change pref file to <apppath>/settings.xml

This commit is contained in:
dborth 2008-11-17 08:02:22 +00:00
parent 8200baf3bb
commit c6e9dce0d7
4 changed files with 40 additions and 9 deletions

View File

@ -229,7 +229,7 @@ bool MakeFilePath(char filepath[], int type, int method)
sprintf(file, "%s.cht", ROMFilename); sprintf(file, "%s.cht", 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

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

View File

@ -44,6 +44,7 @@ extern int emulating;
int ConfigRequested = 0; int ConfigRequested = 0;
int ShutdownRequested = 0; int ShutdownRequested = 0;
int ResetRequested = 0; int ResetRequested = 0;
char appPath[1024];
/**************************************************************************** /****************************************************************************
* Shutdown / Reboot / Exit * Shutdown / Reboot / Exit
@ -124,12 +125,38 @@ 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
* *
* Program entry * Program entry
****************************************************************************/ ****************************************************************************/
int main() 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
@ -149,11 +176,11 @@ int main()
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
int selectedMenu = -1; int selectedMenu = -1;
@ -185,6 +212,9 @@ int main()
// Set defaults // Set defaults
DefaultSettings (); DefaultSettings ();
// store path app was loaded from
CreateAppPath(argv[0]);
// Load preferences // Load preferences
if(!LoadPrefs()) if(!LoadPrefs())
{ {

View File

@ -11,10 +11,10 @@
#define _VBA_H_ #define _VBA_H_
#include <gccore.h> #include <gccore.h>
#define VERSIONNUM "1.0.4" #define VERSIONNUM "1.0.5"
#define VERSIONSTR "VBA GX 1.0.4" #define VERSIONSTR "VBA GX 1.0.5"
#define VERSIONSTRFULL "Visual Boy Advance GX 1.0.4" #define VERSIONSTRFULL "Visual Boy Advance GX 1.0.5"
#define PREF_FILE_NAME "VBAGX.xml" #define PREF_FILE_NAME "settings.xml"
#define NOTSILENT 0 #define NOTSILENT 0
#define SILENT 1 #define SILENT 1
@ -67,5 +67,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