2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2009-07-06 02:10:26 +00:00
|
|
|
|
|
|
|
#include <string>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <vector>
|
2009-07-06 02:10:26 +00:00
|
|
|
#include <wx/dialog.h>
|
2014-02-19 01:56:29 +00:00
|
|
|
#include <wx/event.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/frame.h>
|
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/FifoQueue.h"
|
|
|
|
#include "Core/NetPlayClient.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Core/NetPlayProto.h"
|
|
|
|
|
|
|
|
class CGameListCtrl;
|
|
|
|
class wxButton;
|
|
|
|
class wxCheckBox;
|
|
|
|
class wxChoice;
|
|
|
|
class wxListBox;
|
|
|
|
class wxString;
|
|
|
|
class wxTextCtrl;
|
|
|
|
class wxWindow;
|
2011-02-08 15:36:15 +00:00
|
|
|
|
2010-05-02 23:01:50 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
NP_GUI_EVT_CHANGE_GAME = 45,
|
|
|
|
NP_GUI_EVT_START_GAME,
|
|
|
|
NP_GUI_EVT_STOP_GAME,
|
|
|
|
};
|
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
class NetPlaySetupDiag : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
2010-05-02 23:01:50 +00:00
|
|
|
NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list);
|
2010-06-06 03:52:11 +00:00
|
|
|
~NetPlaySetupDiag();
|
2010-05-01 19:10:35 +00:00
|
|
|
private:
|
|
|
|
void OnJoin(wxCommandEvent& event);
|
|
|
|
void OnHost(wxCommandEvent& event);
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2013-07-22 08:21:56 +00:00
|
|
|
void MakeNetPlayDiag(int port, const std::string &game, bool is_hosting);
|
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
wxTextCtrl* m_nickname_text;
|
|
|
|
wxTextCtrl* m_host_port_text;
|
|
|
|
wxTextCtrl* m_connect_port_text;
|
|
|
|
wxTextCtrl* m_connect_ip_text;
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
wxListBox* m_game_lbox;
|
2013-07-09 00:13:02 +00:00
|
|
|
#ifdef USE_UPNP
|
2014-02-17 04:51:41 +00:00
|
|
|
wxCheckBox* m_upnp_chk;
|
2013-07-09 00:13:02 +00:00
|
|
|
#endif
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
const CGameListCtrl* const m_game_list;
|
2009-07-06 02:10:26 +00:00
|
|
|
};
|
|
|
|
|
2011-02-08 15:36:15 +00:00
|
|
|
class NetPlayDiag : public wxFrame, public NetPlayUI
|
2009-07-06 02:10:26 +00:00
|
|
|
{
|
2010-05-01 19:10:35 +00:00
|
|
|
public:
|
2010-05-02 23:01:50 +00:00
|
|
|
NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game_list
|
2010-05-01 19:10:35 +00:00
|
|
|
, const std::string& game, const bool is_hosting = false);
|
|
|
|
~NetPlayDiag();
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
Common::FifoQueue<std::string> chat_msgs;
|
2010-05-01 19:10:35 +00:00
|
|
|
|
|
|
|
void OnStart(wxCommandEvent& event);
|
|
|
|
|
2011-02-08 15:36:15 +00:00
|
|
|
// implementation of NetPlayUI methods
|
2014-03-08 00:54:44 +00:00
|
|
|
void BootGame(const std::string& filename) override;
|
|
|
|
void StopGame() override;
|
2011-02-08 15:36:15 +00:00
|
|
|
|
2014-03-08 00:54:44 +00:00
|
|
|
void Update() override;
|
|
|
|
void AppendChat(const std::string& msg) override;
|
2011-02-08 15:36:15 +00:00
|
|
|
|
2014-03-08 00:54:44 +00:00
|
|
|
void OnMsgChangeGame(const std::string& filename) override;
|
|
|
|
void OnMsgStartGame() override;
|
|
|
|
void OnMsgStopGame() override;
|
2011-02-08 15:36:15 +00:00
|
|
|
|
2011-02-27 02:27:43 +00:00
|
|
|
static NetPlayDiag *&GetInstance() { return npd; };
|
|
|
|
|
2014-03-08 00:54:44 +00:00
|
|
|
bool IsRecording() override;
|
2013-09-03 19:50:41 +00:00
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
void OnChat(wxCommandEvent& event);
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
|
|
|
void OnThread(wxCommandEvent& event);
|
2010-05-02 23:01:50 +00:00
|
|
|
void OnChangeGame(wxCommandEvent& event);
|
2010-05-05 04:31:21 +00:00
|
|
|
void OnAdjustBuffer(wxCommandEvent& event);
|
2010-06-06 03:52:11 +00:00
|
|
|
void OnConfigPads(wxCommandEvent& event);
|
2013-07-22 08:21:56 +00:00
|
|
|
void GetNetSettings(NetSettings &settings);
|
2013-08-13 18:47:32 +00:00
|
|
|
std::string FindGame();
|
2010-05-01 19:10:35 +00:00
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
wxListBox* m_player_lbox;
|
|
|
|
wxTextCtrl* m_chat_text;
|
|
|
|
wxTextCtrl* m_chat_msg_text;
|
|
|
|
wxCheckBox* m_memcard_write;
|
|
|
|
wxCheckBox* m_record_chkbox;
|
2010-05-01 19:10:35 +00:00
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
std::string m_selected_game;
|
|
|
|
wxButton* m_game_btn;
|
|
|
|
wxButton* m_start_btn;
|
2010-05-01 19:10:35 +00:00
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
std::vector<int> m_playerids;
|
2010-06-06 03:52:11 +00:00
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
const CGameListCtrl* const m_game_list;
|
2011-02-27 02:27:43 +00:00
|
|
|
|
|
|
|
static NetPlayDiag* npd;
|
2009-07-06 02:10:26 +00:00
|
|
|
};
|
|
|
|
|
2010-05-02 23:01:50 +00:00
|
|
|
class ChangeGameDiag : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ChangeGameDiag(wxWindow* const parent, const CGameListCtrl* const game_list, wxString& game_name);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnPick(wxCommandEvent& event);
|
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
wxListBox* m_game_lbox;
|
|
|
|
wxString& m_game_name;
|
2010-05-02 23:01:50 +00:00
|
|
|
};
|
|
|
|
|
2010-06-06 03:52:11 +00:00
|
|
|
class PadMapDiag : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
2013-09-22 18:27:52 +00:00
|
|
|
PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiimotemap[], std::vector<const Player *>& player_list);
|
2010-06-06 03:52:11 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void OnAdjust(wxCommandEvent& event);
|
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
wxChoice* m_map_cbox[8];
|
2013-08-18 13:43:01 +00:00
|
|
|
PadMapping* const m_mapping;
|
2013-09-22 18:27:52 +00:00
|
|
|
PadMapping* const m_wiimapping;
|
2013-08-18 13:43:01 +00:00
|
|
|
std::vector<const Player *>& m_player_list;
|
2010-06-06 03:52:11 +00:00
|
|
|
};
|
|
|
|
|
2013-08-14 21:50:21 +00:00
|
|
|
namespace NetPlay
|
|
|
|
{
|
|
|
|
void StopGame();
|
|
|
|
}
|