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:
parent
ea722bd7c2
commit
88b4a51389
3 changed files with 27 additions and 18 deletions
|
@ -32,7 +32,19 @@ void CompatibilityToolInstaller::installCompatibilityTool()
|
||||||
Q_UNUSED(QDir().mkpath(astraToolDir.absolutePath()))
|
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
|
// 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")));
|
QFile runScriptFile(astraToolDir.absoluteFilePath(QStringLiteral("run.sh")));
|
||||||
runScriptFile.open(QIODevice::WriteOnly | QIODevice::Text);
|
runScriptFile.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
@ -41,21 +53,17 @@ void CompatibilityToolInstaller::installCompatibilityTool()
|
||||||
|
|
||||||
QProcess::execute(QStringLiteral("chmod"), {QStringLiteral("+x"), astraToolDir.absoluteFilePath(QStringLiteral("run.sh"))});
|
QProcess::execute(QStringLiteral("chmod"), {QStringLiteral("+x"), astraToolDir.absoluteFilePath(QStringLiteral("run.sh"))});
|
||||||
|
|
||||||
QString command;
|
// copy required files
|
||||||
if (KSandbox::isFlatpak()) {
|
QFile::copy(QStringLiteral("/app/bin/steamwrap"), astraToolDir.absoluteFilePath(QStringLiteral("steamwrap")));
|
||||||
command = QStringLiteral("flatpak run zone.xiv.astra");
|
QFile::copy(QStringLiteral("/app/bin/libsteam_api.so"), astraToolDir.absoluteFilePath(QStringLiteral("libsteam_api.so")));
|
||||||
} else {
|
|
||||||
command = QCoreApplication::applicationFilePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString toolManifestContents =
|
const QString toolManifestContents = QStringLiteral(
|
||||||
QStringLiteral(
|
"\"manifest\"\n"
|
||||||
"\"manifest\"\n"
|
"{\n"
|
||||||
"{\n"
|
" \"version\" \"2\"\n"
|
||||||
" \"version\" \"2\"\n"
|
" \"commandline\" \"/shell.sh \\\"$STEAM_RUNTIME/scripts/switch-runtime.sh\\\" --runtime=\\\"\\\" -- "
|
||||||
" \"commandline\" \"/run.sh \\\"$STEAM_RUNTIME/scripts/switch-runtime.sh\\\" --runtime=\\\"\\\" -- %1 --steam %verb%\"\n"
|
"$STEAM_COMPAT_CLIENT_INSTALL_PATH/compatibilitytools.d/astra/run.sh %verb%\"\n"
|
||||||
"}")
|
"}");
|
||||||
.arg(command);
|
|
||||||
|
|
||||||
QFile toolManifestFile(astraToolDir.absoluteFilePath(QStringLiteral("toolmanifest.vdf")));
|
QFile toolManifestFile(astraToolDir.absoluteFilePath(QStringLiteral("toolmanifest.vdf")));
|
||||||
toolManifestFile.open(QIODevice::WriteOnly | QIODevice::Text);
|
toolManifestFile.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
@ -127,4 +135,4 @@ QDir CompatibilityToolInstaller::steamDir() const
|
||||||
return steamDir.absoluteFilePath(QStringLiteral("steam"));
|
return steamDir.absoluteFilePath(QStringLiteral("steam"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_compatibilitytoolinstaller.cpp"
|
#include "moc_compatibilitytoolinstaller.cpp"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "squareenixlogin.h"
|
#include "squareenixlogin.h"
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
#include <KSandbox>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
|
@ -86,7 +86,7 @@ modules:
|
||||||
sources:
|
sources:
|
||||||
- type: file
|
- type: file
|
||||||
url: https://xiv.zone/distrib/steamwrap/steamwrap
|
url: https://xiv.zone/distrib/steamwrap/steamwrap
|
||||||
sha256: b6c8a398fdf88787000df5de133c748b896b1ba3a2a9892f2e10e0f8e02627af
|
sha256: 86f798109366a8cb483c2cbd40116e2f34f533021eae18480c0ab7bd20fdf572
|
||||||
- name: steamapi
|
- name: steamapi
|
||||||
buildsystem: simple
|
buildsystem: simple
|
||||||
build-commands:
|
build-commands:
|
||||||
|
@ -94,7 +94,7 @@ modules:
|
||||||
sources:
|
sources:
|
||||||
- type: file
|
- type: file
|
||||||
url: https://xiv.zone/distrib/steamwrap/libsteam_api.so
|
url: https://xiv.zone/distrib/steamwrap/libsteam_api.so
|
||||||
sha256: b50b9d313eb554792216762f5cc0b972cfae14149f720440e0f0d6c4563c951f
|
sha256: 0f2c41c20644503c17e13498203986493332fc8296dbd78493bc1fed352ec0cc
|
||||||
- name: qt6-qtwebview
|
- name: qt6-qtwebview
|
||||||
buildsystem: cmake-ninja
|
buildsystem: cmake-ninja
|
||||||
cleanup-platform:
|
cleanup-platform:
|
||||||
|
|
Loading…
Add table
Reference in a new issue