summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/cheat/cheat_xml.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/cheat/cheat_xml.lua')
-rw-r--r--plugins/cheat/cheat_xml.lua29
1 files changed, 24 insertions, 5 deletions
diff --git a/plugins/cheat/cheat_xml.lua b/plugins/cheat/cheat_xml.lua
index ac63bb76c7c..cb849fe0b07 100644
--- a/plugins/cheat/cheat_xml.lua
+++ b/plugins/cheat/cheat_xml.lua
@@ -54,27 +54,46 @@ local function xml_parse(data)
return xml_table
end
+local cpu_spaces = {}
+
+for tag, device in pairs(manager:machine().devices) do
+ local sp
+ for name, space in pairs(device.spaces) do
+ if not sp then
+ sp = {}
+ cpu_spaces[tag] = sp
+ end
+ sp[space.index] = space.name
+ end
+end
+
function xml.conv_cheat(data)
local spaces, regions, output
data = xml_parse(data)
+
local function convert_expr(data)
local write = false
local function convert_memref(cpu, phys, space, width, addr, rw)
+ -- debug expressions address spaces by index not by name
+ local function get_space_name(index)
+ return cpu_spaces[":" .. cpu][index]
+ end
+
local mod = ""
local count
if space == "p" then
- fullspace = "program"
+ fullspace = get_space_name(0)
elseif space == "d" then
- fullspace = "data"
+ fullspace = get_space_name(1)
elseif space == "i" then
- fullspace = "io"
+ fullspace = get_space_name(2)
elseif space == "r" then
- fullspace = "program"
+ fullspace = get_space_name(0)
mod = "direct_"
space = "p"
elseif space == "o" then
- fullspace = "decrypted_opcodes"
+ fullspace = get_space_name(3)
mod = "direct_"
space = "o"
end