mirror of
https://github.com/notwa/mm
synced 2024-11-05 00:29:02 -08:00
support both bizhawk and m64p
This commit is contained in:
parent
fdbcc5d527
commit
90d30e218f
2 changed files with 47 additions and 21 deletions
|
@ -1,6 +1,9 @@
|
||||||
-- deprecated
|
local hash
|
||||||
-- (i say that, but i continue to use it myself)
|
if bizstring then
|
||||||
local hash = m64p.rom.settings.MD5
|
hash = gameinfo.getromhash()
|
||||||
|
else
|
||||||
|
hash = m64p.rom.settings.MD5
|
||||||
|
end
|
||||||
local Game = require "addrs.addrs"
|
local Game = require "addrs.addrs"
|
||||||
local game = Game(hash)
|
local game = Game(hash)
|
||||||
version = game.version
|
version = game.version
|
||||||
|
|
|
@ -2,26 +2,49 @@
|
||||||
|
|
||||||
require "extra"
|
require "extra"
|
||||||
|
|
||||||
local ram = 0x80000000
|
if bizstring then
|
||||||
R1 = function(addr) return m64p.memory:read(addr+ram, 'u8') end
|
local mm = mainmemory
|
||||||
R2 = function(addr) return m64p.memory:read(addr+ram, 'u16') end
|
local m = memory
|
||||||
R3 = function() error('unimplemented', 2) end
|
m.usememorydomain("ROM")
|
||||||
R4 = function(addr) return m64p.memory:read(addr+ram, 'u32') end
|
|
||||||
RF = function(addr) return m64p.memory.read(addr+ram, 'float') end
|
|
||||||
|
|
||||||
W1 = function(addr, value) m64p.memory:write(addr+ram, 'u8', value) end
|
R1 = mm.readbyte
|
||||||
W2 = function(addr, value) m64p.memory:write(addr+ram, 'u16', value) end
|
R2 = mm.read_u16_be
|
||||||
W3 = function() error('unimplemented', 2) end
|
R3 = mm.read_u24_be
|
||||||
W4 = function(addr, value) m64p.memory:write(addr+ram, 'u32', value) end
|
R4 = mm.read_u32_be
|
||||||
WF = function(addr, value) m64p.memory.write(addr+ram, 'float', value) end
|
RF = function(addr) return mm.readfloat(addr, true) end
|
||||||
|
|
||||||
|
W1 = mm.writebyte
|
||||||
|
W2 = mm.write_u16_be
|
||||||
|
W3 = mm.write_u24_be
|
||||||
|
W4 = mm.write_u32_be
|
||||||
|
WF = function(addr, value) mm.writefloat(addr, value, true) end
|
||||||
|
|
||||||
--[[
|
|
||||||
X1 = m.readbyte
|
X1 = m.readbyte
|
||||||
X2 = m.read_u16_be
|
X2 = m.read_u16_be
|
||||||
X3 = m.read_u24_be
|
X3 = m.read_u24_be
|
||||||
X4 = m.read_u32_be
|
X4 = m.read_u32_be
|
||||||
XF = function(addr) return m.readfloat(addr, true) end
|
XF = function(addr) return m.readfloat(addr, true) end
|
||||||
--]]
|
else
|
||||||
|
local unimplemented = function() error('unimplemented', 2) end
|
||||||
|
local ram = 0x80000000
|
||||||
|
R1 = function(addr) return m64p.memory:read(addr+ram, 'u8') end
|
||||||
|
R2 = function(addr) return m64p.memory:read(addr+ram, 'u16') end
|
||||||
|
R3 = unimplemented
|
||||||
|
R4 = function(addr) return m64p.memory:read(addr+ram, 'u32') end
|
||||||
|
RF = function(addr) return m64p.memory.read(addr+ram, 'float') end
|
||||||
|
|
||||||
|
W1 = function(addr, value) m64p.memory:write(addr+ram, 'u8', value) end
|
||||||
|
W2 = function(addr, value) m64p.memory:write(addr+ram, 'u16', value) end
|
||||||
|
W3 = unimplemented
|
||||||
|
W4 = function(addr, value) m64p.memory:write(addr+ram, 'u32', value) end
|
||||||
|
WF = function(addr, value) m64p.memory.write(addr+ram, 'float', value) end
|
||||||
|
|
||||||
|
X1 = unimplemented
|
||||||
|
X2 = unimplemented
|
||||||
|
X3 = unimplemented
|
||||||
|
X4 = unimplemented
|
||||||
|
XF = unimplemented
|
||||||
|
end
|
||||||
|
|
||||||
local H1 = function(self, value)
|
local H1 = function(self, value)
|
||||||
return value and W1(self.addr, value) or R1(self.addr)
|
return value and W1(self.addr, value) or R1(self.addr)
|
||||||
|
|
Loading…
Reference in a new issue