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

Merge pull request #3587 from valentinvanelslande/apt-fmt

Service/APT: Migrate logging macros
This commit is contained in:
Weiyi Wang 2018-04-12 22:47:44 +03:00 committed by GitHub
commit dfe9b4edf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 67 additions and 62 deletions

View File

@ -32,8 +32,8 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
AppletId app_id = rp.PopEnum<AppletId>();
u32 attributes = rp.Pop<u32>();
LOG_DEBUG(Service_APT, "called app_id=0x%08X, attributes=0x%08X", static_cast<u32>(app_id),
attributes);
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}, attributes={:#010X}",
static_cast<u32>(app_id), attributes);
auto result = apt->applet_manager->Initialize(app_id, attributes);
if (result.Failed()) {
@ -197,10 +197,10 @@ void Module::Interface::GetSharedFont(Kernel::HLERequestContext& ctx) {
if (apt->LoadSharedFont()) {
apt->shared_font_loaded = true;
} else if (apt->LoadLegacySharedFont()) {
LOG_WARNING(Service_APT, "Loaded shared font by legacy method");
NGLOG_WARNING(Service_APT, "Loaded shared font by legacy method");
apt->shared_font_loaded = true;
} else {
LOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds");
NGLOG_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>(0);
rb.PushCopyObjects<Kernel::Object>(nullptr);
@ -231,7 +231,7 @@ void Module::Interface::NotifyToWait(Kernel::HLERequestContext& ctx) {
u32 app_id = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error
LOG_WARNING(Service_APT, "(STUBBED) app_id=%u", app_id);
NGLOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id);
}
void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) {
@ -252,14 +252,14 @@ void Module::Interface::GetLockHandle(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // Least significant bit = power button state
rb.PushCopyObjects(apt->lock);
LOG_WARNING(Service_APT, "(STUBBED) called applet_attributes=0x%08X", applet_attributes);
NGLOG_WARNING(Service_APT, "(STUBBED) called applet_attributes={:#010X}", applet_attributes);
}
void Module::Interface::Enable(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x3, 1, 0); // 0x30040
u32 attributes = rp.Pop<u32>();
LOG_DEBUG(Service_APT, "called attributes=0x%08X", attributes);
NGLOG_DEBUG(Service_APT, "called attributes={:#010X}", attributes);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(apt->applet_manager->Enable(attributes));
@ -275,7 +275,7 @@ void Module::Interface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
rb.Push(static_cast<u32>(AppletId::HomeMenu)); // Home menu AppID
rb.Push(static_cast<u32>(AppletId::Application)); // TODO(purpasmart96): Do this correctly
LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk);
NGLOG_WARNING(Service_APT, "(STUBBED) called unk={:#010X}", unk);
}
void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) {
@ -285,7 +285,7 @@ void Module::Interface::IsRegistered(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); // No error
rb.Push(apt->applet_manager->IsRegistered(app_id));
LOG_DEBUG(Service_APT, "called app_id=0x%08X", static_cast<u32>(app_id));
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}", static_cast<u32>(app_id));
}
void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) {
@ -294,7 +294,7 @@ void Module::Interface::InquireNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error
rb.Push(static_cast<u32>(SignalType::None)); // Signal type
LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X", app_id);
NGLOG_WARNING(Service_APT, "(STUBBED) called app_id={:#010X}", app_id);
}
void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) {
@ -306,9 +306,9 @@ void Module::Interface::SendParameter(Kernel::HLERequestContext& ctx) {
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
std::vector<u8> buffer = rp.PopStaticBuffer();
LOG_DEBUG(Service_APT,
"called src_app_id=0x%08X, dst_app_id=0x%08X, signal_type=0x%08X,"
"buffer_size=0x%08X",
NGLOG_DEBUG(Service_APT,
"called src_app_id={:#010X}, dst_app_id={:#010X}, signal_type={:#010X},"
"buffer_size={:#010X}",
static_cast<u32>(src_app_id), static_cast<u32>(dst_app_id),
static_cast<u32>(signal_type), buffer_size);
@ -329,8 +329,8 @@ void Module::Interface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
AppletId app_id = rp.PopEnum<AppletId>();
u32 buffer_size = rp.Pop<u32>();
LOG_DEBUG(Service_APT, "called app_id=0x%08X, buffer_size=0x%08X", static_cast<u32>(app_id),
buffer_size);
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}, buffer_size={:#010X}",
static_cast<u32>(app_id), buffer_size);
auto next_parameter = apt->applet_manager->ReceiveParameter(app_id);
@ -345,7 +345,7 @@ void Module::Interface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); // No error
rb.PushEnum(next_parameter->sender_id);
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.PushMoveObjects(next_parameter->object);
next_parameter->buffer.resize(buffer_size, 0); // APT always push a buffer with the maximum size
@ -357,8 +357,8 @@ void Module::Interface::GlanceParameter(Kernel::HLERequestContext& ctx) {
AppletId app_id = rp.PopEnum<AppletId>();
u32 buffer_size = rp.Pop<u32>();
LOG_DEBUG(Service_APT, "called app_id=0x%08X, buffer_size=0x%08X", static_cast<u32>(app_id),
buffer_size);
NGLOG_DEBUG(Service_APT, "called app_id={:#010X}, buffer_size={:#010X}",
static_cast<u32>(app_id), buffer_size);
auto next_parameter = apt->applet_manager->GlanceParameter(app_id);
@ -372,7 +372,7 @@ void Module::Interface::GlanceParameter(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); // No error
rb.PushEnum(next_parameter->sender_id);
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.PushMoveObjects(next_parameter->object);
next_parameter->buffer.resize(buffer_size, 0); // APT always push a buffer with the maximum size
@ -393,9 +393,9 @@ void Module::Interface::CancelParameter(Kernel::HLERequestContext& ctx) {
rb.Push(apt->applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
receiver_appid));
LOG_DEBUG(Service_APT,
"called check_sender=%u, sender_appid=0x%08X, "
"check_receiver=%u, receiver_appid=0x%08X",
NGLOG_DEBUG(Service_APT,
"called check_sender={}, sender_appid={:#010X}, "
"check_receiver={}, receiver_appid={:#010X}",
check_sender, static_cast<u32>(sender_appid), check_receiver,
static_cast<u32>(receiver_appid));
}
@ -415,9 +415,10 @@ void Module::Interface::PrepareToStartApplication(Kernel::HLERequestContext& ctx
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error
LOG_WARNING(Service_APT,
"(STUBBED) called title_info1=0x%08X, title_info2=0x%08X, title_info3=0x%08X,"
"title_info4=0x%08X, flags=0x%08X",
NGLOG_WARNING(
Service_APT,
"(STUBBED) called title_info1={:#010X}, title_info2={:#010X}, title_info3={:#010X},"
"title_info4={:#010X}, flags={:#010X}",
title_info1, title_info2, title_info3, title_info4, flags);
}
@ -432,8 +433,8 @@ void Module::Interface::StartApplication(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error
LOG_WARNING(Service_APT,
"(STUBBED) called buffer1_size=0x%08X, buffer2_size=0x%08X, flag=0x%08X",
NGLOG_WARNING(Service_APT,
"(STUBBED) called buffer1_size={:#010X}, buffer2_size={:#010X}, flag={:#010X}",
buffer1_size, buffer2_size, flag);
}
@ -449,8 +450,8 @@ void Module::Interface::AppletUtility(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error
LOG_WARNING(Service_APT,
"(STUBBED) called command=0x%08X, input_size=0x%08X, output_size=0x%08X",
NGLOG_WARNING(Service_APT,
"(STUBBED) called command={:#010X}, input_size={:#010X}, output_size={:#010X}",
utility_command, input_size, output_size);
}
@ -460,13 +461,14 @@ void Module::Interface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
apt->cpu_percent = rp.Pop<u32>();
if (value != 1) {
LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value);
NGLOG_ERROR(Service_APT, "This value should be one, but is actually {}!", value);
}
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error
LOG_WARNING(Service_APT, "(STUBBED) called cpu_percent=%u, value=%u", apt->cpu_percent, value);
NGLOG_WARNING(Service_APT, "(STUBBED) called, cpu_percent={}, value={}", apt->cpu_percent,
value);
}
void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
@ -474,21 +476,21 @@ void Module::Interface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
u32 value = rp.Pop<u32>();
if (value != 1) {
LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value);
NGLOG_ERROR(Service_APT, "This value should be one, but is actually {}!", value);
}
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error
rb.Push(apt->cpu_percent);
LOG_WARNING(Service_APT, "(STUBBED) called value=%u", value);
NGLOG_WARNING(Service_APT, "(STUBBED) called, value={}", value);
}
void Module::Interface::PrepareToStartLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x18, 1, 0); // 0x180040
AppletId applet_id = rp.PopEnum<AppletId>();
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
NGLOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(apt->applet_manager->PrepareToStartLibraryApplet(applet_id));
@ -505,14 +507,14 @@ void Module::Interface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContext&
rb.Push(ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
ErrorSummary::InvalidState, ErrorLevel::Status));
LOG_DEBUG(Service_APT, "called");
NGLOG_DEBUG(Service_APT, "called");
}
void Module::Interface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x16, 1, 0); // 0x160040
AppletId applet_id = rp.PopEnum<AppletId>();
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
NGLOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(apt->applet_manager->PreloadLibraryApplet(applet_id));
@ -525,7 +527,7 @@ void Module::Interface::FinishPreloadingLibraryApplet(Kernel::HLERequestContext&
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(apt->applet_manager->FinishPreloadingLibraryApplet(applet_id));
LOG_WARNING(Service_APT, "(STUBBED) called applet_id=%03X", static_cast<u32>(applet_id));
NGLOG_WARNING(Service_APT, "(STUBBED) called, applet_id={:#05X}", static_cast<u32>(applet_id));
}
void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
@ -536,7 +538,7 @@ void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
std::vector<u8> buffer = rp.PopStaticBuffer();
LOG_DEBUG(Service_APT, "called applet_id=%08X", static_cast<u32>(applet_id));
NGLOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer));
@ -549,7 +551,7 @@ void Module::Interface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push<u32>(1); // TODO: Find the return code meaning
LOG_WARNING(Service_APT, "(STUBBED) called exiting=%d", exiting);
NGLOG_WARNING(Service_APT, "(STUBBED) called exiting={}", exiting);
}
void Module::Interface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
@ -580,7 +582,7 @@ void Module::Interface::SetScreenCapPostPermission(Kernel::HLERequestContext& ct
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error
LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u",
NGLOG_WARNING(Service_APT, "(STUBBED) called, screen_capture_post_permission={}",
static_cast<u32>(apt->screen_capture_post_permission));
}
@ -590,7 +592,7 @@ void Module::Interface::GetScreenCapPostPermission(Kernel::HLERequestContext& ct
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); // No error
rb.Push(static_cast<u32>(apt->screen_capture_post_permission));
LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u",
NGLOG_WARNING(Service_APT, "(STUBBED) called, screen_capture_post_permission={}",
static_cast<u32>(apt->screen_capture_post_permission));
}
@ -598,7 +600,7 @@ void Module::Interface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x6, 1, 0); // 0x60040
auto app_id = rp.PopEnum<AppletId>();
LOG_DEBUG(Service_APT, "called appid=%u", static_cast<u32>(app_id));
NGLOG_DEBUG(Service_APT, "called, app_id={}", static_cast<u32>(app_id));
auto info = apt->applet_manager->GetAppletInfo(app_id);
if (info.Failed()) {
@ -621,16 +623,17 @@ void Module::Interface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
StartupArgumentType startup_argument_type = static_cast<StartupArgumentType>(rp.Pop<u8>());
if (parameter_size >= 0x300) {
LOG_ERROR(
NGLOG_ERROR(
Service_APT,
"Parameter size is outside the valid range (capped to 0x300): parameter_size=0x%08x",
"Parameter size is outside the valid range (capped to 0x300): parameter_size={:#010X}",
parameter_size);
return;
}
std::vector<u8> parameter(parameter_size, 0);
LOG_WARNING(Service_APT, "(stubbed) called startup_argument_type=%u , parameter_size=0x%08x",
NGLOG_WARNING(Service_APT,
"(STUBBED) called, startup_argument_type={}, parameter_size={:#010X}",
static_cast<u32>(startup_argument_type), parameter_size);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
@ -655,7 +658,8 @@ void Module::Interface::Wrap(Kernel::HLERequestContext& ctx) {
ASSERT_MSG(output_size == input_size + HW::AES::CCM_MAC_SIZE,
"input_size ({}) doesn't match to output_size ({})", input_size, output_size);
LOG_DEBUG(Service_APT, "called, output_size=%u, input_size=%u, nonce_offset=%u, nonce_size=%u",
NGLOG_DEBUG(Service_APT,
"called, output_size={}, input_size={}, nonce_offset={}, nonce_size={}",
output_size, input_size, nonce_offset, nonce_size);
// Note: This weird nonce size modification is verified against real 3DS
@ -700,7 +704,8 @@ void Module::Interface::Unwrap(Kernel::HLERequestContext& ctx) {
ASSERT_MSG(output_size == input_size - HW::AES::CCM_MAC_SIZE,
"input_size ({}) doesn't match to output_size ({})", input_size, output_size);
LOG_DEBUG(Service_APT, "called, output_size=%u, input_size=%u, nonce_offset=%u, nonce_size=%u",
NGLOG_DEBUG(Service_APT,
"called, output_size={}, input_size={}, nonce_offset={}, nonce_size={}",
output_size, input_size, nonce_offset, nonce_size);
// Note: This weird nonce size modification is verified against real 3DS
@ -725,7 +730,7 @@ void Module::Interface::Unwrap(Kernel::HLERequestContext& ctx) {
pdata.size() - nonce_offset);
rb.Push(RESULT_SUCCESS);
} else {
LOG_ERROR(Service_APT, "Failed to decrypt data");
NGLOG_ERROR(Service_APT, "Failed to decrypt data");
rb.Push(ResultCode(static_cast<ErrorDescription>(1), ErrorModule::PS,
ErrorSummary::WrongArgument, ErrorLevel::Status));
}
@ -746,7 +751,7 @@ void Module::Interface::CheckNew3DSApp(Kernel::HLERequestContext& ctx) {
PTM::CheckNew3DS(rb);
}
LOG_WARNING(Service_APT, "(STUBBED) called");
NGLOG_WARNING(Service_APT, "(STUBBED) called");
}
void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
@ -755,7 +760,7 @@ void Module::Interface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
PTM::CheckNew3DS(rb);
LOG_WARNING(Service_APT, "(STUBBED) called");
NGLOG_WARNING(Service_APT, "(STUBBED) called");
}
Module::Interface::Interface(std::shared_ptr<Module> apt, const char* name, u32 max_session)