0xDC00 / agent

Universal script based text hooker (powered by FRIDA).
https://discord.gg/sWeFsmJYJc
181 stars 7 forks source link

Issue with finding an address of text string #3

Closed Oneline8 closed 3 years ago

Oneline8 commented 3 years ago

I was testing agent with RPCS3 and was able to pick a D-CODE for Disorder 6 (BLJM61067), but stuck at the first step doing the same for Harem Tengoku da to Omottara Yandere Jigoku Datta (BLJS10266, https://vndb.org/v14536). It seems that the game uses an encoding different from shift-jis, utf-8, utf-16 or utf-32, so I couldn't find address of an text string in memory. Will there be a solution for this?

0xDC00 commented 3 years ago

Thanks for sharing your code.

PS3 is Big Endian, try utf-16be or utf-32be. https://onlineutf8tools.com/convert-utf8-to-utf16 https://onlineutf8tools.com/convert-utf8-to-utf32

Oneline8 commented 3 years ago

That's a good point. Unfortunately utf-16be and utf-32be give the same result (screenshots). There's a file called StringList.dat in the game directory. When I opened it with hex editor, I found that it uses utf-8. Which means that the game might also use this encoding. Nevertheless Cheat Engine can't find anything for some reason.

0xDC00 commented 3 years ago

It's encrypted, the game processes the crypted data directly. That's why we can't find any decrypted string from the memory. 72 3A 70 76 7D 32 7C 98 7C 82 7C 98 xor 0xFF 8D C5 8F 89 82 CD 83 67 83 7D 83 67 <- shift_jis -> 最初はトマト

Unfortunately, D-CODE does not support that thing yet.

You can use the encrypted data find D-CODE. and modify the read_text function.

const view = new Uint8Array(buf);
for (let i=0; i<view.length; i++) view[i]^=0xFF;
const str = decoder.decode(buf)

image

Oneline8 commented 3 years ago

Alright. Another D-Code is ready. Had to do everything twice, since the first signature hooked strings without the first byte. Also added another regex expression to the script to remove garbage between lines. Unfortunately, all addresses of instructions have a lot of calls (being called for every character of string). So, OnEnter spam seems to be inevitable.

As for unmasking bytecode, I think it would be great, if you added a checkbox to the Encode page.

Screenshot

0xDC00 commented 3 years ago

Cool!

Since the first signature hooked strings without the first byte.

The expressions feature can handle this.

added another regex expression

Hmm, filter 1+2+3 seems not to work, in this case.

instructions have a lot of calls

No worries, the debounce function (JS) will ensure decode called only once.

unmasking bytecode...added a checkbox to the Encode page

What do you mean?

Oneline8 commented 3 years ago

What do you mean?

On the Encode page we input text into a field to convert it to hex code in different encodings, right? I suggest adding a checkbox that will show encrypted (with ^=0xFF operation) hex instead, so we could use it for searching text in Cheat Engine. I bet Yandere Jigoku isn't the only game that doesn't store decrypted string in memory.

0xDC00 commented 3 years ago

There are 256 values (00->FF). And maybe another game doesn't use xor for encryption. We need more cases, then I can add a config to handle directly in D-Code. I will close this issue.