Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


UTF-8 v.s UTF-16 scanning

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
makerclark
How do I cheat?
Reputation: 0

Joined: 25 Aug 2016
Posts: 5

PostPosted: Thu Aug 25, 2016 4:30 pm    Post subject: UTF-8 v.s UTF-16 scanning Reply with quote

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
View user's profile Send private message
STN
I post too much
Reputation: 42

Joined: 09 Nov 2005
Posts: 2672

PostPosted: Thu Aug 25, 2016 5:32 pm    Post subject: Reply with quote

Why not modify the language files directly? They must be stored somewhere in game directory
_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
makerclark
How do I cheat?
Reputation: 0

Joined: 25 Aug 2016
Posts: 5

PostPosted: Thu Aug 25, 2016 6:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
makerclark
How do I cheat?
Reputation: 0

Joined: 25 Aug 2016
Posts: 5

PostPosted: Sat Aug 27, 2016 9:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites