Skip to content

Commit

Permalink
add debug option for patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
moonshadow565 committed May 2, 2024
1 parent c46ad66 commit 48a63e1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
9 changes: 8 additions & 1 deletion cslol-tools/lib/lol/patcher/patcher_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ auto patcher::run(std::function<void(Message, char const*)> update,
fs::path const& config_path,
fs::path const& game_path,
fs::names const& opts) -> void {
bool debugpatcher = 0;
for (auto const& o : opts) {
if (o == "debugpatcher") {
debugpatcher = true;
}
}

// Initialize first proces.
lol_throw_if(cslol_init());
lol_throw_if(cslol_set_flags(CSLOL_HOOK_DISALBE_NONE));
lol_throw_if(cslol_set_log_level(CSLOL_LOG_INFO));
lol_throw_if(cslol_set_log_level(debugpatcher ? CSLOL_LOG_DEBUG : CSLOL_LOG_INFO));
lol_throw_if(cslol_set_config(profile_path.generic_u16string().c_str()));

for (;;) {
Expand Down
2 changes: 1 addition & 1 deletion src/CSLOLTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CSLOLTools : public QObject {
void deleteMod(QString name);
void exportMod(QString name, QString dest);
void installFantomeZip(QString path);
void saveProfile(QString name, QJsonObject mods, bool run, bool skipConflict, bool oldPatcher);
void saveProfile(QString name, QJsonObject mods, bool run, bool skipConflict, bool debugPatcher);
void loadProfile(QString name);
void deleteProfile(QString name);
void stopProfile();
Expand Down
4 changes: 2 additions & 2 deletions src/CSLOLToolsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ void CSLOLToolsImpl::doUpdate(QString urls) {
}
}

void CSLOLToolsImpl::saveProfile(QString name, QJsonObject mods, bool run, bool skipConflict, bool oldPatcher) {
void CSLOLToolsImpl::saveProfile(QString name, QJsonObject mods, bool run, bool skipConflict, bool debugPatcher) {
if (state_ == CSLOLState::StateIdle) {
setState(CSLOLState::StateBusy);

Expand Down Expand Up @@ -541,7 +541,7 @@ void CSLOLToolsImpl::saveProfile(QString name, QJsonObject mods, bool run, bool
prog_ + "/profiles/" + name,
prog_ + "/profiles/" + name + ".config",
"--game:" + game_,
"--opts:" + QString(oldPatcher ? "oldpatcher" : "none"),
"--opts:" + QString(debugPatcher ? "debugpatcher" : "none"),
});
} else {
setState(CSLOLState::StateIdle);
Expand Down
8 changes: 7 additions & 1 deletion src/qml/CSLOLDialogSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Dialog {
property alias enableSystray: enableSystrayCheck.checked
property alias enableAutoRun: enableAutoRunCheck.checked
property alias updateUrls: updateUrlsTextArea.text
property bool oldPatcher: false
property alias debugPatcher: debugPatcherCheck.checked

property var colors_LIST: [
"Red",
Expand Down Expand Up @@ -163,6 +163,12 @@ Dialog {
checked: false
Layout.fillWidth: true
}
Switch {
id: debugPatcherCheck
text: qsTr("Debug patcher")
checked: false
Layout.fillWidth: true
}
}
ColumnLayout {
id: settingsThemeTab
Expand Down
4 changes: 2 additions & 2 deletions src/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ApplicationWindow {
property alias themeDarkMode: cslolDialogSettings.themeDarkMode
property alias themePrimaryColor: cslolDialogSettings.themePrimaryColor
property alias themeAccentColor: cslolDialogSettings.themeAccentColor
property alias oldPatcher: cslolDialogSettings.oldPatcher
property alias debugPatcher: cslolDialogSettings.debugPatcher

property alias removeUnknownNames: cslolDialogEditMod.removeUnknownNames
property alias lastZipDirectory: cslolDialogOpenZipFantome.folder
Expand Down Expand Up @@ -98,7 +98,7 @@ ApplicationWindow {
let name = cslolToolBar.profilesCurrentName
let mods = cslolModsView.saveProfile()
if (checkGamePath()) {
cslolTools.saveProfile(name, mods, run, settings.suppressInstallConflicts, settings.oldPatcher)
cslolTools.saveProfile(name, mods, run, settings.suppressInstallConflicts, settings.debugPatcher)
}
}

Expand Down

0 comments on commit 48a63e1

Please sign in to comment.