Various porting patches

This commit is contained in:
Wojtek Figat
2024-01-22 21:17:58 +01:00
parent 37fe11e19f
commit a0e127b9cc
4 changed files with 37 additions and 10 deletions

View File

@@ -281,17 +281,18 @@ bool MCore::LoadEngine()
flaxLibraryPath = ::String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(flaxLibraryPath);
}
#endif
#if !PLATFORM_SWITCH
if (!FileSystem::FileExists(flaxLibraryPath))
{
LOG(Error, "Flax Engine native library file is missing ({0})", flaxLibraryPath);
}
#endif
RegisterNativeLibrary("FlaxEngine", flaxLibraryPath.Get());
MRootDomain = New<MDomain>("Root");
MDomains.Add(MRootDomain);
void* GetRuntimeInformationPtr = GetStaticMethodPointer(TEXT("GetRuntimeInformation"));
char* buildInfo = CallStaticMethod<char*>(GetRuntimeInformationPtr);
char* buildInfo = CallStaticMethod<char*>(GetStaticMethodPointer(TEXT("GetRuntimeInformation")));
LOG(Info, ".NET runtime version: {0}", ::String(buildInfo));
MCore::GC::FreeMemory(buildInfo);
@@ -2047,7 +2048,7 @@ bool InitHostfxr()
#endif
// Platform-specific setup
#if PLATFORM_IOS
#if PLATFORM_IOS || PLATFORM_SWITCH
setenv("MONO_AOT_MODE", "aot", 1);
setenv("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1", 1);
#endif

View File

@@ -180,8 +180,8 @@ namespace FlaxEngine
private static void OnLocalizationChanged()
{
// iOS uses globalization-invariant mode so ignore it
#if !PLATFORM_IOS
// Invariant-globalization only (see InitHostfxr with Mono)
#if !(PLATFORM_IOS || PLATFORM_SWITCH)
var currentThread = Thread.CurrentThread;
var language = Localization.CurrentLanguage;
if (language != null)
@@ -238,6 +238,10 @@ namespace FlaxEngine
internal static ManagedHandle CultureInfoToManaged(int lcid)
{
#if PLATFORM_IOS || PLATFORM_SWITCH
// Invariant-globalization only (see InitHostfxr with Mono)
lcid = 0;
#endif
return ManagedHandle.Alloc(new CultureInfo(lcid));
}