2013-07-22 02:21:56 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-07-22 02:21:56 -06:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2015-08-15 22:08:09 -06:00
|
|
|
#include <array>
|
2015-05-08 15:28:03 -06:00
|
|
|
#include <vector>
|
2014-09-07 19:06:58 -06:00
|
|
|
#include "Common/CommonTypes.h"
|
2017-01-20 13:33:43 -07:00
|
|
|
#include "Core/HW/EXI/EXI_Device.h"
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2018-07-04 15:01:50 -06:00
|
|
|
namespace IOS::HLE::FS
|
|
|
|
{
|
|
|
|
class FileSystem;
|
|
|
|
}
|
2018-06-15 06:11:18 -06:00
|
|
|
namespace PowerPC
|
|
|
|
{
|
|
|
|
enum class CPUCore;
|
|
|
|
}
|
|
|
|
|
2018-07-06 17:39:42 -06:00
|
|
|
namespace NetPlay
|
|
|
|
{
|
2013-07-22 02:21:56 -06:00
|
|
|
struct NetSettings
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
bool m_CPUthread;
|
2018-06-15 06:11:18 -06:00
|
|
|
PowerPC::CPUCore m_CPUcore;
|
2016-07-04 17:48:04 -06:00
|
|
|
bool m_EnableCheats;
|
2016-06-24 02:43:46 -06:00
|
|
|
int m_SelectedLanguage;
|
|
|
|
bool m_OverrideGCLanguage;
|
|
|
|
bool m_ProgressiveScan;
|
|
|
|
bool m_PAL60;
|
|
|
|
bool m_DSPHLE;
|
|
|
|
bool m_DSPEnableJIT;
|
|
|
|
bool m_WriteToMemcard;
|
2016-12-23 18:37:23 -07:00
|
|
|
bool m_CopyWiiSave;
|
2018-06-29 14:48:30 -06:00
|
|
|
bool m_ReducePollingRate;
|
2016-06-24 02:43:46 -06:00
|
|
|
bool m_OCEnable;
|
|
|
|
float m_OCFactor;
|
2017-03-18 15:46:05 -06:00
|
|
|
ExpansionInterface::TEXIDevices m_EXIDevice[2];
|
2018-07-19 16:10:37 -06:00
|
|
|
bool m_EFBAccessEnable;
|
|
|
|
bool m_BBoxEnable;
|
|
|
|
bool m_ForceProgressive;
|
|
|
|
bool m_EFBToTextureEnable;
|
|
|
|
bool m_XFBToTextureEnable;
|
|
|
|
bool m_DisableCopyToVRAM;
|
|
|
|
bool m_ImmediateXFBEnable;
|
|
|
|
bool m_EFBEmulateFormatChanges;
|
|
|
|
int m_SafeTextureCacheColorSamples;
|
|
|
|
bool m_PerfQueriesEnable;
|
|
|
|
bool m_FPRF;
|
|
|
|
bool m_AccurateNaNs;
|
|
|
|
bool m_SyncOnSkipIdle;
|
|
|
|
bool m_SyncGPU;
|
|
|
|
int m_SyncGpuMaxDistance;
|
|
|
|
int m_SyncGpuMinDistance;
|
|
|
|
float m_SyncGpuOverclock;
|
|
|
|
bool m_JITFollowBranch;
|
|
|
|
bool m_FastDiscSpeed;
|
|
|
|
bool m_MMU;
|
|
|
|
bool m_Fastmem;
|
|
|
|
bool m_SkipIPL;
|
|
|
|
bool m_LoadIPLDump;
|
|
|
|
bool m_VertexRounding;
|
|
|
|
int m_InternalResolution;
|
|
|
|
bool m_EFBScaledCopy;
|
|
|
|
bool m_FastDepthCalc;
|
|
|
|
bool m_EnablePixelLighting;
|
|
|
|
bool m_WidescreenHack;
|
|
|
|
bool m_ForceFiltering;
|
|
|
|
int m_MaxAnisotropy;
|
|
|
|
bool m_ForceTrueColor;
|
|
|
|
bool m_DisableCopyFilter;
|
|
|
|
bool m_DisableFog;
|
|
|
|
bool m_ArbitraryMipmapDetection;
|
|
|
|
float m_ArbitraryMipmapDetectionThreshold;
|
|
|
|
bool m_EnableGPUTextureDecoding;
|
|
|
|
bool m_StrictSettingsSync;
|
2018-07-04 15:01:50 -06:00
|
|
|
bool m_SyncSaveData;
|
|
|
|
std::string m_SaveDataRegion;
|
|
|
|
bool m_IsHosting;
|
NetPlay host input authority mode
Currently, each player buffers their own inputs and sends them to the
host. The host then relays those inputs to everyone else. Every player
waits on inputs from all players to be buffered before continuing. What
this means is all clients run in lockstep, and the total latency of
inputs cannot be lower than the sum of the 2 highest client ping times
in the game (in 3+ player sessions with people across the world, the
latency can be very high).
Host input authority mode changes it so players no longer buffer their
own inputs, and only send them to the host. The host stores only the
most recent input received from a player. The host then sends inputs
for all pads at the SI poll interval, similar to the existing code. If
a player sends inputs to slowly, their last received input is simply
sent again. If they send too quickly, inputs are dropped. This means
that the host has full control over what inputs are actually read by
the game, hence the name of the mode. Also, because the rate at which
inputs are received by SI is decoupled from the rate at which players
are sending inputs, clients are no longer dependent on each other. They
only care what the host is doing. This means that they can set their
buffer individually based on their latency to the host, rather than the
highest latency between any 2 players, allowing someone with lower ping
to the host to have less latency than someone else.
This is a catch to this: as a necessity of how the host's input sending
works, the host has 0 latency. There isn't a good way to fix this, as
input delay is now solely dependent on the real latency to the host's
server. Having differing latency between players would be considered
unfair for competitive play, but for casual play we don't really care.
For this reason though, combined with the potential for a few inputs to
be dropped on a bad connection, the old mode will remain and this new
mode is entirely optional.
2018-08-24 02:17:18 -06:00
|
|
|
bool m_HostInputAuthority;
|
2013-07-22 02:21:56 -06:00
|
|
|
};
|
|
|
|
|
2017-08-07 01:22:33 -06:00
|
|
|
struct NetTraversalConfig
|
|
|
|
{
|
|
|
|
NetTraversalConfig() = default;
|
|
|
|
NetTraversalConfig(bool use_traversal_, std::string traversal_host_, u16 traversal_port_)
|
|
|
|
: use_traversal{use_traversal_}, traversal_host{std::move(traversal_host_)},
|
|
|
|
traversal_port{traversal_port_}
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool use_traversal = false;
|
|
|
|
std::string traversal_host;
|
|
|
|
u16 traversal_port = 0;
|
|
|
|
};
|
|
|
|
|
2013-07-22 02:21:56 -06:00
|
|
|
struct Rpt : public std::vector<u8>
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
u16 channel;
|
2013-07-22 02:21:56 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
// messages
|
|
|
|
enum
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_PLAYER_JOIN = 0x10,
|
|
|
|
NP_MSG_PLAYER_LEAVE = 0x11,
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_CHAT_MESSAGE = 0x30,
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_PAD_DATA = 0x60,
|
|
|
|
NP_MSG_PAD_MAPPING = 0x61,
|
|
|
|
NP_MSG_PAD_BUFFER = 0x62,
|
NetPlay host input authority mode
Currently, each player buffers their own inputs and sends them to the
host. The host then relays those inputs to everyone else. Every player
waits on inputs from all players to be buffered before continuing. What
this means is all clients run in lockstep, and the total latency of
inputs cannot be lower than the sum of the 2 highest client ping times
in the game (in 3+ player sessions with people across the world, the
latency can be very high).
Host input authority mode changes it so players no longer buffer their
own inputs, and only send them to the host. The host stores only the
most recent input received from a player. The host then sends inputs
for all pads at the SI poll interval, similar to the existing code. If
a player sends inputs to slowly, their last received input is simply
sent again. If they send too quickly, inputs are dropped. This means
that the host has full control over what inputs are actually read by
the game, hence the name of the mode. Also, because the rate at which
inputs are received by SI is decoupled from the rate at which players
are sending inputs, clients are no longer dependent on each other. They
only care what the host is doing. This means that they can set their
buffer individually based on their latency to the host, rather than the
highest latency between any 2 players, allowing someone with lower ping
to the host to have less latency than someone else.
This is a catch to this: as a necessity of how the host's input sending
works, the host has 0 latency. There isn't a good way to fix this, as
input delay is now solely dependent on the real latency to the host's
server. Having differing latency between players would be considered
unfair for competitive play, but for casual play we don't really care.
For this reason though, combined with the potential for a few inputs to
be dropped on a bad connection, the old mode will remain and this new
mode is entirely optional.
2018-08-24 02:17:18 -06:00
|
|
|
NP_MSG_PAD_HOST_POLL = 0x63,
|
|
|
|
NP_MSG_PAD_FIRST_RECEIVED = 0x64,
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_WIIMOTE_DATA = 0x70,
|
|
|
|
NP_MSG_WIIMOTE_MAPPING = 0x71,
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_START_GAME = 0xA0,
|
|
|
|
NP_MSG_CHANGE_GAME = 0xA1,
|
|
|
|
NP_MSG_STOP_GAME = 0xA2,
|
|
|
|
NP_MSG_DISABLE_GAME = 0xA3,
|
2016-07-10 02:13:34 -06:00
|
|
|
NP_MSG_GAME_STATUS = 0xA4,
|
2018-07-19 16:10:37 -06:00
|
|
|
NP_MSG_IPL_STATUS = 0xA5,
|
NetPlay host input authority mode
Currently, each player buffers their own inputs and sends them to the
host. The host then relays those inputs to everyone else. Every player
waits on inputs from all players to be buffered before continuing. What
this means is all clients run in lockstep, and the total latency of
inputs cannot be lower than the sum of the 2 highest client ping times
in the game (in 3+ player sessions with people across the world, the
latency can be very high).
Host input authority mode changes it so players no longer buffer their
own inputs, and only send them to the host. The host stores only the
most recent input received from a player. The host then sends inputs
for all pads at the SI poll interval, similar to the existing code. If
a player sends inputs to slowly, their last received input is simply
sent again. If they send too quickly, inputs are dropped. This means
that the host has full control over what inputs are actually read by
the game, hence the name of the mode. Also, because the rate at which
inputs are received by SI is decoupled from the rate at which players
are sending inputs, clients are no longer dependent on each other. They
only care what the host is doing. This means that they can set their
buffer individually based on their latency to the host, rather than the
highest latency between any 2 players, allowing someone with lower ping
to the host to have less latency than someone else.
This is a catch to this: as a necessity of how the host's input sending
works, the host has 0 latency. There isn't a good way to fix this, as
input delay is now solely dependent on the real latency to the host's
server. Having differing latency between players would be considered
unfair for competitive play, but for casual play we don't really care.
For this reason though, combined with the potential for a few inputs to
be dropped on a bad connection, the old mode will remain and this new
mode is entirely optional.
2018-08-24 02:17:18 -06:00
|
|
|
NP_MSG_HOST_INPUT_AUTHORITY = 0xA6,
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_TIMEBASE = 0xB0,
|
|
|
|
NP_MSG_DESYNC_DETECTED = 0xB1,
|
2015-03-08 04:50:47 -06:00
|
|
|
|
2016-07-13 16:45:38 -06:00
|
|
|
NP_MSG_COMPUTE_MD5 = 0xC0,
|
|
|
|
NP_MSG_MD5_PROGRESS = 0xC1,
|
|
|
|
NP_MSG_MD5_RESULT = 0xC2,
|
|
|
|
NP_MSG_MD5_ABORT = 0xC3,
|
|
|
|
NP_MSG_MD5_ERROR = 0xC4,
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_READY = 0xD0,
|
|
|
|
NP_MSG_NOT_READY = 0xD1,
|
2013-07-22 02:21:56 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_PING = 0xE0,
|
|
|
|
NP_MSG_PONG = 0xE1,
|
|
|
|
NP_MSG_PLAYER_PING_DATA = 0xE2,
|
2015-06-14 05:59:41 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NP_MSG_SYNC_GC_SRAM = 0xF0,
|
2018-07-04 15:01:50 -06:00
|
|
|
NP_MSG_SYNC_SAVE_DATA = 0xF1,
|
2013-07-22 02:21:56 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
CON_ERR_SERVER_FULL = 1,
|
|
|
|
CON_ERR_GAME_RUNNING = 2,
|
|
|
|
CON_ERR_VERSION_MISMATCH = 3
|
2013-07-22 02:21:56 -06:00
|
|
|
};
|
|
|
|
|
2018-07-04 15:01:50 -06:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SYNC_SAVE_DATA_NOTIFY = 0,
|
|
|
|
SYNC_SAVE_DATA_SUCCESS = 1,
|
|
|
|
SYNC_SAVE_DATA_FAILURE = 2,
|
|
|
|
SYNC_SAVE_DATA_RAW = 3,
|
|
|
|
SYNC_SAVE_DATA_GCI = 4,
|
|
|
|
SYNC_SAVE_DATA_WII = 5
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr u32 NETPLAY_LZO_IN_LEN = 1024 * 64;
|
|
|
|
constexpr u32 NETPLAY_LZO_OUT_LEN = NETPLAY_LZO_IN_LEN + (NETPLAY_LZO_IN_LEN / 16) + 64 + 3;
|
|
|
|
|
2015-08-15 22:00:59 -06:00
|
|
|
using NetWiimote = std::vector<u8>;
|
2016-06-24 02:43:46 -06:00
|
|
|
using MessageId = u8;
|
|
|
|
using PlayerId = u8;
|
|
|
|
using FrameNum = u32;
|
2015-08-15 22:08:09 -06:00
|
|
|
using PadMapping = s8;
|
|
|
|
using PadMappingArray = std::array<PadMapping, 4>;
|
2015-08-15 22:00:59 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool IsNetPlayRunning();
|
2018-07-09 13:52:31 -06:00
|
|
|
// Precondition: A netplay client instance must be present. In other words,
|
|
|
|
// IsNetPlayRunning() must be true before calling this.
|
|
|
|
const NetSettings& GetNetSettings();
|
2018-07-04 15:01:50 -06:00
|
|
|
IOS::HLE::FS::FileSystem* GetWiiSyncFS();
|
|
|
|
void SetWiiSyncFS(std::unique_ptr<IOS::HLE::FS::FileSystem> fs);
|
|
|
|
void ClearWiiSyncFS();
|
NetPlay host input authority mode
Currently, each player buffers their own inputs and sends them to the
host. The host then relays those inputs to everyone else. Every player
waits on inputs from all players to be buffered before continuing. What
this means is all clients run in lockstep, and the total latency of
inputs cannot be lower than the sum of the 2 highest client ping times
in the game (in 3+ player sessions with people across the world, the
latency can be very high).
Host input authority mode changes it so players no longer buffer their
own inputs, and only send them to the host. The host stores only the
most recent input received from a player. The host then sends inputs
for all pads at the SI poll interval, similar to the existing code. If
a player sends inputs to slowly, their last received input is simply
sent again. If they send too quickly, inputs are dropped. This means
that the host has full control over what inputs are actually read by
the game, hence the name of the mode. Also, because the rate at which
inputs are received by SI is decoupled from the rate at which players
are sending inputs, clients are no longer dependent on each other. They
only care what the host is doing. This means that they can set their
buffer individually based on their latency to the host, rather than the
highest latency between any 2 players, allowing someone with lower ping
to the host to have less latency than someone else.
This is a catch to this: as a necessity of how the host's input sending
works, the host has 0 latency. There isn't a good way to fix this, as
input delay is now solely dependent on the real latency to the host's
server. Having differing latency between players would be considered
unfair for competitive play, but for casual play we don't really care.
For this reason though, combined with the potential for a few inputs to
be dropped on a bad connection, the old mode will remain and this new
mode is entirely optional.
2018-08-24 02:17:18 -06:00
|
|
|
void SetSIPollBatching(bool state);
|
2018-07-06 17:39:42 -06:00
|
|
|
} // namespace NetPlay
|