Skip to content

Commit

Permalink
Merge pull request #746 from psiberx/master
Browse files Browse the repository at this point in the history
More hotfixes for 1.21.0
  • Loading branch information
WSSDude authored Nov 11, 2022
2 parents d130f74 + 3cd868a commit 81c038e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/overlay/widgets/TweakDBEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void TweakDBEditor::RefreshFlats()
}

const auto cGroupName = flatName.substr(0, idx);
cacheFlat(RED4ext::FNV1a64(cGroupName.c_str()), cGroupName.c_str(), flatName.substr(idx, idx + 1), dbid);
cacheFlat(RED4ext::FNV1a64(cGroupName.c_str()), cGroupName.c_str(), flatName.c_str(), dbid);
}
}
});
Expand Down
17 changes: 16 additions & 1 deletion src/reverse/RTTIHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ static std::unique_ptr<RTTIHelper> s_pInstance{ nullptr };

void RTTIHelper::Initialize(const LockableState& acLua, LuaSandbox& apSandbox)
{
s_pInstance.reset(new RTTIHelper(acLua, apSandbox));
if (!s_pInstance)
{
s_pInstance.reset(new RTTIHelper(acLua, apSandbox));
}
}

void RTTIHelper::PostInitialize()
{
if (s_pInstance)
{
s_pInstance->InitializeRuntime();
}
}

void RTTIHelper::Shutdown()
Expand Down Expand Up @@ -47,6 +58,10 @@ void RTTIHelper::InitializeRTTI()
m_pRtti = RED4ext::CRTTISystem::Get();
m_pGameInstanceType = m_pRtti->GetClass(RED4ext::FNV1a64("ScriptGameInstance"));

}

void RTTIHelper::InitializeRuntime()
{
const auto cpEngine = RED4ext::CGameEngine::Get();
const auto cpGameInstance = cpEngine->framework->gameInstance;
const auto cpPlayerSystemType = m_pRtti->GetType(RED4ext::FNV1a64("cpPlayerSystem"));
Expand Down
2 changes: 2 additions & 0 deletions src/reverse/RTTIHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct RTTIHelper
std::map<uint64_t, RED4ext::CBaseFunction*> FindFunctions(RED4ext::CClass* apClass, const uint64_t acShortNameHash, bool aIsMember) const;

static void Initialize(const LockableState& acpLua, LuaSandbox& apSandbox);
static void PostInitialize();
static void Shutdown();
static RTTIHelper& Get();

Expand All @@ -46,6 +47,7 @@ struct RTTIHelper
RTTIHelper(const LockableState& acLua, LuaSandbox& apSandbox);

void InitializeRTTI();
void InitializeRuntime();
void ParseGlobalStatics();

bool IsFunctionAlias(RED4ext::CBaseFunction* apFunc);
Expand Down
3 changes: 3 additions & 0 deletions src/scripting/Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ void Scripting::PostInitializeScripting()

m_sandbox.PostInitializeScripting();

RTTIHelper::Initialize(m_lua.AsRef(), m_sandbox);

TriggerOnHook();
}

Expand Down Expand Up @@ -601,6 +603,7 @@ void Scripting::PostInitializeMods()
globals["Game"] = this;

RTTIExtender::Initialize();
RTTIHelper::PostInitialize();
m_mapper.Register();

RegisterOverrides();
Expand Down

0 comments on commit 81c038e

Please sign in to comment.