Convert Configurations to function based for overrides

This commit is contained in:
Björn Gaier 2024-02-15 22:18:22 -05:00
parent 029b81c69b
commit 760c83b0cf
4 changed files with 34 additions and 24 deletions

View File

@ -8,8 +8,8 @@ namespace JabyEngine {
// This size is by Hardware limitation
static constexpr auto Size = SizeU16::create(16, 16);
static constexpr auto TextureLoadPos = Configuration::BIOSFont::TextureLoadPos;
static constexpr auto CLUTLoadPos = Configuration::BIOSFont::CLUTLoadPos;
static constexpr auto TextureLoadPos = Configuration::BIOSFont::texture_load_pos();
static constexpr auto CLUTLoadPos = Configuration::BIOSFont::CLUT_load_pos();
static constexpr TexPage get_tex_page() {
return TexPage::create(BIOS_Font::TextureLoadPos, GPU::TextureColorMode::clut4);

View File

@ -4,8 +4,8 @@
namespace JabyEngine {
namespace Periphery {
static constexpr uint32_t PortCount = Configuration::Periphery::IncludePortB ? 2 : 1;
static constexpr uint32_t DeviceCount = Configuration::Periphery::UseMultiTap ? 4 : 1;
static constexpr uint32_t PortCount = Configuration::Periphery::include_portB() ? 2 : 1;
static constexpr uint32_t DeviceCount = Configuration::Periphery::use_multi_tap() ? 4 : 1;
extern RawController controller[PortCount][DeviceCount];

View File

@ -1,23 +1,33 @@
#pragma once
#include <PSX/GPU/gpu_types.hpp>
#if __has_include(<jabyengine_custom_config.hpp>)
#include <jabyengine_custom_config.hpp>
#else
#include "GPU/gpu_types.hpp"
namespace JabyEngine {
struct DefaultConfiguration {
struct BIOSFont {
static constexpr GPU::PositionU16 texture_load_pos() {
return GPU::PositionU16::create(320, 256);
}
namespace JabyEngine {
#define TEST_STR "Planschbecken sind default"
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 IncludePortB = false;
static constexpr bool UseMultiTap = false;
};
static constexpr GPU::PositionU16 CLUT_load_pos() {
return GPU::PositionU16::create(320, 511);
}
};
}
#endif // has jabyengine_custom_config
struct Periphery {
static constexpr bool include_portB() {
return false;
}
static constexpr bool use_multi_tap(){
return false;
}
};
};
#if __has_include(<jabyengine_custom_config.hpp>)
#include <jabyengine_custom_config.hpp>
#else
#define TEST_STR "Planschbecken sind default"
using Configuration = DefaultConfiguration;
#endif // has jabyengine_custom_config
}

View File

@ -126,7 +126,7 @@ namespace JabyEngine {
}
Periphery::close_connection();
if(Configuration::Periphery::IncludePortB) {
if(Configuration::Periphery::include_portB()) {
cur_controller_port ^= 0x1;
}
}