More service calls implemented

This commit is contained in:
wheremyfoodat 2023-01-06 00:32:02 +02:00
parent 9f07286de8
commit 243224eed3
11 changed files with 59 additions and 2 deletions

View file

@ -10,6 +10,8 @@ namespace ConfigMem {
EnvInfo = 0x1FF80014,
AppMemAlloc = 0x1FF80040,
Datetime0 = 0x1FF81020,
LedState3D = 0x1FF81084
LedState3D = 0x1FF81084,
BatteryState = 0x1FF81085,
HeadphonesConnectedMaybe = 0x1FF810C0 // TODO: What is actually stored here?
};
}

View file

@ -156,6 +156,17 @@ public:
u32 getLinearHeapVaddr();
u8* getFCRAM() { return fcram; }
enum class BatteryLevel {
Empty = 0, AlmostEmpty, OneBar, TwoBars, ThreeBars, FourBars
};
u8 getBatteryState(bool adapterConnected, bool charging, BatteryLevel batteryLevel) {
u8 value = static_cast<u8>(batteryLevel) << 2; // Bits 2:4 are the battery level from 0 to 5
if (adapterConnected) value |= 1 << 0; // Bit 0 shows if the charger is connected
if (charging) value |= 1 << 1; // Bit 1 shows if we're charging
return value;
}
NCCH* getCXI() {
if (loadedCXI.has_value()) {
return &loadedCXI.value();

View file

@ -50,6 +50,7 @@ class DSPService {
// Service functions
void convertProcessAddressFromDspDram(u32 messagePointer); // Nice function name
void flushDataCache(u32 messagePointer);
void getHeadphoneStatus(u32 messagePointer);
void getSemaphoreHandle(u32 messagePointer);
void loadComponent(u32 messagePointer);

View file

@ -31,6 +31,7 @@ class FSService {
void getPriority(u32 messagePointer);
void initialize(u32 messagePointer);
void initializeWithSdkVersion(u32 messagePointer);
void isSdmcDetected(u32 messagePointer);
void openArchive(u32 messagePointer);
void openFile(u32 messagePointer);
void openFileDirectly(u32 messagePointer);

View file

@ -37,6 +37,7 @@ class GPUService {
void setAxiConfigQoSMode(u32 messagePointer);
void setInternalPriorities(u32 messagePointer);
void setLCDForceBlack(u32 messagePointer);
void storeDataCache(u32 messagePointer);
void triggerCmdReqQueue(u32 messagePointer);
void writeHwRegs(u32 messagePointer);
void writeHwRegsWithMask(u32 messagePointer);

View file

@ -49,6 +49,7 @@ class ServiceManager {
void getServiceHandle(u32 messagePointer);
void receiveNotification(u32 messagePointer);
void registerClient(u32 messagePointer);
void subscribe(u32 messagePointer);
public:
ServiceManager(std::array<u32, 16>& regs, Memory& mem, GPU& gpu, u32& currentPID, Kernel& kernel);