1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-11 20:47:45 +00:00

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.
This commit is contained in:
Joshua Goins 2025-05-04 19:15:39 -04:00
parent ea722bd7c2
commit 88b4a51389
3 changed files with 27 additions and 18 deletions

View file

@ -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);

View file

@ -4,6 +4,7 @@
#include "squareenixlogin.h"
#include <KLocalizedString>
#include <KSandbox>
#include <QDesktopServices>
#include <QFile>
#include <QNetworkReply>

View file

@ -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: