From 42035b71d81c88439bd436c0918433163ebd5f13 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:21:51 -0600 Subject: [PATCH] refactor: move linux stubs to `Minecraft.Client` Existing platform abstraction layers are all located in Minecraft.Client, making the `linux` folder the odd one out in `Minecraft.World`. This relocates `linux/wlinux.h` and its supporting helper files to `Minecraft.Client/Linux`. `wlinux.h` has been renamed to `LinuxStubs.h` for consistency. --- .../Linux/LinuxStubs.h | 16 ++++++++-------- .../Linux}/xbox_valve.h | 0 Minecraft.Client/stdafx.h | 8 +++++--- Minecraft.World/stdafx.h | 15 +++++---------- 4 files changed, 18 insertions(+), 21 deletions(-) rename Minecraft.World/linux/wlinux.h => Minecraft.Client/Linux/LinuxStubs.h (97%) rename {Minecraft.World/linux => Minecraft.Client/Linux}/xbox_valve.h (100%) diff --git a/Minecraft.World/linux/wlinux.h b/Minecraft.Client/Linux/LinuxStubs.h similarity index 97% rename from Minecraft.World/linux/wlinux.h rename to Minecraft.Client/Linux/LinuxStubs.h index 0550ca375..2e16db67d 100644 --- a/Minecraft.World/linux/wlinux.h +++ b/Minecraft.Client/Linux/LinuxStubs.h @@ -1,5 +1,5 @@ -#ifndef WLINUX_H -#define WLINUX_H +#ifndef LINUXSTUBS_H +#define LINUXSTUBS_H #pragma once @@ -154,11 +154,11 @@ typedef VOID* XMEMCOMPRESSION_CONTEXT; typedef VOID* XMEMDECOMPRESSION_CONTEXT; // internal search state for FindFirstFile/FindNextFile -typedef struct _WLINUX_FIND_HANDLE { +typedef struct _LINUXSTUBS_FIND_HANDLE { DIR *dir; char dirpath[MAX_PATH]; char pattern[MAX_PATH]; -} _WLINUX_FIND_HANDLE; +} _LINUXSTUBS_FIND_HANDLE; #define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF) @@ -453,7 +453,7 @@ static inline HANDLE FindFirstFileA(const char *lpFileName, WIN32_FIND_DATAA *lp DIR *dir = opendir(dirpath); if (!dir) return INVALID_HANDLE_VALUE; - _WLINUX_FIND_HANDLE *fh = (_WLINUX_FIND_HANDLE *)malloc(sizeof(_WLINUX_FIND_HANDLE)); + _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); @@ -487,7 +487,7 @@ static inline HANDLE FindFirstFile(const char *lpFileName, WIN32_FIND_DATAA *lpF static inline BOOL FindNextFileA(HANDLE hFindFile, WIN32_FIND_DATAA *lpFindFileData) { if (hFindFile == INVALID_HANDLE_VALUE || !lpFindFileData) return FALSE; - _WLINUX_FIND_HANDLE *fh = (_WLINUX_FIND_HANDLE *)hFindFile; + _LINUXSTUBS_FIND_HANDLE *fh = (_LINUXSTUBS_FIND_HANDLE *)hFindFile; struct dirent *ent; while ((ent = readdir(fh->dir)) != NULL) @@ -515,9 +515,9 @@ static inline BOOL FindNextFile(HANDLE hFindFile, WIN32_FIND_DATAA *lpFindFileDa static inline BOOL FindClose(HANDLE hFindFile) { if (hFindFile == INVALID_HANDLE_VALUE) return FALSE; - _WLINUX_FIND_HANDLE *fh = (_WLINUX_FIND_HANDLE *)hFindFile; + _LINUXSTUBS_FIND_HANDLE *fh = (_LINUXSTUBS_FIND_HANDLE *)hFindFile; closedir(fh->dir); free(fh); return TRUE; } -#endif // WLINUX_H \ No newline at end of file +#endif // LINUXSTUBS_H \ No newline at end of file diff --git a/Minecraft.World/linux/xbox_valve.h b/Minecraft.Client/Linux/xbox_valve.h similarity index 100% rename from Minecraft.World/linux/xbox_valve.h rename to Minecraft.Client/Linux/xbox_valve.h diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index fa7ef0367..d9302801a 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -149,7 +149,7 @@ typedef XUID GameSessionUID; #endif #include "../Minecraft.World/Definitions.h" -#include "../Minecraft.World/class.h" +#include "../Minecraft.World/Class.h" #include "../Minecraft.World/ArrayWithLength.h" #include "../Minecraft.World/SharedConstants.h" #include "../Minecraft.World/Random.h" @@ -211,7 +211,7 @@ typedef XUID GameSessionUID; #include "Common/UI/UIEnums.h" #include "Common/UI/UIStructs.h" // #ifdef _XBOX -#include "Common/App_defines.h" +#include "Common/App_Defines.h" #include "Common/App_enums.h" #include "Common/Tutorial/TutorialEnum.h" #include "Common/App_structs.h" @@ -280,8 +280,10 @@ typedef XUID GameSessionUID; #include "Windows64/Iggy/gdraw/gdraw_d3d11.h" #include "Windows64/Windows64_UIController.h" #elif defined __linux__ - // #include "Windows64/Sentient/MinecraftTelemetry.h" #include "Windows64Media/strings.h" + #include "Linux/LinuxStubs.h" + #include "Linux/xbox_valve.h" + // #include "Windows64/Sentient/MinecraftTelemetry.h" // #include "Windows64/Windows64_App.h" // #include "Windows64/Sentient/DynamicConfigurations.h" // #include "Windows64/Sentient/SentientTelemetryCommon.h" diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 6b8b90ff2..a1394e1cc 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -12,11 +12,6 @@ typedef unsigned __int64; typedef unsigned __uint64; -#if defined( __linux__ ) -#include "linux/wlinux.h" -#include "linux/xbox_valve.h" -#endif - #ifdef _WINDOWS64 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: @@ -98,6 +93,9 @@ typedef XUID GameSessionUID; #include #include #include + +#include "../Minecraft.Client/Linux/LinuxStubs.h" +#include "../Minecraft.Client/Linux/xbox_valve.h" #else #include #include @@ -126,11 +124,6 @@ typedef XUID GameSessionUID; #include #endif -#if defined(__linux__) -#else -#include "../Minecraft.Client/Xbox/Network/extra.h" -#endif - #include "Definitions.h" #include "Class.h" #include "Exceptions.h" @@ -183,6 +176,7 @@ void MemSect(int sect); #include "../Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h" #include "../Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h" #elif defined __linux__ +// FIXME: Port 4JLibs to POSIX #include "../Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h" #include "../Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h" #include "../Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h" @@ -246,6 +240,7 @@ void MemSect(int sect); #include "../Minecraft.Client/PSVita/Sentient/SentientManager.h" #include "../Minecraft.Client/PSVita/Sentient/MinecraftTelemetry.h" #elif defined(__linux__) +// FIXME: Move and port to ../Minecraft.Client/Linux #include "../Minecraft.Client/Windows64/Windows64_App.h" #include "../Minecraft.Client/Windows64Media/strings.h" #include "../Minecraft.Client/Windows64/Sentient/SentientTelemetryCommon.h"