convert to System_SendMessage insanity
This commit is contained in:
parent
230fb93766
commit
482e989cd7
5 changed files with 33 additions and 21 deletions
|
@ -58,6 +58,9 @@ SDLJoystick *joystick = NULL;
|
|||
#include "SDLGLGraphicsContext.h"
|
||||
#include "SDLVulkanGraphicsContext.h"
|
||||
|
||||
#if PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS)
|
||||
#include "UI/DarwinFileSystemServices.h"
|
||||
#endif
|
||||
|
||||
GlobalUIState lastUIState = UISTATE_MENU;
|
||||
GlobalUIState GetUIState();
|
||||
|
@ -186,6 +189,17 @@ void System_SendMessage(const char *command, const char *parameter) {
|
|||
StopSDLAudioDevice();
|
||||
InitSDLAudioDevice();
|
||||
}
|
||||
#if PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS)
|
||||
else if (!strcmp(command, "browse_folder")) {
|
||||
DarwinDirectoryPanelCallback callback = [] (Path thePathChosen) {
|
||||
NativeMessageReceived("browse_folder", thePathChosen.c_str());
|
||||
};
|
||||
|
||||
DarwinFileSystemServices services;
|
||||
services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectorites = */ true);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void System_AskForPermission(SystemPermission permission) {}
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
// Created by Serena on 20/01/2023.
|
||||
//
|
||||
|
||||
#ifndef DarwinFileSystemServices_h
|
||||
#define DarwinFileSystemServices_h
|
||||
#pragma once
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
#include "Common/File/Path.h"
|
||||
|
@ -33,5 +32,3 @@ private:
|
|||
void *__pickerDelegate = NULL;
|
||||
#endif // PPSSPP_PLATFORM(IOS)
|
||||
};
|
||||
|
||||
#endif /* DarwinFileSystemServices_h */
|
||||
|
|
|
@ -538,23 +538,7 @@ UI::EventReturn GameBrowser::LastClick(UI::EventParams &e) {
|
|||
}
|
||||
|
||||
UI::EventReturn GameBrowser::BrowseClick(UI::EventParams &e) {
|
||||
#if PPSSPP_PLATFORM(IOS) || PPSSPP_PLATFORM(MAC)
|
||||
DarwinDirectoryPanelCallback callback = [this] (Path thePathChosen) {
|
||||
File::FileInfo info;
|
||||
if (!File::GetFileInfo(thePathChosen, &info))
|
||||
return;
|
||||
|
||||
if (info.isDirectory)
|
||||
SetPath(thePathChosen); // user selected a dir, go there
|
||||
else
|
||||
LaunchFile(screenManager_, thePathChosen); // it's a file, try open it
|
||||
};
|
||||
|
||||
DarwinFileSystemServices services;
|
||||
services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectorites = */ true);
|
||||
#else
|
||||
System_SendMessage("browse_folder", "");
|
||||
#endif
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1258,6 +1258,15 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
|
|||
else if (msg == "app_resumed" || msg == "got_focus") {
|
||||
// Assume that the user may have modified things.
|
||||
MemoryStick_NotifyWrite();
|
||||
} else if (msg == "browse_folder") {
|
||||
Path thePath = Path(value);
|
||||
File::FileInfo info;
|
||||
if (!File::GetFileInfo(thePath, &info))
|
||||
return;
|
||||
if (info.isDirectory)
|
||||
NativeMessageReceived("browse_folderSelect", thePath.c_str());
|
||||
else
|
||||
NativeMessageReceived("browse_fileSelect", thePath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "Common/System/System.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Profiler/Profiler.h"
|
||||
#include "UI/DarwinFileSystemServices.h"
|
||||
|
||||
static int (*csops)(pid_t pid, unsigned int ops, void * useraddr, size_t usersize);
|
||||
static boolean_t (*exc_server)(mach_msg_header_t *, mach_msg_header_t *);
|
||||
|
@ -201,6 +202,13 @@ void System_SendMessage(const char *command, const char *parameter) {
|
|||
g_safeInsetTop = top;
|
||||
g_safeInsetBottom = bottom;
|
||||
}
|
||||
} else if (!strcmp(command, "browse_folder")) {
|
||||
DarwinDirectoryPanelCallback callback = [] (Path thePathChosen) {
|
||||
NativeMessageReceived("browse_folder", thePathChosen.c_str());
|
||||
};
|
||||
|
||||
DarwinFileSystemServices services;
|
||||
services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectorites = */ true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue