- Fix compilation errors with latest libOGC/devkitPPC

- Fix GameCube build
- Add PowerPC specific Blargg makefile flags
- Add LTO to Makefile.gc
This commit is contained in:
emu_kidid 2018-06-06 23:40:11 +09:30
parent 127504ca8e
commit a417745817
14 changed files with 42 additions and 32 deletions

View File

@ -27,14 +27,15 @@ INCLUDES := source source/snes9x
# options for code generation # 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 \ -DZLIB -DRIGHTSHIFT_IS_SAR -DCPU_SHUTDOWN -DCORRECT_VRAM_READS \
-D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \ -D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
-fomit-frame-pointer \ -fomit-frame-pointer \
-Wno-unused-parameter -Wno-strict-aliasing \ -Wno-unused-parameter -Wno-strict-aliasing \
-Wno-write-strings -Wno-parentheses -Wno-write-strings -Wno-parentheses
CXXFLAGS = $(CFLAGS) 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 # any extra libraries we wish to link with the project

View File

@ -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;
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; 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 // we need to check the file extension of the first file in the archive
zippedFilename = GetFirstZipFilename (); zippedFilename = GetFirstZipFilename ();
@ -374,10 +374,10 @@ static bool IsValidROM()
if(p != NULL) if(p != NULL)
{ {
if (stricmp(p, ".smc") == 0 || if (strcasecmp(p, ".smc") == 0 ||
stricmp(p, ".fig") == 0 || strcasecmp(p, ".fig") == 0 ||
stricmp(p, ".sfc") == 0 || strcasecmp(p, ".sfc") == 0 ||
stricmp(p, ".swc") == 0) strcasecmp(p, ".swc") == 0)
{ {
if(zippedFilename) free(zippedFilename); if(zippedFilename) free(zippedFilename);
return true; return true;
@ -402,7 +402,7 @@ bool IsSz()
char * p = strrchr(browserList[browser.selIndex].filename, '.'); char * p = strrchr(browserList[browser.selIndex].filename, '.');
if (p != NULL) if (p != NULL)
if(stricmp(p, ".7z") == 0) if(strcasecmp(p, ".7z") == 0)
return true; return true;
} }
return false; return false;
@ -454,7 +454,7 @@ int BrowserLoadSz()
int WiiFileLoader() int WiiFileLoader()
{ {
int size; u32 size;
char filepath[1024]; char filepath[1024];
memset(Memory.NSRTHeader, 0, sizeof(Memory.NSRTHeader)); memset(Memory.NSRTHeader, 0, sizeof(Memory.NSRTHeader));

View File

@ -16,6 +16,7 @@
#include <unistd.h> #include <unistd.h>
#include <gccore.h> #include <gccore.h>
#include <snes9xgx.h>
#define MAXJOLIET 255 #define MAXJOLIET 255
#ifdef HW_DOL #ifdef HW_DOL

View File

@ -566,9 +566,9 @@ static bool ParseDirEntries()
if(ext == NULL) if(ext == NULL)
continue; continue;
if( stricmp(ext, "smc") != 0 && stricmp(ext, "fig") != 0 && if( strcasecmp(ext, "smc") != 0 && strcasecmp(ext, "fig") != 0 &&
stricmp(ext, "sfc") != 0 && stricmp(ext, "swc") != 0 && strcasecmp(ext, "sfc") != 0 && strcasecmp(ext, "swc") != 0 &&
stricmp(ext, "zip") != 0 && stricmp(ext, "7z") != 0) strcasecmp(ext, "zip") != 0 && strcasecmp(ext, "7z") != 0)
continue; continue;
} }
} }

View File

@ -19,8 +19,10 @@
#include <ogcsys.h> #include <ogcsys.h>
#include <unistd.h> #include <unistd.h>
#ifdef HW_RVL
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <wupc/wupc.h> #include <wupc/wupc.h>
#endif
#include <ogc/lwp_watchdog.h> #include <ogc/lwp_watchdog.h>
#include "snes9xgx.h" #include "snes9xgx.h"

