07th-mod / higurashi-assembly

9 stars 8 forks source link

Linux GNOME desktop environment crash / corrupted configuration file issue #97

Open drojf opened 5 years ago

drojf commented 5 years ago

Recently a user reported that when they start the game using a GNOME desktop (default for Ubuntu), they would get a window with infinite height, and the game wouldn't startup (black screen)


Working configurations:

Not working configurations:

I only tested Ubuntu using XFCE because GNOME had the same problem reported where the window would be infinitely tall and the game wouldn't startup.

The big problem with the GNOME problem is that it will remain, even if you uninstall the game, presumably because the messed up config file is in your ~.config/unity/... folder which never gets cleared unless you go and delete it

So even if the end user re-installs the un-modded game, it will still be stuck like that on GNOME. This may make it seem like it's not our mod causing the issue, when (I'm....pretty sure?) it is (see end of the discussion on discord below).

GNOME is the default desktop environment for Ubuntu, which I assume will make up many of our linux users.

I'm raising this in the higurashi-patch-compiler section because afaik the writing to the config file is done in the modified .dll. But the actual 'solution' could be just a fix in the installer, the .dll might not need to be modified.

Here was the discussion on discord (names omitted and edit for clarity):

---------------------------- Never had mono throw issue with my previous errors BTW did you read how I got higurashi working nativly on gnome? ---------------------------- Install xfce? ---------------------------- You had to force it in fullscreen iirc ---------------------------- Launch the game in full screen mode and mark the config read only ---------------------------- because after the game quits it sets the screenmanager to be windowed again. ---------------------------- That is strange, there's a fullscreen option in the settings ---------------------------- there's 2

1 768 1365 0 1080 1920 768 1 1365

screenmanager gets set to 0 after reboot causes the game to first start in window and then swaps to full however as you progress to later chapters that also becomes a problem ---------------------------- I think the game has issue with gtk 3 in windowed mode ---------------------------- One of these is a Unity setting (the screenmanager thing), the other one is something MG added but what the hell for? :thonk: ---------------------------- the height of the window always goes infinite beyond chapter 3 I've seen the config height being set to negative numbers or really high numbers If I swap to windowed mode right now the game would crash my gnome-shell oh and the same happens in openbox that's another desktop ---------------------------- Not just that if you use proton the same thing happens ---------------------------- One would assume that this would be the testing configruation, especially since Steam only officially supports Ubuntu ---------------------------- As you know I have used both.

Then later by @tellowkrinkle : ---------------------------- Ugh the reason the full screen works like that was to work around a separate issue involving the game not choosing the right aspect ratio if it started in full screen on my Linux boot So I made it so the game modifies the unity config on exit so it starts not full screen, then fullscreens itself once the game starts.

drojf commented 5 years ago

A note that I only did some minor tests - the part where I said "the game is initially not broken, but then installing and running the mod will cause the game to break" may have been me messing up something. But it's definitely possible to get into that state. I will do some further investigation later.

drojf commented 5 years ago

I just tested an install of chapter 5 with no mods (chapter 5 has never been installed on this linux machine). It has exactly the same problem, leading me to believe it has nothing to do with our mod, and is just the base game which is broken.

I followed the steps reported by the above user to 'fix' the problem:

The game will then run, however I didn't know how to exit fullscreen to test if windowed mode would cause the game to crash (alt-enter didn't work, neither did the 'f' key).

Also to add to my report, GNOME will entirely crash each time you start the game. Sometimes you can see the window go very tall before it crashes, sometimes not.

I'm not sure what to do here besides report it to the devs and add a warning to linux users, unless you can force a specific screen resolution in 'safe' mode or something like that.

DuncanCasteleyn commented 5 years ago

As fix for gnome users who don't want to swap their desktop, I have created a script that will enforce the game to run in full screen mode, you can download Higurashi When the Gnome shell cry.zip; It contains a bash script that will install the config files to enforce full screen on all the versions that are effected by the gnome shell problem.

Open a terminal and navigate to the location, where you save the file.

