summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
m---------externals/Vulkan-Headers0
-rw-r--r--src/audio_core/device/device_session.cpp3
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.cpp2
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.h1
-rw-r--r--src/audio_core/renderer/system_manager.cpp19
-rw-r--r--src/audio_core/renderer/system_manager.h7
-rw-r--r--src/audio_core/sink/cubeb_sink.cpp4
-rw-r--r--src/audio_core/sink/sdl2_sink.cpp2
-rw-r--r--src/audio_core/sink/sink_stream.cpp67
-rw-r--r--src/audio_core/sink/sink_stream.h29
-rw-r--r--src/core/frontend/applets/controller.cpp2
-rw-r--r--src/core/frontend/applets/controller.h2
-rw-r--r--src/core/frontend/applets/profile_select.cpp3
-rw-r--r--src/core/frontend/applets/profile_select.h16
-rw-r--r--src/core/hle/service/am/applets/applet_controller.cpp12
-rw-r--r--src/core/hle/service/am/applets/applet_controller.h9
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.cpp52
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.h102
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp32
-rw-r--r--src/core/hle/service/hid/controllers/npad.h4
-rw-r--r--src/core/hle/service/hid/hid.cpp41
-rw-r--r--src/core/hle/service/hid/hid.h1
-rw-r--r--src/video_core/vulkan_common/vulkan_wrapper.cpp2
-rw-r--r--src/yuzu/applets/qt_controller.cpp8
-rw-r--r--src/yuzu/applets/qt_controller.h2
-rw-r--r--src/yuzu/applets/qt_controller.ui8
-rw-r--r--src/yuzu/applets/qt_profile_select.cpp85
-rw-r--r--src/yuzu/applets/qt_profile_select.h11
-rw-r--r--src/yuzu/main.cpp37
-rw-r--r--src/yuzu/main.h7
31 files changed, 417 insertions, 155 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6c43f401..561eaafb2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,7 +222,7 @@ find_package(ZLIB 1.2 REQUIRED)
find_package(zstd 1.5 REQUIRED)
if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS)
- find_package(Vulkan 1.3.238 REQUIRED)
+ find_package(Vulkan 1.3.246 REQUIRED)
endif()
if (ENABLE_LIBUSB)
diff --git a/externals/Vulkan-Headers b/externals/Vulkan-Headers
-Subproject 00671c64ba5c488ade22ad572a0ef81d5e64c80
+Subproject 63af1cf1ee906ba4dcd5a324bdd0201d4f4bfd1
diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp
index 043ce8875..b5c0ef0e6 100644
--- a/src/audio_core/device/device_session.cpp
+++ b/src/audio_core/device/device_session.cpp
@@ -121,8 +121,7 @@ u64 DeviceSession::GetPlayedSampleCount() const {
}
std::optional<std::chrono::nanoseconds> DeviceSession::ThreadFunc() {
- // Add 5ms of samples at a 48K sample rate.
- played_sample_count += 48'000 * INCREMENT_TIME / 1s;
+ played_sample_count = stream->GetExpectedPlayedSampleCount();
if (type == Sink::StreamType::Out) {
system.AudioCore().GetAudioManager().SetEvent(Event::Type::AudioOutManager, true);
} else {
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp
index 42b4b167a..503f40349 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.cpp
+++ b/src/audio_core/renderer/adsp/audio_renderer.cpp
@@ -189,6 +189,8 @@ void AudioRenderer::ThreadFunc() {
max_time = std::min(command_buffer.time_limit, max_time);
command_list_processor.SetProcessTimeMax(max_time);
+ streams[index]->WaitFreeSpace();
+
// Process the command list
{
MICROPROFILE_SCOPE(Audio_Renderer);
diff --git a/src/audio_core/renderer/adsp/audio_renderer.h b/src/audio_core/renderer/adsp/audio_renderer.h
index 151f38c1b..85ce6a269 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.h
+++ b/src/audio_core/renderer/adsp/audio_renderer.h
@@ -10,6 +10,7 @@
#include "audio_core/renderer/adsp/command_buffer.h"
#include "audio_core/renderer/adsp/command_list_processor.h"
#include "common/common_types.h"
+#include "common/polyfill_thread.h"
#include "common/reader_writer_queue.h"
#include "common/thread.h"
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp
index ce631f810..07d8ed093 100644
--- a/src/audio_core/renderer/system_manager.cpp
+++ b/src/audio_core/renderer/system_manager.cpp
@@ -15,14 +15,9 @@ MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager",
MP_RGB(60, 19, 97));
namespace AudioCore::AudioRenderer {
-constexpr std::chrono::nanoseconds RENDER_TIME{5'000'000UL};
SystemManager::SystemManager(Core::System& core_)
- : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()},
- thread_event{Core::Timing::CreateEvent(
- "AudioRendererSystemManager", [this](std::uintptr_t, s64 time, std::chrono::nanoseconds) {
- return ThreadFunc2(time);
- })} {}
+ : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()} {}
SystemManager::~SystemManager() {
Stop();
@@ -33,8 +28,6 @@ bool SystemManager::InitializeUnsafe() {
if (adsp.Start()) {
active = true;
thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(); });
- core.CoreTiming().ScheduleLoopingEvent(std::chrono::nanoseconds(0), RENDER_TIME,
- thread_event);
}
}
@@ -45,7 +38,6 @@ void SystemManager::Stop() {
if (!active) {
return;
}
- core.CoreTiming().UnscheduleEvent(thread_event, {});
active = false;
update.store(true);
update.notify_all();
@@ -111,16 +103,7 @@ void SystemManager::ThreadFunc() {
adsp.Signal();
adsp.Wait();
-
- update.wait(false);
- update.store(false);
}
}
-std::optional<std::chrono::nanoseconds> SystemManager::ThreadFunc2(s64 time) {
- update.store(true);
- update.notify_all();
- return std::nullopt;
-}
-
} // namespace AudioCore::AudioRenderer
diff --git a/src/audio_core/renderer/system_manager.h b/src/audio_core/renderer/system_manager.h
index 415ddb74f..1f0bbd8b4 100644
--- a/src/audio_core/renderer/system_manager.h
+++ b/src/audio_core/renderer/system_manager.h
@@ -68,11 +68,6 @@ private:
*/
void ThreadFunc();
- /**
- * Signalling core timing thread to run ThreadFunc.
- */
- std::optional<std::chrono::nanoseconds> ThreadFunc2(s64 time);
-
enum class StreamState {
Filling,
Steady,
@@ -95,8 +90,6 @@ private:
ADSP::ADSP& adsp;
/// AudioRenderer mailbox for communication
ADSP::AudioRenderer_Mailbox* mailbox{};
- /// Core timing event to signal main thread
- std::shared_ptr<Core::Timing::EventType> thread_event;
/// Atomic for main thread to wait on
std::atomic<bool> update{};
};
diff --git a/src/audio_core/sink/cubeb_sink.cpp b/src/audio_core/sink/cubeb_sink.cpp
index 9133f5388..9a0801888 100644
--- a/src/audio_core/sink/cubeb_sink.cpp
+++ b/src/audio_core/sink/cubeb_sink.cpp
@@ -101,8 +101,6 @@ public:
~CubebSinkStream() override {
LOG_DEBUG(Service_Audio, "Destructing cubeb stream {}", name);
- Unstall();
-
if (!ctx) {
return;
}
@@ -143,8 +141,6 @@ public:
* Stop the sink stream.
*/
void Stop() override {
- Unstall();
-
if (!ctx || paused) {
return;
}
diff --git a/src/audio_core/sink/sdl2_sink.cpp b/src/audio_core/sink/sdl2_sink.cpp
index c138dc628..ee1a0652f 100644
--- a/src/audio_core/sink/sdl2_sink.cpp
+++ b/src/audio_core/sink/sdl2_sink.cpp
@@ -88,7 +88,6 @@ public:
* Finalize the sink stream.
*/
void Finalize() override {
- Unstall();
if (device == 0) {
return;
}
@@ -116,7 +115,6 @@ public:
* Stop the sink stream.
*/
void Stop() override {
- Unstall();
if (device == 0 || paused) {
return;
}
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index 39a21b0f0..f99dbd8ec 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -14,6 +14,8 @@
#include "common/fixed_point.h"
#include "common/settings.h"
#include "core/core.h"
+#include "core/core_timing.h"
+#include "core/core_timing_util.h"
namespace AudioCore::Sink {
@@ -149,10 +151,6 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n
return;
}
- if (queued_buffers > max_queue_size) {
- Stall();
- }
-
while (frames_written < num_frames) {
// If the playing buffer has been consumed or has no frames, we need a new one
if (playing_buffer.consumed || playing_buffer.frames == 0) {
@@ -187,10 +185,6 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n
}
std::memcpy(&last_frame[0], &input_buffer[(frames_written - 1) * frame_size], frame_size_bytes);
-
- if (queued_buffers <= max_queue_size) {
- Unstall();
- }
}
void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::size_t num_frames) {
@@ -198,10 +192,15 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
const std::size_t frame_size = num_channels;
const std::size_t frame_size_bytes = frame_size * sizeof(s16);
size_t frames_written{0};
+ size_t actual_frames_written{0};
// If we're paused or going to shut down, we don't want to consume buffers as coretiming is
// paused and we'll desync, so just play silence.
if (system.IsPaused() || system.IsShuttingDown()) {
+ if (system.IsShuttingDown()) {
+ release_cv.notify_one();
+ }
+
static constexpr std::array<s16, 6> silence{};
for (size_t i = frames_written; i < num_frames; i++) {
std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes);
@@ -209,20 +208,6 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
return;
}
- // Due to many frames being queued up with nvdec (5 frames or so?), a lot of buffers also get
- // queued up (30+) but not all at once, which causes constant stalling here, so just let the
- // video play out without attempting to stall.
- // Can hopefully remove this later with a more complete NVDEC implementation.
- const auto nvdec_active{system.AudioCore().IsNVDECActive()};
-
- // Core timing cannot be paused in single-core mode, so Stall ends up being called over and over
- // and never recovers to a normal state, so just skip attempting to sync things on single-core.
- if (system.IsMulticore() && !nvdec_active && queued_buffers > max_queue_size) {
- Stall();
- } else if (system.IsMulticore() && queued_buffers <= max_queue_size) {
- Unstall();
- }
-
while (frames_written < num_frames) {
// If the playing buffer has been consumed or has no frames, we need a new one
if (playing_buffer.consumed || playing_buffer.frames == 0) {
@@ -237,6 +222,10 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
}
// Successfully dequeued a new buffer.
queued_buffers--;
+
+ { std::unique_lock lk{release_mutex}; }
+
+ release_cv.notify_one();
}
// Get the minimum frames available between the currently playing buffer, and the
@@ -248,6 +237,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
frames_available * frame_size);
frames_written += frames_available;
+ actual_frames_written += frames_available;
playing_buffer.frames_played += frames_available;
// If that's all the frames in the current buffer, add its samples and mark it as
@@ -260,26 +250,29 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
std::memcpy(&last_frame[0], &output_buffer[(frames_written - 1) * frame_size],
frame_size_bytes);
- if (system.IsMulticore() && queued_buffers <= max_queue_size) {
- Unstall();
+ {
+ std::scoped_lock lk{sample_count_lock};
+ last_sample_count_update_time =
+ Core::Timing::CyclesToUs(system.CoreTiming().GetClockTicks());
+ min_played_sample_count = max_played_sample_count;
+ max_played_sample_count += actual_frames_written;
}
}
-void SinkStream::Stall() {
- std::scoped_lock lk{stall_guard};
- if (stalled_lock) {
- return;
- }
- stalled_lock = system.StallApplication();
+u64 SinkStream::GetExpectedPlayedSampleCount() {
+ std::scoped_lock lk{sample_count_lock};
+ auto cur_time{Core::Timing::CyclesToUs(system.CoreTiming().GetClockTicks())};
+ auto time_delta{cur_time - last_sample_count_update_time};
+ auto exp_played_sample_count{min_played_sample_count +
+ (TargetSampleRate * time_delta) / std::chrono::seconds{1}};
+
+ return std::min<u64>(exp_played_sample_count, max_played_sample_count);
}
-void SinkStream::Unstall() {
- std::scoped_lock lk{stall_guard};
- if (!stalled_lock) {
- return;
- }
- system.UnstallApplication();
- stalled_lock.unlock();
+void SinkStream::WaitFreeSpace() {
+ std::unique_lock lk{release_mutex};
+ release_cv.wait(
+ lk, [this]() { return queued_buffers < max_queue_size || system.IsShuttingDown(); });
}
} // namespace AudioCore::Sink
diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h
index 5fea72ab7..23e289c7b 100644
--- a/src/audio_core/sink/sink_stream.h
+++ b/src/audio_core/sink/sink_stream.h
@@ -5,6 +5,7 @@
#include <array>
#include <atomic>
+#include <chrono>
#include <memory>
#include <mutex>
#include <span>
@@ -14,6 +15,7 @@
#include "common/common_types.h"
#include "common/reader_writer_queue.h"
#include "common/ring_buffer.h"
+#include "common/thread.h"
namespace Core {
class System;
@@ -53,9 +55,7 @@ struct SinkBuffer {
class SinkStream {
public:
explicit SinkStream(Core::System& system_, StreamType type_) : system{system_}, type{type_} {}
- virtual ~SinkStream() {
- Unstall();
- }
+ virtual ~SinkStream() {}
/**
* Finalize the sink stream.
@@ -201,14 +201,16 @@ public:
void ProcessAudioOutAndRender(std::span<s16> output_buffer, std::size_t num_frames);
/**
- * Stall core processes if the audio thread falls too far behind.
+ * Get the total number of samples expected to have been played by this stream.
+ *
+ * @return The number of samples.
*/
- void Stall();
+ u64 GetExpectedPlayedSampleCount();
/**
- * Unstall core processes.
+ * Waits for free space in the sample ring buffer
*/
- void Unstall();
+ void WaitFreeSpace();
protected:
/// Core system
@@ -237,12 +239,21 @@ private:
std::atomic<u32> queued_buffers{};
/// The ring size for audio out buffers (usually 4, rarely 2 or 8)
u32 max_queue_size{};
+ /// Locks access to sample count tracking info
+ std::mutex sample_count_lock;
+ /// Minimum number of total samples that have been played since the last callback
+ u64 min_played_sample_count{};
+ /// Maximum number of total samples that can be played since the last callback
+ u64 max_played_sample_count{};
+ /// The time the two above tracking variables were last written to
+ std::chrono::microseconds last_sample_count_update_time{};
/// Set by the audio render/in/out system which uses this stream
f32 system_volume{1.0f};
/// Set via IAudioDevice service calls
f32 device_volume{1.0f};
- std::mutex stall_guard;
- std::unique_lock<std::mutex> stalled_lock;
+ /// Signalled when ring buffer entries are consumed
+ std::condition_variable release_cv;
+ std::mutex release_mutex;
};
using SinkStreamPtr = std::unique_ptr<SinkStream>;
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp
index 8e586e938..3300d4f79 100644
--- a/src/core/frontend/applets/controller.cpp
+++ b/src/core/frontend/applets/controller.cpp
@@ -71,7 +71,7 @@ void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callbac
}
}
- callback();
+ callback(true);
}
} // namespace Core::Frontend
diff --git a/src/core/frontend/applets/controller.h b/src/core/frontend/applets/controller.h
index 5c488387d..19a2db6bf 100644
--- a/src/core/frontend/applets/controller.h
+++ b/src/core/frontend/applets/controller.h
@@ -37,7 +37,7 @@ struct ControllerParameters {
class ControllerApplet : public Applet {
public:
- using ReconfigureCallback = std::function<void()>;
+ using ReconfigureCallback = std::function<void(bool)>;
virtual ~ControllerApplet();
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp
index 910d20c0d..c18f17a36 100644
--- a/src/core/frontend/applets/profile_select.cpp
+++ b/src/core/frontend/applets/profile_select.cpp
@@ -11,7 +11,8 @@ ProfileSelectApplet::~ProfileSelectApplet() = default;
void DefaultProfileSelectApplet::Close() const {}
-void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const {
+void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback,
+ const ProfileSelectParameters& parameters) const {
Service::Account::ProfileManager manager;
callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{}));
LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");
diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h
index 76e963535..92e2737ea 100644
--- a/src/core/frontend/applets/profile_select.h
+++ b/src/core/frontend/applets/profile_select.h
@@ -5,25 +5,35 @@
#include <functional>
#include <optional>
-#include "common/uuid.h"
+#include "common/uuid.h"
#include "core/frontend/applets/applet.h"
+#include "core/hle/service/am/applets/applet_profile_select.h"
namespace Core::Frontend {
+struct ProfileSelectParameters {
+ Service::AM::Applets::UiMode mode;
+ std::array<Common::UUID, 8> invalid_uid_list;
+ Service::AM::Applets::UiSettingsDisplayOptions display_options;
+ Service::AM::Applets::UserSelectionPurpose purpose;
+};
+
class ProfileSelectApplet : public Applet {
public:
using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>;
virtual ~ProfileSelectApplet();
- virtual void SelectProfile(SelectProfileCallback callback) const = 0;
+ virtual void SelectProfile(SelectProfileCallback callback,
+ const ProfileSelectParameters& parameters) const = 0;
};
class DefaultProfileSelectApplet final : public ProfileSelectApplet {
public:
void Close() const override;
- void SelectProfile(SelectProfileCallback callback) const override;
+ void SelectProfile(SelectProfileCallback callback,
+ const ProfileSelectParameters& parameters) const override;
};
} // namespace Core::Frontend
diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp
index 2d1d115d7..9840d2547 100644
--- a/src/core/hle/service/am/applets/applet_controller.cpp
+++ b/src/core/hle/service/am/applets/applet_controller.cpp
@@ -224,7 +224,8 @@ void Controller::Execute() {
parameters.allow_dual_joycons, parameters.allow_left_joycon,
parameters.allow_right_joycon);
- frontend.ReconfigureControllers([this] { ConfigurationComplete(); }, parameters);
+ frontend.ReconfigureControllers(
+ [this](bool is_success) { ConfigurationComplete(is_success); }, parameters);
break;
}
case ControllerSupportMode::ShowControllerStrapGuide:
@@ -232,16 +233,16 @@ void Controller::Execute() {
case ControllerSupportMode::ShowControllerKeyRemappingForSystem:
UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented",
controller_private_arg.mode);
- ConfigurationComplete();
+ ConfigurationComplete(true);
break;
default: {
- ConfigurationComplete();
+ ConfigurationComplete(true);
break;
}
}
}
-void Controller::ConfigurationComplete() {
+void Controller::ConfigurationComplete(bool is_success) {
ControllerSupportResultInfo result_info{};
// If enable_single_mode is enabled, player_count is 1 regardless of any other parameters.
@@ -250,7 +251,8 @@ void Controller::ConfigurationComplete() {
result_info.selected_id = static_cast<u32>(system.HIDCore().GetFirstNpadId());
- result_info.result = 0;
+ result_info.result =
+ is_success ? ControllerSupportResult::Success : ControllerSupportResult::Cancel;
LOG_DEBUG(Service_HID, "Result Info: player_count={}, selected_id={}, result={}",
result_info.player_count, result_info.selected_id, result_info.result);
diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/applets/applet_controller.h
index 1fbabee11..f6c64f633 100644
--- a/src/core/hle/service/am/applets/applet_controller.h
+++ b/src/core/hle/service/am/applets/applet_controller.h
@@ -48,6 +48,11 @@ enum class ControllerSupportCaller : u8 {
MaxControllerSupportCaller,
};
+enum class ControllerSupportResult : u32 {
+ Success = 0,
+ Cancel = 2,
+};
+
struct ControllerSupportArgPrivate {
u32 arg_private_size{};
u32 arg_size{};
@@ -112,7 +117,7 @@ struct ControllerSupportResultInfo {
s8 player_count{};
INSERT_PADDING_BYTES(3);
u32 selected_id{};
- u32 result{};
+ ControllerSupportResult result{};
};
static_assert(sizeof(ControllerSupportResultInfo) == 0xC,
"ControllerSupportResultInfo has incorrect size.");
@@ -131,7 +136,7 @@ public:
void Execute() override;
Result RequestExit() override;
- void ConfigurationComplete();
+ void ConfigurationComplete(bool is_success);
private:
const Core::Frontend::ControllerApplet& frontend;
diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp
index 07abc2563..89cb323e9 100644
--- a/src/core/hle/service/am/applets/applet_profile_select.cpp
+++ b/src/core/hle/service/am/applets/applet_profile_select.cpp
@@ -25,13 +25,29 @@ void ProfileSelect::Initialize() {
final_data.clear();
Applet::Initialize();
+ profile_select_version = ProfileSelectAppletVersion{common_args.library_version};
const auto user_config_storage = broker.PopNormalDataToApplet();
ASSERT(user_config_storage != nullptr);
const auto& user_config = user_config_storage->GetData();
- ASSERT(user_config.size() >= sizeof(UserSelectionConfig));
- std::memcpy(&config, user_config.data(), sizeof(UserSelectionConfig));
+ LOG_INFO(Service_AM, "Initializing Profile Select Applet with version={}",
+ profile_select_version);
+
+ switch (profile_select_version) {
+ case ProfileSelectAppletVersion::Version1:
+ ASSERT(user_config.size() == sizeof(UiSettingsV1));
+ std::memcpy(&config_old, user_config.data(), sizeof(UiSettingsV1));
+ break;
+ case ProfileSelectAppletVersion::Version2:
+ case ProfileSelectAppletVersion::Version3:
+ ASSERT(user_config.size() == sizeof(UiSettings));
+ std::memcpy(&config, user_config.data(), sizeof(UiSettings));
+ break;
+ default:
+ UNIMPLEMENTED_MSG("Unknown profile_select_version = {}", profile_select_version);
+ break;
+ }
}
bool ProfileSelect::TransactionComplete() const {
@@ -52,11 +68,37 @@ void ProfileSelect::Execute() {
return;
}
- frontend.SelectProfile([this](std::optional<Common::UUID> uuid) { SelectionComplete(uuid); });
+ Core::Frontend::ProfileSelectParameters parameters{};
+
+ switch (profile_select_version) {
+ case ProfileSelectAppletVersion::Version1:
+ parameters = {
+ .mode = config_old.mode,
+ .invalid_uid_list = config_old.invalid_uid_list,
+ .display_options = config_old.display_options,
+ .purpose = UserSelectionPurpose::General,
+ };
+ break;
+ case ProfileSelectAppletVersion::Version2:
+ case ProfileSelectAppletVersion::Version3:
+ parameters = {
+ .mode = config.mode,
+ .invalid_uid_list = config.invalid_uid_list,
+ .display_options = config.display_options,
+ .purpose = config.purpose,
+ };
+ break;
+ default:
+ UNIMPLEMENTED_MSG("Unknown profile_select_version = {}", profile_select_version);
+ break;
+ }
+
+ frontend.SelectProfile([this](std::optional<Common::UUID> uuid) { SelectionComplete(uuid); },
+ parameters);
}
void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
- UserSelectionOutput output{};
+ UiReturnArg output{};
if (uuid.has_value() && uuid->IsValid()) {
output.result = 0;
@@ -67,7 +109,7 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
output.uuid_selected = Common::InvalidUUID;
}
- final_data = std::vector<u8>(sizeof(UserSelectionOutput));
+ final_data = std::vector<u8>(sizeof(UiReturnArg));
std::memcpy(final_data.data(), &output, final_data.size());
broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data)));
broker.SignalStateChanged();
diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h
index 85705c216..369f9250f 100644
--- a/src/core/hle/service/am/applets/applet_profile_select.h
+++ b/src/core/hle/service/am/applets/applet_profile_select.h
@@ -16,19 +16,100 @@ class System;
namespace Service::AM::Applets {
-struct UserSelectionConfig {
- // TODO(DarkLordZach): RE this structure
- // It seems to be flags and the like that determine the UI of the applet on the switch... from
- // my research this is safe to ignore for now.
- INSERT_PADDING_BYTES(0xA0);
+enum class ProfileSelectAppletVersion : u32 {
+ Version1 = 0x1, // 1.0.0+
+ Version2 = 0x10000, // 2.0.0+
+ Version3 = 0x20000, // 6.0.0+
};
-static_assert(sizeof(UserSelectionConfig) == 0xA0, "UserSelectionConfig has incorrect size.");
-struct UserSelectionOutput {
+// This is nn::account::UiMode
+enum class UiMode {
+ UserSelector,
+ UserCreator,
+ EnsureNetworkServiceAccountAvailable,
+ UserIconEditor,
+ UserNicknameEditor,
+ UserCreatorForStarter,
+ NintendoAccountAuthorizationRequestContext,
+ IntroduceExternalNetworkServiceAccount,
+ IntroduceExternalNetworkServiceAccountForRegistration,
+ NintendoAccountNnidLinker,
+ LicenseRequirementsForNetworkService,
+ LicenseRequirementsForNetworkServiceWithUserContextImpl,
+ UserCreatorForImmediateNaLoginTest,
+ UserQualificationPromoter,
+};
+
+// This is nn::account::UserSelectionPurpose
+enum class UserSelectionPurpose {
+ General,
+ GameCardRegistration,
+ EShopLaunch,
+ EShopItemShow,
+ PicturePost,
+ NintendoAccountLinkage,
+ SettingsUpdate,
+ SaveDataDeletion,
+ UserMigration,
+ SaveDataTransfer,
+};
+
+// This is nn::account::NintendoAccountStartupDialogType
+enum class NintendoAccountStartupDialogType {
+ LoginAndCreate,
+ Login,
+ Create,
+};
+
+// This is nn::account::UserSelectionSettingsForSystemService
+struct UserSelectionSettingsForSystemService {
+ UserSelectionPurpose purpose;
+ bool enable_user_creation;
+ INSERT_PADDING_BYTES(0x3);
+};
+static_assert(sizeof(UserSelectionSettingsForSystemService) == 0x8,
+ "UserSelectionSettingsForSystemService has incorrect size.");
+
+struct UiSettingsDisplayOptions {
+ bool is_network_service_account_required;
+ bool is_skip_enabled;
+ bool is_system_or_launcher;
+ bool is_registration_permitted;
+ bool show_skip_button;
+ bool aditional_select;
+ bool show_user_selector;
+ bool is_unqualified_user_selectable;
+};
+static_assert(sizeof(UiSettingsDisplayOptions) == 0x8,
+ "UiSettingsDisplayOptions has incorrect size.");
+
+struct UiSettingsV1 {
+ UiMode mode;
+ INSERT_PADDING_BYTES(0x4);
+ std::array<Common::UUID, 8> invalid_uid_list;
+ u64 application_id;
+ UiSettingsDisplayOptions display_options;
+};
+static_assert(sizeof(UiSettingsV1) == 0x98, "UiSettings has incorrect size.");
+
+// This is nn::account::UiSettings
+struct UiSettings {
+ UiMode mode;
+ INSERT_PADDING_BYTES(0x4);
+ std::array<Common::UUID, 8> invalid_uid_list;
+ u64 application_id;
+ UiSettingsDisplayOptions display_options;
+ UserSelectionPurpose purpose;
+ INSERT_PADDING_BYTES(0x4);
+};
+static_assert(sizeof(UiSettings) == 0xA0, "UiSettings has incorrect size.");
+
+// This is nn::account::UiReturnArg
+struct UiReturnArg {
u64 result;
Common::UUID uuid_selected;
};
-static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size.");
+static_assert(sizeof(UiReturnArg) == 0x18, "UiReturnArg has incorrect size.");
class ProfileSelect final : public Applet {
public:
@@ -49,7 +130,10 @@ public:
private:
const Core::Frontend::ProfileSelectApplet& frontend;
- UserSelectionConfig config;
+ UiSettings config;
+ UiSettingsV1 config_old;
+ ProfileSelectAppletVersion profile_select_version;
+
bool complete = false;
Result status = ResultSuccess;
std::vector<u8> final_data;
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 21bd7b0c5..b070327ec 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -819,12 +819,12 @@ Controller_NPad::NpadCommunicationMode Controller_NPad::GetNpadCommunicationMode
return communication_mode;
}
-Result Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id,
- NpadJoyDeviceType npad_device_type,
- NpadJoyAssignmentMode assignment_mode) {
+bool Controller_NPad::SetNpadMode(Core::HID::NpadIdType& new_npad_id, Core::HID::NpadIdType npad_id,
+ NpadJoyDeviceType npad_device_type,
+ NpadJoyAssignmentMode assignment_mode) {
if (!IsNpadIdValid(npad_id)) {
LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id);
- return InvalidNpadId;
+ return false;
}
auto& controller = GetControllerFromNpadIdType(npad_id);
@@ -833,7 +833,7 @@ Result Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id,
}
if (!controller.device->IsConnected()) {
- return ResultSuccess;
+ return false;
}
if (assignment_mode == NpadJoyAssignmentMode::Dual) {
@@ -842,52 +842,52 @@ Result Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id,
controller.is_dual_left_connected = true;
controller.is_dual_right_connected = false;
UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id, true);
- return ResultSuccess;
+ return false;
}
if (controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight) {
DisconnectNpad(npad_id);
controller.is_dual_left_connected = false;
controller.is_dual_right_connected = true;
UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id, true);
- return ResultSuccess;
+ return false;
}
- return ResultSuccess;
+ return false;
}
// This is for NpadJoyAssignmentMode::Single
// Only JoyconDual get affected by this function
if (controller.device->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::JoyconDual) {
- return ResultSuccess;
+ return false;
}
if (controller.is_dual_left_connected && !controller.is_dual_right_connected) {
DisconnectNpad(npad_id);
UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconLeft, npad_id, true);
- return ResultSuccess;
+ return false;
}
if (!controller.is_dual_left_connected && controller.is_dual_right_connected) {
DisconnectNpad(npad_id);
UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconRight, npad_id, true);
- return ResultSuccess;
+ return false;
}
// We have two controllers connected to the same npad_id we need to split them
- const auto npad_id_2 = hid_core.GetFirstDisconnectedNpadId();
- auto& controller_2 = GetControllerFromNpadIdType(npad_id_2);
+ new_npad_id = hid_core.GetFirstDisconnectedNpadId();
+ auto& controller_2 = GetControllerFromNpadIdType(new_npad_id);
DisconnectNpad(npad_id);
if (npad_device_type == NpadJoyDeviceType::Left) {
UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconLeft, npad_id, true);
controller_2.is_dual_left_connected = false;
controller_2.is_dual_right_connected = true;
- UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id_2, true);
+ UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, new_npad_id, true);
} else {
UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconRight, npad_id, true);
controller_2.is_dual_left_connected = true;
controller_2.is_dual_right_connected = false;
- UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id_2, true);
+ UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, new_npad_id, true);
}
- return ResultSuccess;
+ return true;
}
bool Controller_NPad::VibrateControllerAtIndex(Core::HID::NpadIdType npad_id,
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index a5998c453..9cfe298f1 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -102,8 +102,8 @@ public:
void SetNpadCommunicationMode(NpadCommunicationMode communication_mode_);
NpadCommunicationMode GetNpadCommunicationMode() const;
- Result SetNpadMode(Core::HID::NpadIdType npad_id, NpadJoyDeviceType npad_device_type,
- NpadJoyAssignmentMode assignment_mode);
+ bool SetNpadMode(Core::HID::NpadIdType& new_npad_id, Core::HID::NpadIdType npad_id,
+ NpadJoyDeviceType npad_device_type, NpadJoyAssignmentMode assignment_mode);
bool VibrateControllerAtIndex(Core::HID::NpadIdType npad_id, std::size_t device_index,
const Core::HID::VibrationValue& vibration_value);
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 4529ad643..87e7b864a 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -302,7 +302,7 @@ Hid::Hid(Core::System& system_)
{130, &Hid::SwapNpadAssignment, "SwapNpadAssignment"},
{131, &Hid::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"},
{132, &Hid::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"},
- {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"},
+ {133, &Hid::SetNpadJoyAssignmentModeSingleWithDestination, "SetNpadJoyAssignmentModeSingleWithDestination"},
{134, &Hid::SetNpadAnalogStickUseCenterClamp, "SetNpadAnalogStickUseCenterClamp"},
{135, &Hid::SetNpadCaptureButtonAssignment, "SetNpadCaptureButtonAssignment"},
{136, &Hid::ClearNpadCaptureButtonAssignment, "ClearNpadCaptureButtonAssignment"},
@@ -1180,8 +1180,10 @@ void Hid::SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx) {
const auto parameters{rp.PopRaw<Parameters>()};
+ Core::HID::NpadIdType new_npad_id{};
auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad);
- controller.SetNpadMode(parameters.npad_id, Controller_NPad::NpadJoyDeviceType::Left,
+ controller.SetNpadMode(new_npad_id, parameters.npad_id,
+ Controller_NPad::NpadJoyDeviceType::Left,
Controller_NPad::NpadJoyAssignmentMode::Single);
LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id,
@@ -1203,8 +1205,9 @@ void Hid::SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx) {
const auto parameters{rp.PopRaw<Parameters>()};
+ Core::HID::NpadIdType new_npad_id{};
auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad);
- controller.SetNpadMode(parameters.npad_id, parameters.npad_joy_device_type,
+ controller.SetNpadMode(new_npad_id, parameters.npad_id, parameters.npad_joy_device_type,
Controller_NPad::NpadJoyAssignmentMode::Single);
LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}",
@@ -1226,8 +1229,10 @@ void Hid::SetNpadJoyAssignmentModeDual(HLERequestContext& ctx) {
const auto parameters{rp.PopRaw<Parameters>()};
+ Core::HID::NpadIdType new_npad_id{};
auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad);
- controller.SetNpadMode(parameters.npad_id, {}, Controller_NPad::NpadJoyAssignmentMode::Dual);
+ controller.SetNpadMode(new_npad_id, parameters.npad_id, {},
+ Controller_NPad::NpadJoyAssignmentMode::Dual);
LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id,
parameters.applet_resource_user_id);
@@ -1369,6 +1374,34 @@ void Hid::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx) {
rb.Push(result);
}
+void Hid::SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ struct Parameters {
+ Core::HID::NpadIdType npad_id;
+ INSERT_PADDING_WORDS_NOINIT(1);
+ u64 applet_resource_user_id;
+ Controller_NPad::NpadJoyDeviceType npad_joy_device_type;
+ };
+ static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size.");
+
+ const auto parameters{rp.PopRaw<Parameters>()};
+
+ Core::HID::NpadIdType new_npad_id{};
+ auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad);
+ const auto is_reassigned =
+ controller.SetNpadMode(new_npad_id, parameters.npad_id, parameters.npad_joy_device_type,
+ Controller_NPad::NpadJoyAssignmentMode::Single);
+
+ LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}",
+ parameters.npad_id, parameters.applet_resource_user_id,
+ parameters.npad_joy_device_type);
+
+ IPC::ResponseBuilder rb{ctx, 4};
+ rb.Push(ResultSuccess);
+ rb.Push(is_reassigned);
+ rb.PushEnum(new_npad_id);
+}
+
void Hid::SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
struct Parameters {
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index c69e5f3fb..f247b83c2 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -151,6 +151,7 @@ private:
void SwapNpadAssignment(HLERequestContext& ctx);
void IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx);
void EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx);
+ void SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx);
void SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx);
void SetNpadCaptureButtonAssignment(HLERequestContext& ctx);
void ClearNpadCaptureButtonAssignment(HLERequestContext& ctx);
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp
index 486d4dfaf..336f53700 100644
--- a/src/video_core/vulkan_common/vulkan_wrapper.cpp
+++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp
@@ -375,6 +375,8 @@ const char* ToString(VkResult result) noexcept {
return "VK_RESULT_MAX_ENUM";
case VkResult::VK_ERROR_COMPRESSION_EXHAUSTED_EXT:
return "VK_ERROR_COMPRESSION_EXHAUSTED_EXT";
+ case VkResult::VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT:
+ return "VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT";
}
return "Unknown";
}
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index 79018a7f6..00aafb8f8 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -300,7 +300,7 @@ bool QtControllerSelectorDialog::CheckIfParametersMet() {
if (num_connected_players < min_supported_players ||
num_connected_players > max_supported_players) {
parameters_met = false;
- ui->buttonBox->setEnabled(parameters_met);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(parameters_met);
return parameters_met;
}
@@ -327,7 +327,7 @@ bool QtControllerSelectorDialog::CheckIfParametersMet() {
}();
parameters_met = all_controllers_compatible;
- ui->buttonBox->setEnabled(parameters_met);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(parameters_met);
return parameters_met;
}
@@ -697,8 +697,8 @@ void QtControllerSelector::ReconfigureControllers(
emit MainWindowReconfigureControllers(parameters);
}
-void QtControllerSelector::MainWindowReconfigureFinished() {
+void QtControllerSelector::MainWindowReconfigureFinished(bool is_success) {
if (callback) {
- callback();
+ callback(is_success);
}
}
diff --git a/src/yuzu/applets/qt_controller.h b/src/yuzu/applets/qt_controller.h
index 2ef7e488f..2fdc35857 100644
--- a/src/yuzu/applets/qt_controller.h
+++ b/src/yuzu/applets/qt_controller.h
@@ -167,7 +167,7 @@ signals:
void MainWindowRequestExit() const;
private:
- void MainWindowReconfigureFinished();
+ void MainWindowReconfigureFinished(bool is_success);
mutable ReconfigureCallback callback;
};
diff --git a/src/yuzu/applets/qt_controller.ui b/src/yuzu/applets/qt_controller.ui
index f5eccba70..729e921ee 100644
--- a/src/yuzu/applets/qt_controller.ui
+++ b/src/yuzu/applets/qt_controller.ui
@@ -2629,7 +2629,7 @@
<bool>true</bool>
</property>
<property name="standardButtons">
- <set>QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@@ -2649,5 +2649,11 @@
<receiver>QtControllerSelectorDialog</receiver>
<slot>accept()</slot>
</connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>QtControllerSelectorDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
</connections>
</ui>
diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp
index c0a1d5ab7..2448e46b6 100644
--- a/src/yuzu/applets/qt_profile_select.cpp
+++ b/src/yuzu/applets/qt_profile_select.cpp
@@ -46,11 +46,13 @@ QPixmap GetIcon(Common::UUID uuid) {
}
} // Anonymous namespace
-QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent)
+QtProfileSelectionDialog::QtProfileSelectionDialog(
+ Core::HID::HIDCore& hid_core, QWidget* parent,
+ const Core::Frontend::ProfileSelectParameters& parameters)
: QDialog(parent), profile_manager(std::make_unique<Service::Account::ProfileManager>()) {
outer_layout = new QVBoxLayout;
- instruction_label = new QLabel(tr("Select a user:"));
+ instruction_label = new QLabel();
scroll_area = new QScrollArea;
@@ -120,7 +122,8 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core,
item_model->appendRow(item);
setLayout(outer_layout);
- setWindowTitle(tr("Profile Selector"));
+ SetWindowTitle(parameters);
+ SetDialogPurpose(parameters);
resize(550, 400);
}
@@ -154,6 +157,76 @@ void QtProfileSelectionDialog::SelectUser(const QModelIndex& index) {
user_index = index.row();
}
+void QtProfileSelectionDialog::SetWindowTitle(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ using Service::AM::Applets::UiMode;
+ switch (parameters.mode) {
+ case UiMode::UserCreator:
+ case UiMode::UserCreatorForStarter:
+ setWindowTitle(tr("Profile Creator"));
+ return;
+ case UiMode::EnsureNetworkServiceAccountAvailable:
+ setWindowTitle(tr("Profile Selector"));
+ return;
+ case UiMode::UserIconEditor:
+ setWindowTitle(tr("Profile Icon Editor"));
+ return;
+ case UiMode::UserNicknameEditor:
+ setWindowTitle(tr("Profile Nickname Editor"));
+ return;
+ case UiMode::NintendoAccountAuthorizationRequestContext:
+ case UiMode::IntroduceExternalNetworkServiceAccount:
+ case UiMode::IntroduceExternalNetworkServiceAccountForRegistration:
+ case UiMode::NintendoAccountNnidLinker:
+ case UiMode::LicenseRequirementsForNetworkService:
+ case UiMode::LicenseRequirementsForNetworkServiceWithUserContextImpl:
+ case UiMode::UserCreatorForImmediateNaLoginTest:
+ case UiMode::UserQualificationPromoter:
+ case UiMode::UserSelector:
+ default:
+ setWindowTitle(tr("Profile Selector"));
+ }
+}
+
+void QtProfileSelectionDialog::SetDialogPurpose(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ using Service::AM::Applets::UserSelectionPurpose;
+
+ switch (parameters.purpose) {
+ case UserSelectionPurpose::GameCardRegistration:
+ instruction_label->setText(tr("Who will receive the points?"));
+ return;
+ case UserSelectionPurpose::EShopLaunch:
+ instruction_label->setText(tr("Who is using Nintendo eShop?"));
+ return;
+ case UserSelectionPurpose::EShopItemShow:
+ instruction_label->setText(tr("Who is making this purchase?"));
+ return;
+ case UserSelectionPurpose::PicturePost:
+ instruction_label->setText(tr("Who is posting?"));
+ return;
+ case UserSelectionPurpose::NintendoAccountLinkage:
+ instruction_label->setText(tr("Select a user to link to a Nintendo Account."));
+ return;
+ case UserSelectionPurpose::SettingsUpdate:
+ instruction_label->setText(tr("Change settings for which user?"));
+ return;
+ case UserSelectionPurpose::SaveDataDeletion:
+ instruction_label->setText(tr("Format data for which user?"));
+ return;
+ case UserSelectionPurpose::UserMigration:
+ instruction_label->setText(tr("Which user will be transferred to another console?"));
+ return;
+ case UserSelectionPurpose::SaveDataTransfer:
+ instruction_label->setText(tr("Send save data for which user?"));
+ return;
+ case UserSelectionPurpose::General:
+ default:
+ instruction_label->setText(tr("Select a user:"));
+ return;
+ }
+}
+
QtProfileSelector::QtProfileSelector(GMainWindow& parent) {
connect(this, &QtProfileSelector::MainWindowSelectProfile, &parent,
&GMainWindow::ProfileSelectorSelectProfile, Qt::QueuedConnection);
@@ -170,9 +243,11 @@ void QtProfileSelector::Close() const {
emit MainWindowRequestExit();
}
-void QtProfileSelector::SelectProfile(SelectProfileCallback callback_) const {
+void QtProfileSelector::SelectProfile(
+ SelectProfileCallback callback_,
+ const Core::Frontend::ProfileSelectParameters& parameters) const {
callback = std::move(callback_);
- emit MainWindowSelectProfile();
+ emit MainWindowSelectProfile(parameters);
}
void QtProfileSelector::MainWindowFinishedSelection(std::optional<Common::UUID> uuid) {
diff --git a/src/yuzu/applets/qt_profile_select.h b/src/yuzu/applets/qt_profile_select.h
index 9f214d071..99056e274 100644
--- a/src/yuzu/applets/qt_profile_select.h
+++ b/src/yuzu/applets/qt_profile_select.h
@@ -28,7 +28,8 @@ class QtProfileSelectionDialog final : public QDialog {
Q_OBJECT
public:
- explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent);
+ explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent,
+ const Core::Frontend::ProfileSelectParameters& parameters);
~QtProfileSelectionDialog() override;
int exec() override;
@@ -40,6 +41,9 @@ public:
private:
void SelectUser(const QModelIndex& index);
+ void SetWindowTitle(const Core::Frontend::ProfileSelectParameters& parameters);
+ void SetDialogPurpose(const Core::Frontend::ProfileSelectParameters& parameters);
+
int user_index = 0;
QVBoxLayout* layout;
@@ -66,10 +70,11 @@ public:
~QtProfileSelector() override;
void Close() const override;
- void SelectProfile(SelectProfileCallback callback_) const override;
+ void SelectProfile(SelectProfileCallback callback_,
+ const Core::Frontend::ProfileSelectParameters& parameters) const override;
signals:
- void MainWindowSelectProfile() const;
+ void MainWindowSelectProfile(const Core::Frontend::ProfileSelectParameters& parameters) const;
void MainWindowRequestExit() const;
private:
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 0c60a90cb..b79409a68 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -576,6 +576,10 @@ void GMainWindow::RegisterMetaTypes() {
// Controller Applet
qRegisterMetaType<Core::Frontend::ControllerParameters>("Core::Frontend::ControllerParameters");
+ // Profile Select Applet
+ qRegisterMetaType<Core::Frontend::ProfileSelectParameters>(
+ "Core::Frontend::ProfileSelectParameters");
+
// Software Keyboard Applet
qRegisterMetaType<Core::Frontend::KeyboardInitializeParameters>(
"Core::Frontend::KeyboardInitializeParameters");
@@ -634,15 +638,16 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
Qt::WindowStaysOnTopHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint);
controller_applet->setWindowModality(Qt::WindowModal);
- controller_applet->exec();
-
- emit ControllerSelectorReconfigureFinished();
+ bool is_success = controller_applet->exec() != QDialog::Rejected;
// Don't forget to apply settings.
+ system->HIDCore().DisableAllControllerConfiguration();
system->ApplySettings();
config->Save();
UpdateStatusButtons();
+
+ emit ControllerSelectorReconfigureFinished(is_success);
}
void GMainWindow::ControllerSelectorRequestExit() {
@@ -651,8 +656,9 @@ void GMainWindow::ControllerSelectorRequestExit() {
}
}
-void GMainWindow::ProfileSelectorSelectProfile() {
- profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this);
+void GMainWindow::ProfileSelectorSelectProfile(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this, parameters);
SCOPE_EXIT({
profile_select_applet->deleteLater();
profile_select_applet = nullptr;
@@ -1719,8 +1725,9 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
return true;
}
-bool GMainWindow::SelectAndSetCurrentUser() {
- QtProfileSelectionDialog dialog(system->HIDCore(), this);
+bool GMainWindow::SelectAndSetCurrentUser(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
@@ -1766,7 +1773,13 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
Settings::LogSettings();
if (UISettings::values.select_user_on_boot) {
- if (SelectAndSetCurrentUser() == false) {
+ const Core::Frontend::ProfileSelectParameters parameters{
+ .mode = Service::AM::Applets::UiMode::UserSelector,
+ .invalid_uid_list = {},
+ .display_options = {},
+ .purpose = Service::AM::Applets::UserSelectionPurpose::General,
+ };
+ if (SelectAndSetCurrentUser(parameters) == false) {
return;
}
}
@@ -2058,7 +2071,13 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
if (has_user_save) {
// User save data
const auto select_profile = [this] {
- QtProfileSelectionDialog dialog(system->HIDCore(), this);
+ const Core::Frontend::ProfileSelectParameters parameters{
+ .mode = Service::AM::Applets::UiMode::UserSelector,
+ .invalid_uid_list = {},
+ .display_options = {},
+ .purpose = Service::AM::Applets::UserSelectionPurpose::General,
+ };
+ QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index a99938eaa..8b5c1d747 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -69,6 +69,7 @@ struct ControllerParameters;
struct InlineAppearParameters;
struct InlineTextParameters;
struct KeyboardInitializeParameters;
+struct ProfileSelectParameters;
} // namespace Core::Frontend
namespace DiscordRPC {
@@ -165,7 +166,7 @@ signals:
void AmiiboSettingsFinished(bool is_success, const std::string& name);
- void ControllerSelectorReconfigureFinished();
+ void ControllerSelectorReconfigureFinished(bool is_success);
void ErrorDisplayFinished();
@@ -203,7 +204,7 @@ public slots:
void SoftwareKeyboardExit();
void ErrorDisplayDisplayError(QString error_code, QString error_text);
void ErrorDisplayRequestExit();
- void ProfileSelectorSelectProfile();
+ void ProfileSelectorSelectProfile(const Core::Frontend::ProfileSelectParameters& parameters);
void ProfileSelectorRequestExit();
void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args,
bool is_local);
@@ -242,7 +243,7 @@ private:
void SetDiscordEnabled(bool state);
void LoadAmiibo(const QString& filename);
- bool SelectAndSetCurrentUser();
+ bool SelectAndSetCurrentUser(const Core::Frontend::ProfileSelectParameters& parameters);
/**
* Stores the filename in the recently loaded files list.