2016-10-03 12:35:27 +00:00
|
|
|
// Copyright 2016 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2016-11-11 19:58:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
2016-10-03 12:35:27 +00:00
|
|
|
#include <string>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Common/IniFile.h"
|
|
|
|
|
2017-06-19 09:20:14 +00:00
|
|
|
class GameListCtrl;
|
2016-10-03 22:57:32 +00:00
|
|
|
class wxRect;
|
2016-10-03 12:35:27 +00:00
|
|
|
class wxWindow;
|
|
|
|
|
|
|
|
class NetPlayLaunchConfig
|
|
|
|
{
|
|
|
|
public:
|
2016-10-03 22:57:32 +00:00
|
|
|
static std::string GetTraversalHostFromIniConfig(const IniFile::Section& netplay_section);
|
|
|
|
static u16 GetTraversalPortFromIniConfig(const IniFile::Section& netplay_section);
|
|
|
|
void SetDialogInfo(const IniFile::Section& section, wxWindow* parent);
|
2016-10-03 12:35:27 +00:00
|
|
|
|
|
|
|
static const std::string DEFAULT_TRAVERSAL_HOST;
|
2016-10-03 22:57:32 +00:00
|
|
|
static constexpr u16 DEFAULT_TRAVERSAL_PORT = 6262;
|
|
|
|
const wxRect window_defaults{wxDefaultCoord, wxDefaultCoord, 768, 768 - 128};
|
2016-10-03 12:35:27 +00:00
|
|
|
|
|
|
|
std::string player_name;
|
2017-06-19 09:20:14 +00:00
|
|
|
const GameListCtrl* game_list_ctrl;
|
2016-10-03 12:35:27 +00:00
|
|
|
wxWindow* parent_window;
|
|
|
|
bool use_traversal;
|
|
|
|
std::string traversal_host;
|
|
|
|
u16 traversal_port;
|
2016-10-03 22:57:32 +00:00
|
|
|
wxRect window_pos{window_defaults};
|
2016-10-03 12:35:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class NetPlayHostConfig : public NetPlayLaunchConfig
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void FromIniConfig(IniFile::Section& netplay_section);
|
|
|
|
|
2016-10-03 22:57:32 +00:00
|
|
|
static constexpr u16 DEFAULT_LISTEN_PORT = 2626;
|
2016-10-03 12:35:27 +00:00
|
|
|
|
|
|
|
std::string game_name;
|
|
|
|
u16 listen_port = 0;
|
2016-11-19 15:36:26 +00:00
|
|
|
#ifdef USE_UPNP
|
2016-10-03 12:35:27 +00:00
|
|
|
bool forward_port;
|
2016-11-19 15:36:26 +00:00
|
|
|
#endif
|
2016-10-03 12:35:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class NetPlayJoinConfig : public NetPlayLaunchConfig
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string connect_host;
|
|
|
|
u16 connect_port;
|
|
|
|
std::string connect_hash_code;
|
|
|
|
};
|
|
|
|
|
|
|
|
class NetPlayLauncher
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static bool Host(const NetPlayHostConfig& config);
|
|
|
|
static bool Join(const NetPlayJoinConfig& config);
|
2016-11-19 15:36:26 +00:00
|
|
|
};
|