VERY experimental Nintendo Switch 2 emulator
C++
added a GetPointer function to Memory for use with ELF loading
bunnei20807c4d5aad
diff --git a/src/core/src/mem_map.cpp b/src/core/src/mem_map.cppindex eab4051eca..e7b508574d 100644--- a/src/core/src/mem_map.cpp+++ b/src/core/src/mem_map.cpp@@ -1,5 +1,5 @@/**- * Copyright (C) 2013 Citrus Emulator+ * Copyright (C) 2014 Citra Emulator** @file mem_map.cpp* @author ShizZy <[email protected]>diff --git a/src/core/src/mem_map.h b/src/core/src/mem_map.hindex 38004042e1..48137a19bd 100644--- a/src/core/src/mem_map.h+++ b/src/core/src/mem_map.h@@ -1,5 +1,5 @@/**- * Copyright (C) 2013 Citrus Emulator+ * Copyright (C) 2014 Citra Emulator** @file mem_map.h* @author ShizZy <[email protected]>@@ -39,6 +39,7 @@#define MEM_AXI_WRAM_SIZE 0x00080000 ///< AXI WRAM size#define MEM_FCRAM_SIZE 0x08000000 ///< FCRAM size+#define MEM_VRAM_MASK 0x007FFFFF#define MEM_FCRAM_MASK (MEM_FCRAM_SIZE - 1) ///< FCRAm mask////////////////////////////////////////////////////////////////////////////////////////////////////@@ -74,6 +75,8 @@ void Write8(const u32 addr, const u32 data);void Write16(const u32 addr, const u32 data);void Write32(const u32 addr, const u32 data);+u8* GetPointer(const u32 Address);+} // namespace////////////////////////////////////////////////////////////////////////////////////////////////////diff --git a/src/core/src/mem_map_funcs.cpp b/src/core/src/mem_map_funcs.cppindex d1739d7266..f00d10f87b 100644--- a/src/core/src/mem_map_funcs.cpp+++ b/src/core/src/mem_map_funcs.cpp@@ -1,5 +1,5 @@/**- * Copyright (C) 2013 Citrus Emulator+ * Copyright (C) 2014 Citra Emulator** @file mem_map_funcs.cpp* @author ShizZy <[email protected]>@@ -28,33 +28,6 @@namespace Memory {-/*-u8 *GetPointer(const u32 addr)-{- if ((addr & 0x3E000000) == 0x08000000) {- return g_fcram + (addr & MEM_FCRAM_MASK);- }- else if ((addr & 0x3F800000) == 0x04000000) {- return m_pVRAM + (addr & VRAM_MASK);- }- else if ((addr & 0x3F000000) >= 0x08000000 && (addr & 0x3F000000) < 0x08000000 + g_MemorySize) {- return m_pRAM + (addr & g_MemoryMask);- }- else {- ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);- static bool reported = false;- if (!reported) {- Reporting::ReportMessage("Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);- reported = true;- }- if (!g_Config.bIgnoreBadMemAccess) {- Core_EnableStepping(true);- host->SetDebugMode(true);- }- return 0;- }-}*/-template <typename T>inline void ReadFromHardware(T &var, const u32 addr){@@ -125,6 +98,33 @@ bool IsValidAddress(const u32 addr) {}}+u8 *GetPointer(const u32 addr) {+ // TODO(bunnei): Just a stub for now... ImplementMe!+ if ((addr & 0x3E000000) == 0x08000000) {+ return g_fcram + (addr & MEM_FCRAM_MASK);+ }+ //else if ((addr & 0x3F800000) == 0x04000000) {+ // return g_vram + (addr & MEM_VRAM_MASK);+ //}+ //else if ((addr & 0x3F000000) >= 0x08000000 && (addr & 0x3F000000) < 0x08000000 + g_MemorySize) {+ // return m_pRAM + (addr & g_MemoryMask);+ //}+ else {+ //ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);+ ERROR_LOG(MEMMAP, "Unknown GetPointer %08x", addr);+ static bool reported = false;+ //if (!reported) {+ // Reporting::ReportMessage("Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);+ // reported = true;+ //}+ //if (!g_Config.bIgnoreBadMemAccess) {+ // Core_EnableStepping(true);+ // host->SetDebugMode(true);+ //}+ return 0;+ }+}+u8 Read8(const u32 addr) {u8 _var = 0;ReadFromHardware<u8>(_var, addr);