Merge branch 'multiple_compile_fixes' into 'main'

fix: Multiple Compiler Warnings

See merge request citron/emulator!92
This commit is contained in:
Zephyron
2025-10-07 18:36:25 +10:00
11 changed files with 102 additions and 17 deletions

View File

@@ -399,7 +399,7 @@ if(USE_DISCORD_PRESENCE)
# Check if the target directory exists before trying to patch # Check if the target directory exists before trying to patch
if(EXISTS "${PATCH_TARGET_DIR}") if(EXISTS "${PATCH_TARGET_DIR}")
execute_process( execute_process(
COMMAND git apply -p0 --ignore-whitespace "${PATCH_FILE}" COMMAND git apply --ignore-whitespace "${PATCH_FILE}"
WORKING_DIRECTORY "${PATCH_TARGET_DIR}" WORKING_DIRECTORY "${PATCH_TARGET_DIR}"
RESULT_VARIABLE PATCH_RESULT RESULT_VARIABLE PATCH_RESULT
OUTPUT_QUIET OUTPUT_QUIET
@@ -422,7 +422,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(EXISTS "${MCL_PATCH_TARGET_DIR}") if(EXISTS "${MCL_PATCH_TARGET_DIR}")
execute_process( execute_process(
COMMAND git apply -p0 --ignore-whitespace "${MCL_PATCH_FILE}" COMMAND git apply --ignore-whitespace "${MCL_PATCH_FILE}"
WORKING_DIRECTORY "${MCL_PATCH_TARGET_DIR}" WORKING_DIRECTORY "${MCL_PATCH_TARGET_DIR}"
RESULT_VARIABLE MCL_PATCH_RESULT RESULT_VARIABLE MCL_PATCH_RESULT
OUTPUT_QUIET OUTPUT_QUIET
@@ -461,6 +461,30 @@ else()
message(WARNING "Could not find stb_image.h to patch. It may not have been downloaded yet.") message(WARNING "Could not find stb_image.h to patch. It may not have been downloaded yet.")
endif() endif()
# Apply a patch to discord-rpc's CMakeLists.txt to suppress -Wclass-memaccess
message(STATUS "Applying custom patch to submodule's discord-rpc CMakeLists.txt...")
# Define the path to the patch file and the target directory using unique names
set(DISCORD_RPC_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patches/discord-rpc-wclass-memaccess-fix.patch")
set(DISCORD_RPC_PATCH_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR}/externals/discord-rpc")
# Check if the target directory exists before trying to patch
if(EXISTS "${DISCORD_RPC_PATCH_TARGET_DIR}")
execute_process(
COMMAND git apply -p0 --ignore-whitespace "${DISCORD_RPC_PATCH_FILE}"
WORKING_DIRECTORY "${DISCORD_RPC_PATCH_TARGET_DIR}"
RESULT_VARIABLE PATCH_RESULT
OUTPUT_QUIET
ERROR_QUIET
)
if(NOT PATCH_RESULT EQUAL 0)
message(WARNING "Failed to apply discord-rpc CMakeLists.txt patch! This might be okay if it's already applied.")
endif()
else()
message(WARNING "Could not find discord-rpc directory to patch. It may not have been downloaded yet.")
endif()
if (ENABLE_QT) if (ENABLE_QT)
if (NOT USE_SYSTEM_QT) if (NOT USE_SYSTEM_QT)
download_qt(6.7.3) download_qt(6.7.3)

View File

@@ -0,0 +1,18 @@
diff --git CMakeLists.txt CMakeLists.txt
index 5dad9e9..972183d 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -51,6 +51,13 @@ add_library(rapidjson STATIC IMPORTED ${RAPIDJSON})
# add subdirs
add_subdirectory(src)
+
+# Suppress the -Wclass-memaccess warning from modern GCC/Clang in rapidjson.
+# This warning flags intentional, performance-oriented code in the library.
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+ target_compile_options(discord-rpc PRIVATE "-Wno-class-memaccess")
+endif()
+
if (BUILD_EXAMPLES)
add_subdirectory(examples/send-presence)
endif(BUILD_EXAMPLES)

View File

@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm> #include <algorithm>
@@ -184,7 +185,7 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
CheckIfParametersMet(); CheckIfParametersMet();
}); });
connect(connected_controller_checkboxes[i], &QCheckBox::stateChanged, [this, i](int state) { connect(connected_controller_checkboxes[i], &QCheckBox::checkStateChanged, [this, i](Qt::CheckState state) {
player_groupboxes[i]->setChecked(state == Qt::Checked); player_groupboxes[i]->setChecked(state == Qt::Checked);
UpdateControllerIcon(i); UpdateControllerIcon(i);
UpdateControllerState(i); UpdateControllerState(i);

View File

@@ -998,7 +998,7 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) {
screenshot_image.bits(), screenshot_image.bits(),
[=, this](bool invert_y) { [=, this](bool invert_y) {
const std::string std_screenshot_path = screenshot_path.toStdString(); const std::string std_screenshot_path = screenshot_path.toStdString();
if (screenshot_image.mirrored(false, invert_y).save(screenshot_path)) { if ((invert_y ? screenshot_image.flipped(Qt::Vertical) : screenshot_image).save(screenshot_path)) {
LOG_INFO(Frontend, "Screenshot saved to \"{}\"", std_screenshot_path); LOG_INFO(Frontend, "Screenshot saved to \"{}\"", std_screenshot_path);
} else { } else {
LOG_ERROR(Frontend, "Failed to save screenshot to \"{}\"", std_screenshot_path); LOG_ERROR(Frontend, "Failed to save screenshot to \"{}\"", std_screenshot_path);

View File

@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <QFileDialog> #include <QFileDialog>
@@ -29,9 +30,9 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)
connect(ui->reset_game_list_cache, &QPushButton::pressed, this, connect(ui->reset_game_list_cache, &QPushButton::pressed, this,
&ConfigureFilesystem::ResetMetadata); &ConfigureFilesystem::ResetMetadata);
connect(ui->gamecard_inserted, &QCheckBox::stateChanged, this, connect(ui->gamecard_inserted, &QCheckBox::checkStateChanged, this,
&ConfigureFilesystem::UpdateEnabledControls); &ConfigureFilesystem::UpdateEnabledControls);
connect(ui->gamecard_current_game, &QCheckBox::stateChanged, this, connect(ui->gamecard_current_game, &QCheckBox::checkStateChanged, this,
&ConfigureFilesystem::UpdateEnabledControls); &ConfigureFilesystem::UpdateEnabledControls);
} }

View File

@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: 2016 Citra Emulator Project // SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-FileCopyrightText: 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <memory> #include <memory>
@@ -121,7 +122,7 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
&ConfigureInput::UpdateAllInputDevices); &ConfigureInput::UpdateAllInputDevices);
connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputProfiles, this, connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputProfiles, this,
&ConfigureInput::UpdateAllInputProfiles, Qt::QueuedConnection); &ConfigureInput::UpdateAllInputProfiles, Qt::QueuedConnection);
connect(connected_controller_checkboxes[i], &QCheckBox::stateChanged, [this, i](int state) { connect(connected_controller_checkboxes[i], &QCheckBox::checkStateChanged, [this, i](Qt::CheckState state) {
// Keep activated controllers synced with the "Connected Controllers" checkboxes // Keep activated controllers synced with the "Connected Controllers" checkboxes
player_controllers[i]->ConnectPlayer(state == Qt::Checked); player_controllers[i]->ConnectPlayer(state == Qt::Checked);
}); });

View File

@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <QColorDialog> #include <QColorDialog>
@@ -74,13 +75,13 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(Core::HID::HIDCore& hid_core_, QW
} }
} }
connect(ui->mouse_enabled, &QCheckBox::stateChanged, this, connect(ui->mouse_enabled, &QCheckBox::checkStateChanged, this,
&ConfigureInputAdvanced::UpdateUIEnabled); &ConfigureInputAdvanced::UpdateUIEnabled);
connect(ui->debug_enabled, &QCheckBox::stateChanged, this, connect(ui->debug_enabled, &QCheckBox::checkStateChanged, this,
&ConfigureInputAdvanced::UpdateUIEnabled); &ConfigureInputAdvanced::UpdateUIEnabled);
connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this, connect(ui->touchscreen_enabled, &QCheckBox::checkStateChanged, this,
&ConfigureInputAdvanced::UpdateUIEnabled); &ConfigureInputAdvanced::UpdateUIEnabled);
connect(ui->enable_ring_controller, &QCheckBox::stateChanged, this, connect(ui->enable_ring_controller, &QCheckBox::checkStateChanged, this,
&ConfigureInputAdvanced::UpdateUIEnabled); &ConfigureInputAdvanced::UpdateUIEnabled);
connect(ui->debug_configure, &QPushButton::clicked, this, connect(ui->debug_configure, &QPushButton::clicked, this,

View File

@@ -85,7 +85,7 @@ ConfigureSystem::ConfigureSystem(Core::System& system_,
connect(combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check); connect(combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
connect(combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check); connect(combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
connect(checkbox_rtc, qOverload<int>(&QCheckBox::stateChanged), this, update_rtc_date); connect(checkbox_rtc, &QCheckBox::checkStateChanged, this, update_rtc_date);
connect(date_rtc_offset, qOverload<int>(&QSpinBox::valueChanged), this, update_rtc_date); connect(date_rtc_offset, qOverload<int>(&QSpinBox::valueChanged), this, update_rtc_date);
connect(date_rtc, &QDateTimeEdit::dateTimeChanged, this, update_date_offset); connect(date_rtc, &QDateTimeEdit::dateTimeChanged, this, update_date_offset);

View File

@@ -708,7 +708,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
restore_func(); restore_func();
} }
}; };
connect(checkbox, &QCheckBox::stateChanged, reset); connect(checkbox, &QCheckBox::checkStateChanged, reset);
reset(checkbox->checkState()); reset(checkbox->checkState());
} }
} }

