4
Fork 0

Force borderless mode with INI toggle, a workaround for freezing during Bink playback

development
Eddoursul 3 months ago
parent 34e767ca27
commit afa68ffd25
  1. 5
      README.md
  2. 1
      SKSE/Plugins/EnderalSE.ini
  3. 11
      source/Enderal DLL/src/Main.cpp
  4. 2
      source/Enderal DLL/src/Patches/AchievementFix.h
  5. 30
      source/Enderal DLL/src/Patches/ForceBorderless.h

@ -12,15 +12,16 @@
- [Scrambled Bugs](https://www.nexusmods.com/skyrimspecialedition/mods/43532)
- [powerofthree's Tweaks](https://www.nexusmods.com/skyrimspecialedition/mods/51073)
- [Fix Note icon for SkyUI](https://www.nexusmods.com/skyrimspecialedition/mods/32561)
- [.NET Script Framework](https://www.nexusmods.com/skyrimspecialedition/mods/21294) (SE) or [Crash Logger](https://www.nexusmods.com/skyrimspecialedition/mods/59596) (AE)
- [Crash Logger](https://www.nexusmods.com/skyrimspecialedition/mods/59818) (SE/AE/VR)
## How to play
## How to run
- Add a new Skyrim SE instance to Mod Organizer 2.
- Creation Club mods must be moved to a separate mod and disabled.
- In MO2, create an empty mod, name it `Enderal SE - Media`, and copy `E - Sounds.bsa`, `L - Voices.bsa`, and the `Video` directory to it.
- This repository uses LFS to store binary files, run `git lfs install` before cloning it.
- Clone this repository, move it to `mods` in your MO2 instance.
- You should now have two custom mods in MO2, `Enderal SE - Media` and Enderal itself.
- Build EnderalSE.dll.
- Configure the game through Skyrim Launcher.
- Run it with skse64_loader.exe through MO2.

@ -3,3 +3,4 @@ StayAtSystemPage = true
MapMarkerPlacementFixes = true
AchievementFix = true
VideoInterruptPatch = true
ForceBorderless = true

@ -10,6 +10,7 @@
#include "Patches/TweenMenuPatch.h"
#include "Patches/HeroMenuPatch.h"
#include "Patches/HUDMenuPatch.h"
#include "Patches/ForceBorderless.h"
using namespace SKSE;
@ -18,7 +19,8 @@ static std::map<std::string, bool> g_settings{
{ "StayAtSystemPage", true },
{ "MapMarkerPlacementFixes", true },
{ "AchievementFix", true },
{ "VideoInterruptPatch", true }
{ "VideoInterruptPatch", true },
{ "ForceBorderless", true }
};
namespace {
@ -63,9 +65,9 @@ namespace {
MapMarkerPlacement::Install();
}
} else if (message->type == MessagingInterface::kDataLoaded) {
if (GetLoadInterface()->RuntimeVersion().minor() > 5) {
if (REL::Module::get().version() > REL::Version(1, 5, 97, 0)) {
RE::INIPrefSettingCollection::GetSingleton()->GetSetting("bFreebiesSeen:General")->data.b = true;
if (GetLoadInterface()->RuntimeVersion().minor() > 6 || GetLoadInterface()->RuntimeVersion().patch() >= 1130) {
if (REL::Module::get().version() >= REL::Version(1, 6, 1130, 0)) {
RE::INIPrefSettingCollection::GetSingleton()->GetSetting("bUpsellOwned:General")->data.b = true;
}
}
@ -187,6 +189,9 @@ SKSEPluginLoad(const LoadInterface* skse) {
}
if (!REL::Module::IsVR()) {
if (g_settings.at("ForceBorderless")) {
ForceBorderless::Install();
}
if (g_settings.at("FlatMapMarkers")) {
logger::info("Initializing Flat Map Markers...");
FlatMapMarkers::Install();

@ -6,7 +6,7 @@ namespace AchievementFix
{
REL::Relocation<std::uintptr_t> target;
if (GetLoadInterface()->RuntimeVersion().minor() > 6 || GetLoadInterface()->RuntimeVersion().patch() >= 1130) {
if (REL::Module::get().version() >= REL::Version(1, 6, 1130, 0)) {
// Checked: 1.6.1130
target = REL::ID(441528);
} else {

@ -0,0 +1,30 @@
#pragma once
// Bink playback is prone to freezing in bordered window, we enforce borderless mode here
namespace ForceBorderless
{
void Install()
{
if (REL::Module::IsVR()) {
return;
}
std::uint8_t code[] = { 0xB8, 0x01, 0x00, 0x00, 0x00, REL::NOP, REL::NOP }; // mov eax,0x1
auto version = REL::Module::get().version();
if (version >= REL::Version(1, 6, 1130, 0) && version <= REL::Version(1, 6, 1170, 0)) {
logger::info("Initializing borderless mode...");
REL::Relocation<std::uintptr_t> target{ REL::ID(36547), 0xBEA };
REL::safe_write(target.address(), code, sizeof(code));
} else if (version >= REL::Version(1, 5, 97, 0) && version < REL::Version(1, 6, 1130, 0)) {
logger::info("Initializing borderless mode...");
REL::Relocation<std::uintptr_t> target{ REL::RelocationID(35548, 36547), REL::Relocate(0x83A, version >= REL::Version(1, 6, 342, 0) ? version >= REL::Version(1, 6, 629, 0) ? 0xCFA : 0xCDA : 0xCBB) };
REL::safe_write(target.address(), code, sizeof(code));
} else {
logger::info("Untested version of Skyrim, skipping borderless mode...");
return;
}
}
}
Loading…
Cancel
Save