From f060eacf159bdabac97a4b9bb63f572c7b0a966c Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Sun, 30 Jun 2024 01:58:03 -0400 Subject: [PATCH] (Mostly) implement Game Redirects Taking a shortcut here, see libfp commit for details. --- CMakeLists.txt | 2 +- app/src/command/c-download.cpp | 4 ++++ app/src/command/title-command.cpp | 4 ++++ app/src/command/title-command.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bdef49..2876aad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ ob_fetch_qx( # Fetch libfp (build and import from source) include(OB/Fetchlibfp) -ob_fetch_libfp("5ff81d39c13e40f7fbfe01e44dc2170648d35dc8") +ob_fetch_libfp("e65151253813b8da7d7f9b8849810f58dd5e9a50") # Fetch QI-QMP (build and import from source) include(OB/FetchQI-QMP) diff --git a/app/src/command/c-download.cpp b/app/src/command/c-download.cpp index 472ada8..d921e68 100644 --- a/app/src/command/c-download.cpp +++ b/app/src/command/c-download.cpp @@ -75,6 +75,10 @@ Qx::Error CDownload::perform() const Fp::Toolkit* tk = mCore.fpInstall().toolkit(); for(const auto& pg : pItr->playlistGames()) { + /* TODO: This doesn't handle Game Redirects, i.e. if one ID on a playlist becomes a redirect entry in the future. + * Either need to add redirects here, or implement them in the DB module of libfp (full implementation). + */ + // Get data Fp::GameData gameData; if(Fp::DbError gdErr = db->getGameData(gameData, pg.gameId()); gdErr.isValid()) diff --git a/app/src/command/title-command.cpp b/app/src/command/title-command.cpp index c0ba6d2..86c9e0e 100644 --- a/app/src/command/title-command.cpp +++ b/app/src/command/title-command.cpp @@ -210,6 +210,10 @@ Qx::Error TitleCommand::getTitleId(QUuid& id) postError(err); return err; } + QUuid origId = titleId; + titleId = mCore.fpInstall().database()->handleGameRedirects(titleId); // Redirect shortcut + if(titleId != origId) + logEvent(LOG_EVENT_GAME_REDIRECT.arg(origId.toString(QUuid::WithoutBraces), titleId.toString(QUuid::WithoutBraces))); } else if(mParser.isSet(CL_OPTION_TITLE) || mParser.isSet(CL_OPTION_TITLE_STRICT)) { diff --git a/app/src/command/title-command.h b/app/src/command/title-command.h index 9f6cc18..eb0a1f9 100644 --- a/app/src/command/title-command.h +++ b/app/src/command/title-command.h @@ -59,6 +59,7 @@ class TitleCommand : public Command static inline const QString LOG_EVENT_SEL_RAND = u"Selecting a playable title at random..."_s; static inline const QString LOG_EVENT_INIT_RAND_ID = u"Randomly chose primary title is \"%1\""_s; static inline const QString LOG_EVENT_INIT_RAND_PLAY_ADD_COUNT = u"Chosen title has %1 playable additional-apps"_s; + static inline const QString LOG_EVENT_GAME_REDIRECT = u"Game redirected: %1 -> %2"_s; static inline const QString LOG_EVENT_RAND_DET_PRIM = u"Selected primary title"_s; static inline const QString LOG_EVENT_RAND_DET_ADD_APP = u"Selected additional-app \"%1\""_s; static inline const QString LOG_EVENT_RAND_GET_INFO = u"Querying random game info..."_s;