2023-10-11 18:01:30 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-10-11 14:30:21 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
|
|
class LauncherCore;
|
|
|
|
class Profile;
|
2024-04-01 15:03:10 -04:00
|
|
|
struct LoginAuth;
|
2023-10-11 14:30:21 -04:00
|
|
|
|
|
|
|
class GameRunner : public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit GameRunner(LauncherCore &launcher, QObject *parent = nullptr);
|
|
|
|
|
|
|
|
/// Begins the game executable, but calls to Dalamud if needed.
|
2024-07-04 20:53:06 -04:00
|
|
|
void beginGameExecutable(Profile &profile, const std::optional<LoginAuth> &auth);
|
2023-10-11 14:30:21 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Starts a vanilla game session with no Dalamud injection.
|
2024-04-19 20:29:28 -04:00
|
|
|
void beginVanillaGame(const QString &gameExecutablePath, Profile &profile, const std::optional<LoginAuth> &auth);
|
2023-10-11 14:30:21 -04:00
|
|
|
|
|
|
|
/// Starts a game session with Dalamud injected.
|
2024-04-19 20:29:28 -04:00
|
|
|
void beginDalamudGame(const QString &gameExecutablePath, Profile &profile, const std::optional<LoginAuth> &auth);
|
2023-10-11 14:30:21 -04:00
|
|
|
|
|
|
|
/// Returns the game arguments needed to properly launch the game. This encrypts it too if needed, and it's already joined!
|
2024-07-04 20:53:06 -04:00
|
|
|
QString getGameArgs(const Profile &profile, const std::optional<LoginAuth> &auth) const;
|
2023-10-11 14:30:21 -04:00
|
|
|
|
|
|
|
/// This wraps it in wine if needed.
|
2024-07-04 20:53:06 -04:00
|
|
|
void launchExecutable(const Profile &profile, QProcess *process, const QStringList &args, bool isGame, bool needsRegistrySetup);
|
2023-10-11 14:30:21 -04:00
|
|
|
|
2023-10-11 14:33:22 -04:00
|
|
|
/// Set a Wine registry key
|
|
|
|
/// \param settings The profile that's being launched
|
|
|
|
/// \param key The path to the registry key, such as HKEY_CURRENT_USER\\Software\\Wine
|
|
|
|
/// \param value The registry key name, like "HideWineExports"
|
|
|
|
/// \param data What to set the value as, like "1" or "0"
|
2023-12-23 11:11:02 -05:00
|
|
|
void addRegistryKey(const Profile &settings, const QString &key, const QString &value, const QString &data);
|
|
|
|
|
|
|
|
void setWindowsVersion(const Profile &settings, const QString &version);
|
2023-10-11 14:30:21 -04:00
|
|
|
|
|
|
|
LauncherCore &m_launcher;
|
|
|
|
};
|