mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[Kernel/Memory] Implement datetime a bit more nicely
This commit is contained in:
parent
4da023c236
commit
c4cb20f846
4 changed files with 17 additions and 5 deletions
|
@ -155,6 +155,11 @@ public:
|
|||
return env.totalTicks;
|
||||
}
|
||||
|
||||
// Get reference to tick count. Memory needs access to this
|
||||
u64& getTicksRef() {
|
||||
return env.totalTicks;
|
||||
}
|
||||
|
||||
void runFrame() {
|
||||
env.ticksLeft = 268111856 / 60;
|
||||
const auto exitReason = jit->Run();
|
||||
|
|
|
@ -30,7 +30,7 @@ class Emulator {
|
|||
|
||||
public:
|
||||
Emulator() : window(sf::VideoMode(width, height), "Alber", sf::Style::Default, sf::ContextSettings(0, 0, 0, 4, 3)),
|
||||
kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory) {
|
||||
kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory), memory(cpu.getTicksRef()) {
|
||||
reset();
|
||||
window.setActive(true);
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ namespace KernelMemoryTypes {
|
|||
|
||||
class Memory {
|
||||
u8* fcram;
|
||||
u64& cpuTicks; // Reference to the CPU tick counter
|
||||
|
||||
// Our dynarmic core uses page tables for reads and writes with 4096 byte pages
|
||||
std::vector<uintptr_t> readTable, writeTable;
|
||||
|
@ -93,13 +94,14 @@ class Memory {
|
|||
|
||||
std::bitset<FCRAM_PAGE_COUNT> usedFCRAMPages;
|
||||
std::optional<u32> findPaddr(u32 size);
|
||||
u64 timeSince3DSEpoch();
|
||||
|
||||
public:
|
||||
u16 kernelVersion = 0;
|
||||
u32 usedUserMemory = 0;
|
||||
std::optional<int> gspMemIndex; // Index of GSP shared mem in lockedMemoryInfo or nullopt if it's already reserved
|
||||
|
||||
Memory();
|
||||
Memory(u64& cpuTicks);
|
||||
void reset();
|
||||
void* getReadPointer(u32 address);
|
||||
void* getWritePointer(u32 address);
|
||||
|
@ -118,7 +120,6 @@ public:
|
|||
|
||||
u32 getLinearHeapVaddr();
|
||||
u8* getFCRAM() { return fcram; }
|
||||
u64 timeSince3DSEpoch();
|
||||
|
||||
// Returns whether "addr" is aligned to a page (4096 byte) boundary
|
||||
static constexpr bool isAligned(u32 addr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue