Support PS3 by default

This commit is contained in:
jaby 2024-03-14 00:17:48 -05:00
parent 3d2ffd86cf
commit 7eb9a6c224
6 changed files with 14 additions and 11 deletions

View File

@ -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)
```

View File

@ -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)

View File

@ -29,5 +29,6 @@ namespace JabyEngine {
using Configuration = CustomConfiguration;
#else
using Configuration = DefaultConfiguration;
#define __SUPPORT_PS3__
#endif // has jabyengine_custom_config
}

View File

@ -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<typename T, typename...ARGS>
@ -29,8 +30,7 @@ namespace JabyEngine {
template<typename...ARGS>
static void send_wait(IOPort<CD_IO::CommandFifo>& cmd_fifo, IOPort<CD_IO::ParameterFifo>& 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<typename T, typename...ARGS>

View File

@ -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());
}

View File

@ -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();