Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OoT: add some extra ROM checks (ROM loaded, main memory size) #5

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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