From fd43682800b0a0b71c483fa3bf8062dad9e32ee9 Mon Sep 17 00:00:00 2001 From: DrPerkyLegit Date: Thu, 21 May 2026 19:38:53 -0400 Subject: [PATCH] subs for profiler setup, remove discovery code --- .../Network/PlatformNetworkManagerStub.cpp | 90 ---------- Minecraft.Client/Extrax64Stubs.cpp | 15 +- .../Windows64/Network/WinsockNetLayer.cpp | 169 ------------------ .../Windows64/Network/WinsockNetLayer.h | 11 -- .../Windows64/Windows64_Minecraft.cpp | 68 ++++--- .../Windows64/Windows64_Minecraft.h | 7 +- Minecraft.Server/Application.cpp | 10 +- 7 files changed, 48 insertions(+), 322 deletions(-) diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 7340a7e..85db07a 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -473,8 +473,6 @@ int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int l IQNet::m_player[0].m_resolvedXuid = Win64Xuid::GetLegacyEmbeddedHostXuid(); wcsncpy_s(IQNet::m_player[0].m_gamertag, 32, searchResult->data.hostName, _TRUNCATE); - WinsockNetLayer::StopDiscovery(); - if (!WinsockNetLayer::JoinGame(hostIP, hostPort)) { app.DebugPrintf("Win64 LAN: Failed to connect to %s:%d\n", hostIP, hostPort); @@ -777,95 +775,7 @@ void CPlatformNetworkManagerStub::TickSearch() void CPlatformNetworkManagerStub::SearchForGames() { -#ifdef _WINDOWS64 - std::vector lanSessions = WinsockNetLayer::GetDiscoveredSessions(); - //THEY GET DELETED HERE DAMMIT - for (size_t i = 0; i < friendsSessions[0].size(); i++) - delete friendsSessions[0][i]; - friendsSessions[0].clear(); - - for (size_t i = 0; i < lanSessions.size(); i++) - { - FriendSessionInfo* info = new FriendSessionInfo(); - size_t nameLen = wcslen(lanSessions[i].hostName); - info->displayLabel = new wchar_t[nameLen + 1]; - wcscpy_s(info->displayLabel, nameLen + 1, lanSessions[i].hostName); - info->displayLabelLength = static_cast(nameLen); - info->displayLabelViewableStartIndex = 0; - - info->data.netVersion = lanSessions[i].netVersion; - info->data.m_uiGameHostSettings = lanSessions[i].gameHostSettings; - info->data.texturePackParentId = lanSessions[i].texturePackParentId; - info->data.subTexturePackId = lanSessions[i].subTexturePackId; - info->data.isReadyToJoin = lanSessions[i].isJoinable; - info->data.isJoinable = lanSessions[i].isJoinable; - strncpy_s(info->data.hostIP, sizeof(info->data.hostIP), lanSessions[i].hostIP, _TRUNCATE); - info->data.hostPort = lanSessions[i].hostPort; - wcsncpy_s(info->data.hostName, XUSER_NAME_SIZE, lanSessions[i].hostName, _TRUNCATE); - info->data.playerCount = lanSessions[i].playerCount; - info->data.maxPlayers = lanSessions[i].maxPlayers; - - info->sessionId = static_cast(inet_addr(lanSessions[i].hostIP)) | - static_cast(lanSessions[i].hostPort) << 32; - - friendsSessions[0].push_back(info); - } - - if (std::FILE* file = std::fopen("servers.db", "rb")) { - char magic[4] = {}; - if (std::fread(magic, 1, 4, file) == 4 && memcmp(magic, "MCSV", 4) == 0) - { - uint32_t version = 0, count = 0; - std::fread(&version, sizeof(uint32_t), 1, file); - std::fread(&count, sizeof(uint32_t), 1, file); - - if (version == 1) - { - for (uint32_t s = 0; s < count; s++) - { - uint16_t ipLen = 0, port = 0, nameLen = 0; - if (std::fread(&ipLen, sizeof(uint16_t), 1, file) != 1) break; - if (ipLen == 0 || ipLen > 256) break; - - char ipBuf[257] = {}; - if (std::fread(ipBuf, 1, ipLen, file) != ipLen) break; - if (std::fread(&port, sizeof(uint16_t), 1, file) != 1) break; - - if (std::fread(&nameLen, sizeof(uint16_t), 1, file) != 1) break; - if (nameLen > 256) break; - - char nameBuf[257] = {}; - if (nameLen > 0) - { - if (std::fread(nameBuf, 1, nameLen, file) != nameLen) break; - } - - wstring wName = convStringToWstring(nameBuf); - - FriendSessionInfo* info = new FriendSessionInfo(); - size_t nLen = wName.length(); - info->displayLabel = new wchar_t[nLen + 1]; - wcscpy_s(info->displayLabel, nLen + 1, wName.c_str()); - info->displayLabelLength = static_cast(nLen); - info->displayLabelViewableStartIndex = 0; - info->data.isReadyToJoin = true; - info->data.isJoinable = true; - strncpy_s(info->data.hostIP, sizeof(info->data.hostIP), ipBuf, _TRUNCATE); - info->data.hostPort = port; - info->sessionId = static_cast(inet_addr(ipBuf)) | static_cast(port) << 32; - friendsSessions[0].push_back(info); - } - } - } - std::fclose(file); - } - - m_searchResultsCount[0] = static_cast(friendsSessions[0].size()); - - if (m_SessionsUpdatedCallback != nullptr) - m_SessionsUpdatedCallback(m_pSearchParam); -#endif } int CPlatformNetworkManagerStub::SearchForGamesThreadProc( void* lpParameter ) diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 0147896..4e9985b 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -259,11 +259,7 @@ HRESULT IQNet::AddLocalPlayerByUserIndex(DWORD dwUserIndex) { m_player[dwUserIndex].m_isRemote = false; m_player[dwUserIndex].m_isHostPlayer = false; // Give the joining player a distinct gamertag - extern wchar_t g_Win64UsernameW[17]; - if (dwUserIndex == 0) - wcscpy_s(m_player[0].m_gamertag, 32, g_Win64UsernameW); - else - swprintf_s(m_player[dwUserIndex].m_gamertag, 32, L"%s(%d)", g_Win64UsernameW, dwUserIndex + 1); + wcscpy_s(m_player[0].m_gamertag, 32, L"Host Name"); if (dwUserIndex >= s_playerCount) s_playerCount = dwUserIndex + 1; return S_OK; @@ -395,9 +391,8 @@ void IQNet::EndGame() m_player[i].SetCustomDataValue(0); } // Restore local player 0's gamertag so re-joining works correctly - extern wchar_t g_Win64UsernameW[17]; m_player[0].m_isHostPlayer = true; - wcscpy_s(m_player[0].m_gamertag, 32, g_Win64UsernameW); + wcscpy_s(m_player[0].m_gamertag, 32, L"Host Name"); } DWORD MinecraftDynamicConfigurations::GetTrialTime() { return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; } @@ -669,7 +664,6 @@ char fakeGamerTag[32] = "PlayerName"; void SetFakeGamertag(char* name) { strcpy_s(fakeGamerTag, name); } #else char* C_4JProfile::GetGamertag(int iPad) { - extern char g_Win64Username[17]; if (iPad > 0 && iPad < XUSER_MAX_COUNT && IQNet::m_player[iPad].m_gamertag[0] != 0 && !IQNet::m_player[iPad].m_isRemote) { @@ -677,14 +671,13 @@ char* C_4JProfile::GetGamertag(int iPad) { WideCharToMultiByte(CP_ACP, 0, IQNet::m_player[iPad].m_gamertag, -1, s_padGamertag[iPad], 17, nullptr, nullptr); return s_padGamertag[iPad]; } - return g_Win64Username; + return ""; } wstring C_4JProfile::GetDisplayName(int iPad) { - extern wchar_t g_Win64UsernameW[17]; if (iPad > 0 && iPad < XUSER_MAX_COUNT && IQNet::m_player[iPad].m_gamertag[0] != 0 && !IQNet::m_player[iPad].m_isRemote) return IQNet::m_player[iPad].m_gamertag; - return g_Win64UsernameW; + return L""; } #endif bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index 4fbbf6d..cd4edee 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -40,12 +40,6 @@ Win64LANBroadcast WinsockNetLayer::s_advertiseData = {}; CRITICAL_SECTION WinsockNetLayer::s_advertiseLock; int WinsockNetLayer::s_hostGamePort = WIN64_NET_DEFAULT_PORT; -SOCKET WinsockNetLayer::s_discoverySock = INVALID_SOCKET; -HANDLE WinsockNetLayer::s_discoveryThread = nullptr; -volatile bool WinsockNetLayer::s_discovering = false; -CRITICAL_SECTION WinsockNetLayer::s_discoveryLock; -std::vector WinsockNetLayer::s_discoveredSessions; - CRITICAL_SECTION WinsockNetLayer::s_disconnectLock; std::vector WinsockNetLayer::s_disconnectedSmallIds; @@ -80,7 +74,6 @@ bool WinsockNetLayer::Initialize() InitializeCriticalSection(&s_sendLock); InitializeCriticalSection(&s_connectionsLock); InitializeCriticalSection(&s_advertiseLock); - InitializeCriticalSection(&s_discoveryLock); InitializeCriticalSection(&s_disconnectLock); InitializeCriticalSection(&s_freeSmallIdLock); InitializeCriticalSection(&s_smallIdToSocketLock); @@ -89,15 +82,12 @@ bool WinsockNetLayer::Initialize() s_initialized = true; - StartDiscovery(); - return true; } void WinsockNetLayer::Shutdown() { StopAdvertising(); - StopDiscovery(); s_active = false; s_connected = false; @@ -187,7 +177,6 @@ void WinsockNetLayer::Shutdown() DeleteCriticalSection(&s_sendLock); DeleteCriticalSection(&s_connectionsLock); DeleteCriticalSection(&s_advertiseLock); - DeleteCriticalSection(&s_discoveryLock); DeleteCriticalSection(&s_disconnectLock); DeleteCriticalSection(&s_freeSmallIdLock); DeleteCriticalSection(&s_smallIdToSocketLock); @@ -1084,162 +1073,4 @@ DWORD WINAPI WinsockNetLayer::AdvertiseThreadProc(LPVOID param) return 0; } -bool WinsockNetLayer::StartDiscovery() -{ - if (s_discovering) return true; - if (!s_initialized) return false; - - s_discoverySock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (s_discoverySock == INVALID_SOCKET) - { - app.DebugPrintf("Win64 LAN: Failed to create discovery socket: %d\n", WSAGetLastError()); - return false; - } - - BOOL reuseAddr = TRUE; - setsockopt(s_discoverySock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuseAddr, sizeof(reuseAddr)); - - struct sockaddr_in bindAddr; - memset(&bindAddr, 0, sizeof(bindAddr)); - bindAddr.sin_family = AF_INET; - bindAddr.sin_port = htons(WIN64_LAN_DISCOVERY_PORT); - bindAddr.sin_addr.s_addr = INADDR_ANY; - - if (::bind(s_discoverySock, (struct sockaddr*)&bindAddr, sizeof(bindAddr)) == SOCKET_ERROR) - { - app.DebugPrintf("Win64 LAN: Discovery bind failed: %d\n", WSAGetLastError()); - closesocket(s_discoverySock); - s_discoverySock = INVALID_SOCKET; - return false; - } - - DWORD timeout = 500; - setsockopt(s_discoverySock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout)); - - s_discovering = true; - s_discoveryThread = CreateThread(nullptr, 0, DiscoveryThreadProc, nullptr, 0, nullptr); - - app.DebugPrintf("Win64 LAN: Listening for LAN games on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT); - return true; -} - -void WinsockNetLayer::StopDiscovery() -{ - s_discovering = false; - - if (s_discoverySock != INVALID_SOCKET) - { - closesocket(s_discoverySock); - s_discoverySock = INVALID_SOCKET; - } - - if (s_discoveryThread != nullptr) - { - WaitForSingleObject(s_discoveryThread, 2000); - CloseHandle(s_discoveryThread); - s_discoveryThread = nullptr; - } - - EnterCriticalSection(&s_discoveryLock); - s_discoveredSessions.clear(); - LeaveCriticalSection(&s_discoveryLock); -} - -std::vector WinsockNetLayer::GetDiscoveredSessions() -{ - std::vector result; - EnterCriticalSection(&s_discoveryLock); - result = s_discoveredSessions; - LeaveCriticalSection(&s_discoveryLock); - return result; -} - -DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param) -{ - char recvBuf[512]; - - while (s_discovering) - { - struct sockaddr_in senderAddr; - int senderLen = sizeof(senderAddr); - - int recvLen = recvfrom(s_discoverySock, recvBuf, sizeof(recvBuf), 0, - (struct sockaddr*)&senderAddr, &senderLen); - - if (recvLen == SOCKET_ERROR) - { - continue; - } - - if (recvLen < static_cast(sizeof(Win64LANBroadcast))) - continue; - - Win64LANBroadcast* broadcast = (Win64LANBroadcast*)recvBuf; - if (broadcast->magic != WIN64_LAN_BROADCAST_MAGIC) - continue; - - char senderIP[64]; - inet_ntop(AF_INET, &senderAddr.sin_addr, senderIP, sizeof(senderIP)); - - DWORD now = GetTickCount(); - - EnterCriticalSection(&s_discoveryLock); - - bool found = false; - for (size_t i = 0; i < s_discoveredSessions.size(); i++) - { - if (strcmp(s_discoveredSessions[i].hostIP, senderIP) == 0 && - s_discoveredSessions[i].hostPort == static_cast(broadcast->gamePort)) - { - s_discoveredSessions[i].netVersion = broadcast->netVersion; - wcsncpy_s(s_discoveredSessions[i].hostName, 32, broadcast->hostName, _TRUNCATE); - s_discoveredSessions[i].playerCount = broadcast->playerCount; - s_discoveredSessions[i].maxPlayers = broadcast->maxPlayers; - s_discoveredSessions[i].gameHostSettings = broadcast->gameHostSettings; - s_discoveredSessions[i].texturePackParentId = broadcast->texturePackParentId; - s_discoveredSessions[i].subTexturePackId = broadcast->subTexturePackId; - s_discoveredSessions[i].isJoinable = (broadcast->isJoinable != 0); - s_discoveredSessions[i].lastSeenTick = now; - found = true; - break; - } - } - - if (!found) - { - Win64LANSession session; - memset(&session, 0, sizeof(session)); - strncpy_s(session.hostIP, sizeof(session.hostIP), senderIP, _TRUNCATE); - session.hostPort = static_cast(broadcast->gamePort); - session.netVersion = broadcast->netVersion; - wcsncpy_s(session.hostName, 32, broadcast->hostName, _TRUNCATE); - session.playerCount = broadcast->playerCount; - session.maxPlayers = broadcast->maxPlayers; - session.gameHostSettings = broadcast->gameHostSettings; - session.texturePackParentId = broadcast->texturePackParentId; - session.subTexturePackId = broadcast->subTexturePackId; - session.isJoinable = (broadcast->isJoinable != 0); - session.lastSeenTick = now; - s_discoveredSessions.push_back(session); - - app.DebugPrintf("Win64 LAN: Discovered game \"%ls\" at %s:%d\n", - session.hostName, session.hostIP, session.hostPort); - } - - for (size_t i = s_discoveredSessions.size(); i > 0; i--) - { - if (now - s_discoveredSessions[i - 1].lastSeenTick > 5000) - { - app.DebugPrintf("Win64 LAN: Session \"%ls\" at %s timed out\n", - s_discoveredSessions[i - 1].hostName, s_discoveredSessions[i - 1].hostIP); - s_discoveredSessions.erase(s_discoveredSessions.begin() + (i - 1)); - } - } - - LeaveCriticalSection(&s_discoveryLock); - } - - return 0; -} - #endif diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h index 8fe3cae..f1ec18d 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h @@ -99,10 +99,6 @@ public: static void UpdateAdvertiseMaxPlayers(BYTE maxPlayers); static void UpdateAdvertiseJoinable(bool joinable); - static bool StartDiscovery(); - static void StopDiscovery(); - static std::vector GetDiscoveredSessions(); - static int GetHostPort() { return s_hostGamePort; } private: @@ -111,7 +107,6 @@ private: static DWORD WINAPI ClientRecvThreadProc(LPVOID param); static DWORD WINAPI SplitScreenRecvThreadProc(LPVOID param); static DWORD WINAPI AdvertiseThreadProc(LPVOID param); - static DWORD WINAPI DiscoveryThreadProc(LPVOID param); static SOCKET s_listenSocket; static SOCKET s_hostConnectionSocket; @@ -139,12 +134,6 @@ private: static CRITICAL_SECTION s_advertiseLock; static int s_hostGamePort; - static SOCKET s_discoverySock; - static HANDLE s_discoveryThread; - static volatile bool s_discovering; - static CRITICAL_SECTION s_discoveryLock; - static std::vector s_discoveredSessions; - static CRITICAL_SECTION s_disconnectLock; static std::vector s_disconnectedSmallIds; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 9bfb495..72d45a1 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -64,8 +64,8 @@ extern Renderer InternalRenderManager; #define NUM_PROFILE_SETTINGS 4 DWORD dwProfileSettingsA[NUM_PROFILE_VALUES] = { 0,0,0,0,0 }; -char g_Win64Username[17] = { 0 }; -wchar_t g_Win64UsernameW[17] = { 0 }; +std::unordered_map Windows64Minecraft::serverAccessors; + //#define MEMORY_TRACKING @@ -104,14 +104,13 @@ static Minecraft* InitialiseMinecraftRuntime() g_NetworkManager.Initialise(); - for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) - { + for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { IQNet::m_player[i].m_smallId = static_cast(i); IQNet::m_player[i].m_isRemote = false; IQNet::m_player[i].m_isHostPlayer = (i == 0); swprintf_s(IQNet::m_player[i].m_gamertag, 32, L"Player%d", i); } - wcscpy_s(IQNet::m_player[0].m_gamertag, 32, g_Win64UsernameW); + wcscpy_s(IQNet::m_player[0].m_gamertag, 32, L"Host Player"); //todo: place some kinda message here WinsockNetLayer::Initialize(); @@ -132,7 +131,7 @@ static Minecraft* InitialiseMinecraftRuntime() return nullptr; //app.InitGameSettings(); - app.InitialiseTips(); + //app.InitialiseTips(); return pMinecraft; } @@ -144,6 +143,8 @@ static int HeadlessServerConsoleThreadProc(void* lpParameter) std::string line; while (!app.m_bShutdown) { + //app.SetGlobalXuiAction(eAppAction_SaveGame); + if (!std::getline(std::cin, line)) { if (std::cin.eof()) @@ -163,6 +164,7 @@ static int HeadlessServerConsoleThreadProc(void* lpParameter) MinecraftServer* server = MinecraftServer::getInstance(); if (server != nullptr) { + //app.SetXuiServerAction(1, eXuiServerAction_SaveGame); server->handleConsoleInput(command, server); } } @@ -170,34 +172,7 @@ static int HeadlessServerConsoleThreadProc(void* lpParameter) return 0; } -PlayerUID Windows64Minecraft::ResolvePersistentXuidFromName(const std::wstring& playerName) -{ - const unsigned __int64 fnvOffset = 14695981039346656037ULL; - const unsigned __int64 fnvPrime = 1099511628211ULL; - unsigned __int64 hash = fnvOffset; - - for (size_t i = 0; i < playerName.length(); ++i) - { - unsigned short codeUnit = (unsigned short)playerName[i]; - hash ^= (unsigned __int64)(codeUnit & 0xFF); - hash *= fnvPrime; - hash ^= (unsigned __int64)((codeUnit >> 8) & 0xFF); - hash *= fnvPrime; - } - - // Namespace the hash away from legacy smallId-based values. - hash ^= 0x9E3779B97F4A7C15ULL; - hash |= 0x8000000000000000ULL; - - if (hash == (unsigned __int64)INVALID_XUID) - { - hash ^= 0x0100000000000001ULL; - } - - return (PlayerUID)hash; -} - -void Windows64Minecraft::StartDedicatedServer() { +void Windows64Minecraft::StartDedicatedServer(std::function enableProfiler) { __int64 startupTime = System::currentRealTimeMillis(); Logger::Info("Loading Server Properties"); @@ -215,9 +190,6 @@ void Windows64Minecraft::StartDedicatedServer() { const int port = g_Win64DedicatedServerPort > 0 ? g_Win64DedicatedServerPort : serverSettings.getInt(L"server-port", WIN64_NET_DEFAULT_PORT); const std::string addressCombo = std::string(bindIp) + ":" + std::to_string(port); - strncpy_s(g_Win64Username, sizeof(g_Win64Username), "Player", _TRUNCATE); - MultiByteToWideChar(CP_ACP, 0, g_Win64Username, -1, g_Win64UsernameW, 17); - const Minecraft* pMinecraft = InitialiseMinecraftRuntime(); if (pMinecraft == nullptr) { @@ -293,7 +265,7 @@ void Windows64Minecraft::StartDedicatedServer() { } wchar_t filePath[MAX_PATH] = {}; - _snwprintf_s(filePath, sizeof(filePath), _TRUNCATE, L"%sWindows64\\GameHDD\\saveData.ms", exePath); + _snwprintf_s(filePath, sizeof(filePath), _TRUNCATE, L"%GameSaves\\defaultWorld.ms", exePath); File* saveFile = new File(filePath); @@ -336,6 +308,19 @@ void Windows64Minecraft::StartDedicatedServer() { Logger::Info(("Server Has Started In: " + std::to_string(finishedStartupTime)).c_str()); + if (serverSettings.getBoolean(L"enable-profiler", false)) { + Logger::Info("Profiler is enabled. Use with caution as it may impact server performance."); + + std::wstring defaultPassword = L"admin"; + std::wstring password = serverSettings.getString(L"profiler-password", L"admin"); + + if (defaultPassword == password) { + Logger::Warning("Profiler password is set to the default value. Please change it in \"server.properties\" to secure your server."); + } + + enableProfiler(password, serverSettings.getInt(L"profiler-port", 25570)); + } + C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, nullptr, "Server console", 128 * 1024); consoleThread->Run(); @@ -367,6 +352,13 @@ void Windows64Minecraft::StartDedicatedServer() { return; } +ServerAccessor* Windows64Minecraft::getServerAccessor(std::string name) { + auto itor = serverAccessors.find(name); + if (itor == serverAccessors.end()) return nullptr; + + return itor->second; +} + #ifdef MEMORY_TRACKING int totalAllocGen = 0; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.h b/Minecraft.Client/Windows64/Windows64_Minecraft.h index 96be43a..4d2d43a 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.h +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.h @@ -1,10 +1,15 @@ #pragma once #include #include +#include "../../Minecraft.Server/Access/ServerAccessor.h" typedef unsigned long long PlayerUID; class Windows64Minecraft { public: - static void StartDedicatedServer(std::function pluginload); + static void StartDedicatedServer(std::function enableProfiler); + + static ServerAccessor* getServerAccessor(std::string name); +private: + static std::unordered_map serverAccessors; }; \ No newline at end of file diff --git a/Minecraft.Server/Application.cpp b/Minecraft.Server/Application.cpp index 4997962..cf9238e 100644 --- a/Minecraft.Server/Application.cpp +++ b/Minecraft.Server/Application.cpp @@ -3,6 +3,7 @@ #include "Utils/Logger.h" #include "../Minecraft.Client/Windows64/Windows64_Minecraft.h" +void enableProfiler(std::wstring password, int port); int main() { //make things resolve correctly, taken from source and moved @@ -16,6 +17,11 @@ int main() { //HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); //SetConsoleMode(hConsole, ENABLE_VIRTUAL_TERMINAL_PROCESSING); //todo: find out why this breaks \n in printf calls - Windows64Minecraft::StartDedicatedServer(); + Windows64Minecraft::StartDedicatedServer(enableProfiler); return 0; -} \ No newline at end of file +} + + +void enableProfiler(std::wstring password, int port) { + +}