NetPlay: rename md5 -> game digest

This commit is contained in:
Shawn Hoffman 2022-07-27 18:43:16 -07:00
parent 7d2d5d914b
commit c7ce035a7f
11 changed files with 169 additions and 168 deletions

View File

@ -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();
@ -442,24 +442,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:
@ -1419,48 +1419,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)
@ -2469,13 +2469,13 @@ static std::string MD5Sum(const std::string& file_path, std::function<bool(int)>
return fmt::format("{:02x}", fmt::join(output, ""));
}
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())
@ -2486,26 +2486,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]() {
if (m_game_digest_thread.joinable())
m_game_digest_thread.join();
m_game_digest_thread = std::thread([this, file]() {
std::string sum = MD5Sum(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));
});

View File

@ -73,10 +73,10 @@ public:
SyncIdentifierComparison* found = nullptr) = 0;
virtual std::string FindGBARomPath(const std::array<u8, 20>& 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;

View File

@ -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,

View File

@ -1068,13 +1068,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;
@ -1082,13 +1082,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;
@ -1096,13 +1096,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;
@ -1252,10 +1252,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));
@ -1264,10 +1264,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;

View File

@ -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;

View File

@ -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)

View File

@ -156,8 +156,8 @@
<ClCompile Include="MainWindow.cpp" />
<ClCompile Include="MenuBar.cpp" />
<ClCompile Include="NetPlay\ChunkedProgressDialog.cpp" />
<ClCompile Include="NetPlay\GameDigestDialog.cpp" />
<ClCompile Include="NetPlay\GameListDialog.cpp" />
<ClCompile Include="NetPlay\MD5Dialog.cpp" />
<ClCompile Include="NetPlay\NetPlayBrowser.cpp" />
<ClCompile Include="NetPlay\NetPlayDialog.cpp" />
<ClCompile Include="NetPlay\NetPlaySetupDialog.cpp" />
@ -345,8 +345,8 @@
<QtMoc Include="MainWindow.h" />
<QtMoc Include="MenuBar.h" />
<QtMoc Include="NetPlay\ChunkedProgressDialog.h" />
<QtMoc Include="NetPlay\GameDigestDialog.h" />
<QtMoc Include="NetPlay\GameListDialog.h" />
<QtMoc Include="NetPlay\MD5Dialog.h" />
<QtMoc Include="NetPlay\NetPlayBrowser.h" />
<QtMoc Include="NetPlay\NetPlayDialog.h" />
<QtMoc Include="NetPlay\NetPlaySetupDialog.h" />

View File

@ -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 <algorithm>
#include <functional>
@ -36,7 +36,7 @@ static QString GetPlayerNameFromPID(int pid)
return player_name;
}
MD5Dialog::MD5Dialog(QWidget* parent) : QDialog(parent)
GameDigestDialog::GameDigestDialog(QWidget* parent) : QDialog(parent)
{
CreateWidgets();
ConnectWidgets();
@ -45,7 +45,7 @@ MD5Dialog::MD5Dialog(QWidget* parent) : QDialog(parent)
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();
}

View File

@ -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;

View File

@ -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);
});
}

View File

@ -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<int>& 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;