diff --git a/Makefile.gc b/Makefile.gc index fffb6ef..c62edbd 100644 --- a/Makefile.gc +++ b/Makefile.gc @@ -27,14 +27,15 @@ INCLUDES := source source/snes9x # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) -DNO_SOUND \ +CFLAGS = -g -O3 -LTO -Wall $(MACHDEP) $(INCLUDE) -DNO_SOUND \ + -DHAVE_STDINT_H -DBLARGG_NONPORTABLE -DBLARGG_BIG_ENDIAN -DBLARGG_CPU_POWERPC \ -DZLIB -DRIGHTSHIFT_IS_SAR -DCPU_SHUTDOWN -DCORRECT_VRAM_READS \ -D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \ -fomit-frame-pointer \ -Wno-unused-parameter -Wno-strict-aliasing \ -Wno-write-strings -Wno-parentheses CXXFLAGS = $(CFLAGS) -LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map +LDFLAGS = -g $(MACHDEP) -LTO -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project diff --git a/source/filebrowser.cpp b/source/filebrowser.cpp index 9a36420..aa7ed44 100644 --- a/source/filebrowser.cpp +++ b/source/filebrowser.cpp @@ -332,7 +332,7 @@ int FileSortCallback(const void *f1, const void *f2) if(((BROWSERENTRY *)f1)->isdir && !(((BROWSERENTRY *)f2)->isdir)) return -1; if(!(((BROWSERENTRY *)f1)->isdir) && ((BROWSERENTRY *)f2)->isdir) return 1; - return stricmp(((BROWSERENTRY *)f1)->filename, ((BROWSERENTRY *)f2)->filename); + return strcasecmp(((BROWSERENTRY *)f1)->filename, ((BROWSERENTRY *)f2)->filename); } /**************************************************************************** @@ -361,7 +361,7 @@ static bool IsValidROM() { char * zippedFilename = NULL; - if(stricmp(p, ".zip") == 0 && !inSz) + if(strcasecmp(p, ".zip") == 0 && !inSz) { // we need to check the file extension of the first file in the archive zippedFilename = GetFirstZipFilename (); @@ -374,10 +374,10 @@ static bool IsValidROM() if(p != NULL) { - if (stricmp(p, ".smc") == 0 || - stricmp(p, ".fig") == 0 || - stricmp(p, ".sfc") == 0 || - stricmp(p, ".swc") == 0) + if (strcasecmp(p, ".smc") == 0 || + strcasecmp(p, ".fig") == 0 || + strcasecmp(p, ".sfc") == 0 || + strcasecmp(p, ".swc") == 0) { if(zippedFilename) free(zippedFilename); return true; @@ -402,7 +402,7 @@ bool IsSz() char * p = strrchr(browserList[browser.selIndex].filename, '.'); if (p != NULL) - if(stricmp(p, ".7z") == 0) + if(strcasecmp(p, ".7z") == 0) return true; } return false; @@ -454,7 +454,7 @@ int BrowserLoadSz() int WiiFileLoader() { - int size; + u32 size; char filepath[1024]; memset(Memory.NSRTHeader, 0, sizeof(Memory.NSRTHeader)); diff --git a/source/filebrowser.h b/source/filebrowser.h index 5065a48..518b7a5 100644 --- a/source/filebrowser.h +++ b/source/filebrowser.h @@ -16,6 +16,7 @@ #include #include +#include #define MAXJOLIET 255 #ifdef HW_DOL diff --git a/source/fileop.cpp b/source/fileop.cpp index 186baa8..16ea9b8 100644 --- a/source/fileop.cpp +++ b/source/fileop.cpp @@ -566,9 +566,9 @@ static bool ParseDirEntries() if(ext == NULL) continue; - if( stricmp(ext, "smc") != 0 && stricmp(ext, "fig") != 0 && - stricmp(ext, "sfc") != 0 && stricmp(ext, "swc") != 0 && - stricmp(ext, "zip") != 0 && stricmp(ext, "7z") != 0) + if( strcasecmp(ext, "smc") != 0 && strcasecmp(ext, "fig") != 0 && + strcasecmp(ext, "sfc") != 0 && strcasecmp(ext, "swc") != 0 && + strcasecmp(ext, "zip") != 0 && strcasecmp(ext, "7z") != 0) continue; } } diff --git a/source/input.cpp b/source/input.cpp index a1a4993..c192a93 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -19,8 +19,10 @@ #include #include +#ifdef HW_RVL #include #include +#endif #include #include "snes9xgx.h" diff --git a/source/menu.cpp b/source/menu.cpp index 2619427..a0c6ba7 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -13,12 +13,12 @@ #include #include #include -#include -#include #include #ifdef HW_RVL #include +#include +#include #endif #include "snes9xgx.h" @@ -3263,7 +3263,8 @@ static int MenuSettingsVideo() case 1: Settings.SuperFXSpeedPerLine = 0.417 * 40.5e6; reset_sfx = true; break; case 2: Settings.SuperFXSpeedPerLine = 0.417 * 60.5e6; reset_sfx = true; break; } - if (reset_sfx) S9xResetSuperFX(); S9xReset(); + if (reset_sfx) S9xResetSuperFX(); + S9xReset(); break; } diff --git a/source/networkop.cpp b/source/networkop.cpp index a8d5dd0..0e50b63 100644 --- a/source/networkop.cpp +++ b/source/networkop.cpp @@ -313,7 +313,7 @@ bool InitializeNetwork(bool silent) break; } #else - networkInit = !(if_config(wiiIP, NULL, NULL, true) < 0); + networkInit = !(if_config(wiiIP, NULL, NULL, true, 10) < 0); #endif CancelAction(); diff --git a/source/preferences.cpp b/source/preferences.cpp index 785c1f7..f8ad1db 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -64,7 +64,7 @@ static void createXMLSetting(const char * name, const char * description, const mxmlElementSetAttr(item, "description", description); } -static void createXMLController(unsigned int controller[], const char * name, const char * description) +static void createXMLController(u32 controller[], const char * name, const char * description) { item = mxmlNewElement(section, "controller"); mxmlElementSetAttr(item, "name", name); @@ -153,7 +153,9 @@ preparePrefsData () createXMLSection("Menu", "Menu Settings"); +#ifdef HW_RVL createXMLSetting("WiimoteOrientation", "Wiimote Orientation", toStr(GCSettings.WiimoteOrientation)); +#endif createXMLSetting("ExitAction", "Exit Action", toStr(GCSettings.ExitAction)); createXMLSetting("MusicVolume", "Music Volume", toStr(GCSettings.MusicVolume)); createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume)); @@ -166,16 +168,23 @@ preparePrefsData () createXMLSetting("Controller", "Controller", toStr(GCSettings.Controller)); createXMLController(btnmap[CTRL_PAD][CTRLR_GCPAD], "btnmap_pad_gcpad", "SNES Pad - GameCube Controller"); +#ifdef HW_RVL createXMLController(btnmap[CTRL_PAD][CTRLR_WIIMOTE], "btnmap_pad_wiimote", "SNES Pad - Wiimote"); createXMLController(btnmap[CTRL_PAD][CTRLR_CLASSIC], "btnmap_pad_classic", "SNES Pad - Classic Controller"); createXMLController(btnmap[CTRL_PAD][CTRLR_NUNCHUK], "btnmap_pad_nunchuk", "SNES Pad - Nunchuk + Wiimote"); +#endif createXMLController(btnmap[CTRL_SCOPE][CTRLR_GCPAD], "btnmap_scope_gcpad", "Superscope - GameCube Controller"); +#ifdef HW_RVL createXMLController(btnmap[CTRL_SCOPE][CTRLR_WIIMOTE], "btnmap_scope_wiimote", "Superscope - Wiimote"); +#endif createXMLController(btnmap[CTRL_MOUSE][CTRLR_GCPAD], "btnmap_mouse_gcpad", "Mouse - GameCube Controller"); +#ifdef HW_RVL createXMLController(btnmap[CTRL_MOUSE][CTRLR_WIIMOTE], "btnmap_mouse_wiimote", "Mouse - Wiimote"); +#endif createXMLController(btnmap[CTRL_JUST][CTRLR_GCPAD], "btnmap_just_gcpad", "Justifier - GameCube Controller"); +#ifdef HW_RVL createXMLController(btnmap[CTRL_JUST][CTRLR_WIIMOTE], "btnmap_just_wiimote", "Justifier - Wiimote"); - +#endif int datasize = mxmlSaveString(xml, (char *)savebuffer, SAVEBUFFERSIZE, XMLSaveCallback); mxmlDelete(xml); @@ -226,7 +235,7 @@ static void loadXMLSetting(float * var, const char * name) * Load XML elements into variables for a controller mapping ***************************************************************************/ -static void loadXMLController(unsigned int controller[], const char * name) +static void loadXMLController(u32 controller[], const char * name) { item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND); diff --git a/source/s9xsupport.cpp b/source/s9xsupport.cpp index 579c9f3..25d2ccb 100644 --- a/source/s9xsupport.cpp +++ b/source/s9xsupport.cpp @@ -255,12 +255,6 @@ void _makepath(char *filename, const char *drive, const char *dir, ExitApp(); } -int dup(int fildes) -{ - ExitApp(); - return 1; -} - int access(const char *pathname, int mode) { ExitApp(); diff --git a/source/snes9x/controls.h b/source/snes9x/controls.h index 8772f62..e4e2dfc 100644 --- a/source/snes9x/controls.h +++ b/source/snes9x/controls.h @@ -173,7 +173,7 @@ Super NES and Super Nintendo Entertainment System are trademarks of Nintendo Co., Limited and its subsidiary companies. ***********************************************************************************/ - +#include "port.h" #ifndef _CONTROLS_H_ #define _CONTROLS_H_ diff --git a/source/snes9x/memmap.cpp b/source/snes9x/memmap.cpp index 5216df5..38bfe7e 100644 --- a/source/snes9x/memmap.cpp +++ b/source/snes9x/memmap.cpp @@ -3914,7 +3914,7 @@ void CMemory::ApplyROMFixes (void) // BPS % UPS % IPS // number decoding used for both BPS and UPS -static uint32 XPSdecode (const uint8 *data, unsigned &addr, unsigned size) +static uint32 XPSdecode (const uint8 *data, uint32 &addr, uint32 size) { uint32 offset = 0, shift = 1; while(addr < size) { diff --git a/source/snes9xgx.cpp b/source/snes9xgx.cpp index 3daf4fc..45ffab3 100644 --- a/source/snes9xgx.cpp +++ b/source/snes9xgx.cpp @@ -18,14 +18,14 @@ #include #include #include -#include -#include #include #include #include #ifdef HW_RVL #include +#include +#include #endif #include "snes9xgx.h" @@ -58,6 +58,7 @@ char appPath[1024] = { 0 }; static int currentMode; extern "C" { +extern char* strcasestr(const char *, const char *); extern void __exception_setreload(int t); } @@ -306,7 +307,7 @@ bool SaneIOS(u32 ios) static bool gecko = false; static mutex_t gecko_mutex = 0; -static ssize_t __out_write(struct _reent *r, int fd, const char *ptr, size_t len) +static ssize_t __out_write(struct _reent *r, void* fd, const char *ptr, size_t len) { if (!gecko || len == 0) return len; diff --git a/source/snes9xgx.h b/source/snes9xgx.h index 8baebb5..96b6e4e 100644 --- a/source/snes9xgx.h +++ b/source/snes9xgx.h @@ -14,6 +14,7 @@ #ifndef _SNES9XGX_H_ #define _SNES9XGX_H_ +#define MAXPATHLEN 1024 #include "utils/FreeTypeGX.h" #include "snes9x.h" #include "filter.h" diff --git a/source/video.cpp b/source/video.cpp index 74c8e00..70b86b8 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -40,7 +40,7 @@ static unsigned char * snes9xgfx = NULL; unsigned char * filtermem = NULL; // only want ((512*2) X (239*2)) /*** 2D Video ***/ -static unsigned int *xfb[2] = { NULL, NULL }; // Double buffered +static u32 *xfb[2] = { NULL, NULL }; // Double buffered static int whichfb = 0; // Switch GXRModeObj *vmode = NULL; // Current video mode int screenheight = 480;