Frogging-Family / wine-tkg-git

The wine-tkg build systems, to create custom Wine and Proton builds
861 stars 155 forks source link

Arcdps stops working between 5.19 and 5.21 #270

Open ibrokemypie opened 3 years ago

ibrokemypie commented 3 years ago

Arcdps ( a dps meter plugin for guildwars 2) works fine with a dll overrride to put native first for d3d9.dll from at least 5.7 to 5.19 (testing releases from the release page) but stops working at 5.21 and later. It doesnt work at all on plain wine-staging builds across that version range so I think some fix/change in tkg that allowed it to work stopped working between 5.19 and 5.21 Not sure what else to try at this point since I cant build versions that old (patching fails) but very much want to get this working so willing to try any ideas

Tk-Glitch commented 3 years ago

That might be the fullscreen hack.. Have you tried in windowed mode?

ibrokemypie commented 3 years ago

Same issue on both windowed and windowed fullscreen modes. Forgot to include before but heres the actual aerror message from the game when it crashes image

ibrokemypie commented 3 years ago

I narrowed the issue down to being caused by this specific commit https://github.com/wine-staging/wine-staging/commit/be9c96813add8c39fb80f47e85cc25fb1cc88c35, though I use fsync and am not really sure how these changes are related to arcdps/where to go from here

https://github.com/wine-staging/wine-staging/commit/80498dd4408b93dd4591d46928b5ec7f8aca6144 is the last commit where arcdps is working

Tk-Glitch commented 3 years ago

This actually is deeper than just staging. On -tkg, up to mainline 0c249e6125fc9dc6ee86b4ef6ae0d9fa2fc6291b (which is the last commit of the patchwave that dropped the following day, which the commit before the one you found as broken targets in staging https://github.com/wine-staging/wine-staging/commit/ed56966feb49eaee62356df5970c886344bc2ec5#diff-eb8a48ef787fa53774f08a80098309557fd40ae7c5e6232fae12ecf88cf5b362), we were reverting the whole ntdll refactor (see # Esync/Fsync killer - mainline reverts). This is a huge pile of commits getting reverted and backported.

So the breakage most likely happened in between 01150d7 and 0c249e6 upstream.

Reporting the issue on winehq would be the best thing to do for now: https://bugs.winehq.org/show_bug.cgi?id=48649 If you want to help fixing the issue, you'll need to provide logs from a vanilla upstream or staging build and not a -tkg build.

ibrokemypie commented 3 years ago

I will duplicate the instruction that I asked to do in the discord, because such things are quickly lost or may be unnoticed, and I have not received an answer yet:

can you try the following? open winecfg -> Libraries add d3d9_chainload and set it to native(windows) winecfg screenshot

d3d9_chainload

when add soft symlink for dxvk (he should already be in windows/system32/d3d9.dll) and make sure it successfully created in Guild Wars 2/bin64/d3d9_chainload.dll command example ln -sr "/games/gw2/drive_c/windows/system32/d3d9.dll" "/games/gw2/drive_c/Program Files/Guild Wars 2/bin64/d3d9_chainload.dll"

also, after remove arcdps.dll from prefix, try using this as script update_arcdps.sh

#!/bin/sh
cd "/games/gw2/drive_c/Program Files/Guild Wars 2/bin64"
wget -N https://www.deltaconnected.com/arcdps/x64/d3d9.dll
wget -N https://www.deltaconnected.com/arcdps/x64/d3d9.dll.md5sum

**replace all paths to files and directories with your own (I was starting from the script to run that you indicated above, but suddenly I did not guess somewhere)

the instruction is based on https://www.deltaconnected.com/arcdps/ this method allows you to safely delete only the arcdps (Guild Wars 2/bin64/d3d9.dll) file on days when a client update comes out and you need to wait for an arcdps update

works even with a binary TkG-Build: https://github.com/Frogging-Family/wine-tkg-git/releases/tag/6.0.r0.g2414b1da gw2-arcdps-on-tkg-build screenshot

following these steps to the t does not solve the issue for me on any of the effected wine versions, even after redownloading the dll with your script, adding the dll overrides and symbolic link and trying that wine version, the game still crashes at the end of loading after the character select.

ibrokemypie commented 3 years ago

I've opened a bug for wine staging at https://bugs.winehq.org/show_bug.cgi?id=50612

So far I've found out that the issue doesnt occur at all in vanilla wine of any version, but starts on wine-staging 5.14-1 from the arch repos, and 5.20 for tkg built wine staging

Iglu47 commented 3 years ago

Never mind about d3d9_chainload, and I have no idea that exectly going on.

Tk-Glitch commented 3 years ago

Sounds like a possible race condition

Iglu47 commented 3 years ago

Sounds like a possible race condition

Crashes was while in RtlDeleteTimer and RtlEnterCriticalSection ntdll functions, as far as I understand. I will try find way to get the backtrace/more info, but the main difficulty is that there are still no stable steps for repro (and on my machine, crashes do not occur at the very beginning after loading from the character selection window. Need to wait from 2 to 6 hours)

Iglu47 commented 3 years ago

I did some tests and got backtraces for two of the most crashes I encounter (I do not guarantee that there can't be more). They don't always look the same, so I'll only upload one example from each type here:

So crashes seem to be due to the incorrect work of inside DeleteTimerQueueEx and DeleteTimerQueueTimer in Wine itself. In the same 0x33373 offest of the same version of arcdps.dll (20210817.182846-373-x64)

I have not done tests on the vanilla version of Wine yet to see if it will be possible to make a report on bugs.winehq.org

Iglu47 commented 3 years ago

The developer Arcdps added a workaround to their own plugin (added some delay for TimerQueue when creating or something) which should fix the problem on most systems. aug.28.2021: improved compatibility with wine. So on the current version of Arcdps, it will no longer be possible to reproduce the problem. @ibrokemypie can you confirm that you cannot meet this now too?

However, to guarantee a complete fix of the problem, there is a patch for Wine by the same developer Arcdps, which will also fix problems for windows programs with similar behavior (currently unknown). It is already in the temporary build lutris-gw2, but now more interested in whether this patch can cause problems in other applications, so tests are probably needed for this.

Sounds like a possible race condition

@Tk-Glitch that patch that fixing this race condition

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51683 RtlCreateTimer-fix.patch

diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index ca323919d05..20096573c2b 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -936,12 +936,13 @@ NTSTATUS WINAPI RtlCreateTimer(PHANDLE NewTimer, HANDLE TimerQueue,
     if (q->quit)
         status = STATUS_INVALID_HANDLE;
     else
+    {
+        *NewTimer = t;
         queue_add_timer(t, queue_current_time() + DueTime, TRUE);
+    }
     RtlLeaveCriticalSection(&q->cs);

-    if (status == STATUS_SUCCESS)
-        *NewTimer = t;
-    else
+    if (status != STATUS_SUCCESS)
         RtlFreeHeap(GetProcessHeap(), 0, t);

     return status;
-- 
2.33.0