diff --git a/include/services/apt.hpp b/include/services/apt.hpp index 7899f573..b4a3ee30 100644 --- a/include/services/apt.hpp +++ b/include/services/apt.hpp @@ -14,6 +14,7 @@ class APTService { void checkNew3DS(u32 messagePointer); void enable(u32 messagePointer); void notifyToWait(u32 messagePointer); + void receiveParameter(u32 messagePointer); public: APTService(Memory& mem) : mem(mem) {} diff --git a/src/core/services/apt.cpp b/src/core/services/apt.cpp index 12acb0c6..714d29f8 100644 --- a/src/core/services/apt.cpp +++ b/src/core/services/apt.cpp @@ -5,7 +5,8 @@ namespace APTCommands { GetLockHandle = 0x00010040, Enable = 0x00030040, CheckNew3DS = 0x01020000, - NotifyToWait = 0x00430040 + NotifyToWait = 0x00430040, + ReceiveParameter = 0x000D0080 }; } @@ -32,6 +33,7 @@ void APTService::handleSyncRequest(u32 messagePointer) { case APTCommands::Enable: enable(messagePointer); break; case APTCommands::GetLockHandle: getLockHandle(messagePointer); break; case APTCommands::NotifyToWait: notifyToWait(messagePointer); break; + case APTCommands::ReceiveParameter: receiveParameter(messagePointer); break; default: Helpers::panic("APT service requested. Command: %08X\n", command); } } @@ -57,4 +59,21 @@ void APTService::getLockHandle(u32 messagePointer) { void APTService::notifyToWait(u32 messagePointer) { log("APT::NotifyToWat\n"); mem.write32(messagePointer + 4, Result::Success); +} + +void APTService::receiveParameter(u32 messagePointer) { + const u32 app = mem.read32(messagePointer + 4); + const u32 size = mem.read32(messagePointer + 8); + log("APT::ReceiveParameter(app ID = %X, size = %04X) (STUBBED)\n", app, size); + + if (size > 0x1000) Helpers::panic("APT::ReceiveParameter with size > 0x1000"); + + // TODO: Properly implement this. We currently stub it in the same way as 3dmoo + mem.write32(messagePointer + 4, Result::Success); + mem.write32(messagePointer + 8, 0); // Sender App ID + mem.write32(messagePointer + 12, 1); // Signal type (1 = app just started, 0xB = returning to app, 0xC = exiting app) + mem.write32(messagePointer + 16, 0x10); + mem.write32(messagePointer + 20, 0); + mem.write32(messagePointer + 24, 0); + mem.write32(messagePointer + 28, 0); } \ No newline at end of file