Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
e463304365 | |||
409d223465 | |||
6caa8027d2 | |||
9e486fc986 | |||
e8db5d2923 | |||
9c5f81cc27 | |||
7619ef4806 | |||
0bf518084a | |||
31d3d351a9 | |||
5626c52c43 |
7
.gitmodules
vendored
7
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
|||
[submodule "MinHook"]
|
||||
path = MinHook
|
||||
[submodule "Deps/MinHook"]
|
||||
path = Deps/MinHook
|
||||
url = https://github.com/TsudaKageyu/minhook.git
|
||||
[submodule "Deps/spdlog"]
|
||||
path = Deps/spdlog
|
||||
url = https://github.com/gabime/spdlog.git
|
||||
|
|
148
Common/Logger.h
148
Common/Logger.h
|
@ -1,148 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
#include "StringUtil.h"
|
||||
#include "WinUtil.h"
|
||||
|
||||
#define LOGGER_DISABLE_MUTEX
|
||||
|
||||
#ifndef LOGGER_DISABLE
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
Logger(const Logger&) = delete;
|
||||
const Logger& operator=(Logger& other) = delete;
|
||||
|
||||
Logger() : m_systime(), m_console(INVALID_HANDLE_VALUE), m_file(INVALID_HANDLE_VALUE) {}
|
||||
|
||||
Logger::~Logger()
|
||||
{
|
||||
if (m_console)
|
||||
FreeConsole();
|
||||
|
||||
if (m_file)
|
||||
CloseHandle(m_file);
|
||||
}
|
||||
|
||||
#ifndef LOGGER_DISABLE_MUTEX
|
||||
std::mutex& writeMutex() const { return m_writeMutex; }
|
||||
#endif
|
||||
|
||||
static Logger& Logger::Get()
|
||||
{
|
||||
static Logger instance;
|
||||
return instance;
|
||||
};
|
||||
|
||||
bool File(const std::string& filename)
|
||||
{
|
||||
std::string logpath = FullPathFromPath(filename);
|
||||
m_file = CreateFileA(logpath.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, NULL);
|
||||
OutputDebugStringA(logpath.c_str());
|
||||
|
||||
if (m_file != INVALID_HANDLE_VALUE)
|
||||
PrintStamp(false);
|
||||
|
||||
return m_file != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
bool Console(const char* title)
|
||||
{
|
||||
AllocConsole();
|
||||
|
||||
m_console = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (m_console != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ShowWindow(GetConsoleWindow(), SW_MAXIMIZE);
|
||||
if (title) SetConsoleTitleA(title);
|
||||
}
|
||||
|
||||
if (m_console != INVALID_HANDLE_VALUE)
|
||||
PrintStamp(true);
|
||||
|
||||
return m_console != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
void Print(const char* format, va_list args)
|
||||
{
|
||||
bool to_console = m_console != INVALID_HANDLE_VALUE;
|
||||
bool to_file = m_file != INVALID_HANDLE_VALUE;
|
||||
|
||||
if ((to_console || to_file) && format)
|
||||
{
|
||||
int outsize = _vscprintf(format, args) + 1;
|
||||
std::unique_ptr<char[]> buffer(new char[outsize]);
|
||||
CharArrayFromFormatV(buffer.get(), outsize, format, args);
|
||||
|
||||
#ifdef LOGGER_DISABLE_TIME
|
||||
std::string to_print(buffer.get(), outsize - 1);
|
||||
#else
|
||||
std::string to_print;
|
||||
GetTime(&to_print);
|
||||
to_print.append(buffer.get(), outsize - 1);
|
||||
#endif
|
||||
|
||||
to_print.append("\r\n");
|
||||
|
||||
DWORD lenout = 0;
|
||||
if (to_console) WriteConsoleA(m_console, to_print.c_str(), (DWORD)to_print.size(), &lenout, NULL);
|
||||
if (to_file) WriteFile(m_file, to_print.c_str(), (DWORD)to_print.size(), &lenout, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void PrintStamp(bool console)
|
||||
{
|
||||
static char stamp[] = "[TIME]\t\t[THREAD]\t[LOG]\r\n";
|
||||
DWORD lenout = 0;
|
||||
|
||||
if (console) WriteConsoleA(m_console, stamp, _countof(stamp) - 1, &lenout, NULL);
|
||||
else WriteFile(m_file, stamp, _countof(stamp) - 1, &lenout, NULL);
|
||||
}
|
||||
|
||||
void GetTime(std::string* out)
|
||||
{
|
||||
GetLocalTime(&m_systime);
|
||||
*out = StringFromFormat("%02u:%02u:%02u.%03u\t%08u\t", m_systime.wHour, m_systime.wMinute,
|
||||
m_systime.wSecond, m_systime.wMilliseconds, GetCurrentThreadId());
|
||||
|
||||
}
|
||||
|
||||
SYSTEMTIME m_systime;
|
||||
HANDLE m_console;
|
||||
HANDLE m_file;
|
||||
mutable std::mutex m_writeMutex;
|
||||
};
|
||||
|
||||
inline void LogFile(const std::string& logname)
|
||||
{
|
||||
Logger::Get().File(logname);
|
||||
}
|
||||
|
||||
inline void LogConsole(const char* title = nullptr)
|
||||
{
|
||||
Logger::Get().Console(title);
|
||||
}
|
||||
|
||||
inline void PrintLog(const char* format, ...)
|
||||
{
|
||||
#ifndef LOGGER_DISABLE_MUTEX
|
||||
const std::lock_guard<std::mutex> lock(Logger::Get().writeMutex());
|
||||
#endif
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
Logger::Get().Print(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#else
|
||||
#define LogFile(logname) (logname)
|
||||
#define LogConsole(title, notice) (title)
|
||||
#define PrintLog(format, ...) (format)
|
||||
#endif
|
|
@ -328,16 +328,16 @@ public:
|
|||
#endif
|
||||
|
||||
/** Strict less ordering by name of key only */
|
||||
struct KeyOrder : std::binary_function<Entry, Entry, bool> {
|
||||
bool operator()(const Entry & lhs, const Entry & rhs) const {
|
||||
struct KeyOrder {
|
||||
bool operator()(const Entry& lhs, const Entry& rhs) const {
|
||||
const static SI_STRLESS isLess = SI_STRLESS();
|
||||
return isLess(lhs.pItem, rhs.pItem);
|
||||
}
|
||||
};
|
||||
|
||||
/** Strict less ordering by order, and then name of key */
|
||||
struct LoadOrder : std::binary_function<Entry, Entry, bool> {
|
||||
bool operator()(const Entry & lhs, const Entry & rhs) const {
|
||||
struct LoadOrder {
|
||||
bool operator()(const Entry& lhs, const Entry& rhs) const {
|
||||
if (lhs.nOrder != rhs.nOrder) {
|
||||
return lhs.nOrder < rhs.nOrder;
|
||||
}
|
||||
|
|
|
@ -149,13 +149,15 @@ inline std::string CP1252ToUTF8(const std::string& input)
|
|||
|
||||
// trim from start
|
||||
static inline std::string <rim(std::string &s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
||||
//workaround for template deduction after including <locale>
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not_fn([&](int i) { return std::isspace(i); })));
|
||||
return s;
|
||||
}
|
||||
|
||||
// trim from end
|
||||
static inline std::string &rtrim(std::string &s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
|
||||
//workaround for template deduction after including <locale>
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), std::not_fn([&](int i) { return std::isspace(i); })).base(), s.end());
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
1
Deps/spdlog
Submodule
1
Deps/spdlog
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 100f30043f33277122e0991c83845a2617172ffd
|
12
README.md
12
README.md
|
@ -43,8 +43,14 @@ This considerably improves the frame rate when 2D elements are being disabled on
|
|||
## Fix the enemy scan text on resolutions over 720p (FFXIII only)
|
||||
The game calls [SetScissorRect](https://docs.microsoft.com/en-us/windows/win32/api/d3d9helper/nf-d3d9helper-idirect3ddevice9-setscissorrect) using a rectangle hardcoded with the 720p coordenates. This correct the coordenates and rectangle size in order to fix it.
|
||||
|
||||
# Usage with the 4GB Large Address Aware patch
|
||||
You may wish to patch the games to allow them to access more than 4GB of RAM. This seems to avoid crashes in FF13-2 (and may help FF13 under some configurations).
|
||||
# Usage with DXVK
|
||||
People use DXVK on Windows to work around crashes with recent AMD Navi cards. If you are using Nvidia on Windows, you probably don't need it.
|
||||
* Rename DXVK's x86 ```d3d9.dll``` file to ```dxvk.dll```. Keep FF13Fix as ```d3d9.dll```.
|
||||
|
||||
|
||||
# Usage with the 4GB Large Address Aware patch (Recommended)
|
||||
You may wish to patch the games to allow them to access more than 2GB of RAM.
|
||||
This seems to avoid crashes in FF13-2 and FF13 (especially when using triple buffering, playing on 4K+ resolutions, using DXVK and/or Reshade, or using HD texture/model mods).
|
||||
## FF13:
|
||||
* Create a copy of the unpatched ```ffxiiiimg.exe``` to the folder ```FINAL FANTASY XIII\white_data\prog\win\bin```. Name it ```untouched.exe```.
|
||||
* Patch the original ```ffxiiiimg.exe``` (you can use https://ntcore.com/?page_id=371)
|
||||
|
@ -66,4 +72,4 @@ You may wish to patch the games to allow them to access more than 4GB of RAM. Th
|
|||
* This is currently not compatible with GeDoSaTo.
|
||||
* I strongly recommend forcing anisotropic filtering on your GPU driver to improve the quality of the textures.
|
||||
* Using "Maximum Performance" power management in the GPU driver can also help keeping the frame rate smooth.
|
||||
* If you are using ```dxvk```, rename its x86 dll file to ```dxvk.dll``` and keep FF13Fix as ```d3d9.dll```
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ EndProject
|
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{5DB3A8C9-CF87-4AB6-A7C2-07B81A0DA625}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Common\Defines.h = Common\Defines.h
|
||||
Common\Logger.h = Common\Logger.h
|
||||
Common\MemPatch.h = Common\MemPatch.h
|
||||
Common\SimpleIni.h = Common\SimpleIni.h
|
||||
Common\StringUtil.h = Common\StringUtil.h
|
||||
|
@ -18,7 +17,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{5DB3A8
|
|||
Common\WinVer.h = Common\WinVer.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libMinHook", "MinHook\build\VC16\libMinHook.vcxproj", "{F142A341-5EE0-442D-A15F-98AE9B48DBAE}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Deps", "Deps", "{908757C5-6B19-44A6-9C35-1F913D016F6F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libMinHook", "Deps\MinHook\build\VC16\libMinHook.vcxproj", "{F142A341-5EE0-442D-A15F-98AE9B48DBAE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -49,7 +50,7 @@ Global
|
|||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {CC332D21-3B2D-4534-AD8E-2525081AECA5}
|
||||
VisualSVNWorkingCopyRoot = .
|
||||
SolutionGuid = {CC332D21-3B2D-4534-AD8E-2525081AECA5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include "Logger.h"
|
||||
#include "MemPatch.h"
|
||||
|
||||
#include "Context.h"
|
||||
|
@ -9,12 +8,13 @@
|
|||
void MainContext::EnableAutoFix()
|
||||
{
|
||||
std::string exe_name = ModuleNameA(NULL);
|
||||
std::transform(exe_name.begin(), exe_name.end(), exe_name.begin(), std::tolower);
|
||||
//workaround for template deduction after including <locale>
|
||||
std::transform(exe_name.begin(), exe_name.end(), exe_name.begin(), [&](int i) { return std::tolower(i); });
|
||||
|
||||
if (exe_name == "ffxiiiimg.exe")
|
||||
{
|
||||
autofix = AutoFixes::FINAL_FANTASY_XIII;
|
||||
PrintLog("AutoFix for \"Final Fantasy XIII\" enabled");
|
||||
spdlog::info("AutoFix for \"Final Fantasy XIII\" enabled");
|
||||
FF13_InitializeGameAddresses();
|
||||
FF13_HandleLargeAddressAwarePatch();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ void MainContext::EnableAutoFix()
|
|||
if (exe_name == "ffxiii2img.exe")
|
||||
{
|
||||
autofix = AutoFixes::FINAL_FANTASY_XIII2;
|
||||
PrintLog("AutoFix for \"Final Fantasy XIII-2\" enabled");
|
||||
spdlog::info("AutoFix for \"Final Fantasy XIII-2\" enabled");
|
||||
FF13_2_InitializeGameAddresses();
|
||||
FF13_2_CreateSetFrameRateCodeBlock();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ const std::map<const MainContext::AutoFixes, const uint32_t> MainContext::behavi
|
|||
HANDLE WINAPI MainContext::HookCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) {
|
||||
const char* ffxiiiimgPrt = strstr(lpFileName, "ffxiiiimg.exe");
|
||||
if (ffxiiiimgPrt) {
|
||||
PrintLog("HookCreateFileA Before Replacement: %s", lpFileName);
|
||||
spdlog::info("HookCreateFileA Before Replacement: {}", lpFileName);
|
||||
|
||||
int arrayPosition = ffxiiiimgPrt - lpFileName;
|
||||
int len = strlen(lpFileName);
|
||||
|
@ -52,17 +52,18 @@ HANDLE WINAPI MainContext::HookCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAcc
|
|||
const char* untouched = "untouched"; // needs to have the size of "ffxiiiimg"
|
||||
|
||||
memcpy(newFileName + arrayPosition, untouched, strlen(untouched));
|
||||
PrintLog("HookCreateFileA After Replacement: %s", newFileName);
|
||||
spdlog::info("HookCreateFileA After Replacement: {}", newFileName);
|
||||
MH_STATUS disableHookCreateFileA = MH_DisableHook(CreateFileA);
|
||||
PrintLog("disableHookCreateFileA = %d", disableHookCreateFileA);
|
||||
spdlog::info("disableHookCreateFileA = {}", disableHookCreateFileA);
|
||||
MH_STATUS disableHookCreateFileW = MH_DisableHook(CreateFileW);
|
||||
PrintLog("disableHookCreateFileW = %d", disableHookCreateFileW);
|
||||
spdlog::info("disableHookCreateFileW = {}", disableHookCreateFileW);
|
||||
if (GetFileAttributesA(newFileName) == INVALID_FILE_ATTRIBUTES) {
|
||||
PrintLog("ERROR: Unable to get attributes of %s. Does the file exist?", newFileName);
|
||||
spdlog::info("ERROR: Unable to get attributes of {}. Does the file exist? Using the regular ffxiiiimg.exe", newFileName);
|
||||
strcpy_s(newFileName, len + 1, lpFileName);
|
||||
}
|
||||
HANDLE fileHandle = context.TrueCreateFileA(newFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);;
|
||||
spdlog::info("Returning File Handle for {}", newFileName);
|
||||
delete[] newFileName;
|
||||
PrintLog("Returning File Handle");
|
||||
return fileHandle;
|
||||
}
|
||||
else {
|
||||
|
@ -74,7 +75,7 @@ HANDLE WINAPI MainContext::HookCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAc
|
|||
const wchar_t* ffxiiiimgPrt = wcsstr(lpFileName, L"ffxiiiimg.exe");;
|
||||
|
||||
if (ffxiiiimgPrt) {
|
||||
PrintLog("HookCreateFileW Before Replacement: %s", lpFileName);
|
||||
spdlog::info(L"HookCreateFileW Before Replacement: {}", lpFileName);
|
||||
|
||||
int arrayPosition = ffxiiiimgPrt - lpFileName;
|
||||
int len = wcslen(lpFileName);
|
||||
|
@ -82,17 +83,18 @@ HANDLE WINAPI MainContext::HookCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAc
|
|||
wcscpy_s(newFileName, len + 1, lpFileName);
|
||||
const wchar_t* untouched = L"untouched"; //needs to have the size of L"ffxiiiimg"
|
||||
wmemcpy(newFileName + arrayPosition, untouched, wcslen(untouched));
|
||||
PrintLog("HookCreateFileW After Replacement: %s", newFileName);
|
||||
spdlog::info(L"HookCreateFileW After Replacement: {}", newFileName);
|
||||
MH_STATUS disableHookCreateFileA = MH_DisableHook(CreateFileA);
|
||||
PrintLog("disableHookCreateFileA = %d", disableHookCreateFileA);
|
||||
spdlog::info("disableHookCreateFileA = {}", disableHookCreateFileA);
|
||||
MH_STATUS disableHookCreateFileW = MH_DisableHook(CreateFileW);
|
||||
PrintLog("disableHookCreateFileW = %d", disableHookCreateFileW);
|
||||
spdlog::info("disableHookCreateFileW = {}", disableHookCreateFileW);
|
||||
if (GetFileAttributesW(newFileName) == INVALID_FILE_ATTRIBUTES) {
|
||||
PrintLog("ERROR: Unable to get attributes of %s. Does the file exist?", newFileName);
|
||||
spdlog::info(L"ERROR: Unable to get attributes of {}. Does the file exist?", newFileName);
|
||||
wcscpy_s(newFileName, len + 1, lpFileName);
|
||||
}
|
||||
HANDLE fileHandle = context.TrueCreateFileW(newFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);;
|
||||
spdlog::info(L"Returning File Handle {}", newFileName);
|
||||
delete[] newFileName;
|
||||
PrintLog("Returning File Handle");
|
||||
return fileHandle;
|
||||
}
|
||||
else {
|
||||
|
@ -221,15 +223,15 @@ void MainContext::Fix_Thread()
|
|||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::duration<double, std::milli> elapsed = end - start;
|
||||
PrintLog("Waited %f ms", elapsed.count());
|
||||
spdlog::info("Waited {} ms", elapsed.count());
|
||||
|
||||
std::lock_guard<std::mutex> lock(context.fix_mutex);
|
||||
if (context.autofix == AutoFixes::FINAL_FANTASY_XIII) {
|
||||
PrintLog("Starting FFXIII one time RAM patches.");
|
||||
spdlog::info("Starting FFXIII one time RAM patches.");
|
||||
context.FF13_OneTimeFixes();
|
||||
}
|
||||
else if (context.autofix == AutoFixes::FINAL_FANTASY_XIII2) {
|
||||
PrintLog("Starting FFXIII-2 one time RAM patches.");
|
||||
spdlog::info("Starting FFXIII-2 one time RAM patches.");
|
||||
context.FF13_2_OneTimeFixes();
|
||||
}
|
||||
MessageBeep(MB_ICONASTERISK);
|
||||
|
@ -239,7 +241,7 @@ void MainContext::FF13_InitializeGameAddresses()
|
|||
{
|
||||
// FF13 always seem to use the same addresses (even if you force ASLR on the OS), but we are calculating the addresses just in case...
|
||||
uint8_t* baseAddr = (uint8_t*)GetModuleHandle(NULL); // Should be 400000
|
||||
PrintLog("Base Addr = %x", baseAddr);
|
||||
spdlog::info("Base Addr = {}", (void*)baseAddr);
|
||||
|
||||
ff13_frame_pacer_ptr = (float**)(baseAddr + 0x243E34C);
|
||||
ff13_set_framerate_ingame_instruction_address = baseAddr + 0xA8D65F;
|
||||
|
@ -262,35 +264,36 @@ void MainContext::FF13_InitializeGameAddresses()
|
|||
ff13_message_box_call_address = baseAddr + 0xA8A98F;
|
||||
ff13_message_box_stack_push_address = baseAddr + 0xA8A982;
|
||||
ff13_exe_large_address_aware_flag_address = baseAddr + 0x126;
|
||||
ff13_exe_checksum_address = baseAddr + 0x168;
|
||||
ff13_exe_checksum_address = (uint32_t*)(baseAddr + 0x168);
|
||||
}
|
||||
|
||||
void MainContext::FF13_HandleLargeAddressAwarePatch() {
|
||||
const uint8_t laaMask = 0x20;
|
||||
if (*ff13_exe_large_address_aware_flag_address && laaMask) {
|
||||
PrintLog("LargeAddressAwarePatch found. Make sure untouched.exe is an unmodified copy of ffxiiiimg.exe");
|
||||
if (*ff13_exe_large_address_aware_flag_address & laaMask) {
|
||||
spdlog::info("LargeAddressAwarePatch found. ff13_exe_large_address_aware_flag = {:X}; ff13_exe_checksum = {:X}", *ff13_exe_large_address_aware_flag_address, *ff13_exe_checksum_address);
|
||||
|
||||
const MH_STATUS createHookCreateFileA = MH_CreateHook(CreateFileA, HookCreateFileA, reinterpret_cast<void**>(&TrueCreateFileA));
|
||||
PrintLog("createHookCreateFileA = %d", createHookCreateFileA);
|
||||
spdlog::info("createHookCreateFileA = {}", createHookCreateFileA);
|
||||
const MH_STATUS enableHookCreateFileA = MH_EnableHook(CreateFileA);
|
||||
PrintLog("enableHookCreateFileA = %d", enableHookCreateFileA);
|
||||
spdlog::info("enableHookCreateFileA = {}", enableHookCreateFileA);
|
||||
|
||||
const MH_STATUS createHookCreateFileW = MH_CreateHook(CreateFileW, HookCreateFileW, reinterpret_cast<void**>(&TrueCreateFileW));
|
||||
PrintLog("createHookCreateFileW = %d", createHookCreateFileW);
|
||||
spdlog::info("createHookCreateFileW = {}", createHookCreateFileW);
|
||||
const MH_STATUS enableHookCreateFileW = MH_EnableHook(CreateFileW);
|
||||
PrintLog("enableHookCreateFileW = %d", enableHookCreateFileW);
|
||||
spdlog::info("enableHookCreateFileW = {}", enableHookCreateFileW);
|
||||
|
||||
uint8_t new_ff13_exe_large_address_aware_flag = *ff13_exe_large_address_aware_flag_address & ~laaMask;
|
||||
MemPatch::Patch(ff13_exe_large_address_aware_flag_address, &new_ff13_exe_large_address_aware_flag, 1);
|
||||
PrintLog("LargeAddressAware patched back = %d", *ff13_exe_large_address_aware_flag_address);
|
||||
spdlog::info("LargeAddressAware patched back. ff13_exe_large_address_aware_flag = {:X};", *ff13_exe_large_address_aware_flag_address);
|
||||
|
||||
uint32_t new_ff13_exe_checksum = 0;
|
||||
MemPatch::Patch(ff13_exe_checksum_address, &new_ff13_exe_checksum, sizeof(uint32_t));
|
||||
PrintLog("Checksum patched back = %d", *ff13_exe_checksum_address);
|
||||
spdlog::info("Checksum patched back. ff13_exe_checksum = {:X}", *ff13_exe_checksum_address);
|
||||
|
||||
PrintLog("LargeAddressAwarePatch handled");
|
||||
spdlog::info("LargeAddressAwarePatch handled");
|
||||
}
|
||||
else {
|
||||
PrintLog("LargeAddressAwarePatch not found.");
|
||||
spdlog::info("LargeAddressAwarePatch not found.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -298,6 +301,7 @@ void MainContext::FF13_HandleLargeAddressAwarePatch() {
|
|||
void MainContext::ForceWindowActivate(const HWND hWnd) {
|
||||
PostMessage(hWnd, WM_ACTIVATE, WA_INACTIVE, NULL);
|
||||
PostMessage(hWnd, WM_ACTIVATE, WA_CLICKACTIVE, NULL);
|
||||
SetForegroundWindow(hWnd);
|
||||
}
|
||||
|
||||
void MainContext::FF13_OneTimeFixes() {
|
||||
|
@ -315,12 +319,12 @@ void MainContext::FF13_OneTimeFixes() {
|
|||
FF13_SetFrameRateVariables();
|
||||
AdjustVertexData(*ff13_internal_res_w, *ff13_internal_res_h);
|
||||
|
||||
PrintLog("Finished FF13 One Time Fixes");
|
||||
spdlog::info("Finished FF13 One Time Fixes");
|
||||
}
|
||||
|
||||
void MainContext::FF13_PatchMessageBox()
|
||||
{
|
||||
PrintLog("Removing 'Quit game' textbox");
|
||||
spdlog::info("Removing 'Quit game' textbox");
|
||||
|
||||
MemPatch::Nop(ff13_message_box_stack_push_address, 1);
|
||||
MemPatch::Nop(ff13_message_box_stack_push_address + 1 * 4, 1);
|
||||
|
@ -332,14 +336,14 @@ void MainContext::FF13_PatchMessageBox()
|
|||
void MainContext::FF13_EnableControllerVibration()
|
||||
{
|
||||
if (!config.GetFFXIIIEnableControllerVibration()) {
|
||||
PrintLog("Vibration should not be enabled (config file)");
|
||||
spdlog::info("Vibration should not be enabled (config file)");
|
||||
return;
|
||||
}
|
||||
if (!config.GetFFXIIIDisableIngameControllerHotSwapping()) {
|
||||
PrintLog("Vibration disabled because FFXIIIDisableIngameControllerHotSwapping is set to false (config file)");
|
||||
spdlog::info("Vibration disabled because FFXIIIDisableIngameControllerHotSwapping is set to false (config file)");
|
||||
return;
|
||||
}
|
||||
PrintLog("Enabling controller vibration...");
|
||||
spdlog::info("Enabling controller vibration...");
|
||||
MemPatch::Nop(ff13_vibration_low_set_zero_address, 5);
|
||||
MemPatch::Nop(ff13_vibration_high_set_zero_address, 5);
|
||||
|
||||
|
@ -349,19 +353,19 @@ void MainContext::FF13_EnableControllerVibration()
|
|||
void MainContext::FF13_RemoveContinuousControllerScan()
|
||||
{
|
||||
if (!config.GetFFXIIIDisableIngameControllerHotSwapping()) {
|
||||
PrintLog("Continuous controller scanning not disabled (config)");
|
||||
spdlog::info("Continuous controller scanning not disabled (config)");
|
||||
return;
|
||||
}
|
||||
// Disable continuous controller scanning.
|
||||
|
||||
PrintLog("Removing game slow and synchronous controller continuous controller scanning...");
|
||||
spdlog::info("Removing game slow and synchronous controller continuous controller scanning...");
|
||||
// change a jne to jmp
|
||||
MemPatch::Fill(ff13_continuous_scan_instruction_address, 0xEB, 1);
|
||||
}
|
||||
|
||||
void MainContext::FF13_FixScissorRect()
|
||||
{
|
||||
PrintLog("Fixing ScissorRect...");
|
||||
spdlog::info("Fixing ScissorRect...");
|
||||
const float originalWidth = 1280.0F;
|
||||
const float resolutionFactorW = (float)*ff13_internal_res_w / originalWidth;
|
||||
scissor_scaling_factor_w = resolutionFactorW;
|
||||
|
@ -386,7 +390,7 @@ void MainContext::FF13_FixScissorRect()
|
|||
|
||||
void MainContext::FF13_NOPIngameFrameRateLimitSetter()
|
||||
{
|
||||
PrintLog("NOPing the in-game instruction that sets the frame rate.");
|
||||
spdlog::info("NOPing the in-game instruction that sets the frame rate.");
|
||||
MemPatch::Nop(ff13_set_framerate_ingame_instruction_address, 5);
|
||||
}
|
||||
|
||||
|
@ -394,11 +398,11 @@ void MainContext::FF13_SetFrameRateVariables()
|
|||
{
|
||||
float* framePacerTargetPtr = *ff13_frame_pacer_ptr;
|
||||
if (framePacerTargetPtr) {
|
||||
PrintLog("Frame pacer target frame rate is at address %x", framePacerTargetPtr);
|
||||
spdlog::info("Frame pacer target frame rate is at address {}", (void*)framePacerTargetPtr);
|
||||
|
||||
float* ingameFrameRateFramePacerTarget = framePacerTargetPtr;
|
||||
*ingameFrameRateFramePacerTarget = MAX_FRAME_RATE_LIMIT;
|
||||
PrintLog("Frame pacer disabled.");
|
||||
spdlog::info("Frame pacer disabled.");
|
||||
|
||||
if (config.GetFFXIIIIngameFrameRateLimit() != 0)
|
||||
{
|
||||
|
@ -414,11 +418,10 @@ void MainContext::FF13_SetFrameRateVariables()
|
|||
|
||||
float* ingameFrameRateLimitPtr = framePacerTargetPtr + 1;
|
||||
*ingameFrameRateLimitPtr = frameRateLimit;
|
||||
PrintLog("Target frame rate set to %f", frameRateLimit);
|
||||
}
|
||||
spdlog::info("Target frame rate set to {}", frameRateLimit); }
|
||||
}
|
||||
else {
|
||||
PrintLog("Unable to find frame pacer / frame rate address. This shouldn't happen! Report this.");
|
||||
spdlog::info("Unable to find frame pacer / frame rate address. This shouldn't happen! Report this.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,22 +434,22 @@ void MainContext::FF13_2_OneTimeFixes()
|
|||
|
||||
if (*ff13_2_frame_pacer_ptr_address) {
|
||||
**ff13_2_frame_pacer_ptr_address = MAX_FRAME_RATE_LIMIT;
|
||||
PrintLog("Frame pacer disabled");
|
||||
spdlog::info("Frame pacer disabled");
|
||||
|
||||
FF13_2_AddHookIngameFrameRateLimitSetter();
|
||||
FF13_2_RemoveContinuousControllerScan();
|
||||
FF13_2_EnableControllerVibration();
|
||||
AdjustVertexData(*ff13_2_internal_res_w, *ff13_2_internal_res_h);
|
||||
PrintLog("Finished FF13-2 One Time Fixes");
|
||||
spdlog::info("Finished FF13-2 One Time Fixes");
|
||||
}
|
||||
else {
|
||||
PrintLog("Unable to apply FF13-2 One Time Fixes. Report this!");
|
||||
spdlog::info("Unable to apply FF13-2 One Time Fixes. Report this!");
|
||||
}
|
||||
}
|
||||
|
||||
void MainContext::FF13_2_PatchMessageBox()
|
||||
{
|
||||
PrintLog("Removing 'Quit game' textbox");
|
||||
spdlog::info("Removing 'Quit game' textbox");
|
||||
|
||||
// NOP push of registers to call MessageBox
|
||||
MemPatch::Nop(ff13_2_message_box_stack_push_address, 5);
|
||||
|
@ -471,10 +474,10 @@ void MainContext::PatchMessageBoxCall(uint8_t* callInstructionAddress)
|
|||
void MainContext::FF13_2_EnableControllerVibration()
|
||||
{
|
||||
if (!config.GetFFXIIIEnableControllerVibration()) {
|
||||
PrintLog("Vibration should not be enabled (config file)");
|
||||
spdlog::info("Vibration should not be enabled (config file)");
|
||||
return;
|
||||
}
|
||||
PrintLog("Enabling controller vibration...");
|
||||
spdlog::info("Enabling controller vibration...");
|
||||
|
||||
MemPatch::Nop(ff13_2_vibration_low_set_zero_address, 5);
|
||||
MemPatch::Nop(ff13_2_vibration_high_set_zero_address, 5);
|
||||
|
@ -497,7 +500,7 @@ void MainContext::FF13_2_InitializeGameAddresses()
|
|||
{
|
||||
// FF13-2 uses address space layout randomization (ASLR) so we can't rely on fixed addresses without considering the base address
|
||||
uint8_t* baseAddr = (uint8_t*)GetModuleHandle(NULL);
|
||||
PrintLog("Base Addr = %x", baseAddr);
|
||||
spdlog::info("Base Addr = {}", (void*)baseAddr);
|
||||
|
||||
ff13_2_continuous_scan_instruction_address = baseAddr + 0x2A6E7F;
|
||||
ff13_2_set_frame_rate_address = baseAddr + 0x802616;
|
||||
|
@ -514,12 +517,12 @@ void MainContext::FF13_2_InitializeGameAddresses()
|
|||
void MainContext::FF13_2_RemoveContinuousControllerScan()
|
||||
{
|
||||
if (!config.GetFFXIIIDisableIngameControllerHotSwapping()) {
|
||||
PrintLog("Continuous controller scanning not disabled (config)");
|
||||
spdlog::info("Continuous controller scanning not disabled (config)");
|
||||
return;
|
||||
}
|
||||
// Disable continuous controller scanning.
|
||||
|
||||
PrintLog("Removing game slow and synchronous controller continuous controller scanning...");
|
||||
spdlog::info("Removing game slow and synchronous controller continuous controller scanning...");
|
||||
// change a jne to jmp
|
||||
MemPatch::Fill(ff13_2_continuous_scan_instruction_address, 0xEB, 1);
|
||||
}
|
||||
|
@ -527,11 +530,11 @@ void MainContext::FF13_2_RemoveContinuousControllerScan()
|
|||
void MainContext::FF13_2_AddHookIngameFrameRateLimitSetter()
|
||||
{
|
||||
if (config.GetFFXIIIIngameFrameRateLimit() == 0) {
|
||||
PrintLog("Frame rate should not be changed (config = 0)");
|
||||
spdlog::info("Frame rate should not be changed (config = 0)");
|
||||
return;
|
||||
}
|
||||
|
||||
PrintLog("Hooking the instruction that sets the frame rate...");
|
||||
spdlog::info("Hooking the instruction that sets the frame rate...");
|
||||
|
||||
MemPatch::CUnprotect unp(ff13_2_set_frame_rate_address, 5);
|
||||
|
||||
|
@ -545,7 +548,7 @@ void MainContext::FF13_2_CreateSetFrameRateCodeBlock()
|
|||
const int blockSize = 31;
|
||||
FF13_2_SET_FRAME_RATE_INJECTED_CODE = new(std::nothrow) uint8_t[blockSize];
|
||||
if (!FF13_2_SET_FRAME_RATE_INJECTED_CODE) {
|
||||
PrintLog("Failed to initialize FFXIII-2 code block");
|
||||
spdlog::info("Failed to initialize FFXIII-2 code block");
|
||||
return;
|
||||
}
|
||||
DWORD oldProtect;
|
||||
|
@ -562,7 +565,7 @@ void MainContext::FF13_2_CreateSetFrameRateCodeBlock()
|
|||
ff13_2_targetFrameRate = (float)std::min(frameRateConfig, (s32)FF13_2_MAX_FRAME_CAP);
|
||||
}
|
||||
|
||||
PrintLog("Target frame rate set to %f", ff13_2_targetFrameRate);
|
||||
spdlog::info("Target frame rate set to {}", ff13_2_targetFrameRate);
|
||||
}
|
||||
|
||||
// movss xmm1,[&FF13_2_30_FPS]
|
||||
|
@ -602,5 +605,5 @@ void MainContext::FF13_2_CreateSetFrameRateCodeBlock()
|
|||
}
|
||||
|
||||
void MainContext::PrintVersionInfo() {
|
||||
PrintLog("FF13Fix 1.6.2 https://github.com/rebtd7/FF13Fix");
|
||||
spdlog::info("FF13Fix 1.6.5 https://github.com/rebtd7/FF13Fix");
|
||||
}
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
#include <thread>
|
||||
#include <array>
|
||||
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
#include "MinHook.h"
|
||||
#include "SimpleIni.h"
|
||||
|
||||
#include "IDirect3D9.h"
|
||||
#include "IDirect3DDevice9.h"
|
||||
#include "Context.h"
|
||||
#include "Wrapper.h"
|
||||
|
||||
|
@ -47,37 +45,53 @@ Config::Config()
|
|||
|
||||
MainContext::MainContext()
|
||||
{
|
||||
LogFile("FF13Fix.log");
|
||||
std::string logfilename = FullPathFromPath("FF13Fix.log");
|
||||
auto file_logger = spdlog::basic_logger_mt("file_logger", logfilename, true);
|
||||
spdlog::set_default_logger(file_logger);
|
||||
|
||||
//[2014-10-31 23:46:59.678] [thread] [level] Some message
|
||||
spdlog::set_pattern("[%Y-%m-%d %T.%e] [%6t] [%l] %v");
|
||||
spdlog::set_level(static_cast<spdlog::level::level_enum>(config.GetLogLogLevel()));
|
||||
spdlog::flush_on(spdlog::level::err); // trigger flush whenever errors or more severe messages are logged
|
||||
|
||||
if(config.GetLogLogFlush())
|
||||
spdlog::flush_on(spdlog::level::trace); // trigger flush whenever trace or more severe messages are logged => always
|
||||
|
||||
context.PrintVersionInfo();
|
||||
|
||||
PrintLog("Enabling hooks:");
|
||||
spdlog::info("Enabling hooks:");
|
||||
const MH_STATUS initializeHooks = MH_Initialize();
|
||||
PrintLog("initializeHooks = %d", initializeHooks);
|
||||
spdlog::info("initializeHooks = {}", initializeHooks);
|
||||
|
||||
const MH_STATUS createHookDirect3DCreate9 = MH_CreateHook(D3D9DLL::Get().Direct3DCreate9, HookDirect3DCreate9, reinterpret_cast<void**>(&TrueDirect3DCreate9));
|
||||
PrintLog("createHookDirect3DCreate9 = %d", createHookDirect3DCreate9);
|
||||
spdlog::info("createHookDirect3DCreate9 = {}", createHookDirect3DCreate9);
|
||||
const MH_STATUS enableHookDirect3DCreate9 = MH_EnableHook(D3D9DLL::Get().Direct3DCreate9);
|
||||
PrintLog("enableHookDirect3DCreate9 = %d", enableHookDirect3DCreate9);
|
||||
spdlog::info("enableHookDirect3DCreate9 = {}", enableHookDirect3DCreate9);
|
||||
|
||||
const MH_STATUS createHookDirect3DCreate9Ex = MH_CreateHook(D3D9DLL::Get().Direct3DCreate9Ex, HookDirect3DCreate9Ex, reinterpret_cast<void**>(&TrueDirect3DCreate9Ex));
|
||||
spdlog::info("createHookDirect3DCreate9Ex = {}", createHookDirect3DCreate9Ex);
|
||||
const MH_STATUS enableHookDirect3DCreate9Ex = MH_EnableHook(D3D9DLL::Get().Direct3DCreate9Ex);
|
||||
spdlog::info("enableHookDirect3DCreate9Ex = {}", enableHookDirect3DCreate9Ex);
|
||||
|
||||
const MH_STATUS createHookCreateWindowExA = MH_CreateHook(CreateWindowExA, HookCreateWindowExA, reinterpret_cast<void**>(&TrueCreateWindowExA));
|
||||
PrintLog("createHookCreateWindowExA = %d", createHookCreateWindowExA);
|
||||
spdlog::info("createHookCreateWindowExA = {}", createHookCreateWindowExA);
|
||||
const MH_STATUS enableHookCreateWindowExA = MH_EnableHook(CreateWindowExA);
|
||||
PrintLog("enableHookCreateWindowExA = %d", enableHookCreateWindowExA);
|
||||
spdlog::info("enableHookCreateWindowExA = {}", enableHookCreateWindowExA);
|
||||
|
||||
const MH_STATUS createHookCreateWindowExW = MH_CreateHook(CreateWindowExW, HookCreateWindowExW, reinterpret_cast<void**>(&TrueCreateWindowExW));
|
||||
PrintLog("createHookCreateWindowExW = %d", createHookCreateWindowExW);
|
||||
spdlog::info("createHookCreateWindowExW = {}", createHookCreateWindowExW);
|
||||
const MH_STATUS enableHookCreateWindowExW = MH_EnableHook(CreateWindowExW);
|
||||
PrintLog("enableHookCreateWindowExW = %d", enableHookCreateWindowExW);
|
||||
spdlog::info("enableHookCreateWindowExW = {}", enableHookCreateWindowExW);
|
||||
|
||||
const MH_STATUS createHookSetWindowLongA = MH_CreateHook(SetWindowLongA, HookSetWindowLongA, reinterpret_cast<void**>(&TrueSetWindowLongA));
|
||||
PrintLog("createHookSetWindowLongA = %d", createHookSetWindowLongA);
|
||||
spdlog::info("createHookSetWindowLongA = {}", createHookSetWindowLongA);
|
||||
const MH_STATUS enableHookSetWindowLongA = MH_EnableHook(SetWindowLongA);
|
||||
PrintLog("enableHookSetWindowLongA = %d", enableHookSetWindowLongA);
|
||||
spdlog::info("enableHookSetWindowLongA = {}", enableHookSetWindowLongA);
|
||||
|
||||
const MH_STATUS createHookSetWindowLongW = MH_CreateHook(SetWindowLongW, HookSetWindowLongW, reinterpret_cast<void**>(&TrueSetWindowLongW));
|
||||
PrintLog("createHookSetWindowLongW = %d", createHookSetWindowLongW);
|
||||
spdlog::info("createHookSetWindowLongW = {}", createHookSetWindowLongW);
|
||||
const MH_STATUS enableHookSetWindowLongW = MH_EnableHook(SetWindowLongW);
|
||||
PrintLog("enableHookSetWindowLongW = %d", enableHookSetWindowLongW);
|
||||
spdlog::info("enableHookSetWindowLongW = {}", enableHookSetWindowLongW);
|
||||
|
||||
if (config.GetOptionsAutoFix()) EnableAutoFix();
|
||||
}
|
||||
|
@ -89,15 +103,27 @@ MainContext::~MainContext()
|
|||
|
||||
IDirect3D9* WINAPI MainContext::HookDirect3DCreate9(UINT SDKVersion)
|
||||
{
|
||||
spdlog::info(__FUNCTION__);
|
||||
IDirect3D9* d3d9 = context.TrueDirect3DCreate9(SDKVersion);
|
||||
if (d3d9)
|
||||
{
|
||||
return new hkIDirect3D9(d3d9);
|
||||
if (d3d9) {
|
||||
return new hkIDirect3D9(static_cast<IDirect3D9Ex*>(d3d9));
|
||||
}
|
||||
|
||||
return d3d9;
|
||||
}
|
||||
|
||||
HRESULT WINAPI MainContext::HookDirect3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex** ppIDirect3D9Ex)
|
||||
{
|
||||
spdlog::info(__FUNCTION__);
|
||||
HRESULT hr = context.TrueDirect3DCreate9Ex(SDKVersion, ppIDirect3D9Ex);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hkIDirect3D9* pIDirect3D9Ex = new hkIDirect3D9(*ppIDirect3D9Ex);
|
||||
*ppIDirect3D9Ex = pIDirect3D9Ex;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
bool MainContext::BehaviorFlagsToString(DWORD BehaviorFlags, std::string* BehaviorFlagsString)
|
||||
{
|
||||
#define BF2STR(x) if (BehaviorFlags & x) BehaviorFlagsString->append(#x" ");
|
||||
|
@ -133,12 +159,12 @@ bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentati
|
|||
if (config.GetOptionsTripleBuffering() == 1 || (config.GetOptionsTripleBuffering() == -1 && !IsDXVK()))
|
||||
{
|
||||
pPresentationParameters->BackBufferCount = 3;
|
||||
PrintLog("BackBufferCount: BackBufferCount set to %u", pPresentationParameters->BackBufferCount);
|
||||
spdlog::info("BackBufferCount: BackBufferCount set to {}", pPresentationParameters->BackBufferCount);
|
||||
}
|
||||
|
||||
if ((s32)config.GetOptionsFullScreenRefreshRate() >= 0 && pPresentationParameters->FullScreen_RefreshRateInHz != 0)
|
||||
{
|
||||
PrintLog("Changing refresh rate from %u to %u", pPresentationParameters->FullScreen_RefreshRateInHz, config.GetOptionsFullScreenRefreshRate());
|
||||
spdlog::info("Changing refresh rate from {} to {}", pPresentationParameters->FullScreen_RefreshRateInHz, config.GetOptionsFullScreenRefreshRate());
|
||||
pPresentationParameters->FullScreen_RefreshRateInHz = config.GetOptionsFullScreenRefreshRate();
|
||||
}
|
||||
|
||||
|
@ -148,7 +174,7 @@ bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentati
|
|||
pPresentationParameters->MultiSampleType = (D3DMULTISAMPLE_TYPE)config.GetOptionsMultisample();
|
||||
pPresentationParameters->MultiSampleQuality = 0;
|
||||
|
||||
PrintLog("MultiSampleType %u, MultiSampleQuality %u", pPresentationParameters->MultiSampleType, pPresentationParameters->MultiSampleQuality);
|
||||
spdlog::info("MultiSampleType {}, MultiSampleQuality {}", pPresentationParameters->MultiSampleType, pPresentationParameters->MultiSampleQuality);
|
||||
}
|
||||
|
||||
if (config.GetOptionsPresentationInterval() != 0)
|
||||
|
@ -158,13 +184,13 @@ bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentati
|
|||
else if (config.GetOptionsPresentationInterval() > 0)
|
||||
pPresentationParameters->PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||
|
||||
PrintLog("PresentationInterval: PresentationInterval set to 0x%x", pPresentationParameters->PresentationInterval);
|
||||
spdlog::info("PresentationInterval: PresentationInterval set to {:X}", pPresentationParameters->PresentationInterval);
|
||||
}
|
||||
|
||||
if (config.GetOptionsSwapEffect() != -1)
|
||||
{
|
||||
pPresentationParameters->SwapEffect = (D3DSWAPEFFECT)config.GetOptionsSwapEffect();
|
||||
PrintLog("SwapEffect: SwapEffect set to %u", pPresentationParameters->SwapEffect);
|
||||
spdlog::info("SwapEffect: SwapEffect set to {}", pPresentationParameters->SwapEffect);
|
||||
}
|
||||
|
||||
if (config.GetBorderlessBorderless())
|
||||
|
@ -180,7 +206,7 @@ bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentati
|
|||
pPresentationParameters->Windowed = TRUE;
|
||||
pPresentationParameters->FullScreen_RefreshRateInHz = 0;
|
||||
|
||||
PrintLog("ForceWindowedMode");
|
||||
spdlog::info("ForceWindowedMode");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +225,7 @@ bool MainContext::CheckWindow(HWND hWnd)
|
|||
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());
|
||||
spdlog::info(L"HWND {}: ClassName \"{}\", WindowName: \"{}\"", (void*)hWnd, className.get(), windowName.get());
|
||||
|
||||
bool class_found = config.GetWindowWindowClass().compare(className.get()) == 0;
|
||||
bool window_found = config.GetWindowWindowName().compare(windowName.get()) == 0;
|
||||
|
@ -241,8 +267,8 @@ void MainContext::ApplyBorderless(HWND hWnd)
|
|||
SetWindowPos(hWnd, insertAfter, 0, 0, cx, cy, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOSENDCHANGING);
|
||||
SetFocus(hWnd);
|
||||
|
||||
PrintLog("HWND 0x%p: Borderless dwStyle: %lX->%lX", hWnd, dwStyle, new_dwStyle);
|
||||
PrintLog("HWND 0x%p: Borderless dwExStyle: %lX->%lX", hWnd, dwExStyle, new_dwExStyle);
|
||||
spdlog::info("HWND {:X}: Borderless dwStyle: {:X}->{:X}", (void*)hWnd, dwStyle, new_dwStyle);
|
||||
spdlog::info("HWND {:X}: Borderless dwExStyle: {:X}->{:X}", (void*)hWnd, dwExStyle, new_dwExStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,13 +313,13 @@ LONG WINAPI MainContext::HookSetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLon
|
|||
if (nIndex == GWL_STYLE)
|
||||
{
|
||||
dwNewLong &= ~WS_OVERLAPPEDWINDOW;
|
||||
PrintLog("SetWindowLongA dwStyle: %lX->%lX", olddwNewLong, dwNewLong);
|
||||
spdlog::info("SetWindowLongA dwStyle: {:X}->{:X}", olddwNewLong, dwNewLong);
|
||||
}
|
||||
|
||||
if (nIndex == GWL_EXSTYLE)
|
||||
{
|
||||
dwNewLong &= ~(WS_EX_OVERLAPPEDWINDOW);
|
||||
PrintLog("SetWindowLongA dwExStyle: %lX->%lX", olddwNewLong, dwNewLong);
|
||||
spdlog::info("SetWindowLongA dwExStyle: {:X}->{:X}", olddwNewLong, dwNewLong);
|
||||
}
|
||||
}
|
||||
return context.TrueSetWindowLongA(hWnd, nIndex, dwNewLong);
|
||||
|
@ -307,13 +333,13 @@ LONG WINAPI MainContext::HookSetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLon
|
|||
if (nIndex == GWL_STYLE)
|
||||
{
|
||||
dwNewLong &= ~WS_OVERLAPPEDWINDOW;
|
||||
PrintLog("SetWindowLongW dwStyle: %lX->%lX", olddwNewLong, dwNewLong);
|
||||
spdlog::info("SetWindowLongW dwStyle: {:X}->{:X}", olddwNewLong, dwNewLong);
|
||||
}
|
||||
|
||||
if (nIndex == GWL_EXSTYLE)
|
||||
{
|
||||
dwNewLong &= ~(WS_EX_OVERLAPPEDWINDOW);
|
||||
PrintLog("SetWindowLongW dwExStyle: %lX->%lX", olddwNewLong, dwNewLong);
|
||||
spdlog::info("SetWindowLongW dwExStyle: {:X}->{:X}", olddwNewLong, dwNewLong);
|
||||
}
|
||||
}
|
||||
return context.TrueSetWindowLongW(hWnd, nIndex, dwNewLong);
|
||||
|
@ -324,7 +350,7 @@ HWND WINAPI MainContext::HookCreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName
|
|||
HWND hWnd = context.TrueCreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
if (!hWnd)
|
||||
{
|
||||
PrintLog("CreateWindowExA failed");
|
||||
spdlog::info("CreateWindowExA failed");
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
|
@ -342,7 +368,7 @@ HWND WINAPI MainContext::HookCreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassNam
|
|||
HWND hWnd = context.TrueCreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
if (!hWnd)
|
||||
{
|
||||
PrintLog("CreateWindowExW failed");
|
||||
spdlog::info("CreateWindowExW failed");
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
#include <atomic>
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "spdlog/sinks/basic_file_sink.h"
|
||||
|
||||
#include "WinUtil.h"
|
||||
|
||||
#include "Types.h"
|
||||
#include "XInputManager.h"
|
||||
|
||||
static const char* inifilename = "FF13Fix.ini";
|
||||
#define CONFIG_VERSION 6
|
||||
#define CONFIG_VERSION 7
|
||||
|
||||
class Config
|
||||
{
|
||||
|
@ -34,6 +39,7 @@ class MainContext
|
|||
const MainContext& operator=(MainContext& other) = delete;
|
||||
|
||||
DECLARE_HOOK(IDirect3D9*, WINAPI, Direct3DCreate9, UINT SDKVersion);
|
||||
DECLARE_HOOK(HRESULT, WINAPI, Direct3DCreate9Ex, UINT SDKVersion, IDirect3D9Ex** ppIDirect3D9Ex);
|
||||
DECLARE_HOOK(LONG, WINAPI, SetWindowLongA, HWND hWnd, int nIndex, LONG dwNewLong);
|
||||
DECLARE_HOOK(LONG, WINAPI, SetWindowLongW, HWND hWnd, int nIndex, LONG dwNewLong);
|
||||
DECLARE_HOOK(HWND, WINAPI, CreateWindowExA, DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName,
|
||||
|
@ -60,6 +66,7 @@ public:
|
|||
void ApplyBorderless(HWND hWnd);
|
||||
|
||||
Config config;
|
||||
|
||||
void OneTimeFix();
|
||||
bool IsDXVK();
|
||||
|
||||
|
@ -78,6 +85,9 @@ private:
|
|||
|
||||
std::mutex fix_mutex;
|
||||
|
||||
//MainContext is global!
|
||||
//TODO this class is cluttered, separate fixes class from MainContext
|
||||
|
||||
const float MAX_FRAME_RATE_LIMIT = 250000.0F;
|
||||
float** ff13_frame_pacer_ptr = NULL;
|
||||
uint8_t* ff13_set_framerate_ingame_instruction_address = NULL;
|
||||
|
@ -98,7 +108,7 @@ private:
|
|||
uint8_t* ff13_message_box_stack_push_address = NULL;
|
||||
uint8_t* ff13_message_box_call_address = NULL;
|
||||
uint8_t* ff13_exe_large_address_aware_flag_address = NULL;
|
||||
uint8_t* ff13_exe_checksum_address = NULL;
|
||||
uint32_t* ff13_exe_checksum_address = NULL;
|
||||
uint32_t* ff13_internal_res_w;
|
||||
uint32_t* ff13_internal_res_h;
|
||||
|
||||
|
|
|
@ -1,144 +1,221 @@
|
|||
// wrapper for IDirect3D9 in d3d9.h
|
||||
// generated using wrapper_gen.rb
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "Logger.h"
|
||||
#include "Context.h"
|
||||
|
||||
#include "IDirect3D9.h"
|
||||
#include "IDirect3DDevice9.h"
|
||||
|
||||
#define IDirect3D9_PrintLog(format, ...) //PrintLog(format, __VA_ARGS__);
|
||||
|
||||
HRESULT APIENTRY hkIDirect3D9::QueryInterface(REFIID riid, void** ppvObj) {
|
||||
PrintLog(__FUNCTION__);
|
||||
if (ppvObj == nullptr) return E_POINTER;
|
||||
spdlog::info(__FUNCTION__);
|
||||
if (ppvObj == nullptr)
|
||||
return E_POINTER;
|
||||
|
||||
if (riid == __uuidof(IUnknown) ||
|
||||
riid == __uuidof(IDirect3D9))
|
||||
if (riid == __uuidof(this) ||
|
||||
riid == __uuidof(IUnknown) ||
|
||||
riid == __uuidof(IDirect3D9) ||
|
||||
riid == __uuidof(IDirect3D9Ex))
|
||||
{
|
||||
*ppvObj = static_cast<IDirect3D9*>(this);
|
||||
if (!m_is_ex && riid == __uuidof(IDirect3D9Ex))
|
||||
{
|
||||
//we are queried for IDirect3D9Ex but we hold IDirect3D9
|
||||
//upgrade wrapped interface, query it
|
||||
IDirect3D9Ex* pIDirect3D9Ex = nullptr;
|
||||
HRESULT hr = m_pWrapped->QueryInterface(riid, reinterpret_cast<void**>(&pIDirect3D9Ex));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// release one reference from old one and take new IDirect3DDevice9Ex pointer
|
||||
m_pWrapped->Release();
|
||||
m_pWrapped = pIDirect3D9Ex;
|
||||
m_is_ex = true;
|
||||
}
|
||||
|
||||
AddRef();
|
||||
*ppvObj = this;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObj = nullptr;
|
||||
return E_NOINTERFACE;
|
||||
return m_pWrapped->QueryInterface(riid, ppvObj);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE hkIDirect3D9::AddRef() {
|
||||
m_pWrapped->AddRef();
|
||||
return InterlockedIncrement(&m_ref);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE hkIDirect3D9::Release() {
|
||||
const ULONG ref = InterlockedDecrement(&m_ref);
|
||||
if (ref != 0) {
|
||||
m_pWrapped->Release();
|
||||
return ref;
|
||||
}
|
||||
const auto pWrapped = m_pWrapped;
|
||||
m_pWrapped = nullptr;
|
||||
delete this;
|
||||
|
||||
const ULONG ref_last = pWrapped->Release();
|
||||
if (ref_last != 0)
|
||||
spdlog::error("Reference count for IDirect3D9 is wrong: {} {} {}", (void*)this, ref, ref_last);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction) {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->RegisterSoftwareDevice(pInitializeFunction);
|
||||
}
|
||||
|
||||
UINT APIENTRY hkIDirect3D9::GetAdapterCount() {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetAdapterCount();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3D9::GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
|
||||
PrintLog(__FUNCTION__);
|
||||
spdlog::info(__FUNCTION__);
|
||||
HRESULT rt = m_pWrapped->GetAdapterIdentifier(Adapter, Flags, pIdentifier);
|
||||
if (context.config.GetAdapterAdapter() && SUCCEEDED(rt) && pIdentifier)
|
||||
{
|
||||
pIdentifier->VendorId = context.config.GetAdapterVendorId();
|
||||
pIdentifier->DeviceId = context.config.GetAdapterDeviceId();
|
||||
}
|
||||
|
||||
return rt;
|
||||
}
|
||||
|
||||
UINT APIENTRY hkIDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format) {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetAdapterModeCount(Adapter, Format);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3D9::EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->EnumAdapterModes(Adapter, Format, Mode, pMode);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3D9::GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode) {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetAdapterDisplayMode(Adapter, pMode);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3D9::CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed) {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
if (context.config.GetBorderlessForceWindowedMode()) 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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CheckDeviceFormatConversion(Adapter, DeviceType, SourceFormat, TargetFormat);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3D9::GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetDeviceCaps(Adapter, DeviceType, pCaps);
|
||||
}
|
||||
|
||||
HMONITOR APIENTRY hkIDirect3D9::GetAdapterMonitor(UINT Adapter) {
|
||||
IDirect3D9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::info(__FUNCTION__);
|
||||
return ApplyCreateDeviceFix<IDirect3DDevice9, false>(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, nullptr, ppReturnedDeviceInterface);
|
||||
}
|
||||
|
||||
UINT STDMETHODCALLTYPE hkIDirect3D9::GetAdapterModeCountEx(UINT Adapter, CONST D3DDISPLAYMODEFILTER* pFilter) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
|
||||
return static_cast<IDirect3D9Ex*>(m_pWrapped)->GetAdapterModeCountEx(Adapter, pFilter);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3D9::EnumAdapterModesEx(UINT Adapter, CONST D3DDISPLAYMODEFILTER* pFilter, UINT Mode, D3DDISPLAYMODEEX* pMode) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return static_cast<IDirect3D9Ex*>(m_pWrapped)->EnumAdapterModesEx(Adapter, pFilter, Mode, pMode);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3D9::GetAdapterDisplayModeEx(UINT Adapter, D3DDISPLAYMODEEX* pMode, D3DDISPLAYROTATION* pRotation) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return static_cast<IDirect3D9Ex*>(m_pWrapped)->GetAdapterDisplayModeEx(Adapter, pMode, pRotation);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3D9::CreateDeviceEx(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, IDirect3DDevice9Ex** ppReturnedDeviceInterface) {
|
||||
spdlog::info(__FUNCTION__);
|
||||
return ApplyCreateDeviceFix<IDirect3DDevice9Ex, true>(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, ppReturnedDeviceInterface);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3D9::GetAdapterLUID(UINT Adapter, LUID* pLUID) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return static_cast<IDirect3D9Ex*>(m_pWrapped)->GetAdapterLUID(Adapter, pLUID);
|
||||
}
|
||||
|
||||
//TODO move this to other file
|
||||
template <typename T, bool ex>
|
||||
HRESULT hkIDirect3D9::ApplyCreateDeviceFix(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, T** ppReturnedDeviceInterface)
|
||||
{
|
||||
spdlog::info(__FUNCTION__);
|
||||
|
||||
DWORD OriginalBehaviorFlags = BehaviorFlags;
|
||||
std::string BehaviorFlagsString;
|
||||
context.BehaviorFlagsToString(BehaviorFlags, &BehaviorFlagsString);
|
||||
|
||||
PrintLog("BehaviorFlags: %08X %s", BehaviorFlags, BehaviorFlagsString.c_str());
|
||||
spdlog::info("BehaviorFlags: {:#08x} {}", BehaviorFlags, BehaviorFlagsString);
|
||||
|
||||
if (context.config.GetOptionsBehaviorFlags() > 0)
|
||||
{
|
||||
if (context.config.GetOptionsBehaviorFlags() > 0) {
|
||||
BehaviorFlags = context.config.GetOptionsBehaviorFlags();
|
||||
PrintLog("Advanced Mode: BehaviorFlags set");
|
||||
spdlog::info("Advanced Mode: BehaviorFlags set");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
context.ApplyBehaviorFlagsFix(&BehaviorFlags);
|
||||
}
|
||||
|
||||
if (hFocusWindow == NULL) hFocusWindow = pPresentationParameters->hDeviceWindow;
|
||||
if (hFocusWindow == NULL)
|
||||
hFocusWindow = pPresentationParameters->hDeviceWindow;
|
||||
|
||||
context.ApplyPresentationParameters(pPresentationParameters);
|
||||
|
||||
if (OriginalBehaviorFlags != BehaviorFlags)
|
||||
{
|
||||
if (OriginalBehaviorFlags != BehaviorFlags) {
|
||||
std::string BehaviorFlagsString;
|
||||
context.BehaviorFlagsToString(BehaviorFlags, &BehaviorFlagsString);
|
||||
PrintLog("BehaviorFlags changed: %08X %s", BehaviorFlags, BehaviorFlagsString.c_str());
|
||||
spdlog::info("BehaviorFlags changed: {:#08x} {}", BehaviorFlags, BehaviorFlagsString);
|
||||
}
|
||||
|
||||
IDirect3DDevice9* device = nullptr;
|
||||
HRESULT hr = m_pWrapped->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, &device);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PrintLog("CreateDevice fail with HRESULT: %08X", hr);
|
||||
T* device = nullptr;
|
||||
HRESULT hr = S_FALSE;
|
||||
bool is_ex;
|
||||
|
||||
if (ex) {
|
||||
hr = m_pWrapped->CreateDeviceEx(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, reinterpret_cast<IDirect3DDevice9Ex**>(&device));
|
||||
is_ex = true;
|
||||
}
|
||||
else {
|
||||
hr = m_pWrapped->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, reinterpret_cast<IDirect3DDevice9**>(&device));
|
||||
is_ex = false;
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
spdlog::info("CreateDevice fail with HRESULT: {:X}", hr);
|
||||
*ppReturnedDeviceInterface = nullptr;
|
||||
return hr;
|
||||
}
|
||||
else {
|
||||
*ppReturnedDeviceInterface = new hkIDirect3DDevice9(static_cast<IDirect3DDevice9Ex*>(device), is_ex);
|
||||
context.OneTimeFix();
|
||||
}
|
||||
|
||||
context.OneTimeFix();
|
||||
|
||||
*ppReturnedDeviceInterface = new hkIDirect3DDevice9(device);
|
||||
return hr;
|
||||
}
|
|
@ -1,65 +1,52 @@
|
|||
// wrapper for IDirect3D9 in d3d9.h
|
||||
// generated using wrapper_gen.rb
|
||||
|
||||
#pragma once
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "IDirect3DDevice9.h"
|
||||
|
||||
interface hkIDirect3D9 final : public IDirect3D9 {
|
||||
interface DECLSPEC_UUID("16760376-B89E-4CD9-9CE1-5B1C7AFC2E16") hkIDirect3D9 final : public IDirect3D9Ex{
|
||||
public:
|
||||
// original interface
|
||||
STDMETHOD(QueryInterface)(REFIID riid, void** ppvObj);
|
||||
ULONG STDMETHODCALLTYPE AddRef() {
|
||||
m_refPrivate++;
|
||||
m_refCount = m_pWrapped->AddRef();
|
||||
if (m_refCount > m_refPrivate) {
|
||||
// you should not see this ever
|
||||
PrintLog("WARNING: Internal reference counting to low, adjusting %u->%u", m_refPrivate.load(), m_refCount.load());
|
||||
m_refPrivate = m_refCount + 1;
|
||||
}
|
||||
#pragma region IUnknown
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObj);
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
#pragma endregion
|
||||
#pragma region IDirect3D9
|
||||
HRESULT STDMETHODCALLTYPE RegisterSoftwareDevice(void* pInitializeFunction);
|
||||
UINT STDMETHODCALLTYPE GetAdapterCount();
|
||||
HRESULT STDMETHODCALLTYPE GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier);
|
||||
UINT STDMETHODCALLTYPE GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
|
||||
HRESULT STDMETHODCALLTYPE EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode);
|
||||
HRESULT STDMETHODCALLTYPE GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode);
|
||||
HRESULT STDMETHODCALLTYPE CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed);
|
||||
HRESULT STDMETHODCALLTYPE CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
|
||||
HRESULT STDMETHODCALLTYPE CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels);
|
||||
HRESULT STDMETHODCALLTYPE CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat);
|
||||
HRESULT STDMETHODCALLTYPE CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat);
|
||||
HRESULT STDMETHODCALLTYPE GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps);
|
||||
HMONITOR STDMETHODCALLTYPE GetAdapterMonitor(UINT Adapter);
|
||||
HRESULT STDMETHODCALLTYPE CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface);
|
||||
#pragma endregion
|
||||
#pragma region IDirect3D9Ex
|
||||
UINT STDMETHODCALLTYPE GetAdapterModeCountEx(UINT Adapter, const D3DDISPLAYMODEFILTER* pFilter);
|
||||
HRESULT STDMETHODCALLTYPE EnumAdapterModesEx(UINT Adapter, const D3DDISPLAYMODEFILTER* pFilter, UINT Mode, D3DDISPLAYMODEEX* pMode);
|
||||
HRESULT STDMETHODCALLTYPE GetAdapterDisplayModeEx(UINT Adapter, D3DDISPLAYMODEEX* pMode, D3DDISPLAYROTATION* pRotation);
|
||||
HRESULT STDMETHODCALLTYPE CreateDeviceEx(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, IDirect3DDevice9Ex** ppReturnedDeviceInterface);
|
||||
HRESULT STDMETHODCALLTYPE GetAdapterLUID(UINT Adapter, LUID* pLUID);
|
||||
#pragma endregion
|
||||
|
||||
return m_refCount + 1;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release() {
|
||||
if (m_refPrivate == 0ul)
|
||||
delete this;
|
||||
|
||||
if (m_refPrivate != 0ul) {
|
||||
m_refPrivate--;
|
||||
|
||||
m_refCount = m_pWrapped->Release();
|
||||
}
|
||||
return m_refCount + 1;
|
||||
}
|
||||
STDMETHOD(RegisterSoftwareDevice)(void* pInitializeFunction);
|
||||
STDMETHOD_(UINT, GetAdapterCount)();
|
||||
STDMETHOD(GetAdapterIdentifier)(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier);
|
||||
STDMETHOD_(UINT, GetAdapterModeCount)(UINT Adapter, D3DFORMAT Format);
|
||||
STDMETHOD(EnumAdapterModes)(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode);
|
||||
STDMETHOD(GetAdapterDisplayMode)(UINT Adapter, D3DDISPLAYMODE* pMode);
|
||||
STDMETHOD(CheckDeviceType)(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed);
|
||||
STDMETHOD(CheckDeviceFormat)(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
|
||||
STDMETHOD(CheckDeviceMultiSampleType)(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels);
|
||||
STDMETHOD(CheckDepthStencilMatch)(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat);
|
||||
STDMETHOD(CheckDeviceFormatConversion)(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat);
|
||||
STDMETHOD(GetDeviceCaps)(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps);
|
||||
STDMETHOD_(HMONITOR, GetAdapterMonitor)(UINT Adapter);
|
||||
STDMETHOD(CreateDevice)(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface);
|
||||
|
||||
|
||||
hkIDirect3D9(IDirect3D9* pIDirect3D9)
|
||||
hkIDirect3D9(IDirect3D9Ex* pIDirect3D9)
|
||||
: m_pWrapped(pIDirect3D9)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~hkIDirect3D9(){while (m_pWrapped->Release());}
|
||||
|
||||
virtual ~hkIDirect3D9() { }
|
||||
|
||||
private:
|
||||
IDirect3D9* m_pWrapped;
|
||||
std::atomic<uint32_t> m_refCount = { 0ul };
|
||||
std::atomic<uint32_t> m_refPrivate = { 1ul };
|
||||
IDirect3D9Ex* m_pWrapped;
|
||||
ULONG m_ref = 1;
|
||||
bool m_is_ex = false;
|
||||
|
||||
template <typename T, bool ex>
|
||||
HRESULT ApplyCreateDeviceFix(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, T** ppReturnedDeviceInterface);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,94 +1,128 @@
|
|||
// wrapper for IDirect3DDevice9 in d3d9.h
|
||||
// generated using wrapper_gen.rb
|
||||
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "Logger.h"
|
||||
#include "Context.h"
|
||||
|
||||
#include "IDirect3DDevice9.h"
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
#define IDirect3DDevice9_PrintLog(...) //PrintLog("%s", __VA_ARGS__);
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::QueryInterface(REFIID riid, void** ppvObj) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
if (ppvObj == nullptr) return E_POINTER;
|
||||
|
||||
if (riid == __uuidof(IUnknown) ||
|
||||
riid == __uuidof(IDirect3DDevice9))
|
||||
if (riid == __uuidof(this) ||
|
||||
riid == __uuidof(IUnknown) ||
|
||||
riid == __uuidof(IDirect3DDevice9) ||
|
||||
riid == __uuidof(IDirect3DDevice9Ex))
|
||||
{
|
||||
*ppvObj = static_cast<IDirect3DDevice9*>(this);
|
||||
if (!m_is_ex && riid == __uuidof(IDirect3DDevice9Ex))
|
||||
{
|
||||
//we are queried for IDirect3DDevice9Ex but we hold IDirect3DDevice9
|
||||
//upgrade wrapped interface, query it
|
||||
IDirect3DDevice9Ex* pIDirect3DDevice9Ex = nullptr;
|
||||
HRESULT hr = m_pWrapped->QueryInterface(riid, reinterpret_cast<void**>(&pIDirect3DDevice9Ex));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// release one reference from old one and take new IDirect3DDevice9Ex pointer
|
||||
m_pWrapped->Release();
|
||||
m_pWrapped = pIDirect3DDevice9Ex;
|
||||
m_is_ex = true;
|
||||
}
|
||||
|
||||
AddRef();
|
||||
*ppvObj = this;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObj = nullptr;
|
||||
return E_NOINTERFACE;
|
||||
return m_pWrapped->QueryInterface(riid, ppvObj);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE hkIDirect3DDevice9::AddRef() {
|
||||
m_pWrapped->AddRef();
|
||||
return InterlockedIncrement(&m_ref);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE hkIDirect3DDevice9::Release() {
|
||||
const ULONG ref = InterlockedDecrement(&m_ref);
|
||||
if (ref != 0) {
|
||||
m_pWrapped->Release();
|
||||
return ref;
|
||||
}
|
||||
const auto pWrapped = m_pWrapped;
|
||||
m_pWrapped = nullptr;
|
||||
delete this;
|
||||
|
||||
const ULONG ref_last = pWrapped->Release();
|
||||
if (ref_last != 0) {
|
||||
spdlog::error("Reference count for IDirect3DDevice9 is wrong: {} {} {}", (void*)this, ref, ref_last);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::TestCooperativeLevel() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->TestCooperativeLevel();
|
||||
}
|
||||
|
||||
UINT APIENTRY hkIDirect3DDevice9::GetAvailableTextureMem() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetAvailableTextureMem();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::EvictManagedResources() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->EvictManagedResources();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetDirect3D(IDirect3D9** ppD3D9) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetDirect3D(ppD3D9);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetDeviceCaps(D3DCAPS9* pCaps) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetDeviceCaps(pCaps);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetDisplayMode(iSwapChain, pMode);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS* pParameters) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetCreationParameters(pParameters);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap);
|
||||
}
|
||||
|
||||
void APIENTRY hkIDirect3DDevice9::SetCursorPosition(int X, int Y, DWORD Flags) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetCursorPosition(X, Y, Flags);
|
||||
}
|
||||
|
||||
BOOL APIENTRY hkIDirect3DDevice9::ShowCursor(BOOL bShow) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->ShowCursor(bShow);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) {
|
||||
PrintLog(__FUNCTION__);
|
||||
spdlog::info(__FUNCTION__);
|
||||
context.ApplyPresentationParameters(pPresentationParameters);
|
||||
return m_pWrapped->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
|
||||
// Steam Overlay Fix
|
||||
// Add some space, 16bytes should be enough
|
||||
// Steam Overlay crash fix
|
||||
// Add some space, 16bytes should be more than enough
|
||||
__nop(); __nop(); __nop(); __nop();
|
||||
__nop(); __nop(); __nop(); __nop();
|
||||
__nop(); __nop(); __nop(); __nop();
|
||||
|
@ -98,523 +132,597 @@ HRESULT APIENTRY hkIDirect3DDevice9::GetSwapChain(UINT iSwapChain, IDirect3DSwap
|
|||
}
|
||||
|
||||
UINT APIENTRY hkIDirect3DDevice9::GetNumberOfSwapChains() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetNumberOfSwapChains();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) {
|
||||
PrintLog("hkIDirect3DDevice9::Reset");
|
||||
|
||||
spdlog::debug("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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetBackBuffer(iSwapChain, iBackBuffer, Type, ppBackBuffer);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetRasterStatus(iSwapChain, pRasterStatus);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetDialogBoxMode(bEnableDialogs);
|
||||
}
|
||||
|
||||
void APIENTRY hkIDirect3DDevice9::SetGammaRamp(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetGammaRamp(iSwapChain, Flags, pRamp);
|
||||
}
|
||||
|
||||
void APIENTRY hkIDirect3DDevice9::GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__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);
|
||||
spdlog::trace(__FUNCTION__" {} {} {} {} {} {}", Length, Usage, FVF, Pool, (void*)ppVertexBuffer, (void*)pSharedHandle);
|
||||
return context.CreateVertexBuffer(m_pWrapped, 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);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->UpdateSurface(pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->UpdateTexture(pSourceTexture, pDestinationTexture);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetRenderTargetData(pRenderTarget, pDestSurface);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->StretchRect(pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateOffscreenPlainSurface(Width, Height, Format, Pool, ppSurface, pSharedHandle);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetRenderTarget(RenderTargetIndex, pRenderTarget);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetRenderTarget(RenderTargetIndex, ppRenderTarget);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetDepthStencilSurface(pNewZStencil);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetDepthStencilSurface(ppZStencilSurface);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::BeginScene() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->BeginScene();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::EndScene() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->Clear(Count, pRects, Flags, Color, Z, Stencil);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetTransform(State, pMatrix);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetTransform(State, pMatrix);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->MultiplyTransform(State, pMatrix);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9* pViewport) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetViewport(pViewport);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetViewport(D3DVIEWPORT9* pViewport) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetViewport(pViewport);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9* pMaterial) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetMaterial(pMaterial);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetMaterial(D3DMATERIAL9* pMaterial) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetMaterial(pMaterial);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetLight(DWORD Index, CONST D3DLIGHT9* pLight) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetLight(Index, pLight);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetLight(DWORD Index, D3DLIGHT9* pLight) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetLight(Index, pLight);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::LightEnable(DWORD Index, BOOL Enable) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->LightEnable(Index, Enable);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetLightEnable(DWORD Index, BOOL* pEnable) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetLightEnable(Index, pEnable);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetClipPlane(DWORD Index, CONST float* pPlane) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetClipPlane(Index, pPlane);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetClipPlane(DWORD Index, float* pPlane) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetClipPlane(Index, pPlane);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetRenderState(State, Value);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetRenderState(State, pValue);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateStateBlock(Type, ppSB);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::BeginStateBlock() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->BeginStateBlock();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->EndStateBlock(ppSB);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetClipStatus(pClipStatus);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9* pClipStatus) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetClipStatus(pClipStatus);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetTexture(DWORD Stage, IDirect3DBaseTexture9** ppTexture) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetTexture(Stage, ppTexture);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetTexture(Stage, pTexture);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetTextureStageState(Stage, Type, pValue);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetTextureStageState(Stage, Type, Value);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetSamplerState(Sampler, Type, pValue);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetSamplerState(Sampler, Type, Value);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::ValidateDevice(DWORD* pNumPasses) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->ValidateDevice(pNumPasses);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY* pEntries) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetPaletteEntries(PaletteNumber, pEntries);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetPaletteEntries(PaletteNumber, pEntries);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetCurrentTexturePalette(PaletteNumber);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetCurrentTexturePalette(UINT *PaletteNumber) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetCurrentTexturePalette(UINT* PaletteNumber) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetCurrentTexturePalette(PaletteNumber);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetScissorRect(CONST RECT* pRect) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return context.SetScissorRect(m_pWrapped, pRect);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetScissorRect(RECT* pRect) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetScissorRect(pRect);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetSoftwareVertexProcessing(bSoftware);
|
||||
}
|
||||
|
||||
BOOL APIENTRY hkIDirect3DDevice9::GetSoftwareVertexProcessing() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetSoftwareVertexProcessing();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetNPatchMode(float nSegments) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetNPatchMode(nSegments);
|
||||
}
|
||||
|
||||
float APIENTRY hkIDirect3DDevice9::GetNPatchMode() {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetNPatchMode();
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return context.DrawPrimitiveUP(m_pWrapped, 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__);
|
||||
spdlog::trace(__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__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateVertexDeclaration(pVertexElements, ppDecl);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetVertexDeclaration(pDecl);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetVertexDeclaration(ppDecl);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetFVF(DWORD FVF) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetFVF(FVF);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetFVF(DWORD* pFVF) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetFVF(pFVF);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateVertexShader(pFunction, ppShader);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetVertexShader(pShader);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetVertexShader(ppShader);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetVertexShaderConstantB(StartRegister, pConstantData, BoolCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetVertexShaderConstantB(StartRegister, pConstantData, BoolCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetStreamSource(StreamNumber, pStreamData, OffsetInBytes, Stride);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* pOffsetInBytes, UINT* pStride) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetStreamSource(StreamNumber, ppStreamData, pOffsetInBytes, pStride);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber, UINT Setting) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetStreamSourceFreq(StreamNumber, Setting);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber, UINT* pSetting) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetStreamSourceFreq(StreamNumber, pSetting);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetIndices(pIndexData);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetIndices(ppIndexData);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreatePixelShader(pFunction, ppShader);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetPixelShader(pShader);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetPixelShader(ppShader);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetPixelShaderConstantB(StartRegister, pConstantData, BoolCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetPixelShaderConstantB(StartRegister, pConstantData, BoolCount);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::DrawRectPatch(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::DrawTriPatch(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::DeletePatch(UINT Handle) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->DeletePatch(Handle);
|
||||
}
|
||||
|
||||
HRESULT APIENTRY hkIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) {
|
||||
IDirect3DDevice9_PrintLog(__FUNCTION__);
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateQuery(Type, ppQuery);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::SetConvolutionMonoKernel(UINT width, UINT height, float* rows, float* columns) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetConvolutionMonoKernel(width, height, rows, columns);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::ComposeRects(IDirect3DSurface9* pSrc, IDirect3DSurface9* pDst, IDirect3DVertexBuffer9* pSrcRectDescs, UINT NumRects, IDirect3DVertexBuffer9* pDstRectDescs, D3DCOMPOSERECTSOP Operation, int Xoffset, int Yoffset) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->ComposeRects(pSrc, pDst, pSrcRectDescs, NumRects, pDstRectDescs, Operation, Xoffset, Yoffset);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::PresentEx(const RECT* pSourceRect, const RECT* pDestRect, HWND hDestWindowOverride, const RGNDATA* pDirtyRegion, DWORD dwFlags) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->PresentEx(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::GetGPUThreadPriority(INT* pPriority) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetGPUThreadPriority(pPriority);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::SetGPUThreadPriority(INT Priority) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetGPUThreadPriority(Priority);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::WaitForVBlank(UINT iSwapChain) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->WaitForVBlank(iSwapChain);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::CheckResourceResidency(IDirect3DResource9** pResourceArray, UINT32 NumResources) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CheckResourceResidency(pResourceArray, NumResources);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::SetMaximumFrameLatency(UINT MaxLatency) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->SetMaximumFrameLatency(MaxLatency);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::GetMaximumFrameLatency(UINT* pMaxLatency) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetMaximumFrameLatency(pMaxLatency);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::CheckDeviceState(HWND hDestinationWindow) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CheckDeviceState(hDestinationWindow);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::CreateRenderTargetEx(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle, DWORD Usage) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateRenderTargetEx(Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle, Usage);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::CreateOffscreenPlainSurfaceEx(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle, DWORD Usage) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateOffscreenPlainSurfaceEx(Width, Height, Format, Pool, ppSurface, pSharedHandle, Usage);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::CreateDepthStencilSurfaceEx(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle, DWORD Usage) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->CreateDepthStencilSurfaceEx(Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle, Usage);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::ResetEx(D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->ResetEx(pPresentationParameters, pFullscreenDisplayMode);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE hkIDirect3DDevice9::GetDisplayModeEx(UINT iSwapChain, D3DDISPLAYMODEEX* pMode, D3DDISPLAYROTATION* pRotation) {
|
||||
spdlog::trace(__FUNCTION__);
|
||||
return m_pWrapped->GetDisplayModeEx(iSwapChain, pMode, pRotation);
|
||||
}
|
|
@ -1,163 +1,159 @@
|
|||
// wrapper for IDirect3DDevice9 in d3d9.h
|
||||
// generated using wrapper_gen.rb
|
||||
|
||||
#pragma once
|
||||
#include <d3d9.h>
|
||||
|
||||
interface hkIDirect3DDevice9 final : public IDirect3DDevice9 {
|
||||
interface DECLSPEC_UUID("DD98C5F4-40E6-43D9-A0EA-0C32ABDFDF9C") hkIDirect3DDevice9 final : public IDirect3DDevice9Ex{
|
||||
public:
|
||||
// original interface
|
||||
STDMETHOD(QueryInterface)(REFIID riid, void** ppvObj);
|
||||
ULONG STDMETHODCALLTYPE AddRef() {
|
||||
m_refPrivate++;
|
||||
m_refCount = m_pWrapped->AddRef();
|
||||
if (m_refCount > m_refPrivate) {
|
||||
// you should not see this ever
|
||||
PrintLog("WARNING: Internal reference counting to low, adjusting %u->%u", m_refPrivate.load(), m_refCount.load());
|
||||
m_refPrivate = m_refCount + 1;
|
||||
}
|
||||
#pragma region IUnknown
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObj);
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
#pragma endregion
|
||||
#pragma region IDirect3DDevice9
|
||||
HRESULT STDMETHODCALLTYPE TestCooperativeLevel();
|
||||
UINT STDMETHODCALLTYPE GetAvailableTextureMem();
|
||||
HRESULT STDMETHODCALLTYPE EvictManagedResources();
|
||||
HRESULT STDMETHODCALLTYPE GetDirect3D(IDirect3D9** ppD3D9);
|
||||
HRESULT STDMETHODCALLTYPE GetDeviceCaps(D3DCAPS9* pCaps);
|
||||
HRESULT STDMETHODCALLTYPE GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode);
|
||||
HRESULT STDMETHODCALLTYPE GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS* pParameters);
|
||||
HRESULT STDMETHODCALLTYPE SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap);
|
||||
void STDMETHODCALLTYPE SetCursorPosition(int X, int Y, DWORD Flags);
|
||||
BOOL STDMETHODCALLTYPE ShowCursor(BOOL bShow);
|
||||
HRESULT STDMETHODCALLTYPE CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
|
||||
HRESULT STDMETHODCALLTYPE GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
|
||||
UINT STDMETHODCALLTYPE GetNumberOfSwapChains();
|
||||
HRESULT STDMETHODCALLTYPE Reset(D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
HRESULT STDMETHODCALLTYPE Present(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion);
|
||||
HRESULT STDMETHODCALLTYPE GetBackBuffer(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer);
|
||||
HRESULT STDMETHODCALLTYPE GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus);
|
||||
HRESULT STDMETHODCALLTYPE SetDialogBoxMode(BOOL bEnableDialogs);
|
||||
void STDMETHODCALLTYPE SetGammaRamp(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp);
|
||||
void STDMETHODCALLTYPE GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp);
|
||||
HRESULT STDMETHODCALLTYPE CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE UpdateSurface(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint);
|
||||
HRESULT STDMETHODCALLTYPE UpdateTexture(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture);
|
||||
HRESULT STDMETHODCALLTYPE GetRenderTargetData(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface);
|
||||
HRESULT STDMETHODCALLTYPE GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface);
|
||||
HRESULT STDMETHODCALLTYPE StretchRect(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter);
|
||||
HRESULT STDMETHODCALLTYPE ColorFill(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color);
|
||||
HRESULT STDMETHODCALLTYPE CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT STDMETHODCALLTYPE SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget);
|
||||
HRESULT STDMETHODCALLTYPE GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget);
|
||||
HRESULT STDMETHODCALLTYPE SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil);
|
||||
HRESULT STDMETHODCALLTYPE GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface);
|
||||
HRESULT STDMETHODCALLTYPE BeginScene();
|
||||
HRESULT STDMETHODCALLTYPE EndScene();
|
||||
HRESULT STDMETHODCALLTYPE Clear(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil);
|
||||
HRESULT STDMETHODCALLTYPE SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
|
||||
HRESULT STDMETHODCALLTYPE GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix);
|
||||
HRESULT STDMETHODCALLTYPE MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
|
||||
HRESULT STDMETHODCALLTYPE SetViewport(CONST D3DVIEWPORT9* pViewport);
|
||||
HRESULT STDMETHODCALLTYPE GetViewport(D3DVIEWPORT9* pViewport);
|
||||
HRESULT STDMETHODCALLTYPE SetMaterial(CONST D3DMATERIAL9* pMaterial);
|
||||
HRESULT STDMETHODCALLTYPE GetMaterial(D3DMATERIAL9* pMaterial);
|
||||
HRESULT STDMETHODCALLTYPE SetLight(DWORD Index, CONST D3DLIGHT9* pLight);
|
||||
HRESULT STDMETHODCALLTYPE GetLight(DWORD Index, D3DLIGHT9* pLight);
|
||||
HRESULT STDMETHODCALLTYPE LightEnable(DWORD Index, BOOL Enable);
|
||||
HRESULT STDMETHODCALLTYPE GetLightEnable(DWORD Index, BOOL* pEnable);
|
||||
HRESULT STDMETHODCALLTYPE SetClipPlane(DWORD Index, CONST float* pPlane);
|
||||
HRESULT STDMETHODCALLTYPE GetClipPlane(DWORD Index, float* pPlane);
|
||||
HRESULT STDMETHODCALLTYPE SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
|
||||
HRESULT STDMETHODCALLTYPE GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue);
|
||||
HRESULT STDMETHODCALLTYPE CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB);
|
||||
HRESULT STDMETHODCALLTYPE BeginStateBlock();
|
||||
HRESULT STDMETHODCALLTYPE EndStateBlock(IDirect3DStateBlock9** ppSB);
|
||||
HRESULT STDMETHODCALLTYPE SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus);
|
||||
HRESULT STDMETHODCALLTYPE GetClipStatus(D3DCLIPSTATUS9* pClipStatus);
|
||||
HRESULT STDMETHODCALLTYPE GetTexture(DWORD Stage, IDirect3DBaseTexture9** ppTexture);
|
||||
HRESULT STDMETHODCALLTYPE SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture);
|
||||
HRESULT STDMETHODCALLTYPE GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue);
|
||||
HRESULT STDMETHODCALLTYPE SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
|
||||
HRESULT STDMETHODCALLTYPE GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue);
|
||||
HRESULT STDMETHODCALLTYPE SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
|
||||
HRESULT STDMETHODCALLTYPE ValidateDevice(DWORD* pNumPasses);
|
||||
HRESULT STDMETHODCALLTYPE SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY* pEntries);
|
||||
HRESULT STDMETHODCALLTYPE GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries);
|
||||
HRESULT STDMETHODCALLTYPE SetCurrentTexturePalette(UINT PaletteNumber);
|
||||
HRESULT STDMETHODCALLTYPE GetCurrentTexturePalette(UINT* PaletteNumber);
|
||||
HRESULT STDMETHODCALLTYPE SetScissorRect(CONST RECT* pRect);
|
||||
HRESULT STDMETHODCALLTYPE GetScissorRect(RECT* pRect);
|
||||
HRESULT STDMETHODCALLTYPE SetSoftwareVertexProcessing(BOOL bSoftware);
|
||||
BOOL STDMETHODCALLTYPE GetSoftwareVertexProcessing();
|
||||
HRESULT STDMETHODCALLTYPE SetNPatchMode(float nSegments);
|
||||
float STDMETHODCALLTYPE GetNPatchMode();
|
||||
HRESULT STDMETHODCALLTYPE DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount);
|
||||
HRESULT STDMETHODCALLTYPE DrawIndexedPrimitive(D3DPRIMITIVETYPE, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount);
|
||||
HRESULT STDMETHODCALLTYPE DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
|
||||
HRESULT STDMETHODCALLTYPE DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
|
||||
HRESULT STDMETHODCALLTYPE ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags);
|
||||
HRESULT STDMETHODCALLTYPE CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl);
|
||||
HRESULT STDMETHODCALLTYPE SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl);
|
||||
HRESULT STDMETHODCALLTYPE GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl);
|
||||
HRESULT STDMETHODCALLTYPE SetFVF(DWORD FVF);
|
||||
HRESULT STDMETHODCALLTYPE GetFVF(DWORD* pFVF);
|
||||
HRESULT STDMETHODCALLTYPE CreateVertexShader(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader);
|
||||
HRESULT STDMETHODCALLTYPE SetVertexShader(IDirect3DVertexShader9* pShader);
|
||||
HRESULT STDMETHODCALLTYPE GetVertexShader(IDirect3DVertexShader9** ppShader);
|
||||
HRESULT STDMETHODCALLTYPE SetVertexShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT STDMETHODCALLTYPE GetVertexShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT STDMETHODCALLTYPE SetVertexShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT STDMETHODCALLTYPE GetVertexShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT STDMETHODCALLTYPE SetVertexShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT STDMETHODCALLTYPE GetVertexShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT STDMETHODCALLTYPE SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride);
|
||||
HRESULT STDMETHODCALLTYPE GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* pOffsetInBytes, UINT* pStride);
|
||||
HRESULT STDMETHODCALLTYPE SetStreamSourceFreq(UINT StreamNumber, UINT Setting);
|
||||
HRESULT STDMETHODCALLTYPE GetStreamSourceFreq(UINT StreamNumber, UINT* pSetting);
|
||||
HRESULT STDMETHODCALLTYPE SetIndices(IDirect3DIndexBuffer9* pIndexData);
|
||||
HRESULT STDMETHODCALLTYPE GetIndices(IDirect3DIndexBuffer9** ppIndexData);
|
||||
HRESULT STDMETHODCALLTYPE CreatePixelShader(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader);
|
||||
HRESULT STDMETHODCALLTYPE SetPixelShader(IDirect3DPixelShader9* pShader);
|
||||
HRESULT STDMETHODCALLTYPE GetPixelShader(IDirect3DPixelShader9** ppShader);
|
||||
HRESULT STDMETHODCALLTYPE SetPixelShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT STDMETHODCALLTYPE GetPixelShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT STDMETHODCALLTYPE SetPixelShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT STDMETHODCALLTYPE GetPixelShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT STDMETHODCALLTYPE SetPixelShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT STDMETHODCALLTYPE GetPixelShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT STDMETHODCALLTYPE DrawRectPatch(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo);
|
||||
HRESULT STDMETHODCALLTYPE DrawTriPatch(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo);
|
||||
HRESULT STDMETHODCALLTYPE DeletePatch(UINT Handle);
|
||||
HRESULT STDMETHODCALLTYPE CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
|
||||
#pragma endregion
|
||||
#pragma region IDirect3DDevice9Ex
|
||||
HRESULT STDMETHODCALLTYPE SetConvolutionMonoKernel(THIS_ UINT width, UINT height, float* rows, float* columns);
|
||||
HRESULT STDMETHODCALLTYPE ComposeRects(THIS_ IDirect3DSurface9* pSrc, IDirect3DSurface9* pDst, IDirect3DVertexBuffer9* pSrcRectDescs, UINT NumRects, IDirect3DVertexBuffer9* pDstRectDescs, D3DCOMPOSERECTSOP Operation, int Xoffset, int Yoffset);
|
||||
HRESULT STDMETHODCALLTYPE PresentEx(THIS_ CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags);
|
||||
HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(THIS_ INT* pPriority);
|
||||
HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(THIS_ INT Priority);
|
||||
HRESULT STDMETHODCALLTYPE WaitForVBlank(THIS_ UINT iSwapChain);
|
||||
HRESULT STDMETHODCALLTYPE CheckResourceResidency(THIS_ IDirect3DResource9** pResourceArray, UINT32 NumResources);
|
||||
HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency(THIS_ UINT MaxLatency);
|
||||
HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency(THIS_ UINT* pMaxLatency);
|
||||
HRESULT STDMETHODCALLTYPE CheckDeviceState(THIS_ HWND hDestinationWindow);
|
||||
HRESULT STDMETHODCALLTYPE CreateRenderTargetEx(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle, DWORD Usage);
|
||||
HRESULT STDMETHODCALLTYPE CreateOffscreenPlainSurfaceEx(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle, DWORD Usage);
|
||||
HRESULT STDMETHODCALLTYPE CreateDepthStencilSurfaceEx(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle, DWORD Usage);
|
||||
HRESULT STDMETHODCALLTYPE ResetEx(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode);
|
||||
HRESULT STDMETHODCALLTYPE GetDisplayModeEx(THIS_ UINT iSwapChain, D3DDISPLAYMODEEX* pMode, D3DDISPLAYROTATION* pRotation);
|
||||
#pragma endregion
|
||||
|
||||
return m_refCount + 1;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release() {
|
||||
if (m_refPrivate == 0ul)
|
||||
delete this;
|
||||
|
||||
if (m_refPrivate != 0ul) {
|
||||
m_refPrivate--;
|
||||
|
||||
m_refCount = m_pWrapped->Release();
|
||||
}
|
||||
return m_refCount + 1;
|
||||
}
|
||||
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);
|
||||
|
||||
hkIDirect3DDevice9(IDirect3DDevice9* pIDirect3DDevice9)
|
||||
: m_pWrapped(pIDirect3DDevice9)
|
||||
hkIDirect3DDevice9(IDirect3DDevice9Ex* pIDirect3DDevice9, bool is_ex)
|
||||
: m_pWrapped(pIDirect3DDevice9), m_is_ex(is_ex)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~hkIDirect3DDevice9() { while (m_pWrapped->Release()); }
|
||||
virtual ~hkIDirect3DDevice9() { }
|
||||
|
||||
private:
|
||||
IDirect3DDevice9* m_pWrapped;
|
||||
std::atomic<uint32_t> m_refCount = { 0ul };
|
||||
std::atomic<uint32_t> m_refPrivate = { 1ul };
|
||||
IDirect3DDevice9Ex* m_pWrapped;
|
||||
ULONG m_ref = 1;
|
||||
bool m_is_ex = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ SETTING(s32, LongValue, PresentationInterval, Options, 0,
|
|||
L"# PresentationInterval (V-Sync)\n"
|
||||
L"#\n"
|
||||
L"# -1 = V-Sync forced off\n"
|
||||
L"# 0 = V-Sync not changed\n"
|
||||
L"# 0 = V-Sync not changed (default)\n"
|
||||
L"# 1 = V-Sync forced on"
|
||||
);
|
||||
|
||||
SETTING(s32, LongValue, TripleBuffering, Options, -1,
|
||||
L"# TripleBuffering\n"
|
||||
L"#\n"
|
||||
L"# -1 = Auto (Disabled for dxvk.dll; else, enabled)\n"
|
||||
L"# -1 = Auto (Disabled for dxvk.dll; else, enabled) (default)\n"
|
||||
L"# 0 = Off\n"
|
||||
L"# 1 = On"
|
||||
);
|
||||
|
@ -87,5 +87,23 @@ SETTING(bool, BoolValue, Borderless, Borderless, false, 0);
|
|||
SETTING(bool, BoolValue, ForceWindowedMode, Borderless, false, 0);
|
||||
SETTING(bool, BoolValue, AllWindows, Borderless, false, 0);
|
||||
|
||||
SETTING(s32, LongValue, LogLevel, Log, 2,
|
||||
L"# LogLevel\n"
|
||||
L"#\n"
|
||||
L"# 0 = trace\n"
|
||||
L"# 1 = debug\n"
|
||||
L"# 2 = info (default)\n"
|
||||
L"# 3 = warning\n"
|
||||
L"# 4 = error\n"
|
||||
L"# 5 = critical"
|
||||
);
|
||||
|
||||
SETTING(bool, BoolValue, LogFlush, Log, false,
|
||||
L"# LogFlush\n"
|
||||
L"#\n"
|
||||
L"# true = flush log file every line (very slow!)\n"
|
||||
L"# false = flush log file only when error level message is logged (default)"
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define CINTERFACE
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "Logger.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "MinHook.h"
|
||||
|
||||
namespace cinterface
|
||||
|
@ -10,7 +10,7 @@ namespace cinterface
|
|||
|
||||
HRESULT STDMETHODCALLTYPE HookLock(IDirect3DVertexBuffer9* This, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags)
|
||||
{
|
||||
//PrintLog(__FUNCTION__" %u", SizeToLock);
|
||||
spdlog::trace(__FUNCTION__" {}", SizeToLock);
|
||||
if (SizeToLock == 358400)
|
||||
Flags = D3DLOCK_DISCARD;
|
||||
return TrueLock(This, OffsetToLock, SizeToLock, ppbData, Flags);
|
||||
|
@ -20,11 +20,11 @@ namespace cinterface
|
|||
{
|
||||
if (pVertexBuffer->lpVtbl->Lock && TrueLock == nullptr)
|
||||
{
|
||||
PrintLog("WARINING: Experimental DiscardUIVertexBuffer enabled!");
|
||||
spdlog::warn("Experimental DiscardUIVertexBuffer enabled!");
|
||||
const MH_STATUS createHookLock = MH_CreateHook(pVertexBuffer->lpVtbl->Lock, HookLock, reinterpret_cast<void**>(&TrueLock));
|
||||
PrintLog("CreateHookLock = %d", createHookLock);
|
||||
spdlog::info("CreateHookLock = {}", createHookLock);
|
||||
const MH_STATUS enableHookLock = MH_EnableHook(pVertexBuffer->lpVtbl->Lock);
|
||||
PrintLog("EnableHookLock = %d", enableHookLock);
|
||||
spdlog::info("EnableHookLock = {}", enableHookLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "comdef.h"
|
||||
#include <comdef.h>
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "StringUtil.h"
|
||||
|
||||
template <class T>
|
||||
class WrapperBase
|
||||
{
|
||||
|
@ -17,7 +19,7 @@ public:
|
|||
if (m_module)
|
||||
{
|
||||
FreeLibrary(m_module);
|
||||
PrintLog("Unloaded %s", module_path.c_str());
|
||||
spdlog::info("Unloaded {}", module_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,16 +36,16 @@ protected:
|
|||
m_module = LoadLibraryA(module_path.c_str());
|
||||
|
||||
if (m_module) {
|
||||
PrintLog("Loaded %s", module_path.c_str());
|
||||
spdlog::info("Loaded {}", module_path);
|
||||
return true;
|
||||
}
|
||||
else if(fail_is_critical) {
|
||||
HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
_com_error err(hr);
|
||||
|
||||
std::string msg = StringFromFormat("Cannot load %s\nHRESULT 0x%08X: \"%s\"", module_path.c_str(), err.Error(), err.ErrorMessage());
|
||||
std::string msg = StringFromFormat("Cannot load %s\nHRESULT 0x{:X} \"{}\"", module_path.c_str(), err.Error(), err.ErrorMessage());
|
||||
|
||||
PrintLog(msg.c_str());
|
||||
spdlog::critical(msg);
|
||||
MessageBoxA(NULL, msg.c_str(), "Error", MB_ICONERROR);
|
||||
ExitProcess(hr);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>d3d9</TargetName>
|
||||
<IncludePath>$(SolutionDir)\Common;$(SolutionDir)\MinHook\include;$(DXSDK_DIR)\Include;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(SolutionDir)\Common;$(SolutionDir)\Deps\MinHook\include;$(SolutionDir)\Deps\spdlog\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
|
@ -84,7 +84,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>d3d9</TargetName>
|
||||
<IncludePath>$(SolutionDir)\Common;$(SolutionDir)\MinHook\include;$(DXSDK_DIR)\Include;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(SolutionDir)\Common;$(SolutionDir)\Deps\MinHook\include;$(SolutionDir)\Deps\spdlog\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
|
@ -96,9 +96,11 @@
|
|||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;SPDLOG_DISABLE_DEFAULT_LOGGER;SPDLOG_WCHAR_TO_UTF8_SUPPORT;_DEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -127,11 +129,14 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;SPDLOG_DISABLE_DEFAULT_LOGGER;SPDLOG_WCHAR_TO_UTF8_SUPPORT;NDEBUG;_WINDOWS;_USRDLL;D3D9EX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<CreateHotpatchableImage>true</CreateHotpatchableImage>
|
||||
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -209,7 +214,7 @@
|
|||
<None Include="exports.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MinHook\build\VC16\libMinHook.vcxproj">
|
||||
<ProjectReference Include="..\Deps\MinHook\build\VC16\libMinHook.vcxproj">
|
||||
<Project>{f142a341-5ee0-442d-a15f-98ae9b48dbae}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -25,3 +25,5 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Context.h"
|
Loading…
Reference in a new issue