summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-10-28 21:10:21 +0100
committerLioncash <mathew1800@gmail.com>2015-10-28 21:10:21 +0100
commita1bd90929437cefa86edb15398d4c8171ef16157 (patch)
treede3e08d2694faf9dda6542a2814a296e045ef275
parentMerge pull request #1165 from esoteric-programmer/master (diff)
downloadyuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar.gz
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar.bz2
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar.lz
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar.xz
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.tar.zst
yuzu-a1bd90929437cefa86edb15398d4c8171ef16157.zip
-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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <cstring>
#include "core/hle/hle.h"
#include "core/hle/kernel/mutex.h"
#include "core/hle/kernel/shared_memory.h"
@@ -52,19 +53,19 @@ void Initialize(Service::Interface* self) {
}
void ExecuteType0Commands(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
+ u32* const cmd_buff = Kernel::GetCommandBuffer();
+ u8* const ptr = shared_memory->GetPointer(cmd_buff[1]);
+
+ if (shared_memory != nullptr && ptr != nullptr) {
+ Type0Command command;
+ std::memcpy(&command, ptr, sizeof(Type0Command));
+
+ LOG_WARNING(Service, "(STUBBED) CSND_SND::ExecuteType0Commands");
+ command.finished |= 1;
+ cmd_buff[1] = 0;
- if (shared_memory != nullptr) {
- struct Type0Command* command = reinterpret_cast<struct Type0Command*>(
- shared_memory->GetPointer(cmd_buff[1]));
- if (command == nullptr) {
- cmd_buff[1] = 1;
- }else{
- LOG_WARNING(Service, "(STUBBED) CSND_SND::ExecuteType0Commands");
- command->finished |= 1;
- cmd_buff[1] = 0;
- }
- }else{
+ std::memcpy(ptr, &command, sizeof(Type0Command));
+ } else {
cmd_buff[1] = 1;
}
}