1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-05 07:29:04 -08:00
mm/Lua/main.lua

53 lines
1.2 KiB
Lua
Raw Normal View History

2015-12-11 00:43:39 -08:00
print()
package.path = package.path..';./mm/Lua/?.lua'
require = require "depend"
2015-11-27 08:48:47 -08:00
require "boilerplate"
local function once()
require "addrs.init"
2015-12-11 00:43:39 -08:00
print(m64p.rom.settings.MD5, version)
2015-11-27 08:48:47 -08:00
end
2015-12-11 00:43:39 -08:00
--[[
80000000 to 80800000 RDRAM
90000000 to 92000000 probably ROM
A0000000 to A0800000 RDRAM mirror?
A3F00000 to A4000000 RDRAM registers
A4000000 to A4900000?
B0000000 to B2000000 ROM mirror?
--]]
local oldbutts = 0
2015-11-27 08:48:47 -08:00
local function main()
2015-12-11 00:43:39 -08:00
local butts = addrs.buttons()
if butts & 0x0020 > oldbutts & 0x0020 then -- L button
local ok, err = pcall(dofile, 'mm/Lua/test.lua')
if not ok then print(err) end
end
oldbutts = butts
2015-11-27 08:48:47 -08:00
end
local vi_count = 0
2015-12-11 00:43:39 -08:00
--local lastvf = 0
2015-11-27 08:48:47 -08:00
local function vi_callback()
vi_count = vi_count + 1
if vi_count == 1 then
once()
end
2015-12-11 00:43:39 -08:00
if vi_count <= 1 then
2015-11-27 08:48:47 -08:00
return
end
2015-12-11 00:43:39 -08:00
--local vf = addrs.visual_frame()
--if vf > lastvf then
if true then
local ok, err = pcall(main)
if not ok then
print(err)
m64p:unregisterCallback('vi', vi_callback)
return
end
end
--lastvf = vf
2015-11-27 08:48:47 -08:00
end
m64p:registerCallback('vi', vi_callback)