Skip to content

Commit

Permalink
Merge pull request #4937 from maron2000/fix_opendialog
Browse files Browse the repository at this point in the history
Fix some filters were ignored in file open dialogs
  • Loading branch information
joncampbell123 authored Mar 31, 2024
2 parents 6a875c4 + 866d7f4 commit d9007bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ Next:
- Added breakpoint type "Freeze memory" (Enmet)
- Implemented seeking in MSCDEX
(Imported from dosbox-staging/dosbox-staging#3516 authored by weirddan455)
- Fixed built-in COPY command failed to obtain free space when reported DOS
version is set to 7.1 (maron2000)
- Fixed some file extensions in tbe filter list were ignored in the file open
dialogs (maron2000)

2024.03.01
- If an empty CD-ROM drive is attached to IDE emulation, return "Medium Not
Expand Down
10 changes: 5 additions & 5 deletions src/dos/dos_programs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void MenuBrowseCDImage(char drive, int num) {
std::string files="", fname="";
const char *lFilterPatterns[] = {"*.iso","*.cue","*.bin","*.chd","*.mdf","*.gog","*.ins","*.ISO","*.CUE","*.BIN","*.CHD","*.MDF","*.GOG","*.INS"};
const char *lFilterDescription = "CD image files (*.iso, *.cue, *.bin, *.chd, *.mdf, *.gog, *.ins)";
lTheOpenFileName = tinyfd_openFileDialog("Select a CD image file","",14,lFilterPatterns,lFilterDescription,0);
lTheOpenFileName = tinyfd_openFileDialog("Select a CD image file","", sizeof(lFilterPatterns) / sizeof(lFilterPatterns[0]),lFilterPatterns,lFilterDescription,0);

if (lTheOpenFileName) {
isoDrive *cdrom = dynamic_cast<isoDrive*>(Drives[drive-'A']);
Expand Down Expand Up @@ -597,7 +597,7 @@ void MenuBrowseFDImage(char drive, int num, int type) {
std::string files="", fname="";
const char *lFilterPatterns[] = {"*.ima","*.img","*.xdf","*.fdi","*.hdm","*.nfd","*.d88","*.IMA","*.IMG","*.XDF","*.FDI","*.HDM","*.NFD","*.D88"};
const char *lFilterDescription = "Floppy image files (*.ima, *.img, *.xdf, *.fdi, *.hdm, *.nfd, *.d88)";
lTheOpenFileName = tinyfd_openFileDialog("Select a floppy image file","",4,lFilterPatterns,lFilterDescription,0);
lTheOpenFileName = tinyfd_openFileDialog("Select a floppy image file","",sizeof(lFilterPatterns)/sizeof(lFilterPatterns[0]), lFilterPatterns, lFilterDescription, 0);

if (lTheOpenFileName) {
//uint8_t mediaid = 0xF0; UNUSED
Expand Down Expand Up @@ -654,12 +654,12 @@ void MenuBrowseImageFile(char drive, bool arc, bool boot, bool multiple) {
if (arc) {
const char *lFilterPatterns[] = {"*.zip","*.7z","*.ZIP","*.7Z"};
const char *lFilterDescription = "Archive files (*.zip, *.7z)";
lTheOpenFileName = tinyfd_openFileDialog(("Select an archive file for Drive "+str+":").c_str(),"",4,lFilterPatterns,lFilterDescription,0);
lTheOpenFileName = tinyfd_openFileDialog(("Select an archive file for Drive "+str+":").c_str(),"", sizeof(lFilterPatterns) / sizeof(lFilterPatterns[0]),lFilterPatterns,lFilterDescription,0);
if (lTheOpenFileName) fname = GetNewStr(lTheOpenFileName);
} else {
const char *lFilterPatterns[] = {"*.ima","*.img","*.vhd","*.fdi","*.hdi","*.nfd","*.nhd","*.d88","*.hdm","*.xdf","*.iso","*.cue","*.bin","*.chd","*.mdf","*.gog","*.ins","*.ccd","*.IMA","*.IMG","*.VHD","*.FDI","*.HDI","*.NFD","*.NHD","*.D88","*.HDM","*.XDF","*.ISO","*.CUE","*.BIN","*.CHD","*.MDF","*.GOG","*.INS", "*.CCD"};
const char *lFilterDescription = "Disk/CD image files";
lTheOpenFileName = tinyfd_openFileDialog(((multiple?"Select image file(s) for Drive ":"Select an image file for Drive ")+str+":").c_str(),"",22,lFilterPatterns,lFilterDescription,multiple?1:0);
lTheOpenFileName = tinyfd_openFileDialog(((multiple?"Select image file(s) for Drive ":"Select an image file for Drive ")+str+":").c_str(),"", sizeof(lFilterPatterns) / sizeof(lFilterPatterns[0]),lFilterPatterns,lFilterDescription,multiple?1:0);
if (lTheOpenFileName) fname = GetNewStr(lTheOpenFileName);
if (multiple&&fname.size()) {
files += "\"";
Expand All @@ -668,7 +668,7 @@ void MenuBrowseImageFile(char drive, bool arc, bool boot, bool multiple) {
files += "\" ";
}
while (multiple&&lTheOpenFileName&&systemmessagebox("Mount image files","Do you want to mount more image file(s)?","yesno", "question", 1)) {
lTheOpenFileName = tinyfd_openFileDialog(("Select image file(s) for Drive "+str+":").c_str(),"",20,lFilterPatterns,lFilterDescription,multiple?1:0);
lTheOpenFileName = tinyfd_openFileDialog(("Select image file(s) for Drive "+str+":").c_str(),"", sizeof(lFilterPatterns) / sizeof(lFilterPatterns[0]),lFilterPatterns,lFilterDescription,multiple?1:0);
if (lTheOpenFileName) {
fname = GetNewStr(lTheOpenFileName);
files += "\"";
Expand Down

0 comments on commit d9007bd

Please sign in to comment.