add zoom saving, widescreen

This commit is contained in:
dborth 2008-10-24 06:16:15 +00:00
parent 5e024b9f70
commit e006e66c77
9 changed files with 82 additions and 41 deletions

View File

@ -279,7 +279,7 @@ u32 GetJoy(int pad)
#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

@ -35,6 +35,7 @@ extern "C" {
#include "button_mapping.h" #include "button_mapping.h"
#include "menudraw.h" #include "menudraw.h"
#include "input.h" #include "input.h"
#include "vbaconfig.h"
extern "C" extern "C"
{ {
@ -68,6 +69,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
***************************************************************************/ ***************************************************************************/
@ -94,7 +109,7 @@ LoadManager ()
/**************************************************************************** /****************************************************************************
* Preferences Menu * Preferences Menu
***************************************************************************/ ***************************************************************************/
static int prefmenuCount = 11; static int prefmenuCount = 12;
static char prefmenu[][50] = { static char prefmenu[][50] = {
"Load Method", "Load Method",
@ -107,8 +122,9 @@ static char prefmenu[][50] = {
"Verify MC Saves", "Verify MC Saves",
"Enable Zooming", "Enable Zooming",
"Video Rendering", "Video Rendering",
"Video Scaling",
"Save Preferences", "Reset Preferences",
"Back to Main Menu" "Back to Main Menu"
}; };
@ -198,13 +214,16 @@ PreferencesMenu ()
else if (GCSettings.AutoSave == 3) sprintf (prefmenu[5],"Auto Save BOTH"); else if (GCSettings.AutoSave == 3) sprintf (prefmenu[5],"Auto Save BOTH");
sprintf (prefmenu[7], "Enable Zooming %s", sprintf (prefmenu[7], "Enable Zooming %s",
GCSettings.NGCZoom == true ? " ON" : "OFF"); GCSettings.Zoom == true ? " ON" : "OFF");
if ( GCSettings.render == 0) if ( GCSettings.render == 0)
sprintf (prefmenu[8], "Video Rendering Filtered"); sprintf (prefmenu[8], "Video Rendering Filtered");
if ( GCSettings.render == 1) if ( GCSettings.render == 1)
sprintf (prefmenu[8], "Video Rendering Unfiltered"); sprintf (prefmenu[8], "Video Rendering Unfiltered");
sprintf (prefmenu[9], "Video Scaling %s",
GCSettings.widescreen == true ? "16:9 Correction" : "Default");
ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16); ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16);
switch (ret) switch (ret)
@ -240,7 +259,7 @@ PreferencesMenu ()
break; break;
case 7: case 7:
GCSettings.NGCZoom ^= 1; GCSettings.Zoom ^= 1;
break; break;
case 8: case 8:
@ -252,11 +271,17 @@ PreferencesMenu ()
break; break;
case 9: case 9:
SavePrefs(GCSettings.SaveMethod, NOTSILENT); GCSettings.widescreen ^= 1;
break; break;
case -1: /*** Button B ***/
case 10: case 10:
DefaultSettings ();
WaitPrompt((char *)"Preferences Reset");
break;
case 11:
case -1: /*** Button B ***/
SavePrefs(GCSettings.SaveMethod, SILENT);
quit = 1; quit = 1;
break; break;
@ -306,7 +331,7 @@ GameMenu ()
gamemenu[5][0] = '\0'; gamemenu[5][0] = '\0';
} }
// disable Reset Zoom if Zooming is off // disable Reset Zoom if Zooming is off
if(!GCSettings.NGCZoom) if(!GCSettings.Zoom)
gamemenu[6][0] = '\0'; gamemenu[6][0] = '\0';
ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu"); ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu");
@ -704,16 +729,7 @@ MainMenu (int selectedMenu)
break; break;
case 6: case 6:
// 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