unzip Higurashi\ When\ the\ Gnome\ shell\ cry.zip
chmod 700 Higurashi\ When\ the\ Gnome\ shell\ cry.sh
./Higurashi\ When\ the\ Gnome\ shell\ cry.sh

Please note that trying to go to windowed mode during game run will most likely crash your gnome shell.

fallenguru commented 3 years ago
  1. IMHO this issue should be re-titled. The actual issue seems to be that some Higurashi arcs on some systems crash vital parts of the OS on startup.

This machine has Ubuntu 19.10; GNOME 3.34.x, x in [0..3], depending on component; proprietary nVidia drivers version 440; Steam beta. It took me ~10 months from the start of Onikakushi to the end of Himatsubushi, so package versions may have changed slightly since I've actually played an arc.

I do not know whether either of the two types of crashes is in fact the infamous GNOME crash issue, and I do not have the "infinite height" issue mentioned.

  1. The documentation should be updated, since it isn't as simple as GNOME + arc 4-8 = crash.

  2. On the Meakashi crash and workarounds

Launching a freshly downloaded and patched (1.1.63) copy of Meakashi results in the Higurashi window appearing, empty/black and freezing like that, and the UI becoming more or less unresponsive. The mouse pointer can still be moved, sometimes switching to console still works. SSH & friends are unaffected, and logs show that the nVidia driver has crashed. The box must be rebooted remotely, or locally via Alt+SysRq.

Editing ~/.config/unity3d/MangaGamer/Higurashi When They Cry - Ch.5 Meakashi to show <pref name="Screenmanager Is Fullscreen mode" type="int">1</pref> instead of 0 will allow the game to launch. Funnily enough, it launches in a window.

What then works:

What then does not work:

In short, as long as Screenmanager Is Fullscreen stays at 1, and you don't touch F, there is no problem, not even when fullscreen isn't actually on.

  1. Suggested workarounds

In theory, the installer could offer to generate a suitable prefs by asking Linux users if they want to play fullscreen or windowed, and in which resolution, and write-protect it, or something.

fallenguru commented 3 years ago

Update on Meakashi [Steam, patch version info at bottom, fresh install]

