From 7b01acdb81ca380d22df3fec9da7a6f1d13d77f2 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Sun, 20 Jul 2025 18:01:22 -0400 Subject: [PATCH 1/2] Make all single-argument constructors explicit --- src/common/binary_reader_writer.h | 12 ++++++------ src/common/dynamic_library.h | 2 +- src/common/file_system.h | 4 ++-- src/common/heap_array.h | 4 ++-- src/common/perf_scope.h | 2 +- src/core/analog_controller.h | 2 +- src/core/cheats.cpp | 6 +++--- src/core/controller.h | 2 +- src/core/ddgo_controller.h | 2 +- src/core/fullscreen_ui.h | 2 +- src/core/gpu_sw.h | 2 +- src/core/guncon.h | 2 +- src/core/jogcon.h | 2 +- src/core/negcon.h | 2 +- src/core/negcon_rumble.h | 4 ++-- src/core/playstation_mouse.h | 2 +- src/duckstation-qt/controllerbindingwidgets.h | 4 ++-- src/duckstation-qt/debuggermodels.h | 8 ++++---- src/duckstation-qt/gamelistrefreshthread.h | 7 +++---- src/duckstation-qt/gamelistwidget.cpp | 2 +- src/duckstation-qt/gamelistwidget.h | 2 +- src/duckstation-qt/inputbindingwidgets.h | 4 ++-- src/duckstation-qt/isobrowserwindow.h | 2 +- src/duckstation-qt/qthost.h | 4 ++-- src/duckstation-qt/qtprogresscallback.h | 4 ++-- src/duckstation-qt/selectdiscdialog.h | 2 +- src/updater/updater.h | 2 +- src/util/cd_image_cue.cpp | 2 +- src/util/gpu_device.h | 2 +- src/util/postprocessing.h | 2 +- src/util/postprocessing_shader.h | 4 ++-- 31 files changed, 51 insertions(+), 52 deletions(-) diff --git a/src/common/binary_reader_writer.h b/src/common/binary_reader_writer.h index ec83d92bf..b3ff2914b 100644 --- a/src/common/binary_reader_writer.h +++ b/src/common/binary_reader_writer.h @@ -16,7 +16,7 @@ class BinarySpanReader { public: BinarySpanReader(); - BinarySpanReader(std::span buf); + explicit BinarySpanReader(std::span buf); BinarySpanReader(const BinarySpanReader&) = delete; BinarySpanReader& operator=(const BinarySpanReader&) = delete; @@ -146,7 +146,7 @@ class BinarySpanWriter { public: BinarySpanWriter(); - BinarySpanWriter(std::span buf); + explicit BinarySpanWriter(std::span buf); BinarySpanWriter(const BinarySpanWriter&) = delete; BinarySpanWriter& operator=(const BinarySpanWriter&) = delete; @@ -217,8 +217,8 @@ class BinaryFileReader { public: BinaryFileReader(); - BinaryFileReader(std::FILE* fp); - + explicit BinaryFileReader(std::FILE* fp); + BinaryFileReader(const BinaryFileReader&) = delete; BinaryFileReader& operator=(const BinaryFileReader&) = delete; @@ -308,8 +308,8 @@ class BinaryFileWriter { public: BinaryFileWriter(); - BinaryFileWriter(std::FILE* fp); - + explicit BinaryFileWriter(std::FILE* fp); + BinaryFileWriter(const BinaryFileWriter&) = delete; BinaryFileWriter& operator=(const BinaryFileWriter&) = delete; diff --git a/src/common/dynamic_library.h b/src/common/dynamic_library.h index 4cc40adab..ecfc649b9 100644 --- a/src/common/dynamic_library.h +++ b/src/common/dynamic_library.h @@ -19,7 +19,7 @@ public: DynamicLibrary(); /// Automatically loads the specified library. Call IsOpen() to check validity before use. - DynamicLibrary(const char* filename); + explicit DynamicLibrary(const char* filename); /// Move constructor, transfers ownership. DynamicLibrary(DynamicLibrary&& move); diff --git a/src/common/file_system.h b/src/common/file_system.h index 5d3b5852d..5a7ea5f65 100644 --- a/src/common/file_system.h +++ b/src/common/file_system.h @@ -165,8 +165,8 @@ class POSIXLock { public: POSIXLock(); - POSIXLock(int fd, bool block = true, Error* error = nullptr); - POSIXLock(std::FILE* fp, bool block = true, Error* error = nullptr); + explicit POSIXLock(int fd, bool block = true, Error* error = nullptr); + explicit POSIXLock(std::FILE* fp, bool block = true, Error* error = nullptr); POSIXLock(POSIXLock&& move); POSIXLock(const POSIXLock&) = delete; ~POSIXLock(); diff --git a/src/common/heap_array.h b/src/common/heap_array.h index fa9935661..62dce35de 100644 --- a/src/common/heap_array.h +++ b/src/common/heap_array.h @@ -167,7 +167,7 @@ public: using this_type = DynamicHeapArray; DynamicHeapArray() : m_data(nullptr), m_size(0) {} - DynamicHeapArray(size_t size) { internal_resize(size, nullptr, 0); } + explicit DynamicHeapArray(size_t size) { internal_resize(size, nullptr, 0); } DynamicHeapArray(const T* begin, const T* end) { const size_t size = reinterpret_cast(end) - reinterpret_cast(begin); @@ -195,7 +195,7 @@ public: m_size = 0; } } - DynamicHeapArray(const std::span data) + explicit DynamicHeapArray(const std::span data) { if (!data.empty()) { diff --git a/src/common/perf_scope.h b/src/common/perf_scope.h index b85d54d83..1b1219c1f 100644 --- a/src/common/perf_scope.h +++ b/src/common/perf_scope.h @@ -8,7 +8,7 @@ class PerfScope { public: - constexpr PerfScope(const char* prefix) : m_prefix(prefix) {} + constexpr explicit PerfScope(const char* prefix) : m_prefix(prefix) {} bool HasPrefix() const { return (m_prefix && m_prefix[0]); } void Register(const void* ptr, size_t size, const char* symbol); diff --git a/src/core/analog_controller.h b/src/core/analog_controller.h index 60f003537..aa3b2d80b 100644 --- a/src/core/analog_controller.h +++ b/src/core/analog_controller.h @@ -60,7 +60,7 @@ public: static const Controller::ControllerInfo INFO; - AnalogController(u32 index); + explicit AnalogController(u32 index); ~AnalogController() override; static std::unique_ptr Create(u32 index); diff --git a/src/core/cheats.cpp b/src/core/cheats.cpp index 4fbc93aad..3758190c6 100644 --- a/src/core/cheats.cpp +++ b/src/core/cheats.cpp @@ -32,7 +32,7 @@ namespace { class CheatFileReader { public: - CheatFileReader(const std::string_view contents) : m_contents(contents) {} + explicit CheatFileReader(const std::string_view contents) : m_contents(contents) {} ALWAYS_INLINE size_t GetCurrentOffset() const { return m_current_offset; } ALWAYS_INLINE size_t GetCurrentLineOffset() const { return m_current_line_offset; } @@ -178,7 +178,7 @@ public: }; public: - CheatCode(Metadata metadata); + explicit CheatCode(Metadata metadata); virtual ~CheatCode(); ALWAYS_INLINE const Metadata& GetMetadata() const { return m_metadata; } @@ -2034,7 +2034,7 @@ namespace { class GamesharkCheatCode final : public CheatCode { public: - GamesharkCheatCode(Metadata metadata); + explicit GamesharkCheatCode(Metadata metadata); ~GamesharkCheatCode() override; static std::unique_ptr Parse(Metadata metadata, const std::string_view data, Error* error); diff --git a/src/core/controller.h b/src/core/controller.h index 64c88df36..d101ead2e 100644 --- a/src/core/controller.h +++ b/src/core/controller.h @@ -53,7 +53,7 @@ public: static constexpr float DEFAULT_STICK_SENSITIVITY = 1.33f; static constexpr float DEFAULT_BUTTON_DEADZONE = 0.25f; - Controller(u32 index); + explicit Controller(u32 index); virtual ~Controller(); /// Returns the type of controller. diff --git a/src/core/ddgo_controller.h b/src/core/ddgo_controller.h index a2e327e71..53f5812ee 100644 --- a/src/core/ddgo_controller.h +++ b/src/core/ddgo_controller.h @@ -57,7 +57,7 @@ public: static const Controller::ControllerInfo INFO; - DDGoController(u32 index); + explicit DDGoController(u32 index); ~DDGoController() override; static std::unique_ptr Create(u32 index); diff --git a/src/core/fullscreen_ui.h b/src/core/fullscreen_ui.h index 7a7b14ce3..7769aa638 100644 --- a/src/core/fullscreen_ui.h +++ b/src/core/fullscreen_ui.h @@ -84,7 +84,7 @@ void SetStandardSelectionFooterText(bool back_instead_of_cancel); class BackgroundProgressCallback final : public ProgressCallback { public: - BackgroundProgressCallback(std::string name); + explicit BackgroundProgressCallback(std::string name); ~BackgroundProgressCallback() override; void SetStatusText(const std::string_view text) override; diff --git a/src/core/gpu_sw.h b/src/core/gpu_sw.h index dd68e55bc..ef8c718f4 100644 --- a/src/core/gpu_sw.h +++ b/src/core/gpu_sw.h @@ -17,7 +17,7 @@ class GPU_SW final : public GPUBackend { public: - GPU_SW(GPUPresenter& presenter); + explicit GPU_SW(GPUPresenter& presenter); ~GPU_SW() override; bool Initialize(bool upload_vram, Error* error) override; diff --git a/src/core/guncon.h b/src/core/guncon.h index 1e3ec0b36..9b3c6ba35 100644 --- a/src/core/guncon.h +++ b/src/core/guncon.h @@ -27,7 +27,7 @@ public: static const Controller::ControllerInfo INFO; - GunCon(u32 index); + explicit GunCon(u32 index); ~GunCon() override; static std::unique_ptr Create(u32 index); diff --git a/src/core/jogcon.h b/src/core/jogcon.h index 0af8bf9b5..6187cc82d 100644 --- a/src/core/jogcon.h +++ b/src/core/jogcon.h @@ -43,7 +43,7 @@ public: static const Controller::ControllerInfo INFO; - JogCon(u32 index); + explicit JogCon(u32 index); ~JogCon() override; static std::unique_ptr Create(u32 index); diff --git a/src/core/negcon.h b/src/core/negcon.h index a2393ce8d..286aa12c4 100644 --- a/src/core/negcon.h +++ b/src/core/negcon.h @@ -81,7 +81,7 @@ public: static const Controller::ControllerInfo INFO; - NeGcon(u32 index); + explicit NeGcon(u32 index); ~NeGcon() override; static std::unique_ptr Create(u32 index); diff --git a/src/core/negcon_rumble.h b/src/core/negcon_rumble.h index d823aec8c..e3105150e 100644 --- a/src/core/negcon_rumble.h +++ b/src/core/negcon_rumble.h @@ -49,7 +49,7 @@ public: static const Controller::ControllerInfo INFO; - NeGconRumble(u32 index); + explicit NeGconRumble(u32 index); ~NeGconRumble() override; static std::unique_ptr Create(u32 index); @@ -148,4 +148,4 @@ private: float m_steering_deadzone = 0.00f; float m_steering_sensitivity = 1.00f; -}; \ No newline at end of file +}; diff --git a/src/core/playstation_mouse.h b/src/core/playstation_mouse.h index 3a412cef6..d6f156ae2 100644 --- a/src/core/playstation_mouse.h +++ b/src/core/playstation_mouse.h @@ -23,7 +23,7 @@ public: static const Controller::ControllerInfo INFO; - PlayStationMouse(u32 index); + explicit PlayStationMouse(u32 index); ~PlayStationMouse() override; static std::unique_ptr Create(u32 index); diff --git a/src/duckstation-qt/controllerbindingwidgets.h b/src/duckstation-qt/controllerbindingwidgets.h index 4a4787d34..d8d8226df 100644 --- a/src/duckstation-qt/controllerbindingwidgets.h +++ b/src/duckstation-qt/controllerbindingwidgets.h @@ -78,7 +78,7 @@ class ControllerMacroWidget : public QWidget Q_OBJECT public: - ControllerMacroWidget(ControllerBindingWidget* parent); + explicit ControllerMacroWidget(ControllerBindingWidget* parent); ~ControllerMacroWidget(); void updateListItem(u32 index); @@ -133,7 +133,7 @@ class ControllerCustomSettingsWidget : public QWidget Q_OBJECT public: - ControllerCustomSettingsWidget(ControllerBindingWidget* parent); + explicit ControllerCustomSettingsWidget(ControllerBindingWidget* parent); ~ControllerCustomSettingsWidget(); void createSettingWidgets(ControllerBindingWidget* parent, QWidget* parent_widget, QGridLayout* layout, diff --git a/src/duckstation-qt/debuggermodels.h b/src/duckstation-qt/debuggermodels.h index 244df41b8..327a7d52a 100644 --- a/src/duckstation-qt/debuggermodels.h +++ b/src/duckstation-qt/debuggermodels.h @@ -20,7 +20,7 @@ class DebuggerCodeModel final : public QAbstractTableModel Q_OBJECT public: - DebuggerCodeModel(QObject* parent = nullptr); + explicit DebuggerCodeModel(QObject* parent = nullptr); ~DebuggerCodeModel() override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; @@ -61,7 +61,7 @@ class DebuggerRegistersModel final : public QAbstractListModel Q_OBJECT public: - DebuggerRegistersModel(QObject* parent = nullptr); + explicit DebuggerRegistersModel(QObject* parent = nullptr); ~DebuggerRegistersModel() override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; @@ -82,7 +82,7 @@ class DebuggerStackModel final : public QAbstractListModel Q_OBJECT public: - DebuggerStackModel(QObject* parent = nullptr); + explicit DebuggerStackModel(QObject* parent = nullptr); ~DebuggerStackModel() override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; @@ -98,7 +98,7 @@ class DebuggerAddBreakpointDialog final : public QDialog Q_OBJECT public: - DebuggerAddBreakpointDialog(QWidget* parent = nullptr); + explicit DebuggerAddBreakpointDialog(QWidget* parent = nullptr); ~DebuggerAddBreakpointDialog() override; u32 getAddress() const { return m_address; } diff --git a/src/duckstation-qt/gamelistrefreshthread.h b/src/duckstation-qt/gamelistrefreshthread.h index 9c148ad67..47b16b3cc 100644 --- a/src/duckstation-qt/gamelistrefreshthread.h +++ b/src/duckstation-qt/gamelistrefreshthread.h @@ -3,7 +3,6 @@ #pragma once -#include #include #include "common/progress_callback.h" @@ -14,7 +13,7 @@ class GameListRefreshThread; class AsyncRefreshProgressCallback : public ProgressCallback { public: - AsyncRefreshProgressCallback(GameListRefreshThread* parent); + explicit AsyncRefreshProgressCallback(GameListRefreshThread* parent); float timeSinceStart() const; @@ -46,7 +45,7 @@ class GameListRefreshThread final : public QThread Q_OBJECT public: - GameListRefreshThread(bool invalidate_cache); + explicit GameListRefreshThread(bool invalidate_cache); ~GameListRefreshThread(); float timeSinceStart() const; @@ -58,7 +57,7 @@ Q_SIGNALS: void refreshComplete(); protected: - void run(); + void run() final; private: AsyncRefreshProgressCallback m_progress; diff --git a/src/duckstation-qt/gamelistwidget.cpp b/src/duckstation-qt/gamelistwidget.cpp index 3972cbfd2..c147cfd37 100644 --- a/src/duckstation-qt/gamelistwidget.cpp +++ b/src/duckstation-qt/gamelistwidget.cpp @@ -1037,7 +1037,7 @@ namespace { class GameListCenterIconStyleDelegate final : public QStyledItemDelegate { public: - GameListCenterIconStyleDelegate(QWidget* parent) : QStyledItemDelegate(parent) {} + explicit GameListCenterIconStyleDelegate(QWidget* parent) : QStyledItemDelegate(parent) {} ~GameListCenterIconStyleDelegate() = default; void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override diff --git a/src/duckstation-qt/gamelistwidget.h b/src/duckstation-qt/gamelistwidget.h index 14adf7e7d..4e69982d3 100644 --- a/src/duckstation-qt/gamelistwidget.h +++ b/src/duckstation-qt/gamelistwidget.h @@ -210,7 +210,7 @@ class GameListWidget final : public QWidget Q_OBJECT public: - GameListWidget(QWidget* parent = nullptr); + explicit GameListWidget(QWidget* parent = nullptr); ~GameListWidget(); ALWAYS_INLINE GameListModel* getModel() const { return m_model; } diff --git a/src/duckstation-qt/inputbindingwidgets.h b/src/duckstation-qt/inputbindingwidgets.h index 8339de5e4..32193505b 100644 --- a/src/duckstation-qt/inputbindingwidgets.h +++ b/src/duckstation-qt/inputbindingwidgets.h @@ -17,7 +17,7 @@ class InputBindingWidget : public QPushButton Q_OBJECT public: - InputBindingWidget(QWidget* parent); + explicit InputBindingWidget(QWidget* parent); InputBindingWidget(QWidget* parent, SettingsInterface* sif, InputBindingInfo::Type bind_type, std::string section_name, std::string key_name); ~InputBindingWidget(); @@ -76,7 +76,7 @@ class InputVibrationBindingWidget : public QPushButton Q_OBJECT public: - InputVibrationBindingWidget(QWidget* parent); + explicit InputVibrationBindingWidget(QWidget* parent); InputVibrationBindingWidget(QWidget* parent, ControllerSettingsWindow* dialog, std::string section_name, std::string key_name); ~InputVibrationBindingWidget(); diff --git a/src/duckstation-qt/isobrowserwindow.h b/src/duckstation-qt/isobrowserwindow.h index b1dabab08..6fdc815d3 100644 --- a/src/duckstation-qt/isobrowserwindow.h +++ b/src/duckstation-qt/isobrowserwindow.h @@ -12,7 +12,7 @@ class ISOBrowserWindow : public QWidget Q_OBJECT public: - ISOBrowserWindow(QWidget* parent = nullptr); + explicit ISOBrowserWindow(QWidget* parent = nullptr); ~ISOBrowserWindow(); static ISOBrowserWindow* createAndOpenFile(QWidget* parent, const QString& path); diff --git a/src/duckstation-qt/qthost.h b/src/duckstation-qt/qthost.h index 93ca7a653..fe8643dcd 100644 --- a/src/duckstation-qt/qthost.h +++ b/src/duckstation-qt/qthost.h @@ -281,7 +281,7 @@ public: using DeviceList = QList; - InputDeviceListModel(QObject* parent = nullptr); + explicit InputDeviceListModel(QObject* parent = nullptr); ~InputDeviceListModel() override; // Safe to access on UI thread. @@ -325,7 +325,7 @@ Q_SIGNALS: void completed(QtAsyncTask* self); private: - QtAsyncTask(WorkCallback callback); + explicit QtAsyncTask(WorkCallback callback); std::variant m_callback; }; diff --git a/src/duckstation-qt/qtprogresscallback.h b/src/duckstation-qt/qtprogresscallback.h index dda0f1a7f..cd417bcd0 100644 --- a/src/duckstation-qt/qtprogresscallback.h +++ b/src/duckstation-qt/qtprogresscallback.h @@ -16,7 +16,7 @@ class QtModalProgressCallback final : public QObject, public ProgressCallback Q_OBJECT public: - QtModalProgressCallback(QWidget* parent_widget, float show_delay = 0.0f); + explicit QtModalProgressCallback(QWidget* parent_widget, float show_delay = 0.0f); ~QtModalProgressCallback(); QProgressDialog& GetDialog() { return m_dialog; } @@ -53,7 +53,7 @@ class QtAsyncProgressThread : public QThread, public ProgressCallback Q_OBJECT public: - QtAsyncProgressThread(QWidget* parent); + explicit QtAsyncProgressThread(QWidget* parent); ~QtAsyncProgressThread(); bool IsCancelled() const override; diff --git a/src/duckstation-qt/selectdiscdialog.h b/src/duckstation-qt/selectdiscdialog.h index 0d3d4a949..9bb2095f9 100644 --- a/src/duckstation-qt/selectdiscdialog.h +++ b/src/duckstation-qt/selectdiscdialog.h @@ -14,7 +14,7 @@ class SelectDiscDialog final : public QDialog Q_OBJECT public: - SelectDiscDialog(const std::string& disc_set_name, QWidget* parent = nullptr); + explicit SelectDiscDialog(const std::string& disc_set_name, QWidget* parent = nullptr); ~SelectDiscDialog(); ALWAYS_INLINE const std::string& getSelectedDiscPath() { return m_selected_path; } diff --git a/src/updater/updater.h b/src/updater/updater.h index e88e28d06..dbd7f472f 100644 --- a/src/updater/updater.h +++ b/src/updater/updater.h @@ -10,7 +10,7 @@ class Updater { public: - Updater(ProgressCallback* progress); + explicit Updater(ProgressCallback* progress); ~Updater(); bool Initialize(std::string staging_directory, std::string destination_directory); diff --git a/src/util/cd_image_cue.cpp b/src/util/cd_image_cue.cpp index 08cbe7715..4e5a90c20 100644 --- a/src/util/cd_image_cue.cpp +++ b/src/util/cd_image_cue.cpp @@ -28,7 +28,7 @@ namespace { class TrackFileInterface { public: - TrackFileInterface(std::string filename); + explicit TrackFileInterface(std::string filename); virtual ~TrackFileInterface(); ALWAYS_INLINE const std::string& GetFileName() const { return m_filename; } diff --git a/src/util/gpu_device.h b/src/util/gpu_device.h index 05f0e6ee6..3af70d20f 100644 --- a/src/util/gpu_device.h +++ b/src/util/gpu_device.h @@ -172,7 +172,7 @@ IMPLEMENT_ENUM_CLASS_BITWISE_OPERATORS(GPUDriverType); class GPUShader { public: - GPUShader(GPUShaderStage stage); + explicit GPUShader(GPUShaderStage stage); virtual ~GPUShader(); static const char* GetStageName(GPUShaderStage stage); diff --git a/src/util/postprocessing.h b/src/util/postprocessing.h index cc20c91a6..05e4696fc 100644 --- a/src/util/postprocessing.h +++ b/src/util/postprocessing.h @@ -114,7 +114,7 @@ void ClearStages(SettingsInterface& si, const char* section); class Chain final { public: - Chain(const char* section); + explicit Chain(const char* section); ~Chain(); ALWAYS_INLINE bool HasStages() const { return !m_stages.empty(); } diff --git a/src/util/postprocessing_shader.h b/src/util/postprocessing_shader.h index e3d1be91d..203dcfb5c 100644 --- a/src/util/postprocessing_shader.h +++ b/src/util/postprocessing_shader.h @@ -27,7 +27,7 @@ class Shader { public: Shader(); - Shader(std::string name); + explicit Shader(std::string name); virtual ~Shader(); ALWAYS_INLINE const std::string& GetName() const { return m_name; } @@ -64,4 +64,4 @@ protected: OptionList m_options; }; -} // namespace PostProcessing \ No newline at end of file +} // namespace PostProcessing From e3904df8512d9adc7ddd676490a049843e91ba63 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Sun, 20 Jul 2025 20:00:18 -0400 Subject: [PATCH 2/2] Declare all namespace-scope constants as inline This is the idiomatic way since C++17 --- src/common/easing.h | 2 +- src/common/intrin.h | 2 +- src/common/string_util.h | 2 +- src/common/thirdparty/aes.h | 6 +-- src/common/types.h | 28 ++++++------- src/core/achievements.h | 2 +- src/core/bios.h | 4 +- src/core/bus.h | 2 +- src/core/cpu_core.h | 2 +- src/core/fullscreen_ui.h | 6 +-- src/core/gpu_dump.h | 2 +- src/core/gpu_hw_texture_cache.h | 4 +- src/core/gpu_sw_rasterizer.h | 2 +- src/core/gpu_types.h | 2 +- src/core/imgui_overlays.h | 4 +- src/core/interrupt_controller.h | 2 +- src/core/performance_counters.h | 2 +- src/core/save_state_version.h | 8 ++-- src/core/shader_cache_version.h | 2 +- src/duckstation-mini/sdl_key_names.h | 7 ++-- src/duckstation-qt/settingwidgetbinder.h | 6 +-- src/util/imgui_fullscreen.h | 50 ++++++++++++------------ src/util/imgui_manager.h | 14 +++---- src/util/input_manager.h | 14 +++---- src/util/postprocessing.h | 4 +- 25 files changed, 89 insertions(+), 90 deletions(-) diff --git a/src/common/easing.h b/src/common/easing.h index 204b31a7d..051fed469 100644 --- a/src/common/easing.h +++ b/src/common/easing.h @@ -8,7 +8,7 @@ // From https://github.com/nicolausYes/easing-functions/blob/master/src/easing.cpp namespace Easing { -static constexpr float pi = 3.1415926545f; +inline constexpr float pi = 3.1415926545f; template ALWAYS_INLINE_RELEASE static T InSine(T t) diff --git a/src/common/intrin.h b/src/common/intrin.h index d4ef62a7c..25c013226 100644 --- a/src/common/intrin.h +++ b/src/common/intrin.h @@ -56,7 +56,7 @@ #endif /// Only currently using 128-bit vectors at max. -static constexpr u32 VECTOR_ALIGNMENT = 16; +inline constexpr u32 VECTOR_ALIGNMENT = 16; /// Aligns allocation/pitch size to preferred host size. template diff --git a/src/common/string_util.h b/src/common/string_util.h index 66322eb1d..d27e5fde7 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -444,7 +444,7 @@ ALWAYS_INLINE std::optional GetNextToken(std::string_view& car } /// Unicode replacement character. -static constexpr char32_t UNICODE_REPLACEMENT_CHARACTER = 0xFFFD; +inline constexpr char32_t UNICODE_REPLACEMENT_CHARACTER = 0xFFFD; /// Appends a UTF-16/UTF-32 codepoint to a UTF-8 string. void EncodeAndAppendUTF8(std::string& s, char32_t ch); diff --git a/src/common/thirdparty/aes.h b/src/common/thirdparty/aes.h index ab24e0aee..ccf92dc7e 100644 --- a/src/common/thirdparty/aes.h +++ b/src/common/thirdparty/aes.h @@ -13,8 +13,8 @@ #include /****************************** MACROS ******************************/ -static constexpr uint32_t AES_BLOCK_SIZE = 16; // AES operates on 16 bytes at a time -static constexpr uint32_t AES_KEY_SCHEDULE_SIZE = 60; +inline constexpr uint32_t AES_BLOCK_SIZE = 16; // AES operates on 16 bytes at a time +inline constexpr uint32_t AES_KEY_SCHEDULE_SIZE = 60; /*********************** FUNCTION DECLARATIONS **********************/ /////////////////// @@ -119,4 +119,4 @@ bool aes_decrypt_ccm( // authentication. const uint8_t key[], // IN - The AES key for decryption. int keysize); // IN - The length of the key in BITS. Valid values are 128, 192, 256. -#endif \ No newline at end of file +#endif diff --git a/src/common/types.h b/src/common/types.h index 7f40d2f28..b0d88349c 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -212,29 +212,29 @@ extern const u32 HOST_PAGE_MASK; extern const u32 HOST_PAGE_SHIFT; #else #if defined(OVERRIDE_HOST_PAGE_SIZE) -static constexpr u32 HOST_PAGE_SIZE = OVERRIDE_HOST_PAGE_SIZE; -static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1; -static constexpr u32 HOST_PAGE_SHIFT = std::bit_width(HOST_PAGE_MASK); +inline constexpr u32 HOST_PAGE_SIZE = OVERRIDE_HOST_PAGE_SIZE; +inline constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1; +inline constexpr u32 HOST_PAGE_SHIFT = std::bit_width(HOST_PAGE_MASK); #elif defined(__APPLE__) && defined(__aarch64__) -static constexpr u32 HOST_PAGE_SIZE = 0x4000; -static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1; -static constexpr u32 HOST_PAGE_SHIFT = 14; +inline constexpr u32 HOST_PAGE_SIZE = 0x4000; +inline constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1; +inline constexpr u32 HOST_PAGE_SHIFT = 14; #else -static constexpr u32 HOST_PAGE_SIZE = 0x1000; -static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1; -static constexpr u32 HOST_PAGE_SHIFT = 12; +inline constexpr u32 HOST_PAGE_SIZE = 0x1000; +inline constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1; +inline constexpr u32 HOST_PAGE_SHIFT = 12; #endif -static constexpr u32 MIN_HOST_PAGE_SIZE = HOST_PAGE_SIZE; -static constexpr u32 MAX_HOST_PAGE_SIZE = HOST_PAGE_SIZE; +inline constexpr u32 MIN_HOST_PAGE_SIZE = HOST_PAGE_SIZE; +inline constexpr u32 MAX_HOST_PAGE_SIZE = HOST_PAGE_SIZE; #endif // Host cache line sizes. #if defined(OVERRIDE_HOST_CACHE_LINE_SIZE) -static constexpr u32 HOST_CACHE_LINE_SIZE = OVERRIDE_HOST_CACHE_LINE_SIZE; +inline constexpr u32 HOST_CACHE_LINE_SIZE = OVERRIDE_HOST_CACHE_LINE_SIZE; #elif defined(__APPLE__) && defined(__aarch64__) -static constexpr u32 HOST_CACHE_LINE_SIZE = 128; // Apple Silicon uses 128b cache lines. +inline constexpr u32 HOST_CACHE_LINE_SIZE = 128; // Apple Silicon uses 128b cache lines. #else -static constexpr u32 HOST_CACHE_LINE_SIZE = 64; // Everything else is 64b. +inline constexpr u32 HOST_CACHE_LINE_SIZE = 64; // Everything else is 64b. #endif #define ALIGN_TO_CACHE_LINE alignas(HOST_CACHE_LINE_SIZE) diff --git a/src/core/achievements.h b/src/core/achievements.h index d6102736e..eb91e9931 100644 --- a/src/core/achievements.h +++ b/src/core/achievements.h @@ -29,7 +29,7 @@ enum class LoginRequestReason TokenInvalid, }; -static constexpr size_t GAME_HASH_LENGTH = 16; +inline constexpr size_t GAME_HASH_LENGTH = 16; using GameHash = std::array; struct HashDatabaseEntry diff --git a/src/core/bios.h b/src/core/bios.h index adea58aa5..1fa2a009f 100644 --- a/src/core/bios.h +++ b/src/core/bios.h @@ -80,7 +80,7 @@ static_assert(sizeof(PSEXEHeader) == 0x800); #pragma pack(pop) // .cpe files -static constexpr u32 CPE_MAGIC = 0x01455043; +inline constexpr u32 CPE_MAGIC = 0x01455043; std::optional LoadImageFromFile(const char* filename, Error* error); @@ -105,4 +105,4 @@ std::vector> FindBIOSImagesInDire /// Returns true if any BIOS images are found in the configured BIOS directory. bool HasAnyBIOSImages(); -} // namespace BIOS \ No newline at end of file +} // namespace BIOS diff --git a/src/core/bus.h b/src/core/bus.h index 917849bbc..b3386e9de 100644 --- a/src/core/bus.h +++ b/src/core/bus.h @@ -109,7 +109,7 @@ enum : u32 #ifdef ENABLE_MMAP_FASTMEM // Fastmem region size is 4GB to cover the entire 32-bit address space. -static constexpr size_t FASTMEM_ARENA_SIZE = UINT64_C(0x100000000); +inline constexpr size_t FASTMEM_ARENA_SIZE = UINT64_C(0x100000000); #endif bool AllocateMemory(bool export_shared_memory, Error* error); diff --git a/src/core/cpu_core.h b/src/core/cpu_core.h index 8078c6b93..a4565878d 100644 --- a/src/core/cpu_core.h +++ b/src/core/cpu_core.h @@ -253,7 +253,7 @@ struct DebuggerRegisterListEntry u32* value_ptr; }; -static constexpr u32 NUM_DEBUGGER_REGISTER_LIST_ENTRIES = 103; +inline constexpr u32 NUM_DEBUGGER_REGISTER_LIST_ENTRIES = 103; extern const std::array g_debugger_register_list; } // namespace CPU diff --git a/src/core/fullscreen_ui.h b/src/core/fullscreen_ui.h index 7769aa638..18574a9a2 100644 --- a/src/core/fullscreen_ui.h +++ b/src/core/fullscreen_ui.h @@ -48,9 +48,9 @@ void SetTheme(); void UpdateRunIdleState(); void UpdateTransitionState(); -static constexpr float SHORT_TRANSITION_TIME = 0.08f; -static constexpr float DEFAULT_TRANSITION_TIME = 0.15f; -static constexpr float LONG_TRANSITION_TIME = 0.3f; +inline constexpr float SHORT_TRANSITION_TIME = 0.08f; +inline constexpr float DEFAULT_TRANSITION_TIME = 0.15f; +inline constexpr float LONG_TRANSITION_TIME = 0.3f; enum class TransitionState : u8 { diff --git a/src/core/gpu_dump.h b/src/core/gpu_dump.h index dfb26b5a1..c2a0a8359 100644 --- a/src/core/gpu_dump.h +++ b/src/core/gpu_dump.h @@ -37,7 +37,7 @@ enum class PacketType : u8 Comment = 0x12, }; -static constexpr u32 MAX_PACKET_LENGTH = ((1u << 24) - 1); // 3 bytes for packet size +inline constexpr u32 MAX_PACKET_LENGTH = ((1u << 24) - 1); // 3 bytes for packet size union PacketHeader { diff --git a/src/core/gpu_hw_texture_cache.h b/src/core/gpu_hw_texture_cache.h index 23d11fb22..bc84782a5 100644 --- a/src/core/gpu_hw_texture_cache.h +++ b/src/core/gpu_hw_texture_cache.h @@ -19,9 +19,9 @@ class GPU_HW; namespace GPUTextureCache { /// 4 pages in C16 mode, 2+4 pages in P8 mode, 1+1 pages in P4 mode. -static constexpr u32 MAX_PAGE_REFS_PER_SOURCE = 6; +inline constexpr u32 MAX_PAGE_REFS_PER_SOURCE = 6; -static constexpr u32 MAX_PAGE_REFS_PER_WRITE = 32; +inline constexpr u32 MAX_PAGE_REFS_PER_WRITE = 32; enum class PaletteRecordFlags : u32 { diff --git a/src/core/gpu_sw_rasterizer.h b/src/core/gpu_sw_rasterizer.h index 4e46dcc25..d4cc5c95d 100644 --- a/src/core/gpu_sw_rasterizer.h +++ b/src/core/gpu_sw_rasterizer.h @@ -15,7 +15,7 @@ namespace GPU_SW_Rasterizer { // this is actually (31 * 255) >> 4) == 494, but to simplify addressing we use the next power of two (512) -static constexpr u32 DITHER_LUT_SIZE = 512; +inline constexpr u32 DITHER_LUT_SIZE = 512; using DitherLUT = std::array, DITHER_MATRIX_SIZE>, DITHER_MATRIX_SIZE>; extern const DitherLUT g_dither_lut; diff --git a/src/core/gpu_types.h b/src/core/gpu_types.h index e0982b990..5a8d211dd 100644 --- a/src/core/gpu_types.h +++ b/src/core/gpu_types.h @@ -550,7 +550,7 @@ ALWAYS_INLINE static constexpr GSVector4i GetPaletteRect(GPUTexturePaletteReg pa } // 4x4 dither matrix. -static constexpr s32 DITHER_MATRIX[DITHER_MATRIX_SIZE][DITHER_MATRIX_SIZE] = {{-4, +0, -3, +1}, // row 0 +inline constexpr s32 DITHER_MATRIX[DITHER_MATRIX_SIZE][DITHER_MATRIX_SIZE] = {{-4, +0, -3, +1}, // row 0 {+2, -2, +3, -1}, // row 1 {-3, +1, -4, +0}, // row 2 {+3, -1, +2, -2}}; // row 3 diff --git a/src/core/imgui_overlays.h b/src/core/imgui_overlays.h index 13aa45c11..030f8690d 100644 --- a/src/core/imgui_overlays.h +++ b/src/core/imgui_overlays.h @@ -13,7 +13,7 @@ class GPUBackend; namespace ImGuiManager { -static constexpr const char* LOGO_IMAGE_NAME = "images/duck.png"; +inline constexpr const char* LOGO_IMAGE_NAME = "images/duck.png"; void UpdateInputOverlay(); void RenderTextOverlays(const GPUBackend* gpu); @@ -30,7 +30,7 @@ void DestroyOverlayTextures(); namespace SaveStateSelectorUI { -static constexpr float DEFAULT_OPEN_TIME = 7.5f; +inline constexpr float DEFAULT_OPEN_TIME = 7.5f; bool IsOpen(); void Open(float open_time = DEFAULT_OPEN_TIME); diff --git a/src/core/interrupt_controller.h b/src/core/interrupt_controller.h index 8851c5b7f..2a7f58590 100644 --- a/src/core/interrupt_controller.h +++ b/src/core/interrupt_controller.h @@ -8,7 +8,7 @@ class StateWrapper; namespace InterruptController { -static constexpr u32 NUM_IRQS = 11; +inline constexpr u32 NUM_IRQS = 11; enum class IRQ : u32 { diff --git a/src/core/performance_counters.h b/src/core/performance_counters.h index fbdfc86cc..f122db0c2 100644 --- a/src/core/performance_counters.h +++ b/src/core/performance_counters.h @@ -9,7 +9,7 @@ class GPUBackend; namespace PerformanceCounters { -static constexpr u32 NUM_FRAME_TIME_SAMPLES = 150; +inline constexpr u32 NUM_FRAME_TIME_SAMPLES = 150; using FrameTimeHistory = std::array; float GetFPS(); diff --git a/src/core/save_state_version.h b/src/core/save_state_version.h index 36ed7393b..ab061aee3 100644 --- a/src/core/save_state_version.h +++ b/src/core/save_state_version.h @@ -5,9 +5,9 @@ #include "common/types.h" -static constexpr u32 SAVE_STATE_MAGIC = 0x43435544; -static constexpr u32 SAVE_STATE_VERSION = 82; -static constexpr u32 SAVE_STATE_MINIMUM_VERSION = 42; +inline constexpr u32 SAVE_STATE_MAGIC = 0x43435544; +inline constexpr u32 SAVE_STATE_VERSION = 82; +inline constexpr u32 SAVE_STATE_MINIMUM_VERSION = 42; static_assert(SAVE_STATE_VERSION >= SAVE_STATE_MINIMUM_VERSION); @@ -36,7 +36,7 @@ struct SAVE_STATE_HEADER u32 media_path_length; u32 offset_to_media_path; u32 media_subimage_index; - + // Screenshot compression added in version 69. // Uncompressed size not stored, it can be inferred from width/height. u32 screenshot_compression_type; diff --git a/src/core/shader_cache_version.h b/src/core/shader_cache_version.h index 2190c747f..e0f0a880e 100644 --- a/src/core/shader_cache_version.h +++ b/src/core/shader_cache_version.h @@ -5,4 +5,4 @@ #include "common/types.h" -static constexpr u32 SHADER_CACHE_VERSION = 33; +inline constexpr u32 SHADER_CACHE_VERSION = 33; diff --git a/src/duckstation-mini/sdl_key_names.h b/src/duckstation-mini/sdl_key_names.h index 7e7898708..a55dd2462 100644 --- a/src/duckstation-mini/sdl_key_names.h +++ b/src/duckstation-mini/sdl_key_names.h @@ -5,7 +5,6 @@ #include "common/types.h" -#include #include #include #include @@ -15,7 +14,7 @@ namespace SDLKeyNames { -static const std::map s_sdl_key_names = { +inline const std::map s_sdl_key_names = { {SDLK_RETURN, "Return"}, {SDLK_ESCAPE, "Escape"}, {SDLK_BACKSPACE, "Backspace"}, @@ -246,13 +245,13 @@ static const std::map s_sdl_key_names = { {SDLK_SLEEP, "Sleep"}, }; -static const char* GetKeyName(u32 key) +inline const char* GetKeyName(u32 key) { const auto it = s_sdl_key_names.find(key); return it == s_sdl_key_names.end() ? nullptr : it->second; } -static std::optional GetKeyCodeForName(const std::string_view& key_name) +inline std::optional GetKeyCodeForName(const std::string_view key_name) { for (const auto& it : s_sdl_key_names) { diff --git a/src/duckstation-qt/settingwidgetbinder.h b/src/duckstation-qt/settingwidgetbinder.h index 911f6a900..3fd118fa0 100644 --- a/src/duckstation-qt/settingwidgetbinder.h +++ b/src/duckstation-qt/settingwidgetbinder.h @@ -35,9 +35,9 @@ #include namespace SettingWidgetBinder { -static constexpr const char* NULLABLE_PROPERTY = "SettingWidgetBinder_isNullable"; -static constexpr const char* IS_NULL_PROPERTY = "SettingWidgetBinder_isNull"; -static constexpr const char* GLOBAL_VALUE_PROPERTY = "SettingWidgetBinder_globalValue"; +inline constexpr const char* NULLABLE_PROPERTY = "SettingWidgetBinder_isNullable"; +inline constexpr const char* IS_NULL_PROPERTY = "SettingWidgetBinder_isNull"; +inline constexpr const char* GLOBAL_VALUE_PROPERTY = "SettingWidgetBinder_globalValue"; template struct SettingAccessor diff --git a/src/util/imgui_fullscreen.h b/src/util/imgui_fullscreen.h index b7b584140..11ca33d4c 100644 --- a/src/util/imgui_fullscreen.h +++ b/src/util/imgui_fullscreen.h @@ -36,31 +36,31 @@ namespace ImGuiFullscreen { // end_ptr() for string_view #define IMSTR_START_END(sv) (sv).data(), (sv).data() + (sv).length() -static constexpr float LAYOUT_SCREEN_WIDTH = 1280.0f; -static constexpr float LAYOUT_SCREEN_HEIGHT = 720.0f; -static constexpr float LAYOUT_LARGE_FONT_SIZE = 26.0f; -static constexpr float LAYOUT_MEDIUM_FONT_SIZE = 16.0f; -static constexpr float LAYOUT_MEDIUM_LARGE_FONT_SIZE = 21.0f; -static constexpr float LAYOUT_SMALL_FONT_SIZE = 10.0f; -static constexpr float LAYOUT_MENU_BUTTON_X_PADDING = 15.0f; -static constexpr float LAYOUT_MENU_BUTTON_Y_PADDING = 10.0f; -static constexpr float LAYOUT_MENU_BUTTON_SPACING = 6.0f; -static constexpr float LAYOUT_MENU_WINDOW_X_PADDING = 12.0f; -static constexpr float LAYOUT_MENU_WINDOW_Y_PADDING = 12.0f; -static constexpr float LAYOUT_MENU_ITEM_TITLE_SUMMARY_SPACING = 6.0f; -static constexpr float LAYOUT_MENU_ITEM_EXTRA_HEIGHT = 2.0f; -static constexpr float LAYOUT_FOOTER_PADDING = 10.0f; -static constexpr float LAYOUT_FOOTER_HEIGHT = LAYOUT_MEDIUM_FONT_SIZE + LAYOUT_FOOTER_PADDING * 2.0f; -static constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f; -static constexpr float LAYOUT_HORIZONTAL_MENU_PADDING = 30.0f; -static constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH = 250.0f; -static constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_IMAGE_SIZE = 150.0f; -static constexpr float LAYOUT_SHADOW_OFFSET = 1.0f; -static constexpr float LAYOUT_SMALL_POPUP_PADDING = 20.0f; -static constexpr float LAYOUT_LARGE_POPUP_PADDING = 30.0f; -static constexpr float LAYOUT_LARGE_POPUP_ROUNDING = 40.0f; -static constexpr float LAYOUT_WIDGET_FRAME_ROUNDING = 20.0f; -static constexpr ImVec2 LAYOUT_CENTER_ALIGN_TEXT = ImVec2(0.5f, 0.0f); +inline constexpr float LAYOUT_SCREEN_WIDTH = 1280.0f; +inline constexpr float LAYOUT_SCREEN_HEIGHT = 720.0f; +inline constexpr float LAYOUT_LARGE_FONT_SIZE = 26.0f; +inline constexpr float LAYOUT_MEDIUM_FONT_SIZE = 16.0f; +inline constexpr float LAYOUT_MEDIUM_LARGE_FONT_SIZE = 21.0f; +inline constexpr float LAYOUT_SMALL_FONT_SIZE = 10.0f; +inline constexpr float LAYOUT_MENU_BUTTON_X_PADDING = 15.0f; +inline constexpr float LAYOUT_MENU_BUTTON_Y_PADDING = 10.0f; +inline constexpr float LAYOUT_MENU_BUTTON_SPACING = 6.0f; +inline constexpr float LAYOUT_MENU_WINDOW_X_PADDING = 12.0f; +inline constexpr float LAYOUT_MENU_WINDOW_Y_PADDING = 12.0f; +inline constexpr float LAYOUT_MENU_ITEM_TITLE_SUMMARY_SPACING = 6.0f; +inline constexpr float LAYOUT_MENU_ITEM_EXTRA_HEIGHT = 2.0f; +inline constexpr float LAYOUT_FOOTER_PADDING = 10.0f; +inline constexpr float LAYOUT_FOOTER_HEIGHT = LAYOUT_MEDIUM_FONT_SIZE + LAYOUT_FOOTER_PADDING * 2.0f; +inline constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f; +inline constexpr float LAYOUT_HORIZONTAL_MENU_PADDING = 30.0f; +inline constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH = 250.0f; +inline constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_IMAGE_SIZE = 150.0f; +inline constexpr float LAYOUT_SHADOW_OFFSET = 1.0f; +inline constexpr float LAYOUT_SMALL_POPUP_PADDING = 20.0f; +inline constexpr float LAYOUT_LARGE_POPUP_PADDING = 30.0f; +inline constexpr float LAYOUT_LARGE_POPUP_ROUNDING = 40.0f; +inline constexpr float LAYOUT_WIDGET_FRAME_ROUNDING = 20.0f; +inline constexpr ImVec2 LAYOUT_CENTER_ALIGN_TEXT = ImVec2(0.5f, 0.0f); struct ALIGN_TO_CACHE_LINE UIStyles { diff --git a/src/util/imgui_manager.h b/src/util/imgui_manager.h index d227ee487..fc88738e3 100644 --- a/src/util/imgui_manager.h +++ b/src/util/imgui_manager.h @@ -71,9 +71,9 @@ using TextFontOrder = std::array(TextFont::MaxCoun /// Default size for screen margins. #ifndef __ANDROID__ -static constexpr float DEFAULT_SCREEN_MARGIN = 10.0f; +inline constexpr float DEFAULT_SCREEN_MARGIN = 10.0f; #else -static constexpr float DEFAULT_SCREEN_MARGIN = 16.0f; +inline constexpr float DEFAULT_SCREEN_MARGIN = 16.0f; #endif /// Sets the order for text fonts. @@ -223,11 +223,11 @@ void ProcessAuxiliaryRenderWindowInputEvent(Host::AuxiliaryRenderWindowUserData namespace Host { /// Typical durations for OSD messages. -static constexpr float OSD_CRITICAL_ERROR_DURATION = 20.0f; -static constexpr float OSD_ERROR_DURATION = 15.0f; -static constexpr float OSD_WARNING_DURATION = 10.0f; -static constexpr float OSD_INFO_DURATION = 5.0f; -static constexpr float OSD_QUICK_DURATION = 2.5f; +inline constexpr float OSD_CRITICAL_ERROR_DURATION = 20.0f; +inline constexpr float OSD_ERROR_DURATION = 15.0f; +inline constexpr float OSD_WARNING_DURATION = 10.0f; +inline constexpr float OSD_INFO_DURATION = 5.0f; +inline constexpr float OSD_QUICK_DURATION = 2.5f; /// Adds OSD messages, duration is in seconds. void AddOSDMessage(std::string message, float duration = 2.0f); diff --git a/src/util/input_manager.h b/src/util/input_manager.h index 35a35aede..7154d9c7a 100644 --- a/src/util/input_manager.h +++ b/src/util/input_manager.h @@ -191,24 +191,24 @@ public: namespace InputManager { /// Maximum number of buttons that can be part of a chord. -static constexpr u32 MAX_KEYS_PER_BINDING = 4; +inline constexpr u32 MAX_KEYS_PER_BINDING = 4; /// Maximum number of output vibration motors per pad. -static constexpr u32 MAX_MOTORS_PER_PAD = 2; +inline constexpr u32 MAX_MOTORS_PER_PAD = 2; /// Minimum interval between vibration updates when the effect is continuous. -static constexpr double VIBRATION_UPDATE_INTERVAL_SECONDS = 0.5; // 500ms +inline constexpr double VIBRATION_UPDATE_INTERVAL_SECONDS = 0.5; // 500ms /// Maximum number of host mouse devices. -static constexpr u32 MAX_POINTER_DEVICES = 8; -static constexpr u32 MAX_POINTER_BUTTONS = 3; +inline constexpr u32 MAX_POINTER_DEVICES = 8; +inline constexpr u32 MAX_POINTER_BUTTONS = 3; /// Maximum number of software cursors. We allocate an extra two for controllers with /// positioning data from the controller instead of a mouse. -static constexpr u32 MAX_SOFTWARE_CURSORS = MAX_POINTER_DEVICES + 2; +inline constexpr u32 MAX_SOFTWARE_CURSORS = MAX_POINTER_DEVICES + 2; /// Number of macro buttons per controller. -static constexpr u32 NUM_MACRO_BUTTONS_PER_CONTROLLER = 4; +inline constexpr u32 NUM_MACRO_BUTTONS_PER_CONTROLLER = 4; /// Returns a pointer to the external input source class, if present. InputSource* GetInputSourceInterface(InputSourceType type); diff --git a/src/util/postprocessing.h b/src/util/postprocessing.h index 05e4696fc..917aaa741 100644 --- a/src/util/postprocessing.h +++ b/src/util/postprocessing.h @@ -93,8 +93,8 @@ struct ShaderOption }; namespace Config { -static constexpr const char* DISPLAY_CHAIN_SECTION = "PostProcessing"; -static constexpr const char* INTERNAL_CHAIN_SECTION = "InternalPostProcessing"; +inline constexpr const char* DISPLAY_CHAIN_SECTION = "PostProcessing"; +inline constexpr const char* INTERNAL_CHAIN_SECTION = "InternalPostProcessing"; bool IsEnabled(const SettingsInterface& si, const char* section); u32 GetStageCount(const SettingsInterface& si, const char* section);