diff --git a/include/PSX/jabyengine.hpp b/include/PSX/jabyengine.hpp index 8842bde9..65a33360 100644 --- a/include/PSX/jabyengine.hpp +++ b/include/PSX/jabyengine.hpp @@ -1,6 +1,6 @@ #ifndef __JABYENGINE__HPP__ #define __JABYENGINE__HPP__ -#include "../stdint.h" +#include "jabyengine_defines.h" namespace JabyEngine { typedef void (*MainRoutine)(); diff --git a/include/PSX/jabyengine_defines.h b/include/PSX/jabyengine_defines.h index a0957d14..8c838cb7 100644 --- a/include/PSX/jabyengine_defines.h +++ b/include/PSX/jabyengine_defines.h @@ -6,6 +6,7 @@ #define __used __attribute__((used)) #define __no_align __attribute__((packed)) #define __no_inline __attribute__((noinline)) +#define __no_return __attribute__((noreturn)) #define __always_inline __attribute__((always_inline)) #define __section(name) __attribute__((section(name))) #define __collect(...) __VA_ARGS__ diff --git a/src/Library/internal-include/BootLoader/boot_loader.hpp b/src/Library/internal-include/BootLoader/boot_loader.hpp index 68b24c93..888c1b54 100644 --- a/src/Library/internal-include/BootLoader/boot_loader.hpp +++ b/src/Library/internal-include/BootLoader/boot_loader.hpp @@ -3,7 +3,6 @@ #include namespace JabyEngine { - //boot namespace? namespace boot { namespace CD { void setup(); @@ -19,13 +18,11 @@ namespace JabyEngine { void setup(); } - namespace Start { - void setup(); - } - namespace Timer { void setup(); } } + + void __no_return run(); } #endif //!BOOT_LOADER_HPP \ 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 2fce71e4..111c5fbf 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); } - void setup() { + static void setup() { enable_DMA(); SPU::stop_voices(); @@ -34,4 +34,12 @@ namespace JabyEngine { } } } + + void start() { + printf("Starting Planschbecken\n"); + boot::Start::setup(); + + printf("Running main...\n"); + run(); + } } \ No newline at end of file diff --git a/src/Library/src/run.cpp b/src/Library/src/run.cpp new file mode 100644 index 00000000..37038004 --- /dev/null +++ b/src/Library/src/run.cpp @@ -0,0 +1,12 @@ +#include + +extern void main(); + +namespace JabyEngine { + // Executes the game + void __no_return run() { + main(); + printf("Stop!!\n"); + while(true); + } +} \ No newline at end of file diff --git a/src/Library/src/startup.cpp b/src/Library/src/startup.cpp deleted file mode 100644 index 59bcb99a..00000000 --- a/src/Library/src/startup.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "../internal-include/BootLoader/boot_loader.hpp" -#include - -extern void main(); - -namespace JabyEngine { - void start() { - printf("Starting Planschbecken\n"); - boot::Start::setup(); - - printf("Running main...\n"); - main(); - printf("Stop!!\n"); - while(true); - } -} \ No newline at end of file