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