Fix label variable naming, spacing and finally get ini value checking working without requiring to check for the value that is getting changed,

This commit is contained in:
Jules.A 2018-11-23 14:12:52 +08:00
parent 156c590ca4
commit db1ca70f59
4 changed files with 28 additions and 54 deletions

View File

@ -2019,8 +2019,7 @@ int _main()
CommonSettings.gamehacks.en = GetPrivateProfileBool("Emulation", "GameHacks", true, IniName);
CommonSettings.GFX3D_Renderer_TextureDeposterize = GetPrivateProfileBool("3D", "TextureDeposterize", 0, IniName);
CommonSettings.GFX3D_Renderer_TextureSmoothing = GetPrivateProfileBool("3D", "TextureSmooth", 0, IniName);
gpu_bpp = GetPrivateProfileInt("3D", "GpuBpp", 18, IniName);
CheckValid3DIntSetting("GpuBpp", 3);
gpu_bpp = GetValid3DIntSetting("GpuBpp", 18, possibleBPP, 3);
lostFocusPause = GetPrivateProfileBool("Focus", "BackgroundPause", false, IniName);
//Get Ram-Watch values
@ -2264,8 +2263,7 @@ int _main()
else
wifiHandler->SetEmulationLevel(WifiEmulationLevel_Off);
CommonSettings.GFX3D_Renderer_TextureScalingFactor = (cmdline.texture_upscale != -1) ? cmdline.texture_upscale : GetPrivateProfileInt("3D", "TextureScalingFactor ", 1, IniName);
CheckValid3DIntSetting("TextureScalingFactor", 3);
CommonSettings.GFX3D_Renderer_TextureScalingFactor = (cmdline.texture_upscale != -1) ? cmdline.texture_upscale : GetValid3DIntSetting("TextureScalingFactor", 1, possibleTexScale, 3);;
int newPrescaleHD = (cmdline.gpu_resolution_multiplier != -1) ? cmdline.gpu_resolution_multiplier : GetPrivateProfileInt("3D", "PrescaleHD", 1, IniName);
video.SetPrescale(newPrescaleHD, 1);
GPU->SetCustomFramebufferSize(GPU_FRAMEBUFFER_NATIVE_WIDTH*video.prescaleHD, GPU_FRAMEBUFFER_NATIVE_HEIGHT*video.prescaleHD);
@ -2372,8 +2370,7 @@ int _main()
CommonSettings.OpenGL_Emulation_SpecialZeroAlphaBlending = GetPrivateProfileBool("3D", "EnableSpecialZeroAlphaBlending", 1, IniName);
CommonSettings.OpenGL_Emulation_DepthEqualsTestTolerance = GetPrivateProfileBool("3D", "EnableDepthEqualsTestTolerance", 1, IniName);
CommonSettings.OpenGL_Emulation_DepthLEqualPolygonFacing = GetPrivateProfileBool("3D", "EnableDepthLEqualPolygonFacing", 0, IniName); // Default is off.
CommonSettings.GFX3D_Renderer_MultisampleSize = GetPrivateProfileInt("3D", "MultisampleSize", 0, IniName);
CheckValid3DIntSetting("MultisampleSize", 6);
CommonSettings.GFX3D_Renderer_MultisampleSize = GetValid3DIntSetting("MultisampleSize", 0, possibleMSAA, 6);
Change3DCoreWithFallbackAndSave(cur3DCore);
@ -2646,45 +2643,22 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
return ret;
}
//Checks for incorrect values and updates ini. Only supports MultisampleSize, TextureScalingFactor and GpuBpp right now.
void CheckValid3DIntSetting(const char *settingName, const int arrSize)
// Checks for incorrect values, updates ini and returns a valid value. Requires an array to check.
int GetValid3DIntSetting(char *settingName, const int defVal, const int arrName[], const int arrSize)
{
bool valid = false;
const int curVal = GetPrivateProfileInt("3D", settingName, defVal, IniName);
for (int i = 0; i <= arrSize; i++)
{
if (settingName == "MultisampleSize" && CommonSettings.GFX3D_Renderer_MultisampleSize == possibleMSAA[i])
if (curVal == arrName[i])
{
valid = true;
}
else if (settingName == "GpuBpp" && gpu_bpp == possibleBPP[i])
{
valid = true;
}
else if (settingName == "TextureScalingFactor" && CommonSettings.GFX3D_Renderer_TextureScalingFactor == possibleTexScale[i])
{
valid = true;
}
}
if (!valid)
{ // Sets to defaults if ini value is incorrect.
if (settingName == "MultisampleSize")
{
CommonSettings.GFX3D_Renderer_MultisampleSize = 0;
WritePrivateProfileInt("3D", "MultisampleSize", 0, IniName);
}
else if (settingName == "GpuBpp")
{
gpu_bpp = 18;
WritePrivateProfileInt("3D", "GpuBpp", 18, IniName);
}
else if (settingName == "TextureScalingFactor")
{
CommonSettings.GFX3D_Renderer_TextureScalingFactor = 1;
WritePrivateProfileInt("3D", "TextureScalingFactor", 1, IniName);
return curVal;
}
}
// Sets to defaults if ini value is incorrect.
WritePrivateProfileInt("3D", settingName, defVal, IniName);
return defVal;
}
void UpdateScreenRects()
@ -5768,7 +5742,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CheckDlgButton(hw, IDC_SHADOW_POLYGONS, CommonSettings.OpenGL_Emulation_ShadowPolygon);
CheckDlgButton(hw, IDC_S_0_ALPHA_BLEND, CommonSettings.OpenGL_Emulation_SpecialZeroAlphaBlending);
CheckDlgButton(hw, IDC_DEPTH_EQUALS_TT, CommonSettings.OpenGL_Emulation_DepthEqualsTestTolerance);
CheckDlgButton(hw, IDC_DEPTH_LESS_EQUALS_TT, CommonSettings.OpenGL_Emulation_DepthLEqualPolygonFacing);
CheckDlgButton(hw, IDC_DEPTH_L_EQUAL_PF, CommonSettings.OpenGL_Emulation_DepthLEqualPolygonFacing);
// Generate the Color Depth pop-up menu
ComboBox_AddString(GetDlgItem(hw, IDC_GPU_COLOR_DEPTH), "15 bit");
@ -5842,7 +5816,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CommonSettings.OpenGL_Emulation_ShadowPolygon = IsDlgCheckboxChecked(hw, IDC_SHADOW_POLYGONS);
CommonSettings.OpenGL_Emulation_SpecialZeroAlphaBlending = IsDlgCheckboxChecked(hw, IDC_S_0_ALPHA_BLEND);
CommonSettings.OpenGL_Emulation_DepthEqualsTestTolerance = IsDlgCheckboxChecked(hw, IDC_DEPTH_EQUALS_TT);
CommonSettings.OpenGL_Emulation_DepthLEqualPolygonFacing = IsDlgCheckboxChecked(hw, IDC_DEPTH_LESS_EQUALS_TT);
CommonSettings.OpenGL_Emulation_DepthLEqualPolygonFacing = IsDlgCheckboxChecked(hw, IDC_DEPTH_L_EQUAL_PF);
int newPrescaleHD = video.prescaleHD;
LRESULT scaleResult = SendDlgItemMessage(hw, IDC_NUD_PRESCALEHD, UDM_GETPOS, 0, 0);

