Merge branch 'Sync-Objects' of https://github.com/wheremyfoodat/Virtual3DS into Sync-Objects

This commit is contained in:
wheremyfoodat 2023-04-23 21:32:10 +03:00
commit 8cfb038226
49 changed files with 1256 additions and 138 deletions

View file

@ -34,6 +34,7 @@ class APTService {
void enable(u32 messagePointer);
void getSharedFont(u32 messagePointer);
void getWirelessRebootInfo(u32 messagePointer);
void glanceParameter(u32 messagePointer);
void initialize(u32 messagePointer);
void inquireNotification(u32 messagePointer);
void notifyToWait(u32 messagePointer);

View file

@ -1,4 +1,6 @@
#pragma once
#include <array>
#include <optional>
#include "helpers.hpp"
#include "logger.hpp"
#include "memory.hpp"
@ -41,18 +43,38 @@ public:
}
};
// Circular dependencies!
class Kernel;
class DSPService {
Handle handle = KernelHandles::DSP;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, dspServiceLogger)
// Number of DSP pipes
static constexpr size_t pipeCount = 8;
DSPPipe audioPipe;
// DSP service event handles
using DSPEvent = std::optional<Handle>;
DSPEvent semaphoreEvent;
DSPEvent interrupt0;
DSPEvent interrupt1;
std::array<DSPEvent, pipeCount> pipeEvents;
DSPEvent& getEventRef(u32 type, u32 pipe);
static constexpr size_t maxEventCount = 6;
// Total number of DSP service events registered with registerInterruptEvents
size_t totalEventCount;
// Service functions
void convertProcessAddressFromDspDram(u32 messagePointer); // Nice function name
void flushDataCache(u32 messagePointer);
void getHeadphoneStatus(u32 messagePointer);
void getSemaphoreHandle(u32 messagePointer);
void getSemaphoreEventHandle(u32 messagePointer);
void invalidateDCache(u32 messagePointer);
void loadComponent(u32 messagePointer);
void readPipeIfPossible(u32 messagePointer);
@ -62,7 +84,7 @@ class DSPService {
void writeProcessPipe(u32 messagePointer);
public:
DSPService(Memory& mem) : mem(mem) {}
DSPService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
void reset();
void handleSyncRequest(u32 messagePointer);

View file

@ -39,6 +39,7 @@ class FSService {
// Service commands
void createFile(u32 messagePointer);
void closeArchive(u32 messagePointer);
void controlArchive(u32 messagePointer);
void deleteFile(u32 messagePointer);
void formatSaveData(u32 messagePointer);
void getFormatInfo(u32 messagePointer);

View file

@ -1,5 +1,6 @@
#pragma once
#include <cstring>
#include <optional>
#include "PICA/gpu.hpp"
#include "helpers.hpp"
#include "kernel_types.hpp"
@ -16,16 +17,21 @@ enum class GPUInterrupt : u8 {
DMA = 6
};
// More circular dependencies
class Kernel;
class GPUService {
Handle handle = KernelHandles::GPU;
Memory& mem;
GPU& gpu;
Kernel& kernel;
u32& currentPID; // Process ID of the current process
u8* sharedMem; // Pointer to GSP shared memory
// At any point in time only 1 process has privileges to use rendering functions
// This is the PID of that process
u32 privilegedProcess;
std::optional<Handle> interruptEvent;
MAKE_LOG_FUNCTION(log, gspGPULogger)
void processCommandBuffer();
@ -51,7 +57,8 @@ class GPUService {
void flushCacheRegions(u32* cmd);
public:
GPUService(Memory& mem, GPU& gpu, u32& currentPID) : mem(mem), gpu(gpu), currentPID(currentPID) {}
GPUService(Memory& mem, GPU& gpu, Kernel& kernel, u32& currentPID) : mem(mem), gpu(gpu),
kernel(kernel), currentPID(currentPID) {}
void reset();
void handleSyncRequest(u32 messagePointer);
void requestInterrupt(GPUInterrupt type);

View file

@ -10,6 +10,7 @@ class PTMService {
MAKE_LOG_FUNCTION(log, ptmLogger)
// Service commands
void configureNew3DSCPU(u32 messagePointer);
void getStepHistory(u32 messagePointer);
void getTotalStepCount(u32 messagePointer);

View file

@ -1,23 +1,30 @@
#pragma once
#include <optional>
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
#include "memory.hpp"
// Circular dependencies go br
class Kernel;
class Y2RService {
Handle handle = KernelHandles::Y2R;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, y2rLogger)
std::optional<Handle> transferEndEvent;
bool transferEndInterruptEnabled;
// Service commands
void driverInitialize(u32 messagePointer);
void pingProcess(u32 messagePointer);
void setTransferEndInterrupt(u32 messagePointer);
void getTransferEndEvent(u32 messagePointer);
public:
Y2RService(Memory& mem) : mem(mem) {}
Y2RService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};