From 46c28635efdb96e5a30cbb0e9b21fafb9d091b5c Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 23 Jul 2017 21:30:00 -0500 Subject: [PATCH] winport - make 3d settings organization match cocoa UI's, and expose choice of 24/18 bpp GPU --- desmume/src/frontend/windows/main.cpp | 33 ++++++++++-- desmume/src/frontend/windows/resource.h | 3 ++ desmume/src/frontend/windows/resources.rc | 63 ++++++++++++++--------- 3 files changed, 69 insertions(+), 30 deletions(-) diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index ba982da1d..afa9bc8d2 100644 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -328,6 +328,8 @@ bool start_paused; extern bool killStylusTopScreen; extern bool killStylusOffScreen; +static int gpu_bpp = 24; + extern LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); void InitRamSearch(); void FilterUpdate(HWND hwnd, bool user=true); @@ -2872,6 +2874,18 @@ static void RefreshMicSettings() } } +static void SyncGpuBpp() +{ + //either of these works. 666 must be packed as 888 + if(gpu_bpp == 18) + GPU->SetColorFormat(NDSColorFormat_BGR666_Rev); + else + GPU->SetColorFormat(NDSColorFormat_BGR888_Rev); + + //555 doesnt work (packed to u16, needs widespread support) + //GPU->SetColorFormat(NDSColorFormat_BGR555_Rev); +} + #define GPU3D_NULL_SAVED -1 #define GPU3D_DEFAULT GPU3D_SWRAST @@ -2999,6 +3013,7 @@ int _main() CommonSettings.GFX3D_Renderer_TextureScalingFactor = GetPrivateProfileInt("3D", "TextureScalingFactor ", 1, IniName); CommonSettings.GFX3D_Renderer_TextureDeposterize = GetPrivateProfileBool("3D", "TextureDeposterize ", 0, IniName); CommonSettings.GFX3D_Renderer_TextureSmoothing = GetPrivateProfileBool("3D", "TextureSmooth ", 0, IniName); + gpu_bpp = GetPrivateProfileInt("3D", "GpuBpp ", 24, IniName); lostFocusPause = GetPrivateProfileBool("Focus", "BackgroundPause", false, IniName); @@ -3239,8 +3254,8 @@ int _main() video.SetPrescale(CommonSettings.GFX3D_PrescaleHD, 1); GPU->SetCustomFramebufferSize(256*video.prescaleHD,192*video.prescaleHD); - GPU->SetColorFormat(NDSColorFormat_BGR888_Rev); - GPU->ClearWithColor(0xFFFF); + SyncGpuBpp(); + GPU->ClearWithColor(0xFFFFFF); SetMinWindowSize(); ScaleScreen(windowSize, false); @@ -6350,9 +6365,13 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp) CheckDlgButton(hw,IDC_3DSETTINGS_ANTIALIASING, CommonSettings.GFX3D_Renderer_Multisample); CheckDlgButton(hw,IDC_TXTHACK, CommonSettings.GFX3D_TXTHack); - if(CommonSettings.GFX3D_Renderer_TextureScalingFactor == 1) CheckDlgButton(hw,IDC_TEXSCALE_1,CommonSettings.GFX3D_Texture); - if(CommonSettings.GFX3D_Renderer_TextureScalingFactor == 2) CheckDlgButton(hw,IDC_TEXSCALE_2,CommonSettings.GFX3D_Texture); - if(CommonSettings.GFX3D_Renderer_TextureScalingFactor == 4) CheckDlgButton(hw,IDC_TEXSCALE_4,CommonSettings.GFX3D_Texture); + CheckDlgButton(hw,IDC_TEXSCALE_1, CommonSettings.GFX3D_Renderer_TextureScalingFactor == 1); + 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_TEX_DEPOSTERIZE, CommonSettings.GFX3D_Renderer_TextureDeposterize); CheckDlgButton(hw,IDC_TEX_SMOOTH, CommonSettings.GFX3D_Renderer_TextureSmoothing); @@ -6384,6 +6403,8 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp) if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_1)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 1; if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_2)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 2; if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_4)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 4; + if(IsDlgCheckboxChecked(hw,IDC_GPU_18BPP)) gpu_bpp = 18; + 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); @@ -6393,6 +6414,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp) Change3DCoreWithFallbackAndSave(ComboBox_GetCurSel(GetDlgItem(hw, IDC_3DCORE))); video.SetPrescale(CommonSettings.GFX3D_PrescaleHD,1); GPU->SetCustomFramebufferSize(256*video.prescaleHD,192*video.prescaleHD); + SyncGpuBpp(); ScaleScreen(windowSize, false); UpdateScreenRects(); if(display_mutex) slock_unlock(display_mutex); @@ -6409,6 +6431,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp) WritePrivateProfileInt ("3D", "TextureScalingFactor", CommonSettings.GFX3D_Renderer_TextureScalingFactor, IniName); WritePrivateProfileBool("3D", "TextureDeposterize", CommonSettings.GFX3D_Renderer_TextureDeposterize, IniName); WritePrivateProfileBool("3D", "TextureSmooth", CommonSettings.GFX3D_Renderer_TextureSmoothing, IniName); + WritePrivateProfileInt ("3D", "GpuBpp", gpu_bpp, IniName); } case IDCANCEL: { diff --git a/desmume/src/frontend/windows/resource.h b/desmume/src/frontend/windows/resource.h index 833c43fba..5a97b0b69 100644 --- a/desmume/src/frontend/windows/resource.h +++ b/desmume/src/frontend/windows/resource.h @@ -473,6 +473,9 @@ #define IDC_LIST 1069 #define IDC_TEXSCALE_4 1070 #define IDC_SNUMBER 1071 +#define IDC_TEXSCALE_5 1071 +#define IDC_GPU_24BPP 1071 +#define IDC_GPU_18BPP 1072 #define IDC_CHECK1 1074 #define IDC_CHECK2 1075 #define IDC_CAP0_SRC 1075 diff --git a/desmume/src/frontend/windows/resources.rc b/desmume/src/frontend/windows/resources.rc index 68225c8db..fa094264b 100644 --- a/desmume/src/frontend/windows/resources.rc +++ b/desmume/src/frontend/windows/resources.rc @@ -110,7 +110,7 @@ BEGIN PUSHBUTTON "&Cancel",IDCANCEL,127,94,50,16 END -IDD_3DSETTINGS DIALOGEX 0, 0, 390, 205 +IDD_3DSETTINGS DIALOGEX 0, 0, 315, 206 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "3D settings" FONT 8, "MS Sans Serif", 0, 0, 0x0 @@ -118,31 +118,33 @@ BEGIN COMBOBOX IDC_3DCORE,15,23,153,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Unrealistically High-Precision Color Interpolation",IDC_INTERPOLATECOLOR, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,62,165,10 - CONTROL "Enable Edge Marking",IDC_3DSETTINGS_EDGEMARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,74,84,10 - CONTROL "Enable Fog",IDC_3DSETTINGS_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,86,52,10 - CONTROL "Enable Textures",IDC_3DSETTINGS_TEXTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,98,67,10 + CONTROL "Enable Edge Marking",IDC_3DSETTINGS_EDGEMARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,109,84,10 + CONTROL "Enable Fog",IDC_3DSETTINGS_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,122,52,10 + CONTROL "Enable Textures",IDC_3DSETTINGS_TEXTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,133,67,10 CONTROL "Enable Multisample Antialiasing",IDC_3DSETTINGS_ANTIALIASING, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,178,114,10 - EDITTEXT IDC_TEXT_PRESCALEHD,245,61,20,14,ES_AUTOHSCROLL - CONTROL "",IDC_NUD_PRESCALEHD,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,264,61,11,14 - PUSHBUTTON "Default",IDC_DEFAULT,204,187,50,14 - DEFPUSHBUTTON "OK",IDOK,284,187,50,14 - PUSHBUTTON "Cancel",IDCANCEL,340,187,50,14 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,157,114,10 + EDITTEXT IDC_TEXT_PRESCALEHD,262,16,20,14,ES_AUTOHSCROLL + CONTROL "",IDC_NUD_PRESCALEHD,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,281,16,11,14 + PUSHBUTTON "Default",IDC_DEFAULT,136,185,50,14 + DEFPUSHBUTTON "OK",IDOK,201,185,50,14 + PUSHBUTTON "Cancel",IDCANCEL,257,185,50,14 GROUPBOX "Renderer:",IDC_STATIC,7,7,174,39 - GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,50,176,114 - LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,197,31,160,24 - CONTROL "Enable Line Hack",IDC_3DSETTINGS_LINEHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,19,73,10 - LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,15,119,165,11 - CONTROL "Enable TXT Hack",IDC_TXTHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,109,73,10 - GROUPBOX "OpenGL Renderer Options",IDC_STATIC,7,166,176,33 - GROUPBOX "General Options",IDC_STATIC,189,6,176,146 - LTEXT "HD Prescaling:",IDC_STATIC,195,64,48,8 - CONTROL "TexScale 1x",IDC_TEXSCALE_1,"Button",BS_AUTORADIOBUTTON,193,80,67,10 - CONTROL "TexScale 2x",IDC_TEXSCALE_2,"Button",BS_AUTORADIOBUTTON,193,90,67,10 - CONTROL "TexScale 4x",IDC_TEXSCALE_4,"Button",BS_AUTORADIOBUTTON,193,100,67,10 - CONTROL "Tex Deposterize",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,261,81,79,10 - CONTROL "Tex Smoothing",IDC_TEX_SMOOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,261,91,75,10 - LTEXT "You may need to toggle off && on by scene.",ID_LABEL_TXTHACK2,16,127,165,11 + GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,50,176,91 + LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,15,112,160,24 + CONTROL "Enable Line Hack",IDC_3DSETTINGS_LINEHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,102,73,10 + LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,15,83,165,11 + CONTROL "Enable TXT Hack",IDC_TXTHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,73,73,10 + GROUPBOX "OpenGL Renderer Options",IDC_STATIC,7,145,176,34 + GROUPBOX "General Options",IDC_STATIC,189,6,118,175 + LTEXT "GPU Scaling Factor",IDC_STATIC,195,19,64,8 + CONTROL "Texture Scaling 1x",IDC_TEXSCALE_1,"Button",BS_AUTORADIOBUTTON,195,71,77,10 + CONTROL "Texture Scaling 2x",IDC_TEXSCALE_2,"Button",BS_AUTORADIOBUTTON,195,81,79,10 + CONTROL "Texture Scaling 4x",IDC_TEXSCALE_4,"Button",BS_AUTORADIOBUTTON,195,92,72,10 + CONTROL "Deposterize Textures",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,60,79,10 + CONTROL "Smooth Textures",IDC_TEX_SMOOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,167,75,10 + LTEXT "You may need to toggle off && on by scene.",ID_LABEL_TXTHACK2,16,91,165,11 + CONTROL "GPU Color Depth 24 bit",IDC_GPU_24BPP,"Button",BS_AUTORADIOBUTTON,195,33,98,10 + CONTROL "GPU Color Depth 18 bit",IDC_GPU_18BPP,"Button",BS_AUTORADIOBUTTON,195,43,98,10 END IDD_ABOUT_BOX DIALOGEX 0, 0, 268, 198 @@ -1842,7 +1844,6 @@ BEGIN IDD_3DSETTINGS, DIALOG BEGIN - BOTTOMMARGIN, 201 END IDD_CHEAT_ADD, DIALOG @@ -2058,14 +2059,22 @@ END // IDB_FRAMEADVANCE BITMAP "bitmaps\\IDB_FRAMEADVANCE.bmp" + IDB_OPEN BITMAP "bitmaps\\IDB_OPEN.bmp" + IDB_PAUSE BITMAP "bitmaps\\IDB_PAUSE.bmp" + IDB_PLAY BITMAP "bitmaps\\IDB_PLAY.bmp" + IDB_RESET BITMAP "bitmaps\\IDB_RESET.bmp" + IDB_STOP BITMAP "bitmaps\\IDB_STOP.bmp" + IDB_ROTATECCW BITMAP "bitmaps\\IDB_ROTATECCW.bmp" + IDB_ROTATECW BITMAP "bitmaps\\IDB_ROTATECW.bmp" + ///////////////////////////////////////////////////////////////////////////// // // Icon @@ -2074,10 +2083,14 @@ IDB_ROTATECW BITMAP "bitmaps\\IDB_ROTATECW.bmp" // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. ICONDESMUME ICON "DeSmuME.ico" + IDI_FOLDER_OPEN ICON "bitmaps\\FolderClosed.ico" + IDI_FOLDER_CLOSED ICON "bitmaps\\FolderOpen.ico" + IDI_FILE_BINARY ICON "bitmaps\\FileBinary.ico" + ///////////////////////////////////////////////////////////////////////////// // // String Table