From f70d4b703b9f2c74207e8202837e8ca37edf345a Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:48:04 +1100 Subject: [PATCH] refactor: split extraX64.h into NetTypes.h and XboxStubs.h World no longer depends on Xbox/network stubs. INVALID_XUID moved to 4J_Compat.h. XPhysicalAlloc replaced with std::vector in HellFlatLevelSource. --- minecraft/4J.Common/4J_Compat.h | 1 + .../Minecraft.Client/Header Files/NetTypes.h | 155 ++++++++ .../Minecraft.Client/Header Files/XboxStubs.h | 196 ++++++++++ .../Source Files/Extrax64Stubs.cpp | 3 +- .../level/levelgen/HellFlatLevelSource.cpp | 18 +- .../Minecraft.World/x64headers/extraX64.h | 366 +----------------- 6 files changed, 360 insertions(+), 379 deletions(-) create mode 100644 minecraft/Minecraft.Client/Header Files/NetTypes.h create mode 100644 minecraft/Minecraft.Client/Header Files/XboxStubs.h diff --git a/minecraft/4J.Common/4J_Compat.h b/minecraft/4J.Common/4J_Compat.h index e776a6cf9..97dfa4469 100644 --- a/minecraft/4J.Common/4J_Compat.h +++ b/minecraft/4J.Common/4J_Compat.h @@ -27,6 +27,7 @@ inline constexpr int XUSER_INDEX_FOCUS = 254; #define FOURJ_COMMON_PLAYER_UID_DEFINED using PlayerUID = unsigned long long; using PPlayerUID = PlayerUID*; +inline constexpr PlayerUID INVALID_XUID = 0; #endif #endif diff --git a/minecraft/Minecraft.Client/Header Files/NetTypes.h b/minecraft/Minecraft.Client/Header Files/NetTypes.h new file mode 100644 index 000000000..4c03bd353 --- /dev/null +++ b/minecraft/Minecraft.Client/Header Files/NetTypes.h @@ -0,0 +1,155 @@ +#pragma once + +#include +#include +#include +#include + +#include "../../4J.Common/4J_Compat.h" + +inline constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; + +static_assert( + MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), + "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); + +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; +}; + +template +class XLockFreeStack { + std::vector intStack; + std::mutex m_cs; + +public: + XLockFreeStack() = default; + ~XLockFreeStack() = default; + void Initialize() {} + void Push(T* data) { + std::lock_guard lock(m_cs); + intStack.push_back(data); + } + T* Pop() { + std::lock_guard lock(m_cs); + if (intStack.size()) { + T* ret = intStack.back(); + intStack.pop_back(); + return ret; + } + return nullptr; + } +}; + +class IQNetPlayer { +public: + uint8_t GetSmallId(); + void SendData(IQNetPlayer* player, const void* pvData, uint32_t dwDataSize, + uint32_t dwFlags); + bool IsSameSystem(IQNetPlayer* player); + uint32_t GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags); + uint32_t GetCurrentRtt(); + bool IsHost(); + bool IsGuest(); + bool IsLocal(); + PlayerUID GetXuid(); + const wchar_t* GetGamertag(); + int GetSessionIndex(); + bool IsTalking(); + bool IsMutedByLocalUser(uint32_t dwUserIndex); + bool HasVoice(); + bool HasCamera(); + int GetUserIndex(); + void SetCustomDataValue(uintptr_t ulpCustomDataValue); + uintptr_t GetCustomDataValue(); + +private: + uintptr_t m_customData; +}; + +enum QNET_STATE { + QNET_STATE_IDLE, + QNET_STATE_SESSION_HOSTING, + QNET_STATE_SESSION_JOINING, + QNET_STATE_GAME_LOBBY, + QNET_STATE_SESSION_REGISTERING, + QNET_STATE_SESSION_STARTING, + QNET_STATE_GAME_PLAY, + QNET_STATE_SESSION_ENDING, + QNET_STATE_SESSION_LEAVING, + QNET_STATE_SESSION_DELETING +}; + +class IQNet { +public: + int32_t AddLocalPlayerByUserIndex(uint32_t dwUserIndex); + IQNetPlayer* GetHostPlayer(); + IQNetPlayer* GetLocalPlayerByUserIndex(uint32_t dwUserIndex); + IQNetPlayer* GetPlayerByIndex(uint32_t dwPlayerIndex); + IQNetPlayer* GetPlayerBySmallId(uint8_t SmallId); + IQNetPlayer* GetPlayerByXuid(PlayerUID xuid); + uint32_t GetPlayerCount(); + QNET_STATE GetState(); + bool IsHost(); + int32_t JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, + const INVITE_INFO* pInviteInfo); + void HostGame(); + void EndGame(); + + static IQNetPlayer m_player[4]; +}; + +class IQNetCallbacks {}; +class IQNetGameSearch {}; + +struct XNQOSINFO { + uint8_t bFlags; + uint8_t bReserved; + uint16_t cProbesXmit; + uint16_t cProbesRecv; + uint16_t cbData; + uint8_t* pbData; + uint16_t wRttMinInMsecs; + uint16_t wRttMedInMsecs; + uint32_t dwUpBitsPerSec; + uint32_t dwDnBitsPerSec; +}; + +struct XNQOS { + uint32_t cxnqos; + uint32_t cxnqosPending; + XNQOSINFO axnqosinfo[1]; +}; + +struct XOVERLAPPED {}; + +struct XSESSION_SEARCHRESULT {}; + +struct XUSER_CONTEXT { + uint32_t dwContextId; + uint32_t dwValue; +}; + +struct XSESSION_SEARCHRESULT_HEADER { + uint32_t dwSearchResults; + XSESSION_SEARCHRESULT* pResults; +}; diff --git a/minecraft/Minecraft.Client/Header Files/XboxStubs.h b/minecraft/Minecraft.Client/Header Files/XboxStubs.h new file mode 100644 index 000000000..1d5b743a2 --- /dev/null +++ b/minecraft/Minecraft.Client/Header Files/XboxStubs.h @@ -0,0 +1,196 @@ +#pragma once + +#include +#include + +#include "../../4J.Common/4J_Compat.h" + +// XUI forward declarations +typedef struct _XUIOBJ* HXUIOBJ; +typedef struct _XUICLASS* HXUICLASS; +typedef struct _XUIBRUSH* HXUIBRUSH; +typedef struct _XUIDC* HXUIDC; + +bool IsEqualXUID(PlayerUID a, PlayerUID b); + +// Gamepad virtual key constants +#define VK_PAD_A 0x5800 +#define VK_PAD_B 0x5801 +#define VK_PAD_X 0x5802 +#define VK_PAD_Y 0x5803 +#define VK_PAD_RSHOULDER 0x5804 +#define VK_PAD_LSHOULDER 0x5805 +#define VK_PAD_LTRIGGER 0x5806 +#define VK_PAD_RTRIGGER 0x5807 + +#define VK_PAD_DPAD_UP 0x5810 +#define VK_PAD_DPAD_DOWN 0x5811 +#define VK_PAD_DPAD_LEFT 0x5812 +#define VK_PAD_DPAD_RIGHT 0x5813 +#define VK_PAD_START 0x5814 +#define VK_PAD_BACK 0x5815 +#define VK_PAD_LTHUMB_PRESS 0x5816 +#define VK_PAD_RTHUMB_PRESS 0x5817 + +#define VK_PAD_LTHUMB_UP 0x5820 +#define VK_PAD_LTHUMB_DOWN 0x5821 +#define VK_PAD_LTHUMB_RIGHT 0x5822 +#define VK_PAD_LTHUMB_LEFT 0x5823 +#define VK_PAD_LTHUMB_UPLEFT 0x5824 +#define VK_PAD_LTHUMB_UPRIGHT 0x5825 +#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826 +#define VK_PAD_LTHUMB_DOWNLEFT 0x5827 + +#define VK_PAD_RTHUMB_UP 0x5830 +#define VK_PAD_RTHUMB_DOWN 0x5831 +#define VK_PAD_RTHUMB_RIGHT 0x5832 +#define VK_PAD_RTHUMB_LEFT 0x5833 +#define VK_PAD_RTHUMB_UPLEFT 0x5834 +#define VK_PAD_RTHUMB_UPRIGHT 0x5835 +#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 +#define VK_PAD_RTHUMB_DOWNLEFT 0x5837 + +// D3D stubs +inline constexpr int D3DBLEND_CONSTANTALPHA = 0; +inline constexpr int D3DBLEND_INVCONSTANTALPHA = 0; +inline constexpr int D3DPT_QUADLIST = 0; + +class D3DXVECTOR3 { +public: + D3DXVECTOR3(); + D3DXVECTOR3(float, float, float); + float x, y, z, pad; + D3DXVECTOR3& operator+=(const D3DXVECTOR3& add); +}; + +// XUI string table +class CXuiStringTable { +public: + const wchar_t* Lookup(const wchar_t* szId); + const wchar_t* Lookup(uint32_t nIndex); + void Clear(); + int32_t Load(const wchar_t* szId); +}; + +// Compression context stubs +typedef void* XMEMDECOMPRESSION_CONTEXT; +typedef void* XMEMCOMPRESSION_CONTEXT; + +enum XMEMCODEC_TYPE { + XMEMCODEC_DEFAULT = 0, + XMEMCODEC_LZX = 1 +}; + +int32_t XMemDecompress(XMEMDECOMPRESSION_CONTEXT Context, void* pDestination, + size_t* pDestSize, void* pSource, size_t SrcSize); +int32_t XMemCompress(XMEMCOMPRESSION_CONTEXT Context, void* pDestination, + size_t* pDestSize, void* pSource, size_t SrcSize); +int32_t XMemCreateCompressionContext(XMEMCODEC_TYPE CodecType, + const void* pCodecParams, uint32_t Flags, + XMEMCOMPRESSION_CONTEXT* pContext); +int32_t XMemCreateDecompressionContext(XMEMCODEC_TYPE CodecType, + const void* pCodecParams, uint32_t Flags, + XMEMDECOMPRESSION_CONTEXT* pContext); +void XMemDestroyCompressionContext(XMEMCOMPRESSION_CONTEXT Context); +void XMemDestroyDecompressionContext(XMEMDECOMPRESSION_CONTEXT Context); + +struct XMEMCODEC_PARAMETERS_LZX { + uint32_t Flags; + uint32_t WindowSize; + uint32_t CompressionPartitionSize; +}; + +// User sign-in +struct XUSER_SIGNIN_INFO { + PlayerUID xuid; + uint32_t dwGuestNumber; +}; +using PXUSER_SIGNIN_INFO = XUSER_SIGNIN_INFO*; + +#define XUSER_GET_SIGNIN_INFO_ONLINE_XUID_ONLY 0x00000001 +#define XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY 0x00000002 + +uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, + PXUSER_SIGNIN_INFO pSigninInfo); + +// Locale/language constants +inline constexpr int XC_LANGUAGE_ENGLISH = 0x01; +inline constexpr int XC_LANGUAGE_JAPANESE = 0x02; +inline constexpr int XC_LANGUAGE_GERMAN = 0x03; +inline constexpr int XC_LANGUAGE_FRENCH = 0x04; +inline constexpr int XC_LANGUAGE_SPANISH = 0x05; +inline constexpr int XC_LANGUAGE_ITALIAN = 0x06; +inline constexpr int XC_LANGUAGE_KOREAN = 0x07; +inline constexpr int XC_LANGUAGE_TCHINESE = 0x08; +inline constexpr int XC_LANGUAGE_PORTUGUESE = 0x09; +inline constexpr int XC_LANGUAGE_POLISH = 0x0B; +inline constexpr int XC_LANGUAGE_RUSSIAN = 0x0C; +inline constexpr int XC_LANGUAGE_SWEDISH = 0x0D; +inline constexpr int XC_LANGUAGE_TURKISH = 0x0E; +inline constexpr int XC_LANGUAGE_BNORWEGIAN = 0x0F; +inline constexpr int XC_LANGUAGE_DUTCH = 0x10; +inline constexpr int XC_LANGUAGE_SCHINESE = 0x11; +inline constexpr int XC_LANGUAGE_LATINAMERICANSPANISH = 0xF0; +inline constexpr int XC_LANGUAGE_FINISH = 0xF1; +inline constexpr int XC_LANGUAGE_GREEK = 0xF2; +inline constexpr int XC_LANGUAGE_DANISH = 0xF3; +inline constexpr int XC_LANGUAGE_CZECH = 0xF4; +inline constexpr int XC_LANGUAGE_SLOVAK = 0xF5; + +inline constexpr int XC_LOCALE_AUSTRALIA = 1; +inline constexpr int XC_LOCALE_AUSTRIA = 2; +inline constexpr int XC_LOCALE_BELGIUM = 3; +inline constexpr int XC_LOCALE_BRAZIL = 4; +inline constexpr int XC_LOCALE_CANADA = 5; +inline constexpr int XC_LOCALE_CHILE = 6; +inline constexpr int XC_LOCALE_CHINA = 7; +inline constexpr int XC_LOCALE_COLOMBIA = 8; +inline constexpr int XC_LOCALE_CZECH_REPUBLIC = 9; +inline constexpr int XC_LOCALE_DENMARK = 10; +inline constexpr int XC_LOCALE_FINLAND = 11; +inline constexpr int XC_LOCALE_FRANCE = 12; +inline constexpr int XC_LOCALE_GERMANY = 13; +inline constexpr int XC_LOCALE_GREECE = 14; +inline constexpr int XC_LOCALE_HONG_KONG = 15; +inline constexpr int XC_LOCALE_HUNGARY = 16; +inline constexpr int XC_LOCALE_INDIA = 17; +inline constexpr int XC_LOCALE_IRELAND = 18; +inline constexpr int XC_LOCALE_ITALY = 19; +inline constexpr int XC_LOCALE_JAPAN = 20; +inline constexpr int XC_LOCALE_KOREA = 21; +inline constexpr int XC_LOCALE_MEXICO = 22; +inline constexpr int XC_LOCALE_NETHERLANDS = 23; +inline constexpr int XC_LOCALE_NEW_ZEALAND = 24; +inline constexpr int XC_LOCALE_NORWAY = 25; +inline constexpr int XC_LOCALE_POLAND = 26; +inline constexpr int XC_LOCALE_PORTUGAL = 27; +inline constexpr int XC_LOCALE_SINGAPORE = 28; +inline constexpr int XC_LOCALE_SLOVAK_REPUBLIC = 29; +inline constexpr int XC_LOCALE_SOUTH_AFRICA = 30; +inline constexpr int XC_LOCALE_SPAIN = 31; +inline constexpr int XC_LOCALE_SWEDEN = 32; +inline constexpr int XC_LOCALE_SWITZERLAND = 33; +inline constexpr int XC_LOCALE_TAIWAN = 34; +inline constexpr int XC_LOCALE_GREAT_BRITAIN = 35; +inline constexpr int XC_LOCALE_UNITED_STATES = 36; +inline constexpr int XC_LOCALE_RUSSIAN_FEDERATION = 37; +inline constexpr int XC_LOCALE_WORLD_WIDE = 38; +inline constexpr int XC_LOCALE_TURKEY = 39; +inline constexpr int XC_LOCALE_ARGENTINA = 40; +inline constexpr int XC_LOCALE_SAUDI_ARABIA = 41; +inline constexpr int XC_LOCALE_ISRAEL = 42; +inline constexpr int XC_LOCALE_UNITED_ARAB_EMIRATES = 43; +inline constexpr int XC_LOCALE_LATIN_AMERICA = 240; + +uint32_t XGetLanguage(); +uint32_t XGetLocale(); +uint32_t XEnableGuestSignin(bool fEnable); + +inline constexpr int XN_SYS_SIGNINCHANGED = 0; +inline constexpr int XN_SYS_INPUTDEVICESCHANGED = 1; +inline constexpr int XN_LIVE_CONTENT_INSTALLED = 2; +inline constexpr int XN_SYS_STORAGEDEVICESCHANGED = 3; + +inline constexpr int XZP_ICON_SHANK_01 = 1; +inline constexpr int XZP_ICON_SHANK_02 = 2; +inline constexpr int XZP_ICON_SHANK_03 = 3; diff --git a/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp b/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp index c0475e8ac..87534ee2d 100644 --- a/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp +++ b/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp @@ -9,7 +9,8 @@ #include "4J.Common/4J_Compat.h" #include "Minecraft.Client/Linux/Stubs/winapi_stubs.h" -#include "Minecraft.World/x64headers/extraX64.h" +#include "Minecraft.Client/Header Files/NetTypes.h" +#include "Minecraft.Client/Header Files/XboxStubs.h" class INVITE_INFO; #if defined(_WINDOWS64) diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp index b43dddb3e..b448d0425 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -103,29 +103,13 @@ LevelChunk* HellFlatLevelSource::create(int x, int z) { return getChunk(x, z); } LevelChunk* HellFlatLevelSource::getChunk(int xOffs, int zOffs) { random->setSeed(xOffs * 341873128712l + zOffs * 132897987541l); - // 4J - now allocating this with a physical alloc & bypassing general memory - // management so that it will get cleanly freed int chunksSize = Level::genDepth * 16 * 16; - uint8_t* tileData = (uint8_t*)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, - PAGE_READWRITE); - memset(tileData, 0, chunksSize); - std::vector blocks = std::vector(tileData, tileData + chunksSize); - // std::vector blocks = std::vector(16 * level->depth * 16); + std::vector blocks(chunksSize, 0); prepareHeights(xOffs, zOffs, blocks); buildSurfaces(xOffs, zOffs, blocks); - // caveFeature->apply(this, level, xOffs, zOffs, blocks); - // townFeature.apply(this, level, xOffs, zOffs, blocks); - // addCaves(xOffs, zOffs, blocks); - // addTowns(xOffs, zOffs, blocks); - - // 4J - this now creates compressed block data from the blocks array passed - // in, so needs to be after data is finalised. Also now need to free the - // passed in blocks as the LevelChunk doesn't use the passed in allocation - // anymore. LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); - free(tileData); return levelChunk; } diff --git a/minecraft/Minecraft.World/x64headers/extraX64.h b/minecraft/Minecraft.World/x64headers/extraX64.h index 5356c1810..8082b7b09 100644 --- a/minecraft/Minecraft.World/x64headers/extraX64.h +++ b/minecraft/Minecraft.World/x64headers/extraX64.h @@ -1,364 +1,8 @@ +// Compatibility shim — includes the split headers for code that still +// references the old monolithic header. Migrate direct includers to use +// NetTypes.h or XboxStubs.h instead, then delete this file. #pragma once -#include -#include -#include -#include -#include -#include -#include -#include "../../4J.Common/4J_Compat.h" +#include "Minecraft.Client/Header Files/NetTypes.h" +#include "Minecraft.Client/Header Files/XboxStubs.h" #include "Minecraft.Client/Header Files/SkinBox.h" - -#include - -#define MULTITHREAD_ENABLE - -constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; - -static_assert( - MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), - "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); - -typedef uint64_t SessionID; -typedef PlayerUID GameSessionUID; -class INVITE_INFO; - -typedef struct _XUIOBJ* HXUIOBJ; -typedef struct _XUICLASS* HXUICLASS; -typedef struct _XUIBRUSH* HXUIBRUSH; -typedef struct _XUIDC* HXUIDC; - -bool IsEqualXUID(PlayerUID a, PlayerUID b); - -template -class XLockFreeStack { - std::vector intStack; - std::mutex m_cs; - -public: - XLockFreeStack() = default; - ~XLockFreeStack() = default; - void Initialize() {} - void Push(T* data) { - std::lock_guard lock(m_cs); - intStack.push_back(data); - } - T* Pop() { - std::lock_guard lock(m_cs); - if (intStack.size()) { - T* ret = intStack.back(); - intStack.pop_back(); - return ret; - } - - return nullptr; - } -}; - -class DLCManager; -class LevelRuleset; -class ModelPart; -class LevelChunk; -class IXACT3Engine; -class XACT_NOTIFICATION; -class ConsoleSchematicFile; - -const int XZP_ICON_SHANK_01 = 1; -const int XZP_ICON_SHANK_02 = 2; -const int XZP_ICON_SHANK_03 = 3; - -const int XN_SYS_SIGNINCHANGED = 0; -const int XN_SYS_INPUTDEVICESCHANGED = 1; -const int XN_LIVE_CONTENT_INSTALLED = 2; -const int XN_SYS_STORAGEDEVICESCHANGED = 3; - -#define VK_PAD_A 0x5800 -#define VK_PAD_B 0x5801 -#define VK_PAD_X 0x5802 -#define VK_PAD_Y 0x5803 -#define VK_PAD_RSHOULDER 0x5804 -#define VK_PAD_LSHOULDER 0x5805 -#define VK_PAD_LTRIGGER 0x5806 -#define VK_PAD_RTRIGGER 0x5807 - -#define VK_PAD_DPAD_UP 0x5810 -#define VK_PAD_DPAD_DOWN 0x5811 -#define VK_PAD_DPAD_LEFT 0x5812 -#define VK_PAD_DPAD_RIGHT 0x5813 -#define VK_PAD_START 0x5814 -#define VK_PAD_BACK 0x5815 -#define VK_PAD_LTHUMB_PRESS 0x5816 -#define VK_PAD_RTHUMB_PRESS 0x5817 - -#define VK_PAD_LTHUMB_UP 0x5820 -#define VK_PAD_LTHUMB_DOWN 0x5821 -#define VK_PAD_LTHUMB_RIGHT 0x5822 -#define VK_PAD_LTHUMB_LEFT 0x5823 -#define VK_PAD_LTHUMB_UPLEFT 0x5824 -#define VK_PAD_LTHUMB_UPRIGHT 0x5825 -#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826 -#define VK_PAD_LTHUMB_DOWNLEFT 0x5827 - -#define VK_PAD_RTHUMB_UP 0x5830 -#define VK_PAD_RTHUMB_DOWN 0x5831 -#define VK_PAD_RTHUMB_RIGHT 0x5832 -#define VK_PAD_RTHUMB_LEFT 0x5833 -#define VK_PAD_RTHUMB_UPLEFT 0x5834 -#define VK_PAD_RTHUMB_UPRIGHT 0x5835 -#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 -#define VK_PAD_RTHUMB_DOWNLEFT 0x5837 - -class IQNetPlayer { -public: - uint8_t GetSmallId(); - void SendData(IQNetPlayer* player, const void* pvData, uint32_t dwDataSize, - uint32_t dwFlags); - bool IsSameSystem(IQNetPlayer* player); - uint32_t GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags); - uint32_t GetCurrentRtt(); - bool IsHost(); - bool IsGuest(); - bool IsLocal(); - PlayerUID GetXuid(); - const wchar_t* GetGamertag(); - int GetSessionIndex(); - bool IsTalking(); - bool IsMutedByLocalUser(uint32_t dwUserIndex); - bool HasVoice(); - bool HasCamera(); - int GetUserIndex(); - void SetCustomDataValue(uintptr_t ulpCustomDataValue); - uintptr_t GetCustomDataValue(); - -private: - uintptr_t m_customData; -}; - -const int QNET_GETSENDQUEUESIZE_SECONDARY_TYPE = 0; -const int QNET_GETSENDQUEUESIZE_MESSAGES = 0; -const int QNET_GETSENDQUEUESIZE_BYTES = 0; - -typedef struct { - uint8_t bFlags; - uint8_t bReserved; - uint16_t cProbesXmit; - uint16_t cProbesRecv; - uint16_t cbData; - uint8_t* pbData; - uint16_t wRttMinInMsecs; - uint16_t wRttMedInMsecs; - uint32_t dwUpBitsPerSec; - uint32_t dwDnBitsPerSec; -} XNQOSINFO; - -typedef struct { - uint32_t cxnqos; - uint32_t cxnqosPending; - XNQOSINFO axnqosinfo[1]; -} XNQOS; - -typedef struct _XOVERLAPPED { -} XOVERLAPPED, *PXOVERLAPPED; - -typedef struct _XSESSION_SEARCHRESULT { -} XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT; - -typedef struct { - uint32_t dwContextId; - uint32_t dwValue; -} XUSER_CONTEXT, *PXUSER_CONTEXT; - -typedef struct _XSESSION_SEARCHRESULT_HEADER { - uint32_t dwSearchResults; - XSESSION_SEARCHRESULT* pResults; -} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER; - -class IQNetCallbacks {}; -class IQNetGameSearch {}; - -typedef enum _QNET_STATE { - QNET_STATE_IDLE, - QNET_STATE_SESSION_HOSTING, - QNET_STATE_SESSION_JOINING, - QNET_STATE_GAME_LOBBY, - QNET_STATE_SESSION_REGISTERING, - QNET_STATE_SESSION_STARTING, - QNET_STATE_GAME_PLAY, - QNET_STATE_SESSION_ENDING, - QNET_STATE_SESSION_LEAVING, - QNET_STATE_SESSION_DELETING -} QNET_STATE, - *PQNET_STATE; - -class IQNet { -public: - int32_t AddLocalPlayerByUserIndex(uint32_t dwUserIndex); - IQNetPlayer* GetHostPlayer(); - IQNetPlayer* GetLocalPlayerByUserIndex(uint32_t dwUserIndex); - IQNetPlayer* GetPlayerByIndex(uint32_t dwPlayerIndex); - IQNetPlayer* GetPlayerBySmallId(uint8_t SmallId); - IQNetPlayer* GetPlayerByXuid(PlayerUID xuid); - uint32_t GetPlayerCount(); - QNET_STATE GetState(); - bool IsHost(); - int32_t JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, - const INVITE_INFO* pInviteInfo); - void HostGame(); - void EndGame(); - - static IQNetPlayer m_player[4]; -}; - -const int QNET_SENDDATA_LOW_PRIORITY = 0; -const int QNET_SENDDATA_SECONDARY = 0; -constexpr PlayerUID INVALID_XUID = 0; - -const int QNET_SENDDATA_RELIABLE = 0; -const int QNET_SENDDATA_SEQUENTIAL = 0; - -struct XRNM_SEND_BUFFER { - uint32_t dwDataSize; - uint8_t* pbyData; -}; - -const int D3DBLEND_CONSTANTALPHA = 0; -const int D3DBLEND_INVCONSTANTALPHA = 0; -const int D3DPT_QUADLIST = 0; - -typedef struct _XUSER_SIGNIN_INFO { - PlayerUID xuid; - uint32_t dwGuestNumber; -} XUSER_SIGNIN_INFO, *PXUSER_SIGNIN_INFO; - -#define XUSER_GET_SIGNIN_INFO_ONLINE_XUID_ONLY 0x00000001 -#define XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY 0x00000002 - -uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, - PXUSER_SIGNIN_INFO pSigninInfo); - -class CXuiStringTable { -public: - const wchar_t* Lookup(const wchar_t* szId); - const wchar_t* Lookup(uint32_t nIndex); - void Clear(); - int32_t Load(const wchar_t* szId); -}; - -typedef void* XMEMDECOMPRESSION_CONTEXT; -typedef void* XMEMCOMPRESSION_CONTEXT; - -typedef enum _XMEMCODEC_TYPE { - XMEMCODEC_DEFAULT = 0, - XMEMCODEC_LZX = 1 -} XMEMCODEC_TYPE; - -int32_t XMemDecompress(XMEMDECOMPRESSION_CONTEXT Context, void* pDestination, - size_t* pDestSize, void* pSource, size_t SrcSize); - -int32_t XMemCompress(XMEMCOMPRESSION_CONTEXT Context, void* pDestination, - size_t* pDestSize, void* pSource, size_t SrcSize); - -int32_t XMemCreateCompressionContext(XMEMCODEC_TYPE CodecType, - const void* pCodecParams, uint32_t Flags, - XMEMCOMPRESSION_CONTEXT* pContext); - -int32_t XMemCreateDecompressionContext(XMEMCODEC_TYPE CodecType, - const void* pCodecParams, uint32_t Flags, - XMEMDECOMPRESSION_CONTEXT* pContext); - -typedef struct _XMEMCODEC_PARAMETERS_LZX { - uint32_t Flags; - uint32_t WindowSize; - uint32_t CompressionPartitionSize; -} XMEMCODEC_PARAMETERS_LZX; - -void XMemDestroyCompressionContext(XMEMCOMPRESSION_CONTEXT Context); -void XMemDestroyDecompressionContext(XMEMDECOMPRESSION_CONTEXT Context); - -const int XC_LANGUAGE_ENGLISH = 0x01; -const int XC_LANGUAGE_JAPANESE = 0x02; -const int XC_LANGUAGE_GERMAN = 0x03; -const int XC_LANGUAGE_FRENCH = 0x04; -const int XC_LANGUAGE_SPANISH = 0x05; -const int XC_LANGUAGE_ITALIAN = 0x06; -const int XC_LANGUAGE_KOREAN = 0x07; -const int XC_LANGUAGE_TCHINESE = 0x08; -const int XC_LANGUAGE_PORTUGUESE = 0x09; -const int XC_LANGUAGE_POLISH = 0x0B; -const int XC_LANGUAGE_RUSSIAN = 0x0C; -const int XC_LANGUAGE_SWEDISH = 0x0D; -const int XC_LANGUAGE_TURKISH = 0x0E; -const int XC_LANGUAGE_BNORWEGIAN = 0x0F; -const int XC_LANGUAGE_DUTCH = 0x10; -const int XC_LANGUAGE_SCHINESE = 0x11; - -const int XC_LANGUAGE_LATINAMERICANSPANISH = 0xF0; -const int XC_LANGUAGE_FINISH = 0xF1; -const int XC_LANGUAGE_GREEK = 0xF2; -const int XC_LANGUAGE_DANISH = 0xF3; -const int XC_LANGUAGE_CZECH = 0xF4; -const int XC_LANGUAGE_SLOVAK = 0xF5; - -const int XC_LOCALE_AUSTRALIA = 1; -const int XC_LOCALE_AUSTRIA = 2; -const int XC_LOCALE_BELGIUM = 3; -const int XC_LOCALE_BRAZIL = 4; -const int XC_LOCALE_CANADA = 5; -const int XC_LOCALE_CHILE = 6; -const int XC_LOCALE_CHINA = 7; -const int XC_LOCALE_COLOMBIA = 8; -const int XC_LOCALE_CZECH_REPUBLIC = 9; -const int XC_LOCALE_DENMARK = 10; -const int XC_LOCALE_FINLAND = 11; -const int XC_LOCALE_FRANCE = 12; -const int XC_LOCALE_GERMANY = 13; -const int XC_LOCALE_GREECE = 14; -const int XC_LOCALE_HONG_KONG = 15; -const int XC_LOCALE_HUNGARY = 16; -const int XC_LOCALE_INDIA = 17; -const int XC_LOCALE_IRELAND = 18; -const int XC_LOCALE_ITALY = 19; -const int XC_LOCALE_JAPAN = 20; -const int XC_LOCALE_KOREA = 21; -const int XC_LOCALE_MEXICO = 22; -const int XC_LOCALE_NETHERLANDS = 23; -const int XC_LOCALE_NEW_ZEALAND = 24; -const int XC_LOCALE_NORWAY = 25; -const int XC_LOCALE_POLAND = 26; -const int XC_LOCALE_PORTUGAL = 27; -const int XC_LOCALE_SINGAPORE = 28; -const int XC_LOCALE_SLOVAK_REPUBLIC = 29; -const int XC_LOCALE_SOUTH_AFRICA = 30; -const int XC_LOCALE_SPAIN = 31; -const int XC_LOCALE_SWEDEN = 32; -const int XC_LOCALE_SWITZERLAND = 33; -const int XC_LOCALE_TAIWAN = 34; -const int XC_LOCALE_GREAT_BRITAIN = 35; -const int XC_LOCALE_UNITED_STATES = 36; -const int XC_LOCALE_RUSSIAN_FEDERATION = 37; -const int XC_LOCALE_WORLD_WIDE = 38; -const int XC_LOCALE_TURKEY = 39; -const int XC_LOCALE_ARGENTINA = 40; -const int XC_LOCALE_SAUDI_ARABIA = 41; -const int XC_LOCALE_ISRAEL = 42; -const int XC_LOCALE_UNITED_ARAB_EMIRATES = 43; -const int XC_LOCALE_LATIN_AMERICA = 240; - -uint32_t XGetLanguage(); -uint32_t XGetLocale(); -uint32_t XEnableGuestSignin(bool fEnable); - -class D3DXVECTOR3 { -public: - D3DXVECTOR3(); - D3DXVECTOR3(float, float, float); - float x, y, z, pad; - D3DXVECTOR3& operator+=(const D3DXVECTOR3& add); -}; - -#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