| 40 | } |
| 41 | |
| 42 | void ScriptExtender::Initialize() |
| 43 | { |
| 44 | auto& lib = GetStaticSymbols(); |
| 45 | |
| 46 | if (!gExtender->GetLibraryManager().CriticalInitializationFailed()) { |
| 47 | DetourTransactionBegin(); |
| 48 | DetourUpdateThread(GetCurrentThread()); |
| 49 | |
| 50 | if (lib.esv__GameStateThreaded__GameStateWorker__DoWork != nullptr) { |
| 51 | gameStateWorkerStart_.Wrap(lib.esv__GameStateThreaded__GameStateWorker__DoWork); |
| 52 | } |
| 53 | |
| 54 | if (lib.esv__GameStateMachine__Update != nullptr) { |
| 55 | gameStateMachineUpdate_.Wrap(lib.esv__GameStateMachine__Update); |
| 56 | } |
| 57 | |
| 58 | DetourTransactionCommit(); |
| 59 | |
| 60 | gameStateWorkerStart_.SetWrapper(&ScriptExtender::GameStateWorkerWrapper, this); |
| 61 | gameStateMachineUpdate_.SetPrePostHook(&ScriptExtender::PreUpdate, &ScriptExtender::PostUpdate, this); |
| 62 | |
| 63 | gExtender->GetEngineHooks().esv__OsirisVariableHelper__SavegameVisit.SetPreHook(&ScriptExtender::OnSavegameVisit, this); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | void ScriptExtender::Shutdown() |
| 68 | { |
no test coverage detected