From 89ab744486821b3ec3823a2de90ab6242e9ec3c3 Mon Sep 17 00:00:00 2001 From: Jaby Date: Wed, 31 Aug 2022 22:16:16 +0200 Subject: [PATCH] DTC --- include/PSX/Auxiliary/io_class_helper.hpp | 7 +++++++ include/PSX/System/IOPorts/SPU_IO.hpp | 6 ++++++ src/Library/src/BootLoader/boot_spu.cpp | 1 + 3 files changed, 14 insertions(+) diff --git a/include/PSX/Auxiliary/io_class_helper.hpp b/include/PSX/Auxiliary/io_class_helper.hpp index 70eadd89..0cbf4371 100644 --- a/include/PSX/Auxiliary/io_class_helper.hpp +++ b/include/PSX/Auxiliary/io_class_helper.hpp @@ -38,4 +38,11 @@ static constexpr __always_inline void io_class__update_with(T& dst, const T& src const_cast(dst.raw_value) = src.raw_value; } +template +static constexpr __always_inline void io_class__update_with(T& dst, const U& src) { + typedef decltype(dst.raw_value) DST_VALUE; + + const_cast(dst.raw_value) = src; +} + #endif //!__JABYENGINE_IO_CLASS_HELPER_HPP__ \ No newline at end of file diff --git a/include/PSX/System/IOPorts/SPU_IO.hpp b/include/PSX/System/IOPorts/SPU_IO.hpp index 0fbddfa0..a2cff798 100644 --- a/include/PSX/System/IOPorts/SPU_IO.hpp +++ b/include/PSX/System/IOPorts/SPU_IO.hpp @@ -212,6 +212,12 @@ namespace SPU { io_class__2option_map_getter_is(bool, external_audio_off, external_audio_on, 1); io_class__2option_map_getter_is(bool, cd_audio_disable, cd_audio_enable, 0); }; + + struct __no_align DataTransferControl { + static inline __always_inline auto& Register = *reinterpret_cast(0x1F801DAC); + + uint16_t raw_value = 0; + }; } #endif //!__JABYENGINE_SPU_IO_HPP__ \ No newline at end of file diff --git a/src/Library/src/BootLoader/boot_spu.cpp b/src/Library/src/BootLoader/boot_spu.cpp index 448e2c25..e10dddb2 100644 --- a/src/Library/src/BootLoader/boot_spu.cpp +++ b/src/Library/src/BootLoader/boot_spu.cpp @@ -41,6 +41,7 @@ namespace SPU { clear_voice(voice); } + io_class__update_with(DataTransferControl::Register, (2 << 1)); enable_control(); } } \ No newline at end of file