Rename some system functions, merge the Launch* ones.

android launchurl buildfix
This commit is contained in:
Henrik Rydgård 2023-03-21 10:42:23 +01:00
parent a9eaa4fdc8
commit d3955b42bb
32 changed files with 178 additions and 207 deletions

View File

@ -4,6 +4,16 @@
#include <vector>
#include <functional>
// 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<void(bool, const std::string &)> 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<std::string> __cameraGetDeviceList();
bool audioRecording_Available();
bool audioRecording_State();
std::vector<std::string> System_GetCameraDeviceList();
bool System_AudioRecordingIsAvailable();
bool System_AudioRecordingState();

View File

@ -332,7 +332,7 @@ std::vector<std::string> 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

View File

@ -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;
}

View File

@ -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() {}

View File

@ -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);

View File

@ -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));
}

View File

@ -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) {

View File

@ -173,7 +173,7 @@ UI::EventReturn CwCheatScreen::OnEditCheatFile(UI::EventParams &params) {
}
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

View File

@ -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;
}

View File

@ -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));

View File

@ -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);

View File

@ -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 {}

View File

@ -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;
}

View File

@ -304,7 +304,7 @@ void MemStickScreen::CreateViews() {
UI::EventReturn MemStickScreen::OnHelp(UI::EventParams &params) {
// 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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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
}

View File

@ -26,7 +26,6 @@ public:
void UpdateSound() override;
void ShutdownSound() override;
bool IsDebuggingEnabled() override;
void BootDone() override;
bool AttemptLoadSymbolMap() override;
void SaveSymbolMap() override;

View File

@ -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");
}
}

View File

@ -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;

View File

@ -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;

View File

@ -48,7 +48,6 @@ public:
void UpdateSound() override;
void ShutdownSound() override;
bool IsDebuggingEnabled() override;
void BootDone() override;
bool AttemptLoadSymbolMap() override;
void SaveSymbolMap() override;

View File

@ -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
}

View File

@ -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<std::string> __cameraGetDeviceList() {
std::vector<std::string> System_GetCameraDeviceList() {
jclass cameraClass = findClass("org/ppsspp/ppsspp/CameraHelper");
jmethodID deviceListMethod = getEnv()->GetStaticMethodID(cameraClass, "getDeviceList", "()Ljava/util/ArrayList;");
jobject deviceListObject = getEnv()->CallStaticObjectMethod(cameraClass, deviceListMethod);

View File

@ -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 {

View File

@ -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 {}

View File

@ -14,7 +14,7 @@
@implementation CameraHelper
std::vector<std::string> __cameraGetDeviceList() {
std::vector<std::string> System_GetCameraDeviceList() {
std::vector<std::string> deviceList;
for (AVCaptureDevice *device in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) {
deviceList.push_back([device.localizedName UTF8String]);

View File

@ -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]]];
}

View File

@ -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)

View File

@ -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<std::string> __cameraGetDeviceList() { return std::vector<std::string>(); }
bool audioRecording_Available() { return false; }
bool audioRecording_State() { return false; }
std::vector<std::string> System_GetCameraDeviceList() { return std::vector<std::string>(); }
bool System_AudioRecordingIsAvailable() { return false; }
bool System_AudioRecordingState() { return false; }
void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function<void(bool, const std::string &)> cb) { cb(false, ""); }
#endif

View File

@ -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));