From 88b4a51389db198c258c696b26fce2b98e5d3a33 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 4 May 2025 19:15:39 -0400 Subject: [PATCH] Update steamwrap in Flatpak build, compatibility tool updates Now steamwrap is started automatically when launching the game using the compatibility tool, and cleaned up afterwards. --- launcher/src/compatibilitytoolinstaller.cpp | 40 ++++++++++++--------- launcher/src/squareenixlogin.cpp | 1 + zone.xiv.astra.yml | 4 +-- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/launcher/src/compatibilitytoolinstaller.cpp b/launcher/src/compatibilitytoolinstaller.cpp index bf4307b..cb88bb3 100644 --- a/launcher/src/compatibilitytoolinstaller.cpp +++ b/launcher/src/compatibilitytoolinstaller.cpp @@ -32,7 +32,19 @@ void CompatibilityToolInstaller::installCompatibilityTool() Q_UNUSED(QDir().mkpath(astraToolDir.absolutePath())) // we need a run script to escape the compatibility tool quirk where it runs everything in the current directory - const auto runScriptContents = QStringLiteral("#!/bin/sh\nexec \"$@\""); + const auto wrapperScriptContents = QStringLiteral("#!/bin/sh\nexec \"$@\""); + + QFile wrapperScriptFile(astraToolDir.absoluteFilePath(QStringLiteral("wrapper.sh"))); + wrapperScriptFile.open(QIODevice::WriteOnly | QIODevice::Text); + wrapperScriptFile.write(wrapperScriptContents.toUtf8()); + wrapperScriptFile.close(); + + QProcess::execute(QStringLiteral("chmod"), {QStringLiteral("+x"), astraToolDir.absoluteFilePath(QStringLiteral("wrapper.sh"))}); + + // we need a run script to escape the compatibility tool quirk where it runs everything in the current directory + const auto runScriptContents = QStringLiteral( + "$STEAM_COMPAT_CLIENT_INSTALL_PATH/compatibilitytools.d/astra/steamwrap & p1=$!\nflatpak run zone.xiv.astra --steam \"$@\" & p2=$!\nwait -n\n[ \"$?\" " + "-gt 1 ] || kill \"$p1\" \"$p2\"\nwait"); QFile runScriptFile(astraToolDir.absoluteFilePath(QStringLiteral("run.sh"))); runScriptFile.open(QIODevice::WriteOnly | QIODevice::Text); @@ -41,21 +53,17 @@ void CompatibilityToolInstaller::installCompatibilityTool() QProcess::execute(QStringLiteral("chmod"), {QStringLiteral("+x"), astraToolDir.absoluteFilePath(QStringLiteral("run.sh"))}); - QString command; - if (KSandbox::isFlatpak()) { - command = QStringLiteral("flatpak run zone.xiv.astra"); - } else { - command = QCoreApplication::applicationFilePath(); - } + // copy required files + QFile::copy(QStringLiteral("/app/bin/steamwrap"), astraToolDir.absoluteFilePath(QStringLiteral("steamwrap"))); + QFile::copy(QStringLiteral("/app/bin/libsteam_api.so"), astraToolDir.absoluteFilePath(QStringLiteral("libsteam_api.so"))); - const QString toolManifestContents = - QStringLiteral( - "\"manifest\"\n" - "{\n" - " \"version\" \"2\"\n" - " \"commandline\" \"/run.sh \\\"$STEAM_RUNTIME/scripts/switch-runtime.sh\\\" --runtime=\\\"\\\" -- %1 --steam %verb%\"\n" - "}") - .arg(command); + const QString toolManifestContents = QStringLiteral( + "\"manifest\"\n" + "{\n" + " \"version\" \"2\"\n" + " \"commandline\" \"/shell.sh \\\"$STEAM_RUNTIME/scripts/switch-runtime.sh\\\" --runtime=\\\"\\\" -- " + "$STEAM_COMPAT_CLIENT_INSTALL_PATH/compatibilitytools.d/astra/run.sh %verb%\"\n" + "}"); QFile toolManifestFile(astraToolDir.absoluteFilePath(QStringLiteral("toolmanifest.vdf"))); toolManifestFile.open(QIODevice::WriteOnly | QIODevice::Text); @@ -127,4 +135,4 @@ QDir CompatibilityToolInstaller::steamDir() const return steamDir.absoluteFilePath(QStringLiteral("steam")); } -#include "moc_compatibilitytoolinstaller.cpp" \ No newline at end of file +#include "moc_compatibilitytoolinstaller.cpp" diff --git a/launcher/src/squareenixlogin.cpp b/launcher/src/squareenixlogin.cpp index e27a9ed..d544559 100644 --- a/launcher/src/squareenixlogin.cpp +++ b/launcher/src/squareenixlogin.cpp @@ -4,6 +4,7 @@ #include "squareenixlogin.h" #include +#include #include #include #include diff --git a/zone.xiv.astra.yml b/zone.xiv.astra.yml index c4c30d5..7a289a1 100644 --- a/zone.xiv.astra.yml +++ b/zone.xiv.astra.yml @@ -86,7 +86,7 @@ modules: sources: - type: file url: https://xiv.zone/distrib/steamwrap/steamwrap - sha256: b6c8a398fdf88787000df5de133c748b896b1ba3a2a9892f2e10e0f8e02627af + sha256: 86f798109366a8cb483c2cbd40116e2f34f533021eae18480c0ab7bd20fdf572 - name: steamapi buildsystem: simple build-commands: @@ -94,7 +94,7 @@ modules: sources: - type: file url: https://xiv.zone/distrib/steamwrap/libsteam_api.so - sha256: b50b9d313eb554792216762f5cc0b972cfae14149f720440e0f0d6c4563c951f + sha256: 0f2c41c20644503c17e13498203986493332fc8296dbd78493bc1fed352ec0cc - name: qt6-qtwebview buildsystem: cmake-ninja cleanup-platform: