Fixed UI elements moving around by simply re-arranging the order in resources.rc... Also added extra check when context is created.

This commit is contained in:
Jules.A 2018-10-25 04:50:33 +08:00
parent 65285aeb8c
commit cfd77abaf7
3 changed files with 43 additions and 44 deletions

View File

@ -425,7 +425,8 @@ static int sndbuffersize=DESMUME_SAMPLE_RATE*8/60;
int sndvolume=100;
const int possibleMSAA[] = {0, 2, 4, 8, 16, 32};
int maxSamples=0;
int maxSamples = 0;
bool tempContextAttempted = false;
SoundInterface_struct *SNDCoreList[] = {
&SNDDummy,
@ -5680,30 +5681,31 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
{
case WM_INITDIALOG:
{
int i = 0, z = 0;
HWND cur;
int i, z = 0;
const char MSAADescriptions[6][9] = {"Disabled", "2x", "4x", "8x", "16x", "32x"};
if(cur3DCore != 0 && cur3DCore != 2) //Get max device samples from the current renderer only if it's OpenGL.
maxSamples=CurrentRenderer->GetDeviceInfo().maxSamples;
if (maxSamples == 0) { //If it already has a value it's likely correct so don't create again.
maxSamples = CurrentRenderer->GetDeviceInfo().maxSamples;
if (maxSamples == 0 && tempContextAttempted == false)
{ //If it already has a value it's likely correct so don't create again.
tempContextAttempted = true;
bool isTempContextCreated = windows_opengl_init(); //Create a context just to get max device samples.
if(isTempContextCreated) //Creating it here because it's only needed in this window.
{
GLint maxSamplesOGL=0;
GLint maxSamplesOGL = 0;
#if defined(GL_MAX_SAMPLES)
glGetIntegerv(GL_MAX_SAMPLES,&maxSamplesOGL);
#elif defined(GL_MAX_SAMPLES_EXT)
glGetIntegerv(GL_MAX_SAMPLES_EXT,&maxSamplesOGL);
#endif
maxSamples=maxSamplesOGL;
maxSamples = maxSamplesOGL;
}
}
CheckDlgButton(hw,IDC_INTERPOLATECOLOR,CommonSettings.GFX3D_HighResolutionInterpolateColor);
CheckDlgButton(hw,IDC_3DSETTINGS_EDGEMARK,CommonSettings.GFX3D_EdgeMark);
CheckDlgButton(hw,IDC_3DSETTINGS_FOG,CommonSettings.GFX3D_Fog);
CheckDlgButton(hw,IDC_3DSETTINGS_TEXTURE,CommonSettings.GFX3D_Texture);
CheckDlgButton(hw,IDC_INTERPOLATECOLOR, CommonSettings.GFX3D_HighResolutionInterpolateColor);
CheckDlgButton(hw,IDC_3DSETTINGS_EDGEMARK, CommonSettings.GFX3D_EdgeMark);
CheckDlgButton(hw,IDC_3DSETTINGS_FOG, CommonSettings.GFX3D_Fog);
CheckDlgButton(hw,IDC_3DSETTINGS_TEXTURE, CommonSettings.GFX3D_Texture);
CheckDlgButton(hw,IDC_3DSETTINGS_LINEHACK, CommonSettings.GFX3D_LineHack);
CheckDlgButton(hw,IDC_TXTHACK, CommonSettings.GFX3D_TXTHack);
@ -5711,9 +5713,9 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CheckDlgButton(hw,IDC_TEXSCALE_2, CommonSettings.GFX3D_Renderer_TextureScalingFactor == 2);
CheckDlgButton(hw,IDC_TEXSCALE_4, CommonSettings.GFX3D_Renderer_TextureScalingFactor == 4);
CheckDlgButton(hw, IDC_GPU_24BPP, gpu_bpp == 24);
CheckDlgButton(hw, IDC_GPU_18BPP, gpu_bpp == 18);
CheckDlgButton(hw, IDC_GPU_15BPP, gpu_bpp == 15);
CheckDlgButton(hw,IDC_GPU_24BPP, gpu_bpp == 24);
CheckDlgButton(hw,IDC_GPU_18BPP, gpu_bpp == 18);
CheckDlgButton(hw,IDC_GPU_15BPP, gpu_bpp == 15);
CheckDlgButton(hw,IDC_TEX_DEPOSTERIZE, CommonSettings.GFX3D_Renderer_TextureDeposterize);
CheckDlgButton(hw,IDC_TEX_SMOOTH, CommonSettings.GFX3D_Renderer_TextureSmoothing);
@ -5728,12 +5730,11 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
WritePrivateProfileInt("3D", "MultisampleSize", maxSamples, IniName);
}
while (z <= maxSamples && i < 6)
for (i = 0; z <= maxSamples; i++)
{
ComboBox_AddString(GetDlgItem(hw,IDC_MULTISAMPLE_SIZE),MSAADescriptions[i]);
if (z == CommonSettings.GFX3D_Renderer_MultisampleSize)
ComboBox_SetCurSel(GetDlgItem(hw,IDC_MULTISAMPLE_SIZE),i);
i++;
if(z >= 2) z *= 2; else z=2; //Double the samplesize if 2 or more;
}
@ -5744,7 +5745,6 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
ComboBox_SetCurSel(GetDlgItem(hw, IDC_3DCORE), cur3DCore);
}
return TRUE;
case WM_COMMAND:
{
switch(LOWORD(wp))
@ -5768,9 +5768,9 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_1)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 1;
else if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_2)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 2;
else if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_4)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 4;
if(IsDlgCheckboxChecked(hw, IDC_GPU_15BPP)) gpu_bpp = 15;
else if(IsDlgCheckboxChecked(hw, IDC_GPU_18BPP)) gpu_bpp = 18;
else if(IsDlgCheckboxChecked(hw, IDC_GPU_24BPP)) gpu_bpp = 24;
if(IsDlgCheckboxChecked(hw,IDC_GPU_15BPP)) gpu_bpp = 15;
else if(IsDlgCheckboxChecked(hw,IDC_GPU_18BPP)) gpu_bpp = 18;
else if(IsDlgCheckboxChecked(hw,IDC_GPU_24BPP)) gpu_bpp = 24;
CommonSettings.GFX3D_Renderer_TextureDeposterize = IsDlgCheckboxChecked(hw,IDC_TEX_DEPOSTERIZE);
CommonSettings.GFX3D_Renderer_TextureSmoothing = IsDlgCheckboxChecked(hw,IDC_TEX_SMOOTH);

