Remove System_SendMessage!

iOS, Qt buildfixes
This commit is contained in:
Henrik Rydgård 2023-03-22 23:25:00 +01:00
parent 4c99712b60
commit b440e28e38
16 changed files with 29 additions and 39 deletions

View file

@ -116,3 +116,7 @@ inline void System_MicrophoneCommand(const std::string &command) {
inline void System_ShareText(const std::string &text) {
g_requestManager.MakeSystemRequest(SystemRequestType::SHARE_TEXT, nullptr, text, "", 0);
}
inline void System_NotifyUIState(const std::string &state) {
g_requestManager.MakeSystemRequest(SystemRequestType::NOTIFY_UI_STATE, nullptr, state, "", 0);
}

View file

@ -73,6 +73,7 @@ enum class SystemRequestType {
MICROPHONE_COMMAND,
SHARE_TEXT,
NOTIFY_UI_STATE, // Used on Android only. Not a SystemNotification since it takes a parameter.
};
// Implementations are supposed to process the request, and post the response to the g_RequestManager (see Message.h).
@ -82,9 +83,6 @@ enum class SystemRequestType {
// Some requests don't use responses.
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string &param1, const std::string &param2, int param3);
// TODO: To be separated into requests, see Request.h, and a way to post "UI messages".
void System_SendMessage(const char *command, const char *parameter);
PermissionStatus System_GetPermissionStatus(SystemPermission permission);
void System_AskForPermission(SystemPermission permission);
@ -181,6 +179,7 @@ enum class SystemNotification {
FORCE_RECREATE_ACTIVITY,
IMMERSIVE_MODE_CHANGE,
AUDIO_RESET_DEVICE,
SUSTAINED_PERF_CHANGE,
};
std::string System_GetProperty(SystemProperty prop);

View file

@ -33,6 +33,7 @@
#include <condition_variable>
#include "Common/System/System.h"
#include "Common/System/Request.h"
#include "Common/File/Path.h"
#include "Common/Math/math_util.h"
#include "Common/Thread/ThreadUtil.h"
@ -134,7 +135,7 @@ void UpdateUIState(GlobalUIState newState) {
case UISTATE_EXCEPTION: state = "exception"; break;
}
if (state) {
System_SendMessage("uistate", state);
System_NotifyUIState(state);
}
}
}

View file

@ -343,7 +343,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
qApp->exit(0);
return true;
case SystemRequestType::COPY_TO_CLIPBOARD:
QApplication::clipboard()->setText(parameter);
QApplication::clipboard()->setText(param1.c_str());
return true;
case SystemRequestType::INPUT_TEXT_MODAL:
{
@ -371,11 +371,11 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
QCoreApplication::postEvent(emugl, new QEvent((QEvent::Type)browseFolderEvent));
return true;
case SystemRequestType::CAMERA_COMMAND:
if (!strncmp(parameter, "startVideo", 10)) {
if (!strncmp(param1.c_str(), "startVideo", 10)) {
int width = 0, height = 0;
sscanf(parameter, "startVideo_%dx%d", &width, &height);
sscanf(param1.c_str(), "startVideo_%dx%d", &width, &height);
emit(qtcamera->onStartCamera(width, height));
} else if (!strcmp(parameter, "stopVideo")) {
} else if (param1 == "stopVideo") {
emit(qtcamera->onStopCamera());
}
return true;
@ -384,7 +384,6 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
}
}
void System_SendMessage(const char *command, const char *parameter) {}
void System_Toast(const char *text) {}
void System_AskForPermission(SystemPermission permission) {}

View file

@ -222,8 +222,6 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
}
}
void System_SendMessage(const char *command, const char *parameter) {}
void System_AskForPermission(SystemPermission permission) {}
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }

View file

@ -211,7 +211,6 @@ bool EmuScreen::bootAllowStorage(const Path &filename) {
case PERMISSION_STATUS_DENIED:
stopRender_ = true;
screenManager()->switchScreen(new MainScreen());
System_SendMessage("event", "failstartgame");
return false;
case PERMISSION_STATUS_PENDING:
@ -244,7 +243,6 @@ void EmuScreen::bootGame(const Path &filename) {
if (invalid_) {
errorMessage_ = error_string;
ERROR_LOG(BOOT, "%s", errorMessage_.c_str());
System_SendMessage("event", "failstartgame");
return;
}
bootComplete();
@ -329,7 +327,6 @@ void EmuScreen::bootGame(const Path &filename) {
invalid_ = true;
errorMessage_ = error_string;
ERROR_LOG(BOOT, "%s", errorMessage_.c_str());
System_SendMessage("event", "failstartgame");
}
if (PSP_CoreParameter().compat.flags().RequireBufferedRendering && g_Config.bSkipBufferEffects) {
@ -393,8 +390,6 @@ void EmuScreen::bootComplete() {
#endif
}
System_SendMessage("event", "startgame");
saveStateSlot_ = SaveState::GetCurrentSlot();
loadingViewColor_->Divert(0x00FFFFFF, 0.2f);
@ -430,7 +425,6 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
// DR_YES means a message sent to PauseMenu by NativeMessageReceived.
if (result == DR_OK || quit_) {
screenManager()->switchScreen(new MainScreen());
System_SendMessage("event", "exitgame");
quit_ = false;
}
// Returning to the PauseScreen, unless we're stepping, means we should go back to controls.
@ -473,7 +467,6 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
ERROR_LOG(LOADER, "Error resetting: %s", resetError.c_str());
stopRender_ = true;
screenManager()->switchScreen(new MainScreen());
System_SendMessage("event", "failstartgame");
return;
}
} else if (!strcmp(message, "boot")) {

View file

@ -1210,7 +1210,7 @@ UI::EventReturn GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) {
}
UI::EventReturn GameSettingsScreen::OnSustainedPerformanceModeChange(UI::EventParams &e) {
System_SendMessage("sustainedPerfMode", "");
System_Notify(SystemNotification::SUSTAINED_PERF_CHANGE);
return UI::EVENT_DONE;
}

View file

@ -980,7 +980,6 @@ UI::EventReturn GameBrowser::OnHomebrewStore(UI::EventParams &e) {
}
MainScreen::MainScreen() {
System_SendMessage("event", "mainscreen");
g_BackgroundAudio.SetGame(Path());
}

View file

@ -507,8 +507,6 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
}
}
void System_SendMessage(const char *command, const char *parameter) {}
void System_ShowFileInFolder(const char *path) {
// Unsupported
}

