From 8e1ea0be36689d1f723ae6c39192eb098c8b63c4 Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Sat, 16 Nov 2019 02:25:47 +0100 Subject: [PATCH] [DivaMovie] Option to disable PRINT --- source-code/source/plugins/DivaMovie/dllmain.cpp | 4 +++- source-code/source/plugins/DivaMovie/framework.h | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/source-code/source/plugins/DivaMovie/dllmain.cpp b/source-code/source/plugins/DivaMovie/dllmain.cpp index 3258ae5..ed516fa 100644 --- a/source-code/source/plugins/DivaMovie/dllmain.cpp +++ b/source-code/source/plugins/DivaMovie/dllmain.cpp @@ -11,7 +11,7 @@ #include #include -bool forceSoftwareDecoding; +bool forceSoftwareDecoding = false, debug = false; IDirect3DDeviceManager9* deviceManager; @@ -177,6 +177,7 @@ HOOK(HRESULT, DXVA2CreateDirect3DDeviceManager, PROC_ADDRESS("dxva2.dll", "DXVA2 void loadConfig() { forceSoftwareDecoding = GetPrivateProfileIntW(L"general", L"force_software_decoding", 0, CONFIG_FILE) > 0 ? true : false; + debug = GetPrivateProfileIntW(L"general", L"debug", 0, CONFIG_FILE) > 0 ? true : false; } BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) @@ -193,6 +194,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv PluginConfig::PluginConfigOption config[] = { { PluginConfig::CONFIG_BOOLEAN, new PluginConfig::PluginConfigBooleanData{ L"force_software_decoding", L"general", CONFIG_FILE, L"Force Software Decoding", L"Use software decoding even on systems that support DXVA hardware decoding.", false } }, + { PluginConfig::CONFIG_BOOLEAN, new PluginConfig::PluginConfigBooleanData{ L"debug", L"general", CONFIG_FILE, L"Debug", L"Enable PRINT (possibly at the cost of performance).", false } }, }; extern "C" __declspec(dllexport) LPCWSTR GetPluginName(void) diff --git a/source-code/source/plugins/DivaMovie/framework.h b/source-code/source/plugins/DivaMovie/framework.h index 5df672d..076522b 100644 --- a/source-code/source/plugins/DivaMovie/framework.h +++ b/source-code/source/plugins/DivaMovie/framework.h @@ -22,11 +22,7 @@ std::wstring DirPath() { std::wstring CONFIG_FILE_STRING = DirPath() + L"\\plugins\\DivaMovie.ini"; LPCWSTR CONFIG_FILE = CONFIG_FILE_STRING.c_str(); -//#if _DEBUG -#define PRINT(value, ...) printf(value, __VA_ARGS__); -//#else -//#define PRINT(value, ...) -//#endif +#define PRINT(value, ...) if (debug) printf(value, __VA_ARGS__); #define PROC_ADDRESS(libraryName, procName) \ GetProcAddress(LoadLibrary(TEXT(libraryName)), procName)