| 
									
										
										
										
											2013-04-17 23:43:35 -04: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 13:54:46 -05:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2009-07-06 02:10:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							| 
									
										
										
										
											2014-02-22 23:36:30 +01:00
										 |  |  | #include <vector>
 | 
					
						
							| 
									
										
										
										
											2009-07-06 02:10:26 +00:00
										 |  |  | #include <wx/dialog.h>
 | 
					
						
							| 
									
										
										
										
											2014-02-19 02:56:29 +01:00
										 |  |  | #include <wx/event.h>
 | 
					
						
							| 
									
										
										
										
											2014-02-22 23:36:30 +01:00
										 |  |  | #include <wx/frame.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-17 05:18:15 -05:00
										 |  |  | #include "Common/FifoQueue.h"
 | 
					
						
							|  |  |  | #include "Core/NetPlayClient.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-22 23:36:30 +01: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 04:21:56 -04:00
										 |  |  | 	void MakeNetPlayDiag(int port, const std::string &game, bool is_hosting); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-02 01:56:53 -08:00
										 |  |  | 	void OnChoice(wxCommandEvent& event); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	wxStaticText* m_ip_lbl; | 
					
						
							|  |  |  | 	wxStaticText* m_client_port_lbl; | 
					
						
							|  |  |  | 	wxTextCtrl*   m_nickname_text; | 
					
						
							|  |  |  | 	wxStaticText* m_host_port_lbl; | 
					
						
							|  |  |  | 	wxTextCtrl*   m_host_port_text; | 
					
						
							|  |  |  | 	wxTextCtrl*   m_connect_port_text; | 
					
						
							|  |  |  | 	wxTextCtrl*   m_connect_ip_text; | 
					
						
							|  |  |  | 	wxChoice*     m_direct_traversal; | 
					
						
							| 
									
										
										
										
											2009-07-06 02:10:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-16 23:51:41 -05:00
										 |  |  | 	wxListBox*  m_game_lbox; | 
					
						
							| 
									
										
										
										
											2013-07-08 20:13:02 -04:00
										 |  |  | #ifdef USE_UPNP
 | 
					
						
							| 
									
										
										
										
											2014-02-16 23:51:41 -05:00
										 |  |  | 	wxCheckBox* m_upnp_chk; | 
					
						
							| 
									
										
										
										
											2013-07-08 20:13:02 -04: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-16 23:51:41 -05: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 01:54:44 +01:00
										 |  |  | 	void BootGame(const std::string& filename) override; | 
					
						
							|  |  |  | 	void StopGame() override; | 
					
						
							| 
									
										
										
										
											2011-02-08 15:36:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-08 01:54:44 +01:00
										 |  |  | 	void Update() override; | 
					
						
							|  |  |  | 	void AppendChat(const std::string& msg) override; | 
					
						
							| 
									
										
										
										
											2011-02-08 15:36:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-08 01:54:44 +01: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 01:54:44 +01:00
										 |  |  | 	bool IsRecording() override; | 
					
						
							| 
									
										
										
										
											2013-09-03 15:50:41 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-01 19:10:35 +00:00
										 |  |  | private: | 
					
						
							|  |  |  | 	void OnChat(wxCommandEvent& event); | 
					
						
							|  |  |  | 	void OnQuit(wxCommandEvent& event); | 
					
						
							| 
									
										
										
										
											2014-11-10 23:28:09 -05:00
										 |  |  | 	void OnThread(wxThreadEvent& 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); | 
					
						
							| 
									
										
										
										
											2014-05-29 18:59:07 -04:00
										 |  |  | 	void OnKick(wxCommandEvent& event); | 
					
						
							|  |  |  | 	void OnPlayerSelect(wxCommandEvent& event); | 
					
						
							| 
									
										
										
										
											2013-07-22 04:21:56 -04:00
										 |  |  | 	void GetNetSettings(NetSettings &settings); | 
					
						
							| 
									
										
										
										
											2013-08-13 14:47:32 -04:00
										 |  |  | 	std::string FindGame(); | 
					
						
							| 
									
										
										
										
											2010-05-01 19:10:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-02 01:56:53 -08:00
										 |  |  | 	void OnCopyIP(wxCommandEvent&); | 
					
						
							|  |  |  | 	void OnChoice(wxCommandEvent& event); | 
					
						
							|  |  |  | 	void UpdateHostLabel(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	wxListBox*    m_player_lbox; | 
					
						
							|  |  |  | 	wxTextCtrl*   m_chat_text; | 
					
						
							| 
									
										
										
										
											2015-02-02 02:08:58 -08:00
										 |  |  | 	wxTextCtrl*   m_chat_msg_text; | 
					
						
							|  |  |  | 	wxCheckBox*   m_memcard_write; | 
					
						
							| 
									
										
										
										
											2015-02-02 01:56:53 -08:00
										 |  |  | 	wxCheckBox*   m_record_chkbox; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	std::string   m_selected_game; | 
					
						
							|  |  |  | 	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 19:10:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-16 23:51:41 -05: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-16 23:51:41 -05: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 14:27:52 -04: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-16 23:51:41 -05:00
										 |  |  | 	wxChoice* m_map_cbox[8]; | 
					
						
							| 
									
										
										
										
											2013-08-18 09:43:01 -04:00
										 |  |  | 	PadMapping* const m_mapping; | 
					
						
							| 
									
										
										
										
											2013-09-22 14:27:52 -04:00
										 |  |  | 	PadMapping* const m_wiimapping; | 
					
						
							| 
									
										
										
										
											2013-08-18 09:43:01 -04:00
										 |  |  | 	std::vector<const Player *>& m_player_list; | 
					
						
							| 
									
										
										
										
											2010-06-06 03:52:11 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-14 17:50:21 -04:00
										 |  |  | namespace NetPlay | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	void StopGame(); | 
					
						
							|  |  |  | } |