add zoom saving, reorg menus

This commit is contained in:
dborth 2008-10-24 05:38:46 +00:00
parent 3407f9a794
commit 7fa38c378a
7 changed files with 174 additions and 116 deletions

View File

@ -29,7 +29,8 @@ DefaultSettings ()
GCSettings.crosshair = 1; GCSettings.crosshair = 1;
GCSettings.slimit = 1; GCSettings.slimit = 1;
GCSettings.NGCZoom = 0; // zooming default off GCSettings.Zoom = 0; // zooming default off
GCSettings.ZoomLevel = 1.0; // zoom amount
GCSettings.render = 2; // Unfiltered GCSettings.render = 2; // Unfiltered
GCSettings.widescreen = 0; // no aspect ratio correction GCSettings.widescreen = 0; // no aspect ratio correction

View File

@ -48,7 +48,8 @@ struct SGCSettings{
char smbgcid[20]; char smbgcid[20];
char smbsvid[20]; char smbsvid[20];
char smbshare[20]; char smbshare[20];
int NGCZoom; // 0 - off, 1 - on int Zoom; // 0 - off, 1 - on
float ZoomLevel; // zoom amount
int VerifySaves; int VerifySaves;
int render; // 0 - original, 1 - filtered, 2 - unfiltered int render; // 0 - original, 1 - filtered, 2 - unfiltered
int widescreen; int widescreen;

View File

@ -136,14 +136,14 @@ int main(int argc, char *argv[])
if(!LoadPrefs()) if(!LoadPrefs())
{ {
WaitPrompt((char*) "Preferences reset - check settings!"); WaitPrompt((char*) "Preferences reset - check settings!");
selectedMenu = 3; // change to preferences menu selectedMenu = 1; // change to preferences menu
} }
while (1) // main loop while (1) // main loop
{ {
ResetVideo_Menu(); ResetVideo_Menu();
MainMenu(selectedMenu); MainMenu(selectedMenu);
selectedMenu = 4; // return to game menu from now on selectedMenu = 2; // return to game menu from now on
setFrameTimer(); // set frametimer method before emulation setFrameTimer(); // set frametimer method before emulation
FCEUI_SetVidSystem(GCSettings.timing); FCEUI_SetVidSystem(GCSettings.timing);

View File

@ -51,7 +51,6 @@ int vwidth = 256;
int vheight = 240; int vheight = 240;
int updateScaling = 1; int updateScaling = 1;
float zoom_level = 1;
bool progressive = false; bool progressive = false;
int vmode_60hz = 0; int vmode_60hz = 0;
@ -753,8 +752,8 @@ void RenderFrame(unsigned char *XBuf)
if (GCSettings.widescreen) if (GCSettings.widescreen)
xscale = (3*xscale)/4; xscale = (3*xscale)/4;
xscale *= zoom_level; xscale *= GCSettings.ZoomLevel;
yscale *= zoom_level; yscale *= GCSettings.ZoomLevel;
square[0] = square[9] = (-xscale); square[0] = square[9] = (-xscale);
square[3] = square[6] = (xscale); square[3] = square[6] = (xscale);
@ -834,15 +833,15 @@ void RenderFrame(unsigned char *XBuf)
void void
zoom (float speed) zoom (float speed)
{ {
if (zoom_level > 1) if (GCSettings.ZoomLevel > 1)
zoom_level += (speed / -100.0); GCSettings.ZoomLevel += (speed / -100.0);
else else
zoom_level += (speed / -200.0); GCSettings.ZoomLevel += (speed / -200.0);
if (zoom_level < 0.5) if (GCSettings.ZoomLevel < 0.5)
zoom_level = 0.5; GCSettings.ZoomLevel = 0.5;
else if (zoom_level > 2.0) else if (GCSettings.ZoomLevel > 2.0)
zoom_level = 2.0; GCSettings.ZoomLevel = 2.0;
updateScaling = 1; // update video updateScaling = 1; // update video
} }
@ -850,8 +849,7 @@ zoom (float speed)
void void
zoom_reset () zoom_reset ()
{ {
zoom_level = 1.0; GCSettings.ZoomLevel = 1.0;
updateScaling = 1; // update video updateScaling = 1; // update video
} }

View File

@ -66,6 +66,20 @@ void Reboot()
#endif #endif
} }
void ExitToLoader()
{
// Exit to Loader
#ifdef HW_RVL
#ifdef WII_DVD
DI_Close();
#endif
exit(0);
#else // gamecube
if (psoid[0] == PSOSDLOADID)
PSOReload ();
#endif
}
/**************************************************************************** /****************************************************************************
* Load Manager * Load Manager
****************************************************************************/ ****************************************************************************/
@ -89,24 +103,23 @@ LoadManager ()
} }
/**************************************************************************** /****************************************************************************
* Emulator Menu * Video Options Menu
****************************************************************************/ ****************************************************************************/
static int emulatormenuCount = 8; static int videomenuCount = 7;
static char emulatormenu[][50] = { static char videomenu[][50] = {
"Video Filtering", "Video Rendering",
"Video Scaling", "Video Scaling",
"Palette", "Palette",
"Enable Zooming", "Enable Zooming",
"Timing", "Timing",
"8 Sprite Limit", "8 Sprite Limit",
"Save Preferences", "Back to Preferences Menu"
"Back to Main Menu"
}; };
void void
EmulatorMenu () VideoOptions ()
{ {
int ret = 0; int ret = 0;
int quit = 0; int quit = 0;
@ -119,28 +132,28 @@ EmulatorMenu ()
GCSettings.render++; GCSettings.render++;
if ( GCSettings.render == 0 ) if ( GCSettings.render == 0 )
sprintf (emulatormenu[0], "Video Rendering Original"); sprintf (videomenu[0], "Video Rendering Original");
if ( GCSettings.render == 1 ) if ( GCSettings.render == 1 )
sprintf (emulatormenu[0], "Video Rendering Filtered"); sprintf (videomenu[0], "Video Rendering Filtered");
if ( GCSettings.render == 2 ) if ( GCSettings.render == 2 )
sprintf (emulatormenu[0], "Video Rendering Unfiltered"); sprintf (videomenu[0], "Video Rendering Unfiltered");
sprintf (emulatormenu[1], "Video Scaling %s", sprintf (videomenu[1], "Video Scaling %s",
GCSettings.widescreen == true ? "16:9 Correction" : "Default"); GCSettings.widescreen == true ? "16:9 Correction" : "Default");
sprintf (emulatormenu[2], "Palette - %s", sprintf (videomenu[2], "Palette - %s",
GCSettings.currpal ? palettes[GCSettings.currpal-1].name : "Default"); GCSettings.currpal ? palettes[GCSettings.currpal-1].name : "Default");
sprintf (emulatormenu[3], "Enable Zooming %s", sprintf (videomenu[3], "Enable Zooming %s",
GCSettings.NGCZoom == true ? " ON" : "OFF"); GCSettings.Zoom == true ? " ON" : "OFF");
sprintf (emulatormenu[5], "Timing - %s", sprintf (videomenu[4], "Timing - %s",
GCSettings.timing == true ? " PAL" : "NTSC"); GCSettings.timing == true ? " PAL" : "NTSC");
sprintf (emulatormenu[4], "8 Sprite Limit - %s", sprintf (videomenu[5], "8 Sprite Limit - %s",
GCSettings.slimit == true ? " ON" : "OFF"); GCSettings.slimit == true ? " ON" : "OFF");
ret = RunMenu (emulatormenu, emulatormenuCount, (char*)"Emulator Options", 16, -1); ret = RunMenu (videomenu, videomenuCount, (char*)"Video Options", 20, -1);
switch (ret) switch (ret)
{ {
@ -184,7 +197,7 @@ EmulatorMenu ()
break; break;
case 3: case 3:
GCSettings.NGCZoom ^= 1; GCSettings.Zoom ^= 1;
break; break;
case 4: // timing case 4: // timing
@ -196,12 +209,8 @@ EmulatorMenu ()
FCEUI_DisableSpriteLimitation(GCSettings.slimit); FCEUI_DisableSpriteLimitation(GCSettings.slimit);
break; break;
case 6:
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
break;
case -1: // Button B case -1: // Button B
case 7: case 6:
quit = 1; quit = 1;
break; break;
@ -212,10 +221,10 @@ EmulatorMenu ()
/**************************************************************************** /****************************************************************************
* Preferences Menu * File Options Menu
****************************************************************************/ ****************************************************************************/
static int prefmenuCount = 9; static int filemenuCount = 8;
static char prefmenu[][50] = { static char filemenu[][50] = {
"Load Method", "Load Method",
"Load Folder", "Load Folder",
@ -226,12 +235,11 @@ static char prefmenu[][50] = {
"Auto Save", "Auto Save",
"Verify MC Saves", "Verify MC Saves",
"Save Preferences", "Back to Preferences Menu"
"Back to Main Menu"
}; };
void void
PreferencesMenu () FileOptions()
{ {
int ret = 0; int ret = 0;
int quit = 0; int quit = 0;
@ -268,9 +276,9 @@ PreferencesMenu ()
GCSettings.SaveMethod++; GCSettings.SaveMethod++;
if(GCSettings.SaveMethod == METHOD_MC_SLOTB) if(GCSettings.SaveMethod == METHOD_MC_SLOTB)
GCSettings.SaveMethod++; GCSettings.SaveMethod++;
prefmenu[6][0] = '\0'; filemenu[6][0] = '\0';
#else #else
sprintf (prefmenu[6], "Verify MC Saves %s", sprintf (filemenu[6], "Verify MC Saves %s",
GCSettings.VerifySaves == true ? " ON" : "OFF"); GCSettings.VerifySaves == true ? " ON" : "OFF");
#endif #endif
@ -280,37 +288,37 @@ PreferencesMenu ()
if(GCSettings.SaveMethod > 6) if(GCSettings.SaveMethod > 6)
GCSettings.SaveMethod = 0; GCSettings.SaveMethod = 0;
if (GCSettings.LoadMethod == METHOD_AUTO) sprintf (prefmenu[0],"Load Method AUTO"); if (GCSettings.LoadMethod == METHOD_AUTO) sprintf (filemenu[0],"Load Method AUTO");
else if (GCSettings.LoadMethod == METHOD_SD) sprintf (prefmenu[0],"Load Method SD"); else if (GCSettings.LoadMethod == METHOD_SD) sprintf (filemenu[0],"Load Method SD");
else if (GCSettings.LoadMethod == METHOD_USB) sprintf (prefmenu[0],"Load Method USB"); else if (GCSettings.LoadMethod == METHOD_USB) sprintf (filemenu[0],"Load Method USB");
else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (prefmenu[0],"Load Method DVD"); else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (filemenu[0],"Load Method DVD");
else if (GCSettings.LoadMethod == METHOD_SMB) sprintf (prefmenu[0],"Load Method Network"); else if (GCSettings.LoadMethod == METHOD_SMB) sprintf (filemenu[0],"Load Method Network");
sprintf (prefmenu[1], "Load Folder %s", GCSettings.LoadFolder); sprintf (filemenu[1], "Load Folder %s", GCSettings.LoadFolder);
if (GCSettings.SaveMethod == METHOD_AUTO) sprintf (prefmenu[2],"Save Method AUTO"); if (GCSettings.SaveMethod == METHOD_AUTO) sprintf (filemenu[2],"Save Method AUTO");
else if (GCSettings.SaveMethod == METHOD_SD) sprintf (prefmenu[2],"Save Method SD"); else if (GCSettings.SaveMethod == METHOD_SD) sprintf (filemenu[2],"Save Method SD");
else if (GCSettings.SaveMethod == METHOD_USB) sprintf (prefmenu[2],"Save Method USB"); else if (GCSettings.SaveMethod == METHOD_USB) sprintf (filemenu[2],"Save Method USB");
else if (GCSettings.SaveMethod == METHOD_SMB) sprintf (prefmenu[2],"Save Method Network"); else if (GCSettings.SaveMethod == METHOD_SMB) sprintf (filemenu[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_SLOTA) sprintf (filemenu[2],"Save Method MC Slot A");
else if (GCSettings.SaveMethod == METHOD_MC_SLOTB) sprintf (prefmenu[2],"Save Method MC Slot B"); else if (GCSettings.SaveMethod == METHOD_MC_SLOTB) sprintf (filemenu[2],"Save Method MC Slot B");
sprintf (prefmenu[3], "Save Folder %s", GCSettings.SaveFolder); sprintf (filemenu[3], "Save Folder %s", GCSettings.SaveFolder);
// disable changing load/save directories for now // disable changing load/save directories for now
prefmenu[1][0] = '\0'; filemenu[1][0] = '\0';
prefmenu[3][0] = '\0'; filemenu[3][0] = '\0';
if (GCSettings.AutoLoad == 0) sprintf (prefmenu[4],"Auto Load OFF"); if (GCSettings.AutoLoad == 0) sprintf (filemenu[4],"Auto Load OFF");
else if (GCSettings.AutoLoad == 1) sprintf (prefmenu[4],"Auto Load RAM"); else if (GCSettings.AutoLoad == 1) sprintf (filemenu[4],"Auto Load RAM");
else if (GCSettings.AutoLoad == 2) sprintf (prefmenu[4],"Auto Load STATE"); else if (GCSettings.AutoLoad == 2) sprintf (filemenu[4],"Auto Load STATE");
if (GCSettings.AutoSave == 0) sprintf (prefmenu[5],"Auto Save OFF"); if (GCSettings.AutoSave == 0) sprintf (filemenu[5],"Auto Save OFF");
else if (GCSettings.AutoSave == 1) sprintf (prefmenu[5],"Auto Save RAM"); else if (GCSettings.AutoSave == 1) sprintf (filemenu[5],"Auto Save RAM");
else if (GCSettings.AutoSave == 2) sprintf (prefmenu[5],"Auto Save STATE"); else if (GCSettings.AutoSave == 2) sprintf (filemenu[5],"Auto Save STATE");
else if (GCSettings.AutoSave == 3) sprintf (prefmenu[5],"Auto Save BOTH"); else if (GCSettings.AutoSave == 3) sprintf (filemenu[5],"Auto Save BOTH");
ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16, -1); ret = RunMenu (filemenu, filemenuCount, (char*)"Save/Load Options", 20, -1);
switch (ret) switch (ret)
{ {
@ -344,12 +352,8 @@ PreferencesMenu ()
GCSettings.VerifySaves ^= 1; GCSettings.VerifySaves ^= 1;
break; break;
case 7:
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
break;
case -1: // Button B case -1: // Button B
case 8: case 7:
quit = 1; quit = 1;
break; break;
@ -365,13 +369,14 @@ PreferencesMenu ()
int int
GameMenu () GameMenu ()
{ {
int gamemenuCount = 8; int gamemenuCount = 9;
char gamemenu[][50] = { char gamemenu[][50] = {
"Return to Game", "Return to Game",
"Reset Game", "Reset Game",
"ROM Information", "ROM Information",
"Load RAM", "Save RAM", "Load RAM", "Save RAM",
"Load State", "Save State", "Load State", "Save State",
"Reset Zoom",
"Back to Main Menu" "Back to Main Menu"
}; };
@ -408,6 +413,10 @@ GameMenu ()
gamemenu[6][0] = '\0'; gamemenu[6][0] = '\0';
} }
// disable Reset Zoom if Zooming is off
if(!GCSettings.Zoom)
gamemenu[7][0] = '\0';
ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu", 20, -1); ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu", 20, -1);
switch (ret) switch (ret)
@ -442,8 +451,12 @@ GameMenu ()
SaveState(GCSettings.SaveMethod, NOTSILENT); SaveState(GCSettings.SaveMethod, NOTSILENT);
break; break;
case 7:
zoom_reset ();
break;
case -1: // Button B case -1: // Button B
case 7: // Return to previous menu case 8: // Return to previous menu
retval = 0; retval = 0;
quit = 1; quit = 1;
break; break;
@ -672,7 +685,7 @@ ConfigureButtons (u16 ctrlr_type)
menu = oldmenu; menu = oldmenu;
} // end configurebuttons() } // end configurebuttons()
int ctlrmenucount = 9; int ctlrmenucount = 8;
char ctlrmenu[][50] = { char ctlrmenu[][50] = {
"Four Score", "Four Score",
"Zapper", "Zapper",
@ -681,8 +694,7 @@ char ctlrmenu[][50] = {
"Classic Controller", "Classic Controller",
"Wiimote", "Wiimote",
"Gamecube Pad", "Gamecube Pad",
"Save Preferences", "Back to Preferences Menu"
"Go Back"
}; };
void void
@ -753,13 +765,8 @@ ConfigureControllers ()
ConfigureButtons (CTRLR_GCPAD); ConfigureButtons (CTRLR_GCPAD);
break; break;
case 7:
/*** Save Preferences Now ***/
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
break;
case -1: /*** Button B ***/ case -1: /*** Button B ***/
case 8: case 7:
/*** Return ***/ /*** Return ***/
quit = 1; quit = 1;
break; break;
@ -769,15 +776,70 @@ ConfigureControllers ()
menu = oldmenu; menu = oldmenu;
} }
/****************************************************************************
* Preferences Menu
***************************************************************************/
static int prefmenuCount = 5;
static char prefmenu[][50] = {
"Controllers",
"Video",
"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", 20, -1);
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:
SavePrefs(GCSettings.SaveMethod, SILENT);
quit = 1;
break;
}
}
menu = oldmenu;
}
/**************************************************************************** /****************************************************************************
* Main Menu * Main Menu
****************************************************************************/ ****************************************************************************/
int menucount = 8; int menucount = 6;
char menuitems[][50] = { char menuitems[][50] = {
"Choose Game", "Choose Game",
"Controller Configuration", "Emulator Options", "Preferences", "Preferences",
"Game Menu", "Game Menu",
"Credits", "Reset System", "Exit" "Credits",
"Reset System",
"Exit"
}; };
void void
@ -792,7 +854,7 @@ MainMenu (int selectedMenu)
{ {
// disable game-specific menu items if a ROM isn't loaded // disable game-specific menu items if a ROM isn't loaded
if(!romLoaded) if(!romLoaded)
menuitems[4][0] = '\0'; menuitems[2][0] = '\0';
else else
sprintf (menuitems[4], "Game Menu"); sprintf (menuitems[4], "Game Menu");
@ -814,46 +876,28 @@ MainMenu (int selectedMenu)
break; break;
case 1: case 1:
// Configure Controllers
ConfigureControllers ();
break;
case 2:
// Emulator Options
EmulatorMenu ();
break;
case 3:
// Preferences // Preferences
PreferencesMenu (); PreferencesMenu ();
break; break;
case 4: case 2:
// Game Options // Game Options
quit = GameMenu (); quit = GameMenu ();
break; break;
case 5: case 3:
// Credits // Credits
Credits (); Credits ();
WaitButtonA (); WaitButtonA ();
break; break;
case 6: case 4:
// Reset the Gamecube/Wii // Reset the Gamecube/Wii
Reboot(); Reboot();
break; break;
case 7: case 5:
// Exit to Loader ExitToLoader();
#ifdef HW_RVL
#ifdef WII_DVD
DI_Close();
#endif
exit(0);
#else // gamecube
if (psoid[0] == PSOSDLOADID)
PSOReload ();
#endif
break; break;
case -1: // Button B case -1: // Button B

View File

@ -460,7 +460,7 @@ void GetJoy()
#endif #endif
/*** Check for video zoom ***/ /*** Check for video zoom ***/
if (GCSettings.NGCZoom) if (GCSettings.Zoom)
{ {
if (gc_py < -36 || gc_py > 36) if (gc_py < -36 || gc_py > 36)
zoom ((float) gc_py / -36); zoom ((float) gc_py / -36);

View File

@ -56,6 +56,12 @@ const char * toStr(int i)
return temp; return temp;
} }
const char * FtoStr(float i)
{
sprintf(temp, "%.2f", i);
return temp;
}
void createXMLSection(const char * name, const char * description) void createXMLSection(const char * name, const char * description)
{ {
section = mxmlNewElement(data, "section"); section = mxmlNewElement(data, "section");
@ -165,7 +171,8 @@ preparePrefsData (int method)
createXMLSetting("currpal", "Palette", toStr(GCSettings.currpal)); createXMLSetting("currpal", "Palette", toStr(GCSettings.currpal));
createXMLSetting("timing", "Timing", toStr(GCSettings.timing)); createXMLSetting("timing", "Timing", toStr(GCSettings.timing));
createXMLSetting("slimit", "8 Sprite Limit", toStr(GCSettings.slimit)); createXMLSetting("slimit", "8 Sprite Limit", toStr(GCSettings.slimit));
createXMLSetting("NGCZoom", "C-Stick Zoom", toStr(GCSettings.NGCZoom)); createXMLSetting("Zoom", "Zoom On/Off", toStr(GCSettings.Zoom));
createXMLSetting("ZoomLevel", "Zoom Level", FtoStr(GCSettings.ZoomLevel));
createXMLSetting("render", "Video Filtering", toStr(GCSettings.render)); createXMLSetting("render", "Video Filtering", toStr(GCSettings.render));
createXMLSetting("widescreen", "Aspect Ratio Correction", toStr(GCSettings.widescreen)); createXMLSetting("widescreen", "Aspect Ratio Correction", toStr(GCSettings.widescreen));
@ -202,6 +209,12 @@ void loadXMLSettingInt(int * var, const char * name)
if(item) if(item)
*var = atoi(mxmlElementGetAttr(item, "value")); *var = atoi(mxmlElementGetAttr(item, "value"));
} }
void loadXMLSettingFloat(float * var, const char * name)
{
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
if(item)
*var = atof(mxmlElementGetAttr(item, "value"));
}
void loadXMLSettingBool(bool * var, const char * name) void loadXMLSettingBool(bool * var, const char * name)
{ {
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND); item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
@ -285,7 +298,8 @@ decodePrefsData (int method)
loadXMLSettingInt(&GCSettings.timing, "timing"); loadXMLSettingInt(&GCSettings.timing, "timing");
loadXMLSettingInt(&GCSettings.FSDisable, "FSDisable"); loadXMLSettingInt(&GCSettings.FSDisable, "FSDisable");
loadXMLSettingInt(&GCSettings.slimit, "slimit"); loadXMLSettingInt(&GCSettings.slimit, "slimit");
loadXMLSettingInt(&GCSettings.NGCZoom, "NGCZoom"); loadXMLSettingInt(&GCSettings.Zoom, "Zoom");
loadXMLSettingFloat(&GCSettings.ZoomLevel, "ZoomLevel");
loadXMLSettingInt(&GCSettings.render, "render"); loadXMLSettingInt(&GCSettings.render, "render");
loadXMLSettingInt(&GCSettings.widescreen, "widescreen"); loadXMLSettingInt(&GCSettings.widescreen, "widescreen");
loadXMLSettingInt(&GCSettings.zapper, "zapper"); loadXMLSettingInt(&GCSettings.zapper, "zapper");