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

HACK:winex11: limits display modes size #83

Closed
wants to merge 1 commit into from
Closed

HACK:winex11: limits display modes size #83

wants to merge 1 commit into from

Conversation

yuiiio
Copy link

@yuiiio yuiiio commented Mar 1, 2020

@kisak-valve kisak-valve added the cw label Mar 1, 2020
@sonic2kk
Copy link

Can confirm this fixes "Nier: Automata (524220)". I haven't tested the other two games, but it works like magic. I compiled with Proton-tkg.

Fingers crossed this gets merged soon

@GloriousEggroll
Copy link
Contributor

I modified this patch to only take affect with these 3 games, if anyone's able to test:

From 1d6a9c4db01123b6dfd7de0848fe4b3d1870cf8c Mon Sep 17 00:00:00 2001
From: yuiiio <atbjyk@protonmail.com>
Date: Sun, 1 Mar 2020 17:26:58 +0900
Subject: [PATCH] HACK:winex11: limits resources->nmode

fix https://github.com/ValveSoftware/Proton/issues/2929
---
 dlls/winex11.drv/xrandr.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 93e3130cc8..f1acd3c743 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -582,11 +582,22 @@ static int xrandr12_init_modes(void)
         primary_width = primary_height;
         primary_height = tmp;
     }
+    
+    int limit = 53; // required by nier_automata (55), sekiro (53), dark_souls3 (53)
+    int capped_resources_nmode = resources->nmode;
+    const char *sgi = getenv("SteamGameId");
+
+    if (sgi && (!strcmp(sgi, "374320") | !strcmp(sgi, "524220") | !strcmp(sgi, "814380")))
+    {
+        if (resources->nmode > limit) {
+            capped_resources_nmode = limit;
+        }
+    }
 
     xrandr_mode_count = 0;
     for (i = 0; i < output_info->nmode; ++i)
     {
-        for (j = 0; j < resources->nmode; ++j)
+        for (j = 0; j < capped_resources_nmode; ++j)
         {
             XRRModeInfo *mode = &resources->modes[j];
 

@sonic2kk
Copy link

sonic2kk commented Jun 9, 2020

@GloriousEggroll You're probably already aware (sorry for being so late!) but yeah, this works fine in Proton-GE. Hopefully it gets merged into the official Proton release too!

@jqadev
Copy link

jqadev commented Jun 18, 2020

@aeikum is there a chance to merge it with @GloriousEggroll's patch into the next Proton release?

@aeikum
Copy link
Collaborator

aeikum commented Jun 18, 2020

No. I'm not yet convinced this is a game bug. Does it really crash on Windows if your display supports more than 53 modes?

If it really is the case, then the fix should be smarter about filtering out less useful resolutions. I'm not sure what that looks like. Maybe finding resolutions that are "similar" and eliminating redundant resolutions until we have fewer than the threshold. This should be done after we have built the full resolution list, i.e. towards the end of X11DRV_Settings_AddDepthModes.

But again, I'd like it demonstrated that the number of resolutions is actually the problem here.

@yuiiio
Copy link
Author

yuiiio commented Jun 18, 2020

This PR is for problem raising only
I'm not familiar with winex11
I hope someone will investigate further

@yuiiio yuiiio changed the title HACK:winex11: limits resources->nmode HACK:winex11: limits display modes size Sep 25, 2020
@yuiiio
Copy link
Author

yuiiio commented Oct 15, 2020

This shoul'd be fix at ac123a4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DARK SOULS III (374320), Nier: Automata (524220), Sekiro: Shadows Die Twice (814380) crash with Proton 4.11
6 participants