From bdad406173575f0f08da12181be7dfff398d79a4 Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Sun, 14 Jul 2024 19:17:17 -0400 Subject: [PATCH 1/6] Update actions versions --- .github/workflows/master-pull-request-merge-reaction.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master-pull-request-merge-reaction.yml b/.github/workflows/master-pull-request-merge-reaction.yml index 065604b..7787dba 100644 --- a/.github/workflows/master-pull-request-merge-reaction.yml +++ b/.github/workflows/master-pull-request-merge-reaction.yml @@ -91,7 +91,7 @@ jobs: path: ${{ github.workspace }}/redirector - name: Deploy pages artifact id: page-deployment - uses: actions/deploy-pages@v1 + uses: actions/deploy-pages@v4 create-release: name: Create GitHub release @@ -114,7 +114,7 @@ jobs: 7z a "${{ env.zips_path }}/${name}.zip" "${path}/*" } - name: Generate release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: name: "CLIFp Release v${{ needs.tag_master_and_sync_dev.outputs.new_version }} (Targets FP ${{ needs.tag_master_and_sync_dev.outputs.target_fp_version }})" tag_name: "v${{ needs.tag_master_and_sync_dev.outputs.new_version }}" From 2f87573deb4f9c280566988a75de65df032ba25e Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Wed, 14 Aug 2024 11:51:01 -0400 Subject: [PATCH 2/6] Log datapack path --- app/src/kernel/core.cpp | 1 + app/src/kernel/core.h | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/kernel/core.cpp b/app/src/kernel/core.cpp index 3521113..827b530 100644 --- a/app/src/kernel/core.cpp +++ b/app/src/kernel/core.cpp @@ -809,6 +809,7 @@ Qx::Error Core::enqueueDataPackTasks(const Fp::GameData& gameData) QString packPath = tk->datapackPath(gameData); QString packFilename = tk->datapackFilename(gameData); + logEvent(LOG_EVENT_DATA_PACK_PATH.arg(packPath)); // Enqueue pack download if it's not available if(!tk->datapackIsPresent(gameData)) diff --git a/app/src/kernel/core.h b/app/src/kernel/core.h index c31cc64..fefae10 100644 --- a/app/src/kernel/core.h +++ b/app/src/kernel/core.h @@ -176,6 +176,7 @@ class Core : public QObject static inline const QString LOG_EVENT_ENQ_START = u"Enqueuing startup tasks..."_s; static inline const QString LOG_EVENT_ENQ_STOP = u"Enqueuing shutdown tasks..."_s; static inline const QString LOG_EVENT_ENQ_DATA_PACK = u"Enqueuing Data Pack tasks..."_s; + static inline const QString LOG_EVENT_DATA_PACK_PATH = u"Title Data Pack path is: %1"_s; static inline const QString LOG_EVENT_DATA_PACK_MISS = u"Title Data Pack is not available locally"_s; static inline const QString LOG_EVENT_DATA_PACK_FOUND = u"Title Data Pack with correct hash is already present, no need to download"_s; static inline const QString LOG_EVENT_DATA_PACK_NEEDS_MOUNT = u"Title Data Pack requires mounting"_s; From 16fea779d537cb99e096aff3649319520913694c Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Wed, 14 Aug 2024 15:59:02 -0400 Subject: [PATCH 3/6] Fix datapack sometimes not being found The actual datapack filenames were generated using different rounding behavior of their corresponding ISO8601 date string than Qt performs by default. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 457b3ac..3ead273 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ ob_fetch_qx( # Fetch libfp (build and import from source) include(OB/Fetchlibfp) -ob_fetch_libfp("v0.5.3") +ob_fetch_libfp("9fd47ecae0ba6a9befa6d587b6375f0e31f81062") # Fetch QI-QMP (build and import from source) include(OB/FetchQI-QMP) From 31be81b69b86078da2a9da1d7c387f3c5f463988 Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Wed, 14 Aug 2024 11:34:45 -0400 Subject: [PATCH 4/6] Add optional argument passthrough to executable for c-play --- README.md | 5 +++++ app/src/command/c-play.cpp | 19 +++++++++++++++++-- app/src/command/c-play.h | 11 ++++++----- app/src/task/t-exec.cpp | 20 ++++++++++++++------ app/src/task/t-exec.h | 4 +--- 5 files changed, 43 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index d9f690e..a1da9c3 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,11 @@ Options: - [Title Command](#title-commands) options +Notes: + - You can use `--` to pass arguments directly to the title's underlying executable/script, which can be useful for testing or customizing your experience: + + CLIFp play -t "One Stick Man!" -- -monitor 2 + -------------------------------------------------------------------------------- **prepare** - Initializes Flashpoint for playing the provided Data Pack based title by UUID. If the title does not use a Data Pack this command has no effect. diff --git a/app/src/command/c-play.cpp b/app/src/command/c-play.cpp index 4de0a1d..85a3556 100644 --- a/app/src/command/c-play.cpp +++ b/app/src/command/c-play.cpp @@ -69,6 +69,17 @@ Fp::AddApp CPlay::buildAdditionalApp(const Fp::Db::QueryBuffer& addAppResult) //-Instance Functions------------------------------------------------------------- //Private: +void CPlay::addPassthroughParameters(QString& param) +{ + // Consider all positional arguments (can be explicitly added with "-- ") to be passthrough + QStringList ptp = mParser.positionalArguments(); + if(!ptp.isEmpty()) + { + param.append(u' '); + param.append(TExec::joinArguments(ptp)); + } +} + QString CPlay::getServerOverride(const Fp::GameData& gd) { QString override = gd.isNull() ? QString() : gd.parameters().server(); @@ -240,13 +251,15 @@ Qx::Error CPlay::enqueueAdditionalApp(const Fp::AddApp& addApp, const QString& p { QString addAppPath = mCore.resolveFullAppPath(addApp.appPath(), platform); QFileInfo addAppPathInfo(addAppPath); + QString param = addApp.launchCommand(); + addPassthroughParameters(param); TExec* addAppTask = new TExec(&mCore); addAppTask->setIdentifier(addApp.name()); addAppTask->setStage(taskStage); addAppTask->setExecutable(QDir::cleanPath(addAppPathInfo.absoluteFilePath())); // Like canonical but doesn't care if path DNE addAppTask->setDirectory(addAppPathInfo.absoluteDir()); - addAppTask->setParameters(addApp.launchCommand()); + addAppTask->setParameters(param); addAppTask->setEnvironment(mCore.childTitleProcessEnvironment()); addAppTask->setProcessType(addApp.isWaitExit() || taskStage == Task::Stage::Primary ? TExec::ProcessType::Blocking : TExec::ProcessType::Deferred); @@ -268,13 +281,15 @@ Qx::Error CPlay::enqueueGame(const Fp::Game& game, const Fp::GameData& gameData, QString gamePath = mCore.resolveFullAppPath(!gameData.isNull() ? gameData.appPath() : game.appPath(), game.platformName()); QFileInfo gamePathInfo(gamePath); + QString param = !gameData.isNull() ? gameData.launchCommand() : game.launchCommand(); + addPassthroughParameters(param); TExec* gameTask = new TExec(&mCore); gameTask->setIdentifier(game.title()); gameTask->setStage(taskStage); gameTask->setExecutable(QDir::cleanPath(gamePathInfo.absoluteFilePath())); // Like canonical but doesn't care if path DNE gameTask->setDirectory(gamePathInfo.absoluteDir()); - gameTask->setParameters(!gameData.isNull() ? gameData.launchCommand() : game.launchCommand()); + gameTask->setParameters(param); gameTask->setEnvironment(mCore.childTitleProcessEnvironment()); gameTask->setProcessType(TExec::ProcessType::Blocking); diff --git a/app/src/command/c-play.h b/app/src/command/c-play.h index a76c41f..d120554 100644 --- a/app/src/command/c-play.h +++ b/app/src/command/c-play.h @@ -10,7 +10,7 @@ class QX_ERROR_TYPE(CPlayError, "CPlayError", 1212) { friend class CPlay; - //-Class Enums------------------------------------------------------------- +//-Class Enums------------------------------------------------------------- public: enum Type { @@ -18,23 +18,23 @@ class QX_ERROR_TYPE(CPlayError, "CPlayError", 1212) InvalidUrl = 1, }; - //-Class Variables------------------------------------------------------------- +//-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ {NoError, u""_s}, {InvalidUrl, u"The provided 'flashpoint://' scheme URL is invalid."_s} }; - //-Instance Variables------------------------------------------------------------- +//-Instance Variables------------------------------------------------------------- private: Type mType; QString mSpecific; - //-Constructor------------------------------------------------------------- +//-Constructor------------------------------------------------------------- private: CPlayError(Type t = NoError, const QString& s = {}); - //-Instance Functions------------------------------------------------------------- +//-Instance Functions------------------------------------------------------------- public: bool isValid() const; Type type() const; @@ -93,6 +93,7 @@ class CPlay : public TitleCommand //-Instance Functions------------------------------------------------------------------------------------------------------ private: + void addPassthroughParameters(QString& param); QString getServerOverride(const Fp::GameData& gd); Qx::Error handleEntry(const Fp::Game& game); Qx::Error handleEntry(const Fp::AddApp& addApp); diff --git a/app/src/task/t-exec.cpp b/app/src/task/t-exec.cpp index fca12c1..6f95f5d 100644 --- a/app/src/task/t-exec.cpp +++ b/app/src/task/t-exec.cpp @@ -7,6 +7,8 @@ // Project Includes #include "utility.h" +// TODO: See if any quote handling here can be replaced with std::quoted() + //=============================================================================================================== // TExecError //=============================================================================================================== @@ -39,13 +41,13 @@ QString TExecError::deriveSecondary() const { return mSpecific; } //Public: TExec::TExec(QObject* parent) : Task(parent), - mEnvironment(smDefaultEnv), - mBlockingProcessManager(nullptr) + mBlockingProcessManager(nullptr), + mEnvironment(smDefaultEnv) {} //-Class Functions---------------------------------------------------------------- -//Private: -QString TExec::collapseArguments(const QStringList& args) +//Public: +QString TExec::joinArguments(const QStringList& args) { QString reduction; for(int i = 0; i < args.size(); i++) @@ -67,7 +69,6 @@ QString TExec::collapseArguments(const QStringList& args) return reduction; } -//Public: void TExec::installDeferredProcessManager(DeferredProcessManager* manager) { smDeferredProcessManager = manager; } DeferredProcessManager* TExec::deferredProcessManager() { return smDeferredProcessManager; } void TExec::setDefaultProcessEnvironment(const QProcessEnvironment pe) { smDefaultEnv = pe; } @@ -91,7 +92,7 @@ QString TExec::createEscapedShellArguments() { // Collapse QStringList parameters = std::get(mParameters); - QString collapsedParameters = collapseArguments(parameters); + QString collapsedParameters = joinArguments(parameters); // Escape escapedArgs = escapeForShell(collapsedParameters); @@ -204,6 +205,13 @@ QString TExec::identifier() const { return mIdentifier; } void TExec::setExecutable(QString executable) { mExecutable = executable; } void TExec::setDirectory(QDir directory) { mDirectory = directory; } + +/* TODO: Initial testing shows that it may be safe to simply use QProcess::splitCommand() on all single string + * commands so that they can universally be stored as a QStringList and bypass the need for QProcess::setNativeArguments(), + * but this would be a huge change that would needs lots of testing (especially for sh/bat), and perhaps even a separate build + * for people willing to test to test it for a while since it has the potential to break many games if it doesn't work + * out as initially hopped. + */ void TExec::setParameters(const std::variant& parameters) { mParameters = parameters; } void TExec::setEnvironment(const QProcessEnvironment& environment) { mEnvironment = environment; } void TExec::setProcessType(ProcessType processType) { mProcessType = processType; } diff --git a/app/src/task/t-exec.h b/app/src/task/t-exec.h index ac5342f..a2b8cc2 100644 --- a/app/src/task/t-exec.h +++ b/app/src/task/t-exec.h @@ -118,10 +118,8 @@ class TExec : public Task TExec(QObject* parent); //-Class Functions----------------------------------------------------------------------------------------------------- -private: - static QString collapseArguments(const QStringList& args); - public: + static QString joinArguments(const QStringList& args); static void installDeferredProcessManager(DeferredProcessManager* manager); static DeferredProcessManager* deferredProcessManager(); static void setDefaultProcessEnvironment(const QProcessEnvironment pe); From d93f316ae752375650799ca4da5ee9ad984fb1f3 Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Sat, 17 Aug 2024 12:12:51 -0400 Subject: [PATCH 5/6] Update issue template --- .github/ISSUE_TEMPLATE/bug_report.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f8f8766..3e5e8db 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,11 +6,12 @@ labels: bug assignees: oblivioncth --- - ### STOP -If this is a bug that actually pertains to OFILb (the LaunchBox import tool) please use the issue tracker for [that repository](https://github.com/oblivioncth/OFILb/issues) instead. +If this is a bug that actually pertains to FIL (the launcher import tool) please use the issue tracker for [that repository](https://github.com/oblivioncth/FIL/issues) instead. + +### When submitting a bug please use this template as an example: +**MAKE SURE TO ATTACH YOUR CLIFP.LOG FILE** -### When submitting a bug please use this template: **Describe the bug** A clear and concise description of what the bug is. @@ -33,3 +34,5 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. + + From bdc43b7ba77aaa269d1b6ac778f62fe00beb3f7b Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Tue, 20 Aug 2024 00:01:51 -0400 Subject: [PATCH 6/6] Bump for release --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ead273..3ac73e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24.0...3.26.0) # Project # NOTE: DON'T USE TRAILING ZEROS IN VERSIONS project(CLIFp - VERSION 0.9.11 + VERSION 0.9.12 LANGUAGES CXX DESCRIPTION "Command-line Interface for Flashpoint Archive" ) @@ -84,7 +84,7 @@ ob_fetch_qx( # Fetch libfp (build and import from source) include(OB/Fetchlibfp) -ob_fetch_libfp("9fd47ecae0ba6a9befa6d587b6375f0e31f81062") +ob_fetch_libfp("v0.5.4") # Fetch QI-QMP (build and import from source) include(OB/FetchQI-QMP)