refactor: split QNet stubs out of XboxStubs.cpp, remove dead Xbox symbols

This commit is contained in:
MatthewBeshay 2026-04-04 14:30:57 +11:00 committed by Tropical
parent 54a1f90212
commit f28c722da4
6 changed files with 58 additions and 88 deletions

View file

@ -7,7 +7,6 @@
#endif
#include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h"
#include "platform/XboxStubs.h"
#include "NetworkPlayerInterface.h"
#include "SessionInfo.h"
#include "platform/C4JThread.h"

View file

@ -0,0 +1,55 @@
#include "platform/NetTypes.h"
#include "platform/PlatformTypes.h"
IQNetPlayer IQNet::m_player[4];
static bool s_gameRunning = false;
uint8_t IQNetPlayer::GetSmallId() { return 0; }
void IQNetPlayer::SendData(IQNetPlayer* player, const void* pvData,
uint32_t dwDataSize, uint32_t dwFlags) {}
bool IQNetPlayer::IsSameSystem(IQNetPlayer* player) { return true; }
uint32_t IQNetPlayer::GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags) {
return 0;
}
uint32_t IQNetPlayer::GetCurrentRtt() { return 0; }
bool IQNetPlayer::IsHost() { return this == &IQNet::m_player[0]; }
bool IQNetPlayer::IsGuest() { return false; }
bool IQNetPlayer::IsLocal() { return true; }
PlayerUID IQNetPlayer::GetXuid() { return INVALID_XUID; }
const wchar_t* IQNetPlayer::GetGamertag() {
static const wchar_t* name = L"stub";
return name;
}
int IQNetPlayer::GetSessionIndex() { return 0; }
bool IQNetPlayer::IsTalking() { return false; }
bool IQNetPlayer::IsMutedByLocalUser(uint32_t dwUserIndex) { return false; }
bool IQNetPlayer::HasVoice() { return false; }
bool IQNetPlayer::HasCamera() { return false; }
int IQNetPlayer::GetUserIndex() { return this - &IQNet::m_player[0]; }
void IQNetPlayer::SetCustomDataValue(uintptr_t ulpCustomDataValue) {
m_customData = ulpCustomDataValue;
}
uintptr_t IQNetPlayer::GetCustomDataValue() { return m_customData; }
int32_t IQNet::AddLocalPlayerByUserIndex(uint32_t dwUserIndex) { return 0; }
IQNetPlayer* IQNet::GetHostPlayer() { return &m_player[0]; }
IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(uint32_t dwUserIndex) {
return &m_player[dwUserIndex];
}
IQNetPlayer* IQNet::GetPlayerByIndex(uint32_t dwPlayerIndex) {
return &m_player[0];
}
IQNetPlayer* IQNet::GetPlayerBySmallId(uint8_t SmallId) { return &m_player[0]; }
IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) { return &m_player[0]; }
uint32_t IQNet::GetPlayerCount() { return 1; }
QNET_STATE IQNet::GetState() {
return s_gameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE;
}
bool IQNet::IsHost() { return true; }
int32_t IQNet::JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask,
const INVITE_INFO* pInviteInfo) {
return 0;
}
void IQNet::HostGame() { s_gameRunning = true; }
void IQNet::EndGame() { s_gameRunning = false; }

View file

