mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-15 11:08: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>
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "qt_common/abstract/frontend.h"
|
|
#include "ryujinx_dialog.h"
|
|
#include "qt_common/util/fs.h"
|
|
#include "ui_ryujinx_dialog.h"
|
|
#include <filesystem>
|
|
|
|
RyujinxDialog::RyujinxDialog(std::filesystem::path eden_path,
|
|
std::filesystem::path ryu_path,
|
|
QWidget *parent)
|
|
: QDialog(parent)
|
|
, ui(new Ui::RyujinxDialog)
|
|
, m_eden(eden_path.make_preferred())
|
|
, m_ryu(ryu_path.make_preferred())
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
connect(ui->eden, &QPushButton::clicked, this, &RyujinxDialog::fromEden);
|
|
connect(ui->ryujinx, &QPushButton::clicked, this, &RyujinxDialog::fromRyujinx);
|
|
connect(ui->cancel, &QPushButton::clicked, this, &RyujinxDialog::reject);
|
|
}
|
|
|
|
RyujinxDialog::~RyujinxDialog()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void RyujinxDialog::fromEden()
|
|
{
|
|
accept();
|
|
|
|
// Workaround: Ryujinx deletes and re-creates its directory structure???
|
|
// So we just copy Eden's data to Ryujinx and then link the other way
|
|
namespace fs = std::filesystem;
|
|
try {
|
|
fs::remove_all(m_ryu);
|
|
fs::create_directories(m_ryu);
|
|
fs::copy(m_eden, m_ryu, fs::copy_options::recursive);
|
|
} catch (std::exception &e) {
|
|
QtCommon::Frontend::Critical(tr("Failed to link save data"),
|
|
tr("OS returned error: %1").arg(QString::fromStdString(e.what())));
|
|
}
|
|
|
|
// ?ploo
|
|
QtCommon::FS::LinkRyujinx(m_ryu, m_eden);
|
|
}
|
|
|
|
void RyujinxDialog::fromRyujinx()
|
|
{
|
|
accept();
|
|
QtCommon::FS::LinkRyujinx(m_ryu, m_eden);
|
|
}
|