Allow import/export of .pub/.prv/.bnr saves (#1558)

This commit is contained in:
Pk11 2022-11-07 09:03:00 -06:00 committed by GitHub
parent ca19ea1ce8
commit 31a0d7ecd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 5 deletions

View File

@ -266,12 +266,22 @@ void TitleManagerDialog::onImportTitleData()
return; return;
} }
QString extensions = "*.sav";
u32 wantedsize; u32 wantedsize;
switch (type) switch (type)
{ {
case DSi_NAND::TitleData_PublicSav: wantedsize = cur->data(Qt::UserRole+1).toUInt(); break; case DSi_NAND::TitleData_PublicSav:
case DSi_NAND::TitleData_PrivateSav: wantedsize = cur->data(Qt::UserRole+2).toUInt(); break; extensions += " *.pub";
case DSi_NAND::TitleData_BannerSav: wantedsize = cur->data(Qt::UserRole+3).toUInt(); break; wantedsize = cur->data(Qt::UserRole+1).toUInt();
break;
case DSi_NAND::TitleData_PrivateSav:
extensions += " *.prv";
wantedsize = cur->data(Qt::UserRole+2).toUInt();
break;
case DSi_NAND::TitleData_BannerSav:
extensions += " *.bnr";
wantedsize = cur->data(Qt::UserRole+3).toUInt();
break;
default: default:
printf("what??\n"); printf("what??\n");
return; return;
@ -280,7 +290,7 @@ void TitleManagerDialog::onImportTitleData()
QString file = QFileDialog::getOpenFileName(this, QString file = QFileDialog::getOpenFileName(this,
"Select file to import...", "Select file to import...",
QString::fromStdString(EmuDirectory), QString::fromStdString(EmuDirectory),
"Title data files (*.sav);;Any file (*.*)"); "Title data files (" + extensions + ");;Any file (*.*)");
if (file.isEmpty()) return; if (file.isEmpty()) return;
@ -327,19 +337,23 @@ void TitleManagerDialog::onExportTitleData()
} }
QString exportname; QString exportname;
QString extensions = "*.sav";
u32 wantedsize; u32 wantedsize;
switch (type) switch (type)
{ {
case DSi_NAND::TitleData_PublicSav: case DSi_NAND::TitleData_PublicSav:
exportname = "/public.sav"; exportname = "/public.sav";
extensions += " *.pub";
wantedsize = cur->data(Qt::UserRole+1).toUInt(); wantedsize = cur->data(Qt::UserRole+1).toUInt();
break; break;
case DSi_NAND::TitleData_PrivateSav: case DSi_NAND::TitleData_PrivateSav:
exportname = "/private.sav"; exportname = "/private.sav";
extensions += " *.prv";
wantedsize = cur->data(Qt::UserRole+2).toUInt(); wantedsize = cur->data(Qt::UserRole+2).toUInt();
break; break;
case DSi_NAND::TitleData_BannerSav: case DSi_NAND::TitleData_BannerSav:
exportname = "/banner.sav"; exportname = "/banner.sav";
extensions += " *.bnr";
wantedsize = cur->data(Qt::UserRole+3).toUInt(); wantedsize = cur->data(Qt::UserRole+3).toUInt();
break; break;
default: default:
@ -350,7 +364,7 @@ void TitleManagerDialog::onExportTitleData()
QString file = QFileDialog::getSaveFileName(this, QString file = QFileDialog::getSaveFileName(this,
"Select path to export to...", "Select path to export to...",
QString::fromStdString(EmuDirectory) + exportname, QString::fromStdString(EmuDirectory) + exportname,
"Title data files (*.sav);;Any file (*.*)"); "Title data files (" + extensions + ");;Any file (*.*)");
if (file.isEmpty()) return; if (file.isEmpty()) return;