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

@ -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();