From 5730ab7f942ec991fd8567375739735cc4ff0ce9 Mon Sep 17 00:00:00 2001 From: dborth Date: Tue, 30 Sep 2008 05:31:46 +0000 Subject: [PATCH] reorg menu, fix intermittent crashes/freezes problem, bg now stored in MEM2, change savebuffer alloc, other misc changes --- source/ngc/filesel.cpp | 4 +- source/ngc/freeze.cpp | 16 +- source/ngc/menu.cpp | 682 ++++++++++++++++++++------------------- source/ngc/menu.h | 2 +- source/ngc/menudraw.cpp | 29 +- source/ngc/s9xconfig.cpp | 8 +- source/ngc/snes9xGX.cpp | 6 +- source/ngc/sram.cpp | 8 +- 8 files changed, 393 insertions(+), 362 deletions(-) diff --git a/source/ngc/filesel.cpp b/source/ngc/filesel.cpp index a752908..1904898 100644 --- a/source/ngc/filesel.cpp +++ b/source/ngc/filesel.cpp @@ -59,7 +59,7 @@ unsigned char *savebuffer = NULL; /**************************************************************************** * AllocSaveBuffer () - * Clear and allocate the savebuffer + * Allocate and clear the savebuffer ***************************************************************************/ void AllocSaveBuffer () @@ -67,7 +67,7 @@ AllocSaveBuffer () if (savebuffer != NULL) free(savebuffer); - savebuffer = (unsigned char *) memalign(32, SAVEBUFFERSIZE); + savebuffer = (unsigned char *) malloc(SAVEBUFFERSIZE); memset (savebuffer, 0, SAVEBUFFERSIZE); } diff --git a/source/ngc/freeze.cpp b/source/ngc/freeze.cpp index ed696bf..ede02b2 100644 --- a/source/ngc/freeze.cpp +++ b/source/ngc/freeze.cpp @@ -161,17 +161,17 @@ NGCFreezeGame (int method, bool8 silent) { sprintf (filename, "%s.snz", Memory.ROMName); - /*** Copy in save icon ***/ + // Copy in save icon int woffset = sizeof (saveicon); memcpy (savebuffer, saveicon, woffset); - /*** And the freezecomment ***/ + // And the freezecomment sprintf (freezecomment[0], "%s Freeze", VERSIONSTR); sprintf (freezecomment[1], Memory.ROMName); memcpy (savebuffer + woffset, freezecomment, 64); woffset += 64; - /*** Zip and copy in the freeze ***/ + // Zip and copy in the freeze uLongf DestBuffSize = (uLongf) SAVEBUFFERSIZE; int err= compress2((Bytef*)(savebuffer+woffset+8), (uLongf*)&DestBuffSize, (const Bytef*)savebuffer, (uLongf)bufoffset, Z_BEST_COMPRESSION); @@ -290,7 +290,8 @@ NGCUnfreezeGame (int method, bool8 silent) if (ret) { - char zipbuffer[SAVEBUFFERSIZE]; + char * zipbuffer = (char *)malloc(SAVEBUFFERSIZE); + memset (zipbuffer, 0, SAVEBUFFERSIZE); // skip the saveicon and comment offset = (sizeof(saveicon) + 64); @@ -310,18 +311,21 @@ NGCUnfreezeGame (int method, bool8 silent) { sprintf (msg, "Unzip error %s ",zError(err)); WaitPrompt (msg); - return 0; } else if ( DestBuffSize != decompressedsize ) { WaitPrompt((char*) "Unzipped size doesn't match expected size!"); - return 0; } else { offset = SAVEBUFFERSIZE; memcpy (savebuffer, zipbuffer, SAVEBUFFERSIZE); } + free(zipbuffer); + zipbuffer = NULL; + + if(offset == 0) + return 0; } } diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 8fdeb69..12b2ecd 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -114,301 +114,6 @@ LoadManager () return loadROM; } -/**************************************************************************** - * Preferences Menu - ***************************************************************************/ -static int prefmenuCount = 11; -static char prefmenu[][50] = { - - "Load Method", - "Load Folder", - "Save Method", - "Save Folder", - - "Auto Load", - "Auto Save", - "Verify MC Saves", - - "Reverse Stereo", - "Interpolated Sound", - - "Save Preferences", - "Back to Main Menu" -}; - -void -PreferencesMenu () -{ - int ret = 0; - int quit = 0; - int oldmenu = menu; - menu = 0; - while (quit == 0) - { - // some load/save methods are not implemented - here's where we skip them - // they need to be skipped in the order they were enumerated in snes9xGX.h - - // no USB ports on GameCube - #ifndef HW_RVL - if(GCSettings.LoadMethod == METHOD_USB) - GCSettings.LoadMethod++; - if(GCSettings.SaveMethod == METHOD_USB) - GCSettings.SaveMethod++; - #endif - - // saving to DVD is impossible - if(GCSettings.SaveMethod == METHOD_DVD) - GCSettings.SaveMethod++; - - // disable SMB in GC mode (stalls out) - #ifndef HW_RVL - if(GCSettings.LoadMethod == METHOD_SMB) - GCSettings.LoadMethod++; - if(GCSettings.SaveMethod == METHOD_SMB) - GCSettings.SaveMethod++; - #endif - - // disable MC saving in Wii mode - does not work for some reason! - #ifdef HW_RVL - if(GCSettings.SaveMethod == METHOD_MC_SLOTA) - GCSettings.SaveMethod++; - if(GCSettings.SaveMethod == METHOD_MC_SLOTB) - GCSettings.SaveMethod++; - #endif - - // correct load/save methods out of bounds - if(GCSettings.LoadMethod > 4) - GCSettings.LoadMethod = 0; - if(GCSettings.SaveMethod > 6) - GCSettings.SaveMethod = 0; - - if (GCSettings.LoadMethod == METHOD_AUTO) sprintf (prefmenu[0],"Load Method AUTO"); - else if (GCSettings.LoadMethod == METHOD_SD) sprintf (prefmenu[0],"Load Method SD"); - else if (GCSettings.LoadMethod == METHOD_USB) sprintf (prefmenu[0],"Load Method USB"); - else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (prefmenu[0],"Load Method DVD"); - else if (GCSettings.LoadMethod == METHOD_SMB) sprintf (prefmenu[0],"Load Method Network"); - - sprintf (prefmenu[1], "Load Folder %s", GCSettings.LoadFolder); - - if (GCSettings.SaveMethod == METHOD_AUTO) sprintf (prefmenu[2],"Save Method AUTO"); - else if (GCSettings.SaveMethod == METHOD_SD) sprintf (prefmenu[2],"Save Method SD"); - else if (GCSettings.SaveMethod == METHOD_USB) sprintf (prefmenu[2],"Save Method USB"); - else if (GCSettings.SaveMethod == METHOD_SMB) sprintf (prefmenu[2],"Save Method Network"); - else if (GCSettings.SaveMethod == METHOD_MC_SLOTA) sprintf (prefmenu[2],"Save Method MC Slot A"); - else if (GCSettings.SaveMethod == METHOD_MC_SLOTB) sprintf (prefmenu[2],"Save Method MC Slot B"); - - sprintf (prefmenu[3], "Save Folder %s", GCSettings.SaveFolder); - - // disable changing load/save directories for now - prefmenu[1][0] = '\0'; - prefmenu[3][0] = '\0'; - - if (GCSettings.AutoLoad == 0) sprintf (prefmenu[4],"Auto Load OFF"); - else if (GCSettings.AutoLoad == 1) sprintf (prefmenu[4],"Auto Load SRAM"); - else if (GCSettings.AutoLoad == 2) sprintf (prefmenu[4],"Auto Load SNAPSHOT"); - - if (GCSettings.AutoSave == 0) sprintf (prefmenu[5],"Auto Save OFF"); - else if (GCSettings.AutoSave == 1) sprintf (prefmenu[5],"Auto Save SRAM"); - else if (GCSettings.AutoSave == 2) sprintf (prefmenu[5],"Auto Save SNAPSHOT"); - else if (GCSettings.AutoSave == 3) sprintf (prefmenu[5],"Auto Save BOTH"); - - sprintf (prefmenu[6], "Verify MC Saves %s", - GCSettings.VerifySaves == true ? " ON" : "OFF"); - - sprintf (prefmenu[7], "Reverse Stereo %s", - Settings.ReverseStereo == true ? " ON" : "OFF"); - - sprintf (prefmenu[8], "Interpolated Sound %s", - Settings.InterpolatedSound == true ? " ON" : "OFF"); - - ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16); - - switch (ret) - { - case 0: - GCSettings.LoadMethod ++; - break; - - case 1: - break; - - case 2: - GCSettings.SaveMethod ++; - break; - - case 3: - break; - - case 4: - GCSettings.AutoLoad ++; - if (GCSettings.AutoLoad > 2) - GCSettings.AutoLoad = 0; - break; - - case 5: - GCSettings.AutoSave ++; - if (GCSettings.AutoSave > 3) - GCSettings.AutoSave = 0; - break; - - case 6: - GCSettings.VerifySaves ^= 1; - break; - - case 7: - Settings.ReverseStereo ^= 1; - break; - - case 8: - Settings.InterpolatedSound ^= 1; - break; - - case 9: - SavePrefs(GCSettings.SaveMethod, NOTSILENT); - break; - - case -1: /*** Button B ***/ - case 10: - quit = 1; - break; - - } - } - menu = oldmenu; -} - -/**************************************************************************** - * Video Options - ***************************************************************************/ -static int videomenuCount = 14; -static char videomenu[][50] = { - - "Transparency", - "Display Frame Rate", - "Enable Zooming", - "Video Filtering", - "Widescreen", - - "X-shift ++", - " --", - "Y-shift ++", - " --", - "X-shift: ", - "Y-shift: ", - "Reset Video Shifts", - - "Save Preferences", - "Back to Main Menu" -}; - -void -VideoOptions () -{ - int ret = 0; - int quit = 0; - int oldmenu = menu; - menu = 0; - while (quit == 0) - { - - sprintf (prefmenu[0], "Transparency %s", - Settings.Transparency == true ? " ON" : "OFF"); - - sprintf (prefmenu[1], "Display Frame Rate %s", - Settings.DisplayFrameRate == true ? " ON" : "OFF"); - - sprintf (prefmenu[2], "Enable Zooming %s", - GCSettings.NGCZoom == true ? " ON" : "OFF"); - - // don't allow original render mode if progressive video mode detected - if (GCSettings.render==0 && progressive) - GCSettings.render++; - - if ( GCSettings.render == 0 ) - sprintf (prefmenu[3], "Video Rendering Original"); - if ( GCSettings.render == 1 ) - sprintf (prefmenu[3], "Video Rendering Filtered"); - if ( GCSettings.render == 2 ) - sprintf (prefmenu[3], "Video Rendering Unfiltered"); - - sprintf (prefmenu[4], "Video Scaling %s", - GCSettings.widescreen == true ? "16:9 Correction" : "Default"); - - sprintf (prefmenu[9], "X-shift: %d", GCSettings.xshift); - - sprintf (prefmenu[10], "Y-shift: %d", GCSettings.yshift); - - ret = RunMenu (videomenu, videomenuCount, (char*)"Video Options", 16); - - switch (ret) - { - case 0: - Settings.Transparency ^= 1; - break; - - case 1: - Settings.DisplayFrameRate ^= 1; - break; - - case 2: - GCSettings.NGCZoom ^= 1; - break; - - case 3: - GCSettings.render++; - if (GCSettings.render > 2 ) - GCSettings.render = 0; - // reset zoom - zoom_reset (); - break; - - case 4: - GCSettings.widescreen ^= 1; - break; - - case 5: - // xscale UP - GCSettings.xshift++; - break; - - case 6: - // xscale DOWN - GCSettings.xshift--; - break; - - case 7: - // yscale UP - GCSettings.yshift++; - break; - - case 8: - // yscale DOWN - GCSettings.yshift--; - break; - - case 9: - case 10: - break; - - case 11: - // reset video shifts - GCSettings.xshift = GCSettings.yshift = 0; - break; - - case 12: - SavePrefs(GCSettings.SaveMethod, NOTSILENT); - break; - - case -1: /*** Button B ***/ - case 13: - quit = 1; - break; - - } - } - menu = oldmenu; -} - /**************************************************************************** * Cheat Menu ***************************************************************************/ @@ -693,6 +398,286 @@ GameMenu () return retval; } +/**************************************************************************** + * File Options Menu + ***************************************************************************/ +static int filemenuCount = 8; +static char filemenu[][50] = { + "Load Method", + "Load Folder", + "Save Method", + "Save Folder", + + "Auto Load", + "Auto Save", + "Verify MC Saves", + + "Back to Preferences Menu" +}; + +void +FileOptions () +{ + int ret = 0; + int quit = 0; + int oldmenu = menu; + menu = 0; + while (quit == 0) + { + // some load/save methods are not implemented - here's where we skip them + // they need to be skipped in the order they were enumerated in snes9xGX.h + + // no USB ports on GameCube + #ifndef HW_RVL + if(GCSettings.LoadMethod == METHOD_USB) + GCSettings.LoadMethod++; + if(GCSettings.SaveMethod == METHOD_USB) + GCSettings.SaveMethod++; + #endif + + // saving to DVD is impossible + if(GCSettings.SaveMethod == METHOD_DVD) + GCSettings.SaveMethod++; + + // disable SMB in GC mode (stalls out) + #ifndef HW_RVL + if(GCSettings.LoadMethod == METHOD_SMB) + GCSettings.LoadMethod++; + if(GCSettings.SaveMethod == METHOD_SMB) + GCSettings.SaveMethod++; + #endif + + // disable MC saving in Wii mode - does not work for some reason! + #ifdef HW_RVL + if(GCSettings.SaveMethod == METHOD_MC_SLOTA) + GCSettings.SaveMethod++; + if(GCSettings.SaveMethod == METHOD_MC_SLOTB) + GCSettings.SaveMethod++; + #endif + + // correct load/save methods out of bounds + if(GCSettings.LoadMethod > 4) + GCSettings.LoadMethod = 0; + if(GCSettings.SaveMethod > 6) + GCSettings.SaveMethod = 0; + + if (GCSettings.LoadMethod == METHOD_AUTO) sprintf (filemenu[0],"Load Method AUTO"); + else if (GCSettings.LoadMethod == METHOD_SD) sprintf (filemenu[0],"Load Method SD"); + else if (GCSettings.LoadMethod == METHOD_USB) sprintf (filemenu[0],"Load Method USB"); + else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (filemenu[0],"Load Method DVD"); + else if (GCSettings.LoadMethod == METHOD_SMB) sprintf (filemenu[0],"Load Method Network"); + + sprintf (filemenu[1], "Load Folder %s", GCSettings.LoadFolder); + + if (GCSettings.SaveMethod == METHOD_AUTO) sprintf (filemenu[2],"Save Method AUTO"); + else if (GCSettings.SaveMethod == METHOD_SD) sprintf (filemenu[2],"Save Method SD"); + else if (GCSettings.SaveMethod == METHOD_USB) sprintf (filemenu[2],"Save Method USB"); + else if (GCSettings.SaveMethod == METHOD_SMB) sprintf (filemenu[2],"Save Method Network"); + else if (GCSettings.SaveMethod == METHOD_MC_SLOTA) sprintf (filemenu[2],"Save Method MC Slot A"); + else if (GCSettings.SaveMethod == METHOD_MC_SLOTB) sprintf (filemenu[2],"Save Method MC Slot B"); + + sprintf (filemenu[3], "Save Folder %s", GCSettings.SaveFolder); + + // disable changing load/save directories for now + filemenu[1][0] = '\0'; + filemenu[3][0] = '\0'; + + if (GCSettings.AutoLoad == 0) sprintf (filemenu[4],"Auto Load OFF"); + else if (GCSettings.AutoLoad == 1) sprintf (filemenu[4],"Auto Load SRAM"); + else if (GCSettings.AutoLoad == 2) sprintf (filemenu[4],"Auto Load SNAPSHOT"); + + if (GCSettings.AutoSave == 0) sprintf (filemenu[5],"Auto Save OFF"); + else if (GCSettings.AutoSave == 1) sprintf (filemenu[5],"Auto Save SRAM"); + else if (GCSettings.AutoSave == 2) sprintf (filemenu[5],"Auto Save SNAPSHOT"); + else if (GCSettings.AutoSave == 3) sprintf (filemenu[5],"Auto Save BOTH"); + + sprintf (filemenu[6], "Verify MC Saves %s", + GCSettings.VerifySaves == true ? " ON" : "OFF"); + + ret = RunMenu (filemenu, filemenuCount, (char*)"Save/Load Options", 16); + + switch (ret) + { + case 0: + GCSettings.LoadMethod ++; + break; + + case 1: + break; + + case 2: + GCSettings.SaveMethod ++; + break; + + case 3: + break; + + case 4: + GCSettings.AutoLoad ++; + if (GCSettings.AutoLoad > 2) + GCSettings.AutoLoad = 0; + break; + + case 5: + GCSettings.AutoSave ++; + if (GCSettings.AutoSave > 3) + GCSettings.AutoSave = 0; + break; + + case 6: + GCSettings.VerifySaves ^= 1; + break; + case -1: /*** Button B ***/ + case 7: + SavePrefs(GCSettings.SaveMethod, SILENT); + quit = 1; + break; + + } + } + menu = oldmenu; +} + +/**************************************************************************** + * Video Options + ***************************************************************************/ +static int videomenuCount = 14; +static char videomenu[][50] = { + + "Transparency", + "Display Frame Rate", + "Enable Zooming", + "Video Filtering", + "Widescreen", + + "X-shift ++", + " --", + "Y-shift ++", + " --", + "Shift: ", + "Reset Video Shift", + + "Reverse Stereo", + "Interpolated Sound", + "Back to Preferences Menu" +}; + +void +VideoOptions () +{ + int ret = 0; + int quit = 0; + int oldmenu = menu; + menu = 0; + while (quit == 0) + { + sprintf (videomenu[0], "Transparency %s", + Settings.Transparency == true ? " ON" : "OFF"); + + sprintf (videomenu[1], "Display Frame Rate %s", + Settings.DisplayFrameRate == true ? " ON" : "OFF"); + + sprintf (videomenu[2], "Enable Zooming %s", + GCSettings.NGCZoom == true ? " ON" : "OFF"); + + // don't allow original render mode if progressive video mode detected + if (GCSettings.render==0 && progressive) + GCSettings.render++; + + if ( GCSettings.render == 0 ) + sprintf (videomenu[3], "Video Rendering Original"); + if ( GCSettings.render == 1 ) + sprintf (videomenu[3], "Video Rendering Filtered"); + if ( GCSettings.render == 2 ) + sprintf (videomenu[3], "Video Rendering Unfiltered"); + + sprintf (videomenu[4], "Video Scaling %s", + GCSettings.widescreen == true ? "16:9 Correction" : "Default"); + + sprintf (videomenu[9], "Video Shift: %d, %d", GCSettings.xshift, GCSettings.yshift); + + sprintf (videomenu[11], "Reverse Stereo %s", + Settings.ReverseStereo == true ? " ON" : "OFF"); + + sprintf (videomenu[12], "Interpolated Sound %s", + Settings.InterpolatedSound == true ? " ON" : "OFF"); + + ret = RunMenu (videomenu, videomenuCount, (char*)"Video Options", 16); + + switch (ret) + { + case 0: + Settings.Transparency ^= 1; + break; + + case 1: + Settings.DisplayFrameRate ^= 1; + break; + + case 2: + GCSettings.NGCZoom ^= 1; + break; + + case 3: + GCSettings.render++; + if (GCSettings.render > 2 ) + GCSettings.render = 0; + // reset zoom + zoom_reset (); + break; + + case 4: + GCSettings.widescreen ^= 1; + break; + + case 5: + // xscale UP + GCSettings.xshift++; + break; + + case 6: + // xscale DOWN + GCSettings.xshift--; + break; + + case 7: + // yscale UP + GCSettings.yshift++; + break; + + case 8: + // yscale DOWN + GCSettings.yshift--; + break; + + case 9: + break; + + case 10: + // reset video shifts + GCSettings.xshift = GCSettings.yshift = 0; + WaitPrompt((char *)"Video Shift Reset"); + break; + + case 11: + Settings.ReverseStereo ^= 1; + break; + + case 12: + Settings.InterpolatedSound ^= 1; + break; + + case -1: // Button B + case 13: + SavePrefs(GCSettings.SaveMethod, SILENT); + quit = 1; + break; + + } + } + menu = oldmenu; +} + /**************************************************************************** * Controller Configuration * @@ -916,7 +901,7 @@ ConfigureButtons (u16 ctrlr_type) menu = oldmenu; } // end configurebuttons() -int ctlrmenucount = 10; +int ctlrmenucount = 9; char ctlrmenu[][50] = { // toggle: "MultiTap", @@ -928,8 +913,7 @@ char ctlrmenu[][50] = { "Classic Controller", "Wiimote", "Gamecube Pad", - "Save Preferences", - "Go Back" + "Back to Preferences Menu" }; void @@ -1004,13 +988,9 @@ ConfigureControllers () ConfigureButtons (CTRLR_GCPAD); break; - case 8: - /*** Save Preferences Now ***/ - SavePrefs(GCSettings.SaveMethod, NOTSILENT); - break; - case -1: /*** Button B ***/ - case 9: + case 8: + SavePrefs(GCSettings.SaveMethod, SILENT); /*** Return ***/ quit = 1; break; @@ -1020,37 +1000,87 @@ ConfigureControllers () menu = oldmenu; } +/**************************************************************************** + * Preferences Menu + ***************************************************************************/ +static int prefmenuCount = 5; +static char prefmenu[][50] = { + "Controllers", + "Video / Sound", + "Saving / Loading", + "Reset Preferences", + "Back to Main Menu" +}; + +void +PreferencesMenu () +{ + int ret = 0; + int quit = 0; + int oldmenu = menu; + menu = 0; + while (quit == 0) + { + ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences"); + + switch (ret) + { + case 0: + ConfigureControllers (); + break; + + case 1: + VideoOptions (); + break; + + case 2: + FileOptions (); + break; + + case 3: + DefaultSettings (); + WaitPrompt((char *)"Preferences Reset"); + break; + + case -1: /*** Button B ***/ + case 4: + quit = 1; + break; + + } + } + menu = oldmenu; +} + /**************************************************************************** * Main Menu ***************************************************************************/ -int menucount = 9; +int menucount = 7; char menuitems[][50] = { - "Choose Game", - "Controller Configuration", + "Choose Game", "Preferences", "Game Menu", - "Video Options", - "Credits", + "Credits", "DVD Motor Off", - "Reset System", + "Reset System", "Return to Loader" }; void -mainmenu (int selectedMenu) +MainMenu (int selectedMenu) { int quit = 0; int ret; // disable game-specific menu items if a ROM isn't loaded if ( ARAM_ROMSIZE == 0 ) - menuitems[3][0] = '\0'; + menuitems[2][0] = '\0'; else - sprintf (menuitems[3], "Game Menu"); - + sprintf (menuitems[2], "Game Menu"); + #ifndef HW_DOL // don't show dvd motor off on the wii - menuitems[6][0] = '\0'; + menuitems[4][0] = '\0'; #endif VIDEO_WaitVSync (); @@ -1075,44 +1105,34 @@ mainmenu (int selectedMenu) break; case 1: - // Configure Controllers - ConfigureControllers (); - break; - - case 2: // Preferences PreferencesMenu (); break; - case 3: + case 2: // Game Options quit = GameMenu (); break; - - case 4: - // Video Options - VideoOptions (); - break; - case 5: + case 3: // Credits Credits (); WaitButtonA (); break; - - case 6: + + case 4: // turn the dvd motor off (GC only) #ifdef HW_DOL dvd_motor_off (); #endif break; - case 7: + case 5: // Reset the Gamecube/Wii Reboot(); break; - case 8: + case 6: // Exit to Loader #ifdef HW_RVL #ifdef WII_DVD diff --git a/source/ngc/menu.h b/source/ngc/menu.h index c8cad38..3b57fda 100644 --- a/source/ngc/menu.h +++ b/source/ngc/menu.h @@ -15,6 +15,6 @@ #define _NGCMENU_ -void mainmenu (int selectedMenu); +void MainMenu (int selectedMenu); #endif diff --git a/source/ngc/menudraw.cpp b/source/ngc/menudraw.cpp index 11fcbe2..c372c65 100644 --- a/source/ngc/menudraw.cpp +++ b/source/ngc/menudraw.cpp @@ -55,9 +55,7 @@ extern int whichfb; /*** Permanent backdrop ***/ #ifdef HW_RVL -u32 *backdrop; -#else -static u32 *backdrop; +u32 *backdrop = NULL; #endif unsigned int getcolour (u8 r1, u8 g1, u8 b1); void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b ); @@ -318,14 +316,14 @@ unpackbackdrop () unsigned int colour; int offset; int i; + int bgSize = (screenheight * 640 * 2); - // backdrop = (unsigned int *) malloc (screenheight * 1280); - backdrop = (u32 *) malloc (screenheight * 1280); + u32 * bgtemp = (u32 *) malloc (bgSize); colour = getcolour (0x00, 0x00, 0x00); /*** Fill with black for now ***/ for (i = 0; i < (320 * screenheight); i++) - backdrop[i] = colour; + bgtemp[i] = colour; /*** If it's PAL50, need to move down a few lines ***/ offset = ((screenheight - 480) >> 1) * 320; @@ -333,15 +331,22 @@ unpackbackdrop () outbytes = BG_RAW; res = - uncompress ((Bytef *) backdrop + offset, &outbytes, (Bytef *) bg, + uncompress ((Bytef *) bgtemp + offset, &outbytes, (Bytef *) bg, inbytes); - #ifndef HW_RVL - /*** Now store the backdrop in ARAM ***/ - ARAMPut ((char *) backdrop, (char *) AR_BACKDROP, 640 * screenheight * 2); - free (backdrop); + #ifdef HW_RVL + // On Wii - store backdrop in MEM2 + unsigned int MEM2Storage = 0x91000000; + backdrop = (u32 *)MEM2Storage; + memcpy(backdrop, bgtemp, bgSize); + #else + // On GameCube - store the backdrop in ARAM + ARAMPut ((char *) bgtemp, (char *) AR_BACKDROP, bgSize); #endif - // otherwise (on wii) backdrop is stored in memory + + free (bgtemp); + bgtemp = NULL; + clearscreen (); showscreen (); } diff --git a/source/ngc/s9xconfig.cpp b/source/ngc/s9xconfig.cpp index 50b5e3c..c29d24b 100644 --- a/source/ngc/s9xconfig.cpp +++ b/source/ngc/s9xconfig.cpp @@ -31,7 +31,7 @@ DefaultSettings () sprintf (GCSettings.CheatFolder,"snes9x/cheats"); // Path to cheat files GCSettings.AutoLoad = 1; GCSettings.AutoSave = 1; - + GCSettings.VerifySaves = 0; // custom SMB settings @@ -54,12 +54,12 @@ DefaultSettings () GCSettings.Superscope = 0; GCSettings.Mouse = 0; GCSettings.Justifier = 0; - + GCSettings.NGCZoom = 0; // zooming default off GCSettings.render = 2; // Unfiltered GCSettings.widescreen = 0; // no aspect ratio correction - + GCSettings.xshift = 0; // video shift GCSettings.yshift = 0; @@ -99,7 +99,7 @@ DefaultSettings () Settings.SkipFrames = 10; Settings.TurboSkipFrames = 19; Settings.DisplayFrameRate = false; - Settings.AutoDisplayMessages = 1; // SNES9x 1.51 + Settings.AutoDisplayMessages = 0; // SNES9x 1.51 Settings.InitialInfoStringTimeout = 200; // # frames to display messages for // Frame timings in 50hz and 60hz cpu mode diff --git a/source/ngc/snes9xGX.cpp b/source/ngc/snes9xGX.cpp index f37ff90..feea8bf 100644 --- a/source/ngc/snes9xGX.cpp +++ b/source/ngc/snes9xGX.cpp @@ -156,7 +156,7 @@ emulate () //gui_savescreen (); */ - mainmenu (3); // go to game menu + MainMenu (2); // go to game menu FrameTimer = 0; setFrameTimerMethod (); // set frametimer method every time a ROM is loaded @@ -297,7 +297,7 @@ main () if(!LoadPrefs()) { WaitPrompt((char*) "Preferences reset - check settings!"); - selectedMenu = 2; // change to preferences menu + selectedMenu = 1; // change to preferences menu } // No appended ROM, so get the user to load one @@ -305,7 +305,7 @@ main () { while (ARAM_ROMSIZE == 0) { - mainmenu (selectedMenu); + MainMenu (selectedMenu); } } else diff --git a/source/ngc/sram.cpp b/source/ngc/sram.cpp index e862f43..a8925be 100644 --- a/source/ngc/sram.cpp +++ b/source/ngc/sram.cpp @@ -156,9 +156,11 @@ LoadSRAM (int method, bool silent) if(method == METHOD_SD || method == METHOD_USB) { - ChangeFATInterface(method, NOTSILENT); - sprintf (filepath, "%s/%s/%s.srm", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); - offset = LoadBufferFromFAT (filepath, silent); + if(ChangeFATInterface(method, NOTSILENT)) + { + sprintf (filepath, "%s/%s/%s.srm", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); + offset = LoadBufferFromFAT (filepath, silent); + } } else if(method == METHOD_SMB) {