And "immersive", "audio_resetDevice"

This commit is contained in:
Henrik Rydgård 2023-03-22 23:15:08 +01:00
parent ac47476253
commit 4c99712b60
7 changed files with 24 additions and 22 deletions

View file

@ -179,6 +179,8 @@ enum class SystemNotification {
SWITCH_UMD_UPDATED,
ROTATE_UPDATED,
FORCE_RECREATE_ACTIVITY,
IMMERSIVE_MODE_CHANGE,
AUDIO_RESET_DEVICE,
};
std::string System_GetProperty(SystemProperty prop);

View file

@ -271,6 +271,10 @@ void System_Notify(SystemNotification notification) {
if (g_symbolMap)
g_symbolMap->SortSymbols();
break;
case SystemNotification::AUDIO_RESET_DEVICE:
StopSDLAudioDevice();
InitSDLAudioDevice();
break;
default:
break;
}
@ -380,14 +384,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
}
}
void System_SendMessage(const char *command, const char *parameter) {
#if defined(SDL)
if (!strcmp(command, "audio_resetDevice")) {
StopSDLAudioDevice();
InitSDLAudioDevice();
}
#endif
}
void System_SendMessage(const char *command, const char *parameter) {}
void System_Toast(const char *text) {}
void System_AskForPermission(SystemPermission permission) {}

View file

@ -222,12 +222,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
}
}
void System_SendMessage(const char *command, const char *parameter) {
if (!strcmp(command, "audio_resetDevice")) {
StopSDLAudioDevice();
InitSDLAudioDevice();
}
}
void System_SendMessage(const char *command, const char *parameter) {}
void System_AskForPermission(SystemPermission permission) {}
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }
@ -469,6 +464,11 @@ bool System_GetPropertyBool(SystemProperty prop) {
void System_Notify(SystemNotification notification) {
switch (notification) {
case SystemNotification::AUDIO_RESET_DEVICE:
StopSDLAudioDevice();
InitSDLAudioDevice();
break;
default:
break;
}

View file

@ -731,7 +731,7 @@ void RecreateActivity() {
}
UI::EventReturn TouchTestScreen::OnImmersiveModeChange(UI::EventParams &e) {
System_SendMessage("immersive", "");
System_Notify(SystemNotification::IMMERSIVE_MODE_CHANGE);
return UI::EVENT_DONE;
}

View file

@ -1205,7 +1205,7 @@ UI::EventReturn GameSettingsScreen::OnAdhocGuides(UI::EventParams &e) {
}
UI::EventReturn GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) {
System_SendMessage("immersive", "");
System_Notify(SystemNotification::IMMERSIVE_MODE_CHANGE);
return UI::EVENT_DONE;
}
@ -1547,7 +1547,7 @@ UI::EventReturn GameSettingsScreen::OnAudioDevice(UI::EventParams &e) {
if (g_Config.sAudioDevice == a->T("Auto")) {
g_Config.sAudioDevice.clear();
}
System_SendMessage("audio_resetDevice", "");
System_Notify(SystemNotification::AUDIO_RESET_DEVICE);
return UI::EVENT_DONE;
}

View file

@ -85,7 +85,7 @@ bool AndroidVulkanContext::InitAPI() {
INFO_LOG(G3D, "Creating Vulkan device");
if (g_Vulkan->CreateDevice() != VK_SUCCESS) {
INFO_LOG(G3D, "Failed to create vulkan device: %s", g_Vulkan->InitError().c_str());
System_SendMessage("toast", "No Vulkan driver found. Using OpenGL instead.");
System_Toast("No Vulkan driver found. Using OpenGL instead.");
g_Vulkan->DestroyInstance();
delete g_Vulkan;
g_Vulkan = nullptr;

View file

@ -1033,6 +1033,9 @@ void System_Notify(SystemNotification notification) {
case SystemNotification::FORCE_RECREATE_ACTIVITY:
PushCommand("recreate", "");
break;
case SystemNotification::IMMERSIVE_MODE_CHANGE:
PushCommand("immersive", "");
break;
}
}
@ -1062,16 +1065,16 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
case SystemRequestType::CAMERA_COMMAND:
PushCommand("camera_command", param1);
break;
return true;
case SystemRequestType::GPS_COMMAND:
PushCommand("gps_command", param1);
break;
return true;
case SystemRequestType::MICROPHONE_COMMAND:
PushCommand("microphone_command", param1);
break;
return true;
case SystemRequestType::SHARE_TEXT:
PushCommand("share_text", param1);
break;
return true;
default:
return false;
}