{
    "files": [
        {
            "id": "graphics",
            "version": "2.0.0"
        },
        {
            "id": "movie",
            "version": "1.0.0"
        },
        {
            "id": "voices",
            "version": "1.1.0"
        },
        {
            "id": "script",
            "version": "5.1.2"
        },
        {
            "id": "movie-unix",
            "version": "1.0.0"
        },
        {
            "id": "ui-windows-5.5.3p3",
            "version": "1.4.0"
        },
        {
            "id": "ui-windows-5.5.3p1",
            "version": "1.4.0"
        },
        {
            "id": "ui-unix-5.5.3p3",
            "version": "1.4.0"
        },
        {
            "id": "ui-unix-5.5.3p1",
            "version": "1.4.0"
        },
        {
            "id": "og-dll-asset-update",
            "version": "1.0.0"
        }
    ],
    "id": "Meakashi Ch.5/full",
    "lastAttemptedInstallID": "Meakashi Ch.5/full"
fallenguru commented 2 years ago

Just a quick update to say that Tsumihoroboshi (Steam) as of today, installer 1.1.91 is fine even on Ubuntu 18.04.6, which is on GNOME 3.28. AMD card. No problems on the 20.04/nVidia box, either.

drojf commented 1 year ago

We had another report of this issue on Manjaro 22.0.0 with Gnome 42.3. See below discussion

Hello! I was hoping to get some help with the base game, specifically Chapter 5, running on manjaro linux. I have reached out to mangagamer for support to see if it's some official issue but I've gotten no response and was hoping someone here would have had the same issue.

I was hoping the fixes provided by the mod would help however it has the same base issue.

The game opens at a massive resolution well beyond the borders of the screen. The only error I can find in the log is RenderTexture.Create failed: requested size is too large.

Sorry if this is the wrong place for this but I'm at the end of my rope and can't find anyone else to help.

Should also note wine/proton works, however I can't alt+tab out so I would rather just run native. It's also specifically chapter 5, or possibly all the answer arcs. 1-4 had no issues.

the behavoir is the same with and without the mod. actually just tried to install the mod to see if that would fix it today, however the behavoir is the same

Do you have the same issue as this person when you tab out? or does something else happen when you alt+tab out?

Preivously reported tab out issue: "IDK if this is a wine problem or just a problem with the Rei patch but I noticed that if I tab out of the app I can't progress text any more. I tried Matsuribayashi and it seems fine in wine (though the keyboard doesn't work)"

Not quite! The exact behavior is, and this applies to everything I run in proton or wine, is if I switch between desktops the game instantly crashes. If I alt+tab some games are stable, but higu in particular outright crashes.

For now, the user will try XFCE to see if it fixes the problem.

I'm not sure whether we should still try to fix this issue, or just recommend using Wine/Proton, given that there are other issues (at least for me), on the Native version of the game (see https://github.com/07th-mod/higurashi-assembly/issues/78 - assuming you can get Wine/Proton to run at all, it usually works perfectly.


Here is their player.log: Player.zip

fallenguru commented 1 year ago

Well, has this person tried the prefs workaround I posted above?

I'm not an anti-Proton crusader by any stretch of the imagination, but the native Linux version is fine, really.

drojf commented 1 year ago

Well, has this person tried the prefs workaround I posted above?

No, I forgot about that - they actually tried changing the resolution in the file themselves, but not the fix you stated earlier. I'll let them know, although I think they explicitly wanted to be able to ALT+TAB, and I wasn't sure whether the playerprefs fix works if you do that?

I'm not an anti-Proton crusader by any stretch of the imagination, but the native Linux version is fine, really.

See here: https://github.com/07th-mod/higurashi-assembly/issues/78

I've had reports (including from myself) of other problems on the Native Linux build.

However, when I wrote the last comment, I kinda forgot about the non-steam versions of the game (GOG and Mangagamer) where you don't have easy access to Steam/Proton, so for those platforms I would definitely want to try to fix the Native version (if I have time).

drojf commented 1 year ago

I was looking at this issue yesterday and found the game code runs for a little while before the game crashes.

If that was the case, perhaps I could make the game check/modify the prefs file itself. The only issue would be if the prefs file is overwritten as the game (Unity) exits, as then I don't have the opportunity to overwrite it/make changes to it.

drojf commented 1 year ago

hmm, looks like our mod already attempts to set the values, but it sets the fullyscreen mode to 0, not 1:

~GameSystem()
{
    // Fixes an issue where Unity would write garbage values to its saved state on Linux
    // If we do this while the game is running, Unity will overwrite the values
    // So do it in the finalizer, which will run as the game quits and the GameSystem is deallocated
    if (PlayerPrefs.HasKey("width") && PlayerPrefs.HasKey("height"))
    {
        int width = PlayerPrefs.GetInt("width");
        int height = PlayerPrefs.GetInt("height");
        PlayerPrefs.SetInt("Screenmanager Resolution Width", width);
        PlayerPrefs.SetInt("Screenmanager Resolution Height", height);
        PlayerPrefs.SetInt("is_fullscreen", IsFullscreen ? 1 : 0);
        PlayerPrefs.SetInt("Screenmanager Is Fullscreen mode", 0);
    }
}

https://github.com/07th-mod/higurashi-assembly/blob/74a12cded14f580681bcef420c88feb217bf1063/Assets.Scripts.Core/GameSystem.cs#L1114-L1128

The Unity forums suggests setting the value in OnApplicationQuit() instead:

 void OnApplicationQuit () {
     PlayerPrefs.SetInt("Screenmanager Resolution Width", 800);
     PlayerPrefs.SetInt("Screenmanager Resolution Height", 600);
     PlayerPrefs.SetInt("Screenmanager Is Fullscreen mode", 0);
 }

https://answers.unity.com/questions/438937/launching-game-in-windowed-mode-by-default-problem.html


To try:

drojf commented 1 year ago

Well, has this person tried the prefs workaround I posted above?

We tried applying the fix but it only seemed to work once? Even after trying to reset the playerprefs? I'm not exactly sure what happened.

I'll get back to you once I try the fix myself on my own machine (I'll probably install Ubuntu 18.04 which I previously tested to have the same issue)

