summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2019-03-16 14:05:01 -0400
committerGravatar Lioncash2019-03-16 14:05:03 -0400
commit64444ff48178835b554c1b5d86b70ce2f7d82553 (patch)
tree37d5bc7dc9ab93cb4763bb6105a983b53f2fe2e1
parentMerge pull request #2241 from lioncash/compile-flags (diff)
downloadyuzu-64444ff48178835b554c1b5d86b70ce2f7d82553.tar.gz
yuzu-64444ff48178835b554c1b5d86b70ce2f7d82553.tar.xz
yuzu-64444ff48178835b554c1b5d86b70ce2f7d82553.zip
ipc_helpers: Allow pushing and popping floating-point values
Certain values that are passed through the IPC buffer are actually floating point values, not solely integral values.
Diffstat (limited to '')
-rw-r--r--src/core/hle/ipc_helpers.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index a1e4be070..68406eb63 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -275,6 +275,20 @@ inline void ResponseBuilder::Push(u64 value) {
275} 275}
276 276
277template <> 277template <>
278inline void ResponseBuilder::Push(float value) {
279 u32 integral;
280 std::memcpy(&integral, &value, sizeof(u32));
281 Push(integral);
282}
283
284template <>
285inline void ResponseBuilder::Push(double value) {
286 u64 integral;
287 std::memcpy(&integral, &value, sizeof(u64));
288 Push(integral);
289}
290
291template <>
278inline void ResponseBuilder::Push(bool value) { 292inline void ResponseBuilder::Push(bool value) {
279 Push(static_cast<u8>(value)); 293 Push(static_cast<u8>(value));
280} 294}
@@ -416,6 +430,22 @@ inline s64 RequestParser::Pop() {
416} 430}
417 431
418template <> 432template <>
433inline float RequestParser::Pop() {
434 const u32 value = Pop<u32>();
435 float real;
436 std::memcpy(&real, &value, sizeof(real));
437 return real;
438}
439
440template <>
441inline double RequestParser::Pop() {
442 const u64 value = Pop<u64>();
443 float real;
444 std::memcpy(&real, &value, sizeof(real));
445 return real;
446}
447
448template <>
419inline bool RequestParser::Pop() { 449inline bool RequestParser::Pop() {
420 return Pop<u8>() != 0; 450 return Pop<u8>() != 0;
421} 451}