1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-05-18 05:23:22 -07:00

basic mupen64plus support

This commit is contained in:
Connor Olding 2015-11-27 08:48:47 -08:00
parent 433a99cb43
commit 44fdfdb684
5 changed files with 67 additions and 18 deletions

View File

@ -11,7 +11,7 @@ local same = {
return function(hash)
local version = versions[hash] or VERSION_OVERRIDE
if version == nil then
print('ERROR: unknown rom')
error('unknown rom')
return
end
local v = version:sub(1, 2)

View File

@ -1,6 +1,6 @@
-- deprecated
-- (i say that, but i continue to use it myself)
local hash = gameinfo.getromhash()
local hash = m64p.rom.settings.MD5
local Game = require "addrs.addrs"
local game = Game(hash)
version = game.version

View File

@ -1,5 +1,15 @@
return { -- sha1 hashes of .z64s
return { -- md5 and sha1 hashes of .z64s
-- Majora's Mask
["2A0A8ACB61538235BC1094D297FB6556"] = "M US10",
["8F281800FBA5DDCB1D2B377731FC0215"] = "M USDE",
["AC0751DBC23AB2EC0C3144203ACA0003"] = "M USGC",
["13FAB67E603B002CEAF0EEA84130E973"] = "M EU10",
["BECCFDED43A2F159D03555027462A950"] = "M EU11",
["71FBAE5D2B27926EA54E92CE2FC91622"] = "M EUDB",
["DBE9AF0DB46256E42B5C67902B696549"] = "M EUGC",
["15D1A2217CAD61C39CFECBFFA0703E25"] = "M JP10",
["C38A7F6F6B61862EA383A75CDF888279"] = "M JP11",
["D3929AADF7640F8C5B4CE8321AD4393A"] = "M JPGC",
["D6133ACE5AFAA0882CF214CF88DABA39E266C078"] = "M US10",
["2F0744F2422B0421697A74B305CB1EF27041AB11"] = "M USDE",
["9743AA026E9269B339EB0E3044CD5830A440C1FD"] = "M USGC",
@ -12,6 +22,17 @@ return { -- sha1 hashes of .z64s
["1438FD501E3E5B25461770AF88C02AB1E41D3A7E"] = "M JPGC",
-- Ocarina of Time
["5BD1FE107BF8106B2AB6650ABECD54D6"] = "O US10",
["721FDCC6F5F34BE55C43A807F2A16AF4"] = "O US11",
["57A9719AD547C516342E1A15D5C28C3D"] = "O US12",
["CD09029EDCFB7C097AC01986A0F83D3F"] = "O USGC",
["E040DE91A74B61E3201DB0E2323F768A"] = "O EU10",
["D714580DD74C2C033F5E1B6DC0AEAC77"] = "O EU11",
["2C27B4E000E85FD78DBCA551F1B1C965"] = "O EUGC",
["9F04C8E68534B870F707C247FA4B50FC"] = "O JP10",
["1BF5F42B98C3E97948F01155F12E2D88"] = "O JP11",
["2258052847BDD056C8406A9EF6427F13"] = "O JP12",
["33FB7852C180B18EA0B9620B630F413F"] = "O JPGC",
["AD69C91157F6705E8AB06C79FE08AAD47BB57BA7"] = "O US10",
["D3ECB253776CD847A5AA63D859D8C89A2F37B364"] = "O US11",
["41B3BDC48D98C48529219919015A1AF22F5057C2"] = "O US12",
@ -25,6 +46,10 @@ return { -- sha1 hashes of .z64s
["0769C84615422D60F16925CD859593CDFA597F84"] = "O JPGC",
-- Ocarina of Time: Master Quest
["DA35577FE54579F6A266931CC75F512D"] = "O USGC MQ",
["1618403427E4344A57833043DB5CE3C3"] = "O EUGC MQ",
["8CA71E87DE4CE5E9F6EC916202A623E9"] = "O EUDB MQ",
["69895C5C78442260F6EAFB2506DC482A"] = "O JPGC MQ",
["8B5D13AAC69BFBF989861CFDC50B1D840945FC1D"] = "O USGC MQ",
["F46239439F59A2A594EF83CF68EF65043B1BFFE2"] = "O EUGC MQ",
["50BEBEDAD9E0F10746A52B07239E47FA6C284D03"] = "O EUDB MQ",

View File

@ -1,29 +1,27 @@
-- boilerplate convenience functions
-- TODO: respect little endian consoles too
require "extra"
local mm = mainmemory
local m = memory
m.usememorydomain("ROM")
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 = function() error('unimplemented', 2) end
R4 = function(addr) return m64p.memory:read(addr+ram, 'u32') end
RF = function(addr) return m64p.memory.read(addr+ram, 'float') end
R1 = mm.readbyte
R2 = mm.read_u16_be
R3 = mm.read_u24_be
R4 = mm.read_u32_be
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
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 = function() error('unimplemented', 2) end
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 = m.readbyte
X2 = m.read_u16_be
X3 = m.read_u24_be
X4 = m.read_u32_be
XF = function(addr) return m.readfloat(addr, true) end
--]]
local H1 = function(self, value)
return value and W1(self.addr, value) or R1(self.addr)

26
Lua/main.lua Normal file
View File

@ -0,0 +1,26 @@
print('')
require "boilerplate"
local function once()
require "addrs.init"
print(m64p.rom.settings.MD5)
end
local function main()
addrs.hearts(16*1.5)
end
local vi_count = 0
local function vi_callback()
vi_count = vi_count + 1
if vi_count == 1 then
once()
end
local ok, err = pcall(main)
if not ok then
print(err)
m64p:unregisterCallback('vi', vi_callback)
return
end
end
m64p:registerCallback('vi', vi_callback)