Merge branch 'PCSX2:master' into master

This commit is contained in:
987123879113 2022-12-05 11:54:17 +09:00 committed by GitHub
commit a1e72be541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 176 additions and 157 deletions

View File

@ -15,7 +15,7 @@ jobs:
with:
jobName: "wxWidgets"
compiler: gcc
cmakeflags: "-DLTO_PCSX2_CORE=ON"
cmakeflags: "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON"
buildAppImage: true
secrets: inherit

Binary file not shown.

View File

@ -5179,6 +5179,8 @@ SCKA-20090:
SCKA-20092:
name: "K-1 World Grand Prix 2006"
region: "NTSC-K"
gsHWFixes:
deinterlace: 9 # Game requires AdaptiveBFF deinterlacing when auto.
speedHacks:
InstantVU1SpeedHack: 0 # Fixes random black frames from happening when in a fight session.
MTVUSpeedHack: 0
@ -5225,7 +5227,7 @@ SCKA-20109:
name: "Persona 3 FES [Independent Starting Version]"
region: "NTSC-K"
gsHWFixes:
mipmap: 1
mipmap: 2 # Fixes flashing windows.
memcardFilters:
- "SCKA-20109"
- "SCKA-20099"
@ -21681,7 +21683,7 @@ SLES-55354:
name: "Shin Megami Tensei - Persona 3 FES"
region: "PAL-E"
gsHWFixes:
mipmap: 1
mipmap: 2 # Fixes flashing windows.
memcardFilters:
- "SLES-55354"
- "SLES-55018"
@ -26264,6 +26266,8 @@ SLPM-62623:
name: "Elemental Gerad"
region: "NTSC-J"
compat: 5
gsHWFixes:
deinterlace: 9 # Game requires AdaptiveBFF deinterlacing when auto.
gameFixes:
- XGKickHack # Fixes chocolate coloured characters.
patches:
@ -32756,7 +32760,7 @@ SLPM-66689:
name: "Persona 3 FES [Append Edition]"
region: "NTSC-J"
gsHWFixes:
mipmap: 1
mipmap: 2 # Fixes flashing windows.
memcardFilters:
- "SLPM-66445"
- "SLPM-66689"
@ -32765,7 +32769,7 @@ SLPM-66690:
name: "Persona 3 FES [Independent Starting Version]"
region: "NTSC-J"
gsHWFixes:
mipmap: 1
mipmap: 2 # Fixes flashing windows.
memcardFilters:
- "SLPM-66445"
- "SLPM-66689"
@ -34333,7 +34337,7 @@ SLPM-74277:
region: "NTSC-J"
compat: 5
gsHWFixes:
mipmap: 1
mipmap: 2 # Fixes flashing windows.
SLPM-74278:
name: "Persona 4 [PlayStation 2 The Best]"
region: "NTSC-J"
@ -38286,6 +38290,8 @@ SLPS-25710:
name: "K-1 World Grand Prix 2006"
region: "NTSC-J"
compat: 4
gsHWFixes:
deinterlace: 9 # Game requires AdaptiveBFF deinterlacing when auto.
speedHacks:
InstantVU1SpeedHack: 0 # Fixes random black frames from happening when in a fight session.
MTVUSpeedHack: 0
@ -47393,7 +47399,7 @@ SLUS-21621:
region: "NTSC-U"
compat: 5
gsHWFixes:
mipmap: 1
mipmap: 2 # Fixes flashing windows.
memcardFilters:
- "SLUS-21621"
- "SLUS-21569"
@ -49023,7 +49029,7 @@ SLUS-28068:
name: "Shin Megami Tensei - Persona 3 FES [Trade Demo]"
region: "NTSC-U"
gsHWFixes:
mipmap: 1
mipmap: 2 # Fixes flashing windows.
SLUS-28069:
name: "Shin Megami Tensei - Persona 4 [Trade Demo]"
region: "NTSC-U"

View File

