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

Method OnStatsLoadGuarded

BG3Extender/Extender/ScriptExtender.cpp:240–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240void ScriptExtender::OnStatsLoadGuarded(stats::RPGStats::LoadProc* wrapped, stats::RPGStats* mgr, Array<STDString>* paths)
241{
242 // Stats load is scheduled from the client on the shared worker pool
243 ContextGuard _(ContextType::Client);
244
245 // Ensure that we have an empty extension state ready in case OnStatsLoad() is the first callback
246 // due to late load
247 if (!client_.HasExtensionState()) {
248 client_.ResetExtensionState();
249 }
250
251 statLoadOrderHelper_.OnLoadStarted();
252 client_.LoadExtensionState(ExtensionStateContext::Load);
253
254 {
255 ecl::LuaClientPin lua(client_.GetExtensionState());
256 if (lua) {
257 lua->OnModuleLoadStarted();
258 }
259 }
260
261 {
262 DisableCrashReporting _;
263 wrapped(mgr, paths);
264 }
265
266 client_.LoadExtensionState(ExtensionStateContext::Game);
267
268 if (client_.HasExtensionState()) {
269 client_.GetExtensionState().OnStatsLoaded();
270 }
271
272 imgui_.EnableUI(true);
273}
274
275void ScriptExtender::OnStatsLoad(stats::RPGStats::LoadProc* wrapped, stats::RPGStats* mgr, Array<STDString>* paths)
276{

Callers

nothing calls this directly

Calls 7

GetExtensionStateMethod · 0.80
EnableUIMethod · 0.80
HasExtensionStateMethod · 0.45
ResetExtensionStateMethod · 0.45
LoadExtensionStateMethod · 0.45
OnModuleLoadStartedMethod · 0.45
OnStatsLoadedMethod · 0.45

Tested by

no test coverage detected