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