Skip to content

Commit 85d1bd6

Browse files
authored
SkyrimSoulsRE compatibility. (#803)
1 parent d016be2 commit 85d1bd6

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

Code/client/Games/Skyrim/Interface/UI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <Games/Skyrim/Interface/UI.h>
33
#include <Misc/BSFixedString.h>
44
#include <TiltedOnlinePCH.h>
5+
#include "immersive_launcher/stubs/DllBlocklist.h"
56

67
#include <World.h>
78

@@ -84,7 +85,7 @@ static void* (*UI_AddToActiveQueue)(UI*, IMenu*, void*);
8485
static void* UI_AddToActiveQueue_Hook(UI* apSelf, IMenu* apMenu, void* apFoundItem /*In reality a reference*/)
8586
{
8687
// if the menu is empty we let the real function handle it.
87-
if (!apMenu || !World::Get().GetTransport().IsConnected())
88+
if (!apMenu || !World::Get().GetTransport().IsConnected() || stubs::g_IsSoulsREActive)
8889
return UI_AddToActiveQueue(apSelf, apMenu, apFoundItem);
8990

9091
#if 0

Code/immersive_launcher/stubs/DllBlocklist.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace stubs
1818
// for causing crashes and incompatibility with ST
1919
const wchar_t* const kDllBlocklist[] = {
2020
L"EngineFixes.dll", // Skyrim Engine Fixes, breaks our hooks
21-
L"SkyrimSoulsRE.dll", // Our mod implements this with special handling
2221
L"crashhandler64.dll", // Stream crash handler, breaks heap
2322
L"fraps64.dll", // Breaks tilted ui
2423
L"SpecialK64.dll", // breaks rendering
@@ -259,4 +258,13 @@ bool IsDllBlocked(std::wstring_view dllName)
259258

260259
return false;
261260
}
261+
262+
bool IsSoulsRE(std::wstring_view dllName)
263+
{
264+
const wchar_t *dllEntry = L"SkyrimSoulsRE.dll";
265+
if (std::wcscmp(dllName.data(), dllEntry) == 0)
266+
return true;
267+
268+
return false;
269+
}
262270
} // namespace stubs

Code/immersive_launcher/stubs/DllBlocklist.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ namespace stubs
66
{
77
// Returns true if the module name is found in the hard block list.
88
bool IsDllBlocked(std::wstring_view dllName);
9+
10+
// Returns true if the module is a Skyrim Souls RE related DLL.
11+
bool IsSoulsRE(std::wstring_view dllName);
12+
13+
// Global flag indicating whether Skyrim Souls RE is active.
14+
bool g_IsSoulsREActive{};
915
} // namespace stubs

Code/immersive_launcher/stubs/FileMapping.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ NTSTATUS WINAPI TP_LdrLoadDll(const wchar_t* apPath, uint32_t* apFlags, UNICODE_
274274
size_t pos = fileName.find_last_of(L'\\');
275275
if (pos != std::wstring_view::npos && (pos + 1) != fileName.length())
276276
{
277-
if (stubs::IsDllBlocked(&fileName[pos + 1]))
277+
const wchar_t *name = &fileName[pos + 1];
278+
if (stubs::IsSoulsRE(name))
279+
stubs::g_IsSoulsREActive = true;
280+
281+
if (stubs::IsDllBlocked(name))
278282
{
279283
// invalid image hash
280284
// this signals windows to *NOT TRY* loading it again at a later time.

0 commit comments

Comments
 (0)