From 2ddbb5110f9e837baf1a36a0a0b17fae4eb2012e Mon Sep 17 00:00:00 2001 From: Saulius Markevicius Date: Tue, 2 Dec 2025 18:38:29 +0000 Subject: [PATCH 1/4] Fix memory leak in TFS We were subscribing to the game.Exited event but we never unsubscribed, which meant that when we closed the game the Process object could not be garbage collected, thus every game restart would cause a memory leak in a new Process object. Although we never noticed, it is likely that 100 or more game restarts would have caused a performance issue and possibly even a bug in the script. --- pop_tfs.asl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pop_tfs.asl b/pop_tfs.asl index ac1e2d1..4e1d41a 100644 --- a/pop_tfs.asl +++ b/pop_tfs.asl @@ -135,9 +135,6 @@ startup init { - vars.gameRunning = true; - game.Exited += (s, e) => vars.gameRunning = false; - // This is a split which triggers when the prince is within a certain range of coords vars.SplitTFSpos = (Func )((xTarg, yTarg, zTarg, range) => { return @@ -157,9 +154,16 @@ init }); } +exit +{ + // we do not need to unpause the IGT timer because the next time the game is running, the isLoading block will run and then it will be handled there + // however if we didn't have an isLoading block, then we would need to explicitly unpause in the init block + timer.IsGameTimePaused = true; +} + isLoading { - return (current.isMenu == 0 || current.isLoading || !vars.gameRunning); + return (current.isMenu == 0 || current.isLoading); } reset From 627bf7f290ee1b65bdf35bb48330ef0ff477c821 Mon Sep 17 00:00:00 2001 From: Saulius Markevicius Date: Tue, 2 Dec 2025 18:42:16 +0000 Subject: [PATCH 2/4] Fix PoP 3D memory leak See description for previous commit - same applies here --- pop_3d.asl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pop_3d.asl b/pop_3d.asl index 53d4955..e13a818 100644 --- a/pop_3d.asl +++ b/pop_3d.asl @@ -24,10 +24,11 @@ startup } } -init +exit { - vars.gameRunning = true; - game.Exited += (s, e) => vars.gameRunning = false; + // we do not need to unpause the IGT timer because the next time the game is running, the isLoading block will run and then it will be handled there + // however if we didn't have an isLoading block, then we would need to explicitly unpause in the init block + timer.IsGameTimePaused = true; } reset @@ -46,7 +47,7 @@ start isLoading { - return (current.xPos == 0 && current.yPos == 0 && current.zPos == 0) || !vars.gameRunning; + return current.xPos == 0 && current.yPos == 0 && current.zPos == 0; } split From 4f2547dcb63c033b88baed21aa1f05ee06e38d3e Mon Sep 17 00:00:00 2001 From: Saulius Markevicius Date: Tue, 2 Dec 2025 20:59:59 +0000 Subject: [PATCH 3/4] Fix PoP1 Apple II reset on game restart --- pop1_apple.asl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pop1_apple.asl b/pop1_apple.asl index daf38fb..294292b 100644 --- a/pop1_apple.asl +++ b/pop1_apple.asl @@ -35,6 +35,14 @@ startup timer.CurrentTimingMethod = TimingMethod.GameTime; } } + + vars.CurrentProcess = null; +} + +update +{ + vars.OldProcess = vars.CurrentProcess; + vars.CurrentProcess = game; } start @@ -56,7 +64,7 @@ gameTime reset { - return((current.Reset1 == 0 && current.Reset2 == 0 && current.Reset3 == 0) || game.ProcessName != "AppleWin"); + return (current.Reset1 == 0 && current.Reset2 == 0 && current.Reset3 == 0) || vars.OldProcess != vars.CurrentProcess; } split From f804a6747c817b2789580a0a6034b2e436c678fd Mon Sep 17 00:00:00 2001 From: Pranav G Date: Wed, 3 Dec 2025 08:17:49 +0530 Subject: [PATCH 4/4] Removed process based reset condition as the rest seem sufficient --- pop1_apple.asl | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pop1_apple.asl b/pop1_apple.asl index 294292b..dcf1d0d 100644 --- a/pop1_apple.asl +++ b/pop1_apple.asl @@ -35,19 +35,11 @@ startup timer.CurrentTimingMethod = TimingMethod.GameTime; } } - - vars.CurrentProcess = null; -} - -update -{ - vars.OldProcess = vars.CurrentProcess; - vars.CurrentProcess = game; } start { - return(current.Level == 1 && current.Ticks == 0); + return (current.Level == 1 && current.Ticks == 0); } gameTime @@ -64,7 +56,7 @@ gameTime reset { - return (current.Reset1 == 0 && current.Reset2 == 0 && current.Reset3 == 0) || vars.OldProcess != vars.CurrentProcess; + return (current.Reset1 == 0 && current.Reset2 == 0 && current.Reset3 == 0); } split