Skip to content

Commit

Permalink
[Qt] Properly save backups when opening another ROM file. Fixes Issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
shonumi committed Jul 30, 2023
1 parent c3ce957 commit 7676a88
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/qt/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,18 @@ void main_menu::open_file()
{
SDL_PauseAudio(1);

std::string next_rom_file = "";
std::string next_save_file = "";
bool use_next_files = false;

if(config::cli_args.empty())
{
QString filename = QFileDialog::getOpenFileName(this, tr("Open"), "", tr("GBx/NDS/MIN/AM3 files (*.gb *.gbc *.gba *.nds *.min *.am3)"));
if(filename.isNull()) { SDL_PauseAudio(0); return; }

config::rom_file = filename.toStdString();
config::save_file = util::get_filename_no_ext(config::rom_file) + ".sav";
next_rom_file = filename.toStdString();
next_save_file = util::get_filename_no_ext(next_rom_file) + ".sav";
use_next_files = true;
}

else
Expand All @@ -367,6 +372,12 @@ void main_menu::open_file()
main_menu::gbe_plus->core_emu::~core_emu();
}

if(use_next_files)
{
config::rom_file = next_rom_file;
config::save_file = next_save_file;
}

config::sdl_render = false;
config::render_external_sw = render_screen_sw;
config::render_external_hw = render_screen_hw;
Expand Down

0 comments on commit 7676a88

Please sign in to comment.