aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ARCodeFile.cpp4
-rw-r--r--src/ARCodeFile.h3
-rw-r--r--src/AREngine.cpp4
-rw-r--r--src/AREngine.h3
-rw-r--r--src/ARM.cpp13
-rw-r--r--src/ARM.h21
-rw-r--r--src/ARMInterpreter.cpp7
-rw-r--r--src/ARMInterpreter.h3
-rw-r--r--src/ARMInterpreter_ALU.cpp2
-rw-r--r--src/ARMInterpreter_ALU.h3
-rw-r--r--src/ARMInterpreter_Branch.cpp5
-rw-r--r--src/ARMInterpreter_Branch.h3
-rw-r--r--src/ARMInterpreter_LoadStore.cpp2
-rw-r--r--src/ARMInterpreter_LoadStore.h2
-rw-r--r--src/ARMJIT.cpp34
-rw-r--r--src/ARMJIT.h8
-rw-r--r--src/ARMJIT_A64/ARMJIT_ALU.cpp4
-rw-r--r--src/ARMJIT_A64/ARMJIT_Branch.cpp2
-rw-r--r--src/ARMJIT_A64/ARMJIT_Compiler.cpp4
-rw-r--r--src/ARMJIT_A64/ARMJIT_Compiler.h2
-rw-r--r--src/ARMJIT_A64/ARMJIT_LoadStore.cpp4
-rw-r--r--src/ARMJIT_Internal.h4
-rw-r--r--src/ARMJIT_Memory.cpp20
-rw-r--r--src/ARMJIT_Memory.h17
-rw-r--r--src/ARMJIT_RegisterCache.h3
-rw-r--r--src/ARMJIT_x64/ARMJIT_ALU.cpp4
-rw-r--r--src/ARMJIT_x64/ARMJIT_Branch.cpp2
-rw-r--r--src/ARMJIT_x64/ARMJIT_Compiler.cpp5
-rw-r--r--src/ARMJIT_x64/ARMJIT_Compiler.h6
-rw-r--r--src/ARMJIT_x64/ARMJIT_GenOffsets.cpp2
-rw-r--r--src/ARMJIT_x64/ARMJIT_LoadStore.cpp4
-rw-r--r--src/ARM_InstrInfo.cpp2
-rw-r--r--src/ARM_InstrInfo.h2
-rw-r--r--src/CP15.cpp3
-rw-r--r--src/CRC32.cpp4
-rw-r--r--src/CRC32.h3
-rw-r--r--src/DMA.cpp6
-rw-r--r--src/DMA.h8
-rw-r--r--src/DMA_Timings.cpp2
-rw-r--r--src/DMA_Timings.h2
-rw-r--r--src/DSi.cpp4
-rw-r--r--src/DSi.h3
-rw-r--r--src/DSi_AES.cpp4
-rw-r--r--src/DSi_AES.h3
-rw-r--r--src/DSi_Camera.cpp4
-rw-r--r--src/DSi_Camera.h3
-rw-r--r--src/DSi_DSP.cpp4
-rw-r--r--src/DSi_DSP.h3
-rw-r--r--src/DSi_I2C.cpp4
-rw-r--r--src/DSi_I2C.h3
-rw-r--r--src/DSi_NAND.cpp4
-rw-r--r--src/DSi_NAND.h2
-rw-r--r--src/DSi_NDMA.cpp6
-rw-r--r--src/DSi_NDMA.h8
-rw-r--r--src/DSi_NWifi.cpp5
-rw-r--r--src/DSi_NWifi.h3
-rw-r--r--src/DSi_SD.cpp4
-rw-r--r--src/DSi_SD.h3
-rw-r--r--src/DSi_SPI_TSC.cpp4
-rw-r--r--src/DSi_SPI_TSC.h3
-rw-r--r--src/DSi_TMD.h2
-rw-r--r--src/FATIO.cpp6
-rw-r--r--src/FATIO.h4
-rw-r--r--src/FATStorage.cpp4
-rw-r--r--src/FATStorage.h4
-rw-r--r--src/FIFO.h3
-rw-r--r--src/FreeBIOS.cpp5
-rw-r--r--src/FreeBIOS.h3
-rw-r--r--src/GBACart.cpp4
-rw-r--r--src/GBACart.h2
-rw-r--r--src/GPU.cpp14
-rw-r--r--src/GPU.h16
-rw-r--r--src/GPU2D.cpp6
-rw-r--r--src/GPU2D.h8
-rw-r--r--src/GPU2D_Soft.cpp12
-rw-r--r--src/GPU2D_Soft.h9
-rw-r--r--src/GPU3D.cpp5
-rw-r--r--src/GPU3D.h8
-rw-r--r--src/GPU3D_OpenGL.cpp8
-rw-r--r--src/GPU3D_OpenGL.h13
-rw-r--r--src/GPU3D_OpenGL_shaders.h5
-rw-r--r--src/GPU3D_Soft.cpp7
-rw-r--r--src/GPU3D_Soft.h8
-rw-r--r--src/GPU_OpenGL.cpp8
-rw-r--r--src/GPU_OpenGL.h8
-rw-r--r--src/GPU_OpenGL_shaders.h3
-rw-r--r--src/JitBlock.h2
-rw-r--r--src/NDS.cpp12
-rw-r--r--src/NDS.h15
-rw-r--r--src/NDSCart.cpp4
-rw-r--r--src/NDSCart.h2
-rw-r--r--src/NDS_Header.h3
-rw-r--r--src/NonStupidBitfield.h3
-rw-r--r--src/OpenGLSupport.cpp5
-rw-r--r--src/OpenGLSupport.h3
-rw-r--r--src/Platform.h3
-rw-r--r--src/ROMList.cpp4
-rw-r--r--src/ROMList.h3
-rw-r--r--src/RTC.cpp4
-rw-r--r--src/RTC.h3
-rw-r--r--src/SPI.cpp4
-rw-r--r--src/SPI.h3
-rw-r--r--src/SPI_Firmware.cpp4
-rw-r--r--src/SPI_Firmware.h3
-rw-r--r--src/SPU.cpp4
-rw-r--r--src/SPU.h3
-rw-r--r--src/Savestate.cpp4
-rw-r--r--src/Savestate.h3
-rw-r--r--src/TinyVector.h2
-rw-r--r--src/Wifi.cpp4
-rw-r--r--src/Wifi.h3
-rw-r--r--src/WifiAP.cpp4
-rw-r--r--src/WifiAP.h3
-rw-r--r--src/debug/GdbArch.h1
-rw-r--r--src/debug/GdbCmds.cpp1
-rw-r--r--src/debug/GdbProto.cpp1
-rw-r--r--src/debug/GdbProto.h1
-rw-r--r--src/debug/GdbStub.cpp1
-rw-r--r--src/debug/GdbStub.h1
-rw-r--r--src/debug/hexutil.h3
-rw-r--r--src/dolphin/Arm64Emitter.h2
-rw-r--r--src/dolphin/ArmCommon.h2
-rw-r--r--src/dolphin/BitSet.h10
-rw-r--r--src/dolphin/MathUtil.h4
-rw-r--r--src/dolphin/x64ABI.cpp6
-rw-r--r--src/dolphin/x64CPUDetect.cpp2
-rw-r--r--src/dolphin/x64Emitter.cpp2
-rw-r--r--src/dolphin/x64Emitter.h2
-rw-r--r--src/frontend/FrontendUtil.h1
-rw-r--r--src/frontend/Util_Audio.cpp1
-rw-r--r--src/frontend/duckstation/gl/context.h1
-rw-r--r--src/frontend/duckstation/gl/context_agl.h1
-rw-r--r--src/frontend/duckstation/gl/context_wgl.cpp1
-rw-r--r--src/frontend/duckstation/gl/x11_window.h1
-rw-r--r--src/frontend/duckstation/window_info.h4
-rw-r--r--src/frontend/mic_blow.h4
-rw-r--r--src/frontend/qt_sdl/ArchiveUtil.cpp1
-rw-r--r--src/frontend/qt_sdl/ArchiveUtil.h1
-rw-r--r--src/frontend/qt_sdl/AudioInOut.cpp1
-rw-r--r--src/frontend/qt_sdl/AudioSettingsDialog.cpp1
-rw-r--r--src/frontend/qt_sdl/CLI.cpp4
-rw-r--r--src/frontend/qt_sdl/CameraManager.cpp1
-rw-r--r--src/frontend/qt_sdl/CameraManager.h18
-rw-r--r--src/frontend/qt_sdl/CameraSettingsDialog.cpp1
-rw-r--r--src/frontend/qt_sdl/CheatsDialog.cpp1
-rw-r--r--src/frontend/qt_sdl/CheatsDialog.h6
-rw-r--r--src/frontend/qt_sdl/Config.cpp1
-rw-r--r--src/frontend/qt_sdl/EmuSettingsDialog.cpp3
-rw-r--r--src/frontend/qt_sdl/FirmwareSettingsDialog.cpp2
-rw-r--r--src/frontend/qt_sdl/Input.cpp1
-rw-r--r--src/frontend/qt_sdl/Input.h1
-rw-r--r--src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp1
-rw-r--r--src/frontend/qt_sdl/InputConfig/MapButton.h2
-rw-r--r--src/frontend/qt_sdl/LAN_PCap.cpp1
-rw-r--r--src/frontend/qt_sdl/LAN_PCap.h1
-rw-r--r--src/frontend/qt_sdl/LAN_Socket.cpp1
-rw-r--r--src/frontend/qt_sdl/LAN_Socket.h1
-rw-r--r--src/frontend/qt_sdl/LocalMP.cpp3
-rw-r--r--src/frontend/qt_sdl/LocalMP.h1
-rw-r--r--src/frontend/qt_sdl/OSD.cpp2
-rw-r--r--src/frontend/qt_sdl/OSD.h3
-rw-r--r--src/frontend/qt_sdl/PathSettingsDialog.cpp2
-rw-r--r--src/frontend/qt_sdl/Platform.cpp2
-rw-r--r--src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp2
-rw-r--r--src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h2
-rw-r--r--src/frontend/qt_sdl/RAMInfoDialog.cpp1
-rw-r--r--src/frontend/qt_sdl/RAMInfoDialog.h22
-rw-r--r--src/frontend/qt_sdl/ROMInfoDialog.cpp2
-rw-r--r--src/frontend/qt_sdl/ROMInfoDialog.h2
-rw-r--r--src/frontend/qt_sdl/ROMManager.cpp3
-rw-r--r--src/frontend/qt_sdl/ROMManager.h1
-rw-r--r--src/frontend/qt_sdl/SaveManager.cpp3
-rw-r--r--src/frontend/qt_sdl/SaveManager.h16
-rw-r--r--src/frontend/qt_sdl/TitleManagerDialog.cpp3
-rw-r--r--src/frontend/qt_sdl/TitleManagerDialog.h18
-rw-r--r--src/frontend/qt_sdl/main.cpp4
-rw-r--r--src/melonDLDI.h3
-rw-r--r--src/types.h3
178 files changed, 528 insertions, 267 deletions
diff --git a/src/ARCodeFile.cpp b/src/ARCodeFile.cpp
index 595df7d..602a2e7 100644
--- a/src/ARCodeFile.cpp
+++ b/src/ARCodeFile.cpp
@@ -21,6 +21,8 @@
#include "ARCodeFile.h"
#include "Platform.h"
+namespace melonDS
+{
using namespace Platform;
// TODO: import codes from other sources (usrcheat.dat, ...)
@@ -182,3 +184,5 @@ bool ARCodeFile::Save()
CloseFile(f);
return true;
}
+
+} \ No newline at end of file
diff --git a/src/ARCodeFile.h b/src/ARCodeFile.h
index 53b2f75..11e71ef 100644
--- a/src/ARCodeFile.h
+++ b/src/ARCodeFile.h
@@ -24,6 +24,8 @@
#include <vector>
#include "types.h"
+namespace melonDS
+{
struct ARCode
{
std::string Name;
@@ -59,4 +61,5 @@ private:
std::string Filename;
};
+}
#endif // ARCODEFILE_H
diff --git a/src/AREngine.cpp b/src/AREngine.cpp
index c8888ac..1d992b8 100644
--- a/src/AREngine.cpp
+++ b/src/AREngine.cpp
@@ -23,6 +23,9 @@
#include "AREngine.h"
#include "Platform.h"
+namespace melonDS
+{
+
using Platform::Log;
using Platform::LogLevel;
@@ -429,3 +432,4 @@ void AREngine::RunCheats()
}
}
}
+}
diff --git a/src/AREngine.h b/src/AREngine.h
index 8557eb7..a6926ab 100644
--- a/src/AREngine.h
+++ b/src/AREngine.h
@@ -21,6 +21,8 @@
#include "ARCodeFile.h"
+namespace melonDS
+{
class AREngine
{
public:
@@ -45,4 +47,5 @@ private:
void (*BusWrite32)(u32 addr, u32 val);
};
+}
#endif // ARENGINE_H
diff --git a/src/ARM.cpp b/src/ARM.cpp
index a361d77..a1485e9 100644
--- a/src/ARM.cpp
+++ b/src/ARM.cpp
@@ -28,6 +28,8 @@
#include "GPU.h"
#include "ARMJIT_Memory.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -104,7 +106,7 @@ const u32 ARM::ConditionTable[16] =
0x0000 // NE
};
-ARM::ARM(u32 num, ARMJIT::ARMJIT& jit, Melon::GPU& gpu) :
+ARM::ARM(u32 num, ARMJIT& jit, melonDS::GPU& gpu) :
#ifdef GDBSTUB_ENABLED
GdbStub(this, Platform::GetConfigInt(num ? Platform::GdbPortARM7 : Platform::GdbPortARM9)),
#endif
@@ -128,14 +130,14 @@ ARM::~ARM()
// dorp
}
-ARMv5::ARMv5(ARMJIT::ARMJIT& jit, Melon::GPU& gpu) : ARM(0, jit, gpu)
+ARMv5::ARMv5(ARMJIT& jit, melonDS::GPU& gpu) : ARM(0, jit, gpu)
{
DTCM = JIT.Memory.GetARM9DTCM();
PU_Map = PU_PrivMap;
}
-ARMv4::ARMv4(ARMJIT::ARMJIT& jit, Melon::GPU& gpu) : ARM(1, jit, gpu)
+ARMv4::ARMv4(ARMJIT& jit, melonDS::GPU& gpu) : ARM(1, jit, gpu)
{
//
}
@@ -749,7 +751,7 @@ void ARMv5::ExecuteJIT()
return;
}
- ARMJIT::JitBlockEntry block = JIT.LookUpBlock(0, FastBlockLookup,
+ JitBlockEntry block = JIT.LookUpBlock(0, FastBlockLookup,
instrAddr - FastBlockLookupStart, instrAddr);
if (block)
ARM_Dispatch(this, block);
@@ -906,7 +908,7 @@ void ARMv4::ExecuteJIT()
return;
}
- ARMJIT::JitBlockEntry block = JIT.LookUpBlock(1, FastBlockLookup,
+ JitBlockEntry block = JIT.LookUpBlock(1, FastBlockLookup,
instrAddr - FastBlockLookupStart, instrAddr);
if (block)
ARM_Dispatch(this, block);
@@ -1191,5 +1193,6 @@ u32 ARMv5::ReadMem(u32 addr, int size)
return ARM::ReadMem(addr, size);
}
+}
#endif
diff --git a/src/ARM.h b/src/ARM.h
index c8f596a..9a99a07 100644
--- a/src/ARM.h
+++ b/src/ARM.h
@@ -28,6 +28,8 @@
#include "debug/GdbStub.h"
#endif
+namespace melonDS
+{
inline u32 ROR(u32 x, u32 n)
{
return (x >> (n&0x1F)) | (x << ((32-n)&0x1F));
@@ -42,15 +44,9 @@ enum
const u32 ITCMPhysicalSize = 0x8000;
const u32 DTCMPhysicalSize = 0x4000;
-namespace ARMJIT
-{
+
class ARMJIT;
-}
-namespace Melon
-{
class GPU;
-}
-
class ARMJIT_Memory;
class ARM
@@ -59,7 +55,7 @@ class ARM
#endif
{
public:
- ARM(u32 num, ARMJIT::ARMJIT& jit, Melon::GPU& gpu);
+ ARM(u32 num, ARMJIT& jit, GPU& gpu);
virtual ~ARM(); // destroy shit
virtual void Reset();
@@ -190,7 +186,7 @@ public:
Gdb::GdbStub GdbStub;
#endif
- ARMJIT::ARMJIT& JIT;
+ ARMJIT& JIT;
protected:
u8 (*BusRead8)(u32 addr);
u16 (*BusRead16)(u32 addr);
@@ -222,13 +218,13 @@ protected:
void GdbCheckB();
void GdbCheckC();
private:
- Melon::GPU& GPU;
+ melonDS::GPU& GPU;
};
class ARMv5 : public ARM
{
public:
- ARMv5(ARMJIT::ARMJIT& jit, Melon::GPU& gpu);
+ ARMv5(ARMJIT& jit, melonDS::GPU& gpu);
~ARMv5();
void Reset() override;
@@ -372,7 +368,7 @@ public:
class ARMv4 : public ARM
{
public:
- ARMv4(ARMJIT::ARMJIT& jit, Melon::GPU& gpu);
+ ARMv4(ARMJIT& jit, melonDS::GPU& gpu);
void Reset() override;
@@ -541,4 +537,5 @@ extern ARMv4* ARM7;
}
+}
#endif // ARM_H
diff --git a/src/ARMInterpreter.cpp b/src/ARMInterpreter.cpp
index 7aabf4c..ff73e23 100644
--- a/src/ARMInterpreter.cpp
+++ b/src/ARMInterpreter.cpp
@@ -24,15 +24,14 @@
#include "ARMInterpreter_LoadStore.h"
#include "Platform.h"
-using Platform::Log;
-using Platform::LogLevel;
-
#ifdef GDBSTUB_ENABLED
#include "debug/GdbStub.h"
#endif
-namespace ARMInterpreter
+namespace melonDS::ARMInterpreter
{
+ using Platform::Log;
+ using Platform::LogLevel;
void A_UNK(ARM* cpu)
diff --git a/src/ARMInterpreter.h b/src/ARMInterpreter.h
index 38225f0..cff4821 100644
--- a/src/ARMInterpreter.h
+++ b/src/ARMInterpreter.h
@@ -22,6 +22,8 @@
#include "types.h"
#include "ARM.h"
+namespace melonDS
+{
namespace ARMInterpreter
{
@@ -41,4 +43,5 @@ void A_BLX_IMM(ARM* cpu); // I'm a special one look at me
}
+}
#endif // ARMINTERPRETER_H
diff --git a/src/ARMInterpreter_ALU.cpp b/src/ARMInterpreter_ALU.cpp
index 9fa44db..313f764 100644
--- a/src/ARMInterpreter_ALU.cpp
+++ b/src/ARMInterpreter_ALU.cpp
@@ -19,7 +19,7 @@
#include <stdio.h>
#include "ARM.h"
-namespace ARMInterpreter
+namespace melonDS::ARMInterpreter
{
inline bool CarryAdd(u32 a, u32 b)
diff --git a/src/ARMInterpreter_ALU.h b/src/ARMInterpreter_ALU.h
index 202d6b0..6998b63 100644
--- a/src/ARMInterpreter_ALU.h
+++ b/src/ARMInterpreter_ALU.h
@@ -19,6 +19,8 @@
#ifndef ARMINTERPRETER_ALU_H
#define ARMINTERPRETER_ALU_H
+namespace melonDS
+{
namespace ARMInterpreter
{
@@ -134,4 +136,5 @@ void T_ADD_SP(ARM* cpu);
}
+}
#endif
diff --git a/src/ARMInterpreter_Branch.cpp b/src/ARMInterpreter_Branch.cpp
index ece783c..015f568 100644
--- a/src/ARMInterpreter_Branch.cpp
+++ b/src/ARMInterpreter_Branch.cpp
@@ -19,12 +19,11 @@
#include "ARM.h"
#include "Platform.h"
+namespace melonDS::ARMInterpreter
+{
using Platform::Log;
using Platform::LogLevel;
-namespace ARMInterpreter
-{
-
void A_B(ARM* cpu)
{
diff --git a/src/ARMInterpreter_Branch.h b/src/ARMInterpreter_Branch.h
index 3db6f40..51a561c 100644
--- a/src/ARMInterpreter_Branch.h
+++ b/src/ARMInterpreter_Branch.h
@@ -19,6 +19,8 @@
#ifndef ARMINTERPRETER_BRANCH_H
#define ARMINTERPRETER_BRANCH_H
+namespace melonDS
+{
namespace ARMInterpreter
{
@@ -36,4 +38,5 @@ void T_BL_LONG_2(ARM* cpu);
}
+}
#endif
diff --git a/src/ARMInterpreter_LoadStore.cpp b/src/ARMInterpreter_LoadStore.cpp
index 3b4b35d..91acaac 100644
--- a/src/ARMInterpreter_LoadStore.cpp
+++ b/src/ARMInterpreter_LoadStore.cpp
@@ -20,7 +20,7 @@
#include "ARM.h"
-namespace ARMInterpreter
+namespace melonDS::ARMInterpreter
{
diff --git a/src/ARMInterpreter_LoadStore.h b/src/ARMInterpreter_LoadStore.h
index 9016cfa..32d6e4d 100644
--- a/src/ARMInterpreter_LoadStore.h
+++ b/src/ARMInterpreter_LoadStore.h
@@ -19,7 +19,7 @@
#ifndef ARMINTERPRETER_LOADSTORE_H
#define ARMINTERPRETER_LOADSTORE_H
-namespace ARMInterpreter
+namespace melonDS::ARMInterpreter
{
#define A_PROTO_WB_LDRSTR(x) \
diff --git a/src/ARMJIT.cpp b/src/ARMJIT.cpp
index c551213..4544582 100644
--- a/src/ARMJIT.cpp
+++ b/src/ARMJIT.cpp
@@ -43,17 +43,17 @@
#include "Wifi.h"
#include "NDSCart.h"
#include "Platform.h"
+#include "ARMJIT_x64/ARMJIT_Offsets.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
-#include "ARMJIT_x64/ARMJIT_Offsets.h"
static_assert(offsetof(ARM, CPSR) == ARM_CPSR_offset, "");
static_assert(offsetof(ARM, Cycles) == ARM_Cycles_offset, "");
static_assert(offsetof(ARM, StopExecution) == ARM_StopExecution_offset, "");
-namespace ARMJIT
-{
#define JIT_DEBUGPRINT(msg, ...)
//#define JIT_DEBUGPRINT(msg, ...) Platform::Log(Platform::LogLevel::Debug, msg, ## __VA_ARGS__)
@@ -1056,20 +1056,20 @@ bool ARMJIT::SetupExecutableRegion(u32 num, u32 blockAddr, u64*& entry, u32& sta
return false;
}
-template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_MainRAM>(u32);
-template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_MainRAM>(u32);
-template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_SharedWRAM>(u32);
-template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_SharedWRAM>(u32);
-template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_WRAM7>(u32);
-template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_VWRAM>(u32);
-template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_VRAM>(u32);
-template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_ITCM>(u32);
-template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_NewSharedWRAM_A>(u32);
-template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_NewSharedWRAM_A>(u32);
-template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_NewSharedWRAM_B>(u32);
-template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_NewSharedWRAM_B>(u32);
-template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_NewSharedWRAM_C>(u32);
-template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_NewSharedWRAM_C>(u32);
+template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_MainRAM>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_MainRAM>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_SharedWRAM>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_SharedWRAM>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_WRAM7>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_VWRAM>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_VRAM>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_ITCM>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_NewSharedWRAM_A>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_NewSharedWRAM_A>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_NewSharedWRAM_B>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_NewSharedWRAM_B>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<0, ARMJIT_Memory::memregion_NewSharedWRAM_C>(u32) noexcept;
+template void ARMJIT::CheckAndInvalidate<1, ARMJIT_Memory::memregion_NewSharedWRAM_C>(u32) noexcept;
void ARMJIT::ResetBlockCache() noexcept
{
diff --git a/src/ARMJIT.h b/src/ARMJIT.h
index 074e2a1..4191824 100644
--- a/src/ARMJIT.h
+++ b/src/ARMJIT.h
@@ -31,10 +31,10 @@
#include "ARMJIT_Compiler.h"
+namespace melonDS
+{
class ARM;
-namespace ARMJIT
-{
class JitBlock;
class ARMJIT
{
@@ -74,7 +74,7 @@ public:
TinyVector<u32> InvalidLiterals {};
private:
- friend class ::ARMJIT_Memory;
+ friend class ARMJIT_Memory;
void blockSanityCheck(u32 num, u32 blockAddr, JitBlockEntry entry) noexcept;
void RetireJitBlock(JitBlock* block) noexcept;
@@ -160,6 +160,6 @@ private:
}
// Defined in assembly
-extern "C" void ARM_Dispatch(ARM* cpu, ARMJIT::JitBlockEntry entry);
+extern "C" void ARM_Dispatch(melonDS::ARM* cpu, melonDS::JitBlockEntry entry);
#endif
diff --git a/src/ARMJIT_A64/ARMJIT_ALU.cpp b/src/ARMJIT_A64/ARMJIT_ALU.cpp
index 3d52f28..b25bcaa 100644
--- a/src/ARMJIT_A64/ARMJIT_ALU.cpp
+++ b/src/ARMJIT_A64/ARMJIT_ALU.cpp
@@ -20,7 +20,7 @@
using namespace Arm64Gen;
-namespace ARMJIT
+namespace melonDS
{
void Compiler::Comp_RegShiftReg(int op, bool S, Op2& op2, ARM64Reg rs)
@@ -480,7 +480,7 @@ void Compiler::A_Comp_GetOp2(bool S, Op2& op2)
Comp_AddCycles_C();
u32 shift = (CurInstr.Instr >> 7) & 0x1E;
- u32 imm = ::ROR(CurInstr.Instr & 0xFF, shift);
+ u32 imm = melonDS::ROR(CurInstr.Instr & 0xFF, shift);
if (S && shift && (CurInstr.SetFlags & 0x2))
{
diff --git a/src/ARMJIT_A64/ARMJIT_Branch.cpp b/src/ARMJIT_A64/ARMJIT_Branch.cpp
index c7b6e98..d18a0e0 100644
--- a/src/ARMJIT_A64/ARMJIT_Branch.cpp
+++ b/src/ARMJIT_A64/ARMJIT_Branch.cpp
@@ -23,7 +23,7 @@ using namespace Arm64Gen;
// hack
const int kCodeCacheTiming = 3;
-namespace ARMJIT
+namespace melonDS
{
template <typename T>
diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.cpp b/src/ARMJIT_A64/ARMJIT_Compiler.cpp
index 90940b0..1b03758 100644
--- a/src/ARMJIT_A64/ARMJIT_Compiler.cpp
+++ b/src/ARMJIT_A64/ARMJIT_Compiler.cpp
@@ -39,7 +39,7 @@ using namespace Arm64Gen;
extern "C" void ARM_Ret();
-namespace ARMJIT
+namespace melonDS
{
/*
@@ -106,7 +106,7 @@ void Compiler::A_Comp_MSR()
if (CurInstr.Instr & (1 << 25))
{
val = W0;
- MOVI2R(val, ::ROR((CurInstr.Instr & 0xFF), ((CurInstr.Instr >> 7) & 0x1E)));
+ MOVI2R(val, melonDS::ROR((CurInstr.Instr & 0xFF), ((CurInstr.Instr >> 7) & 0x1E)));
}
else
{
diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.h b/src/ARMJIT_A64/ARMJIT_Compiler.h
index 1f79f3d..d1e5c44 100644
--- a/src/ARMJIT_A64/ARMJIT_Compiler.h
+++ b/src/ARMJIT_A64/ARMJIT_Compiler.h
@@ -28,7 +28,7 @@
#include <unordered_map>
-namespace ARMJIT
+namespace melonDS
{
class ARMJIT;
const Arm64Gen::ARM64Reg RMemBase = Arm64Gen::X26;
diff --git a/src/ARMJIT_A64/ARMJIT_LoadStore.cpp b/src/ARMJIT_A64/ARMJIT_LoadStore.cpp
index a779a72..93cd75e 100644
--- a/src/ARMJIT_A64/ARMJIT_LoadStore.cpp
+++ b/src/ARMJIT_A64/ARMJIT_LoadStore.cpp
@@ -24,7 +24,7 @@
using namespace Arm64Gen;
-namespace ARMJIT
+namespace melonDS
{
bool Compiler::IsJITFault(u8* pc)
@@ -79,7 +79,7 @@ bool Compiler::Comp_MemLoadLiteral(int size, bool signExtend, int rd, u32 addr)
if (size == 32)
{
CurCPU->DataRead32(addr & ~0x3, &val);
- val = ::ROR(val, (addr & 0x3) << 3);
+ val = melonDS::ROR(val, (addr & 0x3) << 3);
}
else if (size == 16)
{
diff --git a/src/ARMJIT_Internal.h b/src/ARMJIT_Internal.h
index 7a8eb6b..72d40a5 100644
--- a/src/ARMJIT_Internal.h
+++ b/src/ARMJIT_Internal.h
@@ -28,13 +28,13 @@
#include "JitBlock.h"
#include "TinyVector.h"
+namespace melonDS
+{
class ARM;
class ARMv5;
// here lands everything which doesn't fit into ARMJIT.h
// where it would be included by pretty much everything
-namespace ARMJIT
-{
enum
{
diff --git a/src/ARMJIT_Memory.cpp b/src/ARMJIT_Memory.cpp
index 361a1ed..7ed9b8d 100644
--- a/src/ARMJIT_Memory.cpp
+++ b/src/ARMJIT_Memory.cpp
@@ -49,9 +49,6 @@
#include <stdlib.h>
-using Platform::Log;
-using Platform::LogLevel;
-
/*
We're handling fastmem here.
@@ -100,6 +97,12 @@ using Platform::LogLevel;
#endif
#endif
+namespace melonDS
+{
+
+using Platform::Log;
+using Platform::LogLevel;
+
#if defined(__ANDROID__)
#define ASHMEM_DEVICE "/dev/ashmem"
#endif
@@ -562,7 +565,7 @@ bool ARMJIT_Memory::MapAtAddress(u32 addr) noexcept
}
#endif
- ARMJIT::AddressRange* range = JIT.CodeMemRegions[region] + memoryOffset / 512;
+ AddressRange* range = JIT.CodeMemRegions[region] + memoryOffset / 512;
// this overcomplicated piece of code basically just finds whole pieces of code memory
// which can be mapped/protected
@@ -580,9 +583,9 @@ bool ARMJIT_Memory::MapAtAddress(u32 addr) noexcept
else
{
u32 sectionOffset = offset;
- bool hasCode = isExecutable && ARMJIT::PageContainsCode(&range[offset / 512]);
+ bool hasCode = isExecutable && PageContainsCode(&range[offset / 512]);
while (offset < mirrorSize
- && (!isExecutable || ARMJIT::PageContainsCode(&range[offset / 512]) == hasCode)
+ && (!isExecutable || PageContainsCode(&range[offset / 512]) == hasCode)
&& (!skipDTCM || mirrorStart + offset != NDS::ARM9->DTCMBase))
{
assert(states[(mirrorStart + offset) >> 12] == memstate_Unmapped);
@@ -617,7 +620,7 @@ bool ARMJIT_Memory::MapAtAddress(u32 addr) noexcept
return true;
}
-bool ARMJIT_Memory::FaultHandler(FaultDescription& faultDesc, ARMJIT::ARMJIT& jit)
+bool ARMJIT_Memory::FaultHandler(FaultDescription& faultDesc, ARMJIT& jit)
{
if (jit.JITCompiler.IsJITFault(faultDesc.FaultPC))
{
@@ -638,7 +641,7 @@ bool ARMJIT_Memory::FaultHandler(FaultDescription& faultDesc, ARMJIT::ARMJIT& ji
const u64 AddrSpaceSize = 0x100000000;
-ARMJIT_Memory::ARMJIT_Memory(ARMJIT::ARMJIT& jit) noexcept : JIT(jit)
+ARMJIT_Memory::ARMJIT_Memory(ARMJIT& jit) noexcept : JIT(jit)
{
#if defined(__SWITCH__)
MemoryBase = (u8*)aligned_alloc(0x1000, MemoryTotalSize);
@@ -1365,3 +1368,4 @@ void* ARMJIT_Memory::GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size) co
}
return NULL;
}
+} \ No newline at end of file
diff --git a/src/ARMJIT_Memory.h b/src/ARMJIT_Memory.h
index 1cf4f81..ed48437 100644
--- a/src/ARMJIT_Memory.h
+++ b/src/ARMJIT_Memory.h
@@ -42,11 +42,10 @@
#include "NDS.h"
#endif
-namespace ARMJIT
+namespace melonDS
{
class Compiler;
class ARMJIT;
-}
constexpr u32 RoundUp(u32 size) noexcept
{
@@ -97,7 +96,7 @@ public:
#ifdef JIT_ENABLED
public:
- explicit ARMJIT_Memory(ARMJIT::ARMJIT& jit) noexcept;
+ explicit ARMJIT_Memory(ARMJIT& jit) noexcept;
~ARMJIT_Memory() noexcept;
ARMJIT_Memory(const ARMJIT_Memory&) = delete;
ARMJIT_Memory(ARMJIT_Memory&&) = delete;
@@ -138,7 +137,7 @@ public:
void* GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size) const noexcept;
bool MapAtAddress(u32 addr) noexcept;
private:
- friend class ARMJIT::Compiler;
+ friend class Compiler;
struct Mapping
{
u32 Addr;
@@ -153,12 +152,12 @@ private:
u32 EmulatedFaultAddr;
u8* FaultPC;
};
- static bool FaultHandler(FaultDescription& faultDesc, ARMJIT::ARMJIT& jit);
+ static bool FaultHandler(FaultDescription& faultDesc, ARMJIT& jit);
bool MapIntoRange(u32 addr, u32 num, u32 offset, u32 size) noexcept;
bool UnmapFromRange(u32 addr, u32 num, u32 offset, u32 size) noexcept;
void SetCodeProtectionRange(u32 addr, u32 size, u32 num, int protection) noexcept;
- ARMJIT::ARMJIT& JIT;
+ ARMJIT& JIT;
void* FastMem9Start;
void* FastMem7Start;
u8* MemoryBase = nullptr;
@@ -178,10 +177,10 @@ private:
#endif
u8 MappingStatus9[1 << (32-12)] {};
u8 MappingStatus7[1 << (32-12)] {};
- ARMJIT::TinyVector<Mapping> Mappings[memregions_Count] {};
+ TinyVector<Mapping> Mappings[memregions_Count] {};
#else
public:
- explicit ARMJIT_Memory(ARMJIT::ARMJIT&) {};
+ explicit ARMJIT_Memory(ARMJIT&) {};
~ARMJIT_Memory() = default;
ARMJIT_Memory(const ARMJIT_Memory&) = delete;
ARMJIT_Memory(ARMJIT_Memory&&) = delete;
@@ -224,5 +223,5 @@ private:
std::array<u8, DSi::NWRAMSize> NWRAM_C {};
#endif
};
-
+}
#endif
diff --git a/src/ARMJIT_RegisterCache.h b/src/ARMJIT_RegisterCache.h
index 1610530..3cb0f79 100644
--- a/src/ARMJIT_RegisterCache.h
+++ b/src/ARMJIT_RegisterCache.h
@@ -27,10 +27,11 @@
#include <assert.h>
-namespace ARMJIT
+namespace melonDS
{
using Platform::Log;
using Platform::LogLevel;
+ using namespace Common;
// Imported inside the namespace so that other headers aren't polluted
template <typename T, typename Reg>
diff --git a/src/ARMJIT_x64/ARMJIT_ALU.cpp b/src/ARMJIT_x64/ARMJIT_ALU.cpp
index bdc17e8..69449ff 100644
--- a/src/ARMJIT_x64/ARMJIT_ALU.cpp
+++ b/src/ARMJIT_x64/ARMJIT_ALU.cpp
@@ -21,7 +21,7 @@
using namespace Gen;
-namespace ARMJIT
+namespace melonDS
{
// uses RSCRATCH3
@@ -129,7 +129,7 @@ OpArg Compiler::A_Comp_GetALUOp2(bool S, bool& carryUsed)
Comp_AddCycles_C();
u32 shift = (CurInstr.Instr >> 7) & 0x1E;
- u32 imm = ::ROR(CurInstr.Instr & 0xFF, shift);
+ u32 imm = melonDS::ROR(CurInstr.Instr & 0xFF, shift);
carryUsed = false;
if (S && shift)
diff --git a/src/ARMJIT_x64/ARMJIT_Branch.cpp b/src/ARMJIT_x64/ARMJIT_Branch.cpp
index ae7d1ae..5d76447 100644
--- a/src/ARMJIT_x64/ARMJIT_Branch.cpp
+++ b/src/ARMJIT_x64/ARMJIT_Branch.cpp
@@ -21,7 +21,7 @@
using namespace Gen;
-namespace ARMJIT
+namespace melonDS
{
template <typename T>
diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.cpp b/src/ARMJIT_x64/ARMJIT_Compiler.cpp
index 5506db7..9fc7237 100644
--- a/src/ARMJIT_x64/ARMJIT_Compiler.cpp
+++ b/src/ARMJIT_x64/ARMJIT_Compiler.cpp
@@ -34,10 +34,11 @@
#endif
using namespace Gen;
+using namespace Common;
extern "C" void ARM_Ret();
-namespace ARMJIT
+namespace melonDS
{
template <>
const X64Reg RegisterCache<Compiler, X64Reg>::NativeRegAllocOrder[] =
@@ -141,7 +142,7 @@ void Compiler::A_Comp_MSR()
Comp_AddCycles_C();
OpArg val = CurInstr.Instr & (1 << 25)
- ? Imm32(::ROR((CurInstr.Instr & 0xFF), ((CurInstr.Instr >> 7) & 0x1E)))
+ ? Imm32(melonDS::ROR((CurInstr.Instr & 0xFF), ((CurInstr.Instr >> 7) & 0x1E)))
: MapReg(CurInstr.A_Reg(0));
u32 mask = 0;
diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.h b/src/ARMJIT_x64/ARMJIT_Compiler.h
index 84efb35..f38a6c3 100644
--- a/src/ARMJIT_x64/ARMJIT_Compiler.h
+++ b/src/ARMJIT_x64/ARMJIT_Compiler.h
@@ -30,11 +30,11 @@
#include <unordered_map>
-class ARMJIT_Memory;
-namespace ARMJIT
+namespace melonDS
{
class ARMJIT;
+class ARMJIT_Memory;
const Gen::X64Reg RCPU = Gen::RBP;
const Gen::X64Reg RCPSR = Gen::R15;
@@ -172,7 +172,7 @@ public:
memop_SubtractOffset = 1 << 4
};
void Comp_MemAccess(int rd, int rn, const Op2& op2, int size, int flags);
- s32 Comp_MemAccessBlock(int rn, BitSet16 regs, bool store, bool preinc, bool decrement, bool usermode, bool skipLoadingRn);
+ s32 Comp_MemAccessBlock(int rn, Common::BitSet16 regs, bool store, bool preinc, bool decrement, bool usermode, bool skipLoadingRn);
bool Comp_MemLoadLiteral(int size, bool signExtend, int rd, u32 addr);
void Comp_ArithTriOp(void (Compiler::*op)(int, const Gen::OpArg&, const Gen::OpArg&),
diff --git a/src/ARMJIT_x64/ARMJIT_GenOffsets.cpp b/src/ARMJIT_x64/ARMJIT_GenOffsets.cpp
index 0961fdd..e2a74ee 100644
--- a/src/ARMJIT_x64/ARMJIT_GenOffsets.cpp
+++ b/src/ARMJIT_x64/ARMJIT_GenOffsets.cpp
@@ -17,7 +17,7 @@
*/
#include "../ARM.h"
-
+using namespace melonDS;
int main(int argc, char* argv[])
{
FILE* f = fopen("ARMJIT_Offsets.h", "w");
diff --git a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
index 1433429..9b7d865 100644
--- a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
+++ b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
@@ -21,7 +21,7 @@
using namespace Gen;
-namespace ARMJIT
+namespace melonDS
{
template <typename T>
@@ -85,7 +85,7 @@ bool Compiler::Comp_MemLoadLiteral(int size, bool signExtend, int rd, u32 addr)
if (size == 32)
{
CurCPU->DataRead32(addr & ~0x3, &val);
- val = ::ROR(val, (addr & 0x3) << 3);
+ val = melonDS::ROR(val, (addr & 0x3) << 3);
}
else if (size == 16)
{
diff --git a/src/ARM_InstrInfo.cpp b/src/ARM_InstrInfo.cpp
index ea9f681..d53c88f 100644
--- a/src/ARM_InstrInfo.cpp
+++ b/src/ARM_InstrInfo.cpp
@@ -22,7 +22,7 @@
#include "ARMJIT.h"
-namespace ARMInstrInfo
+namespace melonDS::ARMInstrInfo
{
#define ak(x) ((x) << 23)
diff --git a/src/ARM_InstrInfo.h b/src/ARM_InstrInfo.h
index 3442c9a..13f66b0 100644
--- a/src/ARM_InstrInfo.h
+++ b/src/ARM_InstrInfo.h
@@ -21,7 +21,7 @@
#include "types.h"
-namespace ARMInstrInfo
+namespace melonDS::ARMInstrInfo
{
// Instruction kinds, for faster dispatch
diff --git a/src/CP15.cpp b/src/CP15.cpp
index e8d8c1a..af23da3 100644
--- a/src/CP15.cpp
+++ b/src/CP15.cpp
@@ -25,6 +25,8 @@
#include "ARMJIT_Memory.h"
#include "ARMJIT.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -1031,3 +1033,4 @@ void ARMv5::GetCodeMemRegion(u32 addr, NDS::MemRegion* region)
GetMemRegion(addr, false, &CodeMem);
}
+}
diff --git a/src/CRC32.cpp b/src/CRC32.cpp
index 8afa3ba..0756c03 100644
--- a/src/CRC32.cpp
+++ b/src/CRC32.cpp
@@ -20,6 +20,8 @@
// http://www.codeproject.com/KB/recipes/crc32_large.aspx
+namespace melonDS
+{
constexpr u32 _reflect(u32 refl, char ch)
{
u32 value = 0;
@@ -62,3 +64,5 @@ u32 CRC32(const u8 *data, int len, u32 start)
return (crc ^ 0xFFFFFFFF);
}
+
+} \ No newline at end of file
diff --git a/src/CRC32.h b/src/CRC32.h
index 4a1034c..1187905 100644
--- a/src/CRC32.h
+++ b/src/CRC32.h
@@ -23,6 +23,9 @@
#include "types.h"
+namespace melonDS
+{
u32 CRC32(const u8* data, int len, u32 start=0);
+}
#endif // CRC32_H
diff --git a/src/DMA.cpp b/src/DMA.cpp
index 91f2345..8afc897 100644
--- a/src/DMA.cpp
+++ b/src/DMA.cpp
@@ -24,6 +24,8 @@
#include "DMA_Timings.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -47,7 +49,7 @@ using Platform::LogLevel;
// TODO: timings are nonseq when address is fixed/decrementing
-DMA::DMA(u32 cpu, u32 num, Melon::GPU& gpu) :
+DMA::DMA(u32 cpu, u32 num, melonDS::GPU& gpu) :
CPU(cpu),
Num(num),
GPU(gpu)
@@ -714,3 +716,5 @@ void DMA::Run()
template void DMA::Run<0>();
template void DMA::Run<1>();
+
+} \ No newline at end of file
diff --git a/src/DMA.h b/src/DMA.h
index af8b517..5535661 100644
--- a/src/DMA.h
+++ b/src/DMA.h
@@ -24,15 +24,14 @@
#include "Savestate.h"
#include "DMA_Timings.h"
-namespace Melon
+namespace melonDS
{
class GPU;
-}
class DMA
{
public:
- DMA(u32 cpu, u32 num, Melon::GPU& gpu);
+ DMA(u32 cpu, u32 num, GPU& gpu);
~DMA() = default;
void Reset();
@@ -84,7 +83,7 @@ public:
u32 Cnt {};
private:
- Melon::GPU& GPU;
+ melonDS::GPU& GPU;
u32 CPU {};
u32 Num {};
@@ -109,4 +108,5 @@ private:
std::array<u8, 256> MRAMBurstTable;
};
+}
#endif
diff --git a/src/DMA_Timings.cpp b/src/DMA_Timings.cpp
index cea3282..912e4e2 100644
--- a/src/DMA_Timings.cpp
+++ b/src/DMA_Timings.cpp
@@ -19,7 +19,7 @@
#include "DMA_Timings.h"
#include "types.h"
-namespace DMATiming
+namespace melonDS::DMATiming
{
// DMA timing tables
diff --git a/src/DMA_Timings.h b/src/DMA_Timings.h
index faf2e9c..63dc467 100644
--- a/src/DMA_Timings.h
+++ b/src/DMA_Timings.h
@@ -22,7 +22,7 @@
#include <array>
#include "types.h"
-namespace DMATiming
+namespace melonDS::DMATiming
{
// DMA timing tables
diff --git a/src/DSi.cpp b/src/DSi.cpp
index 5c4b542..351d5ed 100644
--- a/src/DSi.cpp
+++ b/src/DSi.cpp
@@ -41,6 +41,8 @@
#include "tiny-AES-c/aes.hpp"
+namespace melonDS
+{
using namespace Platform;
namespace DSi
@@ -3143,3 +3145,5 @@ void ARM7IOWrite32(u32 addr, u32 val)
}
}
+
+} \ No newline at end of file
diff --git a/src/DSi.h b/src/DSi.h
index 66a4e80..ac6bf77 100644
--- a/src/DSi.h
+++ b/src/DSi.h
@@ -22,6 +22,8 @@
#include "NDS.h"
#include "DSi_SD.h"
+namespace melonDS
+{
class DSi_I2CHost;
class DSi_CamModule;
class DSi_AES;
@@ -126,4 +128,5 @@ void ARM7IOWrite32(u32 addr, u32 val);
}
+}
#endif // DSI_H
diff --git a/src/DSi_AES.cpp b/src/DSi_AES.cpp
index b1d89bd..a29e43f 100644
--- a/src/DSi_AES.cpp
+++ b/src/DSi_AES.cpp
@@ -23,6 +23,8 @@
#include "DSi_AES.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -572,3 +574,5 @@ void DSi_AES::WriteKeyY(u32 slot, u32 offset, u32 val, u32 mask)
DeriveNormalKey(KeyX[slot], KeyY[slot], KeyNormal[slot]);
}
}
+
+} \ No newline at end of file
diff --git a/src/DSi_AES.h b/src/DSi_AES.h
index 1f1c6bf..9c0a63f 100644
--- a/src/DSi_AES.h
+++ b/src/DSi_AES.h
@@ -24,6 +24,8 @@
#include "FIFO.h"
#include "tiny-AES-c/aes.hpp"
+namespace melonDS
+{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
#if defined(__GNUC__) && (__GNUC__ >= 11) // gcc 11.*
@@ -108,4 +110,5 @@ private:
void ProcessBlock_CTR();
};
+}
#endif // DSI_AES_H
diff --git a/src/DSi_Camera.cpp b/src/DSi_Camera.cpp
index 2b259c5..708875c 100644
--- a/src/DSi_Camera.cpp
+++ b/src/DSi_Camera.cpp
@@ -23,6 +23,8 @@
#include "DSi_Camera.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -793,3 +795,5 @@ void DSi_Camera::InputFrame(u32* data, int width, int height, bool rgb)
}
}
}
+
+} \ No newline at end of file
diff --git a/src/DSi_Camera.h b/src/DSi_Camera.h
index c3165b3..8a62e47 100644
--- a/src/DSi_Camera.h
+++ b/src/DSi_Camera.h
@@ -23,6 +23,8 @@
#include "Savestate.h"
#include "DSi_I2C.h"
+namespace melonDS
+{
class DSi_CamModule;
class DSi_Camera : public DSi_I2CDevice
@@ -121,4 +123,5 @@ private:
static const u32 kTransferStart;
};
+}
#endif // DSI_CAMERA_H
diff --git a/src/DSi_DSP.cpp b/src/DSi_DSP.cpp
index 82a52ae..61d2b16 100644
--- a/src/DSi_DSP.cpp
+++ b/src/DSi_DSP.cpp
@@ -24,6 +24,8 @@
#include "NDS.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -593,3 +595,5 @@ void DSi_DSP::DoSavestate(Savestate* file)
// TODO: save the Teakra state!!!
}
+
+} \ No newline at end of file
diff --git a/src/DSi_DSP.h b/src/DSi_DSP.h
index 56850c0..18ad3d1 100644
--- a/src/DSi_DSP.h
+++ b/src/DSi_DSP.h
@@ -27,6 +27,8 @@
namespace Teakra { class Teakra; }
+namespace melonDS
+{
class DSi_DSP
{
public:
@@ -104,5 +106,6 @@ private:
u16 PDataDMAReadMMIO();
};
+}
#endif // DSI_DSP_H
diff --git a/src/DSi_I2C.cpp b/src/DSi_I2C.cpp
index 8549ecb..678c8be 100644
--- a/src/DSi_I2C.cpp
+++ b/src/DSi_I2C.cpp
@@ -26,6 +26,8 @@
#include "SPI.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -592,3 +594,5 @@ void DSi_I2CHost::WriteData(u8 val)
{
Data = val;
}
+
+} \ No newline at end of file
diff --git a/src/DSi_I2C.h b/src/DSi_I2C.h
index b55dd0b..83d7e02 100644
--- a/src/DSi_I2C.h
+++ b/src/DSi_I2C.h
@@ -22,6 +22,8 @@
#include "types.h"
#include "Savestate.h"
+namespace melonDS
+{
class DSi_I2CHost;
class DSi_Camera;
@@ -180,4 +182,5 @@ private:
void GetCurDevice();
};
+}
#endif // DSI_I2C_H
diff --git a/src/DSi_NAND.cpp b/src/DSi_NAND.cpp
index 3db5621..59f582f 100644
--- a/src/DSi_NAND.cpp
+++ b/src/DSi_NAND.cpp
@@ -30,9 +30,9 @@
#include "fatfs/ff.h"
-using namespace Platform;
+using namespace melonDS::Platform;
-namespace DSi_NAND
+namespace melonDS::DSi_NAND
{
NANDImage::NANDImage(Platform::FileHandle* nandfile, const DSiKey& es_keyY) noexcept : NANDImage(nandfile, es_keyY.data())
diff --git a/src/DSi_NAND.h b/src/DSi_NAND.h
index 2bb3a02..699397b 100644
--- a/src/DSi_NAND.h
+++ b/src/DSi_NAND.h
@@ -31,7 +31,7 @@
struct AES_ctx;
-namespace DSi_NAND
+namespace melonDS::DSi_NAND
{
enum
diff --git a/src/DSi_NDMA.cpp b/src/DSi_NDMA.cpp
index 0afb201..4f248ea 100644
--- a/src/DSi_NDMA.cpp
+++ b/src/DSi_NDMA.cpp
@@ -23,10 +23,12 @@
#include "GPU.h"
#include "DSi_AES.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
-DSi_NDMA::DSi_NDMA(u32 cpu, u32 num, Melon::GPU& gpu) : GPU(gpu)
+DSi_NDMA::DSi_NDMA(u32 cpu, u32 num, melonDS::GPU& gpu) : GPU(gpu)
{
CPU = cpu;
Num = num;
@@ -375,3 +377,5 @@ void DSi_NDMA::Run7()
DSi::AES->CheckInputDMA();
DSi::AES->CheckOutputDMA();
}
+
+} \ No newline at end of file
diff --git a/src/DSi_NDMA.h b/src/DSi_NDMA.h
index 732bc9d..4479341 100644
--- a/src/DSi_NDMA.h
+++ b/src/DSi_NDMA.h
@@ -22,15 +22,14 @@
#include "types.h"
#include "Savestate.h"
-namespace Melon
+namespace melonDS
{
class GPU;
-}
class DSi_NDMA
{
public:
- DSi_NDMA(u32 cpu, u32 num, Melon::GPU& gpu);
+ DSi_NDMA(u32 cpu, u32 num, GPU& gpu);
~DSi_NDMA();
void Reset();
@@ -78,7 +77,7 @@ public:
u32 Cnt;
private:
- Melon::GPU& GPU;
+ melonDS::GPU& GPU;
u32 CPU, Num;
u32 StartMode;
@@ -100,4 +99,5 @@ private:
bool IsGXFIFODMA;
};
+}
#endif // DSI_NDMA_H
diff --git a/src/DSi_NWifi.cpp b/src/DSi_NWifi.cpp
index 6e19421..66320ba 100644
--- a/src/DSi_NWifi.cpp
+++ b/src/DSi_NWifi.cpp
@@ -24,6 +24,9 @@
#include "WifiAP.h"
#include "Platform.h"
+namespace melonDS
+{
+
using Platform::Log;
using Platform::LogLevel;
@@ -1607,3 +1610,5 @@ void DSi_NWifi::MSTimer(u32 param)
NDS::ScheduleEvent(NDS::Event_DSi_NWifi, true, 33611, 0, 0);
}
+
+} \ No newline at end of file
diff --git a/src/DSi_NWifi.h b/src/DSi_NWifi.h
index c3e577c..f3e5e15 100644
--- a/src/DSi_NWifi.h
+++ b/src/DSi_NWifi.h
@@ -23,6 +23,8 @@
#include "FIFO.h"
#include "Savestate.h"
+namespace melonDS
+{
class DSi_NWifi : public DSi_SDDevice
{
public:
@@ -146,4 +148,5 @@ private:
u8 LANBuffer[2048];
};
+}
#endif // DSI_NWIFI_H
diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp
index 409a408..5174af3 100644
--- a/src/DSi_SD.cpp
+++ b/src/DSi_SD.cpp
@@ -24,6 +24,8 @@
#include "DSi_NWifi.h"
#include "Platform.h"
+namespace melonDS
+{
using namespace Platform;
// observed IRQ behavior during transfers
@@ -1095,3 +1097,5 @@ u32 DSi_MMCStorage::WriteBlock(u64 addr)
return len;
}
+
+} \ No newline at end of file
diff --git a/src/DSi_SD.h b/src/DSi_SD.h
index 0940b54..faa4296 100644
--- a/src/DSi_SD.h
+++ b/src/DSi_SD.h
@@ -24,6 +24,8 @@
#include "FATStorage.h"
#include "Savestate.h"
+namespace melonDS
+{
namespace DSi_NAND
{
class NANDImage;
@@ -169,4 +171,5 @@ private:
u32 WriteBlock(u64 addr);
};
+}
#endif // DSI_SD_H
diff --git a/src/DSi_SPI_TSC.cpp b/src/DSi_SPI_TSC.cpp
index 7040fcc..520e57b 100644
--- a/src/DSi_SPI_TSC.cpp
+++ b/src/DSi_SPI_TSC.cpp
@@ -22,6 +22,8 @@
#include "DSi_SPI_TSC.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -219,3 +221,5 @@ void DSi_TSC::Release()
DataPos = 0;
}
+
+} \ No newline at end of file
diff --git a/src/DSi_SPI_TSC.h b/src/DSi_SPI_TSC.h
index ebac395..8e9ff91 100644
--- a/src/DSi_SPI_TSC.h
+++ b/src/DSi_SPI_TSC.h
@@ -23,6 +23,8 @@
#include "Savestate.h"
#include "SPI.h"
+namespace melonDS
+{
class DSi_TSC : public TSC
{
public:
@@ -50,4 +52,5 @@ private:
u8 TSCMode;
};
+}
#endif // DSI_SPI_TSC
diff --git a/src/DSi_TMD.h b/src/DSi_TMD.h
index 12226c5..f07b3d1 100644
--- a/src/DSi_TMD.h
+++ b/src/DSi_TMD.h
@@ -22,7 +22,7 @@
#include "types.h"
#include <array>
-namespace DSi_TMD
+namespace melonDS::DSi_TMD
{
struct TitleMetadataContent {
diff --git a/src/FATIO.cpp b/src/FATIO.cpp
index 3e91fba..233014e 100644
--- a/src/FATIO.cpp
+++ b/src/FATIO.cpp
@@ -20,13 +20,15 @@
#include "fatfs/ff.h"
#include "fatfs/diskio.h"
+using namespace melonDS;
+
static ff_disk_read_cb ReadCb;
static ff_disk_write_cb WriteCb;
static LBA_t SectorCount;
static DSTATUS Status = STA_NOINIT | STA_NODISK;
-void ff_disk_open(const ff_disk_read_cb& readcb, const ff_disk_write_cb& writecb, LBA_t seccnt)
+void melonDS::ff_disk_open(const ff_disk_read_cb& readcb, const ff_disk_write_cb& writecb, LBA_t seccnt)
{
if (!readcb) return;
@@ -39,7 +41,7 @@ void ff_disk_open(const ff_disk_read_cb& readcb, const ff_disk_write_cb& writecb
else Status &= ~STA_PROTECT;
}
-void ff_disk_close()
+void melonDS::ff_disk_close()
{
ReadCb = nullptr;
WriteCb = nullptr;
diff --git a/src/FATIO.h b/src/FATIO.h
index b3b63f3..6d8aa49 100644
--- a/src/FATIO.h
+++ b/src/FATIO.h
@@ -24,11 +24,13 @@
#include "fatfs/ff.h"
// extra additions for interfacing with melonDS
-
+namespace melonDS
+{
using ff_disk_read_cb = std::function<UINT(BYTE*, LBA_t, UINT)>;
using ff_disk_write_cb = std::function<UINT(const BYTE*, LBA_t, UINT)>;
void ff_disk_open(const ff_disk_read_cb& readcb, const ff_disk_write_cb& writecb, LBA_t seccnt);
void ff_disk_close();
+}
#endif // FATIO_H
diff --git a/src/FATStorage.cpp b/src/FATStorage.cpp
index e357470..cd0a03c 100644
--- a/src/FATStorage.cpp
+++ b/src/FATStorage.cpp
@@ -25,6 +25,8 @@
#include "FATStorage.h"
#include "Platform.h"
+namespace melonDS
+{
namespace fs = std::filesystem;
using namespace Platform;
@@ -1104,3 +1106,5 @@ bool FATStorage::Save()
return true;
}
+
+} \ No newline at end of file
diff --git a/src/FATStorage.h b/src/FATStorage.h
index 54adb5d..2bdafad 100644
--- a/src/FATStorage.h
+++ b/src/FATStorage.h
@@ -28,7 +28,8 @@
#include "types.h"
#include "fatfs/ff.h"
-
+namespace melonDS
+{
class FATStorage
{
public:
@@ -99,4 +100,5 @@ private:
std::map<std::string, FileIndexEntry> FileIndex;
};
+}
#endif // FATSTORAGE_H
diff --git a/src/FIFO.h b/src/FIFO.h
index c1cbdbf..cbff4ab 100644
--- a/src/FIFO.h
+++ b/src/FIFO.h
@@ -22,6 +22,8 @@
#include "types.h"
#include "Savestate.h"
+namespace melonDS
+{
template<typename T, u32 NumEntries>
class FIFO
{
@@ -189,4 +191,5 @@ private:
u32 ReadPos, WritePos;
};
+}
#endif
diff --git a/src/FreeBIOS.cpp b/src/FreeBIOS.cpp
index 972f4b8..7eef18b 100644
--- a/src/FreeBIOS.cpp
+++ b/src/FreeBIOS.cpp
@@ -26,6 +26,8 @@
#include "FreeBIOS.h"
+namespace melonDS
+{
unsigned char bios_arm7_bin[] = {
0x1c, 0x04, 0x00, 0xea, 0x1c, 0x04, 0x00, 0xea, 0x1c, 0x04, 0x00, 0xea,
0x1a, 0x04, 0x00, 0xea, 0x19, 0x04, 0x00, 0xea, 0x18, 0x04, 0x00, 0xea,
@@ -1738,4 +1740,5 @@ unsigned char bios_arm9_bin[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
-}; \ No newline at end of file
+};
+} \ No newline at end of file
diff --git a/src/FreeBIOS.h b/src/FreeBIOS.h
index 82cb369..ce90725 100644
--- a/src/FreeBIOS.h
+++ b/src/FreeBIOS.h
@@ -28,7 +28,10 @@
#ifndef FREEBIOS_H
#define FREEBIOS_H
+namespace melonDS
+{
extern unsigned char bios_arm7_bin[16384];
extern unsigned char bios_arm9_bin[4096];
+}
#endif // FREEBIOS_H
diff --git a/src/GBACart.cpp b/src/GBACart.cpp
index f20feea..a0c5467 100644
--- a/src/GBACart.cpp
+++ b/src/GBACart.cpp
@@ -24,6 +24,8 @@
#include "CRC32.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -897,3 +899,5 @@ void GBACartSlot::SRAMWrite(u32 addr, u8 val) noexcept
}
}
+
+} \ No newline at end of file
diff --git a/src/GBACart.h b/src/GBACart.h
index 7447f6f..a557089 100644
--- a/src/GBACart.h
+++ b/src/GBACart.h
@@ -23,7 +23,7 @@
#include "types.h"
#include "Savestate.h"
-namespace GBACart
+namespace melonDS::GBACart
{
enum CartType
diff --git a/src/GPU.cpp b/src/GPU.cpp
index 5c67cfb..27dcbfb 100644
--- a/src/GPU.cpp
+++ b/src/GPU.cpp
@@ -26,6 +26,8 @@
#include "GPU3D_Soft.h"
#include "GPU3D_OpenGL.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -33,8 +35,6 @@ using Platform::LogLevel;
#define HBLANK_CYCLES (48+(256*6))
#define FRAME_CYCLES (LINE_CYCLES * 263)
-namespace Melon
-{
enum
{
LCD_StartHBlank = 0,
@@ -64,7 +64,7 @@ enum
VRAMDirty need to be reset for the respective VRAM bank.
*/
-GPU::GPU(ARMJIT::ARMJIT& jit) noexcept : GPU2D_A(0, *this), GPU2D_B(1, *this), JIT(jit)
+GPU::GPU(ARMJIT& jit) noexcept : GPU2D_A(0, *this), GPU2D_B(1, *this), JIT(jit)
{
NDS::RegisterEventFunc(NDS::Event_LCD, LCD_StartHBlank, MemberEventFunc(GPU, StartHBlank));
NDS::RegisterEventFunc(NDS::Event_LCD, LCD_StartScanline, MemberEventFunc(GPU, StartScanline));
@@ -319,21 +319,21 @@ void GPU::InitRenderer(int renderer) noexcept
{
// Fallback on software renderer
renderer = 0;
- GPU3D.SetCurrentRenderer(std::make_unique<GPU3D::SoftRenderer>(*this));
+ GPU3D.SetCurrentRenderer(std::make_unique<SoftRenderer>(*this));
}
- GPU3D.SetCurrentRenderer(GPU3D::GLRenderer::New(*this));
+ GPU3D.SetCurrentRenderer(GLRenderer::New(*this));
if (!GPU3D.GetCurrentRenderer())
{
// Fallback on software renderer
CurGLCompositor.reset();
renderer = 0;
- GPU3D.SetCurrentRenderer(std::make_unique<GPU3D::SoftRenderer>(*this));
+ GPU3D.SetCurrentRenderer(std::make_unique<SoftRenderer>(*this));
}
}
else
#endif
{
- GPU3D.SetCurrentRenderer(std::make_unique<GPU3D::SoftRenderer>(*this));
+ GPU3D.SetCurrentRenderer(std::make_unique<SoftRenderer>(*this));
}
Renderer = renderer;
diff --git a/src/GPU.h b/src/GPU.h
index c3941eb..dbeec52 100644
--- a/src/GPU.h
+++ b/src/GPU.h
@@ -29,19 +29,11 @@
#include "GPU_OpenGL.h"
#endif
-
-namespace GPU3D
+namespace melonDS
{
class GPU3D;
-}
-
-namespace ARMJIT
-{
class ARMJIT;
-}
-namespace Melon
-{
static constexpr u32 VRAMDirtyGranularity = 512;
class GPU;
@@ -75,7 +67,7 @@ struct RenderSettings
class GPU
{
public:
- GPU(ARMJIT::ARMJIT& jit) noexcept;
+ GPU(ARMJIT& jit) noexcept;
~GPU() noexcept;
void Reset() noexcept;
void Stop() noexcept;
@@ -544,7 +536,7 @@ public:
void SyncDirtyFlags() noexcept;
- ARMJIT::ARMJIT& JIT;
+ ARMJIT& JIT;
u16 VCount = 0;
u16 TotalScanlines = 0;
u16 DispStat[2] {};
@@ -590,7 +582,7 @@ public:
GPU2D::Unit GPU2D_A;
GPU2D::Unit GPU2D_B;
- GPU3D::GPU3D GPU3D {};
+ melonDS::GPU3D GPU3D {};
NonStupidBitField<128*1024/VRAMDirtyGranularity> VRAMDirty[9] {};
VRAMTrackingSet<512*1024, 16*1024> VRAMDirty_ABG {};
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp
index e892116..e7fb9a2 100644
--- a/src/GPU2D.cpp
+++ b/src/GPU2D.cpp
@@ -21,6 +21,8 @@
#include "NDS.h"
#include "GPU.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -84,8 +86,7 @@ using Platform::LogLevel;
namespace GPU2D
{
-
-Unit::Unit(u32 num, Melon::GPU& gpu) : Num(num), GPU(gpu)
+Unit::Unit(u32 num, melonDS::GPU& gpu) : Num(num), GPU(gpu)
{
}
@@ -722,3 +723,4 @@ void Unit::GetOBJVRAM(u8*& data, u32& mask)
}
}
+}
diff --git a/src/GPU2D.h b/src/GPU2D.h
index ad052bf..dd3bbf6 100644
--- a/src/GPU2D.h
+++ b/src/GPU2D.h
@@ -22,10 +22,9 @@
#include "types.h"
#include "Savestate.h"
-namespace Melon
+namespace melonDS
{
class GPU;
-}
namespace GPU2D
{
@@ -35,7 +34,7 @@ class Unit
public:
// take a reference to the GPU so we can access its state
// and ensure that it's not null
- Unit(u32 num, Melon::GPU& gpu);
+ Unit(u32 num, melonDS::GPU& gpu);
Unit(const Unit&) = delete;
Unit& operator=(const Unit&) = delete;
@@ -124,7 +123,7 @@ public:
u16 MasterBrightness;
private:
- Melon::GPU& GPU;
+ melonDS::GPU& GPU;
};
class Renderer2D
@@ -150,4 +149,5 @@ protected:
}
+}
#endif
diff --git a/src/GPU2D_Soft.cpp b/src/GPU2D_Soft.cpp
index 7447bcf..9e7d849 100644
--- a/src/GPU2D_Soft.cpp
+++ b/src/GPU2D_Soft.cpp
@@ -20,10 +20,11 @@
#include "GPU.h"
#include "GPU3D_OpenGL.h"
+namespace melonDS
+{
namespace GPU2D
{
-
-SoftRenderer::SoftRenderer(Melon::GPU& gpu)
+SoftRenderer::SoftRenderer(melonDS::GPU& gpu)
: Renderer2D(), GPU(gpu)
{
// initialize mosaic table
@@ -368,7 +369,7 @@ void SoftRenderer::VBlankEnd(Unit* unitA, Unit* unitB)
{
if ((unitA->CaptureCnt & (1<<31)) && (((unitA->CaptureCnt >> 29) & 0x3) != 1))
{
- reinterpret_cast<GPU3D::GLRenderer*>(GPU.GPU3D.GetCurrentRenderer())->PrepareCaptureFrame();
+ reinterpret_cast<GLRenderer*>(GPU.GPU3D.GetCurrentRenderer())->PrepareCaptureFrame();
}
}
#endif
@@ -479,8 +480,8 @@ void SoftRenderer::DoCapture(u32 line, u32 width)
dstaddr &= 0xFFFF;
srcBaddr &= 0xFFFF;
- static_assert(Melon::VRAMDirtyGranularity == 512);
- GPU.VRAMDirty[dstvram][(dstaddr * 2) / Melon::VRAMDirtyGranularity] = true;
+ static_assert(VRAMDirtyGranularity == 512);
+ GPU.VRAMDirty[dstvram][(dstaddr * 2) / VRAMDirtyGranularity] = true;
switch ((captureCnt >> 29) & 0x3)
{
@@ -2226,3 +2227,4 @@ void SoftRenderer::DrawSprite_Normal(u32 num, u32 width, u32 height, s32 xpos, s
}
}
+}
diff --git a/src/GPU2D_Soft.h b/src/GPU2D_Soft.h
index 7d6d65f..86943d3 100644
--- a/src/GPU2D_Soft.h
+++ b/src/GPU2D_Soft.h
@@ -20,10 +20,9 @@
#include "GPU2D.h"
-namespace Melon
+namespace melonDS
{
class GPU;
-}
namespace GPU2D
{
@@ -31,14 +30,14 @@ namespace GPU2D
class SoftRenderer : public Renderer2D
{
public:
- SoftRenderer(Melon::GPU& gpu);
+ SoftRenderer(melonDS::GPU& gpu);
~SoftRenderer() override {}
void DrawScanline(u32 line, Unit* unit) override;
void DrawSprites(u32 line, Unit* unit) override;
void VBlankEnd(Unit* unitA, Unit* unitB) override;
private:
- Melon::GPU& GPU;
+ melonDS::GPU& GPU;
alignas(8) u32 BGOBJLine[256*3];
u32* _3DLine;
@@ -84,3 +83,5 @@ private:
};
}
+
+} \ No newline at end of file
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp
index 80c5d46..b00e6fd 100644
--- a/src/GPU3D.cpp
+++ b/src/GPU3D.cpp
@@ -24,6 +24,8 @@
#include "FIFO.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -98,9 +100,6 @@ using Platform::LogLevel;
// * additionally, some commands (BEGIN, LIGHT_VECTOR, BOXTEST) stall the polygon pipeline
-namespace GPU3D
-{
-
const u8 CmdNumParams[256] =
{
// 0x00
diff --git a/src/GPU3D.h b/src/GPU3D.h
index b8a2d55..f543ff8 100644
--- a/src/GPU3D.h
+++ b/src/GPU3D.h
@@ -25,13 +25,9 @@
#include "Savestate.h"
#include "FIFO.h"
-namespace Melon
+namespace melonDS
{
struct RenderSettings;
-}
-
-namespace GPU3D
-{
struct Vertex
{
@@ -340,7 +336,7 @@ public:
// are more detailed "traits" that we can ask of the Renderer3D type
const bool Accelerated;
- virtual void SetRenderSettings(const Melon::RenderSettings& settings) noexcept = 0;
+ virtual void SetRenderSettings(const RenderSettings& settings) noexcept = 0;
virtual void VCount144() {};
diff --git a/src/GPU3D_OpenGL.cpp b/src/GPU3D_OpenGL.cpp
index 629ec15..fb9f246 100644
--- a/src/GPU3D_OpenGL.cpp
+++ b/src/GPU3D_OpenGL.cpp
@@ -25,7 +25,7 @@
#include "GPU.h"
#include "GPU3D_OpenGL_shaders.h"
-namespace GPU3D
+namespace melonDS
{
bool GLRenderer::BuildRenderShader(u32 flags, const char* vs, const char* fs)
@@ -97,14 +97,14 @@ void SetupDefaultTexParams(GLuint tex)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
-GLRenderer::GLRenderer(Melon::GPU& gpu) noexcept : Renderer3D(true), GPU(gpu)
+GLRenderer::GLRenderer(melonDS::GPU& gpu) noexcept : Renderer3D(true), GPU(gpu)
{
// GLRenderer::New() will be used to actually initialize the renderer;
// The various glDelete* functions silently ignore invalid IDs,
// so we can just let the destructor clean up a half-initialized renderer.
}
-std::unique_ptr<GLRenderer> GLRenderer::New(Melon::GPU& gpu) noexcept
+std::unique_ptr<GLRenderer> GLRenderer::New(melonDS::GPU& gpu) noexcept
{
assert(glEnable != nullptr);
@@ -329,7 +329,7 @@ void GLRenderer::Reset()
{
}
-void GLRenderer::SetRenderSettings(const Melon::RenderSettings& settings) noexcept
+void GLRenderer::SetRenderSettings(const RenderSettings& settings) noexcept
{
int scale = settings.GL_ScaleFactor;
diff --git a/src/GPU3D_OpenGL.h b/src/GPU3D_OpenGL.h
index 3657a12..0bc20d8 100644
--- a/src/GPU3D_OpenGL.h
+++ b/src/GPU3D_OpenGL.h
@@ -23,20 +23,17 @@
#include "OpenGLSupport.h"
-namespace Melon
+namespace melonDS
{
class GPU;
-}
-namespace GPU3D
-{
class GLRenderer : public Renderer3D
{
public:
virtual ~GLRenderer() override;
virtual void Reset() override;
- virtual void SetRenderSettings(const Melon::RenderSettings& settings) noexcept override;
+ virtual void SetRenderSettings(const RenderSettings& settings) noexcept override;
virtual void VCount144() override {};
virtual void RenderFrame() override;
@@ -45,10 +42,10 @@ public:
void SetupAccelFrame();
void PrepareCaptureFrame();
- static std::unique_ptr<GLRenderer> New(Melon::GPU& gpu) noexcept;
+ static std::unique_ptr<GLRenderer> New(melonDS::GPU& gpu) noexcept;
private:
// Used by New()
- GLRenderer(Melon::GPU& gpu) noexcept;
+ GLRenderer(melonDS::GPU& gpu) noexcept;
// GL version requirements
// * texelFetch: 3.0 (GLSL 1.30) (3.2/1.50 for MS)
@@ -68,7 +65,7 @@ private:
u32 RenderKey;
};
- Melon::GPU& GPU;
+ melonDS::GPU& GPU;
RendererPolygon PolygonList[2048] {};
bool BuildRenderShader(u32 flags, const char* vs, const char* fs);
diff --git a/src/GPU3D_OpenGL_shaders.h b/src/GPU3D_OpenGL_shaders.h
index 8131381..13492b7 100644
--- a/src/GPU3D_OpenGL_shaders.h
+++ b/src/GPU3D_OpenGL_shaders.h
@@ -21,7 +21,8 @@
#define kShaderHeader "#version 140"
-
+namespace melonDS
+{
const char* kClearVS = kShaderHeader R"(
in vec2 vPosition;
@@ -802,5 +803,5 @@ void main()
gl_FragDepth = fZ;
}
)";
-
+}
#endif // GPU3D_OPENGL_SHADERS_H
diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp
index 823f752..c6b4631 100644
--- a/src/GPU3D_Soft.cpp
+++ b/src/GPU3D_Soft.cpp
@@ -24,8 +24,7 @@
#include "NDS.h"
#include "GPU.h"
-
-namespace GPU3D
+namespace melonDS
{
void RenderThreadFunc();
@@ -72,7 +71,7 @@ void SoftRenderer::SetupRenderThread()
}
-SoftRenderer::SoftRenderer(Melon::GPU& gpu) noexcept
+SoftRenderer::SoftRenderer(melonDS::GPU& gpu) noexcept
: Renderer3D(false), GPU(gpu)
{
Sema_RenderStart = Platform::Semaphore_Create();
@@ -105,7 +104,7 @@ void SoftRenderer::Reset()
SetupRenderThread();
}
-void SoftRenderer::SetRenderSettings(const Melon::RenderSettings& settings) noexcept
+void SoftRenderer::SetRenderSettings(const RenderSettings& settings) noexcept
{
Threaded = settings.Soft_Threaded;
SetupRenderThread();
diff --git a/src/GPU3D_Soft.h b/src/GPU3D_Soft.h
index b1cfb2f..9fb9a71 100644
--- a/src/GPU3D_Soft.h
+++ b/src/GPU3D_Soft.h
@@ -24,16 +24,16 @@
#include <thread>
#include <atomic>
-namespace GPU3D
+namespace melonDS
{
class SoftRenderer : public Renderer3D
{
public:
- SoftRenderer(Melon::GPU& gpu) noexcept;
+ SoftRenderer(melonDS::GPU& gpu) noexcept;
virtual ~SoftRenderer() override;
virtual void Reset() override;
- virtual void SetRenderSettings(const Melon::RenderSettings& settings) noexcept override;
+ virtual void SetRenderSettings(const RenderSettings& settings) noexcept override;
virtual void VCount144() override;
virtual void RenderFrame() override;
@@ -451,7 +451,7 @@ private:
};
- Melon::GPU& GPU;
+ melonDS::GPU& GPU;
RendererPolygon PolygonList[2048];
void TextureLookup(u32 texparam, u32 texpal, s16 s, s16 t, u16* color, u8* alpha);
u32 RenderPixel(Polygon* polygon, u8 vr, u8 vg, u8 vb, s16 s, s16 t);
diff --git a/src/GPU_OpenGL.cpp b/src/GPU_OpenGL.cpp
index d0649bb..2db3810 100644
--- a/src/GPU_OpenGL.cpp
+++ b/src/GPU_OpenGL.cpp
@@ -28,12 +28,12 @@
#include "OpenGLSupport.h"
#include "GPU_OpenGL_shaders.h"
-namespace Melon
+namespace melonDS
{
using namespace OpenGL;
-std::unique_ptr<GLCompositor> GLCompositor::New(Melon::GPU& gpu) noexcept
+std::unique_ptr<GLCompositor> GLCompositor::New(melonDS::GPU& gpu) noexcept
{
assert(glBindAttribLocation != nullptr);
@@ -53,7 +53,7 @@ std::unique_ptr<GLCompositor> GLCompositor::New(Melon::GPU& gpu) noexcept
return std::unique_ptr<GLCompositor>(new GLCompositor(CompShader, gpu));
}
-GLCompositor::GLCompositor(std::array<GLuint, 3> compShader, Melon::GPU& gpu) noexcept : CompShader(compShader), GPU(gpu)
+GLCompositor::GLCompositor(std::array<GLuint, 3> compShader, melonDS::GPU& gpu) noexcept : CompShader(compShader), GPU(gpu)
{
CompScaleLoc = glGetUniformLocation(CompShader[2], "u3DScale");
Comp3DXPosLoc = glGetUniformLocation(CompShader[2], "u3DXPos");
@@ -218,7 +218,7 @@ void GLCompositor::RenderFrame()
}
glActiveTexture(GL_TEXTURE1);
- reinterpret_cast<GPU3D::GLRenderer*>(GPU.GPU3D.GetCurrentRenderer())->SetupAccelFrame();
+ reinterpret_cast<GLRenderer*>(GPU.GPU3D.GetCurrentRenderer())->SetupAccelFrame();
glBindBuffer(GL_ARRAY_BUFFER, CompVertexBufferID);
glBindVertexArray(CompVertexArrayID);
diff --git a/src/GPU_OpenGL.h b/src/GPU_OpenGL.h
index 3763b6b..68462a9 100644
--- a/src/GPU_OpenGL.h
+++ b/src/GPU_OpenGL.h
@@ -23,7 +23,7 @@
#include <array>
#include <memory>
-namespace Melon
+namespace melonDS
{
class GPU;
struct RenderSettings;
@@ -31,7 +31,7 @@ struct RenderSettings;
class GLCompositor
{
public:
- static std::unique_ptr<GLCompositor> New(Melon::GPU& gpu) noexcept;
+ static std::unique_ptr<GLCompositor> New(melonDS::GPU& gpu) noexcept;
GLCompositor(const GLCompositor&) = delete;
GLCompositor& operator=(const GLCompositor&) = delete;
~GLCompositor();
@@ -44,8 +44,8 @@ public:
void RenderFrame();
void BindOutputTexture(int buf);
private:
- GLCompositor(std::array<GLuint, 3> CompShader, Melon::GPU& gpu) noexcept;
- Melon::GPU& GPU;
+ GLCompositor(std::array<GLuint, 3> CompShader, melonDS::GPU& gpu) noexcept;
+ melonDS::GPU& GPU;
int Scale;
int ScreenH, ScreenW;
diff --git a/src/GPU_OpenGL_shaders.h b/src/GPU_OpenGL_shaders.h
index 9a7d6ab..a8c5b95 100644
--- a/src/GPU_OpenGL_shaders.h
+++ b/src/GPU_OpenGL_shaders.h
@@ -19,6 +19,8 @@
#ifndef GPU_OPENGL_SHADERS_H
#define GPU_OPENGL_SHADERS_H
+namespace melonDS
+{
const char* kCompositorVS = R"(#version 140
in vec2 vPosition;
@@ -866,5 +868,6 @@ void main()
+}
#endif // GPU_OPENGL_SHADERS_H
diff --git a/src/JitBlock.h b/src/JitBlock.h
index abd435b..6a187b2 100644
--- a/src/JitBlock.h
+++ b/src/JitBlock.h
@@ -22,7 +22,7 @@
#include "types.h"
#include "TinyVector.h"
-namespace ARMJIT
+namespace melonDS
{
typedef void (*JitBlockEntry)();
diff --git a/src/NDS.cpp b/src/NDS.cpp
index a216fed..576eb9c 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -43,6 +43,8 @@
#include "ARMJIT.h"
#include "ARMJIT_Memory.h"
+namespace melonDS
+{
using namespace Platform;
namespace NDS
@@ -182,8 +184,8 @@ class RTC* RTC;
class Wifi* Wifi;
std::unique_ptr<NDSCart::NDSCartSlot> NDSCartSlot;
std::unique_ptr<GBACart::GBACartSlot> GBACartSlot;
-std::unique_ptr<Melon::GPU> GPU;
-std::unique_ptr<ARMJIT::ARMJIT> JIT;
+std::unique_ptr<melonDS::GPU> GPU;
+std::unique_ptr<ARMJIT> JIT;
class AREngine* AREngine;
bool Running;
@@ -203,8 +205,8 @@ bool Init()
RegisterEventFunc(Event_Div, 0, DivDone);
RegisterEventFunc(Event_Sqrt, 0, SqrtDone);
- JIT = std::make_unique<ARMJIT::ARMJIT>();
- GPU = std::make_unique<Melon::GPU>(*JIT);
+ JIT = std::make_unique<ARMJIT>();
+ GPU = std::make_unique<melonDS::GPU>(*JIT);
MainRAM = JIT->Memory.GetMainRAM();
SharedWRAM = JIT->Memory.GetSharedWRAM();
@@ -4462,3 +4464,5 @@ void ARM7IOWrite32(u32 addr, u32 val)
}
}
+
+} \ No newline at end of file
diff --git a/src/NDS.h b/src/NDS.h
index a1155ba..7bfad62 100644
--- a/src/NDS.h
+++ b/src/NDS.h
@@ -34,22 +34,16 @@
// with this enabled, to make sure it doesn't desync
//#define DEBUG_CHECK_DESYNC
+namespace melonDS
+{
class SPU;
class SPIHost;
class RTC;
class Wifi;
class AREngine;
-
-namespace Melon
-{
class GPU;
-}
-
-namespace ARMJIT
-{
class ARMJIT;
-}
namespace NDS
{
@@ -273,8 +267,8 @@ extern class RTC* RTC;
extern class Wifi* Wifi;
extern std::unique_ptr<NDSCart::NDSCartSlot> NDSCartSlot;
extern std::unique_ptr<GBACart::GBACartSlot> GBACartSlot;
-extern std::unique_ptr<Melon::GPU> GPU;
-extern std::unique_ptr<ARMJIT::ARMJIT> JIT;
+extern std::unique_ptr<GPU> GPU;
+extern std::unique_ptr<ARMJIT> JIT;
extern class AREngine* AREngine;
const u32 ARM7WRAMSize = 0x10000;
@@ -394,4 +388,5 @@ void ARM7IOWrite32(u32 addr, u32 val);
}
+}
#endif // NDS_H
diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp
index bf2b791..77262a7 100644
--- a/src/NDSCart.cpp
+++ b/src/NDSCart.cpp
@@ -27,6 +27,8 @@
#include "melonDLDI.h"
#include "xxhash/xxhash.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -2068,3 +2070,5 @@ void NDSCartSlot::WriteSPIData(u8 val) noexcept
}
}
+
+} \ No newline at end of file
diff --git a/src/NDSCart.h b/src/NDSCart.h
index 33a17bb..18d1fb6 100644
--- a/src/NDSCart.h
+++ b/src/NDSCart.h
@@ -30,7 +30,7 @@
#include "FATStorage.h"
#include "ROMList.h"
-namespace NDSCart
+namespace melonDS::NDSCart
{
enum CartType
diff --git a/src/NDS_Header.h b/src/NDS_Header.h
index 626f80c..de75f7c 100644
--- a/src/NDS_Header.h
+++ b/src/NDS_Header.h
@@ -22,6 +22,8 @@
#include <string.h>
#include "types.h"
+namespace melonDS
+{
/// Set to indicate the console regions that a ROM (including DSiWare)
/// can be played on.
enum RegionMask : u32
@@ -242,5 +244,6 @@ struct NDSBanner
static_assert(sizeof(NDSBanner) == 9152, "NDSBanner is not 9152 bytes!");
+}
#endif //NDS_HEADER_H
diff --git a/src/NonStupidBitfield.h b/src/NonStupidBitfield.h
index a4fe7ec..eb5e1f2 100644
--- a/src/NonStupidBitfield.h
+++ b/src/NonStupidBitfield.h
@@ -29,6 +29,8 @@
// like std::bitset but less stupid and optimised for
// our use case (keeping track of memory invalidations)
+namespace melonDS
+{
template <u32 Size>
struct NonStupidBitField
{
@@ -203,5 +205,6 @@ struct NonStupidBitField
}
};
+}
#endif
diff --git a/src/OpenGLSupport.cpp b/src/OpenGLSupport.cpp
index 4962b4c..0eb05c5 100644
--- a/src/OpenGLSupport.cpp
+++ b/src/OpenGLSupport.cpp
@@ -18,6 +18,9 @@
#include "OpenGLSupport.h"
+namespace melonDS
+{
+
using Platform::Log;
using Platform::LogLevel;
@@ -142,3 +145,5 @@ void UseShaderProgram(GLuint* ids)
}
}
+
+} \ No newline at end of file
diff --git a/src/OpenGLSupport.h b/src/OpenGLSupport.h
index ed75f38..ee5b504 100644
--- a/src/OpenGLSupport.h
+++ b/src/OpenGLSupport.h
@@ -25,8 +25,7 @@
#include "Platform.h"
#include "PlatformOGL.h"
-
-namespace OpenGL
+namespace melonDS::OpenGL
{
bool BuildShaderProgram(const char* vs, const char* fs, GLuint* ids, const char* name);
diff --git a/src/Platform.h b/src/Platform.h
index de1ca8b..f8b0453 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -24,6 +24,8 @@
#include <functional>
#include <string>
+namespace melonDS
+{
class Firmware;
namespace Platform
@@ -394,4 +396,5 @@ void DynamicLibrary_Unload(DynamicLibrary* lib);
void* DynamicLibrary_LoadFunction(DynamicLibrary* lib, const char* name);
}
+}
#endif // PLATFORM_H
diff --git a/src/ROMList.cpp b/src/ROMList.cpp
index 564f4a4..3ff771f 100644
--- a/src/ROMList.cpp
+++ b/src/ROMList.cpp
@@ -18,6 +18,8 @@
#include "ROMList.h"
+namespace melonDS
+{
const ROMListEntry ROMList[] =
{
{0x41464141, 0x00800000, 0x00000004},
@@ -6801,3 +6803,5 @@ const ROMListEntry ROMList[] =
};
const size_t ROMListEntryCount = sizeof(ROMList) / sizeof(ROMListEntry);
+
+} \ No newline at end of file
diff --git a/src/ROMList.h b/src/ROMList.h
index 11db177..82ee0cc 100644
--- a/src/ROMList.h
+++ b/src/ROMList.h
@@ -23,6 +23,8 @@
#include "types.h"
+namespace melonDS
+{
struct ROMListEntry
{
u32 GameCode;
@@ -36,4 +38,5 @@ extern const ROMListEntry ROMList[];
/// The number of elements in \c ROMList.
extern const size_t ROMListEntryCount;
+}
#endif // ROMLIST_H
diff --git a/src/RTC.cpp b/src/RTC.cpp
index d451585..747348c 100644
--- a/src/RTC.cpp
+++ b/src/RTC.cpp
@@ -21,6 +21,8 @@
#include "RTC.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -940,3 +942,5 @@ void RTC::Write(u16 val, bool byte)
else
IO = (IO & 0x0001) | (val & 0xFFFE);
}
+
+} \ No newline at end of file
diff --git a/src/RTC.h b/src/RTC.h
index 313d237..45d0f26 100644
--- a/src/RTC.h
+++ b/src/RTC.h
@@ -22,6 +22,8 @@
#include "types.h"
#include "Savestate.h"
+namespace melonDS
+{
class RTC
{
public:
@@ -113,4 +115,5 @@ private:
void ByteIn(u8 val);
};
+}
#endif
diff --git a/src/SPI.cpp b/src/SPI.cpp
index a95cd1c..3ded7bc 100644
--- a/src/SPI.cpp
+++ b/src/SPI.cpp
@@ -27,6 +27,8 @@
#include "DSi_SPI_TSC.h"
#include "Platform.h"
+namespace melonDS
+{
using namespace Platform;
@@ -641,3 +643,5 @@ void SPIHost::WriteData(u8 val)
u32 delay = 8 * (8 << (Cnt & 0x3));
NDS::ScheduleEvent(NDS::Event_SPITransfer, false, delay, 0, 0);
}
+
+} \ No newline at end of file
diff --git a/src/SPI.h b/src/SPI.h
index bf665d9..c889fb5 100644
--- a/src/SPI.h
+++ b/src/SPI.h
@@ -28,6 +28,8 @@
#include "Savestate.h"
#include "SPI_Firmware.h"
+namespace melonDS
+{
enum
{
SPIDevice_PowerMan = 0,
@@ -164,4 +166,5 @@ private:
SPIDevice* Devices[3];
};
+}
#endif
diff --git a/src/SPI_Firmware.cpp b/src/SPI_Firmware.cpp
index 5507145..89c8fa6 100644
--- a/src/SPI_Firmware.cpp
+++ b/src/SPI_Firmware.cpp
@@ -20,6 +20,8 @@
#include "SPI.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -404,3 +406,5 @@ void Firmware::UpdateChecksums()
u.UpdateChecksum();
}
}
+
+} \ No newline at end of file
diff --git a/src/SPI_Firmware.h b/src/SPI_Firmware.h
index a264a6c..c8ca25c 100644
--- a/src/SPI_Firmware.h
+++ b/src/SPI_Firmware.h
@@ -24,6 +24,8 @@
#include "types.h"
#include "Platform.h"
+namespace melonDS
+{
u16 CRC16(const u8* data, u32 len, u32 start);
@@ -563,4 +565,5 @@ private:
u32 FirmwareMask;
};
+}
#endif //MELONDS_SPI_FIRMWARE_H
diff --git a/src/SPU.cpp b/src/SPU.cpp
index 89b7fb3..a5570d6 100644
--- a/src/SPU.cpp
+++ b/src/SPU.cpp
@@ -24,6 +24,8 @@
#include "DSi.h"
#include "SPU.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -1208,3 +1210,5 @@ void SPU::Write32(u32 addr, u32 val)
}
}
}
+
+} \ No newline at end of file
diff --git a/src/SPU.h b/src/SPU.h
index 407a3f6..144c19b 100644
--- a/src/SPU.h
+++ b/src/SPU.h
@@ -22,6 +22,8 @@
#include "Savestate.h"
#include "Platform.h"
+namespace melonDS
+{
class SPU;
class SPUChannel
@@ -257,4 +259,5 @@ private:
SPUCaptureUnit* Capture[2];
};
+}
#endif // SPU_H
diff --git a/src/Savestate.cpp b/src/Savestate.cpp
index 77c2e62..6d6a9a4 100644
--- a/src/Savestate.cpp
+++ b/src/Savestate.cpp
@@ -22,6 +22,8 @@
#include "Savestate.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -379,3 +381,5 @@ u32 Savestate::FindSection(const char* magic) const
Log(LogLevel::Error, "savestate: section %s not found. blarg\n", magic);
return NO_SECTION;
}
+
+} \ No newline at end of file
diff --git a/src/Savestate.h b/src/Savestate.h
index ede3963..236aa64 100644
--- a/src/Savestate.h
+++ b/src/Savestate.h
@@ -27,6 +27,8 @@
#define SAVESTATE_MAJOR 11
#define SAVESTATE_MINOR 1
+namespace melonDS
+{
class Savestate
{
public:
@@ -117,5 +119,6 @@ private:
bool buffer_owned;
bool finished;
};
+}
#endif // SAVESTATE_H
diff --git a/src/TinyVector.h b/src/TinyVector.h
index 63e7caf..1904f2a 100644
--- a/src/TinyVector.h
+++ b/src/TinyVector.h
@@ -23,7 +23,7 @@
#include <string.h>
#include "types.h"
-namespace ARMJIT
+namespace melonDS
{
/*
TinyVector
diff --git a/src/Wifi.cpp b/src/Wifi.cpp
index 1486b40..1441d1d 100644
--- a/src/Wifi.cpp
+++ b/src/Wifi.cpp
@@ -24,6 +24,8 @@
#include "WifiAP.h"
#include "Platform.h"
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -2265,3 +2267,5 @@ u8* Wifi::GetBSSID()
{
return (u8*)&IOPORT(W_BSSID0);
}
+
+} \ No newline at end of file
diff --git a/src/Wifi.h b/src/Wifi.h
index 5a4f839..c47a883 100644
--- a/src/Wifi.h
+++ b/src/Wifi.h
@@ -21,6 +21,8 @@
#include "Savestate.h"
+namespace melonDS
+{
class WifiAP;
class Wifi
@@ -285,4 +287,5 @@ private:
void RFTransfer_Type3();
};
+}
#endif
diff --git a/src/WifiAP.cpp b/src/WifiAP.cpp
index 50100c5..efc34a5 100644
--- a/src/WifiAP.cpp
+++ b/src/WifiAP.cpp
@@ -27,6 +27,8 @@
#include <stddef.h>
#endif
+namespace melonDS
+{
using Platform::Log;
using Platform::LogLevel;
@@ -401,3 +403,5 @@ int WifiAP::RecvPacket(u8* data)
return 0;
}
+
+} \ No newline at end of file
diff --git a/src/WifiAP.h b/src/WifiAP.h
index 34f71e7..5d96668 100644
--- a/src/WifiAP.h
+++ b/src/WifiAP.h
@@ -21,6 +21,8 @@
#include "types.h"
+namespace melonDS
+{
class Wifi;
class WifiAP
@@ -61,4 +63,5 @@ private:
int HandleManagementFrame(u8* data, int len);
};
+}
#endif
diff --git a/src/debug/GdbArch.h b/src/debug/GdbArch.h
index 45f1c1b..1d45fb0 100644
--- a/src/debug/GdbArch.h
+++ b/src/debug/GdbArch.h
@@ -5,6 +5,7 @@
namespace Gdb
{
+using namespace melonDS;
enum class Register : int
{
r0,
diff --git a/src/debug/GdbCmds.cpp b/src/debug/GdbCmds.cpp
index 057502f..c470613 100644
--- a/src/debug/GdbCmds.cpp
+++ b/src/debug/GdbCmds.cpp
@@ -8,6 +8,7 @@
#include "GdbProto.h"
+using namespace melonDS;
using Platform::Log;
using Platform::LogLevel;
diff --git a/src/debug/GdbProto.cpp b/src/debug/GdbProto.cpp
index dc80364..ebdf3be 100644
--- a/src/debug/GdbProto.cpp
+++ b/src/debug/GdbProto.cpp
@@ -24,6 +24,7 @@
#include "GdbProto.h"
+using namespace melonDS;
using Platform::Log;
using Platform::LogLevel;
diff --git a/src/debug/GdbProto.h b/src/debug/GdbProto.h
index ef8bdec..68122f0 100644
--- a/src/debug/GdbProto.h
+++ b/src/debug/GdbProto.h
@@ -13,6 +13,7 @@
namespace Gdb {
+using namespace melonDS;
constexpr int GDBPROTO_BUFFER_CAPACITY = 1024+128;
extern u8 Cmdbuf[GDBPROTO_BUFFER_CAPACITY];
diff --git a/src/debug/GdbStub.cpp b/src/debug/GdbStub.cpp
index d756ce4..099f27f 100644
--- a/src/debug/GdbStub.cpp
+++ b/src/debug/GdbStub.cpp
@@ -25,6 +25,7 @@
#include "../Platform.h"
#include "GdbProto.h"
+using namespace melonDS;
using Platform::Log;
using Platform::LogLevel;
diff --git a/src/debug/GdbStub.h b/src/debug/GdbStub.h
index b3bdab7..ace07bf 100644
--- a/src/debug/GdbStub.h
+++ b/src/debug/GdbStub.h
@@ -13,6 +13,7 @@
namespace Gdb
{
+using namespace melonDS;
enum class TgtStatus
{
NoEvent,
diff --git a/src/debug/hexutil.h b/src/debug/hexutil.h
index 9eb4ad2..63d1deb 100644
--- a/src/debug/hexutil.h
+++ b/src/debug/hexutil.h
@@ -9,6 +9,8 @@ extern "C"
#include <stdint.h>
+namespace melonDS
+{
inline static uint8_t hex2nyb(uint8_t v)
{
if (v >= '0' && v <= '9') return v - '0';
@@ -71,5 +73,6 @@ inline static uint32_t unhex32(const uint8_t* src)
}
#endif
+}
#endif
diff --git a/src/dolphin/Arm64Emitter.h b/src/dolphin/Arm64Emitter.h
index 0b066de..0fe4c91 100644
--- a/src/dolphin/Arm64Emitter.h
+++ b/src/dolphin/Arm64Emitter.h
@@ -14,6 +14,8 @@
namespace Arm64Gen
{
+using namespace melonDS;
+using namespace Common;
// X30 serves a dual purpose as a link register
// Encoded as <u3:type><u5:reg>
// Types:
diff --git a/src/dolphin/ArmCommon.h b/src/dolphin/ArmCommon.h
index 6d82e9d..cae2ecb 100644
--- a/src/dolphin/ArmCommon.h
+++ b/src/dolphin/ArmCommon.h
@@ -24,4 +24,4 @@ enum CCFlags
CC_HS = CC_CS, // Alias of CC_CS Unsigned higher or same
CC_LO = CC_CC, // Alias of CC_CC Unsigned lower
};
-const u32 NO_COND = 0xE0000000;
+const melonDS::u32 NO_COND = 0xE0000000;
diff --git a/src/dolphin/BitSet.h b/src/dolphin/BitSet.h
index 09cc1ce..424364e 100644
--- a/src/dolphin/BitSet.h
+++ b/src/dolphin/BitSet.h
@@ -10,6 +10,7 @@
namespace Common
{
+using namespace melonDS;
#if defined(__GNUC__) || defined(__clang__)
__attribute((always_inline)) static constexpr int CountSetBits(u8 val)
{
@@ -218,9 +219,10 @@ public:
constexpr Iterator end() const { return Iterator(m_val, -1); }
IntTy m_val;
};
+
+using BitSet8 = BitSet<u8>;
+using BitSet16 = BitSet<u16>;
+using BitSet32 = BitSet<u32>;
+using BitSet64 = BitSet<u64>;
} // namespace Common
-using BitSet8 = Common::BitSet<u8>;
-using BitSet16 = Common::BitSet<u16>;
-using BitSet32 = Common::BitSet<u32>;
-using BitSet64 = Common::BitSet<u64>;
diff --git a/src/dolphin/MathUtil.h b/src/dolphin/MathUtil.h
index b1dbbae..800a327 100644
--- a/src/dolphin/MathUtil.h
+++ b/src/dolphin/MathUtil.h
@@ -38,7 +38,7 @@ constexpr bool IsPow2(T imm)
return imm > 0 && (imm & (imm - 1)) == 0;
}
-constexpr u32 NextPowerOf2(u32 value)
+constexpr melonDS::u32 NextPowerOf2(melonDS::u32 value)
{
--value;
value |= value >> 1;
@@ -99,7 +99,7 @@ struct Rectangle
float MathFloatVectorSum(const std::vector<float>&);
// Rounds down. 0 -> undefined
-inline int IntLog2(u64 val)
+inline int IntLog2(melonDS::u64 val)
{
#if defined(__GNUC__)
return 63 - __builtin_clzll(val);
diff --git a/src/dolphin/x64ABI.cpp b/src/dolphin/x64ABI.cpp
index d86a158..d85168a 100644
--- a/src/dolphin/x64ABI.cpp
+++ b/src/dolphin/x64ABI.cpp
@@ -6,8 +6,9 @@
#include "x64ABI.h"
#include "x64Emitter.h"
-using namespace Gen;
-
+namespace Gen
+{
+using namespace Common;
// Shared code between Win64 and Unix64
void XEmitter::ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size,
@@ -117,3 +118,4 @@ void XEmitter::MOVTwo(int bits, Gen::X64Reg dst1, Gen::X64Reg src1, s32 offset1,
ADD(bits, R(dst1), Imm32(offset1));
}
}
+} \ No newline at end of file
diff --git a/src/dolphin/x64CPUDetect.cpp b/src/dolphin/x64CPUDetect.cpp
index 49b51c9..2339048 100644
--- a/src/dolphin/x64CPUDetect.cpp
+++ b/src/dolphin/x64CPUDetect.cpp
@@ -17,6 +17,8 @@
#include <sys/types.h>
#endif
+using namespace melonDS;
+
static inline void __cpuidex(int info[4], int function_id, int subfunction_id)
{
#ifdef __FreeBSD__
diff --git a/src/dolphin/x64Emitter.cpp b/src/dolphin/x64Emitter.cpp
index fd90ba7..a4543af 100644
--- a/src/dolphin/x64Emitter.cpp
+++ b/src/dolphin/x64Emitter.cpp
@@ -12,6 +12,8 @@
#include "Compat.h"
#include "CommonFuncs.h"
+using namespace melonDS;
+
namespace Gen
{
// TODO(ector): Add EAX special casing, for ever so slightly smaller code.
diff --git a/src/dolphin/x64Emitter.h b/src/dolphin/x64Emitter.h
index 8799600..3660321 100644
--- a/src/dolphin/x64Emitter.h
+++ b/src/dolphin/x64Emitter.h
@@ -19,6 +19,8 @@
namespace Gen
{
+using namespace melonDS;
+using namespace Common;
enum CCFlags
{
CC_O = 0,
diff --git a/src/frontend/FrontendUtil.h b/src/frontend/FrontendUtil.h
index 375769d..8d94b37 100644
--- a/src/frontend/FrontendUtil.h
+++ b/src/frontend/FrontendUtil.h
@@ -26,6 +26,7 @@
namespace Frontend
{
+using namespace melonDS;
enum ScreenLayout
{
diff --git a/src/frontend/Util_Audio.cpp b/src/frontend/Util_Audio.cpp
index 278a5a0..4a1d089 100644
--- a/src/frontend/Util_Audio.cpp
+++ b/src/frontend/Util_Audio.cpp
@@ -27,6 +27,7 @@
#include "mic_blow.h"
+using namespace melonDS;
namespace Frontend
{
diff --git a/src/frontend/duckstation/gl/context.h b/src/frontend/duckstation/gl/context.h
index 41d8a2c..06e0bc5 100644
--- a/src/frontend/duckstation/gl/context.h
+++ b/src/frontend/duckstation/gl/context.h
@@ -6,6 +6,7 @@
#include <vector>
namespace GL {
+using namespace melonDS;
class Context
{
public:
diff --git a/src/frontend/duckstation/gl/context_agl.h b/src/frontend/duckstation/gl/context_agl.h
index 459bf2f..4ae5202 100644
--- a/src/frontend/duckstation/gl/context_agl.h
+++ b/src/frontend/duckstation/gl/context_agl.h
@@ -13,6 +13,7 @@ struct NSView;
namespace GL {
+using namespace melonDS;
class ContextAGL final : public Context
{
public:
diff --git a/src/frontend/duckstation/gl/context_wgl.cpp b/src/frontend/duckstation/gl/context_wgl.cpp
index 03c18e8..09f994c 100644
--- a/src/frontend/duckstation/gl/context_wgl.cpp
+++ b/src/frontend/duckstation/gl/context_wgl.cpp
@@ -3,6 +3,7 @@
#include "../log.h"
#include "../scoped_guard.h"
#include "loader.h"
+using namespace melonDS;
Log_SetChannel(GL::ContextWGL);
// TODO: get rid of this
diff --git a/src/frontend/duckstation/gl/x11_window.h b/src/frontend/duckstation/gl/x11_window.h
index aff38b7..e216a05 100644
--- a/src/frontend/duckstation/gl/x11_window.h
+++ b/src/frontend/duckstation/gl/x11_window.h
@@ -4,6 +4,7 @@
#include <X11/Xutil.h>
namespace GL {
+using namespace melonDS;
class X11Window
{
public:
diff --git a/src/frontend/duckstation/window_info.h b/src/frontend/duckstation/window_info.h
index 44912ca..4352617 100644
--- a/src/frontend/duckstation/window_info.h
+++ b/src/frontend/duckstation/window_info.h
@@ -28,8 +28,8 @@ struct WindowInfo
Type type = Type::Surfaceless;
void* display_connection = nullptr;
void* window_handle = nullptr;
- u32 surface_width = 0;
- u32 surface_height = 0;
+ melonDS::u32 surface_width = 0;
+ melonDS::u32 surface_height = 0;
float surface_refresh_rate = 0.0f;
float surface_scale = 1.0f;
SurfaceFormat surface_format = SurfaceFormat::RGB8;
diff --git a/src/frontend/mic_blow.h b/src/frontend/mic_blow.h
index 20d5017..f8dbc10 100644
--- a/src/frontend/mic_blow.h
+++ b/src/frontend/mic_blow.h
@@ -19,7 +19,9 @@
#ifndef MIC_BLOW_H
#define MIC_BLOW_H
-const u16 mic_blow[] =
+#include "types.h"
+
+const melonDS::u16 mic_blow[] =
{
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFC, 0xFFFF, 0xFFFC, 0xFFFF, 0xFFFD, 0xFFFF, 0xFFFC, 0xFFFF, 0xFFFD, 0xFFFF, 0xFFFF,
0xFFFE, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFE, 0xFFFF, 0xFFFC, 0xFFFF, 0xFFFC, 0xFFFF, 0xFFFD, 0xFFFF, 0xFFFC, 0xFFFF,
diff --git a/src/frontend/qt_sdl/ArchiveUtil.cpp b/src/frontend/qt_sdl/ArchiveUtil.cpp
index 6f4b134..7d1eca9 100644
--- a/src/frontend/qt_sdl/ArchiveUtil.cpp
+++ b/src/frontend/qt_sdl/ArchiveUtil.cpp
@@ -19,6 +19,7 @@
#include "ArchiveUtil.h"
#include "Platform.h"
+using namespace melonDS;
using Platform::Log;
using Platform::LogLevel;
diff --git a/src/frontend/qt_sdl/ArchiveUtil.h b/src/frontend/qt_sdl/ArchiveUtil.h
index 14ff996..eaffb0d 100644
--- a/src/frontend/qt_sdl/ArchiveUtil.h
+++ b/src/frontend/qt_sdl/ArchiveUtil.h
@@ -35,6 +35,7 @@
namespace Archive
{
+using namespace melonDS;
QVector<QString> ListArchive(QString path);
s32 ExtractFileFromArchive(QString path, QString wantedFile, u8** filedata, u32* filesize);
//QVector<QString> ExtractFileFromArchive(QString path, QString wantedFile, QByteArray *romBuffer);
diff --git a/src/frontend/qt_sdl/AudioInOut.cpp b/src/frontend/qt_sdl/AudioInOut.cpp
index 7faac9f..90708b2 100644
--- a/src/frontend/qt_sdl/AudioInOut.cpp
+++ b/src/frontend/qt_sdl/AudioInOut.cpp
@@ -28,6 +28,7 @@
#include "Input.h"
#include "main.h"
+using namespace melonDS;
namespace AudioInOut
{
diff --git a/src/frontend/qt_sdl/AudioSettingsDialog.cpp b/src/frontend/qt_sdl/AudioSettingsDialog.cpp
index 386519b..cb42e64 100644
--- a/src/frontend/qt_sdl/AudioSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/AudioSettingsDialog.cpp
@@ -31,6 +31,7 @@
#include "ui_AudioSettingsDialog.h"
+using namespace melonDS;
AudioSettingsDialog* AudioSettingsDialog::currentDlg = nullptr;
extern std::string EmuDirectory;
diff --git a/src/frontend/qt_sdl/CLI.cpp b/src/frontend/qt_sdl/CLI.cpp
index dce8ab6..299ce65 100644
--- a/src/frontend/qt_sdl/CLI.cpp
+++ b/src/frontend/qt_sdl/CLI.cpp
@@ -27,8 +27,8 @@
#include "CLI.h"
#include "Platform.h"
-using Platform::Log;
-using Platform::LogLevel;
+using melonDS::Platform::Log;
+using melonDS::Platform::LogLevel;
namespace CLI
{
diff --git a/src/frontend/qt_sdl/CameraManager.cpp b/src/frontend/qt_sdl/CameraManager.cpp
index cc532ff..cc575d2 100644
--- a/src/frontend/qt_sdl/CameraManager.cpp
+++ b/src/frontend/qt_sdl/CameraManager.cpp
@@ -21,6 +21,7 @@
#include "CameraManager.h"
#include "Config.h"
+using namespace melonDS;
#if QT_VERSION >= 0x060000
diff --git a/src/frontend/qt_sdl/CameraManager.h b/src/frontend/qt_sdl/CameraManager.h
index 91e73fb..882b051 100644
--- a/src/frontend/qt_sdl/CameraManager.h
+++ b/src/frontend/qt_sdl/CameraManager.h
@@ -89,11 +89,11 @@ public:
void setXFlip(bool flip);
- void captureFrame(u32* frame, int width, int height, bool yuv);
+ void captureFrame(melonDS::u32* frame, int width, int height, bool yuv);
- void feedFrame(u32* frame, int width, int height, bool yuv);
- void feedFrame_UYVY(u32* frame, int width, int height);
- void feedFrame_NV12(u8* planeY, u8* planeUV, int width, int height);
+ void feedFrame(melonDS::u32* frame, int width, int height, bool yuv);
+ void feedFrame_UYVY(melonDS::u32* frame, int width, int height);
+ void feedFrame_NV12(melonDS::u8* planeY, melonDS::u8* planeUV, int width, int height);
signals:
void camStartSignal();
@@ -120,15 +120,15 @@ private:
int frameWidth, frameHeight;
bool frameFormatYUV;
- u32* frameBuffer;
- u32* tempFrameBuffer;
+ melonDS::u32* frameBuffer;
+ melonDS::u32* tempFrameBuffer;
QMutex frameMutex;
bool xFlip;
- void copyFrame_Straight(u32* src, int swidth, int sheight, u32* dst, int dwidth, int dheight, bool xflip, bool yuv);
- void copyFrame_RGBtoYUV(u32* src, int swidth, int sheight, u32* dst, int dwidth, int dheight, bool xflip);
- void copyFrame_YUVtoRGB(u32* src, int swidth, int sheight, u32* dst, int dwidth, int dheight, bool xflip);
+ void copyFrame_Straight(melonDS::u32* src, int swidth, int sheight, melonDS::u32* dst, int dwidth, int dheight, bool xflip, bool yuv);
+ void copyFrame_RGBtoYUV(melonDS::u32* src, int swidth, int sheight, melonDS::u32* dst, int dwidth, int dheight, bool xflip);
+ void copyFrame_YUVtoRGB(melonDS::u32* src, int swidth, int sheight, melonDS::u32* dst, int dwidth, int dheight, bool xflip);
};
#endif // CAMERAMANAGER_H
diff --git a/src/frontend/qt_sdl/CameraSettingsDialog.cpp b/src/frontend/qt_sdl/CameraSettingsDialog.cpp
index 1da0318..cf40417 100644
--- a/src/frontend/qt_sdl/CameraSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/CameraSettingsDialog.cpp
@@ -26,6 +26,7 @@
#include "CameraSettingsDialog.h"
#include "ui_CameraSettingsDialog.h"
+using namespace melonDS;
CameraSettingsDialog* CameraSettingsDialog::currentDlg = nullptr;
diff --git a/src/frontend/qt_sdl/CheatsDialog.cpp b/src/frontend/qt_sdl/CheatsDialog.cpp
index ceaf803..df68723 100644
--- a/src/frontend/qt_sdl/CheatsDialog.cpp
+++ b/src/frontend/qt_sdl/CheatsDialog.cpp
@@ -29,6 +29,7 @@
#include "CheatsDialog.h"
#include "ui_CheatsDialog.h"
+using namespace melonDS;
using Platform::Log;
using Platform::LogLevel;
diff --git a/src/frontend/qt_sdl/CheatsDialog.h b/src/frontend/qt_sdl/CheatsDialog.h
index 8af75be..ab2ac30 100644
--- a/src/frontend/qt_sdl/CheatsDialog.h
+++ b/src/frontend/qt_sdl/CheatsDialog.h
@@ -27,8 +27,8 @@
#include "ARCodeFile.h"
-Q_DECLARE_METATYPE(ARCodeList::iterator)
-Q_DECLARE_METATYPE(ARCodeCatList::iterator)
+Q_DECLARE_METATYPE(melonDS::ARCodeList::iterator)
+Q_DECLARE_METATYPE(melonDS::ARCodeCatList::iterator)
namespace Ui { class CheatsDialog; }
class CheatsDialog;
@@ -87,7 +87,7 @@ private slots:
private:
Ui::CheatsDialog* ui;
- ARCodeFile* codeFile;
+ melonDS::ARCodeFile* codeFile;
ARCodeChecker* codeChecker;
};
diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp
index 9c6aff8..b6fca7d 100644
--- a/src/frontend/qt_sdl/Config.cpp
+++ b/src/frontend/qt_sdl/Config.cpp
@@ -26,6 +26,7 @@
namespace Config
{
+using namespace melonDS;
int KeyMapping[12];
int JoyMapping[12];
diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.cpp b/src/frontend/qt_sdl/EmuSettingsDialog.cpp
index 48b380b..0a834a6 100644
--- a/src/frontend/qt_sdl/EmuSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/EmuSettingsDialog.cpp
@@ -29,7 +29,8 @@
#include "EmuSettingsDialog.h"
#include "ui_EmuSettingsDialog.h"
-using namespace Platform;
+using namespace melonDS::Platform;
+using namespace melonDS;
EmuSettingsDialog* EmuSettingsDialog::currentDlg = nullptr;
diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp
index 5f76b08..1ec2e8c 100644
--- a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp
@@ -24,6 +24,8 @@
#include "FirmwareSettingsDialog.h"
#include "ui_FirmwareSettingsDialog.h"
+using namespace melonDS::Platform;
+namespace Platform = melonDS::Platform;
FirmwareSettingsDialog* FirmwareSettingsDialog::currentDlg = nullptr;
diff --git a/src/frontend/qt_sdl/Input.cpp b/src/frontend/qt_sdl/Input.cpp
index 1d39a0f..c429cd3 100644
--- a/src/frontend/qt_sdl/Input.cpp
+++ b/src/frontend/qt_sdl/Input.cpp
@@ -22,6 +22,7 @@
#include "Input.h"
#include "Config.h"
+using namespace melonDS;
namespace Input
{
diff --git a/src/frontend/qt_sdl/Input.h b/src/frontend/qt_sdl/Input.h
index 04f7a1f..366c9c3 100644
--- a/src/frontend/qt_sdl/Input.h
+++ b/src/frontend/qt_sdl/Input.h
@@ -24,6 +24,7 @@
namespace Input
{
+using namespace melonDS;
extern int JoystickID;
extern SDL_Joystick* Joystick;
diff --git a/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp b/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp
index 6d651c9..02a76bb 100644
--- a/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp
+++ b/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp
@@ -32,6 +32,7 @@
#include "ui_InputConfigDialog.h"
+using namespace melonDS;
InputConfigDialog* InputConfigDialog::currentDlg = nullptr;
const int dskeyorder[12] = {0, 1, 10, 11, 5, 4, 6, 7, 9, 8, 2, 3};
diff --git a/src/frontend/qt_sdl/InputConfig/MapButton.h b/src/frontend/qt_sdl/InputConfig/MapButton.h
index b35cc1f..5d4fb3e 100644
--- a/src/frontend/qt_sdl/InputConfig/MapButton.h
+++ b/src/frontend/qt_sdl/InputConfig/MapButton.h
@@ -52,7 +52,7 @@ protected:
{
if (!isChecked()) return QPushButton::keyPressEvent(event);
- Platform::Log(Platform::Debug, "KEY PRESSED = %08X %08X | %08X %08X %08X\n", event->key(), (int)event->modifiers(), event->nativeVirtualKey(), event->nativeModifiers(), event->nativeScanCode());
+ Log(melonDS::Platform::Debug, "KEY PRESSED = %08X %08X | %08X %08X %08X\n", event->key(), (int)event->modifiers(), event->nativeVirtualKey(), event->nativeModifiers(), event->nativeScanCode());
int key = event->key();
int mod = event->modifiers();
diff --git a/src/frontend/qt_sdl/LAN_PCap.cpp b/src/frontend/qt_sdl/LAN_PCap.cpp
index e1cbc11..4a1ebc3 100644
--- a/src/frontend/qt_sdl/LAN_PCap.cpp
+++ b/src/frontend/qt_sdl/LAN_PCap.cpp
@@ -41,6 +41,7 @@
#endif
#endif
+using namespace melonDS;
using Platform::Log;
using Platform::LogLevel;
diff --git a/src/frontend/qt_sdl/LAN_PCap.h b/src/frontend/qt_sdl/LAN_PCap.h
index fe6e000..2e03d66 100644
--- a/src/frontend/qt_sdl/LAN_PCap.h
+++ b/src/frontend/qt_sdl/LAN_PCap.h
@@ -24,6 +24,7 @@
namespace LAN_PCap
{
+using namespace melonDS;
struct AdapterData
{
char DeviceName[128];
diff --git a/src/frontend/qt_sdl/LAN_Socket.cpp b/src/frontend/qt_sdl/LAN_Socket.cpp
index e1c8663..e938af8 100644
--- a/src/frontend/qt_sdl/LAN_Socket.cpp
+++ b/src/frontend/qt_sdl/LAN_Socket.cpp
@@ -37,6 +37,7 @@
#include <time.h>
#endif
+using namespace melonDS;
namespace LAN_Socket
{
diff --git a/src/frontend/qt_sdl/LAN_Socket.h b/src/frontend/qt_sdl/LAN_Socket.h
index 9b97301..043e133 100644
--- a/src/frontend/qt_sdl/LAN_Socket.h
+++ b/src/frontend/qt_sdl/LAN_Socket.h
@@ -23,6 +23,7 @@
namespace LAN_Socket
{
+using namespace melonDS;
//
diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp
index 4b3a6a6..a0dfdf7 100644
--- a/src/frontend/qt_sdl/LocalMP.cpp
+++ b/src/frontend/qt_sdl/LocalMP.cpp
@@ -38,6 +38,9 @@
#include "LocalMP.h"
#include "Platform.h"
+using namespace melonDS;
+using namespace melonDS::Platform;
+
using Platform::Log;
using Platform::LogLevel;
diff --git a/src/frontend/qt_sdl/LocalMP.h b/src/frontend/qt_sdl/LocalMP.h
index 07c6f43..e7b4188 100644
--- a/src/frontend/qt_sdl/LocalMP.h
+++ b/src/frontend/qt_sdl/LocalMP.h
@@ -24,6 +24,7 @@
namespace LocalMP
{
+using namespace melonDS;
bool Init();
void DeInit();
diff --git a/src/frontend/qt_sdl/OSD.cpp b/src/frontend/qt_sdl/OSD.cpp
index 02ec158..25072df 100644
--- a/src/frontend/qt_sdl/OSD.cpp
+++ b/src/frontend/qt_sdl/OSD.cpp
@@ -32,6 +32,8 @@
#include "Config.h"
+using namespace melonDS;
+
extern MainWindow* mainWindow;
namespace OSD
diff --git a/src/frontend/qt_sdl/OSD.h b/src/frontend/qt_sdl/OSD.h
index b399fb4..64131d5 100644
--- a/src/frontend/qt_sdl/OSD.h
+++ b/src/frontend/qt_sdl/OSD.h
@@ -19,9 +19,12 @@
#ifndef OSD_H
#define OSD_H
+#include "types.h"
+
namespace OSD
{
+using namespace melonDS;
bool Init(bool openGL);
void DeInit();
diff --git a/src/frontend/qt_sdl/PathSettingsDialog.cpp b/src/frontend/qt_sdl/PathSettingsDialog.cpp
index 1f1c35c..1d69853 100644
--- a/src/frontend/qt_sdl/PathSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/PathSettingsDialog.cpp
@@ -27,6 +27,8 @@
#include "PathSettingsDialog.h"
#include "ui_PathSettingsDialog.h"
+using namespace melonDS::Platform;
+namespace Platform = melonDS::Platform;
PathSettingsDialog* PathSettingsDialog::currentDlg = nullptr;
diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp
index df97590..c2e2f47 100644
--- a/src/frontend/qt_sdl/Platform.cpp
+++ b/src/frontend/qt_sdl/Platform.cpp
@@ -54,7 +54,7 @@ extern CameraManager* camManager[2];
void emuStop();
-namespace Platform
+namespace melonDS::Platform
{
QSharedMemory* IPCBuffer = nullptr;
diff --git a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp
index 1d69988..14ccd51 100644
--- a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp
+++ b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp
@@ -30,6 +30,8 @@
#include <QtDebug>
+using namespace melonDS;
+
PowerManagementDialog* PowerManagementDialog::currentDlg = nullptr;
PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent), ui(new Ui::PowerManagementDialog)
diff --git a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h
index 0302586..cd2954a 100644
--- a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h
+++ b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h
@@ -67,7 +67,7 @@ private:
bool inited;
bool oldDSBatteryLevel;
- u8 oldDSiBatteryLevel;
+ melonDS::u8 oldDSiBatteryLevel;
bool oldDSiBatteryCharging;
void updateDSBatteryLevelControls();
diff --git a/src/frontend/qt_sdl/RAMInfoDialog.cpp b/src/frontend/qt_sdl/RAMInfoDialog.cpp
index b13ff02..b58662c 100644
--- a/src/frontend/qt_sdl/RAMInfoDialog.cpp
+++ b/src/frontend/qt_sdl/RAMInfoDialog.cpp
@@ -21,6 +21,7 @@
#include "main.h"
+using namespace melonDS;
extern EmuThread* emuThread;
s32 GetMainRAMValue(const u32& addr, const ramInfo_ByteType& byteType)
diff --git a/src/frontend/qt_sdl/RAMInfoDialog.h b/src/frontend/qt_sdl/RAMInfoDialog.h
index 33afd98..adc9b28 100644
--- a/src/frontend/qt_sdl/RAMInfoDialog.h
+++ b/src/frontend/qt_sdl/RAMInfoDialog.h
@@ -53,22 +53,22 @@ enum
ramInfo_Previous
};
-s32 GetMainRAMValue(const u32& addr, const ramInfo_ByteType& byteType);
+melonDS::s32 GetMainRAMValue(const melonDS::u32& addr, const ramInfo_ByteType& byteType);
struct ramInfo_RowData
{
- u32 Address;
- s32 Value;
- s32 Previous;
+ melonDS::u32 Address;
+ melonDS::s32 Value;
+ melonDS::s32 Previous;
void Update(const ramInfo_ByteType& byteType)
{
Value = GetMainRAMValue(Address, byteType);
}
- void SetValue(const s32& value)
+ void SetValue(const melonDS::s32& value)
{
- NDS::MainRAM[Address&NDS::MainRAMMask] = (u32)value;
+ melonDS::NDS::MainRAM[Address&melonDS::NDS::MainRAMMask] = (melonDS::u32)value;
Value = value;
}
};
@@ -99,7 +99,7 @@ public:
currentDlg = nullptr;
}
- s32 SearchValue = 0;
+ melonDS::s32 SearchValue = 0;
void ClearTableContents();
@@ -115,7 +115,7 @@ private slots:
void OnSearchFinished();
void ShowRowsInTable();
- void SetProgressbarValue(const u32& value);
+ void SetProgressbarValue(const melonDS::u32& value);
private:
Ui::RAMInfoDialog* ui;
@@ -132,7 +132,7 @@ public:
explicit RAMSearchThread(RAMInfoDialog* dialog);
~RAMSearchThread() override;
- void Start(const s32& searchValue, const ramInfoSTh_SearchMode& searchMode = ramInfoSTh_Default);
+ void Start(const melonDS::s32& searchValue, const ramInfoSTh_SearchMode& searchMode = ramInfoSTh_Default);
void Start(const ramInfoSTh_SearchMode& searchMode);
void SetSearchByteType(const ramInfo_ByteType& bytetype);
@@ -148,14 +148,14 @@ private:
bool SearchRunning = false;
ramInfoSTh_SearchMode SearchMode;
- s32 SearchValue;
+ melonDS::s32 SearchValue;
ramInfo_ByteType SearchByteType = ramInfo_OneByte;
std::vector<ramInfo_RowData>* RowDataVector = nullptr;
void ClearTableContents();
signals:
- void SetProgressbarValue(const u32& value);
+ void SetProgressbarValue(const melonDS::u32& value);
};
#endif // RAMINFODIALOG_H
diff --git a/src/frontend/qt_sdl/ROMInfoDialog.cpp b/src/frontend/qt_sdl/ROMInfoDialog.cpp
index 34917d0..6a46b18 100644
--- a/src/frontend/qt_sdl/ROMInfoDialog.cpp
+++ b/src/frontend/qt_sdl/ROMInfoDialog.cpp
@@ -28,6 +28,8 @@
#include "Platform.h"
#include "Config.h"
+using namespace melonDS;
+
QString IntToHex(u64 num)
{
return ("0x" + QString::number(num, 16).toUpper());
diff --git a/src/frontend/qt_sdl/ROMInfoDialog.h b/src/frontend/qt_sdl/ROMInfoDialog.h
index 630ac22..7316e98 100644
--- a/src/frontend/qt_sdl/ROMInfoDialog.h
+++ b/src/frontend/qt_sdl/ROMInfoDialog.h
@@ -69,7 +69,7 @@ private:
QImage iconImage;
QTimeLine* iconTimeline;
- u32 animatedIconData[64][32*32] = {0};
+ melonDS::u32 animatedIconData[64][32*32] = {0};
std::vector<QPixmap> animatedIconImages;
std::vector<int> animatedSequence;
};
diff --git a/src/frontend/qt_sdl/ROMManager.cpp b/src/frontend/qt_sdl/ROMManager.cpp
index 1c58055..9584c38 100644
--- a/src/frontend/qt_sdl/ROMManager.cpp
+++ b/src/frontend/qt_sdl/ROMManager.cpp
@@ -51,7 +51,8 @@ using std::string;
using std::tie;
using std::unique_ptr;
using std::wstring_convert;
-using namespace Platform;
+using namespace melonDS;
+using namespace melonDS::Platform;
namespace ROMManager
{
diff --git a/src/frontend/qt_sdl/ROMManager.h b/src/frontend/qt_sdl/ROMManager.h
index 6d95763..9228560 100644
--- a/src/frontend/qt_sdl/ROMManager.h
+++ b/src/frontend/qt_sdl/ROMManager.h
@@ -31,6 +31,7 @@
namespace ROMManager
{
+using namespace melonDS;
extern SaveManager* NDSSave;
extern SaveManager* GBASave;
extern std::unique_ptr<SaveManager> FirmwareSave;
diff --git a/src/frontend/qt_sdl/SaveManager.cpp b/src/frontend/qt_sdl/SaveManager.cpp
index 78d4b0e..55279dc 100644
--- a/src/frontend/qt_sdl/SaveManager.cpp
+++ b/src/frontend/qt_sdl/SaveManager.cpp
@@ -22,7 +22,8 @@
#include "SaveManager.h"
#include "Platform.h"
-using namespace Platform;
+using namespace melonDS;
+using namespace melonDS::Platform;
SaveManager::SaveManager(const std::string& path) : QThread()
{
diff --git a/src/frontend/qt_sdl/SaveManager.h b/src/frontend/qt_sdl/SaveManager.h
index 6ffb4f8..d7132e6 100644
--- a/src/frontend/qt_sdl/SaveManager.h
+++ b/src/frontend/qt_sdl/SaveManager.h
@@ -41,31 +41,31 @@ public:
std::string GetPath();
void SetPath(const std::string& path, bool reload);
- void RequestFlush(const u8* savedata, u32 savelen, u32 writeoffset, u32 writelen);
+ void RequestFlush(const melonDS::u8* savedata, melonDS::u32 savelen, melonDS::u32 writeoffset, melonDS::u32 writelen);
void CheckFlush();
bool NeedsFlush();
- void FlushSecondaryBuffer(u8* dst = nullptr, u32 dstLength = 0);
+ void FlushSecondaryBuffer(melonDS::u8* dst = nullptr, melonDS::u32 dstLength = 0);
private:
std::string Path;
std::atomic_bool Running;
- std::unique_ptr<u8[]> Buffer;
- u32 Length;
+ std::unique_ptr<melonDS::u8[]> Buffer;
+ melonDS::u32 Length;
bool FlushRequested;
QMutex* SecondaryBufferLock;
- std::unique_ptr<u8[]> SecondaryBuffer;
- u32 SecondaryBufferLength;
+ std::unique_ptr<melonDS::u8[]> SecondaryBuffer;
+ melonDS::u32 SecondaryBufferLength;
time_t TimeAtLastFlushRequest;
// We keep versions in case the user closes the application before
// a flush cycle is finished.
- u32 PreviousFlushVersion;
- u32 FlushVersion;
+ melonDS::u32 PreviousFlushVersion;
+ melonDS::u32 FlushVersion;
};
#endif // SAVEMANAGER_H
diff --git a/src/frontend/qt_sdl/TitleManagerDialog.cpp b/src/frontend/qt_sdl/TitleManagerDialog.cpp
index eb6b594..eda1bbc 100644
--- a/src/frontend/qt_sdl/TitleManagerDialog.cpp
+++ b/src/frontend/qt_sdl/TitleManagerDialog.cpp
@@ -30,7 +30,8 @@
#include "ui_TitleManagerDialog.h"
#include "ui_TitleImportDialog.h"
-using namespace Platform;
+using namespace melonDS;
+using namespace melonDS::Platform;
std::unique_ptr<DSi_NAND::NANDImage> TitleManagerDialog::nand = nullptr;
TitleManagerDialog* TitleManagerDialog::currentDlg = nullptr;
diff --git a/src/frontend/qt_sdl/TitleManagerDialog.h b/src/frontend/qt_sdl/TitleManagerDialog.h
index 7209f96..2e392eb 100644
--- a/src/frontend/qt_sdl/TitleManagerDialog.h
+++ b/src/frontend/qt_sdl/TitleManagerDialog.h
@@ -46,10 +46,10 @@ class TitleManagerDialog : public QDialog
Q_OBJECT
public:
- explicit TitleManagerDialog(QWidget* parent, DSi_NAND::NANDImage& image);
+ explicit TitleManagerDialog(QWidget* parent, melonDS::DSi_NAND::NANDImage& image);
~TitleManagerDialog();
- static std::unique_ptr<DSi_NAND::NANDImage> nand;
+ static std::unique_ptr<melonDS::DSi_NAND::NANDImage> nand;
static bool openNAND();
static void closeNAND();
@@ -94,17 +94,17 @@ private slots:
void onExportTitleData();
private:
- DSi_NAND::NANDMount nandmount;
+ melonDS::DSi_NAND::NANDMount nandmount;
Ui::TitleManagerDialog* ui;
QString importAppPath;
- DSi_TMD::TitleMetadata importTmdData;
+ melonDS::DSi_TMD::TitleMetadata importTmdData;
bool importReadOnly;
QAction* actImportTitleData[3];
QAction* actExportTitleData[3];
- void createTitleItem(u32 category, u32 titleid);
+ void createTitleItem(melonDS::u32 category, melonDS::u32 titleid);
};
class TitleImportDialog : public QDialog
@@ -112,7 +112,7 @@ class TitleImportDialog : public QDialog
Q_OBJECT
public:
- explicit TitleImportDialog(QWidget* parent, QString& apppath, const DSi_TMD::TitleMetadata* tmd, bool& readonly, DSi_NAND::NANDMount& nand);
+ explicit TitleImportDialog(QWidget* parent, QString& apppath, const melonDS::DSi_TMD::TitleMetadata* tmd, bool& readonly, melonDS::DSi_NAND::NANDMount& nand);
~TitleImportDialog();
private slots:
@@ -125,7 +125,7 @@ private slots:
private:
Ui::TitleImportDialog* ui;
- DSi_NAND::NANDMount& nandmount;
+ melonDS::DSi_NAND::NANDMount& nandmount;
QButtonGroup* grpTmdSource;
@@ -133,10 +133,10 @@ private:
QNetworkReply* netreply;
QString& appPath;
- const DSi_TMD::TitleMetadata* tmdData;
+ const melonDS::DSi_TMD::TitleMetadata* tmdData;
bool& readOnly;
- u32 titleid[2];
+ melonDS::u32 titleid[2];
};
#endif // TITLEMANAGERDIALOG_H
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp
index b820b50..4286498 100644
--- a/src/frontend/qt_sdl/main.cpp
+++ b/src/frontend/qt_sdl/main.cpp
@@ -105,7 +105,7 @@
#include "CLI.h"
// TODO: uniform variable spelling
-
+using namespace melonDS;
const QString NdsRomMimeType = "application/x-nintendo-ds-rom";
const QStringList NdsRomExtensions { ".nds", ".srl", ".dsi", ".ids" };
@@ -163,7 +163,7 @@ EmuThread* emuThread;
int autoScreenSizing = 0;
int videoRenderer;
-Melon::RenderSettings videoSettings;
+RenderSettings videoSettings;
bool videoSettingsDirty;
CameraManager* camManager[2];
diff --git a/src/melonDLDI.h b/src/melonDLDI.h
index 1fe1e59..908a2f6 100644
--- a/src/melonDLDI.h
+++ b/src/melonDLDI.h
@@ -21,6 +21,8 @@
#include "types.h"
+namespace melonDS
+{
const u8 melonDLDI[] =
{
0xED, 0xA5, 0x8D, 0xBF, 0x20, 0x43, 0x68, 0x69, 0x73, 0x68, 0x6D, 0x00, 0x01, 0x09, 0x00, 0x00,
@@ -54,4 +56,5 @@ const u8 melonDLDI[] =
0x1E, 0xFF, 0x2F, 0xE1
};
+}
#endif // MELONDLDI_H
diff --git a/src/types.h b/src/types.h
index 3855644..d37b225 100644
--- a/src/types.h
+++ b/src/types.h
@@ -21,6 +21,8 @@
#include <stdint.h>
+namespace melonDS
+{
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
@@ -30,4 +32,5 @@ typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
+}
#endif // TYPES_H