2015-05-24 07:55:12 +03:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2015-05-18 02:08:10 +03:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 06:43:35 +03:00
|
|
|
// Refer to the license.txt file included.
|
2009-07-06 05:10:26 +03:00
|
|
|
|
2014-02-10 20:54:46 +02:00
|
|
|
#pragma once
|
2009-07-06 05:10:26 +03:00
|
|
|
|
|
|
|
#include <string>
|
2014-02-23 00:36:30 +02:00
|
|
|
#include <vector>
|
|
|
|
#include <wx/frame.h>
|
|
|
|
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "Common/FifoQueue.h"
|
|
|
|
#include "Core/NetPlayClient.h"
|
2014-02-23 00:36:30 +02:00
|
|
|
#include "Core/NetPlayProto.h"
|
2015-04-11 08:24:45 +03:00
|
|
|
#include "Core/NetPlayServer.h"
|
2014-02-23 00:36:30 +02:00
|
|
|
|
|
|
|
class CGameListCtrl;
|
|
|
|
class wxButton;
|
|
|
|
class wxCheckBox;
|
|
|
|
class wxChoice;
|
|
|
|
class wxListBox;
|
|
|
|
class wxString;
|
2015-04-11 08:24:45 +03:00
|
|
|
class wxStaticText;
|
2014-02-23 00:36:30 +02:00
|
|
|
class wxTextCtrl;
|
2011-02-08 17:36:15 +02:00
|
|
|
|
2010-05-03 02:01:50 +03:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
NP_GUI_EVT_CHANGE_GAME = 45,
|
|
|
|
NP_GUI_EVT_START_GAME,
|
|
|
|
NP_GUI_EVT_STOP_GAME,
|
|
|
|
};
|
|
|
|
|
2015-04-11 08:24:45 +03:00
|
|
|
enum
|
2010-05-01 22:10:35 +03:00
|
|
|
{
|
2015-04-11 08:24:45 +03:00
|
|
|
INITIAL_PAD_BUFFER_SIZE = 5
|
2009-07-06 05:10:26 +03:00
|
|
|
};
|
|
|
|
|
2015-04-11 08:24:45 +03:00
|
|
|
class NetPlayDialog : public wxFrame, public NetPlayUI
|
2009-07-06 05:10:26 +03:00
|
|
|
{
|
2010-05-01 22:10:35 +03:00
|
|
|
public:
|
2015-04-11 08:24:45 +03:00
|
|
|
NetPlayDialog(wxWindow* parent, const CGameListCtrl* const game_list
|
2010-05-01 22:10:35 +03:00
|
|
|
, const std::string& game, const bool is_hosting = false);
|
2015-04-11 08:24:45 +03:00
|
|
|
~NetPlayDialog();
|
2009-07-06 05:10:26 +03:00
|
|
|
|
2014-02-17 06:51:41 +02:00
|
|
|
Common::FifoQueue<std::string> chat_msgs;
|
2010-05-01 22:10:35 +03:00
|
|
|
|
|
|
|
void OnStart(wxCommandEvent& event);
|
|
|
|
|
2011-02-08 17:36:15 +02:00
|
|
|
// implementation of NetPlayUI methods
|
2014-03-08 02:54:44 +02:00
|
|
|
void BootGame(const std::string& filename) override;
|
|
|
|
void StopGame() override;
|
2011-02-08 17:36:15 +02:00
|
|
|
|
2014-03-08 02:54:44 +02:00
|
|
|
void Update() override;
|
|
|
|
void AppendChat(const std::string& msg) override;
|
2011-02-08 17:36:15 +02:00
|
|
|
|
2014-03-08 02:54:44 +02:00
|
|
|
void OnMsgChangeGame(const std::string& filename) override;
|
|
|
|
void OnMsgStartGame() override;
|
|
|
|
void OnMsgStopGame() override;
|
2011-02-08 17:36:15 +02:00
|
|
|
|
2015-04-11 08:24:45 +03:00
|
|
|
static NetPlayDialog*& GetInstance() { return npd; }
|
|
|
|
static NetPlayClient*& GetNetPlayClient() { return netplay_client; }
|
|
|
|
static NetPlayServer*& GetNetPlayServer() { return netplay_server; }
|
|
|
|
static void FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list);
|
2011-02-27 04:27:43 +02:00
|
|
|
|
2014-03-08 02:54:44 +02:00
|
|
|
bool IsRecording() override;
|
2013-09-03 22:50:41 +03:00
|
|
|
|
2010-05-01 22:10:35 +03:00
|
|
|
private:
|
|
|
|
void OnChat(wxCommandEvent& event);
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
2014-11-11 06:28:09 +02:00
|
|
|
void OnThread(wxThreadEvent& event);
|
2010-05-03 02:01:50 +03:00
|
|
|
void OnChangeGame(wxCommandEvent& event);
|
2010-05-05 07:31:21 +03:00
|
|
|
void OnAdjustBuffer(wxCommandEvent& event);
|
2015-09-03 14:34:31 +03:00
|
|
|
void OnAssignPads(wxCommandEvent& event);
|
2014-05-30 01:59:07 +03:00
|
|
|
void OnKick(wxCommandEvent& event);
|
|
|
|
void OnPlayerSelect(wxCommandEvent& event);
|
2015-04-11 08:24:45 +03:00
|
|
|
void GetNetSettings(NetSettings& settings);
|
2013-08-13 21:47:32 +03:00
|
|
|
std::string FindGame();
|
2010-05-01 22:10:35 +03:00
|
|
|
|
2015-02-02 11:56:53 +02:00
|
|
|
void OnCopyIP(wxCommandEvent&);
|
|
|
|
void OnChoice(wxCommandEvent& event);
|
|
|
|
void UpdateHostLabel();
|
|
|
|
|
|
|
|
wxListBox* m_player_lbox;
|
|
|
|
wxTextCtrl* m_chat_text;
|
2015-02-02 12:08:58 +02:00
|
|
|
wxTextCtrl* m_chat_msg_text;
|
|
|
|
wxCheckBox* m_memcard_write;
|
2015-02-02 11:56:53 +02:00
|
|
|
wxCheckBox* m_record_chkbox;
|
|
|
|
|
|
|
|
std::string m_selected_game;
|
2015-03-27 19:41:27 +02:00
|
|
|
wxButton* m_player_config_btn;
|
2015-02-02 11:56:53 +02:00
|
|
|
wxButton* m_game_btn;
|
|
|
|
wxButton* m_start_btn;
|
|
|
|
wxButton* m_kick_btn;
|
|
|
|
wxStaticText* m_host_label;
|
|
|
|
wxChoice* m_host_type_choice;
|
|
|
|
wxButton* m_host_copy_btn;
|
|
|
|
bool m_host_copy_btn_is_retry;
|
|
|
|
bool m_is_hosting;
|
2010-05-01 22:10:35 +03:00
|
|
|
|
2014-02-17 06:51:41 +02:00
|
|
|
std::vector<int> m_playerids;
|
2010-06-06 06:52:11 +03:00
|
|
|
|
2010-05-01 22:10:35 +03:00
|
|
|
const CGameListCtrl* const m_game_list;
|
2011-02-27 04:27:43 +02:00
|
|
|
|
2015-04-11 08:24:45 +03:00
|
|
|
static NetPlayDialog* npd;
|
|
|
|
static NetPlayServer* netplay_server;
|
|
|
|
static NetPlayClient* netplay_client;
|
2010-05-03 02:01:50 +03:00
|
|
|
};
|