diff options
| author | swurl <swurl@swurl.xyz> | 2025-05-11 23:58:25 +0000 |
|---|---|---|
| committer | crueter <crueter@noreply.localhost> | 2025-05-11 23:58:25 +0000 |
| commit | 7e943732bf025bb7ead5ee3e104b88c020f9f422 (patch) | |
| tree | 0f1a403b8f44190c90f9b4fab0a8de188237f735 /src/yuzu/migration_worker.cpp | |
| parent | 5bbb9eba32734219cd9b57dfeefaa028b1e8ab02 (diff) | |
fix a large variety of issues (#101)
- GLASM/SPIR-V mixup on Android
- potential greenscreen fix (thx suyu)
- save memory layout and add 10gb/12gb options
- potential samsung gaming hub fix
- fix layout of controller UI
- fix default settings to sensible defaults.
- note to TotK that you should increase memory layout
- Error checking for Windows linking
- fix an IDE error
- improved migration system w/threading and busy indicator
- disabled citron migration for now
- replaced some user-facing legacy strings with eden
- Added 10GB and 12GB DRAM layouts
- Fix Android black screen issues
- add discord link & update FAQ/Quickstart
- update links in about page
- add back rich presence
- add Don't show again for desktop pre alpha banner
- add citron warning to android and polaris to desktop
Signed-off-by: swurl <swurl@swurl.xyz>
Co-authored-by: Pavel Barabanov <pavelbarabanov94@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/101
Co-authored-by: swurl <swurl@swurl.xyz>
Co-committed-by: swurl <swurl@swurl.xyz>
Diffstat (limited to 'src/yuzu/migration_worker.cpp')
| -rw-r--r-- | src/yuzu/migration_worker.cpp | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/yuzu/migration_worker.cpp b/src/yuzu/migration_worker.cpp new file mode 100644 index 0000000000..2bb6eee944 --- /dev/null +++ b/src/yuzu/migration_worker.cpp @@ -0,0 +1,123 @@ +#include "migration_worker.h" + +#include <filesystem> + +#include "common/fs/path_util.h" + +MigrationWorker::MigrationWorker(const LegacyEmu selected_legacy_emu_, + const bool clear_shader_cache_, + const MigrationStrategy strategy_) + : QObject() + , selected_legacy_emu(selected_legacy_emu_) + , clear_shader_cache(clear_shader_cache_) + , strategy(strategy_) +{} + +void MigrationWorker::process() +{ + namespace fs = std::filesystem; + const auto copy_options = fs::copy_options::update_existing | fs::copy_options::recursive; + + std::string legacy_user_dir; + std::string legacy_config_dir; + std::string legacy_cache_dir; + +#define LEGACY_EMU(emu) \ + case LegacyEmu::emu: \ + legacy_user_dir = Common::FS::GetLegacyPath(Common::FS::LegacyPath::emu##Dir).string(); \ + legacy_config_dir = Common::FS::GetLegacyPath(Common::FS::LegacyPath::emu##ConfigDir) \ + .string(); \ + legacy_cache_dir = Common::FS::GetLegacyPath(Common::FS::LegacyPath::emu##CacheDir) \ + .string(); \ + break; + + switch (selected_legacy_emu) { + LEGACY_EMU(Citron) + LEGACY_EMU(Sudachi) + LEGACY_EMU(Yuzu) + LEGACY_EMU(Suyu) + } + +#undef LEGACY_EMU + + fs::path eden_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::EdenDir); + fs::path config_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir); + fs::path cache_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::CacheDir); + fs::path shader_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ShaderDir); + + try { + fs::remove_all(eden_dir); + } catch (fs::filesystem_error &_) { + // ignore because linux does stupid crap sometimes. + } + + switch (strategy) { + case MigrationStrategy::Link: + // Create symlinks/directory junctions if requested + + // Windows 11 has random permission nonsense to deal with. + try { + fs::create_directory_symlink(legacy_user_dir, eden_dir); + } catch (const fs::filesystem_error &e) { + emit error(tr("Linking the old directory failed. You may need to re-run with " + "administrative privileges on Windows.\nOS gave error: %1") + .arg(tr(e.what()))); + return; + } + +// Windows doesn't need any more links, because cache and config +// are already children of the root directory +#ifndef WIN32 + if (fs::is_directory(legacy_config_dir)) { + fs::create_directory_symlink(legacy_config_dir, config_dir); + } + + if (fs::is_directory(legacy_cache_dir)) { + fs::create_directory_symlink(legacy_cache_dir, cache_dir); + } +#endif + break; + case MigrationStrategy::Move: + // Rename directories if deletion is requested (achieves the same result) + fs::rename(legacy_user_dir, eden_dir); + +// Windows doesn't need any more renames, because cache and config +// are already children of the root directory +#ifndef WIN32 + if (fs::is_directory(legacy_config_dir)) { + fs::rename(legacy_config_dir, config_dir); + } + + if (fs::is_directory(legacy_cache_dir)) { + fs::rename(legacy_cache_dir, cache_dir); + } +#endif + break; + case MigrationStrategy::Copy: + default: + // Default behavior: copy + fs::copy(legacy_user_dir, eden_dir, copy_options); + + if (fs::is_directory(legacy_config_dir)) { + fs::copy(legacy_config_dir, config_dir, copy_options); + } + + if (fs::is_directory(legacy_cache_dir)) { + fs::copy(legacy_cache_dir, cache_dir, copy_options); + } + + success_text.append(tr("\n\nIf you wish to clean up the files which were left in the old " + "data location, you can do so by deleting the following directory:\n" + "%1") + .arg(QString::fromStdString(legacy_user_dir))); + break; + } + + // Delete and re-create shader dir + if (clear_shader_cache) { + fs::remove_all(shader_dir); + fs::create_directory(shader_dir); + } + + emit finished(success_text); +} |
