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

Uncaught exception while running a game with un.rpy #217

Closed
walterrr7 opened this issue Apr 3, 2024 · 10 comments
Closed

Uncaught exception while running a game with un.rpy #217

walterrr7 opened this issue Apr 3, 2024 · 10 comments

Comments

@walterrr7
Copy link

Hi, I wanted to decompile rpyc files from a game called goodbye eternity to see if i can mod the game and I'm getting this error :

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/un.rpy", line 2, in <module>
    init python early hide:
  File "game/un.rpy", line 31, in _execute_python_hide
    bindata = renpy.game.script.read_rpyc_data(file, 1)
AttributeError: 'Script' object has no attribute 'read_rpyc_data'

I tried putting the files un.rpy and un.rpyc in the "game" folder and i get the same error for both of them.
(sorry if this is already solved, I went throught the 150 solved problems and I didn't find anything similar)

Game version : 0.8.1
Python version installed : 3.11
Ren'Py version : 8.0.3

Thanks in advance for any help and if any file is needed I can provide it.

@madeddy
Copy link
Contributor

madeddy commented Apr 3, 2024

Which version of unrpyc did you try? And could you attach the file .../name_of_your_game/renpy/script.py ?

@CensoredUsername
Copy link
Owner

I tried putting the files un.rpy and un.rpyc in the "game" folder and i get the same error for both of them.
(sorry if this is already solved, I went throught the 150 solved problems and I didn't find anything similar)

No worries, thanks for the detailed bug report. I think you're dealing with a modified ren'py engine that has renamed that function to something different, because it ought to exist in ren'py 8.0.3. Could you try using unrpyc on the command line?

@walterrr7
Copy link
Author

Which version of unrpyc did you try? And could you attach the file .../name_of_your_game/renpy/script.py ?

I tried with both unrpyc 2.0.0 and 2.0.1
(file requested : script.zip)

No worries, thanks for the detailed bug report. I think you're dealing with a modified ren'py engine that has renamed that function to something different, because it ought to exist in ren'py 8.0.3. Could you try using unrpyc on the command line?

I just tried with the command line and it doesn't work either, I'm getting these errors :

When I run the command on a file :
Exception: Did not find a zlib compressed blob where it was expected. Either the header has been modified or the file structure has been changed

When I add "--try-harder" :
TypeError: ord() expected string of length 1, but int found

@CensoredUsername
Copy link
Owner

CensoredUsername commented Apr 3, 2024

I tried with both unrpyc 2.0.0 and 2.0.1
(file requested : script.zip)

Lmao they replaced all occurrences of rpyc in the file with lidl_discount and minified it. You can try replacing the function name read_rpyc_data in un.rpy with read_lidl_discount_data and it should likely work. Confusing that they then still shipped the python source file instead of just bytecode like ren'py games normally do.

When I run the command on a file :
Exception: Did not find a zlib compressed blob where it was expected. Either the header has been modified or the file structure has been changed

So they changed the file header as well. Seems like have implemented basic anti-unrpyc techniques. From what I saw --try-harder won't counter this one. They did a little bit more than just change the header.

When I add "--try-harder" :

Whoops, that's a bug on our side that happened during the python 3 transition. Thanks for letting me know.

Thanks for the bug report, looks like this isn't really an issue with unrpyc though, just a modified engine. I think you should be able to handle it from here, so I'll close this.

@madeddy
Copy link
Contributor

madeddy commented Apr 3, 2024

OMG!
I got a feeling and that's why i wanted to see the script.py. It's a massacre. Someone likes our german market, huh? 😁

And i think it broke my linter. Never see anything like this: "1045 problems" LOL, craaazy!

Screenshot_20240403_223813

Whoops, that's a bug on our side

That's at least something productive from this "thing".

@CensoredUsername
Copy link
Owner

And i think it broke my linter. Never see anything like this: "1045 problems" LOL, craaazy

haha that's minification for you. I do the same thing to create un.rpyc

@madeddy
Copy link
Contributor

madeddy commented Apr 3, 2024

Ok, that explains this part.
But all the other "hide and seek" changes? This "code" must be worth millions...to hide it like this. 🤣

@walterrr7
Copy link
Author

Lmao they replaced all occurrences of rpyc in the file with lidl_discount and minified it. You can try replacing the function name read_rpyc_data in un.rpy with read_lidl_discount_data and it should likely work. Confusing that they then still shipped the python source file instead of just bytecode like ren'py games normally do.

THANKS! this worked for me

@CensoredUsername
Copy link
Owner

But all the other "hide and seek" changes? This "code" must be worth millions...to hide it like this. 🤣

Nah.

People make these changes because they want to raise the barrier to modification, or redistribution, just a little bit. It'd surprise me if they spent more than an hour on this. It wouldn't be a problem to anyone with the technical skills to produce a high quality mod to break through this. Hell even someone with only a little bit of programming experience could likely figure this one out with a bit of time.

But it stops people whose interest in it doesn't go further than wanting to show people "yo omg I cracked this game" with the barest amount of effort.

Which is why, although I really like the challenge of breaking these kind of systems, I usually don't support people who ask for help with it past pointing out that they changed something. Especially if it's some terrible bug report that just summarizes to "does not work pls fix for me". I feel like, if someone spent time on making it slightly harder to get into something, you should at least be willing to put in some effort yourself to get past that as well.

Which is also why unrpyc doesn't just rip games automatically. I like it as a tool to be used when investigating things, and to enable skilled modding. It would've been really easy to make un.rpyc and friends just rip all assets automatically, or have the command line tool unarchive everything as well. But they don't, because this is a ren'py script decompiler, and not a game ripping tool. I'd like people to have to learn at least a bit about the thing they want to do.

@madeddy
Copy link
Contributor

madeddy commented Apr 4, 2024

I think we are "basically" on the same page.

People make these changes because they want to raise the barrier to modification, or redistribution, just a little bit.

I understand this and nothing against, but find it a bit funny if its "a bit" much. Especially if it looks like it was some work for them. But not to misunderstand this, as i enjoy looking with what ideas people come up and how it works. e.g. our case here where, as you said, they did

  • the header
  • minimze
  • code refactoring/renaming
  • and some cipher method called YVANeusEX (I've seen this elsewhere already)
    Maybe there is more. Quit applaudable such effort and fantasy. LIDL my ass. 🥲

...some terrible bug report that just summarizes to "does not work pls fix for me".

Oh yeah. I think we and a lot other people have seen our share of this behavior. Nothing to add.

I feel like, if someone spent time on making it slightly harder to get into something, you should at least be willing to put in some effort yourself to get past that as well.
Which is also why unrpyc doesn't just rip games automatically. I like it as a tool to be used when investigating things, and to enable skilled modding.

I fully sign this. 👍🏻

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

No branches or pull requests

3 participants