Skip to content

Commit 5652555

Browse files
authored
Merge pull request #90 from oblivioncth/dev
Merge to master for v0.9.12
2 parents d246f22 + bdc43b7 commit 5652555

File tree

10 files changed

+55
-23
lines changed

10 files changed

+55
-23
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ labels: bug
66
assignees: oblivioncth
77

88
---
9-
109
### STOP
11-
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.
10+
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.
11+
12+
### When submitting a bug please use this template as an example:
13+
**MAKE SURE TO ATTACH YOUR CLIFP.LOG FILE**
1214

13-
### When submitting a bug please use this template:
1415
**Describe the bug**
1516
A clear and concise description of what the bug is.
1617

@@ -33,3 +34,5 @@ If applicable, add screenshots to help explain your problem.
3334

3435
**Additional context**
3536
Add any other context about the problem here.
37+
38+

.github/workflows/master-pull-request-merge-reaction.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
path: ${{ github.workspace }}/redirector
9292
- name: Deploy pages artifact
9393
id: page-deployment
94-
uses: actions/deploy-pages@v1
94+
uses: actions/deploy-pages@v4
9595

9696
create-release:
9797
name: Create GitHub release
@@ -114,7 +114,7 @@ jobs:
114114
7z a "${{ env.zips_path }}/${name}.zip" "${path}/*"
115115
}
116116
- name: Generate release
117-
uses: softprops/action-gh-release@v1
117+
uses: softprops/action-gh-release@v2
118118
with:
119119
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 }})"
120120
tag_name: "v${{ needs.tag_master_and_sync_dev.outputs.new_version }}"

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24.0...3.26.0)
66
# Project
77
# NOTE: DON'T USE TRAILING ZEROS IN VERSIONS
88
project(CLIFp
9-
VERSION 0.9.11
9+
VERSION 0.9.12
1010
LANGUAGES CXX
1111
DESCRIPTION "Command-line Interface for Flashpoint Archive"
1212
)
@@ -84,7 +84,7 @@ ob_fetch_qx(
8484

8585
# Fetch libfp (build and import from source)
8686
include(OB/Fetchlibfp)
87-
ob_fetch_libfp("v0.5.3")
87+
ob_fetch_libfp("v0.5.4")
8888

8989
# Fetch QI-QMP (build and import from source)
9090
include(OB/FetchQI-QMP)

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ Options:
209209

210210
- [Title Command](#title-commands) options
211211

212+
Notes:
213+
- You can use `--` to pass arguments directly to the title's underlying executable/script, which can be useful for testing or customizing your experience:
214+
215+
CLIFp play -t "One Stick Man!" -- -monitor 2
216+
212217
--------------------------------------------------------------------------------
213218

214219
**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.

app/src/command/c-play.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ Fp::AddApp CPlay::buildAdditionalApp(const Fp::Db::QueryBuffer& addAppResult)
6969

7070
//-Instance Functions-------------------------------------------------------------
7171
//Private:
72+
void CPlay::addPassthroughParameters(QString& param)
73+
{
74+
// Consider all positional arguments (can be explicitly added with "-- <args>") to be passthrough
75+
QStringList ptp = mParser.positionalArguments();
76+
if(!ptp.isEmpty())
77+
{
78+
param.append(u' ');
79+
param.append(TExec::joinArguments(ptp));
80+
}
81+
}
82+
7283
QString CPlay::getServerOverride(const Fp::GameData& gd)
7384
{
7485
QString override = gd.isNull() ? QString() : gd.parameters().server();
@@ -240,13 +251,15 @@ Qx::Error CPlay::enqueueAdditionalApp(const Fp::AddApp& addApp, const QString& p
240251
{
241252
QString addAppPath = mCore.resolveFullAppPath(addApp.appPath(), platform);
242253
QFileInfo addAppPathInfo(addAppPath);
254+
QString param = addApp.launchCommand();
255+
addPassthroughParameters(param);
243256

244257
TExec* addAppTask = new TExec(&mCore);
245258
addAppTask->setIdentifier(addApp.name());
246259
addAppTask->setStage(taskStage);
247260
addAppTask->setExecutable(QDir::cleanPath(addAppPathInfo.absoluteFilePath())); // Like canonical but doesn't care if path DNE
248261
addAppTask->setDirectory(addAppPathInfo.absoluteDir());
249-
addAppTask->setParameters(addApp.launchCommand());
262+
addAppTask->setParameters(param);
250263
addAppTask->setEnvironment(mCore.childTitleProcessEnvironment());
251264
addAppTask->setProcessType(addApp.isWaitExit() || taskStage == Task::Stage::Primary ? TExec::ProcessType::Blocking : TExec::ProcessType::Deferred);
252265

@@ -268,13 +281,15 @@ Qx::Error CPlay::enqueueGame(const Fp::Game& game, const Fp::GameData& gameData,
268281
QString gamePath = mCore.resolveFullAppPath(!gameData.isNull() ? gameData.appPath() : game.appPath(),
269282
game.platformName());
270283
QFileInfo gamePathInfo(gamePath);
284+
QString param = !gameData.isNull() ? gameData.launchCommand() : game.launchCommand();
285+
addPassthroughParameters(param);
271286

272287
TExec* gameTask = new TExec(&mCore);
273288
gameTask->setIdentifier(game.title());
274289
gameTask->setStage(taskStage);
275290
gameTask->setExecutable(QDir::cleanPath(gamePathInfo.absoluteFilePath())); // Like canonical but doesn't care if path DNE
276291
gameTask->setDirectory(gamePathInfo.absoluteDir());
277-
gameTask->setParameters(!gameData.isNull() ? gameData.launchCommand() : game.launchCommand());
292+
gameTask->setParameters(param);
278293
gameTask->setEnvironment(mCore.childTitleProcessEnvironment());
279294
gameTask->setProcessType(TExec::ProcessType::Blocking);
280295

app/src/command/c-play.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@
1010
class QX_ERROR_TYPE(CPlayError, "CPlayError", 1212)
1111
{
1212
friend class CPlay;
13-
//-Class Enums-------------------------------------------------------------
13+
//-Class Enums-------------------------------------------------------------
1414
public:
1515
enum Type
1616
{
1717
NoError = 0,
1818
InvalidUrl = 1,
1919
};
2020

21-
//-Class Variables-------------------------------------------------------------
21+
//-Class Variables-------------------------------------------------------------
2222
private:
2323
static inline const QHash<Type, QString> ERR_STRINGS{
2424
{NoError, u""_s},
2525
{InvalidUrl, u"The provided 'flashpoint://' scheme URL is invalid."_s}
2626
};
2727

28-
//-Instance Variables-------------------------------------------------------------
28+
//-Instance Variables-------------------------------------------------------------
2929
private:
3030
Type mType;
3131
QString mSpecific;
3232

33-
//-Constructor-------------------------------------------------------------
33+
//-Constructor-------------------------------------------------------------
3434
private:
3535
CPlayError(Type t = NoError, const QString& s = {});
3636

37-
//-Instance Functions-------------------------------------------------------------
37+
//-Instance Functions-------------------------------------------------------------
3838
public:
3939
bool isValid() const;
4040
Type type() const;
@@ -93,6 +93,7 @@ class CPlay : public TitleCommand
9393

9494
//-Instance Functions------------------------------------------------------------------------------------------------------
9595
private:
96+
void addPassthroughParameters(QString& param);
9697
QString getServerOverride(const Fp::GameData& gd);
9798
Qx::Error handleEntry(const Fp::Game& game);
9899
Qx::Error handleEntry(const Fp::AddApp& addApp);

app/src/kernel/core.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ Qx::Error Core::enqueueDataPackTasks(const Fp::GameData& gameData)
809809

810810
QString packPath = tk->datapackPath(gameData);
811811
QString packFilename = tk->datapackFilename(gameData);
812+
logEvent(LOG_EVENT_DATA_PACK_PATH.arg(packPath));
812813

813814
// Enqueue pack download if it's not available
814815
if(!tk->datapackIsPresent(gameData))

app/src/kernel/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class Core : public QObject
176176
static inline const QString LOG_EVENT_ENQ_START = u"Enqueuing startup tasks..."_s;
177177
static inline const QString LOG_EVENT_ENQ_STOP = u"Enqueuing shutdown tasks..."_s;
178178
static inline const QString LOG_EVENT_ENQ_DATA_PACK = u"Enqueuing Data Pack tasks..."_s;
179+
static inline const QString LOG_EVENT_DATA_PACK_PATH = u"Title Data Pack path is: %1"_s;
179180
static inline const QString LOG_EVENT_DATA_PACK_MISS = u"Title Data Pack is not available locally"_s;
180181
static inline const QString LOG_EVENT_DATA_PACK_FOUND = u"Title Data Pack with correct hash is already present, no need to download"_s;
181182
static inline const QString LOG_EVENT_DATA_PACK_NEEDS_MOUNT = u"Title Data Pack requires mounting"_s;

app/src/task/t-exec.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// Project Includes
88
#include "utility.h"
99

10+
// TODO: See if any quote handling here can be replaced with std::quoted()
11+
1012
//===============================================================================================================
1113
// TExecError
1214
//===============================================================================================================
@@ -39,13 +41,13 @@ QString TExecError::deriveSecondary() const { return mSpecific; }
3941
//Public:
4042
TExec::TExec(QObject* parent) :
4143
Task(parent),
42-
mEnvironment(smDefaultEnv),
43-
mBlockingProcessManager(nullptr)
44+
mBlockingProcessManager(nullptr),
45+
mEnvironment(smDefaultEnv)
4446
{}
4547

4648
//-Class Functions----------------------------------------------------------------
47-
//Private:
48-
QString TExec::collapseArguments(const QStringList& args)
49+
//Public:
50+
QString TExec::joinArguments(const QStringList& args)
4951
{
5052
QString reduction;
5153
for(int i = 0; i < args.size(); i++)
@@ -67,7 +69,6 @@ QString TExec::collapseArguments(const QStringList& args)
6769
return reduction;
6870
}
6971

70-
//Public:
7172
void TExec::installDeferredProcessManager(DeferredProcessManager* manager) { smDeferredProcessManager = manager; }
7273
DeferredProcessManager* TExec::deferredProcessManager() { return smDeferredProcessManager; }
7374
void TExec::setDefaultProcessEnvironment(const QProcessEnvironment pe) { smDefaultEnv = pe; }
@@ -91,7 +92,7 @@ QString TExec::createEscapedShellArguments()
9192
{
9293
// Collapse
9394
QStringList parameters = std::get<QStringList>(mParameters);
94-
QString collapsedParameters = collapseArguments(parameters);
95+
QString collapsedParameters = joinArguments(parameters);
9596

9697
// Escape
9798
escapedArgs = escapeForShell(collapsedParameters);
@@ -204,6 +205,13 @@ QString TExec::identifier() const { return mIdentifier; }
204205

205206
void TExec::setExecutable(QString executable) { mExecutable = executable; }
206207
void TExec::setDirectory(QDir directory) { mDirectory = directory; }
208+
209+
/* TODO: Initial testing shows that it may be safe to simply use QProcess::splitCommand() on all single string
210+
* commands so that they can universally be stored as a QStringList and bypass the need for QProcess::setNativeArguments(),
211+
* but this would be a huge change that would needs lots of testing (especially for sh/bat), and perhaps even a separate build
212+
* 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
213+
* out as initially hopped.
214+
*/
207215
void TExec::setParameters(const std::variant<QString, QStringList>& parameters) { mParameters = parameters; }
208216
void TExec::setEnvironment(const QProcessEnvironment& environment) { mEnvironment = environment; }
209217
void TExec::setProcessType(ProcessType processType) { mProcessType = processType; }

app/src/task/t-exec.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,8 @@ class TExec : public Task
118118
TExec(QObject* parent);
119119

120120
//-Class Functions-----------------------------------------------------------------------------------------------------
121-
private:
122-
static QString collapseArguments(const QStringList& args);
123-
124121
public:
122+
static QString joinArguments(const QStringList& args);
125123
static void installDeferredProcessManager(DeferredProcessManager* manager);
126124
static DeferredProcessManager* deferredProcessManager();
127125
static void setDefaultProcessEnvironment(const QProcessEnvironment pe);

0 commit comments

Comments
 (0)