mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-28 09:54:43 +02: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:
@@ -384,7 +384,14 @@ function bootGame(version, cartId)
|
||||
Game = require("src.core.Game2").new()
|
||||
Game:load()
|
||||
else
|
||||
Game = require("src.core.Game")
|
||||
-- Gen1 Game is a module singleton. In-process EXIT GAME resets it in
|
||||
-- place; if a prior teardown left load missing, rebuild from source.
|
||||
local gameMod = require("src.core.Game")
|
||||
if type(gameMod.load) ~= "function" then
|
||||
package.loaded["src.core.Game"] = nil
|
||||
gameMod = require("src.core.Game")
|
||||
end
|
||||
Game = gameMod
|
||||
Game:load()
|
||||
if os.getenv("POKEPORT_AUTOPILOT") then
|
||||
autopilot = require("tests.autopilot")
|
||||
|
||||
Reference in New Issue
Block a user