CensoredUsername / unrpyc

A ren'py script decompiler
Other
870 stars 157 forks source link

Dev: translation refactoring #226

Closed madeddy closed 4 months ago

madeddy commented 6 months ago

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.

CensoredUsername commented 6 months ago

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 commented 6 months ago

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.

CensoredUsername commented 6 months ago

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

CensoredUsername commented 6 months ago

Fixed.

CensoredUsername commented 6 months ago

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

CensoredUsername commented 6 months ago

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 commented 6 months ago

What other traps do you mean though?

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

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.

CensoredUsername commented 6 months ago

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 commented 6 months ago

Also pushed README changes.