Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev: translation refactoring #226

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

Conversation

madeddy
Copy link
Contributor

@madeddy madeddy commented Apr 27, 2024

This closes #202 and partly #211.

So, look what you think.
TL is now as much separated or compartmentalized as possible i think. It could be be cut out without touching much of the other code. I pulled some of the old code into dedicated functions to prevent repeat and as bonus deobfuscation is possible with TL.

Please check also the readme addition if you want to add something(dump opts...) or reword. My EN isn't the best.

- more separation of translation and pure decompile/astdump code in unrpyc.py
- TL needs now only one argparse option as the switch of both needed steps is internal
- multiprocessing related code was separated to own function for easy access from all use cases
- Some code for AST capture has also been separated for ease of use and so that TL can now use deobfuscation
@CensoredUsername CensoredUsername changed the base branch from dev to dev_tl May 2, 2024 01:44
@CensoredUsername CensoredUsername changed the base branch from dev_tl to dev May 2, 2024 01:44
@CensoredUsername
Copy link
Owner

I've pulled it into a dev_tl branch in here for now, and added a commit on top of it with some refactoring. Also removed a few branches that weren't necessary any more. Does this test alright for you?

@madeddy
Copy link
Contributor Author

madeddy commented May 2, 2024

No.

Extracting translations from /home/olli/.xlib/RPG/_test/TheInn-1.01.01-pc/game/1_01_01/take_me_home_country_roads_images.rpyc...

Traceback (most recent call last):
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 550, in <module>
main()
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 487, in main
results = run_workers(worker_tl, args, worklist, args.processes)
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 265, in run_workers
for result in pool.imap(worker, worker_args, 1):
File "/usr/lib/python3.10/multiprocessing/pool.py", line 873, in next
raise value
multiprocessing.pool.MaybeEncodingError: Error sending result: '<__main__.Context object at 0x76e8f63bc3d0>'. Reason: 'PicklingError("Can't pickle <class 'renpy.ast.Say'>: it's not the same object as renpy.ast.Say")'

AFAIK this happens because you removed the pickling of the extracted dialogues in Step1 (i comment there also). This TL setup has quit a few traps build in i'd say.

madeddy referenced this pull request May 2, 2024
…the same codepath, logging of issues encountered while extracting translations, and general clarification of code.
@CensoredUsername
Copy link
Owner

I'll fix that (and add a comment to note why it is needed). What other traps do you mean though?

@CensoredUsername
Copy link
Owner

Fixed.

@CensoredUsername
Copy link
Owner

Actually don't mind that I didn't fix it for sending it to the workers again. Damnit multiprocessing.

@CensoredUsername
Copy link
Owner

But wait, that actually wasn't an issue before. Passing it back to the workers always happened unpickled.

I'm somewhat confused how this was working to begin with. I'll take a better look later.

@madeddy
Copy link
Contributor Author

madeddy commented May 2, 2024

What other traps do you mean though?

I played with TL all through Feb-Mar to get it less cumbersome(imo).

  • The first mistake was to try to do both steps in one while inside MP. Send file into worker, pull TL for it and send it directly into decompiler. I came then to the conclusion we need another file to do it, but the current process has just the one.
  • The other thing i tried was to work on already decompiled files. However the way how the code for TL build is does not allow it i think.

Passing it back to the workers always happened unpickled.

Yes. Its the "dialogue" passing out of MP which needs to be masked somehow so the pickler doesn't throw a tantrum. Maybe its just the way these data are stored inside "dialogue" and not the content. No idea really.

…the same codepath, logging of issues encountered while extracting translations, and general clarification of code.
@CensoredUsername
Copy link
Owner

Aight, did a final pass over it and tested it, I was able to decompile the tutorial game in a variety of languages now. Looking through the README changes now.

@CensoredUsername
Copy link
Owner

Also pushed README changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants