Files
Commonwealth-Online-Public/plugin/include/F4TNetworking.h
T
andrew e61922678b Add server validation, profile store, session launch
Introduce server validation and a session launch flow with persistent server profiles.

- Add ConnectAndValidateServer to Networking to validate handshake/timeouts and return human-friendly errors; avoid auto-connecting in transform send path and remove unconditional local connect on startup.
- Add ServerProfileStore (header + implementation) to persist server->saveFile bindings under Documents/My Games/.../CommonwealthOnline/server-profiles.json with thread-safe load/save, lookup, touch and bind operations.
- Add SessionLaunch (header + implementation) to handle launching validated sessions, first-time join flow (auto coc to SanctuaryExt, character creation menus, save binding), F4SE message handling and periodic Update processing.
- Update ServerBrowserBridge to parse/validate ports, use ConnectAndValidateServer, display joinLoading UI events, schedule validated session launch on the game task thread, and centralize join success/failure handling.
- Wire SessionLaunch into main.cpp (update loop and F4SE message hook).
- Improve direct-connect UI in app.js with client-side validation, port parsing, and handling of joinLoading events.

These changes provide better connection validation, user feedback during joins, and automatic handling for first-time server joins with persistence of associated saves.
2026-06-09 16:26:33 +12:00

33 lines
865 B
C++

#pragma once
#include <cstdint>
#include <string>
namespace F4T::Networking
{
std::string GetLocalPlayerLogPrefix();
bool ConnectToServer(const char* a_host, std::uint16_t a_port);
bool ConnectToLocalServer();
bool ConnectAndValidateServer(const char* a_host, std::uint16_t a_port, std::string& a_error);
void DisconnectFromLocalServer();
bool IsConnectedToServer();
bool SendTransformPacket(
float a_x,
float a_y,
float a_z,
float a_angleZ,
const char* a_movementType,
bool a_hasCellId = false,
std::uint32_t a_cellId = 0,
bool a_hasWorldspaceId = false,
std::uint32_t a_worldspaceId = 0,
bool a_isMoving = false,
bool a_isSprinting = false,
bool a_isSneaking = false,
bool a_isJumping = false,
bool a_isCrouching = false,
bool a_weaponDrawn = false,
float a_movementSpeed = 0.0F,
float a_animationGraphSpeed = -1.0F);
}