@ -255,7 +255,7 @@ void Host::OnInputDeviceDisconnected(const std::string_view& identifier)
{
}
bool Host::AcquireHostDisplay(RenderAPI api)
bool Host::AcquireHostDisplay(RenderAPI api, bool clear_state_on_fail)
{
const std::optional<WindowInfo> wi(GSRunner::GetPlatformWindowInfo());
if (!wi.has_value())
@ -267,7 +267,7 @@ bool Host::AcquireHostDisplay(RenderAPI api)
if (!g_host_display->CreateDevice(wi.value()) || !g_host_display->MakeCurrent() || !g_host_display->SetupDevice() || !ImGuiManager::Initialize())
{
ReleaseHostDisplay();
ReleaseHostDisplay(clear_state_on_fail);
return false;
}
@ -277,12 +277,9 @@ bool Host::AcquireHostDisplay(RenderAPI api)
return g_host_display.get();
}
void Host::ReleaseHostDisplay()
void Host::ReleaseHostDisplay(bool clear_state)
{
if (!g_host_display)
return;
ImGuiManager::Shutdown();
ImGuiManager::Shutdown(clear_state);
g_host_display.reset();
}

View File

@ -866,7 +866,7 @@ void EmuThread::updateDisplay()
}
}
bool EmuThread::acquireHostDisplay(RenderAPI api)
bool EmuThread::acquireHostDisplay(RenderAPI api, bool clear_state_on_fail)
{
pxAssertRel(!g_host_display, "Host display does not exist on create");
m_is_rendering_to_main = shouldRenderToMain();
@ -888,24 +888,24 @@ bool EmuThread::acquireHostDisplay(RenderAPI api)
if (!g_host_display->MakeCurrent())
{
Console.Error("Failed to make render context current");
releaseHostDisplay();
releaseHostDisplay(clear_state_on_fail);
return false;
}
if (!g_host_display->SetupDevice() || !ImGuiManager::Initialize())
{
Console.Error("Failed to initialize device/imgui");
releaseHostDisplay();
releaseHostDisplay(clear_state_on_fail);
return false;
}
Console.WriteLn(Color_StrongGreen, "%s Graphics Driver Info:", HostDisplay::RenderAPIToString(g_host_display->GetRenderAPI()));
Console.Indent().WriteLn(g_host_display->GetDriverInfo());
if (m_run_fullscreen_ui && !FullscreenUI::Initialize())
if (m_run_fullscreen_ui && !ImGuiManager::InitializeFullscreenUI())
{
Console.Error("Failed to initialize fullscreen UI");
releaseHostDisplay();
releaseHostDisplay(clear_state_on_fail);
m_run_fullscreen_ui = false;
return false;
}
@ -913,22 +913,22 @@ bool EmuThread::acquireHostDisplay(RenderAPI api)
return true;
}
void EmuThread::releaseHostDisplay()
void EmuThread::releaseHostDisplay(bool clear_state)
{
ImGuiManager::Shutdown();
ImGuiManager::Shutdown(clear_state);
g_host_display.reset();
emit onDestroyDisplayRequested();
}
bool Host::AcquireHostDisplay(RenderAPI api)
bool Host::AcquireHostDisplay(RenderAPI api, bool clear_state_on_fail)
{
return g_emu_thread->acquireHostDisplay(api);
return g_emu_thread->acquireHostDisplay(api, clear_state_on_fail);
}
void Host::ReleaseHostDisplay()
void Host::ReleaseHostDisplay(bool clear_state)
{
g_emu_thread->releaseHostDisplay();
g_emu_thread->releaseHostDisplay(clear_state);
}
VsyncMode Host::GetEffectiveVSyncMode()

View File

@ -70,9 +70,9 @@ public:
bool shouldRenderToMain() const;
/// Called back from the GS thread when the display state changes (e.g. fullscreen, render to main).
bool acquireHostDisplay(RenderAPI api);
bool acquireHostDisplay(RenderAPI api, bool clear_state_on_fail);
void connectDisplaySignals(DisplayWidget* widget);
void releaseHostDisplay();
void releaseHostDisplay(bool clear_state);
void updateDisplay();
void startBackgroundControllerPollTimer();

View File

