From 9e558dafeeb537748a01cc6c08baf4768b2e8bb5 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 7 May 2018 07:22:30 -0600 Subject: [PATCH] libstratosphere: Make boolean autoparsing match official semantics. --- .../libstratosphere/include/stratosphere/ipc_templating.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stratosphere/libstratosphere/include/stratosphere/ipc_templating.hpp b/stratosphere/libstratosphere/include/stratosphere/ipc_templating.hpp index 25d6f7b14..7fc259ecd 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ipc_templating.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/ipc_templating.hpp @@ -210,6 +210,10 @@ T GetValueFromIpcParsedCommand(IpcParsedCommand& r, IpcCommand& out_c, u8 *point } else if constexpr (std::is_same::value) { cur_rawdata_index += sizeof(u64) / sizeof(u32); return PidDescriptor(r.Pid); + } else if constexpr (std::is_same::value) { + /* Official bools accept non-zero values with low bit unset as false. */ + cur_rawdata_index += size_in_raw_data::value / sizeof(u32); + return ((*(((u32 *)r.Raw + old_rawdata_index))) & 1) == 1; } else { cur_rawdata_index += size_in_raw_data::value / sizeof(u32); return *((T *)((u32 *)r.Raw + old_rawdata_index));