Interruptible cutscenes
This commit is contained in:
parent
623789c5bf
commit
70489f2b30
BIN
SKSE/Plugins/EnderalSE.dll
(Stored with Git LFS)
BIN
SKSE/Plugins/EnderalSE.dll
(Stored with Git LFS)
Binary file not shown.
@ -2,3 +2,4 @@ FlatMapMarkers = true
|
||||
StayAtSystemPage = true
|
||||
MapMarkerPlacementFixes = true
|
||||
AchievementFix = true
|
||||
VideoInterruptPatch = true
|
||||
|
42
source/Enderal DLL/src/BinkInterruptPatch.h
Normal file
42
source/Enderal DLL/src/BinkInterruptPatch.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <XInput.h>
|
||||
#pragma comment(lib, "XInput.lib")
|
||||
|
||||
namespace BinkInterruptPatch
|
||||
{
|
||||
struct BinkListener
|
||||
{
|
||||
static bool thunk()
|
||||
{
|
||||
auto result = func();
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
static inline REL::Relocation<decltype(thunk)> func;
|
||||
};
|
||||
|
||||
void Install()
|
||||
{
|
||||
REL::Relocation<std::uintptr_t> target{ REL::RelocationID(87887, 90256), REL::Relocate(0x9F, 0x16F) };
|
||||
auto& trampoline = SKSE::GetTrampoline();
|
||||
|
||||
SKSE::AllocTrampoline(14);
|
||||
BinkListener::func = trampoline.write_call<5>(target.address(), BinkListener::thunk);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
#include "StayAtSystemPage.h"
|
||||
#include "MapMarkerPlacement.h"
|
||||
#include "AchievementFix.h"
|
||||
#include "BinkInterruptPatch.h"
|
||||
|
||||
using namespace SKSE;
|
||||
|
||||
@ -12,7 +13,8 @@ static std::map<std::string, bool> g_settings{
|
||||
{ "FlatMapMarkers", true },
|
||||
{ "StayAtSystemPage", true },
|
||||
{ "MapMarkerPlacementFixes", true },
|
||||
{ "AchievementFix", true }
|
||||
{ "AchievementFix", true },
|
||||
{ "VideoInterruptPatch", true }
|
||||
};
|
||||
|
||||
namespace {
|
||||
@ -161,6 +163,11 @@ SKSEPluginLoad(const LoadInterface* skse) {
|
||||
|
||||
GetPapyrusInterface()->Register(Papyrus::Bind);
|
||||
|
||||
if (g_settings.at("VideoInterruptPatch")) {
|
||||
logger::info("Making videos interruptible...");
|
||||
BinkInterruptPatch::Install();
|
||||
}
|
||||
|
||||
if (g_settings.at("AchievementFix")) {
|
||||
logger::info("Patching achievements...");
|
||||
AchievementFix::Install();
|
||||
|
Loading…
Reference in New Issue
Block a user