DirectDraw compile switch

This puts all Directdraw-related code into a compile-time switch
'DIRECTDRAW_DEFINED'. To enable DirectDraw, you need to define this in
the snes9xw project file, and add a reference to drraw.lib in it too.
This commit is contained in:
Nelson Garcia 2017-04-02 16:12:55 -07:00
parent 800a7e8e13
commit aeba0086cc
8 changed files with 63 additions and 19 deletions

View File

@ -187,8 +187,7 @@
Nintendo Co., Limited and its subsidiary companies. Nintendo Co., Limited and its subsidiary companies.
***********************************************************************************/ ***********************************************************************************/
#if DIRECTDRAW_DEFINED
// CDirectDraw.cpp: implementation of the CDirectDraw class. // CDirectDraw.cpp: implementation of the CDirectDraw class.
// //
@ -897,3 +896,4 @@ void CDirectDraw::EnumModes(std::vector<dMode> *modeVector)
lpDD->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,(void *)modeVector,(LPDDENUMMODESCALLBACK)EnumModesCallback); lpDD->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,(void *)modeVector,(LPDDENUMMODESCALLBACK)EnumModesCallback);
} }
#endif

View File

@ -203,6 +203,8 @@
#pragma once #pragma once
#endif // _MSC_VER >= 1000 #endif // _MSC_VER >= 1000
#if DIRECTDRAW_DEFINED
class CDirectDraw: public IS9xDisplayOutput class CDirectDraw: public IS9xDisplayOutput
{ {
public: public:
@ -247,4 +249,6 @@ public:
virtual ~CDirectDraw(); virtual ~CDirectDraw();
}; };
#endif
#endif // !defined(CDIRECTDRAW_H_INCLUDED) #endif // !defined(CDIRECTDRAW_H_INCLUDED)

View File

