Lua bytecode builder, cdrom fixes

This commit is contained in:
Jan Racek
2026-03-28 19:41:53 +01:00
parent 275b4e891d
commit 61fbca17a7
5 changed files with 555 additions and 15 deletions

View File

@@ -43,9 +43,9 @@ namespace SplashEdit.EditorCode
public const long SPU_RESERVED = 0x1010;
public const long USABLE_SPU = TOTAL_SPU - SPU_RESERVED;
// Fixed runtime overhead from C++ (renderer.hh constants)
public const long BUMP_ALLOC_TOTAL = 2L * 8096 * 24; // ~380KB
public const long OT_TOTAL = 2L * 16384 * 4; // ~128KB
// Fixed runtime overhead from C++ (renderer.hh constants, now configurable)
public static long BUMP_ALLOC_TOTAL => 2L * SplashSettings.BumpSize;
public static long OT_TOTAL => 2L * SplashSettings.OtSize * 4;
public const long VIS_REFS = 4096 * 4; // 16KB
public const long STACK_ESTIMATE = 32 * 1024; // 32KB
public const long LUA_OVERHEAD = 16 * 1024; // 16KB approximate
@@ -53,6 +53,11 @@ namespace SplashEdit.EditorCode
public long FixedOverhead => BUMP_ALLOC_TOTAL + OT_TOTAL + VIS_REFS + STACK_ESTIMATE + LUA_OVERHEAD;
// Heap estimate and warnings
public long EstimatedHeapFree => USABLE_RAM - TotalRamUsage;
public bool IsHeapWarning => EstimatedHeapFree < 128 * 1024; // < 128KB free
public bool IsHeapCritical => EstimatedHeapFree < 64 * 1024; // < 64KB free
/// <summary>RAM used by scene data (live portion of splashpack).</summary>
public long SceneRamUsage => splashpackLiveSize > 0 ? splashpackLiveSize : splashpackFileSize;