summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2016-07-03 08:57:40 -0500
committer cracyc <cracyc@users.noreply.github.com>2016-07-03 08:57:40 -0500
commite298801bb7d7912edb08308467e1bbb94e8d1b2f (patch)
tree26b5551ed8e69ae162c1c8414985fe1b598a07b5 /plugins
parent4dee62bc85ef9ddb5dd734d7f3a91a3d525dda92 (diff)
plugins/cheat: better error (nw)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/cheat/init.lua24
1 files changed, 15 insertions, 9 deletions
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua
index ad8882d0141..e2d44150e22 100644
--- a/plugins/cheat/init.lua
+++ b/plugins/cheat/init.lua
@@ -185,7 +185,8 @@ function cheat.startplugin()
script, err = load(script, cheat.desc .. name, "t", cheat.cheat_env)
if not script then
emu.print_verbose("error loading cheat script: " .. cheat.desc .. " " .. err)
- cheat = { desc = cheat.desc .. " error" }
+ cheat.desc = cheat.desc .. " error"
+ cheat.script = nil
return
end
cheat.script[name] = script
@@ -199,18 +200,21 @@ function cheat.startplugin()
local cpu, mem
cpu = manager:machine().devices[space.tag]
if not cpu then
- emu.print_verbose("error loading cheat script: " .. cheat.desc)
- cheat = { desc = cheat.desc .. " error" }
+ emu.print_verbose("error loading cheat script: " .. cheat.desc .. " missing device " .. space.tag)
+ cheat.desc = cheat.desc .. " error"
+ cheat.script = nil
return
end
if space.type then
mem = cpu.spaces[space.type]
else
+ space.type = "program"
mem = cpu.spaces["program"]
end
if not mem then
- emu.print_verbose("error loading cheat script: " .. cheat.desc)
- cheat = { desc = cheat.desc .. " error" }
+ emu.print_verbose("error loading cheat script: " .. cheat.desc .. " missing space " .. space.type)
+ cheat.desc = cheat.desc .. " error"
+ cheat.script = nil
return
end
cheat.cheat_env[name] = mem
@@ -230,8 +234,9 @@ function cheat.startplugin()
for name, region in pairs(cheat.region) do
local mem = manager:machine():memory().regions[region]
if not mem then
- emu.print_verbose("error loading cheat script: " .. cheat.desc)
- cheat = { desc = cheat.desc .. " error" }
+ emu.print_verbose("error loading cheat script: " .. cheat.desc .. " missing region " .. region)
+ cheat.desc = cheat.desc .. " error"
+ cheat.script = nil
return
end
cheat.cheat_env[name] = mem
@@ -241,8 +246,9 @@ function cheat.startplugin()
for name, tag in pairs(cheat.ram) do
local ram = manager:machine().devices[tag]
if not ram then
- emu.print_verbose("error loading cheat script: " .. cheat.desc)
- cheat = { desc = cheat.desc .. " error" }
+ emu.print_verbose("error loading cheat script: " .. cheat.desc .. " missing ram device " .. ram)
+ cheat.desc = cheat.desc .. " error"
+ cheat.script = nil
return
end
cheat.cheat_env[name] = emu.item(ram.items["0/m_pointer"])