View File

@ -53,7 +53,7 @@ void SaveWindowSize(HWND hwnd);
void SaveWindowSizePos(HWND hwnd);
void RestoreWindow(HWND hwnd);
void ShowFullScreen(HWND hwnd);
void CheckValid3DIntSetting(const char *settingName, const int arrSize);
int GetValid3DIntSetting(char *settingName, const int defVal, const int arrName[], const int arrSize);
extern bool frameCounterDisplay;
extern bool FpsDisplay;

View File

@ -500,7 +500,7 @@
#define IDC_SHADOW_POLYGONS 1096
#define IDC_S_0_ALPHA_BLEND 1097
#define IDC_DEPTH_EQUALS_TT 1098
#define IDC_DEPTH_LESS_EQUALS_TT 1099
#define IDC_DEPTH_L_EQUAL_PF 1099
#define IDM_FIRMSETTINGS 1100
#define IDD_FIRMSETTINGS 1101
#define IDC_EDIT1 1102
@ -1092,7 +1092,7 @@
#define ID_LABEL_SHADOW_POLYGONS 64009
#define ID_LABEL_S_0_ALPHA_BLEND 640010
#define ID_LABEL_DEPTH_EQUALS_TT 640011
#define ID_LABEL_DEPTH_LEQUALS_TT 640012
#define ID_LABEL_DEPTH_L_EQUAL_PF 640012
// Next default values for new objects

