diff --git a/config/Readme.md b/config/Readme.md index dab2d5d9..8533585a 100644 --- a/config/Readme.md +++ b/config/Readme.md @@ -36,5 +36,6 @@ struct DefaultConfiguration { ``` ### `CustomConfiguration` macros ```c++ -#define __USE_DEBUG_COLOR__ // Turns on colored rectangles during boot +#define __USE_DEBUG_COLOR__ // Turns on colored rectangles during boot (off by default) +#define __SUPPORT_PS3__ // Turns on PS3 support (on by default) ``` \ No newline at end of file diff --git a/include/PSX/GPU/gpu.hpp b/include/PSX/GPU/gpu.hpp index 0bb5b075..0afa19e0 100644 --- a/include/PSX/GPU/gpu.hpp +++ b/include/PSX/GPU/gpu.hpp @@ -1,6 +1,7 @@ #pragma once #include "../Auxiliary/type_traits.hpp" #include "../System/IOPorts/gpu_io.hpp" +#include "../jabyengine_config.hpp" #include "gpu_primitives.hpp" #if !defined(JABYENGINE_NTSC) && !defined(JABYENGINE_PAL) diff --git a/include/PSX/jabyengine_config.hpp b/include/PSX/jabyengine_config.hpp index 023fa364..33570402 100644 --- a/include/PSX/jabyengine_config.hpp +++ b/include/PSX/jabyengine_config.hpp @@ -29,5 +29,6 @@ namespace JabyEngine { using Configuration = CustomConfiguration; #else using Configuration = DefaultConfiguration; + #define __SUPPORT_PS3__ #endif // has jabyengine_custom_config } \ No newline at end of file diff --git a/src/Library/internal-include/CD/cd_internal.hpp b/src/Library/internal-include/CD/cd_internal.hpp index beefa63b..45602186 100644 --- a/src/Library/internal-include/CD/cd_internal.hpp +++ b/src/Library/internal-include/CD/cd_internal.hpp @@ -19,6 +19,7 @@ namespace JabyEngine { ((parameter_fifo.write(CD_IO::ParameterFifo{args})),...); cmd_fifo.write(CD_IO::CommandFifo {cmd.id}); + cmd_interrupt_bit = bit::set(0, cmd.complete_irq); } template @@ -29,8 +30,7 @@ namespace JabyEngine { template static void send_wait(IOPort& cmd_fifo, IOPort& parameter_fifo, CD_IO::Command::Desc cmd, ARGS...args) { send(cmd_fifo, parameter_fifo, cmd, args...); - cmd_interrupt_bit = bit::set(0, cmd.complete_irq); - wait_completed(); // TODO: This was moved because of Duckstation - but is it fine on real hardware? + wait_completed(); } template diff --git a/src/Library/internal-include/GPU/gpu_internal.hpp b/src/Library/internal-include/GPU/gpu_internal.hpp index 85e5d1f2..88eb27b7 100644 --- a/src/Library/internal-include/GPU/gpu_internal.hpp +++ b/src/Library/internal-include/GPU/gpu_internal.hpp @@ -66,10 +66,10 @@ namespace JabyEngine { } namespace DMA { - #ifdef SUPPORT_PS3 + #ifdef __SUPPORT_PS3__ // The PS3 doesn't autoincrement the GPU MADR register so we have to do it extern uintptr_t MADR; - #endif // SUPPORT_PS3 + #endif // __SUPPORT_PS3__ static void wait() { ::JabyEngine::DMA_IO::GPU.wait(); @@ -86,11 +86,11 @@ namespace JabyEngine { } static void set_src(uintptr_t adr) { - #ifdef SUPPORT_PS3 + #ifdef __SUPPORT_PS3__ MADR = adr; #else DMA_IO::GPU.set_adr(adr); - #endif // SUPPORT_PS3 + #endif // __SUPPORT_PS3__ } static void set_dst(const PositionU16& position, const SizeU16& size) { @@ -103,10 +103,10 @@ namespace JabyEngine { static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) { typedef DMA_IO::BCR::SyncMode1 SyncMode1; - #ifdef SUPPORT_PS3 + #ifdef __SUPPORT_PS3__ DMA_IO::GPU.set_adr(MADR); MADR += (blockCount * wordsPerBlock) << 2; - #endif // SUPPORT_PS3 + #endif // __SUPPORT_PS3__ DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR::from(SyncMode1::BlockSize.with(wordsPerBlock), SyncMode1::BlockAmount.with(blockCount))); DMA_IO::GPU.channel_ctrl.write(DMA_IO::CHCHR::StartGPUReceive()); } diff --git a/src/Library/src/GPU/gpu.cpp b/src/Library/src/GPU/gpu.cpp index 012e84f8..98ba7a9c 100644 --- a/src/Library/src/GPU/gpu.cpp +++ b/src/Library/src/GPU/gpu.cpp @@ -9,9 +9,9 @@ namespace JabyEngine { namespace internal { namespace DMA { - #ifdef SUPPORT_PS3 + #ifdef __SUPPORT_PS3__ uintptr_t MADR = 0; - #endif // SUPPORT_PS3 + #endif // __SUPPORT_PS3__ } static SysCall::InterruptVerifierResult interrupt_verifier();