From f815f25a004dd079e0f56e05aa306998086fadde Mon Sep 17 00:00:00 2001 From: OV2 Date: Mon, 17 Apr 2017 13:45:43 +0200 Subject: [PATCH] win32: change define name, keep ifdefs to minimum, keep enum values --- win32/CDirectDraw.cpp | 2 +- win32/CDirectDraw.h | 2 +- win32/dxerr.cpp | 10 +- win32/wconfig.cpp | 6 - win32/win32_display.cpp | 16 +-- win32/wsnes9x.cpp | 267 +++++++++++++++++++++------------------- win32/wsnes9x.h | 8 -- 7 files changed, 155 insertions(+), 156 deletions(-) diff --git a/win32/CDirectDraw.cpp b/win32/CDirectDraw.cpp index 305b038b..8b784aa0 100644 --- a/win32/CDirectDraw.cpp +++ b/win32/CDirectDraw.cpp @@ -187,7 +187,7 @@ Nintendo Co., Limited and its subsidiary companies. ***********************************************************************************/ -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT // CDirectDraw.cpp: implementation of the CDirectDraw class. // diff --git a/win32/CDirectDraw.h b/win32/CDirectDraw.h index a0bdd0f0..4ed39536 100644 --- a/win32/CDirectDraw.h +++ b/win32/CDirectDraw.h @@ -203,7 +203,7 @@ #pragma once #endif // _MSC_VER >= 1000 -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT class CDirectDraw: public IS9xDisplayOutput { diff --git a/win32/dxerr.cpp b/win32/dxerr.cpp index 86d360df..d1e4f36f 100644 --- a/win32/dxerr.cpp +++ b/win32/dxerr.cpp @@ -17,7 +17,7 @@ #include #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT #include #endif #include @@ -3014,7 +3014,7 @@ const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr ) // ------------------------------------------------------------- // ddraw.h error codes // ------------------------------------------------------------- -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT CHK_ERRA(DDERR_ALREADYINITIALIZED) CHK_ERRA(DDERR_CANNOTATTACHSURFACE) CHK_ERRA(DDERR_CANNOTDETACHSURFACE) @@ -6396,7 +6396,7 @@ const char* WINAPI DXGetErrorStringA(_In_ HRESULT hr) CHK_ERR_WIN32A(ERROR_IPSEC_IKE_NEG_STATUS_END) #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT // ------------------------------------------------------------- // ddraw.h error codes // ------------------------------------------------------------- @@ -6864,7 +6864,7 @@ void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) WCHAR* des // Commmented out codes are actually alises for other codes #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT // ------------------------------------------------------------- // ddraw.h error codes // ------------------------------------------------------------- @@ -7387,7 +7387,7 @@ void WINAPI DXGetErrorDescriptionA(_In_ HRESULT hr, _Out_cap_(count) char* desc, // Commmented out codes are actually alises for other codes #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT // ------------------------------------------------------------- // ddraw.h error codes // ------------------------------------------------------------- diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp index 39df9274..41319ce6 100644 --- a/win32/wconfig.cpp +++ b/win32/wconfig.cpp @@ -887,11 +887,7 @@ void WinRegisterConfigItems() AddBoolC("DisplayFrameCount", Settings.DisplayMovieFrame, true, "true to show the frame count when a movie is playing"); #undef CATEGORY #define CATEGORY "Display\\Win" -#if DIRECTDRAW_DEFINED AddUIntC("OutputMethod", GUI.outputMethod, 1, "0=DirectDraw, 1=Direct3D, 2=OpenGL"); -#else - AddUIntC("OutputMethod", GUI.outputMethod, 1, "0=Direct3D, 1=OpenGL"); -#endif AddUIntC("FilterType", GUI.Scale, 0, filterString); AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2); AddBoolC("BlendHiRes", GUI.BlendHiRes, true, "true to horizontally blend Hi-Res images (better transparency effect on filters that do not account for this)"); @@ -910,9 +906,7 @@ void WinRegisterConfigItems() AddBoolC("Stretch:MaintainAspectRatio", GUI.AspectRatio, true, "prevents stretching from changing the aspect ratio"); AddUIntC("Stretch:AspectRatioBaseWidth", GUI.AspectWidth, 256, "base width for aspect ratio calculation (AR=AspectRatioBaseWidth/224), default is 256 - set to 299 for 4:3 aspect ratio"); AddBoolC("Stretch:BilinearFilter", GUI.BilinearFilter, true, "allows bilinear filtering of stretching. Depending on your video card and the window size, this may result in a lower framerate."); -#if DIRECTDRAW_DEFINED AddBoolC("Stretch:LocalVidMem", GUI.LocalVidMem, true, "determines the location of video memory in DirectDraw mode. May increase or decrease rendering performance, depending on your setup and which filter and stretching options are active."); -#endif AddBool("Fullscreen:Enabled", GUI.FullScreen, false); AddUInt("Fullscreen:Width", GUI.FullscreenMode.width, 640); AddUInt("Fullscreen:Height", GUI.FullscreenMode.height, 480); diff --git a/win32/win32_display.cpp b/win32/win32_display.cpp index 910e5697..1bb4b8ba 100644 --- a/win32/win32_display.cpp +++ b/win32/win32_display.cpp @@ -198,7 +198,7 @@ #include "wsnes9x.h" #include "win32_display.h" #include "CDirect3D.h" -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT #include "CDirectDraw.h" #endif #include "COpenGL.h" @@ -209,7 +209,7 @@ // available display output methods CDirect3D Direct3D; -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT CDirectDraw DirectDraw; #endif COpenGL OpenGL; @@ -262,7 +262,7 @@ bool WinDisplayReset(void) case DIRECT3D: S9xDisplayOutput = &Direct3D; break; -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT case DIRECTDRAW: S9xDisplayOutput = &DirectDraw; break; @@ -481,7 +481,7 @@ void ReduceToPath(TCHAR *filename) /* DirectDraw only begin */ void SwitchToGDI() { -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT if(GUI.outputMethod!=DIRECTDRAW) return; @@ -494,7 +494,7 @@ void SwitchToGDI() static void ClearSurface (LPDIRECTDRAWSURFACE2 lpDDSurface) { -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT DDBLTFX fx; memset (&fx, 0, sizeof (fx)); @@ -507,7 +507,7 @@ static void ClearSurface (LPDIRECTDRAWSURFACE2 lpDDSurface) void UpdateBackBuffer() { -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT if (GUI.outputMethod==DIRECTDRAW && GUI.FullScreen) { SwitchToGDI(); @@ -550,7 +550,7 @@ void UpdateBackBuffer() void RestoreGUIDisplay () { -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT if(GUI.outputMethod!=DIRECTDRAW) return; @@ -571,7 +571,7 @@ void RestoreGUIDisplay () void RestoreSNESDisplay () { -#if DIRECTDRAW_DEFINED +#if DIRECTDRAW_SUPPORT if(GUI.outputMethod!=DIRECTDRAW) return; diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index d12598cc..2758f4c1 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -609,9 +609,7 @@ static uint32 FrameTimings[] = { struct sLanguages Languages[] = { { IDR_MENU_US, TEXT("Failed to initialize currently selected display output!\n Try switching to a different output method in the display settings."), -#if DIRECTDRAW_DEFINED TEXT("DirectDraw failed to set the selected display mode!"), -#endif TEXT("DirectSound failed to initialize; no sound will be played."), TEXT("These settings won't take effect until you restart the emulator."), TEXT("The frame timer failed to initialize, please do NOT select the automatic framerate option or Snes9X will crash!")} @@ -1389,9 +1387,7 @@ int HandleKeyMessage(WPARAM wParam, LPARAM lParam) { case VK_ESCAPE: if( -#if DIRECTDRAW_DEFINED GUI.outputMethod!=DIRECTDRAW && -#endif GUI.FullScreen && !GUI.EmulateFullscreen) ToggleFullScreen(); else @@ -7228,146 +7224,162 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_INITDIALOG: - WinRefreshDisplay(); + { + WinRefreshDisplay(); - CreateToolTip(IDC_EMUFULLSCREEN,hDlg,TEXT("Emulate fullscreen by creating a window that spans the entire screen when going fullscreen")); - CreateToolTip(IDC_AUTOFRAME,hDlg,TEXT("Try to achieve 50/60 fps by limiting the speed and skipping at most 'max skipped frames'")); - CreateToolTip(IDC_MAXSKIP,hDlg,TEXT("Try to achieve 50/60 fps by limiting the speed and skipping at most 'max skipped frames'")); - CreateToolTip(IDC_FIXEDSKIP,hDlg,TEXT("Always skip a fixed number of frames - no speed limit")); - CreateToolTip(IDC_SKIPCOUNT,hDlg,TEXT("Always skip a fixed number of frames - no speed limit")); - CreateToolTip(IDC_HIRES,hDlg,TEXT("Support the hi-res mode that a few games use, otherwise render them in low-res")); - CreateToolTip(IDC_HEIGHT_EXTEND,hDlg,TEXT("Display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240")); - CreateToolTip(IDC_MESSAGES_IN_IMAGE,hDlg,TEXT("Draw text inside the SNES image (will get into AVIs, screenshots, and filters)")); + CreateToolTip(IDC_EMUFULLSCREEN, hDlg, TEXT("Emulate fullscreen by creating a window that spans the entire screen when going fullscreen")); + CreateToolTip(IDC_AUTOFRAME, hDlg, TEXT("Try to achieve 50/60 fps by limiting the speed and skipping at most 'max skipped frames'")); + CreateToolTip(IDC_MAXSKIP, hDlg, TEXT("Try to achieve 50/60 fps by limiting the speed and skipping at most 'max skipped frames'")); + CreateToolTip(IDC_FIXEDSKIP, hDlg, TEXT("Always skip a fixed number of frames - no speed limit")); + CreateToolTip(IDC_SKIPCOUNT, hDlg, TEXT("Always skip a fixed number of frames - no speed limit")); + CreateToolTip(IDC_HIRES, hDlg, TEXT("Support the hi-res mode that a few games use, otherwise render them in low-res")); + CreateToolTip(IDC_HEIGHT_EXTEND, hDlg, TEXT("Display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240")); + CreateToolTip(IDC_MESSAGES_IN_IMAGE, hDlg, TEXT("Draw text inside the SNES image (will get into AVIs, screenshots, and filters)")); - prevOutputMethod = GUI.outputMethod; - prevScale = GUI.Scale; - prevScaleHiRes = GUI.ScaleHiRes; - prevPPL = GFX.RealPPL; - prevStretch = GUI.Stretch; - prevBilinearFilter = GUI.BilinearFilter; - prevAspectRatio = GUI.AspectRatio; - prevAspectWidth = GUI.AspectWidth; - prevHeightExtend = GUI.HeightExtend; - prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0; - prevShaderEnabled = GUI.shaderEnabled; - prevBlendHires = GUI.BlendHiRes; - lstrcpy(prevD3DShaderFile,GUI.D3DshaderFileName); - lstrcpy(prevOGLShaderFile,GUI.OGLshaderFileName); + prevOutputMethod = GUI.outputMethod; + prevScale = GUI.Scale; + prevScaleHiRes = GUI.ScaleHiRes; + prevPPL = GFX.RealPPL; + prevStretch = GUI.Stretch; + prevBilinearFilter = GUI.BilinearFilter; + prevAspectRatio = GUI.AspectRatio; + prevAspectWidth = GUI.AspectWidth; + prevHeightExtend = GUI.HeightExtend; + prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0; + prevShaderEnabled = GUI.shaderEnabled; + prevBlendHires = GUI.BlendHiRes; + lstrcpy(prevD3DShaderFile, GUI.D3DshaderFileName); + lstrcpy(prevOGLShaderFile, GUI.OGLshaderFileName); - _stprintf(s,TEXT("Current: %dx%d %dbit %dHz"),GUI.FullscreenMode.width,GUI.FullscreenMode.height,GUI.FullscreenMode.depth,GUI.FullscreenMode.rate); - SendDlgItemMessage(hDlg,IDC_CURRMODE,WM_SETTEXT,0,(LPARAM)s); + _stprintf(s, TEXT("Current: %dx%d %dbit %dHz"), GUI.FullscreenMode.width, GUI.FullscreenMode.height, GUI.FullscreenMode.depth, GUI.FullscreenMode.rate); + SendDlgItemMessage(hDlg, IDC_CURRMODE, WM_SETTEXT, 0, (LPARAM)s); - if(GUI.DoubleBuffered) - SendDlgItemMessage(hDlg, IDC_DBLBUFFER, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(GUI.Vsync) - SendDlgItemMessage(hDlg, IDC_VSYNC, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - SendDlgItemMessage(hDlg,IDC_FRAMERATESKIPSLIDER,TBM_SETRANGE,(WPARAM)true,(LPARAM)MAKELONG(0,9)); - if(Settings.SkipFrames!=AUTO_FRAMERATE) - SendDlgItemMessage(hDlg,IDC_FRAMERATESKIPSLIDER,TBM_SETPOS,(WPARAM)true,(LPARAM)Settings.SkipFrames); - EnableWindow(GetDlgItem(hDlg, IDC_TRANS), TRUE); - if(Settings.Transparency) - SendDlgItemMessage(hDlg, IDC_TRANS, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.DoubleBuffered) + SendDlgItemMessage(hDlg, IDC_DBLBUFFER, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.Vsync) + SendDlgItemMessage(hDlg, IDC_VSYNC, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + SendDlgItemMessage(hDlg, IDC_FRAMERATESKIPSLIDER, TBM_SETRANGE, (WPARAM)true, (LPARAM)MAKELONG(0, 9)); + if (Settings.SkipFrames != AUTO_FRAMERATE) + SendDlgItemMessage(hDlg, IDC_FRAMERATESKIPSLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)Settings.SkipFrames); + EnableWindow(GetDlgItem(hDlg, IDC_TRANS), TRUE); + if (Settings.Transparency) + SendDlgItemMessage(hDlg, IDC_TRANS, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(Settings.SupportHiRes) - SendDlgItemMessage(hDlg, IDC_HIRES, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(GUI.BlendHiRes) - SendDlgItemMessage(hDlg, IDC_HIRESBLEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(GUI.HeightExtend) - SendDlgItemMessage(hDlg, IDC_HEIGHT_EXTEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(Settings.AutoDisplayMessages) - SendDlgItemMessage(hDlg, IDC_MESSAGES_IN_IMAGE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(Settings.SkipFrames==AUTO_FRAMERATE) - SendDlgItemMessage(hDlg, IDC_AUTOFRAME, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(GUI.Stretch) - { - SendDlgItemMessage(hDlg, IDC_STRETCH, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - } + if (Settings.SupportHiRes) + SendDlgItemMessage(hDlg, IDC_HIRES, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.BlendHiRes) + SendDlgItemMessage(hDlg, IDC_HIRESBLEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.HeightExtend) + SendDlgItemMessage(hDlg, IDC_HEIGHT_EXTEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (Settings.AutoDisplayMessages) + SendDlgItemMessage(hDlg, IDC_MESSAGES_IN_IMAGE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (Settings.SkipFrames == AUTO_FRAMERATE) + SendDlgItemMessage(hDlg, IDC_AUTOFRAME, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.Stretch) + { + SendDlgItemMessage(hDlg, IDC_STRETCH, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + } - if(GUI.AspectRatio) - SendDlgItemMessage(hDlg, IDC_ASPECT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - SendDlgItemMessage(hDlg,IDC_ASPECTDROP,CB_ADDSTRING,0,(LPARAM)TEXT("8:7")); - SendDlgItemMessage(hDlg,IDC_ASPECTDROP,CB_ADDSTRING,0,(LPARAM)TEXT("4:3")); - switch(GUI.AspectWidth) { - case 256: - SendDlgItemMessage(hDlg,IDC_ASPECTDROP,CB_SETCURSEL,(WPARAM)0,0); - break; - case 299: - SendDlgItemMessage(hDlg,IDC_ASPECTDROP,CB_SETCURSEL,(WPARAM)1,0); - break; - default: - SendDlgItemMessage(hDlg,IDC_ASPECTDROP,CB_ADDSTRING,0,(LPARAM)TEXT("Custom")); - SendDlgItemMessage(hDlg,IDC_ASPECTDROP,CB_SETCURSEL,(WPARAM)2,0); - break; - } + if (GUI.AspectRatio) + SendDlgItemMessage(hDlg, IDC_ASPECT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + SendDlgItemMessage(hDlg, IDC_ASPECTDROP, CB_ADDSTRING, 0, (LPARAM)TEXT("8:7")); + SendDlgItemMessage(hDlg, IDC_ASPECTDROP, CB_ADDSTRING, 0, (LPARAM)TEXT("4:3")); + switch (GUI.AspectWidth) { + case 256: + SendDlgItemMessage(hDlg, IDC_ASPECTDROP, CB_SETCURSEL, (WPARAM)0, 0); + break; + case 299: + SendDlgItemMessage(hDlg, IDC_ASPECTDROP, CB_SETCURSEL, (WPARAM)1, 0); + break; + default: + SendDlgItemMessage(hDlg, IDC_ASPECTDROP, CB_ADDSTRING, 0, (LPARAM)TEXT("Custom")); + SendDlgItemMessage(hDlg, IDC_ASPECTDROP, CB_SETCURSEL, (WPARAM)2, 0); + break; + } - if(GUI.FullScreen || GUI.EmulatedFullscreen) - SendDlgItemMessage(hDlg, IDC_FULLSCREEN, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(GUI.EmulateFullscreen) - SendDlgItemMessage(hDlg, IDC_EMUFULLSCREEN, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(GUI.BilinearFilter) - SendDlgItemMessage(hDlg,IDC_BILINEAR, BM_SETCHECK, (WPARAM)BST_CHECKED,0); - if(Settings.DisplayFrameRate) - SendDlgItemMessage(hDlg, IDC_SHOWFPS, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.FullScreen || GUI.EmulatedFullscreen) + SendDlgItemMessage(hDlg, IDC_FULLSCREEN, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.EmulateFullscreen) + SendDlgItemMessage(hDlg, IDC_EMUFULLSCREEN, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.BilinearFilter) + SendDlgItemMessage(hDlg, IDC_BILINEAR, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (Settings.DisplayFrameRate) + SendDlgItemMessage(hDlg, IDC_SHOWFPS, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - if(Settings.SkipFrames==AUTO_FRAMERATE) { - SendDlgItemMessage(hDlg, IDC_AUTOFRAME, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - EnableWindow(GetDlgItem(hDlg, IDC_SKIPCOUNT),FALSE); - } else { - SendDlgItemMessage(hDlg, IDC_FIXEDSKIP, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - EnableWindow(GetDlgItem(hDlg, IDC_MAXSKIP),FALSE); - } - SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP, UDM_SETRANGE, 0, MAKELPARAM((short)59, (short)0)); - SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP, UDM_SETPOS,0, Settings.AutoMaxSkipFrames); - SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETRANGE, 0, MAKELPARAM((short)59, (short)0)); - SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETPOS,0, Settings.SkipFrames==AUTO_FRAMERATE?0:Settings.SkipFrames); + if (Settings.SkipFrames == AUTO_FRAMERATE) { + SendDlgItemMessage(hDlg, IDC_AUTOFRAME, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + EnableWindow(GetDlgItem(hDlg, IDC_SKIPCOUNT), FALSE); + } + else { + SendDlgItemMessage(hDlg, IDC_FIXEDSKIP, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + EnableWindow(GetDlgItem(hDlg, IDC_MAXSKIP), FALSE); + } + SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP, UDM_SETRANGE, 0, MAKELPARAM((short)59, (short)0)); + SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP, UDM_SETPOS, 0, Settings.AutoMaxSkipFrames); + SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETRANGE, 0, MAKELPARAM((short)59, (short)0)); + SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETPOS, 0, Settings.SkipFrames == AUTO_FRAMERATE ? 0 : Settings.SkipFrames); - if(GUI.shaderEnabled) { - SendDlgItemMessage(hDlg, IDC_SHADER_ENABLED, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); - EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_FILE),TRUE); - EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE),TRUE); - EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FILE),TRUE); - EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_BROWSE),TRUE); - } - SetDlgItemText(hDlg,IDC_SHADER_HLSL_FILE,GUI.D3DshaderFileName); - SetDlgItemText(hDlg,IDC_SHADER_GLSL_FILE,GUI.OGLshaderFileName); + if (GUI.shaderEnabled) { + SendDlgItemMessage(hDlg, IDC_SHADER_ENABLED, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_FILE), TRUE); + EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE), TRUE); + EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FILE), TRUE); + EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_BROWSE), TRUE); + } + SetDlgItemText(hDlg, IDC_SHADER_HLSL_FILE, GUI.D3DshaderFileName); + SetDlgItemText(hDlg, IDC_SHADER_GLSL_FILE, GUI.OGLshaderFileName); - lpfnOldWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg,IDC_SHADER_GROUP),GWLP_WNDPROC,(LONG_PTR)GroupBoxCheckBoxTitle); + lpfnOldWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, IDC_SHADER_GROUP), GWLP_WNDPROC, (LONG_PTR)GroupBoxCheckBoxTitle); - EnableWindow(GetDlgItem(hDlg, IDC_ASPECT), GUI.Stretch); + EnableWindow(GetDlgItem(hDlg, IDC_ASPECT), GUI.Stretch); -#if DIRECTDRAW_DEFINED - SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_ADDSTRING,0,(LPARAM)TEXT("DirectDraw")); + // add output method to droplist with itemdata set to their enum value + int inserted_index = -1; +#if DIRECTDRAW_SUPPORT + inserted_index = SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_ADDSTRING, 0, (LPARAM)TEXT("DirectDraw")); + SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_SETITEMDATA, inserted_index, DIRECTDRAW); #endif - SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_ADDSTRING,0,(LPARAM)TEXT("Direct3D")); - SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_ADDSTRING,0,(LPARAM)TEXT("OpenGL")); - SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_SETCURSEL,(WPARAM)GUI.outputMethod,0); - // add all the GUI.Scale filters to the combo box - for(int filter = 0 ; filter < (int)NUM_FILTERS ; filter++) - { - strcpy(temp,GetFilterName((RenderFilter)filter)); - SendDlgItemMessageA(hDlg,IDC_FILTERBOX,CB_ADDSTRING,0,(LPARAM) (LPCTSTR)temp); - } - for(int filter = 0, hiResPos = 0 ; filter < (int)NUM_FILTERS ; filter++) - { - if(GetFilterHiResSupport((RenderFilter)filter)) - { - strcpy(temp,GetFilterName((RenderFilter)filter)); - SendDlgItemMessageA(hDlg,IDC_FILTERBOX2,CB_ADDSTRING,0,(LPARAM) (LPCTSTR)temp); - if(GUI.ScaleHiRes==filter) - SendDlgItemMessage(hDlg,IDC_FILTERBOX2,CB_SETCURSEL,(WPARAM)hiResPos,0); - hiResPos++; - } - } + inserted_index = SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_ADDSTRING, 0, (LPARAM)TEXT("Direct3D")); + SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_SETITEMDATA, inserted_index, DIRECT3D); + inserted_index = SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_ADDSTRING, 0, (LPARAM)TEXT("OpenGL")); + SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_SETITEMDATA, inserted_index, OPENGL); - SendDlgItemMessage(hDlg,IDC_FILTERBOX,CB_SETCURSEL,(WPARAM)GUI.Scale,0); + // select item with corresponding itemdata + int item_count = SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_GETCOUNT, 0, 0); + for (int index = 0; index < item_count; index++) { + int item_data = SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_GETITEMDATA, index, 0); + if (item_data == GUI.outputMethod) + SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_SETCURSEL, index, 0); + } - UpdateModeComboBox(GetDlgItem(hDlg,IDC_RESOLUTION)); + // add all the GUI.Scale filters to the combo box + for (int filter = 0; filter < (int)NUM_FILTERS; filter++) + { + strcpy(temp, GetFilterName((RenderFilter)filter)); + SendDlgItemMessageA(hDlg, IDC_FILTERBOX, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)temp); + } + for (int filter = 0, hiResPos = 0; filter < (int)NUM_FILTERS; filter++) + { + if (GetFilterHiResSupport((RenderFilter)filter)) + { + strcpy(temp, GetFilterName((RenderFilter)filter)); + SendDlgItemMessageA(hDlg, IDC_FILTERBOX2, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)temp); + if (GUI.ScaleHiRes == filter) + SendDlgItemMessage(hDlg, IDC_FILTERBOX2, CB_SETCURSEL, (WPARAM)hiResPos, 0); + hiResPos++; + } + } - // have to start focus on something like this or Escape won't exit the dialog - SetFocus(hDlg); + SendDlgItemMessage(hDlg, IDC_FILTERBOX, CB_SETCURSEL, (WPARAM)GUI.Scale, 0); - break; + UpdateModeComboBox(GetDlgItem(hDlg, IDC_RESOLUTION)); + + // have to start focus on something like this or Escape won't exit the dialog + SetFocus(hDlg); + + break; + } case WM_CLOSE: case WM_DESTROY: break; @@ -7477,7 +7489,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; case IDC_OUTPUTMETHOD: if(HIWORD(wParam)==CBN_SELCHANGE) { - OutputMethod newOut = (OutputMethod)SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_GETCURSEL,0,0); + int index = SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_GETCURSEL, 0, 0); + OutputMethod newOut = (OutputMethod)SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_GETITEMDATA, index, 0); if(GUI.outputMethod==newOut) break; if(GUI.FullScreen) diff --git a/win32/wsnes9x.h b/win32/wsnes9x.h index 2fde3770..1f96737b 100644 --- a/win32/wsnes9x.h +++ b/win32/wsnes9x.h @@ -287,12 +287,8 @@ enum RenderFilter{ }; enum OutputMethod { -#if DIRECTDRAW_DEFINED DIRECTDRAW = 0, DIRECT3D, -#else - DIRECT3D = 0, -#endif OPENGL }; @@ -334,9 +330,7 @@ struct sGUI { bool EmulateFullscreen; bool EmulatedFullscreen; bool BilinearFilter; -#if DIRECTDRAW_DEFINED bool LocalVidMem; -#endif bool Vsync; bool shaderEnabled; TCHAR D3DshaderFileName[MAX_PATH]; @@ -441,9 +435,7 @@ struct sGUI { struct sLanguages { int idMenu; TCHAR *errInitDD; -#if DIRECTDRAW_DEFINED TCHAR *errModeDD; -#endif TCHAR *errInitDS; TCHAR *ApplyNeedRestart; TCHAR *errFrameTimer;