View File

@ -13,12 +13,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <wiiuse/wpad.h>
#include <wupc/wupc.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HW_RVL #ifdef HW_RVL
#include <di/di.h> #include <di/di.h>
#include <wiiuse/wpad.h>
#include <wupc/wupc.h>
#endif #endif
#include "snes9xgx.h" #include "snes9xgx.h"
@ -3263,7 +3263,8 @@ static int MenuSettingsVideo()
case 1: Settings.SuperFXSpeedPerLine = 0.417 * 40.5e6; reset_sfx = true; break; case 1: Settings.SuperFXSpeedPerLine = 0.417 * 40.5e6; reset_sfx = true; break;
case 2: Settings.SuperFXSpeedPerLine = 0.417 * 60.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; break;
} }

View File

@ -313,7 +313,7 @@ bool InitializeNetwork(bool silent)
break; break;
} }
#else #else
networkInit = !(if_config(wiiIP, NULL, NULL, true) < 0); networkInit = !(if_config(wiiIP, NULL, NULL, true, 10) < 0);
#endif #endif
CancelAction(); CancelAction();

View File

@ -64,7 +64,7 @@ static void createXMLSetting(const char * name, const char * description, const
mxmlElementSetAttr(item, "description", description); 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"); item = mxmlNewElement(section, "controller");
mxmlElementSetAttr(item, "name", name); mxmlElementSetAttr(item, "name", name);
@ -153,7 +153,9 @@ preparePrefsData ()
createXMLSection("Menu", "Menu Settings"); createXMLSection("Menu", "Menu Settings");
#ifdef HW_RVL
createXMLSetting("WiimoteOrientation", "Wiimote Orientation", toStr(GCSettings.WiimoteOrientation)); createXMLSetting("WiimoteOrientation", "Wiimote Orientation", toStr(GCSettings.WiimoteOrientation));
#endif
createXMLSetting("ExitAction", "Exit Action", toStr(GCSettings.ExitAction)); createXMLSetting("ExitAction", "Exit Action", toStr(GCSettings.ExitAction));
createXMLSetting("MusicVolume", "Music Volume", toStr(GCSettings.MusicVolume)); createXMLSetting("MusicVolume", "Music Volume", toStr(GCSettings.MusicVolume));
createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume)); createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume));
@ -166,16 +168,23 @@ preparePrefsData ()
createXMLSetting("Controller", "Controller", toStr(GCSettings.Controller)); createXMLSetting("Controller", "Controller", toStr(GCSettings.Controller));
createXMLController(btnmap[CTRL_PAD][CTRLR_GCPAD], "btnmap_pad_gcpad", "SNES Pad - GameCube 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_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_CLASSIC], "btnmap_pad_classic", "SNES Pad - Classic Controller");
createXMLController(btnmap[CTRL_PAD][CTRLR_NUNCHUK], "btnmap_pad_nunchuk", "SNES Pad - Nunchuk + Wiimote"); 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"); 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"); createXMLController(btnmap[CTRL_SCOPE][CTRLR_WIIMOTE], "btnmap_scope_wiimote", "Superscope - Wiimote");
#endif
createXMLController(btnmap[CTRL_MOUSE][CTRLR_GCPAD], "btnmap_mouse_gcpad", "Mouse - GameCube Controller"); 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"); createXMLController(btnmap[CTRL_MOUSE][CTRLR_WIIMOTE], "btnmap_mouse_wiimote", "Mouse - Wiimote");
#endif
createXMLController(btnmap[CTRL_JUST][CTRLR_GCPAD], "btnmap_just_gcpad", "Justifier - GameCube Controller"); 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"); createXMLController(btnmap[CTRL_JUST][CTRLR_WIIMOTE], "btnmap_just_wiimote", "Justifier - Wiimote");
#endif
int datasize = mxmlSaveString(xml, (char *)savebuffer, SAVEBUFFERSIZE, XMLSaveCallback); int datasize = mxmlSaveString(xml, (char *)savebuffer, SAVEBUFFERSIZE, XMLSaveCallback);
mxmlDelete(xml); mxmlDelete(xml);
@ -226,7 +235,7 @@ static void loadXMLSetting(float * var, const char * name)
* Load XML elements into variables for a controller mapping * 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); item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND);

