mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 05:28:56 +02:00
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>
73 lines
1.9 KiB
C++
73 lines
1.9 KiB
C++
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#ifndef MIGRATION_WORKER_H
|
|
#define MIGRATION_WORKER_H
|
|
|
|
#include <QObject>
|
|
#include "common/fs/path_util.h"
|
|
|
|
typedef struct Emulator {
|
|
const char *m_name;
|
|
|
|
Common::FS::EmuPath e_user_dir;
|
|
Common::FS::EmuPath e_config_dir;
|
|
Common::FS::EmuPath 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 QString name() const { return QObject::tr(m_name);
|
|
}
|
|
|
|
const QString lower_name() const { return name().toLower();
|
|
}
|
|
} Emulator;
|
|
|
|
#define STRUCT_EMU(name, enumName) Emulator{name, Common::FS::enumName##Dir, Common::FS::enumName##ConfigDir, Common::FS::enumName##CacheDir}
|
|
|
|
static constexpr std::array<Emulator, 4> legacy_emus = {
|
|
STRUCT_EMU(QT_TR_NOOP("Citron"), Citron),
|
|
STRUCT_EMU(QT_TR_NOOP("Sudachi"), Sudachi),
|
|
STRUCT_EMU(QT_TR_NOOP("Suyu"), Suyu),
|
|
STRUCT_EMU(QT_TR_NOOP("Yuzu"), Yuzu),
|
|
};
|
|
|
|
class MigrationWorker : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum class MigrationStrategy {
|
|
Copy,
|
|
Move,
|
|
Link,
|
|
};
|
|
|
|
MigrationWorker(const Emulator selected_emu,
|
|
const bool clear_shader_cache,
|
|
const MigrationStrategy strategy);
|
|
|
|
public slots:
|
|
void process();
|
|
|
|
signals:
|
|
void finished(const QString &success_text, const std::string &user_dir);
|
|
void error(const QString &error_message);
|
|
|
|
private:
|
|
Emulator selected_emu;
|
|
bool clear_shader_cache;
|
|
MigrationStrategy strategy;
|
|
QString success_text = tr("Data was migrated successfully.");
|
|
};
|
|
|
|
#endif // MIGRATION_WORKER_H
|