summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/cheat
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2016-04-10 17:06:21 -0500
committer cracyc <cracyc@users.noreply.github.com>2016-04-10 17:06:21 -0500
commit6dcb0098160558e7707c213860131b192ed3189f (patch)
tree339195107aa421f51f89ded6fb11e739faef408c /plugins/cheat
parent2a6e17c4388e8ecdbf611937606de20d8163b6c3 (diff)
plugins/cheatfind: run same operation over a batch of data (nw)
Diffstat (limited to 'plugins/cheat')
-rw-r--r--plugins/cheat/init.lua26
1 files changed, 21 insertions, 5 deletions
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua
index 63bd76271f2..0bd9427f8c0 100644
--- a/plugins/cheat/init.lua
+++ b/plugins/cheat/init.lua
@@ -23,12 +23,16 @@
-- },
-- "screen": {
-- "varname": "tag"
--- },
+-- },
-- ...
-- "region": {
-- "varname": "tag",
-- ...
-- },
+-- "ram": {
+-- "varname": "tag",
+-- ...
+-- },
-- "script": {
-- "on|off|run|change": "script",
-- ...
@@ -159,7 +163,7 @@ function cheat.startplugin()
script = load(script, cheat.desc .. name, "t", cheat.cheat_env)
if not script then
print("error loading cheat script: " .. cheat.desc)
- cheat = { desc = cheat.desc .. "error" }
+ cheat = { desc = cheat.desc .. " error" }
return
end
cheat.script[name] = script
@@ -174,7 +178,7 @@ function cheat.startplugin()
cpu = manager:machine().devices[space.tag]
if not cpu then
print("error loading cheat script: " .. cheat.desc)
- cheat = { desc = cheat.desc .. "error" }
+ cheat = { desc = cheat.desc .. " error" }
return
end
if space.type then
@@ -184,7 +188,7 @@ function cheat.startplugin()
end
if not mem then
print("error loading cheat script: " .. cheat.desc)
- cheat = { desc = cheat.desc .. "error" }
+ cheat = { desc = cheat.desc .. " error" }
return
end
cheat.cheat_env[name] = mem
@@ -207,12 +211,24 @@ function cheat.startplugin()
mem = manager:machine():memory().regions[region]
if not mem then
print("error loading cheat script: " .. cheat.desc)
- cheat = nil
+ cheat = { desc = cheat.desc .. " error" }
return
end
cheat.cheat_env[name] = mem
end
end
+ if cheat.ram then
+ for name, ram in pairs(cheat.ram) do
+ local ram
+ ram = manager:machine().devices[ram]
+ if not ram then
+ print("error loading cheat script: " .. cheat.desc)
+ cheat = { desc = cheat.desc .. " error" }
+ return
+ end
+ cheat.cheat_env[name] = emu.item(ram.items["0/pointer"])
+ end
+ end
local param = cheat.parameter
if not param then
return