diff options
author | 2016-07-14 14:57:47 -0500 | |
---|---|---|
committer | 2016-07-14 14:57:47 -0500 | |
commit | fa6bd3726529062b4ea003532eab5aa19de081cf (patch) | |
tree | 454a8bc1a1699ed229983bb624db13676596a49c /plugins/cheat/simple_conv.lua | |
parent | 5707b183dd0c203467be2dcaba5bf48b3e1e6cca (diff) |
plugins/cheatfind: add operand size to simple cheat and write cheats from cheatfind into simple file (nw)
Diffstat (limited to 'plugins/cheat/simple_conv.lua')
-rw-r--r-- | plugins/cheat/simple_conv.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/cheat/simple_conv.lua b/plugins/cheat/simple_conv.lua index 1fad3d7dfea..bb209d7af86 100644 --- a/plugins/cheat/simple_conv.lua +++ b/plugins/cheat/simple_conv.lua @@ -2,17 +2,27 @@ local simple = {} -- converter for simple cheats -- simple cheats are single address every frame ram cheats in one file called cheat.simple --- format: <set name>,<cputag>,<hex offset>,<hex value>,<desc> +-- format: <set name>,<cputag>,<hex offset>,<b|w|d|q - size>,<hex value>,<desc> -- only program address space is supported, comments are prepended with ; +-- size is b - u8, w - u16, d - u32, q - u64 function simple.conv_cheat(romset, data) local cheats = {} for line in data:gmatch('([^\n;]+)') do - local set, cputag, offset, val, name = line:match('([^,]+),([^,]+),([^,]+),([^,]+),(.+)') + local set, cputag, offset, size, val, name = line:match('([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),(.+)') if set == romset then local cheat = {} cheat.desc = name cheat.space = { cpup = { tag = cputag, type = "program" } } - cheat.script = { run = "cpup:write_u8(0x" .. offset .. ",0x" .. val .. ", true)" } + if size == "w" then + size "u16" + elseif size == "d" then + size = "u32" + elseif size == "q" then + size = "u64" + else + size = "u8" + end + cheat.script = { run = "cpup:write_" .. size .. "(0x" .. offset .. ",0x" .. val .. ", true)" } cheats[#cheats + 1] = cheat end end |