(MSVC 2013) Add more non_HAVE_DYNAMIC codepaths

This commit is contained in:
twinaphex 2018-01-24 01:52:44 +01:00
parent 80b17668b6
commit 6a46065162
2 changed files with 33 additions and 18 deletions

View File

@ -47,8 +47,10 @@
* it early seems to cause issues on some systems. * it early seems to cause issues on some systems.
*/ */
#ifdef HAVE_DYNAMIC
static dylib_t dwmlib; static dylib_t dwmlib;
static dylib_t shell32lib; static dylib_t shell32lib;
#endif
VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL); VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL);
@ -58,12 +60,14 @@ static bool console_needs_free;
static void gfx_dwm_shutdown(void) static void gfx_dwm_shutdown(void)
{ {
#ifdef HAVE_DYNAMIC
if (dwmlib) if (dwmlib)
dylib_close(dwmlib); dylib_close(dwmlib);
if (shell32lib) if (shell32lib)
dylib_close(shell32lib); dylib_close(shell32lib);
dwmlib = NULL; dwmlib = NULL;
shell32lib = NULL; shell32lib = NULL;
#endif
} }
static bool gfx_init_dwm(void) static bool gfx_init_dwm(void)
@ -76,6 +80,7 @@ static bool gfx_init_dwm(void)
atexit(gfx_dwm_shutdown); atexit(gfx_dwm_shutdown);
#ifdef HAVE_DYNAMIC
shell32lib = dylib_load("shell32.dll"); shell32lib = dylib_load("shell32.dll");
if (!shell32lib) if (!shell32lib)
{ {
@ -93,11 +98,18 @@ static bool gfx_init_dwm(void)
(VOID (WINAPI*)(HWND, BOOL))dylib_proc(shell32lib, "DragAcceptFiles"); (VOID (WINAPI*)(HWND, BOOL))dylib_proc(shell32lib, "DragAcceptFiles");
mmcss = mmcss =
(HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS"); (HRESULT(WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS");
#else
DragAcceptFiles_func = DragAcceptFiles;
#if 0
mmcss = DwmEnableMMCSS;
#endif
#endif
if (mmcss) if (mmcss)
{ {
RARCH_LOG("Setting multimedia scheduling for DWM.\n"); RARCH_LOG("Setting multimedia scheduling for DWM.\n");
mmcss(TRUE); mmcss(TRUE);
} }
inited = true; inited = true;
@ -116,8 +128,11 @@ static void gfx_set_dwm(void)
if (settings->bools.video_disable_composition == dwm_composition_disabled) if (settings->bools.video_disable_composition == dwm_composition_disabled)
return; return;
#ifdef HAVE_DYNAMIC
composition_enable = composition_enable =
(HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition"); (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition");
#endif
if (!composition_enable) if (!composition_enable)
{ {
RARCH_ERR("Did not find DwmEnableComposition ...\n"); RARCH_ERR("Did not find DwmEnableComposition ...\n");
@ -292,22 +307,22 @@ static void frontend_win32_init(void *data)
{ {
typedef BOOL (WINAPI *isProcessDPIAwareProc)(); typedef BOOL (WINAPI *isProcessDPIAwareProc)();
typedef BOOL (WINAPI *setProcessDPIAwareProc)(); typedef BOOL (WINAPI *setProcessDPIAwareProc)();
#ifdef HAVE_DYNAMIC
HMODULE handle = HMODULE handle =
GetModuleHandle("User32.dll"); GetModuleHandle("User32.dll");
isProcessDPIAwareProc isDPIAwareProc = isProcessDPIAwareProc isDPIAwareProc =
(isProcessDPIAwareProc)dylib_proc(handle, "IsProcessDPIAware"); (isProcessDPIAwareProc)dylib_proc(handle, "IsProcessDPIAware");
setProcessDPIAwareProc setDPIAwareProc = setProcessDPIAwareProc setDPIAwareProc =
(setProcessDPIAwareProc)dylib_proc(handle, "SetProcessDPIAware"); (setProcessDPIAwareProc)dylib_proc(handle, "SetProcessDPIAware");
#else
isProcessDPIAwareProc isDPIAwareProc = IsProcessDPIAware;
setProcessDPIAwareProc setDPIAwareProc = SetProcessDPIAware;
#endif
if (isDPIAwareProc) if (isDPIAwareProc)
{
if (!isDPIAwareProc()) if (!isDPIAwareProc())
{
if (setDPIAwareProc) if (setDPIAwareProc)
setDPIAwareProc(); setDPIAwareProc();
}
}
} }
enum frontend_powerstate frontend_win32_get_powerstate(int *seconds, int *percent) enum frontend_powerstate frontend_win32_get_powerstate(int *seconds, int *percent)

View File

@ -85,7 +85,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -99,7 +99,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -115,7 +115,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -133,7 +133,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;HAVE_MENU;HAVE_XMB;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -148,10 +148,10 @@
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsC</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsC</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsC</CompileAs>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">HAVE_XAUDIO;HAVE_XINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">HAVE_XAUDIO;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">HAVE_XAUDIO;HAVE_XINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">HAVE_XAUDIO;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">HAVE_XAUDIO;HAVE_XINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">HAVE_XAUDIO;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">HAVE_XAUDIO;HAVE_XINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">HAVE_XAUDIO;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\griffin\griffin_cpp.cpp" /> <ClCompile Include="..\..\..\griffin\griffin_cpp.cpp" />
</ItemGroup> </ItemGroup>