change pref file to <apppath>/settings.xml

This commit is contained in:
dborth 2008-11-17 08:01:05 +00:00
parent f0a5f35508
commit 3eb3821808
4 changed files with 46 additions and 15 deletions

View File

@ -230,7 +230,7 @@ bool MakeFilePath(char filepath[], int type, int method)
sprintf(file, "%s.cht", Memory.ROMFilename); sprintf(file, "%s.cht", Memory.ROMFilename);
break; break;
case FILE_PREF: case FILE_PREF:
sprintf(folder, GCSettings.SaveFolder); sprintf(folder, appPath);
sprintf(file, "%s", PREF_FILE_NAME); sprintf(file, "%s", PREF_FILE_NAME);
break; break;
} }

View File

@ -90,7 +90,7 @@ ConnectShare (bool silent)
strlen(GCSettings.smbip) == 0) strlen(GCSettings.smbip) == 0)
{ {
if(!silent) if(!silent)
WaitPrompt((char*) "Invalid network settings. Check SNES9xGX.xml."); WaitPrompt((char*) "Invalid network settings. Check settings.xml.");
return false; return false;
} }

View File

@ -64,6 +64,7 @@ extern "C" {
int ConfigRequested = 0; int ConfigRequested = 0;
int ShutdownRequested = 0; int ShutdownRequested = 0;
int ResetRequested = 0; int ResetRequested = 0;
char appPath[1024];
FILE* debughandle; FILE* debughandle;
extern int FrameTimer; extern int FrameTimer;
@ -273,6 +274,32 @@ emulate ()
}//while }//while
} }
void CreateAppPath(char origpath[])
{
#ifdef HW_DOL
sprintf(appPath, GCSettings.SaveFolder);
#else
char path[1024];
strcpy(path, origpath); // make a copy so we don't mess up original
char * loc;
int pos = -1;
loc = strrchr(path,'/');
if (loc != NULL)
*loc = 0; // strip file name
loc = strchr(path,'/'); // looking for / from fat:/
if (loc != NULL)
pos = loc - path + 1;
if(pos >= 0 && pos < 1024)
sprintf(appPath, &(path[pos]));
else
sprintf(appPath, "/");
#endif
}
/**************************************************************************** /****************************************************************************
* MAIN * MAIN
* *
@ -288,15 +315,15 @@ emulate ()
* 9. Let's Party! * 9. Let's Party!
***************************************************************************/ ***************************************************************************/
int int
main () main(int argc, char *argv[])
{ {
#ifdef HW_DOL #ifdef HW_DOL
ipl_set_config(6); // disable Qoob modchip ipl_set_config(6); // disable Qoob modchip
#endif #endif
#ifdef WII_DVD #ifdef WII_DVD
DI_Init(); // first DI_Init(); // first
#endif #endif
int selectedMenu = -1; int selectedMenu = -1;
@ -304,21 +331,21 @@ main ()
InitGCVideo (); InitGCVideo ();
// Controllers // Controllers
#ifdef HW_RVL #ifdef HW_RVL
WPAD_Init(); WPAD_Init();
// read wiimote accelerometer and IR data // read wiimote accelerometer and IR data
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL,640,480); WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
#endif #endif
PAD_Init (); PAD_Init ();
// Wii Power/Reset buttons // Wii Power/Reset buttons
#ifdef HW_RVL #ifdef HW_RVL
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB); WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
SYS_SetPowerCallback(ShutdownCB); SYS_SetPowerCallback(ShutdownCB);
SYS_SetResetCallback(ResetCB); SYS_SetResetCallback(ResetCB);
#endif #endif
// Audio // Audio
AUDIO_Init (NULL); AUDIO_Init (NULL);
@ -361,6 +388,9 @@ main ()
// Set defaults // Set defaults
DefaultSettings (); DefaultSettings ();
// store path app was loaded from
CreateAppPath(argv[0]);
S9xUnmapAllControls (); S9xUnmapAllControls ();
SetDefaultButtonMap (); SetDefaultButtonMap ();
@ -392,7 +422,7 @@ main ()
#endif #endif
// Initialize DVD subsystem (GameCube only) // Initialize DVD subsystem (GameCube only)
#ifndef HW_RVL #ifdef HW_DOL
DVD_Init (); DVD_Init ();
#endif #endif

View File

@ -17,9 +17,9 @@
#include <gccore.h> #include <gccore.h>
#include "snes9x.h" #include "snes9x.h"
#define VERSIONNUM "006" #define VERSIONNUM "007"
#define VERSIONSTR "Snes9x GX 006" #define VERSIONSTR "Snes9x GX 007"
#define PREF_FILE_NAME "SNES9xGX.xml" #define PREF_FILE_NAME "settings.xml"
#define NOTSILENT 0 #define NOTSILENT 0
#define SILENT 1 #define SILENT 1
@ -77,5 +77,6 @@ void ShutdownWii();
extern struct SGCSettings GCSettings; extern struct SGCSettings GCSettings;
extern int ConfigRequested; extern int ConfigRequested;
extern int ShutdownRequested; extern int ShutdownRequested;
extern char appPath[];
#endif #endif