Skip to content

Commit

Permalink
add xinput shim option
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Jul 10, 2024
1 parent ecd46af commit 49ecb52
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ This is not a virus, but you probably shouldn't believe a random file on the int
- You can also run or create a shortcut to `MAXWELL.exe --launch_game ..` to launch the game automatically
- Check `--help` for other command line switches
- `MAXWELL.dll` also works with other generic DLL injectors
- Also works with Wine 9
- Might work with Proton, but trying to load MAXWELL through Steam will probably just make things more complicated
- Also works with Wine 9 / Proton 9
- You can also rename `MAXWELL.dll` to `xinput9_1_0.dll` and place it next to `Animal Well.exe` to load it without the injector
- Use the Steam launch options `PROTON_USE_WINED3D=1 WINEDLLOVERRIDES="xinput9_1_0=n,b" %command%` to load this on Proton
- Doesn't seem to work with some builds of Goldberg's emulator if it has overlay enabled
- To fix this, create a `Animal Well/steam_settings/disable_overlay.txt` file

Expand Down
13 changes: 13 additions & 0 deletions dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,16 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
extern "C" __declspec(dllexport) const char *dll_version() {
return get_version_cstr();
}

auto xinput = LoadLibraryA("c:\\Windows\\system32\\xinput9_1_0.dll");
typedef DWORD(__stdcall *XInputFun)(DWORD, void *);
auto xinput_get_state =
reinterpret_cast<XInputFun>(GetProcAddress(xinput, "XInputGetState"));
auto xinput_set_state =
reinterpret_cast<XInputFun>(GetProcAddress(xinput, "XInputSetState"));
extern "C" __declspec(dllexport) DWORD XInputGetState(DWORD a, void *b) {
return xinput_get_state(a, b);
}
extern "C" __declspec(dllexport) DWORD XInputSetState(DWORD a, void *b) {
return xinput_set_state(a, b);
}

0 comments on commit 49ecb52

Please sign in to comment.