fix #2560 and other comments

This commit is contained in:
Lectem 2017-02-11 15:07:12 +01:00
parent fb70c9683c
commit 77f4fc473f
3 changed files with 22 additions and 22 deletions

View file

@ -119,7 +119,7 @@ inline void RequestBuilder::Push(u64 value) {
template <> template <>
inline void RequestBuilder::Push(bool value) { inline void RequestBuilder::Push(bool value) {
Push(u8(value)); Push(static_cast<u8>(value));
} }
template <> template <>
@ -277,7 +277,7 @@ inline u64 RequestParser::Pop() {
template <> template <>
inline bool RequestParser::Pop() { inline bool RequestParser::Pop() {
return Pop<u8>() != 0; // != 0 to remove warning C4800 return Pop<u8>() != 0;
} }
template <> template <>

View file

@ -72,7 +72,7 @@ void GetSharedFont(Service::Interface* self) {
if (!shared_font_mem) { if (!shared_font_mem) {
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");
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(u32(-1)); // Failure rb.Push<u32>(-1); // TODO: Find the right error code
return; return;
} }
@ -112,7 +112,7 @@ void GetLockHandle(Service::Interface* self) {
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
rb.Push(RESULT_SUCCESS); // No error rb.Push(RESULT_SUCCESS); // No error
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 handleCopy = Kernel::g_handle_table.Create(lock).MoveFrom(); Kernel::Handle handleCopy = Kernel::g_handle_table.Create(lock).MoveFrom();
rb.PushCopyHandles(handleCopy); rb.PushCopyHandles(handleCopy);
@ -134,8 +134,8 @@ void GetAppletManInfo(Service::Interface* self) {
u32 unk = rp.Pop<u32>(); u32 unk = 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
rb.Push(u32(0)); rb.Push<u32>(0);
rb.Push(u32(0)); rb.Push<u32>(0);
rb.Push(static_cast<u32>(AppletId::HomeMenu)); // Home menu AppID rb.Push(static_cast<u32>(AppletId::HomeMenu)); // Home menu AppID
rb.Push(static_cast<u32>(AppletId::Application)); // TODO(purpasmart96): Do this correctly rb.Push(static_cast<u32>(AppletId::Application)); // TODO(purpasmart96): Do this correctly
@ -150,12 +150,12 @@ void IsRegistered(Service::Interface* self) {
// TODO(Subv): An application is considered "registered" if it has already called APT::Enable // TODO(Subv): An application is considered "registered" if it has already called APT::Enable
// handle this properly once we implement multiprocess support. // handle this properly once we implement multiprocess support.
u32 isRegistered = 0; // Set to not registered by default bool isRegistered = false; // Set to not registered by default
if (app_id == static_cast<u32>(AppletId::AnyLibraryApplet)) { if (app_id == static_cast<u32>(AppletId::AnyLibraryApplet)) {
isRegistered = HLE::Applets::IsLibraryAppletRunning() ? 1 : 0; isRegistered = HLE::Applets::IsLibraryAppletRunning() ? true : false;
} else if (auto applet = HLE::Applets::Applet::Get(static_cast<AppletId>(app_id))) { } else if (auto applet = HLE::Applets::Applet::Get(static_cast<AppletId>(app_id))) {
isRegistered = 1; // Set to registered isRegistered = true; // Set to registered
} }
rb.Push(isRegistered); rb.Push(isRegistered);
@ -189,7 +189,7 @@ void SendParameter(Service::Interface* self) {
if (dest_applet == nullptr) { if (dest_applet == nullptr) {
LOG_ERROR(Service_APT, "Unknown applet id=0x%08X", dst_app_id); LOG_ERROR(Service_APT, "Unknown applet id=0x%08X", dst_app_id);
rb.Push(u32(-1)); // TODO(Subv): Find the right error code rb.Push<u32>(-1); // TODO(Subv): Find the right error code
return; return;
} }
@ -227,7 +227,7 @@ void ReceiveParameter(Service::Interface* self) {
rb.Push(next_parameter.sender_id); rb.Push(next_parameter.sender_id);
rb.Push(next_parameter.signal); // Signal type rb.Push(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(u32(next_parameter.buffer.size())); // Parameter buffer size rb.Push(static_cast<u32>(next_parameter.buffer.size())); // Parameter buffer size
rb.PushMoveHandles((next_parameter.object != nullptr) rb.PushMoveHandles((next_parameter.object != nullptr)
? Kernel::g_handle_table.Create(next_parameter.object).MoveFrom() ? Kernel::g_handle_table.Create(next_parameter.object).MoveFrom()
@ -256,7 +256,7 @@ void GlanceParameter(Service::Interface* self) {
rb.Push(next_parameter.sender_id); rb.Push(next_parameter.sender_id);
rb.Push(next_parameter.signal); // Signal type rb.Push(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(u32(next_parameter.buffer.size())); // Parameter buffer size rb.Push(static_cast<u32>(next_parameter.buffer.size())); // Parameter buffer size
rb.PushCopyHandles((next_parameter.object != nullptr) rb.PushCopyHandles((next_parameter.object != nullptr)
? Kernel::g_handle_table.Create(next_parameter.object).MoveFrom() ? Kernel::g_handle_table.Create(next_parameter.object).MoveFrom()
@ -277,7 +277,7 @@ void CancelParameter(Service::Interface* self) {
u32 receiver_appid = rp.Pop<u32>(); u32 receiver_appid = 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
rb.Push(u32(1)); // Set to Success rb.Push(true); // Set to Success
LOG_WARNING(Service_APT, "(STUBBED) called check_sender=0x%08X, sender_appid=0x%08X, " LOG_WARNING(Service_APT, "(STUBBED) called check_sender=0x%08X, sender_appid=0x%08X, "
"check_receiver=0x%08X, receiver_appid=0x%08X", "check_receiver=0x%08X, receiver_appid=0x%08X",
@ -414,7 +414,7 @@ void StartLibraryApplet(Service::Interface* self) {
if (applet == nullptr) { if (applet == nullptr) {
LOG_ERROR(Service_APT, "unknown applet id=%08X", applet_id); LOG_ERROR(Service_APT, "unknown applet id=%08X", applet_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0, false); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0, false);
rb.Push(u32(-1)); // TODO(Subv): Find the right error code rb.Push<u32>(-1); // TODO(Subv): Find the right error code
return; return;
} }
@ -433,10 +433,10 @@ void StartLibraryApplet(Service::Interface* self) {
void CancelLibraryApplet(Service::Interface* self) { void CancelLibraryApplet(Service::Interface* self) {
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x3B, 1, 0); // 0x003B0040 IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x3B, 1, 0); // 0x003B0040
u32 exiting = rp.Pop<u32>() & 0xFF; bool exiting = rp.Pop<bool>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(u32(1)); rb.Push<u32>(1);
LOG_WARNING(Service_APT, "(STUBBED) called exiting=%u", exiting); LOG_WARNING(Service_APT, "(STUBBED) called exiting=%u", exiting);
} }
@ -473,9 +473,9 @@ void GetAppletInfo(Service::Interface* self) {
u64 titileId = 0; u64 titileId = 0;
rb.Push(titileId); rb.Push(titileId);
rb.Push(static_cast<u32>(Service::FS::MediaType::NAND)); rb.Push(static_cast<u32>(Service::FS::MediaType::NAND));
rb.Push(u64(1)); // Registered rb.Push(true); // Registered
rb.Push(u64(1)); // Loaded rb.Push(true); // Loaded
rb.Push(u64(0)); // Applet Attributes rb.Push<u32>(0); // Applet Attributes
} else { } else {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound, rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
@ -514,7 +514,7 @@ void GetStartupArgument(Service::Interface* self) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(u32(0)); rb.Push<u32>(0);
} }
void Wrap(Service::Interface* self) { void Wrap(Service::Interface* self) {
@ -624,7 +624,7 @@ void CheckNew3DSApp(Service::Interface* self) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (unknown_ns_state_field) { if (unknown_ns_state_field) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(u32(0)); rb.Push<u32>(0);
} else { } else {
PTM::CheckNew3DS(rb); PTM::CheckNew3DS(rb);
} }

View file

@ -191,7 +191,7 @@ static void SetSpacialDithering(Interface* self) {
static void GetSpacialDithering(Interface* self) { static void GetSpacialDithering(Interface* self) {
IPC::RequestBuilder rb(Kernel::GetCommandBuffer(), 0xA, 2, 0); IPC::RequestBuilder rb(Kernel::GetCommandBuffer(), 0xA, 2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(bool(spacial_dithering_enabled)); rb.Push(spacial_dithering_enabled != 0);
LOG_WARNING(Service_Y2R, "(STUBBED) called"); LOG_WARNING(Service_Y2R, "(STUBBED) called");
} }