refactor: move misplaced headers to their proper modules

This commit is contained in:
MatthewBeshay
2026-04-06 20:32:24 -05:00
committed by Tropical
parent d814a78453
commit 54a1f90212
95 changed files with 119 additions and 119 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
#include <vector>
#include "PlatformTypes.h"
#include "app/common/NetTypes.h"
#include "platform/NetTypes.h"
#ifndef VER_NETWORK
#define VER_NETWORK 560
+155
View File
@@ -0,0 +1,155 @@
#pragma once
#include <cstdint>
#include <limits>
#include <mutex>
#include <vector>
#include "platform/PlatformTypes.h"
inline constexpr int MINECRAFT_NET_MAX_PLAYERS = 8;
static_assert(
MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits<std::uint8_t>::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 <typename T>
class XLockFreeStack {
std::vector<T*> intStack;
std::mutex m_cs;
public:
XLockFreeStack() = default;
~XLockFreeStack() = default;
void Initialize() {}
void Push(T* data) {
std::lock_guard<std::mutex> lock(m_cs);
intStack.push_back(data);
}
T* Pop() {
std::lock_guard<std::mutex> 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;
};
+160
View File
@@ -0,0 +1,160 @@
#pragma once
#include <cstdint>
#include <string>
#include "platform/PlatformTypes.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;
// 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);
};
// 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;
+308
View File
@@ -0,0 +1,308 @@
#pragma once
#include <string>
#ifdef __linux__
#include <GL/gl.h>
#include <GL/glu.h>
#undef GL_SMOOTH
#undef GL_FLAT
static const int GL_SMOOTH = 0x1D01;
static const int GL_FLAT = 0x1D00;
class FloatBuffer;
class IntBuffer;
class ByteBuffer;
class Minecraft;
void glGenTextures(IntBuffer*);
int glGenTextures();
void glDeleteTextures(IntBuffer*);
void glDeleteTextures(int);
void glLight(int, int, FloatBuffer*);
void glLightModel(int, FloatBuffer*);
void glGetFloat(int, FloatBuffer*);
void glTexGen(int, int, FloatBuffer*);
void glFog(int, FloatBuffer*);
void glTexCoordPointer(int, int, FloatBuffer*);
void glNormalPointer(int, ByteBuffer*);
void glColorPointer(int, bool, int, ByteBuffer*);
void glVertexPointer(int, int, FloatBuffer*);
void glEndList_4J(int vertexCount = 0);
void glTexImage2D(int, int, int, int, int, int, int, int, ByteBuffer*);
void glCallLists(IntBuffer*);
void glGenQueriesARB(IntBuffer*);
void glBeginQueryARB(int, int);
void glEndQueryARB(int);
void glGetQueryObjectuARB(int, int, IntBuffer*);
void glReadPixels(int, int, int, int, int, int, ByteBuffer*);
void LinuxGLLogLightmapState(const char* stage, int textureId, bool scaleLight);
void LinuxLogStubLightmapProbe();
#else
const int GL_BYTE = 0;
const int GL_FLOAT = 0;
const int GL_UNSIGNED_BYTE = 0;
const int GL_COLOR_ARRAY = 0;
const int GL_VERTEX_ARRAY = 0;
const int GL_NORMAL_ARRAY = 0;
const int GL_TEXTURE_COORD_ARRAY = 0;
const int GL_COMPILE = 0x1300;
const int GL_NORMALIZE = 0;
const int GL_RESCALE_NORMAL = 0;
const int GL_SMOOTH = 0;
const int GL_FLAT = 0;
const int GL_RGBA = 0;
const int GL_BGRA = 1;
const int GL_BGR = 0;
const int GL_SAMPLES_PASSED_ARB = 0;
const int GL_QUERY_RESULT_AVAILABLE_ARB = 0;
const int GL_QUERY_RESULT_ARB = 0;
const int GL_POLYGON_OFFSET_FILL = 0;
const int GL_FRONT = 0;
const int GL_BACK = 1;
const int GL_FRONT_AND_BACK = 2;
const int GL_COLOR_MATERIAL = 0;
const int GL_AMBIENT_AND_DIFFUSE = 0;
const int GL_TEXTURE1 = 0;
const int GL_TEXTURE0 = 1;
void glFlush();
void glTexGeni(int, int, int);
void glTexGen(int, int, FloatBuffer*);
void glReadPixels(int, int, int, int, int, int, ByteBuffer*);
void glClearDepth(double);
void glCullFace(int);
void glDeleteLists(int, int);
void glGenTextures(IntBuffer*);
int glGenTextures();
int glGenLists(int);
void glLight(int, int, FloatBuffer*);
void glLightModel(int, FloatBuffer*);
void glGetFloat(int a, FloatBuffer* b);
void glTexCoordPointer(int, int, int, int);
void glTexCoordPointer(int, int, FloatBuffer*);
void glNormalPointer(int, int, int);
void glNormalPointer(int, ByteBuffer*);
void glEnableClientState(int);
void glDisableClientState(int);
void glColorPointer(int, bool, int, ByteBuffer*);
void glColorPointer(int, int, int, int);
void glVertexPointer(int, int, int, int);
void glVertexPointer(int, int, FloatBuffer*);
void glDrawArrays(int, int, int);
void glTranslatef(float, float, float);
void glRotatef(float, float, float, float);
void glNewList(int, int);
void glEndList(int vertexCount = 0);
void glCallList(int);
void glPopMatrix();
void glPushMatrix();
void glColor3f(float, float, float);
void glScalef(float, float, float);
void glMultMatrixf(float*);
void glColor4f(float, float, float, float);
void glDisable(int);
void glEnable(int);
void glBlendFunc(int, int);
void glDepthMask(bool);
void glNormal3f(float, float, float);
void glDepthFunc(int);
void glMatrixMode(int);
void glLoadIdentity();
void glBindTexture(int, int);
void glTexParameteri(int, int, int);
void glTexImage2D(int, int, int, int, int, int, int, int, ByteBuffer*);
void glDeleteTextures(IntBuffer*);
void glDeleteTextures(int);
void glCallLists(IntBuffer*);
void glGenQueriesARB(IntBuffer*);
void glColorMask(bool, bool, bool, bool);
void glBeginQueryARB(int, int);
void glEndQueryARB(int);
void glGetQueryObjectuARB(int, int, IntBuffer*);
void glShadeModel(int);
void glPolygonOffset(float, float);
void glLineWidth(float);
void glScaled(double, double, double);
void gluPerspective(float, float, float, float);
void glClear(int);
void glViewport(int, int, int, int);
void glAlphaFunc(int, float);
void glOrtho(float, float, float, float, float, float);
void glClearColor(float, float, float, float);
void glFogi(int, int);
void glFogf(int, float);
void glFog(int, FloatBuffer*);
void glColorMaterial(int, int);
void glMultiTexCoord2f(int, float, float);
void glClientActiveTexture(int);
void glActiveTexture(int);
#endif
#ifdef __linux__
#include "java/File.h"
class GL11 {
public:
static const int GL_SMOOTH = 0x1D01;
static const int GL_FLAT = 0x1D00;
#undef glShadeModel
#define GL_SHADEMODEL_IS_FUNCTION
static void glShadeModel(int mode) { ::glShadeModel(mode); }
};
#undef GL_ARRAY_BUFFER_ARB
#undef GL_STREAM_DRAW_ARB
class ARBVertexBufferObject {
public:
static const int GL_ARRAY_BUFFER_ARB = 0x8892;
static const int GL_STREAM_DRAW_ARB = 0x88E0;
static void glBindBufferARB(int, int) {}
static void glBufferDataARB(int, ByteBuffer*, int) {}
static void glGenBuffersARB(IntBuffer*) {}
};
#else
class GL11 {
public:
static const int GL_SMOOTH = 0;
static const int GL_FLAT = 0;
static void glShadeModel(int) {};
};
class ARBVertexBufferObject {
public:
static const int GL_ARRAY_BUFFER_ARB = 0;
static const int GL_STREAM_DRAW_ARB = 0;
static void glBindBufferARB(int, int) {}
static void glBufferDataARB(int, ByteBuffer*, int) {}
static void glGenBuffersARB(IntBuffer*) {}
};
#endif
class Level;
class Player;
class Textures;
class Font;
class MapItemSavedData;
class Mob;
class Particles {
public:
void render(float) {}
void tick() {}
};
class BufferedImage;
class Graphics {
public:
void drawImage(BufferedImage*, int, int, void*) {}
void dispose() {}
};
class ZipEntry {};
class InputStream;
class ZipFile {
public:
ZipFile(File* file) {}
InputStream* getInputStream(ZipEntry* entry) { return nullptr; }
ZipEntry* getEntry(const std::wstring& name) { return nullptr; }
void close() {}
};
class ImageIO {
public:
static BufferedImage* read(InputStream* in) { return nullptr; }
};
class Keyboard {
public:
static void create() {}
static void destroy() {}
static bool isKeyDown(int) { return false; }
static std::wstring getKeyName(int) { return L"KEYNAME"; }
static void enableRepeatEvents(bool) {}
static const int KEY_A = 0;
static const int KEY_B = 1;
static const int KEY_C = 2;
static const int KEY_D = 3;
static const int KEY_E = 4;
static const int KEY_F = 5;
static const int KEY_G = 6;
static const int KEY_H = 7;
static const int KEY_I = 8;
static const int KEY_J = 9;
static const int KEY_K = 10;
static const int KEY_L = 11;
static const int KEY_M = 12;
static const int KEY_N = 13;
static const int KEY_O = 14;
static const int KEY_P = 15;
static const int KEY_Q = 16;
static const int KEY_R = 17;
static const int KEY_S = 18;
static const int KEY_T = 19;
static const int KEY_U = 20;
static const int KEY_V = 21;
static const int KEY_W = 22;
static const int KEY_X = 23;
static const int KEY_Y = 24;
static const int KEY_Z = 25;
static const int KEY_SPACE = 26;
static const int KEY_LSHIFT = 27;
static const int KEY_ESCAPE = 28;
static const int KEY_BACK = 29;
static const int KEY_RETURN = 30;
static const int KEY_RSHIFT = 31;
static const int KEY_UP = 32;
static const int KEY_DOWN = 33;
static const int KEY_TAB = 34;
};
class Mouse {
public:
static void create() {}
static void destroy() {}
static int getX() { return 0; }
static int getY() { return 0; }
static bool isButtonDown(int) { return false; }
};
class Display {
public:
static bool isActive() { return true; }
static void update();
static void swapBuffers();
static void destroy() {}
};
class BackgroundDownloader {
public:
BackgroundDownloader(File workDir, Minecraft* minecraft) {}
void start() {}
void halt() {}
void forceReload() {}
};
class Color {
public:
static int HSBtoRGB(float, float, float) { return 0; }
};