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

OMORI on Linux FPSMeter error during start (Steam Play) #2

Open
nor2101 opened this issue Apr 20, 2023 · 15 comments
Open

OMORI on Linux FPSMeter error during start (Steam Play) #2

nor2101 opened this issue Apr 20, 2023 · 15 comments

Comments

@nor2101
Copy link

nor2101 commented Apr 20, 2023

By running OMORI with Kawariki 2.0 compat tool the game complains about missing FPSMeter plugin.

If I have to guess, it seems that it can't find the plugins folder correctly (which is inside the www game folder), or at least it can't find some of the plugins.

I tried running it with either the latest NWjs or with v0.54.1 using the env var (from steam launch command)

@Orochimarufan
Copy link
Owner

I don't own the game, so I can't test it myself. However, looking at the file listing https://steamdb.info/app/1150690/depots/ it seems the game tries very hard to obfuscate itself. That may or may not be part of the problem.

If you want to look into it further, more specifics about the error message would be helpful. You can try running steam from the terminal and look at the output (though it may be redirected into some file depending on distro). The devtools console may also help with figuring out what's going on (KAWARIKI_SDK=1 KAWARIKI_NWJS_DEVTOOLS=1)

@nor2101
Copy link
Author

nor2101 commented Apr 21, 2023

I screenshotted the DevTools window, hopefully it's helpful.

It looks like the game can't find the javascript plugin folder. I thoght it might be related to the Fedora kernel not having the kernel.unprivileged_userns_clone kernel flag:
sudo sysctl kernel.unprivileged_userns_clone returns sysctl: cannot stat /proc/sys/kernel/unprivileged_userns_clone: File o directory non esistente

But it looks like it can load the Pixi.js plugin just fine in www/libs and it can also load rpg_core.js in www/js, shouldn't these two fail as well without userns_clone?

Schermata del 2023-04-21 17-34-48
Schermata del 2023-04-21 17-34-56

EDIT: I think I may have the answer: the files are encrypted. Opening the www/js/plugins folder shows that they all have the .OMORI extension. Bummer I guess...

Schermata del 2023-04-21 17-57-22

@Orochimarufan
Copy link
Owner

It's not related to userns. It wouldn't launch at all if userns clone didn't work (unless you tell Kawariki not to use overlayns)

The files are indeed scrambled in some way. Perhaps the descrambling clashes with the case-insensitive filename resolution implemented in Kawariki or something.

Encryption/obfuscation like this is always a pain in the backside when trying to do anything not explicitly intended by the author (including running on another platform). Which is kind of the reason people try to "encrypt" their stuff.

It's probably not too hard to fix with a good look at the game files, but I can't really help much with that. Sorry. Feel free to ask any questions about RPGM or Kawariki internals if you decide to try.

TL;DR: It's probably not worth it to pursue this unless you're just interested in how the encryption/obfuscation works. Maybe try playing it through Proton (feels pretty bad to me to basically run a browser through wine though) or have a look at https://omo.cep.one/; they claim Steam Deck/Linux support and seem to have some kind of decryption tool and a discord.

@nor2101
Copy link
Author

nor2101 commented Apr 21, 2023

