-
Notifications
You must be signed in to change notification settings - Fork 157
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
Add the ability to use this as a module #136
Comments
My bad, you can use this as a module but |
Mmmm... I've installed with |
Yeah, maybe it doesn't really make sense. I can just write My suggestion would be to maybe use pathlib's |
unrpyc.py diff With these changes I was able to make it work with python 3. So if you have this structure:
You can do from unrpyc_3 import unrpyc
unrpyc.decompile_rpyc('archive.rpa') And it works. |
@Bexa2 making decomplie_rpyc operate on file objects instead of filenames would be a nice addition (then you could also just use a BytesIO object in/out when you need to). |
Yeah, someone could make a script that combines rpatool and unrpyc. This is how I'm doing it right now: if rpa:
archive = rpatool.RenPyArchive(file_to_read)
for file in archive.list():
if "options.rpy" in file or "scripts.rpy" in file:
file_contents = archive.read(file)
tmp_filename = os.urandom(24).hex()
with open(tmp_filename, mode='wb') as fp:
fp.write(file_contents)
if not unrpyc.decompile_rpyc(tmp_filename):
print(f"Error decompiling {archive_rpa}")
with open(tmp_filename+".rpy", mode="r") as fp:
decompiled = fp.read()
Path(tmp_filename).unlink() Then I can easily grab the game's name and version so I don't have to rely on many of the filenames devs give to their zip files. It's a mess. |
I actually can do this. This does not feel like a difficult task (but I looked into the code only briefly - so perhaps there are issues I have not noticed yet). Will report back in a 2/3 weeks time. |
Before you base your work on some current branch, it should be taken into account there is a update coming in the next days. Especially unrpyc.py has some heavy changes coming. |
I think it's be nice to be able to use this as a module.
Paired with rpatool we could do something like:
It'd be useful if you want to extract information from the archive.rpa but don't need to write to file.
The text was updated successfully, but these errors were encountered: