From 6b05cc71f6dd05fa5964389186557b3c745bf233 Mon Sep 17 00:00:00 2001 From: jaby Date: Fri, 7 Jun 2024 13:24:36 +0200 Subject: [PATCH] No fix yet --- .../src/Overlay/GPUTest/gpu_test_assets.cpp | 19 ++++++++++++++++++- .../application/src/Overlay/Overlays.hpp | 2 +- .../PoolBox/application/src/application.cpp | 2 +- examples/PoolBox/application/src/menu.cpp | 2 +- include/PSX/System/IOPorts/cd_io.hpp | 4 ++++ include/PSX/System/syscalls.hpp | 4 ++-- .../internal-include/CD/cd_internal.hpp | 5 ++++- src/Library/src/CD/cd.cpp | 9 +++++---- .../src/File/Processor/cd_file_processor.cpp | 1 + 9 files changed, 37 insertions(+), 11 deletions(-) diff --git a/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test_assets.cpp b/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test_assets.cpp index 99c86893..5249e644 100644 --- a/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test_assets.cpp +++ b/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test_assets.cpp @@ -13,7 +13,24 @@ namespace GPUTest { }; __declare_lba_header(LBA); - CDFile Assets[2] = { + CDFile Assets[18] = { + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + CDFileBuilder::simple_tim(LBA::ICON, IconTIM), + CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM), CDFileBuilder::simple_tim(LBA::ICON, IconTIM), }; diff --git a/examples/PoolBox/application/src/Overlay/Overlays.hpp b/examples/PoolBox/application/src/Overlay/Overlays.hpp index 5dc9b236..18186482 100644 --- a/examples/PoolBox/application/src/Overlay/Overlays.hpp +++ b/examples/PoolBox/application/src/Overlay/Overlays.hpp @@ -14,7 +14,7 @@ namespace ControllerTest { namespace GPUTest { extern const volatile JabyEngine::AutoLBAEntry lba[]; - extern JabyEngine::CDFile Assets[2]; + extern JabyEngine::CDFile Assets[18]; void main(); } diff --git a/examples/PoolBox/application/src/application.cpp b/examples/PoolBox/application/src/application.cpp index c9b9e888..8db4687a 100644 --- a/examples/PoolBox/application/src/application.cpp +++ b/examples/PoolBox/application/src/application.cpp @@ -200,7 +200,7 @@ namespace LoadingScene { } static void run() { - if(old_state_changer != state_changer) { + if(true) {//(old_state_changer != state_changer) { printf("Loading new state...\n"); // TODO: Callback for file load? Locally? diff --git a/examples/PoolBox/application/src/menu.cpp b/examples/PoolBox/application/src/menu.cpp index afe4b942..b91413b1 100644 --- a/examples/PoolBox/application/src/menu.cpp +++ b/examples/PoolBox/application/src/menu.cpp @@ -63,7 +63,7 @@ namespace Menu { if(this->waiting) { auto cursor = JabyEngine::Cursor::create(position); - this->font_writer->write(cursor, "Press and hold ()\nto get back", GPU::Color24::Red(0xD0)); + this->font_writer->write(cursor, "Press and hold O\nto get back", GPU::Color24::Red(0xD0)); } else if(auto_clear) { diff --git a/include/PSX/System/IOPorts/cd_io.hpp b/include/PSX/System/IOPorts/cd_io.hpp index 51ef894d..d21de930 100644 --- a/include/PSX/System/IOPorts/cd_io.hpp +++ b/include/PSX/System/IOPorts/cd_io.hpp @@ -142,6 +142,10 @@ namespace JabyEngine { static void ack_extended(IOPort& port) { port.write(InterruptFlag::from(InterruptFlag::InterruptTypValue.range_max(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ)); +// *reinterpret_cast(0x0) = 0; +// *reinterpret_cast(0x0) = 0; +// *reinterpret_cast(0x0) = 0; +// *reinterpret_cast(0x0) = 0; } }; diff --git a/include/PSX/System/syscalls.hpp b/include/PSX/System/syscalls.hpp index 1c0349a4..9e606d3f 100644 --- a/include/PSX/System/syscalls.hpp +++ b/include/PSX/System/syscalls.hpp @@ -208,14 +208,14 @@ namespace JabyEngine { register uint32_t FuncID asm("a0") = 0x01; register uint32_t returnValue asm("v0"); - __asm__ volatile("syscall" : "=r"(FuncID), "=r"(returnValue) : "r"(FuncID) : "at", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory"); + __asm__ volatile("syscall" : "=r"(returnValue) : "r"(FuncID) : "memory"); return returnValue; } static __always_inline void ExitCriticalSection() { register uint32_t FuncID asm("a0") = 0x02; - __asm__ volatile("syscall" : "=r"(FuncID) : "r"(FuncID) : "at", "v0", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory"); + __asm__ volatile("syscall" :: "r"(FuncID) : "memory"); } static __always_inline void DeliverEvent(uint32_t classId, uint32_t spec) { diff --git a/src/Library/internal-include/CD/cd_internal.hpp b/src/Library/internal-include/CD/cd_internal.hpp index 9dbcb88c..db5ecbbb 100644 --- a/src/Library/internal-include/CD/cd_internal.hpp +++ b/src/Library/internal-include/CD/cd_internal.hpp @@ -18,6 +18,7 @@ namespace JabyEngine { extern State current_state; extern uint8_t cmd_interrupt_bit; + extern uint8_t last_send_cmd; struct Command { struct Internal { @@ -48,7 +49,9 @@ namespace JabyEngine { cmd_interrupt_bit = bit::set(cmd_interrupt_bit, cmd.complete_irq); ((parameter_fifo.write(CD_IO::ParameterFifo{args})),...); - cmd_fifo.write(CD_IO::CommandFifo {cmd.id}); + cmd_fifo.write(CD_IO::CommandFifo{cmd.id}); + + last_send_cmd = cmd.id; } }; diff --git a/src/Library/src/CD/cd.cpp b/src/Library/src/CD/cd.cpp index ecc34faa..dc2f6aaf 100644 --- a/src/Library/src/CD/cd.cpp +++ b/src/Library/src/CD/cd.cpp @@ -39,6 +39,7 @@ namespace JabyEngine { static File cur_file; uint8_t cmd_interrupt_bit = 0; + uint8_t last_send_cmd = 0; State current_state = State::Ready; auto irq_callback = SysCall::InterruptCallback::from(IRQ::verifier, IRQ::handler); @@ -159,12 +160,12 @@ namespace JabyEngine { } void read_file(AutoLBAEntry file_info, const SectorBufferAllocator& buffer_allocator) { - cur_file.set_from(file_info); - sector_allocator = buffer_allocator; + cur_file.set_from(file_info); + sector_allocator = buffer_allocator; - CD_IO::PortIndex0::change_to(); + CD_IO::PortIndex0::change_to(); Command::send_wait(CD_IO::Command::SetMode, DataSectorMode); - send_read_n0(cur_file.cur_lba); + send_read_n0(cur_file.cur_lba); } void continue_reading() { diff --git a/src/Library/src/File/Processor/cd_file_processor.cpp b/src/Library/src/File/Processor/cd_file_processor.cpp index 0db5e716..80a6c5fc 100644 --- a/src/Library/src/File/Processor/cd_file_processor.cpp +++ b/src/Library/src/File/Processor/cd_file_processor.cpp @@ -56,6 +56,7 @@ namespace JabyEngine { return self.circular_buffer.allocate(); })); + printf(">>> 0x%p\n", this->jobs.files); printf(">>> %i.) CD needs to load LBA: %i -> %i (is LZ4: [%s])\n", cur_job.rel_lba_idx, cur_lba.get_lba(), cur_lba.get_size_in_sectors(), cur_lba.is_lz4() ? "Yes" : "No"); }