@ -1,75 +1,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "platform/PlatformTypes.h"
#include "app/linux/Stubs/winapi_stubs.h"
#include "platform/NetTypes.h"
#include "platform/XboxStubs.h"
class INVITE_INFO;
bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; }
uint8_t IQNetPlayer::GetSmallId() { return 0; }
void IQNetPlayer::SendData(IQNetPlayer* player, const void* pvData,
uint32_t dwDataSize, uint32_t dwFlags) {
#if !defined(__linux__)
app.DebugPrintf("Sending from 0x%x to 0x%x %d bytes\n", this, player,
dwDataSize);
#endif
}
bool IQNetPlayer::IsSameSystem(IQNetPlayer* player) { return true; }
uint32_t IQNetPlayer::GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags) {
return 0;
}
uint32_t IQNetPlayer::GetCurrentRtt() { return 0; }
bool IQNetPlayer::IsHost() { return this == &IQNet::m_player[0]; }
bool IQNetPlayer::IsGuest() { return false; }
bool IQNetPlayer::IsLocal() { return true; }
PlayerUID IQNetPlayer::GetXuid() { return INVALID_XUID; }
const wchar_t* IQNetPlayer::GetGamertag() {
static const wchar_t* test = L"stub";
return test;
}
int IQNetPlayer::GetSessionIndex() { return 0; }
bool IQNetPlayer::IsTalking() { return false; }
bool IQNetPlayer::IsMutedByLocalUser(uint32_t dwUserIndex) { return false; }
bool IQNetPlayer::HasVoice() { return false; }
bool IQNetPlayer::HasCamera() { return false; }
int IQNetPlayer::GetUserIndex() { return this - &IQNet::m_player[0]; }
void IQNetPlayer::SetCustomDataValue(uintptr_t ulpCustomDataValue) {
m_customData = ulpCustomDataValue;
}
uintptr_t IQNetPlayer::GetCustomDataValue() { return m_customData; }
IQNetPlayer IQNet::m_player[4];
bool _bQNetStubGameRunning = false;
int32_t IQNet::AddLocalPlayerByUserIndex(uint32_t dwUserIndex) { return 0; }
IQNetPlayer* IQNet::GetHostPlayer() { return &m_player[0]; }
IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(uint32_t dwUserIndex) {
return &m_player[dwUserIndex];
}
IQNetPlayer* IQNet::GetPlayerByIndex(uint32_t dwPlayerIndex) {
return &m_player[0];
}
IQNetPlayer* IQNet::GetPlayerBySmallId(uint8_t SmallId) { return &m_player[0]; }
IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) { return &m_player[0]; }
uint32_t IQNet::GetPlayerCount() { return 1; }
QNET_STATE IQNet::GetState() {
return _bQNetStubGameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE;
}
bool IQNet::IsHost() { return true; }
int32_t IQNet::JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask,
const INVITE_INFO* pInviteInfo) {
return 0;
}
void IQNet::HostGame() { _bQNetStubGameRunning = true; }
void IQNet::EndGame() { _bQNetStubGameRunning = false; }
bool IsEqualXUID(PlayerUID a, PlayerUID b) { return a == b; }
uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags,
PXUSER_SIGNIN_INFO pSigninInfo) {
@ -81,13 +13,6 @@ const wchar_t* CXuiStringTable::Lookup(uint32_t nIndex) { return L"String"; }
void CXuiStringTable::Clear() {}
int32_t CXuiStringTable::Load(const wchar_t* szId) { return 0; }
uint32_t XUserAreUsersFriends(uint32_t dwUserIndex, PPlayerUID pXuids,
uint32_t dwXuidCount, bool* pfResult,
void* pOverlapped) {
return 0;
}
// #if 1
uint32_t XGetLanguage() { return 1; }
uint32_t XGetLocale() { return 0; }
uint32_t XEnableGuestSignin(bool fEnable) { return 0; }

View file

@ -1,7 +1,6 @@
#pragma once
#include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h"
#include "platform/XboxStubs.h"
#include "OffsettedRenderList.h"
#include "platform/C4JThread.h"
#include "util/Definitions.h"

View file

@ -4,7 +4,6 @@
#include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h"
#include "platform/XboxStubs.h"
#include "MobRenderer.h"
#include "minecraft/client/renderer/entity/LivingEntityRenderer.h"
#include "minecraft/world/entity/player/Player.h"

View file

@ -5,11 +5,8 @@
#include "platform/PlatformTypes.h"
// XUI forward declarations
// XUI handle type (used by App_structs.h for SceneStackPair)
typedef struct _XUIOBJ* HXUIOBJ;
typedef struct _XUICLASS* HXUICLASS;
typedef struct _XUIBRUSH* HXUIBRUSH;
typedef struct _XUIDC* HXUIDC;
bool IsEqualXUID(PlayerUID a, PlayerUID b);
@ -50,11 +47,6 @@ bool IsEqualXUID(PlayerUID a, PlayerUID b);
#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:
@ -150,6 +142,7 @@ uint32_t XGetLanguage();
uint32_t XGetLocale();
uint32_t XEnableGuestSignin(bool fEnable);
// System notification constants (used by Game.cpp notification handler)
inline constexpr int XN_SYS_SIGNINCHANGED = 0;
inline constexpr int XN_SYS_INPUTDEVICESCHANGED = 1;
inline constexpr int XN_LIVE_CONTENT_INSTALLED = 2;