Merge pull request #17962 from hrydgard/toggle-wlan-switch

Add mappable key to toggle networking
This commit is contained in:
Henrik Rydgård 2023-08-24 09:52:29 +02:00 committed by GitHub
commit 30016bc0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 6 deletions

View File

@ -91,6 +91,11 @@ void OnScreenDisplay::Show(OSDType type, const std::string &text, const std::str
entries_.insert(entries_.begin(), msg);
}
void OnScreenDisplay::ShowOnOff(const std::string &message, bool on, float duration_s) {
// TODO: translate "on" and "off"? Or just get rid of this whole thing?
Show(OSDType::MESSAGE_INFO, message + ": " + (on ? "on" : "off"), duration_s);
}
void OnScreenDisplay::ShowAchievementUnlocked(int achievementID) {
double now = time_now_d();
@ -201,18 +206,12 @@ void OnScreenDisplay::ShowLeaderboardTracker(int leaderboardTrackerID, const cha
void OnScreenDisplay::ShowLeaderboardStartEnd(const std::string &title, const std::string &description, bool started) {
g_OSD.Show(OSDType::LEADERBOARD_STARTED_FAILED, title, description, 3.0f);
}
void OnScreenDisplay::ShowLeaderboardSubmitted(const std::string &title, const std::string &value) {
g_OSD.Show(OSDType::MESSAGE_SUCCESS, title, value, 3.0f);
}
void OnScreenDisplay::ShowOnOff(const std::string &message, bool on, float duration_s) {
// TODO: translate "on" and "off"? Or just get rid of this whole thing?
Show(OSDType::MESSAGE_INFO, message + ": " + (on ? "on" : "off"), duration_s);
}
void OnScreenDisplay::SetProgressBar(std::string id, std::string &&message, float minValue, float maxValue, float progress, float delay) {
_dbg_assert_(!my_isnanorinf(progress));
_dbg_assert_(!my_isnanorinf(minValue));

View File

@ -431,6 +431,8 @@ const KeyMap_IntStrPair psp_button_names[] = {
{VIRTKEY_SCREEN_ROTATION_HORIZONTAL180, "Display Landscape Reversed"},
#endif
{VIRTKEY_TOGGLE_WLAN, "Toggle WLAN"},
{CTRL_HOME, "Home"},
{CTRL_HOLD, "Hold"},
{CTRL_WLAN, "Wlan"},

View File

@ -72,6 +72,7 @@ enum {
VIRTKEY_VR_CAMERA_ADJUST = 0x40000025,
VIRTKEY_VR_CAMERA_RESET = 0x40000026,
VIRTKEY_PREVIOUS_SLOT = 0x40000027,
VIRTKEY_TOGGLE_WLAN = 0x40000028,
VIRTKEY_LAST,
VIRTKEY_COUNT = VIRTKEY_LAST - VIRTKEY_FIRST
};

View File

@ -794,6 +794,16 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) {
if (down)
g_Config.iInternalScreenRotation = ROTATION_LOCKED_HORIZONTAL180;
break;
case VIRTKEY_TOGGLE_WLAN:
if (down) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
auto di = GetI18NCategory(I18NCat::DIALOG);
g_Config.bEnableWlan = !g_Config.bEnableWlan;
// Try to avoid adding more strings so we piece together a message from existing ones.
g_OSD.Show(OSDType::MESSAGE_INFO, StringFromFormat(
"%s: %s", n->T("Enable networking"), g_Config.bEnableWlan ? di->T("Enabled") : di->T("Disabled")), 2.0, "toggle_wlan");
}
break;
}
}

View File

@ -804,6 +804,7 @@ Texture Dumping = Texture dumping
Texture Replacement = Texture replacement
Toggle Fullscreen = Toggle fullscreen
Toggle mode = Toggle mode
Toggle WLAN = Toggle WLAN
Triangle = Triangle
Fast-forward = Fast-forward
Up = Dpad Up