summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-11-29 05:32:05 +0100
committerbunnei <bunneidev@gmail.com>2015-11-29 05:32:05 +0100
commite906165229346c22034195efba083152c45c4dd5 (patch)
treeb2c7da9e4a8fec256e413b05d41a04b8e5ed9bbd /src/core/hle/service
parentMerge pull request #1256 from archshift/refactor-scandir (diff)
parentcsnd_snd: Get rid of type punning (diff)
downloadyuzu-e906165229346c22034195efba083152c45c4dd5.tar
yuzu-e906165229346c22034195efba083152c45c4dd5.tar.gz
yuzu-e906165229346c22034195efba083152c45c4dd5.tar.bz2
yuzu-e906165229346c22034195efba083152c45c4dd5.tar.lz
yuzu-e906165229346c22034195efba083152c45c4dd5.tar.xz
yuzu-e906165229346c22034195efba083152c45c4dd5.tar.zst
yuzu-e906165229346c22034195efba083152c45c4dd5.zip
Diffstat (limited to 'src/core/hle/service')
-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;
}
}