| View previous topic :: View next topic |
| Author |
Message |
makerclark How do I cheat?
Reputation: 0
Joined: 25 Aug 2016 Posts: 5
|
Posted: Thu Aug 25, 2016 4:30 pm Post subject: UTF-8 v.s UTF-16 scanning |
|
|
First, amazing work on this tool. I'm very impressed.
I'm trying to use CE to study Japanese by running games with Japanese subtitles, so I want to grab Japanese strings from memory at certain points and copy them to the clipboard.
Currently (6.5.1), the string scanning feature in CE has a checkbox that says "Unicode", but from my experiments actually seems to mean "UTF-8". If I search for a Japanese string with Unicode checked, I can find it for games that have it encoded as UTF-8, but not for games using UTF-16.
Currently I have to use a different program to convert the Japanese string I'm searching to hexadecimal and then search for bytes, so it's not like I'm stopped, but it would be nice to be able to specify UTF-16 and search directly.
|
|
| Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Thu Aug 25, 2016 5:32 pm Post subject: |
|
|
Why not modify the language files directly? They must be stored somewhere in game directory
_________________
|
|
| Back to top |
|
 |
makerclark How do I cheat?
Reputation: 0
Joined: 25 Aug 2016 Posts: 5
|
Posted: Thu Aug 25, 2016 6:25 pm Post subject: |
|
|
| The language files ARE easily accessible, but there's a lot there, and I'm trying to get it to feed me phrases as I encounter them in the game (hoping to improve retention by having context). Thus I want to find a specific string in the running process as the first step to determine where to set a breakpoint.
|
|
| Back to top |
|
 |
makerclark How do I cheat?
Reputation: 0
Joined: 25 Aug 2016 Posts: 5
|
Posted: Sat Aug 27, 2016 9:04 pm Post subject: |
|
|
So I made my own fix for this. This code can be put in autorun, it adds a menu item to the scan value edit control "Convert Wide String To Hex". It reads the current string in the edit control, then puts the hex byte representation of the string as UTF16/UCS2/WideChar back in so that it can be searched for as an array of bytes. Has worked in my tests with Japanese strings that are wide.
| Code: |
function convertUnicodeStringToHex(sender)
mf=getMainForm()
txt = mf.scanvalue.Text
tbl = {}
i = 1
for p,c in utf8.codes(txt) do
tbl[i] = string.format("%X %X ", bAnd(c, 0xff), bAnd(bShr(c, 8), 0xff))
i = i + 1
end
mf.scanvalue.Text = table.concat(tbl)
end
if miConvertStringToUnicode == nil then
local mf=getMainForm()
miConvertStringToUnicode = createMenuItem(mf.scanvalue.PopupMenu)
miConvertStringToUnicode.Caption="Convert Wide String To Hex"
miConvertStringToUnicode.OnClick=convertUnicodeStringToHex
mf.scanvalue.PopupMenu.Items.add(miConvertStringToUnicode)
else
miConvertStringToUnicode.OnClick=convertUnicodeStringToHex
end
|
Finally I'd like to say kudos for making CE extensible so even when it doesn't quite do what I need, I can enhance it with some work. Very nice.
|
|
| Back to top |
|
 |
|