summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/cheat/cheat_xml.lua
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2018-05-02 08:42:56 -0500
committer cracyc <cracyc@users.noreply.github.com>2018-05-02 08:42:56 -0500
commit6efb37250fde2ff84629841149098f54642c5c7b (patch)
tree1dd869dab43afdd95e5ce386a7f1ace8a8a5fdaa /plugins/cheat/cheat_xml.lua
parent72cfcbd39eba25b1ea51499a1770215288f36b75 (diff)
plugins/cheat: translate debugger expressions by space index as the debugger does (nw)
pc9801: use correct video clock, fixes policenauts video speed (nw)
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