View File

@@ -5440,10 +5440,6 @@ static void SetHighDPIAttributes() {
Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif #endif
// Enable high DPI scaling and pixmaps
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
// Set the DPI awareness for better scaling on Windows // Set the DPI awareness for better scaling on Windows
#ifdef _WIN32 #ifdef _WIN32
// Enable Per Monitor DPI Awareness for Windows 8.1+ // Enable Per Monitor DPI Awareness for Windows 8.1+

View File

@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project // SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
// SPDX-FileCopyrightText: 2014 Citra Emulator Project // SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-FileCopyrightText: 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm> #include <algorithm>
@@ -141,21 +142,63 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
return result; return result;
} }
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996) // 'std::wstring_convert': was declared deprecated
#elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
std::string UTF16ToUTF8(std::u16string_view input) { std::string UTF16ToUTF8(std::u16string_view input) {
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.to_bytes(input.data(), input.data() + input.size()); return convert.to_bytes(input.data(), input.data() + input.size());
} }
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996) // 'std::wstring_convert': was declared deprecated
#elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
std::u16string UTF8ToUTF16(std::string_view input) { std::u16string UTF8ToUTF16(std::string_view input) {
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.from_bytes(input.data(), input.data() + input.size()); return convert.from_bytes(input.data(), input.data() + input.size());
} }
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996) // 'std::wstring_convert': was declared deprecated
#elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
std::u32string UTF8ToUTF32(std::string_view input) { std::u32string UTF8ToUTF32(std::string_view input) {
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> convert; std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> convert;
return convert.from_bytes(input.data(), input.data() + input.size()); return convert.from_bytes(input.data(), input.data() + input.size());
} }
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
#ifdef _WIN32 #ifdef _WIN32
static std::wstring CPToUTF16(u32 code_page, std::string_view input) { static std::wstring CPToUTF16(u32 code_page, std::string_view input) {
const auto size = const auto size =