View File

@ -255,12 +255,6 @@ void _makepath(char *filename, const char *drive, const char *dir,
ExitApp(); ExitApp();
} }
int dup(int fildes)
{
ExitApp();
return 1;
}
int access(const char *pathname, int mode) int access(const char *pathname, int mode)
{ {
ExitApp(); ExitApp();

View File

@ -173,7 +173,7 @@
Super NES and Super Nintendo Entertainment System are trademarks of Super NES and Super Nintendo Entertainment System are trademarks of
Nintendo Co., Limited and its subsidiary companies. Nintendo Co., Limited and its subsidiary companies.
***********************************************************************************/ ***********************************************************************************/
#include "port.h"
#ifndef _CONTROLS_H_ #ifndef _CONTROLS_H_
#define _CONTROLS_H_ #define _CONTROLS_H_

View File

@ -3914,7 +3914,7 @@ void CMemory::ApplyROMFixes (void)
// BPS % UPS % IPS // BPS % UPS % IPS
// number decoding used for both BPS and UPS // 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; uint32 offset = 0, shift = 1;
while(addr < size) { while(addr < size) {

View File

@ -18,14 +18,14 @@
#include <string> #include <string>
#include <ogcsys.h> #include <ogcsys.h>
#include <unistd.h> #include <unistd.h>
#include <wiiuse/wpad.h>
#include <wupc/wupc.h>
#include <fat.h> #include <fat.h>
#include <debug.h> #include <debug.h>
#include <sys/iosupport.h> #include <sys/iosupport.h>
#ifdef HW_RVL #ifdef HW_RVL
#include <di/di.h> #include <di/di.h>
#include <wiiuse/wpad.h>
#include <wupc/wupc.h>
#endif #endif
#include "snes9xgx.h" #include "snes9xgx.h"
@ -58,6 +58,7 @@ char appPath[1024] = { 0 };
static int currentMode; static int currentMode;
extern "C" { extern "C" {
extern char* strcasestr(const char *, const char *);
extern void __exception_setreload(int t); extern void __exception_setreload(int t);
} }
@ -306,7 +307,7 @@ bool SaneIOS(u32 ios)
static bool gecko = false; static bool gecko = false;
static mutex_t gecko_mutex = 0; 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) if (!gecko || len == 0)
return len; return len;

View File

@ -14,6 +14,7 @@
#ifndef _SNES9XGX_H_ #ifndef _SNES9XGX_H_
#define _SNES9XGX_H_ #define _SNES9XGX_H_
#define MAXPATHLEN 1024
#include "utils/FreeTypeGX.h" #include "utils/FreeTypeGX.h"
#include "snes9x.h" #include "snes9x.h"
#include "filter.h" #include "filter.h"

View File

@ -40,7 +40,7 @@ static unsigned char * snes9xgfx = NULL;
unsigned char * filtermem = NULL; // only want ((512*2) X (239*2)) unsigned char * filtermem = NULL; // only want ((512*2) X (239*2))
/*** 2D Video ***/ /*** 2D Video ***/
static unsigned int *xfb[2] = { NULL, NULL }; // Double buffered static u32 *xfb[2] = { NULL, NULL }; // Double buffered
static int whichfb = 0; // Switch static int whichfb = 0; // Switch
GXRModeObj *vmode = NULL; // Current video mode GXRModeObj *vmode = NULL; // Current video mode
int screenheight = 480; int screenheight = 480;