Skip to content

Commit

Permalink
Merge pull request #71 from oblivioncth/feature/fp_12.1
Browse files Browse the repository at this point in the history
Make compatible with FP12.1
  • Loading branch information
oblivioncth authored Oct 29, 2023
2 parents 3d12672 + 4a8fafe commit 8f1310e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ob_standard_project_setup()

# Additional Project Variables
set(PROJECT_FORMAL_NAME "CLI Flashpoint")
set(TARGET_FP_VERSION_PREFIX 12.0)
set(TARGET_FP_VERSION_PREFIX 12.1)

# Configuration options
# Handled by fetched libs, but set this here formally since they aren't part of the main project
Expand Down Expand Up @@ -79,7 +79,7 @@ ob_fetch_qx(

# Fetch libfp (build and import from source)
include(OB/Fetchlibfp)
ob_fetch_libfp("v0.5")
ob_fetch_libfp("v0.5.1")

# Fetch QI-QMP (build and import from source)
include(OB/FetchQI-QMP)
Expand Down
2 changes: 1 addition & 1 deletion app/src/kernel/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Driver : public QObject

// Error Messages
static inline const QString ERR_LAUNCHER_RUNNING_TIP = u"Please close the Launcher first."_s;
static inline const QString ERR_INSTALL_INVALID_TIP = u"Check its location and compatibility with your Flashpoint version."_s;
static inline const QString ERR_INSTALL_INVALID_TIP = u"You may need to update CLIFp."_s;

// Logging
static inline const QString LOG_EVENT_FLASHPOINT_SEARCH = u"Searching for Flashpoint root..."_s;
Expand Down
3 changes: 2 additions & 1 deletion app/src/task/t-mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void TMount::perform()

//-Setup Mounter(s)------------------------------------

if(mDaemon == Fp::Daemon::FpProxy)
if(mDaemon == Fp::Daemon::FpProxy || mDaemon == Fp::Daemon::FpGameServer)
{
initMounter(mMounterProxy);
mMounterProxy->setFilePath(mPath);
Expand Down Expand Up @@ -122,6 +122,7 @@ void TMount::perform()
switch(mDaemon)
{
case Fp::Daemon::FpProxy:
case Fp::Daemon::FpGameServer:
mMounterProxy->mount();
break;

Expand Down
17 changes: 13 additions & 4 deletions app/src/tools/mounter_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// Qt Includes
#include <QAuthenticator>
#include <QUrlQuery>
#include <QDir>
#include <QJsonObject>
#include <QJsonDocument>

// Qx Includes
#include <qx/core/qx-string.h>
Expand Down Expand Up @@ -96,7 +99,7 @@ quint16 MounterProxy::proxyServerPort() const { return mProxyServerPort; }
QString MounterProxy::filePath() const { return mFilePath; }

void MounterProxy::setProxyServerPort(quint16 port) { mProxyServerPort = port; }
void MounterProxy::setFilePath(const QString& path) { mFilePath = path; }
void MounterProxy::setFilePath(const QString& path) { mFilePath = QDir::toNativeSeparators(path); }

//-Signals & Slots------------------------------------------------------------------------------------------------------------
//Private Slots:
Expand Down Expand Up @@ -139,9 +142,15 @@ void MounterProxy::mount()

// Header
mountReq.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

// Data (could use QJsonDocument but for such a simple object that's overkill
QByteArray data = "{\"filePath\":\""_ba + mFilePath.toLatin1() + "\"}"_ba;
// These headers are used by the stock launcher, but don't seem to be needed
//
// mountReq.setRawHeader("Connection"_ba, "close"_ba);
// mountReq.setRawHeader("Accept"_ba, "application/json, text/plain, */*"_ba);
// mountReq.setRawHeader("Accept-Encoding"_ba, "gzip, compress, deflate, br"_ba);

// Data
QJsonDocument jdData(QJsonObject{{u"filePath"_s, mFilePath}});
QByteArray data = jdData.toJson(QJsonDocument::Compact);

//-POST Request---------------------------------
mProxyMountReply = mNam.post(mountReq, data);
Expand Down

0 comments on commit 8f1310e

Please sign in to comment.