Remove BootFiles. Setup code needs improving
This commit is contained in:
parent
d1e710a283
commit
74d58a5a50
|
@ -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<uintptr_t>(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__
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#include "../../../internal-include/BootLoader/boot_loader.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
#include <PSX/File/Processor/cd_file_processor.hpp>
|
||||
|
||||
extern JabyEngine::NextRoutine main();
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace boot {
|
||||
namespace BootFile {
|
||||
JabyEngine::NextRoutine setup() {
|
||||
printf("Running main!\n");
|
||||
return JabyEngine::NextRoutine::from(main);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#include "../../../internal-include/BootLoader/boot_loader.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace boot {
|
||||
namespace BootFile {
|
||||
JabyEngine::NextRoutine setup() {
|
||||
printf("Overlay boot not implemented!\n");
|
||||
return JabyEngine::NextRoutine::null();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,16 @@
|
|||
#include "../internal-include/BootLoader/boot_loader.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
extern void main();
|
||||
|
||||
namespace JabyEngine {
|
||||
static NextRoutine execute(NextRoutine routine) {
|
||||
// Support currently only direct call
|
||||
return reinterpret_cast<MainRoutine>((routine.value & ~JabyEngine::NextRoutine::OverlayBit))();
|
||||
}
|
||||
|
||||
void start() {
|
||||
NextRoutine next_routine = JabyEngine::NextRoutine::from(boot::Start::setup);
|
||||
printf("Starting Planschbecken\n");
|
||||
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("Running main...\n");
|
||||
main();
|
||||
printf("Stop!!\n");
|
||||
while(true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue