mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 10:02:31 -06:00
Port yuzu-emu/yuzu#2249: "ipc_helpers: Allow pushing and popping floating-point values" (#4702)
Certain values that are passed through the IPC buffer are actually floating point values, not solely integral values.
This commit is contained in:
parent
75ebf1fdf6
commit
318095f9b9
2 changed files with 31 additions and 1 deletions
|
@ -141,6 +141,20 @@ inline void RequestBuilder::Push(u64 value) {
|
||||||
Push(static_cast<u32>(value >> 32));
|
Push(static_cast<u32>(value >> 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline void RequestBuilder::Push(f32 value) {
|
||||||
|
u32 integral;
|
||||||
|
std::memcpy(&integral, &value, sizeof(u32));
|
||||||
|
Push(integral);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline void RequestBuilder::Push(f64 value) {
|
||||||
|
u64 integral;
|
||||||
|
std::memcpy(&integral, &value, sizeof(u64));
|
||||||
|
Push(integral);
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void RequestBuilder::Push(bool value) {
|
inline void RequestBuilder::Push(bool value) {
|
||||||
Push(static_cast<u8>(value));
|
Push(static_cast<u8>(value));
|
||||||
|
@ -341,6 +355,22 @@ inline s32 RequestParser::Pop() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline f32 RequestParser::Pop() {
|
||||||
|
const u32 value = Pop<u32>();
|
||||||
|
float real;
|
||||||
|
std::memcpy(&real, &value, sizeof(real));
|
||||||
|
return real;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline f64 RequestParser::Pop() {
|
||||||
|
const u64 value = Pop<u64>();
|
||||||
|
f64 real;
|
||||||
|
std::memcpy(&real, &value, sizeof(real));
|
||||||
|
return real;
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline bool RequestParser::Pop() {
|
inline bool RequestParser::Pop() {
|
||||||
return Pop<u8>() != 0;
|
return Pop<u8>() != 0;
|
||||||
|
|
|
@ -331,7 +331,7 @@ void Module::Interface::GetGyroscopeLowRawToDpsCoefficient(Kernel::HLERequestCon
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushRaw<f32>(gyroscope_coef);
|
rb.Push(gyroscope_coef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetGyroscopeLowCalibrateParam(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetGyroscopeLowCalibrateParam(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
Loading…
Reference in a new issue