View File

@ -478,7 +478,6 @@
#define IDC_SNUMBER 1071
#define IDC_GPU_24BPP 1071
#define IDC_GPU_18BPP 1072
#define IDC_GPU_18BPP2 1073
#define IDC_GPU_15BPP 1073
#define IDC_CHECK1 1074
#define IDC_CHECK2 1075

View File

@ -115,37 +115,37 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "3D settings"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
GROUPBOX "3D Rendering Engine",IDC_STATIC,7,7,180,34
COMBOBOX IDC_3DCORE,15,20,108,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Default",IDC_DEFAULT,130,19,50,15
GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,44,180,83
CONTROL "Unrealistically High-Precision Color Interpolation",IDC_INTERPOLATECOLOR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,56,165,10
CONTROL "Enable TXT Hack",IDC_TXTHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,67,73,10
LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,13,77,167,11
LTEXT "You may need to toggle off && on by scene.",ID_LABEL_TXTHACK2,13,85,165,11
CONTROL "Enable Line Hack",IDC_3DSETTINGS_LINEHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,96,73,10
LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,13,106,170,18
GROUPBOX "OpenGL Options",IDC_STATIC,7,131,180,43
LTEXT "Multisample Antialiasing:",ID_LABEL_MSAA_SAMPLES,13,145,78,8
COMBOBOX IDC_MULTISAMPLE_SIZE,95,144,84,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Smooth Textures",IDC_TEX_SMOOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,160,75,10
GROUPBOX "General Options",IDC_STATIC,194,7,109,147
LTEXT "GPU Scaling Factor",IDC_STATIC,200,20,64,8
EDITTEXT IDC_TEXT_PRESCALEHD,267,17,20,14,ES_AUTOHSCROLL
CONTROL "",IDC_NUD_PRESCALEHD,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,286,17,11,14
CONTROL "GPU Color Depth 24 bit",IDC_GPU_24BPP,"Button",BS_AUTORADIOBUTTON,200,34,98,10
CONTROL "GPU Color Depth 18 bit",IDC_GPU_18BPP,"Button",BS_AUTORADIOBUTTON,200,44,98,10
CONTROL "GPU Color Depth 15 bit",IDC_GPU_15BPP,"Button",BS_AUTORADIOBUTTON,200,54,98,10
CONTROL "Deposterize Textures",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,71,79,10
CONTROL "Texture Scaling 1x",IDC_TEXSCALE_1,"Button",BS_AUTORADIOBUTTON,200,82,77,10
CONTROL "Texture Scaling 2x",IDC_TEXSCALE_2,"Button",BS_AUTORADIOBUTTON,200,92,79,10
CONTROL "Texture Scaling 4x",IDC_TEXSCALE_4,"Button",BS_AUTORADIOBUTTON,200,102,72,10
CONTROL "Enable Edge Marking",IDC_3DSETTINGS_EDGEMARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,119,84,10
CONTROL "Enable Fog",IDC_3DSETTINGS_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,129,52,10
CONTROL "Enable Textures",IDC_3DSETTINGS_TEXTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,139,67,10
LTEXT "Multisample Antialiasing:",ID_LABEL_MSAA_SAMPLES,13,145,78,8
EDITTEXT IDC_TEXT_PRESCALEHD,267,17,20,14,ES_AUTOHSCROLL
CONTROL "",IDC_NUD_PRESCALEHD,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,286,17,11,14
PUSHBUTTON "Default",IDC_DEFAULT,130,19,50,15
DEFPUSHBUTTON "OK",IDOK,194,159,50,15
PUSHBUTTON "Cancel",IDCANCEL,254,159,50,15
GROUPBOX "3D Rendering Engine",IDC_STATIC,7,7,180,34
GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,44,180,83
LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,13,106,170,18
CONTROL "Enable Line Hack",IDC_3DSETTINGS_LINEHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,96,73,10
LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,13,77,167,11
CONTROL "Enable TXT Hack",IDC_TXTHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,67,73,10
GROUPBOX "OpenGL Options",IDC_STATIC,7,131,180,43
GROUPBOX "General Options",IDC_STATIC,194,7,109,147
LTEXT "GPU Scaling Factor",IDC_STATIC,200,20,64,8
CONTROL "Texture Scaling 1x",IDC_TEXSCALE_1,"Button",BS_AUTORADIOBUTTON,200,82,77,10
CONTROL "Texture Scaling 2x",IDC_TEXSCALE_2,"Button",BS_AUTORADIOBUTTON,200,92,77,10
CONTROL "Texture Scaling 4x",IDC_TEXSCALE_4,"Button",BS_AUTORADIOBUTTON,200,102,77,10
CONTROL "Deposterize Textures",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,71,79,10
CONTROL "Smooth Textures",IDC_TEX_SMOOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,160,75,10
LTEXT "You may need to toggle off && on by scene.",ID_LABEL_TXTHACK2,13,85,165,11
CONTROL "GPU Color Depth 24 bit",IDC_GPU_24BPP,"Button",BS_AUTORADIOBUTTON,200,34,98,10
CONTROL "GPU Color Depth 18 bit",IDC_GPU_18BPP,"Button",BS_AUTORADIOBUTTON,200,44,98,10
CONTROL "GPU Color Depth 15 bit",IDC_GPU_15BPP,"Button",BS_AUTORADIOBUTTON,200,54,98,10
COMBOBOX IDC_MULTISAMPLE_SIZE,95,144,84,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_ABOUT_BOX DIALOGEX 0, 0, 268, 198