diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/service/am/applet_manager.cpp | 18 | ||||
-rw-r--r-- | src/core/hle/service/am/library_applet_storage.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/am/service/library_applet_self_accessor.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/service/am/service/library_applet_self_accessor.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/audio/audctl.cpp | 201 | ||||
-rw-r--r-- | src/core/hle/service/audio/audctl.h | 50 | ||||
-rw-r--r-- | src/core/hle/service/audio/audio.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/audio/audio_controller.cpp | 174 | ||||
-rw-r--r-- | src/core/hle/service/audio/audio_controller.h | 58 | ||||
-rw-r--r-- | src/core/hle/service/caps/caps_a.cpp | 11 | ||||
-rw-r--r-- | src/core/hle/service/caps/caps_a.h | 3 | ||||
-rw-r--r-- | src/core/hle/service/erpt/erpt.cpp | 12 | ||||
-rw-r--r-- | src/hid_core/frontend/emulated_controller.cpp | 6 | ||||
-rw-r--r-- | src/input_common/drivers/android.h | 7 |
16 files changed, 295 insertions, 270 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 7949e056c..c2bdc0b1a 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -491,12 +491,12 @@ add_library(core STATIC hle/service/apm/apm_controller.h hle/service/apm/apm_interface.cpp hle/service/apm/apm_interface.h - hle/service/audio/audctl.cpp - hle/service/audio/audctl.h hle/service/audio/audin_u.cpp hle/service/audio/audin_u.h hle/service/audio/audio.cpp hle/service/audio/audio.h + hle/service/audio/audio_controller.cpp + hle/service/audio/audio_controller.h hle/service/audio/audout_u.cpp hle/service/audio/audout_u.h hle/service/audio/audrec_a.cpp diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 29a10ad13..ee9795532 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -329,9 +329,8 @@ bool ProfileManager::GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& /// Returns if the system is allowing user registrations or not bool ProfileManager::CanSystemRegisterUser() const { - return false; // TODO(ogniK): Games shouldn't have - // access to user registration, when we - // emulate qlaunch. Update this to dynamically change. + // TODO: Both games and applets can register users. Determine when this condition is not meet. + return true; } bool ProfileManager::RemoveUser(UUID uuid) { diff --git a/src/core/hle/service/am/applet_manager.cpp b/src/core/hle/service/am/applet_manager.cpp index 4c7266f89..2e109181d 100644 --- a/src/core/hle/service/am/applet_manager.cpp +++ b/src/core/hle/service/am/applet_manager.cpp @@ -35,6 +35,21 @@ AppletStorageChannel& InitializeFakeCallerApplet(Core::System& system, return applet->caller_applet_broker->GetInData(); } +void PushInShowQlaunch(Core::System& system, AppletStorageChannel& channel) { + const CommonArguments arguments{ + .arguments_version = CommonArgumentVersion::Version3, + .size = CommonArgumentSize::Version3, + .library_version = 0, + .theme_color = ThemeColor::BasicBlack, + .play_startup_sound = true, + .system_tick = system.CoreTiming().GetClockTicks(), + }; + + std::vector<u8> argument_data(sizeof(arguments)); + std::memcpy(argument_data.data(), &arguments, sizeof(arguments)); + channel.Push(std::make_shared<IStorage>(system, std::move(argument_data))); +} + void PushInShowAlbum(Core::System& system, AppletStorageChannel& channel) { const CommonArguments arguments{ .arguments_version = CommonArgumentVersion::Version3, @@ -284,6 +299,9 @@ void AppletManager::CreateAndInsertByFrontendAppletParameters( // Starting from frontend, some applets require input data. switch (applet->applet_id) { + case AppletId::QLaunch: + PushInShowQlaunch(m_system, InitializeFakeCallerApplet(m_system, applet)); + break; case AppletId::Cabinet: PushInShowCabinetData(m_system, InitializeFakeCallerApplet(m_system, applet)); break; diff --git a/src/core/hle/service/am/library_applet_storage.cpp b/src/core/hle/service/am/library_applet_storage.cpp index 46e6c0111..0412c215d 100644 --- a/src/core/hle/service/am/library_applet_storage.cpp +++ b/src/core/hle/service/am/library_applet_storage.cpp @@ -70,7 +70,7 @@ public: Result Read(s64 offset, void* buffer, size_t size) override { R_TRY(ValidateOffset(offset, size, m_size)); - m_memory.ReadBlock(m_trmem->GetSourceAddress(), buffer, size); + m_memory.ReadBlock(m_trmem->GetSourceAddress() + offset, buffer, size); R_SUCCEED(); } @@ -79,7 +79,7 @@ public: R_UNLESS(m_is_writable, ResultUnknown); R_TRY(ValidateOffset(offset, size, m_size)); - m_memory.WriteBlock(m_trmem->GetSourceAddress(), buffer, size); + m_memory.WriteBlock(m_trmem->GetSourceAddress() + offset, buffer, size); R_SUCCEED(); } diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.cpp b/src/core/hle/service/am/service/library_applet_self_accessor.cpp index 963e67487..330eb26f0 100644 --- a/src/core/hle/service/am/service/library_applet_self_accessor.cpp +++ b/src/core/hle/service/am/service/library_applet_self_accessor.cpp @@ -287,17 +287,17 @@ Result ILibraryAppletSelfAccessor::GetCurrentApplicationId(Out<u64> out_applicat } Result ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers( - Out<bool> out_no_users_available, Out<s32> out_users_count, + Out<bool> out_can_select_any_user, Out<s32> out_users_count, OutArray<Common::UUID, BufferAttr_HipcMapAlias> out_users) { const Service::Account::ProfileManager manager{}; - *out_no_users_available = true; + *out_can_select_any_user = false; *out_users_count = -1; LOG_INFO(Service_AM, "called"); if (manager.GetUserCount() > 0) { - *out_no_users_available = false; + *out_can_select_any_user = true; *out_users_count = static_cast<s32>(manager.GetUserCount()); const auto users = manager.GetAllUsers(); diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.h b/src/core/hle/service/am/service/library_applet_self_accessor.h index a9743569f..3e60393c2 100644 --- a/src/core/hle/service/am/service/library_applet_self_accessor.h +++ b/src/core/hle/service/am/service/library_applet_self_accessor.h @@ -71,7 +71,7 @@ private: ErrorCode error_code, InLargeData<ErrorContext, BufferAttr_HipcMapAlias> error_context); Result GetMainAppletApplicationDesiredLanguage(Out<u64> out_desired_language); Result GetCurrentApplicationId(Out<u64> out_application_id); - Result GetMainAppletAvailableUsers(Out<bool> out_no_users_available, Out<s32> out_users_count, + Result GetMainAppletAvailableUsers(Out<bool> out_can_select_any_user, Out<s32> out_users_count, OutArray<Common::UUID, BufferAttr_HipcMapAlias> out_users); Result ShouldSetGpuTimeSliceManually(Out<bool> out_should_set_gpu_time_slice_manually); Result Cmd160(Out<u64> out_unknown0); diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp deleted file mode 100644 index cf4bb4034..000000000 --- a/src/core/hle/service/audio/audctl.cpp +++ /dev/null @@ -1,201 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "common/logging/log.h" -#include "core/hle/service/audio/audctl.h" -#include "core/hle/service/ipc_helpers.h" -#include "core/hle/service/set/system_settings_server.h" -#include "core/hle/service/sm/sm.h" - -namespace Service::Audio { - -AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetTargetVolume"}, - {1, nullptr, "SetTargetVolume"}, - {2, &AudCtl::GetTargetVolumeMin, "GetTargetVolumeMin"}, - {3, &AudCtl::GetTargetVolumeMax, "GetTargetVolumeMax"}, - {4, nullptr, "IsTargetMute"}, - {5, nullptr, "SetTargetMute"}, - {6, nullptr, "IsTargetConnected"}, - {7, nullptr, "SetDefaultTarget"}, - {8, nullptr, "GetDefaultTarget"}, - {9, &AudCtl::GetAudioOutputMode, "GetAudioOutputMode"}, - {10, &AudCtl::SetAudioOutputMode, "SetAudioOutputMode"}, - {11, nullptr, "SetForceMutePolicy"}, - {12, &AudCtl::GetForceMutePolicy, "GetForceMutePolicy"}, - {13, &AudCtl::GetOutputModeSetting, "GetOutputModeSetting"}, - {14, &AudCtl::SetOutputModeSetting, "SetOutputModeSetting"}, - {15, nullptr, "SetOutputTarget"}, - {16, nullptr, "SetInputTargetForceEnabled"}, - {17, &AudCtl::SetHeadphoneOutputLevelMode, "SetHeadphoneOutputLevelMode"}, - {18, &AudCtl::GetHeadphoneOutputLevelMode, "GetHeadphoneOutputLevelMode"}, - {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, - {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, - {21, nullptr, "GetAudioOutputTargetForPlayReport"}, - {22, nullptr, "NotifyHeadphoneVolumeWarningDisplayedEvent"}, - {23, nullptr, "SetSystemOutputMasterVolume"}, - {24, nullptr, "GetSystemOutputMasterVolume"}, - {25, nullptr, "GetAudioVolumeDataForPlayReport"}, - {26, nullptr, "UpdateHeadphoneSettings"}, - {27, nullptr, "SetVolumeMappingTableForDev"}, - {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, - {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, - {30, &AudCtl::SetSpeakerAutoMuteEnabled, "SetSpeakerAutoMuteEnabled"}, - {31, &AudCtl::IsSpeakerAutoMuteEnabled, "IsSpeakerAutoMuteEnabled"}, - {32, nullptr, "GetActiveOutputTarget"}, - {33, nullptr, "GetTargetDeviceInfo"}, - {34, nullptr, "AcquireTargetNotification"}, - {35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, - {36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, - {37, nullptr, "SetHearingProtectionSafeguardEnabled"}, - {38, nullptr, "IsHearingProtectionSafeguardEnabled"}, - {39, nullptr, "IsHearingProtectionSafeguardMonitoringOutputForDebug"}, - {40, nullptr, "GetSystemInformationForDebug"}, - {41, nullptr, "SetVolumeButtonLongPressTime"}, - {42, nullptr, "SetNativeVolumeForDebug"}, - {10000, nullptr, "NotifyAudioOutputTargetForPlayReport"}, - {10001, nullptr, "NotifyAudioOutputChannelCountForPlayReport"}, - {10002, nullptr, "NotifyUnsupportedUsbOutputDeviceAttachedForPlayReport"}, - {10100, nullptr, "GetAudioVolumeDataForPlayReport"}, - {10101, nullptr, "BindAudioVolumeUpdateEventForPlayReport"}, - {10102, nullptr, "BindAudioOutputTargetUpdateEventForPlayReport"}, - {10103, nullptr, "GetAudioOutputTargetForPlayReport"}, - {10104, nullptr, "GetAudioOutputChannelCountForPlayReport"}, - {10105, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, - {10106, nullptr, "GetDefaultAudioOutputTargetForPlayReport"}, - {50000, nullptr, "SetAnalogInputBoostGainForPrototyping"}, - }; - // clang-format on - - RegisterHandlers(functions); - - m_set_sys = - system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true); -} - -AudCtl::~AudCtl() = default; - -void AudCtl::GetTargetVolumeMin(HLERequestContext& ctx) { - LOG_DEBUG(Audio, "called."); - - // This service function is currently hardcoded on the - // actual console to this value (as of 8.0.0). - constexpr s32 target_min_volume = 0; - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(target_min_volume); -} - -void AudCtl::GetTargetVolumeMax(HLERequestContext& ctx) { - LOG_DEBUG(Audio, "called."); - - // This service function is currently hardcoded on the - // actual console to this value (as of 8.0.0). - constexpr s32 target_max_volume = 15; - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(target_max_volume); -} - -void AudCtl::GetAudioOutputMode(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()}; - - Set::AudioOutputMode output_mode{}; - const auto result = m_set_sys->GetAudioOutputMode(&output_mode, target); - - LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(result); - rb.PushEnum(output_mode); -} - -void AudCtl::SetAudioOutputMode(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()}; - const auto output_mode{rp.PopEnum<Set::AudioOutputMode>()}; - - const auto result = m_set_sys->SetAudioOutputMode(target, output_mode); - - LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(result); -} - -void AudCtl::GetForceMutePolicy(HLERequestContext& ctx) { - LOG_WARNING(Audio, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.PushEnum(ForceMutePolicy::Disable); -} - -void AudCtl::GetOutputModeSetting(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()}; - - LOG_WARNING(Audio, "(STUBBED) called, target={}", target); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.PushEnum(Set::AudioOutputMode::ch_7_1); -} - -void AudCtl::SetOutputModeSetting(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()}; - const auto output_mode{rp.PopEnum<Set::AudioOutputMode>()}; - - LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void AudCtl::SetHeadphoneOutputLevelMode(HLERequestContext& ctx) { - LOG_WARNING(Audio, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void AudCtl::GetHeadphoneOutputLevelMode(HLERequestContext& ctx) { - LOG_WARNING(Audio, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.PushEnum(HeadphoneOutputLevelMode::Normal); -} - -void AudCtl::SetSpeakerAutoMuteEnabled(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto is_speaker_auto_mute_enabled{rp.Pop<bool>()}; - - LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}", - is_speaker_auto_mute_enabled); - - const auto result = m_set_sys->SetSpeakerAutoMuteFlag(is_speaker_auto_mute_enabled); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(result); -} - -void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) { - bool is_speaker_auto_mute_enabled{}; - const auto result = m_set_sys->GetSpeakerAutoMuteFlag(&is_speaker_auto_mute_enabled); - - LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}", - is_speaker_auto_mute_enabled); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(result); - rb.Push<u8>(is_speaker_auto_mute_enabled); -} - -} // namespace Service::Audio diff --git a/src/core/hle/service/audio/audctl.h b/src/core/hle/service/audio/audctl.h deleted file mode 100644 index 4c90ead70..000000000 --- a/src/core/hle/service/audio/audctl.h +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::Set { -class ISystemSettingsServer; -} - -namespace Service::Audio { - -class AudCtl final : public ServiceFramework<AudCtl> { -public: - explicit AudCtl(Core::System& system_); - ~AudCtl() override; - -private: - enum class ForceMutePolicy { - Disable, - SpeakerMuteOnHeadphoneUnplugged, - }; - - enum class HeadphoneOutputLevelMode { - Normal, - HighPower, - }; - - void GetTargetVolumeMin(HLERequestContext& ctx); - void GetTargetVolumeMax(HLERequestContext& ctx); - void GetAudioOutputMode(HLERequestContext& ctx); - void SetAudioOutputMode(HLERequestContext& ctx); - void GetForceMutePolicy(HLERequestContext& ctx); - void GetOutputModeSetting(HLERequestContext& ctx); - void SetOutputModeSetting(HLERequestContext& ctx); - void SetHeadphoneOutputLevelMode(HLERequestContext& ctx); - void GetHeadphoneOutputLevelMode(HLERequestContext& ctx); - void SetSpeakerAutoMuteEnabled(HLERequestContext& ctx); - void IsSpeakerAutoMuteEnabled(HLERequestContext& ctx); - void AcquireTargetNotification(HLERequestContext& ctx); - - std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys; -}; - -} // namespace Service::Audio diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp index dccd16309..44af030eb 100644 --- a/src/core/hle/service/audio/audio.cpp +++ b/src/core/hle/service/audio/audio.cpp @@ -2,9 +2,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/core.h" -#include "core/hle/service/audio/audctl.h" #include "core/hle/service/audio/audin_u.h" #include "core/hle/service/audio/audio.h" +#include "core/hle/service/audio/audio_controller.h" #include "core/hle/service/audio/audout_u.h" #include "core/hle/service/audio/audrec_a.h" #include "core/hle/service/audio/audrec_u.h" @@ -18,7 +18,7 @@ namespace Service::Audio { void LoopProcess(Core::System& system) { auto server_manager = std::make_unique<ServerManager>(system); - server_manager->RegisterNamedService("audctl", std::make_shared<AudCtl>(system)); + server_manager->RegisterNamedService("audctl", std::make_shared<IAudioController>(system)); server_manager->RegisterNamedService("audout:u", std::make_shared<AudOutU>(system)); server_manager->RegisterNamedService("audin:u", std::make_shared<AudInU>(system)); server_manager->RegisterNamedService("audrec:a", std::make_shared<AudRecA>(system)); diff --git a/src/core/hle/service/audio/audio_controller.cpp b/src/core/hle/service/audio/audio_controller.cpp new file mode 100644 index 000000000..a6da66d0f --- /dev/null +++ b/src/core/hle/service/audio/audio_controller.cpp @@ -0,0 +1,174 @@ +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging/log.h" +#include "core/hle/service/audio/audio_controller.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/set/system_settings_server.h" +#include "core/hle/service/sm/sm.h" + +namespace Service::Audio { + +IAudioController::IAudioController(Core::System& system_) + : ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetTargetVolume"}, + {1, nullptr, "SetTargetVolume"}, + {2, C<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"}, + {3, C<&IAudioController::GetTargetVolumeMax>, "GetTargetVolumeMax"}, + {4, nullptr, "IsTargetMute"}, + {5, nullptr, "SetTargetMute"}, + {6, nullptr, "IsTargetConnected"}, + {7, nullptr, "SetDefaultTarget"}, + {8, nullptr, "GetDefaultTarget"}, + {9, C<&IAudioController::GetAudioOutputMode>, "GetAudioOutputMode"}, + {10, C<&IAudioController::SetAudioOutputMode>, "SetAudioOutputMode"}, + {11, nullptr, "SetForceMutePolicy"}, + {12, C<&IAudioController::GetForceMutePolicy>, "GetForceMutePolicy"}, + {13, C<&IAudioController::GetOutputModeSetting>, "GetOutputModeSetting"}, + {14, C<&IAudioController::SetOutputModeSetting>, "SetOutputModeSetting"}, + {15, nullptr, "SetOutputTarget"}, + {16, nullptr, "SetInputTargetForceEnabled"}, + {17, C<&IAudioController::SetHeadphoneOutputLevelMode>, "SetHeadphoneOutputLevelMode"}, + {18, C<&IAudioController::GetHeadphoneOutputLevelMode>, "GetHeadphoneOutputLevelMode"}, + {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, + {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, + {21, nullptr, "GetAudioOutputTargetForPlayReport"}, + {22, nullptr, "NotifyHeadphoneVolumeWarningDisplayedEvent"}, + {23, nullptr, "SetSystemOutputMasterVolume"}, + {24, nullptr, "GetSystemOutputMasterVolume"}, + {25, nullptr, "GetAudioVolumeDataForPlayReport"}, + {26, nullptr, "UpdateHeadphoneSettings"}, + {27, nullptr, "SetVolumeMappingTableForDev"}, + {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, + {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, + {30, C<&IAudioController::SetSpeakerAutoMuteEnabled>, "SetSpeakerAutoMuteEnabled"}, + {31, C<&IAudioController::IsSpeakerAutoMuteEnabled>, "IsSpeakerAutoMuteEnabled"}, + {32, nullptr, "GetActiveOutputTarget"}, + {33, nullptr, "GetTargetDeviceInfo"}, + {34, C<&IAudioController::AcquireTargetNotification>, "AcquireTargetNotification"}, + {35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, + {36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, + {37, nullptr, "SetHearingProtectionSafeguardEnabled"}, + {38, nullptr, "IsHearingProtectionSafeguardEnabled"}, + {39, nullptr, "IsHearingProtectionSafeguardMonitoringOutputForDebug"}, + {40, nullptr, "GetSystemInformationForDebug"}, + {41, nullptr, "SetVolumeButtonLongPressTime"}, + {42, nullptr, "SetNativeVolumeForDebug"}, + {10000, nullptr, "NotifyAudioOutputTargetForPlayReport"}, + {10001, nullptr, "NotifyAudioOutputChannelCountForPlayReport"}, + {10002, nullptr, "NotifyUnsupportedUsbOutputDeviceAttachedForPlayReport"}, + {10100, nullptr, "GetAudioVolumeDataForPlayReport"}, + {10101, nullptr, "BindAudioVolumeUpdateEventForPlayReport"}, + {10102, nullptr, "BindAudioOutputTargetUpdateEventForPlayReport"}, + {10103, nullptr, "GetAudioOutputTargetForPlayReport"}, + {10104, nullptr, "GetAudioOutputChannelCountForPlayReport"}, + {10105, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, + {10106, nullptr, "GetDefaultAudioOutputTargetForPlayReport"}, + {50000, nullptr, "SetAnalogInputBoostGainForPrototyping"}, + }; + // clang-format on + + RegisterHandlers(functions); + + m_set_sys = + system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true); + notification_event = service_context.CreateEvent("IAudioController:NotificationEvent"); +} + +IAudioController::~IAudioController() { + service_context.CloseEvent(notification_event); +}; + +Result IAudioController::GetTargetVolumeMin(Out<s32> out_target_min_volume) { + LOG_DEBUG(Audio, "called."); + + // This service function is currently hardcoded on the + // actual console to this value (as of 8.0.0). + *out_target_min_volume = 0; + R_SUCCEED(); +} + +Result IAudioController::GetTargetVolumeMax(Out<s32> out_target_max_volume) { + LOG_DEBUG(Audio, "called."); + + // This service function is currently hardcoded on the + // actual console to this value (as of 8.0.0). + *out_target_max_volume = 15; + R_SUCCEED(); +} + +Result IAudioController::GetAudioOutputMode(Out<Set::AudioOutputMode> out_output_mode, + Set::AudioOutputModeTarget target) { + const auto result = m_set_sys->GetAudioOutputMode(out_output_mode, target); + + LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, *out_output_mode); + R_RETURN(result); +} + +Result IAudioController::SetAudioOutputMode(Set::AudioOutputModeTarget target, + Set::AudioOutputMode output_mode) { + LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); + + R_RETURN(m_set_sys->SetAudioOutputMode(target, output_mode)); +} + +Result IAudioController::GetForceMutePolicy(Out<ForceMutePolicy> out_mute_policy) { + LOG_WARNING(Audio, "(STUBBED) called"); + + // Removed on FW 13.2.1+ + *out_mute_policy = ForceMutePolicy::Disable; + R_SUCCEED(); +} + +Result IAudioController::GetOutputModeSetting(Out<Set::AudioOutputMode> out_output_mode, + Set::AudioOutputModeTarget target) { + LOG_WARNING(Audio, "(STUBBED) called, target={}", target); + + *out_output_mode = Set::AudioOutputMode::ch_7_1; + R_SUCCEED(); +} + +Result IAudioController::SetOutputModeSetting(Set::AudioOutputModeTarget target, + Set::AudioOutputMode output_mode) { + LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); + R_SUCCEED(); +} + +Result IAudioController::SetHeadphoneOutputLevelMode(HeadphoneOutputLevelMode output_level_mode) { + LOG_WARNING(Audio, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IAudioController::GetHeadphoneOutputLevelMode( + Out<HeadphoneOutputLevelMode> out_output_level_mode) { + LOG_INFO(Audio, "called"); + + *out_output_level_mode = HeadphoneOutputLevelMode::Normal; + R_SUCCEED(); +} + +Result IAudioController::SetSpeakerAutoMuteEnabled(bool is_speaker_auto_mute_enabled) { + LOG_INFO(Audio, "called, is_speaker_auto_mute_enabled={}", is_speaker_auto_mute_enabled); + + R_RETURN(m_set_sys->SetSpeakerAutoMuteFlag(is_speaker_auto_mute_enabled)); +} + +Result IAudioController::IsSpeakerAutoMuteEnabled(Out<bool> out_is_speaker_auto_mute_enabled) { + const auto result = m_set_sys->GetSpeakerAutoMuteFlag(out_is_speaker_auto_mute_enabled); + + LOG_INFO(Audio, "called, is_speaker_auto_mute_enabled={}", *out_is_speaker_auto_mute_enabled); + R_RETURN(result); +} + +Result IAudioController::AcquireTargetNotification( + OutCopyHandle<Kernel::KReadableEvent> out_notification_event) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + *out_notification_event = ¬ification_event->GetReadableEvent(); + R_SUCCEED(); +} + +} // namespace Service::Audio diff --git a/src/core/hle/service/audio/audio_controller.h b/src/core/hle/service/audio/audio_controller.h new file mode 100644 index 000000000..9e8514373 --- /dev/null +++ b/src/core/hle/service/audio/audio_controller.h @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" +#include "core/hle/service/set/settings_types.h" + +namespace Core { +class System; +} + +namespace Service::Set { +class ISystemSettingsServer; +} + +namespace Service::Audio { + +class IAudioController final : public ServiceFramework<IAudioController> { +public: + explicit IAudioController(Core::System& system_); + ~IAudioController() override; + +private: + enum class ForceMutePolicy { + Disable, + SpeakerMuteOnHeadphoneUnplugged, + }; + + enum class HeadphoneOutputLevelMode { + Normal, + HighPower, + }; + + Result GetTargetVolumeMin(Out<s32> out_target_min_volume); + Result GetTargetVolumeMax(Out<s32> out_target_max_volume); + Result GetAudioOutputMode(Out<Set::AudioOutputMode> out_output_mode, + Set::AudioOutputModeTarget target); + Result SetAudioOutputMode(Set::AudioOutputModeTarget target, Set::AudioOutputMode output_mode); + Result GetForceMutePolicy(Out<ForceMutePolicy> out_mute_policy); + Result GetOutputModeSetting(Out<Set::AudioOutputMode> out_output_mode, + Set::AudioOutputModeTarget target); + Result SetOutputModeSetting(Set::AudioOutputModeTarget target, + Set::AudioOutputMode output_mode); + Result SetHeadphoneOutputLevelMode(HeadphoneOutputLevelMode output_level_mode); + Result GetHeadphoneOutputLevelMode(Out<HeadphoneOutputLevelMode> out_output_level_mode); + Result SetSpeakerAutoMuteEnabled(bool is_speaker_auto_mute_enabled); + Result IsSpeakerAutoMuteEnabled(Out<bool> out_is_speaker_auto_mute_enabled); + Result AcquireTargetNotification(OutCopyHandle<Kernel::KReadableEvent> out_notification_event); + + KernelHelpers::ServiceContext service_context; + + Kernel::KEvent* notification_event; + std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys; +}; + +} // namespace Service::Audio diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp index 47ff072c5..52228b830 100644 --- a/src/core/hle/service/caps/caps_a.cpp +++ b/src/core/hle/service/caps/caps_a.cpp @@ -16,7 +16,7 @@ IAlbumAccessorService::IAlbumAccessorService(Core::System& system_, // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetAlbumFileCount"}, - {1, nullptr, "GetAlbumFileList"}, + {1, C<&IAlbumAccessorService::GetAlbumFileList>, "GetAlbumFileList"}, {2, nullptr, "LoadAlbumFile"}, {3, C<&IAlbumAccessorService::DeleteAlbumFile>, "DeleteAlbumFile"}, {4, nullptr, "StorageCopyAlbumFile"}, @@ -62,6 +62,15 @@ IAlbumAccessorService::IAlbumAccessorService(Core::System& system_, IAlbumAccessorService::~IAlbumAccessorService() = default; +Result IAlbumAccessorService::GetAlbumFileList( + Out<u64> out_count, AlbumStorage storage, + OutArray<AlbumEntry, BufferAttr_HipcMapAlias> out_entries) { + LOG_INFO(Service_Capture, "called, storage={}", storage); + + const Result result = manager->GetAlbumFileList(out_entries, *out_count, storage, 0); + R_RETURN(TranslateResult(result)); +} + Result IAlbumAccessorService::DeleteAlbumFile(AlbumFileId file_id) { LOG_INFO(Service_Capture, "called, application_id=0x{:0x}, storage={}, type={}", file_id.application_id, file_id.storage, file_id.type); diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h index 2cb9b4547..c7a5208e3 100644 --- a/src/core/hle/service/caps/caps_a.h +++ b/src/core/hle/service/caps/caps_a.h @@ -21,6 +21,9 @@ public: ~IAlbumAccessorService() override; private: + Result GetAlbumFileList(Out<u64> out_count, AlbumStorage storage, + OutArray<AlbumEntry, BufferAttr_HipcMapAlias> out_entries); + Result DeleteAlbumFile(AlbumFileId file_id); Result IsAlbumMounted(Out<bool> out_is_mounted, AlbumStorage storage); diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp index 3ea862fad..39ae3a723 100644 --- a/src/core/hle/service/erpt/erpt.cpp +++ b/src/core/hle/service/erpt/erpt.cpp @@ -3,6 +3,8 @@ #include <memory> +#include "common/logging/log.h" +#include "core/hle/service/cmif_serialization.h" #include "core/hle/service/erpt/erpt.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" @@ -15,7 +17,7 @@ public: explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} { // clang-format off static const FunctionInfo functions[] = { - {0, nullptr, "SubmitContext"}, + {0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, {1, nullptr, "CreateReportV0"}, {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, @@ -36,6 +38,14 @@ public: RegisterHandlers(functions); } + +private: + Result SubmitContext(InBuffer<BufferAttr_HipcMapAlias> buffer_a, + InBuffer<BufferAttr_HipcMapAlias> buffer_b) { + LOG_WARNING(Service_SET, "(STUBBED) called, buffer_a_size={}, buffer_b_size={}", + buffer_a.size(), buffer_b.size()); + R_SUCCEED(); + } }; class ErrorReportSession final : public ServiceFramework<ErrorReportSession> { diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp index 3fa06d188..d9d278fa3 100644 --- a/src/hid_core/frontend/emulated_controller.cpp +++ b/src/hid_core/frontend/emulated_controller.cpp @@ -174,9 +174,13 @@ void EmulatedController::LoadDevices() { // Only map virtual devices to the first controller if (npad_id_type == NpadIdType::Player1 || npad_id_type == NpadIdType::Handheld) { camera_params[1] = Common::ParamPackage{"engine:camera,camera:1"}; - ring_params[1] = Common::ParamPackage{"engine:joycon,axis_x:100,axis_y:101"}; nfc_params[0] = Common::ParamPackage{"engine:virtual_amiibo,nfc:1"}; +#ifdef HAVE_LIBUSB + ring_params[1] = Common::ParamPackage{"engine:joycon,axis_x:100,axis_y:101"}; +#endif +#ifdef ANDROID android_params = Common::ParamPackage{"engine:android,port:100"}; +#endif } output_params[LeftIndex] = left_joycon; diff --git a/src/input_common/drivers/android.h b/src/input_common/drivers/android.h index ac60e3598..8a386c1b1 100644 --- a/src/input_common/drivers/android.h +++ b/src/input_common/drivers/android.h @@ -128,10 +128,11 @@ private: const std::string razer_vid{"1532"}; const std::string redmagic_vid{"3537"}; const std::string backbone_labs_vid{"358a"}; - const std::vector<std::string> flipped_ab_vids{sony_vid, nintendo_vid, razer_vid, redmagic_vid, - backbone_labs_vid}; + const std::string xbox_vid{"045e"}; + const std::vector<std::string> flipped_ab_vids{sony_vid, nintendo_vid, razer_vid, + redmagic_vid, backbone_labs_vid, xbox_vid}; const std::vector<std::string> flipped_xy_vids{sony_vid, razer_vid, redmagic_vid, - backbone_labs_vid}; + backbone_labs_vid, xbox_vid}; }; } // namespace InputCommon |