mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-10-08 09:42:55 -04:00
fix(android): keep Gen1 Game.load after in-process EXIT GAME
Stop fanning out arbitrary field:release() during Game/Game2 reset — shared modules use :release as a handle API, and that teardown left the Gen1 singleton unbootable (Game:load nil) on Play-again. Harden bootGame and endGameSession to rebuild the module if load is missing.
This commit is contained in:
@@ -87,6 +87,13 @@ function SessionLifecycle.endGameSession(game)
|
||||
if game and game.reset then
|
||||
pcall(function() game:reset() end)
|
||||
end
|
||||
-- Gen1 Game is the module singleton. If teardown left it without load,
|
||||
-- drop the cached module so the next require rebuilds a clean table
|
||||
-- (bootGame also guards this; doing it here keeps Play-again reliable).
|
||||
if game and type(game.load) ~= "function"
|
||||
and package.loaded["src.core.Game"] == game then
|
||||
package.loaded["src.core.Game"] = nil
|
||||
end
|
||||
|
||||
local Input = require("src.core.Input")
|
||||
local TouchControls = require("src.core.TouchControls")
|
||||
|
||||
Reference in New Issue
Block a user