|
Cheat Engine The Official Site of Cheat Engine
|
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:44 pm Post subject: UTF-16 string from memory to clipboard |
|
|
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. I have found my break location, I have written the script to attach, debug, and set the breakpoint, and the breakpoint function written, the important part of which is:
Code: |
txt = readString(EAX, 1024, true)
print(txt)
control_setCaption(UDF1_CELabel1, txt)
writeToClipboard(txt)
|
The problem is that even though I specify that I'm reading a wide string from memory, all 3 ways of outputting it don't translate it correctly. Everything but Latin characters turns to "?"s, so the string "Jack は殺したモノ" becomes "Jack ??????" which obviously makes the whole point of the exercise moot.
I suspect this is a case of strings being stored as bytes rather than words. My question is, do I have any alternative (short of writing a plugin)?
Thanks for any help!
P.S. For anybody who wants to know, I'm using JGlossator to interpret the Japanese strings. It provides dictionary definitions for every word in a sentence, making it ideal for subtitles.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Aug 25, 2016 5:51 pm Post subject: |
|
|
Use readBytes(address, count, true) to return an array of bytes.
You'll have to read extra bytes and interrogate for the end of string yourself.
Code: | local aob = { 0x4A, 0x61, 0x63, 0x6B, 0x20, 0xE3, 0x81, 0xAF, 0xE6, 0xAE, 0xBA, 0xE3, 0x81, 0x97, 0xE3, 0x81, 0x9F, 0xE3, 0x83, 0xA2, 0xE3, 0x83, 0x8E }
local str = {}
for i, v in ipairs(aob) do
str[i] = string.char(v)
end
print(table.concat(str)) |
|
|
Back to top |
|
|
makerclark How do I cheat? Reputation: 0
Joined: 25 Aug 2016 Posts: 5
|
Posted: Thu Aug 25, 2016 6:03 pm Post subject: |
|
|
Thank you so much! A quick test shows that this works for the clipboard too.
I'm thinking I'll read the string with readString first to get the length (and there's a prefix I need to check anyway) and then use that length x 2 to read the actual bytes.
You have made my day!
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|