service/apt: Implement soft reset & CloseApplication
This commit is contained in:
@ -543,6 +543,65 @@ void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer));
|
||||
}
|
||||
|
||||
void Module::Interface::CloseApplication(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x27, 1, 4);
|
||||
u32 parameters_size = rp.Pop<u32>();
|
||||
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
||||
std::vector<u8> buffer = rp.PopStaticBuffer();
|
||||
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
Core::System::GetInstance().RequestShutdown();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
void Module::Interface::PrepareToDoApplicationJump(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x31, 4, 0);
|
||||
u32 flags = rp.Pop<u8>();
|
||||
u32 program_id_low = rp.Pop<u32>();
|
||||
u32 program_id_high = rp.Pop<u32>();
|
||||
Service::FS::MediaType media_type = static_cast<Service::FS::MediaType>(rp.Pop<u8>());
|
||||
|
||||
LOG_WARNING(Service_APT,
|
||||
"(STUBBED) called, flags={:08X}, program_id_low={:08X}, program_id_high={:08X}, "
|
||||
"media_type={:08X}",
|
||||
flags, program_id_low, program_id_high, static_cast<u8>(media_type));
|
||||
|
||||
if (flags == 0x2) {
|
||||
// It seems that flags 0x2 means jumping to the same application,
|
||||
// and ignore the parameters. This is used in Pokemon main series
|
||||
// to soft reset.
|
||||
application_reset_prepared = true;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
void Module::Interface::DoApplicationJump(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x32, 2, 4);
|
||||
u32 parameter_size = rp.Pop<u32>();
|
||||
u32 hmac_size = rp.Pop<u32>();
|
||||
std::vector<u8> parameter = rp.PopStaticBuffer();
|
||||
std::vector<u8> hmac = rp.PopStaticBuffer();
|
||||
|
||||
LOG_WARNING(Service_APT, "(STUBBED) called");
|
||||
|
||||
if (application_reset_prepared) {
|
||||
// Reset system
|
||||
Core::System::GetInstance().RequestReset();
|
||||
} else {
|
||||
// After the jump, the application should shutdown
|
||||
// TODO: Actually implement the jump
|
||||
Core::System::GetInstance().RequestShutdown();
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
void Module::Interface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x3B, 1, 0); // 0x003B0040
|
||||
bool exiting = rp.Pop<bool>();
|
||||
|
Reference in New Issue
Block a user