From d5b9f521afa8ce05cd00333d0e0e6ea6c7ca251c Mon Sep 17 00:00:00 2001 From: cracyc Date: Fri, 8 Jun 2018 20:29:58 -0500 Subject: plugins/cheatfind: use explicit integer sizes rather than "native" types (nw) --- plugins/cheatfind/init.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/cheatfind/init.lua b/plugins/cheatfind/init.lua index 25aac6768b3..2b7c1bb2db7 100644 --- a/plugins/cheatfind/init.lua +++ b/plugins/cheatfind/init.lua @@ -80,7 +80,7 @@ function cheatfind.startplugin() elseif data.shift < 0 then local s = -data.shift local read = (s == 1) and space.read_u16 or (s == 2) and space.read_u32 or (s == 3) and space.read_u64 or space.read_u8 - local pack = (s == 1) and "> s) do if j < 65536 then temp[j] = string.pack(pack, read(space, i)) @@ -254,7 +254,7 @@ function cheatfind.startplugin() local devtable = {} local devsel = 1 local devcur = 1 - local formtable = { "B", "b", "H", "h", "L", "l", "J", "j" } + local formtable = { "I1", "i1", "I2", "i2", "I4", "i4", "I8", "i8" } local formname = { "u8", "s8", "little u16", "big u16", "little s16", "big s16", "little u32", "big u32", "little s32", "big s32", "little u64", "big u64", "little s64", "big s64" } local width = 1 @@ -674,12 +674,12 @@ function cheatfind.startplugin() end return mpairs_it, list, 0 end - local bitwidth = formtable[width]:sub(2, 2):lower() - if bitwidth == "h" then + local bitwidth = formtable[width]:sub(3, 3):lower() + if bitwidth == "2" then bitwidth = " %04x" - elseif bitwidth == "l" then + elseif bitwidth == "4" then bitwidth = " %08x" - elseif bitwidth == "j" then + elseif bitwidth == "8" then bitwidth = " %016x" else bitwidth = " %02x" @@ -688,18 +688,18 @@ function cheatfind.startplugin() local function match_exec(match) local dev = devtable[devcur] local cheat = { desc = string.format(_("Test cheat at addr %08X"), match.addr), script = {} } - local wid = formtable[width]:sub(2, 2):lower() + local wid = formtable[width]:sub(3, 3):lower() local widchar local form - if wid == "h" then + if wid == "2" then wid = "u16" form = "%08x %04x" widchar = "w" - elseif wid == "l" then + elseif wid == "4" then wid = "u32" form = "%08x %08x" widchart = "d" - elseif wid == "j" then + elseif wid == "8" then wid = "u64" form = "%08x %016x" widchar = "q" -- cgit v1.2.3