From a21cd131a5fcdd9f0867fcbd979125750df2ddbe Mon Sep 17 00:00:00 2001 From: cracyc Date: Tue, 20 Jun 2017 09:11:29 -0500 Subject: plugins/cheat: fix (nw) --- plugins/cheat/cheat_simple.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/cheat/cheat_simple.lua b/plugins/cheat/cheat_simple.lua index c10c0a6ac41..d7e9277457e 100644 --- a/plugins/cheat/cheat_simple.lua +++ b/plugins/cheat/cheat_simple.lua @@ -25,7 +25,7 @@ local codefuncs = {} local function prepare_rom_cheat(desc, region, addr, val, size, banksize, comp) local cheat = { desc = desc, region = { rom = region } } - cheat.script = { off = "if on then rom:write_u8(addr, save) end" } + cheat.script = { off = "if on then rom:write_u" .. size .. "(addr, save) end" } if banksize and comp then local rom = manager:machine():memory().regions[region] local bankaddr = addr & (banksize - 1) @@ -47,7 +47,7 @@ local function prepare_rom_cheat(desc, region, addr, val, size, banksize, comp) on = true addr = %d save = rom:read_u%d(addr) - rom:write_u8(addr, %d)]], addr, size, val) + rom:write_u%d(addr, %d)]], addr, size, size, val) return cheat end -- cgit v1.2.3