From 3175e38a2eaa387de29c67d9198a234bc17e55fe Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 16 Jan 2022 22:34:39 -0800 Subject: [PATCH 01/31] GXPipelineUid: remove explicit shallow copy where it's the default --- Source/Core/VideoCommon/GXPipelineTypes.h | 35 ----------------------- 1 file changed, 35 deletions(-) diff --git a/Source/Core/VideoCommon/GXPipelineTypes.h b/Source/Core/VideoCommon/GXPipelineTypes.h index ca3fb89701..b448dc107f 100644 --- a/Source/Core/VideoCommon/GXPipelineTypes.h +++ b/Source/Core/VideoCommon/GXPipelineTypes.h @@ -35,24 +35,6 @@ struct GXPipelineUid // and this map lookup can happen every draw call. However, as using memcmp() will also compare // any padding bytes, we have to ensure these are zeroed out. GXPipelineUid() { std::memset(static_cast(this), 0, sizeof(*this)); } -#ifdef _MSC_VER -#pragma warning(push) -// Disable warning for uninitialized member variables, as MSVC doesn't recognise that memcpy -// performs this initialization. -#pragma warning(disable : 26495) -#endif - GXPipelineUid(const GXPipelineUid& rhs) - { - std::memcpy(static_cast(this), &rhs, sizeof(*this)); - } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - GXPipelineUid& operator=(const GXPipelineUid& rhs) - { - std::memcpy(static_cast(this), &rhs, sizeof(*this)); - return *this; - } bool operator<(const GXPipelineUid& rhs) const { return std::memcmp(this, &rhs, sizeof(*this)) < 0; @@ -74,23 +56,6 @@ struct GXUberPipelineUid BlendingState blending_state; GXUberPipelineUid() { std::memset(static_cast(this), 0, sizeof(*this)); } -#ifdef _MSC_VER -#pragma warning(push) -// Disable warning for uninitialized member variables -#pragma warning(disable : 26495) -#endif - GXUberPipelineUid(const GXUberPipelineUid& rhs) - { - std::memcpy(static_cast(this), &rhs, sizeof(*this)); - } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - GXUberPipelineUid& operator=(const GXUberPipelineUid& rhs) - { - std::memcpy(static_cast(this), &rhs, sizeof(*this)); - return *this; - } bool operator<(const GXUberPipelineUid& rhs) const { return std::memcmp(this, &rhs, sizeof(*this)) < 0; From d3ae1bd415f328ebd679828a79dca219856c1e39 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Tue, 25 Jan 2022 14:15:18 -0800 Subject: [PATCH 02/31] [Android] Fix unused variable warning Add [[maybe_unused]] attribute to ConsoleListener's m_use_color --- Source/Core/Common/Logging/ConsoleListener.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/Logging/ConsoleListener.h b/Source/Core/Common/Logging/ConsoleListener.h index 2c5e744751..3901f29580 100644 --- a/Source/Core/Common/Logging/ConsoleListener.h +++ b/Source/Core/Common/Logging/ConsoleListener.h @@ -14,5 +14,5 @@ public: void Log(Common::Log::LogLevel level, const char* text) override; private: - bool m_use_color = false; + [[maybe_unused]] bool m_use_color = false; }; From 07f2587e633f4b50a2cabd2a65f2ded8aeac5f1e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 29 Jan 2022 11:14:09 +0100 Subject: [PATCH 03/31] Android: Get rid of the boot timeout We don't have a timeout like this on other platforms, and it doesn't accomplish anything useful as far as I can tell. If you trigger it, all that happens is that you don't get a working game and also can't press Exit Emulation without Dolphin hanging (stuck in Core::Shutdown). --- Source/Android/jni/MainAndroid.cpp | 34 ++++++------------------------ 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index b533ba74d6..e7e4d84467 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -84,7 +84,6 @@ std::mutex s_surface_lock; bool s_need_nonblocking_alert_msg; Common::Flag s_is_booting; -bool s_have_wm_user_stop = false; bool s_game_metadata_is_valid = false; } // Anonymous namespace @@ -123,7 +122,6 @@ void Host_Message(HostMessageID id) } else if (id == HostMessageID::WMUserStop) { - s_have_wm_user_stop = true; if (Core::IsRunning()) Core::QueueHostJob(&Core::Stop); } @@ -554,8 +552,6 @@ static void Run(JNIEnv* env, std::unique_ptr&& boot, bool riivol WiimoteReal::InitAdapterClass(); - s_have_wm_user_stop = false; - if (riivolution && std::holds_alternative(boot->parameters)) { const std::string& riivolution_dir = File::GetUserPath(D_RIIVOLUTION_IDX); @@ -572,41 +568,25 @@ static void Run(JNIEnv* env, std::unique_ptr&& boot, bool riivol s_need_nonblocking_alert_msg = true; std::unique_lock surface_guard(s_surface_lock); - bool successful_boot = BootManager::BootCore(std::move(boot), wsi); - if (successful_boot) + if (BootManager::BootCore(std::move(boot), wsi)) { ButtonManager::Init(SConfig::GetInstance().GetGameID()); - static constexpr int TIMEOUT = 10000; static constexpr int WAIT_STEP = 25; - int time_waited = 0; - // A Core::CORE_ERROR state would be helpful here. - while (!Core::IsRunningAndStarted()) - { - if (time_waited >= TIMEOUT || s_have_wm_user_stop) - { - successful_boot = false; - break; - } - + while (Core::GetState() == Core::State::Starting) std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_STEP)); - time_waited += WAIT_STEP; - } } s_is_booting.Clear(); s_need_nonblocking_alert_msg = false; surface_guard.unlock(); - if (successful_boot) + while (Core::IsRunning()) { - while (Core::IsRunningAndStarted()) - { - host_identity_guard.unlock(); - s_update_main_frame_event.Wait(); - host_identity_guard.lock(); - Core::HostDispatchJobs(); - } + host_identity_guard.unlock(); + s_update_main_frame_event.Wait(); + host_identity_guard.lock(); + Core::HostDispatchJobs(); } s_game_metadata_is_valid = false; From c5c011dd12cfe3c91947c915d0e7ce73aa831cbb Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 29 Jan 2022 14:36:28 +0100 Subject: [PATCH 04/31] Android: Fix swapped texture dumping description strings --- Source/Android/app/src/main/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index d5553ea25f..64b943660d 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -316,9 +316,9 @@ Dump Textures Dumps decoded game textures based on the other flags to User/Dump/Textures/<game_id>/. If unsure, leave this unchecked. Dump Base Textures - Whether to dump mipmapped game textures to User/Dump/Textures/<game_id>/. + Whether to dump base game textures to User/Dump/Textures/<game_id>/. Dump Mip Maps - Whether to dump base game textures to User/Dump/Textures/<game_id>/. + Whether to dump mipmapped game textures to User/Dump/Textures/<game_id>/. Misc Crop Crops the picture from its native aspect ratio to 4:3 or 16:9. If unsure, leave this unchecked. From 7f32057e9184573d046bea4faef53dae42419943 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 29 Jan 2022 15:48:34 +0100 Subject: [PATCH 05/31] Android: Call OnConfigChanged when resetting a setting Otherwise the value of the setting won't be updated properly. --- Source/Android/jni/Config/NativeConfig.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Android/jni/Config/NativeConfig.cpp b/Source/Android/jni/Config/NativeConfig.cpp index bdeafc5f13..a84906aaec 100644 --- a/Source/Android/jni/Config/NativeConfig.cpp +++ b/Source/Android/jni/Config/NativeConfig.cpp @@ -147,7 +147,10 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_deleteKey( JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key) { const Config::Location location = GetLocation(env, file, section, key); - return static_cast(GetLayer(layer, location)->DeleteKey(location)); + const bool had_value = GetLayer(layer, location)->DeleteKey(location); + if (had_value) + Config::OnConfigChanged(); + return static_cast(had_value); } JNIEXPORT jstring JNICALL From af36b6c0553d0857acd8784e6b9718e63201e8ae Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 10 Feb 2022 17:30:23 +0100 Subject: [PATCH 06/31] HotkeyManager: Change defaults for GBA hotkeys so they don't conflict with common keyboard mappings. --- Source/Core/Core/HotkeyManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index 25b59d3943..02c0191256 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -463,9 +463,9 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface) set_key_expression(HK_UNDO_SAVE_STATE, hotkey_string({"Shift", "F12"})); // GBA - set_key_expression(HK_GBA_LOAD, hotkey_string({"`Shift`", "`O`"})); - set_key_expression(HK_GBA_UNLOAD, hotkey_string({"`Shift`", "`W`"})); - set_key_expression(HK_GBA_RESET, hotkey_string({"`Shift`", "`R`"})); + set_key_expression(HK_GBA_LOAD, hotkey_string({"`Ctrl`", "`Shift`", "`O`"})); + set_key_expression(HK_GBA_UNLOAD, hotkey_string({"`Ctrl`", "`Shift`", "`W`"})); + set_key_expression(HK_GBA_RESET, hotkey_string({"`Ctrl`", "`Shift`", "`R`"})); #ifdef _WIN32 set_key_expression(HK_GBA_VOLUME_DOWN, "`SUBTRACT`"); From a05dd6b7e6b7ffeedc295d5c54c21eeab31c2427 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 31 Jan 2022 10:02:16 -0800 Subject: [PATCH 07/31] MemoryWidget: Fix improperly behaving radio buttons --- Source/Core/DolphinQt/Debugger/MemoryWidget.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp index fe1307ec41..04320c8e0d 100644 --- a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,12 @@ void MemoryWidget::CreateWidgets() m_address_splitter->setCollapsible(0, false); m_address_splitter->setStretchFactor(1, 2); + auto* search_type_group = new QButtonGroup(this); + m_find_ascii = new QRadioButton(tr("ASCII")); + m_find_hex = new QRadioButton(tr("Hex string")); + search_type_group->addButton(m_find_ascii); + search_type_group->addButton(m_find_hex); + // Dump m_dump_mram = new QPushButton(tr("Dump &MRAM")); m_dump_exram = new QPushButton(tr("Dump &ExRAM")); @@ -116,8 +123,6 @@ void MemoryWidget::CreateWidgets() m_find_next = new QPushButton(tr("Find &Next")); m_find_previous = new QPushButton(tr("Find &Previous")); - m_find_ascii = new QRadioButton(tr("ASCII")); - m_find_hex = new QRadioButton(tr("Hex string")); m_result_label = new QLabel; search_layout->addWidget(m_find_next); From 99b3ac21e4e51664a67a07c1c6c175a67a352e9d Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 31 Jan 2022 10:12:55 -0800 Subject: [PATCH 08/31] NewBreakpointDialog: Fix improperly behaving radio buttons --- Source/Core/DolphinQt/Debugger/NewBreakpointDialog.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Core/DolphinQt/Debugger/NewBreakpointDialog.cpp b/Source/Core/DolphinQt/Debugger/NewBreakpointDialog.cpp index 6a1a3eff7b..3e8bfae69a 100644 --- a/Source/Core/DolphinQt/Debugger/NewBreakpointDialog.cpp +++ b/Source/Core/DolphinQt/Debugger/NewBreakpointDialog.cpp @@ -3,6 +3,7 @@ #include "DolphinQt/Debugger/NewBreakpointDialog.h" +#include #include #include #include @@ -31,10 +32,12 @@ NewBreakpointDialog::NewBreakpointDialog(BreakpointWidget* parent) void NewBreakpointDialog::CreateWidgets() { m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto* type_group = new QButtonGroup(this); // Instruction BP m_instruction_bp = new QRadioButton(tr("Instruction Breakpoint")); m_instruction_bp->setChecked(true); + type_group->addButton(m_instruction_bp); m_instruction_box = new QGroupBox; m_instruction_address = new QLineEdit; @@ -45,11 +48,15 @@ void NewBreakpointDialog::CreateWidgets() // Memory BP m_memory_bp = new QRadioButton(tr("Memory Breakpoint")); + type_group->addButton(m_memory_bp); m_memory_box = new QGroupBox; + auto* memory_type_group = new QButtonGroup(this); m_memory_use_address = new QRadioButton(tr("Address")); m_memory_use_address->setChecked(true); + memory_type_group->addButton(m_memory_use_address); // i18n: A range of memory addresses m_memory_use_range = new QRadioButton(tr("Range")); + memory_type_group->addButton(m_memory_use_range); m_memory_address_from = new QLineEdit; m_memory_address_to = new QLineEdit; m_memory_address_from_label = new QLabel; // Set by OnAddressTypeChanged From 0daee4fe9f4cab476f71224a7d2930ac4b78d686 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 12 Feb 2022 11:39:45 -0800 Subject: [PATCH 09/31] CheatSearchFactoryWidget: Set QButtonGroup's parent --- Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp b/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp index 6e566600f8..96dccfd240 100644 --- a/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp +++ b/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp @@ -55,7 +55,7 @@ void CheatSearchFactoryWidget::CreateWidgets() auto* custom_address_space_layout = new QVBoxLayout(); custom_address_space_layout->setMargin(6); - auto* custom_address_space_button_group = new QButtonGroup(); + auto* custom_address_space_button_group = new QButtonGroup(this); m_custom_virtual_address_space = new QRadioButton(tr("Use virtual addresses when possible")); m_custom_virtual_address_space->setChecked(true); m_custom_physical_address_space = new QRadioButton(tr("Use physical addresses")); From f2f9df7541720217b6375b78cc7b8e70e0b958f9 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 31 Jan 2022 10:19:23 -0800 Subject: [PATCH 10/31] Remove unused includes of QButtonGroup --- Source/Core/DolphinQt/Config/ARCodeWidget.cpp | 1 - .../ControllerInterface/DualShockUDPClientAddServerDialog.cpp | 1 - Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp | 1 - Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h | 1 - 4 files changed, 4 deletions(-) diff --git a/Source/Core/DolphinQt/Config/ARCodeWidget.cpp b/Source/Core/DolphinQt/Config/ARCodeWidget.cpp index b45cfb3772..b528bfb509 100644 --- a/Source/Core/DolphinQt/Config/ARCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/ARCodeWidget.cpp @@ -5,7 +5,6 @@ #include -#include #include #include #include diff --git a/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientAddServerDialog.cpp b/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientAddServerDialog.cpp index 790b6ca6ce..84185da00d 100644 --- a/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientAddServerDialog.cpp +++ b/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientAddServerDialog.cpp @@ -5,7 +5,6 @@ #include -#include #include #include #include diff --git a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp index d2272d03b0..1024816e22 100644 --- a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp +++ b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp @@ -3,7 +3,6 @@ #include "DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h" -#include #include #include #include diff --git a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h index 1b0ebcdccc..5ae1199f2e 100644 --- a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h +++ b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h @@ -7,7 +7,6 @@ class QTimer; class QDialog; -class QButtonGroup; class QHeaderView; class QLabel; class QLineEdit; From 3b5faf90f30c8b470527e7cf498cbabf161559e9 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 16 Jan 2022 21:19:34 -0800 Subject: [PATCH 11/31] =?UTF-8?q?FifoAnalyzer:=20Fix=20"enumeration=20valu?= =?UTF-8?q?e=20=E2=80=98NotPresent=E2=80=99=20not=20handled=20in=20switch"?= =?UTF-8?q?=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index be9daf57d3..4227e2af38 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -704,6 +704,8 @@ public: case VertexComponentFormat::Direct: process_simple_component(component_sizes[vtx_attr.GetColorFormat(c)]); break; + case VertexComponentFormat::NotPresent: + break; } } for (u32 t = 0; t < vtx_desc.high.TexCoord.Size(); t++) From a720596771c448744ee3c069524630a3e343de1a Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 16 Jan 2022 21:20:56 -0800 Subject: [PATCH 12/31] GDB Stub: Fix typo mixing ppcState.spr and ppcState.sr This resulted in an out-of-bounds array access, since sr is only 16 entries long and SPR_IBAT0U evaluates to 528. --- Source/Core/Core/PowerPC/GDBStub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index 91bc4a465d..f097135940 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -633,7 +633,7 @@ static void WriteRegister() } else if (id >= 88 && id < 104) { - PowerPC::ppcState.sr[SPR_IBAT0U + id - 88] = re32hex(bufptr); + PowerPC::ppcState.spr[SPR_IBAT0U + id - 88] = re32hex(bufptr); } else { From 0e23dfbb256783a41a0f400251d64d5f4c2c3474 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 16 Jan 2022 21:28:44 -0800 Subject: [PATCH 13/31] FifoDataFile: Stop ignoring size The size variable started to be unused when I created std::array variants of ReadArray, but we should follow it in case any files have fewer registers stored than they should (otherwise the remaining registers would end up with garbage data from later in the fifolog). Though, there probably aren't many fifologs where this is relevant. --- Source/Core/Core/FifoPlayer/FifoDataFile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp index 7bfdff7833..119e19d861 100644 --- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp +++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp @@ -285,19 +285,19 @@ std::unique_ptr FifoDataFile::Load(const std::string& filename, bo u32 size = std::min(BP_MEM_SIZE, header.bpMemSize); file.Seek(header.bpMemOffset, File::SeekOrigin::Begin); - file.ReadArray(&dataFile->m_BPMem); + file.ReadArray(dataFile->m_BPMem.data(), size); size = std::min(CP_MEM_SIZE, header.cpMemSize); file.Seek(header.cpMemOffset, File::SeekOrigin::Begin); - file.ReadArray(&dataFile->m_CPMem); + file.ReadArray(dataFile->m_CPMem.data(), size); size = std::min(XF_MEM_SIZE, header.xfMemSize); file.Seek(header.xfMemOffset, File::SeekOrigin::Begin); - file.ReadArray(&dataFile->m_XFMem); + file.ReadArray(dataFile->m_XFMem.data(), size); size = std::min(XF_REGS_SIZE, header.xfRegsSize); file.Seek(header.xfRegsOffset, File::SeekOrigin::Begin); - file.ReadArray(&dataFile->m_XFRegs); + file.ReadArray(dataFile->m_XFRegs.data(), size); // Texture memory saving was added in version 4. dataFile->m_TexMem.fill(0); From a6d516dc9442faa24646bb4d09b5e190a7a5c0e0 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 16 Jan 2022 21:30:53 -0800 Subject: [PATCH 14/31] Fix shadowing variables in labmdas GCC generates warnings about these, although the variable being shadowed is not captured by the lambda. --- Source/Core/Core/NetPlayClient.cpp | 26 ++++++++++--------- .../Core/DolphinQt/RiivolutionBootWidget.cpp | 8 +++--- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 54aeb83e83..6dcbb2e353 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -1747,18 +1747,20 @@ bool NetPlayClient::StartGame(const std::string& path) // boot game auto boot_session_data = std::make_unique(); - boot_session_data->SetWiiSyncData( - std::move(m_wii_sync_fs), std::move(m_wii_sync_titles), std::move(m_wii_sync_redirect_folder), - [] { - // on emulation end clean up the Wii save sync directory -- see OnSyncSaveDataWii() - const std::string path = File::GetUserPath(D_USER_IDX) + "Wii" GC_MEMCARD_NETPLAY DIR_SEP; - if (File::Exists(path)) - File::DeleteDirRecursively(path); - const std::string redirect_path = - File::GetUserPath(D_USER_IDX) + "Redirect" GC_MEMCARD_NETPLAY DIR_SEP; - if (File::Exists(redirect_path)) - File::DeleteDirRecursively(redirect_path); - }); + boot_session_data->SetWiiSyncData(std::move(m_wii_sync_fs), std::move(m_wii_sync_titles), + std::move(m_wii_sync_redirect_folder), [] { + // on emulation end clean up the Wii save sync directory -- + // see OnSyncSaveDataWii() + const std::string wii_path = File::GetUserPath(D_USER_IDX) + + "Wii" GC_MEMCARD_NETPLAY DIR_SEP; + if (File::Exists(wii_path)) + File::DeleteDirRecursively(wii_path); + const std::string redirect_path = + File::GetUserPath(D_USER_IDX) + + "Redirect" GC_MEMCARD_NETPLAY DIR_SEP; + if (File::Exists(redirect_path)) + File::DeleteDirRecursively(redirect_path); + }); m_dialog->BootGame(path, std::move(boot_session_data)); UpdateDevices(); diff --git a/Source/Core/DolphinQt/RiivolutionBootWidget.cpp b/Source/Core/DolphinQt/RiivolutionBootWidget.cpp index c70df8e770..ff19d8597a 100644 --- a/Source/Core/DolphinQt/RiivolutionBootWidget.cpp +++ b/Source/Core/DolphinQt/RiivolutionBootWidget.cpp @@ -207,10 +207,10 @@ void RiivolutionBootWidget::MakeGUIForParsedFile(std::string path, std::string r connect(selection, qOverload(&QComboBox::currentIndexChanged), this, [this, selection](int idx) { const auto gui_index = selection->currentData().value(); - auto& disc = m_discs[gui_index.m_disc_index].disc; - auto& section = disc.m_sections[gui_index.m_section_index]; - auto& option = section.m_options[gui_index.m_option_index]; - option.m_selected_choice = static_cast(gui_index.m_choice_index); + auto& selected_disc = m_discs[gui_index.m_disc_index].disc; + auto& selected_section = selected_disc.m_sections[gui_index.m_section_index]; + auto& selected_option = selected_section.m_options[gui_index.m_option_index]; + selected_option.m_selected_choice = static_cast(gui_index.m_choice_index); }); grid_layout->addWidget(label, row, 0, 1, 1); From 15f80f72342b7f8dcf24dd27fdc0d10c92f86914 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 16 Jan 2022 23:32:27 -0800 Subject: [PATCH 15/31] MathUtil: Mark lo in SaturatingCast as [[maybe_unused]] It's unused in the case that T is unsigned and dest is signed (e.g. SaturatingCast which appears SetIsoPaths in MainSettings.cpp) --- Source/Core/Common/MathUtil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h index 9b31a9acd5..4f3af04dc5 100644 --- a/Source/Core/Common/MathUtil.h +++ b/Source/Core/Common/MathUtil.h @@ -37,7 +37,7 @@ constexpr Dest SaturatingCast(T value) { static_assert(std::is_integral()); - constexpr Dest lo = std::numeric_limits::lowest(); + [[maybe_unused]] constexpr Dest lo = std::numeric_limits::lowest(); constexpr Dest hi = std::numeric_limits::max(); // T being a signed integer and Dest unsigned is a problematic case because the value will From 5f9e04be1d73b3c9ec8aa66defcedbc6f7106c46 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 16 Jan 2022 23:55:23 -0800 Subject: [PATCH 16/31] DSPJit: Suppress offsetof conditionally-supported warnings The DSP JIT only applies on x64, so if it doesn't work on esoteric compilers then that's not a problem. (And if it fails to compile, then it'll still produce an error on that platform, just no warnings on other platforms) --- Source/Core/Core/DSP/Jit/x64/DSPEmitter.cpp | 7 +++++++ Source/Core/Core/DSP/Jit/x64/DSPJitMultiplier.cpp | 7 +++++++ Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/Source/Core/Core/DSP/Jit/x64/DSPEmitter.cpp b/Source/Core/Core/DSP/Jit/x64/DSPEmitter.cpp index bfe7d117ec..4960c4c992 100644 --- a/Source/Core/Core/DSP/Jit/x64/DSPEmitter.cpp +++ b/Source/Core/Core/DSP/Jit/x64/DSPEmitter.cpp @@ -470,6 +470,10 @@ void DSPEmitter::CompileDispatcher() RET(); } +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif Gen::OpArg DSPEmitter::M_SDSP_pc() { return MDisp(R15, static_cast(offsetof(SDSP, pc))); @@ -503,5 +507,8 @@ Gen::OpArg DSPEmitter::M_SDSP_reg_stack_ptrs(size_t index) return MDisp(R15, static_cast(offsetof(SDSP, reg_stack_ptrs) + sizeof(SDSP::reg_stack_ptrs[0]) * index)); } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif } // namespace DSP::JIT::x64 diff --git a/Source/Core/Core/DSP/Jit/x64/DSPJitMultiplier.cpp b/Source/Core/Core/DSP/Jit/x64/DSPJitMultiplier.cpp index d37e7fd460..617c92462a 100644 --- a/Source/Core/Core/DSP/Jit/x64/DSPJitMultiplier.cpp +++ b/Source/Core/Core/DSP/Jit/x64/DSPJitMultiplier.cpp @@ -149,7 +149,14 @@ void DSPEmitter::multiply_mulx(u8 axh0, u8 axh1) // direct use of prod regs by AX/AXWII (look @that part of ucode). void DSPEmitter::clrp(const UDSPInstruction opc) { +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif int offset = static_cast(offsetof(SDSP, r.prod.val)); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // 64bit move to memory does not work. use 2 32bits MOV(32, MDisp(R15, offset + 0 * sizeof(u32)), Imm32(0xfff00000U)); MOV(32, MDisp(R15, offset + 1 * sizeof(u32)), Imm32(0x001000ffU)); diff --git a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp index 9e69daafab..31becddf8d 100644 --- a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp +++ b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp @@ -20,6 +20,10 @@ namespace DSP::JIT::x64 constexpr std::array s_allocation_order = { {R8, R9, R10, R11, R12, R13, R14, R15, RSI, RDI, RBX, RCX, RDX, RAX, RBP}}; +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif static Gen::OpArg GetRegisterPointer(size_t reg) { switch (reg) @@ -95,6 +99,9 @@ static Gen::OpArg GetRegisterPointer(size_t reg) return M(static_cast(nullptr)); } } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #define STATIC_REG_ACCS //#undef STATIC_REG_ACCS From 50d93499269fb3d8a444cea6ae4da6daad2a2c10 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 17 Jan 2022 00:21:58 -0800 Subject: [PATCH 17/31] Fix integer sign difference comparison warnings --- Source/Core/Core/Core.cpp | 2 +- Source/Core/DiscIO/VolumeVerifier.cpp | 7 ++++--- Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index a945d72276..08b615f5bf 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -1031,7 +1031,7 @@ int AddOnStateChangedCallback(StateChangedCallbackFunc callback) bool RemoveOnStateChangedCallback(int* handle) { - if (handle && *handle >= 0 && s_on_state_changed_callbacks.size() > *handle) + if (handle && *handle >= 0 && s_on_state_changed_callbacks.size() > static_cast(*handle)) { s_on_state_changed_callbacks[*handle] = StateChangedCallbackFunc(); *handle = -1; diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index 252cf427b6..593fb49b33 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -1113,10 +1113,11 @@ void VolumeVerifier::Process() bytes_to_read = Common::AlignUp(content.size, 0x40); content_read = true; - if (m_content_index + 1 < m_content_offsets.size() && - m_content_offsets[m_content_index + 1] < m_progress + bytes_to_read) + const u16 next_content_index = m_content_index + 1; + if (next_content_index < m_content_offsets.size() && + m_content_offsets[next_content_index] < m_progress + bytes_to_read) { - excess_bytes = m_progress + bytes_to_read - m_content_offsets[m_content_index + 1]; + excess_bytes = m_progress + bytes_to_read - m_content_offsets[next_content_index]; } } else if (m_content_index < m_content_offsets.size() && diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp index 77bb8c8bd3..fb300a370f 100644 --- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp @@ -376,7 +376,7 @@ void CodeViewWidget::Update() void CodeViewWidget::CalculateBranchIndentation() { - const size_t rows = rowCount(); + const u32 rows = rowCount(); const size_t columns = m_branches.size(); if (rows < 1 || columns < 1) return; @@ -442,7 +442,7 @@ void CodeViewWidget::CalculateBranchIndentation() }; const u32 first_visible_addr = AddressForRow(0); - const u32 last_visible_addr = AddressForRow(static_cast(rows - 1)); + const u32 last_visible_addr = AddressForRow(rows - 1); if (first_visible_addr <= last_visible_addr) { @@ -456,7 +456,7 @@ void CodeViewWidget::CalculateBranchIndentation() // first_visible_addr to fffffffc, and the second for 00000000 to last_visible_addr. // That means we need to find the row corresponding to 00000000. int addr_zero_row = -1; - for (int row = 0; row < rows; row++) + for (u32 row = 0; row < rows; row++) { if (AddressForRow(row) == 0) { From d2ebbfb91a7d50b0db12010392a594c12bbf1c44 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 17 Jan 2022 00:40:46 -0800 Subject: [PATCH 18/31] GDB Stub: Make s_socket_context static --- Source/Core/Core/PowerPC/GDBStub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index f097135940..2fe39b75fd 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -40,7 +40,7 @@ typedef SSIZE_T ssize_t; namespace GDBStub { -std::optional s_socket_context; +static std::optional s_socket_context; #define GDB_BFR_MAX 10000 From 5e4d1f732db7f2ef397c55ba8fadbbf2975c6bbe Mon Sep 17 00:00:00 2001 From: Zopolis4 Date: Thu, 3 Feb 2022 10:40:28 +1100 Subject: [PATCH 19/31] Remove the Maps folder from the Sys directory It only had two out of date and game-specific maps from decades ago --- Data/Sys/Maps/GFZE01.map | 41 ---------------------------------- Data/Sys/Maps/GMBE8P.map | 34 ---------------------------- Readme.md | 1 - Source/Core/Core/Boot/Boot.cpp | 19 +++++----------- 4 files changed, 6 insertions(+), 89 deletions(-) delete mode 100644 Data/Sys/Maps/GFZE01.map delete mode 100644 Data/Sys/Maps/GMBE8P.map diff --git a/Data/Sys/Maps/GFZE01.map b/Data/Sys/Maps/GFZE01.map deleted file mode 100644 index 464dba3610..0000000000 --- a/Data/Sys/Maps/GFZE01.map +++ /dev/null @@ -1,41 +0,0 @@ -.text -80003488 000000b8 80003488 0 __fill_mem -80003540 00000050 80003540 0 memcpy -8006cff8 0000004c 8006cff8 0 .LoadQuantizers -8006d044 0000002c 8006d044 0 .kill_infinites_helper -8006d070 00000018 8006d070 0 .kill_infinites -8006d088 0000002c 8006d088 0 .rsqrt -8006d0b4 00000034 8006d0b4 0 .sqrt_internal_fz -8006d0e8 00000030 8006d0e8 0 .rsqrt_internal_fz -8006d118 00000070 8006d118 0 .sqrt_fz -8006d188 00000030 8006d188 0 .wrapping_once_fp_lookup -8006d1b8 00000064 8006d1b8 0 .weird2 -8006d1c4 00000058 8006d1c4 0 .into_weird2 -8006d21c 00000030 8006d21c 0 .lookup_some_float_in_table_with_neg_wrap -8006d24c 00000184 8006d24c 0 .atan2 -8006d3d0 0000009c 8006d3d0 0 .asin_fz -8006d46c 000000c8 8006d46c 0 .acos_fz -8006d534 00000070 8006d534 0 .evil_vec_cosine -8006d5f0 00000078 8006d5f0 0 .evil_vec_setlength -8006d668 00000094 8006d668 0 .evil_vec_something -8006d6fc 0000005c 8006d6fc 0 .func -8006d784 0000002c 8006d784 0 .load_strange_matrix1 -8006d7b0 0000002c 8006d7b0 0 .load_strange_matrix2 -8006d7f4 0000003c 8006d7f4 0 .some_strange_destination -8006db30 00000044 8006db30 0 .push_matrix_3x3? -8006db74 00000038 8006db74 0 .write_top_3x3_matrix -8006dbe4 0000003c 8006dbe4 0 .read_current_3x3_matrix -8006dc20 00000014 8006dc20 0 .pop_matrix_stack -8006e424 00000074 8006e424 0 .weird_param_in_p1_p2 -8006e978 000001d4 8006e978 0 zz_006e978_ -8006eb4c 000001c0 8006eb4c 0 zz_006eb4c_ -8006f6a8 000000cc 8006f6a8 0 .z_last_skum_function -800798f0 000000ec 800798f0 0 __div2u -800799dc 00000138 800799dc 0 __div2i -80079b14 000000e0 80079b14 0 __mod2u -80079bf8 0000010c 80079bf8 0 __mod2i -80079d04 00000024 80079d04 0 __shl2i -80079d28 00000024 80079d28 0 __shr2u -80079d4c 00000028 80079d4c 0 __shr2i -8008596c 00000310 8008596c 0 big_matrix_trickery -80088538 00000020 80088538 0 zz_0088538_ diff --git a/Data/Sys/Maps/GMBE8P.map b/Data/Sys/Maps/GMBE8P.map deleted file mode 100644 index 7cbab7e984..0000000000 --- a/Data/Sys/Maps/GMBE8P.map +++ /dev/null @@ -1,34 +0,0 @@ -.text -800031f0 0000001c 800031f0 0 load_sp_rtoc -80007034 0000004c 80007034 0 .LoadQuantizers -80007080 00000030 80007080 0 .LoadInfinitiesEtc -800070b0 00000038 800070b0 0 .rsqrt -800070ec 00000040 800070ec 0 .sqrt_internal_needs_cr1 -8000712c 00000040 8000712c 0 .rsqrt_internal_needs_cr1 -800071e0 00000030 800071e0 0 .wrapping_once_fp_lookup -80007210 00000064 80007210 0 .weird2 -80007274 00000030 80007274 0 .lookup_some_float_in_table_with_neg_wrap -800072a4 00000180 800072a4 0 .atan2 -80007424 000000b8 80007424 0 .calls_sqrt -800074dc 0000005c 800074dc 0 .func -80007538 0000002c 80007538 0 .load_strange_matrix1 -80007564 0000002c 80007564 0 .load_strange_matrix3 -80007590 0000002c 80007590 0 .load_strange_matrix2 -80007834 00000044 80007834 0 .push_matrix_3x3? -80007878 00000038 80007878 0 .read_top_3x3matrix -800078b0 00000038 800078b0 0 .write_top_3x3_matrix -800078e8 0000003c 800078e8 0 .read_current_3x3_matrix -80007924 00000014 80007924 0 .pop_matrix_stack -80007a50 00000170 80007a50 0 .mult_matrix? -80007ecc 000000bc 80007ecc 0 .weird_vector_op_status_in_cr2 -80007f88 00000074 80007f88 0 .weird_param_in_p1_p2 -800080fc 00000078 800080fc 0 .evil_normalize -80008174 00000078 80008174 0 .evil_vec_setlength -800081ec 00000070 800081ec 0 .evil_vec_cosine -80008538 000000f0 80008538 0 .calls_evil1 -8000875c 00000088 8000875c 0 .another_caller -800087e4 0000008c 800087e4 0 .another_caller2 -80008d30 000001b4 80008d30 0 .another_caller3 -80036544 000001b4 80036544 0 .fctiwi_weird2 -8003dd1c 00000110 8003dd1c 0 .fctwi_weird -80043b48 000005bc 80043b48 0 .fctwi_weird3 diff --git a/Readme.md b/Readme.md index 5ec9acee9d..80f0f1424f 100644 --- a/Readme.md +++ b/Readme.md @@ -200,7 +200,6 @@ These folders are installed read-only and should not be changed: * `GameSettings`: per-game default settings database * `GC`: DSP and font dumps -* `Maps`: symbol tables (dev only) * `Shaders`: post-processing shaders * `Themes`: icon themes for GUI * `Resources`: icons that are theme-agnostic diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 30691c730f..0ad7f6ec12 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -362,24 +362,17 @@ void CBoot::UpdateDebugger_MapLoaded() bool CBoot::FindMapFile(std::string* existing_map_file, std::string* writable_map_file) { const std::string& game_id = SConfig::GetInstance().m_debugger_game_id; + std::string path = File::GetUserPath(D_MAPS_IDX) + game_id + ".map"; if (writable_map_file) - *writable_map_file = File::GetUserPath(D_MAPS_IDX) + game_id + ".map"; + *writable_map_file = path; - static const std::array maps_directories{ - File::GetUserPath(D_MAPS_IDX), - File::GetSysDirectory() + MAPS_DIR DIR_SEP, - }; - for (const auto& directory : maps_directories) + if (File::Exists(path)) { - std::string path = directory + game_id + ".map"; - if (File::Exists(path)) - { - if (existing_map_file) - *existing_map_file = std::move(path); + if (existing_map_file) + *existing_map_file = std::move(path); - return true; - } + return true; } return false; From 68d987bbee49f96f25b0e74c3e24946c0f0183a6 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 15 Feb 2022 22:34:29 -0800 Subject: [PATCH 20/31] CommandProcessor: Add FIFO_BP_LO/HI to directly_mapped_vars directly_mapped_vars was added in #69 (4129b30494757a79daf8a07e6a07ea937ba1c94b), but for some reason FIFO_BP_LO/HI were split out from it in in #885 (65af90669bd5f9e02bbaa994d51d5c83d147b868). As far as I can tell, this code (and the code that existed at the time) is identical, so there's no reason to have it handled separately. --- Source/Core/VideoCommon/CommandProcessor.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Source/Core/VideoCommon/CommandProcessor.cpp b/Source/Core/VideoCommon/CommandProcessor.cpp index 890d7ebfa4..6ebb726d23 100644 --- a/Source/Core/VideoCommon/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/CommandProcessor.cpp @@ -121,11 +121,6 @@ void DoState(PointerWrap& p) p.Do(s_interrupt_waiting); } -static inline void WriteLow(std::atomic& reg, u16 lowbits) -{ - reg.store((reg.load(std::memory_order_relaxed) & 0xFFFF0000) | lowbits, - std::memory_order_relaxed); -} static inline void WriteHigh(std::atomic& reg, u16 highbits) { reg.store((reg.load(std::memory_order_relaxed) & 0x0000FFFF) | (static_cast(highbits) << 16), @@ -205,6 +200,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) {FIFO_WRITE_POINTER_HI, MMIO::Utils::HighPart(&fifo.CPWritePointer), false, WMASK_HI_RESTRICT}, // FIFO_READ_POINTER has different code for single/dual core. + {FIFO_BP_LO, MMIO::Utils::LowPart(&fifo.CPBreakpoint), false, WMASK_LO_ALIGN_32BIT}, + {FIFO_BP_HI, MMIO::Utils::HighPart(&fifo.CPBreakpoint), false, WMASK_HI_RESTRICT}, }; for (auto& mapped_var : directly_mapped_vars) @@ -214,16 +211,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) MMIO::DirectWrite(mapped_var.ptr, mapped_var.wmask)); } - mmio->Register(base | FIFO_BP_LO, MMIO::DirectRead(MMIO::Utils::LowPart(&fifo.CPBreakpoint)), - MMIO::ComplexWrite([](u32, u16 val) { - WriteLow(fifo.CPBreakpoint, val & WMASK_LO_ALIGN_32BIT); - })); - mmio->Register(base | FIFO_BP_HI, - MMIO::DirectRead(MMIO::Utils::HighPart(&fifo.CPBreakpoint)), - MMIO::ComplexWrite([WMASK_HI_RESTRICT](u32, u16 val) { - WriteHigh(fifo.CPBreakpoint, val & WMASK_HI_RESTRICT); - })); - // Timing and metrics MMIOs are stubbed with fixed values. struct { From a81b44f69780a15ef6c44377cd88e6e4415ccb8e Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Wed, 16 Feb 2022 11:07:12 -0800 Subject: [PATCH 21/31] Fix menu bar becoming desynced when Pause at End of Movie is disabled Previously, when Pause at End of Movie was disabled, the game would continue running as it should, but the menu bar would think the game was paused, showing the play button instead of the pause button. To make things worse, clicking the play button would then restart the game, instead of pausing or doing nothing. F10 paused/unpaused as normal, though. The old behavior was essentially to enable stepping/pause mode (via `CPU::Break()`) and then if Pause at End of Movie was disabled, to un-pause on the host thread (via `CPU::EnableStepping(false)`). For reasons which aren't entirely clear to me, the first one notified the menu bar (through the `Host::UpdateDisasmDialog` callback, not the `Settings::EmulationStateChanged` one), and the second did not. In any case, this approach does not particularly make sense; I don't see any reason to pause and unpause if Pause at End of Movie is disabled; instead, we should only pause when Pause at End of Movie is enabled. This behavior was probably introduced in c1944f623b5918ab45152795dea9e49f57878138, though I haven't tested it. --- Source/Core/Core/Movie.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 25b8f54018..7eebb5c49c 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -1324,7 +1324,7 @@ void EndPlayInput(bool cont) { // We can be called by EmuThread during boot (CPU::State::PowerDown) bool was_running = Core::IsRunningAndStarted() && !CPU::IsStepping(); - if (was_running) + if (was_running && Config::Get(Config::MAIN_MOVIE_PAUSE_MOVIE)) CPU::Break(); s_rerecords = 0; s_currentByte = 0; @@ -1337,11 +1337,7 @@ void EndPlayInput(bool cont) // delete tmpInput; // tmpInput = nullptr; - Core::QueueHostJob([=] { - Core::UpdateWantDeterminism(); - if (was_running && !Config::Get(Config::MAIN_MOVIE_PAUSE_MOVIE)) - CPU::EnableStepping(false); - }); + Core::QueueHostJob([=] { Core::UpdateWantDeterminism(); }); } } From f56251168e9176b5c74936ad2a41c59495f13a0c Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Wed, 16 Feb 2022 12:44:50 -0800 Subject: [PATCH 22/31] Movie: Convert PlayMode to enum class and move to cpp file --- Source/Core/Core/Movie.cpp | 37 ++++++++++++++++++++++--------------- Source/Core/Core/Movie.h | 7 ------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 25b8f54018..5eb9b32a10 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -79,9 +79,16 @@ namespace Movie using namespace WiimoteCommon; using namespace WiimoteEmu; +enum class PlayMode +{ + None = 0, + Recording, + Playing, +}; + static bool s_bReadOnly = true; static u32 s_rerecords = 0; -static PlayMode s_playMode = MODE_NONE; +static PlayMode s_playMode = PlayMode::None; static std::array s_controllers{}; static std::array s_wiimotes{}; @@ -308,7 +315,7 @@ void SetReadOnly(bool bEnabled) bool IsRecordingInput() { - return (s_playMode == MODE_RECORDING); + return (s_playMode == PlayMode::Recording); } bool IsRecordingInputFromSaveState() @@ -328,12 +335,12 @@ bool IsJustStartingPlayingInputFromSaveState() bool IsPlayingInput() { - return (s_playMode == MODE_PLAYING); + return (s_playMode == PlayMode::Playing); } bool IsMovieActive() { - return s_playMode != MODE_NONE; + return s_playMode != PlayMode::None; } bool IsReadOnly() @@ -528,7 +535,7 @@ void ChangeWiiPads(bool instantly) bool BeginRecordingInput(const ControllerTypeArray& controllers, const WiimoteEnabledArray& wiimotes) { - if (s_playMode != MODE_NONE || + if (s_playMode != PlayMode::None || (controllers == ControllerTypeArray{} && wiimotes == WiimoteEnabledArray{})) return false; @@ -585,7 +592,7 @@ bool BeginRecordingInput(const ControllerTypeArray& controllers, Wiimote::ResetAllWiimotes(); } - s_playMode = MODE_RECORDING; + s_playMode = PlayMode::Recording; s_author = Config::Get(Config::MAIN_MOVIE_MOVIE_AUTHOR); s_temp_input.clear(); @@ -937,7 +944,7 @@ void ReadHeader() // NOTE: Host Thread bool PlayInput(const std::string& movie_path, std::optional* savestate_path) { - if (s_playMode != MODE_NONE) + if (s_playMode != PlayMode::None) return false; File::IOFile recording_file(movie_path, "rb"); @@ -959,7 +966,7 @@ bool PlayInput(const std::string& movie_path, std::optional* savest s_currentLagCount = 0; s_currentInputCount = 0; - s_playMode = MODE_PLAYING; + s_playMode = PlayMode::Playing; // Wiimotes cause desync issues if they're not reset before launching the game Wiimote::ResetAllWiimotes(); @@ -1139,18 +1146,18 @@ void LoadInput(const std::string& movie_path) { if (s_bReadOnly) { - if (s_playMode != MODE_PLAYING) + if (s_playMode != PlayMode::Playing) { - s_playMode = MODE_PLAYING; + s_playMode = PlayMode::Playing; Core::UpdateWantDeterminism(); Core::DisplayMessage("Switched to playback", 2000); } } else { - if (s_playMode != MODE_RECORDING) + if (s_playMode != PlayMode::Recording) { - s_playMode = MODE_RECORDING; + s_playMode = PlayMode::Recording; Core::UpdateWantDeterminism(); Core::DisplayMessage("Switched to recording", 2000); } @@ -1317,10 +1324,10 @@ void EndPlayInput(bool cont) // If !IsMovieActive(), changing s_playMode requires calling UpdateWantDeterminism ASSERT(IsMovieActive()); - s_playMode = MODE_RECORDING; + s_playMode = PlayMode::Recording; Core::DisplayMessage("Reached movie end. Resuming recording.", 2000); } - else if (s_playMode != MODE_NONE) + else if (s_playMode != PlayMode::None) { // We can be called by EmuThread during boot (CPU::State::PowerDown) bool was_running = Core::IsRunningAndStarted() && !CPU::IsStepping(); @@ -1328,7 +1335,7 @@ void EndPlayInput(bool cont) CPU::Break(); s_rerecords = 0; s_currentByte = 0; - s_playMode = MODE_NONE; + s_playMode = PlayMode::None; Core::DisplayMessage("Movie End.", 2000); s_bRecordingFromSaveState = false; // we don't clear these things because otherwise we can't resume playback if we load a movie diff --git a/Source/Core/Core/Movie.h b/Source/Core/Core/Movie.h index a774f7ad4e..25747cd8a2 100644 --- a/Source/Core/Core/Movie.h +++ b/Source/Core/Core/Movie.h @@ -37,13 +37,6 @@ class EncryptionKey; namespace Movie { // Enumerations and structs -enum PlayMode -{ - MODE_NONE = 0, - MODE_RECORDING, - MODE_PLAYING -}; - enum class ControllerType { None = 0, From edbe202aa3290ca267acebc7e9602a08e447754f Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Thu, 17 Feb 2022 09:54:07 -0800 Subject: [PATCH 23/31] VideoCommon: Convert OptionType to enum class --- .../Graphics/PostProcessingConfigWindow.cpp | 8 ++-- Source/Core/VideoCommon/PostProcessing.cpp | 37 +++++++++---------- Source/Core/VideoCommon/PostProcessing.h | 10 ++--- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.cpp b/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.cpp index 434aaa6d2f..59907bd39b 100644 --- a/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.cpp @@ -227,11 +227,11 @@ u32 PostProcessingConfigWindow::ConfigGroup::AddWidgets(PostProcessingConfigWind switch (m_config_option->m_type) { - case OptionType::OPTION_BOOL: + case OptionType::Bool: return AddBool(parent, grid, row); - case OptionType::OPTION_FLOAT: + case OptionType::Float: return AddFloat(parent, grid, row); - case OptionType::OPTION_INTEGER: + case OptionType::Integer: return AddInteger(parent, grid, row); default: // obviously shouldn't get here @@ -336,7 +336,7 @@ void PostProcessingConfigWindow::ConfigGroup::EnableSuboptions(const bool state) { for (auto& it : m_subgroups) { - if (it->m_config_option->m_type == OptionType::OPTION_BOOL) + if (it->m_config_option->m_type == OptionType::Bool) { it->m_checkbox->setEnabled(state); } diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 69c3dcfa0c..d9f7a8e8c6 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -166,11 +166,11 @@ void PostProcessingConfiguration::LoadOptions(const std::string& code) option.m_dirty = true; if (it.m_type == "OptionBool") - option.m_type = ConfigurationOption::OptionType::OPTION_BOOL; + option.m_type = ConfigurationOption::OptionType::Bool; else if (it.m_type == "OptionRangeFloat") - option.m_type = ConfigurationOption::OptionType::OPTION_FLOAT; + option.m_type = ConfigurationOption::OptionType::Float; else if (it.m_type == "OptionRangeInteger") - option.m_type = ConfigurationOption::OptionType::OPTION_INTEGER; + option.m_type = ConfigurationOption::OptionType::Integer; for (const auto& string_option : it.m_options) { @@ -213,17 +213,17 @@ void PostProcessingConfiguration::LoadOptions(const std::string& code) output_float = &option.m_float_step_values; } - if (option.m_type == ConfigurationOption::OptionType::OPTION_BOOL) + if (option.m_type == ConfigurationOption::OptionType::Bool) { TryParse(string_option.second, &option.m_bool_value); } - else if (option.m_type == ConfigurationOption::OptionType::OPTION_INTEGER) + else if (option.m_type == ConfigurationOption::OptionType::Integer) { TryParseVector(string_option.second, output_integer); if (output_integer->size() > 4) output_integer->erase(output_integer->begin() + 4, output_integer->end()); } - else if (option.m_type == ConfigurationOption::OptionType::OPTION_FLOAT) + else if (option.m_type == ConfigurationOption::OptionType::Float) { TryParseVector(string_option.second, output_float); if (output_float->size() > 4) @@ -245,11 +245,11 @@ void PostProcessingConfiguration::LoadOptionsConfiguration() { switch (it.second.m_type) { - case ConfigurationOption::OptionType::OPTION_BOOL: + case ConfigurationOption::OptionType::Bool: ini.GetOrCreateSection(section)->Get(it.second.m_option_name, &it.second.m_bool_value, it.second.m_bool_value); break; - case ConfigurationOption::OptionType::OPTION_INTEGER: + case ConfigurationOption::OptionType::Integer: { std::string value; ini.GetOrCreateSection(section)->Get(it.second.m_option_name, &value); @@ -257,7 +257,7 @@ void PostProcessingConfiguration::LoadOptionsConfiguration() TryParseVector(value, &it.second.m_integer_values); } break; - case ConfigurationOption::OptionType::OPTION_FLOAT: + case ConfigurationOption::OptionType::Float: { std::string value; ini.GetOrCreateSection(section)->Get(it.second.m_option_name, &value); @@ -279,12 +279,12 @@ void PostProcessingConfiguration::SaveOptionsConfiguration() { switch (it.second.m_type) { - case ConfigurationOption::OptionType::OPTION_BOOL: + case ConfigurationOption::OptionType::Bool: { ini.GetOrCreateSection(section)->Set(it.second.m_option_name, it.second.m_bool_value); } break; - case ConfigurationOption::OptionType::OPTION_INTEGER: + case ConfigurationOption::OptionType::Integer: { std::string value; for (size_t i = 0; i < it.second.m_integer_values.size(); ++i) @@ -295,7 +295,7 @@ void PostProcessingConfiguration::SaveOptionsConfiguration() ini.GetOrCreateSection(section)->Set(it.second.m_option_name, value); } break; - case ConfigurationOption::OptionType::OPTION_FLOAT: + case ConfigurationOption::OptionType::Float: { std::ostringstream value; value.imbue(std::locale("C")); @@ -459,15 +459,14 @@ std::string PostProcessing::GetUniformBufferHeader() const // Custom options/uniforms for (const auto& it : m_config.GetOptions()) { - if (it.second.m_type == - PostProcessingConfiguration::ConfigurationOption::OptionType::OPTION_BOOL) + if (it.second.m_type == PostProcessingConfiguration::ConfigurationOption::OptionType::Bool) { ss << fmt::format(" int {};\n", it.first); for (u32 i = 0; i < 3; i++) ss << " int ubo_align_" << unused_counter++ << "_;\n"; } else if (it.second.m_type == - PostProcessingConfiguration::ConfigurationOption::OptionType::OPTION_INTEGER) + PostProcessingConfiguration::ConfigurationOption::OptionType::Integer) { u32 count = static_cast(it.second.m_integer_values.size()); if (count == 1) @@ -479,7 +478,7 @@ std::string PostProcessing::GetUniformBufferHeader() const ss << " int ubo_align_" << unused_counter++ << "_;\n"; } else if (it.second.m_type == - PostProcessingConfiguration::ConfigurationOption::OptionType::OPTION_FLOAT) + PostProcessingConfiguration::ConfigurationOption::OptionType::Float) { u32 count = static_cast(it.second.m_float_values.size()); if (count == 1) @@ -707,17 +706,17 @@ void PostProcessing::FillUniformBuffer(const MathUtil::Rectangle& src, switch (it.second.m_type) { - case PostProcessingConfiguration::ConfigurationOption::OptionType::OPTION_BOOL: + case PostProcessingConfiguration::ConfigurationOption::OptionType::Bool: value.as_bool[0] = it.second.m_bool_value ? 1 : 0; break; - case PostProcessingConfiguration::ConfigurationOption::OptionType::OPTION_INTEGER: + case PostProcessingConfiguration::ConfigurationOption::OptionType::Integer: ASSERT(it.second.m_integer_values.size() < 4); std::copy_n(it.second.m_integer_values.begin(), it.second.m_integer_values.size(), value.as_int); break; - case PostProcessingConfiguration::ConfigurationOption::OptionType::OPTION_FLOAT: + case PostProcessingConfiguration::ConfigurationOption::OptionType::Float: ASSERT(it.second.m_float_values.size() < 4); std::copy_n(it.second.m_float_values.begin(), it.second.m_float_values.size(), value.as_float); diff --git a/Source/Core/VideoCommon/PostProcessing.h b/Source/Core/VideoCommon/PostProcessing.h index aafee8f1f6..c7f94535f5 100644 --- a/Source/Core/VideoCommon/PostProcessing.h +++ b/Source/Core/VideoCommon/PostProcessing.h @@ -24,11 +24,11 @@ class PostProcessingConfiguration public: struct ConfigurationOption { - enum OptionType + enum class OptionType { - OPTION_BOOL = 0, - OPTION_FLOAT, - OPTION_INTEGER, + Bool = 0, + Float, + Integer, }; bool m_bool_value = false; @@ -45,7 +45,7 @@ public: std::vector m_float_step_values; std::vector m_integer_step_values; - OptionType m_type = OptionType::OPTION_BOOL; + OptionType m_type = OptionType::Bool; std::string m_gui_name; std::string m_option_name; From 63181f04464c27802e7951ffc06604a206903496 Mon Sep 17 00:00:00 2001 From: Techjar Date: Fri, 18 Feb 2022 06:34:01 -0500 Subject: [PATCH 24/31] ShaderGenCommon: Add missing include --- Source/Core/VideoCommon/ShaderGenCommon.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h index edbd931db9..bec69fe7c0 100644 --- a/Source/Core/VideoCommon/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/ShaderGenCommon.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include #include From aff45c91fc0729595a2e40511404386726bfd205 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 25 Jan 2022 20:34:03 +0100 Subject: [PATCH 25/31] Port Wiimote source settings to the new config system This lets us finally get rid of BootManager's ConfigCache! --- Source/Android/jni/MainAndroid.cpp | 1 - Source/Core/Core/BootManager.cpp | 90 ------------------- Source/Core/Core/CMakeLists.txt | 2 + Source/Core/Core/Config/WiimoteSettings.cpp | 30 +++++++ Source/Core/Core/Config/WiimoteSettings.h | 20 +++++ .../Core/ConfigLoaders/GameConfigLoader.cpp | 6 ++ .../Core/ConfigLoaders/IsSettingSaveable.cpp | 9 ++ Source/Core/Core/HW/Wiimote.cpp | 33 ++++++- Source/Core/Core/HW/Wiimote.h | 5 -- .../Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 47 ++++------ Source/Core/Core/Movie.cpp | 8 +- Source/Core/Core/NetPlayClient.cpp | 5 +- Source/Core/DolphinLib.props | 2 + .../Config/WiimoteControllersWidget.cpp | 17 ++-- Source/Core/DolphinQt/MainWindow.cpp | 5 +- Source/Core/UICommon/UICommon.cpp | 24 ----- Source/Core/UICommon/UICommon.h | 2 - 17 files changed, 134 insertions(+), 172 deletions(-) create mode 100644 Source/Core/Core/Config/WiimoteSettings.cpp create mode 100644 Source/Core/Core/Config/WiimoteSettings.h diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index b533ba74d6..5abd318b1f 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -496,7 +496,6 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimo JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadWiimoteConfig(JNIEnv*, jclass) { - WiimoteReal::LoadSettings(); Wiimote::LoadConfig(); } diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 7ca13a7729..755a0f9277 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -53,58 +53,6 @@ namespace BootManager { -// TODO this is an ugly hack which allows us to restore values trampled by per-game settings -// Apply fire liberally -struct ConfigCache -{ -public: - // fill the cache with values from the configuration - void SaveConfig(const SConfig& config); - // restore values to the configuration from the cache - void RestoreConfig(SConfig* config); - - // These store if the relevant setting should be reset back later (true) or if it should be left - // alone on restore (false) - bool bSetVolume = false; - std::array bSetWiimoteSource{}; - -private: - bool valid = false; - std::array iWiimoteSource{}; -}; - -void ConfigCache::SaveConfig(const SConfig& config) -{ - valid = true; - - for (int i = 0; i != MAX_BBMOTES; ++i) - iWiimoteSource[i] = WiimoteCommon::GetSource(i); - - bSetVolume = false; - bSetWiimoteSource.fill(false); -} - -void ConfigCache::RestoreConfig(SConfig* config) -{ - if (!valid) - return; - - valid = false; - - // Only change these back if they were actually set by game ini, since they can be changed while a - // game is running. - if (config->bWii) - { - for (unsigned int i = 0; i < MAX_BBMOTES; ++i) - { - if (bSetWiimoteSource[i]) - WiimoteCommon::SetSource(i, iWiimoteSource[i]); - } - } -} - -static ConfigCache config_cache; - // Boot the ISO or file bool BootCore(std::unique_ptr boot, const WindowSystemInfo& wsi) { @@ -113,46 +61,9 @@ bool BootCore(std::unique_ptr boot, const WindowSystemInfo& wsi) SConfig& StartUp = SConfig::GetInstance(); - config_cache.SaveConfig(StartUp); - if (!StartUp.SetPathsAndGameMetadata(*boot)) return false; - // Load game specific settings - if (!std::holds_alternative(boot->parameters)) - { - IniFile game_ini = StartUp.LoadGameIni(); - - // General settings - IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls"); - - // Wii settings - if (StartUp.bWii) - { - int source; - for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - { - controls_section->Get(fmt::format("WiimoteSource{}", i), &source, -1); - if (source != -1 && WiimoteCommon::GetSource(i) != WiimoteSource(source) && - WiimoteSource(source) >= WiimoteSource::None && - WiimoteSource(source) <= WiimoteSource::Real) - { - config_cache.bSetWiimoteSource[i] = true; - WiimoteCommon::SetSource(i, WiimoteSource(source)); - } - } - controls_section->Get("WiimoteSourceBB", &source, -1); - if (source != -1 && - WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD) != WiimoteSource(source) && - (WiimoteSource(source) == WiimoteSource::None || - WiimoteSource(source) == WiimoteSource::Real)) - { - config_cache.bSetWiimoteSource[WIIMOTE_BALANCE_BOARD] = true; - WiimoteCommon::SetSource(WIIMOTE_BALANCE_BOARD, WiimoteSource(source)); - } - } - } - // Movie settings if (Movie::IsPlayingInput() && Movie::IsConfigSaved()) { @@ -313,7 +224,6 @@ void RestoreConfig() Config::RemoveLayer(Config::LayerType::GlobalGame); Config::RemoveLayer(Config::LayerType::LocalGame); SConfig::GetInstance().ResetRunningGameMetadata(); - config_cache.RestoreConfig(&SConfig::GetInstance()); } } // namespace BootManager diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index c0608572df..4063e01562 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -36,6 +36,8 @@ add_library(core Config/SYSCONFSettings.h Config/UISettings.cpp Config/UISettings.h + Config/WiimoteSettings.cpp + Config/WiimoteSettings.h ConfigLoaders/BaseConfigLoader.cpp ConfigLoaders/BaseConfigLoader.h ConfigLoaders/GameConfigLoader.cpp diff --git a/Source/Core/Core/Config/WiimoteSettings.cpp b/Source/Core/Core/Config/WiimoteSettings.cpp new file mode 100644 index 0000000000..6a9fe8efb2 --- /dev/null +++ b/Source/Core/Core/Config/WiimoteSettings.cpp @@ -0,0 +1,30 @@ +// Copyright 2022 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "Core/Config/WiimoteSettings.h" + +#include "Core/HW/Wiimote.h" + +namespace Config +{ +const Info WIIMOTE_1_SOURCE{{System::WiiPad, "Wiimote1", "Source"}, + WiimoteSource::Emulated}; +const Info WIIMOTE_2_SOURCE{{System::WiiPad, "Wiimote2", "Source"}, + WiimoteSource::None}; +const Info WIIMOTE_3_SOURCE{{System::WiiPad, "Wiimote3", "Source"}, + WiimoteSource::None}; +const Info WIIMOTE_4_SOURCE{{System::WiiPad, "Wiimote4", "Source"}, + WiimoteSource::None}; +const Info WIIMOTE_BB_SOURCE{{System::WiiPad, "BalanceBoard", "Source"}, + WiimoteSource::None}; + +const Info& GetInfoForWiimoteSource(int index) +{ + static const std::array*, 5> infos{ + &WIIMOTE_1_SOURCE, &WIIMOTE_2_SOURCE, &WIIMOTE_3_SOURCE, + &WIIMOTE_4_SOURCE, &WIIMOTE_BB_SOURCE, + }; + return *infos[index]; +} + +} // namespace Config diff --git a/Source/Core/Core/Config/WiimoteSettings.h b/Source/Core/Core/Config/WiimoteSettings.h new file mode 100644 index 0000000000..9e97c35726 --- /dev/null +++ b/Source/Core/Core/Config/WiimoteSettings.h @@ -0,0 +1,20 @@ +// Copyright 2022 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "Common/Config/Config.h" + +enum class WiimoteSource; + +namespace Config +{ +extern const Info WIIMOTE_1_SOURCE; +extern const Info WIIMOTE_2_SOURCE; +extern const Info WIIMOTE_3_SOURCE; +extern const Info WIIMOTE_4_SOURCE; +extern const Info WIIMOTE_BB_SOURCE; + +const Info& GetInfoForWiimoteSource(int index); + +} // namespace Config diff --git a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp index cf864b97b2..62fe3e5968 100644 --- a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp @@ -26,6 +26,7 @@ #include "Core/Config/MainSettings.h" #include "Core/Config/SYSCONFSettings.h" +#include "Core/Config/WiimoteSettings.h" #include "Core/ConfigLoaders/IsSettingSaveable.h" namespace ConfigLoaders @@ -79,6 +80,11 @@ static const INIToLocationMap& GetINIToLocationMap() {{"Controls", "PadType1"}, {Config::GetInfoForSIDevice(1).GetLocation()}}, {{"Controls", "PadType2"}, {Config::GetInfoForSIDevice(2).GetLocation()}}, {{"Controls", "PadType3"}, {Config::GetInfoForSIDevice(3).GetLocation()}}, + {{"Controls", "WiimoteSource0"}, {Config::WIIMOTE_1_SOURCE.GetLocation()}}, + {{"Controls", "WiimoteSource1"}, {Config::WIIMOTE_2_SOURCE.GetLocation()}}, + {{"Controls", "WiimoteSource2"}, {Config::WIIMOTE_3_SOURCE.GetLocation()}}, + {{"Controls", "WiimoteSource3"}, {Config::WIIMOTE_4_SOURCE.GetLocation()}}, + {{"Controls", "WiimoteSourceBB"}, {Config::WIIMOTE_BB_SOURCE.GetLocation()}}, }; return ini_to_location; } diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index 18fa55f176..2dd5a5697d 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -10,6 +10,7 @@ #include "Core/Config/GraphicsSettings.h" #include "Core/Config/MainSettings.h" #include "Core/Config/UISettings.h" +#include "Core/Config/WiimoteSettings.h" namespace ConfigLoaders { @@ -129,6 +130,14 @@ bool IsSettingSaveable(const Config::Location& config_location) // UI.General &Config::MAIN_USE_DISCORD_PRESENCE.GetLocation(), + + // Wiimote + + &Config::WIIMOTE_1_SOURCE.GetLocation(), + &Config::WIIMOTE_2_SOURCE.GetLocation(), + &Config::WIIMOTE_3_SOURCE.GetLocation(), + &Config::WIIMOTE_4_SOURCE.GetLocation(), + &Config::WIIMOTE_BB_SOURCE.GetLocation(), }; return std::any_of(begin(s_setting_saveable), end(s_setting_saveable), diff --git a/Source/Core/Core/HW/Wiimote.cpp b/Source/Core/Core/HW/Wiimote.cpp index 30d522b564..675e533346 100644 --- a/Source/Core/Core/HW/Wiimote.cpp +++ b/Source/Core/Core/HW/Wiimote.cpp @@ -3,9 +3,13 @@ #include "Core/HW/Wiimote.h" +#include + #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" +#include "Common/Config/Config.h" +#include "Core/Config/WiimoteSettings.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h" @@ -23,16 +27,17 @@ // Limit the amount of wiimote connect requests, when a button is pressed in disconnected state static std::array s_last_connect_request_counter; -namespace WiimoteCommon +namespace { static std::array, MAX_BBMOTES> s_wiimote_sources; +static std::optional s_config_callback_id = std::nullopt; WiimoteSource GetSource(unsigned int index) { return s_wiimote_sources[index]; } -void SetSource(unsigned int index, WiimoteSource source) +void OnSourceChanged(unsigned int index, WiimoteSource source) { const WiimoteSource previous_source = s_wiimote_sources[index].exchange(source); @@ -44,9 +49,19 @@ void SetSource(unsigned int index, WiimoteSource source) WiimoteReal::HandleWiimoteSourceChange(index); - Core::RunAsCPUThread([index] { UpdateSource(index); }); + Core::RunAsCPUThread([index] { WiimoteCommon::UpdateSource(index); }); } +void RefreshConfig() +{ + for (int i = 0; i < MAX_BBMOTES; ++i) + OnSourceChanged(i, Config::Get(Config::GetInfoForWiimoteSource(i))); +} + +} // namespace + +namespace WiimoteCommon +{ void UpdateSource(unsigned int index) { const auto bluetooth = WiiUtils::GetBluetoothEmuDevice(); @@ -144,6 +159,12 @@ void Shutdown() s_config.ClearControllers(); WiimoteReal::Stop(); + + if (s_config_callback_id) + { + Config::RemoveConfigChangedCallback(*s_config_callback_id); + s_config_callback_id = std::nullopt; + } } void Initialize(InitializeMode init_mode) @@ -158,6 +179,10 @@ void Initialize(InitializeMode init_mode) LoadConfig(); + if (!s_config_callback_id) + s_config_callback_id = Config::AddConfigChangedCallback(RefreshConfig); + RefreshConfig(); + WiimoteReal::Initialize(init_mode); // Reload Wiimotes with our settings @@ -191,7 +216,7 @@ void DoState(PointerWrap& p) { for (int i = 0; i < MAX_BBMOTES; ++i) { - const WiimoteSource source = WiimoteCommon::GetSource(i); + const WiimoteSource source = GetSource(i); auto state_wiimote_source = u8(source); p.Do(state_wiimote_source); diff --git a/Source/Core/Core/HW/Wiimote.h b/Source/Core/Core/HW/Wiimote.h index 1df00539ce..ee59aec2e1 100644 --- a/Source/Core/Core/HW/Wiimote.h +++ b/Source/Core/Core/HW/Wiimote.h @@ -54,9 +54,6 @@ namespace WiimoteCommon { class HIDWiimote; -WiimoteSource GetSource(unsigned int index); -void SetSource(unsigned int index, WiimoteSource source); - // Used to reconnect WiimoteDevice instance to HID source. // Must be run from CPU thread. void UpdateSource(unsigned int index); @@ -108,6 +105,4 @@ void Resume(); void Pause(); void Refresh(); -void LoadSettings(); - } // namespace WiimoteReal diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index 4f2896ad49..6b36551774 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -11,11 +11,14 @@ #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" +#include "Common/Config/Config.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" #include "Common/Swap.h" #include "Common/Thread.h" + #include "Core/Config/MainSettings.h" +#include "Core/Config/WiimoteSettings.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/Wiimote.h" @@ -25,6 +28,7 @@ #include "Core/HW/WiimoteReal/IOLinux.h" #include "Core/HW/WiimoteReal/IOWin.h" #include "Core/HW/WiimoteReal/IOhidapi.h" + #include "InputCommon/ControllerInterface/Wiimote/WiimoteController.h" #include "InputCommon/InputConfig.h" @@ -78,8 +82,11 @@ static void TryToFillWiimoteSlot(u32 index) { std::lock_guard lk(g_wiimotes_mutex); - if (g_wiimotes[index] || WiimoteCommon::GetSource(index) != WiimoteSource::Real) + if (g_wiimotes[index] || + Config::Get(Config::GetInfoForWiimoteSource(index)) != WiimoteSource::Real) + { return; + } // If the pool is empty, attempt to steal from ControllerInterface. if (s_wiimote_pool.empty()) @@ -531,9 +538,11 @@ static unsigned int CalculateWantedWiimotes() std::lock_guard lk(g_wiimotes_mutex); // Figure out how many real Wiimotes are required unsigned int wanted_wiimotes = 0; - for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - if (WiimoteCommon::GetSource(i) == WiimoteSource::Real && !g_wiimotes[i]) + for (int i = 0; i < MAX_WIIMOTES; ++i) + { + if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Real && !g_wiimotes[i]) ++wanted_wiimotes; + } return wanted_wiimotes; } @@ -541,9 +550,11 @@ static unsigned int CalculateWantedBB() { std::lock_guard lk(g_wiimotes_mutex); unsigned int wanted_bb = 0; - if (WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD) == WiimoteSource::Real && + if (Config::Get(Config::WIIMOTE_BB_SOURCE) == WiimoteSource::Real && !g_wiimotes[WIIMOTE_BALANCE_BOARD]) + { ++wanted_bb; + } return wanted_bb; } @@ -823,32 +834,6 @@ int Wiimote::GetIndex() const return m_index; } -void LoadSettings() -{ - std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini"; - - IniFile inifile; - inifile.Load(ini_filename); - - for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - { - std::string secname("Wiimote"); - secname += static_cast('1' + i); - IniFile::Section& sec = *inifile.GetOrCreateSection(secname); - - unsigned int source = 0; - sec.Get("Source", &source, i ? int(WiimoteSource::None) : int(WiimoteSource::Emulated)); - WiimoteCommon::SetSource(i, WiimoteSource(source)); - } - - std::string secname("BalanceBoard"); - IniFile::Section& sec = *inifile.GetOrCreateSection(secname); - - unsigned int bb_source = 0; - sec.Get("Source", &bb_source, int(WiimoteSource::None)); - WiimoteCommon::SetSource(WIIMOTE_BALANCE_BOARD, WiimoteSource(bb_source)); -} - // config dialog calls this when some settings change void Initialize(::Wiimote::InitializeMode init_mode) { @@ -924,7 +909,7 @@ void Pause() // Called from the Wiimote scanner thread (or UI thread on source change) static bool TryToConnectWiimoteToSlot(std::unique_ptr& wm, unsigned int i) { - if (WiimoteCommon::GetSource(i) != WiimoteSource::Real || g_wiimotes[i]) + if (Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::Real || g_wiimotes[i]) return false; if (!wm->Connect(i)) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 25b8f54018..ec168b5c36 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -36,6 +36,7 @@ #include "Core/Boot/Boot.h" #include "Core/Config/MainSettings.h" #include "Core/Config/SYSCONFSettings.h" +#include "Core/Config/WiimoteSettings.h" #include "Core/ConfigLoaders/MovieConfigLoader.h" #include "Core/ConfigManager.h" #include "Core/Core.h" @@ -169,7 +170,7 @@ std::string GetInputDisplay() s_controllers[i] = ControllerType::GC; else s_controllers[i] = ControllerType::None; - s_wiimotes[i] = WiimoteCommon::GetSource(i) != WiimoteSource::None; + s_wiimotes[i] = Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::None; } } @@ -506,7 +507,7 @@ void ChangeWiiPads(bool instantly) for (int i = 0; i < MAX_WIIMOTES; ++i) { - wiimotes[i] = WiimoteCommon::GetSource(i) != WiimoteSource::None; + wiimotes[i] = Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::None; } // This is important for Wiimotes, because they can desync easily if they get re-activated @@ -518,7 +519,8 @@ void ChangeWiiPads(bool instantly) { const bool is_using_wiimote = IsUsingWiimote(i); - WiimoteCommon::SetSource(i, is_using_wiimote ? WiimoteSource::Emulated : WiimoteSource::None); + Config::SetCurrent(Config::GetInfoForWiimoteSource(i), + is_using_wiimote ? WiimoteSource::Emulated : WiimoteSource::None); if (bt != nullptr) bt->AccessWiimoteByIndex(i)->Activate(is_using_wiimote); } diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 54aeb83e83..2d60e0f776 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -37,6 +37,7 @@ #include "Core/Config/MainSettings.h" #include "Core/Config/NetplaySettings.h" #include "Core/Config/SessionSettings.h" +#include "Core/Config/WiimoteSettings.h" #include "Core/ConfigManager.h" #include "Core/GeckoCode.h" #include "Core/HW/EXI/EXI.h" @@ -1741,8 +1742,8 @@ bool NetPlayClient::StartGame(const std::string& path) for (unsigned int i = 0; i < 4; ++i) { - WiimoteCommon::SetSource(i, - m_wiimote_map[i] > 0 ? WiimoteSource::Emulated : WiimoteSource::None); + Config::SetCurrent(Config::GetInfoForWiimoteSource(i), + m_wiimote_map[i] > 0 ? WiimoteSource::Emulated : WiimoteSource::None); } // boot game diff --git a/Source/Core/DolphinLib.props b/Source/Core/DolphinLib.props index c0d465aafe..79557b58c7 100644 --- a/Source/Core/DolphinLib.props +++ b/Source/Core/DolphinLib.props @@ -176,6 +176,7 @@ + @@ -763,6 +764,7 @@ + diff --git a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp index e5616da4bf..613455ead6 100644 --- a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp +++ b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp @@ -17,7 +17,10 @@ #include #include +#include "Common/Config/Config.h" + #include "Core/Config/MainSettings.h" +#include "Core/Config/WiimoteSettings.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/Wiimote.h" @@ -301,9 +304,9 @@ void WiimoteControllersWidget::LoadSettings() { for (size_t i = 0; i < m_wiimote_groups.size(); i++) { - m_wiimote_boxes[i]->setCurrentIndex(int(WiimoteCommon::GetSource(u32(i)))); + m_wiimote_boxes[i]->setCurrentIndex(int(Config::Get(Config::GetInfoForWiimoteSource(int(i))))); } - m_wiimote_real_balance_board->setChecked(WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD) == + m_wiimote_real_balance_board->setChecked(Config::Get(Config::WIIMOTE_BB_SOURCE) == WiimoteSource::Real); m_wiimote_speaker_data->setChecked(Config::Get(Config::MAIN_WIIMOTE_ENABLE_SPEAKER)); m_wiimote_ciface->setChecked(Config::Get(Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE)); @@ -328,17 +331,15 @@ void WiimoteControllersWidget::SaveSettings() Config::SetBaseOrCurrent(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED, m_wiimote_passthrough->isChecked()); - WiimoteCommon::SetSource(WIIMOTE_BALANCE_BOARD, m_wiimote_real_balance_board->isChecked() ? - WiimoteSource::Real : - WiimoteSource::None); + const WiimoteSource bb_source = + m_wiimote_real_balance_board->isChecked() ? WiimoteSource::Real : WiimoteSource::None; + Config::SetBaseOrCurrent(Config::WIIMOTE_BB_SOURCE, bb_source); for (size_t i = 0; i < m_wiimote_groups.size(); i++) { const int index = m_wiimote_boxes[i]->currentIndex(); - WiimoteCommon::SetSource(u32(i), WiimoteSource(index)); + Config::SetBaseOrCurrent(Config::GetInfoForWiimoteSource(int(i)), WiimoteSource(index)); } - UICommon::SaveWiimoteSources(); - SConfig::GetInstance().SaveSettings(); } diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 7fc42cc44a..9c7d4d37ae 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -39,6 +39,7 @@ #include "Core/CommonTitles.h" #include "Core/Config/MainSettings.h" #include "Core/Config/NetplaySettings.h" +#include "Core/Config/WiimoteSettings.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/FreeLookManager.h" @@ -1735,7 +1736,7 @@ void MainWindow::OnStartRecording() controllers[i] = Movie::ControllerType::GC; else controllers[i] = Movie::ControllerType::None; - wiimotes[i] = WiimoteCommon::GetSource(i) != WiimoteSource::None; + wiimotes[i] = Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::None; } if (Movie::BeginRecordingInput(controllers, wiimotes)) @@ -1795,7 +1796,7 @@ void MainWindow::ShowTASInput() for (int i = 0; i < num_wii_controllers; i++) { - if (WiimoteCommon::GetSource(i) == WiimoteSource::Emulated && + if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Emulated && (!Core::IsRunning() || SConfig::GetInstance().bWii)) { m_wii_tas_input_windows[i]->show(); diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index a5f0721251..2843a5fa3a 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -106,7 +106,6 @@ void Init() SConfig::Init(); Discord::Init(); Common::Log::LogManager::Init(); - WiimoteReal::LoadSettings(); GCAdapter::Init(); VideoBackendBase::ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND)); @@ -356,29 +355,6 @@ void SetUserDirectory(std::string custom_path) File::SetUserPath(D_USER_IDX, std::move(user_path)); } -void SaveWiimoteSources() -{ - std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini"; - - IniFile inifile; - inifile.Load(ini_filename); - - for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - { - std::string secname("Wiimote"); - secname += (char)('1' + i); - IniFile::Section& sec = *inifile.GetOrCreateSection(secname); - - sec.Set("Source", int(WiimoteCommon::GetSource(i))); - } - - std::string secname("BalanceBoard"); - IniFile::Section& sec = *inifile.GetOrCreateSection(secname); - sec.Set("Source", int(WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD))); - - inifile.Save(ini_filename); -} - bool TriggerSTMPowerEvent() { const auto ios = IOS::HLE::GetIOS(); diff --git a/Source/Core/UICommon/UICommon.h b/Source/Core/UICommon/UICommon.h index ea1d44e599..6bdb11f541 100644 --- a/Source/Core/UICommon/UICommon.h +++ b/Source/Core/UICommon/UICommon.h @@ -27,8 +27,6 @@ void SetUserDirectory(std::string custom_path); bool TriggerSTMPowerEvent(); -void SaveWiimoteSources(); - // Return a pretty file size string from byte count. // e.g. 1134278 -> "1.08 MiB" std::string FormatSize(u64 bytes, int decimals = 2); From 1b76171a27063d4e75f8055f901379a47d899d5d Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 18 Feb 2022 21:58:05 +0100 Subject: [PATCH 26/31] Android: Get rid of LegacyIntSetting The only settings that were using LegacyIntSetting are now in the new config system, so there's no reason to have LegacyIntSetting anymore. --- .../features/settings/model/IntSetting.java | 16 ++++- .../settings/model/LegacyIntSetting.java | 26 --------- .../ui/SettingsFragmentPresenter.java | 58 +++++-------------- .../features/settings/utils/SettingsFile.java | 4 -- .../app/src/main/res/values/strings.xml | 11 ---- Source/Android/jni/Config/NativeConfig.cpp | 4 ++ 6 files changed, 35 insertions(+), 84 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyIntSetting.java diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java index d28603cbef..1871652ea3 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java @@ -21,6 +21,10 @@ public enum IntSetting implements AbstractIntSetting MAIN_SLOT_A(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotA", 8), MAIN_SLOT_B(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotB", 255), MAIN_FALLBACK_REGION(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "FallbackRegion", 2), + MAIN_SI_DEVICE_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice0", 6), + MAIN_SI_DEVICE_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice1", 0), + MAIN_SI_DEVICE_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice2", 0), + MAIN_SI_DEVICE_3(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice3", 0), MAIN_AUDIO_VOLUME(Settings.FILE_DOLPHIN, Settings.SECTION_INI_DSP, "Volume", 100), @@ -60,13 +64,23 @@ public enum IntSetting implements AbstractIntSetting GFX_STEREO_CONVERGENCE_PERCENTAGE(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY, "StereoConvergencePercentage", 100), - LOGGER_VERBOSITY(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "Verbosity", 1); + LOGGER_VERBOSITY(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "Verbosity", 1), + + WIIMOTE_1_SOURCE(Settings.FILE_WIIMOTE, "Wiimote1", "Source", 1), + WIIMOTE_2_SOURCE(Settings.FILE_WIIMOTE, "Wiimote2", "Source", 0), + WIIMOTE_3_SOURCE(Settings.FILE_WIIMOTE, "Wiimote3", "Source", 0), + WIIMOTE_4_SOURCE(Settings.FILE_WIIMOTE, "Wiimote4", "Source", 0), + WIIMOTE_BB_SOURCE(Settings.FILE_WIIMOTE, "BalanceBoard", "Source", 0); private static final IntSetting[] NOT_RUNTIME_EDITABLE_ARRAY = new IntSetting[]{ MAIN_CPU_CORE, MAIN_GC_LANGUAGE, MAIN_SLOT_A, // Can actually be changed, but specific code is required MAIN_SLOT_B, // Can actually be changed, but specific code is required + MAIN_SI_DEVICE_0, // Can actually be changed, but specific code is required + MAIN_SI_DEVICE_1, // Can actually be changed, but specific code is required + MAIN_SI_DEVICE_2, // Can actually be changed, but specific code is required + MAIN_SI_DEVICE_3, // Can actually be changed, but specific code is required }; private static final Set NOT_RUNTIME_EDITABLE = diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyIntSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyIntSetting.java deleted file mode 100644 index 0413f9a9a9..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyIntSetting.java +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.settings.model; - -public class LegacyIntSetting extends AbstractLegacySetting implements AbstractIntSetting -{ - private final int mDefaultValue; - - public LegacyIntSetting(String file, String section, String key, int defaultValue) - { - super(file, section, key); - mDefaultValue = defaultValue; - } - - @Override - public int getInt(Settings settings) - { - return settings.getSection(mFile, mSection).getInt(mKey, mDefaultValue); - } - - @Override - public void setInt(Settings settings, int newValue) - { - settings.getSection(mFile, mSection).setInt(mKey, newValue); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java index b9c2c3f840..485dda2cf8 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java @@ -17,7 +17,6 @@ import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; import org.dolphinemu.dolphinemu.features.settings.model.FloatSetting; import org.dolphinemu.dolphinemu.features.settings.model.IntSetting; import org.dolphinemu.dolphinemu.features.settings.model.LegacyBooleanSetting; -import org.dolphinemu.dolphinemu.features.settings.model.LegacyIntSetting; import org.dolphinemu.dolphinemu.features.settings.model.LegacyStringSetting; import org.dolphinemu.dolphinemu.features.settings.model.PostProcessing; import org.dolphinemu.dolphinemu.features.settings.model.Settings; @@ -555,51 +554,26 @@ public final class SettingsFragmentPresenter private void addGcPadSettings(ArrayList sl) { - for (int i = 0; i < 4; i++) - { - // GameCube controller 1 is set to Emulated by default, all others disabled - int defaultValue = i == 0 ? 6 : 0; - - LegacyIntSetting gcPadSetting; - if (mGameID.equals("")) - { - gcPadSetting = new LegacyIntSetting(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, - SettingsFile.KEY_GCPAD_TYPE + i, defaultValue); - } - else - { - gcPadSetting = new LegacyIntSetting(Settings.GAME_SETTINGS_PLACEHOLDER_FILE_NAME, - Settings.SECTION_CONTROLS, SettingsFile.KEY_GCPAD_G_TYPE + i, defaultValue); - } - // TODO: This controller_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order. - sl.add(new SingleChoiceSetting(mContext, gcPadSetting, R.string.controller_0 + i, 0, - R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(i))); - } + sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_0, R.string.controller_0, 0, + R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(0))); + sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_1, R.string.controller_1, 0, + R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(1))); + sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_2, R.string.controller_2, 0, + R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(2))); + sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_3, R.string.controller_3, 0, + R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(3))); } private void addWiimoteSettings(ArrayList sl) { - for (int i = 0; i < 4; i++) - { - // Wii Remote 1 is set to Emulated by default, all others disabled - int defaultValue = i == 0 ? 1 : 0; - - LegacyIntSetting wiimoteSetting; - if (mGameID.equals("")) - { - wiimoteSetting = new LegacyIntSetting(Settings.FILE_WIIMOTE, - Settings.SECTION_WIIMOTE + (i + 1), SettingsFile.KEY_WIIMOTE_TYPE, defaultValue); - } - else - { - wiimoteSetting = new LegacyIntSetting(Settings.GAME_SETTINGS_PLACEHOLDER_FILE_NAME, - Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIMOTE_G_TYPE + i, defaultValue); - } - // TODO: This wiimote_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order. - sl.add(new SingleChoiceSetting(mContext, wiimoteSetting, R.string.wiimote_4 + i, 0, - R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, - MenuTag.getWiimoteMenuTag(i + 4))); - } + sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_1_SOURCE, R.string.wiimote_4, 0, + R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(4))); + sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_2_SOURCE, R.string.wiimote_5, 0, + R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(5))); + sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_3_SOURCE, R.string.wiimote_6, 0, + R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(6))); + sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_4_SOURCE, R.string.wiimote_7, 0, + R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(7))); } private void addGraphicsSettings(ArrayList sl) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java index dfa78e6eb2..d8dc74d054 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java @@ -20,9 +20,7 @@ public final class SettingsFile public static final String KEY_ISO_PATH_BASE = "ISOPath"; public static final String KEY_ISO_PATHS = "ISOPaths"; - public static final String KEY_GCPAD_TYPE = "SIDevice"; public static final String KEY_GCPAD_PLAYER_1 = "SIDevice0"; - public static final String KEY_GCPAD_G_TYPE = "PadType"; public static final String KEY_GCBIND_A = "InputA_"; public static final String KEY_GCBIND_B = "InputB_"; @@ -50,11 +48,9 @@ public final class SettingsFile public static final String KEY_EMU_RUMBLE = "EmuRumble"; - public static final String KEY_WIIMOTE_TYPE = "Source"; public static final String KEY_WIIMOTE_EXTENSION = "Extension"; // Controller keys for game specific settings - public static final String KEY_WIIMOTE_G_TYPE = "WiimoteSource"; public static final String KEY_WIIMOTE_PROFILE = "WiimoteProfile"; public static final String KEY_WIIBIND_A = "WiimoteA_"; diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index c403f53768..e87eed9865 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -6,13 +6,10 @@ app dolphinemu - GameCube Controller 1 GameCube Controller 2 GameCube Controller 3 GameCube Controller 4 - Control Stick C Stick @@ -22,23 +19,15 @@ Analog Radius (High value = High sensitivity) Analog Threshold (Low value = High sensitivity) - Wii Remote 1 Wii Remote 2 Wii Remote 3 Wii Remote 4 - - Wii Remote Extension 1 Wii Remote Extension 2 Wii Remote Extension 3 Wii Remote Extension 4 - Extension Choose and bind the Wii Remote extension. diff --git a/Source/Android/jni/Config/NativeConfig.cpp b/Source/Android/jni/Config/NativeConfig.cpp index bdeafc5f13..06b4bf507f 100644 --- a/Source/Android/jni/Config/NativeConfig.cpp +++ b/Source/Android/jni/Config/NativeConfig.cpp @@ -38,6 +38,10 @@ static Config::Location GetLocation(JNIEnv* env, jstring file, jstring section, { system = Config::System::Logger; } + else if (decoded_file == "WiimoteNew") + { + system = Config::System::WiiPad; + } else { ASSERT(false); From 90c576e075f9a0901236429abc9a918983da859a Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 25 Jan 2022 22:04:58 +0100 Subject: [PATCH 27/31] Use config changed callback to detect SD insertion/ejection This saves the GUI from having to manually call SDIO_EventNotify. With that out of the way, we can let users change the "Insert SD Card" setting on Android while a game is running. --- .../settings/model/BooleanSetting.java | 1 - Source/Core/Core/IOS/IOS.cpp | 19 ---------- Source/Core/Core/IOS/IOS.h | 2 -- Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp | 35 +++++++++++++++++-- Source/Core/Core/IOS/SDIO/SDIOSlot0.h | 10 ++++-- Source/Core/DolphinQt/Settings.cpp | 4 --- 6 files changed, 40 insertions(+), 31 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java index a7c47a03ad..a2b380e989 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java @@ -228,7 +228,6 @@ public enum BooleanSetting implements AbstractBooleanSetting MAIN_CPU_THREAD, MAIN_ENABLE_CHEATS, MAIN_OVERRIDE_REGION_SETTINGS, - MAIN_WII_SD_CARD, // Can actually be changed, but specialized code is required MAIN_MMU, MAIN_DSP_JIT, }; diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp index 9465cbe918..364e647839 100644 --- a/Source/Core/Core/IOS/IOS.cpp +++ b/Source/Core/Core/IOS/IOS.cpp @@ -63,7 +63,6 @@ static std::unique_ptr s_ios; constexpr u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL; static CoreTiming::EventType* s_event_enqueue; -static CoreTiming::EventType* s_event_sdio_notify; static CoreTiming::EventType* s_event_finish_ppc_bootstrap; static CoreTiming::EventType* s_event_finish_ios_boot; @@ -789,14 +788,6 @@ void Kernel::UpdateWantDeterminism(const bool new_want_determinism) device.second->UpdateWantDeterminism(new_want_determinism); } -void Kernel::SDIO_EventNotify() -{ - // TODO: Potential race condition: If IsRunning() becomes false after - // it's checked, an event may be scheduled after CoreTiming shuts down. - if (SConfig::GetInstance().bWii && Core::IsRunning()) - CoreTiming::ScheduleEvent(0, s_event_sdio_notify, 0, CoreTiming::FromThread::NON_CPU); -} - void Kernel::DoState(PointerWrap& p) { p.Do(m_request_queue); @@ -886,16 +877,6 @@ void Init() s_ios->HandleIPCEvent(userdata); }); - s_event_sdio_notify = CoreTiming::RegisterEvent("SDIO_EventNotify", [](u64, s64) { - if (!s_ios) - return; - - auto sdio_slot0 = s_ios->GetDeviceByName("/dev/sdio/slot0"); - auto device = static_cast(sdio_slot0.get()); - if (device) - device->EventNotify(); - }); - ESDevice::InitializeEmulationState(); s_event_finish_ppc_bootstrap = diff --git a/Source/Core/Core/IOS/IOS.h b/Source/Core/Core/IOS/IOS.h index 14254fa9cf..773a5d4d64 100644 --- a/Source/Core/Core/IOS/IOS.h +++ b/Source/Core/Core/IOS/IOS.h @@ -125,8 +125,6 @@ public: std::shared_ptr GetFSDevice(); std::shared_ptr GetES(); - void SDIO_EventNotify(); - void EnqueueIPCRequest(u32 address); void EnqueueIPCReply(const Request& request, s32 return_value, s64 cycles_in_future = 0, CoreTiming::FromThread from = CoreTiming::FromThread::CPU); diff --git a/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp b/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp index 4ea206e6ce..8cb17f3267 100644 --- a/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp +++ b/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp @@ -14,8 +14,10 @@ #include "Common/IOFile.h" #include "Common/Logging/Log.h" #include "Common/SDCardUtil.h" + #include "Core/Config/MainSettings.h" #include "Core/Config/SessionSettings.h" +#include "Core/Core.h" #include "Core/HW/Memmap.h" #include "Core/IOS/IOS.h" #include "Core/IOS/VersionInfo.h" @@ -27,6 +29,29 @@ SDIOSlot0Device::SDIOSlot0Device(Kernel& ios, const std::string& device_name) { if (!Config::Get(Config::MAIN_ALLOW_SD_WRITES)) INFO_LOG_FMT(IOS_SD, "Writes to SD card disabled by user"); + + m_config_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); }); + m_sd_card_inserted = Config::Get(Config::MAIN_WII_SD_CARD); +} + +SDIOSlot0Device::~SDIOSlot0Device() +{ + Config::RemoveConfigChangedCallback(m_config_callback_id); +} + +void SDIOSlot0Device::RefreshConfig() +{ + if (m_sd_card_inserted != Config::Get(Config::MAIN_WII_SD_CARD)) + { + Core::RunAsCPUThread([this] { + const bool sd_card_inserted = Config::Get(Config::MAIN_WII_SD_CARD); + if (m_sd_card_inserted != sd_card_inserted) + { + m_sd_card_inserted = sd_card_inserted; + EventNotify(); + } + }); + } } void SDIOSlot0Device::DoState(PointerWrap& p) @@ -49,10 +74,14 @@ void SDIOSlot0Device::EventNotify() if (!m_event) return; - const bool sd_card_inserted = Config::Get(Config::MAIN_WII_SD_CARD); - if ((sd_card_inserted && m_event->type == EVENT_INSERT) || - (!sd_card_inserted && m_event->type == EVENT_REMOVE)) + if ((m_sd_card_inserted && m_event->type == EVENT_INSERT) || + (!m_sd_card_inserted && m_event->type == EVENT_REMOVE)) { + if (m_sd_card_inserted) + INFO_LOG_FMT(IOS_SD, "Notifying PPC of SD card insertion"); + else + INFO_LOG_FMT(IOS_SD, "Notifying PPC of SD card removal"); + m_ios.EnqueueIPCReply(m_event->request, m_event->type); m_event.reset(); } diff --git a/Source/Core/Core/IOS/SDIO/SDIOSlot0.h b/Source/Core/Core/IOS/SDIO/SDIOSlot0.h index efa6595c78..fcdabd372e 100644 --- a/Source/Core/Core/IOS/SDIO/SDIOSlot0.h +++ b/Source/Core/Core/IOS/SDIO/SDIOSlot0.h @@ -22,6 +22,7 @@ class SDIOSlot0Device : public Device { public: SDIOSlot0Device(Kernel& ios, const std::string& device_name); + ~SDIOSlot0Device() override; void DoState(PointerWrap& p) override; @@ -30,8 +31,6 @@ public: std::optional IOCtl(const IOCtlRequest& request) override; std::optional IOCtlV(const IOCtlVRequest& request) override; - void EventNotify(); - private: // SD Host Controller Registers enum @@ -124,6 +123,10 @@ private: Request request; }; + void RefreshConfig(); + + void EventNotify(); + IPCReply WriteHCRegister(const IOCtlRequest& request); IPCReply ReadHCRegister(const IOCtlRequest& request); IPCReply ResetCard(const IOCtlRequest& request); @@ -162,5 +165,8 @@ private: std::array m_registers{}; File::IOFile m_card; + + size_t m_config_callback_id; + bool m_sd_card_inserted = false; }; } // namespace IOS::HLE diff --git a/Source/Core/DolphinQt/Settings.cpp b/Source/Core/DolphinQt/Settings.cpp index d22dcc6e25..61e378f736 100644 --- a/Source/Core/DolphinQt/Settings.cpp +++ b/Source/Core/DolphinQt/Settings.cpp @@ -705,10 +705,6 @@ void Settings::SetSDCardInserted(bool inserted) { Config::SetBaseOrCurrent(Config::MAIN_WII_SD_CARD, inserted); emit SDCardInsertionChanged(inserted); - - auto* ios = IOS::HLE::GetIOS(); - if (ios) - ios->SDIO_EventNotify(); } } From 2273742f9e073e7e9b3b9c02bc1994549523ae5a Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 20 Feb 2022 13:48:06 +0100 Subject: [PATCH 28/31] Android: Get rid of LegacyBooleanSetting --- .../settings/model/BooleanSetting.java | 20 ++++++++++++++ .../settings/model/LegacyBooleanSetting.java | 26 ------------------- .../ui/SettingsFragmentPresenter.java | 14 +++------- .../features/settings/utils/SettingsFile.java | 3 --- 4 files changed, 24 insertions(+), 39 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyBooleanSetting.java diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java index a7c47a03ad..35130eaecc 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java @@ -18,6 +18,14 @@ public enum BooleanSetting implements AbstractBooleanSetting MAIN_OVERRIDE_REGION_SETTINGS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "OverrideRegionSettings", false), MAIN_AUDIO_STRETCH(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AudioStretch", false), + MAIN_ADAPTER_RUMBLE_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AdapterRumble0", true), + MAIN_ADAPTER_RUMBLE_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AdapterRumble1", true), + MAIN_ADAPTER_RUMBLE_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AdapterRumble2", true), + MAIN_ADAPTER_RUMBLE_3(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AdapterRumble3", true), + MAIN_SIMULATE_KONGA_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SimulateKonga0", false), + MAIN_SIMULATE_KONGA_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SimulateKonga1", false), + MAIN_SIMULATE_KONGA_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SimulateKonga2", false), + MAIN_SIMULATE_KONGA_3(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SimulateKonga3", false), MAIN_WII_SD_CARD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiiSDCard", true), MAIN_WIIMOTE_CONTINUOUS_SCANNING(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiimoteContinuousScanning", false), @@ -322,4 +330,16 @@ public enum BooleanSetting implements AbstractBooleanSetting { NativeConfig.setBoolean(layer, mFile, mSection, mKey, newValue); } + + public static BooleanSetting getSettingForAdapterRumble(int channel) + { + return new BooleanSetting[]{MAIN_ADAPTER_RUMBLE_0, MAIN_ADAPTER_RUMBLE_1, MAIN_ADAPTER_RUMBLE_2, + MAIN_ADAPTER_RUMBLE_3}[channel]; + } + + public static BooleanSetting getSettingForSimulateKonga(int channel) + { + return new BooleanSetting[]{MAIN_SIMULATE_KONGA_0, MAIN_SIMULATE_KONGA_1, MAIN_SIMULATE_KONGA_2, + MAIN_SIMULATE_KONGA_3}[channel]; + } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyBooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyBooleanSetting.java deleted file mode 100644 index d754871445..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyBooleanSetting.java +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.settings.model; - -public class LegacyBooleanSetting extends AbstractLegacySetting implements AbstractBooleanSetting -{ - private final boolean mDefaultValue; - - public LegacyBooleanSetting(String file, String section, String key, boolean defaultValue) - { - super(file, section, key); - mDefaultValue = defaultValue; - } - - @Override - public boolean getBoolean(Settings settings) - { - return settings.getSection(mFile, mSection).getBoolean(mKey, mDefaultValue); - } - - @Override - public void setBoolean(Settings settings, boolean newValue) - { - settings.getSection(mFile, mSection).setBoolean(mKey, newValue); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java index 485dda2cf8..58869a9e95 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java @@ -16,7 +16,6 @@ import org.dolphinemu.dolphinemu.features.settings.model.AdHocBooleanSetting; import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; import org.dolphinemu.dolphinemu.features.settings.model.FloatSetting; import org.dolphinemu.dolphinemu.features.settings.model.IntSetting; -import org.dolphinemu.dolphinemu.features.settings.model.LegacyBooleanSetting; import org.dolphinemu.dolphinemu.features.settings.model.LegacyStringSetting; import org.dolphinemu.dolphinemu.features.settings.model.PostProcessing; import org.dolphinemu.dolphinemu.features.settings.model.Settings; @@ -865,15 +864,10 @@ public final class SettingsFragmentPresenter } else if (gcPadType == 12) // Adapter { - LegacyBooleanSetting rumble = new LegacyBooleanSetting(Settings.FILE_DOLPHIN, - Settings.SECTION_INI_CORE, SettingsFile.KEY_GCADAPTER_RUMBLE + gcPadNumber, false); - LegacyBooleanSetting bongo = new LegacyBooleanSetting(Settings.FILE_DOLPHIN, - Settings.SECTION_INI_CORE, SettingsFile.KEY_GCADAPTER_BONGOS + gcPadNumber, false); - - sl.add(new CheckBoxSetting(mContext, rumble, R.string.gc_adapter_rumble, - R.string.gc_adapter_rumble_description)); - sl.add(new CheckBoxSetting(mContext, bongo, R.string.gc_adapter_bongos, - R.string.gc_adapter_bongos_description)); + sl.add(new CheckBoxSetting(mContext, BooleanSetting.getSettingForAdapterRumble(gcPadNumber), + R.string.gc_adapter_rumble, R.string.gc_adapter_rumble_description)); + sl.add(new CheckBoxSetting(mContext, BooleanSetting.getSettingForSimulateKonga(gcPadNumber), + R.string.gc_adapter_bongos, R.string.gc_adapter_bongos_description)); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java index d8dc74d054..87f58b4d02 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java @@ -43,9 +43,6 @@ public final class SettingsFile public static final String KEY_GCBIND_DPAD_LEFT = "DPadLeft_"; public static final String KEY_GCBIND_DPAD_RIGHT = "DPadRight_"; - public static final String KEY_GCADAPTER_RUMBLE = "AdapterRumble"; - public static final String KEY_GCADAPTER_BONGOS = "SimulateKonga"; - public static final String KEY_EMU_RUMBLE = "EmuRumble"; public static final String KEY_WIIMOTE_EXTENSION = "Extension"; From 23cbd570a1c58c7d24c83ae7e3788611c38717dc Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 21 Feb 2022 12:42:51 -0800 Subject: [PATCH 29/31] FramebufferManager: Flush pending EFB pokes in PopulateEFBCache I.e. flush pokes before running an EFB peek, if the cache tile isn't present. If the cache tile is present, then EFB pokes should have been written to the cache tile and thus don't need to be flushed. --- Source/Core/VideoCommon/FramebufferManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/VideoCommon/FramebufferManager.cpp b/Source/Core/VideoCommon/FramebufferManager.cpp index b805de77a8..c6cb2fd29e 100644 --- a/Source/Core/VideoCommon/FramebufferManager.cpp +++ b/Source/Core/VideoCommon/FramebufferManager.cpp @@ -593,6 +593,7 @@ void FramebufferManager::DestroyReadbackFramebuffer() void FramebufferManager::PopulateEFBCache(bool depth, u32 tile_index) { + FlushEFBPokes(); g_vertex_manager->OnCPUEFBAccess(); // Force the path through the intermediate texture, as we can't do an image copy from a depth From b641dc3d3454a2f88e09f165f09e1be11eb68bdd Mon Sep 17 00:00:00 2001 From: Nora Date: Thu, 24 Feb 2022 21:00:16 -0500 Subject: [PATCH 30/31] Add files via upload --- Data/Sys/GameSettings/GMPE01.ini | 22 ++++++++++++++++++++++ Data/Sys/GameSettings/GP5E01.ini | 10 ++++++++++ Data/Sys/GameSettings/GP6E01.ini | 5 +++++ Data/Sys/GameSettings/GP7E01.ini | 12 ++++++++++++ 4 files changed, 49 insertions(+) diff --git a/Data/Sys/GameSettings/GMPE01.ini b/Data/Sys/GameSettings/GMPE01.ini index 1cd20fde22..375891191f 100644 --- a/Data/Sys/GameSettings/GMPE01.ini +++ b/Data/Sys/GameSettings/GMPE01.ini @@ -117,12 +117,19 @@ c2086774 00000002 c2073c7c 00000002 735a0020 281a0020 60000000 00000000 +04005E90 60000000 +04005EA8 60000000 *Fixes a bug where only analog inputs work while using the triggers. $QOL - Automatically Advance Text Boxes [gamemasterplc] 04044A90 60000000 *Automatically scrolls the text boxes without pushing A +$QOL - Disable Advance on Results [gamemasterplc] +20446468 4182FF60 +04446468 4BFFFF60 +E2000001 80008000 + $QOL - Faster Boot Time [Ralf] 04056168 38607FFF *Automatically advance through the initial cutscences. @@ -429,3 +436,18 @@ $Minigame: Take a Breather - Mash Only L [gamemasterplc] 044207f0 38600000 e2000001 80008000 *Mash just L in the minigame Take a Breather. + +$Minigame Replacement - Bowser's Bigger Blast ➜ Chain Chomp Fever [Nora] +2818fd2c 00000027 +0218fd2c 00000025 +e2000001 80008000 + +$Minigame Replacement - Dungeon Duos ➜ The Great Deflate [Nora] +2818fd2c 0000001F +0218fd2c 00000018 +e2000001 80008000 + +$Minigame Replacement - Three Throw ➜ Mr. Blizzard's Brigade [Nora] +2818fd2c 00000009 +0218fd2c 0000000B +e2000001 80008000 \ No newline at end of file diff --git a/Data/Sys/GameSettings/GP5E01.ini b/Data/Sys/GameSettings/GP5E01.ini index 39f95bb068..256ae9d2b8 100644 --- a/Data/Sys/GameSettings/GP5E01.ini +++ b/Data/Sys/GameSettings/GP5E01.ini @@ -474,6 +474,11 @@ A81F019C 7C001838 E0000000 80008000 *Automatically scrolls the text boxes without pushing A +$QOL - Disable Advance on Results [gamemasterplc] +20478F28 4182F754 +04478F1C 48000010 +E2000001 80008000 + $QOL - Faster Boot Time [gamemasterplc] F6000001 80008180 38610030 38800002 @@ -858,6 +863,11 @@ $Minigame Replacement - Scaldin' Cauldron ➜ Rain of Fire [gamemasterplc] 0222A4C4 0000003A E2000001 80008000 +$Minigame Replacement - Submarathon ➜ Defuse or Lose +2822a4c4 0000002F +0222a4c4 00000028 +e2000001 80008000 + $Minigame Replacement - Vicious Vending ➜ Coin Cache [gamemasterplc] 2822a4c4 00000017 0222a4c4 0000000f diff --git a/Data/Sys/GameSettings/GP6E01.ini b/Data/Sys/GameSettings/GP6E01.ini index 36948b9335..47eb810071 100644 --- a/Data/Sys/GameSettings/GP6E01.ini +++ b/Data/Sys/GameSettings/GP6E01.ini @@ -466,6 +466,11 @@ e2000001 80008000 E2000001 80008000 *Automatically advance through the initial cutscences. +$QOL - Disable Advance on Results [gamemasterplc] +20503FB0 41820054 +04503FB0 48000054 +E2000001 80008000 + $QOL - Increased Board Speed [Celerizer] 041556d4 7d170e70 042c31b4 41f00000 diff --git a/Data/Sys/GameSettings/GP7E01.ini b/Data/Sys/GameSettings/GP7E01.ini index 2686dc68f9..37ab3225a7 100644 --- a/Data/Sys/GameSettings/GP7E01.ini +++ b/Data/Sys/GameSettings/GP7E01.ini @@ -597,6 +597,11 @@ e2000001 80008000 e2000001 80008000 *Automatically advance through the initial cutscences. +$QOL - Disable Advance on Results [gamemasterplc] +204DF310 41820050 +044DF310 48000050 +E2000001 80008000 + $QOL - Increased Board Speed [gamemasterplc] 04160ad8 38030002 041604b0 38c0000a @@ -1033,6 +1038,13 @@ c21d8ed0 00000007 041d8f68 3aa00028 *(X) -> 40 Coins, 10 Coins -> 40 Coins, Half Coins -> 40 Coins, 2 Stars -> 1 Star +$Mechanics - Improved Duel Results #2 [Airsola +C21D8ED0 00000003 +2C030003 40820008 +38600001 7C711B78 +60000000 00000000 +*(X) -> 1/2 Coins + $Mechanics - Last 5 Turns Event Is Always x3 Coins on Spaces [gamemasterplc] 042311A8 38000000 From 97ca7b56cbd54faa1037083ec3533a7b1d696418 Mon Sep 17 00:00:00 2001 From: Nora Date: Fri, 25 Feb 2022 20:51:42 -0500 Subject: [PATCH 31/31] Update GMPE01.ini --- Data/Sys/GameSettings/GMPE01.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Data/Sys/GameSettings/GMPE01.ini b/Data/Sys/GameSettings/GMPE01.ini index 375891191f..b77cbb6231 100644 --- a/Data/Sys/GameSettings/GMPE01.ini +++ b/Data/Sys/GameSettings/GMPE01.ini @@ -117,8 +117,6 @@ c2086774 00000002 c2073c7c 00000002 735a0020 281a0020 60000000 00000000 -04005E90 60000000 -04005EA8 60000000 *Fixes a bug where only analog inputs work while using the triggers. $QOL - Automatically Advance Text Boxes [gamemasterplc] @@ -450,4 +448,4 @@ e2000001 80008000 $Minigame Replacement - Three Throw ➜ Mr. Blizzard's Brigade [Nora] 2818fd2c 00000009 0218fd2c 0000000B -e2000001 80008000 \ No newline at end of file +e2000001 80008000