diff --git a/include/PSX/GPU/gpu.hpp b/include/PSX/GPU/gpu.hpp index d18f46b6..12dc7943 100644 --- a/include/PSX/GPU/gpu.hpp +++ b/include/PSX/GPU/gpu.hpp @@ -33,11 +33,11 @@ namespace JabyEngine { } static void enable() { - GPU_IO::GP1.set_display_state(GPU_IO::DisplayMode::State::On); + GPU_IO::GP1.set_display_state(GPU_IO_Values::DisplayMode::State::On); } static void disable() { - GPU_IO::GP1.set_display_state(GPU_IO::DisplayMode::State::Off); + GPU_IO::GP1.set_display_state(GPU_IO_Values::DisplayMode::State::Off); } static void set_offset(int16_t x, int16_t y); @@ -72,7 +72,7 @@ namespace JabyEngine { } static void wait_for_render() { - while(!GPU_IO::GPUSTAT.read().is_set(GPU_IO::GPUSTAT::GP0ReadyForCMD)); + while(!GPU_IO::GPUSTAT.read().is_set(GPU_IO_Values::GPUSTAT::GP0ReadyForCMD)); } uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true); diff --git a/include/PSX/System/IOPorts/gpu_io.hpp b/include/PSX/System/IOPorts/gpu_io.hpp index 5f636f56..88a5f3ed 100644 --- a/include/PSX/System/IOPorts/gpu_io.hpp +++ b/include/PSX/System/IOPorts/gpu_io.hpp @@ -3,8 +3,6 @@ namespace JabyEngine { namespace GPU_IO { - using namespace GPU_IO_Values; - struct GP0IO : public IOPort { void clear_cache() { this->write(GPU_IO_Values::GP0::ClearCache()); diff --git a/include/PSX/System/IOPorts/periphery_io.hpp b/include/PSX/System/IOPorts/periphery_io.hpp index 17961191..e705d10c 100644 --- a/include/PSX/System/IOPorts/periphery_io.hpp +++ b/include/PSX/System/IOPorts/periphery_io.hpp @@ -3,23 +3,21 @@ namespace JabyEngine { namespace Periphery_IO { - namespace Value = Periphery_IO_Values; - - struct JOY_STAT_IO : public IOPort { + struct JOY_STAT_IO : public IOPort { inline bool has_response() const { - return this->read().is_set(Value::JOY_STAT::RXFifoNonEmpty); + return this->read().is_set(Periphery_IO_Values::JOY_STAT::RXFifoNonEmpty); } inline bool is_ready_transfer() const { - return this->read().is_set(Value::JOY_STAT::TXReadyFinished); + return this->read().is_set(Periphery_IO_Values::JOY_STAT::TXReadyFinished); } }; - using JOY_BAUD_IO = IOPort; - using JOY_CTRL_IO = IOPort; - using JOY_MODE_IO = IOPort; - using JOY_RX_DATA_IO = IOPort; - using JOY_TX_DATA_IO = IOPort; + using JOY_BAUD_IO = IOPort; + using JOY_CTRL_IO = IOPort; + using JOY_MODE_IO = IOPort; + using JOY_RX_DATA_IO = IOPort; + using JOY_TX_DATA_IO = IOPort; static auto& JOY_TX_DATA = __new_declare_io_port(JOY_TX_DATA_IO, 0x1F801040); static const auto& JOY_RX_DATA = __new_declare_io_port(JOY_RX_DATA_IO, 0x1F801040); diff --git a/include/PSX/System/IOPorts/spu_io.hpp b/include/PSX/System/IOPorts/spu_io.hpp index 9d10afcd..3190a88c 100644 --- a/include/PSX/System/IOPorts/spu_io.hpp +++ b/include/PSX/System/IOPorts/spu_io.hpp @@ -4,12 +4,10 @@ namespace JabyEngine { namespace SPU_IO { - namespace Value = SPU_IO_Values; - static constexpr size_t VoiceCount = 24; static constexpr size_t ReverbCount = 1; - struct ControlRegisterIO : public IOPort { + struct ControlRegisterIO : public IOPort { using TransferMode = Value::RAMTransferMode; void set_transfer_mode(TransferMode mode) { @@ -18,20 +16,20 @@ namespace JabyEngine { } }; - using ADIO = IOPort; - using DataTransferControlIO = IOPort; - using EchoIO = IOPort32; - using KeyOffIO = IOPort32; - using KeyOnIO = IOPort32; - using KeyStatusIO = IOPort32; - using NoiseIO = IOPort; - using PitchModulationIO = IOPort32; - using SampleRateIO = IOPort; - using SimpleVolumeIO = IOPort; - using StatusRegisterIO = IOPort; - using SRIO = IOPort; - using SRAMAdrIO = IOPort; - using SweepVolumeIO = IOPort; + using ADIO = IOPort; + using DataTransferControlIO = IOPort; + using EchoIO = IOPort32; + using KeyOffIO = IOPort32; + using KeyOnIO = IOPort32; + using KeyStatusIO = IOPort32; + using NoiseIO = IOPort; + using PitchModulationIO = IOPort32; + using SampleRateIO = IOPort; + using SimpleVolumeIO = IOPort; + using StatusRegisterIO = IOPort; + using SRIO = IOPort; + using SRAMAdrIO = IOPort; + using SweepVolumeIO = IOPort; #pragma pack(push, 1) struct Voice { diff --git a/src/Library/internal-include/GPU/gpu_internal.hpp b/src/Library/internal-include/GPU/gpu_internal.hpp index ed0b9fc8..7353ac81 100644 --- a/src/Library/internal-include/GPU/gpu_internal.hpp +++ b/src/Library/internal-include/GPU/gpu_internal.hpp @@ -13,11 +13,11 @@ namespace JabyEngine { static constexpr auto Height = PublicDisplay::Height; #ifdef JABYENGINE_PAL - static constexpr auto DisplayMode = GPU_IO::DisplayMode::PAL(); + static constexpr auto DisplayMode = GPU_IO_Values::DisplayMode::PAL(); static constexpr uint16_t ScanlinesV = 288; static constexpr auto DisplayRange = PositionI16::create(78, 35); #else - static constexpr auto DisplayMode = GPU_IO::DisplayMode::NTSC(); + static constexpr auto DisplayMode = GPU_IO_Values::DisplayMode::NTSC(); static constexpr uint16_t ScanlinesV = 240; static constexpr auto DisplayRange = PositionI16::create(76, 16); #endif //JABYENGINE_PAL @@ -78,7 +78,7 @@ namespace JabyEngine { struct Receive { static void prepare() { - GPU_IO::GP1.set_dma_direction(GPU_IO::GPUSTAT::DMADirection::CPU2GPU); + GPU_IO::GP1.set_dma_direction(GPU_IO_Values::GPUSTAT::DMADirection::CPU2GPU); reset_cmd_buffer(); } diff --git a/src/Library/internal-include/periphery_internal.hpp b/src/Library/internal-include/periphery_internal.hpp index 8a136f50..e2bfa408 100644 --- a/src/Library/internal-include/periphery_internal.hpp +++ b/src/Library/internal-include/periphery_internal.hpp @@ -11,17 +11,17 @@ namespace JabyEngine { using namespace Periphery_IO; static void connect_to(uint16_t port) { - JOY_CTRL.write(Value::JOY_CTRL::create_for(port)); + JOY_CTRL.write(Periphery_IO_Values::JOY_CTRL::create_for(port)); busy_loop(500); } static void close_connection() { - JOY_CTRL.write(Value::JOY_CTRL::close()); + JOY_CTRL.write(Periphery_IO_Values::JOY_CTRL::close()); } static void send_byte(uint8_t byte) { while(!JOY_STAT.is_ready_transfer()); - JOY_TX_DATA.write(Value::JOY_TX_DATA::create(byte)); + JOY_TX_DATA.write(Periphery_IO_Values::JOY_TX_DATA::create(byte)); } static uint8_t read_byte() { @@ -30,8 +30,8 @@ namespace JabyEngine { } static void acknowledge() { - while(JOY_STAT.read().is_set(Value::JOY_STAT::ACKIrqLow)); - JOY_CTRL.write(JOY_CTRL.read().set(Value::JOY_CTRL::ACK)); + while(JOY_STAT.read().is_set(Periphery_IO_Values::JOY_STAT::ACKIrqLow)); + JOY_CTRL.write(JOY_CTRL.read().set(Periphery_IO_Values::JOY_CTRL::ACK)); Interrupt::ack_irq(Interrupt::Periphery); } diff --git a/src/Library/src/GPU/gpu.cpp b/src/Library/src/GPU/gpu.cpp index b2eca103..42ea622a 100644 --- a/src/Library/src/GPU/gpu.cpp +++ b/src/Library/src/GPU/gpu.cpp @@ -61,7 +61,7 @@ namespace JabyEngine { wait_ready_for_CMD(); #ifdef __SUPPORT_PS3__ // The PS3 needs explict change to FiFo - GPU_IO::GP1.set_dma_direction(GPU_IO::GPUSTAT::DMADirection::Fifo); + GPU_IO::GP1.set_dma_direction(GPU_IO_Values::GPUSTAT::DMADirection::Fifo); #endif // __SUPPORT_PS3__ for(size_t n = 0; n < words; n++) { @@ -72,7 +72,7 @@ namespace JabyEngine { void render_dma(const uint32_t* data) { // DPCR already enabled DMA_IO::GPU.wait(); - GPU_IO::GP1.set_dma_direction(GPU_IO::GPUSTAT::DMADirection::CPU2GPU); + GPU_IO::GP1.set_dma_direction(GPU_IO_Values::GPUSTAT::DMADirection::CPU2GPU); DMA_IO::GPU.set_adr(reinterpret_cast(data)); DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR::SyncMode2::for_gpu_cmd());