Convert Configurations to function based for overrides

This commit is contained in:
jaby 2024-02-15 22:18:22 -05:00
parent 3ec3c5ffed
commit 842e7c594e
4 changed files with 34 additions and 24 deletions

View File

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

View File

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

View File

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