2024-07-30 11:42:36 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: GPL-3.0+
|
2022-08-28 21:31:19 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QtWidgets/QDialog>
|
|
|
|
|
|
|
|
#include "common/FileSystem.h"
|
|
|
|
|
|
|
|
#include "ui_MemoryCardConvertDialog.h"
|
|
|
|
|
|
|
|
#include "MemoryCardConvertWorker.h"
|
|
|
|
|
2023-06-11 06:06:40 +00:00
|
|
|
#include "pcsx2/SIO/Memcard/MemoryCardFile.h"
|
2022-08-28 21:31:19 +00:00
|
|
|
|
|
|
|
class MemoryCardConvertDialog final : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MemoryCardConvertDialog(QWidget* parent, QString selectedCard);
|
|
|
|
~MemoryCardConvertDialog();
|
|
|
|
|
|
|
|
bool IsSetup();
|
|
|
|
void onStatusUpdated();
|
|
|
|
void onProgressUpdated(int value, int range);
|
|
|
|
void onThreadFinished();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void ConvertCard();
|
|
|
|
void ConvertCallback();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void StartThread();
|
|
|
|
void CancelThread();
|
|
|
|
void UpdateEnabled();
|
|
|
|
bool SetupPicklist();
|
|
|
|
void SetType(MemoryCardType type, MemoryCardFileType fileType, const QString& description);
|
|
|
|
void SetType_8();
|
|
|
|
void SetType_16();
|
|
|
|
void SetType_32();
|
|
|
|
void SetType_64();
|
|
|
|
void SetType_Folder();
|
2024-09-17 00:18:51 +00:00
|
|
|
void FileOpenError(const QString errmsg);
|
2022-08-28 21:31:19 +00:00
|
|
|
|
|
|
|
Ui::MemoryCardConvertDialog m_ui;
|
|
|
|
|
|
|
|
bool isSetup = false;
|
|
|
|
AvailableMcdInfo m_srcCardInfo;
|
|
|
|
QString m_selectedCard;
|
|
|
|
QString m_destCardName;
|
|
|
|
|
|
|
|
MemoryCardType m_type = MemoryCardType::File;
|
|
|
|
MemoryCardFileType m_fileType = MemoryCardFileType::PS2_8MB;
|
|
|
|
std::unique_ptr<MemoryCardConvertWorker> m_thread;
|
|
|
|
|
|
|
|
static constexpr u32 FLAGS = FILESYSTEM_FIND_RECURSIVE | FILESYSTEM_FIND_FOLDERS | FILESYSTEM_FIND_FILES;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Card capacities computed from freshly formatted superblocks.
|
|
|
|
namespace CardCapacity
|
|
|
|
{
|
|
|
|
static constexpr size_t _8_MB = 0x1f40 * 512 * 2; //(0x1fc7 - 0x29) * 2 * 512;
|
|
|
|
static constexpr size_t _16_MB = 0x3e80 * 512 * 2; //(0x3fa7 - 0x49) * 2 * 512;
|
|
|
|
static constexpr size_t _32_MB = 0x7d00 * 512 * 2; //(0x7f67 - 0x89) * 2 * 512;
|
|
|
|
static constexpr size_t _64_MB = 0xfde8 * 512 * 2; //(0xfee7 - 0x0109) * 2 * 512;
|
|
|
|
}
|