Skip to content

Commit

Permalink
Merge pull request #5 from danielfinke/oot-extra-rom-checks
Browse files Browse the repository at this point in the history
OoT: add some extra ROM checks (ROM loaded, main memory size)
  • Loading branch information
GhostlyDark authored Apr 26, 2021
2 parents a05a9f5 + 88a0bbd commit 15da740
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 @@ -11,10 +11,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 15da740

Please sign in to comment.