change pref file to <apppath>/settings.xml

This commit is contained in:
dborth 2008-11-17 07:59:24 +00:00
parent 59c0c77853
commit 0dfb088a8c
4 changed files with 48 additions and 16 deletions

View File

@ -42,6 +42,7 @@ unsigned char * nesrom = NULL;
int ConfigRequested = 0; int ConfigRequested = 0;
int ShutdownRequested = 0; int ShutdownRequested = 0;
int ResetRequested = 0; int ResetRequested = 0;
char appPath[1024];
bool isWii; bool isWii;
uint8 *xbsave=NULL; uint8 *xbsave=NULL;
int frameskip = 0; int frameskip = 0;
@ -133,6 +134,32 @@ void ipl_set_config(unsigned char c)
} }
#endif #endif
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
* This is where it all happens! * This is where it all happens!
@ -140,31 +167,31 @@ void ipl_set_config(unsigned char c)
int main(int argc, char *argv[]) int 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;
#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
InitGCVideo (); InitGCVideo ();
ResetVideo_Menu (); // change to menu video mode ResetVideo_Menu (); // change to menu video mode
@ -178,9 +205,11 @@ int main(int argc, char *argv[])
InitialiseAudio(); InitialiseAudio();
fatInit (8, false); fatInit (8, false);
#ifndef HW_RVL
DVD_Init(); // Initialize DVD subsystem (GameCube only)
#endif #ifdef HW_DOL
DVD_Init ();
#endif
// allocate memory to store rom // allocate memory to store rom
nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty
@ -197,11 +226,13 @@ int main(int argc, char *argv[])
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
cleanSFMDATA(); // clear state data cleanSFMDATA(); // clear state data
// Set Defaults // Set defaults
DefaultSettings(); DefaultSettings();
// Load preferences // store path app was loaded from
CreateAppPath(argv[0]);
// Load preferences
if(!LoadPrefs()) if(!LoadPrefs())
{ {
WaitPrompt((char*) "Preferences reset - check settings!"); WaitPrompt((char*) "Preferences reset - check settings!");

View File

@ -14,7 +14,7 @@
#define VERSIONNUM "2.0.6" #define VERSIONNUM "2.0.6"
#define VERSIONSTR "FCE Ultra GX 2.0.6" #define VERSIONSTR "FCE Ultra GX 2.0.6"
#define PREF_FILE_NAME "FCEUGX.xml" #define PREF_FILE_NAME "settings.xml"
#define NOTSILENT 0 #define NOTSILENT 0
#define SILENT 1 #define SILENT 1
@ -75,6 +75,7 @@ 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[];
extern int frameskip; extern int frameskip;
#endif #endif

View File

@ -199,7 +199,7 @@ bool MakeFilePath(char filepath[], int type, int method)
sprintf(file, "disksys.rom"); sprintf(file, "disksys.rom");
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

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