From 12b8fef1aada2df97df05e053f681395632df741 Mon Sep 17 00:00:00 2001 From: digiholic Date: Tue, 7 May 2024 01:22:11 -0600 Subject: [PATCH] Adds a canary byte check before sending game completion (#3217) --- data/lua/connector_mmbn3.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/lua/connector_mmbn3.lua b/data/lua/connector_mmbn3.lua index 876ab8a4..fce38a4c 100644 --- a/data/lua/connector_mmbn3.lua +++ b/data/lua/connector_mmbn3.lua @@ -110,6 +110,11 @@ local IsItemable = function() end local is_game_complete = function() + -- If the Cannary Byte is 0xFF, then the save RAM is untrustworthy + if memory.read_u8(canary_byte) == 0xFF then + return game_complete + end + -- If on the title screen don't read RAM, RAM can't be trusted yet if IsOnTitle() then return game_complete end