Skip to content

Commit

Permalink
Merge pull request #2 from williehwc/state
Browse files Browse the repository at this point in the history
Save/load states
  • Loading branch information
williehwc committed Aug 6, 2018
2 parents aa58bd7 + d5d1b1e commit bb18cd5
Show file tree
Hide file tree
Showing 25 changed files with 719 additions and 111 deletions.
4 changes: 2 additions & 2 deletions wonderdroid/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.atelieryl.wonderdroid"
android:versionCode="45"
android:versionName="2.1.3" >
android:versionCode="46"
android:versionName="2.2" >

<uses-sdk
android:minSdkVersion="10"
Expand Down
24 changes: 20 additions & 4 deletions wonderdroid/jni/wswan/com_atelieryl_wonderdroid_WonderSwan.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 26 additions & 26 deletions wonderdroid/jni/wswan/gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,37 @@
#include "v30mz.h"
#include "rtc.h"

static uint32_t wsMonoPal[16][4];
static uint32_t wsColors[8];
static uint32_t wsCols[16][16];
uint32_t wsMonoPal[16][4];
uint32_t wsColors[8];
uint32_t wsCols[16][16];

static uint16_t ColorMapG[16];
static uint16_t ColorMap[16 * 16 * 16];
uint16_t ColorMapG[16];
uint16_t ColorMap[16 * 16 * 16];
static uint32_t LayerEnabled = 7; // BG, FG, sprites

/*current scanline*/

static uint8_t SpriteTable[0x80][4];
static uint32_t SpriteCountCache;
static uint8_t DispControl;
static uint8_t BGColor;
static uint8_t LineCompare;
static uint8_t SPRBase;
static uint8_t SpriteStart, SpriteCount;
static uint8_t FGBGLoc;
static uint8_t FGx0, FGy0, FGx1, FGy1;
static uint8_t SPRx0, SPRy0, SPRx1, SPRy1;

static uint8_t BGXScroll, BGYScroll;
static uint8_t FGXScroll, FGYScroll;
static uint8_t LCDControl, LCDIcons;

static uint8_t BTimerControl;
static uint16_t HBTimerPeriod;
static uint16_t VBTimerPeriod;

static uint16_t HBCounter, VBCounter;
static uint8_t VideoMode;
uint8_t SpriteTable[0x80][4];
uint32_t SpriteCountCache;
uint8_t DispControl;
uint8_t BGColor;
uint8_t LineCompare;
uint8_t SPRBase;
uint8_t SpriteStart, SpriteCount;
uint8_t FGBGLoc;
uint8_t FGx0, FGy0, FGx1, FGy1;
uint8_t SPRx0, SPRy0, SPRx1, SPRy1;

uint8_t BGXScroll, BGYScroll;
uint8_t FGXScroll, FGYScroll;
uint8_t LCDControl, LCDIcons;

uint8_t BTimerControl;
uint16_t HBTimerPeriod;
uint16_t VBTimerPeriod;

uint16_t HBCounter, VBCounter;
uint8_t VideoMode;

void WSwan_GfxInit(void) {
}
Expand Down
36 changes: 34 additions & 2 deletions wonderdroid/jni/wswan/gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

void WSWan_TCacheInvalidByAddr(uint32_t);

extern uint8_t tiles[256][256][2][8];
extern uint8_t wsTCache[512 * 64]; //tiles cache
extern uint8_t wsTCacheFlipped[512 * 64]; //tiles cache (H flip)
extern uint8_t wsTileRow[8]; //extracted 8 pixels (tile row)
Expand All @@ -16,14 +17,45 @@ extern int wsVMode; //Video Mode

uint8_t wsLine; //current scan line

extern uint32_t wsMonoPal[16][4]; // 256-B
extern uint32_t wsColors[8]; // 32-B
extern uint32_t wsCols[16][16]; //1024-B

void wsMakeTiles(void);
void wsGetTile(uint32_t, uint32_t, int, int, int);
void wsSetVideo(int, bool);

void wsScanline(uint16_t *target);

extern uint32_t dx_r, dx_g, dx_b, dx_sr, dx_sg, dx_sb;
extern uint32_t dx_bits, dx_pitch, cmov, dx_linewidth_blit, dx_buffer_line;
extern uint32_t dx_r, dx_g, dx_b, dx_sr, dx_sg, dx_sb; // 4-B each, 24-B total
extern uint32_t dx_bits, dx_pitch, cmov, dx_linewidth_blit, dx_buffer_line; // 4-B each, 20-B total

extern uint16_t ColorMapG[16]; // 32-B
extern uint16_t ColorMap[16 * 16 * 16]; // 8192-B

/*current scanline*/

extern uint8_t SpriteTable[0x80][4]; // 512-B
extern uint32_t SpriteCountCache; // 4-B
extern uint8_t DispControl;
extern uint8_t BGColor;
extern uint8_t LineCompare;
extern uint8_t SPRBase;
extern uint8_t SpriteStart, SpriteCount; // 2-B total
extern uint8_t FGBGLoc;
extern uint8_t FGx0, FGy0, FGx1, FGy1; // 4-B total
extern uint8_t SPRx0, SPRy0, SPRx1, SPRy1; // 4-B total

extern uint8_t BGXScroll, BGYScroll; // 2-B total
extern uint8_t FGXScroll, FGYScroll; // 2-B total
extern uint8_t LCDControl, LCDIcons; // 2-B total

extern uint8_t BTimerControl;
extern uint16_t HBTimerPeriod; // 2-B
extern uint16_t VBTimerPeriod; // 2-B

extern uint16_t HBCounter, VBCounter; // 2-B each, 4-B total
extern uint8_t VideoMode;

void WSwan_SetPixelFormat();

Expand Down
12 changes: 6 additions & 6 deletions wonderdroid/jni/wswan/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#include "interrupt.h"
#include "v30mz.h"

static uint8_t IStatus;
static uint8_t IEnable;
static uint8_t IVectorBase;
uint8_t IStatus;
uint8_t IEnable;
uint8_t IVectorBase;

static bool IOn_Cache = FALSE;
static uint32_t IOn_Which = 0;
static uint32_t IVector_Cache = 0;
bool IOn_Cache = FALSE;
uint32_t IOn_Which = 0;
uint32_t IVector_Cache = 0;

static void RecalcInterrupt(void) {
IOn_Cache = FALSE;
Expand Down
10 changes: 10 additions & 0 deletions wonderdroid/jni/wswan/interrupt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef __WSWAN_INTERRUPT_H
#define __WSWAN_INTERRUPT_H

#include <stdbool.h>

enum {
WSINT_SERIAL_SEND = 0,
WSINT_KEY_PRESS,
Expand All @@ -19,4 +21,12 @@ void WSwan_InterruptCheck(void);
void WSwan_InterruptReset(void);
void WSwan_InterruptDebugForce(unsigned int level);

extern uint8_t IStatus;
extern uint8_t IEnable;
extern uint8_t IVectorBase;

extern bool IOn_Cache;
extern uint32_t IOn_Which;
extern uint32_t IVector_Cache;

#endif
Loading

0 comments on commit bb18cd5

Please sign in to comment.