View file

@ -565,8 +565,6 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
}
}
void System_SendMessage(const char *command, const char *parameter) {}
void System_AskForPermission(SystemPermission permission) {}
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }

View file

@ -401,11 +401,6 @@ void System_LaunchUrl(LaunchUrlType urlType, const char *url) {
}
}
void System_SendMessage(const char *command, const char *parameter) {
// TODO: Using sendmessage this way is deprecated.
PushCommand(command, parameter);
}
std::string System_GetProperty(SystemProperty prop) {
switch (prop) {
case SYSPROP_NAME:
@ -1036,6 +1031,9 @@ void System_Notify(SystemNotification notification) {
case SystemNotification::IMMERSIVE_MODE_CHANGE:
PushCommand("immersive", "");
break;
case SystemNotification::SUSTAINED_PERF_CHANGE:
PushCommand("sustainedPerfMode", "");
break;
}
}
@ -1075,6 +1073,9 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
case SystemRequestType::SHARE_TEXT:
PushCommand("share_text", param1);
return true;
case SystemRequestType::NOTIFY_UI_STATE:
PushCommand("uistate", param1);
return true;
default:
return false;
}

View file

@ -115,7 +115,6 @@ bool System_GetPropertyBool(SystemProperty prop) {
}
}
void System_Notify(SystemNotification notification) {}
void System_SendMessage(const char *command, const char *parameter) {}
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string &param1, const std::string &param2, int param3) { return false; }
void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function<void(bool, const std::string &)> cb) { cb(false, ""); }
void System_AskForPermission(SystemPermission permission) {}

View file

@ -160,6 +160,11 @@ static LocationHelper *locationHelper;
});
}
extern float g_safeInsetLeft;
extern float g_safeInsetRight;
extern float g_safeInsetTop;
extern float g_safeInsetBottom;
- (void)viewSafeAreaInsetsDidChange {
if (@available(iOS 11.0, *)) {
[super viewSafeAreaInsetsDidChange];

View file

@ -89,10 +89,10 @@ void *exception_handler(void *argument) {
return NULL;
}
static float g_safeInsetLeft = 0.0;
static float g_safeInsetRight = 0.0;
static float g_safeInsetTop = 0.0;
static float g_safeInsetBottom = 0.0;
float g_safeInsetLeft = 0.0;
float g_safeInsetRight = 0.0;
float g_safeInsetTop = 0.0;
float g_safeInsetBottom = 0.0;
// We no longer need to judge if jit is usable or not by according to the ios version.
/*
@ -176,8 +176,6 @@ void System_Notify(SystemNotification notification) {
}
}
void System_SendMessage(const char *command, const char *parameter) {}
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string &param1, const std::string &param2, int param3) {
switch (type) {
case SystemRequestType::EXIT_APP:
@ -227,7 +225,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
case SystemRequestType::GPS_COMMAND:
if (param1 == "open") {
startLocation();
} else if (param1 == "close")) {
} else if (param1 == "close") {
stopLocation();
}
return true;

View file

@ -1875,7 +1875,6 @@ void System_Notify(SystemNotification notification) {
}
}
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string &param1, const std::string &param2, int param3) { return false; }
void System_SendMessage(const char *command, const char *parameter) {}
void NativeUpdate() {}
void NativeRender(GraphicsContext *graphicsContext) {}
void NativeResized() {}

View file

@ -41,7 +41,6 @@ void NativeUpdate() { }
void NativeRender(GraphicsContext *graphicsContext) { }
void NativeResized() { }
void System_SendMessage(const char *command, const char *parameter) {}
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string &param1, const std::string &param2, int param3) { return false; }
void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function<void(bool, const std::string &)> cb) { cb(false, ""); }
void System_AskForPermission(SystemPermission permission) {}