clean up NetTypes and move to platform/network

This commit is contained in:
Tropical 2026-04-09 22:18:11 -05:00
parent b20b8cb311
commit bc494aa979
27 changed files with 34 additions and 101 deletions

View file

@ -7,7 +7,7 @@
#include "minecraft/GameEnums.h"
#include "minecraft/GameTypes.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/XboxStubs.h"
#include "platform/profile/ProfileConstants.h"
#include "platform/storage/storage.h"

View file

@ -41,7 +41,7 @@
#include "minecraft/world/item/crafting/Recipy.h"
#include "minecraft/world/level/tile/Tile.h"
#include "minecraft/world/level/tile/entity/HopperTileEntity.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/XboxStubs.h"
#include "platform/profile/profile.h"

View file

@ -32,7 +32,7 @@
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/world/entity/item/MinecartHopper.h"
#include "minecraft/world/level/ConsoleGameRulesConstants.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/XboxStubs.h"
// JoinFromInviteData moved to NetworkController.h

View file

@ -9,7 +9,7 @@
#endif
#include "minecraft/network/INetworkService.h"
#include "platform/C4JThread.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/network/IPlatformNetwork.h"
#include "platform/network/network.h"

View file

@ -4,7 +4,7 @@
#include "app/common/App_structs.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/XboxStubs.h"
#include "platform/storage/storage.h"

View file

@ -31,7 +31,7 @@
#include "app/common/Audio/SoundTypes.h"
#include "minecraft/world/level/LevelSettings.h"
#include "minecraft/world/level/chunk/ChunkSource.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/input/input.h"
#include "platform/profile/profile.h"

View file

@ -29,7 +29,7 @@
#include "app/common/Audio/SoundTypes.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "minecraft/world/level/LevelSettings.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"

View file

@ -26,7 +26,7 @@
#include "app/common/Audio/SoundTypes.h"
#include "minecraft/world/level/GameRules/LevelGenerationOptions.h"
#include "minecraft/world/level/LevelSettings.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/input/input.h"
#include "platform/profile/profile.h"
#include "strings.h"

View file

@ -30,7 +30,7 @@
#include "minecraft/client/gui/ScreenSizeCalculator.h"
#include "minecraft/server/MinecraftServer.h"
#include "app/common/Audio/SoundTypes.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/profile/profile.h"
#include "platform/renderer/renderer.h"

View file

@ -8,7 +8,7 @@
#include "app/common/UI/UIScene.h"
#include "app/linux/Iggy/include/rrCore.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/XboxStubs.h"
#include "platform/profile/ProfileConstants.h"

View file

@ -9,7 +9,7 @@
#include "app/common/UI/Controls/UIControl_PlayerList.h"
#include "app/common/UI/UIScene.h"
#include "app/linux/Iggy/include/rrCore.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
class INetworkPlayer;
class UILayer;

View file

@ -28,7 +28,7 @@
#include "minecraft/server/MinecraftServer.h"
#include "minecraft/world/level/LevelSettings.h"
#include "minecraft/world/level/chunk/ChunkSource.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/stubs.h"
#include "util/StringHelpers.h"

View file

@ -7,7 +7,7 @@
#include "minecraft/world/level/LevelListener.h"
#include "minecraft/world/phys/AABB.h"
#include "platform/C4JThread.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "util/Definitions.h"
class ClipChunk;

View file

@ -6,7 +6,7 @@
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/renderer/entity/LivingEntityRenderer.h"
#include "minecraft/world/entity/player/Player.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
class HumanoidModel;
class LivingEntity;

View file

@ -9,7 +9,7 @@
#include "app/common/Network/GameNetworkManager.h"
#include "platform/network/network.h"
#include "minecraft/server/network/ServerConnection.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/ShutdownManager.h"
class SocketAddress {};

View file

@ -70,7 +70,7 @@
#include "minecraft/world/level/storage/LevelStorage.h"
#include "minecraft/world/level/storage/PlayerIO.h"
#include "nbt/CompoundTag.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/profile/profile.h"
#include "strings.h"

