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

Cannot start the game on Linux if Dalamud isn't enabled #160

Open
Toyoyo opened this issue Jun 27, 2024 · 1 comment
Open

Cannot start the game on Linux if Dalamud isn't enabled #160

Toyoyo opened this issue Jun 27, 2024 · 1 comment

Comments

@Toyoyo
Copy link

Toyoyo commented Jun 27, 2024

When I start the game without Dalamud, I get this error message from ffxiv_dx11.exe (see screenshot, basically saying to start the game from ffxivboot.exe, same message as if running ffxiv_dx11.exe directly).

This doesn't happen at all if Dalamud is enabled and injects fine, which is not going to be the case when 7.0 will launch.
ffxivboot

Happened before the 7.0 maintenance as well, is the same with or without steam integration, happens the same with the managed wine, a system-wide wine and proton.
Happens also in "fake login" mode.
Can not reproduce on windows, it starts fine there.

See attached launcher.log
launcher.log

@Toyoyo
Copy link
Author

Toyoyo commented Jun 27, 2024

After some more debugging I just found that the Windows codepath does not executes ffxiv_dx11.exe directly but instead use the "ACLonly" load method instead.

    public Process Start(string path, string workingDirectory, string arguments, IDictionary<string, string> environment, DpiAwareness dpiAwareness)
    {
        if (dalamudOk)
        {
            var compat = "RunAsInvoker ";
            compat += dpiAwareness switch {
                DpiAwareness.Aware => "HighDPIAware",
                DpiAwareness.Unaware => "DPIUnaware",
                _ => throw new ArgumentOutOfRangeException()
            };
            environment.Add("__COMPAT_LAYER", compat);

            var prevDalamudRuntime = Environment.GetEnvironmentVariable("DALAMUD_RUNTIME");
            if (string.IsNullOrWhiteSpace(prevDalamudRuntime))
                environment.Add("DALAMUD_RUNTIME", dotnetRuntimePath.FullName);

            return this.dalamudLauncher.Run(new FileInfo(path), arguments, environment);
        }
        else
        {
            return NativeAclFix.LaunchGame(workingDirectory, path, arguments, environment, dpiAwareness, process => { });
        }
    }

When I do the same thing on the Linux launcher, the games loads fine.

For now I have the following patch working.
Please note, I'm not familiar enough with the codebase to be sure my approach for setting the load method is correct, but did not find an existing way to do this.

diff '--exclude=.git' '--exclude=*.targets' -x '*.props' -rpuN XIVLauncher.orig/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common/Dalamud/DalamudLauncher.cs XIVLauncher.Patched/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common/Dalamud/DalamudLauncher.cs
--- XIVLauncher.orig/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common/Dalamud/DalamudLauncher.cs	2024-06-27 20:39:28.238852926 +0200
+++ XIVLauncher.Patched/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common/Dalamud/DalamudLauncher.cs	2024-06-27 20:55:33.716001777 +0200
@@ -11,7 +11,7 @@ namespace XIVLauncher.Common.Dalamud
 {
     public class DalamudLauncher
     {
-        private readonly DalamudLoadMethod loadMethod;
+        private DalamudLoadMethod loadMethod;
         private readonly DirectoryInfo gamePath;
         private readonly DirectoryInfo configDirectory;
         private readonly DirectoryInfo logPath;
@@ -24,6 +24,11 @@ namespace XIVLauncher.Common.Dalamud
         private readonly bool noThirdPlugin;
         private readonly string troubleshootingData;
 
+        public void SetLoadMethod(DalamudLoadMethod loadMethod)
+        {
+           this.loadMethod = loadMethod;
+        }
+
         public enum DalamudInstallState
         {
             Ok,
@@ -161,4 +166,4 @@ namespace XIVLauncher.Common.Dalamud
             return true;
         }
     }
-}
\ No newline at end of file
+}
diff '--exclude=.git' '--exclude=*.targets' -x '*.props' -rpuN XIVLauncher.orig/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common.Unix/UnixGameRunner.cs XIVLauncher.Patched/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common.Unix/UnixGameRunner.cs
--- XIVLauncher.orig/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common.Unix/UnixGameRunner.cs	2024-06-27 20:39:28.226853111 +0200
+++ XIVLauncher.Patched/XIVLauncher.Core/lib/FFXIVQuickLauncher/src/XIVLauncher.Common.Unix/UnixGameRunner.cs	2024-06-27 20:55:50.083750286 +0200
@@ -28,7 +28,8 @@ public class UnixGameRunner : IGameRunne
         }
         else
         {
-            return compatibility.RunInPrefix($"\"{path}\" {arguments}", workingDirectory, environment, writeLog: true);
+            this.dalamudLauncher.SetLoadMethod(DalamudLoadMethod.ACLonly);
+            return this.dalamudLauncher.Run(new FileInfo(path), arguments, environment);
         }
     }
-}
\ No newline at end of file
+}

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

1 participant