Do you still maintain this? And is the tool intended to work in py3?
Not really for the first, and totally not for the second
I'm already late to fix bugs in my variable viewer
I was thinking about something, why are we bothering with external tools ?
Initially I started working on this because un.rpyc was precisely a "rpyc" file.
But to what extend do we really need to works externally like un.rpyc is actually doing ?
To what extend should un.rpyc need to be changed for something like:
Python:
python early hide:
# Place here the path to unrpyc files
unrpycBase = "[...]
if not unrpycBase in renpy.sys.path: renpy.sys.path.append( unrpycBase )
init python hide:
import unrpyc
unrpyc()
to works ?
And by extension, do we really need all unrpyc code ?
If you regard Ren'Py, since few years it include the
Interactive Director tool, that give you the code ; through a
renpy.script.Script
object I guess. I never had the time to really look at it, so I'm not sure how far it goes and if it include
init
bloc and independent statements like
define
or
image
.
But if it cover the whole AST, then it should be possible to have a version of un.rpyc that don't need to be adjusted time to time, and that wouldn't care about rpyc obfuscation, because working directly inside Ren'Py, with Ren'Py code, after the rpyc files have been loaded by it, and by using data directly gave by Ren'Py.
If it's the case, I guess that the whole code would be below one hundred lines. Some kind of:
Python:
init python hide:
class UnrpycFile( object ):
def __init__( self ):
self.lines = []
class UnrpycLine( object ):
def __init__( self, number, value ):
self.lineNumber = number
self.text = value
# Here starts the purely hypothetical part
def unrpyc():
unrpycFiles = {}
for atom in script:
if not atom.file in unrpycFiles:
unrpycFiles[atom.file] = UnrpycFile()
code = format the atom entity into (multi lines if needed) text
unrpycFiles[atom.file].lines.appened( UnrpycLine( atom.line, code ) )
for file in unrpycFiles:
create file
lineNumber = 0
for atom in sorted( unrpycFiles[file].lines, key = lambda x: x.lineNumber ):
write blank lines if needed, accordingly to lineNumber and atom.LineNumber
write atom.text
lineNumber += how many line have been added
close file
unrpyc()
At most with the help of a hijack of "start" label, if the game need to be started for the script to be available:
Python:
init python:
config.label_overrides["start"] = "unrpycStart"
config.label_overrides["startOut"] = "start"
label unrpycStart:
$ unrpyc()
jump startOut
Hijacking "_invoke_main_menu" should also works I guess.
It wouldn't works with older versions of Ren'Py, but it's not a problem since older versions of un.rpyc works with them.
Like you know un.rpyc way more than me, take a look if you've a bit of free time. You would surely see the possibilities, and identify the possible issues, way better than me.