diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/settings.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/aoc/aoc_u.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/glue/time/time_zone.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/service/glue/time/time_zone.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/common.h | 24 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/service_manager.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone.cpp | 41 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone_service.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/psc/time/time_zone_service.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/set/system_settings_server.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_audio.cpp | 117 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_audio.h | 7 |
13 files changed, 177 insertions, 111 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 16749ab68..f1b1add56 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -134,12 +134,12 @@ struct Values { | |||
| 134 | Linkage linkage{}; | 134 | Linkage linkage{}; |
| 135 | 135 | ||
| 136 | // Audio | 136 | // Audio |
| 137 | Setting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine", Category::Audio, | 137 | SwitchableSetting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine", |
| 138 | Specialization::RuntimeList}; | 138 | Category::Audio, Specialization::RuntimeList}; |
| 139 | Setting<std::string> audio_output_device_id{linkage, "auto", "output_device", Category::Audio, | 139 | SwitchableSetting<std::string> audio_output_device_id{ |
| 140 | Specialization::RuntimeList}; | 140 | linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList}; |
| 141 | Setting<std::string> audio_input_device_id{linkage, "auto", "input_device", Category::Audio, | 141 | SwitchableSetting<std::string> audio_input_device_id{ |
| 142 | Specialization::RuntimeList}; | 142 | linkage, "auto", "input_device", Category::Audio, Specialization::RuntimeList}; |
| 143 | SwitchableSetting<AudioMode, true> sound_index{ | 143 | SwitchableSetting<AudioMode, true> sound_index{ |
| 144 | linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround, | 144 | linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround, |
| 145 | "sound_index", Category::SystemAudio, Specialization::Default, true, | 145 | "sound_index", Category::SystemAudio, Specialization::Default, true, |
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 7075ab800..486719cc0 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp | |||
| @@ -202,7 +202,7 @@ void AOC_U::ListAddOnContent(HLERequestContext& ctx) { | |||
| 202 | LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, | 202 | LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, |
| 203 | process_id); | 203 | process_id); |
| 204 | 204 | ||
| 205 | const auto current = system.GetApplicationProcessProgramID(); | 205 | const auto current = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); |
| 206 | 206 | ||
| 207 | std::vector<u32> out; | 207 | std::vector<u32> out; |
| 208 | const auto& disabled = Settings::values.disabled_addons[current]; | 208 | const auto& disabled = Settings::values.disabled_addons[current]; |
diff --git a/src/core/hle/service/glue/time/time_zone.cpp b/src/core/hle/service/glue/time/time_zone.cpp index 5dc1187cb..98d928697 100644 --- a/src/core/hle/service/glue/time/time_zone.cpp +++ b/src/core/hle/service/glue/time/time_zone.cpp | |||
| @@ -197,32 +197,27 @@ Result TimeZoneService::ToCalendarTimeWithMyRule( | |||
| 197 | 197 | ||
| 198 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, | 198 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, |
| 199 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 199 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 200 | Out<u32> out_times_count, | 200 | const Service::PSC::Time::CalendarTime& calendar_time, |
| 201 | Service::PSC::Time::CalendarTime& calendar_time, InRule rule) { | 201 | InRule rule) { |
| 202 | SCOPE_EXIT({ | 202 | SCOPE_EXIT({ |
| 203 | LOG_DEBUG(Service_Time, | 203 | LOG_DEBUG(Service_Time, |
| 204 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 204 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={}", |
| 205 | "out_times_count={}", | 205 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 206 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 207 | }); | 206 | }); |
| 208 | 207 | ||
| 209 | R_RETURN( | 208 | R_RETURN(m_wrapped_service->ToPosixTime(out_count, out_times, calendar_time, rule)); |
| 210 | m_wrapped_service->ToPosixTime(out_count, out_times, out_times_count, calendar_time, rule)); | ||
| 211 | } | 209 | } |
| 212 | 210 | ||
| 213 | Result TimeZoneService::ToPosixTimeWithMyRule(Out<u32> out_count, | 211 | Result TimeZoneService::ToPosixTimeWithMyRule( |
| 214 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 212 | Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 215 | Out<u32> out_times_count, | 213 | const Service::PSC::Time::CalendarTime& calendar_time) { |
| 216 | Service::PSC::Time::CalendarTime& calendar_time) { | ||
| 217 | SCOPE_EXIT({ | 214 | SCOPE_EXIT({ |
| 218 | LOG_DEBUG(Service_Time, | 215 | LOG_DEBUG(Service_Time, |
| 219 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 216 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={}", |
| 220 | "out_times_count={}", | 217 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 221 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 222 | }); | 218 | }); |
| 223 | 219 | ||
| 224 | R_RETURN(m_wrapped_service->ToPosixTimeWithMyRule(out_count, out_times, out_times_count, | 220 | R_RETURN(m_wrapped_service->ToPosixTimeWithMyRule(out_count, out_times, calendar_time)); |
| 225 | calendar_time)); | ||
| 226 | } | 221 | } |
| 227 | 222 | ||
| 228 | } // namespace Service::Glue::Time | 223 | } // namespace Service::Glue::Time |
diff --git a/src/core/hle/service/glue/time/time_zone.h b/src/core/hle/service/glue/time/time_zone.h index bf12adbdc..9c1530966 100644 --- a/src/core/hle/service/glue/time/time_zone.h +++ b/src/core/hle/service/glue/time/time_zone.h | |||
| @@ -68,12 +68,10 @@ public: | |||
| 68 | Out<Service::PSC::Time::CalendarTime> out_calendar_time, | 68 | Out<Service::PSC::Time::CalendarTime> out_calendar_time, |
| 69 | Out<Service::PSC::Time::CalendarAdditionalInfo> out_additional_info, s64 time); | 69 | Out<Service::PSC::Time::CalendarAdditionalInfo> out_additional_info, s64 time); |
| 70 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, | 70 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 71 | Out<u32> out_times_count, Service::PSC::Time::CalendarTime& calendar_time, | 71 | const Service::PSC::Time::CalendarTime& calendar_time, InRule rule); |
| 72 | InRule rule); | ||
| 73 | Result ToPosixTimeWithMyRule(Out<u32> out_count, | 72 | Result ToPosixTimeWithMyRule(Out<u32> out_count, |
| 74 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 73 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 75 | Out<u32> out_times_count, | 74 | const Service::PSC::Time::CalendarTime& calendar_time); |
| 76 | Service::PSC::Time::CalendarTime& calendar_time); | ||
| 77 | 75 | ||
| 78 | private: | 76 | private: |
| 79 | Core::System& m_system; | 77 | Core::System& m_system; |
diff --git a/src/core/hle/service/psc/time/common.h b/src/core/hle/service/psc/time/common.h index 596828b8b..3e13144a0 100644 --- a/src/core/hle/service/psc/time/common.h +++ b/src/core/hle/service/psc/time/common.h | |||
| @@ -189,7 +189,7 @@ struct fmt::formatter<Service::PSC::Time::SteadyClockTimePoint> : fmt::formatter | |||
| 189 | template <typename FormatContext> | 189 | template <typename FormatContext> |
| 190 | auto format(const Service::PSC::Time::SteadyClockTimePoint& time_point, | 190 | auto format(const Service::PSC::Time::SteadyClockTimePoint& time_point, |
| 191 | FormatContext& ctx) const { | 191 | FormatContext& ctx) const { |
| 192 | return fmt::format_to(ctx.out(), "time_point={}", time_point.time_point); | 192 | return fmt::format_to(ctx.out(), "[time_point={}]", time_point.time_point); |
| 193 | } | 193 | } |
| 194 | }; | 194 | }; |
| 195 | 195 | ||
| @@ -197,7 +197,7 @@ template <> | |||
| 197 | struct fmt::formatter<Service::PSC::Time::SystemClockContext> : fmt::formatter<fmt::string_view> { | 197 | struct fmt::formatter<Service::PSC::Time::SystemClockContext> : fmt::formatter<fmt::string_view> { |
| 198 | template <typename FormatContext> | 198 | template <typename FormatContext> |
| 199 | auto format(const Service::PSC::Time::SystemClockContext& context, FormatContext& ctx) const { | 199 | auto format(const Service::PSC::Time::SystemClockContext& context, FormatContext& ctx) const { |
| 200 | return fmt::format_to(ctx.out(), "offset={} steady_time_point={}", context.offset, | 200 | return fmt::format_to(ctx.out(), "[offset={} steady_time_point={}]", context.offset, |
| 201 | context.steady_time_point.time_point); | 201 | context.steady_time_point.time_point); |
| 202 | } | 202 | } |
| 203 | }; | 203 | }; |
| @@ -206,8 +206,9 @@ template <> | |||
| 206 | struct fmt::formatter<Service::PSC::Time::CalendarTime> : fmt::formatter<fmt::string_view> { | 206 | struct fmt::formatter<Service::PSC::Time::CalendarTime> : fmt::formatter<fmt::string_view> { |
| 207 | template <typename FormatContext> | 207 | template <typename FormatContext> |
| 208 | auto format(const Service::PSC::Time::CalendarTime& calendar, FormatContext& ctx) const { | 208 | auto format(const Service::PSC::Time::CalendarTime& calendar, FormatContext& ctx) const { |
| 209 | return fmt::format_to(ctx.out(), "{}/{}/{} {}:{}:{}", calendar.day, calendar.month, | 209 | return fmt::format_to(ctx.out(), "[{:02}/{:02}/{:04} {:02}:{:02}:{:02}]", calendar.day, |
| 210 | calendar.year, calendar.hour, calendar.minute, calendar.second); | 210 | calendar.month, calendar.year, calendar.hour, calendar.minute, |
| 211 | calendar.second); | ||
| 211 | } | 212 | } |
| 212 | }; | 213 | }; |
| 213 | 214 | ||
| @@ -217,7 +218,7 @@ struct fmt::formatter<Service::PSC::Time::CalendarAdditionalInfo> | |||
| 217 | template <typename FormatContext> | 218 | template <typename FormatContext> |
| 218 | auto format(const Service::PSC::Time::CalendarAdditionalInfo& additional, | 219 | auto format(const Service::PSC::Time::CalendarAdditionalInfo& additional, |
| 219 | FormatContext& ctx) const { | 220 | FormatContext& ctx) const { |
| 220 | return fmt::format_to(ctx.out(), "weekday={} yearday={} name={} is_dst={} ut_offset={}", | 221 | return fmt::format_to(ctx.out(), "[weekday={} yearday={} name={} is_dst={} ut_offset={}]", |
| 221 | additional.day_of_week, additional.day_of_year, | 222 | additional.day_of_week, additional.day_of_year, |
| 222 | additional.name.data(), additional.is_dst, additional.ut_offset); | 223 | additional.name.data(), additional.is_dst, additional.ut_offset); |
| 223 | } | 224 | } |
| @@ -227,8 +228,7 @@ template <> | |||
| 227 | struct fmt::formatter<Service::PSC::Time::LocationName> : fmt::formatter<fmt::string_view> { | 228 | struct fmt::formatter<Service::PSC::Time::LocationName> : fmt::formatter<fmt::string_view> { |
| 228 | template <typename FormatContext> | 229 | template <typename FormatContext> |
| 229 | auto format(const Service::PSC::Time::LocationName& name, FormatContext& ctx) const { | 230 | auto format(const Service::PSC::Time::LocationName& name, FormatContext& ctx) const { |
| 230 | std::string_view n{name.data(), name.size()}; | 231 | return formatter<string_view>::format(name.data(), ctx); |
| 231 | return formatter<string_view>::format(n, ctx); | ||
| 232 | } | 232 | } |
| 233 | }; | 233 | }; |
| 234 | 234 | ||
| @@ -236,8 +236,7 @@ template <> | |||
| 236 | struct fmt::formatter<Service::PSC::Time::RuleVersion> : fmt::formatter<fmt::string_view> { | 236 | struct fmt::formatter<Service::PSC::Time::RuleVersion> : fmt::formatter<fmt::string_view> { |
| 237 | template <typename FormatContext> | 237 | template <typename FormatContext> |
| 238 | auto format(const Service::PSC::Time::RuleVersion& version, FormatContext& ctx) const { | 238 | auto format(const Service::PSC::Time::RuleVersion& version, FormatContext& ctx) const { |
| 239 | std::string_view v{version.data(), version.size()}; | 239 | return formatter<string_view>::format(version.data(), ctx); |
| 240 | return formatter<string_view>::format(v, ctx); | ||
| 241 | } | 240 | } |
| 242 | }; | 241 | }; |
| 243 | 242 | ||
| @@ -247,10 +246,11 @@ struct fmt::formatter<Service::PSC::Time::ClockSnapshot> : fmt::formatter<fmt::s | |||
| 247 | auto format(const Service::PSC::Time::ClockSnapshot& snapshot, FormatContext& ctx) const { | 246 | auto format(const Service::PSC::Time::ClockSnapshot& snapshot, FormatContext& ctx) const { |
| 248 | return fmt::format_to( | 247 | return fmt::format_to( |
| 249 | ctx.out(), | 248 | ctx.out(), |
| 250 | "user_context={} network_context={} user_time={} network_time={} user_calendar_time={} " | 249 | "[user_context={} network_context={} user_time={} network_time={} " |
| 250 | "user_calendar_time={} " | ||
| 251 | "network_calendar_time={} user_calendar_additional_time={} " | 251 | "network_calendar_time={} user_calendar_additional_time={} " |
| 252 | "network_calendar_additional_time={} steady_clock_time_point={} location={} " | 252 | "network_calendar_additional_time={} steady_clock_time_point={} location={} " |
| 253 | "is_automatic_correction_enabled={} type={}", | 253 | "is_automatic_correction_enabled={} type={}]", |
| 254 | snapshot.user_context, snapshot.network_context, snapshot.user_time, | 254 | snapshot.user_context, snapshot.network_context, snapshot.user_time, |
| 255 | snapshot.network_time, snapshot.user_calendar_time, snapshot.network_calendar_time, | 255 | snapshot.network_time, snapshot.user_calendar_time, snapshot.network_calendar_time, |
| 256 | snapshot.user_calendar_additional_time, snapshot.network_calendar_additional_time, | 256 | snapshot.user_calendar_additional_time, snapshot.network_calendar_additional_time, |
| @@ -266,7 +266,7 @@ struct fmt::formatter<Service::PSC::Time::ContinuousAdjustmentTimePoint> | |||
| 266 | auto format(const Service::PSC::Time::ContinuousAdjustmentTimePoint& time_point, | 266 | auto format(const Service::PSC::Time::ContinuousAdjustmentTimePoint& time_point, |
| 267 | FormatContext& ctx) const { | 267 | FormatContext& ctx) const { |
| 268 | return fmt::format_to(ctx.out(), | 268 | return fmt::format_to(ctx.out(), |
| 269 | "rtc_offset={} diff_scale={} shift_amount={} lower={} upper={}", | 269 | "[rtc_offset={} diff_scale={} shift_amount={} lower={} upper={}]", |
| 270 | time_point.rtc_offset, time_point.diff_scale, time_point.shift_amount, | 270 | time_point.rtc_offset, time_point.diff_scale, time_point.shift_amount, |
| 271 | time_point.lower, time_point.upper); | 271 | time_point.lower, time_point.upper); |
| 272 | } | 272 | } |
diff --git a/src/core/hle/service/psc/time/service_manager.cpp b/src/core/hle/service/psc/time/service_manager.cpp index ec906b723..4e1643fcb 100644 --- a/src/core/hle/service/psc/time/service_manager.cpp +++ b/src/core/hle/service/psc/time/service_manager.cpp | |||
| @@ -120,11 +120,8 @@ Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext& c | |||
| 120 | context, context.steady_time_point.clock_source_id.RawString(), accuracy); | 120 | context, context.steady_time_point.clock_source_id.RawString(), accuracy); |
| 121 | 121 | ||
| 122 | // TODO this is a hack! The network clock should be updated independently, from the ntc service | 122 | // TODO this is a hack! The network clock should be updated independently, from the ntc service |
| 123 | // and maybe elsewhere. We do not do that, so fix the clock to the local clock on first boot | 123 | // and maybe elsewhere. We do not do that, so fix the clock to the local clock. |
| 124 | // to avoid it being stuck at 0. | 124 | m_local_system_clock.GetContext(context); |
| 125 | if (context == Service::PSC::Time::SystemClockContext{}) { | ||
| 126 | m_local_system_clock.GetContext(context); | ||
| 127 | } | ||
| 128 | 125 | ||
| 129 | m_network_system_clock.SetContextWriter(m_network_system_context_writer); | 126 | m_network_system_clock.SetContextWriter(m_network_system_context_writer); |
| 130 | m_network_system_clock.Initialize(context, accuracy); | 127 | m_network_system_clock.Initialize(context, accuracy); |
| @@ -138,13 +135,6 @@ Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correctio | |||
| 138 | LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}", | 135 | LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}", |
| 139 | automatic_correction, time_point, time_point.clock_source_id.RawString()); | 136 | automatic_correction, time_point, time_point.clock_source_id.RawString()); |
| 140 | 137 | ||
| 141 | // TODO this is a hack! The user clock should be updated independently, from the ntc service | ||
| 142 | // and maybe elsewhere. We do not do that, so fix the clock to the local clock on first boot | ||
| 143 | // to avoid it being stuck at 0. | ||
| 144 | if (time_point == Service::PSC::Time::SteadyClockTimePoint{}) { | ||
| 145 | m_local_system_clock.GetCurrentTimePoint(time_point); | ||
| 146 | } | ||
| 147 | |||
| 148 | m_user_system_clock.SetAutomaticCorrection(automatic_correction); | 138 | m_user_system_clock.SetAutomaticCorrection(automatic_correction); |
| 149 | m_user_system_clock.SetTimePointAndSignal(time_point); | 139 | m_user_system_clock.SetTimePointAndSignal(time_point); |
| 150 | m_user_system_clock.SetInitialized(); | 140 | m_user_system_clock.SetInitialized(); |
diff --git a/src/core/hle/service/psc/time/time_zone.cpp b/src/core/hle/service/psc/time/time_zone.cpp index 82ddba42f..cc855c763 100644 --- a/src/core/hle/service/psc/time/time_zone.cpp +++ b/src/core/hle/service/psc/time/time_zone.cpp | |||
| @@ -140,11 +140,11 @@ Result TimeZone::ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary) | |||
| 140 | R_RETURN(ParseBinaryImpl(out_rule, binary)); | 140 | R_RETURN(ParseBinaryImpl(out_rule, binary)); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | Result TimeZone::ToPosixTime(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 143 | Result TimeZone::ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, |
| 144 | CalendarTime& calendar, const Tz::Rule& rule) { | 144 | const CalendarTime& calendar, const Tz::Rule& rule) { |
| 145 | std::scoped_lock l{m_mutex}; | 145 | std::scoped_lock l{m_mutex}; |
| 146 | 146 | ||
| 147 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_count, calendar, rule, -1); | 147 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_max_count, calendar, rule, -1); |
| 148 | 148 | ||
| 149 | if (res != ResultSuccess) { | 149 | if (res != ResultSuccess) { |
| 150 | if (res == ResultTimeZoneNotFound) { | 150 | if (res == ResultTimeZoneNotFound) { |
| @@ -158,10 +158,10 @@ Result TimeZone::ToPosixTime(u32& out_count, std::span<s64> out_times, u32 out_t | |||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | Result TimeZone::ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, | 160 | Result TimeZone::ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, |
| 161 | u32 out_times_count, CalendarTime& calendar) { | 161 | size_t out_times_max_count, const CalendarTime& calendar) { |
| 162 | std::scoped_lock l{m_mutex}; | 162 | std::scoped_lock l{m_mutex}; |
| 163 | 163 | ||
| 164 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_count, calendar, m_my_rule, -1); | 164 | auto res = ToPosixTimeImpl(out_count, out_times, out_times_max_count, calendar, m_my_rule, -1); |
| 165 | 165 | ||
| 166 | if (res != ResultSuccess) { | 166 | if (res != ResultSuccess) { |
| 167 | if (res == ResultTimeZoneNotFound) { | 167 | if (res == ResultTimeZoneNotFound) { |
| @@ -212,20 +212,23 @@ Result TimeZone::ToCalendarTimeImpl(CalendarTime& out_calendar_time, | |||
| 212 | R_SUCCEED(); | 212 | R_SUCCEED(); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 215 | Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, |
| 216 | CalendarTime& calendar, const Tz::Rule& rule, s32 is_dst) { | 216 | size_t out_times_max_count, const CalendarTime& calendar, |
| 217 | const Tz::Rule& rule, s32 is_dst) { | ||
| 217 | R_TRY(ValidateRule(rule)); | 218 | R_TRY(ValidateRule(rule)); |
| 218 | 219 | ||
| 219 | calendar.month -= 1; | 220 | CalendarTime local_calendar{calendar}; |
| 220 | calendar.year -= 1900; | 221 | |
| 222 | local_calendar.month -= 1; | ||
| 223 | local_calendar.year -= 1900; | ||
| 221 | 224 | ||
| 222 | Tz::CalendarTimeInternal internal{ | 225 | Tz::CalendarTimeInternal internal{ |
| 223 | .tm_sec = calendar.second, | 226 | .tm_sec = local_calendar.second, |
| 224 | .tm_min = calendar.minute, | 227 | .tm_min = local_calendar.minute, |
| 225 | .tm_hour = calendar.hour, | 228 | .tm_hour = local_calendar.hour, |
| 226 | .tm_mday = calendar.day, | 229 | .tm_mday = local_calendar.day, |
| 227 | .tm_mon = calendar.month, | 230 | .tm_mon = local_calendar.month, |
| 228 | .tm_year = calendar.year, | 231 | .tm_year = local_calendar.year, |
| 229 | .tm_wday = 0, | 232 | .tm_wday = 0, |
| 230 | .tm_yday = 0, | 233 | .tm_yday = 0, |
| 231 | .tm_isdst = is_dst, | 234 | .tm_isdst = is_dst, |
| @@ -243,9 +246,9 @@ Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 o | |||
| 243 | R_RETURN(ResultTimeZoneNotFound); | 246 | R_RETURN(ResultTimeZoneNotFound); |
| 244 | } | 247 | } |
| 245 | 248 | ||
| 246 | if (internal.tm_sec != calendar.second || internal.tm_min != calendar.minute || | 249 | if (internal.tm_sec != local_calendar.second || internal.tm_min != local_calendar.minute || |
| 247 | internal.tm_hour != calendar.hour || internal.tm_mday != calendar.day || | 250 | internal.tm_hour != local_calendar.hour || internal.tm_mday != local_calendar.day || |
| 248 | internal.tm_mon != calendar.month || internal.tm_year != calendar.year) { | 251 | internal.tm_mon != local_calendar.month || internal.tm_year != local_calendar.year) { |
| 249 | R_RETURN(ResultTimeZoneNotFound); | 252 | R_RETURN(ResultTimeZoneNotFound); |
| 250 | } | 253 | } |
| 251 | 254 | ||
| @@ -254,7 +257,7 @@ Result TimeZone::ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 o | |||
| 254 | } | 257 | } |
| 255 | 258 | ||
| 256 | out_times[0] = time; | 259 | out_times[0] = time; |
| 257 | if (out_times_count < 2) { | 260 | if (out_times_max_count < 2) { |
| 258 | out_count = 1; | 261 | out_count = 1; |
| 259 | R_SUCCEED(); | 262 | R_SUCCEED(); |
| 260 | } | 263 | } |
diff --git a/src/core/hle/service/psc/time/time_zone.h b/src/core/hle/service/psc/time/time_zone.h index 6bd8f2fda..6248e45f9 100644 --- a/src/core/hle/service/psc/time/time_zone.h +++ b/src/core/hle/service/psc/time/time_zone.h | |||
| @@ -38,18 +38,18 @@ public: | |||
| 38 | CalendarAdditionalInfo& calendar_additional, s64 time); | 38 | CalendarAdditionalInfo& calendar_additional, s64 time); |
| 39 | Result ParseBinary(LocationName& name, std::span<const u8> binary); | 39 | Result ParseBinary(LocationName& name, std::span<const u8> binary); |
| 40 | Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary); | 40 | Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary); |
| 41 | Result ToPosixTime(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 41 | Result ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, |
| 42 | CalendarTime& calendar, const Tz::Rule& rule); | 42 | const CalendarTime& calendar, const Tz::Rule& rule); |
| 43 | Result ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 43 | Result ToPosixTimeWithMyRule(u32& out_count, std::span<s64> out_times, |
| 44 | CalendarTime& calendar); | 44 | size_t out_times_max_count, const CalendarTime& calendar); |
| 45 | 45 | ||
| 46 | private: | 46 | private: |
| 47 | Result ParseBinaryImpl(Tz::Rule& out_rule, std::span<const u8> binary); | 47 | Result ParseBinaryImpl(Tz::Rule& out_rule, std::span<const u8> binary); |
| 48 | Result ToCalendarTimeImpl(CalendarTime& out_calendar_time, | 48 | Result ToCalendarTimeImpl(CalendarTime& out_calendar_time, |
| 49 | CalendarAdditionalInfo& out_additional_info, s64 time, | 49 | CalendarAdditionalInfo& out_additional_info, s64 time, |
| 50 | const Tz::Rule& rule); | 50 | const Tz::Rule& rule); |
| 51 | Result ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, u32 out_times_count, | 51 | Result ToPosixTimeImpl(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, |
| 52 | CalendarTime& calendar, const Tz::Rule& rule, s32 is_dst); | 52 | const CalendarTime& calendar, const Tz::Rule& rule, s32 is_dst); |
| 53 | 53 | ||
| 54 | bool m_initialized{}; | 54 | bool m_initialized{}; |
| 55 | std::recursive_mutex m_mutex; | 55 | std::recursive_mutex m_mutex; |
diff --git a/src/core/hle/service/psc/time/time_zone_service.cpp b/src/core/hle/service/psc/time/time_zone_service.cpp index 9376a0324..eb81f5b03 100644 --- a/src/core/hle/service/psc/time/time_zone_service.cpp +++ b/src/core/hle/service/psc/time/time_zone_service.cpp | |||
| @@ -138,32 +138,28 @@ Result TimeZoneService::ToCalendarTimeWithMyRule(Out<CalendarTime> out_calendar_ | |||
| 138 | 138 | ||
| 139 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, | 139 | Result TimeZoneService::ToPosixTime(Out<u32> out_count, |
| 140 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 140 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 141 | Out<u32> out_times_count, CalendarTime& calendar_time, | 141 | const CalendarTime& calendar_time, InRule rule) { |
| 142 | InRule rule) { | ||
| 143 | SCOPE_EXIT({ | 142 | SCOPE_EXIT({ |
| 144 | LOG_DEBUG(Service_Time, | 143 | LOG_DEBUG(Service_Time, |
| 145 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 144 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} ", |
| 146 | "out_times_count={}", | 145 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 147 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 148 | }); | 146 | }); |
| 149 | 147 | ||
| 150 | R_RETURN( | 148 | R_RETURN( |
| 151 | m_time_zone.ToPosixTime(*out_count, out_times, *out_times_count, calendar_time, *rule)); | 149 | m_time_zone.ToPosixTime(*out_count, out_times, out_times.size(), calendar_time, *rule)); |
| 152 | } | 150 | } |
| 153 | 151 | ||
| 154 | Result TimeZoneService::ToPosixTimeWithMyRule(Out<u32> out_count, | 152 | Result TimeZoneService::ToPosixTimeWithMyRule(Out<u32> out_count, |
| 155 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 153 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 156 | Out<u32> out_times_count, | 154 | const CalendarTime& calendar_time) { |
| 157 | CalendarTime& calendar_time) { | ||
| 158 | SCOPE_EXIT({ | 155 | SCOPE_EXIT({ |
| 159 | LOG_DEBUG(Service_Time, | 156 | LOG_DEBUG(Service_Time, |
| 160 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} " | 157 | "called. calendar_time={} out_count={} out_times[0]={} out_times[1]={} ", |
| 161 | "out_times_count={}", | 158 | calendar_time, *out_count, out_times[0], out_times[1]); |
| 162 | calendar_time, *out_count, out_times[0], out_times[1], *out_times_count); | ||
| 163 | }); | 159 | }); |
| 164 | 160 | ||
| 165 | R_RETURN( | 161 | R_RETURN( |
| 166 | m_time_zone.ToPosixTimeWithMyRule(*out_count, out_times, *out_times_count, calendar_time)); | 162 | m_time_zone.ToPosixTimeWithMyRule(*out_count, out_times, out_times.size(), calendar_time)); |
| 167 | } | 163 | } |
| 168 | 164 | ||
| 169 | } // namespace Service::PSC::Time | 165 | } // namespace Service::PSC::Time |
diff --git a/src/core/hle/service/psc/time/time_zone_service.h b/src/core/hle/service/psc/time/time_zone_service.h index 084e3f907..6eb9ddc4b 100644 --- a/src/core/hle/service/psc/time/time_zone_service.h +++ b/src/core/hle/service/psc/time/time_zone_service.h | |||
| @@ -50,10 +50,10 @@ public: | |||
| 50 | Result ToCalendarTimeWithMyRule(Out<CalendarTime> out_calendar_time, | 50 | Result ToCalendarTimeWithMyRule(Out<CalendarTime> out_calendar_time, |
| 51 | Out<CalendarAdditionalInfo> out_additional_info, s64 time); | 51 | Out<CalendarAdditionalInfo> out_additional_info, s64 time); |
| 52 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, | 52 | Result ToPosixTime(Out<u32> out_count, OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 53 | Out<u32> out_times_count, CalendarTime& calendar_time, InRule rule); | 53 | const CalendarTime& calendar_time, InRule rule); |
| 54 | Result ToPosixTimeWithMyRule(Out<u32> out_count, | 54 | Result ToPosixTimeWithMyRule(Out<u32> out_count, |
| 55 | OutArray<s64, BufferAttr_HipcPointer> out_times, | 55 | OutArray<s64, BufferAttr_HipcPointer> out_times, |
| 56 | Out<u32> out_times_count, CalendarTime& calendar_time); | 56 | const CalendarTime& calendar_time); |
| 57 | 57 | ||
| 58 | private: | 58 | private: |
| 59 | Core::System& m_system; | 59 | Core::System& m_system; |
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 100cb2db4..d3d0fb112 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | namespace Service::Set { | 25 | namespace Service::Set { |
| 26 | 26 | ||
| 27 | namespace { | 27 | namespace { |
| 28 | constexpr u32 SETTINGS_VERSION{2u}; | 28 | constexpr u32 SETTINGS_VERSION{3u}; |
| 29 | constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't'); | 29 | constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't'); |
| 30 | struct SettingsHeader { | 30 | struct SettingsHeader { |
| 31 | u64 magic; | 31 | u64 magic; |
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index 9b6ef47a7..c235b0fca 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include <vector> | 6 | #include <vector> |
| 7 | #include <QComboBox> | 7 | #include <QComboBox> |
| 8 | #include <QPushButton> | ||
| 8 | 9 | ||
| 9 | #include "audio_core/sink/sink.h" | 10 | #include "audio_core/sink/sink.h" |
| 10 | #include "audio_core/sink/sink_details.h" | 11 | #include "audio_core/sink/sink_details.h" |
| @@ -67,19 +68,99 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { | |||
| 67 | 68 | ||
| 68 | hold.emplace(std::pair{setting->Id(), widget}); | 69 | hold.emplace(std::pair{setting->Id(), widget}); |
| 69 | 70 | ||
| 71 | auto global_sink_match = [this] { | ||
| 72 | return static_cast<Settings::AudioEngine>(sink_combo_box->currentIndex()) == | ||
| 73 | Settings::values.sink_id.GetValue(true); | ||
| 74 | }; | ||
| 70 | if (setting->Id() == Settings::values.sink_id.Id()) { | 75 | if (setting->Id() == Settings::values.sink_id.Id()) { |
| 71 | // TODO (lat9nq): Let the system manage sink_id | 76 | // TODO (lat9nq): Let the system manage sink_id |
| 72 | sink_combo_box = widget->combobox; | 77 | sink_combo_box = widget->combobox; |
| 73 | InitializeAudioSinkComboBox(); | 78 | InitializeAudioSinkComboBox(); |
| 74 | 79 | ||
| 75 | connect(sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this, | 80 | if (Settings::IsConfiguringGlobal()) { |
| 76 | &ConfigureAudio::UpdateAudioDevices); | 81 | connect(sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this, |
| 82 | &ConfigureAudio::UpdateAudioDevices); | ||
| 83 | } else { | ||
| 84 | restore_sink_button = ConfigurationShared::Widget::CreateRestoreGlobalButton( | ||
| 85 | Settings::values.sink_id.UsingGlobal(), widget); | ||
| 86 | widget->layout()->addWidget(restore_sink_button); | ||
| 87 | connect(restore_sink_button, &QAbstractButton::clicked, [this](bool) { | ||
| 88 | Settings::values.sink_id.SetGlobal(true); | ||
| 89 | const int sink_index = static_cast<int>(Settings::values.sink_id.GetValue()); | ||
| 90 | sink_combo_box->setCurrentIndex(sink_index); | ||
| 91 | ConfigureAudio::UpdateAudioDevices(sink_index); | ||
| 92 | Settings::values.audio_output_device_id.SetGlobal(true); | ||
| 93 | Settings::values.audio_input_device_id.SetGlobal(true); | ||
| 94 | restore_sink_button->setVisible(false); | ||
| 95 | }); | ||
| 96 | connect(sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), | ||
| 97 | [this, global_sink_match](const int slot) { | ||
| 98 | Settings::values.sink_id.SetGlobal(false); | ||
| 99 | Settings::values.audio_output_device_id.SetGlobal(false); | ||
| 100 | Settings::values.audio_input_device_id.SetGlobal(false); | ||
| 101 | |||
| 102 | restore_sink_button->setVisible(true); | ||
| 103 | restore_sink_button->setEnabled(true); | ||
| 104 | output_device_combo_box->setCurrentIndex(0); | ||
| 105 | restore_output_device_button->setVisible(true); | ||
| 106 | restore_output_device_button->setEnabled(global_sink_match()); | ||
| 107 | input_device_combo_box->setCurrentIndex(0); | ||
| 108 | restore_input_device_button->setVisible(true); | ||
| 109 | restore_input_device_button->setEnabled(global_sink_match()); | ||
| 110 | ConfigureAudio::UpdateAudioDevices(slot); | ||
| 111 | }); | ||
| 112 | } | ||
| 77 | } else if (setting->Id() == Settings::values.audio_output_device_id.Id()) { | 113 | } else if (setting->Id() == Settings::values.audio_output_device_id.Id()) { |
| 78 | // Keep track of output (and input) device comboboxes to populate them with system | 114 | // Keep track of output (and input) device comboboxes to populate them with system |
| 79 | // devices, which are determined at run time | 115 | // devices, which are determined at run time |
| 80 | output_device_combo_box = widget->combobox; | 116 | output_device_combo_box = widget->combobox; |
| 117 | |||
| 118 | if (!Settings::IsConfiguringGlobal()) { | ||
| 119 | restore_output_device_button = | ||
| 120 | ConfigurationShared::Widget::CreateRestoreGlobalButton( | ||
| 121 | Settings::values.audio_output_device_id.UsingGlobal(), widget); | ||
| 122 | restore_output_device_button->setEnabled(global_sink_match()); | ||
| 123 | restore_output_device_button->setVisible( | ||
| 124 | !Settings::values.audio_output_device_id.UsingGlobal()); | ||
| 125 | widget->layout()->addWidget(restore_output_device_button); | ||
| 126 | connect(restore_output_device_button, &QAbstractButton::clicked, [this](bool) { | ||
| 127 | Settings::values.audio_output_device_id.SetGlobal(true); | ||
| 128 | SetOutputDevicesFromDeviceID(); | ||
| 129 | restore_output_device_button->setVisible(false); | ||
| 130 | }); | ||
| 131 | connect(output_device_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), | ||
| 132 | [this, global_sink_match](int) { | ||
| 133 | if (updating_devices) { | ||
| 134 | return; | ||
| 135 | } | ||
| 136 | Settings::values.audio_output_device_id.SetGlobal(false); | ||
| 137 | restore_output_device_button->setVisible(true); | ||
| 138 | restore_output_device_button->setEnabled(global_sink_match()); | ||
| 139 | }); | ||
| 140 | } | ||
| 81 | } else if (setting->Id() == Settings::values.audio_input_device_id.Id()) { | 141 | } else if (setting->Id() == Settings::values.audio_input_device_id.Id()) { |
| 82 | input_device_combo_box = widget->combobox; | 142 | input_device_combo_box = widget->combobox; |
| 143 | |||
| 144 | if (!Settings::IsConfiguringGlobal()) { | ||
| 145 | restore_input_device_button = | ||
| 146 | ConfigurationShared::Widget::CreateRestoreGlobalButton( | ||
| 147 | Settings::values.audio_input_device_id.UsingGlobal(), widget); | ||
| 148 | widget->layout()->addWidget(restore_input_device_button); | ||
| 149 | connect(restore_input_device_button, &QAbstractButton::clicked, [this](bool) { | ||
| 150 | Settings::values.audio_input_device_id.SetGlobal(true); | ||
| 151 | SetInputDevicesFromDeviceID(); | ||
| 152 | restore_input_device_button->setVisible(false); | ||
| 153 | }); | ||
| 154 | connect(input_device_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), | ||
| 155 | [this, global_sink_match](int) { | ||
| 156 | if (updating_devices) { | ||
| 157 | return; | ||
| 158 | } | ||
| 159 | Settings::values.audio_input_device_id.SetGlobal(false); | ||
| 160 | restore_input_device_button->setVisible(true); | ||
| 161 | restore_input_device_button->setEnabled(global_sink_match()); | ||
| 162 | }); | ||
| 163 | } | ||
| 83 | } | 164 | } |
| 84 | } | 165 | } |
| 85 | 166 | ||
| @@ -89,16 +170,13 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { | |||
| 89 | } | 170 | } |
| 90 | 171 | ||
| 91 | void ConfigureAudio::SetConfiguration() { | 172 | void ConfigureAudio::SetConfiguration() { |
| 92 | if (!Settings::IsConfiguringGlobal()) { | ||
| 93 | return; | ||
| 94 | } | ||
| 95 | |||
| 96 | SetOutputSinkFromSinkID(); | 173 | SetOutputSinkFromSinkID(); |
| 97 | 174 | ||
| 98 | // The device list cannot be pre-populated (nor listed) until the output sink is known. | 175 | // The device list cannot be pre-populated (nor listed) until the output sink is known. |
| 99 | UpdateAudioDevices(sink_combo_box->currentIndex()); | 176 | UpdateAudioDevices(sink_combo_box->currentIndex()); |
| 100 | 177 | ||
| 101 | SetAudioDevicesFromDeviceID(); | 178 | SetOutputDevicesFromDeviceID(); |
| 179 | SetInputDevicesFromDeviceID(); | ||
| 102 | } | 180 | } |
| 103 | 181 | ||
| 104 | void ConfigureAudio::SetOutputSinkFromSinkID() { | 182 | void ConfigureAudio::SetOutputSinkFromSinkID() { |
| @@ -116,8 +194,8 @@ void ConfigureAudio::SetOutputSinkFromSinkID() { | |||
| 116 | sink_combo_box->setCurrentIndex(new_sink_index); | 194 | sink_combo_box->setCurrentIndex(new_sink_index); |
| 117 | } | 195 | } |
| 118 | 196 | ||
| 119 | void ConfigureAudio::SetAudioDevicesFromDeviceID() { | 197 | void ConfigureAudio::SetOutputDevicesFromDeviceID() { |
| 120 | int new_device_index = -1; | 198 | int new_device_index = 0; |
| 121 | 199 | ||
| 122 | const QString output_device_id = | 200 | const QString output_device_id = |
| 123 | QString::fromStdString(Settings::values.audio_output_device_id.GetValue()); | 201 | QString::fromStdString(Settings::values.audio_output_device_id.GetValue()); |
| @@ -129,8 +207,10 @@ void ConfigureAudio::SetAudioDevicesFromDeviceID() { | |||
| 129 | } | 207 | } |
| 130 | 208 | ||
| 131 | output_device_combo_box->setCurrentIndex(new_device_index); | 209 | output_device_combo_box->setCurrentIndex(new_device_index); |
| 210 | } | ||
| 132 | 211 | ||
| 133 | new_device_index = -1; | 212 | void ConfigureAudio::SetInputDevicesFromDeviceID() { |
| 213 | int new_device_index = 0; | ||
| 134 | const QString input_device_id = | 214 | const QString input_device_id = |
| 135 | QString::fromStdString(Settings::values.audio_input_device_id.GetValue()); | 215 | QString::fromStdString(Settings::values.audio_input_device_id.GetValue()); |
| 136 | for (int index = 0; index < input_device_combo_box->count(); index++) { | 216 | for (int index = 0; index < input_device_combo_box->count(); index++) { |
| @@ -149,15 +229,12 @@ void ConfigureAudio::ApplyConfiguration() { | |||
| 149 | apply_func(is_powered_on); | 229 | apply_func(is_powered_on); |
| 150 | } | 230 | } |
| 151 | 231 | ||
| 152 | if (Settings::IsConfiguringGlobal()) { | 232 | Settings::values.sink_id.LoadString( |
| 153 | Settings::values.sink_id.LoadString( | 233 | sink_combo_box->itemText(sink_combo_box->currentIndex()).toStdString()); |
| 154 | sink_combo_box->itemText(sink_combo_box->currentIndex()).toStdString()); | 234 | Settings::values.audio_output_device_id.SetValue( |
| 155 | Settings::values.audio_output_device_id.SetValue( | 235 | output_device_combo_box->itemText(output_device_combo_box->currentIndex()).toStdString()); |
| 156 | output_device_combo_box->itemText(output_device_combo_box->currentIndex()) | 236 | Settings::values.audio_input_device_id.SetValue( |
| 157 | .toStdString()); | 237 | input_device_combo_box->itemText(input_device_combo_box->currentIndex()).toStdString()); |
| 158 | Settings::values.audio_input_device_id.SetValue( | ||
| 159 | input_device_combo_box->itemText(input_device_combo_box->currentIndex()).toStdString()); | ||
| 160 | } | ||
| 161 | } | 238 | } |
| 162 | 239 | ||
| 163 | void ConfigureAudio::changeEvent(QEvent* event) { | 240 | void ConfigureAudio::changeEvent(QEvent* event) { |
| @@ -169,6 +246,7 @@ void ConfigureAudio::changeEvent(QEvent* event) { | |||
| 169 | } | 246 | } |
| 170 | 247 | ||
| 171 | void ConfigureAudio::UpdateAudioDevices(int sink_index) { | 248 | void ConfigureAudio::UpdateAudioDevices(int sink_index) { |
| 249 | updating_devices = true; | ||
| 172 | output_device_combo_box->clear(); | 250 | output_device_combo_box->clear(); |
| 173 | output_device_combo_box->addItem(QString::fromUtf8(AudioCore::Sink::auto_device_name)); | 251 | output_device_combo_box->addItem(QString::fromUtf8(AudioCore::Sink::auto_device_name)); |
| 174 | 252 | ||
| @@ -183,6 +261,7 @@ void ConfigureAudio::UpdateAudioDevices(int sink_index) { | |||
| 183 | for (const auto& device : AudioCore::Sink::GetDeviceListForSink(sink_id, true)) { | 261 | for (const auto& device : AudioCore::Sink::GetDeviceListForSink(sink_id, true)) { |
| 184 | input_device_combo_box->addItem(QString::fromStdString(device)); | 262 | input_device_combo_box->addItem(QString::fromStdString(device)); |
| 185 | } | 263 | } |
| 264 | updating_devices = false; | ||
| 186 | } | 265 | } |
| 187 | 266 | ||
| 188 | void ConfigureAudio::InitializeAudioSinkComboBox() { | 267 | void ConfigureAudio::InitializeAudioSinkComboBox() { |
diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index 82d7f6524..32a2fa5f0 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h | |||
| @@ -45,7 +45,8 @@ private: | |||
| 45 | void UpdateAudioDevices(int sink_index); | 45 | void UpdateAudioDevices(int sink_index); |
| 46 | 46 | ||
| 47 | void SetOutputSinkFromSinkID(); | 47 | void SetOutputSinkFromSinkID(); |
| 48 | void SetAudioDevicesFromDeviceID(); | 48 | void SetOutputDevicesFromDeviceID(); |
| 49 | void SetInputDevicesFromDeviceID(); | ||
| 49 | 50 | ||
| 50 | void Setup(const ConfigurationShared::Builder& builder); | 51 | void Setup(const ConfigurationShared::Builder& builder); |
| 51 | 52 | ||
| @@ -55,7 +56,11 @@ private: | |||
| 55 | 56 | ||
| 56 | std::vector<std::function<void(bool)>> apply_funcs{}; | 57 | std::vector<std::function<void(bool)>> apply_funcs{}; |
| 57 | 58 | ||
| 59 | bool updating_devices = false; | ||
| 58 | QComboBox* sink_combo_box; | 60 | QComboBox* sink_combo_box; |
| 61 | QPushButton* restore_sink_button; | ||
| 59 | QComboBox* output_device_combo_box; | 62 | QComboBox* output_device_combo_box; |
| 63 | QPushButton* restore_output_device_button; | ||
| 60 | QComboBox* input_device_combo_box; | 64 | QComboBox* input_device_combo_box; |
| 65 | QPushButton* restore_input_device_button; | ||
| 61 | }; | 66 | }; |