diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/mic_u.cpp | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp index 1f851d328..4f1dd2fce 100644 --- a/src/core/hle/service/mic_u.cpp +++ b/src/core/hle/service/mic_u.cpp @@ -4,13 +4,12 @@ #include "common/logging/log.h" #include "core/hle/kernel/event.h" +#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/service/mic_u.h" -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace MIC_U - -namespace MIC_U { +namespace Service { +namespace MIC { enum class Encoding : u8 { PCM8 = 0, @@ -49,10 +48,10 @@ static bool audio_buffer_loop; * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void MapSharedMem(Service::Interface* self) { +static void MapSharedMem(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 size = cmd_buff[1]; - Handle mem_handle = cmd_buff[3]; + Kernel::Handle mem_handle = cmd_buff[3]; shared_memory = Kernel::g_handle_table.Get<Kernel::SharedMemory>(mem_handle); if (shared_memory) { shared_memory->name = "MIC_U:shared_memory"; @@ -68,7 +67,7 @@ static void MapSharedMem(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void UnmapSharedMem(Service::Interface* self) { +static void UnmapSharedMem(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error @@ -87,7 +86,7 @@ static void UnmapSharedMem(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void StartSampling(Service::Interface* self) { +static void StartSampling(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); encoding = static_cast<Encoding>(cmd_buff[1] & 0xFF); @@ -111,7 +110,7 @@ static void StartSampling(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void AdjustSampling(Service::Interface* self) { +static void AdjustSampling(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); sample_rate = static_cast<SampleRate>(cmd_buff[1] & 0xFF); cmd_buff[1] = RESULT_SUCCESS.raw; // No error @@ -125,7 +124,7 @@ static void AdjustSampling(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void StopSampling(Service::Interface* self) { +static void StopSampling(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error is_sampling = false; @@ -140,7 +139,7 @@ static void StopSampling(Service::Interface* self) { * 1 : Result of function, 0 on success, otherwise error code * 2 : 0 = sampling, non-zero = sampling */ -static void IsSampling(Service::Interface* self) { +static void IsSampling(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error cmd_buff[2] = is_sampling; @@ -155,7 +154,7 @@ static void IsSampling(Service::Interface* self) { * 1 : Result of function, 0 on success, otherwise error code * 3 : Event handle */ -static void GetBufferFullEvent(Service::Interface* self) { +static void GetBufferFullEvent(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error cmd_buff[3] = Kernel::g_handle_table.Create(buffer_full_event).MoveFrom(); @@ -170,7 +169,7 @@ static void GetBufferFullEvent(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void SetGain(Service::Interface* self) { +static void SetGain(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); mic_gain = cmd_buff[1] & 0xFF; cmd_buff[1] = RESULT_SUCCESS.raw; // No error @@ -185,7 +184,7 @@ static void SetGain(Service::Interface* self) { * 1 : Result of function, 0 on success, otherwise error code * 2 : Gain */ -static void GetGain(Service::Interface* self) { +static void GetGain(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error cmd_buff[2] = mic_gain; @@ -200,7 +199,7 @@ static void GetGain(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void SetPower(Service::Interface* self) { +static void SetPower(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); mic_power = static_cast<bool>(cmd_buff[1] & 0xFF); cmd_buff[1] = RESULT_SUCCESS.raw; // No error @@ -215,7 +214,7 @@ static void SetPower(Service::Interface* self) { * 1 : Result of function, 0 on success, otherwise error code * 2 : Power */ -static void GetPower(Service::Interface* self) { +static void GetPower(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error cmd_buff[2] = mic_power; @@ -232,7 +231,7 @@ static void GetPower(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void SetIirFilterMic(Service::Interface* self) { +static void SetIirFilterMic(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 size = cmd_buff[1]; @@ -250,7 +249,7 @@ static void SetIirFilterMic(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void SetClamp(Service::Interface* self) { +static void SetClamp(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); clamp = static_cast<bool>(cmd_buff[1] & 0xFF); cmd_buff[1] = RESULT_SUCCESS.raw; // No error @@ -265,7 +264,7 @@ static void SetClamp(Service::Interface* self) { * 1 : Result of function, 0 on success, otherwise error code * 2 : Clamp (0 = don't clamp, non-zero = clamp) */ -static void GetClamp(Service::Interface* self) { +static void GetClamp(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = RESULT_SUCCESS.raw; // No error cmd_buff[2] = clamp; @@ -280,7 +279,7 @@ static void GetClamp(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void SetAllowShellClosed(Service::Interface* self) { +static void SetAllowShellClosed(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); allow_shell_closed = static_cast<bool>(cmd_buff[1] & 0xFF); cmd_buff[1] = RESULT_SUCCESS.raw; // No error @@ -294,7 +293,7 @@ static void SetAllowShellClosed(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void SetClientVersion(Service::Interface* self) { +static void SetClientVersion(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); const u32 version = cmd_buff[1]; @@ -324,10 +323,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00100040, SetClientVersion, "SetClientVersion"}, }; -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface class - -Interface::Interface() { +MIC_U::MIC_U() { Register(FunctionTable); shared_memory = nullptr; buffer_full_event = @@ -338,9 +334,10 @@ Interface::Interface() { clamp = false; } -Interface::~Interface() { +MIC_U::~MIC_U() { shared_memory = nullptr; buffer_full_event = nullptr; } -} // namespace +} // namespace MIC +} // namespace Service |