| 38 | {} |
| 39 | |
| 40 | bool LibraryManager::FindLibraries(uint32_t gameRevision) |
| 41 | { |
| 42 | RegisterSymbols(); |
| 43 | |
| 44 | SymbolMappingLoader loader(mappings_); |
| 45 | PreRegisterLibraries(loader); |
| 46 | if (!loader.LoadBuiltinMappings(IDR_BINARY_MAPPINGS)) { |
| 47 | ERR("Failed to load symbol mapping table"); |
| 48 | CriticalInitFailed = true; |
| 49 | } |
| 50 | |
| 51 | #if defined(_DEBUG) |
| 52 | if (!CriticalInitFailed) { |
| 53 | // Debug check for symbol xml -> engine bindings |
| 54 | for (auto const& sym : mappings_.StaticSymbols) { |
| 55 | if (!sym.second.Bound) { |
| 56 | WARN("No mapping exists for engine symbol: %s", sym.first.c_str()); |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | #endif |
| 61 | |
| 62 | if (!BindApp()) { |
| 63 | ERR("LibraryManager::FindLibraries(): Unable to bind BG3 module."); |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | RegisterLibraries(symbolMapper_); |
| 68 | symbolMapper_.MapAllSymbols(false); |
| 69 | |
| 70 | CriticalInitFailed = CriticalInitFailed || symbolMapper_.HasFailedCriticalMappings(); |
| 71 | InitFailed = InitFailed || symbolMapper_.HasFailedMappings(); |
| 72 | |
| 73 | if (gExtender->GetConfig().DisableLauncher && !CriticalInitFailed) { |
| 74 | ApplyCodePatch("KillLauncher"); |
| 75 | } |
| 76 | |
| 77 | auto const& sym = GetStaticSymbols(); |
| 78 | gCoreLibPlatformInterface.Alloc = &BG3Alloc; |
| 79 | gCoreLibPlatformInterface.Free = &BG3Free; |
| 80 | gCoreLibPlatformInterface.ls__GlobalStringTable__MainTable__CreateFromString = sym.ls__GlobalStringTable__MainTable__CreateFromString; |
| 81 | gCoreLibPlatformInterface.ls__FixedString__GetString = sym.ls__FixedString__GetString; |
| 82 | gCoreLibPlatformInterface.ls__FixedString__IncRef = sym.ls__FixedString__IncRef; |
| 83 | gCoreLibPlatformInterface.ls__GlobalStringTable__MainTable__DecRef = sym.ls__GlobalStringTable__MainTable__DecRef; |
| 84 | gCoreLibPlatformInterface.ls__gGlobalStringTable = sym.ls__gGlobalStringTable; |
| 85 | |
| 86 | return !CriticalInitFailed; |
| 87 | } |
| 88 | |
| 89 | bool LibraryManager::PostStartupFindLibraries() |
| 90 | { |
no test coverage detected