From 02c17a47cba9dd1045017b343416872359d94dea 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. --- include/stratosphere/ipc_templating.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/stratosphere/ipc_templating.hpp b/include/stratosphere/ipc_templating.hpp index 25d6f7b1..7fc259ec 100644 --- a/include/stratosphere/ipc_templating.hpp +++ b/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));