mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-01 00:15:10 +01:00
add zoom saving, widescreen
This commit is contained in:
parent
5e024b9f70
commit
e006e66c77
@ -279,7 +279,7 @@ u32 GetJoy(int pad)
|
||||
#endif
|
||||
|
||||
// Check for video zoom
|
||||
if (GCSettings.NGCZoom)
|
||||
if (GCSettings.Zoom)
|
||||
{
|
||||
if (gc_py < -36 || gc_py > 36)
|
||||
zoom ((float) gc_py / -36);
|
||||
|
@ -35,6 +35,7 @@ extern "C" {
|
||||
#include "button_mapping.h"
|
||||
#include "menudraw.h"
|
||||
#include "input.h"
|
||||
#include "vbaconfig.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -68,6 +69,20 @@ void Reboot()
|
||||
#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
|
||||
***************************************************************************/
|
||||
@ -94,7 +109,7 @@ LoadManager ()
|
||||
/****************************************************************************
|
||||
* Preferences Menu
|
||||
***************************************************************************/
|
||||
static int prefmenuCount = 11;
|
||||
static int prefmenuCount = 12;
|
||||
static char prefmenu[][50] = {
|
||||
|
||||
"Load Method",
|
||||
@ -107,8 +122,9 @@ static char prefmenu[][50] = {
|
||||
"Verify MC Saves",
|
||||
"Enable Zooming",
|
||||
"Video Rendering",
|
||||
"Video Scaling",
|
||||
|
||||
"Save Preferences",
|
||||
"Reset Preferences",
|
||||
"Back to Main Menu"
|
||||
};
|
||||
|
||||
@ -198,13 +214,16 @@ PreferencesMenu ()
|
||||
else if (GCSettings.AutoSave == 3) sprintf (prefmenu[5],"Auto Save BOTH");
|
||||
|
||||
sprintf (prefmenu[7], "Enable Zooming %s",
|
||||
GCSettings.NGCZoom == true ? " ON" : "OFF");
|
||||
GCSettings.Zoom == true ? " ON" : "OFF");
|
||||
|
||||
if ( GCSettings.render == 0)
|
||||
sprintf (prefmenu[8], "Video Rendering Filtered");
|
||||
if ( GCSettings.render == 1)
|
||||
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);
|
||||
|
||||
switch (ret)
|
||||
@ -240,7 +259,7 @@ PreferencesMenu ()
|
||||
break;
|
||||
|
||||
case 7:
|
||||
GCSettings.NGCZoom ^= 1;
|
||||
GCSettings.Zoom ^= 1;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
@ -252,11 +271,17 @@ PreferencesMenu ()
|
||||
break;
|
||||
|
||||
case 9:
|
||||
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
|
||||
GCSettings.widescreen ^= 1;
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 10:
|
||||
DefaultSettings ();
|
||||
WaitPrompt((char *)"Preferences Reset");
|
||||
break;
|
||||
|
||||
case 11:
|
||||
case -1: /*** Button B ***/
|
||||
SavePrefs(GCSettings.SaveMethod, SILENT);
|
||||
quit = 1;
|
||||
break;
|
||||
|
||||
@ -306,7 +331,7 @@ GameMenu ()
|
||||
gamemenu[5][0] = '\0';
|
||||
}
|
||||
// disable Reset Zoom if Zooming is off
|
||||
if(!GCSettings.NGCZoom)
|
||||
if(!GCSettings.Zoom)
|
||||
gamemenu[6][0] = '\0';
|
||||
|
||||
ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu");
|
||||
@ -704,16 +729,7 @@ MainMenu (int selectedMenu)
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// Exit to Loader
|
||||
#ifdef HW_RVL
|
||||
#ifdef WII_DVD
|
||||
DI_Close();
|
||||
#endif
|
||||
exit(0);
|
||||
#else // gamecube
|
||||
if (psoid[0] == PSOSDLOADID)
|
||||
PSOReload ();
|
||||
#endif
|
||||
ExitToLoader();
|
||||
break;
|
||||
|
||||
case -1: // Button B
|
||||
|
@ -47,6 +47,11 @@ const char * toStr(int i)
|
||||
sprintf(temp, "%d", i);
|
||||
return temp;
|
||||
}
|
||||
const char * FtoStr(float i)
|
||||
{
|
||||
sprintf(temp, "%.2f", i);
|
||||
return temp;
|
||||
}
|
||||
|
||||
void createXMLSection(const char * name, const char * description)
|
||||
{
|
||||
@ -152,8 +157,10 @@ preparePrefsData (int method)
|
||||
|
||||
createXMLSection("Emulation", "Emulation Settings");
|
||||
|
||||
createXMLSetting("NGCZoom", "Enable Zoom", toStr(GCSettings.NGCZoom));
|
||||
createXMLSetting("render", "Video Rendering", toStr(GCSettings.render));
|
||||
createXMLSetting("Zoom", "Zoom On/Off", toStr(GCSettings.Zoom));
|
||||
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");
|
||||
|
||||
@ -188,6 +195,12 @@ void loadXMLSetting(int * var, const char * name)
|
||||
if(item)
|
||||
*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)
|
||||
{
|
||||
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||
@ -265,7 +278,7 @@ decodePrefsData (int method)
|
||||
loadXMLSetting(GCSettings.LoadFolder, "LoadFolder");
|
||||
loadXMLSetting(GCSettings.SaveFolder, "SaveFolder");
|
||||
//loadXMLSetting(GCSettings.CheatFolder, "CheatFolder");
|
||||
//loadXMLSetting(&GCSettings.VerifySaves, "VerifySaves");
|
||||
loadXMLSetting(&GCSettings.VerifySaves, "VerifySaves");
|
||||
|
||||
// Network Settings
|
||||
|
||||
@ -276,8 +289,10 @@ decodePrefsData (int method)
|
||||
|
||||
// Emulation Settings
|
||||
|
||||
loadXMLSetting(&GCSettings.NGCZoom, "NGCZoom");
|
||||
loadXMLSetting(&GCSettings.Zoom, "Zoom");
|
||||
loadXMLSetting(&GCSettings.ZoomLevel, "ZoomLevel");
|
||||
loadXMLSetting(&GCSettings.render, "render");
|
||||
loadXMLSetting(&GCSettings.widescreen, "widescreen");
|
||||
|
||||
// Controller Settings
|
||||
|
||||
|
@ -133,6 +133,8 @@ int main()
|
||||
MainMenu(selectedMenu);
|
||||
selectedMenu = 3; // return to game menu from now on
|
||||
|
||||
ResetVideo_Emu();
|
||||
|
||||
while (emulating) // emulation loop
|
||||
{
|
||||
emulator.emuMain(emulator.emuCount);
|
||||
|
@ -45,9 +45,11 @@ struct SGCSettings{
|
||||
char smbgcid[20];
|
||||
char smbsvid[20];
|
||||
char smbshare[20];
|
||||
int NGCZoom; // 0 - off, 1 - on
|
||||
int VerifySaves;
|
||||
int Zoom; // 0 - off, 1 - on
|
||||
float ZoomLevel; // zoom amount
|
||||
int widescreen;
|
||||
int render; // 0 - filtered, 1 - unfiltered
|
||||
int VerifySaves;
|
||||
};
|
||||
|
||||
extern struct SGCSettings GCSettings;
|
||||
|
@ -46,6 +46,8 @@ DefaultSettings ()
|
||||
GCSettings.smbgcid[0] = 0;
|
||||
|
||||
GCSettings.VerifySaves = 0;
|
||||
GCSettings.NGCZoom = 0; // zooming default off
|
||||
GCSettings.render = 0; // Unfiltered
|
||||
GCSettings.Zoom = 0; // zooming default off
|
||||
GCSettings.ZoomLevel = 1.0; // zoom level
|
||||
GCSettings.render = 2; // Unfiltered
|
||||
GCSettings.widescreen = 0; // no aspect ratio correction
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ bool LoadVBAROM(int method)
|
||||
cartridgeType = 1;
|
||||
emulator = GBSystem;
|
||||
|
||||
gbBorderOn = 0;
|
||||
gbBorderOn = 0; // GB borders always off
|
||||
|
||||
if(gbBorderOn)
|
||||
{
|
||||
|
@ -47,7 +47,6 @@ static Mtx view;
|
||||
static int vwidth, vheight, oldvwidth, oldvheight;
|
||||
static int video_vaspect, video_haspect;
|
||||
int updateScaling;
|
||||
float zoom_level = 1;
|
||||
|
||||
#define HASPECT 80
|
||||
#define VASPECT 45
|
||||
@ -361,6 +360,8 @@ ResetVideo_Emu ()
|
||||
|
||||
GX_SetFieldMode (rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
|
||||
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||
|
||||
updateScaling = 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -396,9 +397,12 @@ void UpdateScaling()
|
||||
int xscale = video_haspect;
|
||||
int yscale = video_vaspect;
|
||||
|
||||
if (GCSettings.widescreen)
|
||||
xscale = (3*xscale)/4;
|
||||
|
||||
// change zoom
|
||||
xscale *= zoom_level;
|
||||
yscale *= zoom_level;
|
||||
xscale *= GCSettings.ZoomLevel;
|
||||
yscale *= GCSettings.ZoomLevel;
|
||||
|
||||
// Set new aspect (now with crap AR hack!)
|
||||
square[0] = square[9] = (-xscale - 7);
|
||||
@ -473,9 +477,7 @@ void GX_Render(int width, int height, u8 * buffer, int pitch)
|
||||
whichfb ^= 1;
|
||||
|
||||
if(updateScaling)
|
||||
{
|
||||
UpdateScaling();
|
||||
}
|
||||
|
||||
if ((oldvheight != vheight) || (oldvwidth != vwidth))
|
||||
{
|
||||
@ -533,21 +535,22 @@ void GX_Render(int width, int height, u8 * buffer, int pitch)
|
||||
void
|
||||
zoom (float speed)
|
||||
{
|
||||
if (zoom_level > 1)
|
||||
zoom_level += (speed / -100.0);
|
||||
if (GCSettings.ZoomLevel > 1)
|
||||
GCSettings.ZoomLevel += (speed / -100.0);
|
||||
else
|
||||
zoom_level += (speed / -200.0);
|
||||
GCSettings.ZoomLevel += (speed / -200.0);
|
||||
|
||||
if (zoom_level < 0.5) zoom_level = 0.5;
|
||||
else if (zoom_level > 10.0) zoom_level = 10.0;
|
||||
if (GCSettings.ZoomLevel < 0.5)
|
||||
GCSettings.ZoomLevel = 0.5;
|
||||
else if (GCSettings.ZoomLevel > 2.0)
|
||||
GCSettings.ZoomLevel = 2.0;
|
||||
|
||||
oldvheight = 0; // update video
|
||||
updateScaling = 1; // update video
|
||||
}
|
||||
|
||||
void
|
||||
zoom_reset ()
|
||||
{
|
||||
zoom_level = 1.0;
|
||||
|
||||
oldvheight = 0; // update video
|
||||
GCSettings.ZoomLevel = 1.0;
|
||||
updateScaling = 1; // update video
|
||||
}
|
||||
|
@ -23,5 +23,6 @@ void showscreen ();
|
||||
void zoom (float speed);
|
||||
void zoom_reset ();
|
||||
void ResetVideo_Menu ();
|
||||
void ResetVideo_Emu ();
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user