From 8b8ca421a9e5f61b303e224bec96aba01b4c6735 Mon Sep 17 00:00:00 2001 From: Jaby Date: Tue, 2 Jan 2024 20:29:36 -0600 Subject: [PATCH] Introduce JabyEngine configuration file --- include/PSX/GPU/gpu_auto_load_font.hpp | 6 +++--- include/PSX/Periphery/periphery.hpp | 6 +++++- include/PSX/jabyegine_config.hpp | 16 ++++++++++++++++ src/Library/src/Periphery/periphery.cpp | 5 ++++- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 include/PSX/jabyegine_config.hpp diff --git a/include/PSX/GPU/gpu_auto_load_font.hpp b/include/PSX/GPU/gpu_auto_load_font.hpp index 1ac3e5c7..0b04510e 100644 --- a/include/PSX/GPU/gpu_auto_load_font.hpp +++ b/include/PSX/GPU/gpu_auto_load_font.hpp @@ -1,4 +1,5 @@ #pragma once +#include "../jabyegine_config.hpp" #include "gpu_primitives.hpp" namespace JabyEngine { @@ -7,9 +8,8 @@ namespace JabyEngine { // This size is by Hardware limitation static constexpr auto Size = SizeU16::create(16, 16); - // The following two values can be easily changed - static constexpr auto TextureLoadPos = PositionU16::create(320, 256); - static constexpr auto CLUTLoadPos = PositionU16::create(320, 511); + static constexpr auto TextureLoadPos = Configuration::BIOSFont::TextureLoadPos; + static constexpr auto CLUTLoadPos = Configuration::BIOSFont::CLUTLoadPos; static constexpr TexPage get_tex_page() { return TexPage::create(BIOS_Font::TextureLoadPos, GPU::TexturePageColor::$4bit); diff --git a/include/PSX/Periphery/periphery.hpp b/include/PSX/Periphery/periphery.hpp index 40175930..0bad0d42 100644 --- a/include/PSX/Periphery/periphery.hpp +++ b/include/PSX/Periphery/periphery.hpp @@ -1,9 +1,13 @@ #pragma once +#include "../jabyegine_config.hpp" #include "raw_controller.hpp" namespace JabyEngine { namespace Periphery { - extern RawController controller[1][1]; + static constexpr uint32_t PortCount = Configuration::Periphery::UsePortB ? 2 : 1; + static constexpr uint32_t DeviceCount = Configuration::Periphery::UseMultiTap ? 4 : 1; + + extern RawController controller[PortCount][DeviceCount]; void query_controller(); } diff --git a/include/PSX/jabyegine_config.hpp b/include/PSX/jabyegine_config.hpp new file mode 100644 index 00000000..47a99d4c --- /dev/null +++ b/include/PSX/jabyegine_config.hpp @@ -0,0 +1,16 @@ +#pragma once +#include "GPU/gpu_types.hpp" + +namespace JabyEngine { + struct Configuration { + struct BIOSFont { + static constexpr auto TextureLoadPos = GPU::PositionU16::create(320, 256); + static constexpr auto CLUTLoadPos = GPU::PositionU16::create(320, 511); + }; + + struct Periphery { + static constexpr bool UsePortB = false; + static constexpr bool UseMultiTap = false; + }; + }; +} \ No newline at end of file diff --git a/src/Library/src/Periphery/periphery.cpp b/src/Library/src/Periphery/periphery.cpp index 36c2f6ef..05d3ecb4 100644 --- a/src/Library/src/Periphery/periphery.cpp +++ b/src/Library/src/Periphery/periphery.cpp @@ -3,10 +3,13 @@ namespace JabyEngine { namespace Periphery { - RawController controller[1][1]; + RawController controller[PortCount][DeviceCount]; void query_controller() { printf("Needs implementation\n"); } + + static_assert(!Configuration::Periphery::UsePortB, "Port B not supported yet"); + static_assert(!Configuration::Periphery::UseMultiTap, "MultiTap not supported yet"); } } \ No newline at end of file