plugins/cheat: create temp[0-9] in case xml script doesn't (nw)

This commit is contained in:
cracyc 2016-04-07 20:02:33 -05:00
parent d88bdb6869
commit ea484da9a8

View File

@ -158,18 +158,22 @@ function cheat.startplugin()
script = load(script, cheat.desc .. name, "t", cheat.cheat_env) script = load(script, cheat.desc .. name, "t", cheat.cheat_env)
if not script then if not script then
print("error loading cheat script: " .. cheat.desc) print("error loading cheat script: " .. cheat.desc)
cheat = nil cheat = { desc = cheat.desc .. "error" }
return return
end end
cheat.script[name] = script cheat.script[name] = script
end end
-- initialize temp[0-9] for backward compatbility reasons
for i = 0, 9 do
cheat.cheat_env["temp" .. i] = 0
end
if cheat.space then if cheat.space then
for name, space in pairs(cheat.space) do for name, space in pairs(cheat.space) do
local cpu, mem local cpu, mem
cpu = manager:machine().devices[space.tag] cpu = manager:machine().devices[space.tag]
if not cpu then if not cpu then
print("error loading cheat script: " .. cheat.desc) print("error loading cheat script: " .. cheat.desc)
cheat = nil cheat = { desc = cheat.desc .. "error" }
return return
end end
if space.type then if space.type then
@ -179,7 +183,7 @@ function cheat.startplugin()
end end
if not mem then if not mem then
print("error loading cheat script: " .. cheat.desc) print("error loading cheat script: " .. cheat.desc)
cheat = nil cheat = { desc = cheat.desc .. "error" }
return return
end end
cheat.cheat_env[name] = mem cheat.cheat_env[name] = mem