mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-06 07:12:56 +12:00
Start adding memory stuff
This commit is contained in:
parent
2057e0c447
commit
905c7ed770
8 changed files with 77 additions and 10 deletions
23
src/core/memory.cpp
Normal file
23
src/core/memory.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "memory.hpp"
|
||||
|
||||
Memory::Memory() {
|
||||
fcram = new uint8_t[128_MB]();
|
||||
}
|
||||
|
||||
void* Memory::getReadPointer(u32 address) {
|
||||
const auto page = address >> pageShift;
|
||||
const auto offset = address & pageMask;
|
||||
|
||||
uintptr_t pointer = readTable[page];
|
||||
if (pointer == 0) return nullptr;
|
||||
return (void*)(pointer + offset);
|
||||
}
|
||||
|
||||
void* Memory::getWritePointer(u32 address) {
|
||||
const auto page = address >> pageShift;
|
||||
const auto offset = address & pageMask;
|
||||
|
||||
uintptr_t pointer = writeTable[page];
|
||||
if (pointer == 0) return nullptr;
|
||||
return (void*)(pointer + offset);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue