|
|
@ -9,7 +9,6 @@
|
|
|
|
#include "core/file_sys/file_backend.h"
|
|
|
|
#include "core/file_sys/file_backend.h"
|
|
|
|
#include "core/hle/applets/applet.h"
|
|
|
|
#include "core/hle/applets/applet.h"
|
|
|
|
#include "core/hle/kernel/mutex.h"
|
|
|
|
#include "core/hle/kernel/mutex.h"
|
|
|
|
#include "core/hle/kernel/process.h"
|
|
|
|
|
|
|
|
#include "core/hle/kernel/shared_memory.h"
|
|
|
|
#include "core/hle/kernel/shared_memory.h"
|
|
|
|
#include "core/hle/romfs.h"
|
|
|
|
#include "core/hle/romfs.h"
|
|
|
|
#include "core/hle/service/apt/applet_manager.h"
|
|
|
|
#include "core/hle/service/apt/applet_manager.h"
|
|
|
@ -28,31 +27,15 @@
|
|
|
|
namespace Service {
|
|
|
|
namespace Service {
|
|
|
|
namespace APT {
|
|
|
|
namespace APT {
|
|
|
|
|
|
|
|
|
|
|
|
/// Handle to shared memory region designated to for shared system font
|
|
|
|
void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
|
|
|
|
static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem;
|
|
|
|
IPC::RequestParser rp(ctx, 0x2, 2, 0); // 0x20080
|
|
|
|
static bool shared_font_loaded = false;
|
|
|
|
|
|
|
|
static bool shared_font_relocated = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Kernel::SharedPtr<Kernel::Mutex> lock;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static u32 cpu_percent; ///< CPU time available to the running application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// APT::CheckNew3DSApp will check this unknown_ns_state_field to determine processing mode
|
|
|
|
|
|
|
|
static u8 unknown_ns_state_field;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static ScreencapPostPermission screen_capture_post_permission;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static std::shared_ptr<AppletManager> applet_manager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Initialize(Service::Interface* self) {
|
|
|
|
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X, attributes=0x%08X", static_cast<u32>(app_id),
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X, attributes=0x%08X", static_cast<u32>(app_id),
|
|
|
|
attributes);
|
|
|
|
attributes);
|
|
|
|
|
|
|
|
|
|
|
|
auto result = applet_manager->Initialize(app_id, attributes);
|
|
|
|
auto result = apt->applet_manager->Initialize(app_id, attributes);
|
|
|
|
if (result.Failed()) {
|
|
|
|
if (result.Failed()) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(result.Code());
|
|
|
|
rb.Push(result.Code());
|
|
|
@ -60,8 +43,7 @@ void Initialize(Service::Interface* self) {
|
|
|
|
auto events = std::move(result).Unwrap();
|
|
|
|
auto events = std::move(result).Unwrap();
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushCopyHandles(Kernel::g_handle_table.Create(events.notification_event).Unwrap(),
|
|
|
|
rb.PushCopyObjects(events.notification_event, events.parameter_event);
|
|
|
|
Kernel::g_handle_table.Create(events.parameter_event).Unwrap());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -119,7 +101,7 @@ static u32 DecompressLZ11(const u8* in, u8* out) {
|
|
|
|
return decompressed_size;
|
|
|
|
return decompressed_size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool LoadSharedFont() {
|
|
|
|
bool Module::LoadSharedFont() {
|
|
|
|
u8 font_region_code;
|
|
|
|
u8 font_region_code;
|
|
|
|
switch (CFG::GetRegionValue()) {
|
|
|
|
switch (CFG::GetRegionValue()) {
|
|
|
|
case 4: // CHN
|
|
|
|
case 4: // CHN
|
|
|
@ -184,7 +166,7 @@ static bool LoadSharedFont() {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool LoadLegacySharedFont() {
|
|
|
|
bool Module::LoadLegacySharedFont() {
|
|
|
|
// This is the legacy method to load shared font.
|
|
|
|
// This is the legacy method to load shared font.
|
|
|
|
// The expected format is a decrypted, uncompressed BCFNT file with the 0x80 byte header
|
|
|
|
// The expected format is a decrypted, uncompressed BCFNT file with the 0x80 byte header
|
|
|
|
// generated by the APT:U service. The best way to get is by dumping it from RAM. We've provided
|
|
|
|
// generated by the APT:U service. The best way to get is by dumping it from RAM. We've provided
|
|
|
@ -202,21 +184,21 @@ static bool LoadLegacySharedFont() {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GetSharedFont(Service::Interface* self) {
|
|
|
|
void Module::Interface::GetSharedFont(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
|
|
|
|
|
|
|
|
// Log in telemetry if the game uses the shared font
|
|
|
|
// Log in telemetry if the game uses the shared font
|
|
|
|
Core::Telemetry().AddField(Telemetry::FieldType::Session, "RequiresSharedFont", true);
|
|
|
|
Core::Telemetry().AddField(Telemetry::FieldType::Session, "RequiresSharedFont", true);
|
|
|
|
|
|
|
|
|
|
|
|
if (!shared_font_loaded) {
|
|
|
|
if (!apt->shared_font_loaded) {
|
|
|
|
// On real 3DS, font loading happens on booting. However, we load it on demand to coordinate
|
|
|
|
// On real 3DS, font loading happens on booting. However, we load it on demand to coordinate
|
|
|
|
// with CFG region auto configuration, which happens later than APT initialization.
|
|
|
|
// with CFG region auto configuration, which happens later than APT initialization.
|
|
|
|
if (LoadSharedFont()) {
|
|
|
|
if (apt->LoadSharedFont()) {
|
|
|
|
shared_font_loaded = true;
|
|
|
|
apt->shared_font_loaded = true;
|
|
|
|
} else if (LoadLegacySharedFont()) {
|
|
|
|
} else if (apt->LoadLegacySharedFont()) {
|
|
|
|
LOG_WARNING(Service_APT, "Loaded shared font by legacy method");
|
|
|
|
LOG_WARNING(Service_APT, "Loaded shared font by legacy method");
|
|
|
|
shared_font_loaded = true;
|
|
|
|
apt->shared_font_loaded = true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds");
|
|
|
|
LOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds");
|
|
|
|
rb.Push<u32>(-1); // TODO: Find the right error code
|
|
|
|
rb.Push<u32>(-1); // TODO: Find the right error code
|
|
|
@ -229,10 +211,10 @@ void GetSharedFont(Service::Interface* self) {
|
|
|
|
// The shared font has to be relocated to the new address before being passed to the
|
|
|
|
// The shared font has to be relocated to the new address before being passed to the
|
|
|
|
// application.
|
|
|
|
// application.
|
|
|
|
VAddr target_address =
|
|
|
|
VAddr target_address =
|
|
|
|
Memory::PhysicalToVirtualAddress(shared_font_mem->linear_heap_phys_address).value();
|
|
|
|
Memory::PhysicalToVirtualAddress(apt->shared_font_mem->linear_heap_phys_address).value();
|
|
|
|
if (!shared_font_relocated) {
|
|
|
|
if (!apt->shared_font_relocated) {
|
|
|
|
BCFNT::RelocateSharedFont(shared_font_mem, target_address);
|
|
|
|
BCFNT::RelocateSharedFont(apt->shared_font_mem, target_address);
|
|
|
|
shared_font_relocated = true;
|
|
|
|
apt->shared_font_relocated = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
@ -240,19 +222,19 @@ void GetSharedFont(Service::Interface* self) {
|
|
|
|
// allocated, the real APT service calculates this address by scanning the entire address space
|
|
|
|
// allocated, the real APT service calculates this address by scanning the entire address space
|
|
|
|
// (using svcQueryMemory) and searches for an allocation of the same size as the Shared Font.
|
|
|
|
// (using svcQueryMemory) and searches for an allocation of the same size as the Shared Font.
|
|
|
|
rb.Push(target_address);
|
|
|
|
rb.Push(target_address);
|
|
|
|
rb.PushCopyHandles(Kernel::g_handle_table.Create(shared_font_mem).Unwrap());
|
|
|
|
rb.PushCopyObjects(apt->shared_font_mem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void NotifyToWait(Service::Interface* self) {
|
|
|
|
void Module::Interface::NotifyToWait(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) app_id=%u", app_id);
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) app_id=%u", app_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GetLockHandle(Service::Interface* self) {
|
|
|
|
void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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)
|
|
|
|
// Bit 5 tells the application that there's a pending APT parameter,
|
|
|
|
// Bit 5 tells the application that there's a pending APT parameter,
|
|
|
@ -267,25 +249,23 @@ void GetLockHandle(Service::Interface* self) {
|
|
|
|
|
|
|
|
|
|
|
|
rb.Push(applet_attributes); // Applet Attributes, this value is passed to Enable.
|
|
|
|
rb.Push(applet_attributes); // Applet Attributes, this value is passed to Enable.
|
|
|
|
rb.Push<u32>(0); // Least significant bit = power button state
|
|
|
|
rb.Push<u32>(0); // Least significant bit = power button state
|
|
|
|
Kernel::Handle handle_copy = Kernel::g_handle_table.Create(lock).Unwrap();
|
|
|
|
rb.PushCopyObjects(apt->lock);
|
|
|
|
rb.PushCopyHandles(handle_copy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called handle=0x%08X applet_attributes=0x%08X", handle_copy,
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called applet_attributes=0x%08X", applet_attributes);
|
|
|
|
applet_attributes);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Enable(Service::Interface* self) {
|
|
|
|
void Module::Interface::Enable(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x3, 1, 0); // 0x30040
|
|
|
|
IPC::RequestParser rp(ctx, 0x3, 1, 0); // 0x30040
|
|
|
|
u32 attributes = rp.Pop<u32>();
|
|
|
|
u32 attributes = rp.Pop<u32>();
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called attributes=0x%08X", attributes);
|
|
|
|
LOG_DEBUG(Service_APT, "called attributes=0x%08X", attributes);
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(applet_manager->Enable(attributes));
|
|
|
|
rb.Push(apt->applet_manager->Enable(attributes));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GetAppletManInfo(Service::Interface* self) {
|
|
|
|
void Module::Interface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
@ -297,18 +277,18 @@ void GetAppletManInfo(Service::Interface* self) {
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk);
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IsRegistered(Service::Interface* self) {
|
|
|
|
void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x9, 1, 0); // 0x90040
|
|
|
|
IPC::RequestParser rp(ctx, 0x9, 1, 0); // 0x90040
|
|
|
|
AppletId app_id = static_cast<AppletId>(rp.Pop<u32>());
|
|
|
|
AppletId app_id = rp.PopEnum<AppletId>();
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(applet_manager->IsRegistered(app_id));
|
|
|
|
rb.Push(apt->applet_manager->IsRegistered(app_id));
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X", static_cast<u32>(app_id));
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X", static_cast<u32>(app_id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InquireNotification(Service::Interface* self) {
|
|
|
|
void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
@ -316,52 +296,41 @@ void InquireNotification(Service::Interface* self) {
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X", app_id);
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X", app_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SendParameter(Service::Interface* self) {
|
|
|
|
void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
SignalType signal_type = rp.PopEnum<SignalType>();
|
|
|
|
SignalType signal_type = rp.PopEnum<SignalType>();
|
|
|
|
u32 buffer_size = rp.Pop<u32>();
|
|
|
|
u32 buffer_size = rp.Pop<u32>();
|
|
|
|
Kernel::Handle handle = rp.PopHandle();
|
|
|
|
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
|
|
|
size_t size;
|
|
|
|
std::vector<u8> buffer = rp.PopStaticBuffer();
|
|
|
|
VAddr buffer = rp.PopStaticBuffer(&size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT,
|
|
|
|
LOG_DEBUG(Service_APT, "called src_app_id=0x%08X, dst_app_id=0x%08X, signal_type=0x%08X,"
|
|
|
|
"called src_app_id=0x%08X, dst_app_id=0x%08X, signal_type=0x%08X,"
|
|
|
|
"buffer_size=0x%08X",
|
|
|
|
"buffer_size=0x%08X, handle=0x%08X, size=0x%08zX, in_param_buffer_ptr=0x%08X",
|
|
|
|
|
|
|
|
static_cast<u32>(src_app_id), static_cast<u32>(dst_app_id),
|
|
|
|
static_cast<u32>(src_app_id), static_cast<u32>(dst_app_id),
|
|
|
|
static_cast<u32>(signal_type), buffer_size, handle, size, buffer);
|
|
|
|
static_cast<u32>(signal_type), buffer_size);
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
|
|
|
|
|
|
|
|
MessageParameter param;
|
|
|
|
MessageParameter param;
|
|
|
|
param.destination_id = dst_app_id;
|
|
|
|
param.destination_id = dst_app_id;
|
|
|
|
param.sender_id = src_app_id;
|
|
|
|
param.sender_id = src_app_id;
|
|
|
|
param.object = Kernel::g_handle_table.GetGeneric(handle);
|
|
|
|
param.object = std::move(object);
|
|
|
|
param.signal = signal_type;
|
|
|
|
param.signal = signal_type;
|
|
|
|
param.buffer.resize(buffer_size);
|
|
|
|
param.buffer = std::move(buffer);
|
|
|
|
Memory::ReadBlock(buffer, param.buffer.data(), param.buffer.size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rb.Push(applet_manager->SendParameter(param));
|
|
|
|
rb.Push(apt->applet_manager->SendParameter(param));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ReceiveParameter(Service::Interface* self) {
|
|
|
|
void Module::Interface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
|
|
|
|
|
|
|
|
size_t static_buff_size;
|
|
|
|
|
|
|
|
VAddr buffer = rp.PeekStaticBuffer(0, &static_buff_size);
|
|
|
|
|
|
|
|
if (buffer_size > static_buff_size)
|
|
|
|
|
|
|
|
LOG_WARNING(
|
|
|
|
|
|
|
|
Service_APT,
|
|
|
|
|
|
|
|
"buffer_size is bigger than the size in the buffer descriptor (0x%08X > 0x%08zX)",
|
|
|
|
|
|
|
|
buffer_size, static_buff_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X, buffer_size=0x%08X", static_cast<u32>(app_id),
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X, buffer_size=0x%08X", static_cast<u32>(app_id),
|
|
|
|
buffer_size);
|
|
|
|
buffer_size);
|
|
|
|
|
|
|
|
|
|
|
|
auto next_parameter = applet_manager->ReceiveParameter(app_id);
|
|
|
|
auto next_parameter = apt->applet_manager->ReceiveParameter(app_id);
|
|
|
|
|
|
|
|
|
|
|
|
if (next_parameter.Failed()) {
|
|
|
|
if (next_parameter.Failed()) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
@ -376,33 +345,20 @@ void ReceiveParameter(Service::Interface* self) {
|
|
|
|
rb.PushEnum(next_parameter->signal); // Signal type
|
|
|
|
rb.PushEnum(next_parameter->signal); // Signal type
|
|
|
|
ASSERT_MSG(next_parameter->buffer.size() <= buffer_size, "Input static buffer is too small !");
|
|
|
|
ASSERT_MSG(next_parameter->buffer.size() <= buffer_size, "Input static buffer is too small !");
|
|
|
|
rb.Push(static_cast<u32>(next_parameter->buffer.size())); // Parameter buffer size
|
|
|
|
rb.Push(static_cast<u32>(next_parameter->buffer.size())); // Parameter buffer size
|
|
|
|
|
|
|
|
rb.PushMoveObjects(next_parameter->object);
|
|
|
|
rb.PushMoveHandles((next_parameter->object != nullptr)
|
|
|
|
next_parameter->buffer.resize(buffer_size, 0); // APT always push a buffer with the maximum size
|
|
|
|
? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
|
|
|
|
rb.PushStaticBuffer(next_parameter->buffer, 0);
|
|
|
|
: 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rb.PushStaticBuffer(buffer, next_parameter->buffer.size(), 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GlanceParameter(Service::Interface* self) {
|
|
|
|
void Module::Interface::GlanceParameter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
|
|
|
|
|
|
|
|
size_t static_buff_size;
|
|
|
|
|
|
|
|
VAddr buffer = rp.PeekStaticBuffer(0, &static_buff_size);
|
|
|
|
|
|
|
|
if (buffer_size > static_buff_size)
|
|
|
|
|
|
|
|
LOG_WARNING(
|
|
|
|
|
|
|
|
Service_APT,
|
|
|
|
|
|
|
|
"buffer_size is bigger than the size in the buffer descriptor (0x%08X > 0x%08zX)",
|
|
|
|
|
|
|
|
buffer_size, static_buff_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X, buffer_size=0x%08X", static_cast<u32>(app_id),
|
|
|
|
LOG_DEBUG(Service_APT, "called app_id=0x%08X, buffer_size=0x%08X", static_cast<u32>(app_id),
|
|
|
|
buffer_size);
|
|
|
|
buffer_size);
|
|
|
|
|
|
|
|
|
|
|
|
auto next_parameter = applet_manager->GlanceParameter(app_id);
|
|
|
|
auto next_parameter = apt->applet_manager->GlanceParameter(app_id);
|
|
|
|
|
|
|
|
|
|
|
|
if (next_parameter.Failed()) {
|
|
|
|
if (next_parameter.Failed()) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
@ -416,18 +372,13 @@ void GlanceParameter(Service::Interface* self) {
|
|
|
|
rb.PushEnum(next_parameter->signal); // Signal type
|
|
|
|
rb.PushEnum(next_parameter->signal); // Signal type
|
|
|
|
ASSERT_MSG(next_parameter->buffer.size() <= buffer_size, "Input static buffer is too small !");
|
|
|
|
ASSERT_MSG(next_parameter->buffer.size() <= buffer_size, "Input static buffer is too small !");
|
|
|
|
rb.Push(static_cast<u32>(next_parameter->buffer.size())); // Parameter buffer size
|
|
|
|
rb.Push(static_cast<u32>(next_parameter->buffer.size())); // Parameter buffer size
|
|
|
|
|
|
|
|
rb.PushMoveObjects(next_parameter->object);
|
|
|
|
rb.PushMoveHandles((next_parameter->object != nullptr)
|
|
|
|
next_parameter->buffer.resize(buffer_size, 0); // APT always push a buffer with the maximum size
|
|
|
|
? Kernel::g_handle_table.Create(next_parameter->object).Unwrap()
|
|
|
|
rb.PushStaticBuffer(next_parameter->buffer, 0);
|
|
|
|
: 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rb.PushStaticBuffer(buffer, next_parameter->buffer.size(), 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Memory::WriteBlock(buffer, next_parameter->buffer.data(), next_parameter->buffer.size());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CancelParameter(Service::Interface* self) {
|
|
|
|
void Module::Interface::CancelParameter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0xF, 4, 0); // 0xF0100
|
|
|
|
IPC::RequestParser rp(ctx, 0xF, 4, 0); // 0xF0100
|
|
|
|
|
|
|
|
|
|
|
|
bool check_sender = rp.Pop<bool>();
|
|
|
|
bool check_sender = rp.Pop<bool>();
|
|
|
|
AppletId sender_appid = rp.PopEnum<AppletId>();
|
|
|
|
AppletId sender_appid = rp.PopEnum<AppletId>();
|
|
|
@ -437,7 +388,7 @@ void CancelParameter(Service::Interface* self) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
|
|
|
|
rb.Push(apt->applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
|
|
|
|
receiver_appid));
|
|
|
|
receiver_appid));
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called check_sender=%u, sender_appid=0x%08X, "
|
|
|
|
LOG_DEBUG(Service_APT, "called check_sender=%u, sender_appid=0x%08X, "
|
|
|
@ -446,8 +397,8 @@ void CancelParameter(Service::Interface* self) {
|
|
|
|
static_cast<u32>(receiver_appid));
|
|
|
|
static_cast<u32>(receiver_appid));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PrepareToStartApplication(Service::Interface* self) {
|
|
|
|
void Module::Interface::PrepareToStartApplication(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
u32 title_info3 = rp.Pop<u32>();
|
|
|
|
u32 title_info3 = rp.Pop<u32>();
|
|
|
@ -455,7 +406,7 @@ void PrepareToStartApplication(Service::Interface* self) {
|
|
|
|
u32 flags = rp.Pop<u32>();
|
|
|
|
u32 flags = rp.Pop<u32>();
|
|
|
|
|
|
|
|
|
|
|
|
if (flags & 0x00000100) {
|
|
|
|
if (flags & 0x00000100) {
|
|
|
|
unknown_ns_state_field = 1;
|
|
|
|
apt->unknown_ns_state_field = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
@ -467,49 +418,43 @@ void PrepareToStartApplication(Service::Interface* self) {
|
|
|
|
title_info1, title_info2, title_info3, title_info4, flags);
|
|
|
|
title_info1, title_info2, title_info3, title_info4, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void StartApplication(Service::Interface* self) {
|
|
|
|
void Module::Interface::StartApplication(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
u32 flag = rp.Pop<u32>();
|
|
|
|
u32 flag = rp.Pop<u32>();
|
|
|
|
size_t size1;
|
|
|
|
std::vector<u8> buffer1 = rp.PopStaticBuffer();
|
|
|
|
VAddr buffer1_ptr = rp.PopStaticBuffer(&size1);
|
|
|
|
std::vector<u8> buffer2 = rp.PopStaticBuffer();
|
|
|
|
size_t size2;
|
|
|
|
|
|
|
|
VAddr buffer2_ptr = rp.PopStaticBuffer(&size2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_APT,
|
|
|
|
LOG_WARNING(Service_APT,
|
|
|
|
"(STUBBED) called buffer1_size=0x%08X, buffer2_size=0x%08X, flag=0x%08X,"
|
|
|
|
"(STUBBED) called buffer1_size=0x%08X, buffer2_size=0x%08X, flag=0x%08X",
|
|
|
|
"size1=0x%08zX, buffer1_ptr=0x%08X, size2=0x%08zX, buffer2_ptr=0x%08X",
|
|
|
|
buffer1_size, buffer2_size, flag);
|
|
|
|
buffer1_size, buffer2_size, flag, size1, buffer1_ptr, size2, buffer2_ptr);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AppletUtility(Service::Interface* self) {
|
|
|
|
void Module::Interface::AppletUtility(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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.
|
|
|
|
u32 utility_command = rp.Pop<u32>();
|
|
|
|
u32 utility_command = rp.Pop<u32>();
|
|
|
|
u32 input_size = rp.Pop<u32>();
|
|
|
|
u32 input_size = rp.Pop<u32>();
|
|
|
|
u32 output_size = rp.Pop<u32>();
|
|
|
|
u32 output_size = rp.Pop<u32>();
|
|
|
|
VAddr input_addr = rp.PopStaticBuffer(nullptr);
|
|
|
|
std::vector<u8> input = rp.PopStaticBuffer();
|
|
|
|
|
|
|
|
|
|
|
|
VAddr output_addr = rp.PeekStaticBuffer(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_APT,
|
|
|
|
LOG_WARNING(Service_APT,
|
|
|
|
"(STUBBED) called command=0x%08X, input_size=0x%08X, output_size=0x%08X, "
|
|
|
|
"(STUBBED) called command=0x%08X, input_size=0x%08X, output_size=0x%08X",
|
|
|
|
"input_addr=0x%08X, output_addr=0x%08X",
|
|
|
|
utility_command, input_size, output_size);
|
|
|
|
utility_command, input_size, output_size, input_addr, output_addr);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetAppCpuTimeLimit(Service::Interface* self) {
|
|
|
|
void Module::Interface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x4F, 2, 0); // 0x4F0080
|
|
|
|
IPC::RequestParser rp(ctx, 0x4F, 2, 0); // 0x4F0080
|
|
|
|
u32 value = rp.Pop<u32>();
|
|
|
|
u32 value = rp.Pop<u32>();
|
|
|
|
cpu_percent = rp.Pop<u32>();
|
|
|
|
apt->cpu_percent = rp.Pop<u32>();
|
|
|
|
|
|
|
|
|
|
|
|
if (value != 1) {
|
|
|
|
if (value != 1) {
|
|
|
|
LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value);
|
|
|
|
LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value);
|
|
|
@ -518,11 +463,11 @@ void SetAppCpuTimeLimit(Service::Interface* self) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called cpu_percent=%u, value=%u", cpu_percent, value);
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called cpu_percent=%u, value=%u", apt->cpu_percent, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GetAppCpuTimeLimit(Service::Interface* self) {
|
|
|
|
void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x50, 1, 0); // 0x500040
|
|
|
|
IPC::RequestParser rp(ctx, 0x50, 1, 0); // 0x500040
|
|
|
|
u32 value = rp.Pop<u32>();
|
|
|
|
u32 value = rp.Pop<u32>();
|
|
|
|
|
|
|
|
|
|
|
|
if (value != 1) {
|
|
|
|
if (value != 1) {
|
|
|
@ -531,23 +476,23 @@ void GetAppCpuTimeLimit(Service::Interface* self) {
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(cpu_percent);
|
|
|
|
rb.Push(apt->cpu_percent);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called value=%u", value);
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called value=%u", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PrepareToStartLibraryApplet(Service::Interface* self) {
|
|
|
|
void Module::Interface::PrepareToStartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x18, 1, 0); // 0x180040
|
|
|
|
IPC::RequestParser rp(ctx, 0x18, 1, 0); // 0x180040
|
|
|
|
AppletId applet_id = static_cast<AppletId>(rp.Pop<u32>());
|
|
|
|
AppletId applet_id = rp.PopEnum<AppletId>();
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
|
|
|
|
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(applet_manager->PrepareToStartLibraryApplet(applet_id));
|
|
|
|
rb.Push(apt->applet_manager->PrepareToStartLibraryApplet(applet_id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PrepareToStartNewestHomeMenu(Service::Interface* self) {
|
|
|
|
void Module::Interface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(Subv): This command can only be called by a System Applet (return 0xC8A0CC04 otherwise).
|
|
|
|
// TODO(Subv): This command can only be called by a System Applet (return 0xC8A0CC04 otherwise).
|
|
|
@ -560,47 +505,42 @@ void PrepareToStartNewestHomeMenu(Service::Interface* self) {
|
|
|
|
LOG_DEBUG(Service_APT, "called");
|
|
|
|
LOG_DEBUG(Service_APT, "called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PreloadLibraryApplet(Service::Interface* self) {
|
|
|
|
void Module::Interface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x16, 1, 0); // 0x160040
|
|
|
|
IPC::RequestParser rp(ctx, 0x16, 1, 0); // 0x160040
|
|
|
|
AppletId applet_id = static_cast<AppletId>(rp.Pop<u32>());
|
|
|
|
AppletId applet_id = rp.PopEnum<AppletId>();
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
|
|
|
|
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(applet_manager->PreloadLibraryApplet(applet_id));
|
|
|
|
rb.Push(apt->applet_manager->PreloadLibraryApplet(applet_id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FinishPreloadingLibraryApplet(Service::Interface* self) {
|
|
|
|
void Module::Interface::FinishPreloadingLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x17, 1, 0); // 0x00170040
|
|
|
|
IPC::RequestParser rp(ctx, 0x17, 1, 0); // 0x00170040
|
|
|
|
AppletId applet_id = static_cast<AppletId>(rp.Pop<u32>());
|
|
|
|
AppletId applet_id = rp.PopEnum<AppletId>();
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(applet_manager->FinishPreloadingLibraryApplet(applet_id));
|
|
|
|
rb.Push(apt->applet_manager->FinishPreloadingLibraryApplet(applet_id));
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called applet_id=%03X", static_cast<u32>(applet_id));
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called applet_id=%03X", static_cast<u32>(applet_id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void StartLibraryApplet(Service::Interface* self) {
|
|
|
|
void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1E, 2, 4); // 0x1E0084
|
|
|
|
IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084
|
|
|
|
AppletId applet_id = static_cast<AppletId>(rp.Pop<u32>());
|
|
|
|
AppletId applet_id = rp.PopEnum<AppletId>();
|
|
|
|
|
|
|
|
|
|
|
|
size_t buffer_size = rp.Pop<u32>();
|
|
|
|
size_t buffer_size = rp.Pop<u32>();
|
|
|
|
Kernel::Handle handle = rp.PopHandle();
|
|
|
|
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
|
|
|
VAddr buffer_addr = rp.PopStaticBuffer(nullptr);
|
|
|
|
std::vector<u8> buffer = rp.PopStaticBuffer();
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
|
|
|
|
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
|
|
|
|
rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer));
|
|
|
|
std::vector<u8> buffer(buffer_size);
|
|
|
|
|
|
|
|
Memory::ReadBlock(buffer_addr, buffer.data(), buffer.size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rb.Push(applet_manager->StartLibraryApplet(applet_id, Kernel::g_handle_table.GetGeneric(handle),
|
|
|
|
|
|
|
|
buffer));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CancelLibraryApplet(Service::Interface* self) {
|
|
|
|
void Module::Interface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x3B, 1, 0); // 0x003B0040
|
|
|
|
IPC::RequestParser rp(ctx, 0x3B, 1, 0); // 0x003B0040
|
|
|
|
bool exiting = rp.Pop<bool>();
|
|
|
|
bool exiting = rp.Pop<bool>();
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
@ -609,34 +549,34 @@ void CancelLibraryApplet(Service::Interface* self) {
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called exiting=%d", exiting);
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called exiting=%d", exiting);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetScreenCapPostPermission(Service::Interface* self) {
|
|
|
|
void Module::Interface::SetScreenCapPostPermission(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x55, 1, 0); // 0x00550040
|
|
|
|
IPC::RequestParser rp(ctx, 0x55, 1, 0); // 0x00550040
|
|
|
|
|
|
|
|
|
|
|
|
screen_capture_post_permission = static_cast<ScreencapPostPermission>(rp.Pop<u32>() & 0xF);
|
|
|
|
apt->screen_capture_post_permission = static_cast<ScreencapPostPermission>(rp.Pop<u32>() & 0xF);
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u",
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u",
|
|
|
|
static_cast<u32>(screen_capture_post_permission));
|
|
|
|
static_cast<u32>(apt->screen_capture_post_permission));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GetScreenCapPostPermission(Service::Interface* self) {
|
|
|
|
void Module::Interface::GetScreenCapPostPermission(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(RESULT_SUCCESS); // No error
|
|
|
|
rb.Push(static_cast<u32>(screen_capture_post_permission));
|
|
|
|
rb.Push(static_cast<u32>(apt->screen_capture_post_permission));
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u",
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u",
|
|
|
|
static_cast<u32>(screen_capture_post_permission));
|
|
|
|
static_cast<u32>(apt->screen_capture_post_permission));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GetAppletInfo(Service::Interface* self) {
|
|
|
|
void Module::Interface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x6, 1, 0); // 0x60040
|
|
|
|
IPC::RequestParser rp(ctx, 0x6, 1, 0); // 0x60040
|
|
|
|
auto app_id = static_cast<AppletId>(rp.Pop<u32>());
|
|
|
|
auto app_id = rp.PopEnum<AppletId>();
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_APT, "called appid=%u", static_cast<u32>(app_id));
|
|
|
|
LOG_DEBUG(Service_APT, "called appid=%u", static_cast<u32>(app_id));
|
|
|
|
|
|
|
|
|
|
|
|
auto info = applet_manager->GetAppletInfo(app_id);
|
|
|
|
auto info = apt->applet_manager->GetAppletInfo(app_id);
|
|
|
|
if (info.Failed()) {
|
|
|
|
if (info.Failed()) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(info.Code());
|
|
|
|
rb.Push(info.Code());
|
|
|
@ -651,8 +591,8 @@ void GetAppletInfo(Service::Interface* self) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GetStartupArgument(Service::Interface* self) {
|
|
|
|
void Module::Interface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>());
|
|
|
|
|
|
|
|
|
|
|
@ -664,17 +604,7 @@ void GetStartupArgument(Service::Interface* self) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t static_buff_size;
|
|
|
|
std::vector<u8> parameter(parameter_size, 0);
|
|
|
|
VAddr addr = rp.PeekStaticBuffer(0, &static_buff_size);
|
|
|
|
|
|
|
|
if (parameter_size > static_buff_size)
|
|
|
|
|
|
|
|
LOG_WARNING(
|
|
|
|
|
|
|
|
Service_APT,
|
|
|
|
|
|
|
|
"parameter_size is bigger than the size in the buffer descriptor (0x%08X > 0x%08zX)",
|
|
|
|
|
|
|
|
parameter_size, static_buff_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addr && parameter_size) {
|
|
|
|
|
|
|
|
Memory::ZeroBlock(addr, parameter_size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_APT, "(stubbed) called startup_argument_type=%u , parameter_size=0x%08x",
|
|
|
|
LOG_WARNING(Service_APT, "(stubbed) called startup_argument_type=%u , parameter_size=0x%08x",
|
|
|
|
static_cast<u32>(startup_argument_type), parameter_size);
|
|
|
|
static_cast<u32>(startup_argument_type), parameter_size);
|
|
|
@ -682,21 +612,19 @@ void GetStartupArgument(Service::Interface* self) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(0);
|
|
|
|
rb.Push<u32>(0);
|
|
|
|
rb.PushStaticBuffer(addr, parameter_size, 0);
|
|
|
|
rb.PushStaticBuffer(parameter, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Wrap(Service::Interface* self) {
|
|
|
|
void Module::Interface::Wrap(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
const u32 nonce_offset = rp.Pop<u32>();
|
|
|
|
const u32 nonce_offset = rp.Pop<u32>();
|
|
|
|
u32 nonce_size = rp.Pop<u32>();
|
|
|
|
u32 nonce_size = rp.Pop<u32>();
|
|
|
|
size_t desc_size;
|
|
|
|
auto& input = rp.PopMappedBuffer();
|
|
|
|
IPC::MappedBufferPermissions desc_permission;
|
|
|
|
ASSERT(input.GetSize() == input_size);
|
|
|
|
const VAddr input = rp.PopMappedBuffer(&desc_size, &desc_permission);
|
|
|
|
auto& output = rp.PopMappedBuffer();
|
|
|
|
ASSERT(desc_size == input_size && desc_permission == IPC::MappedBufferPermissions::R);
|
|
|
|
ASSERT(output.GetSize() == output_size);
|
|
|
|
const VAddr output = rp.PopMappedBuffer(&desc_size, &desc_permission);
|
|
|
|
|
|
|
|
ASSERT(desc_size == output_size && desc_permission == IPC::MappedBufferPermissions::W);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note: real 3DS still returns SUCCESS when the sizes don't match. It seems that it doesn't
|
|
|
|
// Note: real 3DS still returns SUCCESS when the sizes don't match. It seems that it doesn't
|
|
|
|
// check the buffer size and writes data with potential overflow.
|
|
|
|
// check the buffer size and writes data with potential overflow.
|
|
|
@ -711,40 +639,37 @@ void Wrap(Service::Interface* self) {
|
|
|
|
|
|
|
|
|
|
|
|
// Reads nonce and concatenates the rest of the input as plaintext
|
|
|
|
// Reads nonce and concatenates the rest of the input as plaintext
|
|
|
|
HW::AES::CCMNonce nonce{};
|
|
|
|
HW::AES::CCMNonce nonce{};
|
|
|
|
Memory::ReadBlock(input + nonce_offset, nonce.data(), nonce_size);
|
|
|
|
input.Read(nonce.data(), nonce_offset, nonce_size);
|
|
|
|
u32 pdata_size = input_size - nonce_size;
|
|
|
|
u32 pdata_size = input_size - nonce_size;
|
|
|
|
std::vector<u8> pdata(pdata_size);
|
|
|
|
std::vector<u8> pdata(pdata_size);
|
|
|
|
Memory::ReadBlock(input, pdata.data(), nonce_offset);
|
|
|
|
input.Read(pdata.data(), 0, nonce_offset);
|
|
|
|
Memory::ReadBlock(input + nonce_offset + nonce_size, pdata.data() + nonce_offset,
|
|
|
|
input.Read(pdata.data() + nonce_offset, nonce_offset + nonce_size, pdata_size - nonce_offset);
|
|
|
|
pdata_size - nonce_offset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Encrypts the plaintext using AES-CCM
|
|
|
|
// Encrypts the plaintext using AES-CCM
|
|
|
|
auto cipher = HW::AES::EncryptSignCCM(pdata, nonce, HW::AES::KeySlotID::APTWrap);
|
|
|
|
auto cipher = HW::AES::EncryptSignCCM(pdata, nonce, HW::AES::KeySlotID::APTWrap);
|
|
|
|
|
|
|
|
|
|
|
|
// Puts the nonce to the beginning of the output, with ciphertext followed
|
|
|
|
// Puts the nonce to the beginning of the output, with ciphertext followed
|
|
|
|
Memory::WriteBlock(output, nonce.data(), nonce_size);
|
|
|
|
output.Write(nonce.data(), 0, nonce_size);
|
|
|
|
Memory::WriteBlock(output + nonce_size, cipher.data(), cipher.size());
|
|
|
|
output.Write(cipher.data(), nonce_size, cipher.size());
|
|
|
|
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
// Unmap buffer
|
|
|
|
// Unmap buffer
|
|
|
|
rb.PushMappedBuffer(input, input_size, IPC::MappedBufferPermissions::R);
|
|
|
|
rb.PushMappedBuffer(input);
|
|
|
|
rb.PushMappedBuffer(output, output_size, IPC::MappedBufferPermissions::W);
|
|
|
|
rb.PushMappedBuffer(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Unwrap(Service::Interface* self) {
|
|
|
|
void Module::Interface::Unwrap(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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>();
|
|
|
|
const u32 nonce_offset = rp.Pop<u32>();
|
|
|
|
const u32 nonce_offset = rp.Pop<u32>();
|
|
|
|
u32 nonce_size = rp.Pop<u32>();
|
|
|
|
u32 nonce_size = rp.Pop<u32>();
|
|
|
|
size_t desc_size;
|
|
|
|
auto& input = rp.PopMappedBuffer();
|
|
|
|
IPC::MappedBufferPermissions desc_permission;
|
|
|
|
ASSERT(input.GetSize() == input_size);
|
|
|
|
const VAddr input = rp.PopMappedBuffer(&desc_size, &desc_permission);
|
|
|
|
auto& output = rp.PopMappedBuffer();
|
|
|
|
ASSERT(desc_size == input_size && desc_permission == IPC::MappedBufferPermissions::R);
|
|
|
|
ASSERT(output.GetSize() == output_size);
|
|
|
|
const VAddr output = rp.PopMappedBuffer(&desc_size, &desc_permission);
|
|
|
|
|
|
|
|
ASSERT(desc_size == output_size && desc_permission == IPC::MappedBufferPermissions::W);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note: real 3DS still returns SUCCESS when the sizes don't match. It seems that it doesn't
|
|
|
|
// Note: real 3DS still returns SUCCESS when the sizes don't match. It seems that it doesn't
|
|
|
|
// check the buffer size and writes data with potential overflow.
|
|
|
|
// check the buffer size and writes data with potential overflow.
|
|
|
@ -759,10 +684,10 @@ void Unwrap(Service::Interface* self) {
|
|
|
|
|
|
|
|
|
|
|
|
// Reads nonce and cipher text
|
|
|
|
// Reads nonce and cipher text
|
|
|
|
HW::AES::CCMNonce nonce{};
|
|
|
|
HW::AES::CCMNonce nonce{};
|
|
|
|
Memory::ReadBlock(input, nonce.data(), nonce_size);
|
|
|
|
input.Read(nonce.data(), 0, nonce_size);
|
|
|
|
u32 cipher_size = input_size - nonce_size;
|
|
|
|
u32 cipher_size = input_size - nonce_size;
|
|
|
|
std::vector<u8> cipher(cipher_size);
|
|
|
|
std::vector<u8> cipher(cipher_size);
|
|
|
|
Memory::ReadBlock(input + nonce_size, cipher.data(), cipher_size);
|
|
|
|
input.Read(cipher.data(), nonce_size, cipher_size);
|
|
|
|
|
|
|
|
|
|
|
|
// Decrypts the ciphertext using AES-CCM
|
|
|
|
// Decrypts the ciphertext using AES-CCM
|
|
|
|
auto pdata = HW::AES::DecryptVerifyCCM(cipher, nonce, HW::AES::KeySlotID::APTWrap);
|
|
|
|
auto pdata = HW::AES::DecryptVerifyCCM(cipher, nonce, HW::AES::KeySlotID::APTWrap);
|
|
|
@ -770,9 +695,9 @@ void Unwrap(Service::Interface* self) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
|
|
|
if (!pdata.empty()) {
|
|
|
|
if (!pdata.empty()) {
|
|
|
|
// Splits the plaintext and put the nonce in between
|
|
|
|
// Splits the plaintext and put the nonce in between
|
|
|
|
Memory::WriteBlock(output, pdata.data(), nonce_offset);
|
|
|
|
output.Write(pdata.data(), 0, nonce_offset);
|
|
|
|
Memory::WriteBlock(output + nonce_offset, nonce.data(), nonce_size);
|
|
|
|
output.Write(nonce.data(), nonce_offset, nonce_size);
|
|
|
|
Memory::WriteBlock(output + nonce_offset + nonce_size, pdata.data() + nonce_offset,
|
|
|
|
output.Write(pdata.data() + nonce_offset, nonce_offset + nonce_size,
|
|
|
|
pdata.size() - nonce_offset);
|
|
|
|
pdata.size() - nonce_offset);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -782,15 +707,15 @@ void Unwrap(Service::Interface* self) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Unmap buffer
|
|
|
|
// Unmap buffer
|
|
|
|
rb.PushMappedBuffer(input, input_size, IPC::MappedBufferPermissions::R);
|
|
|
|
rb.PushMappedBuffer(input);
|
|
|
|
rb.PushMappedBuffer(output, output_size, IPC::MappedBufferPermissions::W);
|
|
|
|
rb.PushMappedBuffer(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CheckNew3DSApp(Service::Interface* self) {
|
|
|
|
void Module::Interface::CheckNew3DSApp(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
if (unknown_ns_state_field) {
|
|
|
|
if (apt->unknown_ns_state_field) {
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(0);
|
|
|
|
rb.Push<u32>(0);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -800,8 +725,8 @@ void CheckNew3DSApp(Service::Interface* self) {
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called");
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CheckNew3DS(Service::Interface* self) {
|
|
|
|
void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 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);
|
|
|
|
|
|
|
|
|
|
|
|
PTM::CheckNew3DS(rb);
|
|
|
|
PTM::CheckNew3DS(rb);
|
|
|
@ -809,11 +734,12 @@ void CheckNew3DS(Service::Interface* self) {
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called");
|
|
|
|
LOG_WARNING(Service_APT, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Init() {
|
|
|
|
Module::Interface::Interface(std::shared_ptr<Module> apt, const char* name, u32 max_session)
|
|
|
|
AddService(new APT_A_Interface);
|
|
|
|
: ServiceFramework(name, max_session), apt(std::move(apt)) {}
|
|
|
|
AddService(new APT_S_Interface);
|
|
|
|
|
|
|
|
AddService(new APT_U_Interface);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Module::Interface::~Interface() = default;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Module::Module() {
|
|
|
|
applet_manager = std::make_shared<AppletManager>();
|
|
|
|
applet_manager = std::make_shared<AppletManager>();
|
|
|
|
|
|
|
|
|
|
|
|
using Kernel::MemoryPermission;
|
|
|
|
using Kernel::MemoryPermission;
|
|
|
@ -823,20 +749,15 @@ void Init() {
|
|
|
|
Kernel::MemoryRegion::SYSTEM, "APT:SharedFont");
|
|
|
|
Kernel::MemoryRegion::SYSTEM, "APT:SharedFont");
|
|
|
|
|
|
|
|
|
|
|
|
lock = Kernel::Mutex::Create(false, "APT_U:Lock");
|
|
|
|
lock = Kernel::Mutex::Create(false, "APT_U:Lock");
|
|
|
|
|
|
|
|
|
|
|
|
cpu_percent = 0;
|
|
|
|
|
|
|
|
unknown_ns_state_field = 0;
|
|
|
|
|
|
|
|
screen_capture_post_permission =
|
|
|
|
|
|
|
|
ScreencapPostPermission::CleanThePermission; // TODO(JamePeng): verify the initial value
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Shutdown() {
|
|
|
|
Module::~Module() {}
|
|
|
|
shared_font_mem = nullptr;
|
|
|
|
|
|
|
|
shared_font_loaded = false;
|
|
|
|
|
|
|
|
shared_font_relocated = false;
|
|
|
|
|
|
|
|
lock = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
applet_manager = nullptr;
|
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
|
|
|
|
|
|
|
auto apt = std::make_shared<Module>();
|
|
|
|
|
|
|
|
std::make_shared<APT_U>(apt)->InstallAsService(service_manager);
|
|
|
|
|
|
|
|
std::make_shared<APT_S>(apt)->InstallAsService(service_manager);
|
|
|
|
|
|
|
|
std::make_shared<APT_A>(apt)->InstallAsService(service_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace APT
|
|
|
|
} // namespace APT
|
|
|
|