Created
May 12, 2015 23:00
-
-
Save Subv/7b9c4a015689890641a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp | |
| index 6a1d961..97c18be 100644 | |
| --- a/src/core/hle/service/csnd_snd.cpp | |
| +++ b/src/core/hle/service/csnd_snd.cpp | |
| @@ -3,6 +3,8 @@ | |
| // Refer to the license.txt file included. | |
| #include "core/hle/hle.h" | |
| +#include "core/hle/kernel/mutex.h" | |
| +#include "core/hle/kernel/shared_memory.h" | |
| #include "core/hle/service/csnd_snd.h" | |
| //////////////////////////////////////////////////////////////////////////////////////////////////// | |
| @@ -10,10 +12,35 @@ | |
| namespace CSND_SND { | |
| +static Kernel::SharedPtr<Kernel::Mutex> mutex; | |
| +static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem; | |
| + | |
| +u32 offset0 = 0; | |
| + | |
| +static void Initialize(Service::Interface* self) { | |
| + u32* cmd_buff = Kernel::GetCommandBuffer(); | |
| + | |
| + using Kernel::MemoryPermission; | |
| + shared_mem = Kernel::SharedMemory::Create(cmd_buff[1], MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, "csnd sharedmem"); | |
| + | |
| + offset0 = cmd_buff[2]; | |
| + | |
| + cmd_buff[1] = 0; | |
| + cmd_buff[3] = Kernel::g_handle_table.Create(mutex).MoveFrom(); | |
| + cmd_buff[4] = Kernel::g_handle_table.Create(shared_mem).MoveFrom(); | |
| +} | |
| + | |
| +static void ExecuteType0Commands(Service::Interface* self) { | |
| + u32* cmd_buff = Kernel::GetCommandBuffer(); | |
| + u32* flag = (u32*)shared_mem->GetPointer(offset0 + 4); | |
| + *flag = 1; | |
| + cmd_buff[1] = 0; | |
| +} | |
| + | |
| const Interface::FunctionInfo FunctionTable[] = { | |
| - {0x00010140, nullptr, "Initialize"}, | |
| + {0x00010140, Initialize, "Initialize"}, | |
| {0x00020000, nullptr, "Shutdown"}, | |
| - {0x00030040, nullptr, "ExecuteType0Commands"}, | |
| + {0x00030040, ExecuteType0Commands, "ExecuteType0Commands"}, | |
| {0x00040080, nullptr, "ExecuteType1Commands"}, | |
| {0x00050000, nullptr, "AcquireSoundChannels"}, | |
| {0x00060000, nullptr, "ReleaseSoundChannels"}, | |
| @@ -28,6 +55,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |
| // Interface class | |
| Interface::Interface() { | |
| + mutex = Kernel::Mutex::Create(false, "CSND mutex"); | |
| Register(FunctionTable); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment