plugins/cheat: translate debugger expressions by space index as the debugger does (nw)

pc9801: use correct video clock, fixes policenauts video speed (nw)
This commit is contained in:
cracyc 2018-05-02 08:42:56 -05:00
parent 72cfcbd39e
commit 6efb37250f
4 changed files with 28 additions and 9 deletions

View File

@ -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

View File

@ -1441,8 +1441,9 @@ void lua_engine::initialize()
"write_direct_u32", &addr_space::direct_mem_write<uint32_t>,
"write_direct_i64", &addr_space::direct_mem_write<int64_t>,
"write_direct_u64", &addr_space::direct_mem_write<uint64_t>,
"name", sol::property(&addr_space::name),
"name", sol::property([](addr_space &sp) { return sp.space.name(); }),
"shift", sol::property([](addr_space &sp) { return sp.space.addr_shift(); }),
"index", sol::property([](addr_space &sp) { return sp.space.spacenum(); }),
"map", sol::property([this](addr_space &sp) {
address_space &space = sp.space;
sol::table map = sol().create_table();

View File

@ -138,7 +138,6 @@ private:
template<typename T> void log_mem_write(offs_t address, T val);
template<typename T> T direct_mem_read(offs_t address);
template<typename T> void direct_mem_write(offs_t address, T val);
const char *name() const { return space.name(); }
address_space &space;
device_memory_interface &dev;

View File

@ -2333,12 +2333,12 @@ MACHINE_CONFIG_START(pc9801_state::pc9801_common)
MCFG_SCREEN_UPDATE_DRIVER(pc9801_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(pc9801_state, vrtc_irq))
MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 21.0526_MHz_XTAL / 8)
MCFG_DEVICE_ADDRESS_MAP(0, upd7220_1_map)
MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))
MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 21.0526_MHz_XTAL / 8)
MCFG_DEVICE_ADDRESS_MAP(0, upd7220_2_map)
MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)