@ -17,7 +17,9 @@
#include <algorithm> #include <algorithm>
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
#if DIRECTDRAW_DEFINED
#include <ddraw.h> #include <ddraw.h>
#endif
#include <d3d9.h> #include <d3d9.h>
#include <dsound.h> #include <dsound.h>
@ -3012,6 +3014,7 @@ const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr )
// ------------------------------------------------------------- // -------------------------------------------------------------
// ddraw.h error codes // ddraw.h error codes
// ------------------------------------------------------------- // -------------------------------------------------------------
#if DIRECTDRAW_DEFINED
CHK_ERRA(DDERR_ALREADYINITIALIZED) CHK_ERRA(DDERR_ALREADYINITIALIZED)
CHK_ERRA(DDERR_CANNOTATTACHSURFACE) CHK_ERRA(DDERR_CANNOTATTACHSURFACE)
CHK_ERRA(DDERR_CANNOTDETACHSURFACE) CHK_ERRA(DDERR_CANNOTDETACHSURFACE)
@ -3130,6 +3133,7 @@ const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr )
CHK_ERRA(DDERR_NOMONITORINFORMATION) CHK_ERRA(DDERR_NOMONITORINFORMATION)
CHK_ERRA(DDERR_NODRIVERSUPPORT) CHK_ERRA(DDERR_NODRIVERSUPPORT)
CHK_ERRA(DDERR_DEVICEDOESNTOWNSURFACE) CHK_ERRA(DDERR_DEVICEDOESNTOWNSURFACE)
#endif
// ------------------------------------------------------------- // -------------------------------------------------------------
// dinput.h error codes // dinput.h error codes
@ -6392,7 +6396,7 @@ const char* WINAPI DXGetErrorStringA(_In_ HRESULT hr)
CHK_ERR_WIN32A(ERROR_IPSEC_IKE_NEG_STATUS_END) CHK_ERR_WIN32A(ERROR_IPSEC_IKE_NEG_STATUS_END)
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
#if DIRECTDRAW_DEFINED
// ------------------------------------------------------------- // -------------------------------------------------------------
// ddraw.h error codes // ddraw.h error codes
// ------------------------------------------------------------- // -------------------------------------------------------------
@ -6514,7 +6518,7 @@ const char* WINAPI DXGetErrorStringA(_In_ HRESULT hr)
CHK_ERRA(DDERR_NOMONITORINFORMATION) CHK_ERRA(DDERR_NOMONITORINFORMATION)
CHK_ERRA(DDERR_NODRIVERSUPPORT) CHK_ERRA(DDERR_NODRIVERSUPPORT)
CHK_ERRA(DDERR_DEVICEDOESNTOWNSURFACE) CHK_ERRA(DDERR_DEVICEDOESNTOWNSURFACE)
#endif
// ------------------------------------------------------------- // -------------------------------------------------------------
// dinput.h error codes // dinput.h error codes
// ------------------------------------------------------------- // -------------------------------------------------------------
@ -6860,7 +6864,7 @@ void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) WCHAR* des
// Commmented out codes are actually alises for other codes // Commmented out codes are actually alises for other codes
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
#if DIRECTDRAW_DEFINED
// ------------------------------------------------------------- // -------------------------------------------------------------
// ddraw.h error codes // ddraw.h error codes
// ------------------------------------------------------------- // -------------------------------------------------------------
@ -6982,7 +6986,7 @@ void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) WCHAR* des
CHK_ERR(DDERR_NOMONITORINFORMATION, "The monitor does not have EDID data.") CHK_ERR(DDERR_NOMONITORINFORMATION, "The monitor does not have EDID data.")
CHK_ERR(DDERR_NODRIVERSUPPORT, "The driver does not enumerate display mode refresh rates.") CHK_ERR(DDERR_NODRIVERSUPPORT, "The driver does not enumerate display mode refresh rates.")
CHK_ERR(DDERR_DEVICEDOESNTOWNSURFACE, "Surfaces created by one direct draw device cannot be used directly by another direct draw device.") CHK_ERR(DDERR_DEVICEDOESNTOWNSURFACE, "Surfaces created by one direct draw device cannot be used directly by another direct draw device.")
#endif
// ------------------------------------------------------------- // -------------------------------------------------------------
// dinput.h error codes // dinput.h error codes
@ -7383,7 +7387,7 @@ void WINAPI DXGetErrorDescriptionA(_In_ HRESULT hr, _Out_cap_(count) char* desc,
// Commmented out codes are actually alises for other codes // Commmented out codes are actually alises for other codes
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
#if DIRECTDRAW_DEFINED
// ------------------------------------------------------------- // -------------------------------------------------------------
// ddraw.h error codes // ddraw.h error codes
// ------------------------------------------------------------- // -------------------------------------------------------------
@ -7505,7 +7509,7 @@ void WINAPI DXGetErrorDescriptionA(_In_ HRESULT hr, _Out_cap_(count) char* desc,
CHK_ERR(DDERR_NOMONITORINFORMATION, "The monitor does not have EDID data.") CHK_ERR(DDERR_NOMONITORINFORMATION, "The monitor does not have EDID data.")
CHK_ERR(DDERR_NODRIVERSUPPORT, "The driver does not enumerate display mode refresh rates.") CHK_ERR(DDERR_NODRIVERSUPPORT, "The driver does not enumerate display mode refresh rates.")
CHK_ERR(DDERR_DEVICEDOESNTOWNSURFACE, "Surfaces created by one direct draw device cannot be used directly by another direct draw device.") CHK_ERR(DDERR_DEVICEDOESNTOWNSURFACE, "Surfaces created by one direct draw device cannot be used directly by another direct draw device.")
#endif
// ------------------------------------------------------------- // -------------------------------------------------------------
// dinput.h error codes // dinput.h error codes

View File

@ -224,7 +224,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>fmod.dll;fmodex.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>fmod.dll;fmodex.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@ -273,7 +273,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>fmod.dll;fmodex64.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>fmod.dll;fmodex64.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@ -317,7 +317,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
@ -363,7 +363,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
@ -409,7 +409,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
@ -456,7 +456,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
@ -509,7 +509,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>fmod.dll;fmodex.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>fmod.dll;fmodex.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@ -560,7 +560,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;ddraw.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;winmm.lib;opengl32.lib;glu32.lib;wsock32.lib;dsound.lib;dxguid.lib;delayimp.lib;vfw32.lib;msxml2.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)..\..\FMOD\api\lib;$(ProjectDir)..\..\FMODEx_x64\api\lib;$(ProjectDir)..\..\FMODEx\api\lib;$(ProjectDir)..\i386;$(ProjectDir)..\..\zlib\lib;$(ProjectDir)..\..\libPNG\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>fmod.dll;fmodex64.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>fmod.dll;fmodex64.dll;%(DelayLoadDLLs)</DelayLoadDLLs>

View File

@ -887,7 +887,11 @@ void WinRegisterConfigItems()
AddBoolC("DisplayFrameCount", Settings.DisplayMovieFrame, true, "true to show the frame count when a movie is playing"); AddBoolC("DisplayFrameCount", Settings.DisplayMovieFrame, true, "true to show the frame count when a movie is playing");
#undef CATEGORY #undef CATEGORY
#define CATEGORY "Display\\Win" #define CATEGORY "Display\\Win"
#if DIRECTDRAW_DEFINED
AddUIntC("OutputMethod", GUI.outputMethod, 1, "0=DirectDraw, 1=Direct3D, 2=OpenGL"); 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("FilterType", GUI.Scale, 0, filterString);
AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2); 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)"); AddBoolC("BlendHiRes", GUI.BlendHiRes, true, "true to horizontally blend Hi-Res images (better transparency effect on filters that do not account for this)");
@ -906,7 +910,9 @@ void WinRegisterConfigItems()
AddBoolC("Stretch:MaintainAspectRatio", GUI.AspectRatio, true, "prevents stretching from changing the aspect ratio"); 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"); 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."); 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."); 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); AddBool("Fullscreen:Enabled", GUI.FullScreen, false);
AddUInt("Fullscreen:Width", GUI.FullscreenMode.width, 640); AddUInt("Fullscreen:Width", GUI.FullscreenMode.width, 640);
AddUInt("Fullscreen:Height", GUI.FullscreenMode.height, 480); AddUInt("Fullscreen:Height", GUI.FullscreenMode.height, 480);

