diff --git a/Lua/classes/Monitor.lua b/Lua/classes/Monitor.lua index 52b2118..bb4aaa8 100644 --- a/Lua/classes/Monitor.lua +++ b/Lua/classes/Monitor.lua @@ -12,12 +12,10 @@ function Monitor:init(name, a) end function Monitor:read() - -- bizhawk has an off-by-one bug where this returns length + 1 bytes - local raw = mainmemory.readbyterange(self.begin, self.len-1) + local raw = mainmemory.readbyterange(self.begin, self.len) local bytes = {} - local begin = self.begin for k, v in pairs(raw) do - bytes[k - begin] = v + bytes[k] = v end return bytes end diff --git a/Lua/test chests.lua b/Lua/test chests.lua index 52aa31a..0f20e96 100755 --- a/Lua/test chests.lua +++ b/Lua/test chests.lua @@ -43,7 +43,7 @@ function read_ascii(addr, len) -- so we'll set up a table we can use ipairs() on local ordered_bytes = {} for a, v in pairs(bytes) do - ordered_bytes[tonumber(a, 16) - begin + 1] = v + ordered_bytes[tonumber(a, 16) + 1] = v end local seq = false