mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 21:14:21 +01:00
add separate hor/vert zoom options
This commit is contained in:
parent
8dbd62bbc5
commit
92e2777efd
@ -98,7 +98,7 @@ InitAudio ()
|
||||
#else
|
||||
ASND_Init();
|
||||
#endif
|
||||
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 100);
|
||||
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 70);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -70,6 +70,7 @@ static GuiSound * enterSound = NULL;
|
||||
static GuiSound * exitSound = NULL;
|
||||
static GuiWindow * mainWindow = NULL;
|
||||
static GuiText * settingText = NULL;
|
||||
static GuiText * settingText2 = NULL;
|
||||
static int lastMenu = MENU_NONE;
|
||||
static int mapMenuCtrl = 0;
|
||||
static int mapMenuCtrlSNES = 0;
|
||||
@ -2726,26 +2727,31 @@ static int MenuSettingsMappingsMap()
|
||||
* MenuSettingsVideo
|
||||
***************************************************************************/
|
||||
|
||||
static void ScreenZoomWindowUpdate(void * ptr, float amount)
|
||||
static void ScreenZoomWindowUpdate(void * ptr, float h, float v)
|
||||
{
|
||||
GuiButton * b = (GuiButton *)ptr;
|
||||
if(b->GetState() == STATE_CLICKED)
|
||||
{
|
||||
GCSettings.ZoomLevel += amount;
|
||||
GCSettings.zoomHor += h;
|
||||
GCSettings.zoomVert += v;
|
||||
|
||||
char zoom[10];
|
||||
sprintf(zoom, "%.2f%%", GCSettings.ZoomLevel*100);
|
||||
sprintf(zoom, "%.2f%%", GCSettings.zoomHor*100);
|
||||
settingText->SetText(zoom);
|
||||
sprintf(zoom, "%.2f%%", GCSettings.zoomVert*100);
|
||||
settingText2->SetText(zoom);
|
||||
b->ResetState();
|
||||
}
|
||||
}
|
||||
|
||||
static void ScreenZoomWindowLeftClick(void * ptr) { ScreenZoomWindowUpdate(ptr, -0.01); }
|
||||
static void ScreenZoomWindowRightClick(void * ptr) { ScreenZoomWindowUpdate(ptr, +0.01); }
|
||||
static void ScreenZoomWindowLeftClick(void * ptr) { ScreenZoomWindowUpdate(ptr, -0.01, 0); }
|
||||
static void ScreenZoomWindowRightClick(void * ptr) { ScreenZoomWindowUpdate(ptr, +0.01, 0); }
|
||||
static void ScreenZoomWindowUpClick(void * ptr) { ScreenZoomWindowUpdate(ptr, 0, +0.01); }
|
||||
static void ScreenZoomWindowDownClick(void * ptr) { ScreenZoomWindowUpdate(ptr, 0, -0.01); }
|
||||
|
||||
static void ScreenZoomWindow()
|
||||
{
|
||||
GuiWindow * w = new GuiWindow(250,250);
|
||||
GuiWindow * w = new GuiWindow(200,200);
|
||||
w->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
|
||||
GuiTrigger trigA;
|
||||
@ -2760,6 +2766,12 @@ static void ScreenZoomWindow()
|
||||
GuiTrigger trigRight;
|
||||
trigRight.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
||||
|
||||
GuiTrigger trigUp;
|
||||
trigUp.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP, PAD_BUTTON_UP);
|
||||
|
||||
GuiTrigger trigDown;
|
||||
trigDown.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN, PAD_BUTTON_DOWN);
|
||||
|
||||
GuiImageData arrowLeft(button_arrow_left_png);
|
||||
GuiImage arrowLeftImg(&arrowLeft);
|
||||
GuiImageData arrowLeftOver(button_arrow_left_over_png);
|
||||
@ -2767,7 +2779,8 @@ static void ScreenZoomWindow()
|
||||
GuiButton arrowLeftBtn(arrowLeft.GetWidth(), arrowLeft.GetHeight());
|
||||
arrowLeftBtn.SetImage(&arrowLeftImg);
|
||||
arrowLeftBtn.SetImageOver(&arrowLeftOverImg);
|
||||
arrowLeftBtn.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
arrowLeftBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
arrowLeftBtn.SetPosition(50, 0);
|
||||
arrowLeftBtn.SetTrigger(0, &trigA);
|
||||
arrowLeftBtn.SetTrigger(1, &trigLeft);
|
||||
arrowLeftBtn.SetSelectable(false);
|
||||
@ -2780,28 +2793,77 @@ static void ScreenZoomWindow()
|
||||
GuiButton arrowRightBtn(arrowRight.GetWidth(), arrowRight.GetHeight());
|
||||
arrowRightBtn.SetImage(&arrowRightImg);
|
||||
arrowRightBtn.SetImageOver(&arrowRightOverImg);
|
||||
arrowRightBtn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||
arrowRightBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
arrowRightBtn.SetPosition(164, 0);
|
||||
arrowRightBtn.SetTrigger(0, &trigA);
|
||||
arrowRightBtn.SetTrigger(1, &trigRight);
|
||||
arrowRightBtn.SetSelectable(false);
|
||||
arrowRightBtn.SetUpdateCallback(ScreenZoomWindowRightClick);
|
||||
|
||||
settingText = new GuiText(NULL, 22, (GXColor){0, 0, 0, 255});
|
||||
char zoom[10];
|
||||
sprintf(zoom, "%.2f%%", GCSettings.ZoomLevel*100);
|
||||
settingText->SetText(zoom);
|
||||
GuiImageData arrowUp(button_arrow_up_png);
|
||||
GuiImage arrowUpImg(&arrowUp);
|
||||
GuiImageData arrowUpOver(button_arrow_up_over_png);
|
||||
GuiImage arrowUpOverImg(&arrowUpOver);
|
||||
GuiButton arrowUpBtn(arrowUp.GetWidth(), arrowUp.GetHeight());
|
||||
arrowUpBtn.SetImage(&arrowUpImg);
|
||||
arrowUpBtn.SetImageOver(&arrowUpOverImg);
|
||||
arrowUpBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
arrowUpBtn.SetPosition(-76, -27);
|
||||
arrowUpBtn.SetTrigger(0, &trigA);
|
||||
arrowUpBtn.SetTrigger(1, &trigUp);
|
||||
arrowUpBtn.SetSelectable(false);
|
||||
arrowUpBtn.SetUpdateCallback(ScreenZoomWindowUpClick);
|
||||
|
||||
float currentZoom = GCSettings.ZoomLevel;
|
||||
GuiImageData arrowDown(button_arrow_down_png);
|
||||
GuiImage arrowDownImg(&arrowDown);
|
||||
GuiImageData arrowDownOver(button_arrow_down_over_png);
|
||||
GuiImage arrowDownOverImg(&arrowDownOver);
|
||||
GuiButton arrowDownBtn(arrowDown.GetWidth(), arrowDown.GetHeight());
|
||||
arrowDownBtn.SetImage(&arrowDownImg);
|
||||
arrowDownBtn.SetImageOver(&arrowDownOverImg);
|
||||
arrowDownBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
arrowDownBtn.SetPosition(-76, 27);
|
||||
arrowDownBtn.SetTrigger(0, &trigA);
|
||||
arrowDownBtn.SetTrigger(1, &trigDown);
|
||||
arrowDownBtn.SetSelectable(false);
|
||||
arrowDownBtn.SetUpdateCallback(ScreenZoomWindowDownClick);
|
||||
|
||||
GuiImageData screenPosition(screen_position_png);
|
||||
GuiImage screenPositionImg(&screenPosition);
|
||||
screenPositionImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
screenPositionImg.SetPosition(0, 0);
|
||||
|
||||
settingText = new GuiText(NULL, 22, (GXColor){0, 0, 0, 255});
|
||||
settingText2 = new GuiText(NULL, 22, (GXColor){0, 0, 0, 255});
|
||||
char zoom[10];
|
||||
sprintf(zoom, "%.2f%%", GCSettings.zoomHor*100);
|
||||
settingText->SetText(zoom);
|
||||
settingText->SetPosition(108, 0);
|
||||
sprintf(zoom, "%.2f%%", GCSettings.zoomVert*100);
|
||||
settingText2->SetText(zoom);
|
||||
settingText2->SetPosition(-76, 0);
|
||||
|
||||
float currentZoomHor = GCSettings.zoomHor;
|
||||
float currentZoomVert = GCSettings.zoomVert;
|
||||
|
||||
w->Append(&arrowLeftBtn);
|
||||
w->Append(&arrowRightBtn);
|
||||
w->Append(&arrowUpBtn);
|
||||
w->Append(&arrowDownBtn);
|
||||
w->Append(&screenPositionImg);
|
||||
w->Append(settingText);
|
||||
w->Append(settingText2);
|
||||
|
||||
if(!SettingWindow("Screen Zoom",w))
|
||||
GCSettings.ZoomLevel = currentZoom; // undo changes
|
||||
{
|
||||
// undo changes
|
||||
GCSettings.zoomHor = currentZoomHor;
|
||||
GCSettings.zoomVert = currentZoomVert;
|
||||
}
|
||||
|
||||
delete(w);
|
||||
delete(settingText);
|
||||
delete(settingText2);
|
||||
}
|
||||
|
||||
static void ScreenPositionWindowUpdate(void * ptr, int x, int y)
|
||||
@ -2921,7 +2983,8 @@ static void ScreenPositionWindow()
|
||||
|
||||
if(!SettingWindow("Screen Position",w))
|
||||
{
|
||||
GCSettings.xshift = currentX; // undo changes
|
||||
// undo changes
|
||||
GCSettings.xshift = currentX;
|
||||
GCSettings.yshift = currentY;
|
||||
}
|
||||
|
||||
@ -3049,9 +3112,7 @@ static int MenuSettingsVideo()
|
||||
sprintf (options.value[1], "Default");
|
||||
|
||||
sprintf (options.value[2], "%s", GetFilterName((RenderFilter)GCSettings.FilterMethod));
|
||||
|
||||
sprintf (options.value[3], "%.2f%%", GCSettings.ZoomLevel*100);
|
||||
|
||||
sprintf (options.value[3], "%.2f%%, %.2f%%", GCSettings.zoomHor*100, GCSettings.zoomVert*100);
|
||||
sprintf (options.value[4], "%d, %d", GCSettings.xshift, GCSettings.yshift);
|
||||
|
||||
switch(GCSettings.videomode)
|
||||
|
@ -136,7 +136,8 @@ preparePrefsData ()
|
||||
createXMLSection("Video", "Video Settings");
|
||||
|
||||
createXMLSetting("videomode", "Video Mode", toStr(GCSettings.videomode));
|
||||
createXMLSetting("ZoomLevel", "Zoom Level", FtoStr(GCSettings.ZoomLevel));
|
||||
createXMLSetting("zoomHor", "Horizontal Zoom Level", FtoStr(GCSettings.zoomHor));
|
||||
createXMLSetting("zoomVert", "Vertical Zoom Level", FtoStr(GCSettings.zoomVert));
|
||||
createXMLSetting("render", "Video Filtering", toStr(GCSettings.render));
|
||||
createXMLSetting("widescreen", "Aspect Ratio Correction", toStr(GCSettings.widescreen));
|
||||
createXMLSetting("FilterMethod", "Filter Method", toStr(GCSettings.FilterMethod));
|
||||
@ -308,7 +309,8 @@ decodePrefsData ()
|
||||
// Video Settings
|
||||
|
||||
loadXMLSetting(&GCSettings.videomode, "videomode");
|
||||
loadXMLSetting(&GCSettings.ZoomLevel, "ZoomLevel");
|
||||
loadXMLSetting(&GCSettings.zoomHor, "zoomHor");
|
||||
loadXMLSetting(&GCSettings.zoomVert, "zoomVert");
|
||||
loadXMLSetting(&GCSettings.render, "render");
|
||||
loadXMLSetting(&GCSettings.widescreen, "widescreen");
|
||||
loadXMLSetting(&GCSettings.FilterMethod, "FilterMethod");
|
||||
|
@ -29,8 +29,10 @@ struct SGCSettings GCSettings;
|
||||
***************************************************************************/
|
||||
void FixInvalidSettings()
|
||||
{
|
||||
if(!(GCSettings.ZoomLevel > 0.5 && GCSettings.ZoomLevel < 1.5))
|
||||
GCSettings.ZoomLevel = 1.0;
|
||||
if(!(GCSettings.zoomHor > 0.5 && GCSettings.zoomHor < 1.5))
|
||||
GCSettings.zoomHor = 1.0;
|
||||
if(!(GCSettings.zoomVert > 0.5 && GCSettings.zoomVert < 1.5))
|
||||
GCSettings.zoomVert = 1.0;
|
||||
if(!(GCSettings.xshift > -50 && GCSettings.xshift < 50))
|
||||
GCSettings.xshift = 0;
|
||||
if(!(GCSettings.yshift > -50 && GCSettings.yshift < 50))
|
||||
@ -82,11 +84,12 @@ DefaultSettings ()
|
||||
GCSettings.Controller = CTRL_PAD2;
|
||||
|
||||
GCSettings.videomode = 0; // automatic video mode detection
|
||||
GCSettings.ZoomLevel = 1.0; // zoom level
|
||||
GCSettings.render = 2; // Unfiltered
|
||||
GCSettings.widescreen = 0; // no aspect ratio correction
|
||||
GCSettings.FilterMethod = FILTER_NONE; // no hq2x
|
||||
|
||||
GCSettings.widescreen = 0; // no aspect ratio correction
|
||||
GCSettings.zoomHor = 1.0; // horizontal zoom level
|
||||
GCSettings.zoomVert = 1.0; // vertical zoom level
|
||||
GCSettings.xshift = 0; // horizontal video shift
|
||||
GCSettings.yshift = 0; // vertical video shift
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "filelist.h"
|
||||
|
||||
#define APPNAME "Snes9x GX"
|
||||
#define APPVERSION "4.1.2"
|
||||
#define APPVERSION "4.1.3"
|
||||
#define APPFOLDER "snes9x"
|
||||
#define PREF_FILE_NAME "settings.xml"
|
||||
|
||||
@ -77,9 +77,10 @@ struct SGCSettings{
|
||||
char smbpwd[20];
|
||||
char smbshare[20];
|
||||
|
||||
float ZoomLevel; // zoom amount
|
||||
int VerifySaves;
|
||||
int videomode; // 0 - automatic, 1 - NTSC (480i), 2 - Progressive (480p), 3 - PAL (50Hz), 4 - PAL (60Hz)
|
||||
float zoomHor; // horizontal zoom amount
|
||||
float zoomVert; // vertical zoom amount
|
||||
int VerifySaves;
|
||||
int videomode; // 0 - automatic, 1 - NTSC (480i), 2 - Progressive (480p), 3 - PAL (50Hz), 4 - PAL (60Hz)
|
||||
int render; // 0 - original, 1 - filtered, 2 - unfiltered
|
||||
int FilterMethod; // convert to RenderFilter
|
||||
int Controller;
|
||||
|
@ -736,8 +736,8 @@ update_video (int width, int height)
|
||||
if (GCSettings.widescreen)
|
||||
xscale = (3*xscale)/4;
|
||||
|
||||
xscale *= GCSettings.ZoomLevel;
|
||||
yscale *= GCSettings.ZoomLevel;
|
||||
xscale *= GCSettings.zoomHor;
|
||||
yscale *= GCSettings.zoomVert;
|
||||
|
||||
square[6] = square[3] = xscale + GCSettings.xshift;
|
||||
square[0] = square[9] = -xscale + GCSettings.xshift;
|
||||
@ -806,32 +806,6 @@ update_video (int width, int height)
|
||||
LWP_ResumeThread (vbthread);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Zoom Functions
|
||||
***************************************************************************/
|
||||
void
|
||||
zoom (float speed)
|
||||
{
|
||||
if (GCSettings.ZoomLevel > 1)
|
||||
GCSettings.ZoomLevel += (speed / -100.0);
|
||||
else
|
||||
GCSettings.ZoomLevel += (speed / -200.0);
|
||||
|
||||
if (GCSettings.ZoomLevel < 0.5)
|
||||
GCSettings.ZoomLevel = 0.5;
|
||||
else if (GCSettings.ZoomLevel > 2.0)
|
||||
GCSettings.ZoomLevel = 2.0;
|
||||
|
||||
oldvheight = 0; // update video
|
||||
}
|
||||
|
||||
void
|
||||
zoom_reset ()
|
||||
{
|
||||
GCSettings.ZoomLevel = 1.0;
|
||||
oldvheight = 0; // update video
|
||||
}
|
||||
|
||||
void AllocGfxMem()
|
||||
{
|
||||
snes9xgfx = (unsigned char *)memalign(32, SNES9XGFX_SIZE);
|
||||
|
@ -24,9 +24,6 @@ void StopGX();
|
||||
void ResetVideo_Emu();
|
||||
void setGFX();
|
||||
void update_video (int width, int height);
|
||||
void zoom (float speed);
|
||||
void zoom_reset ();
|
||||
|
||||
void ResetVideo_Menu();
|
||||
void TakeScreenshot();
|
||||
void Menu_Render();
|
||||
|
Loading…
Reference in New Issue
Block a user