summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile41
-rw-r--r--libretro/libretro.cpp3
-rw-r--r--src/input.c191
-rw-r--r--src/main.cpp1709
-rw-r--r--src/menu.c2385
-rw-r--r--src/menu.h380
-rw-r--r--src/menu_header.bmpbin46134 -> 0 bytes
-rw-r--r--src/menu_header.pspbin18587 -> 0 bytes
-rw-r--r--src/os9x_asm_cpu.h1
-rw-r--r--src/osd_disk.c45
-rw-r--r--src/osnes9xgp_asmfunc.S101
-rw-r--r--src/r.txt876
12 files changed, 34 insertions, 5698 deletions
diff --git a/Makefile b/Makefile
index ea1afb1..b487c04 100644
--- a/Makefile
+++ b/Makefile
@@ -27,21 +27,25 @@ else ifeq ($(platform), ps3)
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
+ STATIC_LINKING := 1
else ifeq ($(platform), sncps3)
TARGET := libretro.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
+ STATIC_LINKING := 1
else ifeq ($(platform), xenon)
TARGET := libretro.a
CC = xenon-gcc
AR = xenon-ar
CFLAGS += -D__LIBXENON__ -m32 -D__ppc__
+ STATIC_LINKING := 1
else ifeq ($(platform), wii)
TARGET := libretro.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar
CFLAGS += -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
+ STATIC_LINKING := 1
# CTR (3DS)
else ifeq ($(platform), ctr)
TARGET := $(TARGET_NAME)_libretro_ctr.a
@@ -53,9 +57,8 @@ else ifeq ($(platform), ctr)
CFLAGS += -Wall -mword-relocations
CFLAGS += -fomit-frame-pointer -ffast-math
CFLAGS += -D_3DS
- CFLAGS += -D__GP2X__
PLATFORM_DEFINES := -D_3DS
- STATIC_LINKING = 1
+ STATIC_LINKING := 1
else
TARGET := retro.dll
CC = gcc
@@ -125,6 +128,30 @@ OBJECTS += ./src/rops.o
OBJECTS += ./libretro/libretro.o
OBJECTS += ./libretro/memstream.o
+
+OBJECTS += ./src/os9x_65c816_global.o
+OBJECTS += ./src/os9x_65c816_spcasm.o
+OBJECTS += ./src/os9x_65c816_spcc.o
+
+OBJECTS += ./src/os9x_65c816.o
+
+OBJECTS += ./src/os9x_asm_cpu.o
+
+#CFLAGS += -D__GP2X__
+#CFLAGS += -DASMCPU
+#CFLAGS += -DVAR_CYCLES
+#CFLAGS += -D_C_GW_
+##COPT = -DUSE_SA1
+# -DFAST_LSB_WORD_ACCESS
+#CFLAGS += -ffast-math
+#CFLAGS += -msoft-float
+#CFLAGS += -finline -finline-functions -fexpensive-optimizations
+#CFLAGS += -falign-functions=16 -falign-loops -falign-labels
+#CFLAGS += -falign-jumps
+#CFLAGS += -fomit-frame-pointer
+#CFLAGS += -fstrict-aliasing -mstructure-size-boundary=32 -fweb -fsigned-char -frename-registers
+
+
INCLUDES = -I. -Ilibretro
DEFINES = -DHAVE_STRINGS_H -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DINLINE=inline -DUSE_SA1
@@ -143,15 +170,7 @@ CFLAGS += $(DEFINES) $(COMMON_DEFINES)
all: $(TARGET)
$(TARGET): $(OBJECTS)
-ifeq ($(platform), ps3)
- $(AR) rcs $@ $(OBJECTS)
-else ifeq ($(platform), sncps3)
- $(AR) rcs $@ $(OBJECTS)
-else ifeq ($(platform), xenon)
- $(AR) rcs $@ $(OBJECTS)
-else ifeq ($(platform), wii)
- $(AR) rcs $@ $(OBJECTS)
-else ifeq ($(platform), ctr)
+ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
$(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) -lm
diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp
index 64f5e19..1059682 100644
--- a/libretro/libretro.cpp
+++ b/libretro/libretro.cpp
@@ -23,6 +23,7 @@
#include "../src/soundux.h"
#include "../src/cheats.h"
#include "../src/display.h"
+#include "../src/os9x_asm_cpu.h"
#ifdef _3DS
extern "C" void* linearMemAlign(size_t size, size_t alignment);
@@ -242,6 +243,7 @@ static void snes_init (void)
Settings.ThreadSound = FALSE;
Settings.SoundSync = FALSE;
Settings.asmspc700 = TRUE;
+// Settings.asmspc700 = FALSE;
Settings.SpeedHacks = TRUE;
Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX;
@@ -386,6 +388,7 @@ void retro_run (void)
{
IPPU.RenderThisFrame = TRUE;
S9xMainLoop();
+// asm_S9xMainLoop();
S9xMixSamples(audio_buf, avail);
audio_batch_cb((int16_t *) audio_buf, avail >> 1);
diff --git a/src/input.c b/src/input.c
deleted file mode 100644
index 07063ce..0000000
--- a/src/input.c
+++ /dev/null
@@ -1,191 +0,0 @@
-
-#include "menu.h"
-
-#if defined(__GP2X__)
-#include "usbjoy.h"
-static struct usbjoy *joys[4];
-static char joyCount = 0;
-static int buttonMap[4][32];
-#endif
-
-struct INPUT Inp;
-static int repeatCounter = 0;
-int InputInit()
-{
- memset(&Inp,0,sizeof(Inp));
-#if defined(__GP2X__)
-int i;
- for (i=1; i<5; i++)
- {
- struct usbjoy *joy = joy_open(i);
- if(joy != NULL)
- {
- joys[joyCount] = joy;
- memset(buttonMap[joyCount],0,sizeof(buttonMap[joyCount]));
- buttonMap[joyCount][0] = (1<<INP_BUTTON_A);
- buttonMap[joyCount][1] = (1<<INP_BUTTON_B);
- buttonMap[joyCount][2] = (1<<INP_BUTTON_X);
- buttonMap[joyCount][3] = (1<<INP_BUTTON_Y);
- buttonMap[joyCount][4] = (1<<INP_BUTTON_L);
- buttonMap[joyCount][5] = (1<<INP_BUTTON_R);
- if (joy->numbuttons<10)
- {
- buttonMap[joyCount][6] = (1<<INP_BUTTON_SELECT);
- buttonMap[joyCount][7] = (1<<INP_BUTTON_START);
- }
- else
- {
- buttonMap[joyCount][6] = (1<<INP_BUTTON_L);
- buttonMap[joyCount][7] = (1<<INP_BUTTON_R);
- buttonMap[joyCount][8] = (1<<INP_BUTTON_SELECT);
- buttonMap[joyCount][9] = (1<<INP_BUTTON_START);
- }
- joyCount++;
- }
- }
-#endif
- return 0;
-}
-
-#if defined(__GP2X__)
-int InputClose()
-{
-int i;
- for (i=0; i<joyCount; i++)
- {
- joy_close(joys[i]);
- }
-}
-
-int joy_getButton(int joyNumber)
-{
-unsigned int key=0;
- if (joyNumber<joyCount)
- {
- int i;
- joy_update(joys[joyNumber]);
- if(joy_getaxe(JOYUP, joys[joyNumber])) key|= (1<<INP_BUTTON_UP);
- if(joy_getaxe(JOYDOWN, joys[joyNumber])) key|= (1<<INP_BUTTON_DOWN);
- if(joy_getaxe(JOYLEFT, joys[joyNumber])) key|= (1<<INP_BUTTON_LEFT);
- if(joy_getaxe(JOYRIGHT, joys[joyNumber])) key|= (1<<INP_BUTTON_RIGHT);
- for (i = 0; i < joy_buttons(joys[joyNumber]); i++)
- {
- if (joy_getbutton(i, joys[joyNumber]))
- key|= buttonMap[joyNumber][i];
- }
- }
- return key;
-}
-
-char joy_Count()
-{
- return joyCount;
-}
-#endif
-
-int InputUpdate(int EnableDiagnals)
-{
- int i=0;
- unsigned int key=0;
- // Get input
-#if defined(__GIZ__)
- key=gp_getButton(EnableDiagnals);
- key&= (1<<INP_BUTTON_UP)|
- (1<<INP_BUTTON_LEFT)|
- (1<<INP_BUTTON_DOWN)|
- (1<<INP_BUTTON_RIGHT)|
- (1<<INP_BUTTON_HOME)|
- (1<<INP_BUTTON_VOL)|
- (1<<INP_BUTTON_L)|
- (1<<INP_BUTTON_R)|
- (1<<INP_BUTTON_REWIND)|
- (1<<INP_BUTTON_FORWARD)|
- (1<<INP_BUTTON_PLAY)|
- (1<<INP_BUTTON_STOP)|
- (1<<INP_BUTTON_BRIGHT);
-#endif
-
-#if defined(__GP2X__)
- key=gp_getButton(EnableDiagnals);
- key&= (1<<INP_BUTTON_UP)|
- (1<<INP_BUTTON_LEFT)|
- (1<<INP_BUTTON_DOWN)|
- (1<<INP_BUTTON_RIGHT)|
- (1<<INP_BUTTON_START)|
- (1<<INP_BUTTON_SELECT)|
- (1<<INP_BUTTON_L)|
- (1<<INP_BUTTON_R)|
- (1<<INP_BUTTON_A)|
- (1<<INP_BUTTON_B)|
- (1<<INP_BUTTON_X)|
- (1<<INP_BUTTON_Y)|
- (1<<INP_BUTTON_VOL_UP)|
- (1<<INP_BUTTON_VOL_DOWN)|
- (1<<INP_BUTTON_STICK_PUSH);
- key |= joy_getButton(0);
-#endif
-
-#if defined(__WIZ__)
- key=gp_getButton(EnableDiagnals);
- key&= (1<<INP_BUTTON_UP)|
- (1<<INP_BUTTON_LEFT)|
- (1<<INP_BUTTON_DOWN)|
- (1<<INP_BUTTON_RIGHT)|
-#ifdef __CAANOO__
- (1<<INP_BUTTON_HOME)|
-#endif
- (1<<INP_BUTTON_START)|
- (1<<INP_BUTTON_SELECT)|
- (1<<INP_BUTTON_L)|
- (1<<INP_BUTTON_R)|
- (1<<INP_BUTTON_A)|
- (1<<INP_BUTTON_B)|
- (1<<INP_BUTTON_X)|
- (1<<INP_BUTTON_Y)|
- (1<<INP_BUTTON_VOL_UP)|
- (1<<INP_BUTTON_VOL_DOWN);
-#endif
-
- // Find out how long key was pressed for
- for (i=0;i<32;i++)
- {
- int held=Inp.held[i];
-
- if (key&(1<<i)) held++; else held=0;
-
- //if (held>=0x80) held&=0xbf; // Keep looping around
-
- Inp.held[i]=held;
- }
-
- // Work out some key repeat values:
- for (i=0;i<32;i++)
- {
- char rep=0;
- int held=Inp.held[i];
-
- if (held==1)
- {
- // Key has just been pressed again, so set repeat by default
- rep=1;
- }
- else
- {
- // Now make sure key has been held for a period of time
- // before auto toggling the repeat flag
- if (held>=0x20)
- {
- repeatCounter++;
- if(repeatCounter>15)
- {
- rep=1;
- repeatCounter=0;
- }
- }
- }
-
- Inp.repeat[i]=rep;
- }
-
- return 0;
-}
diff --git a/src/main.cpp b/src/main.cpp
deleted file mode 100644
index c96d679..0000000
--- a/src/main.cpp
+++ /dev/null
@@ -1,1709 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <errno.h>
-#include <zlib.h>
-#include "unzip.h"
-#include "zip.h"
-#include "screenshot.h"
-#include "theme.h"
-
-#ifdef __GIZ__
-#define TIMER_1_SECOND 1000
-#include <unistd.h>
-#include <w32api/GizSdk/FrameworkAudio.h>
-#include "giz_sdk.h"
-#endif
-
-#ifdef __GP2X__
-#define TIMER_1_SECOND 1000000
-#include "gp2x_sdk.h"
-#include "squidgehack.h"
-#endif
-
-#ifdef __WIZ__
-#define TIMER_1_SECOND 1000000
- #ifdef __CAANOO__
- #include "caanoo_sdk.h"
- #else
- #include "wiz_sdk.h"
- #endif
-#include "time.h"
-unsigned short *pOutputScreen;
-#include "sys/resource.h"
-#endif
-
-#include "menu.h"
-#include "snes9x.h"
-#include "memmap.h"
-#include "apu.h"
-#include "gfx.h"
-#include "soundux.h"
-#include "snapshot.h"
-
-#include "disk_img.h"
-#include "config.h"
-
-#define EMUVERSION "SquidgeSNES V0.37 01-Jun-06"
-
-//---------------------------------------------------------------------------
-
-#ifdef __GP2X__
-extern "C" char joy_Count();
-extern "C" int InputClose();
-extern "C" int joy_getButton(int joyNumber);
-#endif
-
-extern "C" uint32 Spc700JumpTab_13;
-extern "C" uint32 Spc700JumpTab_14;
-extern "C" uint32 Spc700JumpTab_15;
-extern "C" uint32 Spc700JumpTab_21;
-
-unsigned char gammatab[10][32]={
- {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
- 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F},
- {0x00,0x01,0x02,0x03,0x04,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,
- 0x11,0x12,0x13,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F},
- {0x00,0x01,0x03,0x04,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,
- 0x12,0x13,0x14,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F},
- {0x00,0x02,0x04,0x06,0x07,0x08,0x09,0x0A,0x0C,0x0D,0x0E,0x0F,0x0F,0x10,0x11,0x12,
- 0x13,0x14,0x15,0x16,0x16,0x17,0x18,0x19,0x19,0x1A,0x1B,0x1C,0x1C,0x1D,0x1E,0x1F},
- {0x00,0x03,0x05,0x07,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,
- 0x14,0x15,0x16,0x17,0x17,0x18,0x19,0x19,0x1A,0x1B,0x1B,0x1C,0x1D,0x1D,0x1E,0x1F},
- {0x00,0x05,0x07,0x09,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x14,0x15,
- 0x16,0x16,0x17,0x18,0x18,0x19,0x1A,0x1A,0x1B,0x1B,0x1C,0x1C,0x1D,0x1D,0x1E,0x1F},
- {0x00,0x07,0x0A,0x0C,0x0D,0x0E,0x10,0x11,0x12,0x12,0x13,0x14,0x15,0x15,0x16,0x17,
- 0x17,0x18,0x18,0x19,0x1A,0x1A,0x1B,0x1B,0x1B,0x1C,0x1C,0x1D,0x1D,0x1E,0x1E,0x1F},
- {0x00,0x0B,0x0D,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x16,0x17,0x17,0x18,0x18,
- 0x19,0x19,0x1A,0x1A,0x1B,0x1B,0x1B,0x1C,0x1C,0x1D,0x1D,0x1D,0x1E,0x1E,0x1E,0x1F},
- {0x00,0x0F,0x11,0x13,0x14,0x15,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1A,0x1A,0x1A,
- 0x1B,0x1B,0x1B,0x1C,0x1C,0x1C,0x1C,0x1D,0x1D,0x1D,0x1D,0x1E,0x1E,0x1E,0x1E,0x1F},
- {0x00,0x15,0x17,0x18,0x19,0x19,0x1A,0x1A,0x1B,0x1B,0x1B,0x1B,0x1C,0x1C,0x1C,0x1C,
- 0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1F}
-};
-
-int32 gp32_fastmode = 1;
-int gp32_8bitmode = 0;
-int32 gp32_ShowSub = 0;
-int gp32_fastsprite = 1;
-int gp32_gammavalue = 0;
-int globexit = 0;
-int sndvolL, sndvolR;
-char fps_display[256];
-int samplecount=0;
-int enterMenu = 0;
-void *currentFrameBuffer;
-int16 oldHeight = 0;
-bool8 ROMAPUEnabled = 0;
-char lastLoadedFile[2048];
-bool lastLoaded = false;
-unsigned short *loadingFB;
-int loadingY;
-static int loadingPrint(char *txt) {
- gp_drawString(20, loadingY, strlen(txt), txt, tTextColorLoading, (unsigned char*)loadingFB);
- loadingY += 8;
-}
-
-static int S9xCompareSDD1IndexEntries (const void *p1, const void *p2)
-{
- return (*(uint32 *) p1 - *(uint32 *) p2);
-}
-
-void S9xExit ()
-{
-}
-void S9xGenerateSound (void)
- {
- S9xMessage (0,0,"generate sound");
- return;
- }
-
-extern "C"
-{
- void S9xSetPalette ()
- {
-
- }
-
- void S9xExtraUsage ()
- {
- }
-
- void S9xParseArg (char **argv, int &index, int argc)
- {
- }
-
- bool8 S9xOpenSnapshotFile (const char *fname, bool8 read_only, STREAM *file)
- {
- if (read_only)
- {
- if (*file = OPEN_STREAM(fname,"rb"))
- return(TRUE);
- }
- else
- {
- if (*file = OPEN_STREAM(fname,"w+b"))
- return(TRUE);
- }
-
- return (FALSE);
- }
-
- void S9xCloseSnapshotFile (STREAM file)
- {
- CLOSE_STREAM(file);
- }
-
- void S9xMessage (int /* type */, int /* number */, const char *message)
- {
- printf ("%s\n", message);
- }
-
- void erk (void)
- {
- S9xMessage (0,0, "Erk!");
- }
-
- char *osd_GetPackDir(void)
- {
- S9xMessage (0,0,"get pack dir");
- return ".";
- }
-
- const char *S9xGetSnapshotDirectory(void)
- {
- S9xMessage (0,0,"get snapshot dir");
- return ".";
- }
-
- void S9xLoadSDD1Data (void)
- {
- char filename [_MAX_PATH + 1];
- char index [_MAX_PATH + 1];
- char data [_MAX_PATH + 1];
- char patch [_MAX_PATH + 1];
- char text[256];
- //FILE *fs = fopen ("data.log", "w");
-
- Settings.SDD1Pack=TRUE;
- Memory.FreeSDD1Data ();
-
- //gp_clearFramebuffer16(framebuffer16[currFB],0x0);
- //sprintf(text,"Loading SDD1 pack...");
- //gp_drawString(0,0,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- //MenuFlip();
- loadingPrint("Loading SDD1 pack...");
- strcpy (filename, romDir);
-
- if (strncmp (Memory.ROMName, "Star Ocean", 10) == 0)
- strcat (filename, "/socnsdd1");
- else
- strcat (filename, "/sfa2sdd1");
-
- DIR *dir = opendir (filename);
-
- index [0] = 0;
- data [0] = 0;
- patch [0] = 0;
-
- //fprintf(fs,"SDD1 data: %s...\n",filename);
- if (dir)
- {
- struct dirent *d;
-
- while ((d = readdir (dir)))
- {
- //fprintf(fs,"File :%s.\n",d->d_name);
- if (strcasecmp (d->d_name, "sdd1gfx.idx") == 0)
- {
- strcpy (index, filename);
- strcat (index, "/");
- strcat (index, d->d_name);
- //fprintf(fs,"File :%s.\n",index);
- }
- else
- if (strcasecmp (d->d_name, "sdd1gfx.dat") == 0)
- {
- strcpy (data, filename);
- strcat (data, "/");
- strcat (data, d->d_name);
- //fprintf(fs,"File :%s.\n",data);
- }
- if (strcasecmp (d->d_name, "sdd1gfx.pat") == 0)
- {
- strcpy (patch, filename);
- strcat (patch, "/");
- strcat (patch, d->d_name);
- }
- }
- closedir (dir);
-
- if (strlen (index) && strlen (data))
- {
- FILE *fs = fopen (index, "rb");
- int len = 0;
-
- if (fs)
- {
- // Index is stored as a sequence of entries, each entry being
- // 12 bytes consisting of:
- // 4 byte key: (24bit address & 0xfffff * 16) | translated block
- // 4 byte ROM offset
- // 4 byte length
- fseek (fs, 0, SEEK_END);
- len = ftell (fs);
- rewind (fs);
- Memory.SDD1Index = (uint8 *) malloc (len);
- fread (Memory.SDD1Index, 1, len, fs);
- fclose (fs);
- Memory.SDD1Entries = len / 12;
-
- if (!(fs = fopen (data, "rb")))
- {
- free ((char *) Memory.SDD1Index);
- Memory.SDD1Index = NULL;
- Memory.SDD1Entries = 0;
- }
- else
- {
- fseek (fs, 0, SEEK_END);
- len = ftell (fs);
- rewind (fs);
- Memory.SDD1Data = (uint8 *) malloc (len);
- fread (Memory.SDD1Data, 1, len, fs);
- fclose (fs);
-
- if (strlen (patch) > 0 &&
- (fs = fopen (patch, "rb")))
- {
- fclose (fs);
- }
- #ifdef MSB_FIRST
- // Swap the byte order of the 32-bit value triplets on
- // MSBFirst machines.
- uint8 *ptr = Memory.SDD1Index;
- for (int i = 0; i < Memory.SDD1Entries; i++, ptr += 12)
- {
- SWAP_DWORD ((*(uint32 *) (ptr + 0)));
- SWAP_DWORD ((*(uint32 *) (ptr + 4)));
- SWAP_DWORD ((*(uint32 *) (ptr + 8)));
- }
- #endif
- qsort (Memory.SDD1Index, Memory.SDD1Entries, 12,
- S9xCompareSDD1IndexEntries);
- }
- }
- Settings.SDD1Pack = FALSE;
- return;
- }
- }
- //fprintf(fs,"Decompressed data pack not found in '%s'\n",filename);
- //fclose(fs);
- //gp_clearFramebuffer16(framebuffer16[currFB],0x0);
- //sprintf(text,"Decompressed data pack not found!");
- //gp_drawString(0,8,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- //MenuFlip();
- loadingPrint("Decompressed data pack not found!");
- loadingPrint("[Press a button to continue]");
- MenuPause();
- }
-
-
-
- bool8_32 S9xInitUpdate ()
- {
- static int needfskip = 0;
-
- currFB++;
- currFB&=3;
-
- if (snesMenuOptions.renderMode != RENDER_MODE_UNSCALED)
- {
-#if defined (__WIZ__)
- if (PPU.ScreenHeight != SNES_HEIGHT_EXTENDED)
- GFX.Screen = (uint8 *) pOutputScreen+ (640*8) + 64;
- else
- GFX.Screen = (uint8 *) pOutputScreen + 64;
-#else
- GFX.Screen = (uint8 *) framebuffer16[currFB];
-#endif
- }
- else if (PPU.ScreenHeight != SNES_HEIGHT_EXTENDED)
- GFX.Screen = (uint8 *) framebuffer16[currFB]+ (640*8) + 64;
- else
- GFX.Screen = (uint8 *) framebuffer16[currFB]+ 64;
-
- return (TRUE);
- }
-
- bool8_32 S9xDeinitUpdate (int Width, int Height, bool8_32)
- {
-#if defined (__WIZ__)
- if ( snesMenuOptions.renderMode == RENDER_MODE_SCALED)
-#else
- if ( snesMenuOptions.renderMode == RENDER_MODE_SCALED && oldHeight!=Height)
-#endif
- {
- gp_video_RGB_setscaling(256,Height);
- oldHeight=Height;
- }
-#if defined (__WIZ__)
- else if ( snesMenuOptions.renderMode == RENDER_MODE_HORIZONTAL_SCALED)
- {
- gp_video_RGB_setHZscaling(256,Height);
- oldHeight=Height;
- }
-#endif
-
-
- if ((CPU.SRAMModified) && (snesMenuOptions.autoSram == 2)) Draw16x16Image(framebuffer16[currFB], 320-16, 240-16, disk_img);
-
-
-
- if (snesMenuOptions.showFps)
- {
- unsigned int *pix;
- pix=(unsigned int*)framebuffer16[currFB];
- for(int i=8;i;i--)
- {
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- *pix++ = 0x0;
- pix+=128;
- }
- gp_setClipping(0, 0, 319, 239);
- gp_drawString(0,0,strlen(fps_display),fps_display,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- }
-
- gp_setFramebuffer(currFB,0);
- }
-
- const char *S9xGetFilename (const char *ex)
- {
- static char filename [PATH_MAX + 1];
- char drive [_MAX_DRIVE + 1];
- char dir [_MAX_DIR + 1];
- char fname [_MAX_FNAME + 1];
- char ext [_MAX_EXT + 1];
-
- _splitpath (Memory.ROMFilename, drive, dir, fname, ext);
- strcpy (filename, S9xGetSnapshotDirectory ());
- strcat (filename, SLASH_STR);
- strcat (filename, fname);
- strcat (filename, ex);
-
- return (filename);
- }
-
-#ifdef __GIZ__
- uint32 S9xReadJoypad (int which1)
- {
- uint32 val=0x80000000;
-
- if (which1 != 0) return val;
- unsigned long joy = gp_getButton(0);
-
- if (joy & (1<<INP_BUTTON_REWIND)) val |= SNES_Y_MASK;
- if (joy & (1<<INP_BUTTON_FORWARD)) val |= SNES_A_MASK;
- if (joy & (1<<INP_BUTTON_PLAY)) val |= SNES_B_MASK;
- if (joy & (1<<INP_BUTTON_STOP)) val |= SNES_X_MASK;
-
- if (joy & (1<<INP_BUTTON_UP)) val |= SNES_UP_MASK;
- if (joy & (1<<INP_BUTTON_DOWN)) val |= SNES_DOWN_MASK;
- if (joy & (1<<INP_BUTTON_LEFT)) val |= SNES_LEFT_MASK;
- if (joy & (1<<INP_BUTTON_RIGHT)) val |= SNES_RIGHT_MASK;
- if (joy & (1<<INP_BUTTON_HOME)) val |= SNES_START_MASK;
- if (joy & (1<<INP_BUTTON_VOL)) val |= SNES_SELECT_MASK;
- if (joy & (1<<INP_BUTTON_L)) val |= SNES_TL_MASK;
- if (joy & (1<<INP_BUTTON_R)) val |= SNES_TR_MASK;
-
- if (joy & (1<<INP_BUTTON_BRIGHT)) enterMenu = 1;
- return val;
- }
-#endif
-
-#ifdef __GP2X__
- uint32 S9xReadJoypad (int which1)
- {
- uint32 val=0x80000000;
- unsigned long joy = 0;
-
- if (which1 == 0)
- {
- joy = gp_getButton(1);
- }
- else if (joy >= joy_Count()) return val;
-
- joy |= joy_getButton(which1++);
-
- if (snesMenuOptions.actionButtons)
- {
- if (joy & (1<<INP_BUTTON_A)) val |= SNES_Y_MASK;
- if (joy & (1<<INP_BUTTON_B)) val |= SNES_A_MASK;
- if (joy & (1<<INP_BUTTON_X)) val |= SNES_B_MASK;
- if (joy & (1<<INP_BUTTON_Y)) val |= SNES_X_MASK;
- }
- else
- {
- if (joy & (1<<INP_BUTTON_A)) val |= SNES_A_MASK;
- if (joy & (1<<INP_BUTTON_B)) val |= SNES_B_MASK;
- if (joy & (1<<INP_BUTTON_X)) val |= SNES_X_MASK;
- if (joy & (1<<INP_BUTTON_Y)) val |= SNES_Y_MASK;
- }
-
- if (joy & (1<<INP_BUTTON_UP)) val |= SNES_UP_MASK;
- if (joy & (1<<INP_BUTTON_DOWN)) val |= SNES_DOWN_MASK;
- if (joy & (1<<INP_BUTTON_LEFT)) val |= SNES_LEFT_MASK;
- if (joy & (1<<INP_BUTTON_RIGHT)) val |= SNES_RIGHT_MASK;
- if (joy & (1<<INP_BUTTON_START)) val |= SNES_START_MASK;
- if (joy & (1<<INP_BUTTON_L)) val |= SNES_TL_MASK;
- if (joy & (1<<INP_BUTTON_R)) val |= SNES_TR_MASK;
-
- if (joy & (1<<INP_BUTTON_SELECT)) val |= SNES_SELECT_MASK;
-
- if ((joy & (1<<INP_BUTTON_VOL_UP)) && (joy & (1<<INP_BUTTON_VOL_DOWN))) enterMenu = 1;
- else if (joy & (1<<INP_BUTTON_VOL_UP))
- {
- snesMenuOptions.volume+=1;
- if(snesMenuOptions.volume>100) snesMenuOptions.volume=100;
- gp_sound_volume(snesMenuOptions.volume,snesMenuOptions.volume);
- }
- else if (joy & (1<<INP_BUTTON_VOL_DOWN))
- {
- snesMenuOptions.volume-=1;
- if(snesMenuOptions.volume>100) snesMenuOptions.volume=0;
- gp_sound_volume(snesMenuOptions.volume,snesMenuOptions.volume);
- }
-
- return val;
- }
-#endif
-
-#ifdef __WIZ__
- uint32 S9xReadJoypad (int which1)
- {
- uint32 val=0x80000000;
- if (which1 != 0) return val;
-
- unsigned long joy = 0;
-
- joy = gp_getButton(1);
-
- if (snesMenuOptions.actionButtons)
- {
- if (joy & (1<<INP_BUTTON_A)) val |= SNES_Y_MASK;
- if (joy & (1<<INP_BUTTON_B)) val |= SNES_A_MASK;
- if (joy & (1<<INP_BUTTON_X)) val |= SNES_B_MASK;
- if (joy & (1<<INP_BUTTON_Y)) val |= SNES_X_MASK;
- }
- else
- {
- if (joy & (1<<INP_BUTTON_A)) val |= SNES_A_MASK;
- if (joy & (1<<INP_BUTTON_B)) val |= SNES_B_MASK;
- if (joy & (1<<INP_BUTTON_X)) val |= SNES_X_MASK;
- if (joy & (1<<INP_BUTTON_Y)) val |= SNES_Y_MASK;
- }
-
- if (joy & (1<<INP_BUTTON_UP)) val |= SNES_UP_MASK;
- if (joy & (1<<INP_BUTTON_DOWN)) val |= SNES_DOWN_MASK;
- if (joy & (1<<INP_BUTTON_LEFT)) val |= SNES_LEFT_MASK;
- if (joy & (1<<INP_BUTTON_RIGHT)) val |= SNES_RIGHT_MASK;
- if (joy & (1<<INP_BUTTON_START)) val |= SNES_START_MASK;
- if (joy & (1<<INP_BUTTON_L)) val |= SNES_TL_MASK;
- if (joy & (1<<INP_BUTTON_R)) val |= SNES_TR_MASK;
-
- if (joy & (1<<INP_BUTTON_SELECT)) val |= SNES_SELECT_MASK;
-
-#ifdef __CAANOO__
- if (joy & (1<<INP_BUTTON_HOME)) enterMenu = 1;
-#else
- if ((joy & (1<<INP_BUTTON_VOL_UP)) && (joy & (1<<INP_BUTTON_VOL_DOWN))) enterMenu = 1;
-#endif
- else if (joy & (1<<INP_BUTTON_VOL_UP))
- {
- snesMenuOptions.volume+=1;
- if(snesMenuOptions.volume>100) snesMenuOptions.volume=100;
- gp_sound_volume(snesMenuOptions.volume,snesMenuOptions.volume);
- }
- else if (joy & (1<<INP_BUTTON_VOL_DOWN))
- {
- snesMenuOptions.volume-=1;
- if(snesMenuOptions.volume>100) snesMenuOptions.volume=0;
- gp_sound_volume(snesMenuOptions.volume,snesMenuOptions.volume);
- }
-
- return val;
- }
-#endif
-
- bool8 S9xReadMousePosition (int /* which1 */, int &/* x */, int & /* y */,
- uint32 & /* buttons */)
- {
- S9xMessage (0,0,"read mouse");
- return (FALSE);
- }
-
- bool8 S9xReadSuperScopePosition (int & /* x */, int & /* y */,
- uint32 & /* buttons */)
- {
- S9xMessage (0,0,"read scope");
- return (FALSE);
- }
-
- const char *S9xGetFilenameInc (const char *e)
- {
- S9xMessage (0,0,"get filename inc");
- return e;
- }
-
- void S9xSyncSpeed(void)
- {
- //S9xMessage (0,0,"sync speed");
- }
-
- const char *S9xBasename (const char *f)
- {
- const char *p;
-
- S9xMessage (0,0,"s9x base name");
-
- if ((p = strrchr (f, '/')) != NULL || (p = strrchr (f, '\\')) != NULL)
- return (p + 1);
-
- return (f);
- }
-
-};
-
-
-void S9xAutoSaveSRAM (void)
-{
- //since I can't sync the data, there is no point in even writing the data
- //out at this point. Instead I'm now saving the data as the users enter the menu.
- //Memory.SaveSRAM (S9xGetFilename (".srm"));
- //sync(); can't sync when emulator is running as it causes delays
-}
-
-void S9xLoadSRAM (void)
-{
- char path[MAX_PATH];
-
- sprintf(path,"%s%s%s",snesSramDir,DIR_SEP,S9xGetFilename (".srm"));
- Memory.LoadSRAM (path);
-}
-
-void S9xSaveSRAM (void)
-{
- char path[MAX_PATH];
-
- if (CPU.SRAMModified)
- {
- sprintf(path,"%s%s%s",snesSramDir,DIR_SEP,S9xGetFilename (".srm"));
- Memory.SaveSRAM (path);
- CPU.SRAMModified = FALSE;
- if (snesMenuOptions.autoSram == 2) {
- Draw16x16Square(framebuffer16[0], 320-16, 240-16, 0, 0, 0);
- Draw16x16Square(framebuffer16[1], 320-16, 240-16, 0, 0, 0);
- Draw16x16Square(framebuffer16[2], 320-16, 240-16, 0, 0, 0);
- Draw16x16Square(framebuffer16[3], 320-16, 240-16, 0, 0, 0);
- }
- sync();
- }
-}
-
-bool JustifierOffscreen(void)
-{
- return false;
-}
-
-void JustifierButtons(uint32& justifiers)
-{
-}
-
-int os9x_findhacks(int game_crc32){
- int i=0,j;
- int _crc32;
- char c;
- char str[256];
- unsigned int size_snesadvance;
- unsigned char *snesadvance;
- FILE *f;
-
- sprintf(str,"%s/snesadvance.dat",currentWorkingDir);
- f=fopen(str,"rb");
- if (!f) return 0;
- fseek(f,0,SEEK_END);
- size_snesadvance=ftell(f);
- fseek(f,0,SEEK_SET);
- snesadvance=(unsigned char*)malloc(size_snesadvance);
- fread(snesadvance,1,size_snesadvance,f);
- fclose(f);
-
- for (;;) {
- //get crc32
- j=i;
- while ((i<size_snesadvance)&&(snesadvance[i]!='|')) i++;
- if (i==size_snesadvance) {free(snesadvance);return 0;}
- //we have (snesadvance[i]=='|')
- //convert crc32 to int
- _crc32=0;
- while (j<i) {
- c=snesadvance[j];
- if ((c>='0')&&(c<='9')) _crc32=(_crc32<<4)|(c-'0');
- else if ((c>='A')&&(c<='F')) _crc32=(_crc32<<4)|(c-'A'+10);
- else if ((c>='a')&&(c<='f')) _crc32=(_crc32<<4)|(c-'a'+10);
- j++;
- }
- if (game_crc32==_crc32) {
- char text[32];
- //gp_clearFramebuffer16(framebuffer16[currFB],0x0);
- //sprintf(text,"Loading speed hacks...");
- //gp_drawString(0,0,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- //MenuFlip();
- loadingPrint("Loading speed hacks...");
- sleep(2);
- //int p=0;
- for (;;) {
- int adr,val;
-
- i++;
- j=i;
- while ((i<size_snesadvance)&&(snesadvance[i]!=0x0D)&&(snesadvance[i]!=',')) {
- if (snesadvance[i]=='|') j=i+1;
- i++;
- }
- if (i==size_snesadvance) {free(snesadvance);return 0;}
- memcpy(str,&snesadvance[j],i-j);
- str[i-j]=0;
- sscanf(str,"%X=%X",&adr,&val);
- //sprintf(str,"read : %X=%X",adr,val);
- //pgPrintAllBG(32,31-p++,0xFFFF,str);
-
- if ((val==0x42)||((val&0xFF00)==0x4200)) {
- if (val&0xFF00) {
- ROM[adr]=(val>>8)&0xFF;
- ROM[adr+1]=val&0xFF;
- } else ROM[adr]=val;
- }
-
- if (snesadvance[i]==0x0D) {free(snesadvance);return 1; }
- }
-
- }
- while ((i<size_snesadvance)&&(snesadvance[i]!=0x0A)) i++;
- if (i==size_snesadvance) {free(snesadvance);return 0;}
- i++; //new line
- }
-}
-
-static int SnesRomLoad()
-{
- char filename[MAX_PATH+1];
- char *fLoad;
- char *cFile;
- int check;
- int x;
- char text[2048];
- FILE *stream=NULL;
-
-
- // get full filename
- if (!lastLoaded) {
- sprintf(filename,"%s%s%s",romDir,DIR_SEP,currentRomFilename);
- fLoad = filename;
- cFile = currentRomFilename;
- }
- else {
- int x;
- x = strlen(lastLoadedFile);
- for (; x > 0; x--)
- if (lastLoadedFile[x] == '/') {
- x++;
- break;
- };
- fLoad = lastLoadedFile;
- cFile = &lastLoadedFile[x];
- strcpy(currentRomFilename, cFile);
- }
-
- //gp_clearFramebuffer16(framebuffer16[currFB],0x0);
- loadingFB = framebuffer16[currFB];
- loadingY = 45;
- gp_setClipping(0, 0, 319, 239);
- gClearScreen(loadingFB, tBackgroundColor);
- if (tBmpLoading != NULL) gDrawBitmap16(loadingFB, 0, 0, tBmpLoading, 0, 0, tBmpLoading->w, tBmpLoading->h);
- gp_setClipping(20, 40, 320 - 20, 240 - 40);
- MenuFlip();
- //sprintf(text,"Loading Rom...");
- //gp_drawString(0,0,strlen(text),text,tTextColorLoading,(unsigned char*)framebuffer16[currFB]);
- loadingPrint("Loading Rom...");
- //x = strlen(cFile);
- //if (x > 40) x = 40;
- //gp_drawString(0,8,x,cFile,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- loadingPrint(cFile);
- S9xReset();
-
- if (!Memory.LoadROM (fLoad))
- {
- //sprintf(text,"Loading ROM...Failed");
- //gp_drawString(0,0,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- //gp_drawString(0,8,x,cFile,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- loadingPrint("Loading ROM...Failed");
- loadingPrint("[Press a button to continue]");
- //sprintf(text, "Press a button to continue.");
- //gp_drawString(0,16,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- //MenuFlip();
- MenuPause();
- return 0;
- }
-
- if (!lastLoaded) setConfigValue(CONFIG_LASTLOADED, filename);
- else lastLoaded = false;
-
- //sprintf(text,"Loading Rom...OK!");
- //gp_drawString(0,0,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- //sprintf(text,"Loading Sram");
- //gp_drawString(0,8,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
- //MenuFlip();
- loadingPrint("Loading ROM...OK!");
- loadingPrint("Loading SRAM...");
-
- //Memory.LoadSRAM (S9xGetFilename (".srm"));
- S9xLoadSRAM();
-
- //auto load default config for this rom if one exists
- loadingPrint("Loading ROM options...");
- if (LoadMenuOptions(snesOptionsDir, currentRomFilename, MENU_OPTIONS_EXT, (char*)&snesMenuOptions, sizeof(snesMenuOptions),0))
- {
- loadingPrint("Not found. Loading global options...");
- //failed to load options for game, so load the default global ones instead
- if (LoadMenuOptions(snesOptionsDir, MENU_OPTIONS_FILENAME, MENU_OPTIONS_EXT, (char*)&snesMenuOptions, sizeof(snesMenuOptions),0))
- {
- //failed to load global options, so use default values
- SnesDefaultMenuOptions();
- }
- }
- if (Settings.SpeedHacks) os9x_findhacks(Memory.CalculatedChecksum);
-
- //gp_clearFramebuffer16(framebuffer16[currFB],0x0);
- gp_setClipping(0, 0, 319, 239);
- return(1);
-}
-
-#ifdef __GIZ__
-static int SegAim()
-{
-
- int aim=FrameworkAudio_GetCurrentBank();
- return aim;
-}
-#endif
-
-#if defined(__GP2X__) || defined(__WIZ__)
-static int SegAim()
-{
- int aim=CurrentSoundBank;
- aim--; if (aim<0) aim+=8;
-
- return aim;
-}
-#endif
-
-
-void _makepath (char *path, const char *, const char *dir,
- const char *fname, const char *ext)
-{
- if (dir && *dir)
- {
- strcpy (path, dir);
- strcat (path, "/");
- }
- else
- *path = 0;
- strcat (path, fname);
- if (ext && *ext)
- {
- strcat (path, ".");
- strcat (path, ext);
- }
-}
-
-void _splitpath (const char *path, char *drive, char *dir, char *fname,
- char *ext)
-{
- *drive = 0;
-
- char *slash = strrchr (path, '/');
- if (!slash)
- slash = strrchr (path, '\\');
-
- char *dot = strrchr (path, '.');
-
- if (dot && slash && dot < slash)
- dot = NULL;
-
- if (!slash)
- {
- strcpy (dir, "");
- strcpy (fname, path);
- if (dot)
- {
- *(fname + (dot - path)) = 0;
- strcpy (ext, dot + 1);
- }
- else
- strcpy (ext, "");
- }
- else
- {
- strcpy (dir, path);
- *(dir + (slash - path)) = 0;
- strcpy (fname, slash + 1);
- if (dot)
- {
- *(fname + (dot - slash) - 1) = 0;
- strcpy (ext, dot + 1);
- }
- else
- strcpy (ext, "");
- }
-}
-
-// save state file I/O
-int (*statef_open)(const char *fname, const char *mode);
-int (*statef_read)(void *p, int l);
-int (*statef_write)(void *p, int l);
-void (*statef_close)();
-static FILE *state_file = 0;
-static char state_filename[MAX_PATH];
-static char *state_mem = NULL;
-static int state_mem_pos = 0;
-static int state_mem_size=0;
-static int state_mode = 0;
-static int open_mode = 0;
-
-int check_zip(char *filename)
-{
- uint8 buf[2];
- FILE *fd = NULL;
- fd = (FILE*)fopen(filename, "rb");
- if(!fd) return (0);
- fread(buf, 1, 2, fd);
- fclose(fd);
- if(memcmp(buf, "PK", 2) == 0) return (1);
- return (0);
-}
-
-static char *load_archive(char *filename, int *file_size)
-{
- int size = 0;
- char *buf = NULL;
- char text[128];
-
- unzFile fd = NULL;
- unz_file_info info;
- int ret = 0;
-
- /* Attempt to open the archive */
- fd = unzOpen(filename);
- if(!fd)
- {
- printf("Failed to open archive\r\n");
- return NULL;
- }
-
- /* Go to first file in archive */
- ret = unzGoToFirstFile(fd);
- if(ret != UNZ_OK)
- {
- printf("Failed to find first file in zip\r\n");
- unzClose(fd);
- return NULL;
- }
-
- ret = unzGetCurrentFileInfo(fd, &info, NULL, 0, NULL, 0, NULL, 0);
- if(ret != UNZ_OK)
- {
- printf("Failed to zip info\r\n");
- unzClose(fd);
- return NULL;
- }
-
- /* Open the file for reading */
- ret = unzOpenCurrentFile(fd);
- if(ret != UNZ_OK)
- {
- printf("Failed to read file\r\n");
- unzClose(fd);
- return NULL;
- }
-
- /* Allocate file data buffer */
- size = info.uncompressed_size;
- buf=(char*)malloc(size);
- if(!buf)
- {
- printf("Failed to malloc zip buffer\r\n");
- unzClose(fd);
- return NULL;
- }
-
- /* Read (decompress) the file */
- ret = unzReadCurrentFile(fd, buf, info.uncompressed_size);
- if(ret != info.uncompressed_size)
- {
- free(buf);
- printf("File failed to uncompress fully\r\n");
- unzCloseCurrentFile(fd);
- unzClose(fd);
- return NULL;
- }
-
- /* Close the current file */
- ret = unzCloseCurrentFile(fd);
- if(ret != UNZ_OK)
- {
- free(buf);
- printf("Failed to close file in zip\r\n");
- unzClose(fd);
- return NULL;
- }
-
- /* Close the archive */
- ret = unzClose(fd);
- if(ret != UNZ_OK)
- {
- free(buf);
- printf("Failed to close zip\r\n");
- return NULL;
- }
-
- /* Update file size and return pointer to file data */
- *file_size = size;
- return buf;
-}
-
-static int save_archive(char *filename, char *buffer, int size)
-{
- uint8 *buf = NULL;
- char text[128]="";
- zipFile fd = NULL;
- int ret = 0;
- fd=zipOpen(filename,0);
- if(!fd)
- {
- printf("Failed to create zip\r\n");
- return (0);
- }
-
- ret=zipOpenNewFileInZip(fd,"SNAPSHOT",
- NULL,
- NULL,0,
- NULL,0,
- NULL,
- Z_DEFLATED,
- Z_BEST_COMPRESSION);
-
- if(ret != ZIP_OK)
- {
- zipClose(fd,NULL);
- printf("Failed to create file in zip\r\n");
- return (0);
- }
-
- ret=zipWriteInFileInZip(fd,buffer,size);
- if(ret != ZIP_OK)
- {
- zipCloseFileInZip(fd);
- zipClose(fd,NULL);
- printf("Failed to write file in zip\r\n");
- return (0);
- }
-
- ret=zipCloseFileInZip(fd);
- if(ret != ZIP_OK)
- {
- zipClose(fd,NULL);
- printf("Failed to close file in zip\r\n");
- return (0);
- }
-
- ret=zipClose(fd,NULL);
- if(ret != ZIP_OK)
- {
- printf("Failed to close zip\r\n");
- return (0);
- }
-
- return(1);
-}
-
-int state_unc_open(const char *fname, const char *mode)
-{
- //mode = "wb" or "rb"
- //If mode is write then create a new buffer to hold written data
- //when file is closed buffer will be compressed to zip file and then freed
- if(mode[0]=='r')
- {
- //Read mode requested
- if(check_zip((char*)fname))
- {
- //File is a zip, so uncompress
- state_mode = 1; //zip mode
- open_mode = 0;
- state_mem=load_archive((char*)fname,&state_mem_size);
- if(!state_mem) return 0;
- state_mem_pos=0;
- strcpy(state_filename,fname);
- return 1;
- }
- else
- {
- state_mode = 0; //normal file mode
- state_file = fopen(fname, mode);
- return (int) state_file;
- }
- }
- else
- {
- //Write mode requested. Zip only option
- open_mode = 1;
- state_mode = 1; //normal file mode
- state_mem=(char*)malloc(200);
- state_mem_size=200;
- state_mem_pos = 0;
- strcpy(state_filename,fname);
- return 1;
- }
-}
-
-int state_unc_read(void *p, int l)
-{
- if(state_mode==0)
- {
- return fread(p, 1, l, state_file);
- }
- else
- {
-
- if((state_mem_pos+l)>state_mem_size)
- {
- //Read requested that exceeded memory limits
- return 0;
- }
- else
- {
- memcpy(p,state_mem+state_mem_pos,l);
- state_mem_pos+=l;
- }
- return l;
- }
-}
-
-int state_unc_write(void *p, int l)
-{
- if(state_mode==0)
- {
- return fwrite(p, 1, l, state_file);
- }
- else
- {
- if((state_mem_pos+l)>state_mem_size)
- {
- printf("realloc\r\n");
- //Write will exceed current buffer, re-alloc buffer and continue
- state_mem=(char*)realloc(state_mem,state_mem_pos+l);
- state_mem_size=state_mem_pos+l;
- }
- //Now do write
- memcpy(state_mem+state_mem_pos,p,l);
- state_mem_pos+=l;
- return l;
- }
-}
-
-void state_unc_close()
-{
- if(state_mode==0)
- {
- fclose(state_file);
- }
- else
- {
- if (open_mode == 1)
- save_archive(state_filename,state_mem,state_mem_size);
- free(state_mem);
- state_mem=NULL;
- state_mem_size=0;
- state_mem_pos=0;
- state_filename[0]=0;
- }
-}
-
-char **g_argv;
-int main(int argc, char *argv[])
-{
- unsigned int i,j = 0;
- unsigned int romrunning = 0;
- int aim=0, done=0, skip=0, Frames=0, fps=0, tick=0,efps=0;
- uint8 *soundbuffer=NULL;
- int Timer=0;
- int action=0;
- int romloaded=0;
- char text[256];
- DIR *d;
-
- g_argv = argv;
-
- // saves
- statef_open = state_unc_open;
- statef_read = state_unc_read;
- statef_write = state_unc_write;
- statef_close = state_unc_close;
-
-
-
- getcwd(currentWorkingDir, MAX_PATH);
- CheckDirSep(currentWorkingDir);
-
- sprintf(snesOptionsDir,"%s%s%s",currentWorkingDir,DIR_SEP,SNES_OPTIONS_DIR);
- sprintf(snesSramDir,"%s%s%s",currentWorkingDir,DIR_SEP,SNES_SRAM_DIR);
- sprintf(snesSaveStateDir,"%s%s%s",currentWorkingDir,DIR_SEP,SNES_SAVESTATE_DIR);
-
-#ifdef __WIZ__
- setpriority (PRIO_PROCESS, 0, -20);
-#endif
-
-
- InputInit(); // clear input context
-
- //ensure dirs exist
- //should really check if these worked but hey whatever
- mkdir(snesOptionsDir,0777);
- mkdir(snesSramDir,0777);
- mkdir(snesSaveStateDir,0777);
-
- printf("Loading global menu options\r\n"); fflush(stdout);
- if (LoadMenuOptions(snesOptionsDir,MENU_OPTIONS_FILENAME,MENU_OPTIONS_EXT,(char*)&snesMenuOptions, sizeof(snesMenuOptions),0))
- {
- // Failed to load menu options so default options
- printf("Failed to load global options, so using defaults\r\n"); fflush(stdout);
- SnesDefaultMenuOptions();
- }
-
- printf("Loading default rom directory\r\n"); fflush(stdout);
- if (LoadMenuOptions(snesOptionsDir,DEFAULT_ROM_DIR_FILENAME,DEFAULT_ROM_DIR_EXT,(char*)snesRomDir, MAX_PATH,0))
- {
- // Failed to load options to default rom directory to current working directory
- printf("Failed to default rom dir, so using current dir\r\n"); fflush(stdout);
- strcpy(snesRomDir,currentWorkingDir);
- }
-
- //Check that rom directory actually exists
- d = opendir(snesRomDir);
- if(d)
- {
- closedir(d);
- }
- else
- {
- //Failed to open Rom directory, so reset to current directory
- strcpy(snesRomDir,currentWorkingDir);
- }
-
- // Init graphics (must be done before MMUHACK)
- gp_initGraphics(16,0,1);
-
-
-
-#ifdef __GP2X__
- if (1)
- {
- printf("Craigs RAM settings are enabled. Now applying settings..."); fflush(stdout);
- // craigix: --trc 6 --tras 4 --twr 1 --tmrd 1 --trfc 1 --trp 2 --trcd 2
- set_RAM_Timings(6, 4, 1, 1, 1, 2, 2);
- printf("Done\r\n"); fflush(stdout);
- }
- else
- {
- printf("Using normal Ram settings.\r\n"); fflush(stdout);
- }
-
- set_gamma(snesMenuOptions.gamma+100);
-#endif
-
- UpdateMenuGraphicsGamma();
-
- // Initialise Snes stuff
- ZeroMemory (&Settings, sizeof (Settings));
-
- Settings.JoystickEnabled = FALSE;
- Settings.SoundPlaybackRate = 22050;
- Settings.Stereo = FALSE;
- Settings.SoundBufferSize = 0;
- Settings.CyclesPercentage = 100;
- Settings.DisableSoundEcho = FALSE;
- Settings.APUEnabled = FALSE;
- Settings.H_Max = SNES_CYCLES_PER_SCANLINE;
- Settings.SkipFrames = AUTO_FRAMERATE;
- Settings.Shutdown = Settings.ShutdownMaster = TRUE;
- Settings.FrameTimePAL = 20000;
- Settings.FrameTimeNTSC = 16667;
- Settings.FrameTime = Settings.FrameTimeNTSC;
- Settings.DisableSampleCaching = FALSE;
- Settings.DisableMasterVolume = FALSE;
- Settings.Mouse = FALSE;
- Settings.SuperScope = FALSE;
- Settings.MultiPlayer5 = FALSE;
- // Settings.ControllerOption = SNES_MULTIPLAYER5;
- Settings.ControllerOption = 0;
-
- Settings.ForceTransparency = FALSE;
- Settings.Transparency = FALSE;
- Settings.SixteenBit = TRUE;
-
- Settings.SupportHiRes = FALSE;
- Settings.NetPlay = FALSE;
- Settings.ServerName [0] = 0;
- Settings.AutoSaveDelay = 30;
- Settings.ApplyCheats = FALSE;
- Settings.TurboMode = FALSE;
- Settings.TurboSkipFrames = 15;
- Settings.ThreadSound = FALSE;
- Settings.SoundSync = FALSE;
- Settings.asmspc700 = TRUE;
- Settings.SpeedHacks = TRUE;
-
- //Settings.NoPatch = true;
-
- //initScreenShots();
-
- GFX.Screen = (uint8 *) framebuffer16[currFB];
-#if defined(__WIZ__) || defined(__GP2X__)
- GFX.SubScreen = (uint8 *)malloc(GFX_PITCH * 240 * 2);
- GFX.ZBuffer = (uint8 *)malloc(0x13000*2);
- GFX.SubZBuffer = GFX.ZBuffer + ZDELTA;
- //GFX.ZBuffer = (uint8 *)malloc(320 * 240);
- //GFX.SubZBuffer = (uint8 *)malloc(320 * 240);
- GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;
-#else
- GFX.SubScreen = (uint8 *)malloc(GFX_PITCH * 480 * 2);
- GFX.ZBuffer = (uint8 *)malloc(GFX_PITCH * 480 * 2);
- GFX.SubZBuffer = (uint8 *)malloc(GFX_PITCH * 480 * 2);
- GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;
-#endif
-
-#if defined(__WIZ__)
- pOutputScreen = NULL;
- pOutputScreen = (uint16 *)malloc(320*240*2);
-#endif
-
- if (Settings.ForceNoTransparency)
- Settings.Transparency = FALSE;
-
- if (Settings.Transparency)
- Settings.SixteenBit = TRUE;
-
- Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX;
-
- if (!Memory.Init () || !S9xInitAPU())
- erk();
-
- S9xInitSound ();
-
- //S9xSetRenderPixelFormat (RGB565);
- S9xSetSoundMute (TRUE);
-
- if (!S9xGraphicsInit ())
- erk();
-
- // Look for last loaded game
- if (snesMenuOptions.loadOnInit == 1) {
- getConfigValue(CONFIG_LASTLOADED, lastLoadedFile, sizeof(lastLoadedFile)-1) ;
- action = EVENT_LOAD_SNES_ROM;
- lastLoaded = true;
- }
-
- while (1)
- {
- S9xSetSoundMute (TRUE);
-
- if (!lastLoaded) {
- getScreenShot(framebuffer16[prevFB]);
- initTheme();
- action=MainMenu(action);
- destroyScreenShot();
- }
-
- //gp_clearFramebuffer16(framebuffer16[currFB],0x0);
- if (action==EVENT_EXIT_APP) break;
-
- if (action==EVENT_LOAD_SNES_ROM)
- {
- // user wants to load a rom
- Settings.SpeedHacks = snesMenuOptions.SpeedHacks;
- gp_setCpuspeed(MENU_FAST_CPU_SPEED);
- romloaded=SnesRomLoad();
- gp_setCpuspeed(MENU_CPU_SPEED);
- if(romloaded)
- {
- action=EVENT_RUN_SNES_ROM; // rom loaded okay so continue with emulation
- }
- else
- action=0; // rom failed to load so return to menu
- }
-
- if (action==EVENT_RESET_SNES_ROM)
- {
- // user wants to reset current game
- Settings.asmspc700 = snesMenuOptions.asmspc700;
- Settings.SpeedHacks = snesMenuOptions.SpeedHacks;
- S9xReset();
- action=EVENT_RUN_SNES_ROM;
- }
-
- if (action==EVENT_RUN_SNES_ROM)
- {
-#ifdef __WIZ__
- // scaling ?
- if (snesMenuOptions.renderMode == RENDER_MODE_UNSCALED) {
- if (pOutputScreen) {
- free(pOutputScreen);
- pOutputScreen = NULL;
- }
- } else {
- if (!pOutputScreen) {
- pOutputScreen = (uint16 *)malloc(320*240*2);
- if (!pOutputScreen) snesMenuOptions.renderMode == RENDER_MODE_UNSCALED;
- }
- }
-#endif
- // any change in configuration?
- gp_setCpuspeed(cpuSpeedLookup[snesMenuOptions.cpuSpeed]);
- gp_clearFramebuffer16(framebuffer16[0], tBackgroundColor);
- gp_clearFramebuffer16(framebuffer16[1], tBackgroundColor);
- gp_clearFramebuffer16(framebuffer16[2], tBackgroundColor);
- gp_clearFramebuffer16(framebuffer16[3], tBackgroundColor);
- if (tBmpInGame) {
- gDrawBitmap16(framebuffer16[0], 0, 0, tBmpInGame, 0, 0, tBmpInGame->w, tBmpInGame->h);
- gDrawBitmap16(framebuffer16[1], 0, 0, tBmpInGame, 0, 0, tBmpInGame->w, tBmpInGame->h);
- gDrawBitmap16(framebuffer16[2], 0, 0, tBmpInGame, 0, 0, tBmpInGame->w, tBmpInGame->h);
- gDrawBitmap16(framebuffer16[3], 0, 0, tBmpInGame, 0, 0, tBmpInGame->w, tBmpInGame->h);
- }
- destroyTheme();
-
- // Set APU speed
- switch (IAPU.OneCycle) {
- case 13:
- IAPU.asmJumpTab = &Spc700JumpTab_13;
- break;
- case 14:
- IAPU.asmJumpTab = &Spc700JumpTab_14;
- break;
- //default:
- case 15:
- IAPU.asmJumpTab = &Spc700JumpTab_15;
- break;
- default:
- case 21:
- IAPU.asmJumpTab = &Spc700JumpTab_21;
- break;
- }
-
-#ifdef ASMCPU
- CPU.DSPGet = (void *)GetDSP;
- CPU.DSPSet = (void *)SetDSP;
-#endif
-
- Settings.os9x_hack = snesMenuOptions.graphHacks;
- if (snesMenuOptions.transparency)
- {
- Settings.Transparency = TRUE;
- Settings.SixteenBit = TRUE;
- }
- else
- {
- Settings.Transparency = FALSE;
- Settings.SixteenBit = TRUE;
- }
-
- //SelectUpdateScreen();
- switch (snesMenuOptions.region)
- {
- case 0:
- Settings.ForceNTSC = Settings.ForcePAL = FALSE;
- if (Memory.HiROM)
- // Country code
- Settings.PAL = ROM [0xffd9] >= 2;
- else
- Settings.PAL = ROM [0x7fd9] >= 2;
- break;
- case 1:
- Settings.ForceNTSC = TRUE;
- Settings.PAL = Settings.ForcePAL= FALSE;
- break;
- case 2:
- Settings.ForceNTSC = FALSE;
- Settings.PAL = Settings.ForcePAL= TRUE;
- break;
- }
- Settings.FrameTime = Settings.PAL?Settings.FrameTimePAL:Settings.FrameTimeNTSC;
- Memory.ROMFramesPerSecond = Settings.PAL?50:60;
-
- oldHeight = 0;
-
- if (!S9xGraphicsInit ())
- erk();
-
- if (snesMenuOptions.soundOn)
- {
- unsigned int frame_limit = (Settings.PAL?50:60);
- gp32_fastmode = 1;
- gp32_8bitmode = 0;
- gp32_ShowSub = 0;
- gp32_fastsprite = 1;
- gp32_gammavalue = snesMenuOptions.gamma;
- Settings.asmspc700 = snesMenuOptions.asmspc700;
- if (snesMenuOptions.soundHack)
- CPU.APU_APUExecuting = Settings.APUEnabled = 3;
- else
- {
- CPU.APU_APUExecuting = Settings.APUEnabled = 1;
- }
- Settings.SoundPlaybackRate=(unsigned int)soundRates[snesMenuOptions.soundRate];
- Settings.SixteenBitSound=true;
- Settings.Stereo=snesMenuOptions.stereo;
- samplecount=Settings.SoundPlaybackRate/frame_limit;
- if (Settings.Stereo)
- samplecount = samplecount * 2;
- gp_initSound(Settings.SoundPlaybackRate,16,Settings.Stereo,frame_limit,0x0002000F);
- so.stereo = Settings.Stereo;
- so.playback_rate = Settings.SoundPlaybackRate;
- S9xSetPlaybackRate(so.playback_rate);
- S9xSetSoundMute (FALSE);
-#if defined(__GP2X__) || defined(__WIZ__)
- SoundThreadFlag = SOUND_THREAD_SOUND_ON;
-#endif
- gp_sound_volume(snesMenuOptions.volume,snesMenuOptions.volume);
-
- while (1)
- {
- for (i=10;i;i--)
- {
- Timer=gp_timer_read();
- if(Timer-tick>TIMER_1_SECOND)
- {
- fps=Frames;
- Frames=0;
- tick=Timer;
- sprintf(fps_display,"Fps: %2d",fps);
- }
- else if (Timer<tick)
- {
- // should never happen but I'm seeing problems where the FPS stops updating
- tick=Timer; // start timeing again, maybe Timer value has wrapped around?
- }
-
- aim=SegAim();
- if (done!=aim)
- {
- //We need to render more audio:
-#ifdef __GIZ__
- soundbuffer=(uint8 *)FrameworkAudio_GetAudioBank(done);
-#endif
-#if defined(__GP2X__) || defined(__WIZ__)
- soundbuffer=(uint8 *)pOutput[done];
-#endif
- done++; if (done>=8) done=0;
- if(snesMenuOptions.frameSkip==0)
- {
-#if defined(__GIZ__)
- int aim1;
- int aim2;
- int aim3;
- aim1=aim-1;
- if(aim1<0) aim1+=7;
- aim2=aim-2;
- if(aim2<0) aim2+=7;
- aim3=aim-3;
- if(aim3<0) aim3+=7;
- //If we start to get to slow the audio buffer will start
- //to catch us up. So we need to skip frames in order to
- //catch up the real time rendering
- if(
- (done==aim) || // we up right up to speed to render frame
- (done==aim1) || // we are 1 bank behind so still okay
- (done==aim2) || // we are 2 banks behind so just about ok
- (done==aim3) // we are 3 banks behind so getting dodgy
- )
- {
- IPPU.RenderThisFrame=TRUE; // Render last frame
- Frames++;
- }
-
-#endif
-#if defined(__GP2X__) || defined(__WIZ__)
- if ((done==aim))
- {
- IPPU.RenderThisFrame=TRUE; // Render last frame
- Frames++;
- }
-#endif
- else IPPU.RenderThisFrame=FALSE;
- }
- else
- {
- if (skip)
- {
- IPPU.RenderThisFrame=FALSE;
- skip--;
- }
- else
- {
- IPPU.RenderThisFrame=TRUE;
- Frames++;
- skip=snesMenuOptions.frameSkip-1;
- }
- }
- S9xMainLoop ();
- S9xMixSamples((short*)soundbuffer, samplecount);
- }
- if (done==aim) break; // Up to date now
- }
-#if defined (__GP2X__) || defined(__WIZ__)
- done=aim; // Make sure up to date
-#endif
- // need some way to exit menu
- if (enterMenu)
- break;
- }
- enterMenu=0;
- gp_stopSound();
- }
- else
- {
- int quit=0,ticks=0,now=0,done=0,i=0;
- int tick=0,fps=0;
- unsigned int frame_limit = (Settings.PAL?50:60);
- unsigned int frametime=TIMER_1_SECOND/frame_limit;
- CPU.APU_APUExecuting = Settings.APUEnabled = 0;
- S9xSetSoundMute (TRUE);
- Timer=0;
- Frames=0;
- while (1)
- {
- Timer=gp_timer_read()/frametime;
- if(Timer-tick>frame_limit)
- {
- fps=Frames;
- Frames=0;
- tick=Timer;
- sprintf(fps_display,"Fps: %2d",fps);
- }
- else if (Timer<tick)
- {
- // should never happen but I'm seeing problems where the FPS stops updating
- tick=Timer; // start timeing again, maybe Timer value has wrapped around?
- }
-
- now=Timer;
- ticks=now-done;
-
- if(ticks<1) continue;
- if(snesMenuOptions.frameSkip==0)
- {
- if(ticks>10) ticks=10;
- for (i=0; i<ticks-1; i++)
- {
- IPPU.RenderThisFrame=FALSE; // Render last frame
- S9xMainLoop ();
- }
- if(ticks>=1)
- {
- IPPU.RenderThisFrame=TRUE; // Render last frame
- Frames++;
- S9xMainLoop ();
- }
- }
- else
- {
- if(ticks>(snesMenuOptions.frameSkip-1)) ticks=snesMenuOptions.frameSkip-1;
- for (i=0; i<ticks-1; i++)
- {
- IPPU.RenderThisFrame=FALSE; // Render last frame
- S9xMainLoop ();
- }
- if(ticks>=1)
- {
- IPPU.RenderThisFrame=TRUE; // Render last frame
- Frames++;
- S9xMainLoop ();
- }
- }
-
- done=now;
-
- // need some way to exit menu
- if (enterMenu)
- break;
- }
- enterMenu=0;
- }
-
- if (snesMenuOptions.autoSram)
- {
- S9xSaveSRAM();
- }
- }
- }
- set_gamma(100);
-
- //deinitScreenShots();
- destroyTheme();
-
- free(GFX.SubScreen);
- free(GFX.ZBuffer);
-#ifndef __WIZ__
- free(GFX.SubZBuffer);
-#endif
-
-#if defined(__WIZ__)
- if (pOutputScreen) free(pOutputScreen);
-#endif
-#if defined(__GP2X__)
- InputClose();
-#endif
- gp_Reset();
- return 0;
-}
diff --git a/src/menu.c b/src/menu.c
deleted file mode 100644
index 1908323..0000000
--- a/src/menu.c
+++ /dev/null
@@ -1,2385 +0,0 @@
-#include "menu.h"
-#include "theme.h"
-#include "config.h"
-#include "screenshot.h"
-#include "graphics.h"
-#include "png.h"
-
-#define MENU_AREA_Y_START 50
-#define MENU_AREA_Y_END 227
-
-#define PPU_IGNORE_FIXEDCOLCHANGES (1<<0)
-#define PPU_IGNORE_WINDOW (1<<1)
-#define PPU_IGNORE_ADDSUB (1<<2)
-#define PPU_IGNORE_PALWRITE (1<<3)
-#define GFX_IGNORE_OBJ (1<<4)
-#define GFX_IGNORE_BG0 (1<<5)
-#define GFX_IGNORE_BG1 (1<<6)
-#define GFX_IGNORE_BG2 (1<<7)
-#define GFX_IGNORE_BG3 (1<<8)
-
-char romDir[MAX_PATH+1];
-char snesRomDir[MAX_PATH+1];
-
-#define ROM_SELECTOR_DEFAULT_FOCUS 3
-
-DIRDATA dir;
-
-#if defined (__GP2X__)
-unsigned short cpuSpeedLookup[46]={
- 10,20, 30, 40, 50,
- 60,70, 80, 90,100,
- 110,120,130,144,150,
- 160,170,180,190,200,
- 210,220,230,240,250,
- 255,260,265,270,275,
- 280,285,290,295,300,
- 305,310,315,320,325,
- 330,335,340,345,350,
- 355};
-#endif
-
-#if defined (__WIZ__)
-unsigned short cpuSpeedLookup[46]={
- 200,250, 300, 350, 400,
- 450,500, 520, 540,560,
- 580,590,600,610,620,
- 630,640,650,660,670,
- 680,690,700,710,720,
- 730,740,750,760,770,
- 780,790,800,810,820,
- 830,840,850,860,870,
- 875,880,885,890,895,
- 900};
-#endif
-
-extern volatile int timer;
-static int menutileXscroll=0;
-static int menutileYscroll=0;
-static int headerDone[4]; // variable that records if header graphics have been rendered or not
-int quickSavePresent=0;
-struct ROM_LIST_RECORD
-{
- char filename[MAX_PATH+1];
- char type;
-};
-
-static struct ROM_LIST_RECORD romList[MAX_ROMS];
-struct SNES_MENU_OPTIONS snesMenuOptions;
-
-static int romCount;
-char currentRomFilename[MAX_PATH+1]="";
-int currFB=0;
-int prevFB=0;
-int currentEmuMode=EMU_MODE_SNES;
-
-char currentWorkingDir[MAX_PATH+1];
-char snesOptionsDir[MAX_PATH+1];
-char snesSramDir[MAX_PATH+1];
-char snesSaveStateDir[MAX_PATH+1];
-#if defined(__WIZ__)
-float soundRates[3]={22050.0,32000.0,44100.0};
-#else
-float soundRates[5]={8000.0,11025.0,16000.0,22050.0,44100.0};
-#endif
-char menutext[256][50];
-
-struct SAVE_STATE saveState[10]; // holds the filenames for the savestate and "inuse" flags
-char saveStateName[MAX_PATH+MAX_PATH+2]; // holds the last filename to be scanned for save states
-
-// a few vars for persistent file selector
-int lastSelected = -1;
-int defaultDir;
-
-unsigned char gammaConv[32*29]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 0, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 29, 30, 31,
- 0, 3, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31,
- 0, 4, 6, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 30, 31,
- 0, 6, 8, 10, 11, 12, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31,
- 0, 7, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31,
- 0, 8, 10, 12, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 31, 31,
- 0, 9, 11, 13, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 31, 31,
- 0, 10, 12, 14, 16, 17, 18, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31,
- 0, 11, 13, 15, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31,
- 0, 12, 14, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31,
- 0, 12, 15, 17, 18, 19, 20, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31,
- 0, 13, 16, 17, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31,
- 0, 14, 16, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31,
- 0, 14, 17, 18, 20, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31,
- 0, 15, 17, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31,
- 0, 16, 18, 19, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31,
- 0, 16, 18, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31,
- 0, 17, 19, 20, 21, 22, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31,
- 0, 17, 19, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31,
- 0, 17, 20, 21, 22, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31,
- 0, 18, 20, 21, 22, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31,
- 0, 18, 20, 22, 23, 23, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31,
- 0, 19, 21, 22, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31,
- 0, 19, 21, 22, 23, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31,
- 0, 19, 21, 22, 23, 24, 25, 25, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31,
- 0, 20, 22, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31,
- 0, 20, 22, 23, 24, 24, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31,
- 0, 20, 22, 23, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31};
-
-
-void InitMenu(void) {
-
-}
-
-void UpdateMenuGraphicsGamma(void)
-{
- unsigned int currPix=0;
- unsigned short pixel=0;
- unsigned char R,G,B;
- for(currPix=0;currPix<15360;currPix++)
- {
- // md 0000 bbb0 ggg0 rrr0
- // gp rrrr rggg ggbb bbbi
- pixel=menuHeaderOrig[currPix];
- R=(pixel>>11)&0x1F; // 0000 0RRR - 3 bits Red
- G=(pixel>>6)&0x1F;
- B=(pixel>>1)&0x1F;
-
- // Do gamma correction
- R=gammaConv[R+(0<<5)];
- G=gammaConv[G+(0<<5)];
- B=gammaConv[B+(0<<5)];
-
- pixel=MENU_RGB(R,G,B);
- menuHeader[currPix]=pixel;
- }
- for(currPix=0;currPix<5120;currPix++)
- {
- // md 0000 bbb0 ggg0 rrr0
- // gp rrrr rggg ggbb bbbi
- pixel=highLightBarOrig[currPix];
- R=(pixel>>11)&0x1F; // 0000 0RRR - 3 bits Red
- G=(pixel>>6)&0x1F;
- B=(pixel>>1)&0x1F;
-
- // Do gamma correction
- R=gammaConv[R+(0<<5)];
- G=gammaConv[G+(0<<5)];
- B=gammaConv[B+(0<<5)];
-
- pixel=MENU_RGB(R,G,B);
- highLightBar[currPix]=pixel;
-
- }
-
- for(currPix=0;currPix<(MENU_TILE_WIDTH*MENU_TILE_HEIGHT);currPix++)
- {
- // md 0000 bbb0 ggg0 rrr0
- // gp rrrr rggg ggbb bbbi
- pixel=menuTileOrig[currPix];
- R=(pixel>>11)&0x1F; // 0000 0RRR - 3 bits Red
- G=(pixel>>6)&0x1F;
- B=(pixel>>1)&0x1F;
-
- // Do gamma correction
- R=gammaConv[R+(0<<5)];
- G=gammaConv[G+(0<<5)];
- B=gammaConv[B+(0<<5)];
-
- pixel=MENU_RGB(R,G,B);
- menuTile[currPix]=pixel;
-
- }
-}
-
-void SnesDefaultMenuOptions(void)
-{
- // no options file loaded, so set to defaults
- snesMenuOptions.menuVer=SNES_OPTIONS_VER;
- snesMenuOptions.frameSkip=0;
- snesMenuOptions.soundOn = 1;
- snesMenuOptions.volume=100;
- memset(snesMenuOptions.padConfig,0xFF,sizeof(snesMenuOptions.padConfig));
- snesMenuOptions.showFps=1;
- snesMenuOptions.gamma=0;
- snesMenuOptions.asmspc700=1;
- snesMenuOptions.SpeedHacks=1;
-#if defined(__WIZ__)
- snesMenuOptions.soundRate=0;
- snesMenuOptions.cpuSpeed=8;
-#else
- snesMenuOptions.soundRate=2;
- snesMenuOptions.cpuSpeed=19;
-#endif
- snesMenuOptions.loadOnInit = 0;
- snesMenuOptions.delayedRasterFX = 1;
-}
-
-static void ShowMessage(char *text, int showMessage) {
- if (showMessage) {
- gp_setClipping(0, 0, 310, 239);
- PrintBar(prevFB,240-16);
- gp_drawString(40,228,strlen(text),text,tTextColorFocus,framebuffer16[prevFB]);
- }
-}
-
-int LoadMenuOptions(char *path, char *filename, char *ext, char *optionsmem, int maxsize, int showMessage)
-{
- char fullFilename[MAX_PATH+MAX_PATH+1];
- char _filename[MAX_PATH+1];
- char _ext[MAX_PATH+1];
- FILE *stream;
- int size=0;
- char text[50];
-
- ShowMessage("Loading...", showMessage);
-
- SplitFilename(filename, _filename, _ext);
- sprintf(fullFilename,"%s%s%s.%s",path,DIR_SEP,_filename,ext);
- stream=fopen(fullFilename,"rb");
- if(stream)
- {
- // File exists do try to load it
- fseek(stream,0,SEEK_END);
- size=ftell(stream);
- if (size>maxsize) size=maxsize;
- fseek(stream,0,SEEK_SET);
- fread(optionsmem, 1, size, stream);
- fclose(stream);
- return(0);
- }
- else
- {
- return(1);
- }
-}
-
-int SaveMenuOptions(char *path, char *filename, char *ext, char *optionsmem, int maxsize, int showMessage)
-{
- char fullFilename[MAX_PATH+MAX_PATH+1];
- char _filename[MAX_PATH+1];
- char _ext[MAX_PATH+1];
- FILE *stream;
- char text[50];
-
- ShowMessage("Saving...", showMessage);
-
- SplitFilename(filename, _filename, _ext);
- sprintf(fullFilename,"%s%s%s.%s",path,DIR_SEP,_filename,ext);
- stream=fopen(fullFilename,"wb");
- if(stream)
- {
- fwrite(optionsmem, 1, maxsize, stream);
- fclose(stream);
- sync();
- return(0);
- }
- else
- {
- return(1);
- }
-}
-
-int DeleteMenuOptions(char *path, char *filename, char *ext, int showMessage)
-{
- char fullFilename[MAX_PATH+MAX_PATH+1];
- char _filename[MAX_PATH+1];
- char _ext[MAX_PATH+1];
- char text[50];
-
- ShowMessage("Deleting...", showMessage);
-
- SplitFilename(filename, _filename, _ext);
- sprintf(fullFilename,"%s%s%s.%s",path,DIR_SEP,_filename,ext);
- remove(fullFilename);
- sync();
- return(0);
-}
-
-#ifdef __GIZ__
-void sync(void)
-{
-}
-#endif
-
-static void WaitForButtonsUp(void)
-{
- int i=0,j=0,z=0;
-
- for(i=0;i<100;i++)
- {
- while(1)
- {
- InputUpdate(0);
- z=0;
- for (j=0;j<32;j++)
- {
- if (Inp.held[j]) z=1;
- }
- if (z==0) break;
- }
- }
-}
-
-void MenuPause()
-{
- int i=0,j=0,z=0;
- // wait for keys to be released
- for(i=0;i<100;i++) // deal with keybounce by checking a few times
- {
- while(1)
- {
- InputUpdate(0);
- z=0;
- for (j=0;j<32;j++)
- {
- if (Inp.held[j]) z=1;
- }
- if (z==0) break;
- }
- }
-
- for(i=0;i<100;i++) // deal with keybounce by checking a few times
- {
- while(1)
- {
- InputUpdate(0);
- z=0;
- for (j=0;j<32;j++)
- {
- if (Inp.held[j]) z=1;
- }
- if (z==1) break;
- }
- }
-}
-#if defined (__GP2X__) || defined(__WIZ__)
-void MenuFlip()
-{
- prevFB=currFB;
- gp_setFramebuffer(currFB,1);
- currFB++;
- currFB&=3;
-}
-#endif
-#if defined (__GIZ__)
-void MenuFlip()
-{
- prevFB=currFB=0;
- gp_setFramebuffer(currFB,0);
-}
-#endif
-void SplitFilename(char *wholeFilename, char *filename, char *ext)
-{
- int len=strlen(wholeFilename);
- int i=0,y=-1;
-
- ext[0]=0;
- filename[0]=0;
- //Check given string is not null
- if (len<=0)
- {
- return;
- }
- y=-1;
- for(i=len-2;i>0;i--)
- {
- if (wholeFilename[i]=='.')
- {
- y=i;
- break;
- }
- }
-
- if (y>=0)
- {
- memcpy(filename,wholeFilename,y);
- filename[y]=0; // change "." to zero to end string
- memcpy(ext,wholeFilename+y+1,len-(y+1));
- //ext[len-(y+1)+1]=0;
- ext[len-(y+1)]=0;
- }
- else
- {
- strcpy(filename,wholeFilename);
- }
-}
-
-//Ensures all directory seperators are valid for system
-void CheckDirSep(char *path)
-{
- int i=0;
- char dirSepBad[2]={DIR_SEP_BAD};
- char dirSep[2]={DIR_SEP};
- for(i=0;i<strlen(path);i++)
- {
- if(path[i] == dirSepBad[0]) path[i]=dirSep[0];
- }
-}
-
-
-int MenuMessageBox(char *message1,char *message2,char *message3,int mode)
-{
- int select=0;
- int subaction=-1;
- int len=0;
- while(subaction==-1)
- {
- InputUpdate(0);
- if (Inp.repeat[INP_BUTTON_UP])
- {
- select^=1; // Up
- }
- if (Inp.repeat[INP_BUTTON_DOWN])
- {
- select^=1; // Down
- }
- if ((Inp.held[INP_BUTTON_MENU_SELECT]==1) || (Inp.held[INP_BUTTON_MENU_CANCEL]==1))
- {
- subaction=select;
- }
- PrintTile(currFB);
- PrintTitle(currFB);
- len=strlen(message1);
- if(len>39)len=39;
- gp_drawString(8,50,len,message1,tTextColorItem,framebuffer16[currFB]);
- len=strlen(message2);
- if(len>39)len=39;
- gp_drawString(8,60,len,message2,tTextColorItem,framebuffer16[currFB]);
- len=strlen(message3);
- if(len>39)len=39;
- gp_drawString(8,70,len,message3,tTextColorItem,framebuffer16[currFB]);
- switch(mode)
- {
- case 0: // yes no input
- if(select==0)
- {
- PrintBar(currFB, 120-4);
- gp_drawString(8,120,3,"YES",tTextColorFocus,framebuffer16[currFB]);
- gp_drawString(8,140,2,"NO",tTextColorItem,framebuffer16[currFB]);
- }
- else
- {
- PrintBar(currFB, 140-4);
- gp_drawString(8,120,3,"YES",tTextColorItem,framebuffer16[currFB]);
- gp_drawString(8,140,2,"NO",tTextColorFocus,framebuffer16[currFB]);
-
- }
- break;
- }
- MenuFlip();
- }
- return(subaction);
-}
-
-static
-int deleterom(int romindex)
-{
- char text[MAX_PATH+1];
- char fullfilename[MAX_PATH+MAX_PATH+1];
- int x;
- FILE *stream=NULL;
-
- PrintTile(currFB);
- PrintTitle(currFB);
- MenuFlip();
-
- sprintf(text,"Deleting Rom..");
- gp_drawString(8,50,strlen(text),text,tTextColorItem,framebuffer16[prevFB]);
-
- sprintf(text,"%s",romList[romindex].filename);
- x=strlen(text);
- if(x>40) x=40;
- gp_drawString(0,60,x,text,tTextColorItem,framebuffer16[prevFB]);
-
- sprintf(fullfilename,"%s%s%s",romDir,DIR_SEP,romList[romindex].filename);
- remove(fullfilename);
- sync();
-
- sprintf(text,"Updating Rom List..");
- gp_drawString(8,70,strlen(text),text,tTextColorItem,framebuffer16[prevFB]);
- for(x=romindex;x<romCount;x++)
- {
- strcpy(romList[x].filename, romList[x+1].filename);
- romList[x].type = romList[x+1].type;
- }
- romCount--;
-
- return(1);
-}
-
-static int tileCounter=0;
-void PrintTile(int flip)
-{
- short x=0,x2=0;
- short y=0,y2=0;
- unsigned short *framebuffer1 = framebuffer16[flip]+(48*320);
- unsigned short *graphics1 = NULL;
-
- if (isThemeActive() != 0) {
- gDrawBitmap16((unsigned short *)framebuffer16[flip], 0, MENU_AREA_Y_START,
- tBmpBackground, 0, MENU_AREA_Y_START, tBmpBackground->w, tBmpBackground->h - MENU_AREA_Y_START + 1);
- } else {
-
- x2=menutileXscroll;
- y2=(menutileYscroll*MENU_TILE_WIDTH);
- graphics1 = menuTile+y2;
- for (y=0; y<(240-48); y++)
- {
- for (x=0; x<320; x++)
- {
- *framebuffer1++ = graphics1[x2];
- x2++;
- x2&=(MENU_TILE_WIDTH-1);
- }
- y2+=MENU_TILE_WIDTH;
- y2&=((MENU_TILE_HEIGHT*MENU_TILE_WIDTH)-1);
- graphics1=menuTile+y2;
- }
-
- tileCounter++;
- if (tileCounter > 5)
- {
- tileCounter=0;
- menutileXscroll++;
- if(menutileXscroll>=MENU_TILE_WIDTH) menutileXscroll=0;
-
- menutileYscroll++;
- if(menutileYscroll>=MENU_TILE_HEIGHT) menutileYscroll=0;
- }
- }
- return;
-}
-
-void PrintTitle(int flip)
-{
- unsigned int x,y;
- char text[] = DRSNES_VERSION;
- //If header already drawn for this layer exit
- if (headerDone[flip]) return;
-
- if (isThemeActive() != 0) {
- gDrawBitmap16((unsigned short *)framebuffer16[flip], 0, 0, tBmpBackground, 0, 0, tBmpBackground->w, MENU_AREA_Y_START);
- } else {
- unsigned short *framebuffer = (unsigned short*)framebuffer16[flip];
- unsigned short *graphics = (unsigned short*)menuHeader;
-
- for (y=0; y<48; y++)
- {
- for (x=0; x<320; x++)
- {
- *framebuffer++ = *graphics++;
- }
- }
- }
-
- //sprintf(text,"%s",DRSNES_VERSION);
- gp_drawString(175,15,strlen(text),text,tTextColorVersion,framebuffer16[flip]);
- headerDone[currFB] = 1;
-}
-
-void PrintBar(int flip, unsigned int givenY)
-{
- if (isThemeActive()) {
- gBlendBitmap16((unsigned short *)framebuffer16[flip], 0, givenY, tBmpBar, 0, 0, tBmpBar->w, tBmpBar->h);
- } else {
- unsigned int *framebuffer1 = NULL;
- unsigned int *graphics1 = (unsigned int *)highLightBar;
- unsigned int x,y;
-
- framebuffer1 = (unsigned int*)framebuffer16[flip]+(givenY*160);
- for (y=0; y<16; y++)
- {
- for (x=0; x<160; x++)
- {
- *framebuffer1++ = *graphics1++;
- }
- }
- }
-}
-
-static int StringCompare(char *string1, char *string2)
-{
- int i=0;
- char c1=0,c2=0;
- while(1)
- {
- c1=string1[i];
- c2=string2[i];
- // check for string end
-
- if ((c1 == 0) && (c2 == 0)) return 0;
- if (c1 == 0) return 1;
- if (c2 == 0) return -1;
-
- if ((c1 >= 0x61)&&(c1<=0x7A)) c1-=0x20;
- if ((c2 >= 0x61)&&(c2<=0x7A)) c2-=0x20;
- if (c1>c2)
- return 1;
- else if (c1<c2)
- return -1;
- i++;
- }
-
-}
-
-#ifdef __GIZ__
-static BOOL CharToWChar(wchar_t *wc, char *c)
-{
- int len=strlen(c);
- int x=0;
- for (x=0;x<len;x++)
- {
- wc[x] = btowc(c[x]);
- }
- wc[len]=0;
- return TRUE;
-}
-#endif
-
-int FileScan()
-{
- int i=0,j=0;
- char text[256];
- DIR *d;
- struct dirent *de;
- char dirCheck[MAX_PATH+1];
- int dirCount=0;
- char _filename[MAX_PATH+1];
- char _ext[MAX_PATH+1];
- char ll[1024];
- char *llf;
-
-#ifdef __GIZ__
- wchar_t wc[MAX_PATH+1];
- HANDLE hTest;
- WIN32_FIND_DATAW fileInfo;
-#endif
-
- PrintTile(currFB);
- PrintTitle(currFB);
- gp_setClipping(0, 0, 319, 239);
- gp_drawString(8,120,25,"Getting Directory Info...",tTextColorItem,framebuffer16[currFB]);
- MenuFlip();
-
- for (i=0;i<MAX_ROMS;i++)
- {
- romList[i].filename[0] = 0;
- }
-
- //Get rom directory details
- romCount=0;
-
- // Now sort the directory details
- sprintf(romList[0].filename,"Save As Default Directory");
- sprintf(romList[1].filename,"Back To Main Menu");
- sprintf(romList[2].filename,"Parent Directory");
- romList[3].filename[0] = 0;
- romCount=4;
-
- lastSelected = -1;
- defaultDir = (strcmp(snesRomDir, romDir) == 0);
-
- d = opendir(romDir);
-
- if (d)
- {
- while ((de = readdir(d)))
- {
- if (de->d_name[0] != '.')
- {
-#if defined(__GP2X__) || defined(__WIZ__)
- if (de->d_type == 4) // Directory
-#endif
-#ifdef __GIZ__
- sprintf(dirCheck,"%s%s%s",romDir,DIR_SEP,de->d_name);
- CharToWChar(wc, dirCheck);
- hTest=FindFirstFileW(wc, &fileInfo);
- if (fileInfo.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
-#endif
- {
-
- for (i=ROM_SELECTOR_DEFAULT_FOCUS+1;i<=(romCount+1);i++)
- {
- if (romList[i].filename[0] == 0) // string is empty so shove new value in
- {
- strcpy(romList[i].filename,de->d_name);
- romList[i].type=FILE_TYPE_DIRECTORY;//de->d_type;
- break;
- }
- else
- {
- if ((StringCompare(romList[i].filename,de->d_name) > 0) ||
- (romList[i].type != FILE_TYPE_DIRECTORY))
- {
- // new entry is lower than current string so move all entries up one and insert
- // new value in
- for (j=romCount;j>=i;j--)
- {
- strcpy(romList[j+1].filename,romList[j].filename);
- romList[j+1].type=romList[j].type;
- }
- strcpy(romList[i].filename,de->d_name);
- romList[i].type=FILE_TYPE_DIRECTORY;//de->d_type;
- break;
- }
- }
- }
- dirCount++;
- romCount++;
- }
- else // File
- {
- // only interested in Zip and SMC files
- SplitFilename(de->d_name,_filename,_ext);
- if ((StringCompare(_ext,"zip") == 0) ||
- (StringCompare(_ext,"smc") == 0) ||
- (StringCompare(_ext,"sfc") == 0))
- {
- for (i=ROM_SELECTOR_DEFAULT_FOCUS+1+dirCount;i<=(romCount+1);i++)
- {
- if (romList[i].filename[0] == 0) // string is empty so shove new value in
- {
- strcpy(romList[i].filename,de->d_name);
- romList[i].type=FILE_TYPE_FILE;//de->d_type;
- break;
- }
- else
- {
- if (StringCompare(romList[i].filename,de->d_name) > 0)
- {
- // new entry is lower than current string so move all entries up one and insert
- // new value in
- for (j=romCount;j>=i;j--)
- {
- strcpy(romList[j+1].filename,romList[j].filename);
- romList[j+1].type=romList[j].type;
- }
- strcpy(romList[i].filename,de->d_name);
- romList[i].type=FILE_TYPE_FILE;//de->d_type;
- break;
- }
- }
- }
- romCount++;
- }
- }
-
-
- if (romCount > MAX_ROMS)
- {
- PrintTile(currFB);
- PrintTitle(currFB);
- sprintf(text,"Max rom limit exceeded! %d max",MAX_ROMS);
- gp_drawString(8,120,strlen(text),text,tTextColorItem,framebuffer16[currFB]);
- sprintf(text,"Please reduce number of roms");
- gp_drawString(8,130,strlen(text),text,tTextColorItem,framebuffer16[currFB]);
- MenuFlip();
- MenuPause();
- break;
- }
- }
- }
- closedir(d);
-
- getConfigValue(CONFIG_LASTLOADED, ll, sizeof(ll));
- if (strstr(ll, romDir)) { // where loaded in current dir
- llf = strrchr(ll, '/');
- if (!llf) {
- ll[0] = '\0';
- llf = ll;
- } else llf++;
-
- for(i = 4; i < romCount; i++) {
- if ((romList[i].type == FILE_TYPE_FILE) &&
- (strncmp(romList[i].filename, llf, strlen(romList[i].filename)) == 0)) {
- lastSelected = i;
- }
- }
- }
- }
- else
- {
- PrintTile(currFB);
- PrintTitle(currFB);
- sprintf(text,"Failed to open directory!");
- gp_drawString(8,120,strlen(text),text,tTextColorItem,framebuffer16[currFB]);
- MenuFlip();
- MenuPause();
- }
-
-
-
- return romCount;
-}
-
-int FileSelect(int mode)
-{
- char text[256];
- int romname_length;
- int action=0;
- int smooth=0;
- unsigned short color=0;
- int i=0;
- int focus=ROM_SELECTOR_DEFAULT_FOCUS;
- int menuExit=0;
- int scanstart=0,scanend=0;
- char dirSep[2]={DIR_SEP};
- char dirSepBad[2]={DIR_SEP_BAD};
-
- //int x = lastSelected;
- int txt_dir;
- int txt_offset;
- int frame;
-
-#define TIME_TO_SCREENSHOT (20 * 1)
-#define RESET_SCREENSHOT_COUNTER \
- timeToScreenshot = TIME_TO_SCREENSHOT;\
- if (bmpScreenshot) {\
- gDestroyBitmap(bmpScreenshot); \
- bmpScreenshot = NULL; \
- }\
- noScreenshot = 0;
-
- int timeToScreenshot;
- int noScreenshot;
- int xScreenshot;
- gBITMAP *bmpScreenshot = NULL;
-
- FileScan();
-#define RESET_NAME_SCROLL \
- txt_dir = 1; \
- txt_offset = -1;
-
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
-
- if (lastSelected >= 0) focus = lastSelected;
- if (focus>romCount-1) focus = ROM_SELECTOR_DEFAULT_FOCUS;
- smooth=focus<<8;
-
- while (menuExit==0)
- {
- InputUpdate(0);
-
- // Change which rom is focused on:
- if (Inp.repeat[INP_BUTTON_UP])
- {
- focus--; // Up
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- }
- if (Inp.repeat[INP_BUTTON_DOWN])
- {
- focus++; // Down
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- }
-
- if (Inp.held[INP_BUTTON_MENU_CANCEL]==1 ) {action=0; menuExit=1;}
-
- if (Inp.repeat[INP_BUTTON_LEFT] || Inp.repeat[INP_BUTTON_RIGHT] )
- {
- if (Inp.repeat[INP_BUTTON_LEFT])
- {
- focus-=12;
- smooth=(focus<<8)-1;
- }
- else if (Inp.repeat[INP_BUTTON_RIGHT])
- {
- focus+=12;
- smooth=(focus<<8)-1;
- }
-
- if (focus>romCount-1)
- {
- focus=romCount-1;
- smooth=(focus<<8)-1;
- }
- else if (focus<0)
- {
- focus=0;
- smooth=(focus<<8)-1;
- }
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- }
-
- if (focus>romCount-1)
- {
- focus=0;
- smooth=(focus<<8)-1;
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- }
- else if (focus<0)
- {
- focus=romCount-1;
- smooth=(focus<<8)-1;
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- }
- //if (defaultDir) lastSelected = focus;
- if (Inp.held[INP_BUTTON_MENU_SELECT]==1)
- {
- switch(focus)
- {
- case 0: //Save default directory
- SaveMenuOptions(snesOptionsDir, DEFAULT_ROM_DIR_FILENAME, DEFAULT_ROM_DIR_EXT, romDir, strlen(romDir),1);
- strcpy(snesRomDir,romDir);
- break;
-
- case 1: //Return to menu
- action=0;
- menuExit=1;
- break;
-
- case 2: //Goto Parent Directory
- // up a directory
- //Remove a directory from RomPath and rescan
- //Code below will never let you go further up than \SD Card\ on the Gizmondo
- //This is by design.
- for(i=strlen(romDir)-1;i>0;i--) // don't want to change first char in screen
- {
- if((romDir[i] == dirSep[0]) || (romDir[i] == dirSepBad[0]))
- {
- romDir[i] = 0;
- break;
- }
- }
- FileScan();
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- focus=ROM_SELECTOR_DEFAULT_FOCUS; // default menu to non menu item
- // just to stop directory scan being started
- smooth=focus<<8;
- memset(&headerDone,0,sizeof(headerDone)); //clear header
- break;
-
- case ROM_SELECTOR_DEFAULT_FOCUS: //blank space - do nothing
- break;
-
- default:
- // normal file or dir selected
- if (romList[focus].type == FILE_TYPE_DIRECTORY)
- {
- //Just check we are not in root dir as this will always have
- //a trailing directory seperater which screws with things
- sprintf(romDir,"%s%s%s",romDir,DIR_SEP,romList[focus].filename);
- FileScan();
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- focus=ROM_SELECTOR_DEFAULT_FOCUS; // default menu to non menu item
- // just to stop directory scan being started
- smooth=focus<<8;
- }
- else
- {
- // user has selected a rom, so load it
- sprintf(currentRomFilename,romList[focus].filename);
- quickSavePresent=0; // reset any quick saves
- action=1;
- menuExit=1;
- }
- break;
- }
- }
-
- if (Inp.held[INP_BUTTON_MENU_DELETE]==1)
- {
- if(focus>ROM_SELECTOR_DEFAULT_FOCUS)
- {
- //delete current rom
- if (romList[focus].type != FILE_TYPE_DIRECTORY)
- {
- sprintf(text,"%s",romList[focus].filename);
-
- if(MenuMessageBox("Are you sure you want to delete",text,"",0)==0)
- {
- deleterom(focus);
- RESET_NAME_SCROLL
- RESET_SCREENSHOT_COUNTER
- }
- }
- }
- }
- #define MAX_WIDTH (39 * 8)
-
- if (timeToScreenshot) timeToScreenshot--;
- else if ((!bmpScreenshot) && (focus > ROM_SELECTOR_DEFAULT_FOCUS) && (!noScreenshot)) {
- char png_fn[1024];
- char *ext;
- gBITMAP *b;
- // Compose focused filename + screenshots dir
- snprintf(png_fn, sizeof(png_fn), "%s/%s", getScreenShotsDir(), romList[focus].filename);
- // set file ext to .png
- ext = strrchr(png_fn, '.');
- if (!ext) ext = &png_fn[strlen(png_fn)];
- strcpy(ext, ".png");
- // load screenshot
- b = load_png(png_fn, NULL);
- if (!b) noScreenshot = 1;
- else {
- unsigned int sh, sw;
- sh = MENU_AREA_Y_END - MENU_AREA_Y_START - 2 + 1;
- sw = (sh * b->w)/ b->h;
- bmpScreenshot = gStretchBitmap(b, sw, sh);
- gDestroyBitmap(b);
- if (!bmpScreenshot) noScreenshot = 1;
- else xScreenshot = SCREEN_WIDTH - 2;
- }
- }
-
- // Draw screen:
- PrintTile(currFB);
- PrintTitle(currFB);
- sprintf(text,"%s:%s",mode?"Select Rom":"Delete Rom",romDir);
- gp_setClipping(0, 0, 319, 239);
- gp_drawString(6,35,strlen(text)>=40?39:strlen(text),text,tTextColorTitle,framebuffer16[currFB]);
- //gp_setClipping(8, MENU_AREA_Y_START, 8 + MAX_WIDTH, MENU_AREA_Y_END);
-
- // Draw focused file's screenshot
- if (bmpScreenshot) {
- //unsigned int sh, sw;
- //sh = MENU_AREA_Y_END - MENU_AREA_Y_START - 2 + 1;
- //sw = (sh * bmpScreenshot->w)/ bmpScreenshot->h;
- //gDrawScaledBitmap16(framebuffer16[currFB], xScreenshot, MENU_AREA_Y_START + 1, bmpScreenshot, sw, sh);
- //if (xScreenshot > (SCREEN_WIDTH - sw - 4)) xScreenshot -= 2;
- gDrawBitmap16(framebuffer16[currFB], xScreenshot, MENU_AREA_Y_START + 1, bmpScreenshot, 0, 0, bmpScreenshot->w, bmpScreenshot->h);
- if (xScreenshot > (SCREEN_WIDTH - bmpScreenshot->w - 4)) xScreenshot -= 8;
- }
-
- smooth=smooth*7+(focus<<8); smooth>>=3;
-
- scanstart=focus-15;
- if (scanstart<0) scanstart=0;
- scanend = focus+15;
- if (scanend>romCount) scanend=romCount;
-
- for (i=scanstart;i<scanend;i++)
- {
- int x=0,y=0, offset=0;
-
- y=(i<<4)-(smooth>>4);
- x=8;
- y+=112;
- if (y<= (MENU_AREA_Y_START - 8) || y>=232) continue;
-
- gp_setClipping(8, MENU_AREA_Y_START, 8 + MAX_WIDTH, MENU_AREA_Y_END);
- romname_length=strlen(romList[i].filename);
- if (i==focus)
- {
- color=tTextColorFocus;
- PrintBar(currFB,y-4);
- if ((romname_length * 8) > MAX_WIDTH) { // let's scroll romname if length is bigger than screen width
- if (frame == 0) txt_offset += txt_dir; // one of each 4 frames
- if (txt_offset == 1) {txt_offset = 0; txt_dir = -1;}
- if ((romname_length * 8 + txt_offset) < MAX_WIDTH) txt_dir = 1;
- offset = txt_offset;
- }
- }
- else
- {
- color=tTextColorItem;
- if (bmpScreenshot) gp_setClipping(8, MENU_AREA_Y_START, xScreenshot - 1, MENU_AREA_Y_END);
- }
-
- // Draw Directory icon if current entry is a directory
- if(romList[i].type == FILE_TYPE_DIRECTORY)
- {
- gp_drawString(x-8,y,1,"+",color,framebuffer16[currFB]);
- }
-
- gp_drawString(x + offset, y, romname_length,romList[i].filename,color,framebuffer16[currFB]);
- }
- gp_setClipping(0, 0, 319, 239);
- frame = (frame + 1) & 3;
- MenuFlip();
- }
-
- gDestroyBitmap(bmpScreenshot);
- return action;
-}
-
-static void ScanSaveStates(char *romname)
-{
- FILE *stream;
- int i=0;
- char savename[MAX_PATH+1];
- char filename[MAX_PATH+1];
- char ext[MAX_PATH+1];
-
- if(!strcmp(romname,saveStateName)) return; // is current save state rom so exit
-
- SplitFilename(romname,filename,ext);
-
- sprintf(savename,"%s.%s",filename,SAVESTATE_EXT);
-
- for(i=0;i<10;i++)
- {
- /*
- need to build a save state filename
- all saves are held in current working directory (snesSaveStateDir)
- save filename has following format
- shortname(minus file ext) + SV + saveno ( 0 to 9 )
- */
- sprintf(saveState[i].filename,"%s%d",savename,i);
- sprintf(saveState[i].fullFilename,"%s%s%s",snesSaveStateDir,DIR_SEP,saveState[i].filename);
- stream=(FILE*)fopen(saveState[i].fullFilename,"rb");
- if(stream)
- {
- // we have a savestate
- saveState[i].inUse = 1;
- fclose(stream);
- }
- else
- {
- // no save state
- saveState[i].inUse = 0;
- }
- }
- strcpy(saveStateName,romname); // save the last scanned romname
-}
-
-void LoadStateFile(char *filename)
-{
- S9xUnfreezeGame(filename);
-}
-
-static void SaveStateFile(char *filename)
-{
- S9xFreezeGame(filename);
- sync();
-}
-
-static int SaveStateSelect(int mode)
-{
- char text[128];
- int action=11;
- int saveno=0;
-
- if(currentRomFilename[0]==0)
- {
- // no rom loaded
- // display error message and exit
- return(0);
- }
-
- memset(&headerDone,0,sizeof(headerDone));
- ScanSaveStates(currentRomFilename);
-
- while (action!=0&&action!=100)
- {
- InputUpdate(0);
- if(Inp.held[INP_BUTTON_UP]==1) {saveno--; action=1;}
- if(Inp.held[INP_BUTTON_DOWN]==1) {saveno++; action=1;}
- if(saveno<-1) saveno=9;
- if(saveno>9) saveno=-1;
-
- if(Inp.held[INP_BUTTON_MENU_CANCEL]==1) action=0; // exit
- else if((Inp.held[INP_BUTTON_MENU_SELECT]==1)&&(saveno==-1)) action=0; // exit
- else if((Inp.held[INP_BUTTON_MENU_SELECT]==1)&&(mode==0)&&((action==2)||(action==5))) action=6; // pre-save mode
- else if((Inp.held[INP_BUTTON_MENU_SELECT]==1)&&(mode==1)&&(action==5)) action=8; // pre-load mode
- else if((Inp.held[INP_BUTTON_MENU_SELECT]==1)&&(mode==2)&&(action==5))
- {
- if(MenuMessageBox("Are you sure you want to delete","this save?","",0)==0) action=13; //delete slot with no preview
- }
- //else if((Inp.held[INP_BUTTON_R]==1)&&(action==12)) action=3; // preview slot mode
- else if((Inp.held[INP_BUTTON_MENU_SELECT]==1)&&(mode==1)&&(action==12)) action=8; //load slot with no preview
- else if((Inp.held[INP_BUTTON_MENU_SELECT]==1)&&(mode==0)&&(action==12)) action=6; //save slot with no preview
- else if((Inp.held[INP_BUTTON_MENU_SELECT]==1)&&(mode==2)&&(action==12))
- {
- if(MenuMessageBox("Are you sure you want to delete","this save?","",0)==0) action=13; //delete slot with no preview
- }
-
- PrintTile(currFB);
- PrintTitle(currFB);
- if(mode==SAVESTATE_MODE_SAVE) gp_drawString(6,35,10,"Save State",tTextColorTitle,framebuffer16[currFB]);
- if(mode==SAVESTATE_MODE_LOAD) gp_drawString(6,35,10,"Load State",tTextColorTitle,framebuffer16[currFB]);
- if(mode==SAVESTATE_MODE_DELETE) gp_drawString(6,35,12,"Delete State",tTextColorTitle,framebuffer16[currFB]);
- sprintf(text,"Press UP and DOWN to change save slot");
- gp_drawString(12,230,strlen(text),text,(unsigned short)MENU_RGB(31,15,5),framebuffer16[currFB]);
-
- if(saveno==-1)
- {
- if(action!=10&&action!=0)
- {
- action=10;
- }
- }
- else
- {
- PrintBar(currFB,60-4);
- sprintf(text,"SLOT %d",saveno);
- gp_drawString(136,60,strlen(text),text,tTextColorItem,framebuffer16[currFB]);
- }
-
- switch(action)
- {
- case 1:
- //gp_drawString(112,145,14,"Checking....",tTextColorItem,framebuffer16[currFB]);
- break;
- case 2:
- gp_drawString(144,145,4,"FREE",tTextColorItem,framebuffer16[currFB]);
- break;
- case 3:
- gp_drawString(104,145,14,"Previewing....",tTextColorItem,framebuffer16[currFB]);
- break;
- case 4:
- gp_drawString(88,145,18,"Previewing....fail",tTextColorItem,framebuffer16[currFB]);
- break;
- case 5:
- gp_drawString(112,145,17, "Not gonna happen!",tTextColorItem,framebuffer16[currFB]);
- if(mode==1) gp_drawString((320-(strlen(MENU_TEXT_LOAD_SAVESTATE)<<3))>>1,210,strlen(MENU_TEXT_LOAD_SAVESTATE), MENU_TEXT_LOAD_SAVESTATE,tTextColorItem,framebuffer16[currFB]);
- else if(mode==0) gp_drawString((320-(strlen(MENU_TEXT_OVERWRITE_SAVESTATE)<<3))>>1,210,strlen(MENU_TEXT_OVERWRITE_SAVESTATE), MENU_TEXT_OVERWRITE_SAVESTATE,tTextColorItem,framebuffer16[currFB]);
- else if(mode==2) gp_drawString((320-(strlen(MENU_TEXT_DELETE_SAVESTATE)<<3))>>1,210,strlen(MENU_TEXT_DELETE_SAVESTATE), MENU_TEXT_DELETE_SAVESTATE,tTextColorItem,framebuffer16[currFB]);
- break;
- case 6:
- gp_drawString(124,145,9,"Saving...",tTextColorItem,framebuffer16[currFB]);
- break;
- case 7:
- gp_drawString(124,145,14,"Saving...Fail!",tTextColorItem,framebuffer16[currFB]);
- break;
- case 8:
- gp_drawString(116,145,11,"loading....",tTextColorItem,framebuffer16[currFB]);
- break;
- case 9:
- gp_drawString(116,145,15,"loading....Fail",tTextColorItem,framebuffer16[currFB]);
- break;
- case 10:
-
- PrintBar(currFB,145-4);
- gp_drawString(104,145,14,"Return To Menu",tTextColorItem,framebuffer16[currFB]);
- break;
- case 12:
- gp_drawString(124,145,9,"Slot used",tTextColorItem,framebuffer16[currFB]);
- //gp_drawString((320-(strlen(MENU_TEXT_PREVIEW_SAVESTATE)<<3))>>1,165,strlen(MENU_TEXT_PREVIEW_SAVESTATE),MENU_TEXT_PREVIEW_SAVESTATE,tTextColorItem,framebuffer16[currFB]);
- if(mode==1) gp_drawString((320-(strlen(MENU_TEXT_LOAD_SAVESTATE)<<3))>>1,175,strlen(MENU_TEXT_LOAD_SAVESTATE), MENU_TEXT_LOAD_SAVESTATE,tTextColorItem,framebuffer16[currFB]);
- else if(mode==0) gp_drawString((320-(strlen(MENU_TEXT_OVERWRITE_SAVESTATE)<<3))>>1,175,strlen(MENU_TEXT_OVERWRITE_SAVESTATE), MENU_TEXT_OVERWRITE_SAVESTATE,tTextColorItem,framebuffer16[currFB]);
- else if(mode==2) gp_drawString((320-(strlen(MENU_TEXT_DELETE_SAVESTATE)<<3))>>1,175,strlen(MENU_TEXT_DELETE_SAVESTATE), MENU_TEXT_DELETE_SAVESTATE,tTextColorItem,framebuffer16[currFB]);
- break;
- case 13:
- gp_drawString(116,145,11,"Deleting....",tTextColorItem,framebuffer16[currFB]);
- break;
- }
-
- MenuFlip();
-
- switch(action)
- {
- case 1:
- if(saveState[saveno].inUse)
- {
- action=12;
- }
- else
- {
- action=2;
- }
- break;
- case 3:
- gp_setCpuspeed(MENU_FAST_CPU_SPEED);
- LoadStateFile(saveState[saveno].fullFilename);
- gp_setCpuspeed(MENU_CPU_SPEED);
- action=5;
- break;
- case 6:
- gp_setCpuspeed(MENU_FAST_CPU_SPEED);
- SaveStateFile(saveState[saveno].fullFilename);
- gp_setCpuspeed(MENU_CPU_SPEED);
- saveState[saveno].inUse=1;
- action=1;
- break;
- case 7:
- action=1;
- break;
- case 8:
- LoadStateFile(saveState[saveno].fullFilename);
- action=100; // loaded ok so exit
- break;
- case 9:
- action=1;
- break;
- case 11:
- action=1;
- break;
- case 13:
- remove(saveState[saveno].fullFilename);
- sync();
- saveState[saveno].inUse = 0;
- action=1;
- break;
- }
- }
- memset(&headerDone,0,sizeof(headerDone));
- return(action);
-}
-
-static
-void RenderMenu(char *menuName, int menuCount, int menuSmooth, int menufocus)
-{
- int i=0;
- char text[50];
- unsigned short color=0;
- PrintTile(currFB);
- PrintTitle(currFB);
-
- gp_setClipping(0, 0, 319, 239);
- gp_drawString(6,35,strlen(menuName),menuName,tTextColorTitle,framebuffer16[currFB]);
- gp_setClipping(8, MENU_AREA_Y_START, SCREEN_WIDTH - 8, MENU_AREA_Y_END);
-
- // RRRRRGGGGGBBBBBI gp32 color format
- for (i=0;i<menuCount;i++)
- {
- int x=0,y=0;
-
- y=(i<<4)-(menuSmooth>>4);
- x=8;
- y+=112;
-
- if (y<= (MENU_AREA_Y_START - 8) || y>=232) continue;
-
- if (i==menufocus)
- {
- color=tTextColorFocus;
- PrintBar(currFB,y-4);
- }
- else
- {
- color=tTextColorItem;
- }
-
- sprintf(text,"%s",menutext[i]);
- gp_drawString(x,y,strlen(text),text,color,framebuffer16[currFB]);
- }
- gp_setClipping(0, 0, 319, 239);
-}
-
-static
-int LoadRomMenu(void)
-{
- int menuExit=0,menuCount=LOAD_ROM_MENU_COUNT,menufocus=0,menuSmooth=0;
- int action=0;
- int subaction=0;
-
- memset(&headerDone,0,sizeof(headerDone));
- strcpy(romDir,snesRomDir);
- subaction=FileSelect(0);
- memset(&headerDone,0,sizeof(headerDone));
- if(subaction)
- {
- action=EVENT_LOAD_SNES_ROM;
- menuExit=1;
- }
-
- return action;
-}
-
-static
-int SaveStateMenu(void)
-{
- int menuExit=0,menuCount=SAVESTATE_MENU_COUNT,menufocus=0,menuSmooth=0;
- int action=0;
- int subaction=0;
-
- memset(&headerDone,0,sizeof(headerDone));
-
- //Update
- sprintf(menutext[SAVESTATE_MENU_LOAD],"Load State");
- sprintf(menutext[SAVESTATE_MENU_SAVE],"Save State");
- sprintf(menutext[SAVESTATE_MENU_DELETE],"Delete State");
- sprintf(menutext[SAVESTATE_MENU_RETURN],"Back");
-
- while (!menuExit)
- {
- InputUpdate(0);
-
- // Change which rom is focused on:
- if (Inp.repeat[INP_BUTTON_UP]) menufocus--; // Up
- if (Inp.repeat[INP_BUTTON_DOWN]) menufocus++; // Down
-
- if (Inp.held[INP_BUTTON_MENU_CANCEL]==1 ) menuExit=1;
-
- if (menufocus>menuCount-1)
- {
- menufocus=0;
- menuSmooth=(menufocus<<8)-1;
- }
- else if (menufocus<0)
- {
- menufocus=menuCount-1;
- menuSmooth=(menufocus<<8)-1;
- }
-
- if (Inp.held[INP_BUTTON_MENU_SELECT]==1)
- {
- switch(menufocus)
- {
- case SAVESTATE_MENU_LOAD:
- subaction=SaveStateSelect(SAVESTATE_MODE_LOAD);
- if(subaction==100)
- {
- menuExit=1;
- action=100;
- }
- break;
- case SAVESTATE_MENU_SAVE:
- SaveStateSelect(SAVESTATE_MODE_SAVE);
- break;
- case SAVESTATE_MENU_DELETE:
- SaveStateSelect(SAVESTATE_MODE_DELETE);
- break;
- case SAVESTATE_MENU_RETURN:
- menuExit=1;
- break;
- }
- }
- // Draw screen:
- menuSmooth=menuSmooth*7+(menufocus<<8); menuSmooth>>=3;
- RenderMenu("Save States", menuCount,menuSmooth,menufocus);
- MenuFlip();
-
- }
-
- return action;
-}
-
-static
-int SramMenu(void)
-{
- int menuExit=0,menuCount=SRAM_MENU_COUNT,menufocus=0,menuSmooth=0;
- int action=0;
- int subaction=0;
- char *srammem=NULL;
-
-
- memset(&headerDone,0,sizeof(headerDone));
-
- //Update
- sprintf(menutext[SRAM_MENU_LOAD],"Load SRAM");
- sprintf(menutext[SRAM_MENU_SAVE],"Save SRAM");
- sprintf(menutext[SRAM_MENU_DELETE],"Delete SRAM");
- sprintf(menutext[SRAM_MENU_RETURN],"Back");
-
- while (!menuExit)
- {
- InputUpdate(0);
-
- // Change which rom is focused on:
- if (Inp.repeat[INP_BUTTON_UP]) menufocus--; // Up
- if (Inp.repeat[INP_BUTTON_DOWN]) menufocus++; // Down
-
- if (Inp.held[INP_BUTTON_MENU_CANCEL]==1 ) menuExit=1;
-
- if (menufocus>menuCount-1)
- {
- menufocus=0;
- menuSmooth=(menufocus<<8)-1;
- }
- else if (menufocus<0)
- {
- menufocus=menuCount-1;
- menuSmooth=(menufocus<<8)-1;
- }
-
- if (Inp.held[INP_BUTTON_MENU_SELECT]==1)
- {
- switch(menufocus)
- {
- case SRAM_MENU_LOAD:
- //LoadSram(snesSramDir,currentRomFilename,SRAM_FILE_EXT,(char*)&sram);
- break;
- case SRAM_MENU_SAVE:
- //SaveSram(snesSramDir,currentRomFilename,SRAM_FILE_EXT,(char*)&sram);
- break;
- case SRAM_MENU_DELETE:
- //DeleteSram(snesSramDir,currentRomFilename,SRAM_FILE_EXT);
- break;
- case SRAM_MENU_RETURN:
- menuExit=1;
- break;
- }
- }
- // Draw screen:
- menuSmooth=menuSmooth*7+(menufocus<<8); menuSmooth>>=3;
- RenderMenu("SRAM", menuCount,menuSmooth,menufocus);
- MenuFlip();
-
- }
-
- return action;
-}
-
-static
-void SNESOptionsUpdateText(int menu_index)
-{
- switch(menu_index)
- {
- case SNES_MENU_SOUND:
- switch(snesMenuOptions.soundOn)
- {
- case 0:
- sprintf(menutext[SNES_MENU_SOUND],"Sound: OFF");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_SOUND],"Sound: ON");
- break;
- }
- break;
-
- case SNES_MENU_SOUND_RATE:
- if (snesMenuOptions.stereo)
- sprintf(menutext[SNES_MENU_SOUND_RATE],"Sound Rate: %d stereo",(unsigned int)soundRates[snesMenuOptions.soundRate]);
- else
- sprintf(menutext[SNES_MENU_SOUND_RATE],"Sound Rate: %d mono",(unsigned int)soundRates[snesMenuOptions.soundRate]);
- break;
-#if defined(__GP2X__) || defined(__WIZ__)
- case SNES_MENU_CPUSPEED:
- sprintf(menutext[SNES_MENU_CPUSPEED],"Cpu Speed: %d",(unsigned int)cpuSpeedLookup[snesMenuOptions.cpuSpeed]);
- break;
-#endif
- case SNES_MENU_SOUND_VOL:
- sprintf(menutext[SNES_MENU_SOUND_VOL],"Volume: %d",snesMenuOptions.volume);
- break;
-
- case SNES_MENU_FRAMESKIP:
- switch(snesMenuOptions.frameSkip)
- {
- case 0:
- sprintf(menutext[SNES_MENU_FRAMESKIP],"Frameskip: AUTO");
- break;
- default:
- sprintf(menutext[SNES_MENU_FRAMESKIP],"Frameskip: %d",snesMenuOptions.frameSkip-1);
- break;
- }
- break;
-
- case SNES_MENU_REGION:
- switch(snesMenuOptions.region)
- {
- case 0:
- sprintf(menutext[SNES_MENU_REGION],"Region: AUTO");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_REGION],"Region: NTSC");
- break;
- case 2:
- sprintf(menutext[SNES_MENU_REGION],"Region: PAL");
- break;
- }
- break;
-
- case SNES_MENU_FPS:
- switch(snesMenuOptions.showFps)
- {
- case 0:
- sprintf(menutext[SNES_MENU_FPS],"Show FPS: OFF");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_FPS],"Show FPS: ON");
- break;
- }
- break;
-#if defined(__GP2X__)
- case SNES_MENU_GAMMA:
- sprintf(menutext[SNES_MENU_GAMMA],"Brightness: %d",snesMenuOptions.gamma+100);
- break;
-#endif
- case SNES_MENU_TRANSPARENCY:
- switch(snesMenuOptions.transparency)
- {
- case 0:
- sprintf(menutext[SNES_MENU_TRANSPARENCY],"Transparencies: OFF");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_TRANSPARENCY],"Transparencies: ON");
- break;
- }
- break;
-
- case SNES_MENU_LOAD_GLOBAL:
- sprintf(menutext[SNES_MENU_LOAD_GLOBAL],"Load Global Settings");
- break;
-
- case SNES_MENU_SAVE_GLOBAL:
- sprintf(menutext[SNES_MENU_SAVE_GLOBAL],"Save Global Settings");
- break;
-
- case SNES_MENU_DELETE_GLOBAL:
- sprintf(menutext[SNES_MENU_DELETE_GLOBAL],"Delete Global Settings");
- break;
-
- case SNES_MENU_LOAD_CURRENT:
- sprintf(menutext[SNES_MENU_LOAD_CURRENT],"Load Settings For Current Game");
- break;
-
- case SNES_MENU_SAVE_CURRENT:
- sprintf(menutext[SNES_MENU_SAVE_CURRENT],"Save Settings For Current Game");
- break;
-
- case SNES_MENU_DELETE_CURRENT:
- sprintf(menutext[SNES_MENU_DELETE_CURRENT],"Delete Settings For Current Game");
- break;
-
- case SNES_MENU_SET_ROMDIR:
- sprintf(menutext[SNES_MENU_SET_ROMDIR],"Save Current Rom Directory");
- break;
-
- case SNES_MENU_CLEAR_ROMDIR:
- sprintf(menutext[SNES_MENU_CLEAR_ROMDIR],"Reset Default Rom Directory");
- break;
-
- case SNES_MENU_RETURN:
- sprintf(menutext[SNES_MENU_RETURN],"Back");
- break;
-#if defined(__GP2X__) || defined(__WIZ__)
- case SNES_MENU_RENDER_MODE:
- switch(snesMenuOptions.renderMode)
- {
- case RENDER_MODE_UNSCALED:
- sprintf(menutext[SNES_MENU_RENDER_MODE],"Render Mode: Unscaled");
- break;
- case RENDER_MODE_SCALED:
- sprintf(menutext[SNES_MENU_RENDER_MODE],"Render Mode: Scaled");
- break;
- case RENDER_MODE_HORIZONTAL_SCALED:
- sprintf(menutext[SNES_MENU_RENDER_MODE],"Render Mode: Horizontal Scaled");
- break;
- default:
- sprintf(menutext[SNES_MENU_RENDER_MODE],"Render Mode: Unscaled");
- break;
- }
- break;
- case SNES_MENU_ACTION_BUTTONS:
- switch(snesMenuOptions.actionButtons)
- {
- case 0:
- sprintf(menutext[SNES_MENU_ACTION_BUTTONS],"Action Buttons: Normal");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_ACTION_BUTTONS],"Action Buttons: Swapped");
- break;
- }
- break;
-#endif
- case SNES_MENU_AUTO_SAVE_SRAM:
- switch(snesMenuOptions.autoSram)
- {
- case 0:
- sprintf(menutext[SNES_MENU_AUTO_SAVE_SRAM],"Saving SRAM: Manual");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_AUTO_SAVE_SRAM],"Saving SRAM: Automatic");
- break;
- case 2:
- sprintf(menutext[SNES_MENU_AUTO_SAVE_SRAM],"Saving SRAM: Manual + indicator");
- break;
- }
- break;
- case SNES_MENU_EMULATION_TYPE:
- switch(snesMenuOptions.asmspc700)
- {
- case 0:
- sprintf(menutext[SNES_MENU_EMULATION_TYPE],"Emulation (Reset Required): Compatible");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_EMULATION_TYPE],"Emulation (Reset Required): Fast");
- break;
- }
- break;
- case SNES_MENU_LOAD_ROM_ON_INIT:
- switch(snesMenuOptions.loadOnInit)
- {
- case 0:
- sprintf(menutext[SNES_MENU_LOAD_ROM_ON_INIT],"Load last played ROM at startup: OFF");
- break;
- case 1:
- sprintf(menutext[SNES_MENU_LOAD_ROM_ON_INIT],"Load last played ROM at startup: ON");
- break;
- }
- break;
- case SNES_MENU_ADVANCED_HACKS:
- sprintf(menutext[SNES_MENU_ADVANCED_HACKS],"Advanced hacks");
- break;
- }
-}
-
-static
-void SNESHacksUpdateText(int menu_index)
-{
- switch(menu_index)
- {
- case HACKS_MENU_SNESADVANCE_DAT:
- if (snesMenuOptions.SpeedHacks)
- sprintf(menutext[HACKS_MENU_SNESADVANCE_DAT],"Apply snesadvance.dat on ROM load: ON");
- else
- sprintf(menutext[HACKS_MENU_SNESADVANCE_DAT],"Apply snesadvance.dat on ROM load: OFF");
- break;
- case HACKS_MENU_AUDIO:
- if(snesMenuOptions.soundHack)
- sprintf(menutext[HACKS_MENU_AUDIO],"Audio Performance hack: ON");
- else
- sprintf(menutext[HACKS_MENU_AUDIO],"Audio Performance hack: OFF");
- break;
-#ifdef __OLD_RASTER_FX__
- case HACKS_MENU_DELAYED_RASTER_FX:
- sprintf(menutext[HACKS_MENU_DELAYED_RASTER_FX], "Delayed Raster FX: %s", snesMenuOptions.delayedRasterFX ? "ON" : "OFF");
- break;
-#endif
- case HACKS_MENU_PALETTE:
- if(snesMenuOptions.graphHacks & PPU_IGNORE_PALWRITE)
- sprintf(menutext[HACKS_MENU_PALETTE],"Ignore Palette writes: ON");
- else
- sprintf(menutext[HACKS_MENU_PALETTE],"Ignore Palette writes: OFF");
- break;
- case HACKS_MENU_FIXEDCOL:
- if(snesMenuOptions.graphHacks & PPU_IGNORE_FIXEDCOLCHANGES)
- sprintf(menutext[HACKS_MENU_FIXEDCOL],"Ignore Fixed Colour: ON");
- else
- sprintf(menutext[HACKS_MENU_FIXEDCOL],"Ignore Fixed Colour: OFF");
- break;
- case HACKS_MENU_WINDOW:
- if(snesMenuOptions.graphHacks & PPU_IGNORE_WINDOW)
- sprintf(menutext[HACKS_MENU_WINDOW],"Ignore Windows clipping: ON");
- else
- sprintf(menutext[HACKS_MENU_WINDOW],"Ignore Windows clipping: OFF");
- break;
- case HACKS_MENU_ADDSUB:
- if(snesMenuOptions.graphHacks & PPU_IGNORE_ADDSUB)
- sprintf(menutext[HACKS_MENU_ADDSUB],"Ignore Add/Sub modes: ON");
- else
- sprintf(menutext[HACKS_MENU_ADDSUB],"Ignore Add/Sub modes: OFF");
- break;
- case HACKS_MENU_OBJ:
- if(snesMenuOptions.graphHacks & GFX_IGNORE_OBJ)
- sprintf(menutext[HACKS_MENU_OBJ],"Ignore objects layer: ON");
- else
- sprintf(menutext[HACKS_MENU_OBJ],"Ignore objects layer: OFF");
- break;
- case HACKS_MENU_BG0:
- if(snesMenuOptions.graphHacks & GFX_IGNORE_BG0)
- sprintf(menutext[HACKS_MENU_BG0],"Ignore background layer 0: ON");
- else
- sprintf(menutext[HACKS_MENU_BG0],"Ignore background layer 0: OFF");
- break;
- case HACKS_MENU_BG1:
- if(snesMenuOptions.graphHacks & GFX_IGNORE_BG1)
- sprintf(menutext[HACKS_MENU_BG1],"Ignore background layer 1: ON");
- else
- sprintf(menutext[HACKS_MENU_BG1],"Ignore background layer 1: OFF");
- break;
- case HACKS_MENU_BG2:
- if(snesMenuOptions.graphHacks & GFX_IGNORE_BG2)
- sprintf(menutext[HACKS_MENU_BG2],"Ignore background layer 2: ON");
- else
- sprintf(menutext[HACKS_MENU_BG2],"Ignore background layer 2: OFF");
- break;
- case HACKS_MENU_BG3:
- if(snesMenuOptions.graphHacks & GFX_IGNORE_BG3)
- sprintf(menutext[HACKS_MENU_BG3],"Ignore background layer 3: ON");
- else
- sprintf(menutext[HACKS_MENU_BG3],"Ignore background layer 3: OFF");
- break;
- case HACKS_MENU_RETURN:
- sprintf(menutext[HACKS_MENU_RETURN],"Back");
- break;
-
-
- }
-}
-
-static
-void SNESHacksUpdateText_All()
-{
- SNESHacksUpdateText(HACKS_MENU_AUDIO);
- SNESHacksUpdateText(HACKS_MENU_SNESADVANCE_DAT);
-#ifdef __OLD_RASTER_FX__
- SNESHacksUpdateText(HACKS_MENU_DELAYED_RASTER_FX);
-#endif
- SNESHacksUpdateText(HACKS_MENU_PALETTE);
- SNESHacksUpdateText(HACKS_MENU_FIXEDCOL);
- SNESHacksUpdateText(HACKS_MENU_WINDOW);
- SNESHacksUpdateText(HACKS_MENU_ADDSUB);
- SNESHacksUpdateText(HACKS_MENU_OBJ);
- SNESHacksUpdateText(HACKS_MENU_BG0);
- SNESHacksUpdateText(HACKS_MENU_BG1);
- SNESHacksUpdateText(HACKS_MENU_BG2);
- SNESHacksUpdateText(HACKS_MENU_BG3);
- SNESHacksUpdateText(HACKS_MENU_RETURN);
-}
-
-static
-int SNESHacksMenu(void)
-{
- int menuExit=0,menuCount=HACKS_MENU_COUNT,menufocus=0,menuSmooth=0;
- int action=0;
- int subaction=0;
-
- memset(&headerDone,0,sizeof(headerDone));
-
- //Update all items
- SNESHacksUpdateText_All();
-
- while (!menuExit)
- {
- InputUpdate(0);
-
- // Change which rom is focused on:
- if (Inp.repeat[INP_BUTTON_UP]) menufocus--; // Up
- if (Inp.repeat[INP_BUTTON_DOWN]) menufocus++; // Down
-
- if (Inp.held[INP_BUTTON_MENU_CANCEL]==1 ) menuExit=1;
-
- if (menufocus>menuCount-1)
- {
- menufocus=0;
- menuSmooth=(menufocus<<8)-1;
- }
- else if (menufocus<0)
- {
- menufocus=menuCount-1;
- menuSmooth=(menufocus<<8)-1;
-
- }
-
- if (Inp.held[INP_BUTTON_LEFT]==1||
- Inp.held[INP_BUTTON_RIGHT]==1||
- Inp.repeat[INP_BUTTON_LEFT]||
- Inp.repeat[INP_BUTTON_RIGHT])
- {
- switch(menufocus)
- {
- case HACKS_MENU_SNESADVANCE_DAT:
- snesMenuOptions.SpeedHacks^=1;
- SNESHacksUpdateText(HACKS_MENU_SNESADVANCE_DAT);
- break;
- case HACKS_MENU_AUDIO:
- snesMenuOptions.soundHack^=1;
- SNESHacksUpdateText(HACKS_MENU_AUDIO);
- break;
-#ifdef __OLD_RASTER_FX__
- case HACKS_MENU_DELAYED_RASTER_FX:
- snesMenuOptions.delayedRasterFX ^= 1;
- SNESHacksUpdateText(HACKS_MENU_DELAYED_RASTER_FX);
- break;
-#endif
- case HACKS_MENU_PALETTE:
- if (snesMenuOptions.graphHacks & PPU_IGNORE_PALWRITE)
- snesMenuOptions.graphHacks &= ~PPU_IGNORE_PALWRITE;
- else
- snesMenuOptions.graphHacks |= PPU_IGNORE_PALWRITE;
- SNESHacksUpdateText(HACKS_MENU_PALETTE);
- break;
- case HACKS_MENU_FIXEDCOL:
- if (snesMenuOptions.graphHacks & PPU_IGNORE_FIXEDCOLCHANGES)
- snesMenuOptions.graphHacks &= ~PPU_IGNORE_FIXEDCOLCHANGES;
- else
- snesMenuOptions.graphHacks |= PPU_IGNORE_FIXEDCOLCHANGES;
- SNESHacksUpdateText(HACKS_MENU_FIXEDCOL);
- break;
- case HACKS_MENU_WINDOW:
- if (snesMenuOptions.graphHacks & PPU_IGNORE_WINDOW)
- snesMenuOptions.graphHacks &= ~PPU_IGNORE_WINDOW;
- else
- snesMenuOptions.graphHacks |= PPU_IGNORE_WINDOW;
- SNESHacksUpdateText(HACKS_MENU_WINDOW);
- break;
- case HACKS_MENU_ADDSUB:
- if (snesMenuOptions.graphHacks & PPU_IGNORE_ADDSUB)
- snesMenuOptions.graphHacks &= ~PPU_IGNORE_ADDSUB;
- else
- snesMenuOptions.graphHacks |= PPU_IGNORE_ADDSUB;
- SNESHacksUpdateText(HACKS_MENU_ADDSUB);
-
- break;
- case HACKS_MENU_OBJ:
- if (snesMenuOptions.graphHacks & GFX_IGNORE_OBJ)
- snesMenuOptions.graphHacks &= ~GFX_IGNORE_OBJ;
- else
- snesMenuOptions.graphHacks |= GFX_IGNORE_OBJ;
- SNESHacksUpdateText(HACKS_MENU_OBJ);
- break;
- case HACKS_MENU_BG0:
- if (snesMenuOptions.graphHacks & GFX_IGNORE_BG0)
- snesMenuOptions.graphHacks &= ~GFX_IGNORE_BG0;
- else
- snesMenuOptions.graphHacks |= GFX_IGNORE_BG0;
- SNESHacksUpdateText(HACKS_MENU_BG0);
- break;
- case HACKS_MENU_BG1:
- if (snesMenuOptions.graphHacks & GFX_IGNORE_BG1)
- snesMenuOptions.graphHacks &= ~GFX_IGNORE_BG1;
- else
- snesMenuOptions.graphHacks |= GFX_IGNORE_BG1;
- SNESHacksUpdateText(HACKS_MENU_BG1);
- break;
- case HACKS_MENU_BG2:
- if (snesMenuOptions.graphHacks & GFX_IGNORE_BG2)
- snesMenuOptions.graphHacks &= ~GFX_IGNORE_BG2;
- else
- snesMenuOptions.graphHacks |= GFX_IGNORE_BG2;
- SNESHacksUpdateText(HACKS_MENU_BG2);
- break;
- case HACKS_MENU_BG3:
- if (snesMenuOptions.graphHacks & GFX_IGNORE_BG3)
- snesMenuOptions.graphHacks &= ~GFX_IGNORE_BG3;
- else
- snesMenuOptions.graphHacks |= GFX_IGNORE_BG3;
- SNESHacksUpdateText(HACKS_MENU_BG3);
- break;
- }
- }
- if (Inp.held[INP_BUTTON_MENU_SELECT]==1)
- {
- switch(menufocus)
- {
- case HACKS_MENU_RETURN:
- menuExit=1;
- break;
- }
- }
- // Draw screen:
- menuSmooth=menuSmooth*7+(menufocus<<8); menuSmooth>>=3;
- RenderMenu("SNES Advanced Hacks", menuCount,menuSmooth,menufocus);
- MenuFlip();
-
- }
-
- return action;
-}
-
-static
-void SNESOptionsUpdateText_All()
-{
- SNESOptionsUpdateText(SNES_MENU_SOUND);
- SNESOptionsUpdateText(SNES_MENU_SOUND_RATE);
- SNESOptionsUpdateText(SNES_MENU_SOUND_VOL);
- SNESOptionsUpdateText(SNES_MENU_FRAMESKIP);
- SNESOptionsUpdateText(SNES_MENU_REGION);
- SNESOptionsUpdateText(SNES_MENU_FPS);
- SNESOptionsUpdateText(SNES_MENU_TRANSPARENCY);
- SNESOptionsUpdateText(SNES_MENU_LOAD_GLOBAL);
- SNESOptionsUpdateText(SNES_MENU_SAVE_GLOBAL);
- SNESOptionsUpdateText(SNES_MENU_DELETE_GLOBAL);
- SNESOptionsUpdateText(SNES_MENU_LOAD_CURRENT);
- SNESOptionsUpdateText(SNES_MENU_SAVE_CURRENT);
- SNESOptionsUpdateText(SNES_MENU_DELETE_CURRENT);
- SNESOptionsUpdateText(SNES_MENU_SET_ROMDIR);
- SNESOptionsUpdateText(SNES_MENU_CLEAR_ROMDIR);
- SNESOptionsUpdateText(SNES_MENU_RETURN);
-#if defined(__GP2X__) || defined(__WIZ__)
- SNESOptionsUpdateText(SNES_MENU_RENDER_MODE);
- SNESOptionsUpdateText(SNES_MENU_CPUSPEED);
- SNESOptionsUpdateText(SNES_MENU_ACTION_BUTTONS);
-#endif
-#if defined(__GP2X__)
- SNESOptionsUpdateText(SNES_MENU_GAMMA);
-#endif
- SNESOptionsUpdateText(SNES_MENU_EMULATION_TYPE);
- SNESOptionsUpdateText(SNES_MENU_AUTO_SAVE_SRAM);
- SNESOptionsUpdateText(SNES_MENU_LOAD_ROM_ON_INIT);
- SNESOptionsUpdateText(SNES_MENU_ADVANCED_HACKS);
-}
-
-static
-int SNESOptionsMenu(void)
-{
- int menuExit=0,menuCount=SNES_MENU_COUNT,menufocus=0,menuSmooth=0;
- int action=0;
- int subaction=0;
-
- memset(&headerDone,0,sizeof(headerDone));
-
- //Update all items
- SNESOptionsUpdateText_All();
-
- while (!menuExit)
- {
- InputUpdate(0);
-
- // Change which rom is focused on:
- if (Inp.repeat[INP_BUTTON_UP]) menufocus--; // Up
- if (Inp.repeat[INP_BUTTON_DOWN]) menufocus++; // Down
-
- if (Inp.held[INP_BUTTON_MENU_CANCEL]==1 ) menuExit=1;
-
- if (menufocus>menuCount-1)
- {
- menufocus=0;
- menuSmooth=(menufocus<<8)-1;
- }
- else if (menufocus<0)
- {
- menufocus=menuCount-1;
- menuSmooth=(menufocus<<8)-1;
- }
-
- if (Inp.held[INP_BUTTON_LEFT]==1||
- Inp.held[INP_BUTTON_RIGHT]==1||
- Inp.repeat[INP_BUTTON_LEFT]||
- Inp.repeat[INP_BUTTON_RIGHT])
- {
- switch(menufocus)
- {
- case SNES_MENU_SOUND:
- snesMenuOptions.soundOn^=1;
- SNESOptionsUpdateText(SNES_MENU_SOUND);
- break;
- case SNES_MENU_SOUND_RATE:
- if (Inp.held[INP_BUTTON_RIGHT]==1||Inp.repeat[INP_BUTTON_RIGHT])
- {
- if (!snesMenuOptions.stereo)
- snesMenuOptions.stereo = 1;
- else
- {
- snesMenuOptions.soundRate++;
- snesMenuOptions.stereo = 0;
- }
-#if defined(__WIZ__)
- if(snesMenuOptions.soundRate>2) snesMenuOptions.soundRate=0;
-#else
- if(snesMenuOptions.soundRate>4) snesMenuOptions.soundRate=0;
-#endif
- }
- else
- {
- if (snesMenuOptions.stereo)
- snesMenuOptions.stereo = 0;
- else
- {
- snesMenuOptions.soundRate--;
- snesMenuOptions.stereo = 1;
- }
-#if defined(__WIZ__)
- if(snesMenuOptions.soundRate>2) snesMenuOptions.soundRate=2;
-#else
- if(snesMenuOptions.soundRate>4) snesMenuOptions.soundRate=4;
-#endif
- }
- SNESOptionsUpdateText(SNES_MENU_SOUND_RATE);
- break;
- case SNES_MENU_SOUND_VOL:
- if (Inp.held[INP_BUTTON_RIGHT]==1||Inp.repeat[INP_BUTTON_RIGHT])
- {
- snesMenuOptions.volume+=1;
- if(snesMenuOptions.volume>100) snesMenuOptions.volume=0;
- }
- else
- {
- snesMenuOptions.volume-=1;
- if(snesMenuOptions.volume>100) snesMenuOptions.volume=100;
- }
- SNESOptionsUpdateText(SNES_MENU_SOUND_VOL);
- break;
-#if defined(__GP2X__) || defined(__WIZ__)
- case SNES_MENU_CPUSPEED:
- if (Inp.held[INP_BUTTON_RIGHT]==1||Inp.repeat[INP_BUTTON_RIGHT])
- {
- snesMenuOptions.cpuSpeed++;
- if(snesMenuOptions.cpuSpeed>45) snesMenuOptions.cpuSpeed=0;
- }
- else
- {
- snesMenuOptions.cpuSpeed--;
- if(snesMenuOptions.cpuSpeed>45) snesMenuOptions.cpuSpeed=45;
- }
- SNESOptionsUpdateText(SNES_MENU_CPUSPEED);
- break;
-#endif
- case SNES_MENU_FRAMESKIP:
- if (Inp.held[INP_BUTTON_RIGHT]==1||Inp.repeat[INP_BUTTON_RIGHT])
- {
- snesMenuOptions.frameSkip++;
- if(snesMenuOptions.frameSkip>6) snesMenuOptions.frameSkip=0;
- }
- else
- {
- snesMenuOptions.frameSkip--;
- if(snesMenuOptions.frameSkip>6) snesMenuOptions.frameSkip=6;
- }
- SNESOptionsUpdateText(SNES_MENU_FRAMESKIP);
- break;
- case SNES_MENU_REGION:
- if (Inp.held[INP_BUTTON_RIGHT]==1||Inp.repeat[INP_BUTTON_RIGHT])
- {
- snesMenuOptions.region++;
- if(snesMenuOptions.region>2) snesMenuOptions.region=0;
- }
- else
- {
- snesMenuOptions.region--;
- if(snesMenuOptions.region>2) snesMenuOptions.region=2;
- }
- SNESOptionsUpdateText(SNES_MENU_REGION);
- break;
- case SNES_MENU_FPS:
- snesMenuOptions.showFps^=1;
- SNESOptionsUpdateText(SNES_MENU_FPS);
- break;
-#if defined(__GP2X__)
- case SNES_MENU_GAMMA:
- if (Inp.held[INP_BUTTON_RIGHT]==1||Inp.repeat[INP_BUTTON_RIGHT])
- {
- snesMenuOptions.gamma++;
- if(snesMenuOptions.gamma>100) snesMenuOptions.gamma=100;
- }
- else
- {
- snesMenuOptions.gamma--;
- if(snesMenuOptions.gamma<-100) snesMenuOptions.gamma=-100;
- }
- set_gamma(snesMenuOptions.gamma+100);
- SNESOptionsUpdateText(SNES_MENU_GAMMA);
- break;
-#endif
-#if defined(__GP2X__) || defined(__WIZ__)
- case SNES_MENU_ACTION_BUTTONS:
- snesMenuOptions.actionButtons^=1;
- SNESOptionsUpdateText(SNES_MENU_ACTION_BUTTONS);
- break;
-#endif
- case SNES_MENU_TRANSPARENCY:
- snesMenuOptions.transparency^=1;
- SNESOptionsUpdateText(SNES_MENU_TRANSPARENCY);
- break;
-#if defined(__GP2X__) || defined(__WIZ__)
- case SNES_MENU_RENDER_MODE:
- if (Inp.held[INP_BUTTON_RIGHT]==1||Inp.repeat[INP_BUTTON_RIGHT])
- {
- snesMenuOptions.renderMode++;
- if (snesMenuOptions.renderMode > RENDER_MODE_HORIZONTAL_SCALED)
- snesMenuOptions.renderMode = RENDER_MODE_UNSCALED;
- }
- else
- {
- snesMenuOptions.renderMode--;
- if (snesMenuOptions.renderMode > RENDER_MODE_HORIZONTAL_SCALED)
- snesMenuOptions.renderMode = RENDER_MODE_HORIZONTAL_SCALED;
- }
- SNESOptionsUpdateText(SNES_MENU_RENDER_MODE);
- break;
-#endif
- case SNES_MENU_AUTO_SAVE_SRAM:
- //snesMenuOptions.autoSram^=1;
- if ((++snesMenuOptions.autoSram) > 2) snesMenuOptions.autoSram = 0;
- SNESOptionsUpdateText(SNES_MENU_AUTO_SAVE_SRAM);
- break;
- case SNES_MENU_EMULATION_TYPE:
- snesMenuOptions.asmspc700^=1;
- SNESOptionsUpdateText(SNES_MENU_EMULATION_TYPE);
- break;
- case SNES_MENU_LOAD_ROM_ON_INIT:
- snesMenuOptions.loadOnInit ^= 1;
- SNESOptionsUpdateText(SNES_MENU_LOAD_ROM_ON_INIT);
- break;
-
- }
- }
- if (Inp.held[INP_BUTTON_MENU_SELECT]==1)
- {
- switch(menufocus)
- {
- case SNES_MENU_ADVANCED_HACKS:
- memset(&headerDone,0,sizeof(headerDone));
- subaction = SNESHacksMenu();
- memset(&headerDone,0,sizeof(headerDone));
- SNESOptionsUpdateText_All();
- break;
- case SNES_MENU_LOAD_GLOBAL:
- LoadMenuOptions(snesOptionsDir, MENU_OPTIONS_FILENAME, MENU_OPTIONS_EXT, (char*)&snesMenuOptions, sizeof(snesMenuOptions),1);
- SNESOptionsUpdateText_All();
- break;
- case SNES_MENU_SAVE_GLOBAL:
- SaveMenuOptions(snesOptionsDir, MENU_OPTIONS_FILENAME, MENU_OPTIONS_EXT, (char*)&snesMenuOptions, sizeof(snesMenuOptions),1);
- break;
- case SNES_MENU_DELETE_GLOBAL:
- DeleteMenuOptions(snesOptionsDir,MENU_OPTIONS_FILENAME,MENU_OPTIONS_EXT,1);
- break;
- case SNES_MENU_LOAD_CURRENT:
- if(currentRomFilename[0]!=0)
- {
- LoadMenuOptions(snesOptionsDir, currentRomFilename, MENU_OPTIONS_EXT, (char*)&snesMenuOptions, sizeof(snesMenuOptions),1);
- SNESOptionsUpdateText_All();
- }
- break;
- case SNES_MENU_SAVE_CURRENT:
- if(currentRomFilename[0]!=0)
- {
- SaveMenuOptions(snesOptionsDir, currentRomFilename, MENU_OPTIONS_EXT, (char*)&snesMenuOptions, sizeof(snesMenuOptions),1);
- }
- break;
- case SNES_MENU_DELETE_CURRENT:
- if(currentRomFilename[0]!=0)
- {
- DeleteMenuOptions(snesOptionsDir, currentRomFilename, MENU_OPTIONS_EXT,1);
- }
- break;
- case SNES_MENU_SET_ROMDIR:
- SaveMenuOptions(snesOptionsDir, DEFAULT_ROM_DIR_FILENAME, DEFAULT_ROM_DIR_EXT, romDir, strlen(romDir),1);
- strcpy(snesRomDir,romDir);
- break;
- case SNES_MENU_CLEAR_ROMDIR:
- DeleteMenuOptions(snesOptionsDir, DEFAULT_ROM_DIR_FILENAME, DEFAULT_ROM_DIR_EXT,1);
- strcpy(snesRomDir,currentWorkingDir);
- break;
- case SNES_MENU_RETURN:
- menuExit=1;
- break;
- }
- }
- // Draw screen:
- menuSmooth=menuSmooth*7+(menufocus<<8); menuSmooth>>=3;
- RenderMenu("SNES Options", menuCount,menuSmooth,menufocus);
- MenuFlip();
-
- }
-
- return action;
-}
-
-static int screenshotSaved;
-static void MainMenuUpdateText(void)
-{
- sprintf(menutext[MAIN_MENU_ROM_SELECT],"Select Rom");
- sprintf(menutext[MAIN_MENU_MANAGE_SAVE_STATE],"Manage Save States");
- sprintf(menutext[MAIN_MENU_SAVE_SRAM],"Save SRAM");
- if (!screenshotSaved) sprintf(menutext[MAIN_MENU_SAVE_SCREENSHOT],"Save Screenshot");
- else sprintf(menutext[MAIN_MENU_SAVE_SCREENSHOT],"[Screenshot already saved]");
- sprintf(menutext[MAIN_MENU_SNES_OPTIONS],"SNES Options");
- sprintf(menutext[MAIN_MENU_RESET_GAME],"Reset Game");
- sprintf(menutext[MAIN_MENU_EXIT_APP],"Exit Application");
- sprintf(menutext[MAIN_MENU_RETURN],"Return To Game");
-}
-
-
-int MainMenu(int prevaction)
-{
- int menuExit=0,menuCount=MAIN_MENU_COUNT,menufocus=0,menuSmooth=0;
- int action=prevaction;
- int subaction=0;
- screenshotSaved = 0;
-
- gp_setCpuspeed(MENU_CPU_SPEED);
-
- gp_initGraphics(16,currFB,1);
- gp_clearFramebuffer16((unsigned short*)framebuffer16[currFB],0x0);
- MenuFlip();
-#if !defined(__WIZ__)
- gp_video_RGB_setscaling(320,240);
-#endif
-
- memset(&headerDone,0,sizeof(headerDone));
- MainMenuUpdateText();
-
- while (!menuExit)
- {
- InputUpdate(0);
-
- // Change which rom is focused on:
- if (Inp.repeat[INP_BUTTON_UP]) menufocus--; // Up
- if (Inp.repeat[INP_BUTTON_DOWN]) menufocus++; // Down
-
- if (Inp.held[INP_BUTTON_MENU_CANCEL]==1 )
- {
- if(currentRomFilename[0]!=0)
- {
- menuExit=1;
- }
- }
-
- if (menufocus>menuCount-1)
- {
- menufocus=0;
- menuSmooth=(menufocus<<8)-1;
- }
- else if (menufocus<0)
- {
- menufocus=menuCount-1;
- menuSmooth=(menufocus<<8)-1;
- }
-
- if (Inp.held[INP_BUTTON_MENU_SELECT]==1)
- {
- switch(menufocus)
- {
- case MAIN_MENU_ROM_SELECT:
- memset(&headerDone,0,sizeof(headerDone));
- subaction=LoadRomMenu();
- memset(&headerDone,0,sizeof(headerDone));
- if(subaction)
- {
- action=subaction;
- menuExit=1;
- }
- MainMenuUpdateText();
- break;
-
- case MAIN_MENU_MANAGE_SAVE_STATE:
- if(currentRomFilename[0]!=0)
- {
- memset(&headerDone,0,sizeof(headerDone));
- subaction=SaveStateMenu();
- if (subaction==100)
- {
- menuExit=1;
- }
- memset(&headerDone,0,sizeof(headerDone));
- }
- MainMenuUpdateText();
- break;
- case MAIN_MENU_SAVE_SRAM:
- if(currentRomFilename[0]!=0)
- {
- S9xSaveSRAM();
- }
- break;
- case MAIN_MENU_SNES_OPTIONS:
-
- memset(&headerDone,0,sizeof(headerDone));
- subaction=SNESOptionsMenu();
- memset(&headerDone,0,sizeof(headerDone));
- MainMenuUpdateText();
- break;
- case MAIN_MENU_SAVE_SCREENSHOT:
- if (!screenshotSaved) {
- ShowMessage("Saving screenshot...", 1);
- if (saveScreenShot() == 0) {
- screenshotSaved = 1;
- MainMenuUpdateText();
- }
- }
- break;
- case MAIN_MENU_RESET_GAME :
- if(currentRomFilename[0]!=0)
- {
- switch(currentEmuMode)
- {
- case EMU_MODE_SNES:
- action=EVENT_RESET_SNES_ROM;
- menuExit=1;
- break;
- }
- }
- break;
- case MAIN_MENU_RETURN:
- if(currentRomFilename[0]!=0)
- {
- menuExit=1;
- }
- break;
- case MAIN_MENU_EXIT_APP:
- action=EVENT_EXIT_APP;
- menuExit=1;
- break;
- }
- }
- // Draw screen:
- menuSmooth=menuSmooth*7+(menufocus<<8); menuSmooth>>=3;
- RenderMenu("Main Menu", menuCount,menuSmooth,menufocus);
- MenuFlip();
-
-
- }
-
- WaitForButtonsUp();
-
- return action;
-}
-
-
-
diff --git a/src/menu.h b/src/menu.h
deleted file mode 100644
index c0d102d..0000000
--- a/src/menu.h
+++ /dev/null
@@ -1,380 +0,0 @@
-#ifndef _MENU_H_
-#define _MENU_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <dirent.h>
-#include <errno.h>
-
-#ifdef __GIZ__
-#define DIR_SEP "\\"
-#define DIR_SEP_BAD "/"
-#define SYSTEM_DIR "\\SD Card\\DrPocketSnes"
-#else
- #ifdef __GP2X__
- #include "gp2x_sdk.h"
- #endif
- #ifdef __WIZ__
- #ifdef __CAANOO__
- #include "caanoo_sdk.h"
- #else
- #include "wiz_sdk.h"
- #endif
- #endif
-
- #define DIR_SEP "/"
- #define DIR_SEP_BAD "\\"
- #define SYSTEM_DIR "/mnt/sd/DrPocketSnes"
-#endif
-
-#define SNES_OPTIONS_DIR "options"
-#define SNES_SRAM_DIR "sram"
-#define SNES_SAVESTATE_DIR "savestate"
-
-#define ROM_LIST_FILENAME "romlist.bin"
-#define SRAM_FILE_EXT "srm"
-#define SAVESTATE_EXT "sv"
-#define MENU_OPTIONS_FILENAME "menu"
-#define MENU_OPTIONS_EXT "opt"
-#define DEFAULT_ROM_DIR_FILENAME "romdir"
-#define DEFAULT_ROM_DIR_EXT "opt"
-
-
-//define emulation modes
-#define EMU_MODE_NONE 0
-#define EMU_MODE_SNES 1
-
-#define SAVESTATE_MODE_SAVE 0
-#define SAVESTATE_MODE_LOAD 1
-#define SAVESTATE_MODE_DELETE 2
-
-#define SNES_OPTIONS_VER 1
-#define PSVER "7.2.0"
-#ifdef ASMCPU
- #define DRSNES_VERSION "v " PSVER " fast"
-#else
- #define DRSNES_VERSION "v " PSVER " compatible"
-#endif
-
-#define ROM_SIZE 0x500000 //ssf2(40mbits)
-#define MENU_RGB(r,g,b) ((r) << 11 | (g) << 6 | (b) << 0 )
-#define COLOR_TITLE MENU_RGB(31, 0, 0)
-#define COLOR_FOCUS MENU_RGB(0, 0, 0)
-#define COLOR_ITEM MENU_RGB(31, 31, 31)
-#define COLOR_VERSION MENU_RGB(0, 0, 31)
-#define MAX_ROMS 3000
-#define MAX_CPU 39
-#ifndef MAX_PATH
-#define MAX_PATH 255
-#endif
-
-#if defined(__WIZ__)
- #ifdef __CAANOO__
- #define MENU_CPU_SPEED 300
- #else
- #define MENU_CPU_SPEED 120
- #endif
- #define MENU_FAST_CPU_SPEED 300
-#else
- #define MENU_CPU_SPEED 66
- #define MENU_FAST_CPU_SPEED 200
-#endif
-enum FILE_TYPE_ENUM
-{
- FILE_TYPE_FILE = 0,
- FILE_TYPE_DIRECTORY
-};
-
-enum MAIN_MENU_ENUM
-{
- MAIN_MENU_RETURN = 0,
- MAIN_MENU_ROM_SELECT,
- MAIN_MENU_MANAGE_SAVE_STATE,
- MAIN_MENU_SAVE_SRAM,
- MAIN_MENU_SAVE_SCREENSHOT,
- MAIN_MENU_SNES_OPTIONS,
- MAIN_MENU_RESET_GAME,
- MAIN_MENU_EXIT_APP,
- MAIN_MENU_COUNT
-};
-
-enum LOAD_ROM_ENUM
-{
- LOAD_ROM_MENU_SNES = 0,
- LOAD_ROM_MENU_RETURN,
- LOAD_ROM_MENU_COUNT
-};
-
-enum SNES_MENU_ENUM
-{
- SNES_MENU_SOUND = 0,
- SNES_MENU_SOUND_RATE,
- SNES_MENU_SOUND_VOL,
- SNES_MENU_FRAMESKIP,
- SNES_MENU_REGION,
- SNES_MENU_FPS,
- SNES_MENU_TRANSPARENCY,
-#if defined(__GP2X__)
- SNES_MENU_CPUSPEED,
- SNES_MENU_RENDER_MODE,
- SNES_MENU_GAMMA,
- SNES_MENU_ACTION_BUTTONS,
-#endif
-#if defined(__WIZ__)
- SNES_MENU_CPUSPEED,
- SNES_MENU_RENDER_MODE,
- SNES_MENU_ACTION_BUTTONS,
-#endif
- SNES_MENU_EMULATION_TYPE,
- SNES_MENU_LOAD_ROM_ON_INIT,
- SNES_MENU_ADVANCED_HACKS,
- SNES_MENU_AUTO_SAVE_SRAM,
- SNES_MENU_LOAD_GLOBAL,
- SNES_MENU_SAVE_GLOBAL,
- SNES_MENU_DELETE_GLOBAL,
- SNES_MENU_LOAD_CURRENT,
- SNES_MENU_SAVE_CURRENT,
- SNES_MENU_DELETE_CURRENT,
- SNES_MENU_SET_ROMDIR,
- SNES_MENU_CLEAR_ROMDIR,
- SNES_MENU_RETURN,
- SNES_MENU_COUNT
-};
-
-enum SAVESTATE_MENU_ENUM
-{
- SAVESTATE_MENU_LOAD = 0,
- SAVESTATE_MENU_SAVE,
- SAVESTATE_MENU_DELETE,
- SAVESTATE_MENU_RETURN,
- SAVESTATE_MENU_COUNT
-};
-
-enum HACKS_MENU_ENUM
-{
- HACKS_MENU_AUDIO = 0,
- HACKS_MENU_SNESADVANCE_DAT,
-#ifdef __OLD_RASTER_FX__
- HACKS_MENU_DELAYED_RASTER_FX,
-#endif
- HACKS_MENU_PALETTE,
- HACKS_MENU_FIXEDCOL,
- HACKS_MENU_WINDOW,
- HACKS_MENU_ADDSUB,
- HACKS_MENU_OBJ,
- HACKS_MENU_BG0,
- HACKS_MENU_BG1,
- HACKS_MENU_BG2,
- HACKS_MENU_BG3,
- HACKS_MENU_RETURN,
- HACKS_MENU_COUNT
-};
-
-enum SRAM_MENU_ENUM
-{
- SRAM_MENU_LOAD = 0,
- SRAM_MENU_SAVE,
- SRAM_MENU_DELETE,
- SRAM_MENU_RETURN,
- SRAM_MENU_COUNT,
-};
-
-enum EVENT_TYPES
-{
- EVENT_NONE = 0,
- EVENT_EXIT_APP,
- EVENT_LOAD_SNES_ROM,
- EVENT_RUN_SNES_ROM,
- EVENT_RESET_SNES_ROM
-};
-
-enum RENDER_MODE_ENUM
-{
- RENDER_MODE_UNSCALED = 0,
- RENDER_MODE_SCALED,
- RENDER_MODE_HORIZONTAL_SCALED
-};
-
-#define MENU_TILE_WIDTH 64
-#define MENU_TILE_HEIGHT 64
-
-#define GP32_GCC
-
-#ifdef __GIZ__
-#define INP_BUTTON_MENU_SELECT INP_BUTTON_PLAY
-#define INP_BUTTON_MENU_CANCEL INP_BUTTON_STOP
-#define INP_BUTTON_MENU_ENTER INP_BUTTON_BRIGHT
-#define INP_BUTTON_MENU_DELETE INP_BUTTON_REWIND
-#define INP_BUTTON_MENU_QUICKSAVE1 INP_BUTTON_R
-#define INP_BUTTON_MENU_QUICKSAVE2 INP_BUTTON_BRIGHT
-#define INP_BUTTON_MENU_QUICKLOAD1 INP_BUTTON_L
-#define INP_BUTTON_MENU_QUICKLOAD2 INP_BUTTON_BRIGHT
-
-//Menu Text
-#define MENU_TEXT_LOAD_SAVESTATE "Press Play to load"
-#define MENU_TEXT_OVERWRITE_SAVESTATE "Press Play to overwrite"
-#define MENU_TEXT_DELETE_SAVESTATE "Press Play to delete"
-#define MENU_TEXT_PREVIEW_SAVESTATE "Press R to preview"
-#endif
-
-#if defined(__GP2X__) || defined(__WIZ__)
-#define INP_BUTTON_MENU_SELECT INP_BUTTON_B
-#define INP_BUTTON_MENU_CANCEL INP_BUTTON_X
-#define INP_BUTTON_MENU_ENTER INP_BUTTON_SELECT
-#define INP_BUTTON_MENU_DELETE INP_BUTTON_SELECT
-#define INP_BUTTON_MENU_QUICKSAVE1 INP_BUTTON_R
-#define INP_BUTTON_MENU_QUICKSAVE2 INP_BUTTON_SELECT
-#define INP_BUTTON_MENU_QUICKLOAD1 INP_BUTTON_L
-#define INP_BUTTON_MENU_QUICKLOAD2 INP_BUTTON_SELECT
-
-
-//Menu Text
-#define MENU_TEXT_LOAD_SAVESTATE "Press B to load"
-#define MENU_TEXT_OVERWRITE_SAVESTATE "Press B to overwrite"
-#define MENU_TEXT_DELETE_SAVESTATE "Press B to delete"
-#define MENU_TEXT_PREVIEW_SAVESTATE "Press Y to preview"
-#endif
-
-typedef struct {
- char name[MAX_ROMS][MAX_PATH]; // 128 entrys,16 Bytes long
- int size[MAX_ROMS];
-} DIRDATA;
-
-//Graphics - moved to objects because they get updated with current gamma setting
-extern unsigned short menuHeader[];
-extern unsigned short menuHeaderOrig[];
-extern unsigned short highLightBar[];
-extern unsigned short highLightBarOrig[];
-extern unsigned short menuTile[];
-extern unsigned short menuTileOrig[];
-
-extern unsigned char padConfig[];
-extern float soundRates[];
-extern char currentWorkingDir[];
-extern char snesOptionsDir[];
-extern char snesSramDir[];
-extern char snesSaveStateDir[];
-extern unsigned char gammaConv[];
-extern char lastSaveName[];
-extern short *soundBuffer;
-extern unsigned char *RomData;
-extern int currentEmuMode;
-extern int lastStage;
-extern int currFB;
-extern int prevFB;
-extern int saveStateSize;
-extern int romLoaded;
-extern int frames,taken; // Frames and 60hz ticks
-extern char showFps;
-extern char soundRate;
-extern char soundOn;
-
-void UpdateMenuGraphicsGamma(void);
-int RoundDouble(double val);
-void ClearScreen(unsigned int *buffer,unsigned int data);
-void LoadSram(char *path,char *romname,char *ext,char *srammem);
-void SaveSram(char *path,char *romname,char *ext,char *srammem);
-void DeleteSram(char *path,char *romname,char *ext);
-int SaveMenuOptions(char *path, char *filename, char *ext, char *optionsmem, int maxsize, int showMessage);
-int LoadMenuOptions(char *path, char *filename, char *ext, char *optionsmem, int maxsize, int showMessage);
-int DeleteMenuOptions(char *path, char *filename, char *ext, int showMessage);
-void SnesDefaultMenuOptions(void);
-#ifdef __GIZ__
-void sync(void);
-#endif
-// menu.cpp
-void MenuPause(void);
-void MenuFlip(void);
-void SplitFilename(char *wholeFilename, char *filename, char *ext);
-void CheckDirSep(char *path);
-int FileSelect(int mode);
-int MainMenu(int prevAction);
-void PrintTitle(int flip);
-void PrintTile(int flip);
-void PrintBar(int flip, unsigned int givenY);
-
-int FileScan();
-extern void loadStateFile(char *filename);
-extern int quickSavePresent;
-extern unsigned short cpuSpeedLookup[];
-extern float gammaLookup[];
-
-extern char currentRomFilename[];
-extern char romDir[];
-extern char snesRomDir[];
-
-struct SNES_MENU_OPTIONS
-{
- unsigned char menuVer;
- unsigned char frameSkip;
- unsigned char soundOn;
- unsigned char cpuSpeed;
- unsigned char padConfig[32];
- unsigned char tripleBuffer;
- unsigned char forceRegion;
- unsigned char showFps;
- signed char gamma;
- unsigned char lcdver;
- unsigned char stereo;
- unsigned char soundRate;
- unsigned char autoSram;
- unsigned char renderMode;
- unsigned char volume;
- unsigned char actionButtons;
- unsigned char transparency;
- unsigned char ramSettings;
- unsigned char mmuHack;
- unsigned char region;
- unsigned char soundHack;
- unsigned short graphHacks;
- unsigned char asmspc700;
- unsigned char SpeedHacks;
- unsigned char loadOnInit;
- unsigned char delayedRasterFX;
- unsigned char spare1A;
- unsigned char spare1B;
- unsigned char spare1C;
- unsigned char spare1D;
- unsigned char spare1E;
-};
-
-extern struct SNES_MENU_OPTIONS snesMenuOptions;
-
-struct SAVE_STATE
-{
- char filename[MAX_PATH+1];
- char fullFilename[MAX_PATH+1];
- unsigned int inUse;
-};
-
-
-extern struct SAVE_STATE saveState[]; // holds the filenames for the savestate and "inuse" flags
-extern char saveStateName[];
-
-// Input.cpp
-struct INPUT
-{
- unsigned int held[32];
- unsigned int repeat[32];
-};
-extern struct INPUT Inp;
-
-int InputInit();
-int InputUpdate(int EnableDiagnals);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MENU_H_ */
-
-
-
-
-
diff --git a/src/menu_header.bmp b/src/menu_header.bmp
deleted file mode 100644
index 6066978..0000000
--- a/src/menu_header.bmp
+++ /dev/null
Binary files differ
diff --git a/src/menu_header.psp b/src/menu_header.psp
deleted file mode 100644
index 48fccc6..0000000
--- a/src/menu_header.psp
+++ /dev/null
Binary files differ
diff --git a/src/os9x_asm_cpu.h b/src/os9x_asm_cpu.h
index 250e55f..7de635d 100644
--- a/src/os9x_asm_cpu.h
+++ b/src/os9x_asm_cpu.h
@@ -5,6 +5,7 @@ extern "C" void test_opcode(SCPUState *cpuptr);
extern "C" void asmMainLoop_spcC(SCPUState *cpuptr);
extern "C" void asmMainLoop_spcAsm(SCPUState *cpuptr);
+extern "C" void asmMainLoop(SCPUState *cpuptr);
extern "C" void asm_S9xMainLoop(void);
diff --git a/src/osd_disk.c b/src/osd_disk.c
deleted file mode 100644
index 20ab220..0000000
--- a/src/osd_disk.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* GIMP RGB C-Source image dump (osd_disk.c) */
-
-static const struct {
- unsigned int width;
- unsigned int height;
- unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
- unsigned char pixel_data[16 * 16 * 3 + 1];
-} osd_img_disk = {
- 16, 16, 3,
- "\0\0\0Ir\263Ir\263\200\234\313\200\234\313\200\234\313\200\234\313\200\234"
- "\313\200\234\313\200\234\313\200\234\313\200\234\313\200\234\313Ir\263Ir"
- "\263\0\0\0Go\261m\245\341m\245\341\377\377\377\377\377\377\377\377\377\377"
- "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
- "\377\377m\245\341m\245\341Go\261El\257m\245\341m\245\341\377\377\377\377"
- "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
- "\377\377\377\377\377\377\377\377m\245\341m\245\341El\257Bh\254i\241\337i"
- "\241\337\377\377\377\334\352\370\270\324\361\270\324\361\270\324\361\270"
- "\324\361\270\324\361\270\324\361\334\352\370\377\377\377i\241\337i\241\337"
- "Bh\254?e\250d\235\335d\235\335\377\377\377\377\377\377\377\377\377\377\377"
- "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
- "\377d\235\335d\235\335?e\250<`\244^\230\332^\230\332\377\377\377\334\352"
- "\370\270\324\361\270\324\361\270\324\361\270\324\361\270\324\361\270\324"
- "\361\334\352\370\377\377\377^\230\332^\230\332<`\2448[\240X\223\327X\223"
- "\327\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
- "\377\377\377\377\377\377\377\377\377\377\377\377\377X\223\327X\223\3278["
- "\2404U\235R\215\324R\215\324\272\321\356\377\377\377\377\377\377\377\377"
- "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\272\321"
- "\356R\215\324R\215\3244U\2350Q\230K\207\320K\207\320K\207\320K\207\320K\207"
- "\320K\207\320K\207\320K\207\320K\207\320K\207\320K\207\320K\207\320K\207"
- "\320K\207\3200Q\230-L\224D\201\315D\201\315D\201\315D\201\315D\201\315D\201"
- "\315D\201\315D\201\315D\201\315D\201\315D\201\315D\201\315D\201\315D\201"
- "\315-L\224)F\220>{\312>{\312>{\312\311\325\344\354\354\352\354\354\352\354"
- "\354\352\354\354\352\354\354\352\354\354\352\311\325\344'?\214>{\312>{\312"
- ")F\220%A\2148v\3078v\3078v\307\354\354\352.U\244.U\244\354\354\352\354\354"
- "\352\354\354\352\354\354\352\354\354\352'?\2148v\3078v\307%A\214\"=\2112"
- "q\3042q\3042q\304\354\354\352+S\242+S\242\354\354\352\354\354\352\354\354"
- "\352\354\354\352\354\354\352'?\2142q\3042q\304\"=\211\0\0\0\36""9\205-m\302"
- "-m\302\354\354\352)Q\242)Q\242\354\354\352\354\354\352\354\354\352\354\354"
- "\352\354\354\352'?\214-m\302-m\302\36""9\205\0\0\0\0\0\0\34""5\202)i\300"
- "\354\354\352\354\354\352\354\354\352\354\354\352\354\354\352\354\354\352"
- "\354\354\352\354\354\352'?\214)i\300)i\300\34""5\202\0\0\0\0\0\0\0\0\0\32"
- """2\177\203\220\265\203\220\265\203\220\265\203\220\265\203\220\265\203\220"
- "\265\203\220\265\203\220\265\32""2\177\32""2\177\32""2\177\0\0\0",
-};
-
diff --git a/src/osnes9xgp_asmfunc.S b/src/osnes9xgp_asmfunc.S
deleted file mode 100644
index 7cdc3ec..0000000
--- a/src/osnes9xgp_asmfunc.S
+++ /dev/null
@@ -1,101 +0,0 @@
- .global asmClearScreenFast8
- .global asmClearScreenFast16
-
-asmClearScreenFast16:
-;@R0 = scr
-;@R1 = starty
-;@R2 = endy
-;@R3 = col
- stmfd R13!,{R4-R11}
-
- sub R12,R2,R1
- add R12,R12,#1
- ;@R12 = endy-starty+1
-
- mov r2,#320
- mul r1,r2,r1
- ;@R1 = 320*starty
-
- add R0,R0,R1,lsl #1
- ;@R0 = screen + ((320*starty)<<1)
-
- mov R2,R3
- mov R4,R3
- mov R5,R3
- mov R6,R3
- mov R7,R3
- mov R8,R3
- mov R9,R3
-2:
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
-
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
-
- add r0,r0,#32*4
-
- subs R12,R12,#1
- bne 2b
-
- ldmfd R13!,{R4-R11}
- mov PC,LR
-
-
-asmClearScreenFast8:
-;R0 = scr
-;R1 = starty
-;R2 = endy
-;R3 = col
- stmfd R13!,{R4-R11}
-
- sub R12,R2,R1
- add R12,R12,#1
- ;@R12 = endy-starty+1
-
- mov r2,#320
- mul r1,r2,r1
- ;@R1 = 320*starty
-
- add R0,R0,R1
- ;@R0 = screen + ((320*starty))
-
- mov R2,R3
- mov R4,R3
- mov R5,R3
- mov R6,R3
- mov R7,R3
- mov R8,R3
- mov R9,R3
-
-2:
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
- stmia R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
-
- subs R12,R12,#1
- bne 2b
-
- ldmfd R13!,{R4-R11}
- mov PC,LR
-
- \ No newline at end of file
diff --git a/src/r.txt b/src/r.txt
deleted file mode 100644
index 49eac71..0000000
--- a/src/r.txt
+++ /dev/null
@@ -1,876 +0,0 @@
-os9x_65c816_common.s: Assembler messages:
-os9x_65c816_common.s:7: Error: no such instruction: `rstatus .req R4@format:0xff800000'
-os9x_65c816_common.s:8: Error: no such instruction: `reg_d_bank .req R4@format:0x000000ll'
-os9x_65c816_common.s:9: Error: no such instruction: `reg_a .req R5@format:0xhhll0000 or 0xll000000'
-os9x_65c816_common.s:10: Error: no such instruction: `reg_d .req R6@format:0xhhll0000'
-os9x_65c816_common.s:11: Error: no such instruction: `reg_p_bank .req R6@format:0x000000ll'
-os9x_65c816_common.s:12: Error: no such instruction: `reg_x .req R7@format:0xhhll0000 or 0xll000000'
-os9x_65c816_common.s:13: Error: no such instruction: `reg_s .req R8@format:0x0000hhll'
-os9x_65c816_common.s:14: Error: no such instruction: `reg_y .req R9@format:0xhhll0000 or 0xll000000'
-os9x_65c816_common.s:16: Error: no such instruction: `rpc .req R10@32bits address'
-os9x_65c816_common.s:17: Error: no such instruction: `reg_cycles .req R11@32bits counter'
-os9x_65c816_common.s:18: Error: no such instruction: `regpcbase .req R12@32bits address'
-os9x_65c816_common.s:20: Error: no such instruction: `rscratch .req R0@format:0xhhll0000 if data and calculation or return of S9XREADBYTE or WORD'
-os9x_65c816_common.s:21: Error: no such instruction: `regopcode .req R0@format:0x000000ll'
-os9x_65c816_common.s:22: Error: no such instruction: `rscratch2 .req R1@format:0xhhll for calculation and value'
-os9x_65c816_common.s:23: Error: no such instruction: `rscratch3 .req R2@'
-os9x_65c816_common.s:24: Error: no such instruction: `rscratch4 .req R3@??????'
-os9x_65c816_common.s:26: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:27: Error: no such instruction: `rscratch9 .req R10@??????'
-os9x_65c816_common.s:29: Error: no such instruction: `reg_cpu_var .req R14'
-os9x_65c816_common.s:33: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:34: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:36: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:56: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:57: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:58: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:59: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:60: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:61: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:62: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:63: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:85: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:104: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:143: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:194: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:667: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:841: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:842: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:843: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:844: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_common.s:845: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:8: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:9: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:10: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:12: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:13: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:14: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:15: Error: too many memory references for `mov'
-os9x_65c816_global.s:18: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:19: Error: no such instruction: `ldr r2,[reg_cpu_var,'
-os9x_65c816_global.s:20: Error: no such instruction: `bic r1,r1,'
-os9x_65c816_global.s:22: Error: no such instruction: `ldr regpcbase,[r2,r1,lsl'
-os9x_65c816_global.s:23: Error: no such instruction: `bic r0,r0,'
-os9x_65c816_global.s:25: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:26: Error: no such instruction: `blo SPCBSpecial'
-os9x_65c816_global.s:30: Error: no such instruction: `ldr r2,[reg_cpu_var,'
-os9x_65c816_global.s:31: Error: no such instruction: `ldr r1,[r2,r1,lsl'
-os9x_65c816_global.s:32: Error: too many memory references for `add'
-os9x_65c816_global.s:33: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:34: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:35: Error: no such instruction: `orr rstatus,rstatus,r1,lsl'
-os9x_65c816_global.s:37: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:42: Error: no such instruction: `ldr pc,[pc,regpcbase,lsl'
-os9x_65c816_global.s:43: Error: too many memory references for `mov'
-os9x_65c816_global.s:76: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:77: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:79: Error: no such instruction: `ldr r1,vMemory'
-os9x_65c816_global.s:80: Error: no such instruction: `ldr regpcbase,[r1,'
-os9x_65c816_global.s:82: Error: too many memory references for `sub'
-os9x_65c816_global.s:83: Error: too many memory references for `add'
-os9x_65c816_global.s:85: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:86: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:87: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:88: Error: no such instruction: `orr rstatus,rstatus,r0,lsl'
-os9x_65c816_global.s:90: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:91: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:92: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:95: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:96: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:98: Error: no such instruction: `ldr r1,vMemory'
-os9x_65c816_global.s:99: Error: no such instruction: `ldr regpcbase,[r1,'
-os9x_65c816_global.s:101: Error: too many memory references for `sub'
-os9x_65c816_global.s:102: Error: too many memory references for `add'
-os9x_65c816_global.s:104: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:105: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:106: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:107: Error: no such instruction: `orr rstatus,rstatus,r0,lsl'
-os9x_65c816_global.s:109: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:110: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:111: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:114: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:115: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:117: Error: no such instruction: `ldr r1,vMemory'
-os9x_65c816_global.s:118: Error: no such instruction: `ldr regpcbase,[r1,'
-os9x_65c816_global.s:120: Error: too many memory references for `sub'
-os9x_65c816_global.s:121: Error: too many memory references for `add'
-os9x_65c816_global.s:123: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:124: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:125: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:126: Error: no such instruction: `orr rstatus,rstatus,r0,lsl'
-os9x_65c816_global.s:128: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:129: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:130: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:133: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:134: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:136: Error: no such instruction: `ldr r1,vMemory'
-os9x_65c816_global.s:137: Error: no such instruction: `ldr regpcbase,[r1,'
-os9x_65c816_global.s:139: Error: too many memory references for `add'
-os9x_65c816_global.s:141: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:142: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:143: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:144: Error: no such instruction: `orr rstatus,rstatus,r0,lsl'
-os9x_65c816_global.s:146: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:147: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:148: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:151: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:152: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:154: Error: no such instruction: `ldr r1,vMemory'
-os9x_65c816_global.s:155: Error: no such instruction: `ldr regpcbase,[r1,'
-os9x_65c816_global.s:157: Error: too many memory references for `sub'
-os9x_65c816_global.s:158: Error: too many memory references for `add'
-os9x_65c816_global.s:160: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:161: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:162: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:163: Error: no such instruction: `orr rstatus,rstatus,r0,lsl'
-os9x_65c816_global.s:165: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:166: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:167: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:170: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:171: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:172: Error: no such instruction: `ldr r1,vMemory'
-os9x_65c816_global.s:173: Error: no such instruction: `ldr regpcbase,[r1,'
-os9x_65c816_global.s:175: Error: too many memory references for `sub'
-os9x_65c816_global.s:176: Error: too many memory references for `add'
-os9x_65c816_global.s:178: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:179: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:180: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:181: Error: no such instruction: `orr rstatus,rstatus,r0,lsl'
-os9x_65c816_global.s:183: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:184: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:185: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:188: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:189: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:190: Error: no such instruction: `ldr r1,vMemory'
-os9x_65c816_global.s:191: Error: no such instruction: `ldr regpcbase,[r1,'
-os9x_65c816_global.s:193: Error: too many memory references for `sub'
-os9x_65c816_global.s:194: Error: too many memory references for `add'
-os9x_65c816_global.s:196: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:197: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:198: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:199: Error: no such instruction: `orr rstatus,rstatus,r0,lsl'
-os9x_65c816_global.s:201: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:202: Error: no such instruction: `bx r3'
-os9x_65c816_global.s:203: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:206: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:208: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:209: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:210: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:211: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:212: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:213: Error: too many memory references for `mov'
-os9x_65c816_global.s:214: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:215: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:216: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:217: Error: no such instruction: `bic R1,R1,'
-os9x_65c816_global.s:218: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:219: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:220: Error: no such instruction: `ldr R2,[R2,R1,LSL'
-os9x_65c816_global.s:221: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:222: Error: no such instruction: `blo GBSpecial@special'
-os9x_65c816_global.s:223: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:224: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:225: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:226: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:227: Error: too many memory references for `mov'
-os9x_65c816_global.s:228: Error: no such instruction: `ldr R3,[R3,R1,lsl'
-os9x_65c816_global.s:229: Error: too many memory references for `add'
-os9x_65c816_global.s:230: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:231: Error: too many memory references for `add'
-os9x_65c816_global.s:232: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:233: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:234: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:235: Error: no such instruction: `ldrb R3,[R3,R1]'
-os9x_65c816_global.s:236: Error: no such instruction: `ldrb R0,[R2]'
-os9x_65c816_global.s:237: Warning: `R3' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:237: Warning: `R3' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:237: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:238: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:239: Error: no such instruction: `ldrne R1,[reg_cpu_var,'
-os9x_65c816_global.s:240: Error: no such instruction: `orrne rstatus,rstatus,'
-os9x_65c816_global.s:241: Error: no such instruction: `strne R1,[reg_cpu_var,'
-os9x_65c816_global.s:244: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:247: Error: no such instruction: `ldr PC,[PC,R2,LSL'
-os9x_65c816_global.s:248: Error: too many memory references for `mov'
-os9x_65c816_global.s:265: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:266: Error: no such instruction: `ldrb R1,[reg_cpu_var,'
-os9x_65c816_global.s:267: Warning: `R1' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:267: Warning: `R1' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:267: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:268: Error: no such instruction: `addeq reg_cycles,reg_cycles,'
-os9x_65c816_global.s:269: Error: too many memory references for `mov'
-os9x_65c816_global.s:270: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:271: Error: too many memory references for `mov'
-os9x_65c816_global.s:273: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:274: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:275: Error: no such instruction: `bl S9xGetPPU'
-os9x_65c816_global.s:276: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:277: Error: no such instruction: `ldr rstatus,[reg_cpu_var,'
-os9x_65c816_global.s:279: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:280: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:282: Error: too many memory references for `add'
-os9x_65c816_global.s:283: Error: too many memory references for `mov'
-os9x_65c816_global.s:284: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:285: Error: too many memory references for `mov'
-os9x_65c816_global.s:286: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:287: Error: no such instruction: `bl S9xGetCPU'
-os9x_65c816_global.s:288: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:289: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:290: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:293: Error: too many memory references for `add'
-os9x_65c816_global.s:294: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:295: Error: no such instruction: `bic r0,r0,'
-os9x_65c816_global.s:296: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:297: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:299: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:300: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:301: Error: no such instruction: `blx reg_cycles'
-os9x_65c816_global.s:302: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:303: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:304: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:305: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:307: Error: too many memory references for `add'
-os9x_65c816_global.s:308: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:309: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:310: Error: too many memory references for `and'
-os9x_65c816_global.s:311: Error: no such instruction: `ldrb R0,[R1,R0]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:312: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:315: Error: too many memory references for `add'
-os9x_65c816_global.s:317: Error: too many memory references for `mov'
-os9x_65c816_global.s:318: Error: too many memory references for `and'
-os9x_65c816_global.s:319: Error: too many memory references for `mov'
-os9x_65c816_global.s:320: Error: too many memory references for `mov'
-os9x_65c816_global.s:321: Error: too many memory references for `add'
-os9x_65c816_global.s:322: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:323: Error: too many memory references for `sub'
-os9x_65c816_global.s:324: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:325: Error: too many memory references for `and'
-os9x_65c816_global.s:326: Error: no such instruction: `ldrb R0,[R1,R0]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:327: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:331: Error: too many memory references for `mov'
-os9x_65c816_global.s:332: Error: too many memory references for `add'
-os9x_65c816_global.s:333: Error: too many memory references for `and'
-os9x_65c816_global.s:334: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:335: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:340: Error: too many memory references for `add'
-os9x_65c816_global.s:341: Error: too many memory references for `mov'
-os9x_65c816_global.s:342: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:343: Error: too many memory references for `mov'
-os9x_65c816_global.s:344: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:345: Error: no such instruction: `bl S9xGetC4'
-os9x_65c816_global.s:346: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:347: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:348: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:351: Error: too many memory references for `mov'
-os9x_65c816_global.s:352: Error: too many memory references for `add'
-os9x_65c816_global.s:353: Error: too many memory references for `mov'
-os9x_65c816_global.s:354: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:355: Error: too many memory references for `sub'
-os9x_65c816_global.s:356: Error: no such instruction: `ldrb R0,[R0,R1]@*Memory.BWRAM+((Address&0x7fff)- 0x6000)'
-os9x_65c816_global.s:357: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:360: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:362: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:363: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:364: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:365: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:368: Error: too many memory references for `mov'
-os9x_65c816_global.s:369: Error: too many memory references for `add'
-os9x_65c816_global.s:370: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:371: Error: no such instruction: `bne GW_NotBoundary'
-os9x_65c816_global.s:373: Error: no such instruction: `stmfd R13!,{R0}'
-os9x_65c816_global.s:374: Error: no such instruction: `stmfd R13!,{PC}'
-os9x_65c816_global.s:375: Error: no such instruction: `b asmS9xGetByte'
-os9x_65c816_global.s:376: Error: too many memory references for `mov'
-os9x_65c816_global.s:377: Error: no such instruction: `ldmfd R13!,{R1}'
-os9x_65c816_global.s:378: Error: no such instruction: `stmfd R13!,{R0}'
-os9x_65c816_global.s:379: Error: too many memory references for `add'
-os9x_65c816_global.s:380: Error: no such instruction: `stmfd R13!,{PC}'
-os9x_65c816_global.s:381: Error: no such instruction: `b asmS9xGetByte'
-os9x_65c816_global.s:382: Error: too many memory references for `mov'
-os9x_65c816_global.s:383: Error: no such instruction: `ldmfd R13!,{R1}'
-os9x_65c816_global.s:384: Error: no such instruction: `orr R0,R1,R0,LSL'
-os9x_65c816_global.s:385: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:389: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:390: Error: too many memory references for `mov'
-os9x_65c816_global.s:391: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:392: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:393: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:394: Error: no such instruction: `bic R1,R1,'
-os9x_65c816_global.s:395: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:396: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:397: Error: no such instruction: `ldr R2,[R2,R1,LSL'
-os9x_65c816_global.s:398: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:399: Error: no such instruction: `blo GWSpecial@special'
-os9x_65c816_global.s:400: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:402: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:403: Error: no such instruction: `bne GW_Not_Aligned1'
-os9x_65c816_global.s:404: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:405: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:406: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:407: Error: too many memory references for `mov'
-os9x_65c816_global.s:408: Error: no such instruction: `ldr R3,[R3,R1,lsl'
-os9x_65c816_global.s:409: Error: too many memory references for `mov'
-os9x_65c816_global.s:410: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:411: Error: too many memory references for `add'
-os9x_65c816_global.s:412: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:413: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:414: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:415: Error: no such instruction: `ldrh R0,[R2,R0]'
-os9x_65c816_global.s:416: Error: no such instruction: `ldrb R3,[R3,R1]'
-os9x_65c816_global.s:417: Warning: `R3' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:417: Warning: `R3' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:417: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:418: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:419: Error: no such instruction: `ldrne R1,[reg_cpu_var,'
-os9x_65c816_global.s:420: Error: no such instruction: `orrne rstatus,rstatus,'
-os9x_65c816_global.s:421: Error: no such instruction: `strne R1,[reg_cpu_var,'
-os9x_65c816_global.s:423: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:426: Error: too many memory references for `mov'
-os9x_65c816_global.s:427: Error: too many memory references for `add'
-os9x_65c816_global.s:428: Error: no such instruction: `ldrb R3,[R2,R3,LSR'
-os9x_65c816_global.s:429: Error: no such instruction: `ldrb R0,[R2,R0,LSR'
-os9x_65c816_global.s:430: Error: no such instruction: `orr R0,R0,R3,LSL'
-os9x_65c816_global.s:432: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:433: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:434: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:435: Error: no such instruction: `ldrb R3,[R3,R1]@R3=BlockIsRAM[block]'
-os9x_65c816_global.s:436: Error: no such instruction: `ldr R2,[R2,R1,lsl'
-os9x_65c816_global.s:437: Warning: `R3' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:437: Error: invalid character '?' in operand 2
-os9x_65c816_global.s:438: Error: no such instruction: `ldrne R1,[reg_cpu_var,'
-os9x_65c816_global.s:439: Error: no such instruction: `orrne rstatus,rstatus,'
-os9x_65c816_global.s:440: Error: no such instruction: `strne R1,[reg_cpu_var,'
-os9x_65c816_global.s:441: Error: too many memory references for `add'
-os9x_65c816_global.s:442: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:444: Error: no such instruction: `ldr PC,[PC,R2,LSL'
-os9x_65c816_global.s:445: Error: too many memory references for `mov'
-os9x_65c816_global.s:466: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:467: Error: no such instruction: `ldrb R1,[reg_cpu_var,'
-os9x_65c816_global.s:468: Warning: `R1' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:468: Warning: `R1' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:468: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:469: Error: no such instruction: `addeq reg_cycles,reg_cycles,'
-os9x_65c816_global.s:470: Error: too many memory references for `mov'
-os9x_65c816_global.s:471: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:472: Error: too many memory references for `mov'
-os9x_65c816_global.s:474: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:475: Error: no such instruction: `stmfd R13!,{R0,R12,R14}'
-os9x_65c816_global.s:476: Error: no such instruction: `bl S9xGetPPU'
-os9x_65c816_global.s:477: Error: no such instruction: `ldmfd R13!,{R1}'
-os9x_65c816_global.s:478: Error: no such instruction: `stmfd R13!,{R0}'
-os9x_65c816_global.s:479: Error: too many memory references for `add'
-os9x_65c816_global.s:480: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:481: Error: no such instruction: `bl S9xGetPPU'
-os9x_65c816_global.s:482: Error: no such instruction: `ldmfd R13!,{R1,R12,R14}'
-os9x_65c816_global.s:483: Error: no such instruction: `ldr rstatus,[reg_cpu_var,'
-os9x_65c816_global.s:485: Error: no such instruction: `orr R0,R1,R0,LSL'
-os9x_65c816_global.s:486: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:487: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:489: Error: too many memory references for `add'
-os9x_65c816_global.s:490: Error: too many memory references for `mov'
-os9x_65c816_global.s:491: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:492: Error: too many memory references for `mov'
-os9x_65c816_global.s:493: Error: no such instruction: `stmfd R13!,{R0,R12,R14}'
-os9x_65c816_global.s:494: Error: no such instruction: `bl S9xGetCPU'
-os9x_65c816_global.s:495: Error: no such instruction: `ldmfd R13!,{R1}'
-os9x_65c816_global.s:496: Error: no such instruction: `stmfd R13!,{R0}'
-os9x_65c816_global.s:497: Error: too many memory references for `add'
-os9x_65c816_global.s:498: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:499: Error: no such instruction: `bl S9xGetCPU'
-os9x_65c816_global.s:500: Error: no such instruction: `ldmfd R13!,{R1,R12,R14}'
-os9x_65c816_global.s:501: Error: no such instruction: `orr R0,R1,R0,LSL'
-os9x_65c816_global.s:502: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:503: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:505: Error: too many memory references for `add'
-os9x_65c816_global.s:507: Error: no such instruction: `bic r0,r0,'
-os9x_65c816_global.s:508: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:511: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:512: Error: no such instruction: `stmfd R13!,{R0,R12,R14}'
-os9x_65c816_global.s:513: Error: no such instruction: `blx reg_cycles'
-os9x_65c816_global.s:514: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:515: Error: no such instruction: `ldmfd R13!,{R1}'
-os9x_65c816_global.s:516: Error: no such instruction: `stmfd R13!,{R0}'
-os9x_65c816_global.s:517: Error: too many memory references for `add'
-os9x_65c816_global.s:518: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:519: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:520: Error: no such instruction: `blx reg_cycles'
-os9x_65c816_global.s:521: Error: no such instruction: `ldmfd R13!,{R1,R12,R14}'
-os9x_65c816_global.s:522: Error: no such instruction: `orr R0,R1,R0,LSL'
-os9x_65c816_global.s:523: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:524: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:526: Error: too many memory references for `add'
-os9x_65c816_global.s:528: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:529: Error: no such instruction: `bne GW_Not_Aligned2'
-os9x_65c816_global.s:530: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:531: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:532: Error: too many memory references for `and'
-os9x_65c816_global.s:533: Error: no such instruction: `ldrh R0,[R3,R1]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:534: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:536: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:537: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:538: Error: too many memory references for `and'
-os9x_65c816_global.s:539: Error: too many memory references for `add'
-os9x_65c816_global.s:540: Error: too many memory references for `and'
-os9x_65c816_global.s:541: Error: no such instruction: `ldrb R3,[R1,R3]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:542: Error: no such instruction: `ldrb R2,[R1,R2]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:543: Error: no such instruction: `orr R0,R3,R2,LSL'
-os9x_65c816_global.s:544: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:547: Error: too many memory references for `add'
-os9x_65c816_global.s:549: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:550: Error: no such instruction: `bne GW_Not_Aligned3'
-os9x_65c816_global.s:552: Error: too many memory references for `mov'
-os9x_65c816_global.s:553: Error: too many memory references for `and'
-os9x_65c816_global.s:554: Error: too many memory references for `mov'
-os9x_65c816_global.s:555: Error: too many memory references for `mov'
-os9x_65c816_global.s:556: Error: too many memory references for `add'
-os9x_65c816_global.s:557: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:558: Error: too many memory references for `sub'
-os9x_65c816_global.s:560: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:561: Error: too many memory references for `and'
-os9x_65c816_global.s:562: Error: no such instruction: `ldrh R0,[R1,R0]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:563: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:566: Error: too many memory references for `mov'
-os9x_65c816_global.s:567: Error: too many memory references for `and'
-os9x_65c816_global.s:568: Error: too many memory references for `mov'
-os9x_65c816_global.s:569: Error: too many memory references for `mov'
-os9x_65c816_global.s:570: Error: too many memory references for `add'
-os9x_65c816_global.s:571: Error: too many memory references for `add'
-os9x_65c816_global.s:572: Error: too many memory references for `sub'
-os9x_65c816_global.s:573: Error: too many memory references for `mov'
-os9x_65c816_global.s:574: Error: too many memory references for `and'
-os9x_65c816_global.s:575: Error: too many memory references for `mov'
-os9x_65c816_global.s:576: Error: too many memory references for `mov'
-os9x_65c816_global.s:577: Error: too many memory references for `add'
-os9x_65c816_global.s:578: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:579: Error: too many memory references for `sub'
-os9x_65c816_global.s:580: Error: too many memory references for `and'
-os9x_65c816_global.s:581: Error: too many memory references for `and'
-os9x_65c816_global.s:583: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:584: Error: no such instruction: `ldrb R0,[R0,R3]@*Memory.SRAM+(Address...)&SRAMMask'
-os9x_65c816_global.s:585: Error: no such instruction: `ldrb R2,[R2,R3]@*Memory.SRAM+(Address+1...)&SRAMMask'
-os9x_65c816_global.s:586: Error: no such instruction: `orr R0,R2,R0,LSL'
-os9x_65c816_global.s:588: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:592: Error: too many memory references for `mov'
-os9x_65c816_global.s:593: Error: too many memory references for `add'
-os9x_65c816_global.s:594: Error: too many memory references for `mov'
-os9x_65c816_global.s:595: Error: no such instruction: `orr R0,R0,R0,LSL'
-os9x_65c816_global.s:596: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:598: Error: too many memory references for `add'
-os9x_65c816_global.s:599: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:600: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:602: Error: too many memory references for `add'
-os9x_65c816_global.s:603: Error: too many memory references for `mov'
-os9x_65c816_global.s:604: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:605: Error: too many memory references for `mov'
-os9x_65c816_global.s:606: Error: no such instruction: `stmfd R13!,{R0,R12,R14}'
-os9x_65c816_global.s:607: Error: no such instruction: `bl S9xGetC4'
-os9x_65c816_global.s:608: Error: no such instruction: `ldmfd R13!,{R1}'
-os9x_65c816_global.s:609: Error: no such instruction: `stmfd R13!,{R0}'
-os9x_65c816_global.s:610: Error: too many memory references for `add'
-os9x_65c816_global.s:611: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:612: Error: no such instruction: `bl S9xGetC4'
-os9x_65c816_global.s:613: Error: no such instruction: `ldmfd R13!,{R1,R12,R14}'
-os9x_65c816_global.s:614: Error: no such instruction: `orr R0,R1,R0,LSL'
-os9x_65c816_global.s:615: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:616: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:618: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:619: Error: no such instruction: `bne GW_Not_Aligned4'
-os9x_65c816_global.s:620: Error: too many memory references for `mov'
-os9x_65c816_global.s:621: Error: too many memory references for `add'
-os9x_65c816_global.s:622: Error: too many memory references for `mov'
-os9x_65c816_global.s:623: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:624: Error: too many memory references for `sub'
-os9x_65c816_global.s:625: Error: no such instruction: `ldrh R0,[R1,R0]@*Memory.BWRAM+((Address&0x7fff)- 0x6000)'
-os9x_65c816_global.s:626: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:628: Error: too many memory references for `mov'
-os9x_65c816_global.s:629: Error: too many memory references for `add'
-os9x_65c816_global.s:630: Error: too many memory references for `add'
-os9x_65c816_global.s:631: Error: too many memory references for `mov'
-os9x_65c816_global.s:632: Error: too many memory references for `mov'
-os9x_65c816_global.s:633: Error: no such instruction: `ldr R1,[reg_cpu_var,'
-os9x_65c816_global.s:634: Error: too many memory references for `sub'
-os9x_65c816_global.s:635: Error: too many memory references for `sub'
-os9x_65c816_global.s:636: Error: no such instruction: `ldrb R0,[R1,R0]@*Memory.BWRAM+((Address&0x7fff)- 0x6000)'
-os9x_65c816_global.s:637: Error: no such instruction: `ldrb R3,[R1,R3]@*Memory.BWRAM+(((Address+1)&0x7fff)- 0x6000)'
-os9x_65c816_global.s:638: Error: no such instruction: `orr R0,R0,R3,LSL'
-os9x_65c816_global.s:639: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:644: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:646: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:647: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:648: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:649: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:650: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:651: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:652: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:654: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:656: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:657: Error: too many memory references for `mov'
-os9x_65c816_global.s:658: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:659: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:660: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:661: Error: no such instruction: `bic R3,R3,'
-os9x_65c816_global.s:662: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:663: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:664: Error: no such instruction: `ldr R2,[R2,R3,LSL'
-os9x_65c816_global.s:665: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:666: Error: no such instruction: `blo SBSpecial@special'
-os9x_65c816_global.s:667: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:669: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:670: Error: too many memory references for `mov'
-os9x_65c816_global.s:671: Error: too many memory references for `add'
-os9x_65c816_global.s:672: Error: no such instruction: `ldr R0,[reg_cpu_var,'
-os9x_65c816_global.s:673: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:674: Error: invalid char '[' beginning operand 2 `[R2]'
-os9x_65c816_global.s:675: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:676: Error: no such instruction: `ldr R0,[R0,R3,lsl'
-os9x_65c816_global.s:677: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:678: Error: too many memory references for `add'
-os9x_65c816_global.s:679: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:680: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:681: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:682: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:684: Error: no such instruction: `ldr PC,[PC,R2,LSL'
-os9x_65c816_global.s:685: Error: too many memory references for `mov'
-os9x_65c816_global.s:702: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:703: Error: no such instruction: `ldrb R2,[reg_cpu_var,'
-os9x_65c816_global.s:704: Warning: `R2' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:704: Warning: `R2' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:704: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:705: Error: no such instruction: `addeq reg_cycles,reg_cycles,'
-os9x_65c816_global.s:706: Error: too many memory references for `mov'
-os9x_65c816_global.s:707: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:708: Error: too many memory references for `mov'
-os9x_65c816_global.s:709: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:710: Error: too many memory references for `mov'
-os9x_65c816_global.s:711: Error: too many memory references for `mov'
-os9x_65c816_global.s:712: Error: too many memory references for `mov'
-os9x_65c816_global.s:713: Error: no such instruction: `bl S9xSetPPU'
-os9x_65c816_global.s:714: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:715: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:716: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:718: Error: too many memory references for `add'
-os9x_65c816_global.s:719: Error: too many memory references for `mov'
-os9x_65c816_global.s:720: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:721: Error: too many memory references for `mov'
-os9x_65c816_global.s:722: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:723: Error: too many memory references for `mov'
-os9x_65c816_global.s:724: Error: too many memory references for `mov'
-os9x_65c816_global.s:725: Error: too many memory references for `mov'
-os9x_65c816_global.s:726: Error: no such instruction: `bl S9xSetCPU'
-os9x_65c816_global.s:727: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:728: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:729: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:731: Error: too many memory references for `add'
-os9x_65c816_global.s:732: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:733: Error: no such instruction: `bic r0,r0,'
-os9x_65c816_global.s:734: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:735: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:736: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:737: Error: too many memory references for `mov'
-os9x_65c816_global.s:738: Error: too many memory references for `mov'
-os9x_65c816_global.s:739: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:740: Error: too many memory references for `mov'
-os9x_65c816_global.s:741: Error: no such instruction: `blx reg_cycles'
-os9x_65c816_global.s:742: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:743: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:744: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:745: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:747: Error: too many memory references for `add'
-os9x_65c816_global.s:748: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:749: Warning: `R2' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:749: Warning: `R2' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:749: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:750: Error: no such instruction: `ldmeqfd R13!,{PC}@return if SRAMMask=0'
-os9x_65c816_global.s:751: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:752: Error: too many memory references for `and'
-os9x_65c816_global.s:753: Error: invalid char '[' beginning operand 2 `[R0'
-os9x_65c816_global.s:755: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:756: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:757: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:760: Error: too many memory references for `add'
-os9x_65c816_global.s:762: Error: too many memory references for `mov'
-os9x_65c816_global.s:763: Error: too many memory references for `and'
-os9x_65c816_global.s:764: Error: too many memory references for `mov'
-os9x_65c816_global.s:765: Error: too many memory references for `mov'
-os9x_65c816_global.s:766: Error: too many memory references for `add'
-os9x_65c816_global.s:768: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:769: Warning: `R2' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:769: Warning: `R2' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:769: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:770: Error: no such instruction: `ldmeqfd R13!,{PC}@return if SRAMMask=0'
-os9x_65c816_global.s:772: Error: too many memory references for `sub'
-os9x_65c816_global.s:773: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:774: Error: too many memory references for `and'
-os9x_65c816_global.s:775: Error: invalid char '[' beginning operand 2 `[R0'
-os9x_65c816_global.s:777: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:778: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:779: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:784: Error: too many memory references for `add'
-os9x_65c816_global.s:785: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:787: Error: too many memory references for `add'
-os9x_65c816_global.s:788: Error: too many memory references for `mov'
-os9x_65c816_global.s:789: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:790: Error: too many memory references for `mov'
-os9x_65c816_global.s:791: Error: no such instruction: `stmfd R13!,{R12,R14}'
-os9x_65c816_global.s:792: Error: too many memory references for `mov'
-os9x_65c816_global.s:793: Error: too many memory references for `mov'
-os9x_65c816_global.s:794: Error: too many memory references for `mov'
-os9x_65c816_global.s:795: Error: no such instruction: `bl S9xSetC4'
-os9x_65c816_global.s:796: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:797: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:798: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:800: Error: too many memory references for `mov'
-os9x_65c816_global.s:801: Error: too many memory references for `add'
-os9x_65c816_global.s:802: Error: too many memory references for `mov'
-os9x_65c816_global.s:803: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:804: Error: too many memory references for `sub'
-os9x_65c816_global.s:805: Error: invalid char '[' beginning operand 2 `[R0'
-os9x_65c816_global.s:807: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:808: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:810: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:814: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:816: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:817: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:818: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:819: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:821: Error: too many memory references for `mov'
-os9x_65c816_global.s:822: Error: too many memory references for `add'
-os9x_65c816_global.s:823: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:824: Error: no such instruction: `bne SW_NotBoundary'
-os9x_65c816_global.s:826: Error: no such instruction: `stmfd R13!,{R0,R1}'
-os9x_65c816_global.s:827: Error: no such instruction: `stmfd R13!,{PC}'
-os9x_65c816_global.s:828: Error: no such instruction: `b asmS9xSetByte'
-os9x_65c816_global.s:829: Error: too many memory references for `mov'
-os9x_65c816_global.s:830: Error: no such instruction: `ldmfd R13!,{R0,R1}'
-os9x_65c816_global.s:831: Error: too many memory references for `add'
-os9x_65c816_global.s:832: Error: too many memory references for `mov'
-os9x_65c816_global.s:833: Error: no such instruction: `stmfd R13!,{PC}'
-os9x_65c816_global.s:834: Error: no such instruction: `b asmS9xSetByte'
-os9x_65c816_global.s:835: Error: too many memory references for `mov'
-os9x_65c816_global.s:837: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:841: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:842: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:843: Error: no such instruction: `bic rstatus,rstatus,'
-os9x_65c816_global.s:845: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:846: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:847: Error: too many memory references for `mov'
-os9x_65c816_global.s:848: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:849: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:850: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:851: Error: no such instruction: `bic R3,R3,'
-os9x_65c816_global.s:852: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:853: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:854: Error: no such instruction: `ldr R2,[R2,R3,LSL'
-os9x_65c816_global.s:855: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:856: Error: no such instruction: `blo SWSpecial@special'
-os9x_65c816_global.s:857: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:860: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:861: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:862: Error: no such instruction: `bne SW_not_aligned1'
-os9x_65c816_global.s:863: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:864: Error: too many memory references for `mov'
-os9x_65c816_global.s:865: Error: too many memory references for `add'
-os9x_65c816_global.s:866: Error: no such instruction: `ldr R0,[reg_cpu_var,'
-os9x_65c816_global.s:867: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:868: Error: no such instruction: `strh R1,[R2]'
-os9x_65c816_global.s:869: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:870: Error: no such instruction: `ldr R0,[R0,R3,lsl'
-os9x_65c816_global.s:871: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:872: Error: too many memory references for `add'
-os9x_65c816_global.s:873: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:874: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:875: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:876: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:879: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:880: Error: too many memory references for `mov'
-os9x_65c816_global.s:881: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:882: Error: invalid char '[' beginning operand 2 `[R2'
-os9x_65c816_global.s:883: Error: too many memory references for `add'
-os9x_65c816_global.s:884: Error: too many memory references for `mov'
-os9x_65c816_global.s:885: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:886: Error: invalid char '[' beginning operand 2 `[R2'
-os9x_65c816_global.s:887: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:888: Error: no such instruction: `ldr R0,[reg_cpu_var,'
-os9x_65c816_global.s:889: Error: no such instruction: `ldr R0,[R0,R3,lsl'
-os9x_65c816_global.s:890: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:891: Error: too many memory references for `add'
-os9x_65c816_global.s:892: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:893: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:894: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:895: Error: no such instruction: `ldmfd R13!,{PC}'
-os9x_65c816_global.s:897: Error: no such instruction: `ldr PC,[PC,R2,LSL'
-os9x_65c816_global.s:898: Error: too many memory references for `mov'
-os9x_65c816_global.s:915: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:916: Error: no such instruction: `ldrb R2,[reg_cpu_var,'
-os9x_65c816_global.s:917: Warning: `R2' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:917: Warning: `R2' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:917: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:918: Error: no such instruction: `addeq reg_cycles,reg_cycles,'
-os9x_65c816_global.s:919: Error: too many memory references for `mov'
-os9x_65c816_global.s:920: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:921: Error: too many memory references for `mov'
-os9x_65c816_global.s:922: Error: too many memory references for `mov'
-os9x_65c816_global.s:923: Error: too many memory references for `mov'
-os9x_65c816_global.s:924: Error: too many memory references for `mov'
-os9x_65c816_global.s:925: Error: no such instruction: `stmfd R13!,{R0,R1,R12,R14}'
-os9x_65c816_global.s:926: Error: no such instruction: `bl S9xSetPPU'
-os9x_65c816_global.s:927: Error: no such instruction: `ldmfd R13!,{R0,R1}'
-os9x_65c816_global.s:928: Error: too many memory references for `add'
-os9x_65c816_global.s:929: Error: too many memory references for `mov'
-os9x_65c816_global.s:930: Error: no such instruction: `bic R1,R1,'
-os9x_65c816_global.s:931: Error: no such instruction: `bl S9xSetPPU'
-os9x_65c816_global.s:932: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:933: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:934: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:936: Error: too many memory references for `add'
-os9x_65c816_global.s:937: Error: too many memory references for `mov'
-os9x_65c816_global.s:938: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:939: Error: too many memory references for `mov'
-os9x_65c816_global.s:940: Error: too many memory references for `mov'
-os9x_65c816_global.s:941: Error: too many memory references for `mov'
-os9x_65c816_global.s:942: Error: too many memory references for `mov'
-os9x_65c816_global.s:943: Error: no such instruction: `stmfd R13!,{R0,R1,R12,R14}'
-os9x_65c816_global.s:944: Error: no such instruction: `bl S9xSetCPU'
-os9x_65c816_global.s:945: Error: no such instruction: `ldmfd R13!,{R0,R1}'
-os9x_65c816_global.s:946: Error: too many memory references for `add'
-os9x_65c816_global.s:947: Error: too many memory references for `mov'
-os9x_65c816_global.s:948: Error: no such instruction: `bic R1,R1,'
-os9x_65c816_global.s:949: Error: no such instruction: `bl S9xSetCPU'
-os9x_65c816_global.s:950: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:951: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:952: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:954: Error: too many memory references for `add'
-os9x_65c816_global.s:955: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:956: Error: no such instruction: `bic r0,r0,'
-os9x_65c816_global.s:957: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:958: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:959: Error: too many memory references for `mov'
-os9x_65c816_global.s:960: Error: too many memory references for `mov'
-os9x_65c816_global.s:961: Error: too many memory references for `mov'
-os9x_65c816_global.s:962: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:963: Error: no such instruction: `stmfd R13!,{R0,R1,R12,R14}'
-os9x_65c816_global.s:964: Error: no such instruction: `blx reg_cycles'
-os9x_65c816_global.s:965: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:966: Error: no such instruction: `ldmfd R13!,{R0,R1}'
-os9x_65c816_global.s:967: Error: too many memory references for `add'
-os9x_65c816_global.s:968: Error: too many memory references for `mov'
-os9x_65c816_global.s:969: Error: no such instruction: `bic R1,R1,'
-os9x_65c816_global.s:970: Error: no such instruction: `blx reg_cycles'
-os9x_65c816_global.s:971: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:972: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:973: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:974: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:976: Error: too many memory references for `add'
-os9x_65c816_global.s:977: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:978: Warning: `R2' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:978: Warning: `R2' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:978: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:979: Error: no such instruction: `ldmeqfd R13!,{PC}@return if SRAMMask=0'
-os9x_65c816_global.s:981: Error: too many memory references for `and'
-os9x_65c816_global.s:982: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:983: Error: no such instruction: `bne SW_not_aligned2'
-os9x_65c816_global.s:984: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:985: Error: no such instruction: `ldr R0,[reg_cpu_var,'
-os9x_65c816_global.s:986: Error: no such instruction: `strh R1,[R0,R3]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:987: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:988: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:989: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:992: Error: too many memory references for `add'
-os9x_65c816_global.s:993: Error: too many memory references for `and'
-os9x_65c816_global.s:994: Error: no such instruction: `ldr R0,[reg_cpu_var,'
-os9x_65c816_global.s:995: Error: invalid char '[' beginning operand 2 `[R0'
-os9x_65c816_global.s:996: Error: too many memory references for `mov'
-os9x_65c816_global.s:997: Error: invalid char '[' beginning operand 2 `[R0'
-os9x_65c816_global.s:998: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:999: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:1000: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:1003: Error: too many memory references for `add'
-os9x_65c816_global.s:1005: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:1006: Warning: `R2' is not valid here (expected `(%esi)')
-os9x_65c816_global.s:1006: Warning: `R2' is not valid here (expected `(%edi)')
-os9x_65c816_global.s:1006: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
-os9x_65c816_global.s:1007: Error: no such instruction: `ldmeqfd R13!,{PC}@return if SRAMMask=0'
-os9x_65c816_global.s:1009: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:1010: Error: no such instruction: `bne SW_not_aligned3'
-os9x_65c816_global.s:1011: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:1012: Error: too many memory references for `mov'
-os9x_65c816_global.s:1013: Error: too many memory references for `and'
-os9x_65c816_global.s:1014: Error: too many memory references for `mov'
-os9x_65c816_global.s:1015: Error: too many memory references for `mov'
-os9x_65c816_global.s:1016: Error: too many memory references for `add'
-os9x_65c816_global.s:1017: Error: too many memory references for `sub'
-os9x_65c816_global.s:1018: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:1019: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:1020: Error: too many memory references for `and'
-os9x_65c816_global.s:1021: Error: no such instruction: `strh R1,[R0,R3]@*Memory.SRAM+Address&SRAMMask'
-os9x_65c816_global.s:1022: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:1023: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:1024: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:1026: Error: too many memory references for `mov'
-os9x_65c816_global.s:1027: Error: too many memory references for `and'
-os9x_65c816_global.s:1028: Error: too many memory references for `mov'
-os9x_65c816_global.s:1029: Error: too many memory references for `mov'
-os9x_65c816_global.s:1030: Error: too many memory references for `add'
-os9x_65c816_global.s:1031: Error: too many memory references for `sub'
-os9x_65c816_global.s:1033: Error: too many memory references for `add'
-os9x_65c816_global.s:1034: Error: too many memory references for `mov'
-os9x_65c816_global.s:1035: Error: too many memory references for `and'
-os9x_65c816_global.s:1036: Error: too many memory references for `mov'
-os9x_65c816_global.s:1037: Error: too many memory references for `mov'
-os9x_65c816_global.s:1038: Error: too many memory references for `add'
-os9x_65c816_global.s:1039: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:1040: Error: too many memory references for `sub'
-os9x_65c816_global.s:1041: Error: too many memory references for `and'
-os9x_65c816_global.s:1042: Error: too many memory references for `and'
-os9x_65c816_global.s:1044: Error: no such instruction: `ldr R3,[reg_cpu_var,'
-os9x_65c816_global.s:1045: Error: invalid char '[' beginning operand 2 `[R2'
-os9x_65c816_global.s:1046: Error: too many memory references for `mov'
-os9x_65c816_global.s:1047: Error: invalid char '[' beginning operand 2 `[R0'
-os9x_65c816_global.s:1049: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:1050: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:1051: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:1056: Error: too many memory references for `add'
-os9x_65c816_global.s:1057: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:1059: Error: too many memory references for `add'
-os9x_65c816_global.s:1060: Error: too many memory references for `mov'
-os9x_65c816_global.s:1061: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:1062: Error: too many memory references for `mov'
-os9x_65c816_global.s:1063: Error: too many memory references for `mov'
-os9x_65c816_global.s:1064: Error: too many memory references for `mov'
-os9x_65c816_global.s:1065: Error: too many memory references for `mov'
-os9x_65c816_global.s:1066: Error: no such instruction: `stmfd R13!,{R0,R1,R12,R14}'
-os9x_65c816_global.s:1067: Error: no such instruction: `bl S9xSetC4'
-os9x_65c816_global.s:1068: Error: no such instruction: `ldmfd R13!,{R0,R1}'
-os9x_65c816_global.s:1069: Error: too many memory references for `add'
-os9x_65c816_global.s:1070: Error: too many memory references for `mov'
-os9x_65c816_global.s:1071: Error: no such instruction: `bic R1,R1,'
-os9x_65c816_global.s:1072: Error: no such instruction: `bl S9xSetC4'
-os9x_65c816_global.s:1073: Error: no such instruction: `ldmfd R13!,{R12,R14}'
-os9x_65c816_global.s:1074: Error: no such instruction: `ldr reg_cycles,[reg_cpu_var,'
-os9x_65c816_global.s:1075: Error: no such instruction: `ldmfd R13!,{PC}@Return'
-os9x_65c816_global.s:1077: Error: too many memory references for `add'
-os9x_65c816_global.s:1078: Error: no such instruction: `tst R0,'
-os9x_65c816_global.s:1079: Error: no such instruction: `bne SW_not_aligned4'
-os9x_65c816_global.s:1080: Error: junk at end of line, first unrecognized character is `@'
-os9x_65c816_global.s:1081: Error: too many memory references for `mov'
-os9x_65c816_global.s:1082: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:1083: Error: too many memory references for `mov'
-os9x_65c816_global.s:1084: Error: too many memory references for `sub'
-os9x_65c816_global.s:1085: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:1086: Error: no such instruction: `strh R1,[R0,R2]@*Memory.BWRAM+((Address&0x7fff)- 0x6000)'
-os9x_65c816_global.s:1087: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:1088: Error: no such instruction: `ldmfd R13!,{PC}@return'
-os9x_65c816_global.s:1090: Error: too many memory references for `mov'
-os9x_65c816_global.s:1091: Error: too many memory references for `add'
-os9x_65c816_global.s:1092: Error: too many memory references for `mov'
-os9x_65c816_global.s:1093: Error: too many memory references for `mov'
-os9x_65c816_global.s:1094: Error: no such instruction: `ldr R2,[reg_cpu_var,'
-os9x_65c816_global.s:1095: Error: too many memory references for `sub'
-os9x_65c816_global.s:1096: Error: too many memory references for `sub'
-os9x_65c816_global.s:1097: Error: invalid char '[' beginning operand 2 `[R2'
-os9x_65c816_global.s:1098: Error: too many memory references for `mov'
-os9x_65c816_global.s:1099: Error: invalid char '[' beginning operand 2 `[R2'
-os9x_65c816_global.s:1100: Error: expecting operand after ','; got nothing
-os9x_65c816_global.s:1101: Error: invalid char '[' beginning operand 2 `[reg_cpu_var'
-os9x_65c816_global.s:1102: Error: no such instruction: `ldmfd R13!,{PC}@return'
-make: *** [os9x_65c816_global.o] Error 1