Skip to content

Commit

Permalink
OoT: add some extra ROM checks (ROM loaded, main memory size)
Browse files Browse the repository at this point in the history
Should make TestRunnerSRL#51, TestRunnerSRL#39, TestRunnerSRL#26, and TestRunnerSRL#21 less likely to occur (may be enough
to solve them entirely)

(fix TestRunnerSRL#51, fix TestRunnerSRL#39, fix TestRunnerSRL#26, fix TestRunnerSRL#21)
  • Loading branch information
danielfinke committed Oct 6, 2020
1 parent 7b95bb5 commit 88a0bbd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bizhawk-co-op/ramcontroller/Ocarina of Time.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,23 @@ local function declare (name, initval)
rawset(_G, name, initval or false)
end

-- Expect a minimum of 4MB RAM
local EXPECTED_MEMORY_SIZE_MIN = 0x400000

local oot = require('bizhawk-co-op\\helpers\\oot')

local oot_rom = {}

if (gameinfo.getromname() == "Null") then
setmetatable(_G, old_global_metatable)
error("The OoT ROM needs to be loaded prior to hosting/joining a room")
end

if (mainmemory.getcurrentmemorydomainsize() < EXPECTED_MEMORY_SIZE_MIN) then
setmetatable(_G, old_global_metatable)
error("Unexpected main memory size. Did you load a ROM from another console?")
end

local rando_context = mainmemory.read_u32_be(0x1C6E90 + 0x15D4) - 0x80000000
if (rando_context == 0) then
setmetatable(_G, old_global_metatable)
Expand Down

0 comments on commit 88a0bbd

Please sign in to comment.