mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
NetPlay: Refactor game boot code path to allow passing BootSessionData through it.
This commit is contained in:
@ -31,6 +31,7 @@
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/TraversalClient.h"
|
||||
|
||||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/NetplaySettings.h"
|
||||
@ -62,8 +63,10 @@
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
NetPlayDialog::NetPlayDialog(const GameListModel& game_list_model, QWidget* parent)
|
||||
: QDialog(parent), m_game_list_model(game_list_model)
|
||||
NetPlayDialog::NetPlayDialog(const GameListModel& game_list_model,
|
||||
StartGameCallback start_game_callback, QWidget* parent)
|
||||
: QDialog(parent), m_game_list_model(game_list_model),
|
||||
m_start_game_callback(std::move(start_game_callback))
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
@ -682,10 +685,11 @@ void NetPlayDialog::UpdateGUI()
|
||||
|
||||
// NetPlayUI methods
|
||||
|
||||
void NetPlayDialog::BootGame(const std::string& filename)
|
||||
void NetPlayDialog::BootGame(const std::string& filename,
|
||||
std::unique_ptr<BootSessionData> boot_session_data)
|
||||
{
|
||||
m_got_stop_request = false;
|
||||
emit Boot(QString::fromStdString(filename));
|
||||
m_start_game_callback(filename, std::move(boot_session_data));
|
||||
}
|
||||
|
||||
void NetPlayDialog::StopGame()
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMenuBar>
|
||||
|
||||
@ -11,6 +15,7 @@
|
||||
#include "DolphinQt/GameList/GameListModel.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
|
||||
class BootSessionData;
|
||||
class ChunkedProgressDialog;
|
||||
class MD5Dialog;
|
||||
class PadMappingDialog;
|
||||
@ -30,14 +35,19 @@ class NetPlayDialog : public QDialog, public NetPlay::NetPlayUI
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NetPlayDialog(const GameListModel& game_list_model, QWidget* parent = nullptr);
|
||||
using StartGameCallback = std::function<void(const std::string& path,
|
||||
std::unique_ptr<BootSessionData> boot_session_data)>;
|
||||
|
||||
explicit NetPlayDialog(const GameListModel& game_list_model,
|
||||
StartGameCallback start_game_callback, QWidget* parent = nullptr);
|
||||
~NetPlayDialog();
|
||||
|
||||
void show(std::string nickname, bool use_traversal);
|
||||
void reject() override;
|
||||
|
||||
// NetPlayUI methods
|
||||
void BootGame(const std::string& filename) override;
|
||||
void BootGame(const std::string& filename,
|
||||
std::unique_ptr<BootSessionData> boot_session_data) override;
|
||||
void StopGame() override;
|
||||
bool IsHosting() const override;
|
||||
|
||||
@ -85,7 +95,6 @@ public:
|
||||
void HideChunkedProgressDialog() override;
|
||||
void SetChunkedProgress(int pid, u64 progress) override;
|
||||
signals:
|
||||
void Boot(const QString& filename);
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
@ -162,4 +171,6 @@ private:
|
||||
int m_player_count = 0;
|
||||
int m_old_player_count = 0;
|
||||
bool m_host_input_authority = false;
|
||||
|
||||
StartGameCallback m_start_game_callback;
|
||||
};
|
||||
|
Reference in New Issue
Block a user