Skip to content

Commit fff1a5b

Browse files
committed
Fixed launching Steam games through LaunchBox
1 parent 73938a4 commit fff1a5b

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/backend/providers/launchbox/LaunchBoxGamelistXml.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "model/gaming/Collection.h"
2424
#include "model/gaming/Game.h"
2525
#include "model/gaming/GameFile.h"
26-
#include "providers/ProviderUtils.h"
2726
#include "providers/SearchContext.h"
2827
#include "providers/launchbox/LaunchBoxXml.h"
2928
#include "utils/PathTools.h"
@@ -66,10 +65,9 @@ enum class AppField : unsigned char {
6665
void apply_game_fields(
6766
const HashMap<GameField, QString>& fields,
6867
model::Game& game,
69-
const HashMap<QString, Emulator>& emulators)
68+
const HashMap<QString, Emulator>& emulators,
69+
const QString& steam_call)
7070
{
71-
const QString steam_call(providers::find_steam_call());
72-
7371
QString emu_id;
7472
QString emu_params;
7573
QString emu_platform_name;
@@ -145,7 +143,7 @@ void apply_game_fields(
145143

146144
if (emu_id.isEmpty()) {
147145
if (source == QLatin1String("Steam")) {
148-
game.setLaunchCmd(steam_call % path);
146+
game.setLaunchCmd(steam_call % QChar(' ') % path);
149147
} else {
150148
game.setLaunchCmd(QStringLiteral("{file.path}"));
151149
game.setLaunchWorkdir(::clean_abs_dir(QFileInfo(path)));
@@ -368,6 +366,7 @@ HashMap<AppField, QString> GamelistXml::read_app_node(QXmlStreamReader& xml) con
368366
std::vector<model::Game*> GamelistXml::find_games_for(
369367
const Platform& platform,
370368
const HashMap<QString, Emulator>& emulators,
369+
const QString& steam_call,
371370
SearchContext& sctx) const
372371
{
373372
const QString xml_rel_path = QStringLiteral("Data/Platforms/%1.xml").arg(platform.name); // TODO: Qt 5.14+ QLatin1String
@@ -441,7 +440,7 @@ std::vector<model::Game*> GamelistXml::find_games_for(
441440
}
442441

443442
Q_ASSERT(game_ptr);
444-
apply_game_fields(fields, *game_ptr, emulators);
443+
apply_game_fields(fields, *game_ptr, emulators, steam_call);
445444
gameid_map.emplace(fields.at(GameField::ID), game_ptr);
446445
sctx.game_add_to(*game_ptr, collection);
447446
continue;

src/backend/providers/launchbox/LaunchBoxGamelistXml.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class GamelistXml {
4141
public:
4242
explicit GamelistXml(QString, QDir);
4343

44-
std::vector<model::Game*> find_games_for(const Platform&, const HashMap<QString, Emulator>&, SearchContext&) const;
44+
std::vector<model::Game*> find_games_for(const Platform&, const HashMap<QString, Emulator>&, const QString&, SearchContext&) const;
4545

4646
private:
4747
const QString m_log_tag;

src/backend/providers/launchbox/LaunchBoxProvider.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "Log.h"
2121
#include "Paths.h"
22+
#include "providers/ProviderUtils.h"
2223
#include "providers/launchbox/LaunchBoxAssets.h"
2324
#include "providers/launchbox/LaunchBoxEmulatorsXml.h"
2425
#include "providers/launchbox/LaunchBoxGamelistXml.h"
@@ -64,6 +65,8 @@ Provider& LaunchboxProvider::run(providers::SearchContext& sctx)
6465
return *this;
6566
}
6667

68+
const QString steam_call = providers::find_steam_call();
69+
6770
const HashMap<QString, Emulator> emulators = EmulatorsXml(display_name(), lb_dir).find();
6871
// NOTE: It's okay to not have any emulators
6972

@@ -73,7 +76,7 @@ Provider& LaunchboxProvider::run(providers::SearchContext& sctx)
7376
const GamelistXml metahelper(display_name(), lb_dir);
7477
const Assets assethelper(display_name(), lb_dir_path);
7578
for (const Platform& platform : platforms) {
76-
const std::vector<model::Game*> games = metahelper.find_games_for(platform, emulators, sctx);
79+
const std::vector<model::Game*> games = metahelper.find_games_for(platform, emulators, steam_call, sctx);
7780
progress += progress_step;
7881
emit progressChanged(progress);
7982

0 commit comments

Comments
 (0)