mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 19:57:45 +00:00
Fix how game PID detection in Dalamud mode when using Wine
The PID Dalamud gives us is the Windows PID, which would be internal to Wine. Instead, if we're using Wine we need to ignore that and find the ffxiv process ourselves.
This commit is contained in:
parent
1343558506
commit
41a91a0295
1 changed files with 16 additions and 2 deletions
|
@ -14,6 +14,8 @@
|
|||
#include "processwatcher.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include <KProcessList>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
GameRunner::GameRunner(LauncherCore &launcher, QObject *parent)
|
||||
|
@ -103,9 +105,21 @@ void GameRunner::beginDalamudGame(const QString &gameExecutablePath, Profile &pr
|
|||
|
||||
const auto match = pidRegex.match(log);
|
||||
if (match.hasCaptured(1)) {
|
||||
const int PID = match.captured(1).toInt();
|
||||
qint64 PID = match.captured(1).toInt();
|
||||
if (PID > 0) {
|
||||
qCInfo(ASTRA_LOG) << "Recieved PID from Dalamud:" << PID;
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||
// Dalamud gives us a Windows PID, but that's useless to us. We need to find the PID of the game now:
|
||||
|
||||
const auto info = KProcessList::processInfoList();
|
||||
for (const auto &entry : info) {
|
||||
if (entry.name().contains(QLatin1String("ffxiv"))) {
|
||||
qCInfo(ASTRA_LOG) << "Using PID of" << entry.name() << "which is" << entry.pid();
|
||||
PID = entry.pid();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
auto watcher = new ProcessWatcher(PID);
|
||||
connect(watcher, &ProcessWatcher::finished, this, [this, &profile] {
|
||||
profile.setLoggedIn(false);
|
||||
|
@ -377,4 +391,4 @@ void GameRunner::setWindowsVersion(const Profile &settings, const QString &versi
|
|||
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
||||
launchExecutable(settings, process, {QStringLiteral("winecfg"), QStringLiteral("/v"), version}, false, false);
|
||||
process->waitForFinished();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue