From dcb2c43944bdfbb6eee7845bb762de0cf144f61e Mon Sep 17 00:00:00 2001 From: Mohamed Ashraf Date: Mon, 2 Mar 2026 08:58:33 +0400 Subject: [PATCH] major fixes of my shit code --- Minecraft.World/CMakeLists.txt | 5 +- Minecraft.World/linux/wlinux.h | 51 ++++++------------- Minecraft.World/linux/xbox_valve.h | 73 --------------------------- Minecraft.World/stdafx.h | 3 +- Minecraft.World/x64headers/extraX64.h | 53 ++++++++++++++++--- 5 files changed, 65 insertions(+), 120 deletions(-) diff --git a/Minecraft.World/CMakeLists.txt b/Minecraft.World/CMakeLists.txt index 853af61fb..945862bb5 100644 --- a/Minecraft.World/CMakeLists.txt +++ b/Minecraft.World/CMakeLists.txt @@ -1988,4 +1988,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE ">" ) -add_compile_options(-fpermissive -Wtemplate-body) +target_compile_options(${PROJECT_NAME} PRIVATE + -fpermissive + -Wtemplate-body +) diff --git a/Minecraft.World/linux/wlinux.h b/Minecraft.World/linux/wlinux.h index bd2e69c90..1fbb6a7ff 100644 --- a/Minecraft.World/linux/wlinux.h +++ b/Minecraft.World/linux/wlinux.h @@ -5,6 +5,7 @@ #include #include +#include #define TRUE true #define FALSE false @@ -37,45 +38,23 @@ typedef struct { long long QuadPart; LONG HighPart; } LARGE_INTEGER; +typedef long long LONGLONG; +typedef size_t SIZE_T; +typedef std::wstring LPWSTR; + +// https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime +typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; +} FILETIME, *PFILETIME, *LPFILETIME; typedef short SHORT; -typedef struct { - int xuidInvitee; - int xuidInviter; - DWORD dwTitleID; - int hostInfo; - bool fFromGameInvite; -} XINVITE_INFO, * PXINVITE_INFO; +typedef VOID* XMEMCOMPRESSION_CONTEXT; +typedef VOID* XMEMDECOMPRESSION_CONTEXT; -typedef XINVITE_INFO INVITE_INFO; +typedef float FLOAT; -typedef struct HXUIOBJ { - // Stub fields representing the actual Xbox HXUIOBJ structure. - int id; - const char* name; -} HXUIOBJ; +#include "../x64headers/extraX64.h" -typedef struct _RTL_CRITICAL_SECTION { - // // - // // The following field is used for blocking when there is contention for - // // the resource - // // - // - union { - ULONG_PTR RawEvent[4]; - } Synchronization; - // - // // - // // The following three fields control entering and exiting the critical - // // section for the resource - // // - // - LONG LockCount; - LONG RecursionCount; - HANDLE OwningThread; -} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; - -typedef RTL_CRITICAL_SECTION CRITICAL_SECTION; - -#endif // WLINUX_H \ No newline at end of file +#endif // WLINUX_H diff --git a/Minecraft.World/linux/xbox_valve.h b/Minecraft.World/linux/xbox_valve.h index 52b4753ba..2eff251a0 100644 --- a/Minecraft.World/linux/xbox_valve.h +++ b/Minecraft.World/linux/xbox_valve.h @@ -126,60 +126,6 @@ typedef struct _XSESSION_INFO XNKEY keyExchangeKey; // 16 bytes } XSESSION_INFO, *PXSESSION_INFO; -typedef struct _XUSER_DATA -{ - BYTE type; - - union - { - int nData; // XUSER_DATA_TYPE_INT32 - int64 i64Data; // XUSER_DATA_TYPE_INT64 - double dblData; // XUSER_DATA_TYPE_DOUBLE - struct // XUSER_DATA_TYPE_UNICODE - { - uint cbData; // Includes null-terminator - char * pwszData; - } string; - float fData; // XUSER_DATA_TYPE_FLOAT - struct // XUSER_DATA_TYPE_BINARY - { - uint cbData; - char * pbData; - } binary; - }; -} XUSER_DATA, *PXUSER_DATA; - -typedef struct _XUSER_PROPERTY -{ - DWORD dwPropertyId; - XUSER_DATA value; -} XUSER_PROPERTY, *PXUSER_PROPERTY; - -typedef struct _XUSER_CONTEXT -{ - DWORD dwContextId; - DWORD dwValue; -} XUSER_CONTEXT, *PXUSER_CONTEXT; - -typedef struct _XSESSION_SEARCHRESULT -{ - XSESSION_INFO info; - DWORD dwOpenPublicSlots; - DWORD dwOpenPrivateSlots; - DWORD dwFilledPublicSlots; - DWORD dwFilledPrivateSlots; - DWORD cProperties; - DWORD cContexts; - PXUSER_PROPERTY pProperties; - PXUSER_CONTEXT pContexts; -} XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT; - -typedef struct _XSESSION_SEARCHRESULT_HEADER -{ - DWORD dwSearchResults; - XSESSION_SEARCHRESULT *pResults; -} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER; - typedef struct _XSESSION_REGISTRANT { uint64 qwMachineID; @@ -195,25 +141,6 @@ typedef struct _XSESSION_REGISTRATION_RESULTS XSESSION_REGISTRANT *rgRegistrants; } XSESSION_REGISTRATION_RESULTS, *PXSESSION_REGISTRATION_RESULTS; -typedef struct { - BYTE bFlags; - BYTE bReserved; - WORD cProbesXmit; - WORD cProbesRecv; - WORD cbData; - BYTE * pbData; - WORD wRttMinInMsecs; - WORD wRttMedInMsecs; - DWORD dwUpBitsPerSec; - DWORD dwDnBitsPerSec; -} XNQOSINFO; - -typedef struct { - uint cxnqos; - uint cxnqosPending; - XNQOSINFO axnqosinfo[1]; -} XNQOS; - #define XSESSION_CREATE_HOST 0 #define XUSER_DATA_TYPE_INT32 0 #define XSESSION_CREATE_USES_ARBITRATION 0 diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 34f815375..d53a12849 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -124,8 +124,7 @@ typedef XUID GameSessionUID; #include #endif -#if !defined(__linux__) -#include "extraX64.h" +#if defined(__linux__) #else #include "../Minecraft.Client/Xbox/Network/extra.h" #endif diff --git a/Minecraft.World/x64headers/extraX64.h b/Minecraft.World/x64headers/extraX64.h index d06b24207..a210fc892 100644 --- a/Minecraft.World/x64headers/extraX64.h +++ b/Minecraft.World/x64headers/extraX64.h @@ -4,15 +4,16 @@ #include #include -#include "..\..\Minecraft.Client\SkinBox.h" +#include "../../Minecraft.Client/SkinBox.h" #include #define MULTITHREAD_ENABLE +#ifndef __linux__ typedef unsigned char byte; - +#endif // __linux__ const int XUSER_INDEX_ANY = 255; const int XUSER_INDEX_FOCUS = 254; @@ -24,7 +25,43 @@ const int XUSER_MAX_COUNT = 4; const int MINECRAFT_NET_MAX_PLAYERS = 8; #endif +#if defined(__linux__) +typedef struct _RTL_CRITICAL_SECTION { + // // + // // The following field is used for blocking when there is contention for + // // the resource + // // + // + union { + ULONG_PTR RawEvent[4]; + } Synchronization; + // + // // + // // The following three fields control entering and exiting the critical + // // section for the resource + // // + // + LONG LockCount; + LONG RecursionCount; + HANDLE OwningThread; +} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; + +typedef RTL_CRITICAL_SECTION CRITICAL_SECTION; + + +inline void DeleteCriticalSection(CRITICAL_SECTION* stubEnterCS) +{ +} + +inline void EnterCriticalSection(CRITICAL_SECTION* stubEnterCS) +{ +} + +inline void LeaveCriticalSection( CRITICAL_SECTION* stubEnterCS) +{ +} +#endif // __linux__ #ifdef __ORBIS__ #include @@ -406,7 +443,7 @@ const int QNET_SENDDATA_SEQUENTIAL = 0; struct XRNM_SEND_BUFFER { DWORD dwDataSize; - byte *pbyData; + std::byte *pbyData; }; const int D3DBLEND_CONSTANTALPHA = 0; @@ -451,7 +488,7 @@ HRESULT XMemDecompress( XMEMDECOMPRESSION_CONTEXT Context, VOID *pDestination, SIZE_T *pDestSize, - CONST VOID *pSource, + VOID *pSource, SIZE_T SrcSize ); @@ -460,20 +497,20 @@ HRESULT XMemCompress( XMEMCOMPRESSION_CONTEXT Context, VOID *pDestination, SIZE_T *pDestSize, - CONST VOID *pSource, + VOID *pSource, SIZE_T SrcSize ); HRESULT XMemCreateCompressionContext( XMEMCODEC_TYPE CodecType, - CONST VOID *pCodecParams, + const VOID *pCodecParams, DWORD Flags, XMEMCOMPRESSION_CONTEXT *pContext ); HRESULT XMemCreateDecompressionContext( XMEMCODEC_TYPE CodecType, - CONST VOID *pCodecParams, + const VOID *pCodecParams, DWORD Flags, XMEMDECOMPRESSION_CONTEXT *pContext ); @@ -630,7 +667,7 @@ public: D3DXVECTOR3(); D3DXVECTOR3(float,float,float); float x,y,z,pad; - D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& add ); + D3DXVECTOR3& operator += ( const D3DXVECTOR3& add ); }; #define QNET_E_SESSION_FULL 0