From 832009bfdb360a9700c1d367ecfe0f84e32264a7 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 22 Jan 2018 17:27:55 -0300 Subject: Stub OpenAudioOut and fix a issue with HID IAppletResource being created more than once --- src/core/hle/service/audio/audout_u.cpp | 15 ++++++++++++++- src/core/hle/service/audio/audout_u.h | 1 + src/core/hle/service/hid/hid.cpp | 7 ++++++- 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 8ecfef413..8a436bf97 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -49,9 +49,22 @@ void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) { rb.Push(1); } +void AudOutU::OpenAudioOut(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service, "(STUBBED) called"); + + IPC::RequestBuilder rb{ctx, 6}; + + rb.Push(RESULT_SUCCESS); + rb.Push(48000); // Sample Rate + rb.Push(2); // Channels + rb.Push(2); // PCM Format (INT16) + rb.Push(0); // Unknown + rb.PushIpcInterface(); +} + AudOutU::AudOutU() : ServiceFramework("audout:u") { static const FunctionInfo functions[] = {{0x00000000, &AudOutU::ListAudioOuts, "ListAudioOuts"}, - {0x00000001, nullptr, "OpenAudioOut"}, + {0x00000001, &AudOutU::OpenAudioOut, "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 17529245b..69626cc58 100644 --- a/src/core/hle/service/audio/audout_u.h +++ b/src/core/hle/service/audio/audout_u.h @@ -20,6 +20,7 @@ public: private: void ListAudioOuts(Kernel::HLERequestContext& ctx); + void OpenAudioOut(Kernel::HLERequestContext& ctx); }; } // namespace Audio diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index be7a6ff65..d99e9c505 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -162,8 +162,13 @@ public: ~Hid() = default; private: + Kernel::SharedPtr client_port; + void CreateAppletResource(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared()->CreatePort(); + if (client_port == nullptr) { + client_port = std::make_shared()->CreatePort(); + } + auto session = client_port->Connect(); if (session.Succeeded()) { LOG_DEBUG(Service, "called, initialized IAppletResource -> session=%u", -- cgit v1.2.3