@ -717,42 +717,6 @@ void ControllerBindingWidget_Base::initBindingWidgets()
default:
break;
}
if (QSlider* widget = findChild<QSlider*>(QStringLiteral("Deadzone")); widget)
{
const float range = static_cast<float>(widget->maximum());
QLabel* label = findChild<QLabel*>(QStringLiteral("DeadzoneLabel"));
if (label)
{
connect(widget, &QSlider::valueChanged, this, [range, label](int value) {
label->setText(tr("%1%").arg((static_cast<float>(value) / range) * 100.0f, 0, 'f', 0));
});
}
ControllerSettingWidgetBinder::BindWidgetToInputProfileNormalized(sif, widget, config_section, "Deadzone", range,
PAD::DEFAULT_STICK_DEADZONE);
}
if (QSlider* widget = findChild<QSlider*>(QStringLiteral("AxisScale")); widget)
{
// position 1.0f at the halfway point
const float range = static_cast<float>(widget->maximum()) * 0.5f;
QLabel* label = findChild<QLabel*>(QStringLiteral("AxisScaleLabel"));
if (label)
{
connect(widget, &QSlider::valueChanged, this, [range, label](int value) {
label->setText(tr("%1%").arg((static_cast<float>(value) / range) * 100.0f, 0, 'f', 0));
});
}
ControllerSettingWidgetBinder::BindWidgetToInputProfileNormalized(sif, widget, config_section, "AxisScale", range,
PAD::DEFAULT_STICK_SCALE);
}
if (QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QStringLiteral("SmallMotorScale")); widget)
ControllerSettingWidgetBinder::BindWidgetToInputProfileFloat(sif, widget, config_section, "SmallMotorScale", PAD::DEFAULT_MOTOR_SCALE);
if (QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QStringLiteral("LargeMotorScale")); widget)
ControllerSettingWidgetBinder::BindWidgetToInputProfileFloat(sif, widget, config_section, "LargeMotorScale", PAD::DEFAULT_MOTOR_SCALE);
}
ControllerBindingWidget_DualShock2::ControllerBindingWidget_DualShock2(ControllerBindingWidget* parent)

View File

