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);
break;
case FILE_PREF:
sprintf(folder, GCSettings.SaveFolder);
sprintf(folder, appPath);
sprintf(file, "%s", PREF_FILE_NAME);
break;
}

View File

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

View File

@ -64,6 +64,7 @@ extern "C" {
int ConfigRequested = 0;
int ShutdownRequested = 0;
int ResetRequested = 0;
char appPath[1024];
FILE* debughandle;
extern int FrameTimer;
@ -273,6 +274,32 @@ emulate ()
}//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
*
@ -288,15 +315,15 @@ emulate ()
* 9. Let's Party!
***************************************************************************/
int
main ()
main(int argc, char *argv[])
{
#ifdef HW_DOL
#ifdef HW_DOL
ipl_set_config(6); // disable Qoob modchip
#endif
#endif
#ifdef WII_DVD
#ifdef WII_DVD
DI_Init(); // first
#endif
#endif
int selectedMenu = -1;
@ -304,21 +331,21 @@ main ()
InitGCVideo ();
// Controllers
#ifdef HW_RVL
#ifdef HW_RVL
WPAD_Init();
// read wiimote accelerometer and IR data
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
#endif
#endif
PAD_Init ();
// Wii Power/Reset buttons
#ifdef HW_RVL
#ifdef HW_RVL
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
SYS_SetPowerCallback(ShutdownCB);
SYS_SetResetCallback(ResetCB);
#endif
#endif
// Audio
AUDIO_Init (NULL);
@ -361,6 +388,9 @@ main ()
// Set defaults
DefaultSettings ();
// store path app was loaded from
CreateAppPath(argv[0]);
S9xUnmapAllControls ();
SetDefaultButtonMap ();
@ -392,7 +422,7 @@ main ()
#endif
// Initialize DVD subsystem (GameCube only)
#ifndef HW_RVL
#ifdef HW_DOL
DVD_Init ();
#endif

View File

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