From d3955b42bb0e4d18a7d91e4661dc58d2e21dd434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 21 Mar 2023 10:42:23 +0100 Subject: [PATCH] Rename some system functions, merge the Launch* ones. android launchurl buildfix --- Common/System/System.h | 33 ++++++++--- Core/HLE/sceUsbCam.cpp | 2 +- Core/HLE/sceUsbMic.cpp | 4 +- Core/Host.h | 1 - Qt/QtHost.h | 7 --- Qt/QtMain.cpp | 6 +- SDL/SDLMain.cpp | 95 +++++++++++++------------------ UI/CwCheatScreen.cpp | 2 +- UI/GameScreen.cpp | 4 +- UI/GameSettingsScreen.cpp | 6 +- UI/GamepadEmu.cpp | 10 ++-- UI/HostTypes.h | 1 - UI/MainScreen.cpp | 18 +++--- UI/MemStickScreen.cpp | 2 +- UI/MiscScreens.cpp | 16 +++--- UI/ReportScreen.cpp | 4 +- UWP/PPSSPP_UWPMain.cpp | 6 +- UWP/UWPHost.cpp | 4 -- UWP/UWPHost.h | 1 - Windows/EmuThread.cpp | 2 +- Windows/GEDebugger/GEDebugger.cpp | 8 +-- Windows/WindowsHost.cpp | 8 --- Windows/WindowsHost.h | 1 - Windows/main.cpp | 6 +- android/jni/app-android.cpp | 28 ++++----- headless/Headless.cpp | 4 +- headless/StubHost.h | 1 - ios/CameraHelper.mm | 2 +- ios/ViewController.mm | 86 ++++++++++++++-------------- ios/main.mm | 4 +- libretro/libretro.cpp | 7 +-- unittest/UnitTest.cpp | 6 +- 32 files changed, 178 insertions(+), 207 deletions(-) diff --git a/Common/System/System.h b/Common/System/System.h index 38482d3e41..cbb5ad950b 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -4,6 +4,16 @@ #include #include +// Platform integration + +// To run the PPSSPP core, a platform needs to implement all the System_ functions in this file, +// plus derive an object from Host (see Host.h). The latter will be phased out. +// Failure to implement all of these will simply cause linker failures. There are a few that are +// only implemented on specific platforms, but they're also only called on those platforms. + +// The platform then calls the entry points from NativeApp.h as appropriate. That's basically it, +// disregarding build system complexities. + enum SystemPermission { SYSTEM_PERMISSION_STORAGE, }; @@ -18,7 +28,7 @@ enum PermissionStatus { // These APIs must be implemented by every port (for example app-android.cpp, SDLMain.cpp). // Ideally these should be safe to call from any thread. void System_Toast(const char *text); -void ShowKeyboard(); +void System_ShowKeyboard(); // Vibrate either takes a number of milliseconds to vibrate unconditionally, // or you can specify these constants for "standard" feedback. On Android, @@ -30,11 +40,16 @@ enum { HAPTIC_VIRTUAL_KEY = -2, HAPTIC_LONG_PRESS_ACTIVATED = -3, }; -void Vibrate(int length_ms); -void OpenDirectory(const char *path); -void LaunchBrowser(const char *url); -void LaunchMarket(const char *url); -void LaunchEmail(const char *email_address); + +enum class LaunchUrlType { + BROWSER_URL, + MARKET_URL, + EMAIL_ADDRESS, +}; + +void System_Vibrate(int length_ms); +void System_ShowFileInFolder(const char *path); +void System_LaunchUrl(LaunchUrlType urlType, const char *url); void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function cb); void System_SendMessage(const char *command, const char *parameter); PermissionStatus System_GetPermissionStatus(SystemPermission permission); @@ -123,6 +138,6 @@ int System_GetPropertyInt(SystemProperty prop); float System_GetPropertyFloat(SystemProperty prop); bool System_GetPropertyBool(SystemProperty prop); -std::vector __cameraGetDeviceList(); -bool audioRecording_Available(); -bool audioRecording_State(); +std::vector System_GetCameraDeviceList(); +bool System_AudioRecordingIsAvailable(); +bool System_AudioRecordingState(); diff --git a/Core/HLE/sceUsbCam.cpp b/Core/HLE/sceUsbCam.cpp index c8d43a5027..571f846545 100644 --- a/Core/HLE/sceUsbCam.cpp +++ b/Core/HLE/sceUsbCam.cpp @@ -332,7 +332,7 @@ std::vector Camera::getDeviceList() { return winCamera->getDeviceList(); } #elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) - return __cameraGetDeviceList(); + return System_GetCameraDeviceList(); #elif defined(USING_QT_UI) // Qt:macOS / Qt:Linux return __qt_getDeviceList(); #elif PPSSPP_PLATFORM(LINUX) // SDL:Linux diff --git a/Core/HLE/sceUsbMic.cpp b/Core/HLE/sceUsbMic.cpp index 0626f9f4d2..8ab6ff23da 100644 --- a/Core/HLE/sceUsbMic.cpp +++ b/Core/HLE/sceUsbMic.cpp @@ -103,7 +103,7 @@ void __UsbMicInit() { curChannels = 1; curTargetAddr = 0; readMicDataLength = 0; - micState = 0; + micState = 0; eventMicBlockingResume = CoreTiming::RegisterEvent("MicBlockingResume", &__MicBlockingResume); } @@ -349,7 +349,7 @@ bool Microphone::isHaveDevice() { #ifdef HAVE_WIN32_MICROPHONE return winMic->getDeviceCounts() >= 1; #elif PPSSPP_PLATFORM(ANDROID) - return audioRecording_Available(); + return System_AudioRecordingIsAvailable(); #endif return false; } diff --git a/Core/Host.h b/Core/Host.h index 4a4c739c3d..eba025e428 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -45,7 +45,6 @@ public: //this is sent from EMU thread! Make sure that Host handles it properly! virtual void BootDone() {} - virtual bool IsDebuggingEnabled() {return true;} virtual bool AttemptLoadSymbolMap(); virtual void SaveSymbolMap() {} virtual void NotifySymbolMapUpdated() {} diff --git a/Qt/QtHost.h b/Qt/QtHost.h index d8fa12f1f7..a0327474c1 100644 --- a/Qt/QtHost.h +++ b/Qt/QtHost.h @@ -56,13 +56,6 @@ public: mainWindow->Notify(MainWindowMsg::BOOT_DONE); } - bool IsDebuggingEnabled() override { -#ifdef _DEBUG - return true; -#else - return false; -#endif - } bool AttemptLoadSymbolMap() override { auto fn = SymbolMapFilename(PSP_CoreParameter().fileToStart); return g_symbolMap->LoadSymbolMap(fn); diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index 10b7f8ca9d..354ea7399b 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -295,18 +295,18 @@ void System_InputBoxGetString(const std::string &title, const std::string &defau } } -void Vibrate(int length_ms) { +void System_Vibrate(int length_ms) { if (length_ms == -1 || length_ms == -3) length_ms = 50; else if (length_ms == -2) length_ms = 25; } -void OpenDirectory(const char *path) { +void System_ShowFileInFolder(const char *path) { QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(path))); } -void LaunchBrowser(const char *url) +void System_LaunchUrl(LaunchUrlType urlType, const char *url) { QDesktopServices::openUrl(QUrl(url)); } diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index cf77b7e109..c11a50476b 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -158,11 +158,11 @@ void System_Toast(const char *text) { #endif } -void ShowKeyboard() { +void System_ShowKeyboard() { // Irrelevant on PC } -void Vibrate(int length_ms) { +void System_Vibrate(int length_ms) { // Ignore on PC } @@ -194,18 +194,18 @@ void System_SendMessage(const char *command, const char *parameter) { 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) {} PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; } -void OpenDirectory(const char *path) { +void System_ShowFileInFolder(const char *path) { #if PPSSPP_PLATFORM(WINDOWS) SFGAOF flags; PIDLIST_ABSOLUTE pidl = nullptr; @@ -231,68 +231,53 @@ void OpenDirectory(const char *path) { #endif } -void LaunchBrowser(const char *url) { +void System_LaunchUrl(LaunchUrlType urlType, const char *url) { + switch (urlType) { + case LaunchUrlType::BROWSER_URL: + case LaunchUrlType::MARKET_URL: + { #if PPSSPP_PLATFORM(SWITCH) - Uuid uuid = { 0 }; - WebWifiConfig conf; - webWifiCreate(&conf, NULL, url, uuid, 0); - webWifiShow(&conf, NULL); + Uuid uuid = { 0 }; + WebWifiConfig conf; + webWifiCreate(&conf, NULL, url, uuid, 0); + webWifiShow(&conf, NULL); #elif defined(MOBILE_DEVICE) - INFO_LOG(SYSTEM, "Would have gone to %s but LaunchBrowser is not implemented on this platform", url); + INFO_LOG(SYSTEM, "Would have gone to %s but LaunchBrowser is not implemented on this platform", url); #elif defined(_WIN32) - std::wstring wurl = ConvertUTF8ToWString(url); - ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); + std::wstring wurl = ConvertUTF8ToWString(url); + ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); #elif defined(__APPLE__) - std::string command = std::string("open ") + url; - system(command.c_str()); + std::string command = std::string("open ") + url; + system(command.c_str()); #else - std::string command = std::string("xdg-open ") + url; - int err = system(command.c_str()); - if (err) { - INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); - } + std::string command = std::string("xdg-open ") + url; + int err = system(command.c_str()); + if (err) { + INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); + } #endif -} - -void LaunchMarket(const char *url) { -#if PPSSPP_PLATFORM(SWITCH) - Uuid uuid = { 0 }; - WebWifiConfig conf; - webWifiCreate(&conf, NULL, url, uuid, 0); - webWifiShow(&conf, NULL); -#elif defined(MOBILE_DEVICE) - INFO_LOG(SYSTEM, "Would have gone to %s but LaunchMarket is not implemented on this platform", url); -#elif defined(_WIN32) - std::wstring wurl = ConvertUTF8ToWString(url); - ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); -#elif defined(__APPLE__) - std::string command = std::string("open ") + url; - system(command.c_str()); -#else - std::string command = std::string("xdg-open ") + url; - int err = system(command.c_str()); - if (err) { - INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); + break; } -#endif -} - -void LaunchEmail(const char *email_address) { + case LaunchUrlType::EMAIL_ADDRESS: + { #if defined(MOBILE_DEVICE) - INFO_LOG(SYSTEM, "Would have opened your email client for %s but LaunchEmail is not implemented on this platform", email_address); + INFO_LOG(SYSTEM, "Would have opened your email client for %s but LaunchEmail is not implemented on this platform", url); #elif defined(_WIN32) - std::wstring mailto = std::wstring(L"mailto:") + ConvertUTF8ToWString(email_address); - ShellExecute(NULL, L"open", mailto.c_str(), NULL, NULL, SW_SHOWNORMAL); + std::wstring mailto = std::wstring(L"mailto:") + ConvertUTF8ToWString(url); + ShellExecute(NULL, L"open", mailto.c_str(), NULL, NULL, SW_SHOWNORMAL); #elif defined(__APPLE__) - std::string command = std::string("open mailto:") + email_address; - system(command.c_str()); + std::string command = std::string("open mailto:") + url; + system(command.c_str()); #else - std::string command = std::string("xdg-email ") + email_address; - int err = system(command.c_str()); - if (err) { - INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", email_address); - } + std::string command = std::string("xdg-email ") + url; + int err = system(command.c_str()); + if (err) { + INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); + } #endif + break; + } + } } std::string System_GetProperty(SystemProperty prop) { diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index cd6f052ab1..a8f0c9a70f 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -173,7 +173,7 @@ UI::EventReturn CwCheatScreen::OnEditCheatFile(UI::EventParams ¶ms) { } if (engine_) { #if PPSSPP_PLATFORM(UWP) - LaunchBrowser(engine_->CheatFilename().c_str()); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, engine_->CheatFilename().c_str()); #else File::OpenFileInEditor(engine_->CheatFilename()); #endif diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 33773e5adb..3cf6347576 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -140,7 +140,7 @@ void GameScreen::CreateViews() { ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins)); root_->Add(rightColumn); - + LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL); rightColumnItems->SetSpacing(0.0f); rightColumn->Add(rightColumnItems); @@ -328,7 +328,7 @@ void GameScreen::render() { } UI::EventReturn GameScreen::OnShowInFolder(UI::EventParams &e) { - OpenDirectory(gamePath_.c_str()); + System_ShowFileInFolder(gamePath_.c_str()); return UI::EVENT_DONE; } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 499765ec7b..b368e8114f 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -965,7 +965,7 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) { if (System_GetPropertyBool(SYSPROP_HAS_OPEN_DIRECTORY)) { systemSettings->Add(new Choice(sy->T("Show Memory Stick folder")))->OnClick.Add([](UI::EventParams &p) { - OpenDirectory(File::ResolvePath(g_Config.memStickDirectory.ToString()).c_str()); + System_ShowFileInFolder(File::ResolvePath(g_Config.memStickDirectory.ToString()).c_str()); return UI::EVENT_DONE; }); } @@ -1213,7 +1213,7 @@ void RecreateActivity() { UI::EventReturn GameSettingsScreen::OnAdhocGuides(UI::EventParams &e) { auto n = GetI18NCategory("Networking"); - LaunchBrowser(n->T("MultiplayerHowToURL", "https://github.com/hrydgard/ppsspp/wiki/How-to-play-multiplayer-games-with-PPSSPP")); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, n->T("MultiplayerHowToURL", "https://github.com/hrydgard/ppsspp/wiki/How-to-play-multiplayer-games-with-PPSSPP")); return UI::EVENT_DONE; } @@ -1238,7 +1238,7 @@ UI::EventReturn GameSettingsScreen::OnChangeMemStickDir(UI::EventParams &e) { DarwinDirectoryPanelCallback callback = [] (Path thePathChosen) { DarwinFileSystemServices::setUserPreferredMemoryStickDirectory(thePathChosen); }; - + memoryStickManager.presentDirectoryPanel(callback); #else screenManager()->push(new MemStickScreen(false)); diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index 5f997fca42..ccd9a1ddde 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -180,7 +180,7 @@ bool PSPButton::Touch(const TouchInput &input) { bool down = pointerDownMask_ != 0; if (down && !lastDown) { if (g_Config.bHapticFeedback) { - Vibrate(HAPTIC_VIRTUAL_KEY); + System_Vibrate(HAPTIC_VIRTUAL_KEY); } __CtrlButtonDown(pspButtonBit_); } else if (lastDown && !down) { @@ -210,7 +210,7 @@ bool ComboKey::Touch(const TouchInput &input) { if (down && !lastDown) { if (g_Config.bHapticFeedback) - Vibrate(HAPTIC_VIRTUAL_KEY); + System_Vibrate(HAPTIC_VIRTUAL_KEY); if (!repeat_) { for (int i = 0; i < ARRAY_SIZE(comboKeyList); i++) { @@ -359,7 +359,7 @@ void PSPDpad::ProcessTouch(float x, float y, bool down) { for (int i = 0; i < 4; i++) { if (pressed & dir[i]) { if (g_Config.bHapticFeedback) { - Vibrate(HAPTIC_VIRTUAL_KEY); + System_Vibrate(HAPTIC_VIRTUAL_KEY); } __CtrlButtonDown(dir[i]); } @@ -829,8 +829,8 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause, bool showPau auto addComboKey = [=](const ConfigCustomButton& cfg, const char *key, const ConfigTouchPos &touch) -> ComboKey * { using namespace CustomKey; if (touch.show) { - auto aux = root->Add(new ComboKey(cfg.key, key, cfg.toggle, cfg.repeat, controllMapper, - g_Config.iTouchButtonStyle == 0 ? comboKeyShapes[cfg.shape].i : comboKeyShapes[cfg.shape].l, comboKeyShapes[cfg.shape].i, + auto aux = root->Add(new ComboKey(cfg.key, key, cfg.toggle, cfg.repeat, controllMapper, + g_Config.iTouchButtonStyle == 0 ? comboKeyShapes[cfg.shape].i : comboKeyShapes[cfg.shape].l, comboKeyShapes[cfg.shape].i, comboKeyImages[cfg.image].i, touch.scale, comboKeyShapes[cfg.shape].d, buttonLayoutParams(touch))); aux->SetAngle(comboKeyImages[cfg.image].r, comboKeyShapes[cfg.shape].r); aux->FlipImageH(comboKeyShapes[cfg.shape].f); diff --git a/UI/HostTypes.h b/UI/HostTypes.h index c801859b07..528ae90f73 100644 --- a/UI/HostTypes.h +++ b/UI/HostTypes.h @@ -41,7 +41,6 @@ public: // this is sent from EMU thread! Make sure that Host handles it properly! void BootDone() override {} - bool IsDebuggingEnabled() override {return false;} bool AttemptLoadSymbolMap() override {return false;} void NotifySymbolMapUpdated() override {} void SetWindowTitle(const char *message) override {} diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index ed600b42d3..ba2b3e9276 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -533,7 +533,7 @@ UI::EventReturn GameBrowser::LayoutChange(UI::EventParams &e) { } UI::EventReturn GameBrowser::LastClick(UI::EventParams &e) { - LaunchBrowser(lastLink_.c_str()); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, lastLink_.c_str()); return UI::EVENT_DONE; } @@ -1226,16 +1226,16 @@ UI::EventReturn MainScreen::OnDownloadUpgrade(UI::EventParams &e) { #if PPSSPP_PLATFORM(ANDROID) // Go to app store if (System_GetPropertyBool(SYSPROP_APP_GOLD)) { - LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "market://details?id=org.ppsspp.ppssppgold"); } else { - LaunchBrowser("market://details?id=org.ppsspp.ppsspp"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "market://details?id=org.ppsspp.ppsspp"); } #elif PPSSPP_PLATFORM(WINDOWS) - LaunchBrowser("https://www.ppsspp.org/download"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/download"); #else // Go directly to ppsspp.org and let the user sort it out // (for details and in case downloads doesn't have their platform.) - LaunchBrowser("https://www.ppsspp.org/"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/"); #endif return UI::EVENT_DONE; } @@ -1414,20 +1414,20 @@ UI::EventReturn MainScreen::OnCredits(UI::EventParams &e) { UI::EventReturn MainScreen::OnSupport(UI::EventParams &e) { #ifdef __ANDROID__ - LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "market://details?id=org.ppsspp.ppssppgold"); #else - LaunchBrowser("https://www.ppsspp.org/buygold"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold"); #endif return UI::EVENT_DONE; } UI::EventReturn MainScreen::OnPPSSPPOrg(UI::EventParams &e) { - LaunchBrowser("https://www.ppsspp.org"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org"); return UI::EVENT_DONE; } UI::EventReturn MainScreen::OnForums(UI::EventParams &e) { - LaunchBrowser("https://forums.ppsspp.org"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://forums.ppsspp.org"); return UI::EVENT_DONE; } diff --git a/UI/MemStickScreen.cpp b/UI/MemStickScreen.cpp index e640dd5399..265be6bf68 100644 --- a/UI/MemStickScreen.cpp +++ b/UI/MemStickScreen.cpp @@ -304,7 +304,7 @@ void MemStickScreen::CreateViews() { UI::EventReturn MemStickScreen::OnHelp(UI::EventParams ¶ms) { // I'm letting the old redirect handle this one, as the target is within /docs on the website, // and that structure may change a bit. - LaunchBrowser("https://www.ppsspp.org/guide_storage.html"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/guide_storage.html"); return UI::EVENT_DONE; } diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index b9e93d7ab0..170844f6a4 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -657,7 +657,7 @@ void NewLanguageScreen::OnCompleted(DialogResult result) { g_Config.sLanguageIni = code; bool iniLoadedSuccessfully = false; - // Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to + // Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to // test new languages without recompiling the entire app, which is a hassle). const Path langOverridePath = GetSysDirectory(DIRECTORY_SYSTEM) / "lang"; @@ -840,9 +840,9 @@ void CreditsScreen::CreateViews() { UI::EventReturn CreditsScreen::OnSupport(UI::EventParams &e) { #ifdef __ANDROID__ - LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "market://details?id=org.ppsspp.ppssppgold"); #else - LaunchBrowser("https://www.ppsspp.org/buygold"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold"); #endif return UI::EVENT_DONE; } @@ -851,28 +851,28 @@ UI::EventReturn CreditsScreen::OnTwitter(UI::EventParams &e) { #ifdef __ANDROID__ System_SendMessage("showTwitter", "PPSSPP_emu"); #else - LaunchBrowser("https://twitter.com/#!/PPSSPP_emu"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://twitter.com/#!/PPSSPP_emu"); #endif return UI::EVENT_DONE; } UI::EventReturn CreditsScreen::OnPPSSPPOrg(UI::EventParams &e) { - LaunchBrowser("https://www.ppsspp.org"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org"); return UI::EVENT_DONE; } UI::EventReturn CreditsScreen::OnPrivacy(UI::EventParams &e) { - LaunchBrowser("https://www.ppsspp.org/privacy"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/privacy"); return UI::EVENT_DONE; } UI::EventReturn CreditsScreen::OnForums(UI::EventParams &e) { - LaunchBrowser("https://forums.ppsspp.org"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://forums.ppsspp.org"); return UI::EVENT_DONE; } UI::EventReturn CreditsScreen::OnDiscord(UI::EventParams &e) { - LaunchBrowser("https://discord.gg/5NJB6dD"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://discord.gg/5NJB6dD"); return UI::EVENT_DONE; } diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index 7bd0815de5..44585eb85a 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -392,7 +392,7 @@ EventReturn ReportScreen::HandleSubmit(EventParams &e) { EventReturn ReportScreen::HandleBrowser(EventParams &e) { const std::string url = "https://" + Reporting::ServerHost() + "/"; - LaunchBrowser(url.c_str()); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str()); return EVENT_DONE; } @@ -515,6 +515,6 @@ void ReportFinishScreen::ShowSuggestions() { UI::EventReturn ReportFinishScreen::HandleViewFeedback(UI::EventParams &e) { const std::string url = "https://" + Reporting::ServerHost() + "/game/" + Reporting::CurrentGameID(); - LaunchBrowser(url.c_str()); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str()); return EVENT_DONE; } diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index dd4ae939e7..87e7fff4c6 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -476,17 +476,17 @@ void System_SendMessage(const char *command, const char *parameter) { } } -void OpenDirectory(const char *path) { +void System_ShowFileInFolder(const char *path) { // Unsupported } -void LaunchBrowser(const char *url) { +void System_LaunchUrl(LaunchUrlType urlType, const char *url) { auto uri = ref new Windows::Foundation::Uri(ToPlatformString(url)); create_task(Windows::System::Launcher::LaunchUriAsync(uri)).then([](bool b) {}); } -void Vibrate(int length_ms) { +void System_Vibrate(int length_ms) { #if _M_ARM if (length_ms == -1 || length_ms == -3) length_ms = 50; diff --git a/UWP/UWPHost.cpp b/UWP/UWPHost.cpp index 5e489e161c..977d5ddfc9 100644 --- a/UWP/UWPHost.cpp +++ b/UWP/UWPHost.cpp @@ -148,10 +148,6 @@ void UWPHost::NotifySymbolMapUpdated() { g_symbolMap->SortSymbols(); } -bool UWPHost::IsDebuggingEnabled() { - return false; -} - bool UWPHost::CanCreateShortcut() { return false; // Turn on when below function fixed } diff --git a/UWP/UWPHost.h b/UWP/UWPHost.h index ee49d0cba5..dea4547aa5 100644 --- a/UWP/UWPHost.h +++ b/UWP/UWPHost.h @@ -26,7 +26,6 @@ public: void UpdateSound() override; void ShutdownSound() override; - bool IsDebuggingEnabled() override; void BootDone() override; bool AttemptLoadSymbolMap() override; void SaveSymbolMap() override; diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index c28b59279e..c4225d95d8 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -219,7 +219,7 @@ void MainThreadFunc() { } else { if (g_Config.iGPUBackend == (int)GPUBackend::DIRECT3D9) { // Allow the user to download the DX9 runtime. - LaunchBrowser("https://www.microsoft.com/en-us/download/details.aspx?id=34429"); + System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.microsoft.com/en-us/download/details.aspx?id=34429"); } } diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index ae35d85ab6..c96643cc38 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -991,7 +991,7 @@ void CGEDebugger::UpdateSize(WORD width, WORD height) { tabRect.right = tabRect.left + (width / 2 - tabRect.left * 2); } tabRect.bottom = tabRect.top + (height - tabRect.top - tabRect.left); - + RECT tabRectRight = tabRect; if (tabs && tabsRight_ && tabs->Count() == 0 && tabsRight_->Count() != 0) { tabRect.right = tabRect.left; @@ -1005,7 +1005,7 @@ void CGEDebugger::UpdateSize(WORD width, WORD height) { HWND frameWnd = GetDlgItem(m_hDlg, IDC_GEDBG_FRAME); GetWindowRect(frameWnd, &frameRect); MapWindowPoints(HWND_DESKTOP, m_hDlg, (LPPOINT)&frameRect, 2); - + RECT trRect = { frameRect.right + 10, frameRect.top, tabRectRight.right, tabRectRight.top }; if (tabsTR_ && tabsTR_->Count() == 0) { trRect.right = trRect.left; @@ -1045,7 +1045,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { UpdateSize(LOWORD(lParam), HIWORD(lParam)); SavePosition(); return TRUE; - + case WM_MOVE: SavePosition(); return TRUE; @@ -1213,7 +1213,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { case IDC_GEDBG_RECORD: GPURecord::SetCallback([](const Path &path) { // Opens a Windows Explorer window with the file. - OpenDirectory(path.c_str()); + System_ShowFileInFolder(path.c_str()); }); GPURecord::Activate(); break; diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 5f194bcd88..c92483f0b8 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -304,14 +304,6 @@ void WindowsHost::NotifySymbolMapUpdated() { PostMessage(mainWindow_, WM_USER + 1, 0, 0); } -bool WindowsHost::IsDebuggingEnabled() { -#ifdef _DEBUG - return true; -#else - return false; -#endif -} - // http://msdn.microsoft.com/en-us/library/aa969393.aspx HRESULT CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszArguments, LPCWSTR lpszPathLink, LPCWSTR lpszDesc) { HRESULT hres; diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h index 492d47a9db..6eb659e55e 100644 --- a/Windows/WindowsHost.h +++ b/Windows/WindowsHost.h @@ -48,7 +48,6 @@ public: void UpdateSound() override; void ShutdownSound() override; - bool IsDebuggingEnabled() override; void BootDone() override; bool AttemptLoadSymbolMap() override; void SaveSymbolMap() override; diff --git a/Windows/main.cpp b/Windows/main.cpp index f1be24ef22..b776533ddc 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -110,7 +110,7 @@ int g_activeWindow = 0; static std::thread inputBoxThread; static bool inputBoxRunning = false; -void OpenDirectory(const char *path) { +void System_ShowFileInFolder(const char *path) { // SHParseDisplayName can't handle relative paths, so normalize first. std::string resolved = ReplaceAll(File::ResolvePath(path), "/", "\\"); @@ -125,11 +125,11 @@ void OpenDirectory(const char *path) { } } -void LaunchBrowser(const char *url) { +void System_LaunchUrl(LaunchUrlType urlType, const char *url) { ShellExecute(NULL, L"open", ConvertUTF8ToWString(url).c_str(), NULL, NULL, SW_SHOWNORMAL); } -void Vibrate(int length_ms) { +void System_Vibrate(int length_ms) { // Ignore on PC } diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index e89ec0ec33..c67300d53b 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -381,30 +381,26 @@ void System_Toast(const char *text) { PushCommand("toast", text); } -void ShowKeyboard() { +void System_ShowKeyboard() { PushCommand("showKeyboard", ""); } -void Vibrate(int length_ms) { +void System_Vibrate(int length_ms) { char temp[32]; sprintf(temp, "%i", length_ms); PushCommand("vibrate", temp); } -void OpenDirectory(const char *path) { +void System_ShowFileInFolder(const char *path) { // Unsupported } -void LaunchBrowser(const char *url) { - PushCommand("launchBrowser", url); -} - -void LaunchMarket(const char *url) { - PushCommand("launchMarket", url); -} - -void LaunchEmail(const char *email_address) { - PushCommand("launchEmail", email_address); +void System_LaunchUrl(LaunchUrlType urlType, const char *url) { + switch (urlType) { + case LaunchUrlType::BROWSER_URL: PushCommand("launchBrowser", url); break; + case LaunchUrlType::MARKET_URL: PushCommand("launchMarket", url); break; + case LaunchUrlType::EMAIL_ADDRESS: PushCommand("launchEmail", url); break; + } } void System_SendMessage(const char *command, const char *parameter) { @@ -855,11 +851,11 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioRecording_1Stop(JNIEnv *, AndroidAudio_Recording_Stop(g_audioState); } -bool audioRecording_Available() { +bool System_AudioRecordingIsAvailable() { return true; } -bool audioRecording_State() { +bool System_AudioRecordingState() { return AndroidAudio_Recording_State(g_audioState); } @@ -1278,7 +1274,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setDisplayParameters(JN } } -std::vector __cameraGetDeviceList() { +std::vector System_GetCameraDeviceList() { jclass cameraClass = findClass("org/ppsspp/ppsspp/CameraHelper"); jmethodID deviceListMethod = getEnv()->GetStaticMethodID(cameraClass, "getDeviceList", "()Ljava/util/ArrayList;"); jobject deviceListObject = getEnv()->CallStaticObjectMethod(cameraClass, deviceListMethod); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index d6cef79416..8258c58593 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -60,8 +60,8 @@ jclass findClass(const char *name) { return nullptr; } -bool audioRecording_Available() { return false; } -bool audioRecording_State() { return false; } +bool System_AudioRecordingIsAvailable() { return false; } +bool System_AudioRecordingState() { return false; } #endif class PrintfLogger : public LogListener { diff --git a/headless/StubHost.h b/headless/StubHost.h index a77a42424d..5dc0f5a258 100644 --- a/headless/StubHost.h +++ b/headless/StubHost.h @@ -44,7 +44,6 @@ public: // this is sent from EMU thread! Make sure that Host handles it properly void BootDone() override {} - bool IsDebuggingEnabled() override { return false; } bool AttemptLoadSymbolMap() override { g_symbolMap->Clear(); return false; } void NotifySymbolMapUpdated() override {} diff --git a/ios/CameraHelper.mm b/ios/CameraHelper.mm index ef6a7c305a..86dc9f1aec 100644 --- a/ios/CameraHelper.mm +++ b/ios/CameraHelper.mm @@ -14,7 +14,7 @@ @implementation CameraHelper -std::vector __cameraGetDeviceList() { +std::vector System_GetCameraDeviceList() { std::vector deviceList; for (AVCaptureDevice *device in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) { deviceList.push_back([device.localizedName UTF8String]); diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 8e30578dec..44de91f4bc 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -178,7 +178,7 @@ static LocationHelper *locationHelper; self.view.frame = [screen bounds]; self.view.multipleTouchEnabled = YES; self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; - + if (!self.context) { self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; } @@ -193,7 +193,7 @@ static LocationHelper *locationHelper; [[DisplayManager shared] updateResolution:[UIScreen mainScreen]]; graphicsContext = new IOSGraphicsContext(); - + graphicsContext->GetDrawContext()->SetErrorCallback([](const char *shortDesc, const char *details, void *userdata) { host->NotifyUserMessage(details, 5.0, 0xFFFFFFFF, "error_callback"); }, nullptr); @@ -202,12 +202,12 @@ static LocationHelper *locationHelper; dp_xscale = (float)g_display.dp_xres / (float)g_display.pixel_xres; dp_yscale = (float)g_display.dp_yres / (float)g_display.pixel_yres; - + /*self.iCadeView = [[iCadeReaderView alloc] init]; [self.view addSubview:self.iCadeView]; self.iCadeView.delegate = self; self.iCadeView.active = YES;*/ - + #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 if ([GCController class]) { if ([[GCController controllers] count] > 0) { @@ -221,7 +221,7 @@ static LocationHelper *locationHelper; locationHelper = [[LocationHelper alloc] init]; [locationHelper setDelegate:self]; - + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ NativeInitGraphics(graphicsContext); @@ -238,7 +238,7 @@ static LocationHelper *locationHelper; // Also ask the main thread to stop, so it doesn't hang waiting for a new frame. INFO_LOG(SYSTEM, "Emulation thread stopping\n"); graphicsContext->StopThread(); - + threadStopped = true; }); } @@ -317,7 +317,7 @@ static LocationHelper *locationHelper; - (void)touchX:(float)x y:(float)y code:(int)code pointerId:(int)pointerId { float scale = [UIScreen mainScreen].scale; - + if ([[UIScreen mainScreen] respondsToSelector:@selector(nativeScale)]) { scale = [UIScreen mainScreen].nativeScale; } @@ -434,22 +434,22 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { axis.axisId = JOYSTICK_AXIS_Y; axis.value = -1.0f; break; - + case iCadeJoystickDown : axis.axisId = JOYSTICK_AXIS_Y; axis.value = 1.0f; break; - + case iCadeJoystickLeft : axis.axisId = JOYSTICK_AXIS_X; axis.value = -1.0f; break; - + case iCadeJoystickRight : axis.axisId = JOYSTICK_AXIS_X; axis.value = 1.0f; break; - + default: break; } @@ -479,7 +479,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { simulateAnalog = !simulateAnalog; lastSelectPress = time_now_d(); } - + if (button == iCadeButtonC) { // Pressing Start twice within 1 second will take to the Emu menu if ((lastStartPress + 1.0f) > time_now_d()) { @@ -492,7 +492,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { } lastStartPress = time_now_d(); } - + if (simulateAnalog && ((button == iCadeJoystickUp) || (button == iCadeJoystickDown) || @@ -504,22 +504,22 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { axis.axisId = JOYSTICK_AXIS_Y; axis.value = 0.0f; break; - + case iCadeJoystickDown : axis.axisId = JOYSTICK_AXIS_Y; axis.value = 0.0f; break; - + case iCadeJoystickLeft : axis.axisId = JOYSTICK_AXIS_X; axis.value = 0.0f; break; - + case iCadeJoystickRight : axis.axisId = JOYSTICK_AXIS_X; axis.value = 0.0f; break; - + default: break; } @@ -533,16 +533,16 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { key.deviceId = DEVICE_ID_PAD_0; NativeKey(key); } - + } #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 - (void)controllerDidConnect:(NSNotification *)note { if (![[GCController controllers] containsObject:self.gameController]) self.gameController = nil; - + if (self.gameController != nil) return; // already have a connected controller - + [self setupController:(GCController *)note.object]; } @@ -550,7 +550,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { { if (self.gameController == note.object) { self.gameController = nil; - + if ([[GCController controllers] count] > 0) { [self setupController:[[GCController controllers] firstObject]]; } else { @@ -577,15 +577,15 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { - (void)setupController:(GCController *)controller { self.gameController = controller; - + GCGamepad *baseProfile = self.gameController.gamepad; if (baseProfile == nil) { self.gameController = nil; return; } - + [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; // prevent auto-lock - + self.gameController.controllerPausedHandler = ^(GCController *controller) { KeyInput key; key.flags = KEY_DOWN; @@ -593,55 +593,55 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { key.deviceId = DEVICE_ID_KEYBOARD; NativeKey(key); }; - + baseProfile.buttonA.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_2]; // Cross }; - + baseProfile.buttonB.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_3]; // Circle }; - + baseProfile.buttonX.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_4]; // Square }; - + baseProfile.buttonY.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_1]; // Triangle }; - + baseProfile.leftShoulder.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_7]; // LTrigger }; - + baseProfile.rightShoulder.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_8]; // RTrigger }; - + baseProfile.dpad.up.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_DPAD_UP]; }; - + baseProfile.dpad.down.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_DPAD_DOWN]; }; - + baseProfile.dpad.left.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_DPAD_LEFT]; }; - + baseProfile.dpad.right.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_DPAD_RIGHT]; }; - + GCExtendedGamepad *extendedProfile = self.gameController.extendedGamepad; if (extendedProfile == nil) return; // controller doesn't support extendedGamepad profile - + extendedProfile.leftTrigger.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_9]; // Select }; - + extendedProfile.rightTrigger.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { [self controllerButtonPressed:pressed keyCode:NKCODE_BUTTON_10]; // Start }; @@ -677,7 +677,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { }; } #endif - + extendedProfile.leftThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value) { AxisInput axisInput; axisInput.deviceId = DEVICE_ID_PAD_0; @@ -686,7 +686,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { axisInput.value = value; NativeAxis(axisInput); }; - + extendedProfile.leftThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value) { AxisInput axisInput; axisInput.deviceId = DEVICE_ID_PAD_0; @@ -695,7 +695,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { axisInput.value = -value; NativeAxis(axisInput); }; - + // Map right thumbstick as another analog stick, particularly useful for controllers like the DualShock 3/4 when connected to an iOS device extendedProfile.rightThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value) { AxisInput axisInput; @@ -705,7 +705,7 @@ int ToTouchID(UITouch *uiTouch, bool allowAllocate) { axisInput.value = value; NativeAxis(axisInput); }; - + extendedProfile.rightThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value) { AxisInput axisInput; axisInput.deviceId = DEVICE_ID_PAD_0; @@ -752,11 +752,11 @@ void stopLocation() { @end -void OpenDirectory(const char *path) { +void System_ShowFileInFolder(const char *path) { // Unsupported } -void LaunchBrowser(char const* url) +void System_LaunchUrl(LaunchUrlType urlType, char const* url) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithCString:url encoding:NSStringEncodingConversionAllowLossy]]]; } diff --git a/ios/main.mm b/ios/main.mm index 3f7e6556d2..8ab82e7431 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -208,7 +208,7 @@ void System_SendMessage(const char *command, const char *parameter) { DarwinDirectoryPanelCallback callback = [] (Path thePathChosen) { NativeMessageReceived("browse_folder", thePathChosen.c_str()); }; - + DarwinFileSystemServices services; services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectorites = */ true); } @@ -236,7 +236,7 @@ BOOL SupportsTaptic() { return [val intValue] >= 2; } -void Vibrate(int mode) { +void System_Vibrate(int mode) { if (SupportsTaptic()) { PPSSPPUIApplication* app = (PPSSPPUIApplication*)[UIApplication sharedApplication]; if(app.feedbackGenerator == nil) diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 6bc6de0804..11563409fe 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -400,7 +400,6 @@ class LibretroHost : public Host AudioBufferWrite(audio, samples); } void ShutdownSound() override {} - bool IsDebuggingEnabled() override { return false; } bool AttemptLoadSymbolMap() override { return false; } }; @@ -1881,9 +1880,9 @@ void NativeResized() {} void System_Toast(const char *str) {} #if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) -std::vector __cameraGetDeviceList() { return std::vector(); } -bool audioRecording_Available() { return false; } -bool audioRecording_State() { return false; } +std::vector System_GetCameraDeviceList() { return std::vector(); } +bool System_AudioRecordingIsAvailable() { return false; } +bool System_AudioRecordingState() { return false; } void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function cb) { cb(false, ""); } #endif diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index fcbe56f282..457d51727b 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -97,8 +97,8 @@ jclass findClass(const char *name) { return nullptr; } -bool audioRecording_Available() { return false; } -bool audioRecording_State() { return false; } +bool System_AudioRecordingIsAvailable() { return false; } +bool System_AudioRecordingState() { return false; } #endif #ifndef M_PI_2 @@ -694,7 +694,7 @@ static bool TestAndroidContentURI() { EXPECT_TRUE(fileTreeURI.CanNavigateUp()); fileTreeURI.NavigateUp(); EXPECT_FALSE(fileTreeURI.CanNavigateUp()); - + EXPECT_EQ_STR(fileTreeURI.FilePath(), fileTreeURI.RootPath()); EXPECT_EQ_STR(fileTreeURI.ToString(), std::string(directoryURIString));