From 12156b199a13d7147f3fe6aebe72ae0c257986a5 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 26 May 2022 19:57:11 -0400 Subject: [PATCH 01/18] web_service: Eliminate variable shadowing --- src/web_service/telemetry_json.cpp | 4 ++-- src/web_service/web_backend.cpp | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/web_service/telemetry_json.cpp b/src/web_service/telemetry_json.cpp index 6215c914f..46faddb61 100644 --- a/src/web_service/telemetry_json.cpp +++ b/src/web_service/telemetry_json.cpp @@ -13,8 +13,8 @@ namespace WebService { namespace Telemetry = Common::Telemetry; struct TelemetryJson::Impl { - Impl(std::string host, std::string username, std::string token) - : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {} + Impl(std::string host_, std::string username_, std::string token_) + : host{std::move(host_)}, username{std::move(username_)}, token{std::move(token_)} {} nlohmann::json& TopSection() { return sections[static_cast(Telemetry::FieldType::None)]; diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 58b0c2f10..dce9772fe 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp @@ -30,10 +30,10 @@ constexpr std::array API_VERSION{'1'}; constexpr std::size_t TIMEOUT_SECONDS = 30; struct Client::Impl { - Impl(std::string host, std::string username, std::string token) - : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} { + Impl(std::string host_, std::string username_, std::string token_) + : host{std::move(host_)}, username{std::move(username_)}, token{std::move(token_)} { std::scoped_lock lock{jwt_cache.mutex}; - if (this->username == jwt_cache.username && this->token == jwt_cache.token) { + if (username == jwt_cache.username && token == jwt_cache.token) { jwt = jwt_cache.jwt; } } @@ -69,8 +69,8 @@ struct Client::Impl { */ WebResult GenericRequest(const std::string& method, const std::string& path, const std::string& data, const std::string& accept, - const std::string& jwt = "", const std::string& username = "", - const std::string& token = "") { + const std::string& jwt_ = "", const std::string& username_ = "", + const std::string& token_ = "") { if (cli == nullptr) { cli = std::make_unique(host.c_str()); } @@ -85,14 +85,14 @@ struct Client::Impl { cli->set_write_timeout(TIMEOUT_SECONDS); httplib::Headers params; - if (!jwt.empty()) { + if (!jwt_.empty()) { params = { - {std::string("Authorization"), fmt::format("Bearer {}", jwt)}, + {std::string("Authorization"), fmt::format("Bearer {}", jwt_)}, }; - } else if (!username.empty()) { + } else if (!username_.empty()) { params = { - {std::string("x-username"), username}, - {std::string("x-token"), token}, + {std::string("x-username"), username_}, + {std::string("x-token"), token_}, }; } From b3d6f7bdd841098aa47f367d60c2ac0ab320dd98 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 26 May 2022 19:57:35 -0400 Subject: [PATCH 02/18] yuzu: Eliminate variable shadowing --- src/yuzu/bootmanager.cpp | 8 ++++---- src/yuzu/bootmanager.h | 12 ++++++------ src/yuzu/configuration/configure_per_game.cpp | 4 ++-- src/yuzu/configuration/configure_per_game.h | 2 +- src/yuzu/configuration/configure_per_game_addons.cpp | 4 ++-- src/yuzu/configuration/configure_per_game_addons.h | 2 +- src/yuzu/game_list.cpp | 6 +++--- src/yuzu/game_list_p.h | 2 +- src/yuzu/main.cpp | 8 ++++---- src/yuzu/main.h | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index bde465485..fdc093524 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -364,9 +364,9 @@ void GRenderWindow::RestoreGeometry() { QWidget::restoreGeometry(geometry); } -void GRenderWindow::restoreGeometry(const QByteArray& geometry) { +void GRenderWindow::restoreGeometry(const QByteArray& geometry_) { // Make sure users of this class don't need to deal with backing up the geometry themselves - QWidget::restoreGeometry(geometry); + QWidget::restoreGeometry(geometry_); BackupGeometry(); } @@ -1014,8 +1014,8 @@ QStringList GRenderWindow::GetUnsupportedGLExtensions() const { return unsupported_ext; } -void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) { - this->emu_thread = emu_thread; +void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread_) { + emu_thread = emu_thread_; } void GRenderWindow::OnEmulationStopping() { diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index d01538039..81fe52c0e 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -56,12 +56,12 @@ public: /** * Sets whether the emulation thread is running or not - * @param running Boolean value, set the emulation thread to running if true + * @param running_ Boolean value, set the emulation thread to running if true * @note This function is thread-safe */ - void SetRunning(bool running) { + void SetRunning(bool running_) { std::unique_lock lock{running_mutex}; - this->running = running; + running = running_; lock.unlock(); running_cv.notify_all(); if (!running) { @@ -138,8 +138,8 @@ public: void BackupGeometry(); void RestoreGeometry(); - void restoreGeometry(const QByteArray& geometry); // overridden - QByteArray saveGeometry(); // overridden + void restoreGeometry(const QByteArray& geometry_); // overridden + QByteArray saveGeometry(); // overridden qreal windowPixelRatio() const; @@ -189,7 +189,7 @@ public: void Exit(); public slots: - void OnEmulationStarting(EmuThread* emu_thread); + void OnEmulationStarting(EmuThread* emu_thread_); void OnEmulationStopping(); void OnFramebufferSizeChanged(); diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index 54b3fe150..e7826b692 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp @@ -116,8 +116,8 @@ void ConfigurePerGame::HandleApplyButtonClicked() { ApplyConfiguration(); } -void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file) { - this->file = std::move(file); +void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file_) { + file = std::move(file_); LoadConfiguration(); } diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index e6dc05546..cf71eb68b 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h @@ -46,7 +46,7 @@ public: /// Save all button configurations to settings file void ApplyConfiguration(); - void LoadFromFile(FileSys::VirtualFile file); + void LoadFromFile(FileSys::VirtualFile file_); private: void changeEvent(QEvent* event) override; diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp index 7893a85bb..4906997ab 100644 --- a/src/yuzu/configuration/configure_per_game_addons.cpp +++ b/src/yuzu/configuration/configure_per_game_addons.cpp @@ -89,8 +89,8 @@ void ConfigurePerGameAddons::ApplyConfiguration() { Settings::values.disabled_addons[title_id] = disabled_addons; } -void ConfigurePerGameAddons::LoadFromFile(FileSys::VirtualFile file) { - this->file = std::move(file); +void ConfigurePerGameAddons::LoadFromFile(FileSys::VirtualFile file_) { + file = std::move(file_); LoadConfiguration(); } diff --git a/src/yuzu/configuration/configure_per_game_addons.h b/src/yuzu/configuration/configure_per_game_addons.h index 24b017494..14690fba8 100644 --- a/src/yuzu/configuration/configure_per_game_addons.h +++ b/src/yuzu/configuration/configure_per_game_addons.h @@ -35,7 +35,7 @@ public: /// Save all button configurations to settings file void ApplyConfiguration(); - void LoadFromFile(FileSys::VirtualFile file); + void LoadFromFile(FileSys::VirtualFile file_); void SetTitleId(u64 id); diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 6321afc83..64a866f34 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -80,9 +80,9 @@ bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* eve return QObject::eventFilter(obj, event); } -void GameListSearchField::setFilterResult(int visible, int total) { - this->visible = visible; - this->total = total; +void GameListSearchField::setFilterResult(int visible_, int total_) { + visible = visible_; + total = total_; label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible)); } diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index f2a986ed8..582f6db5e 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -348,7 +348,7 @@ public: explicit GameListSearchField(GameList* parent = nullptr); QString filterText() const; - void setFilterResult(int visible, int total); + void setFilterResult(int visible_, int total_); void clear(); void setFocus(); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 33886e50e..7dc9b6743 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1442,7 +1442,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p } return false; } - game_path = filename; + current_game_path = filename; system->TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt"); return true; @@ -1641,7 +1641,7 @@ void GMainWindow::ShutdownGame() { emu_frametime_label->setVisible(false); renderer_status_button->setEnabled(!UISettings::values.has_broken_vulkan); - game_path.clear(); + current_game_path.clear(); // When closing the game, destroy the GLWindow to clear the context after the game is closed render_window->ReleaseRenderTarget(); @@ -2560,7 +2560,7 @@ void GMainWindow::OnRestartGame() { return; } // Make a copy since BootGame edits game_path - BootGame(QString(game_path)); + BootGame(QString(current_game_path)); } void GMainWindow::OnPauseGame() { @@ -2989,7 +2989,7 @@ void GMainWindow::OnToggleAdaptingFilter() { void GMainWindow::OnConfigurePerGame() { const u64 title_id = system->GetCurrentProcessProgramID(); - OpenPerGameConfiguration(title_id, game_path.toStdString()); + OpenPerGameConfiguration(title_id, current_game_path.toStdString()); } void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 600647015..8cf224c9c 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -369,7 +369,7 @@ private: bool emulation_running = false; std::unique_ptr emu_thread; // The path to the game currently running - QString game_path; + QString current_game_path; bool auto_paused = false; bool auto_muted = false; From c1bd602e4ce8db7b66e64c69d57fb3b8db8a8529 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 26 May 2022 20:33:55 -0400 Subject: [PATCH 03/18] common: Eliminate variable shadowing GCC/Clang treats variables within lambdas as potentially shadowing those outside the lambda, despite them not being captured inside the lambda's capture list. --- src/common/detached_tasks.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/detached_tasks.cpp b/src/common/detached_tasks.cpp index c1362631e..ec31d0b88 100644 --- a/src/common/detached_tasks.cpp +++ b/src/common/detached_tasks.cpp @@ -33,9 +33,9 @@ void DetachedTasks::AddTask(std::function task) { ++instance->count; std::thread([task{std::move(task)}]() { task(); - std::unique_lock lock{instance->mutex}; + std::unique_lock thread_lock{instance->mutex}; --instance->count; - std::notify_all_at_thread_exit(instance->cv, std::move(lock)); + std::notify_all_at_thread_exit(instance->cv, std::move(thread_lock)); }).detach(); } From d0328f49f1ebcc061ba2db34bb3ae49605ca97fa Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 26 May 2022 21:05:06 -0400 Subject: [PATCH 04/18] externals: microprofile: Eliminate variable shadowing --- externals/microprofile/microprofile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h index a06f6457d..639f3618c 100644 --- a/externals/microprofile/microprofile.h +++ b/externals/microprofile/microprofile.h @@ -1246,7 +1246,7 @@ struct MicroProfileScopeLock { bool bUseLock; std::recursive_mutex& m; - MicroProfileScopeLock(std::recursive_mutex& m) : bUseLock(g_bUseLock), m(m) + MicroProfileScopeLock(std::recursive_mutex& m_) : bUseLock(g_bUseLock), m(m_) { if(bUseLock) m.lock(); From efc89c032b18d149308a1f8c1a371f503edb91d1 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 26 May 2022 20:08:21 -0400 Subject: [PATCH 05/18] CMakeLists: Make variable shadowing a compile-time error Now that the entire project is free of variable shadowing, we can enforce this as a compile time error to prevent any further introduction of this logic bug. --- src/CMakeLists.txt | 5 +++++ src/audio_core/CMakeLists.txt | 2 -- src/core/CMakeLists.txt | 5 ----- src/input_common/CMakeLists.txt | 1 - src/shader_recompiler/CMakeLists.txt | 3 --- src/video_core/CMakeLists.txt | 5 ----- 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9182dbfd4..39d038493 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,6 +65,10 @@ if (MSVC) /we4305 # 'context': truncation from 'type1' to 'type2' /we4388 # 'expression': signed/unsigned mismatch /we4389 # 'operator': signed/unsigned mismatch + /we4456 # Declaration of 'identifier' hides previous local declaration + /we4457 # Declaration of 'identifier' hides function parameter + /we4458 # Declaration of 'identifier' hides class member + /we4459 # Declaration of 'identifier' hides global declaration /we4505 # 'function': unreferenced local function has been removed /we4547 # 'operator': operator before comma has no effect; expected operator with side-effect /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? @@ -92,6 +96,7 @@ else() -Werror=missing-declarations -Werror=missing-field-initializers -Werror=reorder + -Werror=shadow -Werror=sign-compare -Werror=switch -Werror=uninitialized diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt index e553b8203..75ae085ea 100644 --- a/src/audio_core/CMakeLists.txt +++ b/src/audio_core/CMakeLists.txt @@ -49,9 +49,7 @@ if (NOT MSVC) target_compile_options(audio_core PRIVATE -Werror=conversion -Werror=ignored-qualifiers - -Werror=shadow -Werror=unused-parameter - -Werror=unused-variable $<$:-Werror=unused-but-set-parameter> $<$:-Werror=unused-but-set-variable> diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 2bd720f08..670410e75 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -743,16 +743,11 @@ if (MSVC) /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data - /we4456 # Declaration of 'identifier' hides previous local declaration - /we4457 # Declaration of 'identifier' hides function parameter - /we4458 # Declaration of 'identifier' hides class member - /we4459 # Declaration of 'identifier' hides global declaration ) else() target_compile_options(core PRIVATE -Werror=conversion -Werror=ignored-qualifiers - -Werror=shadow $<$:-Werror=class-memaccess> $<$:-Werror=unused-but-set-parameter> diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index d4fa69a77..48e799cf5 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt @@ -44,7 +44,6 @@ else() -Werror -Werror=conversion -Werror=ignored-qualifiers - -Werror=shadow $<$:-Werror=unused-but-set-parameter> $<$:-Werror=unused-but-set-variable> -Werror=unused-variable diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt index 4c76ce1ea..ae1dbe619 100644 --- a/src/shader_recompiler/CMakeLists.txt +++ b/src/shader_recompiler/CMakeLists.txt @@ -253,9 +253,6 @@ else() -Werror -Werror=conversion -Werror=ignored-qualifiers - -Werror=implicit-fallthrough - -Werror=shadow - -Werror=sign-compare $<$:-Werror=unused-but-set-parameter> $<$:-Werror=unused-but-set-variable> -Werror=unused-variable diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 256695804..14de7bc89 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -258,10 +258,6 @@ if (MSVC) target_compile_options(video_core PRIVATE /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data - /we4456 # Declaration of 'identifier' hides previous local declaration - /we4457 # Declaration of 'identifier' hides function parameter - /we4458 # Declaration of 'identifier' hides class member - /we4459 # Declaration of 'identifier' hides global declaration ) else() target_compile_options(video_core PRIVATE @@ -269,7 +265,6 @@ else() -Wno-error=sign-conversion -Werror=pessimizing-move -Werror=redundant-move - -Werror=shadow -Werror=type-limits $<$:-Werror=class-memaccess> From 8671aa8dd00f7408193df8835af8043706c64fcb Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 26 May 2022 21:26:54 -0400 Subject: [PATCH 06/18] audio_core: Remove -Werror=unused-parameter Removing this as we don't enforce unused parameter warnings elsewhere in the project, and explicitly specify -Wno-unused-parameter in the main CMakeLists. --- src/audio_core/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt index 75ae085ea..89575a53e 100644 --- a/src/audio_core/CMakeLists.txt +++ b/src/audio_core/CMakeLists.txt @@ -49,7 +49,6 @@ if (NOT MSVC) target_compile_options(audio_core PRIVATE -Werror=conversion -Werror=ignored-qualifiers - -Werror=unused-parameter $<$:-Werror=unused-but-set-parameter> $<$:-Werror=unused-but-set-variable> From 69d92a19a53d214e0087aa5e18d274ea57e4d57c Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 15:41:36 -0400 Subject: [PATCH 07/18] yuzu_cmd: Eliminate variable shadowing --- src/yuzu_cmd/emu_window/emu_window_sdl2.h | 2 +- src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | 4 ++-- src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h | 2 +- src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp | 4 ++-- src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h index 9746585f5..58b885465 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h @@ -20,7 +20,7 @@ enum class MouseButton; class EmuWindow_SDL2 : public Core::Frontend::EmuWindow { public: - explicit EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem, Core::System& system_); + explicit EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_); ~EmuWindow_SDL2(); /// Whether the window is still open, and a close request hasn't yet been sent diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp index 8075c9082..9b660c13c 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp @@ -73,9 +73,9 @@ bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() { return unsupported_ext.empty(); } -EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem, +EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_, bool fullscreen) - : EmuWindow_SDL2{input_subsystem, system_} { + : EmuWindow_SDL2{input_subsystem_, system_} { SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 6); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h index d159166fd..39346e704 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h @@ -17,7 +17,7 @@ class InputSubsystem; class EmuWindow_SDL2_GL final : public EmuWindow_SDL2 { public: - explicit EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem, Core::System& system_, + explicit EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_, bool fullscreen); ~EmuWindow_SDL2_GL(); diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp index d5fe35aa0..65455c86e 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp @@ -21,9 +21,9 @@ #include #include -EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, +EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_, bool fullscreen) - : EmuWindow_SDL2{input_subsystem, system_} { + : EmuWindow_SDL2{input_subsystem_, system_} { const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc); render_window = diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h index d92e3aaab..e39ad754d 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h @@ -18,7 +18,7 @@ class InputSubsystem; class EmuWindow_SDL2_VK final : public EmuWindow_SDL2 { public: - explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, Core::System& system, + explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem_, Core::System& system, bool fullscreen); ~EmuWindow_SDL2_VK() override; From 8b55f2c615f72d74cc1754941ffba5d526dd8d1d Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 16:04:40 -0400 Subject: [PATCH 08/18] externals: microprofileui: Eliminate variable shadowing --- externals/microprofile/microprofileui.h | 75 ++++++++++++------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/externals/microprofile/microprofileui.h b/externals/microprofile/microprofileui.h index 85fbf2cb9..1357a08fd 100644 --- a/externals/microprofile/microprofileui.h +++ b/externals/microprofile/microprofileui.h @@ -213,8 +213,8 @@ struct MicroProfileCustom struct SOptionDesc { - SOptionDesc(){} - SOptionDesc(uint8_t nSubType, uint8_t nIndex, const char* fmt, ...):nSubType(nSubType), nIndex(nIndex) + SOptionDesc()=default; + SOptionDesc(uint8_t nSubType_, uint8_t nIndex_, const char* fmt, ...):nSubType(nSubType_), nIndex(nIndex_) { va_list args; va_start (args, fmt); @@ -573,10 +573,10 @@ inline void MicroProfileToolTipMeta(MicroProfileStringArray* pToolTip) } else { - for(int i = 0; i < MICROPROFILE_META_MAX; ++i) + for(int k = 0; k < MICROPROFILE_META_MAX; ++k) { - nMetaSumInclusive[i] += nMetaSum[i]; - nMetaSum[i] = 0; + nMetaSumInclusive[k] += nMetaSum[k]; + nMetaSum[k] = 0; } } break; @@ -708,10 +708,10 @@ inline void MicroProfileDrawFloatTooltip(uint32_t nX, uint32_t nY, uint32_t nTok if(UI.nMouseLeftMod) { - int nIndex = (g_MicroProfileUI.LockedToolTipFront + MICROPROFILE_TOOLTIP_MAX_LOCKED - 1) % MICROPROFILE_TOOLTIP_MAX_LOCKED; - g_MicroProfileUI.nLockedToolTipColor[nIndex] = S.TimerInfo[nTimerId].nColor; - MicroProfileStringArrayCopy(&g_MicroProfileUI.LockedToolTips[nIndex], &ToolTip); - g_MicroProfileUI.LockedToolTipFront = nIndex; + int nToolTipIndex = (g_MicroProfileUI.LockedToolTipFront + MICROPROFILE_TOOLTIP_MAX_LOCKED - 1) % MICROPROFILE_TOOLTIP_MAX_LOCKED; + g_MicroProfileUI.nLockedToolTipColor[nToolTipIndex] = S.TimerInfo[nTimerId].nColor; + MicroProfileStringArrayCopy(&g_MicroProfileUI.LockedToolTips[nToolTipIndex], &ToolTip); + g_MicroProfileUI.LockedToolTipFront = nToolTipIndex; } } @@ -917,9 +917,8 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int float fStart = floor(fMsBase*fRcpStep) * fStep; for(float f = fStart; f < fMsEnd; ) { - float fStart = f; float fNext = f + fStep; - MicroProfileDrawBox(((fStart-fMsBase) * fMsToScreen), nBaseY, (fNext-fMsBase) * fMsToScreen+1, nBaseY + nHeight, UI.nOpacityBackground | g_nMicroProfileBackColors[nColorIndex++ & 1]); + MicroProfileDrawBox(((f-fMsBase) * fMsToScreen), nBaseY, (fNext-fMsBase) * fMsToScreen+1, nBaseY + nHeight, UI.nOpacityBackground | g_nMicroProfileBackColors[nColorIndex++ & 1]); f = fNext; } } @@ -1116,9 +1115,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int nMaxStackDepth = MicroProfileMax(nMaxStackDepth, nStackPos); float fMsStart = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickStart); - float fMsEnd = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickEnd); + float fMsEnd2 = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickEnd); float fXStart = fMsStart * fMsToScreen; - float fXEnd = fMsEnd * fMsToScreen; + float fXEnd = fMsEnd2 * fMsToScreen; float fYStart = (float)(nY + nStackPos * nYDelta); float fYEnd = fYStart + (MICROPROFILE_DETAILED_BAR_HEIGHT); float fXDist = MicroProfileMax(fXStart - fMouseX, fMouseX - fXEnd); @@ -1269,22 +1268,22 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int if(UI.nRangeBegin != UI.nRangeEnd) { float fMsStart = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeBegin); - float fMsEnd = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeEnd); + float fMsEnd3 = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeEnd); float fXStart = fMsStart * fMsToScreen; - float fXEnd = fMsEnd * fMsToScreen; + float fXEnd = fMsEnd3 * fMsToScreen; MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT, MicroProfileBoxTypeFlat); MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000); MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000); fMsStart += fDetailedOffset; - fMsEnd += fDetailedOffset; + fMsEnd3 += fDetailedOffset; char sBuffer[32]; uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart); float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); float fStartTextX = fXStart - fStartTextWidth - 2; MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); - uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); + uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd3); MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); @@ -1297,9 +1296,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int if(UI.nRangeBeginGpu != UI.nRangeEndGpu) { float fMsStart = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeBeginGpu); - float fMsEnd = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeEndGpu); + float fMsEnd4 = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeEndGpu); float fXStart = fMsStart * fMsToScreen; - float fXEnd = fMsEnd * fMsToScreen; + float fXEnd = fMsEnd4 * fMsToScreen; MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU, MicroProfileBoxTypeFlat); MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000); MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000); @@ -1307,14 +1306,14 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int nBaseY += MICROPROFILE_TEXT_HEIGHT+1; fMsStart += fDetailedOffset; - fMsEnd += fDetailedOffset; + fMsEnd4 += fDetailedOffset; char sBuffer[32]; uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart); float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); float fStartTextX = fXStart - fStartTextWidth - 2; MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); - uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); + uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd4); MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); } @@ -1716,8 +1715,8 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight) uint32_t nTextCount = 0; uint32_t nGraphIndex = (S.nGraphPut + MICROPROFILE_GRAPH_HISTORY - int(MICROPROFILE_GRAPH_HISTORY*(1.f - fMouseXPrc))) % MICROPROFILE_GRAPH_HISTORY; - uint32_t nX = UI.nMouseX; - uint32_t nY = UI.nMouseY + 20; + uint32_t nMouseX = UI.nMouseX; + uint32_t nMouseY = UI.nMouseY + 20; for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) { @@ -1736,7 +1735,7 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight) } if(nTextCount) { - MicroProfileDrawFloatWindow(nX, nY, Strings.ppStrings, Strings.nNumStrings, 0, pColors); + MicroProfileDrawFloatWindow(nMouseX, nMouseY, Strings.ppStrings, Strings.nNumStrings, 0, pColors); } if(UI.nMouseRight) @@ -2321,8 +2320,8 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) uint32_t nMenuX[MICROPROFILE_MENU_MAX] = {0}; uint32_t nNumMenuItems = 0; - int nLen = snprintf(buffer, 127, "MicroProfile"); - MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen); + int nMPTextLen = snprintf(buffer, 127, "MicroProfile"); + MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nMPTextLen); nX += (sizeof("MicroProfile")+2) * (MICROPROFILE_TEXT_WIDTH+1); pMenuText[nNumMenuItems++] = "Mode"; pMenuText[nNumMenuItems++] = "Groups"; @@ -2438,16 +2437,16 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) int nNumLines = 0; bool bSelected = false; const char* pString = CB(nNumLines, &bSelected); - uint32_t nWidth = 0, nHeight = 0; + uint32_t nTextWidth = 0, nTextHeight = 0; while(pString) { - nWidth = MicroProfileMax(nWidth, (int)strlen(pString)); + nTextWidth = MicroProfileMax(nTextWidth, (int)strlen(pString)); nNumLines++; pString = CB(nNumLines, &bSelected); } - nWidth = (2+nWidth) * (MICROPROFILE_TEXT_WIDTH+1); - nHeight = nNumLines * (MICROPROFILE_TEXT_HEIGHT+1); - if(UI.nMouseY <= nY + nHeight+0 && UI.nMouseY >= nY-0 && UI.nMouseX <= nX + nWidth + 0 && UI.nMouseX >= nX - 0) + nTextWidth = (2+nTextWidth) * (MICROPROFILE_TEXT_WIDTH+1); + nTextHeight = nNumLines * (MICROPROFILE_TEXT_HEIGHT+1); + if(UI.nMouseY <= nY + nTextHeight+0 && UI.nMouseY >= nY-0 && UI.nMouseX <= nX + nTextWidth + 0 && UI.nMouseX >= nX - 0) { UI.nActiveMenu = nMenu; } @@ -2455,21 +2454,21 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) { UI.nActiveMenu = UINT32_MAX; } - MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000|g_nMicroProfileBackColors[1]); + MicroProfileDrawBox(nX, nY, nX + nTextWidth, nY + nTextHeight, 0xff000000|g_nMicroProfileBackColors[1]); for(int i = 0; i < nNumLines; ++i) { - bool bSelected = false; - const char* pString = CB(i, &bSelected); + bool bSelected2 = false; + const char* pString2 = CB(i, &bSelected2); if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT + 1) { if(UI.nMouseLeft || UI.nMouseRight) { CBClick[nMenu](i); } - MicroProfileDrawBox(nX, nY, nX + nWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888); + MicroProfileDrawBox(nX, nY, nX + nTextWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888); } - int nLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected ? '*' : ' ' ,pString); - MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen); + int nTextLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected2 ? '*' : ' ' ,pString2); + MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nTextLen); nY += MICROPROFILE_TEXT_HEIGHT+1; } } @@ -2605,7 +2604,7 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) for(uint32_t i = 0; i < nCount; ++i) { nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); - uint32_t nWidth = MicroProfileMin(nMaxWidth, (uint32_t)(nMaxWidth * pMs[i] * fRcpReference)); + nWidth = MicroProfileMin(nMaxWidth, (uint32_t)(nMaxWidth * pMs[i] * fRcpReference)); MicroProfileDrawBox(nMaxOffsetX, nOffsetY, nMaxOffsetX+nWidth, nOffsetY+MICROPROFILE_TEXT_HEIGHT, pColors[i]|0xff000000); } } From e29e8eec2febc58e36add101d63e197f3ddea0bc Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 16:52:19 -0400 Subject: [PATCH 09/18] game_list: Eliminate variable shadowing --- src/yuzu/game_list.cpp | 8 ++++---- src/yuzu/game_list.h | 4 ++-- src/yuzu/game_list_p.h | 6 +++--- src/yuzu/game_list_worker.cpp | 12 ++++++------ src/yuzu/game_list_worker.h | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 64a866f34..05d309827 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -28,8 +28,8 @@ #include "yuzu/uisettings.h" #include "yuzu/util/controller_navigation.h" -GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist, QObject* parent) - : QObject(parent), gamelist{gamelist} {} +GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist_, QObject* parent) + : QObject(parent), gamelist{gamelist_} {} // EventFilter in order to process systemkeys while editing the searchfield bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* event) { @@ -309,9 +309,9 @@ void GameList::OnFilterCloseClicked() { main_window->filterBarSetChecked(false); } -GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, +GameList::GameList(FileSys::VirtualFilesystem vfs_, FileSys::ManualContentProvider* provider_, Core::System& system_, GMainWindow* parent) - : QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} { + : QWidget{parent}, vfs{std::move(vfs_)}, provider{provider_}, system{system_} { watcher = new QFileSystemWatcher(this); connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 464da98ad..bc36d015a 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h @@ -67,8 +67,8 @@ public: COLUMN_COUNT, // Number of columns }; - explicit GameList(std::shared_ptr vfs, - FileSys::ManualContentProvider* provider, Core::System& system_, + explicit GameList(std::shared_ptr vfs_, + FileSys::ManualContentProvider* provider_, Core::System& system_, GMainWindow* parent = nullptr); ~GameList() override; diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 582f6db5e..cd7d63536 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -225,8 +225,8 @@ public: static constexpr int GameDirRole = Qt::UserRole + 2; explicit GameListDir(UISettings::GameDir& directory, - GameListItemType dir_type = GameListItemType::CustomDir) - : dir_type{dir_type} { + GameListItemType dir_type_ = GameListItemType::CustomDir) + : dir_type{dir_type_} { setData(type(), TypeRole); UISettings::GameDir* game_dir = &directory; @@ -356,7 +356,7 @@ public: private: class KeyReleaseEater : public QObject { public: - explicit KeyReleaseEater(GameList* gamelist, QObject* parent = nullptr); + explicit KeyReleaseEater(GameList* gamelist_, QObject* parent = nullptr); private: GameList* gamelist = nullptr; diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index ca1899b5c..63326968b 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -223,12 +223,12 @@ QList MakeGameListEntry(const std::string& path, const std::stri } } // Anonymous namespace -GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, - FileSys::ManualContentProvider* provider, - QVector& game_dirs, - const CompatibilityList& compatibility_list, Core::System& system_) - : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), - compatibility_list(compatibility_list), system{system_} {} +GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs_, + FileSys::ManualContentProvider* provider_, + QVector& game_dirs_, + const CompatibilityList& compatibility_list_, Core::System& system_) + : vfs{std::move(vfs_)}, provider{provider_}, game_dirs{game_dirs_}, + compatibility_list{compatibility_list_}, system{system_} {} GameListWorker::~GameListWorker() = default; diff --git a/src/yuzu/game_list_worker.h b/src/yuzu/game_list_worker.h index 622d241fb..24a4e92c3 100644 --- a/src/yuzu/game_list_worker.h +++ b/src/yuzu/game_list_worker.h @@ -33,10 +33,10 @@ class GameListWorker : public QObject, public QRunnable { Q_OBJECT public: - explicit GameListWorker(std::shared_ptr vfs, - FileSys::ManualContentProvider* provider, - QVector& game_dirs, - const CompatibilityList& compatibility_list, Core::System& system_); + explicit GameListWorker(std::shared_ptr vfs_, + FileSys::ManualContentProvider* provider_, + QVector& game_dirs_, + const CompatibilityList& compatibility_list_, Core::System& system_); ~GameListWorker() override; /// Starts the processing of directory tree information. From 2d903e3ce6e0972c43d4611d4e20cecee4a42e23 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 17:30:41 -0400 Subject: [PATCH 10/18] bootmanager: Eliminate variable shadowing --- src/yuzu/bootmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index fdc093524..cbe4e2daa 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -127,7 +127,7 @@ void EmuThread::run() { class OpenGLSharedContext : public Core::Frontend::GraphicsContext { public: /// Create the original context that should be shared from - explicit OpenGLSharedContext(QSurface* surface) : surface(surface) { + explicit OpenGLSharedContext(QSurface* surface_) : surface{surface_} { QSurfaceFormat format; format.setVersion(4, 6); format.setProfile(QSurfaceFormat::CompatibilityProfile); From 1c8301452644545079474abbdc7d80ba5b1a781c Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 18:19:04 -0400 Subject: [PATCH 11/18] configure_dialog: Eliminate variable shadowing --- src/yuzu/configuration/configure_dialog.cpp | 7 +++---- src/yuzu/configuration/configure_dialog.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index b415a1cc4..e99657bd6 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -27,12 +27,11 @@ #include "yuzu/hotkeys.h" #include "yuzu/uisettings.h" -ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, +ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, InputCommon::InputSubsystem* input_subsystem, Core::System& system_) - : QDialog(parent), ui{std::make_unique()}, - registry(registry), system{system_}, audio_tab{std::make_unique(system_, - this)}, + : QDialog(parent), ui{std::make_unique()}, registry{registry_}, + system{system_}, audio_tab{std::make_unique(system_, this)}, cpu_tab{std::make_unique(system_, this)}, debug_tab_tab{std::make_unique(system_, this)}, filesystem_tab{std::make_unique(this)}, diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h index 32ddfd4e0..12cf25daf 100644 --- a/src/yuzu/configuration/configure_dialog.h +++ b/src/yuzu/configuration/configure_dialog.h @@ -40,7 +40,7 @@ class ConfigureDialog : public QDialog { Q_OBJECT public: - explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, + explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, InputCommon::InputSubsystem* input_subsystem, Core::System& system_); ~ConfigureDialog() override; From fe7184c2a8a7d9085cfa83431db99e2e4888f1d1 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:01:25 -0400 Subject: [PATCH 12/18] configure_input_player: Eliminate variable shadowing --- .../configuration/configure_input_player.cpp | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 1c05dd0f3..f3be9a374 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -264,15 +264,16 @@ QString ConfigureInputPlayer::AnalogToText(const Common::ParamPackage& param, return QObject::tr("[unknown]"); } -ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index, - QWidget* bottom_row, +ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index_, + QWidget* bottom_row_, InputCommon::InputSubsystem* input_subsystem_, InputProfiles* profiles_, Core::HID::HIDCore& hid_core_, - bool is_powered_on_, bool debug) - : QWidget(parent), ui(std::make_unique()), player_index(player_index), - debug(debug), is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, - profiles(profiles_), timeout_timer(std::make_unique()), - poll_timer(std::make_unique()), bottom_row(bottom_row), hid_core{hid_core_} { + bool is_powered_on_, bool debug_) + : QWidget(parent), + ui(std::make_unique()), player_index{player_index_}, debug{debug_}, + is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, profiles(profiles_), + timeout_timer(std::make_unique()), + poll_timer(std::make_unique()), bottom_row{bottom_row_}, hid_core{hid_core_} { if (player_index == 0) { auto* emulated_controller_p1 = hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); @@ -696,39 +697,38 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i UpdateControllerEnabledButtons(); UpdateControllerButtonNames(); UpdateMotionButtons(); - connect(ui->comboControllerType, qOverload(&QComboBox::currentIndexChanged), - [this, player_index](int) { - UpdateControllerAvailableButtons(); - UpdateControllerEnabledButtons(); - UpdateControllerButtonNames(); - UpdateMotionButtons(); - const Core::HID::NpadStyleIndex type = - GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); + connect(ui->comboControllerType, qOverload(&QComboBox::currentIndexChanged), [this](int) { + UpdateControllerAvailableButtons(); + UpdateControllerEnabledButtons(); + UpdateControllerButtonNames(); + UpdateMotionButtons(); + const Core::HID::NpadStyleIndex type = + GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); - if (player_index == 0) { - auto* emulated_controller_p1 = - hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); - auto* emulated_controller_handheld = - hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); - bool is_connected = emulated_controller->IsConnected(true); + if (player_index == 0) { + auto* emulated_controller_p1 = + hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); + auto* emulated_controller_handheld = + hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); + bool is_connected = emulated_controller->IsConnected(true); - emulated_controller_p1->SetNpadStyleIndex(type); - emulated_controller_handheld->SetNpadStyleIndex(type); - if (is_connected) { - if (type == Core::HID::NpadStyleIndex::Handheld) { - emulated_controller_p1->Disconnect(); - emulated_controller_handheld->Connect(true); - emulated_controller = emulated_controller_handheld; - } else { - emulated_controller_handheld->Disconnect(); - emulated_controller_p1->Connect(true); - emulated_controller = emulated_controller_p1; - } - } - ui->controllerFrame->SetController(emulated_controller); + emulated_controller_p1->SetNpadStyleIndex(type); + emulated_controller_handheld->SetNpadStyleIndex(type); + if (is_connected) { + if (type == Core::HID::NpadStyleIndex::Handheld) { + emulated_controller_p1->Disconnect(); + emulated_controller_handheld->Connect(true); + emulated_controller = emulated_controller_handheld; + } else { + emulated_controller_handheld->Disconnect(); + emulated_controller_p1->Connect(true); + emulated_controller = emulated_controller_p1; } - emulated_controller->SetNpadStyleIndex(type); - }); + } + ui->controllerFrame->SetController(emulated_controller); + } + emulated_controller->SetNpadStyleIndex(type); + }); connect(ui->comboDevices, qOverload(&QComboBox::activated), this, &ConfigureInputPlayer::UpdateMappingWithDefaults); From 5503338f211c7082420f864a4f2124f9960c1367 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:05:43 -0400 Subject: [PATCH 13/18] configure_per_game: Eliminate variable shadowing --- src/yuzu/configuration/configure_per_game.cpp | 6 +++--- src/yuzu/configuration/configure_per_game.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index e7826b692..af8343b2e 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp @@ -35,10 +35,10 @@ #include "yuzu/uisettings.h" #include "yuzu/util/util.h" -ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name, +ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name, Core::System& system_) - : QDialog(parent), ui(std::make_unique()), - title_id(title_id), system{system_} { + : QDialog(parent), + ui(std::make_unique()), title_id{title_id_}, system{system_} { const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) : fmt::format("{:016X}", title_id); diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index cf71eb68b..17a98a0f3 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h @@ -39,7 +39,7 @@ class ConfigurePerGame : public QDialog { public: // Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263 - explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name, + explicit ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name, Core::System& system_); ~ConfigurePerGame() override; From e37196121948e98b7512e5111da515b29591beec Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:06:00 -0400 Subject: [PATCH 14/18] configure_touch_from_button: Eliminate variable shadowing --- src/yuzu/configuration/configure_touch_from_button.cpp | 4 ++-- src/yuzu/configuration/configure_touch_from_button.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yuzu/configuration/configure_touch_from_button.cpp b/src/yuzu/configuration/configure_touch_from_button.cpp index c17da6fd1..06cc452c3 100644 --- a/src/yuzu/configuration/configure_touch_from_button.cpp +++ b/src/yuzu/configuration/configure_touch_from_button.cpp @@ -68,10 +68,10 @@ static QString ButtonToText(const Common::ParamPackage& param) { } ConfigureTouchFromButton::ConfigureTouchFromButton( - QWidget* parent, const std::vector& touch_maps, + QWidget* parent, const std::vector& touch_maps_, InputCommon::InputSubsystem* input_subsystem_, const int default_index) : QDialog(parent), ui(std::make_unique()), - touch_maps(touch_maps), input_subsystem{input_subsystem_}, selected_index(default_index), + touch_maps{touch_maps_}, input_subsystem{input_subsystem_}, selected_index{default_index}, timeout_timer(std::make_unique()), poll_timer(std::make_unique()) { ui->setupUi(this); binding_list_model = new QStandardItemModel(0, 3, this); diff --git a/src/yuzu/configuration/configure_touch_from_button.h b/src/yuzu/configuration/configure_touch_from_button.h index e1400481a..b8c55db66 100644 --- a/src/yuzu/configuration/configure_touch_from_button.h +++ b/src/yuzu/configuration/configure_touch_from_button.h @@ -37,7 +37,7 @@ class ConfigureTouchFromButton : public QDialog { public: explicit ConfigureTouchFromButton(QWidget* parent, - const std::vector& touch_maps, + const std::vector& touch_maps_, InputCommon::InputSubsystem* input_subsystem_, int default_index = 0); ~ConfigureTouchFromButton() override; From 95bcf6ac38810a313f31d6011b3569d519214e4e Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 14 Jun 2022 04:58:46 -0400 Subject: [PATCH 15/18] configure_ringcon: Eliminate variable shadowing --- src/yuzu/configuration/configure_ringcon.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/yuzu/configuration/configure_ringcon.cpp b/src/yuzu/configuration/configure_ringcon.cpp index 4fcc22b7a..688c2dd38 100644 --- a/src/yuzu/configuration/configure_ringcon.cpp +++ b/src/yuzu/configuration/configure_ringcon.cpp @@ -165,10 +165,10 @@ ConfigureRingController::ConfigureRingController(QWidget* parent, const std::string invert_str = invert_value ? "+" : "-"; param.Set("invert_x", invert_str); emulated_device->SetRingParam(param); - for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; - ++sub_button_id) { - analog_map_buttons[sub_button_id]->setText( - AnalogToText(param, analog_sub_buttons[sub_button_id])); + for (int sub_button_id2 = 0; sub_button_id2 < ANALOG_SUB_BUTTONS_NUM; + ++sub_button_id2) { + analog_map_buttons[sub_button_id2]->setText( + AnalogToText(param, analog_sub_buttons[sub_button_id2])); } }); context_menu.exec( From 742f021fdf4868653d3a66e200cf5250ad28b772 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 14 Jun 2022 05:44:08 -0400 Subject: [PATCH 16/18] wait_tree: Eliminate variable shadowing --- src/yuzu/debugger/wait_tree.cpp | 16 ++++++++-------- src/yuzu/debugger/wait_tree.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp index 8f486a131..0ea31cd33 100644 --- a/src/yuzu/debugger/wait_tree.cpp +++ b/src/yuzu/debugger/wait_tree.cpp @@ -113,9 +113,9 @@ QString WaitTreeText::GetText() const { return text; } -WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table, +WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address_, const Kernel::KHandleTable& handle_table, Core::System& system_) - : mutex_address(mutex_address), system{system_} { + : mutex_address{mutex_address_}, system{system_} { mutex_value = system.Memory().Read32(mutex_address); owner_handle = static_cast(mutex_value & Kernel::Svc::HandleWaitMask); owner = handle_table.GetObject(owner_handle).GetPointerUnsafe(); @@ -140,8 +140,8 @@ std::vector> WaitTreeMutexInfo::GetChildren() cons return list; } -WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_) - : thread(thread), system{system_} {} +WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread_, Core::System& system_) + : thread{thread_}, system{system_} {} WaitTreeCallstack::~WaitTreeCallstack() = default; QString WaitTreeCallstack::GetText() const { @@ -171,8 +171,8 @@ std::vector> WaitTreeCallstack::GetChildren() cons } WaitTreeSynchronizationObject::WaitTreeSynchronizationObject( - const Kernel::KSynchronizationObject& o, Core::System& system_) - : object(o), system{system_} {} + const Kernel::KSynchronizationObject& object_, Core::System& system_) + : object{object_}, system{system_} {} WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default; WaitTreeExpandableItem::WaitTreeExpandableItem() = default; @@ -380,8 +380,8 @@ std::vector> WaitTreeThread::GetChildren() const { return list; } -WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_) - : WaitTreeSynchronizationObject(object, system_) {} +WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object_, Core::System& system_) + : WaitTreeSynchronizationObject(object_, system_) {} WaitTreeEvent::~WaitTreeEvent() = default; WaitTreeThreadList::WaitTreeThreadList(std::vector&& list, Core::System& system_) diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h index 4a36dfc48..f21b9f467 100644 --- a/src/yuzu/debugger/wait_tree.h +++ b/src/yuzu/debugger/wait_tree.h @@ -78,7 +78,7 @@ public: class WaitTreeMutexInfo : public WaitTreeExpandableItem { Q_OBJECT public: - explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table, + explicit WaitTreeMutexInfo(VAddr mutex_address_, const Kernel::KHandleTable& handle_table, Core::System& system_); ~WaitTreeMutexInfo() override; @@ -97,7 +97,7 @@ private: class WaitTreeCallstack : public WaitTreeExpandableItem { Q_OBJECT public: - explicit WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_); + explicit WaitTreeCallstack(const Kernel::KThread& thread_, Core::System& system_); ~WaitTreeCallstack() override; QString GetText() const override; @@ -112,7 +112,7 @@ private: class WaitTreeSynchronizationObject : public WaitTreeExpandableItem { Q_OBJECT public: - explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object, + explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object_, Core::System& system_); ~WaitTreeSynchronizationObject() override; @@ -162,7 +162,7 @@ private: class WaitTreeEvent : public WaitTreeSynchronizationObject { Q_OBJECT public: - explicit WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_); + explicit WaitTreeEvent(const Kernel::KReadableEvent& object_, Core::System& system_); ~WaitTreeEvent() override; }; From 0eeee431dc3fc38114282174f4858c7e81667eb2 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 14 Jun 2022 14:09:45 -0400 Subject: [PATCH 17/18] main: Eliminate variable shadowing --- src/yuzu/main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 7dc9b6743..b460020b1 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -934,8 +934,7 @@ void GMainWindow::InitializeWidgets() { Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan); } else { Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); - const auto filter = Settings::values.scaling_filter.GetValue(); - if (filter == Settings::ScalingFilter::Fsr) { + if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Fsr) { Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::NearestNeighbor); UpdateFilterText(); } @@ -1508,7 +1507,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t // Register an ExecuteProgram callback such that Core can execute a sub-program system->RegisterExecuteProgramCallback( - [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); + [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); }); // Register an Exit callback such that Core can exit the currently running application. system->RegisterExitCallback([this]() { render_window->Exit(); }); From 7620e1a631781b234b17cbbf7c5f7bd14d3115f9 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Fri, 27 May 2022 12:59:26 -0400 Subject: [PATCH 18/18] externals: Update cpp-httplib to latest --- externals/cpp-httplib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/cpp-httplib b/externals/cpp-httplib index 9648f950f..305a7abcb 160000 --- a/externals/cpp-httplib +++ b/externals/cpp-httplib @@ -1 +1 @@ -Subproject commit 9648f950f5a8a41d18833cf4a85f5821b1bcac54 +Subproject commit 305a7abcb9b4e9e349843c6d563212e6c1bbbf21