diff --git a/Common/GPU/D3D11/thin3d_d3d11.cpp b/Common/GPU/D3D11/thin3d_d3d11.cpp index 12aa002e7b4c..6505c56e6deb 100644 --- a/Common/GPU/D3D11/thin3d_d3d11.cpp +++ b/Common/GPU/D3D11/thin3d_d3d11.cpp @@ -172,7 +172,6 @@ class D3D11DrawContext : public DrawContext { case InfoField::DRIVER: return "-"; case InfoField::SHADELANGVERSION: switch (featureLevel_) { - case D3D_FEATURE_LEVEL_1_0_CORE: return "Feature Level 1.0 Core"; case D3D_FEATURE_LEVEL_9_1: return "Feature Level 9.1"; case D3D_FEATURE_LEVEL_9_2: return "Feature Level 9.2"; case D3D_FEATURE_LEVEL_9_3: return "Feature Level 9.3"; @@ -182,7 +181,11 @@ class D3D11DrawContext : public DrawContext { case D3D_FEATURE_LEVEL_11_1: return "Feature Level 11.1"; case D3D_FEATURE_LEVEL_12_0: return "Feature Level 12.0"; case D3D_FEATURE_LEVEL_12_1: return "Feature Level 12.1"; +#ifndef __LIBRETRO__ + case D3D_FEATURE_LEVEL_1_0_CORE: return "Feature Level 1.0 Core"; // This is for compute-only devices. Useless for us. case D3D_FEATURE_LEVEL_12_2: return "Feature Level 12.2"; +#endif + default: return "Feature Level X.X"; } return "Unknown feature level"; case InfoField::APINAME: return "Direct3D 11"; diff --git a/Core/ControlMapper.cpp b/Core/ControlMapper.cpp index 5687735c8454..f32a6faaa158 100644 --- a/Core/ControlMapper.cpp +++ b/Core/ControlMapper.cpp @@ -147,8 +147,8 @@ void ConvertAnalogStick(float x, float y, float *outX, float *outY) { } void ControlMapper::SetCallbacks( - std::function onVKey, - std::function onVKeyAnalog, + std::function onVKey, + std::function onVKeyAnalog, std::function updatePSPButtons, std::function setPSPAnalog, std::function setRawAnalog) { @@ -421,7 +421,7 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping, double no // OK, handle all the virtual keys next. For these we need to do deltas here and send events. // Note that virtual keys include the analog directions, as they are driven by them. for (int i = 0; i < VIRTKEY_COUNT; i++) { - int vkId = i + VIRTKEY_FIRST; + VirtKey vkId = (VirtKey)(i + VIRTKEY_FIRST); uint32_t idForMapping = vkId; SwapMappingIfEnabled(&idForMapping); @@ -578,7 +578,7 @@ void ControlMapper::ToggleSwapAxes() { updatePSPButtons_(0, CTRL_LEFT | CTRL_RIGHT | CTRL_UP | CTRL_DOWN); - for (uint32_t vkey = VIRTKEY_FIRST; vkey < VIRTKEY_LAST; vkey++) { + for (VirtKey vkey = VIRTKEY_FIRST; vkey < VIRTKEY_LAST; vkey = (VirtKey)(vkey + 1)) { if (IsSwappableVKey(vkey)) { if (virtKeyOn_[vkey - VIRTKEY_FIRST]) { onVKey_(vkey, false); @@ -668,13 +668,13 @@ void ControlMapper::PSPKey(int deviceId, int pspKeyCode, int flags) { int vk = pspKeyCode - VIRTKEY_FIRST; if (flags & KEY_DOWN) { virtKeys_[vk] = 1.0f; - onVKey(pspKeyCode, true); - onVKeyAnalog(deviceId, pspKeyCode, 1.0f); + onVKey((VirtKey)pspKeyCode, true); + onVKeyAnalog(deviceId, (VirtKey)pspKeyCode, 1.0f); } if (flags & KEY_UP) { virtKeys_[vk] = 0.0f; - onVKey(pspKeyCode, false); - onVKeyAnalog(deviceId, pspKeyCode, 0.0f); + onVKey((VirtKey)pspKeyCode, false); + onVKeyAnalog(deviceId, (VirtKey)pspKeyCode, 0.0f); } } else { // INFO_LOG(Log::System, "pspKey %d %d", pspKeyCode, flags); @@ -685,7 +685,7 @@ void ControlMapper::PSPKey(int deviceId, int pspKeyCode, int flags) { } } -void ControlMapper::onVKeyAnalog(int deviceId, int vkey, float value) { +void ControlMapper::onVKeyAnalog(int deviceId, VirtKey vkey, float value) { // Unfortunately, for digital->analog inputs to work sanely, we need to sum up // with the opposite value too. int stick = 0; @@ -716,7 +716,7 @@ void ControlMapper::onVKeyAnalog(int deviceId, int vkey, float value) { SetPSPAxis(deviceId, stick, axis, sign * value); } -void ControlMapper::onVKey(int vkey, bool down) { +void ControlMapper::onVKey(VirtKey vkey, bool down) { switch (vkey) { case VIRTKEY_ANALOG_ROTATE_CW: if (down) { @@ -745,7 +745,7 @@ void ControlMapper::onVKey(int vkey, bool down) { void ControlMapper::GetDebugString(char *buffer, size_t bufSize) const { std::stringstream str; - for (auto iter : curInput_) { + for (auto &iter : curInput_) { char temp[256]; iter.first.FormatDebug(temp, sizeof(temp)); str << temp << ": " << iter.second.value << std::endl; diff --git a/Core/ControlMapper.h b/Core/ControlMapper.h index 313453bac070..cde5ea688481 100644 --- a/Core/ControlMapper.h +++ b/Core/ControlMapper.h @@ -21,8 +21,8 @@ class ControlMapper { // Required callbacks. // TODO: These are so many now that a virtual interface might be more appropriate.. void SetCallbacks( - std::function onVKey, - std::function onVKeyAnalog, + std::function onVKey, + std::function onVKeyAnalog, std::function updatePSPButtons, std::function setPSPAnalog, std::function setRawAnalog); @@ -58,8 +58,8 @@ class ControlMapper { void SetPSPAxis(int deviceId, int stick, char axis, float value); void UpdateAnalogOutput(int stick); - void onVKey(int vkey, bool down); - void onVKeyAnalog(int deviceId, int vkey, float value); + void onVKey(VirtKey vkey, bool down); + void onVKeyAnalog(int deviceId, VirtKey vkey, float value); void UpdateCurInputAxis(const InputMapping &mapping, float value, double timestamp); float GetDeviceAxisThreshold(int device, const InputMapping &mapping); @@ -93,8 +93,8 @@ class ControlMapper { std::map curInput_; // Callbacks - std::function onVKey_; - std::function onVKeyAnalog_; + std::function onVKey_; + std::function onVKeyAnalog_; std::function updatePSPButtons_; std::function setPSPAnalog_; std::function setRawAnalog_; diff --git a/Core/KeyMap.h b/Core/KeyMap.h index 47e99625e921..1e0cf93fc596 100644 --- a/Core/KeyMap.h +++ b/Core/KeyMap.h @@ -31,7 +31,7 @@ #define KEYMAP_ERROR_UNKNOWN_KEY 0 // Don't change any of these - it'll break backwards compatibility with configs. -enum { +enum VirtKey { VIRTKEY_FIRST = 0x40000001, VIRTKEY_AXIS_X_MIN = 0x40000001, VIRTKEY_AXIS_Y_MIN = 0x40000002, diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index f254137df4f8..5af330eabc06 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -690,7 +690,7 @@ static void ShowFpsLimitNotice() { g_OSD.Show(OSDType::TRANSPARENT_STATUS, temp, "", "I_FASTFORWARD", 1.5f, "altspeed"); } -void EmuScreen::onVKey(int virtualKeyCode, bool down) { +void EmuScreen::onVKey(VirtKey virtualKeyCode, bool down) { auto sc = GetI18NCategory(I18NCat::SCREEN); auto mc = GetI18NCategory(I18NCat::MAPPABLECONTROLS); @@ -953,13 +953,41 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) { "%s: %s", n->T("Enable networking"), g_Config.bEnableWlan ? di->T("Enabled") : di->T("Disabled")), 2.0, "toggle_wlan"); } break; + default: + // To make sure we're not in an async context. + if (down) { + queuedVirtKey_ = virtualKeyCode; + } + break; + } +} + +void EmuScreen::ProcessQueuedVKeys() { + switch (queuedVirtKey_) { case VIRTKEY_EXIT_APP: - System_ExitApp(); + { + std::string confirmExitMessage = GetConfirmExitMessage(); + if (!confirmExitMessage.empty()) { + auto di = GetI18NCategory(I18NCat::DIALOG); + confirmExitMessage += '\n'; + confirmExitMessage += di->T("Are you sure you want to exit?"); + screenManager()->push(new PromptScreen(gamePath_, confirmExitMessage, di->T("Yes"), di->T("No"), [=](bool result) { + if (result) { + System_ExitApp(); + } + })); + } else { + System_ExitApp(); + } break; } + default: + break; + } + queuedVirtKey_ = (VirtKey)0; } -void EmuScreen::onVKeyAnalog(int virtualKeyCode, float value) { +void EmuScreen::onVKeyAnalog(VirtKey virtualKeyCode, float value) { if (virtualKeyCode != VIRTKEY_SPEED_ANALOG) { return; } @@ -1478,6 +1506,8 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) { GamepadUpdateOpacity(); + ProcessQueuedVKeys(); + bool skipBufferEffects = g_Config.bSkipBufferEffects; bool framebufferBound = false; diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index 27f42f3a9198..d24479d9a910 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -82,12 +82,14 @@ class EmuScreen : public UIScreen { void runImDebugger(); void renderImDebugger(); - void onVKey(int virtualKeyCode, bool down); - void onVKeyAnalog(int virtualKeyCode, float value); + void onVKey(VirtKey virtualKeyCode, bool down); + void onVKeyAnalog(VirtKey virtualKeyCode, float value); void autoLoad(); bool checkPowerDown(); + void ProcessQueuedVKeys(); + UI::Event OnDevMenu; UI::Event OnChatMenu; bool bootPending_ = true; @@ -144,6 +146,8 @@ class EmuScreen : public UIScreen { bool keyAltRight_ = false; bool lastImguiEnabled_ = false; + + VirtKey queuedVirtKey_ = (VirtKey)0; }; bool MustRunBehind(); diff --git a/assets/lang/hu_HU.ini b/assets/lang/hu_HU.ini index 3fbdc442d711..2747ea504cbc 100644 --- a/assets/lang/hu_HU.ini +++ b/assets/lang/hu_HU.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y irányú eltolás (üres terület %-ában kifejezve Cardboard VR Settings = Google Cardboard VR beállítások Cheats = Csalások Copy to texture = Textúrába másolás -CPU texture upscaler (slow) = Felskálázás típusa +CPU texture upscaler (slow) = Felskálázás típusa (CPU) Current GPU Driver = Current GPU Driver Debugging = Hibakeresés Default GPU driver = Default GPU driver diff --git a/assets/lang/id_ID.ini b/assets/lang/id_ID.ini index 121fca035db1..62200b348f8d 100644 --- a/assets/lang/id_ID.ini +++ b/assets/lang/id_ID.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y shift (dalam % dari ruang kosong) Cardboard VR Settings = Pengaturan Google Cardboard VR Cheats = Pengecoh Copy to texture = Salin ke tekstur -CPU texture upscaler (slow) = Jenis skala-atas +CPU texture upscaler (slow) = Jenis skala-atas (CPU) Current GPU Driver = Driver GPU Saat Ini Debugging = Awakutu Default GPU driver = Driver GPU bawaan diff --git a/assets/lang/it_IT.ini b/assets/lang/it_IT.ini index 38c5eeaa1695..b604dc93fa7c 100644 --- a/assets/lang/it_IT.ini +++ b/assets/lang/it_IT.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Spostamento verticale (in % di spazio vuoto) Cardboard VR Settings = Impostazioni Google Cardboard VR Cheats = Trucchi Copy to texture = Copia nella texture -CPU texture upscaler (slow) = Tipo Ottimizzazione +CPU texture upscaler (slow) = Tipo Ottimizzazione (CPU) Current GPU Driver = Driver GPU corrente Debugging = Debugging Default GPU driver = Driver GPU predefinito diff --git a/assets/lang/ja_JP.ini b/assets/lang/ja_JP.ini index 7edc2a10c492..8b96406be8a5 100644 --- a/assets/lang/ja_JP.ini +++ b/assets/lang/ja_JP.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y軸の位置変更 (余白に対する%) Cardboard VR Settings = Google Cardboard VRの設定 Cheats = チート Copy to texture = テクスチャにコピー -CPU texture upscaler (slow) = アップスケールのタイプ +CPU texture upscaler (slow) = アップスケールのタイプ (CPU) Current GPU Driver = 現在のGPUドライバ Debugging = デバッグ Default GPU driver = デフォルトのGPUドライバ diff --git a/assets/lang/jv_ID.ini b/assets/lang/jv_ID.ini index e4d54e172458..94bf28917521 100644 --- a/assets/lang/jv_ID.ini +++ b/assets/lang/jv_ID.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y shift (in % of the blank space) Cardboard VR Settings = Setelan Karton Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Jenis Penaikan-skala +CPU texture upscaler (slow) = Jenis Penaikan-skala (CPU) Current GPU Driver = Current GPU Driver Debugging = Pilian debug Default GPU driver = Default GPU driver diff --git a/assets/lang/lo_LA.ini b/assets/lang/lo_LA.ini index 0fbe145e9b3e..c7aaab1dc988 100644 --- a/assets/lang/lo_LA.ini +++ b/assets/lang/lo_LA.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = ປັບປ່ຽນແກນ Y (ໃນ % ຂອງ Cardboard VR Settings = ການຕັ້ງຄ່າ Google Cardboard VR Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = ຮູບແບບການເພີ່ມສເກລພາບ +CPU texture upscaler (slow) = ຮູບແບບການເພີ່ມສເກລພາບ (CPU) Current GPU Driver = Current GPU Driver Debugging = ການແກ້ຈຸດບົກພ່ອງ Default GPU driver = Default GPU driver diff --git a/assets/lang/lt-LT.ini b/assets/lang/lt-LT.ini index 397e593062f1..1417aedc7f61 100644 --- a/assets/lang/lt-LT.ini +++ b/assets/lang/lt-LT.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y shift (in % of the blank space) Cardboard VR Settings = Google Cardboard VR settings Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = "Pakėlimo" tipas +CPU texture upscaler (slow) = "Pakėlimo" tipas (CPU) Current GPU Driver = Current GPU Driver Debugging = Testinis režimas Default GPU driver = Default GPU driver diff --git a/assets/lang/ms_MY.ini b/assets/lang/ms_MY.ini index 7e4424cefdb7..82829fa28f08 100644 --- a/assets/lang/ms_MY.ini +++ b/assets/lang/ms_MY.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y shift (in % of the blank space) Cardboard VR Settings = Google Cardboard VR settings Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Jenis penskalaan +CPU texture upscaler (slow) = Jenis penskalaan (CPU) Current GPU Driver = Current GPU Driver Debugging = Pempepijat Default GPU driver = Default GPU driver diff --git a/assets/lang/nl_NL.ini b/assets/lang/nl_NL.ini index c4893f4e8870..9f406bb9a2db 100644 --- a/assets/lang/nl_NL.ini +++ b/assets/lang/nl_NL.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Verschuiving Y-as (in % van de lege ruimte) Cardboard VR Settings = Instellingen voor Google Cardboard VR Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Upscaletype +CPU texture upscaler (slow) = Upscaletype (CPU) Current GPU Driver = Current GPU Driver Debugging = Fouten opsporen Default GPU driver = Default GPU driver diff --git a/assets/lang/no_NO.ini b/assets/lang/no_NO.ini index a4baed339369..157fa41b9402 100644 --- a/assets/lang/no_NO.ini +++ b/assets/lang/no_NO.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y shift (in % of the blank space) Cardboard VR Settings = Google Cardboard VR settings Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Oppskaler type +CPU texture upscaler (slow) = Oppskaler type (CPU) Current GPU Driver = Current GPU Driver Debugging = Debugging Default GPU driver = Default GPU driver diff --git a/assets/lang/pt_BR.ini b/assets/lang/pt_BR.ini index 80d2ed6bf149..4cfaf259ff7f 100644 --- a/assets/lang/pt_BR.ini +++ b/assets/lang/pt_BR.ini @@ -625,7 +625,7 @@ Backend = Backend Balanced = Balanceado Bicubic = Bi-cúbico Copy to texture = Copiar pra textura -CPU texture upscaler (slow) = Tipo de ampliação +CPU texture upscaler (slow) = Tipo de ampliação (CPU) Current GPU Driver = Driver da GPU Atual Default GPU driver = Driver padrão da GPU Disable culling = Desativar o culling diff --git a/assets/lang/pt_PT.ini b/assets/lang/pt_PT.ini index 245cc5e6575b..99bee47f4630 100644 --- a/assets/lang/pt_PT.ini +++ b/assets/lang/pt_PT.ini @@ -635,7 +635,7 @@ Cardboard Screen Y Shift = Deslocamento do Y (em % do espaço vazio) Cardboard VR Settings = Definições do Google VR Cardboard Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Tipo de ampliação +CPU texture upscaler (slow) = Tipo de ampliação (CPU) Current GPU Driver = Current GPU Driver Debugging = Debugging Default GPU driver = Default GPU driver diff --git a/assets/lang/ro_RO.ini b/assets/lang/ro_RO.ini index 3739ef7904d3..cbd2fb9e26e3 100644 --- a/assets/lang/ro_RO.ini +++ b/assets/lang/ro_RO.ini @@ -612,7 +612,7 @@ Cardboard Screen Y Shift = mișcare Y (în % din spațiu gol) Cardboard VR Settings = Setări Google Cardboard VR Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Tip Suprascalare +CPU texture upscaler (slow) = Tip Suprascalare (CPU) Current GPU Driver = Current GPU Driver Debugging = Depanare Default GPU driver = Default GPU driver diff --git a/assets/lang/tg_PH.ini b/assets/lang/tg_PH.ini index 5398e10e2129..7a61a2e109c0 100644 --- a/assets/lang/tg_PH.ini +++ b/assets/lang/tg_PH.ini @@ -612,7 +612,7 @@ Cardboard Screen Y Shift = Y shift (in % of the blank space) Cardboard VR Settings = Google Cardboard VR settings Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Uri ng upscale +CPU texture upscaler (slow) = Uri ng upscale (CPU) Current GPU Driver = Current GPU Driver Debugging = Debugging Default GPU driver = Default GPU driver diff --git a/assets/lang/tr_TR.ini b/assets/lang/tr_TR.ini index 2320d9dc8221..01846f467076 100644 --- a/assets/lang/tr_TR.ini +++ b/assets/lang/tr_TR.ini @@ -613,7 +613,7 @@ Cardboard Screen Y Shift = Y shift (boş alanın %'si olarak) Cardboard VR Settings = Google Cardboard VR Ayarları Cheats = Hileler Copy to texture = Dokuya kopyala -CPU texture upscaler (slow) = Ölçeklendirme türü +CPU texture upscaler (slow) = Ölçeklendirme türü (CPU) Current GPU Driver = Şimdiki GPU Sürücüsü Debugging = Hata Ayıklama Default GPU driver = Varsayılan GPU Sürücüsü diff --git a/assets/lang/uk_UA.ini b/assets/lang/uk_UA.ini index 9d7b39020a31..96713fbe5e33 100644 --- a/assets/lang/uk_UA.ini +++ b/assets/lang/uk_UA.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Налаштування - Y - Cardboard VR Settings = Управління 3D кінотеатром Cheats = Чит-коди Copy to texture = Копіювати в текстуру -CPU texture upscaler (slow) = Тип масштабування +CPU texture upscaler (slow) = Тип масштабування (CPU) Current GPU Driver = Поточний драйвер GPU Debugging = Налагодження Default GPU driver = звичайний драйвер CPU diff --git a/assets/lang/vi_VN.ini b/assets/lang/vi_VN.ini index 5310f232a13c..773a2ee74525 100644 --- a/assets/lang/vi_VN.ini +++ b/assets/lang/vi_VN.ini @@ -611,7 +611,7 @@ Cardboard Screen Y Shift = Y shift (in % of the blank space) Cardboard VR Settings = Google Cardboard VR settings Cheats = Cheats Copy to texture = Copy to texture -CPU texture upscaler (slow) = Loại cao cấp +CPU texture upscaler (slow) = Loại cao cấp (CPU) Current GPU Driver = Current GPU Driver Debugging = Debugging Default GPU driver = Default GPU driver