Skip to content

Commit

Permalink
opentrack: #define to force particular module, overriding .ini
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Dec 19, 2021
1 parent cc9ef30 commit b9a3909
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
18 changes: 15 additions & 3 deletions logic/state.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "state.hpp"

#include "opentrack/defs.hpp"
#include <iterator>

using dylib_ptr = Modules::dylib_ptr;
Expand Down Expand Up @@ -28,7 +28,13 @@ State::State(const QString& library_path) :

dylib_ptr State::current_tracker()
{
auto [ptr, idx] = module_by_name(m.tracker_dll, modules.trackers());
const QString& module =
#ifdef UI_FORCED_TRACKER
UI_FORCED_TRACKER;
#else
m.tracker_dll;
#endif
auto [ptr, idx] = module_by_name(module, modules.trackers());
return ptr;
}

Expand All @@ -40,6 +46,12 @@ dylib_ptr State::current_protocol()

dylib_ptr State::current_filter()
{
auto [ptr, idx] = module_by_name(m.filter_dll, modules.filters());
const QString& module =
#ifdef UI_FORCED_FILTER
UI_FORCED_FILTER;
#else
m.filter_dll;
#endif
auto [ptr, idx] = module_by_name(module, modules.filters());
return ptr;
}
13 changes: 13 additions & 0 deletions opentrack/defs.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

//#define UI_FORCED_TRACKER "pt"
//#define UI_FORCED_FILTER "accela"

//#define UI_NO_TRACKER_COMBOBOX
//#define UI_NO_FILTER_COMBOBOX

//#define UI_NO_TRACKER_SETTINGS_BUTTON
//#define UI_NO_FILTER_SETTINGS_BUTTON

//#define UI_NO_RAW_DATA
//#define UI_NO_GAME_DATA
2 changes: 1 addition & 1 deletion opentrack/main-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "compat/library-path.hpp"
#include "compat/math.hpp"
#include "compat/sysexits.hpp"
#include "opentrack/defs.hpp"

#include <algorithm>
#include <utility>

#include <QMessageBox>
Expand Down

0 comments on commit b9a3909

Please sign in to comment.