diff options
| author | crueter <crueter@eden-emu.dev> | 2025-11-09 18:07:38 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-11-09 18:07:38 +0100 |
| commit | 08f3639c80f188a3efd7ed1277b0bf8baaa33681 (patch) | |
| tree | 800e528a84e5bd2e905c1f1fed69bd460475021b /src/yuzu/util/util.cpp | |
| parent | e13c7ef3f80f04e710a9c620d7ec44dd37110b59 (diff) | |
[desktop, fs] main_window separation; fix Ryujinx save data link issues (#2929)
Some genius decided to put the entire MainWindow class into main.h and
main.cpp, which is not only horrific practice but also completely
destroys clangd beyond repair. Please, just don't do this.
(this will probably merge conflict to hell and back)
Also, fixes a bunch of issues with Ryujinx save data link:
- Paths with spaces would cause mklink to fail
- Add support for portable directories
- Symlink detection was incorrect sometimes(????)
- Some other stuff I'm forgetting
Furthermore, when selecting "From Eden" and attempting to save in Ryujinx, Ryujinx would destroy the link for... some reason? So to get around this we just copy the Eden data to Ryujinx then treat it like a "From Ryujinx" op
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2929
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/yuzu/util/util.cpp')
| -rw-r--r-- | src/yuzu/util/util.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/yuzu/util/util.cpp b/src/yuzu/util/util.cpp index 844da5c401..0c035e5058 100644 --- a/src/yuzu/util/util.cpp +++ b/src/yuzu/util/util.cpp @@ -8,7 +8,11 @@ #include <cmath> #include <QPainter> +#include "applets/qt_profile_select.h" #include "common/logging/log.h" +#include "core/frontend/applets/profile_select.h" +#include "core/hle/service/acc/profile_manager.h" +#include "qt_common/qt_common.h" #include "yuzu/util/util.h" #ifdef _WIN32 @@ -153,3 +157,49 @@ bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image) return false; #endif } +const std::optional<Common::UUID> GetProfileID() { + // if there's only a single profile, the user probably wants to use that... right? + const auto& profiles = QtCommon::system->GetProfileManager().FindExistingProfileUUIDs(); + if (profiles.size() == 1) { + return profiles[0]; + } + + const auto select_profile = [] { + const Core::Frontend::ProfileSelectParameters parameters{ + .mode = Service::AM::Frontend::UiMode::UserSelector, + .invalid_uid_list = {}, + .display_options = {}, + .purpose = Service::AM::Frontend::UserSelectionPurpose::General, + }; + QtProfileSelectionDialog dialog(*QtCommon::system, QtCommon::rootObject, parameters); + dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | + Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); + dialog.setWindowModality(Qt::WindowModal); + + if (dialog.exec() == QDialog::Rejected) { + return -1; + } + + return dialog.GetIndex(); + }; + + const auto index = select_profile(); + if (index == -1) { + return std::nullopt; + } + + const auto uuid = + QtCommon::system->GetProfileManager().GetUser(static_cast<std::size_t>(index)); + ASSERT(uuid); + + return uuid; +} +std::string GetProfileIDString() { + const auto uuid = GetProfileID(); + if (!uuid) + return ""; + + auto user_id = uuid->AsU128(); + + return fmt::format("{:016X}{:016X}", user_id[1], user_id[0]); +} |
