From 3f71b1f69ca508a3a2f9b0c0982f94b039fe9f2e Mon Sep 17 00:00:00 2001 From: dborth Date: Tue, 16 Jun 2009 05:01:12 +0000 Subject: [PATCH] correction for loading settings from usb, set widescreen to maximum size --- source/ngc/preferences.cpp | 39 ++++++++++++++++++++++++++------------ source/ngc/vba.cpp | 13 +++++++++---- source/ngc/vba.h | 1 + source/ngc/video.cpp | 3 +-- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/source/ngc/preferences.cpp b/source/ngc/preferences.cpp index 0984b26..75e7a8e 100644 --- a/source/ngc/preferences.cpp +++ b/source/ngc/preferences.cpp @@ -380,7 +380,6 @@ static void loadXMLPaletteFromSection(gamePalette &pal) } } - /**************************************************************************** * decodePrefsData * @@ -527,10 +526,12 @@ SavePrefs (bool silent) char filepath[1024]; int datasize; int offset = 0; + int method = appLoadMethod; // We'll save using the first available method (probably SD) since this // is the method preferences will be loaded from by default - int method = autoSaveMethod(silent); + if(method == METHOD_AUTO) + autoSaveMethod(silent); if(method == METHOD_AUTO) return false; @@ -608,16 +609,30 @@ bool LoadPrefs() return true; bool prefFound = false; - if(ChangeInterface(METHOD_SD, SILENT)) - prefFound = LoadPrefsFromMethod(METHOD_SD); - if(!prefFound && ChangeInterface(METHOD_USB, SILENT)) - prefFound = LoadPrefsFromMethod(METHOD_USB); - if(!prefFound && TestMC(CARD_SLOTA, SILENT)) - prefFound = LoadPrefsFromMethod(METHOD_MC_SLOTA); - if(!prefFound && TestMC(CARD_SLOTB, SILENT)) - prefFound = LoadPrefsFromMethod(METHOD_MC_SLOTB); - if(!prefFound && ChangeInterface(METHOD_SMB, SILENT)) - prefFound = LoadPrefsFromMethod(METHOD_SMB); + + if(appLoadMethod == METHOD_SD) + { + if(ChangeInterface(METHOD_SD, SILENT)) + prefFound = LoadPrefsFromMethod(METHOD_SD); + } + else if(appLoadMethod == METHOD_USB) + { + if(ChangeInterface(METHOD_USB, SILENT)) + prefFound = LoadPrefsFromMethod(METHOD_USB); + } + else + { + if(ChangeInterface(METHOD_SD, SILENT)) + prefFound = LoadPrefsFromMethod(METHOD_SD); + if(!prefFound && ChangeInterface(METHOD_USB, SILENT)) + prefFound = LoadPrefsFromMethod(METHOD_USB); + if(!prefFound && TestMC(CARD_SLOTA, SILENT)) + prefFound = LoadPrefsFromMethod(METHOD_MC_SLOTA); + if(!prefFound && TestMC(CARD_SLOTB, SILENT)) + prefFound = LoadPrefsFromMethod(METHOD_MC_SLOTB); + if(!prefFound && ChangeInterface(METHOD_SMB, SILENT)) + prefFound = LoadPrefsFromMethod(METHOD_SMB); + } prefLoaded = true; // attempted to load preferences diff --git a/source/ngc/vba.cpp b/source/ngc/vba.cpp index 0810913..451be9d 100644 --- a/source/ngc/vba.cpp +++ b/source/ngc/vba.cpp @@ -48,6 +48,7 @@ int ShutdownRequested = 0; int ResetRequested = 0; int ExitRequested = 0; char appPath[1024]; +int appLoadMethod = METHOD_AUTO; FreeTypeGX *fontSystem; extern FILE *out; @@ -60,7 +61,6 @@ static void ExitCleanup() { #ifdef HW_RVL ShutoffRumble(); - StopWiiKeyboard(); #endif ShutdownAudio(); StopGX(); @@ -173,19 +173,24 @@ static void ipl_set_config(unsigned char c) static void CreateAppPath(char origpath[]) { #ifdef HW_DOL - snprintf(appPath, 1024, GCSettings.SaveFolder); + sprintf(appPath, GCSettings.SaveFolder); #else char path[1024]; - strcpy(path, origpath); // make a copy so we don't mess up original + strncpy(path, origpath, 1024); // make a copy so we don't mess up original char * loc; int pos = -1; + if(strncmp(path, "sd:/", 5) == 0 || strncmp(path, "fat:/", 5) == 0) + appLoadMethod = METHOD_SD; + else if(strncmp(path, "usb:/", 5) == 0) + appLoadMethod = METHOD_USB; + loc = strrchr(path,'/'); if (loc != NULL) *loc = 0; // strip file name - loc = strchr(path,'/'); // looking for / from fat:/ + loc = strchr(path,'/'); // looking for first / (after sd: or usb:) if (loc != NULL) pos = loc - path + 1; diff --git a/source/ngc/vba.h b/source/ngc/vba.h index 1f538ac..3e62e1b 100644 --- a/source/ngc/vba.h +++ b/source/ngc/vba.h @@ -81,6 +81,7 @@ extern int ConfigRequested; extern int ShutdownRequested; extern int ExitRequested; extern char appPath[]; +extern int appLoadMethod; extern FreeTypeGX *fontSystem; #endif diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index 9ab1ac0..176d6e6 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -402,8 +402,7 @@ static void SetupVideoMode() // widescreen fix if(CONF_GetAspectRatio() == CONF_ASPECT_16_9) { - vmode->viWidth = VI_MAX_WIDTH_PAL-12; - vmode->viXOrigin = ((VI_MAX_WIDTH_PAL - vmode->viWidth) / 2) + 2; + vmode->viWidth = VI_MAX_WIDTH_PAL; } #endif