2018-10-07 03:38:44 +00:00
|
|
|
#pragma once
|
2018-01-10 06:16:18 +00:00
|
|
|
|
2019-09-04 21:22:05 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
|
2022-02-21 02:28:07 +00:00
|
|
|
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
2018-01-10 06:16:18 +00:00
|
|
|
|
|
|
|
#undef min
|
|
|
|
#undef max
|
|
|
|
|
2022-02-21 02:28:07 +00:00
|
|
|
namespace metaforce {
|
2018-01-10 06:16:18 +00:00
|
|
|
|
|
|
|
using namespace std::literals;
|
|
|
|
|
2021-01-24 02:16:19 +00:00
|
|
|
#if defined(__APPLE__)
|
2018-01-22 02:40:11 +00:00
|
|
|
#define DEFAULT_GRAPHICS_API "Metal"sv
|
2018-01-10 06:16:18 +00:00
|
|
|
#else
|
2019-09-29 12:44:01 +00:00
|
|
|
#define DEFAULT_GRAPHICS_API "Vulkan"sv
|
2018-01-10 06:16:18 +00:00
|
|
|
#endif
|
|
|
|
|
2018-12-08 05:18:42 +00:00
|
|
|
struct CVarCommons {
|
|
|
|
CVarManager& m_mgr;
|
2021-03-30 20:43:54 +00:00
|
|
|
CVar* m_fullscreen = nullptr;
|
2023-10-28 16:12:05 +00:00
|
|
|
CVar* m_allowJoystickInBackground = nullptr;
|
2018-12-08 05:18:42 +00:00
|
|
|
CVar* m_graphicsApi = nullptr;
|
|
|
|
CVar* m_drawSamples = nullptr;
|
|
|
|
CVar* m_texAnisotropy = nullptr;
|
|
|
|
CVar* m_deepColor = nullptr;
|
2020-04-14 19:20:00 +00:00
|
|
|
CVar* m_variableDt = nullptr;
|
2023-10-27 21:32:36 +00:00
|
|
|
CVar* m_windowSize = nullptr;
|
|
|
|
CVar* m_windowPos = nullptr;
|
2020-04-14 19:20:00 +00:00
|
|
|
|
|
|
|
CVar* m_debugOverlayPlayerInfo = nullptr;
|
|
|
|
CVar* m_debugOverlayWorldInfo = nullptr;
|
|
|
|
CVar* m_debugOverlayAreaInfo = nullptr;
|
2021-05-31 00:29:27 +00:00
|
|
|
CVar* m_debugOverlayLayerInfo = nullptr;
|
2020-04-14 19:20:00 +00:00
|
|
|
CVar* m_debugOverlayShowFrameCounter = nullptr;
|
2021-01-03 19:04:00 +00:00
|
|
|
CVar* m_debugOverlayShowFramerate = nullptr;
|
2020-04-14 19:20:00 +00:00
|
|
|
CVar* m_debugOverlayShowInGameTime = nullptr;
|
|
|
|
CVar* m_debugOverlayShowResourceStats = nullptr;
|
2020-09-13 20:43:15 +00:00
|
|
|
CVar* m_debugOverlayShowRandomStats = nullptr;
|
2021-01-17 03:31:14 +00:00
|
|
|
CVar* m_debugOverlayShowRoomTimer = nullptr;
|
2023-10-23 01:38:58 +00:00
|
|
|
CVar* m_debugOverlayPipelineInfo = nullptr;
|
|
|
|
CVar* m_debugOverlayDrawCallInfo = nullptr;
|
|
|
|
CVar* m_debugOverlayBufferInfo = nullptr;
|
2021-05-30 07:52:20 +00:00
|
|
|
CVar* m_debugOverlayShowInput = nullptr;
|
2022-06-13 05:18:30 +00:00
|
|
|
CVar* m_debugOverlayCorner = nullptr;
|
|
|
|
CVar* m_debugInputOverlayCorner = nullptr;
|
2021-01-11 02:41:59 +00:00
|
|
|
CVar* m_debugToolDrawAiPath = nullptr;
|
|
|
|
CVar* m_debugToolDrawLighting = nullptr;
|
|
|
|
CVar* m_debugToolDrawCollisionActors = nullptr;
|
|
|
|
CVar* m_debugToolDrawMazePath = nullptr;
|
2021-01-17 03:31:14 +00:00
|
|
|
CVar* m_debugToolDrawPlatformCollision = nullptr;
|
2020-09-06 01:30:51 +00:00
|
|
|
CVar* m_logFile = nullptr;
|
2022-06-13 05:18:30 +00:00
|
|
|
CVar* m_lastDiscPath = nullptr;
|
2018-12-08 05:18:42 +00:00
|
|
|
|
2021-02-28 02:36:43 +00:00
|
|
|
CVarCommons(CVarManager& manager);
|
2018-12-08 05:18:42 +00:00
|
|
|
|
2021-03-30 20:43:54 +00:00
|
|
|
bool getFullscreen() const { return m_fullscreen->toBoolean(); }
|
2023-10-28 16:12:05 +00:00
|
|
|
bool getAllowJoystickInBackground() const { return m_allowJoystickInBackground->toBoolean(); }
|
2021-03-30 20:43:54 +00:00
|
|
|
|
|
|
|
void setFullscreen(bool b) { m_fullscreen->fromBoolean(b); }
|
|
|
|
|
2018-12-08 05:18:42 +00:00
|
|
|
std::string getGraphicsApi() const { return m_graphicsApi->toLiteral(); }
|
|
|
|
|
|
|
|
void setGraphicsApi(std::string_view api) { m_graphicsApi->fromLiteral(api); }
|
|
|
|
|
2019-09-29 12:44:01 +00:00
|
|
|
uint32_t getSamples() const { return std::max(1u, m_drawSamples->toUnsigned()); }
|
2018-12-08 05:18:42 +00:00
|
|
|
|
|
|
|
void setSamples(uint32_t v) { m_drawSamples->fromInteger(std::max(uint32_t(1), v)); }
|
2018-01-10 06:16:18 +00:00
|
|
|
|
2019-09-29 12:44:01 +00:00
|
|
|
uint32_t getAnisotropy() const { return std::max(1u, uint32_t(m_texAnisotropy->toUnsigned())); }
|
2023-10-27 21:32:36 +00:00
|
|
|
zeus::CVector2i getWindowSize() const { return m_windowSize->toVec2i(); }
|
|
|
|
zeus::CVector2i getWindowPos() const { return m_windowPos->toVec2i(); }
|
2018-12-08 05:18:42 +00:00
|
|
|
|
2019-09-29 12:44:01 +00:00
|
|
|
void setAnisotropy(uint32_t v) { m_texAnisotropy->fromInteger(std::max(1u, v)); }
|
2018-12-08 05:18:42 +00:00
|
|
|
|
|
|
|
bool getDeepColor() const { return m_deepColor->toBoolean(); }
|
|
|
|
|
|
|
|
void setDeepColor(bool b) { m_deepColor->fromBoolean(b); }
|
|
|
|
|
2020-09-15 21:09:35 +00:00
|
|
|
bool getVariableFrameTime() const { return m_variableDt->toBoolean(); }
|
|
|
|
|
|
|
|
void setVariableFrameTime(bool b) { m_variableDt->fromBoolean(b); }
|
|
|
|
|
2020-09-06 01:30:51 +00:00
|
|
|
std::string getLogFile() const { return m_logFile->toLiteral(); };
|
|
|
|
|
|
|
|
void setLogFile(std::string_view log) { m_logFile->fromLiteral(log); }
|
|
|
|
|
2018-12-08 05:18:42 +00:00
|
|
|
void serialize() { m_mgr.serialize(); }
|
2021-02-28 02:36:43 +00:00
|
|
|
|
|
|
|
static CVarCommons* instance();
|
2018-12-08 05:18:42 +00:00
|
|
|
};
|
2018-01-10 06:16:18 +00:00
|
|
|
|
2018-12-08 05:18:42 +00:00
|
|
|
} // namespace hecl
|