mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 16:34:28 +01:00
added a GetPointer function to Memory for use with ELF loading
This commit is contained in:
parent
97e4d9f211
commit
20807c4d5a
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2013 Citrus Emulator
|
* Copyright (C) 2014 Citra Emulator
|
||||||
*
|
*
|
||||||
* @file mem_map.cpp
|
* @file mem_map.cpp
|
||||||
* @author ShizZy <shizzy247@gmail.com>
|
* @author ShizZy <shizzy247@gmail.com>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2013 Citrus Emulator
|
* Copyright (C) 2014 Citra Emulator
|
||||||
*
|
*
|
||||||
* @file mem_map.h
|
* @file mem_map.h
|
||||||
* @author ShizZy <shizzy247@gmail.com>
|
* @author ShizZy <shizzy247@gmail.com>
|
||||||
@ -39,6 +39,7 @@
|
|||||||
#define MEM_AXI_WRAM_SIZE 0x00080000 ///< AXI WRAM size
|
#define MEM_AXI_WRAM_SIZE 0x00080000 ///< AXI WRAM size
|
||||||
#define MEM_FCRAM_SIZE 0x08000000 ///< FCRAM size
|
#define MEM_FCRAM_SIZE 0x08000000 ///< FCRAM size
|
||||||
|
|
||||||
|
#define MEM_VRAM_MASK 0x007FFFFF
|
||||||
#define MEM_FCRAM_MASK (MEM_FCRAM_SIZE - 1) ///< FCRAm mask
|
#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 Write16(const u32 addr, const u32 data);
|
||||||
void Write32(const u32 addr, const u32 data);
|
void Write32(const u32 addr, const u32 data);
|
||||||
|
|
||||||
|
u8* GetPointer(const u32 Address);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2013 Citrus Emulator
|
* Copyright (C) 2014 Citra Emulator
|
||||||
*
|
*
|
||||||
* @file mem_map_funcs.cpp
|
* @file mem_map_funcs.cpp
|
||||||
* @author ShizZy <shizzy247@gmail.com>
|
* @author ShizZy <shizzy247@gmail.com>
|
||||||
@ -28,33 +28,6 @@
|
|||||||
|
|
||||||
namespace Memory {
|
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>
|
template <typename T>
|
||||||
inline void ReadFromHardware(T &var, const u32 addr)
|
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 Read8(const u32 addr) {
|
||||||
u8 _var = 0;
|
u8 _var = 0;
|
||||||
ReadFromHardware<u8>(_var, addr);
|
ReadFromHardware<u8>(_var, addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user