diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 38fef5525..bef0d7a1e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -95,8 +95,18 @@ add_library(core STATIC hle/service/apm/apm.h hle/service/audio/audio.cpp hle/service/audio/audio.h + hle/service/audio/audin_u.cpp + hle/service/audio/audin_u.h hle/service/audio/audout_u.cpp hle/service/audio/audout_u.h + hle/service/audio/audrec_u.cpp + hle/service/audio/audrec_u.h + hle/service/audio/audren_u.cpp + hle/service/audio/audren_u.h + hle/service/audio/audren_u.cpp + hle/service/audio/audren_u.h + hle/service/audio/codecctl.cpp + hle/service/audio/codecctl.h hle/service/filesystem/filesystem.cpp hle/service/filesystem/filesystem.h hle/service/filesystem/fsp_srv.cpp diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp new file mode 100644 index 000000000..ee749fddd --- /dev/null +++ b/src/core/hle/service/audio/audin_u.cpp @@ -0,0 +1,41 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/audio/audin_u.h" + +namespace Service { +namespace Audio { + +class IAudioIn final : public ServiceFramework { +public: + IAudioIn() : ServiceFramework("IAudioIn") { + static const FunctionInfo functions[] = { + {0x0, nullptr, "GetAudioInState"}, + {0x1, nullptr, "StartAudioIn"}, + {0x2, nullptr, "StopAudioIn"}, + {0x3, nullptr, "AppendAudioInBuffer_1"}, + {0x4, nullptr, "RegisterBufferEvent"}, + {0x5, nullptr, "GetReleasedAudioInBuffer_1"}, + {0x6, nullptr, "ContainsAudioInBuffer"}, + {0x7, nullptr, "AppendAudioInBuffer_2"}, + {0x8, nullptr, "GetReleasedAudioInBuffer_2"}, + }; + RegisterHandlers(functions); + } + ~IAudioIn() = default; +}; + +AudInU::AudInU() : ServiceFramework("audin:u") { + static const FunctionInfo functions[] = { + {0x00000000, nullptr, "ListAudioIns"}, + {0x00000001, nullptr, "OpenAudioIn"}, + }; + RegisterHandlers(functions); +} + +} // namespace Audio +} // namespace Service diff --git a/src/core/hle/service/audio/audin_u.h b/src/core/hle/service/audio/audin_u.h new file mode 100644 index 000000000..2b8576756 --- /dev/null +++ b/src/core/hle/service/audio/audin_u.h @@ -0,0 +1,23 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service { +namespace Audio { + +class AudInU final : public ServiceFramework { +public: + explicit AudInU(); + ~AudInU() = default; +}; + +} // namespace Audio +} // namespace Service diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp index 2b4c6c5d0..3f7fb44eb 100644 --- a/src/core/hle/service/audio/audio.cpp +++ b/src/core/hle/service/audio/audio.cpp @@ -2,14 +2,22 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/audio/audin_u.h" #include "core/hle/service/audio/audio.h" #include "core/hle/service/audio/audout_u.h" +#include "core/hle/service/audio/audrec_u.h" +#include "core/hle/service/audio/audren_u.h" +#include "core/hle/service/audio/codecctl.h" namespace Service { namespace Audio { void InstallInterfaces(SM::ServiceManager& service_manager) { std::make_shared()->InstallAsService(service_manager); + std::make_shared()->InstallAsService(service_manager); + std::make_shared()->InstallAsService(service_manager); + std::make_shared()->InstallAsService(service_manager); + std::make_shared()->InstallAsService(service_manager); } } // namespace Audio diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index c028262c6..8ecfef413 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -4,21 +4,56 @@ #include "common/logging/log.h" #include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/hle_ipc.h" #include "core/hle/service/audio/audout_u.h" namespace Service { namespace Audio { +class IAudioOut final : public ServiceFramework { +public: + IAudioOut() : ServiceFramework("IAudioOut") { + static const FunctionInfo functions[] = { + {0x0, nullptr, "GetAudioOutState"}, + {0x1, nullptr, "StartAudioOut"}, + {0x2, nullptr, "StopAudioOut"}, + {0x3, nullptr, "AppendAudioOutBuffer_1"}, + {0x4, nullptr, "RegisterBufferEvent"}, + {0x5, nullptr, "GetReleasedAudioOutBuffer_1"}, + {0x6, nullptr, "ContainsAudioOutBuffer"}, + {0x7, nullptr, "AppendAudioOutBuffer_2"}, + {0x8, nullptr, "GetReleasedAudioOutBuffer_2"}, + }; + RegisterHandlers(functions); + } + ~IAudioOut() = default; +}; + void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) called"); - IPC::RequestBuilder rb{ctx, 2}; + IPC::RequestParser rp{ctx}; + + auto& buffer = ctx.BufferDescriptorB()[0]; + const std::string audio_interface = "AudioInterface"; + + Memory::WriteBlock(buffer.Address(), &audio_interface[0], audio_interface.size()); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 0, 0, 0); + rb.Push(RESULT_SUCCESS); + // TODO(st4rk): we're currently returning only one audio interface + // (stringlist size) + // however, it's highly possible to have more than one interface (despite that + // libtransistor + // requires only one). + rb.Push(1); } AudOutU::AudOutU() : ServiceFramework("audout:u") { - static const FunctionInfo functions[] = { - {0x00000000, &AudOutU::ListAudioOuts, "ListAudioOuts"}, - }; + static const FunctionInfo functions[] = {{0x00000000, &AudOutU::ListAudioOuts, "ListAudioOuts"}, + {0x00000001, nullptr, "OpenAudioOut"}, + {0x00000002, nullptr, "Unknown2"}, + {0x00000003, nullptr, "Unknown3"}}; RegisterHandlers(functions); } diff --git a/src/core/hle/service/audio/audout_u.h b/src/core/hle/service/audio/audout_u.h index 42680af94..17529245b 100644 --- a/src/core/hle/service/audio/audout_u.h +++ b/src/core/hle/service/audio/audout_u.h @@ -4,9 +4,12 @@ #pragma once -#include "core/hle/kernel/hle_ipc.h" #include "core/hle/service/service.h" +namespace Kernel { +class HLERequestContext; +} + namespace Service { namespace Audio { diff --git a/src/core/hle/service/audio/audrec_u.cpp b/src/core/hle/service/audio/audrec_u.cpp new file mode 100644 index 000000000..f2626ec70 --- /dev/null +++ b/src/core/hle/service/audio/audrec_u.cpp @@ -0,0 +1,38 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/audio/audrec_u.h" + +namespace Service { +namespace Audio { + +class IFinalOutputRecorder final : public ServiceFramework { +public: + IFinalOutputRecorder() : ServiceFramework("IFinalOutputRecorder") { + static const FunctionInfo functions[] = { + {0x0, nullptr, "GetFinalOutputRecorderState"}, + {0x1, nullptr, "StartFinalOutputRecorder"}, + {0x2, nullptr, "StopFinalOutputRecorder"}, + {0x3, nullptr, "AppendFinalOutputRecorderBuffer"}, + {0x4, nullptr, "RegisterBufferEvent"}, + {0x5, nullptr, "GetReleasedFinalOutputRecorderBuffer"}, + {0x6, nullptr, "ContainsFinalOutputRecorderBuffer"}, + }; + RegisterHandlers(functions); + } + ~IFinalOutputRecorder() = default; +}; + +AudRecU::AudRecU() : ServiceFramework("audrec:u") { + static const FunctionInfo functions[] = { + {0x00000000, nullptr, "OpenFinalOutputRecorder"}, + }; + RegisterHandlers(functions); +} + +} // namespace Audio +} // namespace Service diff --git a/src/core/hle/service/audio/audrec_u.h b/src/core/hle/service/audio/audrec_u.h new file mode 100644 index 000000000..c31e412c1 --- /dev/null +++ b/src/core/hle/service/audio/audrec_u.h @@ -0,0 +1,23 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service { +namespace Audio { + +class AudRecU final : public ServiceFramework { +public: + explicit AudRecU(); + ~AudRecU() = default; +}; + +} // namespace Audio +} // namespace Service diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp new file mode 100644 index 000000000..4bafdfac3 --- /dev/null +++ b/src/core/hle/service/audio/audren_u.cpp @@ -0,0 +1,44 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/audio/audren_u.h" + +namespace Service { +namespace Audio { + +class IAudioRenderer final : public ServiceFramework { +public: + IAudioRenderer() : ServiceFramework("IAudioRenderer") { + static const FunctionInfo functions[] = { + {0x0, nullptr, "GetAudioRendererSampleRate"}, + {0x1, nullptr, "GetAudioRendererSampleCount"}, + {0x2, nullptr, "GetAudioRendererMixBufferCount"}, + {0x3, nullptr, "GetAudioRendererState"}, + {0x4, nullptr, "RequestUpdateAudioRenderer"}, + {0x5, nullptr, "StartAudioRenderer"}, + {0x6, nullptr, "StopAudioRenderer"}, + {0x7, nullptr, "QuerySystemEvent"}, + {0x8, nullptr, "SetAudioRendererRenderingTimeLimit"}, + {0x9, nullptr, "GetAudioRendererRenderingTimeLimit"}, + }; + RegisterHandlers(functions); + } + ~IAudioRenderer() = default; +}; + +AudRenU::AudRenU() : ServiceFramework("audren:u") { + static const FunctionInfo functions[] = { + {0x00000000, nullptr, "OpenAudioRenderer"}, + {0x00000001, nullptr, "GetAudioRendererWorkBufferSize"}, + {0x00000002, nullptr, "GetAudioRenderersProcessMasterVolume"}, + {0x00000003, nullptr, "SetAudioRenderersProcessMasterVolume"}, + }; + RegisterHandlers(functions); +} + +} // namespace Audio +} // namespace Service diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h new file mode 100644 index 000000000..1d9264c72 --- /dev/null +++ b/src/core/hle/service/audio/audren_u.h @@ -0,0 +1,23 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service { +namespace Audio { + +class AudRenU final : public ServiceFramework { +public: + explicit AudRenU(); + ~AudRenU() = default; +}; + +} // namespace Audio +} // namespace Service diff --git a/src/core/hle/service/audio/codecctl.cpp b/src/core/hle/service/audio/codecctl.cpp new file mode 100644 index 000000000..d2a7f4cd0 --- /dev/null +++ b/src/core/hle/service/audio/codecctl.cpp @@ -0,0 +1,33 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/audio/codecctl.h" + +namespace Service { +namespace Audio { + +CodecCtl::CodecCtl() : ServiceFramework("codecctl") { + static const FunctionInfo functions[] = { + {0x00000000, nullptr, "InitializeCodecController"}, + {0x00000001, nullptr, "FinalizeCodecController"}, + {0x00000002, nullptr, "SleepCodecController"}, + {0x00000003, nullptr, "WakeCodecController"}, + {0x00000004, nullptr, "SetCodecVolume"}, + {0x00000005, nullptr, "GetCodecVolumeMax"}, + {0x00000006, nullptr, "GetCodecVolumeMin"}, + {0x00000007, nullptr, "SetCodecActiveTarget"}, + {0x00000008, nullptr, "Unknown"}, + {0x00000009, nullptr, "BindCodecHeadphoneMicJackInterrupt"}, + {0x0000000A, nullptr, "IsCodecHeadphoneMicJackInserted"}, + {0x0000000B, nullptr, "ClearCodecHeadphoneMicJackInterrupt"}, + {0x0000000C, nullptr, "IsCodecDeviceRequested"}, + }; + RegisterHandlers(functions); +} + +} // namespace Audio +} // namespace Service diff --git a/src/core/hle/service/audio/codecctl.h b/src/core/hle/service/audio/codecctl.h new file mode 100644 index 000000000..1121ab0b1 --- /dev/null +++ b/src/core/hle/service/audio/codecctl.h @@ -0,0 +1,23 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Kernel { +class HLERequestContext; +} + +namespace Service { +namespace Audio { + +class CodecCtl final : public ServiceFramework { +public: + explicit CodecCtl(); + ~CodecCtl() = default; +}; + +} // namespace Audio +} // namespace Service