From 6ef973ef8b62dba7e9c8c86901376b0b53ee1b3f Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:33:45 -0500 Subject: [PATCH] remove implicit stdafx inclusion from Client --- minecraft/Minecraft.Client/Common/App_enums.h | 64 ------- .../Minecraft.Client/Common/App_structs.h | 1 + .../Minecraft.Client/Common/Consoles_App.h | 2 + .../Common/Source Files/DLC/DLCManager.h | 1 + .../Network/PlatformNetworkManagerInterface.h | 2 + .../Common/Source Files/Tutorial/Tutorial.h | 3 + .../UI/All Platforms/IUIController.h | 1 + .../IUIScene_AbstractContainerMenu.h | 6 + .../Source Files/UI/All Platforms/UIStructs.h | 8 +- .../Common/Source Files/UI/UIController.h | 9 + .../Header Files/BufferedImage.h | 1 + .../Header Files/extraX64client.h | 43 ----- .../Minecraft.Client/Header Files/stubs.h | 1 + .../Linux/Stubs/winapi_stubs.h | 168 +----------------- minecraft/Minecraft.Client/meson.build | 2 +- .../net/minecraft/client/Camera.cpp | 6 +- .../net/minecraft/client/Minecraft.h | 4 + .../net/minecraft/client/gui/PauseScreen.cpp | 1 + .../client/multiplayer/MultiPlayerLevel.cpp | 1 + .../net/minecraft/client/player/Input.cpp | 3 +- .../renderer/entity/VillagerGolemRenderer.cpp | 2 +- .../minecraft/client/skins/DLCTexturePack.cpp | 1 + .../net/minecraft/server/MinecraftServer.h | 4 +- .../net/minecraft/server/level/ServerPlayer.h | 5 + .../ConsoleSaveFileIO/FileHeader.h | 5 +- .../ConsoleHelpers/StringHelpers.h | 1 + .../Minecraft.World/net/minecraft/util/Mth.h | 2 + .../net/minecraft/util/WeighedRandom.h | 3 + .../net/minecraft/world/effect/MobEffect.h | 1 + .../net/minecraft/world/entity/Entity.h | 6 + .../net/minecraft/world/entity/LivingEntity.h | 2 + .../net/minecraft/world/entity/Mob.h | 1 + .../net/minecraft/world/item/Item.h | 3 + .../net/minecraft/world/item/ItemInstance.h | 2 + .../net/minecraft/world/level/biome/Biome.h | 1 + .../minecraft/world/level/chunk/ChunkSource.h | 1 + .../level/levelgen/structure/StructurePiece.h | 3 + .../Minecraft.World/x64headers/extraX64.h | 36 ---- minecraft/java/include/java/JavaIntHash.h | 2 + 39 files changed, 90 insertions(+), 318 deletions(-) diff --git a/minecraft/Minecraft.Client/Common/App_enums.h b/minecraft/Minecraft.Client/Common/App_enums.h index 38a8cd618..27499d143 100644 --- a/minecraft/Minecraft.Client/Common/App_enums.h +++ b/minecraft/Minecraft.Client/Common/App_enums.h @@ -637,70 +637,6 @@ enum EHTMLFontSize { eHTMLSize_COUNT, }; -enum EControllerActions { - ACTION_MENU_A, - ACTION_MENU_B, - ACTION_MENU_X, - ACTION_MENU_Y, - ACTION_MENU_UP, - ACTION_MENU_DOWN, - ACTION_MENU_RIGHT, - ACTION_MENU_LEFT, - ACTION_MENU_PAGEUP, - ACTION_MENU_PAGEDOWN, - ACTION_MENU_RIGHT_SCROLL, - ACTION_MENU_LEFT_SCROLL, - ACTION_MENU_STICK_PRESS, - ACTION_MENU_OTHER_STICK_PRESS, - ACTION_MENU_OTHER_STICK_UP, - ACTION_MENU_OTHER_STICK_DOWN, - ACTION_MENU_OTHER_STICK_LEFT, - ACTION_MENU_OTHER_STICK_RIGHT, - ACTION_MENU_PAUSEMENU, - - ACTION_MENU_OK, - ACTION_MENU_CANCEL, - // 4jcraft added, off by one - ACTION_MAX_MENU = ACTION_MENU_CANCEL + 1, - - MINECRAFT_ACTION_JUMP, - MINECRAFT_ACTION_FORWARD, - MINECRAFT_ACTION_BACKWARD, - MINECRAFT_ACTION_LEFT, - MINECRAFT_ACTION_RIGHT, - MINECRAFT_ACTION_LOOK_LEFT, - MINECRAFT_ACTION_LOOK_RIGHT, - MINECRAFT_ACTION_LOOK_UP, - MINECRAFT_ACTION_LOOK_DOWN, - MINECRAFT_ACTION_USE, - MINECRAFT_ACTION_ACTION, - MINECRAFT_ACTION_LEFT_SCROLL, - MINECRAFT_ACTION_RIGHT_SCROLL, - MINECRAFT_ACTION_INVENTORY, - MINECRAFT_ACTION_PAUSEMENU, - MINECRAFT_ACTION_DROP, - MINECRAFT_ACTION_SNEAK_TOGGLE, - MINECRAFT_ACTION_SPRINT, - MINECRAFT_ACTION_CRAFTING, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - MINECRAFT_ACTION_GAME_INFO, - MINECRAFT_ACTION_DPAD_LEFT, - MINECRAFT_ACTION_DPAD_RIGHT, - MINECRAFT_ACTION_DPAD_UP, - MINECRAFT_ACTION_DPAD_DOWN, - - MINECRAFT_ACTION_MAX, - - // These 4 aren't mapped to the input manager directly but are created from - // the dpad controls if required in Minecraft::run_middle Don't use them - // with the input manager directly, just through - // LocalPlayer::ullButtonsPressed - MINECRAFT_ACTION_SPAWN_CREEPER, - MINECRAFT_ACTION_CHANGE_SKIN, - MINECRAFT_ACTION_FLY_TOGGLE, - MINECRAFT_ACTION_RENDER_DEBUG -}; - enum eMCLang { eMCLang_null = 0, eMCLang_enUS, diff --git a/minecraft/Minecraft.Client/Common/App_structs.h b/minecraft/Minecraft.Client/Common/App_structs.h index edbb71635..63038ec03 100644 --- a/minecraft/Minecraft.Client/Common/App_structs.h +++ b/minecraft/Minecraft.Client/Common/App_structs.h @@ -3,6 +3,7 @@ #include #include "4J.Storage/4J_Storage.h" +#include "Minecraft.World/x64headers/extraX64.h" typedef struct { wchar_t* wchFilename; diff --git a/minecraft/Minecraft.Client/Common/Consoles_App.h b/minecraft/Minecraft.Client/Common/Consoles_App.h index cc2663309..d189d194a 100644 --- a/minecraft/Minecraft.Client/Common/Consoles_App.h +++ b/minecraft/Minecraft.Client/Common/Consoles_App.h @@ -22,6 +22,8 @@ #include "Minecraft.Client/Header Files/SkinBox.h" #include "Minecraft.Client/Common/Source Files/UI/All Platforms/ArchiveFile.h" #include "Minecraft.World/net/minecraft/world/entity/item/MinecartHopper.h" +#include "Minecraft.Client/Common/App_structs.h" +#include "Minecraft.World/x64headers/extraX64.h" typedef struct _JoinFromInviteData { std::uint32_t dwUserIndex; // dwUserIndex diff --git a/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCManager.h b/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCManager.h index f8701ee6d..b1d3aaf45 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCManager.h +++ b/minecraft/Minecraft.Client/Common/Source Files/DLC/DLCManager.h @@ -2,6 +2,7 @@ // using namespace std; #include #include +#include class DLCPack; class DLCSkinFile; diff --git a/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerInterface.h b/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerInterface.h index aefa48f9d..449cb5d6c 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerInterface.h +++ b/minecraft/Minecraft.Client/Common/Source Files/Network/PlatformNetworkManagerInterface.h @@ -5,9 +5,11 @@ #include #endif #include "Minecraft.World/ConsoleHelpers/C4JThread.h" +#include "Minecraft.World/x64headers/extraX64.h" #include "NetworkPlayerInterface.h" #include "SessionInfo.h" + class ClientConnection; class Minecraft; class CGameNetworkManager; diff --git a/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.h b/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.h index 2f53c8d28..dbf5caec5 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.h +++ b/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.h @@ -7,6 +7,7 @@ #include "TutorialEnum.h" #include +#include // #define TUTORIAL_HINT_DELAY_TIME 14000 // How long we should wait from // displaying one hint to the next #define TUTORIAL_DISPLAY_MESSAGE_TIME 7000 @@ -17,8 +18,10 @@ // // 0-24000 // #define TUTORIAL_FREEZE_TIME_VALUE 8000 +class UIScene; class Level; class CXuiScene; +class Player; class Tutorial { public: diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIController.h b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIController.h index 72749780e..dc57734a4 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIController.h +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIController.h @@ -1,6 +1,7 @@ #pragma once #include "UIEnums.h" +#include "Minecraft.World/Header Files/SoundTypes.h" // 4J Stu - An interface class that defines all the public functions that we use // within the game code. This allows us to build the Xbox 360 version without diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_AbstractContainerMenu.h b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_AbstractContainerMenu.h index d1191a45b..d38676cba 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_AbstractContainerMenu.h +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_AbstractContainerMenu.h @@ -1,5 +1,11 @@ #pragma once +#include "Minecraft.Client/Common/Source Files/Tutorial/TutorialEnum.h" +#include "UIStructs.h" + +class HtmlString; +class ItemInstance; + // Uncomment to enable tap input detection to jump 1 slot. Doesn't work // particularly well yet, and I feel the system does not need it. Would probably // be required if we decide to slow down the pointer movement. 4J Stu - There diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/UIStructs.h b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/UIStructs.h index a29ba6f97..0f308727c 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/UIStructs.h +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/UIStructs.h @@ -3,9 +3,11 @@ // #pragma message("UIStructs.h") #include +#include #include "UIEnums.h" #include "Minecraft.Client/Common/App_Defines.h" +#include "Minecraft.World/ConsoleHelpers/C4JThread.h" #include "4J.Storage/4J_Storage.h" class Container; @@ -21,6 +23,8 @@ class EntityHorse; class BeaconTileEntity; class Slot; class AbstractContainerMenu; +class Level; +class FriendSessionInfo; // 4J Stu - Structs shared by Iggy and Xui scenes. typedef struct _UIVec2D { @@ -218,8 +222,8 @@ typedef struct _SaveListDetails { saveId = 0; pbThumbnailData = nullptr; dwThumbnailSize = 0; - ZeroMemory(UTF8SaveName, 128); - ZeroMemory(UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH); + std::memset(UTF8SaveName, 0, 128); + std::memset(UTF8SaveFilename, 0, MAX_SAVEFILENAME_LENGTH); } } SaveListDetails; diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.h b/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.h index 1f58c5ec4..55261b4b7 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.h +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.h @@ -3,6 +3,15 @@ #include #include +#ifdef __linux__ +#include "Minecraft.Client/Linux/Iggy/include/iggy.h" +#include "Minecraft.Client/Linux/Stubs/d3d11_stubs.h" +#elif defined(_WINDOWS64) +#include "Minecraft.Client/Windows64/Iggy/include/iggy.h" +#endif + +#include "4J.Common/4J_InputActions.h" + #include "Minecraft.Client/Common/Source Files/UI/All Platforms/IUIController.h" #include "Minecraft.Client/Common/Source Files/UI/All Platforms/UIEnums.h" #include "UIGroup.h" diff --git a/minecraft/Minecraft.Client/Header Files/BufferedImage.h b/minecraft/Minecraft.Client/Header Files/BufferedImage.h index d70d19914..4889483de 100644 --- a/minecraft/Minecraft.Client/Header Files/BufferedImage.h +++ b/minecraft/Minecraft.Client/Header Files/BufferedImage.h @@ -1,5 +1,6 @@ #pragma once #include +#include class Graphics; class DLCPack; diff --git a/minecraft/Minecraft.Client/Header Files/extraX64client.h b/minecraft/Minecraft.Client/Header Files/extraX64client.h index 88b5abb87..4217b6e21 100644 --- a/minecraft/Minecraft.Client/Header Files/extraX64client.h +++ b/minecraft/Minecraft.Client/Header Files/extraX64client.h @@ -42,46 +42,3 @@ uint32_t XUserAreUsersFriends(uint32_t dwUserIndex, PPlayerUID pXuids, uint32_t dwXuidCount, bool* pfResult, void* pOverlapped); -class XSOCIAL_IMAGEPOSTPARAMS {}; - -class XSOCIAL_LINKPOSTPARAMS {}; - -typedef struct _XSESSION_VIEW_PROPERTIES { - uint32_t dwViewId; - uint32_t dwNumProperties; - XUSER_PROPERTY* pProperties; -} XSESSION_VIEW_PROPERTIES; - -#define XUSER_STATS_ATTRS_IN_SPEC 1 - -typedef struct _XUSER_STATS_SPEC { - uint32_t dwViewId; - uint32_t dwNumColumnIds; - uint16_t rgwColumnIds[XUSER_STATS_ATTRS_IN_SPEC]; -} XUSER_STATS_SPEC, *PXUSER_STATS_SPEC; - -typedef struct _XUSER_STATS_COLUMN { - uint16_t wColumnId; - XUSER_DATA Value; -} XUSER_STATS_COLUMN, *PXUSER_STATS_COLUMN; - -typedef struct _XUSER_STATS_ROW { - PlayerUID xuid; - uint32_t dwRank; - int64_t i64Rating; - char szGamertag[XUSER_NAME_SIZE]; - uint32_t dwNumColumns; - PXUSER_STATS_COLUMN pColumns; -} XUSER_STATS_ROW, *PXUSER_STATS_ROW; - -typedef struct _XUSER_STATS_VIEW { - uint32_t dwViewId; - uint32_t dwTotalViewRows; - uint32_t dwNumRows; - PXUSER_STATS_ROW pRows; -} XUSER_STATS_VIEW, *PXUSER_STATS_VIEW; - -typedef struct _XUSER_STATS_READ_RESULTS { - uint32_t dwNumViews; - PXUSER_STATS_VIEW pViews; -} XUSER_STATS_READ_RESULTS, *PXUSER_STATS_READ_RESULTS; diff --git a/minecraft/Minecraft.Client/Header Files/stubs.h b/minecraft/Minecraft.Client/Header Files/stubs.h index 622d3dc9e..68ff11bf0 100644 --- a/minecraft/Minecraft.Client/Header Files/stubs.h +++ b/minecraft/Minecraft.Client/Header Files/stubs.h @@ -12,6 +12,7 @@ static const int GL_FLAT = 0x1D00; class FloatBuffer; class IntBuffer; class ByteBuffer; +class Minecraft; void glGenTextures(IntBuffer*); int glGenTextures(); diff --git a/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h b/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h index 7e5d6ac54..d648892e0 100644 --- a/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h +++ b/minecraft/Minecraft.Client/Linux/Stubs/winapi_stubs.h @@ -5,7 +5,10 @@ #include #include +#include +#include #include +#include #define TRUE true #define FALSE false @@ -208,13 +211,6 @@ typedef enum _GET_FILEEX_INFO_LEVELS { typedef void* XMEMCOMPRESSION_CONTEXT; typedef void* XMEMDECOMPRESSION_CONTEXT; -// internal search state for FindFirstFile/FindNextFile -typedef struct _LINUXSTUBS_FIND_HANDLE { - DIR* dir; - char dirpath[MAX_PATH]; - char pattern[MAX_PATH]; -} _LINUXSTUBS_FIND_HANDLE; - // https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime typedef struct _SYSTEMTIME { WORD wYear; @@ -286,23 +282,6 @@ static inline FILETIME _TimeToFileTime(time_t t) { return ft; } -// internal helper: fill WIN32_FIND_DATAA from stat + name -static inline void _FillFindData(const char* name, const struct stat* st, - WIN32_FIND_DATAA* out) { - memset(out, 0, sizeof(*out)); - out->dwFileAttributes = - S_ISDIR(st->st_mode) ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL; - if (!(st->st_mode & S_IWUSR)) - out->dwFileAttributes |= FILE_ATTRIBUTE_READONLY; - if (name[0] == '.') out->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN; - out->ftCreationTime = _TimeToFileTime(st->st_mtime); - out->ftLastAccessTime = _TimeToFileTime(st->st_atime); - out->ftLastWriteTime = _TimeToFileTime(st->st_mtime); - out->nFileSizeHigh = (DWORD)((st->st_size >> 32) & 0xFFFFFFFF); - out->nFileSizeLow = (DWORD)(st->st_size & 0xFFFFFFFF); - strncpy(out->cFileName, name, MAX_PATH - 1); -} - static inline HANDLE CreateFileA(const char* lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, void* lpSecurityAttributes, DWORD dwCreationDisposition, @@ -430,46 +409,6 @@ static inline DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, return (DWORD)(result & 0xFFFFFFFF); } -static inline DWORD GetFileAttributesA(const char* lpFileName) { - struct stat st{}; - if (stat(lpFileName, &st) != 0) return INVALID_FILE_ATTRIBUTES; - DWORD attrs = - S_ISDIR(st.st_mode) ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL; - if (!(st.st_mode & S_IWUSR)) attrs |= FILE_ATTRIBUTE_READONLY; - const char* base = strrchr(lpFileName, '/'); - base = base ? base + 1 : lpFileName; - if (base[0] == '.') attrs |= FILE_ATTRIBUTE_HIDDEN; - return attrs; -} - -static inline DWORD GetFileAttributes(const char* lpFileName) { - return GetFileAttributesA(lpFileName); -} - -static inline bool GetFileAttributesExA(const char* lpFileName, - GET_FILEEX_INFO_LEVELS fInfoLevelId, - void* lpFileInformation) { - if (fInfoLevelId != GetFileExInfoStandard || !lpFileInformation) - return FALSE; - struct stat st{}; - if (stat(lpFileName, &st) != 0) return FALSE; - WIN32_FILE_ATTRIBUTE_DATA* out = - (WIN32_FILE_ATTRIBUTE_DATA*)lpFileInformation; - out->dwFileAttributes = GetFileAttributesA(lpFileName); - out->ftCreationTime = _TimeToFileTime(st.st_mtime); - out->ftLastAccessTime = _TimeToFileTime(st.st_atime); - out->ftLastWriteTime = _TimeToFileTime(st.st_mtime); - out->nFileSizeHigh = (DWORD)((st.st_size >> 32) & 0xFFFFFFFF); - out->nFileSizeLow = (DWORD)(st.st_size & 0xFFFFFFFF); - return TRUE; -} - -static inline bool GetFileAttributesEx(const char* lpFileName, - GET_FILEEX_INFO_LEVELS fInfoLevelId, - void* lpFileInformation) { - return GetFileAttributesExA(lpFileName, fInfoLevelId, lpFileInformation); -} - static inline bool CreateDirectoryA(const char* lpPathName, void* lpSecurityAttributes) { return mkdir(lpPathName, 0755) == 0; @@ -498,107 +437,6 @@ static inline bool MoveFile(const char* lpExistingFileName, return MoveFileA(lpExistingFileName, lpNewFileName); } -// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilea -static inline HANDLE FindFirstFileA(const char* lpFileName, - WIN32_FIND_DATAA* lpFindFileData) { - if (!lpFileName || !lpFindFileData) return INVALID_HANDLE_VALUE; - - char dirpath[MAX_PATH], pattern[MAX_PATH]; - const char* sep = strrchr(lpFileName, '/'); - if (sep) { - size_t len = sep - lpFileName; - if (len >= MAX_PATH) return INVALID_HANDLE_VALUE; - strncpy(dirpath, lpFileName, len); - dirpath[len] = '\0'; - strncpy(pattern, sep + 1, MAX_PATH - 1); - } else { - strncpy(dirpath, ".", MAX_PATH - 1); - strncpy(pattern, lpFileName, MAX_PATH - 1); - } - - DIR* dir = opendir(dirpath); - if (!dir) return INVALID_HANDLE_VALUE; - - _LINUXSTUBS_FIND_HANDLE* fh = - (_LINUXSTUBS_FIND_HANDLE*)malloc(sizeof(_LINUXSTUBS_FIND_HANDLE)); - if (!fh) { - closedir(dir); - return INVALID_HANDLE_VALUE; - } - fh->dir = dir; - strncpy(fh->dirpath, dirpath, MAX_PATH - 1); - strncpy(fh->pattern, pattern, MAX_PATH - 1); - - struct dirent* ent; - while ((ent = readdir(fh->dir)) != nullptr) { - if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) - continue; - if (fnmatch(fh->pattern, ent->d_name, 0) == 0) { - char fullpath[MAX_PATH * 2]; - snprintf(fullpath, sizeof(fullpath), "%s/%s", fh->dirpath, - ent->d_name); - struct stat st{}; - if (stat(fullpath, &st) == 0) - _FillFindData(ent->d_name, &st, lpFindFileData); - else { - memset(lpFindFileData, 0, sizeof(*lpFindFileData)); - strncpy(lpFindFileData->cFileName, ent->d_name, MAX_PATH - 1); - } - return (HANDLE)fh; - } - } - - closedir(fh->dir); - free(fh); - return INVALID_HANDLE_VALUE; -} - -static inline HANDLE FindFirstFile(const char* lpFileName, - WIN32_FIND_DATAA* lpFindFileData) { - return FindFirstFileA(lpFileName, lpFindFileData); -} - -// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextfilea -static inline bool FindNextFileA(HANDLE hFindFile, - WIN32_FIND_DATAA* lpFindFileData) { - if (hFindFile == INVALID_HANDLE_VALUE || !lpFindFileData) return FALSE; - _LINUXSTUBS_FIND_HANDLE* fh = (_LINUXSTUBS_FIND_HANDLE*)hFindFile; - - struct dirent* ent; - while ((ent = readdir(fh->dir)) != nullptr) { - if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) - continue; - if (fnmatch(fh->pattern, ent->d_name, 0) == 0) { - char fullpath[MAX_PATH * 2]; - snprintf(fullpath, sizeof(fullpath), "%s/%s", fh->dirpath, - ent->d_name); - struct stat st{}; - if (stat(fullpath, &st) == 0) - _FillFindData(ent->d_name, &st, lpFindFileData); - else { - memset(lpFindFileData, 0, sizeof(*lpFindFileData)); - strncpy(lpFindFileData->cFileName, ent->d_name, MAX_PATH - 1); - } - return TRUE; - } - } - return FALSE; -} - -static inline bool FindNextFile(HANDLE hFindFile, - WIN32_FIND_DATAA* lpFindFileData) { - return FindNextFileA(hFindFile, lpFindFileData); -} - -// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findclose -static inline bool FindClose(HANDLE hFindFile) { - if (hFindFile == INVALID_HANDLE_VALUE) return FALSE; - _LINUXSTUBS_FIND_HANDLE* fh = (_LINUXSTUBS_FIND_HANDLE*)hFindFile; - closedir(fh->dir); - free(fh); - return TRUE; -} - // internal helper: convert FILETIME (100ns since 1601) to time_t (seconds since // 1970) static inline time_t _FileTimeToTimeT(const FILETIME& ft) { diff --git a/minecraft/Minecraft.Client/meson.build b/minecraft/Minecraft.Client/meson.build index 972757c4c..edb3f0faa 100644 --- a/minecraft/Minecraft.Client/meson.build +++ b/minecraft/Minecraft.Client/meson.build @@ -112,7 +112,7 @@ client = executable( + [ '-DUNICODE', '-D_UNICODE', - '-include', meson.current_source_dir() / 'Header Files/stdafx.h', + # '-include', meson.current_source_dir() / 'Header Files/stdafx.h', ], c_args: global_cpp_defs + ['-DUNICODE', '-D_UNICODE'], install: true, diff --git a/minecraft/Minecraft.Client/net/minecraft/client/Camera.cpp b/minecraft/Minecraft.Client/net/minecraft/client/Camera.cpp index 98d9ce6c8..11aeed1d9 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/Camera.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/Camera.cpp @@ -54,9 +54,9 @@ zPlayerOffs = position->get(2); // this is just working out how to get a (0,0,0) point in clip space to pass // into the inverted combined model/view/projection matrix, so we just need // to get this matrix and get its translation as an equivalent. - XMMATRIX _modelview, _proj, _final, _invert; - XMVECTOR _det; - XMFLOAT4 trans; + DirectX::XMMATRIX _modelview, _proj, _final, _invert; + DirectX::XMVECTOR _det; + DirectX::XMFLOAT4 trans; memcpy(&_modelview, modelview->_getDataPointer(), 64); memcpy(&_proj, projection->_getDataPointer(), 64); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.h b/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.h index 43972cd27..384a4f925 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.h +++ b/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.h @@ -1,5 +1,6 @@ #pragma once #include + class Timer; class MultiPlayerLevel; class LevelRenderer; @@ -37,10 +38,13 @@ class ItemInHandRenderer; class LevelSettings; class ColourTable; class MultiPlayerGameMode; +class LivingEntity; + #include "java/File.h" #include "Minecraft.World/net/minecraft/network/packet/DisconnectPacket.h" #include "Minecraft.World/ConsoleHelpers/C4JThread.h" #include "Minecraft.Client/net/minecraft/client/resources/ResourceLocation.h" +#include "4J.Common/4J_Compat.h" #if defined(linux) #undef linux diff --git a/minecraft/Minecraft.Client/net/minecraft/client/gui/PauseScreen.cpp b/minecraft/Minecraft.Client/net/minecraft/client/gui/PauseScreen.cpp index a1966fce6..80f933e66 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/gui/PauseScreen.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/gui/PauseScreen.cpp @@ -11,6 +11,7 @@ #include "Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "Minecraft.Client/net/minecraft/server/MinecraftServer.h" #include "4J_Profile.h" +#include "4J_Input.h" #include "Minecraft.Client/Common/App_enums.h" #include "Minecraft.Client/Common/Source Files/Network/GameNetworkManager.h" #include "Minecraft.Client/Linux/Linux_App.h" diff --git a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp index d3869c9fc..44e7ad138 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -17,6 +17,7 @@ #include "java/JavaMath.h" #include "4J.Common/4J_Compat.h" #include "4J_Profile.h" +#include "4J_Input.h" #include "Minecraft.Client/Common/Source Files/Audio/SoundEngine.h" #include "Minecraft.Client/Common/Source Files/Console_Debug_enum.h" #include "Minecraft.Client/Common/Source Files/Network/GameNetworkManager.h" diff --git a/minecraft/Minecraft.Client/net/minecraft/client/player/Input.cpp b/minecraft/Minecraft.Client/net/minecraft/client/player/Input.cpp index cc3b37694..8872a528a 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/player/Input.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/player/Input.cpp @@ -4,6 +4,7 @@ #include "Input.h" #include "LocalPlayer.h" #include "4J_Input.h" +#include "4J.Common/4J_InputActions.h" #include "Minecraft.Client/Common/App_enums.h" #include "Minecraft.Client/Linux/Linux_App.h" #include "Minecraft.World/net/minecraft/world/entity/player/Abilities.h" @@ -112,7 +113,7 @@ void Input::tick(LocalPlayer* player) { } tx = ty = 0.0f; } - player->interpolateTurn(tx * abs(tx) * turnSpeed, ty * abs(ty) * turnSpeed); + player->interpolateTurn(tx * std::abs(tx) * turnSpeed, ty * std::abs(ty) * turnSpeed); // jumping = controller.isButtonPressed(0); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp index 9e3f54adb..4a1bc5f6b 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp @@ -44,7 +44,7 @@ void VillagerGolemRenderer::setupRotations(std::shared_ptr _mob, float p = 13; float wp = mob->walkAnimPos - mob->walkAnimSpeed * (1 - a) + 6; float triangleWave = - (abs(fmod(wp, p) - p * 0.5f) - p * 0.25f) / (p * 0.25f); + (std::abs(std::fmod(wp, p) - p * 0.5f) - p * 0.25f) / (p * 0.25f); glRotatef(6.5f * triangleWave, 0, 0, 1); } diff --git a/minecraft/Minecraft.Client/net/minecraft/client/skins/DLCTexturePack.cpp b/minecraft/Minecraft.Client/net/minecraft/client/skins/DLCTexturePack.cpp index 365780486..b2bce514a 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/skins/DLCTexturePack.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/skins/DLCTexturePack.cpp @@ -14,6 +14,7 @@ #include "Minecraft.Client/Common/Source Files/DLC/DLCAudioFile.h" #include "4J_Profile.h" #include "4J_Storage.h" +#include "4J_Input.h" #include "Minecraft.Client/Header Files/BufferedImage.h" #include "Minecraft.Client/Common/App_enums.h" #include "Minecraft.Client/Common/Source Files/Audio/SoundEngine.h" diff --git a/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.h b/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.h index d87e31e82..8ab096f79 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.h +++ b/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.h @@ -6,6 +6,8 @@ #include "Minecraft.World/ConsoleHelpers/ArrayWithLength.h" #include "Minecraft.World/net/minecraft/SharedConstants.h" #include "Minecraft.World/ConsoleHelpers/C4JThread.h" +#include "Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/FileHeader.h" +#include "Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h" class ServerConnection; class Settings; @@ -14,12 +16,12 @@ class EntityTracker; class ConsoleInput; class ConsoleCommands; class LevelStorageSource; -class ChunkSource; class INetworkPlayer; class LevelRuleset; class LevelType; class ProgressRenderer; class CommandDispatcher; +class LevelGenerationOptions; #define MINECRAFT_SERVER_SLOW_QUEUE_DELAY 250 diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.h b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.h index a8abf6115..831ed4f99 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.h +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.h @@ -1,7 +1,11 @@ #pragma once + +#include + #include "Minecraft.World/net/minecraft/world/entity/player/net.minecraft.world.entity.player.h" #include "Minecraft.World/net/minecraft/world/inventory/net.minecraft.world.inventory.ContainerListener.h" #include "Minecraft.World/net/minecraft/world/level/ChunkPos.h" + class PlayerConnection; class MinecraftServer; class ServerPlayerGameMode; @@ -15,6 +19,7 @@ class MinecartHopper; class BeaconTileEntity; class EntityHorse; class Merchant; +class ServerLevel; class ServerPlayer : public Player, public net_minecraft_world_inventory::ContainerListener { diff --git a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/FileHeader.h b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/FileHeader.h index 092f1e2aa..200cf493b 100644 --- a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/FileHeader.h +++ b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/FileHeader.h @@ -1,6 +1,9 @@ #pragma once #include "java/System.h" +#include "Minecraft.World/ConsoleHelpers/Definitions.h" + +#include // The first 4 bytes is the location of the header (the header itself is at the // end of the file) Then 4 bytes for the size of the header Then 2 bytes for the @@ -106,7 +109,7 @@ public: unsigned int currentFilePointer; - FileEntry() { ZeroMemory(&data, sizeof(FileEntrySaveData)); } + FileEntry() { memset(&data, 0, sizeof(FileEntrySaveData)); } FileEntry(wchar_t name[64], unsigned int length, unsigned int startOffset) { data.length = length; diff --git a/minecraft/Minecraft.World/ConsoleHelpers/StringHelpers.h b/minecraft/Minecraft.World/ConsoleHelpers/StringHelpers.h index b13a10af5..3dc558475 100644 --- a/minecraft/Minecraft.World/ConsoleHelpers/StringHelpers.h +++ b/minecraft/Minecraft.World/ConsoleHelpers/StringHelpers.h @@ -2,6 +2,7 @@ #include #include +#include std::wstring toLower(const std::wstring& a); std::wstring trimString(const std::wstring& a); diff --git a/minecraft/Minecraft.World/net/minecraft/util/Mth.h b/minecraft/Minecraft.World/net/minecraft/util/Mth.h index 014160203..8cd6f78c7 100644 --- a/minecraft/Minecraft.World/net/minecraft/util/Mth.h +++ b/minecraft/Minecraft.World/net/minecraft/util/Mth.h @@ -1,5 +1,7 @@ #pragma once +#include + class Random; class Mth { diff --git a/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h b/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h index 27b7ed518..7a152005d 100644 --- a/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h +++ b/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h @@ -1,4 +1,7 @@ #pragma once + +#include "java/Random.h" + // 4J - this WeighedRandomItem class was a nested static class within // WeighedRandom, but we need to be able to refer to it externally diff --git a/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h b/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h index 9eebb9558..2f5102bbf 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h +++ b/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h @@ -1,6 +1,7 @@ #pragma once #include "Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeModifier.h" +#include "Minecraft.Client/Common/App_enums.h" class Mob; class MobEffectInstance; diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.h b/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.h index 246d6e5e4..9031ae452 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.h +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.h @@ -6,6 +6,9 @@ #include "nbt/ListTag.h" #include "nbt/DoubleTag.h" #include "nbt/FloatTag.h" + +#include "java/Class.h" + #include "Minecraft.World/net/minecraft/world/phys/Vec3.h" #include "Minecraft.World/ConsoleHelpers/Definitions.h" #include "Minecraft.World/net/minecraft/world/phys/AABB.h" @@ -22,6 +25,9 @@ class Level; class CompoundTag; class DamageSource; class Explosion; +class Tesselator; +class Tile; +class ItemInstance; // 4J Stu Added this mainly to allow is to record telemetry for player deaths enum EEntityDamageType { diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/LivingEntity.h b/minecraft/Minecraft.World/net/minecraft/world/entity/LivingEntity.h index 3fa36041b..f66366f69 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/LivingEntity.h +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/LivingEntity.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "Entity.h" #include "MobType.h" @@ -17,6 +18,7 @@ class Attribute; class MobEffect; class HitResult; class Vec3; +class Icon; class LivingEntity : public Entity { friend class MobSpawner; diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.h b/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.h index 2fdcbef5e..41b6375da 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.h +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.h @@ -19,6 +19,7 @@ class Sensing; class Icon; class Pos; class MobGroupData; +class Item; class Mob : public LivingEntity { friend class MobSpawner; diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/Item.h b/minecraft/Minecraft.World/net/minecraft/world/item/Item.h index b8cd34e30..839fa1033 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/Item.h +++ b/minecraft/Minecraft.World/net/minecraft/world/item/Item.h @@ -1,6 +1,7 @@ #pragma once #include "Minecraft.World/net/minecraft/world/Container.h" +#include "Minecraft.World/net/minecraft/world/entity/ai/attributes/Attribute.h" #include "UseAnim.h" #include "Rarity.h" @@ -19,6 +20,8 @@ class BowItem; class FishingRodItem; class EnchantedBookItem; class EmptyMapItem; +class LivingEntity; +class HtmlString; #define ITEM_ICON_COLUMNS 16 diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/ItemInstance.h b/minecraft/Minecraft.World/net/minecraft/world/item/ItemInstance.h index 7366065bf..e03e0602d 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/ItemInstance.h +++ b/minecraft/Minecraft.World/net/minecraft/world/item/ItemInstance.h @@ -19,6 +19,8 @@ class MapItem; class ItemFrame; class Icon; class HtmlString; +class Tile; +class Item; // 4J Stu - While this is not really an abstract class, we don't want to make // new instances of it, mainly because there are too many ctors and that doesn't diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/biome/Biome.h b/minecraft/Minecraft.World/net/minecraft/world/level/biome/Biome.h index ae48c3b6e..0ba7d8c95 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/biome/Biome.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/biome/Biome.h @@ -3,6 +3,7 @@ #include "Minecraft.World/net/minecraft/world/level/LevelSource.h" #include "Minecraft.World/net/minecraft/world/entity/Mob.h" #include "Minecraft.World/net/minecraft/util/WeighedRandom.h" +#include "Minecraft.Client/Common/App_enums.h" class Feature; class MobCategory; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h index ddaafc79e..5356cebaf 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/ChunkSource.h @@ -3,6 +3,7 @@ #include "Minecraft.World/net/minecraft/world/level/biome/Biome.h" class ProgressListener; class TilePos; +class LevelChunk; // The maximum number of chunks that we can store #ifdef _LARGE_WORLDS diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h index cf01815ab..f5264afe3 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h @@ -1,4 +1,7 @@ #pragma once + +#include + #include "Minecraft.World/net/minecraft/util/WeighedRandom.h" #include "BoundingBox.h" #include "StructureFeatureIO.h" diff --git a/minecraft/Minecraft.World/x64headers/extraX64.h b/minecraft/Minecraft.World/x64headers/extraX64.h index b5ecdee1c..289f5858e 100644 --- a/minecraft/Minecraft.World/x64headers/extraX64.h +++ b/minecraft/Minecraft.World/x64headers/extraX64.h @@ -180,18 +180,6 @@ typedef struct _XSESSION_SEARCHRESULT_HEADER { XSESSION_SEARCHRESULT* pResults; } XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER; -typedef struct _XONLINE_FRIEND { - PlayerUID xuid; - char szGamertag[XUSER_NAME_SIZE]; - uint32_t dwFriendState; - SessionID sessionID; - uint32_t dwTitleID; - FILETIME ftUserTime; - SessionID xnkidInvite; - FILETIME gameinviteTime; - uint32_t cchRichPresence; -} XONLINE_FRIEND, *PXONLINE_FRIEND; - class IQNetCallbacks {}; class IQNetGameSearch {}; @@ -301,30 +289,6 @@ typedef struct _XMEMCODEC_PARAMETERS_LZX { void XMemDestroyCompressionContext(XMEMCOMPRESSION_CONTEXT Context); void XMemDestroyDecompressionContext(XMEMDECOMPRESSION_CONTEXT Context); -typedef struct { - uint8_t type; - union { - int32_t nData; - int64_t i64Data; - double dblData; - struct { - uint32_t cbData; - wchar_t* pwszData; - } string; - float fData; - struct { - uint32_t cbData; - uint8_t* pbData; - } binary; - FILETIME ftData; - }; -} XUSER_DATA, *PXUSER_DATA; - -typedef struct { - uint32_t dwPropertyId; - XUSER_DATA value; -} XUSER_PROPERTY, *PXUSER_PROPERTY; - const int XC_LANGUAGE_ENGLISH = 0x01; const int XC_LANGUAGE_JAPANESE = 0x02; const int XC_LANGUAGE_GERMAN = 0x03; diff --git a/minecraft/java/include/java/JavaIntHash.h b/minecraft/java/include/java/JavaIntHash.h index 476baae56..c76ef55d2 100644 --- a/minecraft/java/include/java/JavaIntHash.h +++ b/minecraft/java/include/java/JavaIntHash.h @@ -1,5 +1,7 @@ #pragma once +#include "java/Class.h" + // Java doesn't have a default hash value for ints, however, the hashmap itself // does some "supplemental" hashing, so our ints actually get hashed by code as // implemented below. std templates *do* have a standard hash for ints, but it