unrpyc icon indicating copy to clipboard operation
unrpyc copied to clipboard

Dev: translation refactoring

Open madeddy opened this issue 1 year ago • 9 comments

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.

madeddy avatar Apr 27 '24 22:04 madeddy

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?

CensoredUsername avatar May 02 '24 01:05 CensoredUsername

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 avatar May 02 '24 11:05 madeddy

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

CensoredUsername avatar May 02 '24 13:05 CensoredUsername

Fixed.

CensoredUsername avatar May 02 '24 13:05 CensoredUsername

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

CensoredUsername avatar May 02 '24 14:05 CensoredUsername

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.

CensoredUsername avatar May 02 '24 15:05 CensoredUsername

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.

madeddy avatar May 02 '24 18:05 madeddy

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 avatar May 03 '24 16:05 CensoredUsername

Also pushed README changes.

CensoredUsername avatar May 03 '24 17:05 CensoredUsername