diff --git a/include/PSX/jabyengine.hpp b/include/PSX/jabyengine.hpp index 867d8f16..8842bde9 100644 --- a/include/PSX/jabyengine.hpp +++ b/include/PSX/jabyengine.hpp @@ -3,34 +3,7 @@ #include "../stdint.h" namespace JabyEngine { - struct NextRoutine { - static constexpr uintptr_t OverlayBit = (1 << ((sizeof(uintptr_t)*8) - 2)); - typedef NextRoutine (*MainRoutine)(); - - uintptr_t value; - - constexpr static NextRoutine null() { - return {.value = 0}; - } - - static NextRoutine from(MainRoutine function) { - return {.value = reinterpret_cast(function)}; - } - - constexpr bool is_overlay() const { - return (this->value & OverlayBit); - } - - constexpr bool is_absolute() const { - return !NextRoutine::is_overlay(); - } - - constexpr bool is_null() const { - return this->value == 0; - } - }; - - typedef NextRoutine::MainRoutine MainRoutine; + typedef void (*MainRoutine)(); } #endif //!__JABYENGINE__HPP__ \ No newline at end of file diff --git a/lib/PSEXETarget.mk b/lib/PSEXETarget.mk index 295089a9..7445dd7d 100644 --- a/lib/PSEXETarget.mk +++ b/lib/PSEXETarget.mk @@ -7,10 +7,6 @@ include $(AUTO_OVERLAY_DIR)/Overlays.mk JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE) JABY_ENGINE_LIB_NAME = JabyEngine_$(TV_FORMAT) -#Bind this to the overlay.json file maybe? -BOOT_TYPE = main -OBJS += $(JABY_ENGINE_LIB_DIR)/$(BOOT_TYPE)_boot.o - #Linking rule $(TARGET).elf: $(OBJS) $(JABY_ENGINE_LIB_DIR)/lib$(JABY_ENGINE_LIB_NAME).a $(AUTO_OVERLAY_DIR)/Overlays.ld $(LD) -o $(TARGET).elf $(LDFLAGS_all) $(LDFLAGS) $(OBJS) -L$(JABY_ENGINE_LIB_DIR) -l$(JABY_ENGINE_LIB_NAME) $(LIBS) diff --git a/src/Library/Makefile b/src/Library/Makefile index 688e59aa..4183fabe 100644 --- a/src/Library/Makefile +++ b/src/Library/Makefile @@ -16,9 +16,7 @@ SRCS += src/syscall_printf.asm include ../../lib/Makefile LIB_DIR = ../../lib/$(CONFIG_NAME) -MAIN_BOOT_OBJ = $(filter %/main_boot.o,$(OBJS)) -OVERLAY_BOOT_OBJ = $(filter %/overlay_boot.o,$(OBJS)) -MAIN_LIB_OBJS = $(filter-out $(MAIN_BOOT_OBJ) $(OVERLAY_BOOT_OBJ),$(OBJS)) +MAIN_LIB_OBJS = $(filter-out $(MAIN_BOOT_OBJ) $(OVERLAY_BOOT_OBJ),$(OBJS)) #$(info $$var is [${MAIN_BOOT_OBJ}]) #$(info $$var2 is [${MAIN_LIB_OBJS}]) @@ -33,14 +31,6 @@ $(LIB_DIR)/$(ARTIFACT).a: $(TARGET).a @mkdir -p $(LIB_DIR) cp $(TARGET).a $(LIB_DIR)/$(ARTIFACT).a -$(LIB_DIR)/$(notdir $(MAIN_BOOT_OBJ)): $(MAIN_BOOT_OBJ) - @mkdir -p $(LIB_DIR) - cp $(MAIN_BOOT_OBJ) $(LIB_DIR)/$(notdir $(MAIN_BOOT_OBJ)) - -$(LIB_DIR)/$(notdir $(OVERLAY_BOOT_OBJ)): $(OVERLAY_BOOT_OBJ) - @mkdir -p $(LIB_DIR) - cp $(OVERLAY_BOOT_OBJ) $(LIB_DIR)/$(notdir $(OVERLAY_BOOT_OBJ)) - # Improve later # rule to make the boot image $(SPLASH_IMAGE): ressources/Splash.png @@ -50,7 +40,7 @@ $(SPLASH_IMAGE_NTSC): ressources/Splash_ntsc.png jaby_engine_fconv --lz4 $< simple-tim full16 | cpp_out --name SplashScreen -o $@ #Rules section for default compilation and linking -all: $(SPLASH_IMAGE) $(SPLASH_IMAGE_NTSC) $(LIB_DIR)/$(ARTIFACT).a $(LIB_DIR)/$(notdir $(MAIN_BOOT_OBJ)) $(LIB_DIR)/$(notdir $(OVERLAY_BOOT_OBJ)) +all: $(SPLASH_IMAGE) $(SPLASH_IMAGE_NTSC) $(LIB_DIR)/$(ARTIFACT).a clean: rm -fr $(SPLASH_IMAGE) diff --git a/src/Library/internal-include/BootLoader/boot_loader.hpp b/src/Library/internal-include/BootLoader/boot_loader.hpp index 8153adc8..68b24c93 100644 --- a/src/Library/internal-include/BootLoader/boot_loader.hpp +++ b/src/Library/internal-include/BootLoader/boot_loader.hpp @@ -5,10 +5,6 @@ namespace JabyEngine { //boot namespace? namespace boot { - namespace BootFile { - JabyEngine::NextRoutine setup(); - } - namespace CD { void setup(); } @@ -24,7 +20,7 @@ namespace JabyEngine { } namespace Start { - JabyEngine::NextRoutine setup(); + void setup(); } namespace Timer { diff --git a/src/Library/src/BootLoader/boot_file/main_boot.cpp b/src/Library/src/BootLoader/boot_file/main_boot.cpp deleted file mode 100644 index 711ead13..00000000 --- a/src/Library/src/BootLoader/boot_file/main_boot.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "../../../internal-include/BootLoader/boot_loader.hpp" -#include - -#include - -extern JabyEngine::NextRoutine main(); - -namespace JabyEngine { - namespace boot { - namespace BootFile { - JabyEngine::NextRoutine setup() { - printf("Running main!\n"); - return JabyEngine::NextRoutine::from(main); - } - } - } -} \ No newline at end of file diff --git a/src/Library/src/BootLoader/boot_file/overlay_boot.cpp b/src/Library/src/BootLoader/boot_file/overlay_boot.cpp deleted file mode 100644 index decd2942..00000000 --- a/src/Library/src/BootLoader/boot_file/overlay_boot.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "../../../internal-include/BootLoader/boot_loader.hpp" -#include - -namespace JabyEngine { - namespace boot { - namespace BootFile { - JabyEngine::NextRoutine setup() { - printf("Overlay boot not implemented!\n"); - return JabyEngine::NextRoutine::null(); - } - } - } -} \ No newline at end of file diff --git a/src/Library/src/BootLoader/start_boot.cpp b/src/Library/src/BootLoader/start_boot.cpp index ee4bf32d..2fce71e4 100644 --- a/src/Library/src/BootLoader/start_boot.cpp +++ b/src/Library/src/BootLoader/start_boot.cpp @@ -13,7 +13,7 @@ namespace JabyEngine { DMA_IO::DPCR = DMA_IO::DPCR_t(DMA_IO::DPCR).set(DMA_IO::DPCR_t::SPUEnable).set(DMA_IO::DPCR_t::GPUEnable).set(DMA_IO::DPCR_t::CDROMEnable); } - JabyEngine::NextRoutine setup() { + void setup() { enable_DMA(); SPU::stop_voices(); @@ -31,7 +31,6 @@ namespace JabyEngine { //Pause?? SPU::setup(); - return BootFile::setup(); } } } diff --git a/src/Library/src/startup.cpp b/src/Library/src/startup.cpp index 78c2ede0..59bcb99a 100644 --- a/src/Library/src/startup.cpp +++ b/src/Library/src/startup.cpp @@ -1,29 +1,16 @@ #include "../internal-include/BootLoader/boot_loader.hpp" #include +extern void main(); + namespace JabyEngine { - static NextRoutine execute(NextRoutine routine) { - // Support currently only direct call - return reinterpret_cast((routine.value & ~JabyEngine::NextRoutine::OverlayBit))(); - } - void start() { - NextRoutine next_routine = JabyEngine::NextRoutine::from(boot::Start::setup); - - printf("Starting Planschbecken 0x%p\n", next_routine.value); - while(true) { - if(next_routine.is_null()) { - break; - } - - if(next_routine.is_overlay()) { - printf("Overlay not supported yet!\n"); - break; - } - - next_routine = execute(next_routine); - } - printf("Stop!\n"); + printf("Starting Planschbecken\n"); + boot::Start::setup(); + + printf("Running main...\n"); + main(); + printf("Stop!!\n"); while(true); } } \ No newline at end of file