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

Hide DirectX 9 option if not available

(cherry picked from commit 8e4c032b3c)
This commit is contained in:
Joshua Goins 2024-03-23 12:51:48 -04:00
parent 78e8babffc
commit e213ab069d
4 changed files with 12 additions and 1 deletions

View file

@ -26,6 +26,7 @@ class Profile : public QObject
Q_PROPERTY(bool gamescopeEnabled READ gamescopeEnabled WRITE setGamescopeEnabled NOTIFY useGamescopeChanged)
Q_PROPERTY(bool gamemodeEnabled READ gamemodeEnabled WRITE setGamemodeEnabled NOTIFY useGamemodeChanged)
Q_PROPERTY(bool directx9Enabled READ directx9Enabled WRITE setDirectX9Enabled NOTIFY useDX9Changed)
Q_PROPERTY(bool hasDirectx9 READ hasDirectx9 NOTIFY gamePathChanged)
Q_PROPERTY(bool gamescopeFullscreen READ gamescopeFullscreen WRITE setGamescopeFullscreen NOTIFY gamescopeFullscreenChanged)
Q_PROPERTY(bool gamescopeBorderless READ gamescopeBorderless WRITE setGamescopeBorderless NOTIFY gamescopeBorderlessChanged)
Q_PROPERTY(int gamescopeWidth READ gamescopeWidth WRITE setGamescopeWidth NOTIFY gamescopeWidthChanged)
@ -80,6 +81,8 @@ public:
[[nodiscard]] bool directx9Enabled() const;
void setDirectX9Enabled(bool value);
[[nodiscard]] bool hasDirectx9() const;
[[nodiscard]] bool gamescopeFullscreen() const;
void setGamescopeFullscreen(bool value);

View file

@ -23,7 +23,7 @@ GameRunner::GameRunner(LauncherCore &launcher, QObject *parent)
void GameRunner::beginGameExecutable(Profile &profile, const LoginAuth &auth)
{
QString gameExectuable;
if (profile.directx9Enabled()) {
if (profile.directx9Enabled() && profile.hasDirectx9()) {
gameExectuable = profile.gamePath() + QStringLiteral("/game/ffxiv.exe");
} else {
gameExectuable = profile.gamePath() + QStringLiteral("/game/ffxiv_dx11.exe");

View file

@ -239,6 +239,12 @@ void Profile::setDirectX9Enabled(const bool value)
}
}
bool Profile::hasDirectx9() const
{
const QDir gameDir(gamePath());
return QFileInfo::exists(gameDir.absoluteFilePath(QStringLiteral("game/ffxiv.exe")));
}
bool Profile::gamescopeFullscreen() const
{
return m_config->gamescopeFullscreen();

View file

@ -61,10 +61,12 @@ FormCard.FormCardPage {
model: ["DirectX 11", "DirectX 9"]
currentIndex: page.profile.directx9Enabled ? 1 : 0
onCurrentIndexChanged: page.profile.directx9Enabled = (currentIndex === 1)
visible: page.profile.hasDirectx9
}
FormCard.FormDelegateSeparator {
above: directXDelegate
visible: page.profile.hasDirectx9
}
FormCard.FormTextDelegate {