mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
plugins/cheat: Migrate remaining XML cheat code for Lua API changes.
This commit is contained in:
parent
9c961d992a
commit
525f744b38
@ -76,7 +76,7 @@ function xml.conv_cheat(data)
|
|||||||
local function convert_memref(cpu, phys, space, width, addr, rw)
|
local function convert_memref(cpu, phys, space, width, addr, rw)
|
||||||
-- debug expressions address spaces by index not by name
|
-- debug expressions address spaces by index not by name
|
||||||
local function get_space_name(index)
|
local function get_space_name(index)
|
||||||
local prefix = cpu:sub(1,1)
|
local prefix = cpu:sub(1, 1)
|
||||||
if prefix == ":" then
|
if prefix == ":" then
|
||||||
return cpu_spaces[cpu][index]
|
return cpu_spaces[cpu][index]
|
||||||
else
|
else
|
||||||
@ -85,7 +85,6 @@ function xml.conv_cheat(data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local mod = ""
|
local mod = ""
|
||||||
local count
|
|
||||||
if space == "p" then
|
if space == "p" then
|
||||||
fullspace = get_space_name(0)
|
fullspace = get_space_name(0)
|
||||||
elseif space == "d" then
|
elseif space == "d" then
|
||||||
@ -94,11 +93,11 @@ function xml.conv_cheat(data)
|
|||||||
fullspace = get_space_name(2)
|
fullspace = get_space_name(2)
|
||||||
elseif space == "r" then
|
elseif space == "r" then
|
||||||
fullspace = get_space_name(0)
|
fullspace = get_space_name(0)
|
||||||
mod = "direct_"
|
mod = "_direct"
|
||||||
space = "p"
|
space = "p"
|
||||||
elseif space == "o" then
|
elseif space == "o" then
|
||||||
fullspace = get_space_name(3)
|
fullspace = get_space_name(3)
|
||||||
mod = "direct_"
|
mod = "_direct"
|
||||||
space = "o"
|
space = "o"
|
||||||
end
|
end
|
||||||
if width == "b" then
|
if width == "b" then
|
||||||
@ -122,14 +121,15 @@ function xml.conv_cheat(data)
|
|||||||
else
|
else
|
||||||
spaces[cpuname .. space] = { tag = ":" .. cpu, type = fullspace }
|
spaces[cpuname .. space] = { tag = ":" .. cpu, type = fullspace }
|
||||||
if phys ~= "p" and mod == "" then
|
if phys ~= "p" and mod == "" then
|
||||||
mod = "log_"
|
mod = "v"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local ret
|
||||||
if rw == "=" then
|
if rw == "=" then
|
||||||
write = true
|
write = true
|
||||||
ret = cpuname .. space .. ":" .. "write_" .. mod .. width .. "(" .. addr .. ","
|
ret = string.format("%s%s:write%s_%s(%s,", cpuname, space, mod, width, addr)
|
||||||
else
|
else
|
||||||
ret = cpuname .. space .. ":" .. "read_" .. mod .. width .. "(" .. addr .. ")"
|
ret = string.format("%s%s:read%s_%s(%s)", cpuname, space, mod, width, addr)
|
||||||
end
|
end
|
||||||
if rw == "==" then
|
if rw == "==" then
|
||||||
ret = ret .. "=="
|
ret = ret .. "=="
|
||||||
@ -161,6 +161,7 @@ function xml.conv_cheat(data)
|
|||||||
data = data:gsub("%f[%w](%x+)%f[%W]", "0x%1")
|
data = data:gsub("%f[%w](%x+)%f[%W]", "0x%1")
|
||||||
-- 0?x? avoids an issue where db (data region byte) is interepeted as a hex number
|
-- 0?x? avoids an issue where db (data region byte) is interepeted as a hex number
|
||||||
data = data:gsub("([%w_:]-)%.(p?)0?x?([pmrodi3])([bwdq])@(%w+) *(=*)", convert_memref)
|
data = data:gsub("([%w_:]-)%.(p?)0?x?([pmrodi3])([bwdq])@(%w+) *(=*)", convert_memref)
|
||||||
|
local count
|
||||||
repeat
|
repeat
|
||||||
data, count = data:gsub("([%w_:]-)%.(p?)0?x?([pmrodi3])([bwdq])@(%b()) *(=*)", convert_memref)
|
data, count = data:gsub("([%w_:]-)%.(p?)0?x?([pmrodi3])([bwdq])@(%b()) *(=*)", convert_memref)
|
||||||
until count == 0
|
until count == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user