From efe28a971870fd599b2d88deea75a832c0c45e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gaier?= Date: Fri, 9 Feb 2024 11:30:55 -0500 Subject: [PATCH] First configuratable JabyEngine prototype --- config/MyConfig/jabyengine_custom_config.hpp | 18 ++++++++++ config/MyConfig/jabyengine_custom_defines.hpp | 2 ++ examples/PoolBox/PoolBox.code-workspace | 11 +++++-- include/PSX/jabyengine_config.hpp | 33 +++++++++++-------- mkfile/PSEXETarget.mk | 9 ++++- src/Library/Library.code-workspace | 18 ++++++++++ src/Library/Makefile | 10 ++++++ 7 files changed, 84 insertions(+), 17 deletions(-) create mode 100644 config/MyConfig/jabyengine_custom_config.hpp create mode 100644 config/MyConfig/jabyengine_custom_defines.hpp diff --git a/config/MyConfig/jabyengine_custom_config.hpp b/config/MyConfig/jabyengine_custom_config.hpp new file mode 100644 index 00000000..638e4501 --- /dev/null +++ b/config/MyConfig/jabyengine_custom_config.hpp @@ -0,0 +1,18 @@ +#pragma once +#include + +namespace JabyEngine { + #define TEST_STR "Planschbecken sind konfigurierbar" + + 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; + }; + }; +} \ No newline at end of file diff --git a/config/MyConfig/jabyengine_custom_defines.hpp b/config/MyConfig/jabyengine_custom_defines.hpp new file mode 100644 index 00000000..77e81455 --- /dev/null +++ b/config/MyConfig/jabyengine_custom_defines.hpp @@ -0,0 +1,2 @@ +#pragma once + diff --git a/examples/PoolBox/PoolBox.code-workspace b/examples/PoolBox/PoolBox.code-workspace index f9f4dc97..77107f0f 100644 --- a/examples/PoolBox/PoolBox.code-workspace +++ b/examples/PoolBox/PoolBox.code-workspace @@ -11,8 +11,8 @@ { "label": "build", "type": "shell", - "windows": { // v re-export for WSL v re-export for WSL - "command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})", + "windows": { // v re-export for WSL v re-export for WSL + "command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region} ${input:test} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})", }, "linux": { "command": "make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region}", @@ -67,6 +67,13 @@ "options": ["SCEE", "SCEA", "SCEI"], "default": "SCEE", "description": "Region profile to use" + }, + { + "id": "test", + "type": "pickString", + "options": ["", "CUSTOM_CONFIG=MyConfig"], + "default": "", + "description": "Simple custom config test" }, { "id": "output memory map", diff --git a/include/PSX/jabyengine_config.hpp b/include/PSX/jabyengine_config.hpp index 6f249f34..12285ed4 100644 --- a/include/PSX/jabyengine_config.hpp +++ b/include/PSX/jabyengine_config.hpp @@ -1,18 +1,23 @@ #pragma once -#include "GPU/gpu_types.hpp" -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); - }; +#if __has_include() + #include +#else + #include "GPU/gpu_types.hpp" - struct Periphery { - static constexpr bool IncludePortB = false; - static constexpr bool UseMultiTap = false; + 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; + }; }; - }; -} \ No newline at end of file + } +#endif // has jabyengine_custom_config \ No newline at end of file diff --git a/mkfile/PSEXETarget.mk b/mkfile/PSEXETarget.mk index 02433a68..adefbfd4 100644 --- a/mkfile/PSEXETarget.mk +++ b/mkfile/PSEXETarget.mk @@ -4,7 +4,14 @@ AUTO_OVERLAY_DIR = $(OUTPUT_DIR)/auto_overlay include $(AUTO_OVERLAY_DIR)/Overlays.mk #We use the JabyEngine so we will include ourselves -JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE) +ifdef CUSTOM_CONFIG + CCFLAGS += -I$(JABY_ENGINE_DIR)/config/$(CUSTOM_CONFIG) -imacros $(JABY_ENGINE_DIR)/config/$(CUSTOM_CONFIG)/jabyengine_custom_defines.hpp + # TODO: v can this be empty maybe?? + JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE)/$(CUSTOM_CONFIG) +else + JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE) +endif + JABY_ENGINE_SUPPORT_LIB_DIR = $(JABY_ENGINE_DIR)/Support/lib/PSX-$(BUILD_PROFILE) JABY_ENGINE_SUPPORT_LIBS = $(addprefix -l,$(SUPPORT_LIBS)) JABY_ENGINE_SUPPORT_DEPS = $(addsuffix .a,$(addprefix $(JABY_ENGINE_SUPPORT_LIB_DIR)/lib,$(SUPPORT_LIBS))) diff --git a/src/Library/Library.code-workspace b/src/Library/Library.code-workspace index aeb56d58..8c588e6e 100644 --- a/src/Library/Library.code-workspace +++ b/src/Library/Library.code-workspace @@ -27,6 +27,17 @@ }, "group": "build" }, + { + "label": "make custom config", + "type": "shell", + "windows": { + "command": "wsl make ${input:target} BUILD_PROFILE=${input:build cfg} TV_FORMAT=${input:tv format} CUSTOM_CONFIG=${input:custom config}", + }, + "linux": { + "command": "make ${input:target} BUILD_PROFILE=${input:build cfg} TV_FORMAT=${input:tv format} CUSTOM_CONFIG=${input:custom config}", + }, + "group": "build" + }, { "label": "combi make", "type": "shell", @@ -54,6 +65,13 @@ "default": "PAL", "description": "TV format to use" }, + { + "id": "custom config", + "type": "pickString", + "options": ["MyConfig"], + "default": "MyConfig", + "description": "The custom configuration to use for this build" + }, { "id": "target", "type": "pickString", diff --git a/src/Library/Makefile b/src/Library/Makefile index 369913d3..480ce4e6 100644 --- a/src/Library/Makefile +++ b/src/Library/Makefile @@ -6,9 +6,19 @@ ARTIFACT = libJabyEngine_$(TV_FORMAT) SPLASH_IMAGE = src/BootLoader/splash_image_pal_boot.hpp SPLASH_IMAGE_NTSC = src/BootLoader/splash_image_ntsc_boot.hpp +#TODO: v Check if we need this include still CCFLAGS += -Iinclude -I../../include -D__friends=public CCFLAGS += -save-temps=obj +ifdef CUSTOM_CONFIG + #TODO: Custom config build var + CCFLAGS += -I../../config/$(CUSTOM_CONFIG) -imacros ../../config/$(CUSTOM_CONFIG)/jabyengine_custom_defines.hpp + #TODO: v Or here? v Do we want this here? + CONFIG_NAME = $(PLATFORM)-$(BUILD_PROFILE)/$(CUSTOM_CONFIG) +else + CONFIG_NAME = $(PLATFORM)-$(BUILD_PROFILE) +endif + include ../../mkfile/Wildcard.mk SRCS = $(call rwildcard, src, c cpp s)