View File

@ -110,7 +110,7 @@ BEGIN
PUSHBUTTON "&Cancel",IDCANCEL,127,94,50,16
END
IDD_3DSETTINGS DIALOGEX 0, 0, 329, 274
IDD_3DSETTINGS DIALOGEX 0, 0, 329, 273
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "3D Settings"
FONT 8, "MS Sans Serif", 400, 0, 0x0
@ -125,8 +125,8 @@ BEGIN
EDITTEXT IDC_TEXT_PRESCALEHD,273,17,31,14,ES_AUTOHSCROLL
CONTROL "",IDC_NUD_PRESCALEHD,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,303,17,12,14
PUSHBUTTON "Default",IDC_DEFAULT,135,19,50,15
DEFPUSHBUTTON "OK",IDOK,211,253,50,15
PUSHBUTTON "Cancel",IDCANCEL,273,253,50,15
DEFPUSHBUTTON "OK",IDOK,211,252,50,15
PUSHBUTTON "Cancel",IDCANCEL,273,252,50,15
GROUPBOX "3D Rendering Engine",IDC_STATIC,7,7,184,34
GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,44,184,83
LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,12,106,170,18
@ -134,7 +134,7 @@ BEGIN
LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,12,77,171,8
LTEXT "May need to be toggled on/off per scene.",ID_LABEL_TXTHACK2,12,86,167,8
CONTROL "Enable TXT Hack",IDC_TXTHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,67,73,10
GROUPBOX "OpenGL Options",IDC_STATIC,7,131,315,117
GROUPBOX "OpenGL Options",IDC_STATIC,7,131,315,116
GROUPBOX "General Options",IDC_STATIC,198,7,124,120
LTEXT "GPU Scaling Factor",IDC_STATIC,203,20,64,8
CONTROL "Deposterize Textures",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,203,79,79,10
@ -148,14 +148,14 @@ BEGIN
CONTROL "Enable Special Zero Alpha Blending",IDC_S_0_ALPHA_BLEND,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,173,137,10
CONTROL "Enable Depth Equals Test Tolerance",IDC_DEPTH_EQUALS_TT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,202,137,10
CONTROL "Enable Depth L-Equal Polygon Facing",IDC_DEPTH_LESS_EQUALS_TT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,202,137,10
LTEXT "Disabling this option may cause some shadows to disappear.",ID_LABEL_SHADOW_POLYGONS,17,184,137,16
LTEXT "Disabling this option may cause certain polygons to get caught up in Z-fighting or disappear completely.",ID_LABEL_S_0_ALPHA_BLEND,17,213,137,24
LTEXT "Disabling this option may cause some colors to look darker than normal.",ID_LABEL_DEPTH_EQUALS_TT,172,184,137,16
LTEXT "Disabling this option may cause some fragments to disappear. Disabled by default due to performance impact.",ID_LABEL_DEPTH_LEQUALS_TT,172,213,137,24
GROUPBOX "Rendering Accuracy Options",IDC_STATIC,12,161,305,82,BS_CENTER
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,203,137,10
CONTROL "Enable Depth L-Equal Polygon Facing",IDC_DEPTH_L_EQUAL_PF,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,203,137,10
LTEXT "Disabling this option may cause some shadows to disappear.",ID_LABEL_SHADOW_POLYGONS,17,183,137,16
LTEXT "Disabling this option may cause certain polygons to get caught up in Z-fighting or disappear completely.",ID_LABEL_DEPTH_EQUALS_TT,17,213,137,24
LTEXT "Disabling this option may cause some colors to look darker than normal.",ID_LABEL_S_0_ALPHA_BLEND,172,183,137,16
LTEXT "Disabling this option may cause some fragments to disappear. Disabled by default due to performance impact.",ID_LABEL_DEPTH_L_EQUAL_PF,172,213,137,24
GROUPBOX "Rendering Accuracy Options",IDC_STATIC,12,161,305,81,BS_CENTER
END
IDD_ABOUT_BOX DIALOGEX 0, 0, 268, 198