MCPcopy Create free account
hub / github.com/Norbyte/bg3se / Initialize

Method Initialize

BG3Extender/Extender/Client/ScriptExtenderClient.cpp:66–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void ScriptExtender::Initialize()
67{
68 // Wrap state change functions even if extension startup failed, otherwise
69 // we won't be able to show any startup errors
70
71 auto& lib = GetStaticSymbols();
72
73 DetourTransactionBegin();
74 DetourUpdateThread(GetCurrentThread());
75
76 if (lib.ecl__GameStateThreaded__GameStateWorker__DoWork != nullptr) {
77 gameStateWorkerStart_.Wrap(lib.ecl__GameStateThreaded__GameStateWorker__DoWork);
78 }
79
80 if (lib.ecl__GameStateMachine__Update != nullptr) {
81 gameStateMachineUpdate_.Wrap(lib.ecl__GameStateMachine__Update);
82 }
83
84 DetourTransactionCommit();
85
86 gameStateWorkerStart_.SetWrapper(&ScriptExtender::GameStateWorkerWrapper, this);
87 gameStateMachineUpdate_.SetPrePostHook(&ScriptExtender::OnPreUpdate, &ScriptExtender::OnUpdate, this);
88
89 sdl_.EnableHooks();
90}
91
92void ScriptExtender::Shutdown()
93{

Callers 1

InitializeLuaStateMethod · 0.45

Calls 4

SetWrapperMethod · 0.80
SetPrePostHookMethod · 0.80
WrapMethod · 0.45
EnableHooksMethod · 0.45

Tested by

no test coverage detected