2023-12-11 08:53:57 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <XInput.h>
|
|
|
|
#pragma comment(lib, "XInput.lib")
|
|
|
|
|
|
|
|
namespace BinkInterruptPatch
|
|
|
|
{
|
|
|
|
struct BinkListener
|
|
|
|
{
|
2023-12-13 16:10:02 +00:00
|
|
|
static bool thunk(RE::BGSMoviePlayer* moviePlayer, bool bInterruptible)
|
2023-12-11 08:53:57 +00:00
|
|
|
{
|
2023-12-13 16:10:02 +00:00
|
|
|
if (!bInterruptible) {
|
|
|
|
return true;
|
|
|
|
}
|
2023-12-11 08:53:57 +00:00
|
|
|
|
2023-12-13 04:08:38 +00:00
|
|
|
if (SKSE::WinAPI::GetKeyState(VK_SPACE) & 0x8000 || SKSE::WinAPI::GetKeyState(VK_ESCAPE) & 0x8000 || SKSE::WinAPI::GetKeyState(VK_LBUTTON) & 0x8000 || SKSE::WinAPI::GetKeyState(VK_RBUTTON) & 0x8000 || SKSE::WinAPI::GetKeyState(VK_LMENU) & 0x8000) {
|
2023-12-11 08:53:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RE::BSInputDeviceManager::GetSingleton()->IsGamepadEnabled()) {
|
|
|
|
for (DWORD index = 0; index < XUSER_MAX_COUNT; index++) {
|
|
|
|
XINPUT_STATE state;
|
|
|
|
if (XInputGetState(index, &state) == ERROR_SUCCESS) {
|
|
|
|
if ((state.Gamepad.wButtons & XINPUT_GAMEPAD_A) || (state.Gamepad.wButtons & XINPUT_GAMEPAD_START)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-13 16:10:02 +00:00
|
|
|
return true;
|
2023-12-11 08:53:57 +00:00
|
|
|
}
|
|
|
|
static inline REL::Relocation<decltype(thunk)> func;
|
|
|
|
};
|
|
|
|
|
|
|
|
void Install()
|
|
|
|
{
|
2023-12-21 11:41:08 +00:00
|
|
|
// Checked: 1.5.97, 1.6.640, 1.6.659, 1.6.1130
|
2023-12-13 16:10:02 +00:00
|
|
|
REL::Relocation<std::uintptr_t> target{ REL::RelocationID(87890, 90259), REL::Relocate(0x22, 0x21) };
|
2023-12-11 08:53:57 +00:00
|
|
|
SKSE::AllocTrampoline(14);
|
2023-12-21 11:41:08 +00:00
|
|
|
BinkListener::func = SKSE::GetTrampoline().write_call<5>(target.address(), BinkListener::thunk);
|
2023-12-11 08:53:57 +00:00
|
|
|
}
|
|
|
|
}
|