| 25 | } |
| 26 | |
| 27 | void OsirisProxy::Initialize() |
| 28 | { |
| 29 | Debug("OsirisProxy::Initialize: Starting"); |
| 30 | Wrappers.Initialize(); |
| 31 | |
| 32 | using namespace std::placeholders; |
| 33 | Wrappers.RegisterDivFunctions.AddPreHook(std::bind(&OsirisProxy::OnRegisterDIVFunctions, this, _1, _2)); |
| 34 | Wrappers.InitGame.AddPreHook(std::bind(&OsirisProxy::OnInitGame, this, _1)); |
| 35 | Wrappers.DeleteAllData.AddPreHook(std::bind(&OsirisProxy::OnDeleteAllData, this, _1, _2)); |
| 36 | Wrappers.Error.AddPreHook(std::bind(&OsirisProxy::OnError, this, _1)); |
| 37 | Wrappers.Assert.AddPreHook(std::bind(&OsirisProxy::OnAssert, this, _1, _2, _3)); |
| 38 | Wrappers.Compile.SetWrapper(std::bind(&OsirisProxy::CompileWrapper, this, _1, _2, _3, _4)); |
| 39 | Wrappers.Load.AddPostHook(std::bind(&OsirisProxy::OnAfterOsirisLoad, this, _1, _2, _3)); |
| 40 | Wrappers.Merge.SetWrapper(std::bind(&OsirisProxy::MergeWrapper, this, _1, _2, _3)); |
| 41 | #if !defined(OSI_NO_DEBUGGER) |
| 42 | Wrappers.RuleActionCall.SetWrapper(std::bind(&OsirisProxy::RuleActionCall, this, _1, _2, _3, _4, _5, _6)); |
| 43 | #endif |
| 44 | |
| 45 | if (ExtensionsEnabled) { |
| 46 | Debug("OsirisProxy::Initialize: Initializing libraries."); |
| 47 | if (Libraries.FindLibraries()) { |
| 48 | CustomInjector.Initialize(); |
| 49 | FunctionLibrary.Register(); |
| 50 | |
| 51 | Wrappers.InitializeExtensions(); |
| 52 | Wrappers.InitNetworkFixedStrings.AddPostHook(std::bind(&OsirisProxy::OnInitNetworkFixedStrings, this, _1, _2)); |
| 53 | |
| 54 | #if 0 |
| 55 | auto headers = CustomFunctions.GenerateHeaders(); |
| 56 | Debug(" === EXTENSION HEADERS ==="); |
| 57 | std::cout << headers << std::endl; |
| 58 | Debug(" === END EXTENSION HEADERS ==="); |
| 59 | #endif |
| 60 | } |
| 61 | else { |
| 62 | Debug("OsirisProxy::Initialize: Could not load libraries; skipping scripting extension initialization."); |
| 63 | ExtensionsEnabled = false; |
| 64 | } |
| 65 | } |
| 66 | else { |
| 67 | Debug("OsirisProxy::Initialize: Skipped library init -- scripting extensions not enabled."); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | void OsirisProxy::Shutdown() |
| 72 | { |
no test coverage detected