| 280 | } |
| 281 | |
| 282 | bool MCore::LoadEngine() |
| 283 | { |
| 284 | PROFILE_CPU(); |
| 285 | PROFILE_MEM(ScriptingCSharp); |
| 286 | |
| 287 | // Initialize hostfxr |
| 288 | if (InitHostfxr()) |
| 289 | return true; |
| 290 | |
| 291 | // Prepare managed side |
| 292 | CallStaticMethod<void>(GetStaticMethodPointer(TEXT("Init"))); |
| 293 | #ifdef MCORE_MAIN_MODULE_NAME |
| 294 | // MCORE_MAIN_MODULE_NAME define is injected by Scripting.Build.cs on platforms that use separate shared library for engine symbols |
| 295 | ::String flaxLibraryPath(Platform::GetMainDirectory() / TEXT(MACRO_TO_STR(MCORE_MAIN_MODULE_NAME))); |
| 296 | #else |
| 297 | ::String flaxLibraryPath(Platform::GetExecutableFilePath()); |
| 298 | #endif |
| 299 | #if PLATFORM_MAC |
| 300 | // On some platforms all native binaries are side-by-side with the app in a different folder |
| 301 | if (!FileSystem::FileExists(flaxLibraryPath)) |
| 302 | { |
| 303 | flaxLibraryPath = ::String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(flaxLibraryPath); |
| 304 | } |
| 305 | #endif |
| 306 | #if !PLATFORM_SWITCH |
| 307 | if (!FileSystem::FileExists(flaxLibraryPath)) |
| 308 | { |
| 309 | LOG(Error, "Flax Engine native library file is missing ({0})", flaxLibraryPath); |
| 310 | } |
| 311 | #endif |
| 312 | RegisterNativeLibrary("FlaxEngine", flaxLibraryPath.Get()); |
| 313 | |
| 314 | MRootDomain = New<MDomain>("Root"); |
| 315 | MDomains.Add(MRootDomain); |
| 316 | |
| 317 | char* buildInfo = CallStaticMethod<char*>(GetStaticMethodPointer(TEXT("GetRuntimeInformation"))); |
| 318 | LOG(Info, ".NET runtime version: {0}", ::String(buildInfo)); |
| 319 | GC::FreeMemory(buildInfo); |
| 320 | Ready = true; |
| 321 | |
| 322 | return false; |
| 323 | } |
| 324 | |
| 325 | void MCore::UnloadEngine() |
| 326 | { |
nothing calls this directly
no test coverage detected