mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
I hate this
This commit is contained in:
parent
17724e77ca
commit
77dff17107
5 changed files with 105 additions and 38 deletions
|
@ -5,41 +5,43 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
namespace Applets {
|
||||
enum class AppletIDs : u32 {
|
||||
None = 0,
|
||||
SysAppletMask = 0x100,
|
||||
HomeMenu = 0x101,
|
||||
AltMenu = 0x103,
|
||||
Camera = 0x110,
|
||||
Friends = 0x112,
|
||||
GameNotes = 0x113,
|
||||
Browser = 0x114,
|
||||
InstructionManual = 0x115,
|
||||
Notifications = 0x116,
|
||||
Miiverse = 0x117,
|
||||
MiiversePosting = 0x118,
|
||||
AmiiboSettings = 0x119,
|
||||
SysLibraryAppletMask = 0x200,
|
||||
SoftwareKeyboard = 0x201,
|
||||
MiiSelector = 0x202,
|
||||
PNote = 0x204, // TODO: What dis?
|
||||
SNote = 0x205, // What is this too?
|
||||
ErrDisp = 0x206,
|
||||
EshopMint = 0x207,
|
||||
CirclePadProCalib = 0x208,
|
||||
Notepad = 0x209,
|
||||
Application = 0x300,
|
||||
EshopTiger = 0x301,
|
||||
LibraryAppletMask = 0x400,
|
||||
SoftwareKeyboard2 = 0x401,
|
||||
MiiSelector2 = 0x402,
|
||||
Pnote2 = 0x404,
|
||||
SNote2 = 0x405,
|
||||
ErrDisp2 = 0x406,
|
||||
EshopMint2 = 0x407,
|
||||
CirclePadProCalib2 = 0x408,
|
||||
Notepad2 = 0x409,
|
||||
};
|
||||
namespace AppletIDs {
|
||||
enum : u32 {
|
||||
None = 0,
|
||||
SysAppletMask = 0x100,
|
||||
HomeMenu = 0x101,
|
||||
AltMenu = 0x103,
|
||||
Camera = 0x110,
|
||||
Friends = 0x112,
|
||||
GameNotes = 0x113,
|
||||
Browser = 0x114,
|
||||
InstructionManual = 0x115,
|
||||
Notifications = 0x116,
|
||||
Miiverse = 0x117,
|
||||
MiiversePosting = 0x118,
|
||||
AmiiboSettings = 0x119,
|
||||
SysLibraryAppletMask = 0x200,
|
||||
SoftwareKeyboard = 0x201,
|
||||
MiiSelector = 0x202,
|
||||
PNote = 0x204, // TODO: What dis?
|
||||
SNote = 0x205, // What is this too?
|
||||
ErrDisp = 0x206,
|
||||
EshopMint = 0x207,
|
||||
CirclePadProCalib = 0x208,
|
||||
Notepad = 0x209,
|
||||
Application = 0x300,
|
||||
EshopTiger = 0x301,
|
||||
LibraryAppletMask = 0x400,
|
||||
SoftwareKeyboard2 = 0x401,
|
||||
MiiSelector2 = 0x402,
|
||||
Pnote2 = 0x404,
|
||||
SNote2 = 0x405,
|
||||
ErrDisp2 = 0x406,
|
||||
EshopMint2 = 0x407,
|
||||
CirclePadProCalib2 = 0x408,
|
||||
Notepad2 = 0x409,
|
||||
};
|
||||
}
|
||||
|
||||
class AppletBase {
|
||||
Memory& mem;
|
||||
|
|
|
@ -28,6 +28,7 @@ class APTService {
|
|||
|
||||
// Applets here
|
||||
Applets::MiiSelectorApplet miiSelector;
|
||||
Applets::AppletBase* getApplet(u32 id);
|
||||
|
||||
MAKE_LOG_FUNCTION(log, aptLogger)
|
||||
|
||||
|
@ -38,17 +39,21 @@ class APTService {
|
|||
void checkNew3DS(u32 messagePointer);
|
||||
void checkNew3DSApp(u32 messagePointer);
|
||||
void enable(u32 messagePointer);
|
||||
void getAppletInfo(u32 messagePointer);
|
||||
void getSharedFont(u32 messagePointer);
|
||||
void getWirelessRebootInfo(u32 messagePointer);
|
||||
void glanceParameter(u32 messagePointer);
|
||||
void initialize(u32 messagePointer);
|
||||
void inquireNotification(u32 messagePointer);
|
||||
void isRegistered(u32 messagePointer);
|
||||
void notifyToWait(u32 messagePointer);
|
||||
void preloadLibraryApplet(u32 messagePointer);
|
||||
void receiveParameter(u32 messagePointer);
|
||||
void replySleepQuery(u32 messagePointer);
|
||||
void setApplicationCpuTimeLimit(u32 messagePointer);
|
||||
void setScreencapPostPermission(u32 messagePointer);
|
||||
void prepareToStartLibraryApplet(u32 messagePointer);
|
||||
void startLibraryApplet(u32 messagePointer);
|
||||
void theSmashBrosFunction(u32 messagePointer);
|
||||
|
||||
// Percentage of the syscore available to the application, between 5% and 89%
|
||||
|
|
|
@ -43,7 +43,9 @@ class GPUService {
|
|||
// Service commands
|
||||
void acquireRight(u32 messagePointer);
|
||||
void flushDataCache(u32 messagePointer);
|
||||
void importDisplayCaptureInfo(u32 messagePointer);
|
||||
void registerInterruptRelayQueue(u32 messagePointer);
|
||||
void saveVramSysArea(u32 messagePointer);
|
||||
void setAxiConfigQoSMode(u32 messagePointer);
|
||||
void setInternalPriorities(u32 messagePointer);
|
||||
void setLCDForceBlack(u32 messagePointer);
|
||||
|
|
|
@ -7,10 +7,13 @@ namespace APTCommands {
|
|||
GetLockHandle = 0x00010040,
|
||||
Initialize = 0x00020080,
|
||||
Enable = 0x00030040,
|
||||
GetAppletInfo = 0x00060040,
|
||||
IsRegistered = 0x00090040,
|
||||
InquireNotification = 0x000B0040,
|
||||
ReceiveParameter = 0x000D0080,
|
||||
GlanceParameter = 0x000E0080,
|
||||
PreloadLibraryApplet = 0x00160040,
|
||||
StartLibraryApplet = 0x001E0084,
|
||||
ReplySleepQuery = 0x003E0080,
|
||||
NotifyToWait = 0x00430040,
|
||||
GetSharedFont = 0x00440000,
|
||||
|
@ -62,6 +65,17 @@ void APTService::reset() {
|
|||
miiSelector.reset();
|
||||
}
|
||||
|
||||
Applets::AppletBase* APTService::getApplet(u32 id) {
|
||||
using namespace Applets;
|
||||
|
||||
switch (id) {
|
||||
case AppletIDs::MiiSelector:
|
||||
case AppletIDs::MiiSelector2: return &miiSelector;
|
||||
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void APTService::handleSyncRequest(u32 messagePointer) {
|
||||
const u32 command = mem.read32(messagePointer);
|
||||
switch (command) {
|
||||
|
@ -69,9 +83,11 @@ void APTService::handleSyncRequest(u32 messagePointer) {
|
|||
case APTCommands::CheckNew3DS: checkNew3DS(messagePointer); break;
|
||||
case APTCommands::CheckNew3DSApp: checkNew3DSApp(messagePointer); break;
|
||||
case APTCommands::Enable: enable(messagePointer); break;
|
||||
case APTCommands::GetAppletInfo: getAppletInfo(messagePointer); break;
|
||||
case APTCommands::GetSharedFont: getSharedFont(messagePointer); break;
|
||||
case APTCommands::Initialize: initialize(messagePointer); break;
|
||||
case APTCommands::InquireNotification: [[likely]] inquireNotification(messagePointer); break;
|
||||
case APTCommands::IsRegistered: isRegistered(messagePointer); break;
|
||||
case APTCommands::GetApplicationCpuTimeLimit: getApplicationCpuTimeLimit(messagePointer); break;
|
||||
case APTCommands::GetLockHandle: getLockHandle(messagePointer); break;
|
||||
case APTCommands::GetWirelessRebootInfo: getWirelessRebootInfo(messagePointer); break;
|
||||
|
@ -84,7 +100,7 @@ void APTService::handleSyncRequest(u32 messagePointer) {
|
|||
case APTCommands::SetScreencapPostPermission: setScreencapPostPermission(messagePointer); break;
|
||||
case APTCommands::TheSmashBrosFunction: theSmashBrosFunction(messagePointer); break;
|
||||
default:
|
||||
Helpers::panicDev("APT service requested. Command: %08X\n", command);
|
||||
Helpers::panic("APT service requested. Command: %08X\n", command);
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
break;
|
||||
}
|
||||
|
@ -102,9 +118,30 @@ void APTService::appletUtility(u32 messagePointer) {
|
|||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
void APTService::getAppletInfo(u32 messagePointer) {
|
||||
const u32 appID = mem.read32(messagePointer + 4);
|
||||
Helpers::warn("APT::GetAppletInfo (appID = %X)\n", appID);
|
||||
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x06, 7, 0));
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
|
||||
mem.write8(messagePointer + 20, 1); // 1 = registered
|
||||
mem.write8(messagePointer + 24, 1); // 1 = loaded
|
||||
// TODO: The rest of this
|
||||
}
|
||||
|
||||
void APTService::isRegistered(u32 messagePointer) {
|
||||
const u32 appID = mem.read32(messagePointer + 4);
|
||||
Helpers::warn("APT::IsRegistered (appID = %X)\n", appID);
|
||||
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x09, 2, 0));
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
mem.write8(messagePointer + 8, 1); // Return that the app is always registered. This might break with home menu?
|
||||
}
|
||||
|
||||
void APTService::preloadLibraryApplet(u32 messagePointer) {
|
||||
const u32 appID = mem.read32(messagePointer + 4);
|
||||
log("APT::PreloadLibraryApplet (app ID = %d) (stubbed)\n", appID);
|
||||
log("APT::PreloadLibraryApplet (app ID = %X) (stubbed)\n", appID);
|
||||
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x16, 1, 0));
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace ServiceCommands {
|
|||
FlushDataCache = 0x00080082,
|
||||
SetLCDForceBlack = 0x000B0040,
|
||||
TriggerCmdReqQueue = 0x000C0000,
|
||||
ImportDisplayCaptureInfo = 0x00180000,
|
||||
SaveVramSysArea = 0x00190000,
|
||||
SetInternalPriorities = 0x001E0080,
|
||||
StoreDataCache = 0x001F0082
|
||||
};
|
||||
|
@ -40,14 +42,16 @@ void GPUService::reset() {
|
|||
void GPUService::handleSyncRequest(u32 messagePointer) {
|
||||
const u32 command = mem.read32(messagePointer);
|
||||
switch (command) {
|
||||
case ServiceCommands::TriggerCmdReqQueue: [[likely]] triggerCmdReqQueue(messagePointer); break;
|
||||
case ServiceCommands::AcquireRight: acquireRight(messagePointer); break;
|
||||
case ServiceCommands::FlushDataCache: flushDataCache(messagePointer); break;
|
||||
case ServiceCommands::ImportDisplayCaptureInfo: importDisplayCaptureInfo(messagePointer); break;
|
||||
case ServiceCommands::RegisterInterruptRelayQueue: registerInterruptRelayQueue(messagePointer); break;
|
||||
case ServiceCommands::SaveVramSysArea: saveVramSysArea(messagePointer); break;
|
||||
case ServiceCommands::SetAxiConfigQoSMode: setAxiConfigQoSMode(messagePointer); break;
|
||||
case ServiceCommands::SetInternalPriorities: setInternalPriorities(messagePointer); break;
|
||||
case ServiceCommands::SetLCDForceBlack: setLCDForceBlack(messagePointer); break;
|
||||
case ServiceCommands::StoreDataCache: storeDataCache(messagePointer); break;
|
||||
case ServiceCommands::TriggerCmdReqQueue: [[likely]] triggerCmdReqQueue(messagePointer); break;
|
||||
case ServiceCommands::WriteHwRegs: writeHwRegs(messagePointer); break;
|
||||
case ServiceCommands::WriteHwRegsWithMask: writeHwRegsWithMask(messagePointer); break;
|
||||
; default: Helpers::panic("GPU service requested. Command: %08X\n", command);
|
||||
|
@ -395,3 +399,20 @@ void GPUService::triggerTextureCopy(u32* cmd) {
|
|||
// NSMB2 relies on this
|
||||
requestInterrupt(GPUInterrupt::PPF);
|
||||
}
|
||||
|
||||
// Used when transitioning from the app to an OS applet, such as software keyboard, mii maker, mii selector, etc
|
||||
// Stubbed until we decide to support LLE applets
|
||||
void GPUService::saveVramSysArea(u32 messagePointer) {
|
||||
Helpers::warn("GSP::GPU::SaveVramSysArea (stubbed)\n");
|
||||
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x19, 1, 0));
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
// Used in similar fashion to the SaveVramSysArea function
|
||||
void GPUService::importDisplayCaptureInfo(u32 messagePointer) {
|
||||
Helpers::warn("GSP::GPU::ImportDisplayCaptureInfo (stubbed)\n");
|
||||
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x18, 9, 0));
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
Loading…
Add table
Reference in a new issue