Yeah, I'm playing the game through Proton right now, and honestly it's not worse than when I play it with Windows, but I have different issues: on Windows I get a lot of frame judder, on Linux I get screen tearing (classic nvidia on X11 issue, although it's less noticeable than judder at 144hz).

I was looking on a way to upgrade NWjs to be able to remove the forced gpu-vsync of the game and use VRR with my monitor (which solves tearing in most cases).

I found this tool: https://github.com/Lou1sL/omori_decrypt

Maybe it's worth a shot to use this tool to decrypt the game files, but I don't think it's worth the effort to implement it in Kawariki just for this one game

@Orochimarufan
Copy link
Owner

Trying to run the game with decrypted files won't do any good AFAICT. That repo actually includes the decryption code though:
https://github.com/Lou1sL/omori_decrypt/blob/7130b93e42e46272608a6c026f783089d5711c81/www/js/rpg_managers.js#L2850

I believe I have found the issue as well. The decryption code is clashing with the mv-decrypted-assets plugin that ships with Kawariki. It should really only be enabled when needed, but there's no configuration system yet so I just enabled it all the time. I wasn't even aware anyone but myself used Kawariki.

You can try commenting out a few lines and see if that helps:

if game.rpgmaker_release == "MV" and not game.is_rpgmaker_mv_legacy:
inject_scripts.append(self.base_path / 'injects/mv-decrypted-assets.js')
if game.rpgmaker_release == "MZ":
inject_scripts.append(self.base_path / 'injects/mz-decrypted-assets.js')

@nor2101
Copy link
Author

nor2101 commented Apr 21, 2023

Trying to run the game with decrypted files won't do any good AFAICT. That repo actually includes the decryption code though:
https://github.com/Lou1sL/omori_decrypt/blob/7130b93e42e46272608a6c026f783089d5711c81/www/js/rpg_managers.js#L2850

Yeah, I tried the decrypt tool but nothing changed

I wasn't even aware anyone but myself used Kawariki.

I found your tool by trying to understand how to run the game natively on Linux. Honestly it's a pretty cool idea, and I like the injection approach to replace the windows NWjs

You can try commenting out a few lines and see if that helps:

if game.rpgmaker_release == "MV" and not game.is_rpgmaker_mv_legacy:
inject_scripts.append(self.base_path / 'injects/mv-decrypted-assets.js')
if game.rpgmaker_release == "MZ":
inject_scripts.append(self.base_path / 'injects/mz-decrypted-assets.js')

I tried to comment out those lines and run Omori, but the error is sadly the same as before (now I have the CEP mod installed, but same error with or without the mod):

Schermata del 2023-04-21 23-56-59

@Orochimarufan
Copy link
Owner

Orochimarufan commented Apr 21, 2023

I pushed some changes to disable the offending script by default.

The screenshot unfortunately isn't very useful; what does the devtools console say? Preferrably with traceback (May have to reload with F5 while devtools are open for the little dropdown arrow next to the red X to show up)

The output of the following in the console might also be interesting:

nw.App.argv
process.mainModule.filename

@nor2101
Copy link
Author

nor2101 commented Apr 22, 2023

Ok, these are the outputs:

Schermata del 2023-04-22 10-54-21
Schermata del 2023-04-22 10-54-49
Schermata del 2023-04-22 10-58-37

@Orochimarufan
Copy link
Owner

I had another look at this and it turns out the problem is that the game tries to use the LOCALAPPDATA environment variable without any safeguards. It's a standard Windows variable, so it would work unless someone has a really weird setup, but it doesn't exist on Linux. That's what that first error message is about (the path must be string one).

The above error causes one of the plugin files to not load, which means anything defined therein will be missing, including FPSMeter. Furthermore, the game uses native Node filesystem APIs directly which skips Kawariki's case handling, causing missing file errors.

I've implemented patching of the Node APIs as well as included a quirk for the LOCALAPPDATA in the latest commits. I still haven't actually tested it, so it'd be great to hear back if that's all the issues fixed.

@nor2101
Copy link
Author

nor2101 commented May 22, 2023

I had another look at this and it turns out the problem is that the game tries to use the LOCALAPPDATA environment variable without any safeguards. It's a standard Windows variable, so it would work unless someone has a really weird setup, but it doesn't exist on Linux. That's what that first error message is about (the path must be string one).

The above error causes one of the plugin files to not load, which means anything defined therein will be missing, including FPSMeter. Furthermore, the game uses native Node filesystem APIs directly which skips Kawariki's case handling, causing missing file errors.

I've implemented patching of the Node APIs as well as included a quirk for the LOCALAPPDATA in the latest commits. I still haven't actually tested it, so it'd be great to hear back if that's all the issues fixed.

I'll test it as soon as I can

@nor2101
Copy link
Author

nor2101 commented May 23, 2023

Ok, I tried it. It's improved, looks like it's finding the libraries now, but it still refuses to start, returning this error:

Schermata del 2023-05-23 22-43-20

A (hopefully) more detailed output:

Schermata del 2023-05-23 22-43-13

EDIT: nw.App.argv and process.mainModule.filename outputs:

Schermata del 2023-05-23 22-52-04

@Orochimarufan
Copy link
Owner

Have you tried running it without SDK mode? e.g. KAWARIKI_NWJS=75-nosdk

@nor2101
Copy link
Author

nor2101 commented May 23, 2023

Have you tried running it without SDK mode? e.g. KAWARIKI_NWJS=75-nosdk

Oh wow, yeah, I'm so dumb. It works now!

Only one issue: fullscreen settings don't work. It stays in a small window

@Orochimarufan
Copy link
Owner

Fullscreen is a big mess in RPGMaker since it's not built in and everyone is doing it slightly differently. I tend to just use WM shortcuts (KWin etc) for fullscreen

@nor2101
Copy link
Author

nor2101 commented Jun 2, 2023

Fullscreen is a big mess in RPGMaker since it's not built in and everyone is doing it slightly differently. I tend to just use WM shortcuts (KWin etc) for fullscreen

Double size window is also broken sadly. Setting it to 640x480 and allowing gamescope to handle it fixes it... whenever gamescope feels like starting on nvidia 😃

I'll close this issue though if that's ok with you, as you solved it and the fullscreen problem is a different thing

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

2 participants