From f6104609f922aee5707e44ee5318818c96d3d40c Mon Sep 17 00:00:00 2001 From: Arisotura Date: Wed, 9 Jul 2025 21:10:31 +0200 Subject: [PATCH] lay very basic base for HLE ucode stuff --- src/CMakeLists.txt | 2 + src/DSP_HLE/Ucode_Base.cpp | 180 +++++++++++++++++++++++++++++++++++++ src/DSP_HLE/Ucode_Base.h | 73 +++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 src/DSP_HLE/Ucode_Base.cpp create mode 100644 src/DSP_HLE/Ucode_Base.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4fa4d514..fd83ddf3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,6 +58,8 @@ add_library(core STATIC Wifi.cpp WifiAP.cpp + DSP_HLE/Ucode_Base.cpp + fatfs/ff.c fatfs/ffsystem.c fatfs/ffunicode.c diff --git a/src/DSP_HLE/Ucode_Base.cpp b/src/DSP_HLE/Ucode_Base.cpp new file mode 100644 index 00000000..e5e3a218 --- /dev/null +++ b/src/DSP_HLE/Ucode_Base.cpp @@ -0,0 +1,180 @@ +/* + Copyright 2016-2025 melonDS team + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#include "../DSi.h" +#include "../DSi_DSP.h" +#include "Ucode_Base.h" +#include "../Platform.h" + + +namespace melonDS +{ +using Platform::Log; +using Platform::LogLevel; + + +DSPHLE_UcodeBase::DSPHLE_UcodeBase() +{ + // +} + +DSPHLE_UcodeBase::~DSPHLE_UcodeBase() +{ + // +} + +void DSPHLE_UcodeBase::Reset() +{ + // +} + +void DSPHLE_UcodeBase::DoSavestate(Savestate *file) +{ + // +} + +bool DSPHLE_UcodeBase::SendDataIsEmpty(u8 index) +{ + // + return false; +} + +bool DSPHLE_UcodeBase::RecvDataIsEmpty(u8 index) +{ + // + return false; +} + +u16 DSPHLE_UcodeBase::DMAChan0GetDstHigh() +{ + // + return 0; +} + +u16 DSPHLE_UcodeBase::AHBMGetDmaChannel(u16 index) +{ + // + return 0; +} + +u16 DSPHLE_UcodeBase::AHBMGetDirection(u16 index) +{ + // + return 0; +} + +u16 DSPHLE_UcodeBase::AHBMGetUnitSize(u16 index) +{ + // + return 0; +} + +u16 DSPHLE_UcodeBase::DataReadA32(u32 addr) +{ + // + return 0; +} + +void DSPHLE_UcodeBase::DataWriteA32(u32 addr, u16 val) +{ + // +} + +u16 DSPHLE_UcodeBase::MMIORead(u16 addr) +{ + // + return 0; +} + +void DSPHLE_UcodeBase::MMIOWrite(u16 addr, u16 val) +{ + // +} + +u16 DSPHLE_UcodeBase::ProgramRead(u32 addr) +{ + // + return 0; +} + +void DSPHLE_UcodeBase::ProgramWrite(u32 addr, u16 val) +{ + // +} + +u16 DSPHLE_UcodeBase::AHBMRead16(u32 addr) +{ + // + return 0; +} + +u32 DSPHLE_UcodeBase::AHBMRead32(u32 addr) +{ + // + return 0; +} + +void DSPHLE_UcodeBase::AHBMWrite16(u32 addr, u16 val) +{ + // +} + +void DSPHLE_UcodeBase::AHBMWrite32(u32 addr, u32 val) +{ + // +} + +u16 DSPHLE_UcodeBase::GetSemaphore() +{ + // + return 0; +} + +void DSPHLE_UcodeBase::SetSemaphore(u16 val) +{ + // +} + +void DSPHLE_UcodeBase::ClearSemaphore(u16 val) +{ + // +} + +void DSPHLE_UcodeBase::MaskSemaphore(u16 val) +{ + // +} + +u16 DSPHLE_UcodeBase::RecvData(u8 index) +{ + // + return 0; +} + +void DSPHLE_UcodeBase::SendData(u8 index, u16 val) +{ + // +} + +void DSPHLE_UcodeBase::Run(u32 cycles) +{ + // +} + + +} \ No newline at end of file diff --git a/src/DSP_HLE/Ucode_Base.h b/src/DSP_HLE/Ucode_Base.h new file mode 100644 index 00000000..7e33e938 --- /dev/null +++ b/src/DSP_HLE/Ucode_Base.h @@ -0,0 +1,73 @@ +/* + Copyright 2016-2025 melonDS team + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#ifndef UCODE_BASE_H +#define UCODE_BASE_H + +#include + +#include "../types.h" +#include "../Savestate.h" + +namespace melonDS +{ + +class DSPHLE_UcodeBase +{ +public: + DSPHLE_UcodeBase(); + ~DSPHLE_UcodeBase(); + void Reset(); + void DoSavestate(Savestate* file); + + //void SetRecvDataHandler(u8 index, std::function func); + //void SetSemaphoreHandler(std::function func); + + bool SendDataIsEmpty(u8 index); + bool RecvDataIsEmpty(u8 index); + + u16 DMAChan0GetDstHigh(); + u16 AHBMGetDmaChannel(u16 index); + u16 AHBMGetDirection(u16 index); + u16 AHBMGetUnitSize(u16 index); + + u16 DataReadA32(u32 addr); + void DataWriteA32(u32 addr, u16 val); + u16 MMIORead(u16 addr); + void MMIOWrite(u16 addr, u16 val); + u16 ProgramRead(u32 addr); + void ProgramWrite(u32 addr, u16 val); + u16 AHBMRead16(u32 addr); + u32 AHBMRead32(u32 addr); + void AHBMWrite16(u32 addr, u16 val); + void AHBMWrite32(u32 addr, u32 val); + + u16 GetSemaphore(); + void SetSemaphore(u16 val); + void ClearSemaphore(u16 val); + void MaskSemaphore(u16 val); + + u16 RecvData(u8 index); + void SendData(u8 index, u16 val); + + void Run(u32 cycles); +}; + +} + +#endif // UCODE_BASE_H