mirror of
https://github.com/yuzu-emu/yuzu-mainline
synced 2024-11-24 06:38:22 +00:00
Merge pull request #1225 from lioncash/clean
csnd_snd: Get rid of type punning
This commit is contained in:
commit
e906165229
1 changed files with 13 additions and 12 deletions
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include "core/hle/hle.h"
|
#include "core/hle/hle.h"
|
||||||
#include "core/hle/kernel/mutex.h"
|
#include "core/hle/kernel/mutex.h"
|
||||||
#include "core/hle/kernel/shared_memory.h"
|
#include "core/hle/kernel/shared_memory.h"
|
||||||
|
@ -52,19 +53,19 @@ void Initialize(Service::Interface* self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecuteType0Commands(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) {
|
if (shared_memory != nullptr && ptr != nullptr) {
|
||||||
struct Type0Command* command = reinterpret_cast<struct Type0Command*>(
|
Type0Command command;
|
||||||
shared_memory->GetPointer(cmd_buff[1]));
|
std::memcpy(&command, ptr, sizeof(Type0Command));
|
||||||
if (command == nullptr) {
|
|
||||||
cmd_buff[1] = 1;
|
LOG_WARNING(Service, "(STUBBED) CSND_SND::ExecuteType0Commands");
|
||||||
}else{
|
command.finished |= 1;
|
||||||
LOG_WARNING(Service, "(STUBBED) CSND_SND::ExecuteType0Commands");
|
cmd_buff[1] = 0;
|
||||||
command->finished |= 1;
|
|
||||||
cmd_buff[1] = 0;
|
std::memcpy(ptr, &command, sizeof(Type0Command));
|
||||||
}
|
} else {
|
||||||
}else{
|
|
||||||
cmd_buff[1] = 1;
|
cmd_buff[1] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue