diff --git a/d3d9ex/AutoFix.cpp b/d3d9ex/AutoFix.cpp index 9dc3b24..7e37c00 100644 --- a/d3d9ex/AutoFix.cpp +++ b/d3d9ex/AutoFix.cpp @@ -1,79 +1,79 @@ -#include "stdafx.h" - -#include "Context.h" - -void MainContext::EnableAutoFix() -{ - std::string exe_name = ModuleNameA(NULL); - std::transform(exe_name.begin(), exe_name.end(), exe_name.begin(), std::tolower); - - if (exe_name == "game.exe" || exe_name == "game.dat") - { - autofix = RESIDENT_EVIL_4; - PrintLog("AutoFix for \"Resident Evil 4\" enabled"); - } - - if (exe_name == "kb.exe") - { - autofix = KINGS_BOUNTY_LEGEND; - PrintLog("AutoFix for \"Kings Bounty: Legend\" enabled"); - } - - if (exe_name == "ffxiiiimg.exe") - { - autofix = FINAL_FANTASY_XIII; - PrintLog("AutoFix for \"Final Fantasy XIII\" enabled"); - } -} - -const std::map MainContext::behaviorflags_fixes = -{ - { RESIDENT_EVIL_4, D3DCREATE_SOFTWARE_VERTEXPROCESSING }, - { KINGS_BOUNTY_LEGEND, D3DCREATE_MIXED_VERTEXPROCESSING }, -}; - -void MainContext::FixBehaviorFlagConflict(const DWORD flags_in, DWORD* flags_out) -{ - if (flags_in & D3DCREATE_SOFTWARE_VERTEXPROCESSING) - { - *flags_out &= ~(D3DCREATE_PUREDEVICE | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MIXED_VERTEXPROCESSING); - *flags_out |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; - } - else if (flags_in & D3DCREATE_MIXED_VERTEXPROCESSING) - { - *flags_out &= ~(D3DCREATE_PUREDEVICE | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING); - *flags_out |= D3DCREATE_MIXED_VERTEXPROCESSING; - } - else if (flags_in & D3DCREATE_HARDWARE_VERTEXPROCESSING) - { - *flags_out &= ~(D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING); - *flags_out |= D3DCREATE_HARDWARE_VERTEXPROCESSING; - } -} - -bool MainContext::ApplyBehaviorFlagsFix(DWORD* flags) -{ - if (AutoFixes::NONE) return false; - - auto && fix = behaviorflags_fixes.find(autofix); - if (fix != behaviorflags_fixes.end()) - { - FixBehaviorFlagConflict(fix->second, flags); - return true; - } - - return false; -} - -bool MainContext::ApplyVertexBufferFix(UINT& Length, DWORD& Usage, DWORD& FVF, D3DPOOL& Pool) -{ - if (AutoFixes::NONE) return false; - - // Final Fantasy XIII - if (autofix == FINAL_FANTASY_XIII) - { - if (Length == 358400 && FVF == 0 && Pool == D3DPOOL_MANAGED) { Usage = D3DUSAGE_DYNAMIC; Pool = D3DPOOL_DEFAULT; } - return true; - } - return false; +#include "stdafx.h" + +#include "Context.h" + +void MainContext::EnableAutoFix() +{ + std::string exe_name = ModuleNameA(NULL); + std::transform(exe_name.begin(), exe_name.end(), exe_name.begin(), std::tolower); + + if (exe_name == "game.exe" || exe_name == "game.dat") + { + autofix = RESIDENT_EVIL_4; + PrintLog("AutoFix for \"Resident Evil 4\" enabled"); + } + + if (exe_name == "kb.exe") + { + autofix = KINGS_BOUNTY_LEGEND; + PrintLog("AutoFix for \"Kings Bounty: Legend\" enabled"); + } + + if (exe_name == "ffxiiiimg.exe") + { + autofix = FINAL_FANTASY_XIII; + PrintLog("AutoFix for \"Final Fantasy XIII\" enabled"); + } +} + +const std::map MainContext::behaviorflags_fixes = +{ + { RESIDENT_EVIL_4, D3DCREATE_SOFTWARE_VERTEXPROCESSING }, + { KINGS_BOUNTY_LEGEND, D3DCREATE_MIXED_VERTEXPROCESSING }, +}; + +void MainContext::FixBehaviorFlagConflict(const DWORD flags_in, DWORD* flags_out) +{ + if (flags_in & D3DCREATE_SOFTWARE_VERTEXPROCESSING) + { + *flags_out &= ~(D3DCREATE_PUREDEVICE | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MIXED_VERTEXPROCESSING); + *flags_out |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; + } + else if (flags_in & D3DCREATE_MIXED_VERTEXPROCESSING) + { + *flags_out &= ~(D3DCREATE_PUREDEVICE | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING); + *flags_out |= D3DCREATE_MIXED_VERTEXPROCESSING; + } + else if (flags_in & D3DCREATE_HARDWARE_VERTEXPROCESSING) + { + *flags_out &= ~(D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING); + *flags_out |= D3DCREATE_HARDWARE_VERTEXPROCESSING; + } +} + +bool MainContext::ApplyBehaviorFlagsFix(DWORD* flags) +{ + if (autofix == AutoFixes::NONE) return false; + + auto && fix = behaviorflags_fixes.find(autofix); + if (fix != behaviorflags_fixes.end()) + { + FixBehaviorFlagConflict(fix->second, flags); + return true; + } + + return false; +} + +bool MainContext::ApplyVertexBufferFix(UINT& Length, DWORD& Usage, DWORD& FVF, D3DPOOL& Pool) +{ + if (autofix == AutoFixes::NONE) return false; + + // Final Fantasy XIII + if (autofix == FINAL_FANTASY_XIII) + { + if (Length == 358400 && FVF == 0 && Pool == D3DPOOL_MANAGED) { Usage = D3DUSAGE_DYNAMIC; Pool = D3DPOOL_DEFAULT; } + return true; + } + return false; } \ No newline at end of file diff --git a/d3d9ex/Context.cpp b/d3d9ex/Context.cpp index bfa0d5c..571987a 100644 --- a/d3d9ex/Context.cpp +++ b/d3d9ex/Context.cpp @@ -1,303 +1,303 @@ -#include "stdafx.h" - -#include "Wrapper.h" - -#include "Context.h" -#include "IDirect3D9.h" - -MainContext context; - -Config::Config() -{ - std::string inifile = FullPathFromPath(inifilename); - - CSimpleIniW ini; - ini.LoadFile(inifile.c_str()); - - u32 config_version = ini.GetLongValue(L"Version", L"Config"); - if (config_version != CONFIG_VERSION) - { - // save file and reload - ini.Reset(); - -#define SETTING(_type, _func, _var, _section, _defaultval) \ - ini.Set##_func(L#_section, L#_var, _defaultval) -#include "Settings.h" -#undef SETTING - - ini.SetLongValue(L"Version", L"Config", CONFIG_VERSION); - ini.SaveFile(inifile.c_str()); - ini.Reset(); - ini.LoadFile(inifile.c_str()); - } - -#define SETTING(_type, _func, _var, _section, _defaultval) \ - _var = ini.Get##_func(L#_section, L#_var) -#include "Settings.h" -#undef SETTING -} - -MainContext::MainContext() -{ - LogFile("OneTweakNG.log"); - - if(config.GetAutoFix()) EnableAutoFix(); - - MH_Initialize(); - - MH_CreateHook(D3D9DLL::Get().Direct3DCreate9, HookDirect3DCreate9, reinterpret_cast(&TrueDirect3DCreate9)); - MH_EnableHook(D3D9DLL::Get().Direct3DCreate9); - - MH_CreateHook(CreateWindowExA, HookCreateWindowExA, reinterpret_cast(&TrueCreateWindowExA)); - MH_EnableHook(CreateWindowExA); - - MH_CreateHook(CreateWindowExW, HookCreateWindowExW, reinterpret_cast(&TrueCreateWindowExW)); - MH_EnableHook(CreateWindowExW); - - MH_CreateHook(SetWindowLongA, HookSetWindowLongA, reinterpret_cast(&TrueSetWindowLongA)); - MH_EnableHook(SetWindowLongA); - - MH_CreateHook(SetWindowLongW, HookSetWindowLongW, reinterpret_cast(&TrueSetWindowLongW)); - MH_EnableHook(SetWindowLongW); -} - -MainContext::~MainContext() -{ - while (::ShowCursor(TRUE) <= 0); -} - -IDirect3D9 * WINAPI MainContext::HookDirect3DCreate9(UINT SDKVersion) -{ - IDirect3D9* d3d9 = context.TrueDirect3DCreate9(SDKVersion); - if (d3d9) - { - return new hkIDirect3D9(d3d9); - } - - return d3d9; -} - -bool MainContext::BehaviorFlagsToString(DWORD BehaviorFlags, std::string* BehaviorFlagsString) -{ -#define BF2STR(x) if (BehaviorFlags & x) BehaviorFlagsString->append(#x" "); - - BF2STR(D3DCREATE_ADAPTERGROUP_DEVICE); - BF2STR(D3DCREATE_DISABLE_DRIVER_MANAGEMENT); - BF2STR(D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX); - BF2STR(D3DCREATE_DISABLE_PRINTSCREEN); - BF2STR(D3DCREATE_DISABLE_PSGP_THREADING); - BF2STR(D3DCREATE_ENABLE_PRESENTSTATS); - BF2STR(D3DCREATE_FPU_PRESERVE); - BF2STR(D3DCREATE_HARDWARE_VERTEXPROCESSING); - BF2STR(D3DCREATE_MIXED_VERTEXPROCESSING); - BF2STR(D3DCREATE_SOFTWARE_VERTEXPROCESSING); - BF2STR(D3DCREATE_MULTITHREADED); - BF2STR(D3DCREATE_NOWINDOWCHANGES); - BF2STR(D3DCREATE_PUREDEVICE); - BF2STR(D3DCREATE_SCREENSAVER); - -#undef BF2STR - - if (BehaviorFlagsString->back() == ' ') - BehaviorFlagsString->pop_back(); - - return false; -} - -bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentationParameters) -{ - if (pPresentationParameters) - { - if (config.GetTrippleBuffering()) - { - pPresentationParameters->BackBufferCount = 3; - } - - if (config.GetMultisample() > 0) - { - pPresentationParameters->SwapEffect = D3DSWAPEFFECT_DISCARD; - pPresentationParameters->MultiSampleType = (D3DMULTISAMPLE_TYPE)config.GetMultisample(); - pPresentationParameters->MultiSampleQuality = 0; - - PrintLog("MultiSampleType %u, MultiSampleQuality %u", pPresentationParameters->MultiSampleType, pPresentationParameters->MultiSampleQuality); - } - - if (config.GetPresentationInterval() != -1) - { - pPresentationParameters->PresentationInterval = config.GetPresentationInterval(); - PrintLog("PresentationInterval: PresentationInterval set to %u", pPresentationParameters->PresentationInterval); - } - - if (config.GetBorderless()) - { - SetWindowPos(pPresentationParameters->hDeviceWindow, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING); - - if (config.GetForceWindowedMode()) - { - pPresentationParameters->SwapEffect = D3DSWAPEFFECT_FLIP; - pPresentationParameters->Windowed = TRUE; - pPresentationParameters->FullScreen_RefreshRateInHz = 0; - } - PrintLog("ForceWindowedMode: Windowed set to TRUE"); - } - - if (config.GetHideCursor()) while (::ShowCursor(FALSE) >= 0); // ShowCursor < 0 -> hidden - - return true; - } - return false; -} - -bool MainContext::CheckWindow(HWND hWnd) -{ - std::unique_ptr className(new wchar_t[MAX_PATH]); - std::unique_ptr windowName(new wchar_t[MAX_PATH]); - - GetClassNameW(hWnd, className.get(), MAX_PATH); - GetWindowTextW(hWnd, windowName.get(), MAX_PATH); - - PrintLog("HWND 0x%p: ClassName \"%ls\", WindowName: \"%ls\"", hWnd, className.get(), windowName.get()); - - bool classname = config.GetWindowClass().compare(className.get()) == 0; - bool windowname = config.GetWindowName().compare(windowName.get()) == 0; - bool always = config.GetAllWindows(); - - return classname || windowname || always; -} - -void MainContext::ApplyWndProc(HWND hWnd) -{ - if (config.GetAlwaysActive()) - { - context.oldWndProc = (WNDPROC)context.TrueSetWindowLongA(hWnd, GWLP_WNDPROC, (LONG_PTR)context.WindowProc); - } -} - -void MainContext::ApplyBorderless(HWND hWnd) -{ - if (config.GetBorderless()) - { - LONG_PTR dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE); - LONG_PTR dwExStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE); - - DWORD new_dwStyle = dwStyle & ~WS_OVERLAPPEDWINDOW; - DWORD new_dwExStyle = dwExStyle & ~(WS_EX_OVERLAPPEDWINDOW | WS_EX_TOPMOST); - - context.TrueSetWindowLongW(hWnd, GWL_STYLE, new_dwStyle); - context.TrueSetWindowLongW(hWnd, GWL_EXSTYLE, new_dwExStyle); - - int cx = GetSystemMetrics(SM_CXSCREEN); - int cy = GetSystemMetrics(SM_CYSCREEN); - - SetWindowPos(hWnd, HWND_TOP, 0, 0, cx, cy, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); - - PrintLog("HWND 0x%p: Borderless dwStyle: %lX->%lX", hWnd, dwStyle, new_dwStyle); - PrintLog("HWND 0x%p: Borderless dwExStyle: %lX->%lX", hWnd, dwExStyle, new_dwExStyle); - MessageBeep(MB_ICONASTERISK); - } -} - -LRESULT CALLBACK MainContext::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uMsg) - { - - case WM_ACTIVATE: - switch (LOWORD(wParam)) - { - case WA_ACTIVE: - case WA_CLICKACTIVE: - while (::ShowCursor(FALSE) >= 0); - break; - - case WA_INACTIVE: - if (context.config.GetAlwaysActive()) - return TRUE; - - while (::ShowCursor(TRUE) < 0); - break; - } - - case WM_ACTIVATEAPP: - if (context.config.GetAlwaysActive()) - return TRUE; - - } - return CallWindowProc(context.oldWndProc, hWnd, uMsg, wParam, lParam); -} - -LONG WINAPI MainContext::HookSetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong) -{ - if (context.config.GetBorderless()) - { - DWORD olddwNewLong = dwNewLong; - if (nIndex == GWL_STYLE) - { - dwNewLong &= ~WS_OVERLAPPEDWINDOW; - PrintLog("SetWindowLongA dwStyle: %lX->%lX", olddwNewLong, dwNewLong); - } - - if (nIndex == GWL_EXSTYLE) - { - dwNewLong &= ~(WS_EX_OVERLAPPEDWINDOW | WS_EX_TOPMOST); - PrintLog("SetWindowLongA dwExStyle: %lX->%lX", olddwNewLong, dwNewLong); - } - } - return context.TrueSetWindowLongA(hWnd, nIndex, dwNewLong); -} - -LONG WINAPI MainContext::HookSetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong) -{ - if (context.config.GetBorderless()) - { - DWORD olddwNewLong = dwNewLong; - if (nIndex == GWL_STYLE) - { - dwNewLong &= ~WS_OVERLAPPEDWINDOW; - PrintLog("SetWindowLongW dwStyle: %lX->%lX", olddwNewLong, dwNewLong); - } - - if (nIndex == GWL_EXSTYLE) - { - dwNewLong &= ~(WS_EX_OVERLAPPEDWINDOW | WS_EX_TOPMOST); - PrintLog("SetWindowLongW dwExStyle: %lX->%lX", olddwNewLong, dwNewLong); - } - } - return context.TrueSetWindowLongW(hWnd, nIndex, dwNewLong); -} - -HWND WINAPI MainContext::HookCreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) -{ - HWND hWnd = context.TrueCreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); - if (!hWnd) - { - PrintLog("CreateWindowExA failed"); - return hWnd; - } - - if (context.CheckWindow(hWnd)) - { - context.ApplyWndProc(hWnd); - context.ApplyBorderless(hWnd); - } - - return hWnd; -} - -HWND WINAPI MainContext::HookCreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) -{ - HWND hWnd = context.TrueCreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); - if (!hWnd) - { - PrintLog("CreateWindowExW failed"); - return hWnd; - } - - if (context.CheckWindow(hWnd)) - { - context.ApplyWndProc(hWnd); - context.ApplyBorderless(hWnd); - } - - return hWnd; -} +#include "stdafx.h" + +#include "Wrapper.h" + +#include "Context.h" +#include "IDirect3D9.h" + +MainContext context; + +Config::Config() +{ + std::string inifile = FullPathFromPath(inifilename); + + CSimpleIniW ini; + ini.LoadFile(inifile.c_str()); + + u32 config_version = ini.GetLongValue(L"Version", L"Config"); + if (config_version != CONFIG_VERSION) + { + // save file and reload + ini.Reset(); + +#define SETTING(_type, _func, _var, _section, _defaultval) \ + ini.Set##_func(L#_section, L#_var, _defaultval) +#include "Settings.h" +#undef SETTING + + ini.SetLongValue(L"Version", L"Config", CONFIG_VERSION); + ini.SaveFile(inifile.c_str()); + ini.Reset(); + ini.LoadFile(inifile.c_str()); + } + +#define SETTING(_type, _func, _var, _section, _defaultval) \ + _var = ini.Get##_func(L#_section, L#_var) +#include "Settings.h" +#undef SETTING +} + +MainContext::MainContext() +{ + LogFile("OneTweakNG.log"); + + if(config.GetAutoFix()) EnableAutoFix(); + + MH_Initialize(); + + MH_CreateHook(D3D9DLL::Get().Direct3DCreate9, HookDirect3DCreate9, reinterpret_cast(&TrueDirect3DCreate9)); + MH_EnableHook(D3D9DLL::Get().Direct3DCreate9); + + MH_CreateHook(CreateWindowExA, HookCreateWindowExA, reinterpret_cast(&TrueCreateWindowExA)); + MH_EnableHook(CreateWindowExA); + + MH_CreateHook(CreateWindowExW, HookCreateWindowExW, reinterpret_cast(&TrueCreateWindowExW)); + MH_EnableHook(CreateWindowExW); + + MH_CreateHook(SetWindowLongA, HookSetWindowLongA, reinterpret_cast(&TrueSetWindowLongA)); + MH_EnableHook(SetWindowLongA); + + MH_CreateHook(SetWindowLongW, HookSetWindowLongW, reinterpret_cast(&TrueSetWindowLongW)); + MH_EnableHook(SetWindowLongW); +} + +MainContext::~MainContext() +{ + while (::ShowCursor(TRUE) <= 0); +} + +IDirect3D9 * WINAPI MainContext::HookDirect3DCreate9(UINT SDKVersion) +{ + IDirect3D9* d3d9 = context.TrueDirect3DCreate9(SDKVersion); + if (d3d9) + { + return new hkIDirect3D9(d3d9); + } + + return d3d9; +} + +bool MainContext::BehaviorFlagsToString(DWORD BehaviorFlags, std::string* BehaviorFlagsString) +{ +#define BF2STR(x) if (BehaviorFlags & x) BehaviorFlagsString->append(#x" "); + + BF2STR(D3DCREATE_ADAPTERGROUP_DEVICE); + BF2STR(D3DCREATE_DISABLE_DRIVER_MANAGEMENT); + BF2STR(D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX); + BF2STR(D3DCREATE_DISABLE_PRINTSCREEN); + BF2STR(D3DCREATE_DISABLE_PSGP_THREADING); + BF2STR(D3DCREATE_ENABLE_PRESENTSTATS); + BF2STR(D3DCREATE_FPU_PRESERVE); + BF2STR(D3DCREATE_HARDWARE_VERTEXPROCESSING); + BF2STR(D3DCREATE_MIXED_VERTEXPROCESSING); + BF2STR(D3DCREATE_SOFTWARE_VERTEXPROCESSING); + BF2STR(D3DCREATE_MULTITHREADED); + BF2STR(D3DCREATE_NOWINDOWCHANGES); + BF2STR(D3DCREATE_PUREDEVICE); + BF2STR(D3DCREATE_SCREENSAVER); + +#undef BF2STR + + if (BehaviorFlagsString->back() == ' ') + BehaviorFlagsString->pop_back(); + + return false; +} + +bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentationParameters) +{ + if (pPresentationParameters) + { + if (config.GetTrippleBuffering()) + { + pPresentationParameters->BackBufferCount = 3; + } + + if (config.GetMultisample() > 0) + { + pPresentationParameters->SwapEffect = D3DSWAPEFFECT_DISCARD; + pPresentationParameters->MultiSampleType = (D3DMULTISAMPLE_TYPE)config.GetMultisample(); + pPresentationParameters->MultiSampleQuality = 0; + + PrintLog("MultiSampleType %u, MultiSampleQuality %u", pPresentationParameters->MultiSampleType, pPresentationParameters->MultiSampleQuality); + } + + if (config.GetPresentationInterval() != -1) + { + pPresentationParameters->PresentationInterval = config.GetPresentationInterval(); + PrintLog("PresentationInterval: PresentationInterval set to %u", pPresentationParameters->PresentationInterval); + } + + if (config.GetBorderless()) + { + SetWindowPos(pPresentationParameters->hDeviceWindow, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING); + + if (config.GetForceWindowedMode()) + { + pPresentationParameters->SwapEffect = D3DSWAPEFFECT_FLIP; + pPresentationParameters->Windowed = TRUE; + pPresentationParameters->FullScreen_RefreshRateInHz = 0; + } + PrintLog("ForceWindowedMode: Windowed set to TRUE"); + } + + if (config.GetHideCursor()) while (::ShowCursor(FALSE) >= 0); // ShowCursor < 0 -> hidden + + return true; + } + return false; +} + +bool MainContext::CheckWindow(HWND hWnd) +{ + std::unique_ptr className(new wchar_t[MAX_PATH]); + std::unique_ptr windowName(new wchar_t[MAX_PATH]); + + GetClassNameW(hWnd, className.get(), MAX_PATH); + GetWindowTextW(hWnd, windowName.get(), MAX_PATH); + + PrintLog("HWND 0x%p: ClassName \"%ls\", WindowName: \"%ls\"", hWnd, className.get(), windowName.get()); + + bool classname = config.GetWindowClass().compare(className.get()) == 0; + bool windowname = config.GetWindowName().compare(windowName.get()) == 0; + bool always = config.GetAllWindows(); + + return classname || windowname || always; +} + +void MainContext::ApplyWndProc(HWND hWnd) +{ + if (config.GetAlwaysActive()) + { + context.oldWndProc = (WNDPROC)context.TrueSetWindowLongA(hWnd, GWLP_WNDPROC, (LONG_PTR)context.WindowProc); + } +} + +void MainContext::ApplyBorderless(HWND hWnd) +{ + if (config.GetBorderless()) + { + LONG_PTR dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE); + LONG_PTR dwExStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE); + + DWORD new_dwStyle = dwStyle & ~WS_OVERLAPPEDWINDOW; + DWORD new_dwExStyle = dwExStyle & ~(WS_EX_OVERLAPPEDWINDOW | WS_EX_TOPMOST); + + context.TrueSetWindowLongW(hWnd, GWL_STYLE, new_dwStyle); + context.TrueSetWindowLongW(hWnd, GWL_EXSTYLE, new_dwExStyle); + + int cx = GetSystemMetrics(SM_CXSCREEN); + int cy = GetSystemMetrics(SM_CYSCREEN); + + SetWindowPos(hWnd, HWND_TOP, 0, 0, cx, cy, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); + + PrintLog("HWND 0x%p: Borderless dwStyle: %lX->%lX", hWnd, dwStyle, new_dwStyle); + PrintLog("HWND 0x%p: Borderless dwExStyle: %lX->%lX", hWnd, dwExStyle, new_dwExStyle); + MessageBeep(MB_ICONASTERISK); + } +} + +LRESULT CALLBACK MainContext::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + + case WM_ACTIVATE: + switch (LOWORD(wParam)) + { + case WA_ACTIVE: + case WA_CLICKACTIVE: + while (::ShowCursor(FALSE) >= 0); + break; + + case WA_INACTIVE: + if (context.config.GetAlwaysActive()) + return TRUE; + + while (::ShowCursor(TRUE) < 0); + break; + } + + case WM_ACTIVATEAPP: + if (context.config.GetAlwaysActive()) + return TRUE; + + } + return CallWindowProc(context.oldWndProc, hWnd, uMsg, wParam, lParam); +} + +LONG WINAPI MainContext::HookSetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong) +{ + if (context.config.GetBorderless()) + { + DWORD olddwNewLong = dwNewLong; + if (nIndex == GWL_STYLE) + { + dwNewLong &= ~WS_OVERLAPPEDWINDOW; + PrintLog("SetWindowLongA dwStyle: %lX->%lX", olddwNewLong, dwNewLong); + } + + if (nIndex == GWL_EXSTYLE) + { + dwNewLong &= ~(WS_EX_OVERLAPPEDWINDOW | WS_EX_TOPMOST); + PrintLog("SetWindowLongA dwExStyle: %lX->%lX", olddwNewLong, dwNewLong); + } + } + return context.TrueSetWindowLongA(hWnd, nIndex, dwNewLong); +} + +LONG WINAPI MainContext::HookSetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong) +{ + if (context.config.GetBorderless()) + { + DWORD olddwNewLong = dwNewLong; + if (nIndex == GWL_STYLE) + { + dwNewLong &= ~WS_OVERLAPPEDWINDOW; + PrintLog("SetWindowLongW dwStyle: %lX->%lX", olddwNewLong, dwNewLong); + } + + if (nIndex == GWL_EXSTYLE) + { + dwNewLong &= ~(WS_EX_OVERLAPPEDWINDOW | WS_EX_TOPMOST); + PrintLog("SetWindowLongW dwExStyle: %lX->%lX", olddwNewLong, dwNewLong); + } + } + return context.TrueSetWindowLongW(hWnd, nIndex, dwNewLong); +} + +HWND WINAPI MainContext::HookCreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) +{ + HWND hWnd = context.TrueCreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); + if (!hWnd) + { + PrintLog("CreateWindowExA failed"); + return hWnd; + } + + if (context.CheckWindow(hWnd)) + { + context.ApplyWndProc(hWnd); + context.ApplyBorderless(hWnd); + } + + return hWnd; +} + +HWND WINAPI MainContext::HookCreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) +{ + HWND hWnd = context.TrueCreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); + if (!hWnd) + { + PrintLog("CreateWindowExW failed"); + return hWnd; + } + + if (context.CheckWindow(hWnd)) + { + context.ApplyWndProc(hWnd); + context.ApplyBorderless(hWnd); + } + + return hWnd; +} diff --git a/d3d9ex/IDirect3D9.cpp b/d3d9ex/IDirect3D9.cpp index 6160031..f04e21a 100644 --- a/d3d9ex/IDirect3D9.cpp +++ b/d3d9ex/IDirect3D9.cpp @@ -1,148 +1,148 @@ -// wrapper for IDirect3D9 in d3d9.h -// generated using wrapper_gen.rb - -#include "stdafx.h" -#include "Context.h" - -#include "IDirect3D9.h" -#include "IDirect3DDevice9.h" - -#define IDirect3D9_PrintLog(format, ...) //PrintLog(format, __VA_ARGS__); - -hkIDirect3D9::hkIDirect3D9(IDirect3D9 *pIDirect3D9) { - PrintLog(__FUNCTION__); - m_pWrapped = pIDirect3D9; -} - -hkIDirect3D9::~hkIDirect3D9() -{ - PrintLog(__FUNCTION__); -} - -HRESULT APIENTRY hkIDirect3D9::QueryInterface(REFIID riid, void** ppvObj) { - PrintLog(__FUNCTION__); - return m_pWrapped->QueryInterface(riid, ppvObj); -} - -ULONG APIENTRY hkIDirect3D9::AddRef() { - PrintLog(__FUNCTION__); - return m_pWrapped->AddRef(); -} - -ULONG APIENTRY hkIDirect3D9::Release() { - ULONG ref_count = m_pWrapped->Release(); - PrintLog(__FUNCTION__ " return = %lu", ref_count); - if (ref_count == 0) delete this; - return ref_count; -} - -HRESULT APIENTRY hkIDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->RegisterSoftwareDevice(pInitializeFunction); -} - -UINT APIENTRY hkIDirect3D9::GetAdapterCount() { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->GetAdapterCount(); -} - -HRESULT APIENTRY hkIDirect3D9::GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) { - PrintLog(__FUNCTION__); - HRESULT rt = m_pWrapped->GetAdapterIdentifier(Adapter, Flags, pIdentifier); - if (context.config.GetAdapter() && SUCCEEDED(rt) && pIdentifier) - { - pIdentifier->VendorId = context.config.GetVendorId(); - pIdentifier->DeviceId = context.config.GetDeviceId(); - } - - return rt; -} - -UINT APIENTRY hkIDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->GetAdapterModeCount(Adapter, Format); -} - -HRESULT APIENTRY hkIDirect3D9::EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->EnumAdapterModes(Adapter, Format, Mode, pMode); -} - -HRESULT APIENTRY hkIDirect3D9::GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->GetAdapterDisplayMode(Adapter, pMode); -} - -HRESULT APIENTRY hkIDirect3D9::CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed) { - IDirect3D9_PrintLog(__FUNCTION__); - if (context.config.GetForceWindowedMode()) bWindowed = TRUE; - return m_pWrapped->CheckDeviceType(Adapter, DevType, AdapterFormat, BackBufferFormat, bWindowed); -} - -HRESULT APIENTRY hkIDirect3D9::CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->CheckDeviceFormat(Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat); -} - -HRESULT APIENTRY hkIDirect3D9::CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->CheckDeviceMultiSampleType(Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels); -} - -HRESULT APIENTRY hkIDirect3D9::CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->CheckDepthStencilMatch(Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat); -} - -HRESULT APIENTRY hkIDirect3D9::CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->CheckDeviceFormatConversion(Adapter, DeviceType, SourceFormat, TargetFormat); -} - -HRESULT APIENTRY hkIDirect3D9::GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->GetDeviceCaps(Adapter, DeviceType, pCaps); -} - -HMONITOR APIENTRY hkIDirect3D9::GetAdapterMonitor(UINT Adapter) { - IDirect3D9_PrintLog(__FUNCTION__); - return m_pWrapped->GetAdapterMonitor(Adapter); -} - -HRESULT APIENTRY hkIDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface) { - PrintLog(__FUNCTION__); - - DWORD OriginalBehaviorFlags = BehaviorFlags; - std::string BehaviorFlagsString; - context.BehaviorFlagsToString(BehaviorFlags, &BehaviorFlagsString); - - PrintLog("BehaviorFlags: %08X %s", BehaviorFlags, BehaviorFlagsString.c_str()); - - if (context.config.GetBehaviorFlags() > 0) - { - BehaviorFlags = context.config.GetBehaviorFlags(); - PrintLog("Advanced Mode: BehaviorFlags set"); - } - else - { - context.ApplyBehaviorFlagsFix(&BehaviorFlags); - } - - if (hFocusWindow == NULL) hFocusWindow = pPresentationParameters->hDeviceWindow; - context.ApplyPresentationParameters(pPresentationParameters); - - HRESULT hr = m_pWrapped->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); - if (SUCCEEDED(hr) && ppReturnedDeviceInterface && *ppReturnedDeviceInterface) - { - hkIDirect3DDevice9* pIDirect3DDevice9 = new hkIDirect3DDevice9(*ppReturnedDeviceInterface); - *ppReturnedDeviceInterface = pIDirect3DDevice9; - } - - if (OriginalBehaviorFlags != BehaviorFlags) - { - std::string BehaviorFlagsString; - context.BehaviorFlagsToString(BehaviorFlags, &BehaviorFlagsString); - PrintLog("BehaviorFlags changed: %08X %s", BehaviorFlags, BehaviorFlagsString.c_str()); - } - return hr; -} +// wrapper for IDirect3D9 in d3d9.h +// generated using wrapper_gen.rb + +#include "stdafx.h" +#include "Context.h" + +#include "IDirect3D9.h" +#include "IDirect3DDevice9.h" + +#define IDirect3D9_PrintLog(format, ...) //PrintLog(format, __VA_ARGS__); + +hkIDirect3D9::hkIDirect3D9(IDirect3D9 *pIDirect3D9) { + PrintLog(__FUNCTION__); + m_pWrapped = pIDirect3D9; +} + +hkIDirect3D9::~hkIDirect3D9() +{ + PrintLog(__FUNCTION__); +} + +HRESULT APIENTRY hkIDirect3D9::QueryInterface(REFIID riid, void** ppvObj) { + PrintLog(__FUNCTION__); + return m_pWrapped->QueryInterface(riid, ppvObj); +} + +ULONG APIENTRY hkIDirect3D9::AddRef() { + PrintLog(__FUNCTION__); + return m_pWrapped->AddRef(); +} + +ULONG APIENTRY hkIDirect3D9::Release() { + ULONG ref_count = m_pWrapped->Release(); + PrintLog(__FUNCTION__ " return = %lu", ref_count); + if (ref_count == 0) delete this; + return ref_count; +} + +HRESULT APIENTRY hkIDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->RegisterSoftwareDevice(pInitializeFunction); +} + +UINT APIENTRY hkIDirect3D9::GetAdapterCount() { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->GetAdapterCount(); +} + +HRESULT APIENTRY hkIDirect3D9::GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) { + PrintLog(__FUNCTION__); + HRESULT rt = m_pWrapped->GetAdapterIdentifier(Adapter, Flags, pIdentifier); + if (context.config.GetAdapter() && SUCCEEDED(rt) && pIdentifier) + { + pIdentifier->VendorId = context.config.GetVendorId(); + pIdentifier->DeviceId = context.config.GetDeviceId(); + } + + return rt; +} + +UINT APIENTRY hkIDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->GetAdapterModeCount(Adapter, Format); +} + +HRESULT APIENTRY hkIDirect3D9::EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->EnumAdapterModes(Adapter, Format, Mode, pMode); +} + +HRESULT APIENTRY hkIDirect3D9::GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->GetAdapterDisplayMode(Adapter, pMode); +} + +HRESULT APIENTRY hkIDirect3D9::CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed) { + IDirect3D9_PrintLog(__FUNCTION__); + if (context.config.GetForceWindowedMode()) bWindowed = TRUE; + return m_pWrapped->CheckDeviceType(Adapter, DevType, AdapterFormat, BackBufferFormat, bWindowed); +} + +HRESULT APIENTRY hkIDirect3D9::CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->CheckDeviceFormat(Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat); +} + +HRESULT APIENTRY hkIDirect3D9::CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->CheckDeviceMultiSampleType(Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels); +} + +HRESULT APIENTRY hkIDirect3D9::CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->CheckDepthStencilMatch(Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat); +} + +HRESULT APIENTRY hkIDirect3D9::CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->CheckDeviceFormatConversion(Adapter, DeviceType, SourceFormat, TargetFormat); +} + +HRESULT APIENTRY hkIDirect3D9::GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->GetDeviceCaps(Adapter, DeviceType, pCaps); +} + +HMONITOR APIENTRY hkIDirect3D9::GetAdapterMonitor(UINT Adapter) { + IDirect3D9_PrintLog(__FUNCTION__); + return m_pWrapped->GetAdapterMonitor(Adapter); +} + +HRESULT APIENTRY hkIDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface) { + PrintLog(__FUNCTION__); + + DWORD OriginalBehaviorFlags = BehaviorFlags; + std::string BehaviorFlagsString; + context.BehaviorFlagsToString(BehaviorFlags, &BehaviorFlagsString); + + PrintLog("BehaviorFlags: %08X %s", BehaviorFlags, BehaviorFlagsString.c_str()); + + if (context.config.GetBehaviorFlags() > 0) + { + BehaviorFlags = context.config.GetBehaviorFlags(); + PrintLog("Advanced Mode: BehaviorFlags set"); + } + else + { + context.ApplyBehaviorFlagsFix(&BehaviorFlags); + } + + if (hFocusWindow == NULL) hFocusWindow = pPresentationParameters->hDeviceWindow; + context.ApplyPresentationParameters(pPresentationParameters); + + HRESULT hr = m_pWrapped->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); + if (SUCCEEDED(hr) && ppReturnedDeviceInterface && *ppReturnedDeviceInterface) + { + hkIDirect3DDevice9* pIDirect3DDevice9 = new hkIDirect3DDevice9(*ppReturnedDeviceInterface); + *ppReturnedDeviceInterface = pIDirect3DDevice9; + } + + if (OriginalBehaviorFlags != BehaviorFlags) + { + std::string BehaviorFlagsString; + context.BehaviorFlagsToString(BehaviorFlags, &BehaviorFlagsString); + PrintLog("BehaviorFlags changed: %08X %s", BehaviorFlags, BehaviorFlagsString.c_str()); + } + return hr; +} diff --git a/d3d9ex/IDirect3DDevice9.cpp b/d3d9ex/IDirect3DDevice9.cpp index 53bfb71..2a19676 100644 --- a/d3d9ex/IDirect3DDevice9.cpp +++ b/d3d9ex/IDirect3DDevice9.cpp @@ -1,644 +1,644 @@ -// wrapper for IDirect3DDevice9 in d3d9.h -// generated using wrapper_gen.rb - -#pragma once -#include "stdafx.h" -#include "Context.h" - -#include "IDirect3DDevice9.h" - -#define IDirect3DDevice9_PrintLog(...) //PrintLog(format, __VA_ARGS__); - -hkIDirect3DDevice9::hkIDirect3DDevice9(IDirect3DDevice9 *pIDirect3DDevice9) { - PrintLog(__FUNCTION__); - m_pWrapped = pIDirect3DDevice9; -} - -hkIDirect3DDevice9::~hkIDirect3DDevice9() -{ - PrintLog(__FUNCTION__); -} - -HRESULT APIENTRY hkIDirect3DDevice9::QueryInterface(REFIID riid, void** ppvObj) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->QueryInterface(riid, ppvObj); -} - -ULONG APIENTRY hkIDirect3DDevice9::AddRef() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->AddRef(); -} - -ULONG APIENTRY hkIDirect3DDevice9::Release() { - ULONG ref_count = m_pWrapped->Release(); - PrintLog(__FUNCTION__ " return = %lu", ref_count); - if (ref_count == 0) delete this; - return ref_count; -} - -HRESULT APIENTRY hkIDirect3DDevice9::TestCooperativeLevel() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->TestCooperativeLevel(); -} - -UINT APIENTRY hkIDirect3DDevice9::GetAvailableTextureMem() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetAvailableTextureMem(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::EvictManagedResources() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->EvictManagedResources(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetDirect3D(IDirect3D9** ppD3D9) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetDirect3D(ppD3D9); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetDeviceCaps(D3DCAPS9* pCaps) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetDeviceCaps(pCaps); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetDisplayMode(iSwapChain, pMode); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetCreationParameters(pParameters); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap); -} - -void APIENTRY hkIDirect3DDevice9::SetCursorPosition(int X, int Y, DWORD Flags) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetCursorPosition(X, Y, Flags); -} - -BOOL APIENTRY hkIDirect3DDevice9::ShowCursor(BOOL bShow) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->ShowCursor(bShow); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) { - PrintLog(__FUNCTION__); - context.ApplyPresentationParameters(pPresentationParameters); - return m_pWrapped->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - - // Steam Overlay Fix - // Add some space, 16bytes should be enough - _asm - { - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - nop; - } - - return m_pWrapped->GetSwapChain(iSwapChain, pSwapChain); -} - -UINT APIENTRY hkIDirect3DDevice9::GetNumberOfSwapChains() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetNumberOfSwapChains(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) { - PrintLog("hkIDirect3DDevice9::Reset"); - - context.ApplyPresentationParameters(pPresentationParameters); - return m_pWrapped->Reset(pPresentationParameters); -} - -HRESULT APIENTRY hkIDirect3DDevice9::Present(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetBackBuffer(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetBackBuffer(iSwapChain, iBackBuffer, Type, ppBackBuffer); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetRasterStatus(iSwapChain, pRasterStatus); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetDialogBoxMode(bEnableDialogs); -} - -void APIENTRY hkIDirect3DDevice9::SetGammaRamp(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetGammaRamp(iSwapChain, Flags, pRamp); -} - -void APIENTRY hkIDirect3DDevice9::GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetGammaRamp(iSwapChain, pRamp); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) { - //PrintLog("hkIDirect3DDevice9::CreateVertexBuffer %08u %x %x %x %p %p", Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle); - context.ApplyVertexBufferFix(Length, Usage, FVF, Pool); - return m_pWrapped->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) { - //PrintLog("hkIDirect3DDevice9::CreateIndexBuffer %u %x %x %x %p %p", Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle); - return m_pWrapped->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateRenderTarget(Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateDepthStencilSurface(Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->UpdateSurface(pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint); -} - -HRESULT APIENTRY hkIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->UpdateTexture(pSourceTexture, pDestinationTexture); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetRenderTargetData(pRenderTarget, pDestSurface); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetFrontBufferData(iSwapChain, pDestSurface); -} - -HRESULT APIENTRY hkIDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->StretchRect(pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter); -} - -HRESULT APIENTRY hkIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->ColorFill(pSurface, pRect, color); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateOffscreenPlainSurface(Width, Height, Format, Pool, ppSurface, pSharedHandle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetRenderTarget(RenderTargetIndex, pRenderTarget); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetRenderTarget(RenderTargetIndex, ppRenderTarget); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetDepthStencilSurface(pNewZStencil); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetDepthStencilSurface(ppZStencilSurface); -} - -HRESULT APIENTRY hkIDirect3DDevice9::BeginScene() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->BeginScene(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::EndScene() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->EndScene(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::Clear(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->Clear(Count, pRects, Flags, Color, Z, Stencil); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetTransform(State, pMatrix); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetTransform(State, pMatrix); -} - -HRESULT APIENTRY hkIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->MultiplyTransform(State, pMatrix); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9* pViewport) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetViewport(pViewport); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetViewport(D3DVIEWPORT9* pViewport) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetViewport(pViewport); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9* pMaterial) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetMaterial(pMaterial); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetMaterial(D3DMATERIAL9* pMaterial) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetMaterial(pMaterial); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetLight(DWORD Index, CONST D3DLIGHT9* pLight) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetLight(Index, pLight); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetLight(DWORD Index, D3DLIGHT9* pLight) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetLight(Index, pLight); -} - -HRESULT APIENTRY hkIDirect3DDevice9::LightEnable(DWORD Index, BOOL Enable) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->LightEnable(Index, Enable); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetLightEnable(DWORD Index, BOOL* pEnable) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetLightEnable(Index, pEnable); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetClipPlane(DWORD Index, CONST float* pPlane) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetClipPlane(Index, pPlane); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetClipPlane(DWORD Index, float* pPlane) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetClipPlane(Index, pPlane); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetRenderState(State, Value); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetRenderState(State, pValue); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateStateBlock(Type, ppSB); -} - -HRESULT APIENTRY hkIDirect3DDevice9::BeginStateBlock() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->BeginStateBlock(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->EndStateBlock(ppSB); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetClipStatus(pClipStatus); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9* pClipStatus) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetClipStatus(pClipStatus); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetTexture(DWORD Stage, IDirect3DBaseTexture9** ppTexture) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetTexture(Stage, ppTexture); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetTexture(Stage, pTexture); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetTextureStageState(Stage, Type, pValue); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetTextureStageState(Stage, Type, Value); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetSamplerState(Sampler, Type, pValue); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetSamplerState(Sampler, Type, Value); -} - -HRESULT APIENTRY hkIDirect3DDevice9::ValidateDevice(DWORD* pNumPasses) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->ValidateDevice(pNumPasses); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY* pEntries) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetPaletteEntries(PaletteNumber, pEntries); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetPaletteEntries(PaletteNumber, pEntries); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetCurrentTexturePalette(PaletteNumber); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetCurrentTexturePalette(UINT *PaletteNumber) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetCurrentTexturePalette(PaletteNumber); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetScissorRect(CONST RECT* pRect) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetScissorRect(pRect); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetScissorRect(RECT* pRect) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetScissorRect(pRect); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetSoftwareVertexProcessing(bSoftware); -} - -BOOL APIENTRY hkIDirect3DDevice9::GetSoftwareVertexProcessing() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetSoftwareVertexProcessing(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetNPatchMode(float nSegments) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetNPatchMode(nSegments); -} - -float APIENTRY hkIDirect3DDevice9::GetNPatchMode() { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetNPatchMode(); -} - -HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->DrawIndexedPrimitive(PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride); -} - -HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->DrawIndexedPrimitiveUP(PrimitiveType, MinVertexIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); -} - -HRESULT APIENTRY hkIDirect3DDevice9::ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateVertexDeclaration(pVertexElements, ppDecl); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetVertexDeclaration(pDecl); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetVertexDeclaration(ppDecl); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetFVF(DWORD FVF) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetFVF(FVF); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetFVF(DWORD* pFVF) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetFVF(pFVF); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateVertexShader(pFunction, ppShader); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetVertexShader(pShader); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetVertexShader(ppShader); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetVertexShaderConstantB(StartRegister, pConstantData, BoolCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetVertexShaderConstantB(StartRegister, pConstantData, BoolCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetStreamSource(StreamNumber, pStreamData, OffsetInBytes, Stride); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* pOffsetInBytes, UINT* pStride) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetStreamSource(StreamNumber, ppStreamData, pOffsetInBytes, pStride); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber, UINT Setting) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetStreamSourceFreq(StreamNumber, Setting); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber, UINT* pSetting) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetStreamSourceFreq(StreamNumber, pSetting); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetIndices(pIndexData); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetIndices(ppIndexData); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreatePixelShader(pFunction, ppShader); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetPixelShader(pShader); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetPixelShader(ppShader); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->SetPixelShaderConstantB(StartRegister, pConstantData, BoolCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->GetPixelShaderConstantB(StartRegister, pConstantData, BoolCount); -} - -HRESULT APIENTRY hkIDirect3DDevice9::DrawRectPatch(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo); -} - -HRESULT APIENTRY hkIDirect3DDevice9::DrawTriPatch(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo); -} - -HRESULT APIENTRY hkIDirect3DDevice9::DeletePatch(UINT Handle) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->DeletePatch(Handle); -} - -HRESULT APIENTRY hkIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) { - IDirect3DDevice9_PrintLog(__FUNCTION__); - return m_pWrapped->CreateQuery(Type, ppQuery); -} +// wrapper for IDirect3DDevice9 in d3d9.h +// generated using wrapper_gen.rb + +#pragma once +#include "stdafx.h" +#include "Context.h" + +#include "IDirect3DDevice9.h" + +#define IDirect3DDevice9_PrintLog(...) //PrintLog(format, __VA_ARGS__); + +hkIDirect3DDevice9::hkIDirect3DDevice9(IDirect3DDevice9 *pIDirect3DDevice9) { + PrintLog(__FUNCTION__); + m_pWrapped = pIDirect3DDevice9; +} + +hkIDirect3DDevice9::~hkIDirect3DDevice9() +{ + PrintLog(__FUNCTION__); +} + +HRESULT APIENTRY hkIDirect3DDevice9::QueryInterface(REFIID riid, void** ppvObj) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->QueryInterface(riid, ppvObj); +} + +ULONG APIENTRY hkIDirect3DDevice9::AddRef() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->AddRef(); +} + +ULONG APIENTRY hkIDirect3DDevice9::Release() { + ULONG ref_count = m_pWrapped->Release(); + PrintLog(__FUNCTION__ " return = %lu", ref_count); + if (ref_count == 0) delete this; + return ref_count; +} + +HRESULT APIENTRY hkIDirect3DDevice9::TestCooperativeLevel() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->TestCooperativeLevel(); +} + +UINT APIENTRY hkIDirect3DDevice9::GetAvailableTextureMem() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetAvailableTextureMem(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::EvictManagedResources() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->EvictManagedResources(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetDirect3D(IDirect3D9** ppD3D9) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetDirect3D(ppD3D9); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetDeviceCaps(D3DCAPS9* pCaps) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetDeviceCaps(pCaps); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetDisplayMode(iSwapChain, pMode); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetCreationParameters(pParameters); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap); +} + +void APIENTRY hkIDirect3DDevice9::SetCursorPosition(int X, int Y, DWORD Flags) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetCursorPosition(X, Y, Flags); +} + +BOOL APIENTRY hkIDirect3DDevice9::ShowCursor(BOOL bShow) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->ShowCursor(bShow); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) { + PrintLog(__FUNCTION__); + context.ApplyPresentationParameters(pPresentationParameters); + return m_pWrapped->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + + // Steam Overlay Fix + // Add some space, 16bytes should be enough + _asm + { + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + nop; + } + + return m_pWrapped->GetSwapChain(iSwapChain, pSwapChain); +} + +UINT APIENTRY hkIDirect3DDevice9::GetNumberOfSwapChains() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetNumberOfSwapChains(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) { + PrintLog("hkIDirect3DDevice9::Reset"); + + context.ApplyPresentationParameters(pPresentationParameters); + return m_pWrapped->Reset(pPresentationParameters); +} + +HRESULT APIENTRY hkIDirect3DDevice9::Present(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetBackBuffer(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetBackBuffer(iSwapChain, iBackBuffer, Type, ppBackBuffer); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetRasterStatus(iSwapChain, pRasterStatus); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetDialogBoxMode(bEnableDialogs); +} + +void APIENTRY hkIDirect3DDevice9::SetGammaRamp(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetGammaRamp(iSwapChain, Flags, pRamp); +} + +void APIENTRY hkIDirect3DDevice9::GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetGammaRamp(iSwapChain, pRamp); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) { + //PrintLog("hkIDirect3DDevice9::CreateVertexBuffer %08u %x %x %x %p %p", Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle); + context.ApplyVertexBufferFix(Length, Usage, FVF, Pool); + return m_pWrapped->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) { + //PrintLog("hkIDirect3DDevice9::CreateIndexBuffer %u %x %x %x %p %p", Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle); + return m_pWrapped->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateRenderTarget(Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateDepthStencilSurface(Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->UpdateSurface(pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint); +} + +HRESULT APIENTRY hkIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->UpdateTexture(pSourceTexture, pDestinationTexture); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetRenderTargetData(pRenderTarget, pDestSurface); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetFrontBufferData(iSwapChain, pDestSurface); +} + +HRESULT APIENTRY hkIDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->StretchRect(pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter); +} + +HRESULT APIENTRY hkIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->ColorFill(pSurface, pRect, color); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateOffscreenPlainSurface(Width, Height, Format, Pool, ppSurface, pSharedHandle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetRenderTarget(RenderTargetIndex, pRenderTarget); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetRenderTarget(RenderTargetIndex, ppRenderTarget); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetDepthStencilSurface(pNewZStencil); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetDepthStencilSurface(ppZStencilSurface); +} + +HRESULT APIENTRY hkIDirect3DDevice9::BeginScene() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->BeginScene(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::EndScene() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->EndScene(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::Clear(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->Clear(Count, pRects, Flags, Color, Z, Stencil); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetTransform(State, pMatrix); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetTransform(State, pMatrix); +} + +HRESULT APIENTRY hkIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->MultiplyTransform(State, pMatrix); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9* pViewport) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetViewport(pViewport); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetViewport(D3DVIEWPORT9* pViewport) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetViewport(pViewport); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9* pMaterial) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetMaterial(pMaterial); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetMaterial(D3DMATERIAL9* pMaterial) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetMaterial(pMaterial); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetLight(DWORD Index, CONST D3DLIGHT9* pLight) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetLight(Index, pLight); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetLight(DWORD Index, D3DLIGHT9* pLight) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetLight(Index, pLight); +} + +HRESULT APIENTRY hkIDirect3DDevice9::LightEnable(DWORD Index, BOOL Enable) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->LightEnable(Index, Enable); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetLightEnable(DWORD Index, BOOL* pEnable) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetLightEnable(Index, pEnable); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetClipPlane(DWORD Index, CONST float* pPlane) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetClipPlane(Index, pPlane); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetClipPlane(DWORD Index, float* pPlane) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetClipPlane(Index, pPlane); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetRenderState(State, Value); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetRenderState(State, pValue); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateStateBlock(Type, ppSB); +} + +HRESULT APIENTRY hkIDirect3DDevice9::BeginStateBlock() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->BeginStateBlock(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->EndStateBlock(ppSB); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetClipStatus(pClipStatus); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9* pClipStatus) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetClipStatus(pClipStatus); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetTexture(DWORD Stage, IDirect3DBaseTexture9** ppTexture) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetTexture(Stage, ppTexture); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetTexture(Stage, pTexture); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetTextureStageState(Stage, Type, pValue); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetTextureStageState(Stage, Type, Value); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetSamplerState(Sampler, Type, pValue); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetSamplerState(Sampler, Type, Value); +} + +HRESULT APIENTRY hkIDirect3DDevice9::ValidateDevice(DWORD* pNumPasses) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->ValidateDevice(pNumPasses); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY* pEntries) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetPaletteEntries(PaletteNumber, pEntries); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetPaletteEntries(PaletteNumber, pEntries); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetCurrentTexturePalette(PaletteNumber); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetCurrentTexturePalette(UINT *PaletteNumber) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetCurrentTexturePalette(PaletteNumber); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetScissorRect(CONST RECT* pRect) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetScissorRect(pRect); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetScissorRect(RECT* pRect) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetScissorRect(pRect); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetSoftwareVertexProcessing(bSoftware); +} + +BOOL APIENTRY hkIDirect3DDevice9::GetSoftwareVertexProcessing() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetSoftwareVertexProcessing(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetNPatchMode(float nSegments) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetNPatchMode(nSegments); +} + +float APIENTRY hkIDirect3DDevice9::GetNPatchMode() { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetNPatchMode(); +} + +HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->DrawIndexedPrimitive(PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride); +} + +HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->DrawIndexedPrimitiveUP(PrimitiveType, MinVertexIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); +} + +HRESULT APIENTRY hkIDirect3DDevice9::ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateVertexDeclaration(pVertexElements, ppDecl); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetVertexDeclaration(pDecl); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetVertexDeclaration(ppDecl); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetFVF(DWORD FVF) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetFVF(FVF); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetFVF(DWORD* pFVF) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetFVF(pFVF); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateVertexShader(pFunction, ppShader); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetVertexShader(pShader); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetVertexShader(ppShader); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetVertexShaderConstantB(StartRegister, pConstantData, BoolCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetVertexShaderConstantB(StartRegister, pConstantData, BoolCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetStreamSource(StreamNumber, pStreamData, OffsetInBytes, Stride); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* pOffsetInBytes, UINT* pStride) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetStreamSource(StreamNumber, ppStreamData, pOffsetInBytes, pStride); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber, UINT Setting) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetStreamSourceFreq(StreamNumber, Setting); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber, UINT* pSetting) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetStreamSourceFreq(StreamNumber, pSetting); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetIndices(pIndexData); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetIndices(ppIndexData); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreatePixelShader(pFunction, ppShader); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetPixelShader(pShader); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetPixelShader(ppShader); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->SetPixelShaderConstantB(StartRegister, pConstantData, BoolCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->GetPixelShaderConstantB(StartRegister, pConstantData, BoolCount); +} + +HRESULT APIENTRY hkIDirect3DDevice9::DrawRectPatch(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo); +} + +HRESULT APIENTRY hkIDirect3DDevice9::DrawTriPatch(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo); +} + +HRESULT APIENTRY hkIDirect3DDevice9::DeletePatch(UINT Handle) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->DeletePatch(Handle); +} + +HRESULT APIENTRY hkIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) { + IDirect3DDevice9_PrintLog(__FUNCTION__); + return m_pWrapped->CreateQuery(Type, ppQuery); +} diff --git a/d3d9ex/IDirect3DDevice9.h b/d3d9ex/IDirect3DDevice9.h index d3259d4..e8dfbe0 100644 --- a/d3d9ex/IDirect3DDevice9.h +++ b/d3d9ex/IDirect3DDevice9.h @@ -1,135 +1,135 @@ -// wrapper for IDirect3DDevice9 in d3d9.h -// generated using wrapper_gen.rb - -#pragma once -#include "d3d9.h" - -interface hkIDirect3DDevice9 : public IDirect3DDevice9 { - IDirect3DDevice9* m_pWrapped; - -public: - hkIDirect3DDevice9(IDirect3DDevice9 *pIDirect3DDevice9); - ~hkIDirect3DDevice9(); - - // original interface - STDMETHOD(QueryInterface)(REFIID riid, void** ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - STDMETHOD(TestCooperativeLevel)(); - STDMETHOD_(UINT, GetAvailableTextureMem)(); - STDMETHOD(EvictManagedResources)(); - STDMETHOD(GetDirect3D)(IDirect3D9** ppD3D9); - STDMETHOD(GetDeviceCaps)(D3DCAPS9* pCaps); - STDMETHOD(GetDisplayMode)(UINT iSwapChain, D3DDISPLAYMODE* pMode); - STDMETHOD(GetCreationParameters)(D3DDEVICE_CREATION_PARAMETERS *pParameters); - STDMETHOD(SetCursorProperties)(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap); - STDMETHOD_(void, SetCursorPosition)(int X, int Y, DWORD Flags); - STDMETHOD_(BOOL, ShowCursor)(BOOL bShow); - STDMETHOD(CreateAdditionalSwapChain)(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain); - STDMETHOD(GetSwapChain)(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain); - STDMETHOD_(UINT, GetNumberOfSwapChains)(); - STDMETHOD(Reset)(D3DPRESENT_PARAMETERS* pPresentationParameters); - STDMETHOD(Present)(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion); - STDMETHOD(GetBackBuffer)(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer); - STDMETHOD(GetRasterStatus)(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus); - STDMETHOD(SetDialogBoxMode)(BOOL bEnableDialogs); - STDMETHOD_(void, SetGammaRamp)(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp); - STDMETHOD_(void, GetGammaRamp)(UINT iSwapChain, D3DGAMMARAMP* pRamp); - STDMETHOD(CreateTexture)(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle); - STDMETHOD(CreateVolumeTexture)(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle); - STDMETHOD(CreateCubeTexture)(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle); - STDMETHOD(CreateVertexBuffer)(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle); - STDMETHOD(CreateIndexBuffer)(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle); - STDMETHOD(CreateRenderTarget)(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle); - STDMETHOD(CreateDepthStencilSurface)(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle); - STDMETHOD(UpdateSurface)(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint); - STDMETHOD(UpdateTexture)(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture); - STDMETHOD(GetRenderTargetData)(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface); - STDMETHOD(GetFrontBufferData)(UINT iSwapChain, IDirect3DSurface9* pDestSurface); - STDMETHOD(StretchRect)(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter); - STDMETHOD(ColorFill)(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color); - STDMETHOD(CreateOffscreenPlainSurface)(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle); - STDMETHOD(SetRenderTarget)(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget); - STDMETHOD(GetRenderTarget)(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget); - STDMETHOD(SetDepthStencilSurface)(IDirect3DSurface9* pNewZStencil); - STDMETHOD(GetDepthStencilSurface)(IDirect3DSurface9** ppZStencilSurface); - STDMETHOD(BeginScene)(); - STDMETHOD(EndScene)(); - STDMETHOD(Clear)(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil); - STDMETHOD(SetTransform)(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix); - STDMETHOD(GetTransform)(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix); - STDMETHOD(MultiplyTransform)(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix); - STDMETHOD(SetViewport)(CONST D3DVIEWPORT9* pViewport); - STDMETHOD(GetViewport)(D3DVIEWPORT9* pViewport); - STDMETHOD(SetMaterial)(CONST D3DMATERIAL9* pMaterial); - STDMETHOD(GetMaterial)(D3DMATERIAL9* pMaterial); - STDMETHOD(SetLight)(DWORD Index, CONST D3DLIGHT9* pLight); - STDMETHOD(GetLight)(DWORD Index, D3DLIGHT9* pLight); - STDMETHOD(LightEnable)(DWORD Index, BOOL Enable); - STDMETHOD(GetLightEnable)(DWORD Index, BOOL* pEnable); - STDMETHOD(SetClipPlane)(DWORD Index, CONST float* pPlane); - STDMETHOD(GetClipPlane)(DWORD Index, float* pPlane); - STDMETHOD(SetRenderState)(D3DRENDERSTATETYPE State, DWORD Value); - STDMETHOD(GetRenderState)(D3DRENDERSTATETYPE State, DWORD* pValue); - STDMETHOD(CreateStateBlock)(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB); - STDMETHOD(BeginStateBlock)(); - STDMETHOD(EndStateBlock)(IDirect3DStateBlock9** ppSB); - STDMETHOD(SetClipStatus)(CONST D3DCLIPSTATUS9* pClipStatus); - STDMETHOD(GetClipStatus)(D3DCLIPSTATUS9* pClipStatus); - STDMETHOD(GetTexture)(DWORD Stage, IDirect3DBaseTexture9** ppTexture); - STDMETHOD(SetTexture)(DWORD Stage, IDirect3DBaseTexture9* pTexture); - STDMETHOD(GetTextureStageState)(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue); - STDMETHOD(SetTextureStageState)(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value); - STDMETHOD(GetSamplerState)(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue); - STDMETHOD(SetSamplerState)(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value); - STDMETHOD(ValidateDevice)(DWORD* pNumPasses); - STDMETHOD(SetPaletteEntries)(UINT PaletteNumber, CONST PALETTEENTRY* pEntries); - STDMETHOD(GetPaletteEntries)(UINT PaletteNumber, PALETTEENTRY* pEntries); - STDMETHOD(SetCurrentTexturePalette)(UINT PaletteNumber); - STDMETHOD(GetCurrentTexturePalette)(UINT *PaletteNumber); - STDMETHOD(SetScissorRect)(CONST RECT* pRect); - STDMETHOD(GetScissorRect)(RECT* pRect); - STDMETHOD(SetSoftwareVertexProcessing)(BOOL bSoftware); - STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(); - STDMETHOD(SetNPatchMode)(float nSegments); - STDMETHOD_(float, GetNPatchMode)(); - STDMETHOD(DrawPrimitive)(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount); - STDMETHOD(DrawIndexedPrimitive)(D3DPRIMITIVETYPE, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount); - STDMETHOD(DrawPrimitiveUP)(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride); - STDMETHOD(DrawIndexedPrimitiveUP)(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride); - STDMETHOD(ProcessVertices)(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags); - STDMETHOD(CreateVertexDeclaration)(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl); - STDMETHOD(SetVertexDeclaration)(IDirect3DVertexDeclaration9* pDecl); - STDMETHOD(GetVertexDeclaration)(IDirect3DVertexDeclaration9** ppDecl); - STDMETHOD(SetFVF)(DWORD FVF); - STDMETHOD(GetFVF)(DWORD* pFVF); - STDMETHOD(CreateVertexShader)(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader); - STDMETHOD(SetVertexShader)(IDirect3DVertexShader9* pShader); - STDMETHOD(GetVertexShader)(IDirect3DVertexShader9** ppShader); - STDMETHOD(SetVertexShaderConstantF)(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount); - STDMETHOD(GetVertexShaderConstantF)(UINT StartRegister, float* pConstantData, UINT Vector4fCount); - STDMETHOD(SetVertexShaderConstantI)(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount); - STDMETHOD(GetVertexShaderConstantI)(UINT StartRegister, int* pConstantData, UINT Vector4iCount); - STDMETHOD(SetVertexShaderConstantB)(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount); - STDMETHOD(GetVertexShaderConstantB)(UINT StartRegister, BOOL* pConstantData, UINT BoolCount); - STDMETHOD(SetStreamSource)(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride); - STDMETHOD(GetStreamSource)(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* pOffsetInBytes, UINT* pStride); - STDMETHOD(SetStreamSourceFreq)(UINT StreamNumber, UINT Setting); - STDMETHOD(GetStreamSourceFreq)(UINT StreamNumber, UINT* pSetting); - STDMETHOD(SetIndices)(IDirect3DIndexBuffer9* pIndexData); - STDMETHOD(GetIndices)(IDirect3DIndexBuffer9** ppIndexData); - STDMETHOD(CreatePixelShader)(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader); - STDMETHOD(SetPixelShader)(IDirect3DPixelShader9* pShader); - STDMETHOD(GetPixelShader)(IDirect3DPixelShader9** ppShader); - STDMETHOD(SetPixelShaderConstantF)(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount); - STDMETHOD(GetPixelShaderConstantF)(UINT StartRegister, float* pConstantData, UINT Vector4fCount); - STDMETHOD(SetPixelShaderConstantI)(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount); - STDMETHOD(GetPixelShaderConstantI)(UINT StartRegister, int* pConstantData, UINT Vector4iCount); - STDMETHOD(SetPixelShaderConstantB)(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount); - STDMETHOD(GetPixelShaderConstantB)(UINT StartRegister, BOOL* pConstantData, UINT BoolCount); - STDMETHOD(DrawRectPatch)(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo); - STDMETHOD(DrawTriPatch)(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo); - STDMETHOD(DeletePatch)(UINT Handle); - STDMETHOD(CreateQuery)(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery); -}; - +// wrapper for IDirect3DDevice9 in d3d9.h +// generated using wrapper_gen.rb + +#pragma once +#include "d3d9.h" + +interface hkIDirect3DDevice9 : public IDirect3DDevice9 { + IDirect3DDevice9* m_pWrapped; + +public: + hkIDirect3DDevice9(IDirect3DDevice9 *pIDirect3DDevice9); + ~hkIDirect3DDevice9(); + + // original interface + STDMETHOD(QueryInterface)(REFIID riid, void** ppvObj); + STDMETHOD_(ULONG, AddRef)(); + STDMETHOD_(ULONG, Release)(); + STDMETHOD(TestCooperativeLevel)(); + STDMETHOD_(UINT, GetAvailableTextureMem)(); + STDMETHOD(EvictManagedResources)(); + STDMETHOD(GetDirect3D)(IDirect3D9** ppD3D9); + STDMETHOD(GetDeviceCaps)(D3DCAPS9* pCaps); + STDMETHOD(GetDisplayMode)(UINT iSwapChain, D3DDISPLAYMODE* pMode); + STDMETHOD(GetCreationParameters)(D3DDEVICE_CREATION_PARAMETERS *pParameters); + STDMETHOD(SetCursorProperties)(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap); + STDMETHOD_(void, SetCursorPosition)(int X, int Y, DWORD Flags); + STDMETHOD_(BOOL, ShowCursor)(BOOL bShow); + STDMETHOD(CreateAdditionalSwapChain)(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain); + STDMETHOD(GetSwapChain)(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain); + STDMETHOD_(UINT, GetNumberOfSwapChains)(); + STDMETHOD(Reset)(D3DPRESENT_PARAMETERS* pPresentationParameters); + STDMETHOD(Present)(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion); + STDMETHOD(GetBackBuffer)(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer); + STDMETHOD(GetRasterStatus)(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus); + STDMETHOD(SetDialogBoxMode)(BOOL bEnableDialogs); + STDMETHOD_(void, SetGammaRamp)(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp); + STDMETHOD_(void, GetGammaRamp)(UINT iSwapChain, D3DGAMMARAMP* pRamp); + STDMETHOD(CreateTexture)(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle); + STDMETHOD(CreateVolumeTexture)(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle); + STDMETHOD(CreateCubeTexture)(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle); + STDMETHOD(CreateVertexBuffer)(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle); + STDMETHOD(CreateIndexBuffer)(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle); + STDMETHOD(CreateRenderTarget)(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle); + STDMETHOD(CreateDepthStencilSurface)(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle); + STDMETHOD(UpdateSurface)(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint); + STDMETHOD(UpdateTexture)(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture); + STDMETHOD(GetRenderTargetData)(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface); + STDMETHOD(GetFrontBufferData)(UINT iSwapChain, IDirect3DSurface9* pDestSurface); + STDMETHOD(StretchRect)(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter); + STDMETHOD(ColorFill)(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color); + STDMETHOD(CreateOffscreenPlainSurface)(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle); + STDMETHOD(SetRenderTarget)(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget); + STDMETHOD(GetRenderTarget)(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget); + STDMETHOD(SetDepthStencilSurface)(IDirect3DSurface9* pNewZStencil); + STDMETHOD(GetDepthStencilSurface)(IDirect3DSurface9** ppZStencilSurface); + STDMETHOD(BeginScene)(); + STDMETHOD(EndScene)(); + STDMETHOD(Clear)(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil); + STDMETHOD(SetTransform)(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix); + STDMETHOD(GetTransform)(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix); + STDMETHOD(MultiplyTransform)(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix); + STDMETHOD(SetViewport)(CONST D3DVIEWPORT9* pViewport); + STDMETHOD(GetViewport)(D3DVIEWPORT9* pViewport); + STDMETHOD(SetMaterial)(CONST D3DMATERIAL9* pMaterial); + STDMETHOD(GetMaterial)(D3DMATERIAL9* pMaterial); + STDMETHOD(SetLight)(DWORD Index, CONST D3DLIGHT9* pLight); + STDMETHOD(GetLight)(DWORD Index, D3DLIGHT9* pLight); + STDMETHOD(LightEnable)(DWORD Index, BOOL Enable); + STDMETHOD(GetLightEnable)(DWORD Index, BOOL* pEnable); + STDMETHOD(SetClipPlane)(DWORD Index, CONST float* pPlane); + STDMETHOD(GetClipPlane)(DWORD Index, float* pPlane); + STDMETHOD(SetRenderState)(D3DRENDERSTATETYPE State, DWORD Value); + STDMETHOD(GetRenderState)(D3DRENDERSTATETYPE State, DWORD* pValue); + STDMETHOD(CreateStateBlock)(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB); + STDMETHOD(BeginStateBlock)(); + STDMETHOD(EndStateBlock)(IDirect3DStateBlock9** ppSB); + STDMETHOD(SetClipStatus)(CONST D3DCLIPSTATUS9* pClipStatus); + STDMETHOD(GetClipStatus)(D3DCLIPSTATUS9* pClipStatus); + STDMETHOD(GetTexture)(DWORD Stage, IDirect3DBaseTexture9** ppTexture); + STDMETHOD(SetTexture)(DWORD Stage, IDirect3DBaseTexture9* pTexture); + STDMETHOD(GetTextureStageState)(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue); + STDMETHOD(SetTextureStageState)(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value); + STDMETHOD(GetSamplerState)(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue); + STDMETHOD(SetSamplerState)(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value); + STDMETHOD(ValidateDevice)(DWORD* pNumPasses); + STDMETHOD(SetPaletteEntries)(UINT PaletteNumber, CONST PALETTEENTRY* pEntries); + STDMETHOD(GetPaletteEntries)(UINT PaletteNumber, PALETTEENTRY* pEntries); + STDMETHOD(SetCurrentTexturePalette)(UINT PaletteNumber); + STDMETHOD(GetCurrentTexturePalette)(UINT *PaletteNumber); + STDMETHOD(SetScissorRect)(CONST RECT* pRect); + STDMETHOD(GetScissorRect)(RECT* pRect); + STDMETHOD(SetSoftwareVertexProcessing)(BOOL bSoftware); + STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(); + STDMETHOD(SetNPatchMode)(float nSegments); + STDMETHOD_(float, GetNPatchMode)(); + STDMETHOD(DrawPrimitive)(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount); + STDMETHOD(DrawIndexedPrimitive)(D3DPRIMITIVETYPE, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount); + STDMETHOD(DrawPrimitiveUP)(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride); + STDMETHOD(DrawIndexedPrimitiveUP)(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride); + STDMETHOD(ProcessVertices)(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags); + STDMETHOD(CreateVertexDeclaration)(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl); + STDMETHOD(SetVertexDeclaration)(IDirect3DVertexDeclaration9* pDecl); + STDMETHOD(GetVertexDeclaration)(IDirect3DVertexDeclaration9** ppDecl); + STDMETHOD(SetFVF)(DWORD FVF); + STDMETHOD(GetFVF)(DWORD* pFVF); + STDMETHOD(CreateVertexShader)(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader); + STDMETHOD(SetVertexShader)(IDirect3DVertexShader9* pShader); + STDMETHOD(GetVertexShader)(IDirect3DVertexShader9** ppShader); + STDMETHOD(SetVertexShaderConstantF)(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount); + STDMETHOD(GetVertexShaderConstantF)(UINT StartRegister, float* pConstantData, UINT Vector4fCount); + STDMETHOD(SetVertexShaderConstantI)(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount); + STDMETHOD(GetVertexShaderConstantI)(UINT StartRegister, int* pConstantData, UINT Vector4iCount); + STDMETHOD(SetVertexShaderConstantB)(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount); + STDMETHOD(GetVertexShaderConstantB)(UINT StartRegister, BOOL* pConstantData, UINT BoolCount); + STDMETHOD(SetStreamSource)(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride); + STDMETHOD(GetStreamSource)(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* pOffsetInBytes, UINT* pStride); + STDMETHOD(SetStreamSourceFreq)(UINT StreamNumber, UINT Setting); + STDMETHOD(GetStreamSourceFreq)(UINT StreamNumber, UINT* pSetting); + STDMETHOD(SetIndices)(IDirect3DIndexBuffer9* pIndexData); + STDMETHOD(GetIndices)(IDirect3DIndexBuffer9** ppIndexData); + STDMETHOD(CreatePixelShader)(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader); + STDMETHOD(SetPixelShader)(IDirect3DPixelShader9* pShader); + STDMETHOD(GetPixelShader)(IDirect3DPixelShader9** ppShader); + STDMETHOD(SetPixelShaderConstantF)(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount); + STDMETHOD(GetPixelShaderConstantF)(UINT StartRegister, float* pConstantData, UINT Vector4fCount); + STDMETHOD(SetPixelShaderConstantI)(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount); + STDMETHOD(GetPixelShaderConstantI)(UINT StartRegister, int* pConstantData, UINT Vector4iCount); + STDMETHOD(SetPixelShaderConstantB)(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount); + STDMETHOD(GetPixelShaderConstantB)(UINT StartRegister, BOOL* pConstantData, UINT BoolCount); + STDMETHOD(DrawRectPatch)(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo); + STDMETHOD(DrawTriPatch)(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo); + STDMETHOD(DeletePatch)(UINT Handle); + STDMETHOD(CreateQuery)(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery); +}; + diff --git a/d3d9ex/d3d9ex.vcxproj b/d3d9ex/d3d9ex.vcxproj index 5ae2139..e68c3f4 100644 --- a/d3d9ex/d3d9ex.vcxproj +++ b/d3d9ex/d3d9ex.vcxproj @@ -1,209 +1,209 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6C397640-B1A0-4DEF-8657-0EB21DC2FEA5} - Win32Proj - d3d9ex - OneTweakNG - 8.1 - - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - true - MultiByte - true - v140 - - - DynamicLibrary - false - true - MultiByte - true - v140 - - - - - - - - - - - - - - - - - - - true - d3d9 - $(SolutionDir)\Common;$(SolutionDir)\MinHook\include;$(IncludePath) - - - true - d3d9 - $(SolutionDir)\Common\Common;$(SolutionDir)\MinHook\include;$(IncludePath) - - - false - dinput8 - $(SolutionDir)\Common;$(SolutionDir)\MinHook\include;$(IncludePath) - - - false - d3d9 - $(SolutionDir)\Common\Common;$(SolutionDir)\MinHook\include;$(IncludePath) - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) - true - - - Windows - true - exports.def - d3d9.lib;%(AdditionalDependencies) - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) - true - - - Windows - true - exports.def - d3d9.lib;%(AdditionalDependencies) - - - - - Level3 - Use - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) - true - MultiThreaded - MaxSpeed - - - Windows - true - true - true - d3d9.lib;%(AdditionalDependencies) - exports.def - - - - - Level3 - Use - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) - true - MultiThreaded - - - Windows - true - true - true - d3d9.lib;%(AdditionalDependencies) - exports.def - - - - - - - - - - - - - - - - - - - false - false - - - - - false - false - - - - - - - - - Create - Create - Create - Create - - - - - - - - {f142a341-5ee0-442d-a15f-98ae9b48dbae} - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {6C397640-B1A0-4DEF-8657-0EB21DC2FEA5} + Win32Proj + d3d9ex + OneTweakNG + 8.1 + + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + true + MultiByte + true + v140 + + + DynamicLibrary + false + true + MultiByte + true + v140 + + + + + + + + + + + + + + + + + + + true + d3d9 + $(SolutionDir)\Common;$(SolutionDir)\MinHook\include;$(IncludePath) + + + true + d3d9 + $(SolutionDir)\Common\Common;$(SolutionDir)\MinHook\include;$(IncludePath) + + + false + dinput8 + $(SolutionDir)\Common;$(SolutionDir)\MinHook\include;$(IncludePath) + + + false + d3d9 + $(SolutionDir)\Common\Common;$(SolutionDir)\MinHook\include;$(IncludePath) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + exports.def + d3d9.lib;%(AdditionalDependencies) + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + exports.def + d3d9.lib;%(AdditionalDependencies) + + + + + Level3 + Use + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + MaxSpeed + + + Windows + true + true + true + d3d9.lib;%(AdditionalDependencies) + exports.def + + + + + Level3 + Use + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + + + Windows + true + true + true + d3d9.lib;%(AdditionalDependencies) + exports.def + + + + + + + + + + + + + + + + + + + false + false + + + + + false + false + + + + + + + + + Create + Create + Create + Create + + + + + + + + {f142a341-5ee0-442d-a15f-98ae9b48dbae} + + + + + \ No newline at end of file diff --git a/d3d9ex/d3d9ex.vcxproj.filters b/d3d9ex/d3d9ex.vcxproj.filters index c5a1069..7dc38cd 100644 --- a/d3d9ex/d3d9ex.vcxproj.filters +++ b/d3d9ex/d3d9ex.vcxproj.filters @@ -1,68 +1,68 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + \ No newline at end of file