mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
add zoom saving, video corrections
This commit is contained in:
parent
f0662c9d37
commit
6d4bab0809
@ -446,7 +446,7 @@ void NGCReportButtons ()
|
|||||||
|
|
||||||
|
|
||||||
/*** 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);
|
||||||
|
@ -83,6 +83,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
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -104,9 +118,6 @@ LoadManager ()
|
|||||||
|
|
||||||
// setup cheats
|
// setup cheats
|
||||||
SetupCheats();
|
SetupCheats();
|
||||||
|
|
||||||
// reset zoom
|
|
||||||
zoom_reset ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return loadROM;
|
return loadROM;
|
||||||
@ -346,7 +357,6 @@ GameMenu ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // Reset Game
|
case 1: // Reset Game
|
||||||
zoom_reset ();
|
|
||||||
S9xSoftReset ();
|
S9xSoftReset ();
|
||||||
quit = retval = 1;
|
quit = retval = 1;
|
||||||
break;
|
break;
|
||||||
@ -361,7 +371,6 @@ GameMenu ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // Load SRAM
|
case 4: // Load SRAM
|
||||||
zoom_reset ();
|
|
||||||
quit = retval = LoadSRAM(GCSettings.SaveMethod, NOTSILENT);
|
quit = retval = LoadSRAM(GCSettings.SaveMethod, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -370,7 +379,6 @@ GameMenu ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: // Load Freeze
|
case 6: // Load Freeze
|
||||||
zoom_reset ();
|
|
||||||
quit = retval = NGCUnfreezeGame (GCSettings.SaveMethod, NOTSILENT);
|
quit = retval = NGCUnfreezeGame (GCSettings.SaveMethod, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -544,8 +552,8 @@ static char videomenu[][50] = {
|
|||||||
"Transparency",
|
"Transparency",
|
||||||
"Display Frame Rate",
|
"Display Frame Rate",
|
||||||
"Enable Zooming",
|
"Enable Zooming",
|
||||||
"Video Filtering",
|
"Video Rendering",
|
||||||
"Widescreen",
|
"Video Scaling",
|
||||||
|
|
||||||
"Shift Video Up",
|
"Shift Video Up",
|
||||||
"Shift Video Down",
|
"Shift Video Down",
|
||||||
@ -574,7 +582,7 @@ VideoOptions ()
|
|||||||
Settings.DisplayFrameRate == true ? " ON" : "OFF");
|
Settings.DisplayFrameRate == true ? " ON" : "OFF");
|
||||||
|
|
||||||
sprintf (videomenu[2], "Enable Zooming %s",
|
sprintf (videomenu[2], "Enable Zooming %s",
|
||||||
GCSettings.NGCZoom == true ? " ON" : "OFF");
|
GCSettings.Zoom == true ? " ON" : "OFF");
|
||||||
|
|
||||||
// don't allow original render mode if progressive video mode detected
|
// don't allow original render mode if progressive video mode detected
|
||||||
if (GCSettings.render==0 && progressive)
|
if (GCSettings.render==0 && progressive)
|
||||||
@ -605,7 +613,7 @@ VideoOptions ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
GCSettings.NGCZoom ^= 1;
|
GCSettings.Zoom ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
@ -1111,16 +1119,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
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
@ -154,7 +159,8 @@ preparePrefsData (int method)
|
|||||||
|
|
||||||
createXMLSetting("Transparency", "Transparency", toStr(Settings.Transparency));
|
createXMLSetting("Transparency", "Transparency", toStr(Settings.Transparency));
|
||||||
createXMLSetting("DisplayFrameRate", "Display Frame Rate", toStr(Settings.DisplayFrameRate));
|
createXMLSetting("DisplayFrameRate", "Display Frame Rate", toStr(Settings.DisplayFrameRate));
|
||||||
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));
|
||||||
createXMLSetting("xshift", "Horizontal Video Shift", toStr(GCSettings.xshift));
|
createXMLSetting("xshift", "Horizontal Video Shift", toStr(GCSettings.xshift));
|
||||||
@ -198,6 +204,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(bool8 * var, const char * name)
|
void loadXMLSetting(bool8 * var, const char * name)
|
||||||
{
|
{
|
||||||
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
@ -278,7 +290,8 @@ decodePrefsData (int method)
|
|||||||
|
|
||||||
loadXMLSetting(&Settings.Transparency, "Transparency");
|
loadXMLSetting(&Settings.Transparency, "Transparency");
|
||||||
loadXMLSetting(&Settings.DisplayFrameRate, "DisplayFrameRate");
|
loadXMLSetting(&Settings.DisplayFrameRate, "DisplayFrameRate");
|
||||||
loadXMLSetting(&GCSettings.NGCZoom, "NGCZoom");
|
loadXMLSetting(&GCSettings.Zoom, "Zoom");
|
||||||
|
loadXMLSetting(&GCSettings.ZoomLevel, "ZoomLevel");
|
||||||
loadXMLSetting(&GCSettings.render, "render");
|
loadXMLSetting(&GCSettings.render, "render");
|
||||||
loadXMLSetting(&GCSettings.widescreen, "widescreen");
|
loadXMLSetting(&GCSettings.widescreen, "widescreen");
|
||||||
loadXMLSetting(&GCSettings.xshift, "xshift");
|
loadXMLSetting(&GCSettings.xshift, "xshift");
|
||||||
|
@ -55,8 +55,8 @@ DefaultSettings ()
|
|||||||
GCSettings.Mouse = 0;
|
GCSettings.Mouse = 0;
|
||||||
GCSettings.Justifier = 0;
|
GCSettings.Justifier = 0;
|
||||||
|
|
||||||
GCSettings.NGCZoom = 0; // zooming default off
|
GCSettings.Zoom = 0; // zooming default off
|
||||||
|
GCSettings.ZoomLevel = 1.0; // zoom level
|
||||||
GCSettings.render = 2; // Unfiltered
|
GCSettings.render = 2; // Unfiltered
|
||||||
GCSettings.widescreen = 0; // no aspect ratio correction
|
GCSettings.widescreen = 0; // no aspect ratio correction
|
||||||
|
|
||||||
|
@ -50,7 +50,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 Superscope;
|
int Superscope;
|
||||||
|
@ -48,7 +48,6 @@ GXTexObj texobj;
|
|||||||
Mtx view;
|
Mtx view;
|
||||||
int vwidth, vheight, oldvwidth, oldvheight;
|
int vwidth, vheight, oldvwidth, oldvheight;
|
||||||
|
|
||||||
float zoom_level = 1;
|
|
||||||
int zoom_xshift = 0;
|
int zoom_xshift = 0;
|
||||||
int zoom_yshift = 0;
|
int zoom_yshift = 0;
|
||||||
|
|
||||||
@ -82,7 +81,7 @@ s16 square[] ATTRIBUTE_ALIGN (32) =
|
|||||||
-HASPECT, VASPECT, 0, // 0
|
-HASPECT, VASPECT, 0, // 0
|
||||||
HASPECT, VASPECT, 0, // 1
|
HASPECT, VASPECT, 0, // 1
|
||||||
HASPECT, -VASPECT, 0, // 2
|
HASPECT, -VASPECT, 0, // 2
|
||||||
-HASPECT, -VASPECT, 0, // 3
|
-HASPECT, -VASPECT, 0 // 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -576,7 +575,7 @@ ResetVideo_Emu ()
|
|||||||
TV_448i.viTVMode = VI_TVMODE(vmode->viTVMode >> 2, VI_INTERLACE);
|
TV_448i.viTVMode = VI_TVMODE(vmode->viTVMode >> 2, VI_INTERLACE);
|
||||||
// set VI position
|
// set VI position
|
||||||
TV_239p.viXOrigin = TV_224p.viXOrigin = TV_478i.viXOrigin = TV_448i.viXOrigin = (VI_MAX_WIDTH_NTSC - 640)/2;
|
TV_239p.viXOrigin = TV_224p.viXOrigin = TV_478i.viXOrigin = TV_448i.viXOrigin = (VI_MAX_WIDTH_NTSC - 640)/2;
|
||||||
TV_239p.viYOrigin = TV_478i.viYOrigin = (VI_MAX_HEIGHT_NTSC/2 - 478/2)/2;
|
TV_239p.viYOrigin = TV_478i.viYOrigin = (VI_MAX_HEIGHT_PAL/2 - 478/2)/2;
|
||||||
TV_224p.viYOrigin = TV_448i.viYOrigin = (VI_MAX_HEIGHT_NTSC/2 - 448/2)/2;
|
TV_224p.viYOrigin = TV_448i.viYOrigin = (VI_MAX_HEIGHT_NTSC/2 - 448/2)/2;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -760,8 +759,8 @@ update_video (int width, int height)
|
|||||||
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[6] = square[3] = xscale + GCSettings.xshift;
|
square[6] = square[3] = xscale + GCSettings.xshift;
|
||||||
square[0] = square[9] = -xscale + GCSettings.xshift;
|
square[0] = square[9] = -xscale + GCSettings.xshift;
|
||||||
@ -812,13 +811,15 @@ update_video (int width, int height)
|
|||||||
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 > 10.0)
|
||||||
|
GCSettings.ZoomLevel = 10.0;
|
||||||
|
|
||||||
oldvheight = 0; // update video
|
oldvheight = 0; // update video
|
||||||
}
|
}
|
||||||
@ -826,8 +827,7 @@ zoom (float speed)
|
|||||||
void
|
void
|
||||||
zoom_reset ()
|
zoom_reset ()
|
||||||
{
|
{
|
||||||
zoom_level = 1.0;
|
GCSettings.ZoomLevel = 1.0;
|
||||||
|
|
||||||
oldvheight = 0; // update video
|
oldvheight = 0; // update video
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user