summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/cheatfind/init.lua
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2016-04-23 14:28:38 -0500
committer cracyc <cracyc@users.noreply.github.com>2016-04-23 14:28:38 -0500
commit6af9782d91cc9a62ea5f19197a268561c4b35cbc (patch)
tree27762fd5cfa5ae74865112606863b88371f6913b /plugins/cheatfind/init.lua
parentd157233d679c8dc0ea71d449f5501de01d8db2ee (diff)
plugins/cheatfind: fix machines with >1 ram regions (nw)
Diffstat (limited to 'plugins/cheatfind/init.lua')
-rw-r--r--plugins/cheatfind/init.lua25
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/cheatfind/init.lua b/plugins/cheatfind/init.lua
index c2f56c531e2..23497d1fdc1 100644
--- a/plugins/cheatfind/init.lua
+++ b/plugins/cheatfind/init.lua
@@ -12,7 +12,6 @@ local cheatfind = exports
function cheatfind.startplugin()
local cheat = {}
- local watches = {}
-- return table of devices and spaces
function cheat.getspaces()
@@ -80,7 +79,7 @@ function cheatfind.startplugin()
end
local function beq(a, b, val, addr)
- if val == 0 then
+ if type(val) ~= "table" then
bitmask = ~a ~ b
return bitmask ~= 0
elseif not val[addr] then
@@ -187,13 +186,13 @@ function cheatfind.startplugin()
-- compare a data block to the current state
function cheat.compcur(olddata, oper, format, val, bcd)
local newdata = cheat.save(olddata.space, olddata.start, olddata.size, olddata.space)
- return cheat.comp(olddata, newdata, oper, format, check_val(oper, val, oldmatch), bcd)
+ return cheat.comp(olddata, newdata, oper, format, val, bcd)
end
-- compare a data block to the current state and filter
function cheat.compcurnext(olddata, oldmatch, oper, format, val, bcd)
local newdata = cheat.save(olddata.space, olddata.start, olddata.size, olddata.space)
- return cheat.compnext(olddata, newdata, oldmatch, oper, format, check_val(oper, val, oldmatch), bcd)
+ return cheat.compnext(olddata, newdata, oldmatch, oper, format, val, bcd)
end
@@ -217,6 +216,7 @@ function cheatfind.startplugin()
local menu_blocks = {}
local midx = { region = 1, init = 2, undo = 3, save = 4, lop = 6, op = 7, rop = 8, val = 9,
width = 11, bcd = 12, comp = 13, match = 15, watch = 0 }
+ local watches = {}
local function start()
devtable = {}
@@ -231,6 +231,7 @@ function cheatfind.startplugin()
matches = {}
matchsel = 1
menu_blocks = {}
+ watches = {}
local space_table = cheat.getspaces()
for tag, list in pairs(space_table) do
@@ -427,9 +428,9 @@ function cheatfind.startplugin()
bcd = incdec(bcd, 0, 1)
elseif index == midx.comp then
if event == "select" then
- for num = 1, #menu_blocks do
- if #matches == 0 then
- matches[1] = {}
+ if #matches == 0 then
+ matches[1] = {}
+ for num = 1, #menu_blocks do
if rightop == #menu_blocks[1] + 1 then
matches[1][num] = cheat.compcur(menu_blocks[num][leftop], optable[opsel],
formtable[width], value, bcd == 1)
@@ -437,9 +438,11 @@ function cheatfind.startplugin()
matches[1][num] = cheat.comp(menu_blocks[num][leftop], menu_blocks[num][rightop],
optable[opsel], formtable[width], value, bcd == 1)
end
- else
- lastmatch = matches[#matches]
- matches[#matches + 1] = {}
+ end
+ else
+ lastmatch = matches[#matches]
+ matches[#matches + 1] = {}
+ for num = 1, #menu_blocks do
if rightop == #menu_blocks[1] + 1 then
matches[#matches][num] = cheat.compcurnext(menu_blocks[num][leftop], lastmatch[num],
optable[opsel], formtable[width], value, bcd == 1)
@@ -448,8 +451,6 @@ function cheatfind.startplugin()
lastmatch[num], optable[opsel], formtable[width], value, bcd == 1)
end
end
-
-
end
ret = true
end