I don't know why it didn't occur to me before but I think there is a very real possibility to corrupt savegames by subframe resetting. From what I've seen, the game doesn't seem to have any checksum protection. Unfortunately, it looks like no rerecording GBA emulator is capable of doing subframe stuff yet.
I first researched savegames in
November 2014.
If my calculation is right, savegame file 1 has memory dedicated to it ranging from address $02001E80 to $02002578. That's a range of 0x6F8.
$02001E90 keeps track of the room you were in. If this is 0x1DF, 0x1E or 0x1C7 upon loading, you are in one of the last screens and the ending will trigger automatically.
So the idea now was to interrupt the write to that address during the save. But the write seems to occur in one chunk, as a 'word' (2 bytes). Still, maybe there is some other way to abuse this.
I've been trying to use memory write/read register lua functions but I haven't been very lucky. My test on Bizhawk yielded: The mgba-core does a print telling that memory callbacks aren't supported. The VBA-core, nothing seems to happen. Maybe the lua implementation is broken.
See here for my inquiry. So I looked at the standalone VBA 24m.
My script for it works, but I can't pause or do anything until after the frame ends. I can read the memory addresses following $02001E90.
During frame 14001, $02001E90 gets written to which fires my function that reads the upcoming addresses. The reads all yielded 0. At the end of that frame, all those addresses have been written to (as you can see in the memory viewer).
I don't know if the game performs any check if nothing has gone awry during that crucial frame, but I haven't seen anything that indicates that yet.
Maybe I will investigate this some more and if I see the chance of a very quick theoretical TAS, I will make it.
Language: Lua
--mlsstestVBA.lua
function NumToHex(IN)
local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
while IN>0 do
I=I+1
IN,D=math.floor(IN/B),math.mod(IN,B)+1
OUT=string.sub(K,D,D)..OUT
end
return OUT
end
write_1E90 = function()
emu.pause()
print(emu.framecount()..": Write to $02001E90 occured.")
print("$02001E90 now reads ".. NumToHex(memory.readwordsigned(0x02001E90)))
print("Next memory addresses read:")
counter=0
for k, v in pairs( memory.readbyterange(0x02001E92,10) ) do
print(NumToHex(0x02001E92+counter) ..": ".. v)
counter=counter+1
end
print("---")
end
memory.registerwrite(0x02001E90,write_1E90)
while true do
emu.frameadvance()
end
Edit:
I think there is a checksum protection after all. I've seen it delete my custom save upon reset sometimes.
Also, I think savegame abuse is not possible. The room ID gets written in one piece and that's the only lead I had.