@ -47,6 +47,11 @@ const char * toStr(int i)
sprintf(temp, "%d", i); sprintf(temp, "%d", 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)
{ {
@ -152,8 +157,10 @@ preparePrefsData (int method)
createXMLSection("Emulation", "Emulation Settings"); createXMLSection("Emulation", "Emulation Settings");
createXMLSetting("NGCZoom", "Enable Zoom", toStr(GCSettings.NGCZoom)); createXMLSetting("Zoom", "Zoom On/Off", toStr(GCSettings.Zoom));
createXMLSetting("render", "Video Rendering", toStr(GCSettings.render)); createXMLSetting("ZoomLevel", "Zoom Level", FtoStr(GCSettings.ZoomLevel));
createXMLSetting("render", "Video Filtering", toStr(GCSettings.render));
createXMLSetting("widescreen", "Aspect Ratio Correction", toStr(GCSettings.widescreen));
createXMLSection("Controller", "Controller Settings"); createXMLSection("Controller", "Controller Settings");
@ -188,6 +195,12 @@ void loadXMLSetting(int * var, const char * name)
if(item) if(item)
*var = atoi(mxmlElementGetAttr(item, "value")); *var = atoi(mxmlElementGetAttr(item, "value"));
} }
void loadXMLSetting(float * var, const char * name)
{
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
if(item)
*var = atof(mxmlElementGetAttr(item, "value"));
}
void loadXMLSetting(bool * var, const char * name) void loadXMLSetting(bool * var, const char * name)
{ {
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND); item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
@ -265,7 +278,7 @@ decodePrefsData (int method)
loadXMLSetting(GCSettings.LoadFolder, "LoadFolder"); loadXMLSetting(GCSettings.LoadFolder, "LoadFolder");
loadXMLSetting(GCSettings.SaveFolder, "SaveFolder"); loadXMLSetting(GCSettings.SaveFolder, "SaveFolder");
//loadXMLSetting(GCSettings.CheatFolder, "CheatFolder"); //loadXMLSetting(GCSettings.CheatFolder, "CheatFolder");
//loadXMLSetting(&GCSettings.VerifySaves, "VerifySaves"); loadXMLSetting(&GCSettings.VerifySaves, "VerifySaves");
// Network Settings // Network Settings
@ -276,8 +289,10 @@ decodePrefsData (int method)
// Emulation Settings // Emulation Settings
loadXMLSetting(&GCSettings.NGCZoom, "NGCZoom"); loadXMLSetting(&GCSettings.Zoom, "Zoom");
loadXMLSetting(&GCSettings.ZoomLevel, "ZoomLevel");
loadXMLSetting(&GCSettings.render, "render"); loadXMLSetting(&GCSettings.render, "render");
loadXMLSetting(&GCSettings.widescreen, "widescreen");
// Controller Settings // Controller Settings

View File

@ -133,6 +133,8 @@ int main()
MainMenu(selectedMenu); MainMenu(selectedMenu);
selectedMenu = 3; // return to game menu from now on selectedMenu = 3; // return to game menu from now on
ResetVideo_Emu();
while (emulating) // emulation loop while (emulating) // emulation loop
{ {
emulator.emuMain(emulator.emuCount); emulator.emuMain(emulator.emuCount);

View File

@ -45,9 +45,11 @@ 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
int VerifySaves; float ZoomLevel; // zoom amount
int widescreen;
int render; // 0 - filtered, 1 - unfiltered int render; // 0 - filtered, 1 - unfiltered
int VerifySaves;
}; };
extern struct SGCSettings GCSettings; extern struct SGCSettings GCSettings;

View File

@ -46,6 +46,8 @@ DefaultSettings ()
GCSettings.smbgcid[0] = 0; GCSettings.smbgcid[0] = 0;
GCSettings.VerifySaves = 0; GCSettings.VerifySaves = 0;
GCSettings.NGCZoom = 0; // zooming default off GCSettings.Zoom = 0; // zooming default off
GCSettings.render = 0; // Unfiltered GCSettings.ZoomLevel = 1.0; // zoom level
GCSettings.render = 2; // Unfiltered
GCSettings.widescreen = 0; // no aspect ratio correction
} }

View File

@ -682,7 +682,7 @@ bool LoadVBAROM(int method)
cartridgeType = 1; cartridgeType = 1;
emulator = GBSystem; emulator = GBSystem;
gbBorderOn = 0; gbBorderOn = 0; // GB borders always off
if(gbBorderOn) if(gbBorderOn)
{ {

View File

@ -47,7 +47,6 @@ static Mtx view;
static int vwidth, vheight, oldvwidth, oldvheight; static int vwidth, vheight, oldvwidth, oldvheight;
static int video_vaspect, video_haspect; static int video_vaspect, video_haspect;
int updateScaling; int updateScaling;
float zoom_level = 1;
#define HASPECT 80 #define HASPECT 80
#define VASPECT 45 #define VASPECT 45
@ -361,6 +360,8 @@ ResetVideo_Emu ()
GX_SetFieldMode (rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE)); GX_SetFieldMode (rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR); GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
updateScaling = 1;
} }
/**************************************************************************** /****************************************************************************
@ -396,9 +397,12 @@ void UpdateScaling()
int xscale = video_haspect; int xscale = video_haspect;
int yscale = video_vaspect; int yscale = video_vaspect;
if (GCSettings.widescreen)
xscale = (3*xscale)/4;
// change zoom // change zoom
xscale *= zoom_level; xscale *= GCSettings.ZoomLevel;
yscale *= zoom_level; yscale *= GCSettings.ZoomLevel;
// Set new aspect (now with crap AR hack!) // Set new aspect (now with crap AR hack!)
square[0] = square[9] = (-xscale - 7); square[0] = square[9] = (-xscale - 7);
@ -473,9 +477,7 @@ void GX_Render(int width, int height, u8 * buffer, int pitch)
whichfb ^= 1; whichfb ^= 1;
if(updateScaling) if(updateScaling)
{
UpdateScaling(); UpdateScaling();
}
if ((oldvheight != vheight) || (oldvwidth != vwidth)) if ((oldvheight != vheight) || (oldvwidth != vwidth))
{ {
@ -533,21 +535,22 @@ void GX_Render(int width, int height, u8 * buffer, int pitch)
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) zoom_level = 0.5; if (GCSettings.ZoomLevel < 0.5)
else if (zoom_level > 10.0) zoom_level = 10.0; GCSettings.ZoomLevel = 0.5;
else if (GCSettings.ZoomLevel > 2.0)
GCSettings.ZoomLevel = 2.0;
oldvheight = 0; // update video updateScaling = 1; // update video
} }
void void
zoom_reset () zoom_reset ()
{ {
zoom_level = 1.0; GCSettings.ZoomLevel = 1.0;
updateScaling = 1; // update video
oldvheight = 0; // update video
} }

View File

@ -23,5 +23,6 @@ void showscreen ();
void zoom (float speed); void zoom (float speed);
void zoom_reset (); void zoom_reset ();
void ResetVideo_Menu (); void ResetVideo_Menu ();
void ResetVideo_Emu ();
#endif #endif