| 64 | } |
| 65 | |
| 66 | void 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 | |
| 92 | void ScriptExtender::Shutdown() |
| 93 | { |
no test coverage detected