@ -336,12 +336,13 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
updateRendererDependentOptions();
#ifndef PCSX2_DEVBUILD
// only allow disabling readbacks for per-game settings, it's too dangerous
m_ui.gsDownloadMode->setEnabled(m_dialog->isPerGameSettings());
// Remove texture offset and skipdraw range for global settings.
if (!m_dialog->isPerGameSettings())
{
// Only allow disabling readbacks for per-game settings, it's too dangerous.
m_ui.advancedDebugFormLayout->removeRow(2);
m_ui.gsDownloadMode = nullptr;
// Remove texture offset and skipdraw range for global settings.
m_ui.upscalingFixesLayout->removeRow(2);
m_ui.hardwareFixesLayout->removeRow(2);
m_ui.hardwareFixesLayout->removeRow(1);
@ -358,7 +359,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
dialog->registerWidgetHelp(m_ui.DisableInterlaceOffset, tr("Disable Interlace Offset"), tr("Unchecked"),
tr("Disables interlacing offset which may reduce blurring in some situations."));
dialog->registerWidgetHelp(m_ui.bilinearFiltering, tr("Bilinear Filtering"), tr("Bilinear (Sharp)"),
dialog->registerWidgetHelp(m_ui.bilinearFiltering, tr("Bilinear Filtering"), tr("Bilinear (Smooth)"),
tr("Enables bilinear post processing filter. Smooths the overall picture as it is displayed on the screen. Corrects positioning between pixels."));
dialog->registerWidgetHelp(m_ui.PCRTCOffsets, tr("Screen Offsets"), tr("Unchecked"),

View File

@ -1596,7 +1596,7 @@
<property name="title">
<string>Debug Options</string>
</property>
<layout class="QFormLayout" name="formLayout_6">
<layout class="QFormLayout" name="advancedDebugFormLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_19">
<property name="text">

View File

@ -66,11 +66,6 @@ elseif("${PGO}" STREQUAL "use")
target_compile_options(PCSX2_FLAGS INTERFACE -fprofile-use)
endif()
if(TARGET PulseAudio::PulseAudio)
target_compile_definitions(PCSX2_FLAGS INTERFACE SPU2X_PULSEAUDIO)
target_link_libraries(PCSX2_FLAGS INTERFACE PulseAudio::PulseAudio)
endif()
if(XDG_STD)
target_compile_definitions(PCSX2_FLAGS INTERFACE XDG_STD)
endif()
@ -612,6 +607,7 @@ set(pcsx2USBHeadersQt
if(TARGET PulseAudio::PulseAudio)
list(APPEND pcsx2USBSources USB/usb-mic/audiodev-pulse.cpp)
list(APPEND pcsx2USBHeaders USB/usb-mic/audiodev-pulse.h)
target_link_libraries(PCSX2_FLAGS INTERFACE PulseAudio::PulseAudio)
endif()
if(PCSX2_CORE)
@ -1670,6 +1666,9 @@ if(LTO_PCSX2_CORE)
if (WIN32)
target_compile_definitions(PCSX2_LTO PRIVATE _M_SSE=0x401)
endif()
if (DISABLE_ADVANCE_SIMD)
target_compile_definitions(PCSX2_LTO PRIVATE MULTI_ISA_SHARED_COMPILATION)
endif()
target_link_libraries(PCSX2_LTO PRIVATE PCSX2_FLAGS)
target_link_libraries(PCSX2 PRIVATE PCSX2_LTO)
set_target_properties(PCSX2_LTO PROPERTIES INTERPROCEDURAL_OPTIMIZATION true)

View File

@ -19,6 +19,7 @@
#include "Frontend/CommonHost.h"
#include "Frontend/FullscreenUI.h"
#include "Frontend/ImGuiFullscreen.h"
#include "Frontend/ImGuiManager.h"
#include "common/Assertions.h"
#include "common/FileSystem.h"
@ -427,7 +428,7 @@ std::string Achievements::GetUserAgent()
void Achievements::BeginLoadingScreen(const char* text, bool* was_running_idle)
{
GetMTGS().RunOnGSThread(&FullscreenUI::Initialize);
GetMTGS().RunOnGSThread(&ImGuiManager::InitializeFullscreenUI);
ImGuiFullscreen::OpenBackgroundProgressDialog("achievements_loading", text, 0, 0, 0);
}
@ -1131,7 +1132,7 @@ void Achievements::GetPatchesCallback(s32 status_code, const std::string& conten
return;
// ensure fullscreen UI is ready
GetMTGS().RunOnGSThread([]() { FullscreenUI::Initialize(); });
GetMTGS().RunOnGSThread(&ImGuiManager::InitializeFullscreenUI);
s_game_id = response.id;
s_game_title = response.title;

View File

@ -553,17 +553,12 @@ bool FullscreenUI::Initialize()
if (!ImGuiManager::AddFullscreenFontsIfMissing() || !ImGuiFullscreen::Initialize("fullscreenui/placeholder.png") || !LoadResources())
{
DestroyResources();
ImGuiFullscreen::Shutdown();
ImGuiFullscreen::Shutdown(true);
s_tried_to_initialize = true;
return false;
}
s_initialized = true;
s_current_main_window = MainWindowType::None;
s_current_pause_submenu = PauseSubMenu::None;
s_pause_menu_was_open = false;
s_was_paused_on_quick_menu_open = false;
s_about_window_open = false;
s_hotkey_list_cache = InputManager::GetHotkeyList();
GetMTGS().SetRunIdle(true);
@ -573,7 +568,9 @@ bool FullscreenUI::Initialize()
}
else
{
SwitchToLanding();
// only switch to landing if we weren't e.g. in settings
if (s_current_main_window == MainWindowType::None)
SwitchToLanding();
}
return true;
@ -708,7 +705,7 @@ void FullscreenUI::OpenPauseMenu()
return;
GetMTGS().RunOnGSThread([]() {
if (!Initialize() || s_current_main_window != MainWindowType::None)
if (!ImGuiManager::InitializeFullscreenUI() || s_current_main_window != MainWindowType::None)
return;
PauseForMenuOpen();
@ -739,23 +736,32 @@ void FullscreenUI::OpenPauseSubMenu(PauseSubMenu submenu)
QueueResetFocus();
}
void FullscreenUI::Shutdown()
void FullscreenUI::Shutdown(bool clear_state)
{
CancelAsyncOps();
CloseSaveStateSelector();
s_cover_image_map.clear();
s_game_list_sorted_entries = {};
s_game_list_directories_cache = {};
s_fullscreen_mode_list_cache = {};
s_graphics_adapter_list_cache = {};
if (clear_state)
{
CancelAsyncOps();
CloseSaveStateSelector();
s_cover_image_map.clear();
s_game_list_sorted_entries = {};
s_game_list_directories_cache = {};
s_fullscreen_mode_list_cache = {};
s_graphics_adapter_list_cache = {};
s_current_game_title = {};
s_current_game_subtitle = {};
s_current_game_serial = {};
s_current_game_path = {};
s_current_game_crc = 0;
s_current_main_window = MainWindowType::None;
s_current_pause_submenu = PauseSubMenu::None;
s_pause_menu_was_open = false;
s_was_paused_on_quick_menu_open = false;
s_about_window_open = false;
}
s_hotkey_list_cache = {};
s_current_game_title = {};
s_current_game_subtitle = {};
s_current_game_serial = {};
s_current_game_path = {};
s_current_game_crc = 0;
DestroyResources();
ImGuiFullscreen::Shutdown();
ImGuiFullscreen::Shutdown(clear_state);
s_initialized = false;
s_tried_to_initialize = false;
}
@ -1259,7 +1265,7 @@ void FullscreenUI::DrawInputBindingButton(SettingsInterface* bsi, PAD::Controlle
{
BeginInputBinding(bsi, type, section, name, display_name);
}
else if (ImGui::IsItemClicked(ImGuiMouseButton_Right))
else if (ImGui::IsItemClicked(ImGuiMouseButton_Right) || ImGui::IsNavInputTest(ImGuiNavInput_Input, ImGuiNavReadMode_Pressed))
{
bsi->DeleteValue(section, name);
SetSettingsChanged(bsi);
@ -5690,7 +5696,7 @@ void FullscreenUI::OpenAchievementsWindow()
return;
GetMTGS().RunOnGSThread([]() {
if (!Initialize())
if (!ImGuiManager::InitializeFullscreenUI())
return;
SwitchToAchievementsWindow();
@ -6080,7 +6086,7 @@ void FullscreenUI::OpenLeaderboardsWindow()
return;
GetMTGS().RunOnGSThread([]() {
if (!Initialize())
if (!ImGuiManager::InitializeFullscreenUI())
return;
SwitchToLeaderboardsWindow();

View File

@ -38,7 +38,7 @@ namespace FullscreenUI
void OpenAchievementsWindow();
void OpenLeaderboardsWindow();
void Shutdown();
void Shutdown(bool clear_state);
void Render();
void InvalidateCoverCache();

View File

@ -203,7 +203,7 @@ bool ImGuiFullscreen::Initialize(const char* placeholder_image_path)
return true;
}
void ImGuiFullscreen::Shutdown()
void ImGuiFullscreen::Shutdown(bool clear_state)
{
if (s_texture_load_thread.Joinable())
{
@ -223,25 +223,28 @@ void ImGuiFullscreen::Shutdown()
s_texture_cache.Clear();
s_notifications.clear();
s_background_progress_dialogs.clear();
CloseInputDialog();
CloseMessageDialog();
s_choice_dialog_open = false;
s_choice_dialog_checkable = false;
s_choice_dialog_title = {};
s_choice_dialog_options.clear();
s_choice_dialog_callback = {};
s_enum_choice_button_id = 0;
s_enum_choice_button_value = 0;
s_enum_choice_button_set = false;
s_file_selector_open = false;
s_file_selector_directory = false;
s_file_selector_title = {};
s_file_selector_callback = {};
s_file_selector_current_directory = {};
s_file_selector_filters.clear();
s_file_selector_items.clear();
if (clear_state)
{
s_notifications.clear();
s_background_progress_dialogs.clear();
CloseInputDialog();
CloseMessageDialog();
s_choice_dialog_open = false;
s_choice_dialog_checkable = false;
s_choice_dialog_title = {};
s_choice_dialog_options.clear();
s_choice_dialog_callback = {};
s_enum_choice_button_id = 0;
s_enum_choice_button_value = 0;
s_enum_choice_button_set = false;
s_file_selector_open = false;
s_file_selector_directory = false;
s_file_selector_title = {};
s_file_selector_callback = {};
s_file_selector_current_directory = {};
s_file_selector_filters.clear();
s_file_selector_items.clear();
}
}
const std::shared_ptr<HostDisplayTexture>& ImGuiFullscreen::GetPlaceholderTexture()

View File

@ -112,8 +112,8 @@ namespace ImGuiFullscreen
void SetFonts(ImFont* standard_font, ImFont* medium_font, ImFont* large_font);
bool UpdateLayoutScale();
/// Shuts down, clearing all state.
void Shutdown();
/// Shuts down, optionally clearing all state (including notifications).
void Shutdown(bool clear_state);
/// Texture cache.
const std::shared_ptr<HostDisplayTexture>& GetPlaceholderTexture();

View File

@ -85,6 +85,9 @@ static std::atomic_bool s_imgui_wants_text{false};
// mapping of host key -> imgui key
static std::unordered_map<u32, ImGuiKey> s_imgui_key_map;
// need to keep track of this, so we can reinitialize on renderer switch
static bool s_fullscreen_ui_was_initialized = false;
#endif
bool ImGuiManager::Initialize()
@ -116,7 +119,10 @@ bool ImGuiManager::Initialize()
SetStyle();
#ifdef PCSX2_CORE
const bool add_fullscreen_fonts = s_fullscreen_ui_was_initialized;
pxAssertRel(!FullscreenUI::IsInitialized(), "Fullscreen UI is not initialized on ImGui init");
#else
const bool add_fullscreen_fonts = false;
#endif
if (!g_host_display->CreateImGuiContext())
@ -128,7 +134,7 @@ bool ImGuiManager::Initialize()
return false;
}
if (!AddImGuiFonts(false) || !g_host_display->UpdateImGuiFontTexture())
if (!AddImGuiFonts(add_fullscreen_fonts) || !g_host_display->UpdateImGuiFontTexture())
{
pxFailRel("Failed to create ImGui font text");
g_host_display->DestroyImGuiContext();
@ -141,13 +147,33 @@ bool ImGuiManager::Initialize()
ImGui::GetIO().Fonts->ClearTexData();
NewFrame();
// reinitialize fsui if it was previously enabled
#ifdef PCSX2_CORE
if (add_fullscreen_fonts)
InitializeFullscreenUI();
#endif
return true;
}
void ImGuiManager::Shutdown()
bool ImGuiManager::InitializeFullscreenUI()
{
#ifdef PCSX2_CORE
FullscreenUI::Shutdown();
s_fullscreen_ui_was_initialized = FullscreenUI::Initialize();
return s_fullscreen_ui_was_initialized;
#else
return false;
#endif
}
void ImGuiManager::Shutdown(bool clear_state)
{
#ifdef PCSX2_CORE
FullscreenUI::Shutdown(clear_state);
ImGuiFullscreen::SetFonts(nullptr, nullptr, nullptr);
if (clear_state)
s_fullscreen_ui_was_initialized = false;
#endif
if (g_host_display)
@ -159,11 +185,9 @@ void ImGuiManager::Shutdown()
s_fixed_font = nullptr;
s_medium_font = nullptr;
s_large_font = nullptr;
#ifdef PCSX2_CORE
ImGuiFullscreen::SetFonts(nullptr, nullptr, nullptr);
#endif
UnloadFontData();
if (clear_state)
UnloadFontData();
}
void ImGuiManager::WindowResized()

View File

@ -25,8 +25,11 @@ namespace ImGuiManager
/// Initializes ImGui, creates fonts, etc.
bool Initialize();
/// Initializes fullscreen UI.
bool InitializeFullscreenUI();
/// Frees all ImGui resources.
void Shutdown();
void Shutdown(bool clear_state);
/// Updates internal state when the window is size.
void WindowResized();

View File

@ -112,6 +112,9 @@ namespace InputManager
static bool DoEventHook(InputBindingKey key, float value);
static bool PreprocessEvent(InputBindingKey key, float value, GenericInputBinding generic_key);
template <typename T>
static void UpdateInputSourceState(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock, InputSourceType type);
} // namespace InputManager
// ------------------------------------------------------------------------
@ -276,7 +279,8 @@ std::string InputManager::ConvertInputBindingKeyToString(InputBindingKey key)
}
else if (key.source_subtype == InputSubclass::PointerAxis)
{
return fmt::format("Pointer-{}/{}{:c}", u32{key.source_index}, s_pointer_axis_names[key.data], key.modifier == InputModifier::Negate ? '-' : '+');
return fmt::format("Pointer-{}/{}{:c}", u32{key.source_index}, s_pointer_axis_names[key.data],
key.modifier == InputModifier::Negate ? '-' : '+');
}
}
else if (key.source_type < InputSourceType::Count && s_input_sources[static_cast<u32>(key.source_type)])
@ -567,8 +571,8 @@ void InputManager::AddPadBindings(SettingsInterface& si, u32 pad_index, const ch
if (!bindings.empty())
{
// we use axes for all pad bindings to simplify things, and because they are pressure sensitive
AddBindings(bindings, InputAxisEventHandler{[pad_index, bind_index](
float value) { PAD::SetControllerState(pad_index, bind_index, value); }});
AddBindings(bindings,
InputAxisEventHandler{[pad_index, bind_index](float value) { PAD::SetControllerState(pad_index, bind_index, value); }});
}
}
}
@ -1173,11 +1177,15 @@ GenericInputBindingMapping InputManager::GetGenericBindingMapping(const std::str
return mapping;
}
template <typename T>
static void UpdateInputSourceState(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock, InputSourceType type)
bool InputManager::IsInputSourceEnabled(SettingsInterface& si, InputSourceType type)
{
const bool enabled =
si.GetBoolValue("InputSources", InputManager::InputSourceToString(type), InputManager::GetInputSourceDefaultEnabled(type));
return si.GetBoolValue("InputSources", InputManager::InputSourceToString(type), InputManager::GetInputSourceDefaultEnabled(type));
}
template <typename T>
void InputManager::UpdateInputSourceState(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock, InputSourceType type)
{
const bool enabled = IsInputSourceEnabled(si, type);
if (enabled)
{
if (s_input_sources[static_cast<u32>(type)])
@ -1189,7 +1197,7 @@ static void UpdateInputSourceState(SettingsInterface& si, std::unique_lock<std::
std::unique_ptr<InputSource> source = std::make_unique<T>();
if (!source->Initialize(si, settings_lock))
{
Console.Error("(InputManager) Source '%s' failed to initialize.", InputManager::InputSourceToString(type));
Console.Error("(InputManager) Source '%s' failed to initialize.", InputSourceToString(type));
return;
}

View File

@ -257,6 +257,9 @@ namespace InputManager
/// Retrieves bindings that match the generic bindings for the specified device.
GenericInputBindingMapping GetGenericBindingMapping(const std::string_view& device);
/// Returns whether a given input source is enabled.
bool IsInputSourceEnabled(SettingsInterface& si, InputSourceType type);
/// Re-parses the config and registers all hotkey and pad bindings.
void ReloadBindings(SettingsInterface& si, SettingsInterface& binding_si);

View File

@ -127,7 +127,7 @@ void GSshutdown()
g_gs_device.reset();
}
Host::ReleaseHostDisplay();
Host::ReleaseHostDisplay(true);
#endif
#ifdef _WIN32
@ -156,7 +156,7 @@ void GSclose()
if (g_host_display)
g_host_display->SetGPUTimingEnabled(false);
Host::ReleaseHostDisplay();
Host::ReleaseHostDisplay(true);
}
static RenderAPI GetAPIForRenderer(GSRendererType renderer)
@ -319,13 +319,13 @@ bool GSreopen(bool recreate_display, const Pcsx2Config::GSOptions& old_config)
if (recreate_display)
{
Host::ReleaseHostDisplay();
if (!Host::AcquireHostDisplay(GetAPIForRenderer(GSConfig.Renderer)))
Host::ReleaseHostDisplay(false);
if (!Host::AcquireHostDisplay(GetAPIForRenderer(GSConfig.Renderer), false))
{
Console.Error("(GSreopen) Failed to reacquire host display");
// try to get the old one back
if (!Host::AcquireHostDisplay(GetAPIForRenderer(old_config.Renderer)))
if (!Host::AcquireHostDisplay(GetAPIForRenderer(old_config.Renderer), false))
{
pxFailRel("Failed to recreate old config host display");
return false;
@ -345,8 +345,8 @@ bool GSreopen(bool recreate_display, const Pcsx2Config::GSOptions& old_config)
// try the old config
if (recreate_display && GSConfig.Renderer != old_config.Renderer)
{
Host::ReleaseHostDisplay();
if (!Host::AcquireHostDisplay(GetAPIForRenderer(old_config.Renderer)))
Host::ReleaseHostDisplay(false);
if (!Host::AcquireHostDisplay(GetAPIForRenderer(old_config.Renderer), false))
{
pxFailRel("Failed to recreate old config host display (part 2)");
return false;
@ -380,7 +380,7 @@ bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* b
GSConfig = config;
GSConfig.Renderer = renderer;
if (!Host::AcquireHostDisplay(GetAPIForRenderer(renderer)))
if (!Host::AcquireHostDisplay(GetAPIForRenderer(renderer), true))
{
Console.Error("Failed to acquire host display");
return false;
@ -388,7 +388,7 @@ bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* b
if (!DoGSOpen(renderer, basemem))
{
Host::ReleaseHostDisplay();
Host::ReleaseHostDisplay(true);
return false;
}

View File

@ -173,10 +173,10 @@ extern std::unique_ptr<HostDisplay> g_host_display;
namespace Host
{
/// Creates the host display. This may create a new window. The API used depends on the current configuration.
bool AcquireHostDisplay(RenderAPI api);
bool AcquireHostDisplay(RenderAPI api, bool clear_state_on_fail);
/// Destroys the host display. This may close the display window.
void ReleaseHostDisplay();
void ReleaseHostDisplay(bool clear_state);
/// Returns the desired vsync mode, depending on the runtime environment.
VsyncMode GetEffectiveVSyncMode();

View File

@ -2721,7 +2721,9 @@ static __ri void _vuXGKICK(VURegs* VU)
VU->xgkicksizeremaining = 0;
VU->xgkickendpacket = false;
VU->xgkicklastcycle = VU->cycle;
VU->xgkickcyclecount = 0;
// XGKick command counts as one cycle for the transfer.
// Can be tested with Resident Evil: Outbreak, Kingdom Hearts, CART Fury.
VU->xgkickcyclecount = 1;
VU0.VI[REG_VPU_STAT].UL |= (1 << 12);
VUM_LOG("XGKICK addr %x", addr);
}

View File

@ -117,7 +117,7 @@ bool Host::ConfirmMessage(const std::string_view& title, const std::string_view&
return true;
}
bool Host::AcquireHostDisplay(RenderAPI api)
bool Host::AcquireHostDisplay(RenderAPI api, bool clear_state_on_fail)
{
sApp.OpenGsPanel();
@ -141,9 +141,9 @@ bool Host::AcquireHostDisplay(RenderAPI api)
return true;
}
void Host::ReleaseHostDisplay()
void Host::ReleaseHostDisplay(bool clear_state_on_fail)
{
ImGuiManager::Shutdown();
ImGuiManager::Shutdown(clear_state_on_fail);
if (g_host_display)
g_host_display.reset();

View File

@ -681,7 +681,9 @@ void* mVUcompile(microVU& mVU, u32 startPC, uptr pState)
}
else
{
mVUregs.xgkickcycles = 0;
// XGKick command counts as one cycle for the transfer.
// Can be tested with Resident Evil: Outbreak, Kingdom Hearts, CART Fury.
mVUregs.xgkickcycles = 1;
mVUlow.kickcycles = 0;
}