View File

@ -198,7 +198,9 @@
#include "wsnes9x.h" #include "wsnes9x.h"
#include "win32_display.h" #include "win32_display.h"
#include "CDirect3D.h" #include "CDirect3D.h"
#if DIRECTDRAW_DEFINED
#include "CDirectDraw.h" #include "CDirectDraw.h"
#endif
#include "COpenGL.h" #include "COpenGL.h"
#include "IS9xDisplayOutput.h" #include "IS9xDisplayOutput.h"
@ -207,7 +209,9 @@
// available display output methods // available display output methods
CDirect3D Direct3D; CDirect3D Direct3D;
#if DIRECTDRAW_DEFINED
CDirectDraw DirectDraw; CDirectDraw DirectDraw;
#endif
COpenGL OpenGL; COpenGL OpenGL;
SSurface Src = {0}; SSurface Src = {0};
extern BYTE *ScreenBufferBlend; extern BYTE *ScreenBufferBlend;
@ -258,9 +262,11 @@ bool WinDisplayReset(void)
case DIRECT3D: case DIRECT3D:
S9xDisplayOutput = &Direct3D; S9xDisplayOutput = &Direct3D;
break; break;
#if DIRECTDRAW_DEFINED
case DIRECTDRAW: case DIRECTDRAW:
S9xDisplayOutput = &DirectDraw; S9xDisplayOutput = &DirectDraw;
break; break;
#endif
case OPENGL: case OPENGL:
S9xDisplayOutput = &OpenGL; S9xDisplayOutput = &OpenGL;
break; break;
@ -473,9 +479,9 @@ void ReduceToPath(TCHAR *filename)
// TODO: abstract the following functions in some way - only necessary for directdraw // TODO: abstract the following functions in some way - only necessary for directdraw
/* DirectDraw only begin */ /* DirectDraw only begin */
void SwitchToGDI() void SwitchToGDI()
{ {
#if DIRECTDRAW_DEFINED
if(GUI.outputMethod!=DIRECTDRAW) if(GUI.outputMethod!=DIRECTDRAW)
return; return;
@ -483,10 +489,12 @@ void SwitchToGDI()
DirectDraw.lpDD->FlipToGDISurface(); DirectDraw.lpDD->FlipToGDISurface();
GUI.FlipCounter = 0; GUI.FlipCounter = 0;
DirectDraw.lpDDSPrimary2->SetPalette (NULL); DirectDraw.lpDDSPrimary2->SetPalette (NULL);
#endif
} }
static void ClearSurface (LPDIRECTDRAWSURFACE2 lpDDSurface) static void ClearSurface (LPDIRECTDRAWSURFACE2 lpDDSurface)
{ {
#if DIRECTDRAW_DEFINED
DDBLTFX fx; DDBLTFX fx;
memset (&fx, 0, sizeof (fx)); memset (&fx, 0, sizeof (fx));
@ -494,11 +502,12 @@ static void ClearSurface (LPDIRECTDRAWSURFACE2 lpDDSurface)
while (lpDDSurface->Blt (NULL, DirectDraw.lpDDSPrimary2, NULL, DDBLT_WAIT, NULL) == DDERR_SURFACELOST) while (lpDDSurface->Blt (NULL, DirectDraw.lpDDSPrimary2, NULL, DDBLT_WAIT, NULL) == DDERR_SURFACELOST)
lpDDSurface->Restore (); lpDDSurface->Restore ();
#endif
} }
void UpdateBackBuffer() void UpdateBackBuffer()
{ {
#if DIRECTDRAW_DEFINED
if (GUI.outputMethod==DIRECTDRAW && GUI.FullScreen) if (GUI.outputMethod==DIRECTDRAW && GUI.FullScreen)
{ {
SwitchToGDI(); SwitchToGDI();
@ -536,10 +545,12 @@ void UpdateBackBuffer()
if (GetMenu( GUI.hWnd) != NULL) if (GetMenu( GUI.hWnd) != NULL)
DrawMenuBar (GUI.hWnd); DrawMenuBar (GUI.hWnd);
} }
#endif
} }
void RestoreGUIDisplay () void RestoreGUIDisplay ()
{ {
#if DIRECTDRAW_DEFINED
if(GUI.outputMethod!=DIRECTDRAW) if(GUI.outputMethod!=DIRECTDRAW)
return; return;
@ -555,10 +566,12 @@ void RestoreGUIDisplay ()
} }
SwitchToGDI(); SwitchToGDI();
S9xClearPause (PAUSE_RESTORE_GUI); S9xClearPause (PAUSE_RESTORE_GUI);
#endif
} }
void RestoreSNESDisplay () void RestoreSNESDisplay ()
{ {
#if DIRECTDRAW_DEFINED
if(GUI.outputMethod!=DIRECTDRAW) if(GUI.outputMethod!=DIRECTDRAW)
return; return;
@ -569,6 +582,7 @@ void RestoreSNESDisplay ()
} }
UpdateBackBuffer(); UpdateBackBuffer();
#endif
} }
/* DirectDraw only end */ /* DirectDraw only end */

