citra-emu
/
citra-canary
Archived
1
0
Fork 0

Service: Add BaseInterface and NSInterface

This commit is contained in:
James Rowe 2018-11-28 11:16:19 -07:00
parent b62ca12e88
commit f2167d76a8
10 changed files with 73 additions and 55 deletions

View File

@ -29,7 +29,12 @@
namespace Service::APT { namespace Service::APT {
void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) { Module::NSInterface::NSInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session)
: ServiceFramework(name, max_session), BaseInterface(std::move(apt)) {}
Module::NSInterface::~NSInterface() = default;
void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x2, 2, 0); // 0x20080 IPC::RequestParser rp(ctx, 0x2, 2, 0); // 0x20080
AppletId app_id = rp.PopEnum<AppletId>(); AppletId app_id = rp.PopEnum<AppletId>();
u32 attributes = rp.Pop<u32>(); u32 attributes = rp.Pop<u32>();
@ -181,7 +186,7 @@ bool Module::LoadLegacySharedFont() {
return false; return false;
} }
void Module::Interface::GetSharedFont(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x44, 0, 0); // 0x00440000 IPC::RequestParser rp(ctx, 0x44, 0, 0); // 0x00440000
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
@ -233,7 +238,7 @@ void Module::Interface::GetSharedFont(Kernel::HLERequestContext& ctx) {
rb.PushCopyObjects(apt->shared_font_mem); rb.PushCopyObjects(apt->shared_font_mem);
} }
void Module::Interface::NotifyToWait(Kernel::HLERequestContext& ctx) { void Module::APTInterface::NotifyToWait(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x43, 1, 0); // 0x430040 IPC::RequestParser rp(ctx, 0x43, 1, 0); // 0x430040
u32 app_id = rp.Pop<u32>(); u32 app_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -241,7 +246,7 @@ void Module::Interface::NotifyToWait(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id); LOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id);
} }
void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetLockHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1, 1, 0); // 0x10040 IPC::RequestParser rp(ctx, 0x1, 1, 0); // 0x10040
// Bits [0:2] are the applet type (System, Library, etc) // Bits [0:2] are the applet type (System, Library, etc)
@ -262,7 +267,7 @@ void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called applet_attributes={:#010X}", applet_attributes); LOG_WARNING(Service_APT, "(STUBBED) called applet_attributes={:#010X}", applet_attributes);
} }
void Module::Interface::Enable(Kernel::HLERequestContext& ctx) { void Module::APTInterface::Enable(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x3, 1, 0); // 0x30040 IPC::RequestParser rp(ctx, 0x3, 1, 0); // 0x30040
u32 attributes = rp.Pop<u32>(); u32 attributes = rp.Pop<u32>();
@ -272,7 +277,7 @@ void Module::Interface::Enable(Kernel::HLERequestContext& ctx) {
rb.Push(apt->applet_manager->Enable(attributes)); rb.Push(apt->applet_manager->Enable(attributes));
} }
void Module::Interface::GetAppletManInfo(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x5, 1, 0); // 0x50040 IPC::RequestParser rp(ctx, 0x5, 1, 0); // 0x50040
u32 unk = rp.Pop<u32>(); u32 unk = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
@ -285,7 +290,7 @@ void Module::Interface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called unk={:#010X}", unk); LOG_WARNING(Service_APT, "(STUBBED) called unk={:#010X}", unk);
} }
void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) { void Module::APTInterface::IsRegistered(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x9, 1, 0); // 0x90040 IPC::RequestParser rp(ctx, 0x9, 1, 0); // 0x90040
AppletId app_id = rp.PopEnum<AppletId>(); AppletId app_id = rp.PopEnum<AppletId>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
@ -295,7 +300,7 @@ void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_APT, "called app_id={:#010X}", static_cast<u32>(app_id)); LOG_DEBUG(Service_APT, "called app_id={:#010X}", static_cast<u32>(app_id));
} }
void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) { void Module::APTInterface::InquireNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xB, 1, 0); // 0xB0040 IPC::RequestParser rp(ctx, 0xB, 1, 0); // 0xB0040
u32 app_id = rp.Pop<u32>(); u32 app_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
@ -304,7 +309,7 @@ void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called app_id={:#010X}", app_id); LOG_WARNING(Service_APT, "(STUBBED) called app_id={:#010X}", app_id);
} }
void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) { void Module::APTInterface::SendParameter(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xC, 4, 4); // 0xC0104 IPC::RequestParser rp(ctx, 0xC, 4, 4); // 0xC0104
AppletId src_app_id = rp.PopEnum<AppletId>(); AppletId src_app_id = rp.PopEnum<AppletId>();
AppletId dst_app_id = rp.PopEnum<AppletId>(); AppletId dst_app_id = rp.PopEnum<AppletId>();
@ -331,7 +336,7 @@ void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) {
rb.Push(apt->applet_manager->SendParameter(param)); rb.Push(apt->applet_manager->SendParameter(param));
} }
void Module::Interface::ReceiveParameter(Kernel::HLERequestContext& ctx) { void Module::APTInterface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xD, 2, 0); // 0xD0080 IPC::RequestParser rp(ctx, 0xD, 2, 0); // 0xD0080
AppletId app_id = rp.PopEnum<AppletId>(); AppletId app_id = rp.PopEnum<AppletId>();
u32 buffer_size = rp.Pop<u32>(); u32 buffer_size = rp.Pop<u32>();
@ -359,7 +364,7 @@ void Module::Interface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
rb.PushStaticBuffer(next_parameter->buffer, 0); rb.PushStaticBuffer(next_parameter->buffer, 0);
} }
void Module::Interface::GlanceParameter(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GlanceParameter(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xE, 2, 0); // 0xE0080 IPC::RequestParser rp(ctx, 0xE, 2, 0); // 0xE0080
AppletId app_id = rp.PopEnum<AppletId>(); AppletId app_id = rp.PopEnum<AppletId>();
u32 buffer_size = rp.Pop<u32>(); u32 buffer_size = rp.Pop<u32>();
@ -386,7 +391,7 @@ void Module::Interface::GlanceParameter(Kernel::HLERequestContext& ctx) {
rb.PushStaticBuffer(next_parameter->buffer, 0); rb.PushStaticBuffer(next_parameter->buffer, 0);
} }
void Module::Interface::CancelParameter(Kernel::HLERequestContext& ctx) { void Module::APTInterface::CancelParameter(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xF, 4, 0); // 0xF0100 IPC::RequestParser rp(ctx, 0xF, 4, 0); // 0xF0100
bool check_sender = rp.Pop<bool>(); bool check_sender = rp.Pop<bool>();
@ -407,7 +412,7 @@ void Module::Interface::CancelParameter(Kernel::HLERequestContext& ctx) {
static_cast<u32>(receiver_appid)); static_cast<u32>(receiver_appid));
} }
void Module::Interface::PrepareToDoApplicationJump(Kernel::HLERequestContext& ctx) { void Module::APTInterface::PrepareToDoApplicationJump(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x31, 4, 0); // 0x00310100 IPC::RequestParser rp(ctx, 0x31, 4, 0); // 0x00310100
auto flags = rp.PopEnum<ApplicationJumpFlags>(); auto flags = rp.PopEnum<ApplicationJumpFlags>();
u64 title_id = rp.Pop<u64>(); u64 title_id = rp.Pop<u64>();
@ -423,7 +428,7 @@ void Module::Interface::PrepareToDoApplicationJump(Kernel::HLERequestContext& ct
rb.Push(result); rb.Push(result);
} }
void Module::Interface::DoApplicationJump(Kernel::HLERequestContext& ctx) { void Module::APTInterface::DoApplicationJump(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x32, 2, 4); // 0x00320084 IPC::RequestParser rp(ctx, 0x32, 2, 4); // 0x00320084
u32 param_size = rp.Pop<u32>(); u32 param_size = rp.Pop<u32>();
u32 hmac_size = rp.Pop<u32>(); u32 hmac_size = rp.Pop<u32>();
@ -440,7 +445,7 @@ void Module::Interface::DoApplicationJump(Kernel::HLERequestContext& ctx) {
rb.Push(apt->applet_manager->DoApplicationJump()); rb.Push(apt->applet_manager->DoApplicationJump());
} }
void Module::Interface::GetProgramIdOnApplicationJump(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetProgramIdOnApplicationJump(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x33, 0, 0); // 0x00330000 IPC::RequestParser rp(ctx, 0x33, 0, 0); // 0x00330000
LOG_DEBUG(Service_APT, "called"); LOG_DEBUG(Service_APT, "called");
@ -455,7 +460,7 @@ void Module::Interface::GetProgramIdOnApplicationJump(Kernel::HLERequestContext&
rb.Push(static_cast<u8>(parameters.next_media_type)); rb.Push(static_cast<u8>(parameters.next_media_type));
} }
void Module::Interface::PrepareToStartApplication(Kernel::HLERequestContext& ctx) { void Module::APTInterface::PrepareToStartApplication(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x15, 5, 0); // 0x00150140 IPC::RequestParser rp(ctx, 0x15, 5, 0); // 0x00150140
u32 title_info1 = rp.Pop<u32>(); u32 title_info1 = rp.Pop<u32>();
u32 title_info2 = rp.Pop<u32>(); u32 title_info2 = rp.Pop<u32>();
@ -476,7 +481,7 @@ void Module::Interface::PrepareToStartApplication(Kernel::HLERequestContext& ctx
title_info1, title_info2, title_info3, title_info4, flags); title_info1, title_info2, title_info3, title_info4, flags);
} }
void Module::Interface::StartApplication(Kernel::HLERequestContext& ctx) { void Module::APTInterface::StartApplication(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1B, 3, 4); // 0x001B00C4 IPC::RequestParser rp(ctx, 0x1B, 3, 4); // 0x001B00C4
u32 buffer1_size = rp.Pop<u32>(); u32 buffer1_size = rp.Pop<u32>();
u32 buffer2_size = rp.Pop<u32>(); u32 buffer2_size = rp.Pop<u32>();
@ -492,7 +497,7 @@ void Module::Interface::StartApplication(Kernel::HLERequestContext& ctx) {
buffer1_size, buffer2_size, flag); buffer1_size, buffer2_size, flag);
} }
void Module::Interface::AppletUtility(Kernel::HLERequestContext& ctx) { void Module::APTInterface::AppletUtility(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x4B, 3, 2); // 0x004B00C2 IPC::RequestParser rp(ctx, 0x4B, 3, 2); // 0x004B00C2
// These are from 3dbrew - I'm not really sure what they're used for. // These are from 3dbrew - I'm not really sure what they're used for.
@ -509,7 +514,7 @@ void Module::Interface::AppletUtility(Kernel::HLERequestContext& ctx) {
utility_command, input_size, output_size); utility_command, input_size, output_size);
} }
void Module::Interface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) { void Module::APTInterface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x4F, 2, 0); // 0x4F0080 IPC::RequestParser rp(ctx, 0x4F, 2, 0); // 0x4F0080
u32 value = rp.Pop<u32>(); u32 value = rp.Pop<u32>();
apt->cpu_percent = rp.Pop<u32>(); apt->cpu_percent = rp.Pop<u32>();
@ -524,7 +529,7 @@ void Module::Interface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called, cpu_percent={}, value={}", apt->cpu_percent, value); LOG_WARNING(Service_APT, "(STUBBED) called, cpu_percent={}, value={}", apt->cpu_percent, value);
} }
void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x50, 1, 0); // 0x500040 IPC::RequestParser rp(ctx, 0x50, 1, 0); // 0x500040
u32 value = rp.Pop<u32>(); u32 value = rp.Pop<u32>();
@ -539,7 +544,7 @@ void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called, value={}", value); LOG_WARNING(Service_APT, "(STUBBED) called, value={}", value);
} }
void Module::Interface::PrepareToStartLibraryApplet(Kernel::HLERequestContext& ctx) { void Module::APTInterface::PrepareToStartLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x18, 1, 0); // 0x180040 IPC::RequestParser rp(ctx, 0x18, 1, 0); // 0x180040
AppletId applet_id = rp.PopEnum<AppletId>(); AppletId applet_id = rp.PopEnum<AppletId>();
@ -549,7 +554,7 @@ void Module::Interface::PrepareToStartLibraryApplet(Kernel::HLERequestContext& c
rb.Push(apt->applet_manager->PrepareToStartLibraryApplet(applet_id)); rb.Push(apt->applet_manager->PrepareToStartLibraryApplet(applet_id));
} }
void Module::Interface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContext& ctx) { void Module::APTInterface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1A, 0, 0); // 0x1A0000 IPC::RequestParser rp(ctx, 0x1A, 0, 0); // 0x1A0000
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -563,7 +568,7 @@ void Module::Interface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContext&
LOG_DEBUG(Service_APT, "called"); LOG_DEBUG(Service_APT, "called");
} }
void Module::Interface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) { void Module::APTInterface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x16, 1, 0); // 0x160040 IPC::RequestParser rp(ctx, 0x16, 1, 0); // 0x160040
AppletId applet_id = rp.PopEnum<AppletId>(); AppletId applet_id = rp.PopEnum<AppletId>();
@ -573,7 +578,7 @@ void Module::Interface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
rb.Push(apt->applet_manager->PreloadLibraryApplet(applet_id)); rb.Push(apt->applet_manager->PreloadLibraryApplet(applet_id));
} }
void Module::Interface::FinishPreloadingLibraryApplet(Kernel::HLERequestContext& ctx) { void Module::APTInterface::FinishPreloadingLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x17, 1, 0); // 0x00170040 IPC::RequestParser rp(ctx, 0x17, 1, 0); // 0x00170040
AppletId applet_id = rp.PopEnum<AppletId>(); AppletId applet_id = rp.PopEnum<AppletId>();
@ -583,7 +588,7 @@ void Module::Interface::FinishPreloadingLibraryApplet(Kernel::HLERequestContext&
LOG_WARNING(Service_APT, "(STUBBED) called, applet_id={:#05X}", static_cast<u32>(applet_id)); LOG_WARNING(Service_APT, "(STUBBED) called, applet_id={:#05X}", static_cast<u32>(applet_id));
} }
void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) { void Module::APTInterface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084 IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084
AppletId applet_id = rp.PopEnum<AppletId>(); AppletId applet_id = rp.PopEnum<AppletId>();
@ -597,7 +602,7 @@ void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer)); rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer));
} }
void Module::Interface::CloseApplication(Kernel::HLERequestContext& ctx) { void Module::APTInterface::CloseApplication(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x27, 1, 4); IPC::RequestParser rp(ctx, 0x27, 1, 4);
u32 parameters_size = rp.Pop<u32>(); u32 parameters_size = rp.Pop<u32>();
std::shared_ptr<Kernel::Object> object = rp.PopGenericObject(); std::shared_ptr<Kernel::Object> object = rp.PopGenericObject();
@ -611,7 +616,7 @@ void Module::Interface::CloseApplication(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void Module::Interface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) { void Module::APTInterface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x3B, 1, 0); // 0x003B0040 IPC::RequestParser rp(ctx, 0x3B, 1, 0); // 0x003B0040
bool exiting = rp.Pop<bool>(); bool exiting = rp.Pop<bool>();
@ -621,7 +626,7 @@ void Module::Interface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called exiting={}", exiting); LOG_WARNING(Service_APT, "(STUBBED) called exiting={}", exiting);
} }
void Module::Interface::PrepareToCloseLibraryApplet(Kernel::HLERequestContext& ctx) { void Module::APTInterface::PrepareToCloseLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x25, 3, 0); // 0x002500C0 IPC::RequestParser rp(ctx, 0x25, 3, 0); // 0x002500C0
bool not_pause = rp.Pop<bool>(); bool not_pause = rp.Pop<bool>();
bool exiting = rp.Pop<bool>(); bool exiting = rp.Pop<bool>();
@ -634,7 +639,7 @@ void Module::Interface::PrepareToCloseLibraryApplet(Kernel::HLERequestContext& c
rb.Push(apt->applet_manager->PrepareToCloseLibraryApplet(not_pause, exiting, jump_to_home)); rb.Push(apt->applet_manager->PrepareToCloseLibraryApplet(not_pause, exiting, jump_to_home));
} }
void Module::Interface::CloseLibraryApplet(Kernel::HLERequestContext& ctx) { void Module::APTInterface::CloseLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x28, 1, 4); // 0x00280044 IPC::RequestParser rp(ctx, 0x28, 1, 4); // 0x00280044
u32 parameter_size = rp.Pop<u32>(); u32 parameter_size = rp.Pop<u32>();
auto object = rp.PopGenericObject(); auto object = rp.PopGenericObject();
@ -646,7 +651,7 @@ void Module::Interface::CloseLibraryApplet(Kernel::HLERequestContext& ctx) {
rb.Push(apt->applet_manager->CloseLibraryApplet(std::move(object), std::move(buffer))); rb.Push(apt->applet_manager->CloseLibraryApplet(std::move(object), std::move(buffer)));
} }
void Module::Interface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) { void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x40, 1, 2); // 0x00400042 IPC::RequestParser rp(ctx, 0x40, 1, 2); // 0x00400042
u32 size = rp.Pop<u32>(); u32 size = rp.Pop<u32>();
ASSERT(size == 0x20); ASSERT(size == 0x20);
@ -656,7 +661,7 @@ void Module::Interface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void Module::Interface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx) { void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x41, 1, 0); // 0x00410040 IPC::RequestParser rp(ctx, 0x41, 1, 0); // 0x00410040
u32 size = rp.Pop<u32>(); u32 size = rp.Pop<u32>();
ASSERT(size == 0x20); ASSERT(size == 0x20);
@ -667,7 +672,7 @@ void Module::Interface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx)
rb.PushStaticBuffer(std::move(apt->screen_capture_buffer), 0); rb.PushStaticBuffer(std::move(apt->screen_capture_buffer), 0);
} }
void Module::Interface::SetScreenCapPostPermission(Kernel::HLERequestContext& ctx) { void Module::APTInterface::SetScreenCapPostPermission(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x55, 1, 0); // 0x00550040 IPC::RequestParser rp(ctx, 0x55, 1, 0); // 0x00550040
apt->screen_capture_post_permission = static_cast<ScreencapPostPermission>(rp.Pop<u32>() & 0xF); apt->screen_capture_post_permission = static_cast<ScreencapPostPermission>(rp.Pop<u32>() & 0xF);
@ -678,7 +683,7 @@ void Module::Interface::SetScreenCapPostPermission(Kernel::HLERequestContext& ct
static_cast<u32>(apt->screen_capture_post_permission)); static_cast<u32>(apt->screen_capture_post_permission));
} }
void Module::Interface::GetScreenCapPostPermission(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetScreenCapPostPermission(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x56, 0, 0); // 0x00560000 IPC::RequestParser rp(ctx, 0x56, 0, 0); // 0x00560000
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
@ -688,7 +693,7 @@ void Module::Interface::GetScreenCapPostPermission(Kernel::HLERequestContext& ct
static_cast<u32>(apt->screen_capture_post_permission)); static_cast<u32>(apt->screen_capture_post_permission));
} }
void Module::Interface::GetAppletInfo(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x6, 1, 0); // 0x60040 IPC::RequestParser rp(ctx, 0x6, 1, 0); // 0x60040
auto app_id = rp.PopEnum<AppletId>(); auto app_id = rp.PopEnum<AppletId>();
@ -709,7 +714,7 @@ void Module::Interface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
} }
} }
void Module::Interface::GetStartupArgument(Kernel::HLERequestContext& ctx) { void Module::APTInterface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x51, 2, 0); // 0x00510080 IPC::RequestParser rp(ctx, 0x51, 2, 0); // 0x00510080
u32 parameter_size = rp.Pop<u32>(); u32 parameter_size = rp.Pop<u32>();
StartupArgumentType startup_argument_type = static_cast<StartupArgumentType>(rp.Pop<u8>()); StartupArgumentType startup_argument_type = static_cast<StartupArgumentType>(rp.Pop<u8>());
@ -735,7 +740,7 @@ void Module::Interface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
rb.PushStaticBuffer(parameter, 0); rb.PushStaticBuffer(parameter, 0);
} }
void Module::Interface::Wrap(Kernel::HLERequestContext& ctx) { void Module::APTInterface::Wrap(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x46, 4, 4); IPC::RequestParser rp(ctx, 0x46, 4, 4);
const u32 output_size = rp.Pop<u32>(); const u32 output_size = rp.Pop<u32>();
const u32 input_size = rp.Pop<u32>(); const u32 input_size = rp.Pop<u32>();
@ -780,7 +785,7 @@ void Module::Interface::Wrap(Kernel::HLERequestContext& ctx) {
rb.PushMappedBuffer(output); rb.PushMappedBuffer(output);
} }
void Module::Interface::Unwrap(Kernel::HLERequestContext& ctx) { void Module::APTInterface::Unwrap(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x47, 4, 4); IPC::RequestParser rp(ctx, 0x47, 4, 4);
const u32 output_size = rp.Pop<u32>(); const u32 output_size = rp.Pop<u32>();
const u32 input_size = rp.Pop<u32>(); const u32 input_size = rp.Pop<u32>();
@ -831,7 +836,7 @@ void Module::Interface::Unwrap(Kernel::HLERequestContext& ctx) {
rb.PushMappedBuffer(output); rb.PushMappedBuffer(output);
} }
void Module::Interface::CheckNew3DSApp(Kernel::HLERequestContext& ctx) { void Module::APTInterface::CheckNew3DSApp(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x101, 0, 0); // 0x01010000 IPC::RequestParser rp(ctx, 0x101, 0, 0); // 0x01010000
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
@ -845,7 +850,7 @@ void Module::Interface::CheckNew3DSApp(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called"); LOG_WARNING(Service_APT, "(STUBBED) called");
} }
void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) { void Module::APTInterface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x102, 0, 0); // 0x01020000 IPC::RequestParser rp(ctx, 0x102, 0, 0); // 0x01020000
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
@ -854,10 +859,10 @@ void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called"); LOG_WARNING(Service_APT, "(STUBBED) called");
} }
Module::Interface::Interface(std::shared_ptr<Module> apt, const char* name, u32 max_session) Module::APTInterface::APTInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session)
: ServiceFramework(name, max_session), apt(std::move(apt)) {} : ServiceFramework(name, max_session), BaseInterface(std::move(apt)) {}
Module::Interface::~Interface() = default; Module::APTInterface::~APTInterface() = default;
Module::Module(Core::System& system) : system(system) { Module::Module(Core::System& system) : system(system) {
applet_manager = std::make_shared<AppletManager>(system); applet_manager = std::make_shared<AppletManager>(system);

View File

@ -8,8 +8,8 @@
#include <vector> #include <vector>
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/service/fs/archive.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core { namespace Core {
@ -60,10 +60,24 @@ public:
explicit Module(Core::System& system); explicit Module(Core::System& system);
~Module(); ~Module();
class Interface : public ServiceFramework<Interface> { class BaseInterface {
public: public:
Interface(std::shared_ptr<Module> apt, const char* name, u32 max_session); explicit BaseInterface(std::shared_ptr<Module> apt) : apt(apt) {}
~Interface();
protected:
std::shared_ptr<Module> apt;
};
class NSInterface : public ServiceFramework<NSInterface>, public BaseInterface {
public:
NSInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session);
~NSInterface();
};
class APTInterface : public ServiceFramework<APTInterface>, public BaseInterface {
public:
APTInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session);
~APTInterface();
protected: protected:
/** /**
@ -593,7 +607,6 @@ public:
void CheckNew3DS(Kernel::HLERequestContext& ctx); void CheckNew3DS(Kernel::HLERequestContext& ctx);
private: private:
std::shared_ptr<Module> apt;
bool application_reset_prepared{}; bool application_reset_prepared{};
}; };

View File

@ -7,7 +7,7 @@
namespace Service::APT { namespace Service::APT {
APT_A::APT_A(std::shared_ptr<Module> apt) APT_A::APT_A(std::shared_ptr<Module> apt)
: Module::Interface(std::move(apt), "APT:A", MaxAPTSessions) { : Module::APTInterface(std::move(apt), "APT:A", MaxAPTSessions) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x00010040, &APT_A::GetLockHandle, "GetLockHandle"}, {0x00010040, &APT_A::GetLockHandle, "GetLockHandle"},
{0x00020080, &APT_A::Initialize, "Initialize"}, {0x00020080, &APT_A::Initialize, "Initialize"},

View File

@ -8,7 +8,7 @@
namespace Service::APT { namespace Service::APT {
class APT_A final : public Module::Interface { class APT_A final : public Module::APTInterface {
public: public:
explicit APT_A(std::shared_ptr<Module> apt); explicit APT_A(std::shared_ptr<Module> apt);
}; };

View File

@ -7,7 +7,7 @@
namespace Service::APT { namespace Service::APT {
APT_S::APT_S(std::shared_ptr<Module> apt) APT_S::APT_S(std::shared_ptr<Module> apt)
: Module::Interface(std::move(apt), "APT:S", MaxAPTSessions) { : Module::APTInterface(std::move(apt), "APT:S", MaxAPTSessions) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x00010040, &APT_S::GetLockHandle, "GetLockHandle"}, {0x00010040, &APT_S::GetLockHandle, "GetLockHandle"},
{0x00020080, &APT_S::Initialize, "Initialize"}, {0x00020080, &APT_S::Initialize, "Initialize"},

View File

@ -15,7 +15,7 @@ namespace Service::APT {
// svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services. // svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services.
/// Interface to "APT:S" service /// Interface to "APT:S" service
class APT_S final : public Module::Interface { class APT_S final : public Module::APTInterface {
public: public:
explicit APT_S(std::shared_ptr<Module> apt); explicit APT_S(std::shared_ptr<Module> apt);
}; };

View File

@ -7,7 +7,7 @@
namespace Service::APT { namespace Service::APT {
APT_U::APT_U(std::shared_ptr<Module> apt) APT_U::APT_U(std::shared_ptr<Module> apt)
: Module::Interface(std::move(apt), "APT:U", MaxAPTSessions) { : Module::APTInterface(std::move(apt), "APT:U", MaxAPTSessions) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x00010040, &APT_U::GetLockHandle, "GetLockHandle"}, {0x00010040, &APT_U::GetLockHandle, "GetLockHandle"},
{0x00020080, &APT_U::Initialize, "Initialize"}, {0x00020080, &APT_U::Initialize, "Initialize"},

View File

@ -15,7 +15,7 @@ namespace Service::APT {
// svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services. // svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services.
/// Interface to "APT:U" service /// Interface to "APT:U" service
class APT_U final : public Module::Interface { class APT_U final : public Module::APTInterface {
public: public:
explicit APT_U(std::shared_ptr<Module> apt); explicit APT_U(std::shared_ptr<Module> apt);
}; };

View File

@ -7,7 +7,7 @@
namespace Service::NS { namespace Service::NS {
NS_S::NS_S(std::shared_ptr<Service::APT::Module> apt) NS_S::NS_S(std::shared_ptr<Service::APT::Module> apt)
: Service::APT::Module::Interface(std::move(apt), "NS:S", Service::APT::MaxAPTSessions) { : Service::APT::Module::NSInterface(std::move(apt), "NS:S", Service::APT::MaxAPTSessions) {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x000100C0, nullptr, "LaunchFIRM"}, {0x000100C0, nullptr, "LaunchFIRM"},
{0x000200C0, nullptr, "LaunchTitle"}, {0x000200C0, nullptr, "LaunchTitle"},

View File

@ -11,7 +11,7 @@
namespace Service::NS { namespace Service::NS {
/// Interface to "ns:s" service /// Interface to "ns:s" service
class NS_S final : public Service::APT::Module::Interface { class NS_S final : public Service::APT::Module::NSInterface {
public: public:
explicit NS_S(std::shared_ptr<Service::APT::Module> apt); explicit NS_S(std::shared_ptr<Service::APT::Module> apt);
}; };