From acefa81ae3750d8bbf3bd239f77779279d8da4fe Mon Sep 17 00:00:00 2001
From: NarcolepticK <NarcolepticKrias@gmail.com>
Date: Mon, 2 Jul 2018 22:09:10 -0400
Subject: [PATCH] service/csnd: Addressed comments and removed outdated
 information

---
 src/core/hle/service/csnd_snd.cpp | 20 +++++++++-----------
 src/core/hle/service/csnd_snd.h   |  1 -
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp
index 25a6d0141..19a795213 100644
--- a/src/core/hle/service/csnd_snd.cpp
+++ b/src/core/hle/service/csnd_snd.cpp
@@ -21,10 +21,10 @@ static_assert(sizeof(Type0Command) == 0x20, "Type0Command structure size is wron
 void CSND_SND::Initialize(Kernel::HLERequestContext& ctx) {
     IPC::RequestParser rp(ctx, 0x01, 5, 0);
     u32 size = Common::AlignUp(rp.Pop<u32>(), Memory::PAGE_SIZE);
-    VAddr offset0 = rp.Pop<u32>();
-    VAddr offset1 = rp.Pop<u32>();
-    VAddr offset2 = rp.Pop<u32>();
-    VAddr offset3 = rp.Pop<u32>();
+    u32 offset0 = rp.Pop<u32>();
+    u32 offset1 = rp.Pop<u32>();
+    u32 offset2 = rp.Pop<u32>();
+    u32 offset3 = rp.Pop<u32>();
 
     using Kernel::MemoryPermission;
     mutex = Kernel::Mutex::Create(false, "CSND:mutex");
@@ -58,12 +58,11 @@ void CSND_SND::Shutdown(Kernel::HLERequestContext& ctx) {
 
 void CSND_SND::ExecuteCommands(Kernel::HLERequestContext& ctx) {
     IPC::RequestParser rp(ctx, 0x03, 1, 0);
-    VAddr addr = rp.Pop<u32>();
+    u32 addr = rp.Pop<u32>();
 
-    IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
+    IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
     if (!shared_memory) {
         rb.Push<u32>(1);
-        rb.Skip(1, false);
         LOG_ERROR(Service_CSND, "called, shared memory not allocated");
     } else {
         u8* ptr = shared_memory->GetPointer(addr);
@@ -74,7 +73,6 @@ void CSND_SND::ExecuteCommands(Kernel::HLERequestContext& ctx) {
         std::memcpy(ptr, &command, sizeof(Type0Command));
 
         rb.Push(RESULT_SUCCESS);
-        rb.Push<u32>(0xFFFFFF00);
     }
 
     LOG_WARNING(Service_CSND, "(STUBBED) called, addr=0x{:08X}", addr);
@@ -101,7 +99,7 @@ void CSND_SND::ReleaseSoundChannels(Kernel::HLERequestContext& ctx) {
 
 void CSND_SND::FlushDataCache(Kernel::HLERequestContext& ctx) {
     IPC::RequestParser rp(ctx, 0x9, 2, 2);
-    u32 address = rp.Pop<u32>();
+    VAddr address = rp.Pop<u32>();
     u32 size = rp.Pop<u32>();
     auto process = rp.PopObject<Kernel::Process>();
 
@@ -114,7 +112,7 @@ void CSND_SND::FlushDataCache(Kernel::HLERequestContext& ctx) {
 
 void CSND_SND::StoreDataCache(Kernel::HLERequestContext& ctx) {
     IPC::RequestParser rp(ctx, 0xA, 2, 2);
-    u32 address = rp.Pop<u32>();
+    VAddr address = rp.Pop<u32>();
     u32 size = rp.Pop<u32>();
     auto process = rp.PopObject<Kernel::Process>();
 
@@ -127,7 +125,7 @@ void CSND_SND::StoreDataCache(Kernel::HLERequestContext& ctx) {
 
 void CSND_SND::InvalidateDataCache(Kernel::HLERequestContext& ctx) {
     IPC::RequestParser rp(ctx, 0xB, 2, 2);
-    u32 address = rp.Pop<u32>();
+    VAddr address = rp.Pop<u32>();
     u32 size = rp.Pop<u32>();
     auto process = rp.PopObject<Kernel::Process>();
 
diff --git a/src/core/hle/service/csnd_snd.h b/src/core/hle/service/csnd_snd.h
index 3f1d2a55e..34722874d 100644
--- a/src/core/hle/service/csnd_snd.h
+++ b/src/core/hle/service/csnd_snd.h
@@ -50,7 +50,6 @@ private:
      *      1 : Command offset in shared memory.
      *  Outputs:
      *      1 : Result of function, 0 on success, otherwise error code
-     *      2 : Available channel bit mask
      */
     void ExecuteCommands(Kernel::HLERequestContext& ctx);