Let us start here, from square one. No, from Zero!

This commit is contained in:
smpn2
2022-09-30 22:45:51 +09:00
parent 14215af0d1
commit b7a60638a4
1005 changed files with 303069 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
#include "hook.h"
#include <windows.h>
#include <dinput.h>
#include "util/detour.h"
#include "util/logging.h"
#include "fake_backend.h"
//static decltype(DirectInput8Create) *DirectInput8Create_orig = nullptr;
static HRESULT WINAPI DirectInput8Create_hook(
HINSTANCE hinst,
DWORD dwVersion,
REFIID riidltf,
LPVOID *ppvOut,
LPUNKNOWN punkOuter)
{
log_misc("input::dinput8", "DirectInput8Create hook hit");
if (ppvOut == nullptr) {
return E_POINTER;
}
*ppvOut = new FakeIDirectInput8W();
return DI_OK;
}
void hooks::input::dinput8::init(HMODULE module) {
/*
* This is for the games using DirectInput for keyboard/gamepad controls themselves,
* for things such as debug controls. We don't want that, neither do we want the game to
* interfere with our RawInput stuff.
*/
log_info("input::dinput8", "attaching...");
// patch IAT
detour::iat_try("DirectInput8Create", DirectInput8Create_hook, module, "dinput8.dll");
/*
if (DirectInput8Create_orig == nullptr) {
DirectInput8Create_orig = orig;
}
*/
log_info("input::dinput8", "attached");
}