Support configuratable screen offset and remove resolved TODOs

This commit is contained in:
jaby 2024-07-30 16:13:32 -05:00
parent ee78193bfd
commit 40c7dea1f0
8 changed files with 20 additions and 26 deletions

View File

@ -27,6 +27,9 @@ struct DefaultConfiguration {
static constexpr GPU::PositionU16 CLUT_load_pos();
};
// Offsets the default origin of the screen by the specified value
static constexpr auto DisplayDefaultOffset;
struct Periphery {
// Turns on the second controller port and enables multi tap support
static constexpr bool include_portB();
@ -36,6 +39,8 @@ struct DefaultConfiguration {
```
### `CustomConfiguration` macros
```c++
#define __USE_DEBUG_COLOR__ // Turns on colored rectangles during boot (off by default)
#define __SUPPORT_PS3__ // Turns on PS3 support (on by default)
// Turns on colored rectangles during boot (off by default)
#define __USE_DEBUG_COLOR__
// Turns on PS3 support (on by default)
#define __SUPPORT_PS3__
```

View File

@ -164,7 +164,6 @@ namespace JabyEngine {
Interrupt::Type complete_irq;
};
// TODO: Seems they all need to be ACK? Can we remove this?
static constexpr Desc GetStat{0x01, Interrupt::Type::Acknowledge};
static constexpr Desc SetLoc{0x02, Interrupt::Type::Acknowledge};
static constexpr Desc Play{0x03, Interrupt::Type::Acknowledge};

View File

@ -13,6 +13,8 @@ namespace JabyEngine {
}
};
static constexpr auto DisplayDefaultOffset = GPU::PositionI16::create(0, 0);
struct Periphery {
static constexpr bool include_portB() {
return false;

View File

@ -36,19 +36,6 @@ namespace JabyEngine {
Interrupt::enable_irq(Interrupt::CDROM);
Interrupt::ack_irq(Interrupt::CDROM);
SysCall::ExitCriticalSection();
// TODO: Do we need this at all?!
/*__debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale);
CD_IO::PortIndex0::change_to();
__debug_boot_color_at(::JabyEngine::GPU::Color24::Green(), DebugX, DebugY, DebugScale);
Command::send(CD_IO::Command::GetStat);
__debug_boot_color_at(::JabyEngine::GPU::Color24::Blue(), DebugX, DebugY, DebugScale);
Command::send(CD_IO::Command::GetStat);
__debug_boot_color_at(::JabyEngine::GPU::Color24::Yellow(), DebugX, DebugY, DebugScale);
Command::send(CD_IO::Command::Init);*/
//Command::send(CD_IO::Command::Demute);
}
}
}

View File

@ -5,7 +5,6 @@
namespace JabyEngine {
namespace boot {
namespace DMA {
// TODO: Do we want all of this? So far it didn't help
void setup() {
static constexpr auto EnableDMA = DMA_IO::DPCR::from(DMA_IO::DPCR::SPU.turn_on(3), DMA_IO::DPCR::GPU.turn_on(3), DMA_IO::DPCR::CDROM.turn_on(3));

View File

@ -84,12 +84,17 @@ namespace JabyEngine {
}
void Display :: set_offset(int16_t x, int16_t y) {
// TODO: Apply these in a better way or never?
static constexpr auto PS3_CorrectionX = 0; // 2
static constexpr auto PS3_CorrectionY = 0; // 1
x += internal::Display::DisplayRange.x;
y += internal::Display::DisplayRange.y;
// Does not matter really - The original offset is good enough
#ifdef __ADJUST_PS3_SCREEN_OFFSET__
static constexpr auto PS3_CorrectionX = 2;
static constexpr auto PS3_CorrectionY = 1;
#else
static constexpr auto PS3_CorrectionX = 0;
static constexpr auto PS3_CorrectionY = 0;
#endif // __ADJUST_PS3_SCREEN_OFFSET__
x += (internal::Display::DisplayRange.x + Configuration::DisplayDefaultOffset.x);
y += (internal::Display::DisplayRange.y + Configuration::DisplayDefaultOffset.y);
GPU_IO::GP1.write(GPU_IO::Command::HorizontalDisplayRange((x << 3), (x + Display::Width + PS3_CorrectionX) << 3));
GPU_IO::GP1.write(GPU_IO::Command::VerticalDisplayRange(y, y + Display::Height + PS3_CorrectionY));

View File

@ -57,7 +57,6 @@ static void* cplx_memset(void* dst, int val, size_t len) {
}
extern "C" {
// TODO: Speed measure
void* memset(void* dest, int val, size_t len) {
return simple_memset(dest, val, len);
}

View File

@ -30,8 +30,6 @@ pub fn create_audio_for_vec(audio_samples: &Vec<AudioSample>) -> Vec<Audio> {
let mut samples = &audio_samples[0..audio_samples.len()];
let mut parsed_samples = Vec::new();
// TODO: When asking to the LOC of a track, the PS1 does not consider the sector count and just returns (min:seconds);
// psxcdgen_ex has to make sure that songs start at sector 0
for _ in 0..samples_to_parse {
let mut audio = Audio::new();