Skip to content

Commit

Permalink
Allow import/export of .pub/.prv/.bnr saves (melonDS-emu#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
Epicpkmn11 authored Nov 7, 2022
1 parent ca19ea1 commit 31a0d7e
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/frontend/qt_sdl/TitleManagerDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,22 @@ void TitleManagerDialog::onImportTitleData()
return;
}

QString extensions = "*.sav";
u32 wantedsize;
switch (type)
{
case DSi_NAND::TitleData_PublicSav: wantedsize = cur->data(Qt::UserRole+1).toUInt(); break;
case DSi_NAND::TitleData_PrivateSav: wantedsize = cur->data(Qt::UserRole+2).toUInt(); break;
case DSi_NAND::TitleData_BannerSav: wantedsize = cur->data(Qt::UserRole+3).toUInt(); break;
case DSi_NAND::TitleData_PublicSav:
extensions += " *.pub";
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:
printf("what??\n");
return;
Expand All @@ -280,7 +290,7 @@ void TitleManagerDialog::onImportTitleData()
QString file = QFileDialog::getOpenFileName(this,
"Select file to import...",
QString::fromStdString(EmuDirectory),
"Title data files (*.sav);;Any file (*.*)");
"Title data files (" + extensions + ");;Any file (*.*)");

if (file.isEmpty()) return;

Expand Down Expand Up @@ -327,19 +337,23 @@ void TitleManagerDialog::onExportTitleData()
}

QString exportname;
QString extensions = "*.sav";
u32 wantedsize;
switch (type)
{
case DSi_NAND::TitleData_PublicSav:
exportname = "/public.sav";
extensions += " *.pub";
wantedsize = cur->data(Qt::UserRole+1).toUInt();
break;
case DSi_NAND::TitleData_PrivateSav:
exportname = "/private.sav";
extensions += " *.prv";
wantedsize = cur->data(Qt::UserRole+2).toUInt();
break;
case DSi_NAND::TitleData_BannerSav:
exportname = "/banner.sav";
extensions += " *.bnr";
wantedsize = cur->data(Qt::UserRole+3).toUInt();
break;
default:
Expand All @@ -350,7 +364,7 @@ void TitleManagerDialog::onExportTitleData()
QString file = QFileDialog::getSaveFileName(this,
"Select path to export to...",
QString::fromStdString(EmuDirectory) + exportname,
"Title data files (*.sav);;Any file (*.*)");
"Title data files (" + extensions + ");;Any file (*.*)");

if (file.isEmpty()) return;

Expand Down

0 comments on commit 31a0d7e

Please sign in to comment.