fallenguru commented 1 year ago

I think they explicitly wanted to be able to ALT+TAB

Never had any problem with Alt-Tab whatsoever, and I used it a lot. No lag, either. Not even on a Surface Go 2 with the CPU throttled as low as it would go.

But then the only one that gave me any problems worth mentioning is Meakashi, and those ranged from runs fine, via intermittent crashes on startup (just the game), and needing the prefs fiddling, depending on the machine, distro version, and moon phase. I've had exactly one full gnome-shell crash, and that was in Tatarigoroshi.

My comments here are basically meant as evidence that the native version, while it may well be broken for some, even many people, isn't categorically borked on GNOME nowadays (if it ever was).

drojf commented 1 year ago

Just reporting back that the same user uninstalled our mod (they re-installed the vanilla/unmodded game), then tried your forced fullscreen again and it works (albeit with the wrong aspect ratio (the unmodded game should be 4:3 instead of 16:9)): Honeyview_unknown

Here is their log from it being run that time: Player(1).log

Possibly some of the mod code we have which attempts to fix this issue may be interfering with the external playerprefs fix.

@fallenguru - were your tests with the mod installed? or on the unmodded/vanilla version of the game?

fallenguru commented 1 year ago

Possibly some of the mod code we have which attempts to fix this issue may be interfering with the external playerprefs fix.

At any rate there seems to be a disconnect in behaviour between how the output is set up at startup and how it is changed at run-time.

@fallenguru - were your tests with the mod installed? or on the unmodded/vanilla version of the game?

Only ever with the mod. I take care to not even run the unmodded version once, so I can be sure I've a clean slate.

drojf commented 1 year ago

I should report in on the status of this issue, also to record some things before I forget.

  1. I did some testing on testing on Manjaro Linux (which uses Gnome DE), as another user reported the same issue on this setup. I found the mod itself caused some problems if you wanted to just play in fullscreen mode. I added/changed various things in the mod so that fullscreen would work, and some recovery to fullscreen mode if it was detected that the game crashed. I also added a 'fullscreen lock' which prevents you from entering windowed mode by accident. More details in this PR: https://github.com/07th-mod/higurashi-assembly/pull/91 (not yet merged)
  2. Just after I finished this, @tellowkrinkle found the bug didn't happen on the .x86 binary, but that may have been a red herring
  3. @tellowkrinkle did some more investigation and found the root cause of the issue. See this comment for details: https://github.com/07th-mod/higurashi-assembly/pull/91#issuecomment-1296724341 . Patching the binary to fix the issue will stop the game crashing in windowed mode, but will also require a restart before you can change the resolution.
  4. On discord, a user reported that you could solve this issue using gamescope, but I have not tested it yet.

if any yall are having problems running 07th mod (or any game thereof) natively on linux, try running through gamescope which transfers the program into its own minimal window manager although it will only work if you are using wayland (so oof if you are using an nvidia card without driver above version 515.x)

TellowKrinkle commented 1 year ago

Full fix with live resize support at https://github.com/07th-mod/higurashi-assembly/pull/93

nesper8 commented 1 year ago

i made a simple shell script which launches Higu in gamescope

#!/bin/bash
env INTEL_DEBUG=noccs gamescope ./HigurashiEp01.x86_64 -f -w 1366 -h 768

this launches Higu inside gamescope with -f for full screen -w for width and -h for height you only need env INTEL_DEBUG=noccs if you are experiencing graphical corruption in gamescope

gamescope is available in arch community repos and is preinstalled in nobara

drojf commented 1 year ago

Tellowkrinkle's fix has now been pushed out for all chapters, which I've tested to work on all chapters with this issue.

I'll leave this issue open as it's only just been released, in case there are some issues.