diff options
| author | 2019-03-16 22:22:03 -0400 | |
|---|---|---|
| committer | 2019-03-16 22:22:03 -0400 | |
| commit | 9ad3b01d306c04bc5800d6daf7bd7481336c82a3 (patch) | |
| tree | da853e4a1eb93bc567807d2af79bd9fee32439c3 | |
| parent | Merge pull request #2246 from lioncash/opus-fork (diff) | |
| parent | ipc_helpers: Allow pushing and popping floating-point values (diff) | |
| download | yuzu-9ad3b01d306c04bc5800d6daf7bd7481336c82a3.tar.gz yuzu-9ad3b01d306c04bc5800d6daf7bd7481336c82a3.tar.xz yuzu-9ad3b01d306c04bc5800d6daf7bd7481336c82a3.zip | |
Merge pull request #2249 from lioncash/ipc
ipc_helpers: Allow pushing and popping floating-point values
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/ipc_helpers.h | 30 |
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 | ||
| 277 | template <> | 277 | template <> |
| 278 | inline void ResponseBuilder::Push(float value) { | ||
| 279 | u32 integral; | ||
| 280 | std::memcpy(&integral, &value, sizeof(u32)); | ||
| 281 | Push(integral); | ||
| 282 | } | ||
| 283 | |||
| 284 | template <> | ||
| 285 | inline void ResponseBuilder::Push(double value) { | ||
| 286 | u64 integral; | ||
| 287 | std::memcpy(&integral, &value, sizeof(u64)); | ||
| 288 | Push(integral); | ||
| 289 | } | ||
| 290 | |||
| 291 | template <> | ||
| 278 | inline void ResponseBuilder::Push(bool value) { | 292 | inline 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 | ||
| 418 | template <> | 432 | template <> |
| 433 | inline float RequestParser::Pop() { | ||
| 434 | const u32 value = Pop<u32>(); | ||
| 435 | float real; | ||
| 436 | std::memcpy(&real, &value, sizeof(real)); | ||
| 437 | return real; | ||
| 438 | } | ||
| 439 | |||
| 440 | template <> | ||
| 441 | inline double RequestParser::Pop() { | ||
| 442 | const u64 value = Pop<u64>(); | ||
| 443 | float real; | ||
| 444 | std::memcpy(&real, &value, sizeof(real)); | ||
| 445 | return real; | ||
| 446 | } | ||
| 447 | |||
| 448 | template <> | ||
| 419 | inline bool RequestParser::Pop() { | 449 | inline bool RequestParser::Pop() { |
| 420 | return Pop<u8>() != 0; | 450 | return Pop<u8>() != 0; |
| 421 | } | 451 | } |