1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-25 03:36:02 +00:00

libstratosphere: Make boolean autoparsing match official semantics.

This commit is contained in:
Michael Scire 2018-05-07 07:22:30 -06:00
parent 25db9fcc4a
commit 9e558dafee

View file

@ -210,6 +210,10 @@ T GetValueFromIpcParsedCommand(IpcParsedCommand& r, IpcCommand& out_c, u8 *point
} else if constexpr (std::is_same<T, PidDescriptor>::value) { } else if constexpr (std::is_same<T, PidDescriptor>::value) {
cur_rawdata_index += sizeof(u64) / sizeof(u32); cur_rawdata_index += sizeof(u64) / sizeof(u32);
return PidDescriptor(r.Pid); return PidDescriptor(r.Pid);
} else if constexpr (std::is_same<T, bool>::value) {
/* Official bools accept non-zero values with low bit unset as false. */
cur_rawdata_index += size_in_raw_data<T>::value / sizeof(u32);
return ((*(((u32 *)r.Raw + old_rawdata_index))) & 1) == 1;
} else { } else {
cur_rawdata_index += size_in_raw_data<T>::value / sizeof(u32); cur_rawdata_index += size_in_raw_data<T>::value / sizeof(u32);
return *((T *)((u32 *)r.Raw + old_rawdata_index)); return *((T *)((u32 *)r.Raw + old_rawdata_index));