add lcemp networking + ps3 support

YES I KNOW ITS GARBAGE, THATS WHY ITS NOT ON MAIN

ILL FIX IT UP IN FUTURE COMMITS THEN MERGE TO MAIN
This commit is contained in:
2026-07-31 22:08:30 +03:00
parent 51ee0d8e57
commit dbd90a75c9
50 changed files with 1958 additions and 96 deletions
+23 -6
View File
@@ -25,9 +25,9 @@
#include "..\Minecraft.World\net.minecraft.world.level.saveddata.h"
#include "..\Minecraft.World\JavaMath.h"
#include "..\Minecraft.World\EntityIO.h"
#ifdef _XBOX
#if defined(_XBOX) || defined(_WINDOWS64) || defined(DISABLE_PSN)
#include "Xbox\Network\NetworkPlayerXbox.h"
#elif defined(__PS3__) || defined(__ORBIS__)
#elif !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__)
#include "Common\Network\Sony\NetworkPlayerSony.h"
#endif
@@ -53,7 +53,11 @@ PlayerList::PlayerList(MinecraftServer *server)
//int viewDistance = server->settings->getInt(L"view-distance", 10);
#ifdef _WINDOWS64
maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
#else
maxPlayers = server->settings->getInt(L"max-players", 20);
#endif
doWhiteList = false;
InitializeCriticalSection(&m_kickPlayersCS);
@@ -90,7 +94,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST,1);
}
#if defined(__PS3__) || defined(__ORBIS__)
#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__)
// PS3 networking library doesn't automatically assign PlayerUIDs to the network players for anything remote, so need to tell it what to set from the data in this packet now
if( !g_NetworkManager.IsLocalGame() )
{
@@ -99,6 +103,13 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
((NetworkPlayerSony *)networkPlayer)->SetUID( packet->m_onlineXuid );
}
}
#elif defined(_WINDOWS64) || defined(DISABLE_PSN)
if (networkPlayer != NULL && !networkPlayer->IsLocal())
{
NetworkPlayerXbox *nxp = (NetworkPlayerXbox *)networkPlayer;
IQNetPlayer *qnp = nxp->GetQNetPlayer();
wcsncpy(qnp->m_gamertag, player->name.c_str(), 32);
}
#endif
// 4J Stu - TU-1 hotfix
@@ -469,6 +480,7 @@ void PlayerList::remove(shared_ptr<ServerPlayer> player)
//4J Stu - We don't want to save the map data for guests, so when we are sure that the player is gone delete the map
if(player->isGuest()) playerIo->deleteMapFilesForPlayer(player);
ServerLevel *level = player->getLevel();
level->getTracker()->removeEntity(player);
if (player->riding != NULL)
{
// remove mount first because the player unmounts when being
@@ -497,7 +509,7 @@ void PlayerList::remove(shared_ptr<ServerPlayer> player)
shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid)
{
if (players.size() >= maxPlayers)
if (players.size() >= (unsigned int)MINECRAFT_NET_MAX_PLAYERS)
{
pendingConnection->disconnect(DisconnectPacket::eDisconnect_ServerFull);
return shared_ptr<ServerPlayer>();
@@ -510,9 +522,14 @@ shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(PendingConnection *pendin
// Work out the base server player settings
INetworkPlayer *networkPlayer = pendingConnection->connection->getSocket()->getPlayer();
if(networkPlayer != NULL && !networkPlayer->IsHost())
if (networkPlayer != NULL)
{
player->enableAllPlayerPrivileges( app.GetGameHostOption(eGameHostOption_TrustPlayers)>0 );
if (!networkPlayer->IsHost())
player->enableAllPlayerPrivileges( app.GetGameHostOption(eGameHostOption_TrustPlayers)>0 );
PlayerUID realXuid = networkPlayer->GetUID();
player->setXuid(realXuid);
player->setOnlineXuid(realXuid);
}
// 4J Added