Refactor Dusk settings out to common interface used by game and UI code

This commit is contained in:
Max Roncace
2026-04-02 23:58:38 -04:00
parent ffa958a75d
commit 3b895609d3
20 changed files with 215 additions and 130 deletions
+71
View File
@@ -0,0 +1,71 @@
#ifndef DUSK_CONFIG_H
#define DUSK_CONFIG_H
namespace dusk {
// Persistent user settings
struct UserSettings {
// Program settings
struct {
// Video
bool enableFullscreen;
} video;
struct {
// Audio
float masterVolume;
float mainMusicVolume;
float subMusicVolume;
float soundEffectsVolume;
float fanfareVolume;
} audio;
// Game settings
struct {
// QoL
bool enableQuickTransform;
// Preferences
bool enableMirrorMode;
bool invertCameraXAxis;
// Graphics
bool enableBloom;
bool useWaterProjectionOffset;
// Cheats
bool enableFastIronBoots;
// Technical
bool restoreWiiGlitches;
} game;
};
UserSettings& getSettings();
// Transient settings
struct CollisionViewSettings {
bool enableTerrainView;
bool enableWireframe;
bool enableAtView;
bool enableTgView;
bool enableCoView;
float terrainViewOpacity;
float colliderViewOpacity;
float drawRange;
};
struct TransientSettings {
CollisionViewSettings collisionView;
};
TransientSettings& getTransientSettings();
}
#endif // DUSK_CONFIG_H
+3 -4
View File
@@ -3,8 +3,7 @@
#include "JSystem/JUtility/JUTGamePad.h"
#include "SSystem/SComponent/c_API_controller_pad.h"
#include "dusk/imgui/ImGuiMenuEnhancements.hpp"
#include "dusk/settings.h"
// Controller Ports 1 - 4
enum { PAD_1, PAD_2, PAD_3, PAD_4 };
@@ -57,7 +56,7 @@ public:
static s16 getStickAngle3D(u32 pad) {
#if TARGET_PC
if (dusk::ImGuiMenuEnhancements::m_enhancements.mirrorMode) {
if (dusk::getSettings().game.enableMirrorMode) {
return -getCpadInfo(pad).mMainStickAngle;
} else {
return getCpadInfo(pad).mMainStickAngle;
@@ -69,7 +68,7 @@ public:
static f32 getSubStickX3D(u32 pad) {
#if TARGET_PC
if (dusk::ImGuiMenuEnhancements::m_enhancements.mirrorMode) {
if (dusk::getSettings().game.enableMirrorMode) {
return -getCpadInfo(pad).mCStickPosX;
} else {
return getCpadInfo(pad).mCStickPosX;