diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 05c6779e24..c3f23e037d 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -16,11 +16,11 @@ #include #include -#include #include "Common/Assert.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" +#include "Common/Crypto/SHA1.h" #include "Common/ENetUtil.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" @@ -90,10 +90,10 @@ NetPlayClient::~NetPlayClient() if (m_is_connected) { - m_should_compute_MD5 = false; - m_dialog->AbortMD5(); - if (m_MD5_thread.joinable()) - m_MD5_thread.join(); + m_should_compute_game_digest = false; + m_dialog->AbortGameDigest(); + if (m_game_digest_thread.joinable()) + m_game_digest_thread.join(); m_do_loop.Clear(); m_thread.join(); @@ -444,24 +444,24 @@ void NetPlayClient::OnData(sf::Packet& packet) OnSyncCodes(packet); break; - case MessageID::ComputeMD5: - OnComputeMD5(packet); + case MessageID::ComputeGameDigest: + OnComputeGameDigest(packet); break; - case MessageID::MD5Progress: - OnMD5Progress(packet); + case MessageID::GameDigestProgress: + OnGameDigestProgress(packet); break; - case MessageID::MD5Result: - OnMD5Result(packet); + case MessageID::GameDigestResult: + OnGameDigestResult(packet); break; - case MessageID::MD5Error: - OnMD5Error(packet); + case MessageID::GameDigestError: + OnGameDigestError(packet); break; - case MessageID::MD5Abort: - OnMD5Abort(); + case MessageID::GameDigestAbort: + OnGameDigestAbort(); break; default: @@ -1421,48 +1421,48 @@ void NetPlayClient::OnSyncCodesDataAR(sf::Packet& packet) ActionReplay::UpdateSyncedCodes(synced_codes); } -void NetPlayClient::OnComputeMD5(sf::Packet& packet) +void NetPlayClient::OnComputeGameDigest(sf::Packet& packet) { SyncIdentifier sync_identifier; ReceiveSyncIdentifier(packet, sync_identifier); - ComputeMD5(sync_identifier); + ComputeGameDigest(sync_identifier); } -void NetPlayClient::OnMD5Progress(sf::Packet& packet) +void NetPlayClient::OnGameDigestProgress(sf::Packet& packet) { PlayerId pid; int progress; packet >> pid; packet >> progress; - m_dialog->SetMD5Progress(pid, progress); + m_dialog->SetGameDigestProgress(pid, progress); } -void NetPlayClient::OnMD5Result(sf::Packet& packet) +void NetPlayClient::OnGameDigestResult(sf::Packet& packet) { PlayerId pid; std::string result; packet >> pid; packet >> result; - m_dialog->SetMD5Result(pid, result); + m_dialog->SetGameDigestResult(pid, result); } -void NetPlayClient::OnMD5Error(sf::Packet& packet) +void NetPlayClient::OnGameDigestError(sf::Packet& packet) { PlayerId pid; std::string error; packet >> pid; packet >> error; - m_dialog->SetMD5Result(pid, error); + m_dialog->SetGameDigestResult(pid, error); } -void NetPlayClient::OnMD5Abort() +void NetPlayClient::OnGameDigestAbort() { - m_should_compute_MD5 = false; - m_dialog->AbortMD5(); + m_should_compute_game_digest = false; + m_dialog->AbortGameDigest(); } void NetPlayClient::Send(const sf::Packet& packet, const u8 channel_id) @@ -2438,16 +2438,15 @@ bool NetPlayClient::DoAllPlayersHaveGame() }); } -static std::string MD5Sum(const std::string& file_path, std::function report_progress) +static std::string SHA1Sum(const std::string& file_path, std::function report_progress) { std::vector data(8 * 1024 * 1024); u64 read_offset = 0; - mbedtls_md5_context ctx; std::unique_ptr file(DiscIO::CreateBlobReader(file_path)); u64 game_size = file->GetDataSize(); - mbedtls_md5_starts_ret(&ctx); + auto ctx = Common::SHA1::CreateContext(); while (read_offset < game_size) { @@ -2455,7 +2454,7 @@ static std::string MD5Sum(const std::string& file_path, std::function if (!file->Read(read_offset, read_size, data.data())) return ""; - mbedtls_md5_update_ret(&ctx, data.data(), read_size); + ctx->Update(data.data(), read_size); read_offset += read_size; int progress = @@ -2464,20 +2463,17 @@ static std::string MD5Sum(const std::string& file_path, std::function return ""; } - std::array output; - mbedtls_md5_finish_ret(&ctx, output.data()); - // Convert to hex - return fmt::format("{:02x}", fmt::join(output, "")); + return fmt::format("{:02x}", fmt::join(ctx->Finish(), "")); } -void NetPlayClient::ComputeMD5(const SyncIdentifier& sync_identifier) +void NetPlayClient::ComputeGameDigest(const SyncIdentifier& sync_identifier) { - if (m_should_compute_MD5) + if (m_should_compute_game_digest) return; - m_dialog->ShowMD5Dialog(sync_identifier.game_id); - m_should_compute_MD5 = true; + m_dialog->ShowGameDigestDialog(sync_identifier.game_id); + m_should_compute_game_digest = true; std::string file; if (sync_identifier == GetSDCardIdentifier()) @@ -2488,26 +2484,26 @@ void NetPlayClient::ComputeMD5(const SyncIdentifier& sync_identifier) if (file.empty() || !File::Exists(file)) { sf::Packet packet; - packet << MessageID::MD5Error; + packet << MessageID::GameDigestError; packet << "file not found"; Send(packet); return; } - if (m_MD5_thread.joinable()) - m_MD5_thread.join(); - m_MD5_thread = std::thread([this, file]() { - std::string sum = MD5Sum(file, [&](int progress) { + if (m_game_digest_thread.joinable()) + m_game_digest_thread.join(); + m_game_digest_thread = std::thread([this, file]() { + std::string sum = SHA1Sum(file, [&](int progress) { sf::Packet packet; - packet << MessageID::MD5Progress; + packet << MessageID::GameDigestProgress; packet << progress; SendAsync(std::move(packet)); - return m_should_compute_MD5; + return m_should_compute_game_digest; }); sf::Packet packet; - packet << MessageID::MD5Result; + packet << MessageID::GameDigestResult; packet << sum; SendAsync(std::move(packet)); }); diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h index dc96ac388b..d3d0273325 100644 --- a/Source/Core/Core/NetPlayClient.h +++ b/Source/Core/Core/NetPlayClient.h @@ -73,10 +73,10 @@ public: SyncIdentifierComparison* found = nullptr) = 0; virtual std::string FindGBARomPath(const std::array& hash, std::string_view title, int device_number) = 0; - virtual void ShowMD5Dialog(const std::string& title) = 0; - virtual void SetMD5Progress(int pid, int progress) = 0; - virtual void SetMD5Result(int pid, const std::string& result) = 0; - virtual void AbortMD5() = 0; + virtual void ShowGameDigestDialog(const std::string& title) = 0; + virtual void SetGameDigestProgress(int pid, int progress) = 0; + virtual void SetGameDigestResult(int pid, const std::string& result) = 0; + virtual void AbortGameDigest() = 0; virtual void OnIndexAdded(bool success, std::string error) = 0; virtual void OnIndexRefreshFailed(std::string error) = 0; @@ -248,7 +248,7 @@ private: void Disconnect(); bool Connect(); void SendGameStatus(); - void ComputeMD5(const SyncIdentifier& sync_identifier); + void ComputeGameDigest(const SyncIdentifier& sync_identifier); void DisplayPlayersPing(); u32 GetPlayersMaxPing() const; @@ -291,11 +291,11 @@ private: void OnSyncCodesDataGecko(sf::Packet& packet); void OnSyncCodesNotifyAR(sf::Packet& packet); void OnSyncCodesDataAR(sf::Packet& packet); - void OnComputeMD5(sf::Packet& packet); - void OnMD5Progress(sf::Packet& packet); - void OnMD5Result(sf::Packet& packet); - void OnMD5Error(sf::Packet& packet); - void OnMD5Abort(); + void OnComputeGameDigest(sf::Packet& packet); + void OnGameDigestProgress(sf::Packet& packet); + void OnGameDigestResult(sf::Packet& packet); + void OnGameDigestError(sf::Packet& packet); + void OnGameDigestAbort(); bool m_is_connected = false; ConnectionState m_connection_state = ConnectionState::Failure; @@ -307,8 +307,8 @@ private: std::string m_player_name; bool m_connecting = false; TraversalClient* m_traversal_client = nullptr; - std::thread m_MD5_thread; - bool m_should_compute_MD5 = false; + std::thread m_game_digest_thread; + bool m_should_compute_game_digest = false; Common::Event m_gc_pad_event; Common::Event m_wii_pad_event; Common::Event m_first_pad_status_received_event; diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h index 9c82ed70a3..c85d7373d6 100644 --- a/Source/Core/Core/NetPlayProto.h +++ b/Source/Core/Core/NetPlayProto.h @@ -168,11 +168,11 @@ enum class MessageID : u8 TimeBase = 0xB0, DesyncDetected = 0xB1, - ComputeMD5 = 0xC0, - MD5Progress = 0xC1, - MD5Result = 0xC2, - MD5Abort = 0xC3, - MD5Error = 0xC4, + ComputeGameDigest = 0xC0, + GameDigestProgress = 0xC1, + GameDigestResult = 0xC2, + GameDigestAbort = 0xC3, + GameDigestError = 0xC4, Ready = 0xD0, NotReady = 0xD1, diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index c44af173ba..da69d1abfa 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -1030,13 +1030,13 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) } break; - case MessageID::MD5Progress: + case MessageID::GameDigestProgress: { int progress; packet >> progress; sf::Packet spac; - spac << MessageID::MD5Progress; + spac << MessageID::GameDigestProgress; spac << player.pid; spac << progress; @@ -1044,13 +1044,13 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) } break; - case MessageID::MD5Result: + case MessageID::GameDigestResult: { std::string result; packet >> result; sf::Packet spac; - spac << MessageID::MD5Result; + spac << MessageID::GameDigestResult; spac << player.pid; spac << result; @@ -1058,13 +1058,13 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) } break; - case MessageID::MD5Error: + case MessageID::GameDigestError: { std::string error; packet >> error; sf::Packet spac; - spac << MessageID::MD5Error; + spac << MessageID::GameDigestError; spac << player.pid; spac << error; @@ -1214,10 +1214,10 @@ bool NetPlayServer::ChangeGame(const SyncIdentifier& sync_identifier, } // called from ---GUI--- thread -bool NetPlayServer::ComputeMD5(const SyncIdentifier& sync_identifier) +bool NetPlayServer::ComputeGameDigest(const SyncIdentifier& sync_identifier) { sf::Packet spac; - spac << MessageID::ComputeMD5; + spac << MessageID::ComputeGameDigest; SendSyncIdentifier(spac, sync_identifier); SendAsyncToClients(std::move(spac)); @@ -1226,10 +1226,10 @@ bool NetPlayServer::ComputeMD5(const SyncIdentifier& sync_identifier) } // called from ---GUI--- thread -bool NetPlayServer::AbortMD5() +bool NetPlayServer::AbortGameDigest() { sf::Packet spac; - spac << MessageID::MD5Abort; + spac << MessageID::GameDigestAbort; SendAsyncToClients(std::move(spac)); return true; diff --git a/Source/Core/Core/NetPlayServer.h b/Source/Core/Core/NetPlayServer.h index 13a05ee070..89f5bf82b7 100644 --- a/Source/Core/Core/NetPlayServer.h +++ b/Source/Core/Core/NetPlayServer.h @@ -45,8 +45,8 @@ public: ~NetPlayServer(); bool ChangeGame(const SyncIdentifier& sync_identifier, const std::string& netplay_name); - bool ComputeMD5(const SyncIdentifier& sync_identifier); - bool AbortMD5(); + bool ComputeGameDigest(const SyncIdentifier& sync_identifier); + bool AbortGameDigest(); void SendChatMessage(const std::string& msg); bool DoAllPlayersHaveIPLDump() const; diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 1c02e783bb..c00526cdb8 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -33,41 +33,6 @@ add_executable(dolphin-emu CheatSearchWidget.h CheatsManager.cpp CheatsManager.h - ConvertDialog.cpp - ConvertDialog.h - DiscordHandler.cpp - DiscordHandler.h - DiscordJoinRequestDialog.cpp - DiscordJoinRequestDialog.h - FIFO/FIFOPlayerWindow.cpp - FIFO/FIFOPlayerWindow.h - FIFO/FIFOAnalyzer.cpp - FIFO/FIFOAnalyzer.h - Host.cpp - Host.h - HotkeyScheduler.cpp - HotkeyScheduler.h - Main.cpp - MainWindow.cpp - MainWindow.h - MenuBar.cpp - MenuBar.h - NKitWarningDialog.cpp - NKitWarningDialog.h - RenderWidget.cpp - RenderWidget.h - Resources.cpp - Resources.h - SearchBar.cpp - SearchBar.h - Settings.cpp - Settings.h - ToolBar.cpp - ToolBar.h - Translation.cpp - Translation.h - WiiUpdate.cpp - WiiUpdate.h Config/ARCodeWidget.cpp Config/ARCodeWidget.h Config/CheatCodeEditor.cpp @@ -76,12 +41,12 @@ add_executable(dolphin-emu Config/CheatWarningWidget.h Config/CommonControllersWidget.cpp Config/CommonControllersWidget.h + Config/ControllerInterface/ControllerInterfaceWindow.cpp + Config/ControllerInterface/ControllerInterfaceWindow.h Config/ControllerInterface/DualShockUDPClientAddServerDialog.cpp Config/ControllerInterface/DualShockUDPClientAddServerDialog.h Config/ControllerInterface/DualShockUDPClientWidget.cpp Config/ControllerInterface/DualShockUDPClientWidget.h - Config/ControllerInterface/ControllerInterfaceWindow.cpp - Config/ControllerInterface/ControllerInterfaceWindow.h Config/ControllerInterface/ServerStringValidator.cpp Config/ControllerInterface/ServerStringValidator.h Config/ControllersWindow.cpp @@ -92,14 +57,14 @@ add_executable(dolphin-emu Config/FreeLookWidget.h Config/FreeLookWindow.cpp Config/FreeLookWindow.h - Config/GamecubeControllersWidget.cpp - Config/GamecubeControllersWidget.h Config/GameConfigEdit.cpp Config/GameConfigEdit.h Config/GameConfigHighlighter.cpp Config/GameConfigHighlighter.h Config/GameConfigWidget.cpp Config/GameConfigWidget.h + Config/GamecubeControllersWidget.cpp + Config/GamecubeControllersWidget.h Config/GeckoCodeWidget.cpp Config/GeckoCodeWidget.h Config/Graphics/AdvancedWidget.cpp @@ -221,6 +186,8 @@ add_executable(dolphin-emu Config/VerifyWidget.h Config/WiimoteControllersWidget.cpp Config/WiimoteControllersWidget.h + ConvertDialog.cpp + ConvertDialog.h Debugger/BreakpointWidget.cpp Debugger/BreakpointWidget.h Debugger/CodeDiffDialog.cpp @@ -249,6 +216,14 @@ add_executable(dolphin-emu Debugger/ThreadWidget.h Debugger/WatchWidget.cpp Debugger/WatchWidget.h + DiscordHandler.cpp + DiscordHandler.h + DiscordJoinRequestDialog.cpp + DiscordJoinRequestDialog.h + FIFO/FIFOAnalyzer.cpp + FIFO/FIFOAnalyzer.h + FIFO/FIFOPlayerWindow.cpp + FIFO/FIFOPlayerWindow.h GameList/GameList.cpp GameList/GameList.h GameList/GameListModel.cpp @@ -263,14 +238,21 @@ add_executable(dolphin-emu GCMemcardCreateNewDialog.h GCMemcardManager.cpp GCMemcardManager.h - QtUtils/BlockUserInputFilter.cpp - QtUtils/BlockUserInputFilter.h + Host.cpp + Host.h + HotkeyScheduler.cpp + HotkeyScheduler.h + Main.cpp + MainWindow.cpp + MainWindow.h + MenuBar.cpp + MenuBar.h NetPlay/ChunkedProgressDialog.cpp NetPlay/ChunkedProgressDialog.h + NetPlay/GameDigestDialog.cpp + NetPlay/GameDigestDialog.h NetPlay/GameListDialog.cpp NetPlay/GameListDialog.h - NetPlay/MD5Dialog.cpp - NetPlay/MD5Dialog.h NetPlay/NetPlayBrowser.cpp NetPlay/NetPlayBrowser.h NetPlay/NetPlayDialog.cpp @@ -279,6 +261,12 @@ add_executable(dolphin-emu NetPlay/NetPlaySetupDialog.h NetPlay/PadMappingDialog.cpp NetPlay/PadMappingDialog.h + NKitWarningDialog.cpp + NKitWarningDialog.h + QtUtils/AspectRatioWidget.cpp + QtUtils/AspectRatioWidget.h + QtUtils/BlockUserInputFilter.cpp + QtUtils/BlockUserInputFilter.h QtUtils/DolphinFileDialog.cpp QtUtils/DolphinFileDialog.h QtUtils/DoubleClickEventFilter.cpp @@ -289,13 +277,15 @@ add_executable(dolphin-emu QtUtils/FileOpenEventFilter.h QtUtils/FlowLayout.cpp QtUtils/FlowLayout.h + QtUtils/ImageConverter.cpp + QtUtils/ImageConverter.h QtUtils/ModalMessageBox.cpp QtUtils/ModalMessageBox.h + QtUtils/NonDefaultQPushButton.cpp + QtUtils/NonDefaultQPushButton.h QtUtils/ParallelProgressDialog.h QtUtils/PartiallyClosableTabWidget.cpp QtUtils/PartiallyClosableTabWidget.h - QtUtils/ImageConverter.cpp - QtUtils/ImageConverter.h QtUtils/SignalBlocking.h QtUtils/UTF8CodePointCountValidator.cpp QtUtils/UTF8CodePointCountValidator.h @@ -305,14 +295,18 @@ add_executable(dolphin-emu QtUtils/WinIconHelper.h QtUtils/WrapInScrollArea.cpp QtUtils/WrapInScrollArea.h - QtUtils/AspectRatioWidget.cpp - QtUtils/AspectRatioWidget.h - QtUtils/NonDefaultQPushButton.cpp - QtUtils/NonDefaultQPushButton.h + RenderWidget.cpp + RenderWidget.h ResourcePackManager.cpp ResourcePackManager.h + Resources.cpp + Resources.h RiivolutionBootWidget.cpp RiivolutionBootWidget.h + SearchBar.cpp + SearchBar.h + Settings.cpp + Settings.h Settings/AdvancedPane.cpp Settings/AdvancedPane.h Settings/AudioPane.cpp @@ -327,26 +321,32 @@ add_executable(dolphin-emu Settings/InterfacePane.h Settings/PathPane.cpp Settings/PathPane.h - Settings/WiiPane.cpp - Settings/WiiPane.h Settings/USBDeviceAddToWhitelistDialog.cpp Settings/USBDeviceAddToWhitelistDialog.h + Settings/WiiPane.cpp + Settings/WiiPane.h TAS/GCTASInputWindow.cpp TAS/GCTASInputWindow.h - TAS/WiiTASInputWindow.cpp - TAS/WiiTASInputWindow.h + TAS/IRWidget.cpp + TAS/IRWidget.h + TAS/StickWidget.cpp + TAS/StickWidget.h TAS/TASCheckBox.cpp TAS/TASCheckBox.h TAS/TASInputWindow.cpp TAS/TASInputWindow.h TAS/TASSlider.cpp TAS/TASSlider.h - TAS/StickWidget.cpp - TAS/StickWidget.h - TAS/IRWidget.cpp - TAS/IRWidget.h + TAS/WiiTASInputWindow.cpp + TAS/WiiTASInputWindow.h + ToolBar.cpp + ToolBar.h + Translation.cpp + Translation.h Updater.cpp Updater.h + WiiUpdate.cpp + WiiUpdate.h ) if (NOT WIN32) diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj b/Source/Core/DolphinQt/DolphinQt.vcxproj index e9490c805c..9747da0769 100644 --- a/Source/Core/DolphinQt/DolphinQt.vcxproj +++ b/Source/Core/DolphinQt/DolphinQt.vcxproj @@ -160,8 +160,8 @@ + - @@ -349,8 +349,8 @@ + - diff --git a/Source/Core/DolphinQt/NetPlay/MD5Dialog.cpp b/Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp similarity index 87% rename from Source/Core/DolphinQt/NetPlay/MD5Dialog.cpp rename to Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp index 3d5766a810..6a91e4bbde 100644 --- a/Source/Core/DolphinQt/NetPlay/MD5Dialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Dolphin Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "DolphinQt/NetPlay/MD5Dialog.h" +#include "DolphinQt/NetPlay/GameDigestDialog.h" #include #include @@ -36,16 +36,16 @@ static QString GetPlayerNameFromPID(int pid) return player_name; } -MD5Dialog::MD5Dialog(QWidget* parent) : QDialog(parent) +GameDigestDialog::GameDigestDialog(QWidget* parent) : QDialog(parent) { CreateWidgets(); ConnectWidgets(); - setWindowTitle(tr("MD5 Checksum")); + setWindowTitle(tr("SHA1 Digest")); setWindowFlags(Qt::Sheet | Qt::Dialog); setWindowModality(Qt::WindowModal); } -void MD5Dialog::CreateWidgets() +void GameDigestDialog::CreateWidgets() { m_main_layout = new QVBoxLayout; m_progress_box = new QGroupBox; @@ -61,12 +61,12 @@ void MD5Dialog::CreateWidgets() setLayout(m_main_layout); } -void MD5Dialog::ConnectWidgets() +void GameDigestDialog::ConnectWidgets() { - connect(m_button_box, &QDialogButtonBox::rejected, this, &MD5Dialog::reject); + connect(m_button_box, &QDialogButtonBox::rejected, this, &GameDigestDialog::reject); } -void MD5Dialog::show(const QString& title) +void GameDigestDialog::show(const QString& title) { m_progress_box->setTitle(title); @@ -118,7 +118,7 @@ void MD5Dialog::show(const QString& title) QDialog::show(); } -void MD5Dialog::SetProgress(int pid, int progress) +void GameDigestDialog::SetProgress(int pid, int progress) { QString player_name = GetPlayerNameFromPID(pid); @@ -130,7 +130,7 @@ void MD5Dialog::SetProgress(int pid, int progress) m_progress_bars[pid]->setValue(progress); } -void MD5Dialog::SetResult(int pid, const std::string& result) +void GameDigestDialog::SetResult(int pid, const std::string& result) { QString player_name = GetPlayerNameFromPID(pid); @@ -162,12 +162,12 @@ void MD5Dialog::SetResult(int pid, const std::string& result) } } -void MD5Dialog::reject() +void GameDigestDialog::reject() { auto server = Settings::Instance().GetNetPlayServer(); if (server) - server->AbortMD5(); + server->AbortGameDigest(); QDialog::reject(); } diff --git a/Source/Core/DolphinQt/NetPlay/MD5Dialog.h b/Source/Core/DolphinQt/NetPlay/GameDigestDialog.h similarity index 84% rename from Source/Core/DolphinQt/NetPlay/MD5Dialog.h rename to Source/Core/DolphinQt/NetPlay/GameDigestDialog.h index d3078667df..684b239dab 100644 --- a/Source/Core/DolphinQt/NetPlay/MD5Dialog.h +++ b/Source/Core/DolphinQt/NetPlay/GameDigestDialog.h @@ -16,15 +16,15 @@ class QProgressBar; class QVBoxLayout; class QWidget; -class MD5Dialog : public QDialog +class GameDigestDialog : public QDialog { Q_OBJECT public: - explicit MD5Dialog(QWidget* parent); + explicit GameDigestDialog(QWidget* parent); void show(const QString& title); void SetProgress(int pid, int progress); - void SetResult(int pid, const std::string& md5); + void SetResult(int pid, const std::string& result); void reject() override; diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp index 4a297acea3..b994bd93f3 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp @@ -45,8 +45,8 @@ #include "Core/SyncIdentifier.h" #include "DolphinQt/NetPlay/ChunkedProgressDialog.h" +#include "DolphinQt/NetPlay/GameDigestDialog.h" #include "DolphinQt/NetPlay/GameListDialog.h" -#include "DolphinQt/NetPlay/MD5Dialog.h" #include "DolphinQt/NetPlay/PadMappingDialog.h" #include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/QueueOnObject.h" @@ -100,7 +100,7 @@ NetPlayDialog::NetPlayDialog(const GameListModel& game_list_model, setWindowIcon(Resources::GetAppIcon()); m_pad_mapping = new PadMappingDialog(this); - m_md5_dialog = new MD5Dialog(this); + m_game_digest_dialog = new GameDigestDialog(this); m_chunked_progress_dialog = new ChunkedProgressDialog(this); ResetExternalIP(); @@ -182,19 +182,20 @@ void NetPlayDialog::CreateMainLayout() m_network_mode_group->addAction(m_golf_mode_action); m_fixed_delay_action->setChecked(true); - m_md5_menu = m_menu_bar->addMenu(tr("Checksum")); - m_md5_menu->addAction(tr("Current game"), this, [this] { - Settings::Instance().GetNetPlayServer()->ComputeMD5(m_current_game_identifier); + m_game_digest_menu = m_menu_bar->addMenu(tr("Checksum")); + m_game_digest_menu->addAction(tr("Current game"), this, [this] { + Settings::Instance().GetNetPlayServer()->ComputeGameDigest(m_current_game_identifier); }); - m_md5_menu->addAction(tr("Other game..."), this, [this] { + m_game_digest_menu->addAction(tr("Other game..."), this, [this] { GameListDialog gld(m_game_list_model, this); if (gld.exec() != QDialog::Accepted) return; - Settings::Instance().GetNetPlayServer()->ComputeMD5(gld.GetSelectedGame().GetSyncIdentifier()); + Settings::Instance().GetNetPlayServer()->ComputeGameDigest( + gld.GetSelectedGame().GetSyncIdentifier()); }); - m_md5_menu->addAction(tr("SD Card"), this, [] { - Settings::Instance().GetNetPlayServer()->ComputeMD5( + m_game_digest_menu->addAction(tr("SD Card"), this, [] { + Settings::Instance().GetNetPlayServer()->ComputeGameDigest( NetPlay::NetPlayClient::GetSDCardIdentifier()); }); @@ -506,7 +507,7 @@ void NetPlayDialog::show(std::string nickname, bool use_traversal) m_data_menu->menuAction()->setVisible(is_hosting); m_network_menu->menuAction()->setVisible(is_hosting); - m_md5_menu->menuAction()->setVisible(is_hosting); + m_game_digest_menu->menuAction()->setVisible(is_hosting); #ifdef HAS_LIBMGBA m_hide_remote_gbas_action->setVisible(is_hosting); #else @@ -1175,39 +1176,39 @@ void NetPlayDialog::SaveSettings() Config::SetBase(Config::NETPLAY_NETWORK_MODE, network_mode); } -void NetPlayDialog::ShowMD5Dialog(const std::string& title) +void NetPlayDialog::ShowGameDigestDialog(const std::string& title) { QueueOnObject(this, [this, title] { - m_md5_menu->setEnabled(false); + m_game_digest_menu->setEnabled(false); - if (m_md5_dialog->isVisible()) - m_md5_dialog->close(); + if (m_game_digest_dialog->isVisible()) + m_game_digest_dialog->close(); - m_md5_dialog->show(QString::fromStdString(title)); + m_game_digest_dialog->show(QString::fromStdString(title)); }); } -void NetPlayDialog::SetMD5Progress(int pid, int progress) +void NetPlayDialog::SetGameDigestProgress(int pid, int progress) { QueueOnObject(this, [this, pid, progress] { - if (m_md5_dialog->isVisible()) - m_md5_dialog->SetProgress(pid, progress); + if (m_game_digest_dialog->isVisible()) + m_game_digest_dialog->SetProgress(pid, progress); }); } -void NetPlayDialog::SetMD5Result(int pid, const std::string& result) +void NetPlayDialog::SetGameDigestResult(int pid, const std::string& result) { QueueOnObject(this, [this, pid, result] { - m_md5_dialog->SetResult(pid, result); - m_md5_menu->setEnabled(true); + m_game_digest_dialog->SetResult(pid, result); + m_game_digest_menu->setEnabled(true); }); } -void NetPlayDialog::AbortMD5() +void NetPlayDialog::AbortGameDigest() { QueueOnObject(this, [this] { - m_md5_dialog->close(); - m_md5_menu->setEnabled(true); + m_game_digest_dialog->close(); + m_game_digest_menu->setEnabled(true); }); } diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h index 03111925bd..273cd76199 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h @@ -17,7 +17,7 @@ class BootSessionData; class ChunkedProgressDialog; -class MD5Dialog; +class GameDigestDialog; class PadMappingDialog; class QCheckBox; class QComboBox; @@ -85,10 +85,10 @@ public: void LoadSettings(); void SaveSettings(); - void ShowMD5Dialog(const std::string& title) override; - void SetMD5Progress(int pid, int progress) override; - void SetMD5Result(int pid, const std::string& result) override; - void AbortMD5() override; + void ShowGameDigestDialog(const std::string& title) override; + void SetGameDigestProgress(int pid, int progress) override; + void SetGameDigestResult(int pid, const std::string& result) override; + void AbortGameDigest() override; void ShowChunkedProgressDialog(const std::string& title, u64 data_size, const std::vector& players) override; @@ -136,7 +136,7 @@ private: QMenuBar* m_menu_bar; QMenu* m_data_menu; QMenu* m_network_menu; - QMenu* m_md5_menu; + QMenu* m_game_digest_menu; QMenu* m_other_menu; QPushButton* m_game_button; QPushButton* m_start_button; @@ -159,7 +159,7 @@ private: QActionGroup* m_network_mode_group; QGridLayout* m_main_layout; - MD5Dialog* m_md5_dialog; + GameDigestDialog* m_game_digest_dialog; ChunkedProgressDialog* m_chunked_progress_dialog; PadMappingDialog* m_pad_mapping; NetPlay::SyncIdentifier m_current_game_identifier;