diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 0df9a4839d..e3178aa102 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -244,7 +244,8 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string } }; DarwinFileSystemServices services; - services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectories = */ false); + BrowseFileType fileType = (BrowseFileType)param3; + services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectories = */ false, fileType); return true; } case SystemRequestType::BROWSE_FOR_FOLDER: diff --git a/UI/DarwinFileSystemServices.h b/UI/DarwinFileSystemServices.h index 6a76c3e8df..2b22d12acf 100644 --- a/UI/DarwinFileSystemServices.h +++ b/UI/DarwinFileSystemServices.h @@ -9,6 +9,7 @@ #include "ppsspp_config.h" #include "Common/File/Path.h" +#include "Common/System/Request.h" #define PreferredMemoryStickUserDefaultsKey "UserPreferredMemoryStickDirectoryPath" @@ -18,18 +19,20 @@ typedef std::function DarwinDirectoryPanelCallback; /// on Darwin platforms. class DarwinFileSystemServices { public: - /// Present a pannel to choose the directory as the memory stick manager. - void presentDirectoryPanel(DarwinDirectoryPanelCallback, - bool allowFiles = false, - bool allowDirectories = true); - - static Path appropriateMemoryStickDirectoryToUse(); - static void setUserPreferredMemoryStickDirectory(Path); + /// Present a panel to choose a file or directory. + void presentDirectoryPanel( + DarwinDirectoryPanelCallback, + bool allowFiles = false, + bool allowDirectories = true, + BrowseFileType fileType = BrowseFileType::ANY); + + static Path appropriateMemoryStickDirectoryToUse(); + static void setUserPreferredMemoryStickDirectory(Path); private: - static Path __defaultMemoryStickPath(); + static Path __defaultMemoryStickPath(); #if PPSSPP_PLATFORM(IOS) - // iOS only, needed for UIDocumentPickerViewController - void *__pickerDelegate = NULL; + // iOS only, needed for UIDocumentPickerViewController + void *__pickerDelegate = NULL; #endif // PPSSPP_PLATFORM(IOS) }; diff --git a/UI/DarwinFileSystemServices.mm b/UI/DarwinFileSystemServices.mm index 09daa933b7..2afeabfa94 100644 --- a/UI/DarwinFileSystemServices.mm +++ b/UI/DarwinFileSystemServices.mm @@ -44,15 +44,35 @@ #include #endif // __has_include() -void DarwinFileSystemServices::presentDirectoryPanel(DarwinDirectoryPanelCallback callback, - bool allowFiles, - bool allowDirectories) { - dispatch_async(dispatch_get_main_queue(), ^{ +void DarwinFileSystemServices::presentDirectoryPanel( + DarwinDirectoryPanelCallback callback, + bool allowFiles, bool allowDirectories, + BrowseFileType fileType) { + dispatch_async(dispatch_get_main_queue(), ^{ #if PPSSPP_PLATFORM(MAC) - NSOpenPanel *panel = [[NSOpenPanel alloc] init]; - panel.allowsMultipleSelection = NO; - panel.canChooseFiles = allowFiles; - panel.canChooseDirectories = allowDirectories; + NSOpenPanel *panel = [[NSOpenPanel alloc] init]; + panel.allowsMultipleSelection = NO; + panel.canChooseFiles = allowFiles; + panel.canChooseDirectories = allowDirectories; + switch (fileType) { + case BrowseFileType::BOOTABLE: + [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"iso", @"cso", @"pbp", @"elf", @"zip", @"ppdmp", nil]]; + break; + case BrowseFileType::IMAGE: + [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"jpg", @"png", nil]]; + break; + case BrowseFileType::INI: + [panel setAllowedFileTypes:[NSArray arrayWithObject:@"ini"]]; + break; + case BrowseFileType::DB: + [panel setAllowedFileTypes:[NSArray arrayWithObject:@"db"]]; + break; + case BrowseFileType::SOUND_EFFECT: + [panel setAllowedFileTypes:[NSArray arrayWithObject:@"wav"]]; + break; + default: + break; + } // if (!allowFiles && allowDirectories) // panel.allowedFileTypes = @[(__bridge NSString *)kUTTypeFolder]; diff --git a/ext/rcheevos b/ext/rcheevos index 73f924f08d..223df07613 160000 --- a/ext/rcheevos +++ b/ext/rcheevos @@ -1 +1 @@ -Subproject commit 73f924f08d3c6ea9cc3ef27b29efaa152d3b3c15 +Subproject commit 223df0761313c5c9d9f4d4dc4b5897cf41e7e036