Jump to content

[Release] Agent - an all-games on any platform text hooker, use this for machine translations!


Recommended Posts

I think I finally got it fully working on 64bit PPSSPP. The crash I experienced previously when trying to use signature was because the signature was too vague, and it actually hooked to the wrong address - I only noticed it when I paused emulator before attaching. When I tried more specific signature - it worked.

I did that on "test 2" version.

Link to post
Share on other sites
39 minutes ago, 0xDC00 said:

@adamstan How about test1, please check it too.

Okay, I'll test that too. Also I think now I'll focus on making it work with '&' - Sora no Mukou de Sakimasu you ni -  on rpc3 emulator. I found out that this game uses utf8 encoding with 00 as terminator, I found an address when one of the lines is stored, and have a bunch of instructions that access it. Among those, one seems to be the instruction that reads the line one character at time, since it executes the same number of times as there are characters in the line. But when I try to hook to any of those instructions, I either get no reaction or a crash (the endless loop of "onEnter <address>" messages) :( When I get back home I'll post a screenshot with those instructions - maybe you'll have a better idea which one would be good to try.

But it's also possible that rpcs3 works in a weird way, just like PS3...

Edited by adamstan
Link to post
Share on other sites

Okay, as far as PPSSPP64 is concerned - "test2" version works properly for me:

agent-test2.png

When using the same signature on "test 1" version, it hooked to the correct address but it crashed when I pressed the button to advance the game.

 

And here are search results for rpcs3 and the abovementioned '&' - Sora no Mukou de Sakimasu you ni -

and-rpcs.png

But when trying to hook onto one of those instructions I get either no reaction or crash.

Edited by adamstan
Link to post
Share on other sites

@adamstan

Latest: https://github.com/0xDC00/agent/archive/refs/heads/master.zip
 

aIcDvbw.png


Try this script.
Note: create a new .js file inside the scripts folder and load it instead of ExecutionWatch.

globalThis._FIXED_DCODE_ = '$utf-8,|0|00,|rbx+[rbp+0x38]|4883EC28837D14000F85????????48????48????B0FEFFFF48??????????B0FEFFFF48????204C????????????4C????1848????????????48??????????78FFFFFF48';
// func 0x46328

var previousString = '';
globalThis.filters = function(s) {
    if (s === previousString) {
        console.log('>');
        return null;
    }
    previousString = s;
    return s.replace(/\n+/g, ' ');
}

require('_ExecutionWatch.js');

Source: https://docs.google.com/spreadsheets/d/14k5TBc2cAed8Fcx2fb5schlPh6Ah24dmW3dJpxvNAbc/edit#gid=0&range=E18

Edited by 0xDC00
fix image link
Link to post
Share on other sites
7 hours ago, 0xDC00 said:

@adamstan

Latest: https://github.com/0xDC00/agent/archive/refs/heads/master.zip
 

aIcDvbw.png


Try this script.
Note: create a new .js file inside the scripts folder and load it instead of ExecutionWatch.



globalThis._FIXED_DCODE_ = '$utf-8,|0|00,|rbx+[rbp+0x38]|4883EC28837D14000F85????????48????48????B0FEFFFF48??????????B0FEFFFF48????204C????????????4C????1848????????????48??????????78FFFFFF48';
// func 0x46328

var previousString = '';
globalThis.filters = function(s) {
    if (s === previousString) {
        console.log('>');
        return null;
    }
    previousString = s;
    return s.replace(/\n+/g, ' ');
}

require('_ExecutionWatch.js');

Source: https://docs.google.com/spreadsheets/d/14k5TBc2cAed8Fcx2fb5schlPh6Ah24dmW3dJpxvNAbc/edit#gid=0&range=E18

I was full of hope, but sadly, it's again perhaps the problem of different compilations on different systems - on mine, I get "No Result!" message when trying your custom script with d-code. Could you describe how did you arrive at this code? Then maybe I'll be able to work out the one for my system.

Link to post
Share on other sites
1 hour ago, 0xDC00 said:

Thanks! I found correct signature for my system, and now it works :D

and-success-hook

(Screenshot got weirdly streched, but that doesn't matter ;) )

If I may ask - how did you know that it should be function 0x46328 ?

Link to post
Share on other sites

@adamstan

Manual debug (CE debugger or x64dbg).
Like https://wiki.anime-sharing.com/hgames/index.php?title=AGTH/Tutorial

Your signature:
4883EC28837D14000F85????????48????48??????????B0FEFFFF48????B0FEFFFF48????204C????????????4C????1848????????????48??????????78FFFFFF48

My Signature:
4883EC28837D14000F85????????48????48????B0FEFFFF48??????????B0FEFFFF48????204C????????????4C????1848????????????48??????????78FFFFFF48

Hmm..., this signature will work for both machine.
4883EC28837D14000F85????????48????48????????????????????????B0FEFFFF48????204C????????????4C????1848????????????48??????????78FFFFFF48

 

Link to post
Share on other sites
  • 2 weeks later...

@0xDC00

I have one feature request (or perhaps a bugfix?) for ExecutionWatch script.

It's related to the problem I encoutered when playing Princess Evangile. This game uses UTF16 encoding with 0000 word used as terminator. And here's the problem - it seems that when searching for that pattern, it stops when it finds two consecutive 00 bytes regardless of their position, which leads to the situation from picture below:

agent-utf16terminator.png

Since this game has also latin letters and various formatting codes incorporated into the script, it is possible to encounter characters with codes that start or end with 00. And sometimes it leads to the premature clipping of the text, like in this example - there was 3E00 004E sequence - and those two middle bytes got misinterpreted as terminator pattern. I think the solution would be to modify the script so it would consider specified encoding and pattern length when looking for the terminator. So in this example, since it's utf16 and 2-bytes long terminator pattern, I think it should always read the data as 16bit words, not as a series of single bytes. That way we should be able to avoid this problem.

(BTW If I'm not mistaken, 004E code is 一 character, since I got the same problem with the word 一名, which is also always preceded by formatting code or special character ending in 00.)

 

Edited by adamstan
Link to post
Share on other sites
57 minutes ago, 0xDC00 said:

I have one more question. What is exact syntax for replace function? For example, I'd like to filter out ruby text/furigana. In case of this game, it means removing "<R*/" (with * here acting as a wildcard) and ">". What arguments should I provide to replace function?

Link to post
Share on other sites

@adamstan Custom script.

globalThis._FIXED_DCODE_ = '$utf-16,|50|0000,46??????????45??????F3??????????F3??????????41'; // <-- YOUR CODE HERE

//globalThis.decode = function(buffer) {
//    return _decode(buffer);
//}

globalThis.filters = function(s) {
    return s
        .replace(/(<R[^\/]+.)([^>]+)(.)/g, '$2') // trim ruby
        .replace(/<[A-Z]+>/g, '')                // trim tag
        //.replace(/\n+/g, ' ')                    // single line
        ;
}

require('_ExecutionWatch.js');

regex101

ZLzqFSn.png

Edited by 0xDC00
fix regex single line
Link to post
Share on other sites
9 minutes ago, 0xDC00 said:

@adamstan Custom script.


globalThis._FIXED_DCODE_ = '$utf-16,|50|0000,46??????????45??????F3??????????F3??????????41'; // <-- YOUR CODE HERE

//globalThis.decode = function(buffer) {
//    return _decode(buffer);
//}

globalThis.filters = function(s) {
    return s
        .replace(/(<R[^\/]+.)([^>]+)(.)/g, '$2') // trim ruby
        .replace(/<[A-Z]+>/g, '')                // trim tag
        //.replace(/\n+/, ' ')                   // single line
        ;
}

require('_ExecutionWatch.js');

regex101

ZLzqFSn.png

Thanks, works like a charm :) And thanks for the RegEx explanation/example :)

Link to post
Share on other sites
  • 1 month later...

Hello, @0xDC00

Could you perhaps help me with another PSP title? This time I'm trying to work out the D-CODE for PSP version of DameKoi

I found the signature that almost works:

44 0FB6 4C 03 00  - movzx r9d,byte ptr [rbx+rax+00]

44 0FB6 4C 03 00     
E9 19000000          
3D 00000100          
72 07                
3D 00400100          
72 E7                
8D 00                

$shift_jis,00,440FB64C0300E9190000003D0000010072073D0040010072E78D00

agent-damekoi1.png

But it has one little problem - it keeps truncating the first byte of the captured string, which leads to garbled up first character of the text:

agent-damekoi2.png

How can I fix that?

 

Link to post
Share on other sites

Okay, I found the solution, using 'expressions' field of the DCODE. Since original function pointed to rax+rbx, I just changed it to rax+rbx-1, to shift captured area one byte 'left'. Now it works as it should :)

agent-damekoi-success.png

So here's working D-CODE for PSP version of DameKoi:

$shift_jis,1|50|00,|rax+rbx-1|440FB64C03??E919????????????????72073D0040010072E78D00

(It has to be attached after starting the game)

 

Edited by adamstan
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...