Added separate "Open GB" and "Open GBC" menu items.

This commit is contained in:
skidau 2015-05-23 01:01:43 +00:00
parent 97935797be
commit f2e6d4544f
4 changed files with 593 additions and 511 deletions

File diff suppressed because it is too large Load Diff

View File

@ -87,33 +87,24 @@ void MainFrame::SetMenuOption(const char* menuName, int value)
//// File menu //// File menu
// formerly OpenGBA, OpenGBC, OpenGB
// having just one means separate ROM dirs only make sense on the cmd line
static int open_ft = 0; static int open_ft = 0;
static wxString open_dir; static wxString open_dir;
EVT_HANDLER(wxID_OPEN, "Open ROM...") EVT_HANDLER(wxID_OPEN, "Open ROM...")
{ {
if (gbEmulatorType == 1) open_dir = gopts.gba_rom_dir;
open_dir = gopts.gba_rom_dir;
else if (gbEmulatorType == 5)
open_dir = gopts.gb_rom_dir;
else
open_dir = gopts.gbc_rom_dir;
// FIXME: ignore if non-existent or not a dir // FIXME: ignore if non-existent or not a dir
wxString pats = _( wxString pats = _(
"Archives (*.zip;*.7z;*.rar)|" "GameBoy Advance Files (*.agb;*.gba;*.bin;*.elf;*.mb;*.zip;*.7z;*.rar)|"
"*.agb;*.gba;*.bin;*.elf;*.mb;"
"*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz;"
"*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z;"
"*.zip;*.7z;*.rar"
"|GameBoy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|"
"*.dmg;*.gb;*.gbc;*.cgb;*.sgb;"
"*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;"
"*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;"
"*.zip;*.7z;*.rar" "*.zip;*.7z;*.rar"
"|GameBoy Advance Files (*.agb;*.gba;*.bin;*.elf;*.mb)|"
"*.agb;*.gba;*.bin;*.elf;*.mb"
"*.agb.gz;*.gba.gz;*.bin.gz;*.elf.gz;*.mb.gz"
"*.agb.z;*.gba.z;*.bin.z;*.elf.z;*.mb.z"
"|GameBoy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb)|"
"*.dmg;*.gb;*.gbc;*.cgb;*.sgb"
"*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz"
"*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z"
"|" "|"
); );
pats.append(wxALL_FILES); pats.append(wxALL_FILES);
@ -129,6 +120,56 @@ EVT_HANDLER(wxID_OPEN, "Open ROM...")
open_dir = dlg.GetDirectory(); open_dir = dlg.GetDirectory();
} }
EVT_HANDLER(OpenGB, "Open GB...")
{
open_dir = gopts.gb_rom_dir;
// FIXME: ignore if non-existent or not a dir
wxString pats = _(
"GameBoy Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|"
"*.dmg;*.gb;*.gbc;*.cgb;*.sgb;"
"*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;"
"*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;"
"*.zip;*.7z;*.rar"
"|"
);
pats.append(wxALL_FILES);
wxFileDialog dlg(this, _("Open GB ROM file"), open_dir, wxT(""),
pats,
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
dlg.SetFilterIndex(open_ft);
if (ShowModal(&dlg) == wxID_OK)
wxGetApp().pending_load = dlg.GetPath();
open_ft = dlg.GetFilterIndex();
open_dir = dlg.GetDirectory();
}
EVT_HANDLER(OpenGBC, "Open GBC...")
{
open_dir = gopts.gbc_rom_dir;
// FIXME: ignore if non-existent or not a dir
wxString pats = _(
"GameBoy Color Files (*.dmg;*.gb;*.gbc;*.cgb;*.sgb;*.zip;*.7z;*.rar)|"
"*.dmg;*.gb;*.gbc;*.cgb;*.sgb;"
"*.dmg.gz;*.gb.gz;*.gbc.gz;*.cgb.gz;*.sgb.gz;"
"*.dmg.z;*.gb.z;*.gbc.z;*.cgb.z;*.sgb.z;"
"*.zip;*.7z;*.rar"
"|"
);
pats.append(wxALL_FILES);
wxFileDialog dlg(this, _("Open GBC ROM file"), open_dir, wxT(""),
pats,
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
dlg.SetFilterIndex(open_ft);
if (ShowModal(&dlg) == wxID_OK)
wxGetApp().pending_load = dlg.GetPath();
open_ft = dlg.GetFilterIndex();
open_dir = dlg.GetDirectory();
}
EVT_HANDLER(RecentReset, "Reset recent ROM list") EVT_HANDLER(RecentReset, "Reset recent ROM list")
{ {
// only save config if there were items to remove // only save config if there were items to remove

View File

@ -382,7 +382,7 @@ void GameArea::LoadGame(const wxString &name)
case 0x20000: case 0x20000:
saveType = 3; saveType = 3;
flashSetSize(fnb.length()); flashSetSize(bat.GetSize().GetValue());
break; break;
default: default:

View File

@ -4,6 +4,12 @@
<object class="wxMenu"> <object class="wxMenu">
<label>_File</label> <label>_File</label>
<object class="wxMenuItem" name="wxID_OPEN"/> <object class="wxMenuItem" name="wxID_OPEN"/>
<object class="wxMenuItem" name="OpenGB">
<label>Open _GB...</label>
</object>
<object class="wxMenuItem" name="OpenGBC">
<label>Open GB_C...</label>
</object>
<object class="wxMenu" name="RecentMenu"> <object class="wxMenu" name="RecentMenu">
<label>Open rece_nt</label> <label>Open rece_nt</label>
<object class="wxMenuItem" name="RecentReset"> <object class="wxMenuItem" name="RecentReset">