Fix NativeAOT GC region range defaults (#385)

Use the bare hex value accepted by older NativeAOT runtimes and CoreCLR. Cover the default and shared and per-game overrides.

Co-authored-by: James Yeung <163084539+CiphemonJY@users.noreply.github.com>
This commit is contained in:
ArthurandJames Yeung authored and GitHub committed 2026-10-10 14:38:47 -04:00
1 parent 20f919d708
commit 285e271f3e
2 files changed
+19 -2

No files matched your search

@@ -46,10 +46,26 @@ class GameEnvironmentTest {
@Test fun dotnetRuntimeFitsAndroidAddressSpaceForEveryGame() {
val values = GameEnvironment.effective(GameEnvironment.Config(), "PERFORMANCE", "43")
assertEquals("0x800000000", values["DOTNET_GCRegionRange"])
assertEquals("800000000", values["DOTNET_GCRegionRange"])
assertEquals("0", values["DOTNET_EnableWriteXorExecute"])
}
@Test fun dotnetHeapRangeIsBareHexForNativeAot() {
for (preset in FexPreset.all) {
val values = GameEnvironment.effective(GameEnvironment.Config(), preset.id, "3478050")
assertEquals(32L * 1024 * 1024 * 1024, values.getValue("DOTNET_GCRegionRange")!!.toLong(16))
}
}
@Test fun dotnetHeapRangeRespectsSharedAndGameOverrides() {
val config = GameEnvironment.Config(
shared = mapOf("DOTNET_GCRegionRange" to "400000000"),
games = mapOf("3478050" to mapOf("DOTNET_GCRegionRange" to "800000000")),
)
assertEquals("800000000", GameEnvironment.effective(config, "", "3478050")["DOTNET_GCRegionRange"])
assertEquals("400000000", GameEnvironment.effective(config, "", "43")["DOTNET_GCRegionRange"])
}
@Test fun multiSelectionPreservesCustomTokensAndRemovesToggledValues() {
assertEquals("fps,custom_token,frametimes", GameEnvironmentOptions.toggle("fps,custom_token", "frametimes"))
assertEquals("custom_token", GameEnvironmentOptions.toggle("fps,custom_token", "fps"))