Stub QueryAudioDevice{Input,Output}Event

Used in many 3.0.0+ games
This commit is contained in:
Billy Laws 2022-04-30 15:23:34 +01:00
parent 8d7dbe2c4e
commit 112c20cef2
2 changed files with 30 additions and 3 deletions

View File

@ -6,7 +6,11 @@
#include "IAudioDevice.h" #include "IAudioDevice.h"
namespace skyline::service::audio { namespace skyline::service::audio {
IAudioDevice::IAudioDevice(const DeviceState &state, ServiceManager &manager) : systemEvent(std::make_shared<type::KEvent>(state, true)), BaseService(state, manager) {} IAudioDevice::IAudioDevice(const DeviceState &state, ServiceManager &manager)
: BaseService(state, manager),
systemEvent(std::make_shared<type::KEvent>(state, true)),
outputEvent(std::make_shared<type::KEvent>(state, true)),
inputEvent(std::make_shared<type::KEvent>(state, true)) {}
Result IAudioDevice::ListAudioDeviceName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { Result IAudioDevice::ListAudioDeviceName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
span buffer{request.outputBuf.at(0)}; span buffer{request.outputBuf.at(0)};
@ -44,4 +48,18 @@ namespace skyline::service::audio {
response.Push<u32>(constant::StereoChannelCount); response.Push<u32>(constant::StereoChannelCount);
return {}; return {};
} }
Result IAudioDevice::QueryAudioDeviceInputEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
auto handle{state.process->InsertItem(inputEvent)};
Logger::Debug("Audio Device Input Event Handle: 0x{:X}", handle);
response.copyHandles.push_back(handle);
return {};
}
Result IAudioDevice::QueryAudioDeviceOutputEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
auto handle{state.process->InsertItem(outputEvent)};
Logger::Debug("Audio Device Output Event Handle: 0x{:X}", handle);
response.copyHandles.push_back(handle);
return {};
}
} }

View File

@ -12,7 +12,10 @@ namespace skyline::service::audio {
*/ */
class IAudioDevice : public BaseService { class IAudioDevice : public BaseService {
private: private:
std::shared_ptr<type::KEvent> systemEvent; //!< The KEvent that is signalled on audio device changes std::shared_ptr<type::KEvent> systemEvent; //!< Signalled on all audio device changes
std::shared_ptr<type::KEvent> inputEvent; //!< Signalled on audio input device changes
std::shared_ptr<type::KEvent> outputEvent; //!< Signalled on audio output device changes
public: public:
IAudioDevice(const DeviceState &state, ServiceManager &manager); IAudioDevice(const DeviceState &state, ServiceManager &manager);
@ -44,6 +47,10 @@ namespace skyline::service::audio {
*/ */
Result GetActiveChannelCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); Result GetActiveChannelCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
Result QueryAudioDeviceInputEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
Result QueryAudioDeviceOutputEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
SERVICE_DECL( SERVICE_DECL(
SFUNC(0x0, IAudioDevice, ListAudioDeviceName), SFUNC(0x0, IAudioDevice, ListAudioDeviceName),
SFUNC(0x1, IAudioDevice, SetAudioDeviceOutputVolume), SFUNC(0x1, IAudioDevice, SetAudioDeviceOutputVolume),
@ -52,7 +59,9 @@ namespace skyline::service::audio {
SFUNC(0x5, IAudioDevice, GetActiveChannelCount), SFUNC(0x5, IAudioDevice, GetActiveChannelCount),
SFUNC(0x6, IAudioDevice, ListAudioDeviceName), SFUNC(0x6, IAudioDevice, ListAudioDeviceName),
SFUNC(0x7, IAudioDevice, SetAudioDeviceOutputVolume), SFUNC(0x7, IAudioDevice, SetAudioDeviceOutputVolume),
SFUNC(0xA, IAudioDevice, GetActiveAudioDeviceName) SFUNC(0xA, IAudioDevice, GetActiveAudioDeviceName),
SFUNC(0xB, IAudioDevice, QueryAudioDeviceInputEvent),
SFUNC(0xC, IAudioDevice, QueryAudioDeviceOutputEvent)
) )
}; };
} }