mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-05 21:38:17 +01:00
add separate hor/vert zoom options
This commit is contained in:
parent
0429fe4d03
commit
8b04d5a65f
@ -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))
|
||||
@ -67,12 +69,13 @@ DefaultSettings ()
|
||||
GCSettings.spritelimit = 1; // enforce 8 sprite limit
|
||||
GCSettings.gamegenie = 1;
|
||||
|
||||
GCSettings.ZoomLevel = 1.0; // zoom amount
|
||||
GCSettings.render = 2; // Unfiltered
|
||||
GCSettings.widescreen = 0; // no aspect ratio correction
|
||||
GCSettings.hideoverscan = 2; // hide both horizontal and vertical
|
||||
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
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "driver.h"
|
||||
|
||||
#define APPNAME "FCE Ultra GX"
|
||||
#define APPVERSION "3.1.0"
|
||||
#define APPVERSION "3.1.1"
|
||||
#define APPFOLDER "fceugx"
|
||||
#define PREF_FILE_NAME "settings.xml"
|
||||
|
||||
@ -74,7 +74,8 @@ struct SGCSettings{
|
||||
char smbpwd[20];
|
||||
char smbshare[20];
|
||||
|
||||
float ZoomLevel; // zoom amount
|
||||
float zoomHor; // horizontal zoom amount
|
||||
float zoomVert; // vertical zoom amount
|
||||
int VerifySaves;
|
||||
int render; // 0 - original, 1 - filtered, 2 - unfiltered
|
||||
int videomode; // 0 - automatic, 1 - NTSC (480i), 2 - Progressive (480p), 3 - PAL (50Hz), 4 - PAL (60Hz)
|
||||
|
@ -424,8 +424,8 @@ UpdateScaling()
|
||||
if (GCSettings.widescreen)
|
||||
xscale = (3*xscale)/4;
|
||||
|
||||
xscale *= GCSettings.ZoomLevel;
|
||||
yscale *= GCSettings.ZoomLevel;
|
||||
xscale *= GCSettings.zoomHor;
|
||||
yscale *= GCSettings.zoomVert;
|
||||
|
||||
// update vertex position matrix
|
||||
square[0] = square[9] = (-xscale) + GCSettings.xshift;
|
||||
@ -785,32 +785,6 @@ void RenderFrame(unsigned char *XBuf)
|
||||
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;
|
||||
|
||||
UpdateVideo = 1; // update video
|
||||
}
|
||||
|
||||
void
|
||||
zoom_reset ()
|
||||
{
|
||||
GCSettings.ZoomLevel = 1.0;
|
||||
UpdateVideo = 1; // update video
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* TakeScreenshot
|
||||
*
|
||||
|
@ -26,8 +26,6 @@ void ResetVideo_Emu ();
|
||||
void RenderFrame(unsigned char *XBuf);
|
||||
void setFrameTimer();
|
||||
void SyncSpeed();
|
||||
void zoom (float speed);
|
||||
void zoom_reset ();
|
||||
void SetPalette();
|
||||
void ResetVideo_Menu ();
|
||||
void TakeScreenshot();
|
||||
|
@ -59,6 +59,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 mapMenuCtrlNES = 0;
|
||||
@ -2669,26 +2670,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;
|
||||
@ -2703,6 +2709,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);
|
||||
@ -2710,7 +2722,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);
|
||||
@ -2723,28 +2736,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)
|
||||
@ -2864,7 +2926,8 @@ static void ScreenPositionWindow()
|
||||
|
||||
if(!SettingWindow("Screen Position",w))
|
||||
{
|
||||
GCSettings.xshift = currentX; // undo changes
|
||||
// undo changes
|
||||
GCSettings.xshift = currentX;
|
||||
GCSettings.yshift = currentY;
|
||||
}
|
||||
|
||||
@ -3036,7 +3099,7 @@ static int MenuSettingsVideo()
|
||||
GCSettings.currpal ? palettes[GCSettings.currpal-1].desc : "Default");
|
||||
|
||||
sprintf (options.value[5], "%s", GCSettings.timing == 1 ? "PAL" : "NTSC");
|
||||
sprintf (options.value[6], "%.2f%%", GCSettings.ZoomLevel*100);
|
||||
sprintf (options.value[6], "%.2f%%, %.2f%%", GCSettings.zoomHor*100, GCSettings.zoomVert*100);
|
||||
sprintf (options.value[7], "%d, %d", GCSettings.xshift, GCSettings.yshift);
|
||||
sprintf (options.value[8], "%s", GCSettings.crosshair == 1 ? "On" : "Off");
|
||||
sprintf (options.value[9], "%s", GCSettings.spritelimit == 1 ? "On" : "Off");
|
||||
|
@ -141,7 +141,8 @@ preparePrefsData ()
|
||||
createXMLSetting("currpal", "Palette", toStr(GCSettings.currpal));
|
||||
createXMLSetting("timing", "Timing", toStr(GCSettings.timing));
|
||||
createXMLSetting("spritelimit", "Sprite Limit", toStr(GCSettings.spritelimit));
|
||||
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));
|
||||
@ -313,7 +314,8 @@ decodePrefsData ()
|
||||
loadXMLSetting(&GCSettings.currpal, "currpal");
|
||||
loadXMLSetting(&GCSettings.timing, "timing");
|
||||
loadXMLSetting(&GCSettings.spritelimit, "spritelimit");
|
||||
loadXMLSetting(&GCSettings.ZoomLevel, "ZoomLevel");
|
||||
loadXMLSetting(&GCSettings.zoomHor, "zoomHor");
|
||||
loadXMLSetting(&GCSettings.zoomVert, "zoomVert");
|
||||
loadXMLSetting(&GCSettings.render, "render");
|
||||
loadXMLSetting(&GCSettings.widescreen, "widescreen");
|
||||
loadXMLSetting(&GCSettings.FilterMethod, "FilterMethod");
|
||||
|
Loading…
Reference in New Issue
Block a user