Move all core types into namespaces (#1886)
* Reorganize namespaces - Most types are now moved into the `melonDS` namespace - Only good chance to do this for a while, since a big refactor is next * Fix the build
This commit is contained in:
parent
651b0f680c
commit
346dd4006e
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
13
src/ARM.cpp
13
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
|
||||
|
||||
|
|
23
src/ARM.h
23
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;
|
||||
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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <stdio.h>
|
||||
#include "ARM.h"
|
||||
|
||||
namespace ARMInterpreter
|
||||
namespace melonDS::ARMInterpreter
|
||||
{
|
||||
|
||||
inline bool CarryAdd(u32 a, u32 b)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "ARM.h"
|
||||
|
||||
|
||||
namespace ARMInterpreter
|
||||
namespace melonDS::ARMInterpreter
|
||||
{
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef ARMINTERPRETER_LOADSTORE_H
|
||||
#define ARMINTERPRETER_LOADSTORE_H
|
||||
|
||||
namespace ARMInterpreter
|
||||
namespace melonDS::ARMInterpreter
|
||||
{
|
||||
|
||||
#define A_PROTO_WB_LDRSTR(x) \
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ using namespace Arm64Gen;
|
|||
// hack
|
||||
const int kCodeCacheTiming = 3;
|
||||
|
||||
namespace ARMJIT
|
||||
namespace melonDS
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace ARMJIT
|
||||
namespace melonDS
|
||||
{
|
||||
class ARMJIT;
|
||||
const Arm64Gen::ARM64Reg RMemBase = Arm64Gen::X26;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
using namespace Gen;
|
||||
|
||||
namespace ARMJIT
|
||||
namespace melonDS
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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&),
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "../ARM.h"
|
||||
|
||||
using namespace melonDS;
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
FILE* f = fopen("ARMJIT_Offsets.h", "w");
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "ARMJIT.h"
|
||||
|
||||
namespace ARMInstrInfo
|
||||
namespace melonDS::ARMInstrInfo
|
||||
{
|
||||
|
||||
#define ak(x) ((x) << 23)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
namespace ARMInstrInfo
|
||||
namespace melonDS::ARMInstrInfo
|
||||
{
|
||||
|
||||
// Instruction kinds, for faster dispatch
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -23,6 +23,9 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
namespace melonDS
|
||||
{
|
||||
u32 CRC32(const u8* data, int len, u32 start=0);
|
||||
}
|
||||
|
||||
#endif // CRC32_H
|
||||
|
|
|
@ -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>();
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "DMA_Timings.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace DMATiming
|
||||
namespace melonDS::DMATiming
|
||||
{
|
||||
|
||||
// DMA timing tables
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <array>
|
||||
#include "types.h"
|
||||
|
||||
namespace DMATiming
|
||||
namespace melonDS::DMATiming
|
||||
{
|
||||
|
||||
// DMA timing tables
|
||||
|
|
|
@ -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)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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!!!
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
struct AES_ctx;
|
||||
|
||||
namespace DSi_NAND
|
||||
namespace melonDS::DSi_NAND
|
||||
{
|
||||
|
||||
enum
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "types.h"
|
||||
#include <array>
|
||||
|
||||
namespace DSi_TMD
|
||||
namespace melonDS::DSi_TMD
|
||||
{
|
||||
|
||||
struct TitleMetadataContent {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
@ -1739,3 +1741,4 @@ unsigned char bios_arm9_bin[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
#include "types.h"
|
||||
#include "Savestate.h"
|
||||
|
||||
namespace GBACart
|
||||
namespace melonDS::GBACart
|
||||
{
|
||||
|
||||
enum CartType
|
||||
|
|
14
src/GPU.cpp
14
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;
|
||||
|
|
16
src/GPU.h
16
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 {};
|
||||
|
|
|
@ -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)
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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() {};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "types.h"
|
||||
#include "TinyVector.h"
|
||||
|
||||
namespace ARMJIT
|
||||
namespace melonDS
|
||||
{
|
||||
typedef void (*JitBlockEntry)();
|
||||
|
||||
|
|
12
src/NDS.cpp
12
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)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
15
src/NDS.h
15
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
|
||||
|
|
|
@ -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
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@
|
|||
#include "FATStorage.h"
|
||||
#include "ROMList.h"
|
||||
|
||||
namespace NDSCart
|
||||
namespace melonDS::NDSCart
|
||||
{
|
||||
|
||||
enum CartType
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "OpenGLSupport.h"
|
||||
|
||||
namespace melonDS
|
||||
{
|
||||
|
||||
using Platform::Log;
|
||||
using Platform::LogLevel;
|
||||
|
||||
|
@ -142,3 +145,5 @@ void UseShaderProgram(GLuint* ids)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue