From c5511d0afac1890f7a3428c89d44aaa977e5bcd3 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Thu, 16 May 2024 15:58:04 +0200 Subject: [PATCH] Misc: Update hw mipmap code hotkey. --- pcsx2/GS/GS.cpp | 32 +++++++++++--------------------- pcsx2/SIO/Pad/Pad.cpp | 2 +- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index 4b2f25e368..75ac296fbe 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -1113,28 +1113,18 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys){"Screenshot", TRANSLATE_NOOP("Hotkeys", "Graphic Pcsx2Config::GSOptions::AspectRatioNames[static_cast(EmuConfig.CurrentAspectRatio)]), Host::OSD_QUICK_DURATION); }}, - {"CycleMipmapMode", TRANSLATE_NOOP("Hotkeys", "Graphics"), TRANSLATE_NOOP("Hotkeys", "Cycle Hardware Mipmapping"), + {"ToggleMipmapMode", TRANSLATE_NOOP("Hotkeys", "Graphics"), TRANSLATE_NOOP("Hotkeys", "Toggle Hardware Mipmapping"), [](s32 pressed) { - if (pressed) - return; - - static constexpr s32 CYCLE_COUNT = 4; - static constexpr std::array option_names = { - {"Automatic", "Off", "Basic (Generated)", "Full (PS2)"}}; - - const HWMipmapLevel new_level = - static_cast(((static_cast(EmuConfig.GS.HWMipmap) + 2) % CYCLE_COUNT) - 1); - Host::AddKeyedOSDMessage("CycleMipmapMode", - fmt::format(TRANSLATE_FS("Hotkeys", "Hardware mipmapping set to '{}'."), - option_names[static_cast(new_level) + 1]), - Host::OSD_QUICK_DURATION); - EmuConfig.GS.HWMipmap = new_level; - - MTGS::RunOnGSThread([new_level]() { - GSConfig.HWMipmap = new_level; - g_gs_renderer->PurgeTextureCache(true, false, true); - g_gs_device->PurgePool(); - }); + if (!pressed) + { + EmuConfig.GS.HWMipmap = !EmuConfig.GS.HWMipmap; + Host::AddKeyedOSDMessage("ToggleMipmapMode", + EmuConfig.GS.HWMipmap ? + TRANSLATE_STR("Hotkeys", "Hardware mipmapping is now enabled.") : + TRANSLATE_STR("Hotkeys", "Hardware mipmapping is now disabled."), + Host::OSD_INFO_DURATION); + MTGS::ApplySettings(); + } }}, {"CycleInterlaceMode", TRANSLATE_NOOP("Hotkeys", "Graphics"), TRANSLATE_NOOP("Hotkeys", "Cycle Deinterlace Mode"), [](s32 pressed) { diff --git a/pcsx2/SIO/Pad/Pad.cpp b/pcsx2/SIO/Pad/Pad.cpp index 4643ab5537..4fbce0a597 100644 --- a/pcsx2/SIO/Pad/Pad.cpp +++ b/pcsx2/SIO/Pad/Pad.cpp @@ -214,7 +214,7 @@ void Pad::SetDefaultHotkeyConfig(SettingsInterface& si) // PCSX2 Controller Settings - Hotkeys - Graphics si.SetStringValue("Hotkeys", "CycleAspectRatio", "Keyboard/F6"); si.SetStringValue("Hotkeys", "CycleInterlaceMode", "Keyboard/F5"); - si.SetStringValue("Hotkeys", "CycleMipmapMode", "Keyboard/Insert"); + si.SetStringValue("Hotkeys", "ToggleMipmapMode", "Keyboard/Insert"); // si.SetStringValue("Hotkeys", "DecreaseUpscaleMultiplier", "Keyboard"); TBD // si.SetStringValue("Hotkeys", "IncreaseUpscaleMultiplier", "Keyboard"); TBD // si.SetStringValue("Hotkeys", "ReloadTextureReplacements", "Keyboard"); TBD