diff options
| author | crueter <swurl@swurl.xyz> | 2025-06-11 22:57:13 +0000 |
|---|---|---|
| committer | crueter <crueter@noreply.localhost> | 2025-06-11 22:57:13 +0000 |
| commit | c4ca8d2367e3283e2adcc37833376d68b2ece6fc (patch) | |
| tree | 88d9dc9a3a112ac4fb2ad2f6854515e9b7e97ebc /src/yuzu/migration_worker.h | |
| parent | 8ff1b9d282a9a7a8a02df86eecf19dbbd8440557 (diff) | |
Properly migrate internal NAND, Load, etc. directories (#167)
Signed-off-by: crueter <swurl@swurl.xyz>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/167
Co-authored-by: crueter <swurl@swurl.xyz>
Co-committed-by: crueter <swurl@swurl.xyz>
Diffstat (limited to 'src/yuzu/migration_worker.h')
| -rw-r--r-- | src/yuzu/migration_worker.h | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/src/yuzu/migration_worker.h b/src/yuzu/migration_worker.h index 49bb695b32..205e552a94 100644 --- a/src/yuzu/migration_worker.h +++ b/src/yuzu/migration_worker.h @@ -2,25 +2,58 @@ #define MIGRATION_WORKER_H #include <QObject> +#include "common/fs/path_util.h" + +using namespace Common::FS; + +typedef struct Emulator { + const char *name; + + LegacyPath e_user_dir; + LegacyPath e_config_dir; + LegacyPath e_cache_dir; + + const std::string get_user_dir() const { + return Common::FS::GetLegacyPath(e_user_dir).string(); + } + + const std::string get_config_dir() const { + return Common::FS::GetLegacyPath(e_config_dir).string(); + } + + const std::string get_cache_dir() const { + return Common::FS::GetLegacyPath(e_cache_dir).string(); + } + + const std::string lower_name() const { + std::string lower_name{name}; + std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), + [](unsigned char c){ return std::tolower(c); }); + + return lower_name; + } +} Emulator; + +#define EMU(name) Emulator{#name, name##Dir, name##ConfigDir, name##CacheDir} +static constexpr std::array<Emulator, 4> legacy_emus = { + EMU(Citron), + EMU(Sudachi), + EMU(Suyu), + EMU(Yuzu), +}; +#undef EMU class MigrationWorker : public QObject { Q_OBJECT public: - enum class LegacyEmu { - Citron, - Sudachi, - Yuzu, - Suyu, - }; - enum class MigrationStrategy { Copy, Move, Link, }; - MigrationWorker(const LegacyEmu selected_legacy_emu, + MigrationWorker(const Emulator selected_legacy_emu, const bool clear_shader_cache, const MigrationStrategy strategy); @@ -28,11 +61,11 @@ public slots: void process(); signals: - void finished(const QString &success_text); + void finished(const QString &success_text, const std::string &user_dir); void error(const QString &error_message); private: - LegacyEmu selected_legacy_emu; + Emulator selected_legacy_emu; bool clear_shader_cache; MigrationStrategy strategy; QString success_text = tr("Data was migrated successfully."); |
