Skip to content

Commit

Permalink
Merge branch 'vr' of github.com:alandtse/CommonLibVR into vr
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Dec 19, 2023
2 parents f955d27 + 6089216 commit b624e7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 4 additions & 3 deletions include/RE/T/TESDataHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ namespace RE
class TESDataHandler : public BSTSingletonSDM<TESDataHandler>
{
public:
static TESDataHandler* GetSingleton(bool a_VRESL = true);
inline static RE::TESFileCollection* VRcompiledFileCollection = nullptr; // used by SkyrimVRESL to store pointer to VR version
static TESDataHandler* GetSingleton(bool a_VRESL = true);

bool AddFormToDataHandler(TESForm* a_form);

Expand Down Expand Up @@ -100,9 +101,9 @@ namespace RE
TESRegionDataManager* regionDataManager; // DB0
InventoryChanges* merchantInventory; // DB8
#else
std::uint32_t loadedModCount; // D70
std::uint32_t loadedModCount; // D70 this should be avoided if SkyrimVRESL is available
std::uint32_t pad14; // D74
TESFile* loadedMods[0xFF]; // D78
TESFile* loadedMods[0xFF]; // D78 this should be avoided if SkyrimVRESL is available
bool masterSave; // 1570
bool blockSave; // 1571
bool saveLoadGame; // 1572
Expand Down
8 changes: 3 additions & 5 deletions src/RE/T/TESDataHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@

namespace RE
{
static const RE::TESFileCollection* VRcompiledFileCollection = nullptr;

TESDataHandler* TESDataHandler::GetSingleton(bool a_VRESL)
{
REL::Relocation<TESDataHandler**> singleton{ Offset::TESDataHandler::Singleton };
#ifdef SKYRIMVR
if (a_VRESL) {
if (a_VRESL && !TESDataHandler::VRcompiledFileCollection) {
const auto VRhandle = WinAPI::GetModuleHandle("skyrimvresl");
if (!VRcompiledFileCollection) {
if (VRhandle != NULL) {
const auto GetCompiledFileCollection = reinterpret_cast<const RE::TESFileCollection* (*)()>(WinAPI::GetProcAddress(VRhandle, "GetCompiledFileCollectionExtern"));
if (GetCompiledFileCollection != nullptr) {
VRcompiledFileCollection = GetCompiledFileCollection();
TESDataHandler::VRcompiledFileCollection = const_cast<RE::TESFileCollection*>(GetCompiledFileCollection());
}
}
}
Expand Down

0 comments on commit b624e7e

Please sign in to comment.