DS2Revival/mods/multiplayer/multiplayer.h

41 lines
1.8 KiB
C++

// Shared between the DS2Multiplayer translation units.
#pragma once
#include <winsock2.h>
#include "../common/patch.h"
namespace mp {
// Private harness only: DS2DEV_DOCS plus DS2DEV_LOOPBACK=1. Never changes player networking.
bool TestLoopback();
unsigned long TestLoopbackNet(); // network-order address of this instance's loopback (DS2DEV_LOOPBACK=1 or 127.x.y.z)
// This PC's main IPv4 address (the adapter that holds the default route).
bool PrimaryIPv4(in_addr* out);
// The replacement server ([Network] Server); empty if none.
const char* ServerName();
// In-game news / version check (news.cpp): [Network] NewsUrl.
bool NewsEnabled(const ds2::Ini& ini); // NewsUrl is set and usable (then DistroId is served non-zero)
void InstallNews(const ds2::Ini& ini, ds2::Exe exe);
struct NewsTarget { // where NewsUrl points
wchar_t host[256];
unsigned short port;
bool secure;
};
void InstallNewsUi(const ds2::Ini& ini, ds2::Exe exe, const NewsTarget& target); // news_ui.cpp: banner text, button, dialog
void ReadSeen(char* out, size_t cap); // the news item the player last opened ("" = none)
// A joiner whose game differs from the host's (exe file, version) gets a message and is returned to the game list instead of
// hanging in the staging area (version_check.cpp, roadmap R8): [Multiplayer] JoinVersionMessage.
void InstallJoinVersionCheck(const ds2::Ini& ini, ds2::Exe exe);
// DirectPlay relay (relay.cpp): tunnels joiners to hosts they cannot reach directly.
void InstallRelay(const ds2::Ini& ini);
// DirectPlay 8 shim (dp8shim.cpp): [Network] DirectPlay = auto (default) | native | shim.
void InstallDirectPlayShim(const ds2::Ini& ini);
// A shim DirectPlay8Client/Server/Address regardless of the mode (tools/dp8test).
HRESULT CreateDirectPlayShim(const GUID& clsid, const GUID& iid, void** out);
} // namespace mp