summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2015-10-28 16:10:21 -0400
committerGravatar Lioncash2015-10-28 16:10:21 -0400
commita1bd90929437cefa86edb15398d4c8171ef16157 (patch)
treede3e08d2694faf9dda6542a2814a296e045ef275 /src
parentMerge pull request #1165 from esoteric-programmer/master (diff)
downloadyuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar.gz
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar.xz
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.zip
csnd_snd: Get rid of type punning
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/csnd_snd.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp
index ce2877f57..669659510 100644
--- a/src/core/hle/service/csnd_snd.cpp
+++ b/src/core/hle/service/csnd_snd.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
5#include "core/hle/hle.h" 6#include "core/hle/hle.h"
6#include "core/hle/kernel/mutex.h" 7#include "core/hle/kernel/mutex.h"
7#include "core/hle/kernel/shared_memory.h" 8#include "core/hle/kernel/shared_memory.h"
@@ -52,19 +53,19 @@ void Initialize(Service::Interface* self) {
52} 53}
53 54
54void ExecuteType0Commands(Service::Interface* self) { 55void ExecuteType0Commands(Service::Interface* self) {
55 u32* cmd_buff = Kernel::GetCommandBuffer(); 56 u32* const cmd_buff = Kernel::GetCommandBuffer();
57 u8* const ptr = shared_memory->GetPointer(cmd_buff[1]);
58
59 if (shared_memory != nullptr && ptr != nullptr) {
60 Type0Command command;
61 std::memcpy(&command, ptr, sizeof(Type0Command));
62
63 LOG_WARNING(Service, "(STUBBED) CSND_SND::ExecuteType0Commands");
64 command.finished |= 1;
65 cmd_buff[1] = 0;
56 66
57 if (shared_memory != nullptr) { 67 std::memcpy(ptr, &command, sizeof(Type0Command));
58 struct Type0Command* command = reinterpret_cast<struct Type0Command*>( 68 } else {
59 shared_memory->GetPointer(cmd_buff[1]));
60 if (command == nullptr) {
61 cmd_buff[1] = 1;
62 }else{
63 LOG_WARNING(Service, "(STUBBED) CSND_SND::ExecuteType0Commands");
64 command->finished |= 1;
65 cmd_buff[1] = 0;
66 }
67 }else{
68 cmd_buff[1] = 1; 69 cmd_buff[1] = 1;
69 } 70 }
70} 71}