View file

@ -21,7 +21,7 @@
#include "minecraft/server/PlayerList.h"
#include "minecraft/server/level/ServerPlayer.h"
#include "minecraft/util/Log.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/storage/storage.h"

View file

@ -11,7 +11,7 @@
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "java/System.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "util/Definitions.h"
// Note: See header for an overview of this class

View file

@ -9,7 +9,7 @@
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
// Note: See header for an overview of this class

View file

@ -9,7 +9,7 @@
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
// Note: See header for an overview of this class

View file

@ -5,7 +5,7 @@
#include <string>
#include <vector>
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#ifndef VER_NETWORK

View file

@ -17,20 +17,6 @@ using SessionID = uint64_t;
using GameSessionUID = PlayerUID;
class INVITE_INFO;
inline constexpr int QNET_SENDDATA_LOW_PRIORITY = 0;
inline constexpr int QNET_SENDDATA_SECONDARY = 0;
inline constexpr int QNET_SENDDATA_RELIABLE = 0;
inline constexpr int QNET_SENDDATA_SEQUENTIAL = 0;
inline constexpr int QNET_GETSENDQUEUESIZE_SECONDARY_TYPE = 0;
inline constexpr int QNET_GETSENDQUEUESIZE_MESSAGES = 0;
inline constexpr int QNET_GETSENDQUEUESIZE_BYTES = 0;
#define QNET_E_SESSION_FULL 0
#define QNET_USER_MASK_USER0 1
#define QNET_USER_MASK_USER1 2
#define QNET_USER_MASK_USER2 4
#define QNET_USER_MASK_USER3 8
struct XRNM_SEND_BUFFER {
uint32_t dwDataSize;
uint8_t* pbyData;

View file

@ -1,6 +1,6 @@
#pragma once
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
// A struct that we store in the QoS data when we are hosting the session. Max
// size 1020 bytes.

View file

@ -2,7 +2,7 @@
#include "StubPlatformNetwork.h"
#include "java/System.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
StubNetworkPlayer::StubNetworkPlayer() { m_pSocket = nullptr; }

View file

@ -4,16 +4,16 @@
#include <string>
#include "platform/network/network.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/network/network.h"
class Socket;
// This is an implementation of the INetworkPlayer interface for the supported
// QNet-backed path. It
// effectively wraps the StubNetworkPlayer class in a non-platform-specific way. It is
// managed by PlatformNetworkManagerStub.
// effectively wraps the StubNetworkPlayer class in a non-platform-specific way.
// It is managed by PlatformNetworkManagerStub.
class StubNetworkPlayer : public INetworkPlayer {
public:
@ -21,13 +21,12 @@ public:
// Common player interface
unsigned char GetSmallId();
void SendData(INetworkPlayer* player, const void* pvData,
int dataSize, bool lowPriority, bool ack);
void SendData(INetworkPlayer* player, const void* pvData, int dataSize,
bool lowPriority, bool ack);
bool IsSameSystem(INetworkPlayer* player);
int GetOutstandingAckCount();
int GetSendQueueSizeBytes(INetworkPlayer* player, bool lowPriority);
int GetSendQueueSizeMessages(INetworkPlayer* player,
bool lowPriority);
int GetSendQueueSizeMessages(INetworkPlayer* player, bool lowPriority);
int GetCurrentRtt();
bool IsHost();
bool IsGuest();

View file

@ -9,7 +9,7 @@
#include "app/common/Network/GameNetworkManager.h"
#include "minecraft/network/Socket.h"
#include "platform/C4JThread.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/network/network.h"
namespace platform_internal {
@ -120,24 +120,9 @@ bool StubPlatformNetwork::Initialise(CGameNetworkManager* pGameNetworkManager,
m_bLeaveGameOnTick = false;
m_bHostChanged = false;
m_bSearchResultsReady = false;
m_bSearchPending = false;
m_bIsOfflineGame = false;
m_SessionsUpdatedCallback = nullptr;
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
m_searchResultsCount[i] = 0;
m_lastSearchStartTime[i] = 0;
// The results that will be filled in with the current search
m_pSearchResults[i] = nullptr;
m_pQoSResult[i] = nullptr;
m_pCurrentSearchResults[i] = nullptr;
m_pCurrentQoSResult[i] = nullptr;
m_currentSearchResultsCount[i] = 0;
}
// Success!
return true;
}
@ -343,20 +328,6 @@ void StubPlatformNetwork::SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer) {
m_playerFlags.push_back(newPlayerFlags);
}
// Remove a player from the per system flag storage - just maintains the
// m_playerFlags vector without any gaps in it
void StubPlatformNetwork::SystemFlagRemovePlayer(
INetworkPlayer* pNetworkPlayer) {
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) {
delete m_playerFlags[i];
m_playerFlags[i] = m_playerFlags.back();
m_playerFlags.pop_back();
return;
}
}
}
void StubPlatformNetwork::SystemFlagReset() {
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
delete m_playerFlags[i];
@ -420,10 +391,7 @@ void StubPlatformNetwork::TickSearch() {}
void StubPlatformNetwork::SearchForGames() {}
void StubPlatformNetwork::SetSearchResultsReady(int resultCount) {
m_bSearchResultsReady = true;
m_searchResultsCount[m_lastSearchPad] = resultCount;
}
void StubPlatformNetwork::SetSearchResultsReady(int resultCount) {}
std::vector<FriendSessionInfo*>* StubPlatformNetwork::GetSessionList(
int iPad, int localPlayers, bool partyOnly) {
@ -451,13 +419,6 @@ void StubPlatformNetwork::GetFullFriendSessionInfo(
void StubPlatformNetwork::ForceFriendsSessionRefresh() {
fprintf(stderr, "Resetting friends session search data\n");
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
m_searchResultsCount[i] = 0;
m_lastSearchStartTime[i] = 0;
delete m_pSearchResults[i];
m_pSearchResults[i] = nullptr;
}
}
INetworkPlayer* StubPlatformNetwork::addNetworkPlayer(
@ -484,7 +445,7 @@ INetworkPlayer* StubPlatformNetwork::getNetworkPlayer(
}
INetworkPlayer* StubPlatformNetwork::GetLocalPlayerByUserIndex(int userIndex) {
if (userIndex != 0) return nullptr; // 4jcraft: hack
if (userIndex != 0) return nullptr; // 4jcraft: hack
return getNetworkPlayer(&m_players[userIndex]);
}

View file

@ -6,7 +6,7 @@
#include "StubNetworkPlayer.h"
#include "minecraft/client/model/SkinBox.h"
#include "platform/NetTypes.h"
#include "platform/network/NetTypes.h"
#include "platform/PlatformTypes.h"
#include "platform/XboxStubs.h"
#include "platform/network/IPlatformNetwork.h"
@ -136,19 +136,6 @@ private:
int m_searchResultsCount[XUSER_MAX_COUNT];
int m_lastSearchStartTime[XUSER_MAX_COUNT];
// The results that will be filled in with the current search
XSESSION_SEARCHRESULT_HEADER* m_pSearchResults[XUSER_MAX_COUNT];
XNQOS* m_pQoSResult[XUSER_MAX_COUNT];
// The results from the previous search, which are currently displayed in
// the game
XSESSION_SEARCHRESULT_HEADER* m_pCurrentSearchResults[XUSER_MAX_COUNT];
XNQOS* m_pCurrentQoSResult[XUSER_MAX_COUNT];
int m_currentSearchResultsCount[XUSER_MAX_COUNT];
int m_lastSearchPad;
bool m_bSearchResultsReady;
bool m_bSearchPending;
std::function<void()> m_SessionsUpdatedCallback;
void TickSearch();