View File

@ -609,7 +609,9 @@ static uint32 FrameTimings[] = {
struct sLanguages Languages[] = { struct sLanguages Languages[] = {
{ IDR_MENU_US, { IDR_MENU_US,
TEXT("Failed to initialize currently selected display output!\n Try switching to a different output method in the display settings."), 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!"), TEXT("DirectDraw failed to set the selected display mode!"),
#endif
TEXT("DirectSound failed to initialize; no sound will be played."), TEXT("DirectSound failed to initialize; no sound will be played."),
TEXT("These settings won't take effect until you restart the emulator."), 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!")} TEXT("The frame timer failed to initialize, please do NOT select the automatic framerate option or Snes9X will crash!")}
@ -1386,7 +1388,11 @@ int HandleKeyMessage(WPARAM wParam, LPARAM lParam)
switch (wParam) switch (wParam)
{ {
case VK_ESCAPE: case VK_ESCAPE:
if(GUI.outputMethod!=DIRECTDRAW && GUI.FullScreen && !GUI.EmulateFullscreen) if(
#if DIRECTDRAW_DEFINED
GUI.outputMethod!=DIRECTDRAW &&
#endif
GUI.FullScreen && !GUI.EmulateFullscreen)
ToggleFullScreen(); ToggleFullScreen();
else else
if (GetMenu (GUI.hWnd) == NULL) if (GetMenu (GUI.hWnd) == NULL)
@ -7327,7 +7333,9 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
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")); SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_ADDSTRING,0,(LPARAM)TEXT("DirectDraw"));
#endif
SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_ADDSTRING,0,(LPARAM)TEXT("Direct3D")); 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_ADDSTRING,0,(LPARAM)TEXT("OpenGL"));
SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_SETCURSEL,(WPARAM)GUI.outputMethod,0); SendDlgItemMessage(hDlg,IDC_OUTPUTMETHOD,CB_SETCURSEL,(WPARAM)GUI.outputMethod,0);

View File

@ -287,8 +287,12 @@ enum RenderFilter{
}; };
enum OutputMethod { enum OutputMethod {
#if DIRECTDRAW_DEFINED
DIRECTDRAW = 0, DIRECTDRAW = 0,
DIRECT3D, DIRECT3D,
#else
DIRECT3D = 0,
#endif
OPENGL OPENGL
}; };
@ -330,7 +334,9 @@ struct sGUI {
bool EmulateFullscreen; bool EmulateFullscreen;
bool EmulatedFullscreen; bool EmulatedFullscreen;
bool BilinearFilter; bool BilinearFilter;
#if DIRECTDRAW_DEFINED
bool LocalVidMem; bool LocalVidMem;
#endif
bool Vsync; bool Vsync;
bool shaderEnabled; bool shaderEnabled;
TCHAR D3DshaderFileName[MAX_PATH]; TCHAR D3DshaderFileName[MAX_PATH];
@ -434,7 +440,9 @@ struct sGUI {
struct sLanguages { struct sLanguages {
int idMenu; int idMenu;
TCHAR *errInitDD; TCHAR *errInitDD;
#if DIRECTDRAW_DEFINED
TCHAR *errModeDD; TCHAR *errModeDD;
#endif
TCHAR *errInitDS; TCHAR *errInitDS;
TCHAR *ApplyNeedRestart; TCHAR *ApplyNeedRestart;
TCHAR *errFrameTimer; TCHAR *errFrameTimer;