#pragma once #include "stdafx.h" #include #include "GameServerConnection.h" #include "INotificationListener.h" #include "IInputProvider.h" #include "IInputRecorder.h" using std::thread; class Console; class GameServer : public IInputRecorder, public IInputProvider, public INotificationListener { private: static shared_ptr Instance; shared_ptr _console; unique_ptr _serverThread; atomic _stop; unique_ptr _listener; uint16_t _port; string _password; list> _openConnections; bool _initialized = false; string _hostPlayerName; uint8_t _hostControllerPort; void AcceptConnections(); void UpdateConnections(); void Exec(); void Stop(); public: GameServer(shared_ptr console, uint16_t port, string password, string hostPlayerName); virtual ~GameServer(); void RegisterServerInput(); static void StartServer(shared_ptr console, uint16_t port, string password, string hostPlayerName); static void StopServer(); static bool Started(); static string GetHostPlayerName(); static uint8_t GetHostControllerPort(); static void SetHostControllerPort(uint8_t port); static uint8_t GetAvailableControllers(); static vector GetPlayerList(); static void SendPlayerList(); static list> GetConnectionList(); bool SetInput(BaseControlDevice *device) override; void RecordInput(vector> devices) override; // Inherited via INotificationListener virtual void ProcessNotification(ConsoleNotificationType type, void * parameter) override; };