Set directory path for generic file dialog

This commit is contained in:
Andy Vandijck 2025-05-11 08:11:46 +02:00
parent bd0a59cc5f
commit 5529797f10
13 changed files with 98 additions and 6 deletions

View File

@ -445,7 +445,9 @@ void Blip_Buffer::mix_samples( blip_sample_t const* in, long count )
*out -= prev;
}
#if 0
blip_ulong const subsample_mask = (1L << BLIP_BUFFER_ACCURACY) - 1;
#endif
void Blip_Buffer::save_state( blip_buffer_state_t* out )
{

View File

@ -228,7 +228,10 @@ class Stereo_Buffer : public Multi_Buffer
buf_t bufs[bufs_size];
Stereo_Mixer mixer;
channel_t chan;
#if 0
long samples_avail_;
#endif
};
// Silent_Buffer generates no samples, useful where no sound is wanted

View File

@ -63,9 +63,11 @@ static void make_unbuffered( Std_File_Reader* r )
r->make_unbuffered();
}
#if 0
inline
static void make_unbuffered( void* )
{ }
#endif
blargg_err_t File_Extractor::open_arc_file( bool unbuffered )
{

View File

@ -376,12 +376,14 @@ static inline void gfxDrawRotScreen16Bit(uint16_t control, uint16_t x_l, uint16_
int sizeX = 240;
int sizeY = 160;
#if 0
int startX = (x_l) | ((x_h & 0x07FF) << 16);
if (x_h & 0x0800)
startX |= 0xF8000000;
int startY = (y_l) | ((y_h & 0x07FF) << 16);
if (y_h & 0x0800)
startY |= 0xF8000000;
#endif
int dx = pa & 0x7FFF;
if (pa & 0x8000)

View File

@ -142,6 +142,7 @@ int WaitForSingleObject(sem_t* s, int t)
#include <signal.h>
static void alrmhand(int sig)
{
(void)sig;
}
#endif
int WaitForSingleObject(sem_t* s, int t)

View File

@ -534,12 +534,12 @@ else ifneq (,$(findstring windows_msvc2022,$(platform)))
ifneq (,$(findstring desktop,$(PlatformSuffix)))
WinPartition = desktop
MSVC2022CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -FS
LDFLAGS += -MANIFEST -LTCG:incremental -NXCOMPAT -DYNAMICBASE -DEBUG -OPT:REF -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MANIFESTUAC:"level='asInvoker' uiAccess='false'" -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1
LDFLAGS += -LIBPATH:"$(LIB)" -MANIFEST -LTCG:incremental -NXCOMPAT -DYNAMICBASE -DEBUG -OPT:REF -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MANIFESTUAC:"level='asInvoker' uiAccess='false'" -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1
LIBS := kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
else ifneq (,$(findstring uwp,$(PlatformSuffix)))
WinPartition = uwp
MSVC2022CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WINDLL -D_UNICODE -DUNICODE -D__WRL_NO_DEFAULT_LIB__ -EHsc -FS
LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -LTCG -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
LDFLAGS += -LIBPATH:"$(LIB)" -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -LTCG -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
LIBS := WindowsApp.lib
endif
@ -681,11 +681,11 @@ else
LD = link.exe
ifeq ($(DEBUG), 1)
CFLAGS += -MDd
CXXFLAGS += -MDd
CFLAGS += -MTd
CXXFLAGS += -MTd
else
CFLAGS += -MD
CXXFLAGS += -MD
CFLAGS += -MT
CXXFLAGS += -MT
endif
endif
else

View File

@ -146,6 +146,8 @@ EVT_HANDLER(wxID_OPEN, "Open ROM...")
pats,
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, gba_rom_dir);
dlg.SetFilterIndex(open_ft);
if (ShowModal(&dlg) == wxID_OK)
@ -175,6 +177,8 @@ EVT_HANDLER(OpenGB, "Open GB...")
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
dlg.SetFilterIndex(open_ft);
SetGenericPath(dlg, gb_rom_dir);
if (ShowModal(&dlg) == wxID_OK)
wxGetApp().pending_load = dlg.GetPath();
@ -202,6 +206,8 @@ EVT_HANDLER(OpenGBC, "Open GBC...")
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
dlg.SetFilterIndex(open_ft);
SetGenericPath(dlg, gbc_rom_dir);
if (ShowModal(&dlg) == wxID_OK)
wxGetApp().pending_load = dlg.GetPath();
@ -367,6 +373,9 @@ EVT_HANDLER_MASK(SetLoadingDotCodeFile, "Load e-Reader Dot Code...", CMDEN_GBA)
"E-Reader Dot Code (*.bin;*.raw)|"
"*.bin;*.raw"),
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, loaddotcodefile_path);
int ret = ShowModal(&dlg);
if (ret != wxID_OK)
@ -389,6 +398,9 @@ EVT_HANDLER_MASK(SetSavingDotCodeFile, "Save e-Reader Dot Code...", CMDEN_GBA)
"E-Reader Dot Code (*.bin;*.raw)|"
"*.bin;*.raw"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, savedotcodefile_path);
int ret = ShowModal(&dlg);
if (ret != wxID_OK)
@ -407,6 +419,9 @@ EVT_HANDLER_MASK(ImportBatteryFile, "Import battery file...", CMDEN_GB | CMDEN_G
wxFileDialog dlg(this, _("Select battery file"), batimp_path, wxEmptyString,
_("Battery file (*.sav)|*.sav|Flash save (*.dat)|*.dat"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, batimp_path);
int ret = ShowModal(&dlg);
batimp_path = dlg.GetDirectory();
@ -435,6 +450,9 @@ EVT_HANDLER_MASK(ImportGamesharkCodeFile, "Import Game Shark code file...", CMDE
wxFileDialog dlg(this, _("Select code file"), path, wxEmptyString,
panel->game_type() == IMAGE_GBA ? _("Game Shark Code File (*.spc;*.xpc)|*.spc;*.xpc") : _("Game Shark Code File (*.gcf)|*.gcf"),
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, path);
int ret = ShowModal(&dlg);
path = dlg.GetDirectory();
@ -555,6 +573,9 @@ EVT_HANDLER_MASK(ImportGamesharkActionReplaySnapshot,
wxFileDialog dlg(this, _("Select snapshot file"), gss_path, wxEmptyString,
panel->game_type() == IMAGE_GBA ? _("Game Shark & PAC Snapshots (*.sps;*.xps)|*.sps;*.xps|Game Shark SP Snapshots (*.gsv)|*.gsv") : _("Game Boy Snapshot (*.gbs)|*.gbs"),
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, gss_path);
int ret = ShowModal(&dlg);
gss_path = dlg.GetDirectory();
@ -602,6 +623,9 @@ EVT_HANDLER_MASK(ExportBatteryFile, "Export battery file...", CMDEN_GB | CMDEN_G
wxFileDialog dlg(this, _("Select battery file"), batimp_path, wxEmptyString,
_("Battery file (*.sav)|*.sav|Flash save (*.dat)|*.dat"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, batimp_path);
int ret = ShowModal(&dlg);
batimp_path = dlg.GetDirectory();
@ -630,6 +654,9 @@ EVT_HANDLER_MASK(ExportGamesharkSnapshot, "Export GameShark snapshot...", CMDEN_
def_name.append(wxT(".sps"));
wxFileDialog dlg(this, _("Select snapshot file"), gss_path, def_name,
_("Game Shark Snapshot (*.sps)|*.sps"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, gss_path);
int ret = ShowModal(&dlg);
gss_path = dlg.GetDirectory();
@ -675,6 +702,9 @@ EVT_HANDLER_MASK(ScreenCapture, "Screen capture...", CMDEN_GB | CMDEN_GBA)
wxFileDialog dlg(this, _("Select output file"), scap_path, def_name,
_("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, scap_path);
dlg.SetFilterIndex(capture_format);
int ret = ShowModal(&dlg);
scap_path = dlg.GetDirectory();
@ -753,6 +783,9 @@ EVT_HANDLER_MASK(RecordSoundStartRecording, "Start sound recording...", CMDEN_NS
def_name += extoff.Left(wxStrcspn(extoff, wxT(";|")));
wxFileDialog dlg(this, _("Select output file"), sound_path, def_name,
sound_exts, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, sound_path);
dlg.SetFilterIndex(sound_extno);
int ret = ShowModal(&dlg);
sound_extno = dlg.GetFilterIndex();
@ -823,6 +856,9 @@ EVT_HANDLER_MASK(RecordAVIStartRecording, "Start video recording...", CMDEN_NVRE
def_name += extoff.Left(wxStrcspn(extoff, wxT(";|")));
wxFileDialog dlg(this, _("Select output file"), vid_path, def_name,
vid_exts, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, vid_path);
dlg.SetFilterIndex(vid_extno);
int ret = ShowModal(&dlg);
vid_extno = dlg.GetFilterIndex();
@ -892,6 +928,9 @@ EVT_HANDLER_MASK(RecordMovieStartRecording, "Start game recording...", CMDEN_NGR
def_name += extoff.Left(wxStrcspn(extoff, wxT(";|")));
wxFileDialog dlg(this, _("Select output file"), mov_path, def_name,
mov_exts, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, mov_path);
dlg.SetFilterIndex(mov_extno);
int ret = ShowModal(&dlg);
mov_extno = dlg.GetFilterIndex();
@ -959,6 +998,9 @@ EVT_HANDLER_MASK(PlayMovieStartPlaying, "Start playing movie...", CMDEN_NGREC |
def_name += extoff.Left(wxStrcspn(extoff, wxT(";|")));
wxFileDialog dlg(this, _("Select file"), mov_path, def_name,
mov_exts, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, mov_path);
dlg.SetFilterIndex(mov_extno);
int ret = ShowModal(&dlg);
mov_extno = dlg.GetFilterIndex();
@ -1263,6 +1305,9 @@ EVT_HANDLER_MASK(Load, "Load state...", CMDEN_GB | CMDEN_GBA)
wxFileDialog dlg(this, _("Select state file"), st_dir, wxEmptyString,
_("Visual Boy Advance saved game files|*.sgm"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, st_dir);
int ret = ShowModal(&dlg);
st_dir = dlg.GetDirectory();
@ -1356,6 +1401,9 @@ EVT_HANDLER_MASK(Save, "Save state as...", CMDEN_GB | CMDEN_GBA)
wxFileDialog dlg(this, _("Select state file"), st_dir, wxEmptyString,
_("Visual Boy Advance saved game files|*.sgm"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, st_dir);
int ret = ShowModal(&dlg);
st_dir = dlg.GetDirectory();

View File

@ -3,4 +3,8 @@
#undef wxFileDialog
#define wxFileDialog wxGenericFileDialog
#define SetGenericPath(X,Y) X.SetDirectory(Y); X.SetPath(Y)
#else
#define SetGenericPath(X,Y)
#endif

View File

@ -1229,6 +1229,9 @@ void savepal(wxWindow* parent, const uint8_t* data, int ncols, const wxString ty
wxFileDialog dlg(parent, _("Select output file and type"), pdir, def_name,
_("Windows Palette (*.pal)|*.pal|PaintShop Palette (*.pal)|*.pal|Adobe Color Table (*.act)|*.act"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, pdir);
dlg.SetFilterIndex(ptype);
int ret = dlg.ShowModal();
ptype = dlg.GetFilterIndex();
@ -1688,6 +1691,9 @@ public:
wxFileDialog dlg(GetGrandParent(), _("Select output file"), bmp_save_dir, def_name,
_("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, bmp_save_dir);
dlg.SetFilterIndex(capture_format);
int ret = dlg.ShowModal();
bmp_save_dir = dlg.GetDirectory();
@ -1833,6 +1839,9 @@ public:
wxFileDialog dlg(GetGrandParent(), _("Select output file"), bmp_save_dir, def_name,
_("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, bmp_save_dir);
dlg.SetFilterIndex(capture_format);
int ret = dlg.ShowModal();
bmp_save_dir = dlg.GetDirectory();

View File

@ -257,6 +257,9 @@ public:
wxFileDialog subdlg(dlg, _("Select cheat file"), cheatdir, cheatfn,
_("VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht"),
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(subdlg, cheatdir);
int ret = subdlg.ShowModal();
cheatdir = subdlg.GetDirectory();
cheatfn = subdlg.GetPath();
@ -310,6 +313,9 @@ public:
wxFileDialog subdlg(dlg, _("Select cheat file"), cheatdir,
cheatfn, _("VBA cheat lists (*.clt)|*.clt"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(subdlg, cheatdir);
int ret = subdlg.ShowModal();
cheatdir = subdlg.GetDirectory();
cheatfn = subdlg.GetPath();

View File

@ -947,6 +947,9 @@ void PrintDialog::DoSave(wxCommandEvent&)
wxFileDialog fdlg(dlg, _("Save printer image to"), prsav_path, dn,
pats, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(fdlg, prsav_path);
int ret = fdlg.ShowModal();
prsav_path = fdlg.GetDirectory();

View File

@ -587,6 +587,9 @@ void LogDialog::Save(wxCommandEvent& ev)
pats.append(wxALL_FILES);
wxFileDialog dlg(this, _("Select output file"), logdir, def_name,
pats, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, logdir);
int ret = dlg.ShowModal();
def_name = dlg.GetPath();
logdir = dlg.GetDirectory();
@ -729,6 +732,9 @@ public:
pats.append(wxALL_FILES);
wxFileDialog dlg(this, _("Select memory dump file"), memsave_dir, memsave_fn,
pats, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
SetGenericPath(dlg, memsave_dir);
int ret = dlg.ShowModal();
memsave_fn = dlg.GetPath();
memsave_dir = dlg.GetDirectory();
@ -801,6 +807,9 @@ public:
pats.append(wxALL_FILES);
wxFileDialog dlg(this, _("Select output file"), memsave_dir, memsave_fn,
pats, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, memsave_dir);
int ret = dlg.ShowModal();
memsave_dir = dlg.GetDirectory();
memsave_fn = dlg.GetPath();

View File

@ -1198,6 +1198,9 @@ void GfxViewer::SaveBMP(wxCommandEvent& ev)
wxFileDialog dlg(GetGrandParent(), _("Select output file"), bmp_save_dir_, def_name,
_("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
SetGenericPath(dlg, bmp_save_dir_);
dlg.SetFilterIndex(capture_format);
int ret = dlg.ShowModal();
bmp_save_dir_ = dlg.GetDirectory();