diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/csnd_snd.cpp | 57 | ||||
| -rw-r--r-- | src/core/hle/service/csnd_snd.h | 13 |
2 files changed, 66 insertions, 4 deletions
diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp index 6a1d961ac..ce2877f57 100644 --- a/src/core/hle/service/csnd_snd.cpp +++ b/src/core/hle/service/csnd_snd.cpp | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/hle.h" | 5 | #include "core/hle/hle.h" |
| 6 | #include "core/hle/kernel/mutex.h" | ||
| 7 | #include "core/hle/kernel/shared_memory.h" | ||
| 6 | #include "core/hle/service/csnd_snd.h" | 8 | #include "core/hle/service/csnd_snd.h" |
| 7 | 9 | ||
| 8 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 10 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -11,11 +13,11 @@ | |||
| 11 | namespace CSND_SND { | 13 | namespace CSND_SND { |
| 12 | 14 | ||
| 13 | const Interface::FunctionInfo FunctionTable[] = { | 15 | const Interface::FunctionInfo FunctionTable[] = { |
| 14 | {0x00010140, nullptr, "Initialize"}, | 16 | {0x00010140, Initialize, "Initialize"}, |
| 15 | {0x00020000, nullptr, "Shutdown"}, | 17 | {0x00020000, Shutdown, "Shutdown"}, |
| 16 | {0x00030040, nullptr, "ExecuteType0Commands"}, | 18 | {0x00030040, ExecuteType0Commands, "ExecuteType0Commands"}, |
| 17 | {0x00040080, nullptr, "ExecuteType1Commands"}, | 19 | {0x00040080, nullptr, "ExecuteType1Commands"}, |
| 18 | {0x00050000, nullptr, "AcquireSoundChannels"}, | 20 | {0x00050000, AcquireSoundChannels, "AcquireSoundChannels"}, |
| 19 | {0x00060000, nullptr, "ReleaseSoundChannels"}, | 21 | {0x00060000, nullptr, "ReleaseSoundChannels"}, |
| 20 | {0x00070000, nullptr, "AcquireCaptureDevice"}, | 22 | {0x00070000, nullptr, "AcquireCaptureDevice"}, |
| 21 | {0x00080040, nullptr, "ReleaseCaptureDevice"}, | 23 | {0x00080040, nullptr, "ReleaseCaptureDevice"}, |
| @@ -31,4 +33,51 @@ Interface::Interface() { | |||
| 31 | Register(FunctionTable); | 33 | Register(FunctionTable); |
| 32 | } | 34 | } |
| 33 | 35 | ||
| 36 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr; | ||
| 37 | static Kernel::SharedPtr<Kernel::Mutex> mutex = nullptr; | ||
| 38 | |||
| 39 | void Initialize(Service::Interface* self) { | ||
| 40 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 41 | |||
| 42 | shared_memory = Kernel::SharedMemory::Create(cmd_buff[1], | ||
| 43 | Kernel::MemoryPermission::ReadWrite, | ||
| 44 | Kernel::MemoryPermission::ReadWrite, "CSNDSharedMem"); | ||
| 45 | |||
| 46 | mutex = Kernel::Mutex::Create(false); | ||
| 47 | |||
| 48 | cmd_buff[1] = 0; | ||
| 49 | cmd_buff[2] = 0x4000000; | ||
| 50 | cmd_buff[3] = Kernel::g_handle_table.Create(mutex).MoveFrom(); | ||
| 51 | cmd_buff[4] = Kernel::g_handle_table.Create(shared_memory).MoveFrom(); | ||
| 52 | } | ||
| 53 | |||
| 54 | void ExecuteType0Commands(Service::Interface* self) { | ||
| 55 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 56 | |||
| 57 | if (shared_memory != nullptr) { | ||
| 58 | struct Type0Command* command = reinterpret_cast<struct Type0Command*>( | ||
| 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 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | void AcquireSoundChannels(Service::Interface* self) { | ||
| 73 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 74 | cmd_buff[1] = 0; | ||
| 75 | cmd_buff[2] = 0xFFFFFF00; | ||
| 76 | } | ||
| 77 | |||
| 78 | void Shutdown(Service::Interface* self) { | ||
| 79 | shared_memory = nullptr; | ||
| 80 | mutex = nullptr; | ||
| 81 | } | ||
| 82 | |||
| 34 | } // namespace | 83 | } // namespace |
diff --git a/src/core/hle/service/csnd_snd.h b/src/core/hle/service/csnd_snd.h index a84752473..e861f3327 100644 --- a/src/core/hle/service/csnd_snd.h +++ b/src/core/hle/service/csnd_snd.h | |||
| @@ -20,4 +20,17 @@ public: | |||
| 20 | } | 20 | } |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | struct Type0Command { | ||
| 24 | // command id and next command offset | ||
| 25 | u32 command_id; | ||
| 26 | u32 finished; | ||
| 27 | u32 flags; | ||
| 28 | u8 parameters[20]; | ||
| 29 | }; | ||
| 30 | |||
| 31 | void Initialize(Service::Interface* self); | ||
| 32 | void ExecuteType0Commands(Service::Interface* self); | ||
| 33 | void AcquireSoundChannels(Service::Interface* self); | ||
| 34 | void Shutdown(Service::Interface* self); | ||
| 35 | |||
| 23 | } // namespace | 36 | } // namespace |