From e1a66b0ad0183b6319755b20e61bc4cc731cd3e7 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:26:18 +1100 Subject: [PATCH 001/192] Modernise portable file and timing utilities --- Minecraft.Client/Utils/ArchiveFile.cpp | 69 +------ Minecraft.World/IO/Files/File.cpp | 191 ++++++++++++++---- Minecraft.World/Level/CustomLevelSource.cpp | 84 +++----- Minecraft.World/Util/PerformanceTimer.cpp | 22 +- Minecraft.World/Util/PerformanceTimer.h | 17 +- Minecraft.World/Util/PortableFileIO.h | 90 +++++++++ .../WorldGen/Layers/BiomeOverrideLayer.cpp | 47 ++--- 7 files changed, 303 insertions(+), 217 deletions(-) create mode 100644 Minecraft.World/Util/PortableFileIO.h diff --git a/Minecraft.Client/Utils/ArchiveFile.cpp b/Minecraft.Client/Utils/ArchiveFile.cpp index b2a8b383b..8c2754fc4 100644 --- a/Minecraft.Client/Utils/ArchiveFile.cpp +++ b/Minecraft.Client/Utils/ArchiveFile.cpp @@ -1,6 +1,7 @@ #include "../Platform/stdafx.h" #include "../../Minecraft.World/Util/StringHelpers.h" +#include "../../Minecraft.World/Util/PortableFileIO.h" #include "../../Minecraft.World/IO/Streams/Compression.h" #include "ArchiveFile.h" @@ -120,66 +121,18 @@ byteArray ArchiveFile::getFile(const std::wstring &filename) memcpy( out.data, m_cachedData + data->ptr, data->filesize ); #else + const unsigned int fileSize = static_cast(data->filesize); + PBYTE pbData = new BYTE[fileSize == 0 ? 1 : fileSize]; + out = byteArray(pbData, fileSize); + const PortableFileIO::BinaryReadResult readResult = PortableFileIO::ReadBinaryFileSegment( + m_sourcefile.getPath(), + static_cast(data->ptr), + out.data, + static_cast(data->filesize)); -#if defined(_UNICODE) && !defined(__linux__) - HANDLE hfile = CreateFile( m_sourcefile.getPath().c_str(), - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL - ); -#else - app.DebugPrintf("Createfile archive\n"); - HANDLE hfile = CreateFile( wstringtofilename(m_sourcefile.getPath()), - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL - ); -#endif - - if (hfile != INVALID_HANDLE_VALUE) + if (readResult.status != PortableFileIO::BinaryReadStatus::ok) { - app.DebugPrintf("hfile ok\n"); - DWORD ok = SetFilePointer( hfile, - data->ptr, - NULL, - FILE_BEGIN - ); - - if (ok != INVALID_SET_FILE_POINTER) - { - PBYTE pbData = new BYTE[ data->filesize ]; - - DWORD bytesRead = -1; - BOOL bSuccess = ReadFile( hfile, - (LPVOID) pbData, - data->filesize, - &bytesRead, - NULL - ); - - if(bSuccess==FALSE) - { - app.FatalLoadError(); - } - assert(bytesRead == data->filesize); - out = byteArray(pbData, data->filesize); - } - else - { - app.FatalLoadError(); - } - - CloseHandle(hfile); - } - else - { - app.DebugPrintf("bad hfile\n"); + app.DebugPrintf("Failed to read archive file segment\n"); app.FatalLoadError(); } #endif diff --git a/Minecraft.World/IO/Files/File.cpp b/Minecraft.World/IO/Files/File.cpp index e2326d25e..aa789546a 100644 --- a/Minecraft.World/IO/Files/File.cpp +++ b/Minecraft.World/IO/Files/File.cpp @@ -3,6 +3,11 @@ #include "../../Level/Storage/McRegionLevelStorageSource.h" #include "File.h" +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) +#include +#include +#endif + #ifdef __PS3__ #include #endif @@ -17,6 +22,34 @@ const std::wstring File::pathRoot = L"GAME:"; // Path root after pathSeparator h const std::wstring File::pathRoot = L""; // Path root after pathSeparator has been removed #endif +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) +namespace +{ + namespace fs = std::filesystem; + + fs::path ToFilesystemPath(const std::wstring& path) + { + const std::string nativePath = wstringtofilename(path); + return fs::u8path(nativePath); + } + + std::wstring ToFilename(const fs::path& path) + { + const std::string filename = path.filename().u8string(); + return filenametowstring(filename.c_str()); + } + + __int64 ToEpochMilliseconds(const fs::file_time_type& fileTime) + { + using namespace std::chrono; + + const auto systemTime = time_point_cast( + fileTime - fs::file_time_type::clock::now() + system_clock::now()); + return static_cast<__int64>(systemTime.time_since_epoch().count()); + } +} +#endif + //Creates a new File instance from a parent abstract pathname and a child pathname string. File::File( const File &parent, const std::wstring& child ) { @@ -97,7 +130,36 @@ this->parent = NULL; //true if and only if the file or directory is successfully deleted; false otherwise bool File::_delete() { +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + const bool result = fs::remove(ToFilesystemPath(getPath()), error); #if defined _UNICODE + if( !result || error ) + { +#ifndef _CONTENT_PACKAGE + printf( "File::_delete - Error code %d (%#0.8X)\n", error.value(), error.value() ); +#endif + return false; + } + return true; +#elif defined(__linux__) + if( !result || error ) + { + printf("Unable to delete file :("); + return false; + } + return true; +#else + if( !result || error ) + { +#ifndef _CONTENT_PACKAGE + printf( "File::_delete - Error code %d (%#0.8X)\n", error.value(), error.value() ); +#endif + return false; + } + return true; +#endif +#elif defined _UNICODE BOOL result = DeleteFile( getPath().c_str() ); #elif defined(__linux__) // FIXME @@ -126,7 +188,10 @@ bool File::_delete() //true if and only if the directory was created; false otherwise bool File::mkdir() const { -#if defined (_UNICODE) +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + return fs::create_directory(ToFilesystemPath(getPath()), error); +#elif defined (_UNICODE) return CreateDirectory( getPath().c_str(), NULL) != 0; #elif defined(__linux__) return ::mkdir(wstringtofilename(getPath()), 0777) == 0; @@ -157,6 +222,22 @@ bool File::mkdir() const // bool File::mkdirs() const { +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + const fs::path path = ToFilesystemPath(getPath()); + + if( fs::exists(path, error) ) + { + return fs::is_directory(path, error); + } + + if( error ) + { + return false; + } + + return fs::create_directories(path, error); +#else std::vector path = stringSplit( m_abstractPathName, pathSeparator ); std::wstring pathToHere = L""; @@ -208,6 +289,7 @@ bool File::mkdirs() const assert( exists() ); return true; +#endif } /* @@ -223,7 +305,10 @@ return (File *) parent; bool File::exists() const { // TODO 4J Stu - Possible we could get an error result from something other than the file not existing? -#if defined(_UNICODE) +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + return fs::exists(ToFilesystemPath(getPath()), error); +#elif defined(_UNICODE) return GetFileAttributes( getPath().c_str() ) != -1; #elif defined(__linux__) // BAD DOBBY BAD DOBBY @@ -252,6 +337,16 @@ bool File::isFile() const //true if and only if the renaming succeeded; false otherwise bool File::renameTo(File dest) { +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + fs::rename(ToFilesystemPath(getPath()), ToFilesystemPath(dest.getPath()), error); + if(error) + { + perror("File::renameTo - Error renaming file"); + return false; + } + return true; +#else std::string sourcePath = wstringtofilename(getPath()); std::string destPath = wstringtofilename(dest.getPath()); @@ -266,37 +361,9 @@ bool File::renameTo(File dest) { return true; } +#endif } -#if defined(__linux__) -// DecalOverdose: Stolen from my other project -void listFiles(const char *directory) { - DIR *dp; - struct dirent *entry; - struct stat fileStat; - - dp = opendir(directory); - if (dp == NULL) { - perror("opendir"); - return; - } - - while ((entry = readdir(dp)) != NULL) { - char fullPath[1024]; - snprintf(fullPath, sizeof(fullPath), "%s/%s", directory, entry->d_name); - - if (stat(fullPath, &fileStat) == 0) { - if (S_ISREG(fileStat.st_mode)) { - printf("File: %s\n", entry->d_name); - } - } else { - perror("stat"); - } - } - closedir(dp); -} -#endif // __linux__ - //Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname. //If this abstract pathname does not denote a directory, then this method returns null. Otherwise an array of File objects is returned, //one for each file or directory in the directory. Pathnames denoting the directory itself and the directory's parent directory @@ -319,6 +386,13 @@ std::vector *File::listFiles() const if( !isDirectory() ) return vOutput; +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + for( fs::directory_iterator it(ToFilesystemPath(getPath()), error); !error && it != fs::directory_iterator(); it.increment(error) ) + { + vOutput->push_back( new File( *this, ToFilename(it->path()) ) ); + } +#else #ifdef __PS3__ const char *lpFileName=wstringtofilename(getPath()); char filePath[256]; @@ -447,6 +521,7 @@ std::vector *File::listFiles() const FindClose( hFind); } #endif +#endif #endif return vOutput; } @@ -469,6 +544,17 @@ std::vector *File::listFiles(FileFilter *filter) const std::vector *vOutput = new std::vector(); +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + for( fs::directory_iterator it(ToFilesystemPath(getPath()), error); !error && it != fs::directory_iterator(); it.increment(error) ) + { + File thisFile = File( *this, ToFilename(it->path()) ); + if( filter->accept( &thisFile ) ) + { + vOutput->push_back( new File( thisFile ) ); + } + } +#else #ifdef __PS3__ const char *lpFileName=wstringtofilename(getPath()); char filePath[256]; @@ -551,6 +637,7 @@ std::vector *File::listFiles(FileFilter *filter) const FindClose( hFind); } #endif +#endif #endif return vOutput; } @@ -560,7 +647,10 @@ std::vector *File::listFiles(FileFilter *filter) const //true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise bool File::isDirectory() const { -#if defined(_UNICODE) +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + return fs::is_directory(ToFilesystemPath(getPath()), error); +#elif defined(_UNICODE) return exists() && ( GetFileAttributes( getPath().c_str() ) & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY; #elif defined(__linux__) const char *dirpath = wstringtofilename(getPath()); @@ -639,17 +729,20 @@ __int64 File::length() return 0; } return statData.fileSize; -#elif defined(__linux__) - struct stat fileInfoBuffer; - const char *path = wstringtofilename(getPath()); +#elif !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + const fs::path path = ToFilesystemPath(getPath()); - int result = stat(path, &fileInfoBuffer); - - if(result == 0) { - return fileInfoBuffer.st_size; - } else { - return 0; + if( fs::is_regular_file(path, error) ) + { + const auto size = fs::file_size(path, error); + if( !error ) + { + return static_cast<__int64>(size); + } } + + return 0; #else WIN32_FILE_ATTRIBUTE_DATA fileInfoBuffer; #ifdef _UNICODE @@ -689,7 +782,21 @@ __int64 File::length() //or 0L if the file does not exist or if an I/O error occurs __int64 File::lastModified() { -#if !defined(__linux__) +#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) + std::error_code error; + const fs::path path = ToFilesystemPath(getPath()); + + if( fs::is_regular_file(path, error) ) + { + const fs::file_time_type lastWriteTime = fs::last_write_time(path, error); + if( !error ) + { + return ToEpochMilliseconds(lastWriteTime); + } + } + + return 0l; +#elif !defined(__linux__) WIN32_FILE_ATTRIBUTE_DATA fileInfoBuffer; #ifdef _UNICODE BOOL result = GetFileAttributesEx( diff --git a/Minecraft.World/Level/CustomLevelSource.cpp b/Minecraft.World/Level/CustomLevelSource.cpp index 5753d6092..d31aed6b2 100644 --- a/Minecraft.World/Level/CustomLevelSource.cpp +++ b/Minecraft.World/Level/CustomLevelSource.cpp @@ -1,4 +1,5 @@ #include "../Platform/stdafx.h" +#include "../Util/PortableFileIO.h" #include "../Headers/net.minecraft.world.level.h" #include "../Headers/net.minecraft.world.level.biome.h" #include "../Headers/net.minecraft.world.level.levelgen.h" @@ -19,86 +20,47 @@ CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateSt m_heightmapOverride = byteArray( (m_XZSize*16) * (m_XZSize*16) ); -#ifdef _UNICODE - std::wstring path = L"GAME:\\GameRules\\heightmap.bin"; - -#else #ifdef _WINDOWS64 - std::string path = "GameRules\\heightmap.bin"; + const std::wstring path = L"GameRules\\heightmap.bin"; #else - std::string path = "GAME:\\GameRules\\heightmap.bin"; + const std::wstring path = L"GAME:\\GameRules\\heightmap.bin"; #endif -#endif - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if( file == INVALID_HANDLE_VALUE ) + const PortableFileIO::BinaryReadResult heightmapReadResult = PortableFileIO::ReadBinaryFile(path, m_heightmapOverride.data, m_heightmapOverride.length); + if(heightmapReadResult.status == PortableFileIO::BinaryReadStatus::not_found) { app.FatalLoadError(); - DWORD error = GetLastError(); assert(false); } - else + else if(heightmapReadResult.status == PortableFileIO::BinaryReadStatus::too_large) { - -#ifdef _DURANGO - __debugbreak(); // TODO - DWORD bytesRead,dwFileSize = 0; -#else - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); -#endif - if(dwFileSize > m_heightmapOverride.length) - { - app.DebugPrintf("Heightmap binary is too large!!\n"); - __debugbreak(); - } - BOOL bSuccess = ReadFile(file,m_heightmapOverride.data,dwFileSize,&bytesRead,NULL); - - if(bSuccess==FALSE) - { - app.FatalLoadError(); - } - CloseHandle(file); + app.DebugPrintf("Heightmap binary is too large!!\n"); + __debugbreak(); + } + else if(heightmapReadResult.status != PortableFileIO::BinaryReadStatus::ok) + { + app.FatalLoadError(); } m_waterheightOverride = byteArray( (m_XZSize*16) * (m_XZSize*16) ); -#ifdef _UNICODE - std::wstring waterHeightPath = L"GAME:\\GameRules\\waterheight.bin"; - -#else #ifdef _WINDOWS64 - std::string waterHeightPath = "GameRules\\waterheight.bin"; + const std::wstring waterHeightPath = L"GameRules\\waterheight.bin"; #else - std::string waterHeightPath = "GAME:\\GameRules\\waterheight.bin"; + const std::wstring waterHeightPath = L"GAME:\\GameRules\\waterheight.bin"; #endif -#endif - file = CreateFile(waterHeightPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if( file == INVALID_HANDLE_VALUE ) + const PortableFileIO::BinaryReadResult waterHeightReadResult = PortableFileIO::ReadBinaryFile(waterHeightPath, m_waterheightOverride.data, m_waterheightOverride.length); + if(waterHeightReadResult.status == PortableFileIO::BinaryReadStatus::not_found) { - DWORD error = GetLastError(); - //assert(false); memset(m_waterheightOverride.data, level->seaLevel, m_waterheightOverride.length); } - else + else if(waterHeightReadResult.status == PortableFileIO::BinaryReadStatus::too_large) { - -#ifdef _DURANGO - __debugbreak(); // TODO - DWORD bytesRead,dwFileSize = 0; -#else - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); -#endif - if(dwFileSize > m_waterheightOverride.length) - { - app.DebugPrintf("waterheight binary is too large!!\n"); - __debugbreak(); - } - BOOL bSuccess = ReadFile(file,m_waterheightOverride.data,dwFileSize,&bytesRead,NULL); - - if(bSuccess==FALSE) - { - app.FatalLoadError(); - } - CloseHandle(file); + app.DebugPrintf("waterheight binary is too large!!\n"); + __debugbreak(); + } + else if(waterHeightReadResult.status != PortableFileIO::BinaryReadStatus::ok) + { + app.FatalLoadError(); } caveFeature = new LargeCaveFeature(); diff --git a/Minecraft.World/Util/PerformanceTimer.cpp b/Minecraft.World/Util/PerformanceTimer.cpp index 96ce372ef..42b00a2a7 100644 --- a/Minecraft.World/Util/PerformanceTimer.cpp +++ b/Minecraft.World/Util/PerformanceTimer.cpp @@ -3,33 +3,17 @@ PerformanceTimer::PerformanceTimer() { -#if !defined (__linux__) - // Get the frequency of the timer - LARGE_INTEGER qwTicksPerSec; - QueryPerformanceFrequency( &qwTicksPerSec ); - m_fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; - Reset(); -#endif } void PerformanceTimer::Reset() { -#if !defined (__linux__) - QueryPerformanceCounter( &m_qwStartTime ); -#endif + m_startTime = std::chrono::steady_clock::now(); } void PerformanceTimer::PrintElapsedTime(const std::wstring &description) { -#if !defined (__linux__) - LARGE_INTEGER qwNewTime, qwDeltaTime; + const std::chrono::duration elapsedTime = std::chrono::steady_clock::now() - m_startTime; - QueryPerformanceCounter( &qwNewTime ); - - qwDeltaTime.QuadPart = qwNewTime.QuadPart - m_qwStartTime.QuadPart; - float fElapsedTime = m_fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); - - app.DebugPrintf("TIMER: %ls: Elapsed time %f\n", description.c_str(), fElapsedTime); -#endif + app.DebugPrintf("TIMER: %ls: Elapsed time %f\n", description.c_str(), elapsedTime.count()); } diff --git a/Minecraft.World/Util/PerformanceTimer.h b/Minecraft.World/Util/PerformanceTimer.h index 5ceaa2480..7fca90507 100644 --- a/Minecraft.World/Util/PerformanceTimer.h +++ b/Minecraft.World/Util/PerformanceTimer.h @@ -1,13 +1,24 @@ #pragma once +#ifdef __valid +#pragma push_macro("__valid") +#undef __valid +#define PERFORMANCE_TIMER_RESTORE_VALID_MACRO +#endif +#include +#ifdef PERFORMANCE_TIMER_RESTORE_VALID_MACRO +#pragma pop_macro("__valid") +#undef PERFORMANCE_TIMER_RESTORE_VALID_MACRO +#endif +#include + class PerformanceTimer { private: - LARGE_INTEGER m_qwStartTime; - float m_fSecsPerTick; + std::chrono::steady_clock::time_point m_startTime; public: PerformanceTimer(); void Reset(); void PrintElapsedTime(const std::wstring &description); -}; \ No newline at end of file +}; diff --git a/Minecraft.World/Util/PortableFileIO.h b/Minecraft.World/Util/PortableFileIO.h new file mode 100644 index 000000000..e3e70a4ac --- /dev/null +++ b/Minecraft.World/Util/PortableFileIO.h @@ -0,0 +1,90 @@ +#pragma once + +#include +#include +#include +#include + +#include "StringHelpers.h" + +namespace PortableFileIO +{ + enum class BinaryReadStatus + { + ok, + not_found, + too_large, + read_error, + }; + + struct BinaryReadResult + { + BinaryReadStatus status; + std::size_t bytesRead; + std::size_t fileSize; + }; + + inline BinaryReadResult ReadBinaryFile(const std::wstring &path, void *buffer, std::size_t capacity) + { + const std::string nativePath = wstringtofilename(path); + std::ifstream stream(nativePath.c_str(), std::ios::binary | std::ios::ate); + if (!stream.is_open()) + { + return { BinaryReadStatus::not_found, 0, 0 }; + } + + const std::streamoff endPosition = stream.tellg(); + if (endPosition < 0) + { + return { BinaryReadStatus::read_error, 0, 0 }; + } + + const std::size_t fileSize = static_cast(endPosition); + if (fileSize > capacity) + { + return { BinaryReadStatus::too_large, 0, fileSize }; + } + + stream.seekg(0, std::ios::beg); + stream.read(reinterpret_cast(buffer), static_cast(fileSize)); + const std::size_t bytesRead = static_cast(stream.gcount()); + if ((!stream && !stream.eof()) || bytesRead != fileSize) + { + return { BinaryReadStatus::read_error, bytesRead, fileSize }; + } + + return { BinaryReadStatus::ok, bytesRead, fileSize }; + } + + inline BinaryReadResult ReadBinaryFileSegment(const std::wstring &path, std::size_t offset, void *buffer, std::size_t bytesToRead) + { + const std::string nativePath = wstringtofilename(path); + std::ifstream stream(nativePath.c_str(), std::ios::binary | std::ios::ate); + if (!stream.is_open()) + { + return { BinaryReadStatus::not_found, 0, 0 }; + } + + const std::streamoff endPosition = stream.tellg(); + if (endPosition < 0) + { + return { BinaryReadStatus::read_error, 0, 0 }; + } + + const std::size_t fileSize = static_cast(endPosition); + if ((offset > fileSize) || (bytesToRead > (fileSize - offset))) + { + return { BinaryReadStatus::too_large, 0, fileSize }; + } + + stream.seekg(static_cast(offset), std::ios::beg); + stream.read(reinterpret_cast(buffer), static_cast(bytesToRead)); + const std::size_t bytesRead = static_cast(stream.gcount()); + if ((!stream && !stream.eof()) || bytesRead != bytesToRead) + { + return { BinaryReadStatus::read_error, bytesRead, fileSize }; + } + + return { BinaryReadStatus::ok, bytesRead, fileSize }; + } +} diff --git a/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp b/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp index 436cdc5ae..9f6c90585 100644 --- a/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp @@ -1,4 +1,5 @@ #include "../../Platform/stdafx.h" +#include "../../Util/PortableFileIO.h" #include "../../Headers/net.minecraft.world.level.biome.h" #include "../../Headers/net.minecraft.world.level.newbiome.layer.h" #include "../../Headers/net.minecraft.world.level.h" @@ -9,47 +10,25 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { m_biomeOverride = byteArray( width * height ); -#ifdef _UNICODE - std::wstring path = L"GAME:\\GameRules\\biomemap.bin"; - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#else #ifdef _WINDOWS64 - std::string path = "GameRules\\biomemap.bin"; + const std::wstring path = L"GameRules\\biomemap.bin"; #else - std::string path = "GAME:\\GameRules\\biomemap.bin"; + const std::wstring path = L"GAME:\\GameRules\\biomemap.bin"; #endif - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#endif - if( file == INVALID_HANDLE_VALUE ) + const PortableFileIO::BinaryReadResult readResult = PortableFileIO::ReadBinaryFile(path, m_biomeOverride.data, m_biomeOverride.length); + if(readResult.status == PortableFileIO::BinaryReadStatus::not_found) { - DWORD error = GetLastError(); - //assert(false); app.DebugPrintf("Biome override not found, using plains as default\n"); - memset(m_biomeOverride.data,Biome::plains->id,m_biomeOverride.length); } - else + else if(readResult.status == PortableFileIO::BinaryReadStatus::too_large) { - -#ifdef _DURANGO - __debugbreak(); // TODO - DWORD bytesRead,dwFileSize = 0; -#else - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); -#endif - if(dwFileSize > m_biomeOverride.length) - { - app.DebugPrintf("Biomemap binary is too large!!\n"); - __debugbreak(); - } - BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,NULL); - - if(bSuccess==FALSE) - { - app.FatalLoadError(); - } - - CloseHandle(file); + app.DebugPrintf("Biomemap binary is too large!!\n"); + __debugbreak(); + } + else if(readResult.status != PortableFileIO::BinaryReadStatus::ok) + { + app.FatalLoadError(); } } @@ -78,4 +57,4 @@ intArray BiomeOverrideLayer::getArea(int xo, int yo, int w, int h) } } return result; -} \ No newline at end of file +} From 2cc7a74e6fe938f41b2f12108b33600217635f4a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:34:16 +1100 Subject: [PATCH 002/192] Remove HANDLE from portable file streams --- Minecraft.World/IO/Files/FileInputStream.cpp | 169 +++++++++--------- Minecraft.World/IO/Files/FileInputStream.h | 8 +- Minecraft.World/IO/Files/FileOutputStream.cpp | 140 ++++++--------- Minecraft.World/IO/Files/FileOutputStream.h | 10 +- 4 files changed, 144 insertions(+), 183 deletions(-) diff --git a/Minecraft.World/IO/Files/FileInputStream.cpp b/Minecraft.World/IO/Files/FileInputStream.cpp index c5586a781..14d91f8b2 100644 --- a/Minecraft.World/IO/Files/FileInputStream.cpp +++ b/Minecraft.World/IO/Files/FileInputStream.cpp @@ -2,11 +2,31 @@ #include "File.h" #include "FileInputStream.h" -#include -#include // for close() +#include extern CConsoleMinecraftApp app; +namespace +{ + __int64 FileTell(std::FILE *file) + { +#if defined(_WIN32) + return _ftelli64(file); +#else + return static_cast<__int64>(ftello(file)); +#endif + } + + bool FileSeek(std::FILE *file, __int64 offset, int origin) + { +#if defined(_WIN32) + return _fseeki64(file, offset, origin) == 0; +#else + return fseeko(file, static_cast(offset), origin) == 0; +#endif + } +} + //Creates a FileInputStream by opening a connection to an actual file, the file named by the File object file in the file system. //A new FileDescriptor object is created to represent this file connection. //First, if there is a security manager, its checkRead method is called with the path represented by the file argument as its argument. @@ -20,34 +40,16 @@ extern CConsoleMinecraftApp app; //FileNotFoundException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be //opened for reading. //SecurityException - if a security manager exists and its checkRead method denies read access to the file. -FileInputStream::FileInputStream(const File &file) +FileInputStream::FileInputStream(const File &file) : m_fileHandle(NULL) { - const char *pchFilename=wstringtofilename(file.getPath()); -#ifdef _UNICODE - m_fileHandle = CreateFile( - file.getPath().c_str(), // file name - GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it - FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported - ); -#elif defined(__linux__) - m_fileHandle = (HANDLE)(intptr_t)open(pchFilename, O_RDONLY); +#if defined(_WIN32) + m_fileHandle = _wfopen(file.getPath().c_str(), L"rb"); #else - m_fileHandle = CreateFile( - pchFilename, // file name - GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it - FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported - ); + const std::string nativePath = wstringtofilename(file.getPath()); + m_fileHandle = std::fopen(nativePath.c_str(), "rb"); #endif - if( m_fileHandle == INVALID_HANDLE_VALUE ) + if( m_fileHandle == NULL ) { // TODO 4J Stu - Any form of error/exception handling //__debugbreak(); @@ -57,45 +59,26 @@ FileInputStream::FileInputStream(const File &file) FileInputStream::~FileInputStream() { - if( m_fileHandle != INVALID_HANDLE_VALUE ) -#ifndef __linux__ - CloseHandle( m_fileHandle ); -#else - ::close( (int)(intptr_t)m_fileHandle ); -#endif -} - -#if defined(__linux__) -ssize_t ReadFile(int fd, void* buffer, size_t byteRead, DWORD* numberOfBytesRead, int JustAddANULL) { - ssize_t result = read(fd, buffer, byteRead); - - if (result == -1) { - perror("read failed"); - return -1; - } else { - *numberOfBytesRead = result; - return 0; + if( m_fileHandle != NULL ) + { + std::fclose( m_fileHandle ); } } -#endif // __linux__ //Reads a byte of data from this input stream. This method blocks if no input is yet available. //Returns: //the next byte of data, or -1 if the end of the file is reached. int FileInputStream::read() { + if( m_fileHandle == NULL ) + { + return -1; + } + uint8_t byteRead = static_cast(0); - DWORD numberOfBytesRead; + const size_t numberOfBytesRead = std::fread(&byteRead, 1, 1, m_fileHandle); - BOOL bSuccess = ReadFile( - m_fileHandle, // handle to file - &byteRead, // data buffer - 1, // number of bytes to read - &numberOfBytesRead, // number of bytes read - NULL // overlapped buffer - ); - - if( bSuccess==FALSE ) + if( std::ferror(m_fileHandle) != 0 ) { // TODO 4J Stu - Some kind of error handling app.FatalLoadError(); @@ -117,17 +100,14 @@ int FileInputStream::read() //the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. int FileInputStream::read(byteArray b) { - DWORD numberOfBytesRead; + if( m_fileHandle == NULL ) + { + return -1; + } - BOOL bSuccess = ReadFile( - m_fileHandle, // handle to file - b.data, // data buffer - b.length, // number of bytes to read - &numberOfBytesRead, // number of bytes read - NULL // overlapped buffer - ); + const size_t numberOfBytesRead = std::fread(b.data, 1, b.length, m_fileHandle); - if( bSuccess==FALSE ) + if( std::ferror(m_fileHandle) != 0 ) { // TODO 4J Stu - Some kind of error handling app.FatalLoadError(); @@ -155,17 +135,14 @@ int FileInputStream::read(byteArray b, unsigned int offset, unsigned int length) // 4J Stu - We don't want to read any more than the array buffer can hold assert( length <= ( b.length - offset ) ); - DWORD numberOfBytesRead; + if( m_fileHandle == NULL ) + { + return -1; + } - BOOL bSuccess = ReadFile( - m_fileHandle, // handle to file - &b[offset], // data buffer - length, // number of bytes to read - &numberOfBytesRead, // number of bytes read - NULL // overlapped buffer - ); + const size_t numberOfBytesRead = std::fread(&b[offset], 1, length, m_fileHandle); - if( bSuccess==FALSE ) + if( std::ferror(m_fileHandle) != 0 ) { // TODO 4J Stu - Some kind of error handling app.FatalLoadError(); @@ -184,21 +161,21 @@ int FileInputStream::read(byteArray b, unsigned int offset, unsigned int length) //If this stream has an associated channel then the channel is closed as well. void FileInputStream::close() { - if(m_fileHandle==INVALID_HANDLE_VALUE) + if(m_fileHandle==NULL) { //printf("\n\nFileInputStream::close - TRYING TO CLOSE AN INVALID FILE HANDLE\n\n"); return; } - int result = ::close( (int)(intptr_t)m_fileHandle ); + int result = std::fclose( m_fileHandle ); - if( result == 0 ) + if( result != 0 ) { // TODO 4J Stu - Some kind of error handling } // Stop the dtor from trying to close it again - m_fileHandle = INVALID_HANDLE_VALUE; + m_fileHandle = NULL; } @@ -211,18 +188,34 @@ void FileInputStream::close() //the actual number of bytes skipped. __int64 FileInputStream::skip(__int64 n) { -#ifdef _XBOX - LARGE_INTEGER li; - li.QuadPart = n; - li.LowPart = SetFilePointer(m_fileHandle, li.LowPart, &li.HighPart, FILE_CURRENT); - - if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) + if( m_fileHandle == NULL || n <= 0 ) { - li.QuadPart = 0; + return 0; } - return li.QuadPart; -#else - return 0; -#endif + const __int64 start = FileTell(m_fileHandle); + if( start < 0 ) + { + return 0; + } + + if( !FileSeek(m_fileHandle, 0, SEEK_END) ) + { + return 0; + } + + const __int64 end = FileTell(m_fileHandle); + if( end < 0 ) + { + return 0; + } + + const __int64 offset = std::min(n, std::max<__int64>(0, end - start)); + const __int64 target = start + offset; + if( !FileSeek(m_fileHandle, target, SEEK_SET) ) + { + return 0; + } + + return offset; } diff --git a/Minecraft.World/IO/Files/FileInputStream.h b/Minecraft.World/IO/Files/FileInputStream.h index ecf3ff599..7afda60a2 100644 --- a/Minecraft.World/IO/Files/FileInputStream.h +++ b/Minecraft.World/IO/Files/FileInputStream.h @@ -1,8 +1,12 @@ #pragma once // 4J Stu - Represents Java standard library class +#include + #include "../Streams/InputStream.h" +class File; + class FileInputStream : public InputStream { public: @@ -15,6 +19,6 @@ public: virtual __int64 skip(__int64 n); private: - HANDLE m_fileHandle; + std::FILE *m_fileHandle; -}; \ No newline at end of file +}; diff --git a/Minecraft.World/IO/Files/FileOutputStream.cpp b/Minecraft.World/IO/Files/FileOutputStream.cpp index 8b0ff4213..904f6fca7 100644 --- a/Minecraft.World/IO/Files/FileOutputStream.cpp +++ b/Minecraft.World/IO/Files/FileOutputStream.cpp @@ -1,14 +1,6 @@ #include "../../Platform/stdafx.h" #include "File.h" #include "FileOutputStream.h" -#include -#include -#include -#include -#include -#include -#include -#include //Creates a file output stream to write to the file represented by the specified File object. A new FileDescriptor object is //created to represent this file connection. @@ -19,7 +11,7 @@ // //Parameters: //file - the file to be opened for writing. -FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HANDLE_VALUE ) +FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( NULL ) { if( file.exists() && file.isDirectory()) { @@ -27,46 +19,26 @@ FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HAN return; } -#ifdef _DURANGO - m_fileHandle = CreateFile( - file.getPath().c_str() , // file name - GENERIC_WRITE, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_ALWAYS , // how to create - FILE_ATTRIBUTE_NORMAL , // file attributes - NULL // Unsupported - ); -#elif defined(__linux__) - std::wstring path = file.getPath(); - char* convertedPath = new char[path.size() + 1]; - std::wcstombs(convertedPath, path.c_str(), path.size() + 1); - - m_fileHandle = (HANDLE)(intptr_t)open(convertedPath, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); - delete[] convertedPath; +#if defined(_WIN32) + m_fileHandle = _wfopen(file.getPath().c_str(), L"wb"); #else - m_fileHandle = CreateFile( - wstringtofilename(file.getPath()) , // file name - GENERIC_WRITE, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_ALWAYS , // how to create - FILE_ATTRIBUTE_NORMAL , // file attributes - NULL // Unsupported - ); + const std::string nativePath = wstringtofilename(file.getPath()); + m_fileHandle = std::fopen(nativePath.c_str(), "wb"); #endif - if( m_fileHandle == INVALID_HANDLE_VALUE ) + if( m_fileHandle == NULL ) { // TODO 4J Stu - Any form of error/exception handling - DWORD error = GetLastError(); + perror("FileOutputStream::FileOutputStream"); } } FileOutputStream::~FileOutputStream() { - if( m_fileHandle != INVALID_HANDLE_VALUE ) - ::close( (int)(intptr_t)m_fileHandle ); + if( m_fileHandle != NULL ) + { + std::fclose( m_fileHandle ); + } } //Writes the specified byte to this file output stream. Implements the write method of OutputStream. @@ -74,23 +46,16 @@ FileOutputStream::~FileOutputStream() //b - the byte to be written. void FileOutputStream::write(unsigned int b) { + if( m_fileHandle == NULL ) + { + return; + } + uint8_t value = (uint8_t) b; + const size_t numberOfBytesWritten = std::fwrite(&value, 1, 1, m_fileHandle); + const int result = std::ferror(m_fileHandle); -#if defined(_WIN32) - BOOL result = WriteFile( - m_fileHandle, // handle to file - &value, // data buffer - 1, // number of bytes to write - &numberOfBytesWritten, // number of bytes written - NULL // overlapped buffer - ); -#else // LINUX - int fileDescriptor = (int)(intptr_t)(m_fileHandle); - ssize_t numberOfBytesWritten = ::write(fileDescriptor, &value, 1); - int result = static_cast(numberOfBytesWritten); -#endif // _WIN32 - - if( result == 0 ) + if( result != 0 ) { // TODO 4J Stu - Some kind of error handling } @@ -105,21 +70,15 @@ void FileOutputStream::write(unsigned int b) //b - the data. void FileOutputStream::write(byteArray b) { -#if defined(_WIN32) - BOOL result = WriteFile( - m_fileHandle, // handle to file - &b.data, // data buffer - b.length, // number of bytes to write - &numberOfBytesWritten, // number of bytes written - NULL // overlapped buffer - ); -#else // Linux - int fileDescriptor = (int)(intptr_t)(m_fileHandle); - ssize_t numberOfBytesWritten = ::write(fileDescriptor, static_cast(b.data), b.length); - int result = static_cast(numberOfBytesWritten); -#endif // _WIN32 + if( m_fileHandle == NULL ) + { + return; + } - if( result == 0 ) + const size_t numberOfBytesWritten = std::fwrite(b.data, 1, b.length, m_fileHandle); + const int result = std::ferror(m_fileHandle); + + if( result != 0 ) { // TODO 4J Stu - Some kind of error handling } @@ -139,23 +98,15 @@ void FileOutputStream::write(byteArray b, unsigned int offset, unsigned int leng // 4J Stu - We don't want to write any more than the array buffer holds assert( length <= ( b.length - offset ) ); -#if defined(_WIN32) - DWORD numberOfBytesWritten; + if( m_fileHandle == NULL ) + { + return; + } - BOOL result = WriteFile( - m_fileHandle, // handle to file - &b[offset], // data buffer - length, // number of bytes to write - &numberOfBytesWritten, // number of bytes written - NULL // overlapped buffer - ); -#else - int fileDescriptor = (int)(intptr_t)(m_fileHandle); - ssize_t numberOfBytesWritten = ::write(fileDescriptor, static_cast(&b[offset]), length); - int result = static_cast(numberOfBytesWritten); -#endif // _WIN32 + const size_t numberOfBytesWritten = std::fwrite(&b[offset], 1, length, m_fileHandle); + const int result = std::ferror(m_fileHandle); - if( result == 0 ) + if( result != 0 ) { // TODO 4J Stu - Some kind of error handling } @@ -170,16 +121,25 @@ void FileOutputStream::write(byteArray b, unsigned int offset, unsigned int leng //If this stream has an associated channel then the channel is closed as well. void FileOutputStream::close() { -#ifdef _WIN32 - BOOL result = CloseHandle( m_fileHandle ); -#else // __linux__ - int result = ::close( (int)(intptr_t)m_fileHandle ); -#endif // _WIN32 - if( result == 0 ) + if( m_fileHandle == NULL ) + { + return; + } + + int result = std::fclose( m_fileHandle ); + if( result != 0 ) { // TODO 4J Stu - Some kind of error handling } // Stop the dtor from trying to close it again - m_fileHandle = INVALID_HANDLE_VALUE; + m_fileHandle = NULL; +} + +void FileOutputStream::flush() +{ + if( m_fileHandle != NULL ) + { + std::fflush( m_fileHandle ); + } } diff --git a/Minecraft.World/IO/Files/FileOutputStream.h b/Minecraft.World/IO/Files/FileOutputStream.h index 577994303..03734802c 100644 --- a/Minecraft.World/IO/Files/FileOutputStream.h +++ b/Minecraft.World/IO/Files/FileOutputStream.h @@ -1,8 +1,12 @@ #pragma once // 4J Stu - Represents Java standard lib abstract +#include + #include "../Streams/OutputStream.h" +class File; + class FileOutputStream : public OutputStream { public: @@ -12,8 +16,8 @@ public: virtual void write(byteArray b); virtual void write(byteArray b, unsigned int offset, unsigned int length); virtual void close(); - virtual void flush() {} + virtual void flush(); private: - HANDLE m_fileHandle; -}; \ No newline at end of file + std::FILE *m_fileHandle; +}; From 62a5c364f2b2d5590a1097a9cc15dc1caa6520d6 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:39:09 +1100 Subject: [PATCH 003/192] Use portable file reads for DLC texture data --- .../Textures/Packs/DLCTexturePack.cpp | 146 +++++++----------- Minecraft.World/Util/PortableFileIO.h | 89 ++++++++--- 2 files changed, 123 insertions(+), 112 deletions(-) diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 3519b038c..b7df9e445 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -8,14 +8,47 @@ #include "../../Platform/Common/DLC/DLCTextureFile.h" #include "../../Platform/Common/DLC/DLCLocalisationFile.h" #include "../../../Minecraft.World/Util/StringHelpers.h" +#include "../../../Minecraft.World/Util/PortableFileIO.h" #include "../../Utils/StringTable.h" #include "../../Platform/Common/DLC/DLCAudioFile.h" +#include + #if defined _XBOX || defined _WINDOWS64 #include "../../Platform/Xbox/XML/ATGXmlParser.h" #include "../../Platform/Xbox/XML/xmlFilesCallback.h" #endif +namespace +{ + bool ReadPortableBinaryFile(File &file, PBYTE &data, DWORD &size) + { + const __int64 fileLength = file.length(); + if (fileLength < 0 || fileLength > static_cast<__int64>(std::numeric_limits::max())) + { + data = NULL; + size = 0; + return false; + } + + const std::size_t capacity = static_cast(fileLength); + PBYTE buffer = new BYTE[capacity == 0 ? 1 : capacity]; + const PortableFileIO::BinaryReadResult readResult = PortableFileIO::ReadBinaryFile(file.getPath(), buffer, capacity); + if (readResult.status != PortableFileIO::BinaryReadStatus::ok + || readResult.fileSize > std::numeric_limits::max()) + { + delete [] buffer; + data = NULL; + size = 0; + return false; + } + + data = buffer; + size = static_cast(readResult.fileSize); + return true; + } +} + DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) { m_dlcInfoPack = pack; @@ -305,30 +338,12 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if(xzpPath.exists()) { - const char *pchFilename=wstringtofilename(xzpPath.getPath()); - HANDLE fileHandle = CreateFile( - pchFilename, // file name - GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it - FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported - ); - - if( fileHandle != INVALID_HANDLE_VALUE ) + PBYTE pbData = NULL; + DWORD bytesRead = 0; + if( ReadPortableBinaryFile(xzpPath, pbData, bytesRead) ) { - DWORD dwFileSize = xzpPath.length(); - DWORD bytesRead; - PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL success = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); - CloseHandle(fileHandle); - if(success) - { - DLCUIDataFile *uiDLCFile = (DLCUIDataFile *)texturePack->m_dlcDataPack->addFile(DLCManager::e_DLCType_UIData,L"TexturePack.xzp"); - uiDLCFile->addData(pbData,bytesRead,true); - - } + DLCUIDataFile *uiDLCFile = (DLCUIDataFile *)texturePack->m_dlcDataPack->addFile(DLCManager::e_DLCType_UIData,L"TexturePack.xzp"); + uiDLCFile->addData(pbData,bytesRead,true); } } #else @@ -354,43 +369,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen File grf( getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dlcFile->getGrfPath() ) ); if (grf.exists()) { -#if defined(_UNICODE) && !defined(__linux__) - std::wstring path = grf.getPath(); - const WCHAR *pchFilename=path.c_str(); - HANDLE fileHandle = CreateFile( - pchFilename, // file name - GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it - FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported - ); -#else - const char *pchFilename=wstringtofilename(grf.getPath()); - HANDLE fileHandle = CreateFile( - pchFilename, // file name - GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it - FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported - ); -#endif - - if( fileHandle != INVALID_HANDLE_VALUE ) + PBYTE pbData = NULL; + DWORD dwFileSize = 0; + if( ReadPortableBinaryFile(grf, pbData, dwFileSize) ) { - DWORD dwFileSize = grf.length(); - DWORD bytesRead; - PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); - if(bSuccess==FALSE) - { - app.FatalLoadError(); - } - CloseHandle(fileHandle); - // 4J-PB - is it possible that we can get here after a read fail and it's not an error? dlcFile->setGrfData(pbData, dwFileSize, texturePack->m_stringTable); @@ -398,6 +380,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen app.m_gameRules.setLevelGenerationOptions( dlcFile->lgo ); } + else + { + app.FatalLoadError(); + } } } } @@ -406,45 +392,17 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen File grf(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), levelGen->getBaseSavePath() )); if (grf.exists()) { -#if defined(_UNICODE) && !defined(__linux__) - std::wstring path = grf.getPath(); - const WCHAR *pchFilename=path.c_str(); - HANDLE fileHandle = CreateFile( - pchFilename, // file name - GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it - FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported - ); -#else - const char *pchFilename=wstringtofilename(grf.getPath()); - HANDLE fileHandle = CreateFile( - pchFilename, // file name - GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused - OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it - FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported - ); -#endif - - if( fileHandle != INVALID_HANDLE_VALUE ) + PBYTE pbData = NULL; + DWORD dwFileSize = 0; + if( ReadPortableBinaryFile(grf, pbData, dwFileSize) ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); - PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); - if(bSuccess==FALSE) - { - app.FatalLoadError(); - } - CloseHandle(fileHandle); - // 4J-PB - is it possible that we can get here after a read fail and it's not an error? levelGen->setBaseSaveData(pbData, dwFileSize); } + else + { + app.FatalLoadError(); + } } } } diff --git a/Minecraft.World/Util/PortableFileIO.h b/Minecraft.World/Util/PortableFileIO.h index e3e70a4ac..126a1448e 100644 --- a/Minecraft.World/Util/PortableFileIO.h +++ b/Minecraft.World/Util/PortableFileIO.h @@ -1,8 +1,7 @@ #pragma once #include -#include -#include +#include #include #include "StringHelpers.h" @@ -24,31 +23,72 @@ namespace PortableFileIO std::size_t fileSize; }; + inline std::FILE *OpenBinaryFileForRead(const std::wstring &path) + { +#if defined(_WIN32) + return _wfopen(path.c_str(), L"rb"); +#else + const std::string nativePath = wstringtofilename(path); + return std::fopen(nativePath.c_str(), "rb"); +#endif + } + + inline bool Seek(std::FILE *file, std::size_t offset, int origin) + { +#if defined(_WIN32) + return _fseeki64(file, static_cast<__int64>(offset), origin) == 0; +#else + return fseeko(file, static_cast(offset), origin) == 0; +#endif + } + + inline __int64 Tell(std::FILE *file) + { +#if defined(_WIN32) + return _ftelli64(file); +#else + return static_cast<__int64>(ftello(file)); +#endif + } + inline BinaryReadResult ReadBinaryFile(const std::wstring &path, void *buffer, std::size_t capacity) { - const std::string nativePath = wstringtofilename(path); - std::ifstream stream(nativePath.c_str(), std::ios::binary | std::ios::ate); - if (!stream.is_open()) + std::FILE *stream = OpenBinaryFileForRead(path); + if (stream == NULL) { return { BinaryReadStatus::not_found, 0, 0 }; } - const std::streamoff endPosition = stream.tellg(); + if (!Seek(stream, 0, SEEK_END)) + { + std::fclose(stream); + return { BinaryReadStatus::read_error, 0, 0 }; + } + + const __int64 endPosition = Tell(stream); if (endPosition < 0) { + std::fclose(stream); return { BinaryReadStatus::read_error, 0, 0 }; } const std::size_t fileSize = static_cast(endPosition); if (fileSize > capacity) { + std::fclose(stream); return { BinaryReadStatus::too_large, 0, fileSize }; } - stream.seekg(0, std::ios::beg); - stream.read(reinterpret_cast(buffer), static_cast(fileSize)); - const std::size_t bytesRead = static_cast(stream.gcount()); - if ((!stream && !stream.eof()) || bytesRead != fileSize) + if (!Seek(stream, 0, SEEK_SET)) + { + std::fclose(stream); + return { BinaryReadStatus::read_error, 0, fileSize }; + } + + const std::size_t bytesRead = std::fread(buffer, 1, fileSize, stream); + const bool failed = std::ferror(stream) != 0; + std::fclose(stream); + if (failed || bytesRead != fileSize) { return { BinaryReadStatus::read_error, bytesRead, fileSize }; } @@ -58,29 +98,42 @@ namespace PortableFileIO inline BinaryReadResult ReadBinaryFileSegment(const std::wstring &path, std::size_t offset, void *buffer, std::size_t bytesToRead) { - const std::string nativePath = wstringtofilename(path); - std::ifstream stream(nativePath.c_str(), std::ios::binary | std::ios::ate); - if (!stream.is_open()) + std::FILE *stream = OpenBinaryFileForRead(path); + if (stream == NULL) { return { BinaryReadStatus::not_found, 0, 0 }; } - const std::streamoff endPosition = stream.tellg(); + if (!Seek(stream, 0, SEEK_END)) + { + std::fclose(stream); + return { BinaryReadStatus::read_error, 0, 0 }; + } + + const __int64 endPosition = Tell(stream); if (endPosition < 0) { + std::fclose(stream); return { BinaryReadStatus::read_error, 0, 0 }; } const std::size_t fileSize = static_cast(endPosition); if ((offset > fileSize) || (bytesToRead > (fileSize - offset))) { + std::fclose(stream); return { BinaryReadStatus::too_large, 0, fileSize }; } - stream.seekg(static_cast(offset), std::ios::beg); - stream.read(reinterpret_cast(buffer), static_cast(bytesToRead)); - const std::size_t bytesRead = static_cast(stream.gcount()); - if ((!stream && !stream.eof()) || bytesRead != bytesToRead) + if (!Seek(stream, offset, SEEK_SET)) + { + std::fclose(stream); + return { BinaryReadStatus::read_error, 0, fileSize }; + } + + const std::size_t bytesRead = std::fread(buffer, 1, bytesToRead, stream); + const bool failed = std::ferror(stream) != 0; + std::fclose(stream); + if (failed || bytesRead != bytesToRead) { return { BinaryReadStatus::read_error, bytesRead, fileSize }; } From 37d9439be3392494134e3d60a199a07ff5ea7dc4 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:41:52 +1100 Subject: [PATCH 004/192] Use portable file writes for debug save dumps --- .../IO/Files/ConsoleSaveFileOriginal.cpp | 25 ++++++++----------- .../IO/Files/ConsoleSaveFileSplit.cpp | 18 ++++++------- Minecraft.World/Util/PortableFileIO.h | 19 ++++++++++++++ 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index a5bce2de1..ddcf4d439 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -1,5 +1,6 @@ #include "../../Platform/stdafx.h" #include "../../Util/StringHelpers.h" +#include "../../Util/PortableFileIO.h" #include "ConsoleSaveFileOriginal.h" #include "File.h" #include @@ -859,23 +860,19 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, } swprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH+1, L"\\v%04d-%ls%02d.%02d.%02d.%02d.%02d.mcs",VER_PRODUCTBUILD,cutFileName.c_str(), t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); -#ifdef _UNICODE - std::wstring wtemp = targetFileDir.getPath() + std::wstring(fileName); - LPCWSTR lpFileName = wtemp.c_str(); -#else - LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + std::wstring(fileName) ); -#endif + const std::wstring outputPath = targetFileDir.getPath() + std::wstring(fileName); #ifndef __PSVITA__ - HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); + bool writeSucceeded = false; #endif if(compressedData != NULL && compressedDataSize > 0) { #ifdef __PSVITA__ // AP - Use the access function to save - VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, NULL); + VirtualWriteFile( outputPath.c_str(), compressedData, compressedDataSize, &numberOfBytesWritten, NULL); #else - WriteFile( hSaveFile,compressedData,compressedDataSize,&numberOfBytesWritten,NULL); + writeSucceeded = PortableFileIO::WriteBinaryFile(outputPath, compressedData, compressedDataSize); + numberOfBytesWritten = writeSucceeded ? compressedDataSize : 0; #endif assert(numberOfBytesWritten == compressedDataSize); } @@ -883,15 +880,13 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, { #ifdef __PSVITA__ // AP - Use the access function to save - VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, NULL); + VirtualWriteFile( outputPath.c_str(), compressedData, compressedDataSize, &numberOfBytesWritten, NULL); #else - WriteFile(hSaveFile,pvSaveMem,fileSize,&numberOfBytesWritten,NULL); + writeSucceeded = PortableFileIO::WriteBinaryFile(outputPath, pvSaveMem, fileSize); + numberOfBytesWritten = writeSucceeded ? fileSize : 0; #endif assert(numberOfBytesWritten == fileSize); } -#ifndef __PSVITA__ - CloseHandle( hSaveFile ); -#endif delete[] fileName; @@ -1064,4 +1059,4 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() void *ConsoleSaveFileOriginal::getWritePointer(FileEntry *file) { return (char *)pvSaveMem + file->currentFilePointer;; -} \ No newline at end of file +} diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 5b088f628..167b580cc 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -1,5 +1,6 @@ #include "../../Platform/stdafx.h" #include "../../Util/StringHelpers.h" +#include "../../Util/PortableFileIO.h" #include "ConsoleSaveFileSplit.h" #include "ConsoleSaveFileConverter.h" #include "File.h" @@ -1510,26 +1511,21 @@ void ConsoleSaveFileSplit::DebugFlushToFile(void *compressedData /*= NULL*/, uns } swprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH+1, L"\\v%04d-%ls%02d.%02d.%02d.%02d.%02d.mcs",VER_PRODUCTBUILD,cutFileName.c_str(), t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); -#ifdef _UNICODE - std::wstring wtemp = targetFileDir.getPath() + std::wstring(fileName); - LPCWSTR lpFileName = wtemp.c_str(); -#else - LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + std::wstring(fileName) ); -#endif - - HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); + const std::wstring outputPath = targetFileDir.getPath() + std::wstring(fileName); + bool writeSucceeded = false; if(compressedData != NULL && compressedDataSize > 0) { - WriteFile(hSaveFile,compressedData,compressedDataSize,&numberOfBytesWritten,NULL); + writeSucceeded = PortableFileIO::WriteBinaryFile(outputPath, compressedData, compressedDataSize); + numberOfBytesWritten = writeSucceeded ? compressedDataSize : 0; assert(numberOfBytesWritten == compressedDataSize); } else { - WriteFile(hSaveFile,pvSaveMem,fileSize,&numberOfBytesWritten,NULL); + writeSucceeded = PortableFileIO::WriteBinaryFile(outputPath, pvSaveMem, fileSize); + numberOfBytesWritten = writeSucceeded ? fileSize : 0; assert(numberOfBytesWritten == fileSize); } - CloseHandle( hSaveFile ); delete[] fileName; diff --git a/Minecraft.World/Util/PortableFileIO.h b/Minecraft.World/Util/PortableFileIO.h index 126a1448e..aed99aa31 100644 --- a/Minecraft.World/Util/PortableFileIO.h +++ b/Minecraft.World/Util/PortableFileIO.h @@ -140,4 +140,23 @@ namespace PortableFileIO return { BinaryReadStatus::ok, bytesRead, fileSize }; } + + inline bool WriteBinaryFile(const std::wstring &path, const void *buffer, std::size_t bytesToWrite) + { +#if defined(_WIN32) + std::FILE *stream = _wfopen(path.c_str(), L"wb"); +#else + const std::string nativePath = wstringtofilename(path); + std::FILE *stream = std::fopen(nativePath.c_str(), "wb"); +#endif + if (stream == NULL) + { + return false; + } + + const std::size_t bytesWritten = std::fwrite(buffer, 1, bytesToWrite, stream); + const bool failed = std::ferror(stream) != 0 || bytesWritten != bytesToWrite; + const bool closeFailed = std::fclose(stream) != 0; + return !failed && !closeFailed; + } } From 22757b4b517ecc3dafa138922bf8fe6fa4052fe6 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:57:50 +1100 Subject: [PATCH 005/192] Remove HANDLE from zoned chunk storage headers --- Minecraft.World/IO/NBT/NbtSlotFile.cpp | 100 ++++++++++++++------- Minecraft.World/IO/NBT/NbtSlotFile.h | 4 +- Minecraft.World/Level/Storage/ZoneFile.cpp | 32 ++++++- Minecraft.World/Level/Storage/ZoneFile.h | 4 +- Minecraft.World/Level/Storage/ZoneIO.cpp | 26 ++++-- Minecraft.World/Level/Storage/ZoneIO.h | 6 +- 6 files changed, 127 insertions(+), 45 deletions(-) diff --git a/Minecraft.World/IO/NBT/NbtSlotFile.cpp b/Minecraft.World/IO/NBT/NbtSlotFile.cpp index 3a7cceacf..a373667fe 100644 --- a/Minecraft.World/IO/NBT/NbtSlotFile.cpp +++ b/Minecraft.World/IO/NBT/NbtSlotFile.cpp @@ -2,6 +2,47 @@ #include "../Files/File.h" #include "NbtSlotFile.h" +namespace +{ + std::FILE *OpenBinaryFileForReadWrite(const File &file) + { +#if defined(_WIN32) + std::FILE *stream = _wfopen(file.getPath().c_str(), L"r+b"); + if (stream == NULL) + { + stream = _wfopen(file.getPath().c_str(), L"w+b"); + } +#else + const std::string nativePath = wstringtofilename(file.getPath()); + std::FILE *stream = std::fopen(nativePath.c_str(), "r+b"); + if (stream == NULL) + { + stream = std::fopen(nativePath.c_str(), "w+b"); + } +#endif + return stream; + } + + bool SeekFile(std::FILE *file, __int64 offset) + { +#if defined(_WIN32) + return _fseeki64(file, offset, SEEK_SET) == 0; +#else + return fseeko(file, static_cast(offset), SEEK_SET) == 0; +#endif + } + + bool ReadExact(std::FILE *file, void *buffer, std::size_t size) + { + return std::fread(buffer, 1, size, file) == size; + } + + bool WriteExact(std::FILE *file, const void *buffer, std::size_t size) + { + return std::fwrite(buffer, 1, size, file) == size; + } +} + byteArray NbtSlotFile::READ_BUFFER(1024*1024); __int64 NbtSlotFile::largest = 0; @@ -14,12 +55,12 @@ NbtSlotFile::NbtSlotFile(File file) if ( !file.exists() || file.length() ) { - raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + raf = OpenBinaryFileForReadWrite(file); writeHeader(); } else { - raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + raf = OpenBinaryFileForReadWrite(file); } readHeader(); @@ -29,12 +70,11 @@ NbtSlotFile::NbtSlotFile(File file) fileSlotMap[i] = new std::vector; } - DWORD numberofBytesRead; for (int fileSlot = 0; fileSlot < totalFileSlots; fileSlot++) { seekSlotHeader(fileSlot); short slot; - ReadFile(raf,&slot,2,&numberofBytesRead,NULL); + ReadExact(raf, &slot, sizeof(slot)); if (slot == 0) { freeFileSlots.push_back(fileSlot); @@ -49,42 +89,39 @@ NbtSlotFile::NbtSlotFile(File file) void NbtSlotFile::readHeader() { - DWORD numberOfBytesRead; - SetFilePointer(raf,0,0,FILE_BEGIN); + SeekFile(raf, 0); int magic; - ReadFile(raf,&magic,4,&numberOfBytesRead,NULL); + ReadExact(raf, &magic, sizeof(magic)); // if (magic != MAGIC_NUMBER) throw new IOException("Bad magic number: " + magic); // 4J - TODO short version; - ReadFile(raf,&version,2,&numberOfBytesRead,NULL); + ReadExact(raf, &version, sizeof(version)); // if (version != 0) throw new IOException("Bad version number: " + version); // 4J - TODO - ReadFile(raf,&totalFileSlots,4,&numberOfBytesRead,NULL); + ReadExact(raf, &totalFileSlots, sizeof(totalFileSlots)); } void NbtSlotFile::writeHeader() { - DWORD numberOfBytesWritten; short version = 0; - SetFilePointer(raf,0,0,FILE_BEGIN); - WriteFile(raf,&MAGIC_NUMBER,4,&numberOfBytesWritten,NULL); - WriteFile(raf,&version,2,&numberOfBytesWritten,NULL); - WriteFile(raf,&totalFileSlots,4,&numberOfBytesWritten,NULL); + SeekFile(raf, 0); + WriteExact(raf, &MAGIC_NUMBER, sizeof(MAGIC_NUMBER)); + WriteExact(raf, &version, sizeof(version)); + WriteExact(raf, &totalFileSlots, sizeof(totalFileSlots)); } void NbtSlotFile::seekSlotHeader(int fileSlot) { int target = FILE_HEADER_SIZE + fileSlot * (FILE_SLOT_SIZE + FILE_SLOT_HEADER_SIZE); - SetFilePointer(raf,target,0,FILE_BEGIN); + SeekFile(raf, target); } void NbtSlotFile::seekSlot(int fileSlot) { int target = FILE_HEADER_SIZE + fileSlot * (FILE_SLOT_SIZE + FILE_SLOT_HEADER_SIZE); - SetFilePointer(raf,target+FILE_SLOT_HEADER_SIZE,0,FILE_BEGIN); + SeekFile(raf, target + FILE_SLOT_HEADER_SIZE); } std::vector *NbtSlotFile::readAll(int slot) { - DWORD numberOfBytesRead; std::vector *tags = new std::vector; std::vector *fileSlots = fileSlotMap[slot]; int skipped = 0; @@ -101,12 +138,12 @@ std::vector *NbtSlotFile::readAll(int slot) { seekSlotHeader(c); short oldSlot; - ReadFile(raf,&oldSlot,2,&numberOfBytesRead,NULL); + ReadExact(raf, &oldSlot, sizeof(oldSlot)); short size; - ReadFile(raf,&size,2,&numberOfBytesRead,NULL); - ReadFile(raf,&continuesAt,4,&numberOfBytesRead,NULL); + ReadExact(raf, &size, sizeof(size)); + ReadExact(raf, &continuesAt, sizeof(continuesAt)); int lastSlot; - ReadFile(raf,&lastSlot,4,&numberOfBytesRead,NULL); + ReadExact(raf, &lastSlot, sizeof(lastSlot)); seekSlot(c); if (expectedSlot > 0 && oldSlot == -expectedSlot) @@ -117,7 +154,7 @@ std::vector *NbtSlotFile::readAll(int slot) // if (oldSlot != expectedSlot) throw new IOException("Wrong slot! Got " + oldSlot + ", expected " + expectedSlot); // 4J - TODO - ReadFile(raf,READ_BUFFER.data + pos,size,&numberOfBytesRead,NULL); + ReadExact(raf, READ_BUFFER.data + pos, size); if (continuesAt >= 0) { @@ -161,7 +198,6 @@ int NbtSlotFile::getFreeSlot() } void NbtSlotFile::replaceSlot(int slot, std::vector *tags) { - DWORD numberOfBytesWritten; toReplace = fileSlotMap[slot]; fileSlotMap[slot] = new std::vector(); @@ -210,13 +246,13 @@ void NbtSlotFile::replaceSlot(int slot, std::vector *tags) } seekSlotHeader(fileSlot); - WriteFile(raf,¤tSlot,2,&numberOfBytesWritten,NULL); - WriteFile(raf,&toWrite,2,&numberOfBytesWritten,NULL); - WriteFile(raf,&nextFileSlot,4,&numberOfBytesWritten,NULL); - WriteFile(raf,&lastFileSlot,4,&numberOfBytesWritten,NULL); + WriteExact(raf, ¤tSlot, sizeof(currentSlot)); + WriteExact(raf, &toWrite, sizeof(toWrite)); + WriteExact(raf, &nextFileSlot, sizeof(nextFileSlot)); + WriteExact(raf, &lastFileSlot, sizeof(lastFileSlot)); seekSlot(fileSlot); - WriteFile(raf,compressed.data+pos,toWrite,&numberOfBytesWritten,NULL); + WriteExact(raf, compressed.data + pos, toWrite); if (remaining > 0) { @@ -237,7 +273,7 @@ void NbtSlotFile::replaceSlot(int slot, std::vector *tags) seekSlotHeader(c); short zero = 0; - WriteFile(raf,&zero,2,&numberOfBytesWritten,NULL); + WriteExact(raf, &zero, sizeof(zero)); } toReplace->clear(); @@ -246,5 +282,9 @@ void NbtSlotFile::replaceSlot(int slot, std::vector *tags) void NbtSlotFile::close() { - CloseHandle(raf); + if (raf != NULL) + { + std::fclose(raf); + raf = NULL; + } } diff --git a/Minecraft.World/IO/NBT/NbtSlotFile.h b/Minecraft.World/IO/NBT/NbtSlotFile.h index 4c1f40b8e..0a613cab2 100644 --- a/Minecraft.World/IO/NBT/NbtSlotFile.h +++ b/Minecraft.World/IO/NBT/NbtSlotFile.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "CompoundTag.h" #include "../../Level/Storage/ZonedChunkStorage.h" #include "../../Headers/com.mojang.nbt.h" @@ -14,7 +16,7 @@ private: static const int FILE_SLOT_HEADER_SIZE = 12; static const int FILE_SLOT_SIZE = 500; - HANDLE raf; + std::FILE *raf; std::vector **fileSlotMap; int fileSlotMapLength; std::vector freeFileSlots; diff --git a/Minecraft.World/Level/Storage/ZoneFile.cpp b/Minecraft.World/Level/Storage/ZoneFile.cpp index f90290683..fc60cc54c 100644 --- a/Minecraft.World/Level/Storage/ZoneFile.cpp +++ b/Minecraft.World/Level/Storage/ZoneFile.cpp @@ -3,6 +3,28 @@ #include "../../IO/Files/File.h" #include "ZoneFile.h" +namespace +{ + std::FILE *OpenBinaryFileForReadWrite(const File &file) + { +#if defined(_WIN32) + std::FILE *stream = _wfopen(file.getPath().c_str(), L"r+b"); + if (stream == NULL) + { + stream = _wfopen(file.getPath().c_str(), L"w+b"); + } +#else + const std::string nativePath = wstringtofilename(file.getPath()); + std::FILE *stream = std::fopen(nativePath.c_str(), "r+b"); + if (stream == NULL) + { + stream = std::fopen(nativePath.c_str(), "w+b"); + } +#endif + return stream; + } +} + const int ZoneFile::slotsLength = ZonedChunkStorage::CHUNKS_PER_ZONE * ZonedChunkStorage::CHUNKS_PER_ZONE; @@ -23,7 +45,7 @@ ZoneFile::ZoneFile(__int64 key, File file, File entityFile) : slots(slotsLength) // this.entityFile = new NbtSlotFile(entityFile); // } - channel = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + channel = OpenBinaryFileForReadWrite(file); // 4J - try/catch removed // try { readHeader(); @@ -71,7 +93,11 @@ void ZoneFile::writeHeader() void ZoneFile::close() { - CloseHandle(channel); + if (channel != NULL) + { + std::fclose(channel); + channel = NULL; + } entityFile->close(); } @@ -89,4 +115,4 @@ ZoneIo *ZoneFile::getZoneIo(int slot) bool ZoneFile::containsSlot(int slot) { return slots[slot] > 0; -} \ No newline at end of file +} diff --git a/Minecraft.World/Level/Storage/ZoneFile.h b/Minecraft.World/Level/Storage/ZoneFile.h index bc055f25f..75e402918 100644 --- a/Minecraft.World/Level/Storage/ZoneFile.h +++ b/Minecraft.World/Level/Storage/ZoneFile.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "ZonedChunkStorage.h" #include "../../IO/NBT/NbtSlotFile.h" #include "ZoneIO.h" @@ -20,7 +22,7 @@ public: __int64 lastUse; private: - HANDLE channel; + std::FILE *channel; public: __int64 key; diff --git a/Minecraft.World/Level/Storage/ZoneIO.cpp b/Minecraft.World/Level/Storage/ZoneIO.cpp index 8899fa76c..9789fae2b 100644 --- a/Minecraft.World/Level/Storage/ZoneIO.cpp +++ b/Minecraft.World/Level/Storage/ZoneIO.cpp @@ -2,7 +2,19 @@ #include "../../IO/Streams/ByteBuffer.h" #include "ZoneIO.h" -ZoneIo::ZoneIo(HANDLE channel, __int64 pos) +namespace +{ + bool SeekFile(std::FILE *file, __int64 offset) + { +#if defined(_WIN32) + return _fseeki64(file, offset, SEEK_SET) == 0; +#else + return fseeko(file, static_cast(offset), SEEK_SET) == 0; +#endif + } +} + +ZoneIo::ZoneIo(std::FILE *channel, __int64 pos) { this->channel = channel; this->pos = pos; @@ -21,23 +33,21 @@ void ZoneIo::write(byteArray bb, int size) void ZoneIo::write(ByteBuffer *bb, int size) { - DWORD numberOfBytesWritten; - SetFilePointer(channel,(int)pos,NULL,NULL); - WriteFile(channel,bb->getBuffer(), bb->getSize(),&numberOfBytesWritten,NULL); + SeekFile(channel, pos); + std::fwrite(bb->getBuffer(), 1, bb->getSize(), channel); pos += size; } ByteBuffer *ZoneIo::read(int size) { - DWORD numberOfBytesRead; byteArray bb = byteArray(size); - SetFilePointer(channel,(int)pos,NULL,NULL); + SeekFile(channel, pos); ByteBuffer *buff = ByteBuffer::wrap(bb); // 4J - to investigate - why is this buffer flipped before anything goes in it? buff->order(ZonedChunkStorage::BYTEORDER); buff->position(size); buff->flip(); - ReadFile(channel, buff->getBuffer(), buff->getSize(), &numberOfBytesRead, NULL); + std::fread(buff->getBuffer(), 1, buff->getSize(), channel); pos += size; return buff; } @@ -45,4 +55,4 @@ ByteBuffer *ZoneIo::read(int size) void ZoneIo::flush() { // 4J - was channel.force(false); -} \ No newline at end of file +} diff --git a/Minecraft.World/Level/Storage/ZoneIO.h b/Minecraft.World/Level/Storage/ZoneIO.h index 22473583a..6bf1dbd04 100644 --- a/Minecraft.World/Level/Storage/ZoneIO.h +++ b/Minecraft.World/Level/Storage/ZoneIO.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "ZonedChunkStorage.h" class ByteBuffer; @@ -6,11 +8,11 @@ class ByteBuffer; class ZoneIo { private: - HANDLE channel; + std::FILE *channel; __int64 pos; public: - ZoneIo(HANDLE channel, __int64 pos); + ZoneIo(std::FILE *channel, __int64 pos); void write(byteArray bb, int size); void write(ByteBuffer *bb, int size); ByteBuffer *read(int size); From 1687568ff78aad9eb27a7ceaf71c9b7e45424eae Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:59:09 +1100 Subject: [PATCH 006/192] Remove DWORD from FileHeader interface --- Minecraft.World/IO/Files/FileHeader.cpp | 2 +- Minecraft.World/IO/Files/FileHeader.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.World/IO/Files/FileHeader.cpp b/Minecraft.World/IO/Files/FileHeader.cpp index fd9e16e26..547e0aaa6 100644 --- a/Minecraft.World/IO/Files/FileHeader.cpp +++ b/Minecraft.World/IO/Files/FileHeader.cpp @@ -325,7 +325,7 @@ unsigned int FileHeader::GetFileSize() return GetStartOfNextData() + ( sizeof(FileEntrySaveData) * (unsigned int)fileTable.size() ); } -void FileHeader::AdjustStartOffsets(FileEntry *file, DWORD nNumberOfBytesToWrite, bool subtract /*= false*/) +void FileHeader::AdjustStartOffsets(FileEntry *file, unsigned int nNumberOfBytesToWrite, bool subtract /*= false*/) { bool found = false; for( unsigned int i = 0; i < fileTable.size(); ++i ) diff --git a/Minecraft.World/IO/Files/FileHeader.h b/Minecraft.World/IO/Files/FileHeader.h index 5367a2924..155efaa1c 100644 --- a/Minecraft.World/IO/Files/FileHeader.h +++ b/Minecraft.World/IO/Files/FileHeader.h @@ -173,7 +173,7 @@ protected: unsigned int GetFileSize(); - void AdjustStartOffsets(FileEntry *file, DWORD nNumberOfBytesToWrite, bool subtract = false); + void AdjustStartOffsets(FileEntry *file, unsigned int nNumberOfBytesToWrite, bool subtract = false); bool fileExists( const std::wstring &name ); From e38e7c1fc03fa4bb2b1e705bb5ee319a99a59262 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:02:43 +1100 Subject: [PATCH 007/192] Remove Win32 types from StringTable --- Minecraft.Client/Utils/StringTable.cpp | 18 +++++++++--------- Minecraft.Client/Utils/StringTable.h | 10 ++++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Minecraft.Client/Utils/StringTable.cpp b/Minecraft.Client/Utils/StringTable.cpp index ac324a2d4..c86166750 100644 --- a/Minecraft.Client/Utils/StringTable.cpp +++ b/Minecraft.Client/Utils/StringTable.cpp @@ -7,9 +7,9 @@ StringTable::StringTable(void) } // Load string table from a binary blob, filling out with the current localisation data only -StringTable::StringTable(PBYTE pbData, DWORD dwSize) +StringTable::StringTable(uint8_t *pbData, unsigned int dataSize) { - src = byteArray(pbData, dwSize); + src = byteArray(pbData, dataSize); ByteArrayInputStream bais(src); DataInputStream dis(&bais); @@ -31,7 +31,7 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) bool foundLang = false; __int64 bytesToSkip = 0; - int dataSize = 0; + int selectedDataSize = 0; // for( AUTO_VAR(it_locales, locales.begin()); @@ -46,7 +46,7 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) if(it->first.compare(*it_locales) == 0) { app.DebugPrintf("StringTable:: Found language '%ls'.\n", it_locales->c_str()); - dataSize = it->second; + selectedDataSize = it->second; foundLang = true; break; } @@ -62,7 +62,7 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) { dis.skip(bytesToSkip); - byteArray langData(dataSize); + byteArray langData(selectedDataSize); dis.read(langData); dis.close(); @@ -119,13 +119,13 @@ StringTable::~StringTable(void) // delete src.data; TODO 4J-JEV: ? } -void StringTable::getData(PBYTE *ppData, UINT *pSize) +void StringTable::getData(uint8_t **ppData, unsigned int *pSize) { *ppData = src.data; *pSize = src.length; } -LPCWSTR StringTable::getString(const std::wstring &id) +const wchar_t *StringTable::getString(const std::wstring &id) { #ifndef _CONTENT_PACKAGE if (isStatic) @@ -147,7 +147,7 @@ LPCWSTR StringTable::getString(const std::wstring &id) } } -LPCWSTR StringTable::getString(int id) +const wchar_t *StringTable::getString(int id) { #ifndef _CONTENT_PACKAGE if (!isStatic) @@ -159,7 +159,7 @@ LPCWSTR StringTable::getString(int id) if (id < m_stringsVec.size()) { - LPCWSTR pwchString=m_stringsVec.at(id).c_str(); + const wchar_t *pwchString = m_stringsVec.at(id).c_str(); return pwchString; } else diff --git a/Minecraft.Client/Utils/StringTable.h b/Minecraft.Client/Utils/StringTable.h index 4e55afe76..8a66ffdac 100644 --- a/Minecraft.Client/Utils/StringTable.h +++ b/Minecraft.Client/Utils/StringTable.h @@ -1,5 +1,7 @@ #pragma once +#include + #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ @@ -59,13 +61,13 @@ public: // }; StringTable(void); - StringTable(PBYTE pbData, DWORD dwSize); + StringTable(uint8_t *pbData, unsigned int dataSize); ~StringTable(void); - void getData(PBYTE *ppbData, UINT *pdwSize); + void getData(uint8_t **ppData, unsigned int *pSize); - LPCWSTR getString(const std::wstring &id); - LPCWSTR getString(int id); + const wchar_t *getString(const std::wstring &id); + const wchar_t *getString(int id); //static LPCWSTR m_wchLocaleCode[LOCALE_COUNT]; From 3880df481ab32e3f6baf0006aa7dafdf0d892ac3 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:05:16 +1100 Subject: [PATCH 008/192] Remove DWORD from utility TLS headers --- Minecraft.World/Util/AABB.cpp | 2 +- Minecraft.World/Util/AABB.h | 2 +- Minecraft.World/Util/IntCache.cpp | 4 ++-- Minecraft.World/Util/IntCache.h | 4 ++-- Minecraft.World/Util/Vec3.cpp | 4 ++-- Minecraft.World/Util/Vec3.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.World/Util/AABB.cpp b/Minecraft.World/Util/AABB.cpp index b768f76f6..2999a43fd 100644 --- a/Minecraft.World/Util/AABB.cpp +++ b/Minecraft.World/Util/AABB.cpp @@ -7,7 +7,7 @@ #include "AABB.h" #include "HitResult.h" -DWORD AABB::tlsIdx = 0; +unsigned int AABB::tlsIdx = 0; AABB::ThreadStorage *AABB::tlsDefault = NULL; AABB::ThreadStorage::ThreadStorage() diff --git a/Minecraft.World/Util/AABB.h b/Minecraft.World/Util/AABB.h index 5341e6eba..28f55d1f8 100644 --- a/Minecraft.World/Util/AABB.h +++ b/Minecraft.World/Util/AABB.h @@ -18,7 +18,7 @@ class AABB ThreadStorage(); ~ThreadStorage(); }; - static DWORD tlsIdx; + static unsigned int tlsIdx; static ThreadStorage *tlsDefault; public: // Each new thread that needs to use Vec3 pools will need to call one of the following 2 functions, to either create its own diff --git a/Minecraft.World/Util/IntCache.cpp b/Minecraft.World/Util/IntCache.cpp index 39755e63f..241c541f9 100644 --- a/Minecraft.World/Util/IntCache.cpp +++ b/Minecraft.World/Util/IntCache.cpp @@ -1,7 +1,7 @@ #include "../Platform/stdafx.h" #include "IntCache.h" -DWORD IntCache::tlsIdx = TlsAlloc(); +unsigned int IntCache::tlsIdx = TlsAlloc(); void IntCache::CreateNewThreadStorage() { @@ -161,4 +161,4 @@ void IntCache::Reset() delete [] tls->toosmall[i].data; } tls->toosmall.clear(); -} \ No newline at end of file +} diff --git a/Minecraft.World/Util/IntCache.h b/Minecraft.World/Util/IntCache.h index 6097d6844..c83b1eba8 100644 --- a/Minecraft.World/Util/IntCache.h +++ b/Minecraft.World/Util/IntCache.h @@ -20,7 +20,7 @@ private: std::vector toosmall; // 4J added ~ThreadStorage(); }; - static DWORD tlsIdx; + static unsigned int tlsIdx; static const int TINY_CUTOFF = 256; @@ -31,4 +31,4 @@ public: static void CreateNewThreadStorage(); static void ReleaseThreadStorage(); static void Reset(); // 4J added -}; \ No newline at end of file +}; diff --git a/Minecraft.World/Util/Vec3.cpp b/Minecraft.World/Util/Vec3.cpp index 8c4671960..24132d839 100644 --- a/Minecraft.World/Util/Vec3.cpp +++ b/Minecraft.World/Util/Vec3.cpp @@ -2,7 +2,7 @@ #include "Vec3.h" #include "AABB.h" -DWORD Vec3::tlsIdx = 0; +unsigned int Vec3::tlsIdx = 0; Vec3::ThreadStorage *Vec3::tlsDefault = NULL; Vec3::ThreadStorage::ThreadStorage() @@ -262,4 +262,4 @@ double Vec3::distanceTo(AABB *box) else if( z > box->z1) zd = z - box->z1; return sqrt(xd * xd + yd * yd + zd * zd); -} \ No newline at end of file +} diff --git a/Minecraft.World/Util/Vec3.h b/Minecraft.World/Util/Vec3.h index 0d1fd247d..826bf9a0a 100644 --- a/Minecraft.World/Util/Vec3.h +++ b/Minecraft.World/Util/Vec3.h @@ -15,7 +15,7 @@ class Vec3 ThreadStorage(); ~ThreadStorage(); }; - static DWORD tlsIdx; + static unsigned int tlsIdx; static ThreadStorage *tlsDefault; public: // Each new thread that needs to use Vec3 pools will need to call one of the following 2 functions, to either create its own @@ -56,4 +56,4 @@ public: // 4J Added double distanceTo(AABB *box); -}; \ No newline at end of file +}; From 88ffcab9a17ae9e9b6db451b34922a275f3e9935 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:06:01 +1100 Subject: [PATCH 009/192] Remove Win32 types from WstringLookup --- Minecraft.Client/Utils/WstringLookup.cpp | 17 +++++++++-------- Minecraft.Client/Utils/WstringLookup.h | 12 ++++++------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Minecraft.Client/Utils/WstringLookup.cpp b/Minecraft.Client/Utils/WstringLookup.cpp index dfd3de37c..7f8fdaa70 100644 --- a/Minecraft.Client/Utils/WstringLookup.cpp +++ b/Minecraft.Client/Utils/WstringLookup.cpp @@ -8,7 +8,7 @@ WstringLookup::WstringLookup() numIDs = 0; } -std::wstring WstringLookup::lookup(UINT id) +std::wstring WstringLookup::lookup(unsigned int id) { // TODO //if (id > currentMaxID) @@ -17,12 +17,12 @@ std::wstring WstringLookup::lookup(UINT id) return int2str.at(id); } -UINT WstringLookup::lookup(std::wstring str) +unsigned int WstringLookup::lookup(std::wstring str) { if (str2int.find(str) == str2int.end()) { - std::pair p = - std::pair(str, numIDs); + std::pair p = + std::pair(str, numIDs); str2int.insert( p ); int2str.push_back( str ); @@ -35,14 +35,15 @@ UINT WstringLookup::lookup(std::wstring str) } } -VOID WstringLookup::getTable(std::wstring **lookup, UINT *len) +void WstringLookup::getTable(std::wstring **lookup, unsigned int *len) { // Outputs - std::wstring *out_lookup; UINT out_len; + std::wstring *out_lookup; + unsigned int out_len; // Fill lookup. out_lookup = new std::wstring[int2str.size()]; - for (UINT i = 0; i < numIDs; i++) + for (unsigned int i = 0; i < numIDs; i++) out_lookup[i] = int2str.at(i); out_len = numIDs; @@ -51,4 +52,4 @@ VOID WstringLookup::getTable(std::wstring **lookup, UINT *len) *lookup = out_lookup; *len = out_len; return; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Utils/WstringLookup.h b/Minecraft.Client/Utils/WstringLookup.h index a5247bc3f..8c531845b 100644 --- a/Minecraft.Client/Utils/WstringLookup.h +++ b/Minecraft.Client/Utils/WstringLookup.h @@ -5,16 +5,16 @@ class WstringLookup { private: - UINT numIDs; - std::unordered_map str2int; + unsigned int numIDs; + std::unordered_map str2int; std::vector int2str; public: WstringLookup(); - std::wstring lookup(UINT id); + std::wstring lookup(unsigned int id); - UINT lookup(std::wstring); + unsigned int lookup(std::wstring); - VOID getTable(std::wstring **lookup, UINT *len); -}; \ No newline at end of file + void getTable(std::wstring **lookup, unsigned int *len); +}; From e4cc79387ab990c92875395ebc53bff2243cace0 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:07:15 +1100 Subject: [PATCH 010/192] Remove Win32 byte types from ArchiveFile --- Minecraft.Client/Utils/ArchiveFile.cpp | 4 ++-- Minecraft.Client/Utils/ArchiveFile.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Utils/ArchiveFile.cpp b/Minecraft.Client/Utils/ArchiveFile.cpp index 8c2754fc4..eddd8a7fa 100644 --- a/Minecraft.Client/Utils/ArchiveFile.cpp +++ b/Minecraft.Client/Utils/ArchiveFile.cpp @@ -122,7 +122,7 @@ byteArray ArchiveFile::getFile(const std::wstring &filename) memcpy( out.data, m_cachedData + data->ptr, data->filesize ); #else const unsigned int fileSize = static_cast(data->filesize); - PBYTE pbData = new BYTE[fileSize == 0 ? 1 : fileSize]; + uint8_t *pbData = new uint8_t[fileSize == 0 ? 1 : fileSize]; out = byteArray(pbData, fileSize); const PortableFileIO::BinaryReadResult readResult = PortableFileIO::ReadBinaryFileSegment( m_sourcefile.getPath(), @@ -151,7 +151,7 @@ byteArray ArchiveFile::getFile(const std::wstring &filename) unsigned int decompressedSize = dis.readInt(); dis.close(); - PBYTE uncompressedBuffer = new BYTE[decompressedSize]; + uint8_t *uncompressedBuffer = new uint8_t[decompressedSize]; Compression::getCompression()->Decompress(uncompressedBuffer, &decompressedSize, out.data+4, out.length-4); delete [] out.data; diff --git a/Minecraft.Client/Utils/ArchiveFile.h b/Minecraft.Client/Utils/ArchiveFile.h index 83ca6b160..ac2fe84d9 100644 --- a/Minecraft.Client/Utils/ArchiveFile.h +++ b/Minecraft.Client/Utils/ArchiveFile.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -12,7 +13,7 @@ class ArchiveFile { protected: File m_sourcefile; - BYTE *m_cachedData; + uint8_t *m_cachedData; typedef struct _MetaData { From b02bcd27f5ab3997e3153d50f7988d2627d786de Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:15:56 +1100 Subject: [PATCH 011/192] Remove Win32 byte pointers from texture pack icons --- Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp | 6 +++--- Minecraft.Client/Textures/Packs/AbstractTexturePack.h | 8 ++++---- Minecraft.Client/Textures/Packs/TexturePack.h | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 56739429d..26f2b8012 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -373,14 +373,14 @@ std::wstring AbstractTexturePack::getXuiRootPath() return szResourceLocator; } -PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes) +uint8_t *AbstractTexturePack::getPackIcon(DWORD &dwImageBytes) { if(m_iconSize == 0 || m_iconData == NULL) loadIcon(); dwImageBytes = m_iconSize; return m_iconData; } -PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes) +uint8_t *AbstractTexturePack::getPackComparison(DWORD &dwImageBytes) { if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison(); @@ -396,4 +396,4 @@ unsigned int AbstractTexturePack::getDLCParentPackId() unsigned char AbstractTexturePack::getDLCSubPackId() { return 0; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h index c861a88c0..dec6d1362 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h @@ -19,10 +19,10 @@ protected: std::wstring desc1; std::wstring desc2; - PBYTE m_iconData; + uint8_t *m_iconData; DWORD m_iconSize; - PBYTE m_comparisonData; + uint8_t *m_comparisonData; DWORD m_comparisonSize; TexturePack *fallback; @@ -84,8 +84,8 @@ public: virtual void loadUI(); virtual void unloadUI(); virtual std::wstring getXuiRootPath(); - virtual PBYTE getPackIcon(DWORD &dwImageBytes); - virtual PBYTE getPackComparison(DWORD &dwImageBytes); + virtual uint8_t *getPackIcon(DWORD &dwImageBytes); + virtual uint8_t *getPackComparison(DWORD &dwImageBytes); virtual unsigned int getDLCParentPackId(); virtual unsigned char getDLCSubPackId(); virtual ColourTable *getColourTable() { return m_colourTable; } diff --git a/Minecraft.Client/Textures/Packs/TexturePack.h b/Minecraft.Client/Textures/Packs/TexturePack.h index edbabc796..2bd1b0364 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.h +++ b/Minecraft.Client/Textures/Packs/TexturePack.h @@ -1,5 +1,6 @@ #pragma once +#include #include "../../Platform/Common/App_enums.h" @@ -46,8 +47,8 @@ public: virtual void loadUI() = 0; virtual void unloadUI() = 0; virtual std::wstring getXuiRootPath() = 0; - virtual PBYTE getPackIcon(DWORD &dwImageBytes) = 0; - virtual PBYTE getPackComparison(DWORD &dwImageBytes) = 0; + virtual uint8_t *getPackIcon(DWORD &dwImageBytes) = 0; + virtual uint8_t *getPackComparison(DWORD &dwImageBytes) = 0; virtual unsigned int getDLCParentPackId() = 0; virtual unsigned char getDLCSubPackId() = 0; virtual ColourTable *getColourTable() = 0; From 66538b67f286d45e8a4ee0b64b00e845e7d29321 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:17:57 +1100 Subject: [PATCH 012/192] Remove Win32 byte pointers from DLC file interfaces --- Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp | 10 +++++----- Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h | 8 ++++---- Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp | 4 ++-- Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h | 4 ++-- .../Platform/Common/DLC/DLCColourTableFile.cpp | 4 ++-- .../Platform/Common/DLC/DLCColourTableFile.h | 4 ++-- Minecraft.Client/Platform/Common/DLC/DLCFile.h | 7 ++++--- .../Platform/Common/DLC/DLCGameRulesFile.cpp | 6 +++--- .../Platform/Common/DLC/DLCGameRulesFile.h | 8 ++++---- .../Platform/Common/DLC/DLCGameRulesHeader.cpp | 8 ++++---- .../Platform/Common/DLC/DLCGameRulesHeader.h | 10 +++++----- .../Platform/Common/DLC/DLCLocalisationFile.cpp | 4 ++-- .../Platform/Common/DLC/DLCLocalisationFile.h | 6 +++--- Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp | 2 +- Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h | 2 +- .../Platform/Common/DLC/DLCTextureFile.cpp | 6 +++--- Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h | 8 ++++---- Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp | 6 +++--- Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h | 6 +++--- 19 files changed, 57 insertions(+), 56 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp index 0caf3f5de..92a5003c4 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp @@ -12,7 +12,7 @@ DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLC m_dwBytes = 0; } -void DLCAudioFile::addData(PBYTE pbData, DWORD dwBytes) +void DLCAudioFile::addData(uint8_t *pbData, DWORD dwBytes) { m_pbData = pbData; m_dwBytes = dwBytes; @@ -20,7 +20,7 @@ void DLCAudioFile::addData(PBYTE pbData, DWORD dwBytes) processDLCDataFile(pbData,dwBytes); } -PBYTE DLCAudioFile::getData(DWORD &dwBytes) +uint8_t *DLCAudioFile::getData(DWORD &dwBytes) { dwBytes = m_dwBytes; return m_pbData; @@ -120,7 +120,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons } } -bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) +bool DLCAudioFile::processDLCDataFile(uint8_t *pbData, DWORD dwLength) { std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; @@ -164,7 +164,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) dwTemp+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } - PBYTE pbTemp=((PBYTE )pFile); + uint8_t *pbTemp = reinterpret_cast(pFile); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; for(unsigned int i=0;i m_parameters; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp index 6ef5c97f4..35f58ad1f 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp @@ -6,7 +6,7 @@ DLCCapeFile::DLCCapeFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy { } -void DLCCapeFile::addData(PBYTE pbData, DWORD dwBytes) +void DLCCapeFile::addData(uint8_t *pbData, DWORD dwBytes) { app.AddMemoryTextureFile(m_path,pbData,dwBytes); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h index 6626387a8..dde0617ab 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h @@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile public: DLCCapeFile(const std::wstring &path); - virtual void addData(PBYTE pbData, DWORD dwBytes); -}; \ No newline at end of file + virtual void addData(uint8_t *pbData, DWORD dwBytes); +}; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp index beab8161e..239a3fb99 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp @@ -19,8 +19,8 @@ DLCColourTableFile::~DLCColourTableFile() } } -void DLCColourTableFile::addData(PBYTE pbData, DWORD dwBytes) +void DLCColourTableFile::addData(uint8_t *pbData, DWORD dwBytes) { ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable(); m_colourTable = new ColourTable(defaultColourTable, pbData, dwBytes); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h index cb7a8cf5a..97d5723ea 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h @@ -12,7 +12,7 @@ public: DLCColourTableFile(const std::wstring &path); ~DLCColourTableFile(); - virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual void addData(uint8_t *pbData, DWORD dwBytes); ColourTable *getColourTable() { return m_colourTable; } -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCFile.h b/Minecraft.Client/Platform/Common/DLC/DLCFile.h index 0f652f849..0a91a650e 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCFile.h @@ -1,4 +1,5 @@ #pragma once +#include #include "DLCManager.h" class DLCFile @@ -16,10 +17,10 @@ public: std::wstring getPath() { return m_path; } DWORD getSkinID() { return m_dwSkinId; } - virtual void addData(PBYTE pbData, DWORD dwBytes) {} - virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } + virtual void addData(uint8_t *pbData, DWORD dwBytes) {} + virtual uint8_t *getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {} virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;} -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp index b383bd70d..b7550abe2 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp @@ -8,14 +8,14 @@ DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCM m_dwBytes = 0; } -void DLCGameRulesFile::addData(PBYTE pbData, DWORD dwBytes) +void DLCGameRulesFile::addData(uint8_t *pbData, DWORD dwBytes) { m_pbData = pbData; m_dwBytes = dwBytes; } -PBYTE DLCGameRulesFile::getData(DWORD &dwBytes) +uint8_t *DLCGameRulesFile::getData(DWORD &dwBytes) { dwBytes = m_dwBytes; return m_pbData; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h index 9924ca849..aebb0ebd3 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h @@ -4,12 +4,12 @@ class DLCGameRulesFile : public DLCGameRules { private: - PBYTE m_pbData; + uint8_t *m_pbData; DWORD m_dwBytes; public: DLCGameRulesFile(const std::wstring &path); - virtual void addData(PBYTE pbData, DWORD dwBytes); - virtual PBYTE getData(DWORD &dwBytes); -}; \ No newline at end of file + virtual void addData(uint8_t *pbData, DWORD dwBytes); + virtual uint8_t *getData(DWORD &dwBytes); +}; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp index 5b2d705f0..f0c9f2a67 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp @@ -21,7 +21,7 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules( lgo = NULL; } -void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) +void DLCGameRulesHeader::addData(uint8_t *pbData, DWORD dwBytes) { m_pbData = pbData; m_dwBytes = dwBytes; @@ -73,13 +73,13 @@ void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) #endif } -PBYTE DLCGameRulesHeader::getData(DWORD &dwBytes) +uint8_t *DLCGameRulesHeader::getData(DWORD &dwBytes) { dwBytes = m_dwBytes; return m_pbData; } -void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st) +void DLCGameRulesHeader::setGrfData(uint8_t *fData, DWORD fSize, StringTable *st) { if (!m_hasData) { @@ -89,4 +89,4 @@ void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st) app.m_gameRules.readRuleFile(lgo, fData, fSize, st); } -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h index fddc7318c..b8c0bdb9e 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h @@ -8,7 +8,7 @@ class DLCGameRulesHeader : public DLCGameRules, public JustGrSource private: // GR-Header - PBYTE m_pbData; + uint8_t *m_pbData; DWORD m_dwBytes; bool m_hasData; @@ -33,10 +33,10 @@ public: public: DLCGameRulesHeader(const std::wstring &path); - virtual void addData(PBYTE pbData, DWORD dwBytes); - virtual PBYTE getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, DWORD dwBytes); + virtual uint8_t *getData(DWORD &dwBytes); - void setGrfData(PBYTE fData, DWORD fSize, StringTable *); + void setGrfData(uint8_t *fData, DWORD fSize, StringTable *); virtual bool ready() { return m_hasData; } -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp index 67e6639a6..870e07117 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp @@ -8,7 +8,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLC m_strings = NULL; } -void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes) +void DLCLocalisationFile::addData(uint8_t *pbData, DWORD dwBytes) { m_strings = new StringTable(pbData, dwBytes); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h index db4211667..d4194687a 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h @@ -10,9 +10,9 @@ private: public: DLCLocalisationFile(const std::wstring &path); - DLCLocalisationFile(PBYTE pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++ + DLCLocalisationFile(uint8_t *pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++ - virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual void addData(uint8_t *pbData, DWORD dwBytes); StringTable *getStringTable() { return m_strings; } -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp index 2a4df2cc6..87fb2adfa 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp @@ -16,7 +16,7 @@ DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy m_uiAnimOverrideBitmask=0L; } -void DLCSkinFile::addData(PBYTE pbData, DWORD dwBytes) +void DLCSkinFile::addData(uint8_t *pbData, DWORD dwBytes) { app.AddMemoryTextureFile(m_path,pbData,dwBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h index 08ceb6920..36fd7e242 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h @@ -17,7 +17,7 @@ public: DLCSkinFile(const std::wstring &path); - virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual void addData(uint8_t *pbData, DWORD dwBytes); virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); diff --git a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp index 10085c834..81d32b806 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp @@ -11,14 +11,14 @@ DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e m_dwBytes = 0; } -void DLCTextureFile::addData(PBYTE pbData, DWORD dwBytes) +void DLCTextureFile::addData(uint8_t *pbData, DWORD dwBytes) { //app.AddMemoryTextureFile(m_path,pbData,dwBytes); m_pbData = pbData; m_dwBytes = dwBytes; } -PBYTE DLCTextureFile::getData(DWORD &dwBytes) +uint8_t *DLCTextureFile::getData(DWORD &dwBytes) { dwBytes = m_dwBytes; return m_pbData; @@ -56,4 +56,4 @@ bool DLCTextureFile::getParameterAsBool(DLCManager::EDLCParameterType type) default: return false; } -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h index 831740601..7e5bff9fc 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h @@ -8,17 +8,17 @@ private: bool m_bIsAnim; std::wstring m_animString; - PBYTE m_pbData; + uint8_t *m_pbData; DWORD m_dwBytes; public: DLCTextureFile(const std::wstring &path); - virtual void addData(PBYTE pbData, DWORD dwBytes); - virtual PBYTE getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, DWORD dwBytes); + virtual uint8_t *getData(DWORD &dwBytes); virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp index 9ba227607..aa6f0dbe1 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp @@ -18,15 +18,15 @@ DLCUIDataFile::~DLCUIDataFile() } } -void DLCUIDataFile::addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData) +void DLCUIDataFile::addData(uint8_t *pbData, DWORD dwBytes,bool canDeleteData) { m_pbData = pbData; m_dwBytes = dwBytes; m_canDeleteData = canDeleteData; } -PBYTE DLCUIDataFile::getData(DWORD &dwBytes) +uint8_t *DLCUIDataFile::getData(DWORD &dwBytes) { dwBytes = m_dwBytes; return m_pbData; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h index a9ffa6c1f..fa0d2fc6b 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h @@ -4,7 +4,7 @@ class DLCUIDataFile : public DLCFile { private: - PBYTE m_pbData; + uint8_t *m_pbData; DWORD m_dwBytes; bool m_canDeleteData; @@ -15,6 +15,6 @@ public: using DLCFile::addData; using DLCFile::addParameter; - virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false); - virtual PBYTE getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, DWORD dwBytes,bool canDeleteData = false); + virtual uint8_t *getData(DWORD &dwBytes); }; From 61808e925a8863bcad4ba625c2c89964b719b474 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:19:34 +1100 Subject: [PATCH 013/192] Remove Win32 byte pointers from DLC pack blobs --- .../Platform/Common/DLC/DLCManager.cpp | 14 +++++++------- Minecraft.Client/Platform/Common/DLC/DLCManager.h | 5 +++-- Minecraft.Client/Platform/Common/DLC/DLCPack.h | 5 +++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index f4f74fb4c..3f9311ce5 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -363,7 +363,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat } DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); - PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; + uint8_t *pbData = new uint8_t[dwFileSize]; BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { @@ -385,7 +385,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack); } -bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack) +bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, uint8_t *pbData, DWORD dwLength, DLCPack *pack) { std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; @@ -439,7 +439,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwTemp+=DLC_DETAIL_ADV(pFile->dwWchCount); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } - PBYTE pbTemp=((PBYTE )pFile);//+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount; + uint8_t *pbTemp = reinterpret_cast(pFile);//+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount; pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; for(unsigned int i=0;idwWchCount); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } - PBYTE pbTemp=((PBYTE )pFile); + uint8_t *pbTemp = reinterpret_cast(pFile); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; for(unsigned int i=0;i #include class DLCPack; class DLCSkinFile; @@ -93,7 +94,7 @@ public: DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); private: - bool processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack); + bool processDLCDataFile(DWORD &dwFilesProcessed, uint8_t *pbData, DWORD dwLength, DLCPack *pack); - DWORD retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack); + DWORD retrievePackID(uint8_t *pbData, DWORD dwLength, DLCPack *pack); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.h b/Minecraft.Client/Platform/Common/DLC/DLCPack.h index 7a0ba2bac..9dcb8d982 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.h @@ -1,5 +1,6 @@ #pragma once //using namespace std; +#include #include "DLCManager.h" class DLCFile; @@ -28,7 +29,7 @@ private: DWORD m_packId; DWORD m_packVersion; - PBYTE m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. + uint8_t *m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. public: DLCPack(const std::wstring &name,DWORD dwLicenseMask); @@ -39,7 +40,7 @@ public: std::wstring getFullDataPath() { return m_dataPath; } - void SetDataPointer(PBYTE pbData) { m_data = pbData; } + void SetDataPointer(uint8_t *pbData) { m_data = pbData; } bool IsCorrupt() { return m_isCorrupt; } void SetIsCorrupt(bool val) { m_isCorrupt = val; } From 65dc775e847a41f830b5f516514d876648d278dc Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:31:42 +1100 Subject: [PATCH 014/192] Remove Win32 byte aliases from DLC texture loading --- .../Textures/Packs/DLCTexturePack.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index b7df9e445..afae70edf 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -12,6 +12,7 @@ #include "../../Utils/StringTable.h" #include "../../Platform/Common/DLC/DLCAudioFile.h" +#include #include #if defined _XBOX || defined _WINDOWS64 @@ -21,7 +22,7 @@ namespace { - bool ReadPortableBinaryFile(File &file, PBYTE &data, DWORD &size) + bool ReadPortableBinaryFile(File &file, uint8_t *&data, DWORD &size) { const __int64 fileLength = file.length(); if (fileLength < 0 || fileLength > static_cast<__int64>(std::numeric_limits::max())) @@ -32,7 +33,7 @@ namespace } const std::size_t capacity = static_cast(fileLength); - PBYTE buffer = new BYTE[capacity == 0 ? 1 : capacity]; + uint8_t *buffer = new uint8_t[capacity == 0 ? 1 : capacity]; const PortableFileIO::BinaryReadResult readResult = PortableFileIO::ReadBinaryFile(file.getPath(), buffer, capacity); if (readResult.status != PortableFileIO::BinaryReadStatus::ok || readResult.fileSize > std::numeric_limits::max()) @@ -218,7 +219,7 @@ void DLCTexturePack::loadColourTable() DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); DWORD dwSize = 0; - PBYTE pbData = dataFile->getData(dwSize); + uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; @@ -338,7 +339,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if(xzpPath.exists()) { - PBYTE pbData = NULL; + uint8_t *pbData = NULL; DWORD bytesRead = 0; if( ReadPortableBinaryFile(xzpPath, pbData, bytesRead) ) { @@ -369,7 +370,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen File grf( getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dlcFile->getGrfPath() ) ); if (grf.exists()) { - PBYTE pbData = NULL; + uint8_t *pbData = NULL; DWORD dwFileSize = 0; if( ReadPortableBinaryFile(grf, pbData, dwFileSize) ) { @@ -392,7 +393,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen File grf(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), levelGen->getBaseSavePath() )); if (grf.exists()) { - PBYTE pbData = NULL; + uint8_t *pbData = NULL; DWORD dwFileSize = 0; if( ReadPortableBinaryFile(grf, pbData, dwFileSize) ) { @@ -476,7 +477,7 @@ void DLCTexturePack::loadUI() DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); DWORD dwSize = 0; - PBYTE pbData = dataFile->getData(dwSize); + uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; @@ -550,7 +551,7 @@ std::wstring DLCTexturePack::getXuiRootPath() DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); DWORD dwSize = 0; - PBYTE pbData = dataFile->getData(dwSize); + uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; From 7bdf4c8cedcc3a9fd6b325d1e9d17fb1cbfcfd9f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:42:17 +1100 Subject: [PATCH 015/192] Remove Win32 byte counts from texture pack images --- .../Platform/Common/UI/IUIScene_StartGame.cpp | 24 +++++------ .../Common/UI/UIScene_CreateWorldMenu.cpp | 8 ++-- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 18 ++++----- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 34 ++++++++-------- .../Platform/Common/XUI/XUI_LoadSettings.cpp | 40 +++++++++---------- .../Common/XUI/XUI_MultiGameCreate.cpp | 32 +++++++-------- .../Common/XUI/XUI_MultiGameJoinLoad.cpp | 28 +++++++------ .../Textures/Packs/AbstractTexturePack.cpp | 12 +++--- .../Textures/Packs/AbstractTexturePack.h | 8 ++-- .../Textures/Packs/DLCTexturePack.cpp | 8 +++- .../Textures/Packs/DefaultTexturePack.cpp | 2 +- Minecraft.Client/Textures/Packs/TexturePack.h | 4 +- 12 files changed, 113 insertions(+), 105 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp index 175e96362..59eab4f28 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp @@ -29,14 +29,14 @@ void IUIScene_StartGame::HandleDLCMountingComplete() { TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { wchar_t imageName[64]; swprintf(imageName,64,L"tpack%08x",tp->getId()); - registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); + registerSubstitutionTexture(imageName, imageData, imageBytes); m_texturePackList.addPack(i,imageName); } } @@ -180,12 +180,12 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) m_labelTexturePackName.setLabel(tp->getName()); m_labelTexturePackDescription.setLabel(tp->getDesc1()); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - //if(dwImageBytes > 0 && pbImageData) + //if(imageBytes > 0 && imageData) //{ - // registerSubstitutionTexture(L"texturePackIcon", pbImageData, dwImageBytes); + // registerSubstitutionTexture(L"texturePackIcon", imageData, imageBytes); // m_bitmapTexturePackIcon.setTextureName(L"texturePackIcon"); //} @@ -193,12 +193,12 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) swprintf(imageName,64,L"tpack%08x",tp->getId()); m_bitmapTexturePackIcon.setTextureName(imageName); - pbImageData = tp->getPackComparison(dwImageBytes); + imageData = tp->getPackComparison(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { swprintf(imageName,64,L"texturePackComparison%08x",tp->getId()); - registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); + registerSubstitutionTexture(imageName, imageData, imageBytes); m_bitmapComparison.setTextureName(imageName); } else @@ -376,4 +376,4 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora #endif pClass->m_bIgnoreInput=false; return 0; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 32c1f8065..efa2cae05 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -167,14 +167,14 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay { TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { wchar_t imageName[64]; swprintf(imageName,64,L"tpack%08x",tp->getId()); - registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); + registerSubstitutionTexture(imageName, imageData, imageBytes); m_texturePackList.addPack(i,imageName); } } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index 2382f5a5c..9febff710 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -173,14 +173,14 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye // retrieve the save icon from the texture pack, if there is one TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { wchar_t textureName[64]; swprintf(textureName,64,L"loadsave"); - registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); + registerSubstitutionTexture(textureName,imageData,imageBytes); m_bitmapIcon.setTextureName( textureName ); } } @@ -259,14 +259,14 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye { TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { wchar_t imageName[64]; swprintf(imageName,64,L"tpack%08x",tp->getId()); - registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); + registerSubstitutionTexture(imageName, imageData, imageBytes); m_texturePackList.addPack(i,imageName); } } @@ -1801,4 +1801,4 @@ int UIScene_LoadMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM // pClass->m_bIgnoreInput=false; // return 0; // } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 034d55a4e..bbfd4ed0d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -927,14 +927,14 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() // increment the count of the mash-up pack worlds in the save list m_iMashUpButtonsC++; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId()); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { wchar_t imageName[64]; swprintf(imageName,64,L"tpack%08x",tp->getId()); - registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); + registerSubstitutionTexture(imageName, imageData, imageBytes); m_buttonListSaves.setTextureName( m_buttonListSaves.getItemCount() - 1, imageName ); } } @@ -1691,8 +1691,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() TexturePack *tp = pMinecraft->skins->getTexturePackById(sessionInfo->data.texturePackParentId); HRESULT hr; - DWORD dwImageBytes=0; - PBYTE pbImageData=NULL; + std::uint32_t imageBytes = 0; + uint8_t *imageData = NULL; if(tp==NULL) { @@ -1701,20 +1701,22 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? - app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); - if(dwImageBytes > 0 && pbImageData) + DWORD tpdImageBytes = 0; + app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&imageData,&tpdImageBytes ); + imageBytes = static_cast(tpdImageBytes); + if(imageBytes > 0 && imageData) { swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); - registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); + registerSubstitutionTexture(textureName,imageData,imageBytes); } } else { - pbImageData = tp->getPackIcon(dwImageBytes); - if(dwImageBytes > 0 && pbImageData) + imageData = tp->getPackIcon(imageBytes); + if(imageBytes > 0 && imageData) { swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); - registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); + registerSubstitutionTexture(textureName,imageData,imageBytes); } } } @@ -1724,13 +1726,13 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() Minecraft *pMinecraft = Minecraft::GetInstance(); TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(0); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); - registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); + registerSubstitutionTexture(textureName,imageData,imageBytes); } } diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp index 987997a87..4695a769a 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp @@ -130,12 +130,12 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // retrieve the save icon from the texture pack, if there is one TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { - XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&m_hXuiBrush); + XuiCreateTextureBrushFromMemory(imageData,imageBytes,&m_hXuiBrush); } // Set this level as created in creative mode, so that people can't use the themed worlds as an easy way to get achievements @@ -270,10 +270,10 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { ListInfo.fEnabled = TRUE; DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; @@ -297,7 +297,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl OutputDebugStringW(tp->getName().c_str()); app.DebugPrintf(", sort index - %d\n",ListInfo.iSortIndex); #endif - hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); + hr=XuiCreateTextureBrushFromMemory(imageData,imageBytes,&ListInfo.hXuiBrush); m_pTexturePacksList->AddData(ListInfo,0,CXuiCtrl4JList::eSortList_Index); } @@ -1280,12 +1280,12 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) m_texturePackTitle.SetText(tp->getName().c_str()); m_texturePackDescription.SetText(tp->getDesc1().c_str()); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { - XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&m_hTexturePackIconBrush); + XuiCreateTextureBrushFromMemory(imageData,imageBytes,&m_hTexturePackIconBrush); m_texturePackIcon->UseBrush(m_hTexturePackIconBrush); } else @@ -1293,11 +1293,11 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) m_texturePackIcon->UseBrush(NULL); } - pbImageData = tp->getPackComparison(dwImageBytes); + imageData = tp->getPackComparison(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { - XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&m_hTexturePackComparisonBrush); + XuiCreateTextureBrushFromMemory(imageData,imageBytes,&m_hTexturePackComparisonBrush); m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush); } else @@ -1532,13 +1532,13 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete() TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { ListInfo.fEnabled = TRUE; - hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); + hr=XuiCreateTextureBrushFromMemory(imageData,imageBytes,&ListInfo.hXuiBrush); DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; if(pDLCTexPack) @@ -1683,4 +1683,4 @@ HRESULT CScene_LoadGameSettings::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) #endif CXuiSceneBase::SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK, -1, -1,-1,-1,-1,iRB); return S_OK; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp index 3aeb139cd..253f33807 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp @@ -184,10 +184,10 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { ListInfo.fEnabled = TRUE; DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; @@ -213,7 +213,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle app.DebugPrintf(", sort index - %d\n",ListInfo.iSortIndex); #endif - hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); + hr=XuiCreateTextureBrushFromMemory(imageData,imageBytes,&ListInfo.hXuiBrush); m_pTexturePacksList->AddData(ListInfo,0,CXuiCtrl4JList::eSortList_Index); } @@ -1138,20 +1138,20 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) m_texturePackTitle.SetText(tp->getName().c_str()); m_texturePackDescription.SetText(tp->getDesc1().c_str()); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { - XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&m_hTexturePackIconBrush); + XuiCreateTextureBrushFromMemory(imageData,imageBytes,&m_hTexturePackIconBrush); m_texturePackIcon->UseBrush(m_hTexturePackIconBrush); } - pbImageData = tp->getPackComparison(dwImageBytes); + imageData = tp->getPackComparison(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { - XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&m_hTexturePackComparisonBrush); + XuiCreateTextureBrushFromMemory(imageData,imageBytes,&m_hTexturePackComparisonBrush); m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush); } else @@ -1287,13 +1287,13 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete() TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { ListInfo.fEnabled = TRUE; - hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); + hr=XuiCreateTextureBrushFromMemory(imageData,imageBytes,&ListInfo.hXuiBrush); DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; if(pDLCTexPack) @@ -1394,4 +1394,4 @@ void CScene_MultiGameCreate::ClearTexturePackDescription() m_texturePackDescription.SetText(L" "); m_texturePackComparison->UseBrush(NULL); m_texturePackIcon->UseBrush(NULL); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp index b431a4f71..f60944386 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -295,13 +295,13 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons() // increment the count of the mash-up pack worlds in the save list m_iMashUpButtonsC++; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId()); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); + std::uint32_t imageBytes = 0; + uint8_t *imageData = tp->getPackIcon(imageBytes); HXUIBRUSH hXuiBrush; - if(dwImageBytes > 0 && pbImageData) + if(imageBytes > 0 && imageData) { - XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush); + XuiCreateTextureBrushFromMemory(imageData,imageBytes,&hXuiBrush); // the index inside the list item for this will be i+1 because they start at m_vListData.size(), so the first etry (tutorial) is 1 m_pSavesList->UpdateGraphic(iSavesListIndex+1,hXuiBrush); } @@ -1270,8 +1270,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() TexturePack *tp = pMinecraft->skins->getTexturePackById(sessionInfo->data.texturePackParentId); HRESULT hr; - DWORD dwImageBytes=0; - PBYTE pbImageData=NULL; + std::uint32_t imageBytes = 0; + uint8_t *imageData = NULL; if(tp==NULL) { @@ -1280,19 +1280,21 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? - app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); - if(dwImageBytes > 0 && pbImageData) + DWORD tpdImageBytes = 0; + app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&imageData,&tpdImageBytes ); + imageBytes = static_cast(tpdImageBytes); + if(imageBytes > 0 && imageData) { - hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush); + hr=XuiCreateTextureBrushFromMemory(imageData,imageBytes,&hXuiBrush); m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush); } } else { - pbImageData = tp->getPackIcon(dwImageBytes); - if(dwImageBytes > 0 && pbImageData) + imageData = tp->getPackIcon(imageBytes); + if(imageBytes > 0 && imageData) { - hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush); + hr=XuiCreateTextureBrushFromMemory(imageData,imageBytes,&hXuiBrush); m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush); } } @@ -2764,4 +2766,4 @@ void CScene_MultiGameJoinLoad::SaveUploadCompleteCallback(LPVOID lpParam) app.TMSPP_SetTitleGroupID(GROUP_ID); // app.getRemoteStorage()->abort(); // pClass->m_eSaveUploadState = eSaveUpload_Idle; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 26f2b8012..a70351355 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -46,7 +46,7 @@ void AbstractTexturePack::loadIcon() UINT size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size); - m_iconSize = size; + m_iconSize = static_cast(size); #endif } @@ -62,7 +62,7 @@ void AbstractTexturePack::loadComparison() UINT size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_comparisonData, &size); - m_comparisonSize = size; + m_comparisonSize = static_cast(size); #endif } @@ -373,18 +373,18 @@ std::wstring AbstractTexturePack::getXuiRootPath() return szResourceLocator; } -uint8_t *AbstractTexturePack::getPackIcon(DWORD &dwImageBytes) +uint8_t *AbstractTexturePack::getPackIcon(std::uint32_t &imageBytes) { if(m_iconSize == 0 || m_iconData == NULL) loadIcon(); - dwImageBytes = m_iconSize; + imageBytes = m_iconSize; return m_iconData; } -uint8_t *AbstractTexturePack::getPackComparison(DWORD &dwImageBytes) +uint8_t *AbstractTexturePack::getPackComparison(std::uint32_t &imageBytes) { if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison(); - dwImageBytes = m_comparisonSize; + imageBytes = m_comparisonSize; return m_comparisonData; } diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h index dec6d1362..7f6e23f2b 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h @@ -20,10 +20,10 @@ protected: std::wstring desc2; uint8_t *m_iconData; - DWORD m_iconSize; + std::uint32_t m_iconSize; uint8_t *m_comparisonData; - DWORD m_comparisonSize; + std::uint32_t m_comparisonSize; TexturePack *fallback; @@ -84,8 +84,8 @@ public: virtual void loadUI(); virtual void unloadUI(); virtual std::wstring getXuiRootPath(); - virtual uint8_t *getPackIcon(DWORD &dwImageBytes); - virtual uint8_t *getPackComparison(DWORD &dwImageBytes); + virtual uint8_t *getPackIcon(std::uint32_t &imageBytes); + virtual uint8_t *getPackComparison(std::uint32_t &imageBytes); virtual unsigned int getDLCParentPackId(); virtual unsigned char getDLCSubPackId(); virtual ColourTable *getColourTable() { return m_colourTable; } diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index afae70edf..b0a958d2a 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -86,7 +86,9 @@ void DLCTexturePack::loadIcon() if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"icon.png")) { DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"icon.png"); - m_iconData = textureFile->getData(m_iconSize); + DWORD iconSize = 0; + m_iconData = textureFile->getData(iconSize); + m_iconSize = static_cast(iconSize); } else { @@ -99,7 +101,9 @@ void DLCTexturePack::loadComparison() if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"comparison.png")) { DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"comparison.png"); - m_comparisonData = textureFile->getData(m_comparisonSize); + DWORD comparisonSize = 0; + m_comparisonData = textureFile->getData(comparisonSize); + m_comparisonSize = static_cast(comparisonSize); } } diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp index 62418287b..7f49ed7cd 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp @@ -31,7 +31,7 @@ void DefaultTexturePack::loadIcon() { byteArray ba = app.getArchiveFile(L"Graphics\\TexturePackIcon.png"); m_iconData = ba.data; - m_iconSize = ba.length; + m_iconSize = static_cast(ba.length); } #endif } diff --git a/Minecraft.Client/Textures/Packs/TexturePack.h b/Minecraft.Client/Textures/Packs/TexturePack.h index 2bd1b0364..a5954c77e 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.h +++ b/Minecraft.Client/Textures/Packs/TexturePack.h @@ -47,8 +47,8 @@ public: virtual void loadUI() = 0; virtual void unloadUI() = 0; virtual std::wstring getXuiRootPath() = 0; - virtual uint8_t *getPackIcon(DWORD &dwImageBytes) = 0; - virtual uint8_t *getPackComparison(DWORD &dwImageBytes) = 0; + virtual uint8_t *getPackIcon(std::uint32_t &imageBytes) = 0; + virtual uint8_t *getPackComparison(std::uint32_t &imageBytes) = 0; virtual unsigned int getDLCParentPackId() = 0; virtual unsigned char getDLCSubPackId() = 0; virtual ColourTable *getColourTable() = 0; From c10b1a1706239816a0a70a2b680c5a8b7c065a51 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:46:41 +1100 Subject: [PATCH 016/192] Remove DWORD sizes from DLC payload APIs --- .../Platform/Common/DLC/DLCAudioFile.cpp | 14 +++++++------- .../Platform/Common/DLC/DLCAudioFile.h | 8 ++++---- .../Platform/Common/DLC/DLCCapeFile.cpp | 4 ++-- .../Platform/Common/DLC/DLCCapeFile.h | 2 +- .../Platform/Common/DLC/DLCColourTableFile.cpp | 4 ++-- .../Platform/Common/DLC/DLCColourTableFile.h | 2 +- Minecraft.Client/Platform/Common/DLC/DLCFile.h | 4 ++-- .../Platform/Common/DLC/DLCGameRulesFile.cpp | 10 +++++----- .../Platform/Common/DLC/DLCGameRulesFile.h | 6 +++--- .../Platform/Common/DLC/DLCGameRulesHeader.cpp | 16 ++++++++-------- .../Platform/Common/DLC/DLCGameRulesHeader.h | 8 ++++---- .../Platform/Common/DLC/DLCLocalisationFile.cpp | 4 ++-- .../Platform/Common/DLC/DLCLocalisationFile.h | 4 ++-- .../Platform/Common/DLC/DLCSkinFile.cpp | 4 ++-- .../Platform/Common/DLC/DLCSkinFile.h | 2 +- .../Platform/Common/DLC/DLCTextureFile.cpp | 10 +++++----- .../Platform/Common/DLC/DLCTextureFile.h | 6 +++--- .../Platform/Common/DLC/DLCUIDataFile.cpp | 10 +++++----- .../Platform/Common/DLC/DLCUIDataFile.h | 6 +++--- .../Textures/Packs/DLCTexturePack.cpp | 14 +++++++------- 20 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp index 92a5003c4..b25c0bec2 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp @@ -9,20 +9,20 @@ DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) { m_pbData = NULL; - m_dwBytes = 0; + m_dataBytes = 0; } -void DLCAudioFile::addData(uint8_t *pbData, DWORD dwBytes) +void DLCAudioFile::addData(uint8_t *pbData, std::uint32_t dataBytes) { m_pbData = pbData; - m_dwBytes = dwBytes; + m_dataBytes = dataBytes; - processDLCDataFile(pbData,dwBytes); + processDLCDataFile(pbData,dataBytes); } -uint8_t *DLCAudioFile::getData(DWORD &dwBytes) +uint8_t *DLCAudioFile::getData(std::uint32_t &dataBytes) { - dwBytes = m_dwBytes; + dataBytes = m_dataBytes; return m_pbData; } @@ -120,7 +120,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons } } -bool DLCAudioFile::processDLCDataFile(uint8_t *pbData, DWORD dwLength) +bool DLCAudioFile::processDLCDataFile(uint8_t *pbData, std::uint32_t dataLength) { std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h index 8276ebc6c..c3296a807 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h @@ -32,10 +32,10 @@ public: DLCAudioFile(const std::wstring &path); - virtual void addData(uint8_t *pbData, DWORD dwBytes); - virtual uint8_t *getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); + virtual uint8_t *getData(std::uint32_t &dataBytes); - bool processDLCDataFile(uint8_t *pbData, DWORD dwLength); + bool processDLCDataFile(uint8_t *pbData, std::uint32_t dataLength); int GetCountofType(DLCAudioFile::EAudioType ptype); std::wstring &GetSoundName(int iIndex); @@ -43,7 +43,7 @@ private: using DLCFile::addParameter; uint8_t *m_pbData; - DWORD m_dwBytes; + std::uint32_t m_dataBytes; static const int CURRENT_AUDIO_VERSION_NUM=1; //std::unordered_map m_parameters; std::vector m_parameters[e_AudioType_Max]; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp index 35f58ad1f..da72eec4b 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp @@ -6,7 +6,7 @@ DLCCapeFile::DLCCapeFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy { } -void DLCCapeFile::addData(uint8_t *pbData, DWORD dwBytes) +void DLCCapeFile::addData(uint8_t *pbData, std::uint32_t dataBytes) { - app.AddMemoryTextureFile(m_path,pbData,dwBytes); + app.AddMemoryTextureFile(m_path,pbData,dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h index dde0617ab..df7e51ca8 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h @@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile public: DLCCapeFile(const std::wstring &path); - virtual void addData(uint8_t *pbData, DWORD dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp index 239a3fb99..3922bae69 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp @@ -19,8 +19,8 @@ DLCColourTableFile::~DLCColourTableFile() } } -void DLCColourTableFile::addData(uint8_t *pbData, DWORD dwBytes) +void DLCColourTableFile::addData(uint8_t *pbData, std::uint32_t dataBytes) { ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable(); - m_colourTable = new ColourTable(defaultColourTable, pbData, dwBytes); + m_colourTable = new ColourTable(defaultColourTable, pbData, dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h index 97d5723ea..8ae18dcad 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h @@ -12,7 +12,7 @@ public: DLCColourTableFile(const std::wstring &path); ~DLCColourTableFile(); - virtual void addData(uint8_t *pbData, DWORD dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); ColourTable *getColourTable() { return m_colourTable; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCFile.h b/Minecraft.Client/Platform/Common/DLC/DLCFile.h index 0a91a650e..9e6482250 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCFile.h @@ -17,8 +17,8 @@ public: std::wstring getPath() { return m_path; } DWORD getSkinID() { return m_dwSkinId; } - virtual void addData(uint8_t *pbData, DWORD dwBytes) {} - virtual uint8_t *getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes) {} + virtual uint8_t *getData(std::uint32_t &dataBytes) { dataBytes = 0; return NULL; } virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {} virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp index b7550abe2..754aca694 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp @@ -5,17 +5,17 @@ DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path) { m_pbData = NULL; - m_dwBytes = 0; + m_dataBytes = 0; } -void DLCGameRulesFile::addData(uint8_t *pbData, DWORD dwBytes) +void DLCGameRulesFile::addData(uint8_t *pbData, std::uint32_t dataBytes) { m_pbData = pbData; - m_dwBytes = dwBytes; + m_dataBytes = dataBytes; } -uint8_t *DLCGameRulesFile::getData(DWORD &dwBytes) +uint8_t *DLCGameRulesFile::getData(std::uint32_t &dataBytes) { - dwBytes = m_dwBytes; + dataBytes = m_dataBytes; return m_pbData; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h index aebb0ebd3..8e3ff0abf 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h @@ -5,11 +5,11 @@ class DLCGameRulesFile : public DLCGameRules { private: uint8_t *m_pbData; - DWORD m_dwBytes; + std::uint32_t m_dataBytes; public: DLCGameRulesFile(const std::wstring &path); - virtual void addData(uint8_t *pbData, DWORD dwBytes); - virtual uint8_t *getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); + virtual uint8_t *getData(std::uint32_t &dataBytes); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp index f0c9f2a67..a9c4805d9 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp @@ -12,7 +12,7 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) { m_pbData = NULL; - m_dwBytes = 0; + m_dataBytes = 0; m_hasData = false; @@ -21,14 +21,14 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules( lgo = NULL; } -void DLCGameRulesHeader::addData(uint8_t *pbData, DWORD dwBytes) +void DLCGameRulesHeader::addData(uint8_t *pbData, std::uint32_t dataBytes) { m_pbData = pbData; - m_dwBytes = dwBytes; + m_dataBytes = dataBytes; #if 0 - byteArray data(m_pbData, m_dwBytes); + byteArray data(m_pbData, m_dataBytes); ByteArrayInputStream bais(data); DataInputStream dis(&bais); @@ -73,13 +73,13 @@ void DLCGameRulesHeader::addData(uint8_t *pbData, DWORD dwBytes) #endif } -uint8_t *DLCGameRulesHeader::getData(DWORD &dwBytes) +uint8_t *DLCGameRulesHeader::getData(std::uint32_t &dataBytes) { - dwBytes = m_dwBytes; + dataBytes = m_dataBytes; return m_pbData; } -void DLCGameRulesHeader::setGrfData(uint8_t *fData, DWORD fSize, StringTable *st) +void DLCGameRulesHeader::setGrfData(uint8_t *fData, std::uint32_t dataSize, StringTable *st) { if (!m_hasData) { @@ -87,6 +87,6 @@ void DLCGameRulesHeader::setGrfData(uint8_t *fData, DWORD fSize, StringTable *st //app.m_gameRules.loadGameRules(lgo, fData, fSize); - app.m_gameRules.readRuleFile(lgo, fData, fSize, st); + app.m_gameRules.readRuleFile(lgo, fData, dataSize, st); } } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h index b8c0bdb9e..dfd70dc98 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h @@ -9,7 +9,7 @@ private: // GR-Header uint8_t *m_pbData; - DWORD m_dwBytes; + std::uint32_t m_dataBytes; bool m_hasData; @@ -33,10 +33,10 @@ public: public: DLCGameRulesHeader(const std::wstring &path); - virtual void addData(uint8_t *pbData, DWORD dwBytes); - virtual uint8_t *getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); + virtual uint8_t *getData(std::uint32_t &dataBytes); - void setGrfData(uint8_t *fData, DWORD fSize, StringTable *); + void setGrfData(uint8_t *fData, std::uint32_t dataSize, StringTable *); virtual bool ready() { return m_hasData; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp index 870e07117..1c53207ff 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp @@ -8,7 +8,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLC m_strings = NULL; } -void DLCLocalisationFile::addData(uint8_t *pbData, DWORD dwBytes) +void DLCLocalisationFile::addData(uint8_t *pbData, std::uint32_t dataBytes) { - m_strings = new StringTable(pbData, dwBytes); + m_strings = new StringTable(pbData, dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h index d4194687a..77e160cce 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h @@ -10,9 +10,9 @@ private: public: DLCLocalisationFile(const std::wstring &path); - DLCLocalisationFile(uint8_t *pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++ + DLCLocalisationFile(uint8_t *pbData, std::uint32_t dataBytes); // when we load in a texture pack details file from TMS++ - virtual void addData(uint8_t *pbData, DWORD dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); StringTable *getStringTable() { return m_strings; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp index 87fb2adfa..171ecffa0 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp @@ -16,9 +16,9 @@ DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy m_uiAnimOverrideBitmask=0L; } -void DLCSkinFile::addData(uint8_t *pbData, DWORD dwBytes) +void DLCSkinFile::addData(uint8_t *pbData, std::uint32_t dataBytes) { - app.AddMemoryTextureFile(m_path,pbData,dwBytes); + app.AddMemoryTextureFile(m_path,pbData,dataBytes); } void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h index 36fd7e242..d0c0f7f05 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h @@ -17,7 +17,7 @@ public: DLCSkinFile(const std::wstring &path); - virtual void addData(uint8_t *pbData, DWORD dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); diff --git a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp index 81d32b806..029f41b5a 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp @@ -8,19 +8,19 @@ DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e m_animString = L""; m_pbData = NULL; - m_dwBytes = 0; + m_dataBytes = 0; } -void DLCTextureFile::addData(uint8_t *pbData, DWORD dwBytes) +void DLCTextureFile::addData(uint8_t *pbData, std::uint32_t dataBytes) { //app.AddMemoryTextureFile(m_path,pbData,dwBytes); m_pbData = pbData; - m_dwBytes = dwBytes; + m_dataBytes = dataBytes; } -uint8_t *DLCTextureFile::getData(DWORD &dwBytes) +uint8_t *DLCTextureFile::getData(std::uint32_t &dataBytes) { - dwBytes = m_dwBytes; + dataBytes = m_dataBytes; return m_pbData; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h index 7e5bff9fc..4a64870e9 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h @@ -9,13 +9,13 @@ private: std::wstring m_animString; uint8_t *m_pbData; - DWORD m_dwBytes; + std::uint32_t m_dataBytes; public: DLCTextureFile(const std::wstring &path); - virtual void addData(uint8_t *pbData, DWORD dwBytes); - virtual uint8_t *getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); + virtual uint8_t *getData(std::uint32_t &dataBytes); virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); diff --git a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp index aa6f0dbe1..b96ba31cc 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp @@ -5,7 +5,7 @@ DLCUIDataFile::DLCUIDataFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path) { m_pbData = NULL; - m_dwBytes = 0; + m_dataBytes = 0; m_canDeleteData = false; } @@ -18,15 +18,15 @@ DLCUIDataFile::~DLCUIDataFile() } } -void DLCUIDataFile::addData(uint8_t *pbData, DWORD dwBytes,bool canDeleteData) +void DLCUIDataFile::addData(uint8_t *pbData, std::uint32_t dataBytes,bool canDeleteData) { m_pbData = pbData; - m_dwBytes = dwBytes; + m_dataBytes = dataBytes; m_canDeleteData = canDeleteData; } -uint8_t *DLCUIDataFile::getData(DWORD &dwBytes) +uint8_t *DLCUIDataFile::getData(std::uint32_t &dataBytes) { - dwBytes = m_dwBytes; + dataBytes = m_dataBytes; return m_pbData; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h index fa0d2fc6b..e77ccd138 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h @@ -5,7 +5,7 @@ class DLCUIDataFile : public DLCFile { private: uint8_t *m_pbData; - DWORD m_dwBytes; + std::uint32_t m_dataBytes; bool m_canDeleteData; public: @@ -15,6 +15,6 @@ public: using DLCFile::addData; using DLCFile::addParameter; - virtual void addData(uint8_t *pbData, DWORD dwBytes,bool canDeleteData = false); - virtual uint8_t *getData(DWORD &dwBytes); + virtual void addData(uint8_t *pbData, std::uint32_t dataBytes,bool canDeleteData = false); + virtual uint8_t *getData(std::uint32_t &dataBytes); }; diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index b0a958d2a..1c1160d7f 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -86,9 +86,9 @@ void DLCTexturePack::loadIcon() if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"icon.png")) { DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"icon.png"); - DWORD iconSize = 0; + std::uint32_t iconSize = 0; m_iconData = textureFile->getData(iconSize); - m_iconSize = static_cast(iconSize); + m_iconSize = iconSize; } else { @@ -101,9 +101,9 @@ void DLCTexturePack::loadComparison() if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"comparison.png")) { DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"comparison.png"); - DWORD comparisonSize = 0; + std::uint32_t comparisonSize = 0; m_comparisonData = textureFile->getData(comparisonSize); - m_comparisonSize = static_cast(comparisonSize); + m_comparisonSize = comparisonSize; } } @@ -222,7 +222,7 @@ void DLCTexturePack::loadColourTable() { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); - DWORD dwSize = 0; + std::uint32_t dwSize = 0; uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string @@ -480,7 +480,7 @@ void DLCTexturePack::loadUI() { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); - DWORD dwSize = 0; + std::uint32_t dwSize = 0; uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string @@ -554,7 +554,7 @@ std::wstring DLCTexturePack::getXuiRootPath() { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); - DWORD dwSize = 0; + std::uint32_t dwSize = 0; uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string From b47ed0af98212e234ea91b0cd2244ca74e11269d Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:51:17 +1100 Subject: [PATCH 017/192] Remove Win32 metadata types from level generation interfaces --- .../Platform/Common/DLC/DLCGameRulesHeader.h | 8 +++--- .../GameRules/LevelGenerationOptions.cpp | 18 ++++++------ .../Common/GameRules/LevelGenerationOptions.h | 28 ++++++++++--------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h index dfd70dc98..294180e9f 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h @@ -15,14 +15,14 @@ private: public: virtual bool requiresTexturePack() {return m_bRequiresTexturePack;} - virtual UINT getRequiredTexturePackId() {return m_requiredTexturePackId;} + virtual std::uint32_t getRequiredTexturePackId() {return m_requiredTexturePackId;} virtual std::wstring getDefaultSaveName() {return m_defaultSaveName;} - virtual LPCWSTR getWorldName() {return m_worldName.c_str();} - virtual LPCWSTR getDisplayName() {return m_displayName.c_str();} + virtual const wchar_t *getWorldName() {return m_worldName.c_str();} + virtual const wchar_t *getDisplayName() {return m_displayName.c_str();} virtual std::wstring getGrfPath() {return L"GameRules.grf";} virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} - virtual void setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;} + virtual void setRequiredTexturePackId(std::uint32_t x) {m_requiredTexturePackId = x;} virtual void setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;} virtual void setWorldName(const std::wstring & x) {m_worldName = x;} virtual void setDisplayName(const std::wstring & x) {m_displayName = x;} diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index b6bf2a390..d2790f1bd 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -23,16 +23,16 @@ JustGrSource::JustGrSource() } bool JustGrSource::requiresTexturePack() {return m_bRequiresTexturePack;} -UINT JustGrSource::getRequiredTexturePackId() {return m_requiredTexturePackId;} +std::uint32_t JustGrSource::getRequiredTexturePackId() {return m_requiredTexturePackId;} std::wstring JustGrSource::getDefaultSaveName() {return m_defaultSaveName;} -LPCWSTR JustGrSource::getWorldName() {return m_worldName.c_str();} -LPCWSTR JustGrSource::getDisplayName() {return m_displayName.c_str();} +const wchar_t *JustGrSource::getWorldName() {return m_worldName.c_str();} +const wchar_t *JustGrSource::getDisplayName() {return m_displayName.c_str();} std::wstring JustGrSource::getGrfPath() {return m_grfPath;} bool JustGrSource::requiresBaseSave() { return m_bRequiresBaseSave; }; std::wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; }; void JustGrSource::setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} -void JustGrSource::setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;} +void JustGrSource::setRequiredTexturePackId(std::uint32_t x) {m_requiredTexturePackId = x;} void JustGrSource::setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;} void JustGrSource::setWorldName(const std::wstring &x) {m_worldName = x;} void JustGrSource::setDisplayName(const std::wstring &x) {m_displayName = x;} @@ -477,10 +477,10 @@ bool LevelGenerationOptions::isFromSave() { return getSrc() == eSrc_fromSave; } bool LevelGenerationOptions::isFromDLC() { return getSrc() == eSrc_fromDLC; } bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresTexturePack(); } -UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); } +std::uint32_t LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); } std::wstring LevelGenerationOptions::getDefaultSaveName() { return info()->getDefaultSaveName(); } -LPCWSTR LevelGenerationOptions::getWorldName() { return info()->getWorldName(); } -LPCWSTR LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); } +const wchar_t *LevelGenerationOptions::getWorldName() { return info()->getWorldName(); } +const wchar_t *LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); } std::wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); } bool LevelGenerationOptions::requiresBaseSave() { return info()->requiresBaseSave(); } std::wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseSavePath(); } @@ -488,7 +488,7 @@ std::wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseS void LevelGenerationOptions::setGrSource(GrSource *grs) { m_pSrc = grs; } void LevelGenerationOptions::setRequiresTexturePack(bool x) { info()->setRequiresTexturePack(x); } -void LevelGenerationOptions::setRequiredTexturePackId(UINT x) { info()->setRequiredTexturePackId(x); } +void LevelGenerationOptions::setRequiredTexturePackId(std::uint32_t x) { info()->setRequiredTexturePackId(x); } void LevelGenerationOptions::setDefaultSaveName(const std::wstring &x) { info()->setDefaultSaveName(x); } void LevelGenerationOptions::setWorldName(const std::wstring &x) { info()->setWorldName(x); } void LevelGenerationOptions::setDisplayName(const std::wstring &x) { info()->setDisplayName(x); } @@ -511,4 +511,4 @@ bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; } bool LevelGenerationOptions::requiresGameRules() { return m_bRequiresGameRules; } void LevelGenerationOptions::setRequiredGameRules(LevelRuleset *rules) { m_requiredGameRules = rules; m_bRequiresGameRules = true; } -LevelRuleset *LevelGenerationOptions::getRequiredGameRules() { return m_requiredGameRules; } \ No newline at end of file +LevelRuleset *LevelGenerationOptions::getRequiredGameRules() { return m_requiredGameRules; } diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h index d81436bee..47cc6a649 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h @@ -3,6 +3,8 @@ // #pragma message("LevelGenerationOptions.h ") +#include + #include "GameRuleDefinition.h" #include "../../Minecraft.World/WorldGen/Features/StructureFeature.h" @@ -23,16 +25,16 @@ public: // completely different lifespans. virtual bool requiresTexturePack()=0; - virtual UINT getRequiredTexturePackId()=0; + virtual std::uint32_t getRequiredTexturePackId()=0; virtual std::wstring getDefaultSaveName()=0; - virtual LPCWSTR getWorldName()=0; - virtual LPCWSTR getDisplayName()=0; + virtual const wchar_t *getWorldName()=0; + virtual const wchar_t *getDisplayName()=0; virtual std::wstring getGrfPath()=0; virtual bool requiresBaseSave() = 0; virtual std::wstring getBaseSavePath() = 0; virtual void setRequiresTexturePack(bool)=0; - virtual void setRequiredTexturePackId(UINT)=0; + virtual void setRequiredTexturePackId(std::uint32_t)=0; virtual void setDefaultSaveName(const std::wstring &)=0; virtual void setWorldName(const std::wstring &)=0; virtual void setDisplayName(const std::wstring &)=0; @@ -51,23 +53,23 @@ protected: std::wstring m_displayName; std::wstring m_defaultSaveName; bool m_bRequiresTexturePack; - int m_requiredTexturePackId; + std::uint32_t m_requiredTexturePackId; std::wstring m_grfPath; std::wstring m_baseSavePath; bool m_bRequiresBaseSave; public: virtual bool requiresTexturePack(); - virtual UINT getRequiredTexturePackId(); + virtual std::uint32_t getRequiredTexturePackId(); virtual std::wstring getDefaultSaveName(); - virtual LPCWSTR getWorldName(); - virtual LPCWSTR getDisplayName(); + virtual const wchar_t *getWorldName(); + virtual const wchar_t *getDisplayName(); virtual std::wstring getGrfPath(); virtual bool requiresBaseSave(); virtual std::wstring getBaseSavePath(); virtual void setRequiresTexturePack(bool x); - virtual void setRequiredTexturePackId(UINT x); + virtual void setRequiredTexturePackId(std::uint32_t x); virtual void setDefaultSaveName(const std::wstring &x); virtual void setWorldName(const std::wstring &x); virtual void setDisplayName(const std::wstring &x); @@ -116,10 +118,10 @@ public: bool isFromDLC(); bool requiresTexturePack(); - UINT getRequiredTexturePackId(); + std::uint32_t getRequiredTexturePackId(); std::wstring getDefaultSaveName(); - LPCWSTR getWorldName(); - LPCWSTR getDisplayName(); + const wchar_t *getWorldName(); + const wchar_t *getDisplayName(); std::wstring getGrfPath(); bool requiresBaseSave(); std::wstring getBaseSavePath(); @@ -127,7 +129,7 @@ public: void setGrSource(GrSource *grs); void setRequiresTexturePack(bool x); - void setRequiredTexturePackId(UINT x); + void setRequiredTexturePackId(std::uint32_t x); void setDefaultSaveName(const std::wstring &x); void setWorldName(const std::wstring &x); void setDisplayName(const std::wstring &x); From 2dbce494d10cb203e9e5362d601f115f251cb785 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:55:41 +1100 Subject: [PATCH 018/192] Remove DWORD texture pack IDs from pack interfaces --- .../Textures/Packs/AbstractTexturePack.cpp | 4 +-- .../Textures/Packs/AbstractTexturePack.h | 6 ++-- .../Textures/Packs/DLCTexturePack.cpp | 4 +-- .../Textures/Packs/DLCTexturePack.h | 6 ++-- .../Textures/Packs/FileTexturePack.cpp | 4 +-- .../Textures/Packs/FileTexturePack.h | 2 +- .../Textures/Packs/FolderTexturePack.cpp | 4 +-- .../Textures/Packs/FolderTexturePack.h | 4 +-- Minecraft.Client/Textures/Packs/TexturePack.h | 2 +- .../Textures/Packs/TexturePackRepository.cpp | 28 +++++++++---------- .../Textures/Packs/TexturePackRepository.h | 20 ++++++------- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index a70351355..4a8aa44e0 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -4,7 +4,7 @@ #include "../../../Minecraft.World/IO/Streams/InputOutputStream.h" #include "../../../Minecraft.World/Util/StringHelpers.h" -AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name) +AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name) { // 4J init textureId = -1; @@ -152,7 +152,7 @@ bool AbstractTexturePack::hasFile(const std::wstring &name, bool allowFallback) return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile; } -DWORD AbstractTexturePack::getId() +std::uint32_t AbstractTexturePack::getId() { return id; } diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h index 7f6e23f2b..3c2176622 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h @@ -8,7 +8,7 @@ class BufferedImage; class AbstractTexturePack : public TexturePack { private: - const DWORD id; + const std::uint32_t id; const std::wstring name; protected: @@ -36,7 +36,7 @@ private: int textureId; protected: - AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback); + AbstractTexturePack(std::uint32_t id, File *file, const std::wstring &name, TexturePack *fallback); private: static std::wstring trim(std::wstring line); @@ -61,7 +61,7 @@ public: virtual void load(Textures *textures); virtual bool hasFile(const std::wstring &name, bool allowFallback); virtual bool hasFile(const std::wstring &name) = 0; - virtual DWORD getId(); + virtual std::uint32_t getId(); virtual std::wstring getName(); virtual std::wstring getDesc1(); virtual std::wstring getDesc2(); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 1c1160d7f..06880099b 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -50,7 +50,7 @@ namespace } } -DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) +DLCTexturePack::DLCTexturePack(std::uint32_t id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) { m_dlcInfoPack = pack; m_dlcDataPack = NULL; @@ -305,7 +305,7 @@ void DLCTexturePack::loadData() -std::wstring DLCTexturePack::getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder) +std::wstring DLCTexturePack::getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder) { return app.getFilePath(packId,filename,bAddDataFolder); } diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.h b/Minecraft.Client/Textures/Packs/DLCTexturePack.h index 375c8cafe..ef6e5154b 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.h +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.h @@ -22,7 +22,7 @@ private: public: using AbstractTexturePack::getResource; - DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback); + DLCTexturePack(std::uint32_t id, DLCPack *pack, TexturePack *fallback); ~DLCTexturePack(); virtual std::wstring getResource(const std::wstring& name); @@ -54,8 +54,8 @@ public: virtual bool isLoadingData() { return m_bLoadingData; } private: - static std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); - static std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder=true); + static std::wstring getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder); + static std::wstring getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder=true); public: static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp index 4cbf392ed..c70b462d6 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp @@ -1,7 +1,7 @@ #include "../../Platform/stdafx.h" #include "FileTexturePack.h" -FileTexturePack::FileTexturePack(DWORD id, File *file, TexturePack *fallback) : AbstractTexturePack(id, file, file->getName(), fallback) +FileTexturePack::FileTexturePack(std::uint32_t id, File *file, TexturePack *fallback) : AbstractTexturePack(id, file, file->getName(), fallback) { // 4J Stu - These calls need to be in the most derived version of the class loadIcon(); @@ -83,4 +83,4 @@ bool FileTexturePack::isTerrainUpdateCompatible() return !hasOldFiles; #endif return false; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.h b/Minecraft.Client/Textures/Packs/FileTexturePack.h index 6a7be75fe..3643d6f74 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.h @@ -12,7 +12,7 @@ private: //ZipFile *zipFile; public: - FileTexturePack(DWORD id, File *file, TexturePack *fallback); + FileTexturePack(std::uint32_t id, File *file, TexturePack *fallback); //@Override void unload(Textures *textures); diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp index 51e5a669c..39bdd88ec 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp @@ -1,7 +1,7 @@ #include "../../Platform/stdafx.h" #include "FolderTexturePack.h" -FolderTexturePack::FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback) +FolderTexturePack::FolderTexturePack(std::uint32_t id, const std::wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback) { // 4J Stu - These calls need to be in the most derived version of the class loadIcon(); @@ -107,4 +107,4 @@ void FolderTexturePack::unloadUI() } AbstractTexturePack::unloadUI(); #endif -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.h b/Minecraft.Client/Textures/Packs/FolderTexturePack.h index c57d2576e..3cd30859e 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.h @@ -8,7 +8,7 @@ private: bool bUILoaded; public: - FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback); + FolderTexturePack(std::uint32_t id, const std::wstring &name, File *folder, TexturePack *fallback); protected: //@Override @@ -23,4 +23,4 @@ public: virtual std::wstring getPath(bool bTitleUpdateTexture = false); virtual void loadUI(); virtual void unloadUI(); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Textures/Packs/TexturePack.h b/Minecraft.Client/Textures/Packs/TexturePack.h index a5954c77e..ed36f63dd 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.h +++ b/Minecraft.Client/Textures/Packs/TexturePack.h @@ -22,7 +22,7 @@ public: virtual void load(Textures *textures) = 0; virtual InputStream *getResource(const std::wstring &name, bool allowFallback) = 0;// throws IOException; //virtual InputStream *getResource(const std::wstring &name) = 0;// throws IOException; - virtual DWORD getId() = 0; + virtual std::uint32_t getId() = 0; virtual std::wstring getName() = 0; virtual std::wstring getDesc1() = 0; virtual std::wstring getDesc2() = 0; diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index 2b10c3a4a..b20bf8f57 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -291,19 +291,19 @@ bool TexturePackRepository::canUseWebSkin() return false; } -std::vector< std::pair > *TexturePackRepository::getTexturePackIdNames() +std::vector< std::pair > *TexturePackRepository::getTexturePackIdNames() { - std::vector< std::pair > *packList = new std::vector< std::pair >(); + std::vector< std::pair > *packList = new std::vector< std::pair >(); for(AUTO_VAR(it,texturePacks->begin()); it != texturePacks->end(); ++it) { TexturePack *pack = *it; - packList->push_back( std::pair(pack->getId(),pack->getName()) ); + packList->push_back( std::pair(pack->getId(),pack->getName()) ); } return packList; } -bool TexturePackRepository::selectTexturePackById(DWORD id) +bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { bool bDidSelect = false; @@ -352,7 +352,7 @@ bool TexturePackRepository::selectTexturePackById(DWORD id) return bDidSelect; } -TexturePack *TexturePackRepository::getTexturePackById(DWORD id) +TexturePack *TexturePackRepository::getTexturePackById(std::uint32_t id) { AUTO_VAR(it, cacheById.find(id)); if(it != cacheById.end()) @@ -363,27 +363,27 @@ TexturePack *TexturePackRepository::getTexturePackById(DWORD id) return NULL; } -TexturePack *TexturePackRepository::addTexturePackFromDLC(DLCPack *dlcPack, DWORD id) +TexturePack *TexturePackRepository::addTexturePackFromDLC(DLCPack *dlcPack, std::uint32_t id) { TexturePack *newPack = NULL; // 4J-PB - The City texture pack went out with a child id for the texture pack of 1 instead of zero // we need to mask off the child id here to deal with this - DWORD dwParentID=id&0xFFFFFF; // child id is <<24 and Or'd with parent + const std::uint32_t parentId = id & 0xFFFFFFu; // child id is <<24 and Or'd with parent if(dlcPack != NULL) { - newPack = new DLCTexturePack(dwParentID, dlcPack, DEFAULT_TEXTURE_PACK); + newPack = new DLCTexturePack(parentId, dlcPack, DEFAULT_TEXTURE_PACK); texturePacks->push_back(newPack); - cacheById[dwParentID] = newPack; + cacheById[parentId] = newPack; #ifndef _CONTENT_PACKAGE if(dlcPack->hasPurchasedFile(DLCManager::e_DLCType_TexturePack,L"")) { - wprintf(L"Added new FULL DLCTexturePack: %ls - id=%d\n", dlcPack->getName().c_str(),dwParentID ); + wprintf(L"Added new FULL DLCTexturePack: %ls - id=%u\n", dlcPack->getName().c_str(), parentId ); } else { - wprintf(L"Added new TRIAL DLCTexturePack: %ls - id=%d\n", dlcPack->getName().c_str(),dwParentID ); + wprintf(L"Added new TRIAL DLCTexturePack: %ls - id=%u\n", dlcPack->getName().c_str(), parentId ); } #endif } @@ -398,7 +398,7 @@ void TexturePackRepository::clearInvalidTexturePacks() } } -void TexturePackRepository::removeTexturePackById(DWORD id) +void TexturePackRepository::removeTexturePackById(std::uint32_t id) { AUTO_VAR(it, cacheById.find(id)); if(it != cacheById.end()) @@ -450,7 +450,7 @@ TexturePack *TexturePackRepository::getTexturePackByIndex(unsigned int index) return pack; } -unsigned int TexturePackRepository::getTexturePackIndex(unsigned int id) +unsigned int TexturePackRepository::getTexturePackIndex(std::uint32_t id) { int currentIndex = 0; for(AUTO_VAR(it,texturePacks->begin()); it != texturePacks->end(); ++it) @@ -461,4 +461,4 @@ unsigned int TexturePackRepository::getTexturePackIndex(unsigned int id) } if(currentIndex >= texturePacks->size()) currentIndex = 0; return currentIndex; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.h b/Minecraft.Client/Textures/Packs/TexturePackRepository.h index 1f8e66b8c..a93e1f7c6 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.h +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.h @@ -7,9 +7,9 @@ class Minecraft; class TexturePackRepository { public: - static const DWORD DEFAULT_TEXTURE_PACK_ID = 0; - static const DWORD FOLDER_TEST_TEXTURE_PACK_ID = 1; - static const DWORD DLC_TEST_TEXTURE_PACK_ID = 2; + static constexpr std::uint32_t DEFAULT_TEXTURE_PACK_ID = 0; + static constexpr std::uint32_t FOLDER_TEST_TEXTURE_PACK_ID = 1; + static constexpr std::uint32_t DLC_TEST_TEXTURE_PACK_ID = 2; private: static TexturePack *DEFAULT_TEXTURE_PACK; TexturePack *m_dummyTexturePack; @@ -21,7 +21,7 @@ private: std::vector *texturePacks; std::vector m_texturePacksToDelete; - std::unordered_map cacheById; + std::unordered_map cacheById; TexturePack *selected; TexturePack *lastSelected; @@ -60,18 +60,18 @@ public: bool isUsingDefaultSkin() { return selected == DEFAULT_TEXTURE_PACK; } // 4J Added TexturePack *getDefault() { return DEFAULT_TEXTURE_PACK; } // 4J Added - std::vector< std::pair > *getTexturePackIdNames(); - bool selectTexturePackById(DWORD id); // 4J Added - TexturePack *getTexturePackById(DWORD id); // 4J Added + std::vector< std::pair > *getTexturePackIdNames(); + bool selectTexturePackById(std::uint32_t id); // 4J Added + TexturePack *getTexturePackById(std::uint32_t id); // 4J Added - TexturePack *addTexturePackFromDLC(DLCPack *dlcPack, DWORD id); + TexturePack *addTexturePackFromDLC(DLCPack *dlcPack, std::uint32_t id); void clearInvalidTexturePacks(); void updateUI(); bool needsUIUpdate(); private: - void removeTexturePackById(DWORD id); + void removeTexturePackById(std::uint32_t id); public: unsigned int getTexturePackCount(); TexturePack *getTexturePackByIndex(unsigned int index); - unsigned int getTexturePackIndex(unsigned int id); + unsigned int getTexturePackIndex(std::uint32_t id); }; From e372b250756f7eb477fbf27fb0886e21cb490eac Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:57:20 +1100 Subject: [PATCH 019/192] Remove DWORD texture pack IDs from UI launch params --- Minecraft.Client/Platform/Common/UI/UIStructs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIStructs.h b/Minecraft.Client/Platform/Common/UI/UIStructs.h index d59a666fa..637bdea9b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIStructs.h +++ b/Minecraft.Client/Platform/Common/UI/UIStructs.h @@ -2,6 +2,8 @@ // #pragma message("UIStructs.h") +#include + #include "UIEnums.h" class Container; @@ -257,7 +259,7 @@ typedef struct _LaunchMoreOptionsMenuInitData int iPad; - DWORD dwTexturePack; + std::uint32_t dwTexturePack; std::wstring seed; int worldSize; From 91c8698358adee025b55f99ab55d3e66204d27a6 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:58:52 +1100 Subject: [PATCH 020/192] Remove DWORD from required texture pack app state --- Minecraft.Client/Platform/Common/Consoles_App.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index d0f2d1700..6c50f680f 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -839,8 +839,8 @@ public: void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;} void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;} - DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;} - void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;} + std::uint32_t GetRequiredTexturePackID() { return m_dwRequiredTexturePackID; } + void SetRequiredTexturePackID(std::uint32_t texturePackId) { m_dwRequiredTexturePackID = texturePackId; } virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;} @@ -854,7 +854,7 @@ private: bool m_bResetNether; - DWORD m_dwRequiredTexturePackID; + std::uint32_t m_dwRequiredTexturePackID; #ifdef _XBOX_ONE std::vector m_vTMSPPData; #endif From 52b462fffd314df03fd645aa94aa824879e8a2d1 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:00:49 +1100 Subject: [PATCH 021/192] Remove DWORD texture pack IDs from server prelogin state --- Minecraft.Client/MinecraftServer.h | 6 ++++-- Minecraft.World/Network/Packets/PreLoginPacket.cpp | 12 ++++++++---- Minecraft.World/Network/Packets/PreLoginPacket.h | 7 ++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index ced9a6c9e..07be02ac7 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "Input/ConsoleInputSource.h" #include "../Minecraft.World/Util/ArrayWithLength.h" #include "../Minecraft.World/Util/SharedConstants.h" @@ -34,7 +36,7 @@ typedef struct _NetworkGameInitData LoadSaveDataThreadParam *saveData; DWORD settings; LevelGenerationOptions *levelGen; - DWORD texturePackId; + std::uint32_t texturePackId; bool findSeed; unsigned int xzSize; unsigned char hellScale; @@ -118,7 +120,7 @@ public: DWORD m_ugcPlayersVersion; // This value is used to store the texture pack id for the currently loaded world - DWORD m_texturePackId; + std::uint32_t m_texturePackId; public: MinecraftServer(); diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.cpp b/Minecraft.World/Network/Packets/PreLoginPacket.cpp index 2cc287ec0..8c51cd463 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.cpp +++ b/Minecraft.World/Network/Packets/PreLoginPacket.cpp @@ -1,4 +1,6 @@ #include "../../Platform/stdafx.h" +#include +#include #include #include "PacketListener.h" #include "PreLoginPacket.h" @@ -32,7 +34,7 @@ PreLoginPacket::PreLoginPacket(std::wstring userName) m_netcodeVersion = 0; } -PreLoginPacket::PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, DWORD texturePackId) +PreLoginPacket::PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, std::uint32_t texturePackId) { this->loginKey = userName; m_playerXuids = playerXuids; @@ -75,8 +77,8 @@ void PreLoginPacket::read(DataInputStream *dis) //throws IOException m_serverSettings = dis->readInt(); m_hostIndex = dis->readByte(); - INT texturePackId = dis->readInt(); - m_texturePackId = *(DWORD *)&texturePackId; + std::int32_t texturePackId = dis->readInt(); + std::memcpy(&m_texturePackId, &texturePackId, sizeof(m_texturePackId)); // Set the name of the map so we can check it for players banned lists app.SetUniqueMapName((char *)m_szUniqueSaveName); @@ -103,7 +105,9 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException } dos->writeInt(m_serverSettings); dos->writeByte(m_hostIndex); - dos->writeInt(m_texturePackId); + std::int32_t texturePackId = 0; + std::memcpy(&texturePackId, &m_texturePackId, sizeof(texturePackId)); + dos->writeInt(texturePackId); } void PreLoginPacket::handle(PacketListener *listener) diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.h b/Minecraft.World/Network/Packets/PreLoginPacket.h index c6839b2b6..ea3c34758 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.h +++ b/Minecraft.World/Network/Packets/PreLoginPacket.h @@ -1,5 +1,6 @@ #pragma once +#include #include "Packet.h" @@ -18,14 +19,14 @@ public: BYTE m_szUniqueSaveName[m_iSaveNameLen]; // added for checking if the level is in the ban list DWORD m_serverSettings; // A bitfield of server settings constructed with the MAKE_SERVER_SETTINGS macro BYTE m_hostIndex; // Rather than sending the xuid of the host again, send an index into the m_playerXuids array - DWORD m_texturePackId; + std::uint32_t m_texturePackId; SHORT m_netcodeVersion; std::wstring loginKey; PreLoginPacket(); PreLoginPacket(std::wstring userName); - PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, DWORD texturePackId); + PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, std::uint32_t texturePackId); ~PreLoginPacket(); virtual void read(DataInputStream *dis); @@ -36,4 +37,4 @@ public: public: static std::shared_ptr create() { return std::shared_ptr(new PreLoginPacket()); } virtual int getId() { return 2; } -}; \ No newline at end of file +}; From fc1e696409060f7a44cad240b44360fd42657bc4 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:02:38 +1100 Subject: [PATCH 022/192] Remove DWORD texture pack IDs from app path helpers --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 5268792f2..cc746122a 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -9395,7 +9395,7 @@ void CMinecraftApp::SetTickTMSDLCFiles(bool bVal) m_bTickTMSDLCFiles=bVal; } -std::wstring CMinecraftApp::getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder) +std::wstring CMinecraftApp::getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder) { #ifdef _XBOX std::wstring path = getRootPath(packId, true, bAddDataFolder) + filename; @@ -9431,7 +9431,7 @@ std::wstring titleUpdateTexturePackRoot = L"GAME:\\res\\TitleUpdate\\DLC\\"; #endif #endif -std::wstring CMinecraftApp::getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder) +std::wstring CMinecraftApp::getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder) { std::wstring path = L"TPACK:"; #ifdef _XBOX diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 6c50f680f..e92b391b0 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -878,13 +878,13 @@ public: void SetTickTMSDLCFiles(bool bVal); - std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder); + std::wstring getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder); private: std::unordered_mapm_localeA; std::unordered_mapm_eMCLangA; std::unordered_mapm_xcLangA; - std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); + std::wstring getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder); public: #ifdef _XBOX From 26c3ac619710391f06b49c68fe7a3a4909878448 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:05:18 +1100 Subject: [PATCH 023/192] Remove DWORD texture pack IDs from image metadata APIs --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 2 +- Minecraft.Client/Platform/Common/Consoles_App.h | 2 +- .../Platform/PS3/Network/SonyRemoteStorage_PS3.cpp | 3 ++- .../Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index cc746122a..ca69329b7 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -7631,7 +7631,7 @@ unsigned int CMinecraftApp::FromBigEndian(unsigned int uiValue) #endif } -void CMinecraftApp::GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack) +void CMinecraftApp::GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,std::uint32_t &uiTexturePack) { unsigned char *ucPtr=pbImageData; unsigned int uiCount=0; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index e92b391b0..e5f1010dd 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -703,7 +703,7 @@ public: bool CanRecordStatsAndAchievements(); // World seed from png image - void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack); + void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,std::uint32_t &uiTexturePack); unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId); // Game rules diff --git a/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp b/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp index 4dbd9f224..c40bc20bd 100644 --- a/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp +++ b/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp @@ -1,6 +1,7 @@ #include "../../../../Minecraft.World/Platform/stdafx.h" #include "SonyRemoteStorage_PS3.h" +#include #include #include #include @@ -341,7 +342,7 @@ bool SonyRemoteStorage_PS3::setDataInternal() { unsigned int uiHostOptions; bool bHostOptionsRead; - DWORD uiTexturePack; + std::uint32_t uiTexturePack = 0; char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); diff --git a/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp b/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp index 1b7d0844b..1d7a22d42 100644 --- a/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp +++ b/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp @@ -2,6 +2,7 @@ #include "SonyRemoteStorage_Vita.h" #include "SonyHttp_Vita.h" +#include #include #include #include @@ -313,7 +314,7 @@ bool SonyRemoteStorage_Vita::setDataInternal() { unsigned int uiHostOptions; bool bHostOptionsRead; - DWORD uiTexturePack; + std::uint32_t uiTexturePack = 0; char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); From e76f427e341aad23ef382f339d918a0b5c32a275 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:09:02 +1100 Subject: [PATCH 024/192] Remove DWORD from GUI chat accessors --- Minecraft.Client/UI/Gui.cpp | 2 +- Minecraft.Client/UI/Gui.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/UI/Gui.cpp b/Minecraft.Client/UI/Gui.cpp index 87213ba19..fc1f8ea47 100644 --- a/Minecraft.Client/UI/Gui.cpp +++ b/Minecraft.Client/UI/Gui.cpp @@ -1349,7 +1349,7 @@ void Gui::addMessage(const std::wstring& _string,int iPad,bool bIsDeathMessage) } // 4J Added -float Gui::getOpacity(int iPad, DWORD index) +float Gui::getOpacity(int iPad, std::size_t index) { float opacityPercentage = 0; if (guiMessages[iPad].size() > index && guiMessages[iPad][index].ticks < 20 * 10) diff --git a/Minecraft.Client/UI/Gui.h b/Minecraft.Client/UI/Gui.h index 590947f0e..725a3b4c6 100644 --- a/Minecraft.Client/UI/Gui.h +++ b/Minecraft.Client/UI/Gui.h @@ -1,4 +1,5 @@ #pragma once +#include #include "GuiComponent.h" #include "GuiMessage.h" class Random; @@ -55,9 +56,9 @@ public: void displayClientMessage(int messageId, int iPad); // 4J Added - DWORD getMessagesCount(int iPad) { return (int)guiMessages[iPad].size(); } - std::wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; } - float getOpacity(int iPad, DWORD index); + std::size_t getMessagesCount(int iPad) { return guiMessages[iPad].size(); } + std::wstring getMessage(int iPad, std::size_t index) { return guiMessages[iPad].at(index).string; } + float getOpacity(int iPad, std::size_t index); std::wstring getJukeboxMessage(int iPad) { return overlayMessageString; } float getJukeboxOpacity(int iPad); From b5ad58f65cfcb05cc0174d3e4fbefc50de8fde36 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:11:08 +1100 Subject: [PATCH 025/192] Remove BYTE from entity event constants --- Minecraft.World/Entities/EntityEvent.h | 39 +++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Minecraft.World/Entities/EntityEvent.h b/Minecraft.World/Entities/EntityEvent.h index 4d2064aba..8e94bac1c 100644 --- a/Minecraft.World/Entities/EntityEvent.h +++ b/Minecraft.World/Entities/EntityEvent.h @@ -1,29 +1,30 @@ #pragma once +#include class EntityEvent { public: - static const BYTE JUMP = 1; - static const BYTE HURT = 2; - static const BYTE DEATH = 3; - static const BYTE START_ATTACKING = 4; - static const BYTE STOP_ATTACKING = 5; + static const std::uint8_t JUMP = 1; + static const std::uint8_t HURT = 2; + static const std::uint8_t DEATH = 3; + static const std::uint8_t START_ATTACKING = 4; + static const std::uint8_t STOP_ATTACKING = 5; - static const BYTE TAMING_FAILED = 6; - static const BYTE TAMING_SUCCEEDED = 7; - static const BYTE SHAKE_WETNESS = 8; + static const std::uint8_t TAMING_FAILED = 6; + static const std::uint8_t TAMING_SUCCEEDED = 7; + static const std::uint8_t SHAKE_WETNESS = 8; - static const BYTE USE_ITEM_COMPLETE = 9; + static const std::uint8_t USE_ITEM_COMPLETE = 9; - static const BYTE EAT_GRASS = 10; - static const BYTE OFFER_FLOWER = 11; - static const BYTE LOVE_HEARTS = 12; - static const BYTE VILLAGER_ANGRY = 13; - static const BYTE VILLAGER_HAPPY = 14; - static const BYTE WITCH_HAT_MAGIC = 15; - static const BYTE ZOMBIE_CONVERTING = 16; + static const std::uint8_t EAT_GRASS = 10; + static const std::uint8_t OFFER_FLOWER = 11; + static const std::uint8_t LOVE_HEARTS = 12; + static const std::uint8_t VILLAGER_ANGRY = 13; + static const std::uint8_t VILLAGER_HAPPY = 14; + static const std::uint8_t WITCH_HAT_MAGIC = 15; + static const std::uint8_t ZOMBIE_CONVERTING = 16; - static const BYTE FIREWORKS_EXPLODE = 17; + static const std::uint8_t FIREWORKS_EXPLODE = 17; - static const BYTE IN_LOVE_HEARTS = 18; -}; \ No newline at end of file + static const std::uint8_t IN_LOVE_HEARTS = 18; +}; From fca297538be778361563324c58ae01773bf03e0d Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:12:34 +1100 Subject: [PATCH 026/192] Remove BYTE from block generation helpers --- Minecraft.World/Level/BlockGenMethods.cpp | 10 +++++----- Minecraft.World/Level/BlockGenMethods.h | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Minecraft.World/Level/BlockGenMethods.cpp b/Minecraft.World/Level/BlockGenMethods.cpp index bf00c5511..e5799f50a 100644 --- a/Minecraft.World/Level/BlockGenMethods.cpp +++ b/Minecraft.World/Level/BlockGenMethods.cpp @@ -3,7 +3,7 @@ #include "../Headers/net.minecraft.world.level.h" #include "BlockGenMethods.h" -void BlockGenMethods::generateBox(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, BYTE edge, BYTE filling) +void BlockGenMethods::generateBox(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, std::uint8_t edge, std::uint8_t filling) { sx = Mth::clamp(sx, 0, 15); @@ -34,7 +34,7 @@ void BlockGenMethods::generateBox(Level *level, byteArray blocks, int sx, int sy } } -void BlockGenMethods::generateFrame(Level *level, byteArray blocks, int sx, int sy, int ex, int ey, int flatZ, int direction, BYTE edge, BYTE filling) +void BlockGenMethods::generateFrame(Level *level, byteArray blocks, int sx, int sy, int ex, int ey, int flatZ, int direction, std::uint8_t edge, std::uint8_t filling) { sx = Mth::clamp(sx, 0, 15); @@ -100,7 +100,7 @@ void BlockGenMethods::generateFrame(Level *level, byteArray blocks, int sx, int } } -void BlockGenMethods::generateDirectionLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, int startDirection, int endDirection, BYTE block) +void BlockGenMethods::generateDirectionLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, int startDirection, int endDirection, std::uint8_t block) { sx = Mth::clamp(sx, 0, 15); @@ -218,7 +218,7 @@ void BlockGenMethods::generateDirectionLine(Level *level, byteArray blocks, int } } -void BlockGenMethods::generateLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, BYTE block) +void BlockGenMethods::generateLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, std::uint8_t block) { generateDirectionLine(level, blocks, sx, sy, sz, ex, ey, ez, 0, 0, block); -} \ No newline at end of file +} diff --git a/Minecraft.World/Level/BlockGenMethods.h b/Minecraft.World/Level/BlockGenMethods.h index 602a994b7..f0e6027c6 100644 --- a/Minecraft.World/Level/BlockGenMethods.h +++ b/Minecraft.World/Level/BlockGenMethods.h @@ -1,12 +1,13 @@ #pragma once +#include #include "../Util/ArrayWithLength.h" class BlockGenMethods { public: - static void generateBox(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, BYTE edge, BYTE filling); - static void generateFrame(Level *level, byteArray blocks, int sx, int sy, int ex, int ey, int flatZ, int direction, BYTE edge, BYTE filling); - static void generateDirectionLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, int startDirection, int endDirection, BYTE block); - static void generateLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, BYTE block); -}; \ No newline at end of file + static void generateBox(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, std::uint8_t edge, std::uint8_t filling); + static void generateFrame(Level *level, byteArray blocks, int sx, int sy, int ex, int ey, int flatZ, int direction, std::uint8_t edge, std::uint8_t filling); + static void generateDirectionLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, int startDirection, int endDirection, std::uint8_t block); + static void generateLine(Level *level, byteArray blocks, int sx, int sy, int sz, int ex, int ey, int ez, std::uint8_t block); +}; From 6026f078ac25c42f77bcdf9c131c392943b0b0aa Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:15:08 +1100 Subject: [PATCH 027/192] Remove Win32 byte types from memory texture loaders --- Minecraft.Client/Textures/BufferedImage.cpp | 14 +++++++------- Minecraft.Client/Textures/BufferedImage.h | 5 +++-- Minecraft.Client/Textures/MemTexture.cpp | 6 +++--- Minecraft.Client/Textures/MemTexture.h | 5 +++-- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Minecraft.Client/Textures/BufferedImage.cpp b/Minecraft.Client/Textures/BufferedImage.cpp index cf64c2e3f..d8065851f 100644 --- a/Minecraft.Client/Textures/BufferedImage.cpp +++ b/Minecraft.Client/Textures/BufferedImage.cpp @@ -193,8 +193,8 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi { HRESULT hr; std::wstring filePath = File; - BYTE *pbData = NULL; - DWORD dwBytes = 0; + std::uint8_t *pbData = NULL; + std::uint32_t dataBytes = 0; for( int l = 0 ; l < 10; l++ ) { @@ -229,8 +229,8 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi } DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name); - pbData = dlcFile->getData(dwBytes); - if(pbData == NULL || dwBytes == 0) + pbData = dlcFile->getData(dataBytes); + if(pbData == NULL || dataBytes == 0) { // 4J - If we haven't loaded the non-mipmap version then exit the game if( l == 0 ) @@ -242,7 +242,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi D3DXIMAGE_INFO ImageInfo; ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO)); - hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[l]); + hr=RenderManager.LoadTextureData(pbData,dataBytes,&ImageInfo,&data[l]); if(hr!=ERROR_SUCCESS) @@ -264,7 +264,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi } -BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes) +BufferedImage::BufferedImage(std::uint8_t *pbData, std::uint32_t dataBytes) { int iCurrentByte=0; for( int l = 0 ; l < 10; l++ ) @@ -274,7 +274,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes) D3DXIMAGE_INFO ImageInfo; ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO)); - HRESULT hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[0]); + HRESULT hr=RenderManager.LoadTextureData(pbData,dataBytes,&ImageInfo,&data[0]); if(hr==ERROR_SUCCESS) { diff --git a/Minecraft.Client/Textures/BufferedImage.h b/Minecraft.Client/Textures/BufferedImage.h index 026c457a7..94ffe0576 100644 --- a/Minecraft.Client/Textures/BufferedImage.h +++ b/Minecraft.Client/Textures/BufferedImage.h @@ -1,4 +1,5 @@ #pragma once +#include class Graphics; @@ -17,7 +18,7 @@ public: BufferedImage(int width,int height,int type); BufferedImage(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); // 4J added BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension = false ); // 4J Added - BufferedImage(BYTE *pbData, DWORD dwBytes); // 4J added + BufferedImage(std::uint8_t *pbData, std::uint32_t dataBytes); // 4J added ~BufferedImage(); int getWidth(); @@ -30,4 +31,4 @@ public: BufferedImage *getSubimage(int x, int y, int w, int h); void preMultiplyAlpha(); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Textures/MemTexture.cpp b/Minecraft.Client/Textures/MemTexture.cpp index 343aa48a3..e243a94ce 100644 --- a/Minecraft.Client/Textures/MemTexture.cpp +++ b/Minecraft.Client/Textures/MemTexture.cpp @@ -1,7 +1,7 @@ #include "../Platform/stdafx.h" #include "MemTexture.h" -MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor) +MemTexture::MemTexture(const std::wstring& _url, std::uint8_t *pbData, std::uint32_t dataBytes, MemTextureProcessor *processor) { // 4J - added count = 1; @@ -14,7 +14,7 @@ MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, Mem // load the texture, and process it //loadedImage=Textures::getTexture() // 4J - remember to add deletes in here for any created BufferedImages when implemented - loadedImage = new BufferedImage(pbData,dwBytes); + loadedImage = new BufferedImage(pbData,dataBytes); if(processor==NULL) { @@ -30,4 +30,4 @@ MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, Mem MemTexture::~MemTexture() { delete loadedImage; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/MemTexture.h b/Minecraft.Client/Textures/MemTexture.h index e3f6b6bf7..d8c9c4d1a 100644 --- a/Minecraft.Client/Textures/MemTexture.h +++ b/Minecraft.Client/Textures/MemTexture.h @@ -1,4 +1,5 @@ #pragma once +#include class BufferedImage; class MemTextureProcessor; @@ -12,6 +13,6 @@ public: int ticksSinceLastUse; static const int UNUSED_TICKS_TO_FREE = 20; - MemTexture(const std::wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor); + MemTexture(const std::wstring& _name, std::uint8_t *pbData, std::uint32_t dataBytes, MemTextureProcessor *processor); ~MemTexture(); -}; \ No newline at end of file +}; From 474d8b2896ebb8487f9942e7418a578279e1293b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:17:32 +1100 Subject: [PATCH 028/192] Remove Win32 byte types from texture packets --- Minecraft.Client/Network/ClientConnection.cpp | 4 ++-- Minecraft.Client/Network/PlayerConnection.cpp | 6 +++--- .../Network/Packets/TexturePacket.cpp | 18 +++++++++--------- .../Network/Packets/TexturePacket.h | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index a671cc0d8..d8d07f091 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -2235,7 +2235,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) // Server side also needs to store a list of those clients waiting to get a texture the server doesn't have yet // so that it can send it out to them when it comes in - if(packet->dwBytes==0) + if(packet->dataBytes==0) { // Request for texture #ifndef _CONTENT_PACKAGE @@ -2256,7 +2256,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Client received custom texture %ls\n",packet->textureName.c_str()); #endif - app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes); + app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes); Minecraft::GetInstance()->handleClientTextureReceived(packet->textureName); } } diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index 76c71433c..636ea6560 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -796,7 +796,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way - if(packet->dwBytes==0) + if(packet->dataBytes==0) { // Request for texture #ifndef _CONTENT_PACKAGE @@ -821,7 +821,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Server received custom texture %ls\n",packet->textureName.c_str()); #endif - app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes); + app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes); server->connection->handleTextureReceived(packet->textureName); } } @@ -1714,4 +1714,4 @@ bool PlayerConnection::isGuest() } return isGuest; } -} \ No newline at end of file +} diff --git a/Minecraft.World/Network/Packets/TexturePacket.cpp b/Minecraft.World/Network/Packets/TexturePacket.cpp index 09b2bd9cf..bb179a8e5 100644 --- a/Minecraft.World/Network/Packets/TexturePacket.cpp +++ b/Minecraft.World/Network/Packets/TexturePacket.cpp @@ -9,7 +9,7 @@ TexturePacket::TexturePacket() { this->textureName = L""; - this->dwBytes = 0; + this->dataBytes = 0; this->pbData = NULL; } @@ -22,11 +22,11 @@ TexturePacket::~TexturePacket() // } } -TexturePacket::TexturePacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes) +TexturePacket::TexturePacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes) { this->textureName = textureName; this->pbData = pbData; - this->dwBytes = dwBytes; + this->dataBytes = dataBytes; } void TexturePacket::handle(PacketListener *listener) @@ -37,13 +37,13 @@ void TexturePacket::handle(PacketListener *listener) void TexturePacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - dwBytes = (DWORD)dis->readShort(); + dataBytes = (std::uint32_t)dis->readShort(); - if(dwBytes>0) + if(dataBytes>0) { - this->pbData= new BYTE [dwBytes]; + this->pbData= new std::uint8_t [dataBytes]; - for(DWORD i=0;ipbData[i] = dis->readByte(); } @@ -53,8 +53,8 @@ void TexturePacket::read(DataInputStream *dis) //throws IOException void TexturePacket::write(DataOutputStream *dos) //throws IOException { dos->writeUTF(textureName); - dos->writeShort((short)dwBytes); - for(DWORD i=0;iwriteShort((short)dataBytes); + for(std::uint32_t i=0;iwriteByte(this->pbData[i]); } diff --git a/Minecraft.World/Network/Packets/TexturePacket.h b/Minecraft.World/Network/Packets/TexturePacket.h index d4e199019..dfa5bd70f 100644 --- a/Minecraft.World/Network/Packets/TexturePacket.h +++ b/Minecraft.World/Network/Packets/TexturePacket.h @@ -1,5 +1,5 @@ #pragma once - +#include #include "Packet.h" @@ -7,12 +7,12 @@ class TexturePacket : public Packet, public std::enable_shared_from_this create() { return std::shared_ptr(new TexturePacket()); } virtual int getId() { return 154; } -}; \ No newline at end of file +}; From f5326bfe3ba0ca9ff8b59436285412c722348af7 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 01:19:54 +1100 Subject: [PATCH 029/192] Remove Win32 byte types from colour tables --- .../Platform/Common/Colours/ColourTable.cpp | 12 ++++++------ .../Platform/Common/Colours/ColourTable.h | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp b/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp index 18f959d44..294c3f5fd 100644 --- a/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp @@ -314,20 +314,20 @@ void ColourTable::staticCtor() } } -ColourTable::ColourTable(PBYTE pbData, DWORD dwLength) +ColourTable::ColourTable(std::uint8_t *pbData, std::uint32_t dataLength) { - loadColoursFromData(pbData, dwLength); + loadColoursFromData(pbData, dataLength); } -ColourTable::ColourTable(ColourTable *defaultColours, PBYTE pbData, DWORD dwLength) +ColourTable::ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength) { // 4J Stu - Default the colours that of the table passed in XMemCpy( (void *)m_colourValues, (void *)defaultColours->m_colourValues, sizeof(int) * eMinecraftColour_COUNT); - loadColoursFromData(pbData, dwLength); + loadColoursFromData(pbData, dataLength); } -void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength) +void ColourTable::loadColoursFromData(std::uint8_t *pbData, std::uint32_t dataLength) { - byteArray src(pbData, dwLength); + byteArray src(pbData, dataLength); ByteArrayInputStream bais(src); DataInputStream dis(&bais); diff --git a/Minecraft.Client/Platform/Common/Colours/ColourTable.h b/Minecraft.Client/Platform/Common/Colours/ColourTable.h index 5b3e6ee03..8a467e6cd 100644 --- a/Minecraft.Client/Platform/Common/Colours/ColourTable.h +++ b/Minecraft.Client/Platform/Common/Colours/ColourTable.h @@ -1,4 +1,5 @@ #pragma once +#include class ColourTable { @@ -11,13 +12,13 @@ private: public: static void staticCtor(); - ColourTable(PBYTE pbData, DWORD dwLength); - ColourTable(ColourTable *defaultColours, PBYTE pbData, DWORD dwLength); + ColourTable(std::uint8_t *pbData, std::uint32_t dataLength); + ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength); unsigned int getColour(eMinecraftColour id); unsigned int getColor(eMinecraftColour id) { return getColour(id); } - void loadColoursFromData(PBYTE pbData, DWORD dwLength); + void loadColoursFromData(std::uint8_t *pbData, std::uint32_t dataLength); void setColour(const std::wstring &colourName, int value); void setColour(const std::wstring &colourName, const std::wstring &value); -}; \ No newline at end of file +}; From 85ddd0cca0acf3424c05bcfe11299939c6adb33a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 02:18:43 +1100 Subject: [PATCH 030/192] Remove Win32 byte types from texture and geometry packets --- .../Packets/TextureAndGeometryPacket.cpp | 28 +++++++++---------- .../Packets/TextureAndGeometryPacket.h | 14 +++++----- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp index 029daa1a6..131d42775 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp @@ -30,7 +30,7 @@ TextureAndGeometryPacket::~TextureAndGeometryPacket() // } } -TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes) +TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes) { this->textureName = textureName; @@ -41,13 +41,13 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureNa ss >> this->dwSkinID; this->dwSkinID = MAKE_SKIN_BITMASK(true, this->dwSkinID); this->pbData = pbData; - this->dwTextureBytes = dwBytes; + this->dwTextureBytes = dataBytes; this->dwBoxC = 0; this->BoxDataA=NULL; this->uiAnimOverrideBitmask=0; } -TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes, DLCSkinFile *pDLCSkinFile) +TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes, DLCSkinFile *pDLCSkinFile) { this->textureName = textureName; @@ -59,7 +59,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureNa this->dwSkinID = MAKE_SKIN_BITMASK(true, this->dwSkinID); this->pbData = pbData; - this->dwTextureBytes = dwBytes; + this->dwTextureBytes = dataBytes; this->uiAnimOverrideBitmask = pDLCSkinFile->getAnimOverrideBitmask(); this->dwBoxC = pDLCSkinFile->getAdditionalBoxesCount(); if(this->dwBoxC!=0) @@ -80,7 +80,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureNa } } -TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes,std::vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask) +TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes,std::vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask) { this->textureName = textureName; @@ -92,7 +92,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureNa this->dwSkinID = MAKE_SKIN_BITMASK(true, this->dwSkinID); this->pbData = pbData; - this->dwTextureBytes = dwBytes; + this->dwTextureBytes = dataBytes; this->uiAnimOverrideBitmask = uiAnimOverrideBitmask; if(pvSkinBoxes==NULL) { @@ -101,7 +101,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const std::wstring &textureNa } else { - this->dwBoxC = (DWORD)pvSkinBoxes->size(); + this->dwBoxC = (std::uint32_t)pvSkinBoxes->size(); this->BoxDataA= new SKIN_BOX [this->dwBoxC]; int iCount=0; @@ -123,27 +123,27 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); dwSkinID = (DWORD)dis->readInt(); - dwTextureBytes = (DWORD)dis->readShort(); + dwTextureBytes = (std::uint32_t)dis->readShort(); if(dwTextureBytes>0) { - this->pbData= new BYTE [dwTextureBytes]; + this->pbData= new std::uint8_t [dwTextureBytes]; - for(DWORD i=0;ipbData[i] = dis->readByte(); } } uiAnimOverrideBitmask = dis->readInt(); - dwBoxC = (DWORD)dis->readShort(); + dwBoxC = (std::uint32_t)dis->readShort(); if(dwBoxC>0) { this->BoxDataA= new SKIN_BOX [dwBoxC]; } - for(DWORD i=0;iBoxDataA[i].ePart = (eBodyPart) dis->readShort(); this->BoxDataA[i].fX = dis->readFloat(); @@ -162,14 +162,14 @@ void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException dos->writeUTF(textureName); dos->writeInt(dwSkinID); dos->writeShort((short)dwTextureBytes); - for(DWORD i=0;iwriteByte(this->pbData[i]); } dos->writeInt(uiAnimOverrideBitmask); dos->writeShort((short)dwBoxC); - for(DWORD i=0;iwriteShort((short)this->BoxDataA[i].ePart); dos->writeFloat(this->BoxDataA[i].fX); diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h index f1ca1f7cb..9ff7e6930 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.h @@ -1,5 +1,5 @@ #pragma once - +#include #include "Packet.h" #include "../../../Minecraft.Client/Rendering/Models/Model.h" @@ -12,17 +12,17 @@ class TextureAndGeometryPacket : public Packet, public std::enable_shared_from_t public: std::wstring textureName; DWORD dwSkinID; - PBYTE pbData; - DWORD dwTextureBytes; + std::uint8_t *pbData; + std::uint32_t dwTextureBytes; SKIN_BOX *BoxDataA; - DWORD dwBoxC; + std::uint32_t dwBoxC; unsigned int uiAnimOverrideBitmask; TextureAndGeometryPacket(); ~TextureAndGeometryPacket(); - TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes); - TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes, DLCSkinFile *pDLCSkinFile); - TextureAndGeometryPacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes, std::vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask); + TextureAndGeometryPacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes); + TextureAndGeometryPacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes, DLCSkinFile *pDLCSkinFile); + TextureAndGeometryPacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes, std::vector *pvSkinBoxes, unsigned int uiAnimOverrideBitmask); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); From bd2c3fca1886f5fdfe3c10373a24aab9aa742031 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 02:19:50 +1100 Subject: [PATCH 031/192] Remove DWORD skin IDs from texture geometry packets --- .../Network/Packets/TextureAndGeometryChangePacket.cpp | 8 ++++++-- .../Network/Packets/TextureAndGeometryChangePacket.h | 6 +++--- .../Network/Packets/TextureAndGeometryPacket.cpp | 8 ++++++-- .../Network/Packets/TextureAndGeometryPacket.h | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp index 0115c2bd4..9efedd881 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp @@ -1,4 +1,5 @@ #include "../../Platform/stdafx.h" +#include #include #include "../../IO/Streams/InputOutputStream.h" #include "../../Headers/net.minecraft.world.entity.h" @@ -31,14 +32,17 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(std::shared_ptrreadInt(); - dwSkinID = dis->readInt(); + int skinId = dis->readInt(); + std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID)); path = dis->readUTF(); } void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); - dos->writeInt(dwSkinID); + int skinId = 0; + std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID)); + dos->writeInt(skinId); dos->writeUTF(path); } diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h index 00001d8f3..7584b3c3e 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h @@ -1,5 +1,5 @@ #pragma once - +#include #include "Packet.h" @@ -9,7 +9,7 @@ public: int id; std::wstring path; - DWORD dwSkinID; + std::uint32_t dwSkinID; TextureAndGeometryChangePacket(); TextureAndGeometryChangePacket(std::shared_ptr e, const std::wstring &path); @@ -22,4 +22,4 @@ public: public: static std::shared_ptr create() { return std::shared_ptr(new TextureAndGeometryChangePacket()); } virtual int getId() { return 161; } -}; \ No newline at end of file +}; diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp index 131d42775..941b468ff 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp @@ -1,4 +1,5 @@ #include "../../Platform/stdafx.h" +#include #include #include "../../IO/Streams/InputOutputStream.h" #include "PacketListener.h" @@ -122,7 +123,8 @@ void TextureAndGeometryPacket::handle(PacketListener *listener) void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - dwSkinID = (DWORD)dis->readInt(); + int skinId = dis->readInt(); + std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID)); dwTextureBytes = (std::uint32_t)dis->readShort(); if(dwTextureBytes>0) @@ -160,7 +162,9 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException { dos->writeUTF(textureName); - dos->writeInt(dwSkinID); + int skinId = 0; + std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID)); + dos->writeInt(skinId); dos->writeShort((short)dwTextureBytes); for(std::uint32_t i=0;i Date: Tue, 10 Mar 2026 07:21:04 +1100 Subject: [PATCH 032/192] Remove Win32 types from add player packets --- .../Network/Packets/AddPlayerPacket.cpp | 23 +++++++++++-------- .../Network/Packets/AddPlayerPacket.h | 9 ++++---- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp index 64ff58608..f1c32d19b 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp @@ -1,4 +1,5 @@ #include "../../Platform/stdafx.h" +#include #include #include "../../IO/Streams/InputOutputStream.h" #include "../../Headers/net.minecraft.world.entity.player.h" @@ -55,7 +56,7 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr player, PlayerUID xuid, this->xuid = xuid; this->OnlineXuid = OnlineXuid; - m_playerIndex = (BYTE)player->getPlayerIndex(); + m_playerIndex = static_cast(player->getPlayerIndex()); m_skinId = player->getCustomSkin(); m_capeId = player->getCustomCape(); m_uiGamePrivileges = player->getAllPlayerGamePrivileges(); @@ -77,11 +78,11 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException carriedItem = dis->readShort(); xuid = dis->readPlayerUID(); OnlineXuid = dis->readPlayerUID(); - m_playerIndex = static_cast(dis->readByte()); - INT skinId = dis->readInt(); - m_skinId = *(DWORD *)&skinId; - INT capeId = dis->readInt(); - m_capeId = *(DWORD *)&capeId; + m_playerIndex = static_cast(dis->readByte()); + int skinId = dis->readInt(); + std::memcpy(&m_skinId, &skinId, sizeof(m_skinId)); + int capeId = dis->readInt(); + std::memcpy(&m_capeId, &capeId, sizeof(m_capeId)); INT privileges = dis->readInt(); m_uiGamePrivileges = *(unsigned int *)&privileges; MemSect(1); @@ -103,8 +104,12 @@ void AddPlayerPacket::write(DataOutputStream *dos) //throws IOException dos->writePlayerUID(xuid); dos->writePlayerUID(OnlineXuid); dos->writeByte(static_cast(m_playerIndex)); // 4J Added - dos->writeInt(m_skinId); - dos->writeInt(m_capeId); + int skinId = 0; + std::memcpy(&skinId, &m_skinId, sizeof(m_skinId)); + dos->writeInt(skinId); + int capeId = 0; + std::memcpy(&capeId, &m_capeId, sizeof(m_capeId)); + dos->writeInt(capeId); dos->writeInt(m_uiGamePrivileges); entityData->packAll(dos); @@ -117,7 +122,7 @@ void AddPlayerPacket::handle(PacketListener *listener) int AddPlayerPacket::getEstimatedSize() { - int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) + sizeof(uint8_t); + int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(std::uint8_t) + sizeof(std::uint8_t) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(std::uint8_t) + sizeof(unsigned int) + sizeof(uint8_t); if( entityData != NULL ) { diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.h b/Minecraft.World/Network/Packets/AddPlayerPacket.h index 80a5c3dfb..43b86165f 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.h +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.h @@ -1,5 +1,6 @@ #pragma once +#include #include "Packet.h" #include "../../Entities/SyncedEntityData.h" @@ -18,12 +19,12 @@ public: std::wstring name; int x, y, z; char yRot, xRot; - int carriedItem; + int carriedItem; PlayerUID xuid; // 4J Added PlayerUID OnlineXuid; // 4J Added - BYTE m_playerIndex; // 4J Added - DWORD m_skinId; // 4J Added - DWORD m_capeId; // 4J Added + std::uint8_t m_playerIndex; // 4J Added + std::uint32_t m_skinId; // 4J Added + std::uint32_t m_capeId; // 4J Added unsigned int m_uiGamePrivileges; // 4J Added uint8_t yHeadRot; // 4J Added From 62a1aea3fcb4382823c21bda1f91af48afd9b37f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:22:47 +1100 Subject: [PATCH 033/192] Remove Win32 types from login packets --- .../Network/Packets/LoginPacket.cpp | 36 +++++++++++-------- Minecraft.World/Network/Packets/LoginPacket.h | 17 ++++----- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/Minecraft.World/Network/Packets/LoginPacket.cpp b/Minecraft.World/Network/Packets/LoginPacket.cpp index e13d26ab9..83b04924a 100644 --- a/Minecraft.World/Network/Packets/LoginPacket.cpp +++ b/Minecraft.World/Network/Packets/LoginPacket.cpp @@ -1,4 +1,5 @@ #include "../../Platform/stdafx.h" +#include #include #include "../../IO/Streams/InputOutputStream.h" #include "../../Headers/net.minecraft.world.entity.player.h" @@ -36,7 +37,7 @@ LoginPacket::LoginPacket() } // Client -> Server -LoginPacket::LoginPacket(const std::wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest) +LoginPacket::LoginPacket(const std::wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, std::uint32_t ugcPlayersVersion, std::uint32_t skinId, std::uint32_t capeId, bool isGuest) { this->userName = userName; this->clientVersion = clientVersion; @@ -65,7 +66,7 @@ LoginPacket::LoginPacket(const std::wstring& userName, int clientVersion, Player } // Server -> Client -LoginPacket::LoginPacket(const std::wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale) +LoginPacket::LoginPacket(const std::wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, std::uint8_t mapHeight, std::uint8_t maxPlayers, char difficulty, int multiplayerInstanceId, std::uint8_t playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale) { this->userName = userName; this->clientVersion = clientVersion; @@ -106,19 +107,20 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException seed = dis->readLong(); gameType = dis->readInt(); dimension = (int)dis->readByte(); - mapHeight = (int)dis->readByte(); - maxPlayers = (int)dis->readByte(); + mapHeight = static_cast(dis->readByte()); + maxPlayers = static_cast(dis->readByte()); m_offlineXuid = dis->readPlayerUID(); m_onlineXuid = dis->readPlayerUID(); m_friendsOnlyUGC = dis->readBoolean(); - m_ugcPlayersVersion = dis->readInt(); + int ugcPlayersVersion = dis->readInt(); + std::memcpy(&m_ugcPlayersVersion, &ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); difficulty = (int)dis->readByte(); m_multiplayerInstanceId = dis->readInt(); - m_playerIndex = (int)dis->readByte(); - INT skinId = dis->readInt(); - m_playerSkinId = *(DWORD *)&skinId; - INT capeId = dis->readInt(); - m_playerCapeId = *(DWORD *)&capeId; + m_playerIndex = static_cast(dis->readByte()); + int skinId = dis->readInt(); + std::memcpy(&m_playerSkinId, &skinId, sizeof(m_playerSkinId)); + int capeId = dis->readInt(); + std::memcpy(&m_playerCapeId, &capeId, sizeof(m_playerCapeId)); m_isGuest = dis->readBoolean(); m_newSeaLevel = dis->readBoolean(); m_uiGamePrivileges = dis->readInt(); @@ -150,12 +152,18 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException dos->writePlayerUID(m_offlineXuid); dos->writePlayerUID(m_onlineXuid); dos->writeBoolean(m_friendsOnlyUGC); - dos->writeInt(m_ugcPlayersVersion); + int ugcPlayersVersion = 0; + std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); + dos->writeInt(ugcPlayersVersion); dos->writeByte((uint8_t)difficulty); dos->writeInt(m_multiplayerInstanceId); dos->writeByte((uint8_t)m_playerIndex); - dos->writeInt(m_playerSkinId); - dos->writeInt(m_playerCapeId); + int skinId = 0; + std::memcpy(&skinId, &m_playerSkinId, sizeof(m_playerSkinId)); + dos->writeInt(skinId); + int capeId = 0; + std::memcpy(&capeId, &m_playerCapeId, sizeof(m_playerCapeId)); + dos->writeInt(capeId); dos->writeBoolean(m_isGuest); dos->writeBoolean(m_newSeaLevel); dos->writeInt(m_uiGamePrivileges); @@ -178,5 +186,5 @@ int LoginPacket::getEstimatedSize() length = (int)m_pLevelType->getGeneratorName().length(); } - return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(__int64) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int)); + return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(__int64) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) + 1 + sizeof(char) + sizeof(std::uint8_t) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int)); } diff --git a/Minecraft.World/Network/Packets/LoginPacket.h b/Minecraft.World/Network/Packets/LoginPacket.h index d0bfb030a..b6f14816a 100644 --- a/Minecraft.World/Network/Packets/LoginPacket.h +++ b/Minecraft.World/Network/Packets/LoginPacket.h @@ -1,5 +1,6 @@ #pragma once +#include #include "Packet.h" class LevelType; @@ -14,10 +15,10 @@ public: PlayerUID m_offlineXuid, m_onlineXuid; // 4J Added char difficulty; // 4J Added bool m_friendsOnlyUGC; // 4J Added - DWORD m_ugcPlayersVersion; // 4J Added - INT m_multiplayerInstanceId; //4J Added for sentient - BYTE m_playerIndex; // 4J Added - DWORD m_playerSkinId, m_playerCapeId; // 4J Added + std::uint32_t m_ugcPlayersVersion; // 4J Added + int m_multiplayerInstanceId; //4J Added for sentient + std::uint8_t m_playerIndex; // 4J Added + std::uint32_t m_playerSkinId, m_playerCapeId; // 4J Added bool m_isGuest; // 4J Added bool m_newSeaLevel; // 4J Added LevelType *m_pLevelType; @@ -27,12 +28,12 @@ public: // 1.8.2 int gameType; - BYTE mapHeight; - BYTE maxPlayers; + std::uint8_t mapHeight; + std::uint8_t maxPlayers; LoginPacket(); - LoginPacket(const std::wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT m_multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client - LoginPacket(const std::wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest); // Client -> Server + LoginPacket(const std::wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, std::uint8_t mapHeight, std::uint8_t maxPlayers, char difficulty, int m_multiplayerInstanceId, std::uint8_t playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client + LoginPacket(const std::wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, std::uint32_t ugcPlayersVersion, std::uint32_t skinId, std::uint32_t capeId, bool isGuest); // Client -> Server virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); From 3f374cecad37fce5990e6328721d5ce751fecdde Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:25:29 +1100 Subject: [PATCH 034/192] Remove DWORD skin IDs from player customisation APIs --- Minecraft.Client/Player/LocalPlayer.cpp | 5 ++--- Minecraft.Client/Player/LocalPlayer.h | 5 +++-- .../Player/MultiPlayerLocalPlayer.cpp | 8 ++++---- .../Player/MultiPlayerLocalPlayer.h | 5 +++-- Minecraft.World/Player/Player.cpp | 20 +++++++++---------- Minecraft.World/Player/Player.h | 17 ++++++++-------- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Minecraft.Client/Player/LocalPlayer.cpp b/Minecraft.Client/Player/LocalPlayer.cpp index dee185522..7d0e68ddc 100644 --- a/Minecraft.Client/Player/LocalPlayer.cpp +++ b/Minecraft.Client/Player/LocalPlayer.cpp @@ -1139,12 +1139,12 @@ void LocalPlayer::onCrafted(std::shared_ptr item) } } -void LocalPlayer::setAndBroadcastCustomSkin(DWORD skinId) +void LocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { setCustomSkin(skinId); } -void LocalPlayer::setAndBroadcastCustomCape(DWORD capeId) +void LocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { setCustomCape(capeId); } @@ -1613,4 +1613,3 @@ void LocalPlayer::SetPlayerAdditionalModelParts(std::vectorpAdditio { m_pAdditionalModelParts=pAdditionalModelParts; } - diff --git a/Minecraft.Client/Player/LocalPlayer.h b/Minecraft.Client/Player/LocalPlayer.h index 3a70bd4b6..cb8b5dfa1 100644 --- a/Minecraft.Client/Player/LocalPlayer.h +++ b/Minecraft.Client/Player/LocalPlayer.h @@ -1,4 +1,5 @@ #pragma once +#include #include "../../Minecraft.World/Util/SmoothFloat.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../../Minecraft.World/Util/Pos.h" @@ -161,8 +162,8 @@ public: // 4J Stu - Added to allow callback to tutorial to stay within Minecraft.Client virtual void onCrafted(std::shared_ptr item); - virtual void setAndBroadcastCustomSkin(DWORD skinId); - virtual void setAndBroadcastCustomCape(DWORD capeId); + virtual void setAndBroadcastCustomSkin(std::uint32_t skinId); + virtual void setAndBroadcastCustomCape(std::uint32_t capeId); private: bool isSolidBlock(int x, int y, int z); diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp index 2f6fae0e1..47ae79e61 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp @@ -348,9 +348,9 @@ void MultiplayerLocalPlayer::StopSleeping() } // 4J Added -void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId) +void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { - DWORD oldSkinIndex = getCustomSkin(); + std::uint32_t oldSkinIndex = getCustomSkin(); LocalPlayer::setCustomSkin(skinId); #ifndef _CONTENT_PACKAGE wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() ); @@ -358,9 +358,9 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId) if(getCustomSkin() != oldSkinIndex) connection->send( std::shared_ptr( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) ); } -void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId) +void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { - DWORD oldCapeIndex = getCustomCape(); + std::uint32_t oldCapeIndex = getCustomCape(); LocalPlayer::setCustomCape(capeId); #ifndef _CONTENT_PACKAGE wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str()); diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h index 54c6001da..ea66686c0 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h @@ -1,4 +1,5 @@ #pragma once +#include #include "LocalPlayer.h" #include "../../Minecraft.World/Util/SharedConstants.h" @@ -68,6 +69,6 @@ public: virtual void StopSleeping(); // 4J Added - virtual void setAndBroadcastCustomSkin(DWORD skinId); - virtual void setAndBroadcastCustomCape(DWORD capeId); + virtual void setAndBroadcastCustomSkin(std::uint32_t skinId); + virtual void setAndBroadcastCustomCape(std::uint32_t capeId); }; diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index 0c8005ad4..d842e6ea5 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -620,7 +620,7 @@ void Player::setPlayerDefaultSkin(EDefaultSkins skin) m_skinIndex = skin; } -void Player::setCustomSkin(DWORD skinId) +void Player::setCustomSkin(std::uint32_t skinId) { #ifndef _CONTENT_PACKAGE wprintf(L"Attempting to set skin to %08X for player %ls\n", skinId, name.c_str() ); @@ -634,8 +634,8 @@ void Player::setCustomSkin(DWORD skinId) if( !GET_IS_DLC_SKIN_FROM_BITMASK(skinId) ) { // GET_UGC_SKIN_ID_FROM_BITMASK will always be zero - this was for a possible custom skin editor skin - DWORD ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); - DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); + std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); + std::uint32_t defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); if( ugcSkinIndex == 0 && defaultSkinIndex > 0 ) { playerSkin = (EDefaultSkins) defaultSkinIndex; @@ -699,7 +699,7 @@ void Player::setCustomSkin(DWORD skinId) } -unsigned int Player::getSkinAnimOverrideBitmask(DWORD skinId) +unsigned int Player::getSkinAnimOverrideBitmask(std::uint32_t skinId) { unsigned long bitmask = 0L; if( GET_IS_DLC_SKIN_FROM_BITMASK(skinId) ) @@ -751,7 +751,7 @@ void Player::setXuid(PlayerUID xuid) #endif } -void Player::setCustomCape(DWORD capeId) +void Player::setCustomCape(std::uint32_t capeId) { #ifndef _CONTENT_PACKAGE wprintf(L"Attempting to set cape to %08X for player %s\n", capeId, name.c_str() ); @@ -801,10 +801,10 @@ void Player::setCustomCape(DWORD capeId) } } -DWORD Player::getCapeIdFromPath(const std::wstring &cape) +std::uint32_t Player::getCapeIdFromPath(const std::wstring &cape) { bool dlcCape = false; - unsigned int capeId = 0; + std::uint32_t capeId = 0; if(cape.size() >= 14) { @@ -827,7 +827,7 @@ DWORD Player::getCapeIdFromPath(const std::wstring &cape) return capeId; } -std::wstring Player::getCapePathFromId(DWORD capeId) +std::wstring Player::getCapePathFromId(std::uint32_t capeId) { // 4J Stu - This function maps the encoded DWORD we store in the player profile // to a filename that is stored as a memory texture and shared between systems in game @@ -840,8 +840,8 @@ std::wstring Player::getCapePathFromId(DWORD capeId) } else { - DWORD ugcCapeIndex = GET_UGC_SKIN_ID_FROM_BITMASK(capeId); - DWORD defaultCapeIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(capeId); + std::uint32_t ugcCapeIndex = GET_UGC_SKIN_ID_FROM_BITMASK(capeId); + std::uint32_t defaultCapeIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(capeId); if( ugcCapeIndex == 0 ) { swprintf(chars,256,L"defcape%08X.png",defaultCapeIndex); diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index 55159386c..408b33f6a 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -1,5 +1,6 @@ #pragma once +#include #include "../Entities/Mob.h" #include "../Util/Definitions.h" @@ -396,14 +397,14 @@ public: virtual int getTexture(); // 4J changed from std::wstring to int void setPlayerDefaultSkin(EDefaultSkins skin); EDefaultSkins getPlayerDefaultSkin() { return m_skinIndex; } - virtual void setCustomSkin(DWORD skinId); - DWORD getCustomSkin() {return m_dwSkinId; } - virtual void setCustomCape(DWORD capeId); - DWORD getCustomCape() {return m_dwCapeId; } + virtual void setCustomSkin(std::uint32_t skinId); + std::uint32_t getCustomSkin() {return m_dwSkinId; } + virtual void setCustomCape(std::uint32_t capeId); + std::uint32_t getCustomCape() {return m_dwCapeId; } - static DWORD getCapeIdFromPath(const std::wstring &cape); - static std::wstring getCapePathFromId(DWORD capeId); - static unsigned int getSkinAnimOverrideBitmask(DWORD skinId); + static std::uint32_t getCapeIdFromPath(const std::wstring &cape); + static std::wstring getCapePathFromId(std::uint32_t capeId); + static unsigned int getSkinAnimOverrideBitmask(std::uint32_t skinId); // 4J Added void setXuid(PlayerUID xuid); @@ -436,7 +437,7 @@ protected: private: EDefaultSkins m_skinIndex; - DWORD m_dwSkinId,m_dwCapeId; + std::uint32_t m_dwSkinId,m_dwCapeId; // 4J Added - Used to show which colour the player is on the map/behind their name DWORD m_playerIndex; From b1de3b90656d92ce63de976d685c04d5e4cc18d2 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:27:27 +1100 Subject: [PATCH 035/192] Remove DWORD player indices from player state --- Minecraft.Client/Network/PlayerList.cpp | 7 ++++--- Minecraft.World/Player/Player.h | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index 7299f00a3..c26079a16 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -1,4 +1,5 @@ #include "../Platform/stdafx.h" +#include #include "PlayerList.h" #include "PlayerChunkMap.h" #include "../MinecraftServer.h" @@ -105,7 +106,7 @@ void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptrgetLevel(player->dimension); - DWORD playerIndex = 0; + std::uint8_t playerIndex = 0; { bool usedIndexes[MINECRAFT_NET_MAX_PLAYERS]; ZeroMemory( &usedIndexes, MINECRAFT_NET_MAX_PLAYERS * sizeof(bool) ); @@ -211,7 +212,7 @@ void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptrsend( std::shared_ptr( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), (uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(), - level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), + level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) ); playerConnection->send( std::shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); playerConnection->send( std::shared_ptr( new PlayerAbilitiesPacket(&player->abilities)) ); @@ -535,7 +536,7 @@ std::shared_ptr PlayerList::respawn(std::shared_ptr serverPlayer->dimension = targetDimension; EDefaultSkins skin = serverPlayer->getPlayerDefaultSkin(); - DWORD playerIndex = serverPlayer->getPlayerIndex(); + std::uint8_t playerIndex = serverPlayer->getPlayerIndex(); PlayerUID playerXuid = serverPlayer->getXuid(); PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid(); diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index 408b33f6a..dfd125601 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -414,8 +414,8 @@ public: void setUUID(const std::wstring &UUID) { m_UUID = UUID; } std::wstring getUUID() { return m_UUID; } - void setPlayerIndex(DWORD dwIndex) { m_playerIndex = dwIndex; } - DWORD getPlayerIndex() { return m_playerIndex; } + void setPlayerIndex(std::uint8_t index) { m_playerIndex = index; } + std::uint8_t getPlayerIndex() { return m_playerIndex; } void setIsGuest(bool bVal) { m_bIsGuest = bVal; } bool isGuest() { return m_bIsGuest; } @@ -440,7 +440,7 @@ private: std::uint32_t m_dwSkinId,m_dwCapeId; // 4J Added - Used to show which colour the player is on the map/behind their name - DWORD m_playerIndex; + std::uint8_t m_playerIndex; // 4J-PB - to track debug options from the server player unsigned int m_uiDebugOptions; From 990d3a998630d00e048f0a2dfa1922613d651982 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:29:06 +1100 Subject: [PATCH 036/192] Remove BYTE from player user types --- Minecraft.World/Player/Player.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index dfd125601..04cce224b 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -65,7 +65,7 @@ protected: int jumpTriggerTime; public: - BYTE userType; + std::uint8_t userType; int score; float oBob, bob; bool swinging; From d0410440008c3868673e1e7fbf45d74c095b28a8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:31:09 +1100 Subject: [PATCH 037/192] Remove BYTE from network player IDs --- Minecraft.Client/Network/PlayerList.cpp | 8 ++++---- Minecraft.Client/Network/PlayerList.h | 9 +++++---- Minecraft.World/Network/Packets/KickPlayerPacket.cpp | 4 ++-- Minecraft.World/Network/Packets/KickPlayerPacket.h | 7 ++++--- Minecraft.World/Network/Packets/PlayerInfoPacket.cpp | 4 ++-- Minecraft.World/Network/Packets/PlayerInfoPacket.h | 7 ++++--- Minecraft.World/Network/Socket.h | 5 +++-- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index c26079a16..e56efca60 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -847,7 +847,7 @@ void PlayerList::tick() EnterCriticalSection(&m_closePlayersCS); while(!m_smallIdsToClose.empty()) { - BYTE smallId = m_smallIdsToClose.front(); + std::uint8_t smallId = m_smallIdsToClose.front(); m_smallIdsToClose.pop_front(); std::shared_ptr player = nullptr; @@ -873,7 +873,7 @@ void PlayerList::tick() EnterCriticalSection(&m_kickPlayersCS); while(!m_smallIdsToKick.empty()) { - BYTE smallId = m_smallIdsToKick.front(); + std::uint8_t smallId = m_smallIdsToKick.front(); m_smallIdsToKick.pop_front(); INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(smallId); if( selectedPlayer != NULL ) @@ -1416,14 +1416,14 @@ bool PlayerList::canReceiveAllPackets(std::shared_ptr player) return false; } -void PlayerList::kickPlayerByShortId(BYTE networkSmallId) +void PlayerList::kickPlayerByShortId(std::uint8_t networkSmallId) { EnterCriticalSection(&m_kickPlayersCS); m_smallIdsToKick.push_back(networkSmallId); LeaveCriticalSection(&m_kickPlayersCS); } -void PlayerList::closePlayerConnectionBySmallId(BYTE networkSmallId) +void PlayerList::closePlayerConnectionBySmallId(std::uint8_t networkSmallId) { EnterCriticalSection(&m_closePlayersCS); m_smallIdsToClose.push_back(networkSmallId); diff --git a/Minecraft.Client/Network/PlayerList.h b/Minecraft.Client/Network/PlayerList.h index 1c5bebfc5..50a00ea91 100644 --- a/Minecraft.Client/Network/PlayerList.h +++ b/Minecraft.Client/Network/PlayerList.h @@ -1,4 +1,5 @@ #pragma once +#include #include #include "../../Minecraft.World/Util/ArrayWithLength.h" @@ -30,9 +31,9 @@ private: // 4J Added std::vector m_bannedXuids; - std::deque m_smallIdsToKick; + std::deque m_smallIdsToKick; CRITICAL_SECTION m_kickPlayersCS; - std::deque m_smallIdsToClose; + std::deque m_smallIdsToClose; CRITICAL_SECTION m_closePlayersCS; /* 4J - removed Set bans = new HashSet(); @@ -119,8 +120,8 @@ public: void setAllowCheatsForAllPlayers(bool allowCommands); // 4J Added - void kickPlayerByShortId(BYTE networkSmallId); - void closePlayerConnectionBySmallId(BYTE networkSmallId); + void kickPlayerByShortId(std::uint8_t networkSmallId); + void closePlayerConnectionBySmallId(std::uint8_t networkSmallId); bool isXuidBanned(PlayerUID xuid); // AP added for Vita so the range can be increased once the level starts void setViewDistance(int newViewDistance); diff --git a/Minecraft.World/Network/Packets/KickPlayerPacket.cpp b/Minecraft.World/Network/Packets/KickPlayerPacket.cpp index 502fd6b86..fcbdce6bc 100644 --- a/Minecraft.World/Network/Packets/KickPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/KickPlayerPacket.cpp @@ -11,7 +11,7 @@ KickPlayerPacket::KickPlayerPacket() m_networkSmallId = 0; } -KickPlayerPacket::KickPlayerPacket(BYTE networkSmallId) +KickPlayerPacket::KickPlayerPacket(std::uint8_t networkSmallId) { m_networkSmallId = networkSmallId; } @@ -23,7 +23,7 @@ void KickPlayerPacket::handle(PacketListener *listener) void KickPlayerPacket::read(DataInputStream *dis) //throws IOException { - m_networkSmallId = (int)dis->readByte(); + m_networkSmallId = static_cast(dis->readByte()); } void KickPlayerPacket::write(DataOutputStream *dos) //throws IOException diff --git a/Minecraft.World/Network/Packets/KickPlayerPacket.h b/Minecraft.World/Network/Packets/KickPlayerPacket.h index 37e4655c5..30c04b4c6 100644 --- a/Minecraft.World/Network/Packets/KickPlayerPacket.h +++ b/Minecraft.World/Network/Packets/KickPlayerPacket.h @@ -1,15 +1,16 @@ #pragma once +#include #include "Packet.h" class KickPlayerPacket : public Packet, public std::enable_shared_from_this { public: - BYTE m_networkSmallId; + std::uint8_t m_networkSmallId; KickPlayerPacket(); - KickPlayerPacket(BYTE networkSmallId); + KickPlayerPacket(std::uint8_t networkSmallId); virtual void handle(PacketListener *listener); virtual void read(DataInputStream *dis); @@ -19,4 +20,4 @@ public: public: static std::shared_ptr create() { return std::shared_ptr(new KickPlayerPacket()); } virtual int getId() { return 159; } -}; \ No newline at end of file +}; diff --git a/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp b/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp index 4b9056386..020c9e739 100644 --- a/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp +++ b/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp @@ -19,7 +19,7 @@ PlayerInfoPacket::PlayerInfoPacket() m_entityId = -1; } -PlayerInfoPacket::PlayerInfoPacket(BYTE networkSmallId, short playerColourIndex, unsigned int playerPrivileges) +PlayerInfoPacket::PlayerInfoPacket(std::uint8_t networkSmallId, short playerColourIndex, unsigned int playerPrivileges) { m_networkSmallId = networkSmallId; m_playerColourIndex = playerColourIndex; @@ -38,7 +38,7 @@ PlayerInfoPacket::PlayerInfoPacket(std::shared_ptr player) void PlayerInfoPacket::read(DataInputStream *dis) { - m_networkSmallId = dis->readByte(); + m_networkSmallId = static_cast(dis->readByte()); m_playerColourIndex = dis->readShort(); m_playerPrivileges = dis->readInt(); m_entityId = dis->readInt(); diff --git a/Minecraft.World/Network/Packets/PlayerInfoPacket.h b/Minecraft.World/Network/Packets/PlayerInfoPacket.h index fd4c83451..0c98036df 100644 --- a/Minecraft.World/Network/Packets/PlayerInfoPacket.h +++ b/Minecraft.World/Network/Packets/PlayerInfoPacket.h @@ -1,4 +1,5 @@ #pragma once +#include #include "Packet.h" @@ -11,14 +12,14 @@ class PlayerInfoPacket : public Packet, public std::enable_shared_from_this player); virtual void read(DataInputStream *dis); @@ -29,4 +30,4 @@ class PlayerInfoPacket : public Packet, public std::enable_shared_from_this create() { return std::shared_ptr(new PlayerInfoPacket()); } virtual int getId() { return 201; } -}; \ No newline at end of file +}; diff --git a/Minecraft.World/Network/Socket.h b/Minecraft.World/Network/Socket.h index 659967e1a..082274c23 100644 --- a/Minecraft.World/Network/Socket.h +++ b/Minecraft.World/Network/Socket.h @@ -1,4 +1,5 @@ #pragma once +#include #ifndef __linux__ #include #include @@ -109,7 +110,7 @@ private: // Host only connection class static ServerConnection *s_serverConnection; - BYTE networkPlayerSmallId; + std::uint8_t networkPlayerSmallId; public: C4JThread::Event* m_socketClosedEvent; @@ -133,5 +134,5 @@ public: bool isLocal() { return m_hostLocal; } bool isClosing() { return m_endClosed[SOCKET_CLIENT_END] || m_endClosed[SOCKET_SERVER_END]; } - BYTE getSmallId() { return networkPlayerSmallId; } + std::uint8_t getSmallId() { return networkPlayerSmallId; } }; From 3aeb023869c2dde7c2c70b7e0d392200fd670519 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:46:02 +1100 Subject: [PATCH 038/192] Remove Win32 types from prelogin packets --- .../Network/PendingConnection.cpp | 9 ++--- .../Network/Packets/PreLoginPacket.cpp | 34 +++++++++++-------- .../Network/Packets/PreLoginPacket.h | 16 ++++----- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Minecraft.Client/Network/PendingConnection.cpp b/Minecraft.Client/Network/PendingConnection.cpp index dec6b1f15..80bc0f043 100644 --- a/Minecraft.Client/Network/PendingConnection.cpp +++ b/Minecraft.Client/Network/PendingConnection.cpp @@ -1,4 +1,5 @@ #include "../Platform/stdafx.h" +#include #include "PendingConnection.h" #include "PlayerConnection.h" #include "ServerConnection.h" @@ -94,9 +95,9 @@ void PendingConnection::sendPreLoginResponse() { // 4J Stu - Calculate the players with UGC privileges set PlayerUID *ugcXuids = new PlayerUID[MINECRAFT_NET_MAX_PLAYERS]; - DWORD ugcXuidCount = 0; - DWORD hostIndex = 0; - BYTE ugcFriendsOnlyBits = 0; + std::uint8_t ugcXuidCount = 0; + std::uint8_t hostIndex = 0; + std::uint8_t ugcFriendsOnlyBits = 0; char szUniqueMapName[14]; StorageManager.GetSaveUniqueFilename(szUniqueMapName); @@ -267,4 +268,4 @@ std::wstring PendingConnection::getName() bool PendingConnection::isServerPacketListener() { return true; -} \ No newline at end of file +} diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.cpp b/Minecraft.World/Network/Packets/PreLoginPacket.cpp index 8c51cd463..030c3e88e 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.cpp +++ b/Minecraft.World/Network/Packets/PreLoginPacket.cpp @@ -34,7 +34,7 @@ PreLoginPacket::PreLoginPacket(std::wstring userName) m_netcodeVersion = 0; } -PreLoginPacket::PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, std::uint32_t texturePackId) +PreLoginPacket::PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, std::uint8_t playerCount, std::uint8_t friendsOnlyBits, std::uint32_t ugcPlayersVersion, const char *pszUniqueSaveName, std::uint32_t serverSettings, std::uint8_t hostIndex, std::uint32_t texturePackId) { this->loginKey = userName; m_playerXuids = playerXuids; @@ -59,23 +59,25 @@ void PreLoginPacket::read(DataInputStream *dis) //throws IOException loginKey = readUtf(dis, 32); - m_friendsOnlyBits = dis->readByte(); - m_ugcPlayersVersion = dis->readInt(); - m_dwPlayerCount = dis->readByte(); + m_friendsOnlyBits = static_cast(dis->readByte()); + std::int32_t ugcPlayersVersion = dis->readInt(); + std::memcpy(&m_ugcPlayersVersion, &ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); + m_dwPlayerCount = static_cast(dis->readByte()); if( m_dwPlayerCount > 0 ) { m_playerXuids = new PlayerUID[m_dwPlayerCount]; - for(DWORD i = 0; i < m_dwPlayerCount; ++i) + for(std::uint32_t i = 0; i < m_dwPlayerCount; ++i) { m_playerXuids[i] = dis->readPlayerUID(); } } - for(DWORD i = 0; i < m_iSaveNameLen; ++i) + for(int i = 0; i < m_iSaveNameLen; ++i) { - m_szUniqueSaveName[i]=dis->readByte(); + m_szUniqueSaveName[i] = static_cast(dis->readByte()); } - m_serverSettings = dis->readInt(); - m_hostIndex = dis->readByte(); + std::int32_t serverSettings = dis->readInt(); + std::memcpy(&m_serverSettings, &serverSettings, sizeof(m_serverSettings)); + m_hostIndex = static_cast(dis->readByte()); std::int32_t texturePackId = dis->readInt(); std::memcpy(&m_texturePackId, &texturePackId, sizeof(m_texturePackId)); @@ -91,19 +93,23 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException writeUtf(loginKey, dos); dos->writeByte(m_friendsOnlyBits); - dos->writeInt(m_ugcPlayersVersion); + std::int32_t ugcPlayersVersion = 0; + std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); + dos->writeInt(ugcPlayersVersion); dos->writeByte((uint8_t)m_dwPlayerCount); - for(DWORD i = 0; i < m_dwPlayerCount; ++i) + for(std::uint32_t i = 0; i < m_dwPlayerCount; ++i) { dos->writePlayerUID( m_playerXuids[i] ); } app.DebugPrintf("*** PreLoginPacket::write - %s\n",m_szUniqueSaveName); - for(DWORD i = 0; i < m_iSaveNameLen; ++i) + for(int i = 0; i < m_iSaveNameLen; ++i) { - dos->writeByte(m_szUniqueSaveName[i]); + dos->writeByte(static_cast(m_szUniqueSaveName[i])); } - dos->writeInt(m_serverSettings); + std::int32_t serverSettings = 0; + std::memcpy(&serverSettings, &m_serverSettings, sizeof(m_serverSettings)); + dos->writeInt(serverSettings); dos->writeByte(m_hostIndex); std::int32_t texturePackId = 0; std::memcpy(&texturePackId, &m_texturePackId, sizeof(texturePackId)); diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.h b/Minecraft.World/Network/Packets/PreLoginPacket.h index ea3c34758..637cb34dd 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.h +++ b/Minecraft.World/Network/Packets/PreLoginPacket.h @@ -13,20 +13,20 @@ public: // join, and so that we can inform the server if we have that privilege set. Anyone with UGC turned off completely // can't play the game online at all, so we only need to specify players with friends only set PlayerUID *m_playerXuids; - DWORD m_dwPlayerCount; - BYTE m_friendsOnlyBits; - DWORD m_ugcPlayersVersion; - BYTE m_szUniqueSaveName[m_iSaveNameLen]; // added for checking if the level is in the ban list - DWORD m_serverSettings; // A bitfield of server settings constructed with the MAKE_SERVER_SETTINGS macro - BYTE m_hostIndex; // Rather than sending the xuid of the host again, send an index into the m_playerXuids array + std::uint8_t m_dwPlayerCount; + std::uint8_t m_friendsOnlyBits; + std::uint32_t m_ugcPlayersVersion; + char m_szUniqueSaveName[m_iSaveNameLen]; // added for checking if the level is in the ban list + std::uint32_t m_serverSettings; // A bitfield of server settings constructed with the MAKE_SERVER_SETTINGS macro + std::uint8_t m_hostIndex; // Rather than sending the xuid of the host again, send an index into the m_playerXuids array std::uint32_t m_texturePackId; - SHORT m_netcodeVersion; + std::int16_t m_netcodeVersion; std::wstring loginKey; PreLoginPacket(); PreLoginPacket(std::wstring userName); - PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, DWORD playerCount, BYTE friendsOnlyBits, DWORD ugcPlayersVersion,char *pszUniqueSaveName, DWORD serverSettings, BYTE hostIndex, std::uint32_t texturePackId); + PreLoginPacket(std::wstring userName, PlayerUID *playerXuids, std::uint8_t playerCount, std::uint8_t friendsOnlyBits, std::uint32_t ugcPlayersVersion, const char *pszUniqueSaveName, std::uint32_t serverSettings, std::uint8_t hostIndex, std::uint32_t texturePackId); ~PreLoginPacket(); virtual void read(DataInputStream *dis); From 238bf98cadb6bdb254d353acf4b2006b272fd8ee Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:48:32 +1100 Subject: [PATCH 039/192] Remove DWORD from server UGC version state --- Minecraft.Client/MinecraftServer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 07be02ac7..6db0b2fc5 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -117,7 +117,7 @@ private: public: // 4J Stu - This value should be incremented every time the list of players with friends-only UGC settings changes // It is sent with PreLoginPacket and compared when it comes back in the LoginPacket - DWORD m_ugcPlayersVersion; + std::uint32_t m_ugcPlayersVersion; // This value is used to store the texture pack id for the currently loaded world std::uint32_t m_texturePackId; From c247f918f1e6d3354dfda9e542fa362e00acf668 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:50:07 +1100 Subject: [PATCH 040/192] Remove DWORD from server init settings --- Minecraft.Client/MinecraftServer.cpp | 6 +++--- Minecraft.Client/MinecraftServer.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index c20b35a10..6bcd72d49 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -99,7 +99,7 @@ MinecraftServer::~MinecraftServer() { } -bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed) +bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, std::uint32_t initSettings, bool findSeed) { // 4J - removed #if 0 @@ -1060,7 +1060,7 @@ extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b; void MinecraftServer::run(__int64 seed, void *lpParameter) { NetworkGameInitData *initData = NULL; - DWORD initSettings = 0; + std::uint32_t initSettings = 0; bool findSeed = false; if(lpParameter != NULL) { @@ -1695,4 +1695,4 @@ bool MinecraftServer::flagEntitiesToBeRemoved(unsigned int *flags) } } return removedFound; -} \ No newline at end of file +} diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 6db0b2fc5..057ddbd38 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -34,7 +34,7 @@ typedef struct _NetworkGameInitData { __int64 seed; LoadSaveDataThreadParam *saveData; - DWORD settings; + std::uint32_t settings; LevelGenerationOptions *levelGen; std::uint32_t texturePackId; bool findSeed; @@ -127,7 +127,7 @@ public: ~MinecraftServer(); private: // 4J Added - LoadSaveDataThreadParam - bool initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed); + bool initServer(__int64 seed, NetworkGameInitData *initData, std::uint32_t initSettings, bool findSeed); void postProcessTerminate(ProgressRenderer *mcprogress); bool loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData); void setProgress(const std::wstring& status, int progress); From 97d12ae2d8c7a134b2875c43b72b2c57951a2a36 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:51:28 +1100 Subject: [PATCH 041/192] Remove LPVOID from save data thread params --- Minecraft.Client/MinecraftServer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 057ddbd38..4e9fd5895 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -24,10 +24,10 @@ class CommandDispatcher; typedef struct _LoadSaveDataThreadParam { - LPVOID data; + void *data; __int64 fileSize; const std::wstring saveName; - _LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const std::wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {} + _LoadSaveDataThreadParam(void *data, __int64 filesize, const std::wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {} } LoadSaveDataThreadParam; typedef struct _NetworkGameInitData From 3da761347f7135366da859c98bc82962df44d3bb Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:53:04 +1100 Subject: [PATCH 042/192] Remove BYTE from mob effect packets --- Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp | 4 ++-- Minecraft.World/Network/Packets/UpdateMobEffectPacket.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp index 56873ac80..443c24c56 100644 --- a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp +++ b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.cpp @@ -17,7 +17,7 @@ UpdateMobEffectPacket::UpdateMobEffectPacket() UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId, MobEffectInstance *effect) { this->entityId = entityId; - this->effectId = (BYTE) (effect->getId() & 0xff); + this->effectId = static_cast(effect->getId() & 0xff); this->effectAmplifier = (char) (effect->getAmplifier() & 0xff); this->effectDurationTicks = (short) effect->getDuration(); } @@ -57,4 +57,4 @@ bool UpdateMobEffectPacket::isInvalidatedBy(std::shared_ptr packet) { std::shared_ptr target = std::dynamic_pointer_cast(packet); return target->entityId == entityId && target->effectId == effectId; -} \ No newline at end of file +} diff --git a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h index 0eeed4dc1..d8d6c879e 100644 --- a/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h +++ b/Minecraft.World/Network/Packets/UpdateMobEffectPacket.h @@ -1,4 +1,5 @@ #pragma once +#include #include "Packet.h" @@ -8,7 +9,7 @@ class UpdateMobEffectPacket : public Packet, public std::enable_shared_from_this { public: int entityId; - BYTE effectId; + std::uint8_t effectId; char effectAmplifier; short effectDurationTicks; @@ -25,4 +26,4 @@ public: public: static std::shared_ptr create() { return std::shared_ptr(new UpdateMobEffectPacket()); } virtual int getId() { return 41; } -}; \ No newline at end of file +}; From 5d72f9214ae74a058be5c7aca0b340a883403e75 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 07:53:55 +1100 Subject: [PATCH 043/192] Remove DWORD from client connection user index --- Minecraft.Client/Network/ClientConnection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.h b/Minecraft.Client/Network/ClientConnection.h index 1f0aae762..f901e98fa 100644 --- a/Minecraft.Client/Network/ClientConnection.h +++ b/Minecraft.Client/Network/ClientConnection.h @@ -41,7 +41,7 @@ public: Socket *getSocket() { return connection->getSocket(); } // 4J Added private: - DWORD m_userIndex; // 4J Added + int m_userIndex; // 4J Added public: SavedDataStorage *savedDataStorage; ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port); @@ -137,4 +137,4 @@ public: virtual void handleXZ(std::shared_ptr packet); void displayPrivilegeChanges(std::shared_ptr player, unsigned int oldPrivileges); -}; \ No newline at end of file +}; From b59ab4a4b8a97b9f0bbb5ceb1fa041dc3fb48c4f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:33:47 +1100 Subject: [PATCH 044/192] Remove LPVOID from server chunk save threads --- Minecraft.Client/Network/ServerChunkCache.cpp | 4 ++-- Minecraft.Client/Network/ServerChunkCache.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index c82e26a81..b479f49b2 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -912,9 +912,9 @@ TilePos *ServerChunkCache::findNearestMapFeature(Level *level, const std::wstrin return source->findNearestMapFeature(level, featureName, x, y, z); } -int ServerChunkCache::runSaveThreadProc(LPVOID lpParam) +int ServerChunkCache::runSaveThreadProc(void *lpParam) { - SaveThreadData *params = (SaveThreadData *)lpParam; + SaveThreadData *params = static_cast(lpParam); if(params->useSharedThreadStorage) { diff --git a/Minecraft.Client/Network/ServerChunkCache.h b/Minecraft.Client/Network/ServerChunkCache.h index e5350771b..e127ccd71 100644 --- a/Minecraft.Client/Network/ServerChunkCache.h +++ b/Minecraft.Client/Network/ServerChunkCache.h @@ -97,5 +97,5 @@ private: } SaveThreadData; public: - static int runSaveThreadProc(LPVOID lpParam); + static int runSaveThreadProc(void *lpParam); }; From 8da27c59addf24626c665de7fc557bc642b4998e Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:34:43 +1100 Subject: [PATCH 045/192] Remove LPVOID from game renderer update thread --- Minecraft.Client/Rendering/GameRenderer.cpp | 2 +- Minecraft.Client/Rendering/GameRenderer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index 3a135655b..be73d7e2c 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -1158,7 +1158,7 @@ void GameRenderer::FinishedReassigning() LeaveCriticalSection(&m_csDeleteStack); } -int GameRenderer::runUpdate(LPVOID lpParam) +int GameRenderer::runUpdate(void *lpParam) { Minecraft *minecraft = Minecraft::GetInstance(); Vec3::CreateNewThreadStorage(); diff --git a/Minecraft.Client/Rendering/GameRenderer.h b/Minecraft.Client/Rendering/GameRenderer.h index 5026704bb..57c32f696 100644 --- a/Minecraft.Client/Rendering/GameRenderer.h +++ b/Minecraft.Client/Rendering/GameRenderer.h @@ -145,7 +145,7 @@ public: #ifdef MULTITHREAD_ENABLE static C4JThread* m_updateThread; - static int runUpdate(LPVOID lpParam); + static int runUpdate(void *lpParam); static C4JThread::EventArray* m_updateEvents; enum EUpdateEvents { From 529ecb8185610cc471bbe8346de2b14bd9860840 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:35:28 +1100 Subject: [PATCH 046/192] Remove LPVOID from level renderer rebuild threads --- Minecraft.Client/Rendering/LevelRenderer.cpp | 2 +- Minecraft.Client/Rendering/LevelRenderer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index 538529ac4..e1af52093 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -3626,7 +3626,7 @@ void LevelRenderer::staticCtor() } } -int LevelRenderer::rebuildChunkThreadProc(LPVOID lpParam) +int LevelRenderer::rebuildChunkThreadProc(void *lpParam) { Vec3::CreateNewThreadStorage(); AABB::CreateNewThreadStorage(); diff --git a/Minecraft.Client/Rendering/LevelRenderer.h b/Minecraft.Client/Rendering/LevelRenderer.h index 32941711d..65a82d4be 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.h +++ b/Minecraft.Client/Rendering/LevelRenderer.h @@ -271,7 +271,7 @@ public: static C4JThread::EventArray *s_rebuildCompleteEvents; static C4JThread::Event *s_activationEventA[MAX_CHUNK_REBUILD_THREADS]; static void staticCtor(); - static int rebuildChunkThreadProc(LPVOID lpParam); + static int rebuildChunkThreadProc(void *lpParam); CRITICAL_SECTION m_csChunkFlags; #endif From 96a7519f5de7184f74ab0ad5890e4b751f0717fc Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:36:56 +1100 Subject: [PATCH 047/192] Remove DWORD from chunk TLS storage --- Minecraft.Client/Rendering/Chunk.cpp | 2 +- Minecraft.Client/Rendering/Chunk.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index a91477615..cbf5bb4a3 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -20,7 +20,7 @@ int Chunk::updates = 0; #ifdef _LARGE_WORLDS -DWORD Chunk::tlsIdx = TlsAlloc(); +unsigned int Chunk::tlsIdx = TlsAlloc(); void Chunk::CreateNewThreadStorage() { diff --git a/Minecraft.Client/Rendering/Chunk.h b/Minecraft.Client/Rendering/Chunk.h index 787fae4de..efcdfc914 100644 --- a/Minecraft.Client/Rendering/Chunk.h +++ b/Minecraft.Client/Rendering/Chunk.h @@ -32,7 +32,7 @@ private: #ifndef _LARGE_WORLDS static Tesselator *t; #else - static DWORD tlsIdx; + static unsigned int tlsIdx; public: static void CreateNewThreadStorage(); static void ReleaseThreadStorage(); From 344921bb269d4be5ad7b89628836ef77c8f6a9dc Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:37:47 +1100 Subject: [PATCH 048/192] Remove DWORD from tesselator TLS storage --- Minecraft.Client/Rendering/Tesselator.cpp | 4 ++-- Minecraft.Client/Rendering/Tesselator.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Rendering/Tesselator.cpp b/Minecraft.Client/Rendering/Tesselator.cpp index e1c7373b3..f4b12390c 100644 --- a/Minecraft.Client/Rendering/Tesselator.cpp +++ b/Minecraft.Client/Rendering/Tesselator.cpp @@ -24,7 +24,7 @@ int normal; */ -DWORD Tesselator::tlsIdx = TlsAlloc(); +unsigned int Tesselator::tlsIdx = TlsAlloc(); Tesselator *Tesselator::getInstance() { @@ -1080,4 +1080,4 @@ bool Tesselator::hasMaxVertices() #else return false; #endif -} \ No newline at end of file +} diff --git a/Minecraft.Client/Rendering/Tesselator.h b/Minecraft.Client/Rendering/Tesselator.h index 6c0f30a23..59960873c 100644 --- a/Minecraft.Client/Rendering/Tesselator.h +++ b/Minecraft.Client/Rendering/Tesselator.h @@ -38,7 +38,7 @@ private: public: static void CreateNewThreadStorage(int bytes); private: - static DWORD tlsIdx; + static unsigned int tlsIdx; public: static Tesselator *getInstance(); From cc8c956358e9de74f33e7497e1b172e34677491a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:46:48 +1100 Subject: [PATCH 049/192] Use standard byte types in socket queues --- Minecraft.World/Network/Socket.cpp | 6 +++--- Minecraft.World/Network/Socket.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Minecraft.World/Network/Socket.cpp b/Minecraft.World/Network/Socket.cpp index 4f1025b2a..b6d252532 100644 --- a/Minecraft.World/Network/Socket.cpp +++ b/Minecraft.World/Network/Socket.cpp @@ -147,7 +147,7 @@ void Socket::setPlayer(INetworkPlayer *player) } } -void Socket::pushDataToQueue(const BYTE * pbData, DWORD dwDataSize, bool fromHost /*= true*/) +void Socket::pushDataToQueue(const std::uint8_t *pbData, std::size_t dataSize, bool fromHost /*= true*/) { int queueIdx = SOCKET_CLIENT_END; if(!fromHost) @@ -160,7 +160,7 @@ void Socket::pushDataToQueue(const BYTE * pbData, DWORD dwDataSize, bool fromHos } EnterCriticalSection(&m_queueLockNetwork[queueIdx]); - for( unsigned int i = 0; i < dwDataSize; i++ ) + for(std::size_t i = 0; i < dataSize; ++i) { m_queueNetwork[queueIdx].push(*pbData++); } @@ -564,4 +564,4 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int void Socket::SocketOutputStreamNetwork::close() { m_streamOpen = false; -} \ No newline at end of file +} diff --git a/Minecraft.World/Network/Socket.h b/Minecraft.World/Network/Socket.h index 082274c23..aed12b0b7 100644 --- a/Minecraft.World/Network/Socket.h +++ b/Minecraft.World/Network/Socket.h @@ -1,4 +1,5 @@ #pragma once +#include #include #ifndef __linux__ #include @@ -123,7 +124,7 @@ public: Socket(bool response = false); // 4J - Create a local socket, for end 0 or 1 of a connection Socket(INetworkPlayer *player, bool response = false, bool hostLocal = false); // 4J - Create a socket for an INetworkPlayer SocketAddress *getRemoteSocketAddress(); - void pushDataToQueue(const BYTE * pbData, DWORD dwDataSize, bool fromHost = true); + void pushDataToQueue(const std::uint8_t *pbData, std::size_t dataSize, bool fromHost = true); static void addIncomingSocket(Socket *socket); InputStream *getInputStream(bool isServerConnection); void setSoTimeout(int a ); From fb3e4947c67f633265b2bc98f0646796fd95ec0f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:52:07 +1100 Subject: [PATCH 050/192] Remove LPVOID from file header APIs --- Minecraft.World/IO/Files/FileHeader.cpp | 4 ++-- Minecraft.World/IO/Files/FileHeader.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.World/IO/Files/FileHeader.cpp b/Minecraft.World/IO/Files/FileHeader.cpp index 547e0aaa6..056345a1c 100644 --- a/Minecraft.World/IO/Files/FileHeader.cpp +++ b/Minecraft.World/IO/Files/FileHeader.cpp @@ -69,7 +69,7 @@ void FileHeader::RemoveFile( FileEntry *file ) delete file; } -void FileHeader::WriteHeader( LPVOID saveMem ) +void FileHeader::WriteHeader(void *saveMem) { unsigned int headerOffset = GetStartOfNextData(); @@ -137,7 +137,7 @@ void FileHeader::WriteHeader( LPVOID saveMem ) } } -void FileHeader::ReadHeader( LPVOID saveMem, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL */ ) +void FileHeader::ReadHeader(void *saveMem, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL */ ) { unsigned int headerOffset; unsigned int headerSize; diff --git a/Minecraft.World/IO/Files/FileHeader.h b/Minecraft.World/IO/Files/FileHeader.h index 155efaa1c..e7e8c1e4d 100644 --- a/Minecraft.World/IO/Files/FileHeader.h +++ b/Minecraft.World/IO/Files/FileHeader.h @@ -166,8 +166,8 @@ public: protected: FileEntry *AddFile( const std::wstring &name, unsigned int length = 0 ); void RemoveFile( FileEntry * ); - void WriteHeader( LPVOID saveMem ); - void ReadHeader( LPVOID saveMem, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL ); + void WriteHeader(void *saveMem); + void ReadHeader(void *saveMem, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); unsigned int GetStartOfNextData(); From afca2898485a129b444225e5feb5941ba84b69d4 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:53:49 +1100 Subject: [PATCH 051/192] Remove DWORD from compression TLS storage --- Minecraft.World/IO/Streams/Compression.cpp | 2 +- Minecraft.World/IO/Streams/Compression.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.World/IO/Streams/Compression.cpp b/Minecraft.World/IO/Streams/Compression.cpp index c7f2e463a..8e55dcd34 100644 --- a/Minecraft.World/IO/Streams/Compression.cpp +++ b/Minecraft.World/IO/Streams/Compression.cpp @@ -16,7 +16,7 @@ #include "../../../Minecraft.Client/Platform/PS3/PS3Extras/EdgeZLib.h" #endif //__PS3__ -DWORD Compression::tlsIdx = 0; +unsigned int Compression::tlsIdx = 0; Compression::ThreadStorage *Compression::tlsDefault = NULL; Compression::ThreadStorage::ThreadStorage() diff --git a/Minecraft.World/IO/Streams/Compression.h b/Minecraft.World/IO/Streams/Compression.h index 4f81cc784..f76a059af 100644 --- a/Minecraft.World/IO/Streams/Compression.h +++ b/Minecraft.World/IO/Streams/Compression.h @@ -27,7 +27,7 @@ private: ThreadStorage(); ~ThreadStorage(); }; - static DWORD tlsIdx; + static unsigned int tlsIdx; static ThreadStorage *tlsDefault; public: // Each new thread that needs to use Compression will need to call one of the following 2 functions, to either create its own From 32773137e15c5c3c76d23d4845aa68382291314e Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:56:26 +1100 Subject: [PATCH 052/192] Remove VOID from compression helpers --- Minecraft.World/IO/Streams/Compression.cpp | 2 +- Minecraft.World/IO/Streams/Compression.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.World/IO/Streams/Compression.cpp b/Minecraft.World/IO/Streams/Compression.cpp index 8e55dcd34..c38bf096e 100644 --- a/Minecraft.World/IO/Streams/Compression.cpp +++ b/Minecraft.World/IO/Streams/Compression.cpp @@ -354,7 +354,7 @@ HRESULT Compression::Decompress(void *pDestination, unsigned int *pDestSize, voi // MGH - same as VirtualDecompress in PSVitaStubs, but for use on other platforms (so no virtual mem stuff) #ifndef _XBOX -VOID Compression::VitaVirtualDecompress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize) // (LPVOID buf, SIZE_T dwSize, LPVOID dst) +void Compression::VitaVirtualDecompress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize) // (LPVOID buf, SIZE_T dwSize, LPVOID dst) { uint8_t *pSrc = (uint8_t *)pSource; int Offset = 0; diff --git a/Minecraft.World/IO/Streams/Compression.h b/Minecraft.World/IO/Streams/Compression.h index f76a059af..080e2b349 100644 --- a/Minecraft.World/IO/Streams/Compression.h +++ b/Minecraft.World/IO/Streams/Compression.h @@ -46,7 +46,7 @@ public: HRESULT CompressRLE(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize); HRESULT DecompressRLE(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize); #ifndef _XBOX - static VOID VitaVirtualDecompress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize); + static void VitaVirtualDecompress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize); #endif void SetDecompressionType(ECompressionTypes type) { m_decompressType = type; } // for loading a save from a different platform (Sony cloud storage cross play) From 647b3c6352379d64759925a277f6f2aa4aa15bf6 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:57:44 +1100 Subject: [PATCH 053/192] Remove LPVOID from original save file memory --- Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp | 2 +- Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index ddcf4d439..c0ea9c2df 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -24,7 +24,7 @@ unsigned int ConsoleSaveFileOriginal::pagesCommitted = 0; void *ConsoleSaveFileOriginal::pvHeap = NULL; -ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, void *pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index 123d4828a..5f6076633 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -24,7 +24,7 @@ private: static const unsigned int CSF_PAGE_SIZE = 64 * 1024; static const unsigned int MAX_PAGE_COUNT = 1024; #endif - LPVOID pvSaveMem; + void *pvSaveMem; CRITICAL_SECTION m_lock; @@ -35,7 +35,7 @@ public: #if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) static int SaveSaveDataCallback(LPVOID lpParam,bool bRes); #endif - ConsoleSaveFileOriginal(const std::wstring &fileName, LPVOID pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); + ConsoleSaveFileOriginal(const std::wstring &fileName, void *pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); virtual ~ConsoleSaveFileOriginal(); // 4J Stu - Initial implementation is intended to have a similar interface to the standard Xbox file access functions @@ -91,4 +91,4 @@ public: protected: virtual void *getWritePointer(FileEntry *file); -}; \ No newline at end of file +}; From 0db324debd56e84825143badede1ee637d4248b9 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:58:31 +1100 Subject: [PATCH 054/192] Remove LPVOID from split save file memory --- Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp | 4 ++-- Minecraft.World/IO/Files/ConsoleSaveFileSplit.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 167b580cc..bd5a999c6 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -380,7 +380,7 @@ FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) return newRef->fileEntry; } -ConsoleSaveFileSplit::ConsoleSaveFileSplit(const std::wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileSplit::ConsoleSaveFileSplit(const std::wstring &fileName, void *pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { DWORD fileSize = dFileSize; @@ -438,7 +438,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alr } } -void ConsoleSaveFileSplit::_init(const std::wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat) +void ConsoleSaveFileSplit::_init(const std::wstring &fileName, void *pvSaveData, DWORD fileSize, ESavePlatform plat) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index afb9eecad..38697c177 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -67,7 +67,7 @@ private: static const unsigned int CSF_PAGE_SIZE = 64 * 1024; static const unsigned int MAX_PAGE_COUNT = 1024; #endif - LPVOID pvSaveMem; + void *pvSaveMem; CRITICAL_SECTION m_lock; @@ -83,10 +83,10 @@ public: static int SaveRegionFilesCallback(LPVOID lpParam,bool bRes); private: - void _init(const std::wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat); + void _init(const std::wstring &fileName, void *pvSaveData, DWORD fileSize, ESavePlatform plat); public: - ConsoleSaveFileSplit(const std::wstring &fileName, LPVOID pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); + ConsoleSaveFileSplit(const std::wstring &fileName, void *pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alreadySmallRegions = true, ProgressListener *progress = NULL); virtual ~ConsoleSaveFileSplit(); From 2b3c688b44712a5f693c44d8d46729aa69f25b45 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:59:50 +1100 Subject: [PATCH 055/192] Use bool for save file close handles --- Minecraft.World/IO/Files/ConsoleSaveFile.h | 2 +- Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp | 2 +- Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp | 4 ++-- Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h | 2 +- Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp | 2 +- Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp | 4 ++-- Minecraft.World/IO/Files/ConsoleSaveFileSplit.h | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFile.h b/Minecraft.World/IO/Files/ConsoleSaveFile.h index 818964175..28a1a73f3 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFile.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFile.h @@ -14,7 +14,7 @@ public: virtual BOOL writeFile( FileEntry *file, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) = 0; virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) = 0; virtual BOOL readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ) = 0; - virtual BOOL closeHandle( FileEntry *file ) = 0; + virtual bool closeHandle( FileEntry *file ) = 0; virtual void finalizeWrite() = 0; virtual void tick() {}; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp index 35cd702c7..658d498e7 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp @@ -121,7 +121,7 @@ void ConsoleSaveFileInputStream::close() { if( m_saveFile != NULL ) { - BOOL result = m_saveFile->closeHandle( m_file ); + bool result = m_saveFile->closeHandle( m_file ); if( result == 0 ) { diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index c0ea9c2df..3f58d6a33 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -451,13 +451,13 @@ BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, LPVOID lpBuffer, DWORD return 1; } -BOOL ConsoleSaveFileOriginal::closeHandle( FileEntry *file ) +bool ConsoleSaveFileOriginal::closeHandle( FileEntry *file ) { LockSaveAccess(); finalizeWrite(); ReleaseSaveAccess(); - return TRUE; + return true; } void ConsoleSaveFileOriginal::finalizeWrite() diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index 5f6076633..8c7c5930f 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -47,7 +47,7 @@ public: virtual BOOL writeFile( FileEntry *file, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); virtual BOOL readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); - virtual BOOL closeHandle( FileEntry *file ); + virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp index 2193991e8..3972c79b8 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp @@ -117,7 +117,7 @@ void ConsoleSaveFileOutputStream::close() { if( m_saveFile != NULL ) { - BOOL result = m_saveFile->closeHandle( m_file ); + bool result = m_saveFile->closeHandle( m_file ); if( result == 0 ) { diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index bd5a999c6..a08c1d36c 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -892,13 +892,13 @@ BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNu return 1; } -BOOL ConsoleSaveFileSplit::closeHandle( FileEntry *file ) +bool ConsoleSaveFileSplit::closeHandle( FileEntry *file ) { LockSaveAccess(); finalizeWrite(); ReleaseSaveAccess(); - return TRUE; + return true; } // In this method, attempt to write any dirty region files, subject to maintaining a maximum write output rate. Writing is prioritised by time since the region was last written. diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index 38697c177..f9778fbe0 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -99,7 +99,7 @@ public: virtual BOOL writeFile( FileEntry *file, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); virtual BOOL readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); - virtual BOOL closeHandle( FileEntry *file ); + virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); virtual void tick(); From 8be51f6270da190775920364acca6fefdad661aa Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 10:00:59 +1100 Subject: [PATCH 056/192] Use standard pointers in save file IO --- Minecraft.World/IO/Files/ConsoleSaveFile.h | 4 ++-- Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp | 4 ++-- Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h | 4 ++-- Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp | 4 ++-- Minecraft.World/IO/Files/ConsoleSaveFileSplit.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFile.h b/Minecraft.World/IO/Files/ConsoleSaveFile.h index 28a1a73f3..dc1a9f8c3 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFile.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFile.h @@ -11,9 +11,9 @@ public: virtual FileEntry *createFile( const ConsoleSavePath &fileName ) = 0; virtual void deleteFile( FileEntry *file ) = 0; virtual void setFilePointer( FileEntry *file,LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) = 0; - virtual BOOL writeFile( FileEntry *file, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) = 0; + virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) = 0; virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) = 0; - virtual BOOL readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ) = 0; + virtual BOOL readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ) = 0; virtual bool closeHandle( FileEntry *file ) = 0; virtual void finalizeWrite() = 0; virtual void tick() {}; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 3f58d6a33..b256a38f3 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -337,7 +337,7 @@ void ConsoleSaveFileOriginal::PrepareForWrite( FileEntry *file, DWORD nNumberOfB finalizeWrite(); } -BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) +BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) @@ -411,7 +411,7 @@ BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWr return 1; } -BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) +BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) { DWORD actualBytesToRead; assert( pvSaveMem != NULL ); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index 8c7c5930f..dcb3727f9 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -44,9 +44,9 @@ public: virtual void deleteFile( FileEntry *file ); virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - virtual BOOL writeFile( FileEntry *file, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); + virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); - virtual BOOL readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); + virtual BOOL readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index a08c1d36c..98517c023 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -734,7 +734,7 @@ void ConsoleSaveFileSplit::PrepareForWrite( FileEntry *file, DWORD nNumberOfByte finalizeWrite(); } -BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) +BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) @@ -840,7 +840,7 @@ BOOL ConsoleSaveFileSplit::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite return 1; } -BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) +BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) { DWORD actualBytesToRead; assert( pvSaveMem != NULL ); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index f9778fbe0..c96324123 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -96,9 +96,9 @@ public: virtual void deleteFile( FileEntry *file ); virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - virtual BOOL writeFile( FileEntry *file, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); + virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); - virtual BOOL readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); + virtual BOOL readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); From d1b2b8cedbcf110ef9817aa48143845fcf023fb8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 10:20:17 +1100 Subject: [PATCH 057/192] Use standard byte counts in save file IO --- Minecraft.Client/MinecraftServer.cpp | 4 ++-- .../Platform/Common/XUI/XUI_DebugOverlay.cpp | 6 ++--- Minecraft.World/IO/Files/ConsoleSaveFile.h | 6 ++--- .../IO/Files/ConsoleSaveFileConverter.cpp | 8 +++---- .../IO/Files/ConsoleSaveFileInputStream.cpp | 6 ++--- .../IO/Files/ConsoleSaveFileOriginal.cpp | 20 ++++++++-------- .../IO/Files/ConsoleSaveFileOriginal.h | 10 ++++---- .../IO/Files/ConsoleSaveFileOutputStream.cpp | 6 ++--- .../IO/Files/ConsoleSaveFileSplit.cpp | 20 ++++++++-------- .../IO/Files/ConsoleSaveFileSplit.h | 10 ++++---- .../Level/Storage/DirectoryLevelStorage.cpp | 4 ++-- Minecraft.World/Level/Storage/RegionFile.cpp | 24 +++++++++---------- 12 files changed, 62 insertions(+), 62 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 6bcd72d49..a936358be 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -535,7 +535,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile(); if( csf->doesFileExist(filepath) ) { - DWORD numberOfBytesRead; + unsigned int numberOfBytesRead; byteArray ba_gameRules; FileEntry *fe = csf->createFile(filepath); @@ -810,7 +810,7 @@ void MinecraftServer::saveGameRules() ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile(); FileEntry *fe = csf->createFile(ConsoleSavePath(GAME_RULE_SAVENAME)); csf->setFilePointer(fe, 0, NULL, FILE_BEGIN); - DWORD length; + unsigned int length; csf->writeFile(fe, ba.data, ba.length, &length ); delete [] ba.data; diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp index 088a47402..68d349529 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp @@ -307,7 +307,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) //SetSpawnToPlayerPos(); FileEntry *origFileEntry = currentSave->createFile( std::wstring( L"level.dat" ) ); byteArray levelData( origFileEntry->getFileSize() ); - DWORD bytesRead; + unsigned int bytesRead; currentSave->setFilePointer(origFileEntry,0,NULL,FILE_BEGIN); currentSave->readFile( origFileEntry, @@ -317,7 +317,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) ); FileEntry *newFileEntry = newSave.createFile( std::wstring( L"level.dat" ) ); - DWORD bytesWritten; + unsigned int bytesWritten; newSave.writeFile( newFileEntry, levelData.data, // data buffer origFileEntry->getFileSize(), // number of bytes to write @@ -388,4 +388,4 @@ DataOutputStream *CScene_DebugOverlay::getChunkDataOutputStream(std::unordered_m RegionFile *r = getRegionFile(newFileCache, saveFile, prefix, chunkX, chunkZ); return r->getChunkDataOutputStream(chunkX & 31, chunkZ & 31); } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.World/IO/Files/ConsoleSaveFile.h b/Minecraft.World/IO/Files/ConsoleSaveFile.h index dc1a9f8c3..6acfb3bd5 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFile.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFile.h @@ -11,9 +11,9 @@ public: virtual FileEntry *createFile( const ConsoleSavePath &fileName ) = 0; virtual void deleteFile( FileEntry *file ) = 0; virtual void setFilePointer( FileEntry *file,LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) = 0; - virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) = 0; - virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) = 0; - virtual BOOL readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ) = 0; + virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; + virtual BOOL zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; + virtual BOOL readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ) = 0; virtual bool closeHandle( FileEntry *file ) = 0; virtual void finalizeWrite() = 0; virtual void tick() {}; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp index 439c819fb..e208e1953 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp @@ -7,8 +7,8 @@ void ConsoleSaveFileConverter::ProcessSimpleFile(ConsoleSaveFile *sourceSave, FileEntry *sourceFileEntry, ConsoleSaveFile *targetSave, FileEntry *targetFileEntry) { - DWORD numberOfBytesRead = 0; - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; uint8_t *data = new uint8_t[sourceFileEntry->getFileSize()]; @@ -23,8 +23,8 @@ void ConsoleSaveFileConverter::ProcessSimpleFile(ConsoleSaveFile *sourceSave, Fi void ConsoleSaveFileConverter::ProcessStandardRegionFile(ConsoleSaveFile *sourceSave, File sourceFile, ConsoleSaveFile *targetSave, File targetFile) { - DWORD numberOfBytesWritten = 0; - DWORD numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; RegionFile sourceRegionFile(sourceSave, &sourceFile); RegionFile targetRegionFile(targetSave, &targetFile); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp index 658d498e7..9118dbf4a 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp @@ -26,7 +26,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile int ConsoleSaveFileInputStream::read() { uint8_t byteRead = static_cast(0); - DWORD numberOfBytesRead; + unsigned int numberOfBytesRead; BOOL result = m_saveFile->readFile( m_file, @@ -56,7 +56,7 @@ int ConsoleSaveFileInputStream::read() //the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. int ConsoleSaveFileInputStream::read(byteArray b) { - DWORD numberOfBytesRead; + unsigned int numberOfBytesRead; BOOL result = m_saveFile->readFile( m_file, @@ -92,7 +92,7 @@ int ConsoleSaveFileInputStream::read(byteArray b, unsigned int offset, unsigned // 4J Stu - We don't want to read any more than the array buffer can hold assert( length <= ( b.length - offset ) ); - DWORD numberOfBytesRead; + unsigned int numberOfBytesRead; BOOL result = m_saveFile->readFile( m_file, diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index b256a38f3..0356b753d 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -314,7 +314,7 @@ void ConsoleSaveFileOriginal::setFilePointer(FileEntry *file,LONG lDistanceToMov } // If this file needs to grow, move the data after along -void ConsoleSaveFileOriginal::PrepareForWrite( FileEntry *file, DWORD nNumberOfBytesToWrite ) +void ConsoleSaveFileOriginal::PrepareForWrite( FileEntry *file, unsigned int nNumberOfBytesToWrite ) { int bytesToGrowBy = ( (file->currentFilePointer - file->data.startOffset) + nNumberOfBytesToWrite) - file->getFileSize(); if( bytesToGrowBy <= 0 ) @@ -337,7 +337,7 @@ void ConsoleSaveFileOriginal::PrepareForWrite( FileEntry *file, DWORD nNumberOfB finalizeWrite(); } -BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) +BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) @@ -374,7 +374,7 @@ BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,const void *lpBuffer, DW return 1; } -BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) +BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) @@ -411,9 +411,9 @@ BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWr return 1; } -BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) +BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead) { - DWORD actualBytesToRead; + unsigned int actualBytesToRead; assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { @@ -467,13 +467,13 @@ void ConsoleSaveFileOriginal::finalizeWrite() ReleaseSaveAccess(); } -void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite) +void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, unsigned int nNumberOfBytesToWrite) { - DWORD numberOfBytesRead = 0; - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; - const DWORD bufferSize = 4096; - DWORD amountToRead = bufferSize; + const unsigned int bufferSize = 4096; + unsigned int amountToRead = bufferSize; //assert( nNumberOfBytesToWrite <= bufferSize ); static uint8_t buffer1[bufferSize]; static uint8_t buffer2[bufferSize]; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index dcb3727f9..e613b15d7 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -28,8 +28,8 @@ private: CRITICAL_SECTION m_lock; - void PrepareForWrite( FileEntry *file, DWORD nNumberOfBytesToWrite ); - void MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite); + void PrepareForWrite( FileEntry *file, unsigned int nNumberOfBytesToWrite ); + void MoveDataBeyond(FileEntry *file, unsigned int nNumberOfBytesToWrite); public: #if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) @@ -44,9 +44,9 @@ public: virtual void deleteFile( FileEntry *file ); virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); - virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); - virtual BOOL readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); + virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); + virtual BOOL zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); + virtual BOOL readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp index 3972c79b8..210f1e988 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp @@ -36,7 +36,7 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi //b - the byte to be written. void ConsoleSaveFileOutputStream::write(unsigned int b) { - DWORD numberOfBytesWritten; + unsigned int numberOfBytesWritten; uint8_t value = (uint8_t) b; @@ -62,7 +62,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b) //b - the data. void ConsoleSaveFileOutputStream::write(byteArray b) { - DWORD numberOfBytesWritten; + unsigned int numberOfBytesWritten; BOOL result = m_saveFile->writeFile( m_file, @@ -91,7 +91,7 @@ void ConsoleSaveFileOutputStream::write(byteArray b, unsigned int offset, unsign // 4J Stu - We don't want to write any more than the array buffer holds assert( length <= ( b.length - offset ) ); - DWORD numberOfBytesWritten; + unsigned int numberOfBytesWritten; BOOL result = m_saveFile->writeFile( m_file, diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 98517c023..8a34658b7 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -709,7 +709,7 @@ void ConsoleSaveFileSplit::setFilePointer(FileEntry *file,LONG lDistanceToMove,P } // If this file needs to grow, move the data after along -void ConsoleSaveFileSplit::PrepareForWrite( FileEntry *file, DWORD nNumberOfBytesToWrite ) +void ConsoleSaveFileSplit::PrepareForWrite( FileEntry *file, unsigned int nNumberOfBytesToWrite ) { int bytesToGrowBy = ( (file->currentFilePointer - file->data.startOffset) + nNumberOfBytesToWrite) - file->getFileSize(); if( bytesToGrowBy <= 0 ) @@ -734,7 +734,7 @@ void ConsoleSaveFileSplit::PrepareForWrite( FileEntry *file, DWORD nNumberOfByte finalizeWrite(); } -BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) +BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) @@ -787,7 +787,7 @@ BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,const void *lpBuffer, DWORD return 1; } -BOOL ConsoleSaveFileSplit::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) +BOOL ConsoleSaveFileSplit::zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) @@ -840,9 +840,9 @@ BOOL ConsoleSaveFileSplit::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite return 1; } -BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) +BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead) { - DWORD actualBytesToRead; + unsigned int actualBytesToRead; assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { @@ -1037,13 +1037,13 @@ void ConsoleSaveFileSplit::finalizeWrite() ReleaseSaveAccess(); } -void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite) +void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, unsigned int nNumberOfBytesToWrite) { - DWORD numberOfBytesRead = 0; - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; - const DWORD bufferSize = 4096; - DWORD amountToRead = bufferSize; + const unsigned int bufferSize = 4096; + unsigned int amountToRead = bufferSize; //assert( nNumberOfBytesToWrite <= bufferSize ); static uint8_t buffer1[bufferSize]; static uint8_t buffer2[bufferSize]; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index c96324123..52ac39d56 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -71,8 +71,8 @@ private: CRITICAL_SECTION m_lock; - void PrepareForWrite( FileEntry *file, DWORD nNumberOfBytesToWrite ); - void MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite); + void PrepareForWrite( FileEntry *file, unsigned int nNumberOfBytesToWrite ); + void MoveDataBeyond(FileEntry *file, unsigned int nNumberOfBytesToWrite); bool GetNumericIdentifierFromName(const std::wstring &fileName, unsigned int *idOut); std::wstring GetNameFromNumericIdentifier(unsigned int idIn); @@ -96,9 +96,9 @@ public: virtual void deleteFile( FileEntry *file ); virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); - virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); - virtual BOOL readFile( FileEntry *file, void *lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); + virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); + virtual BOOL zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); + virtual BOOL readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index ab1381644..2146216c3 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -243,7 +243,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() #endif if (!m_bHasLoadedMapDataMappings && !mapFile.getName().empty() && getSaveFile()->doesFileExist( mapFile )) { - DWORD NumberOfBytesRead; + unsigned int NumberOfBytesRead; FileEntry *fileEntry = getSaveFile()->createFile(mapFile); #ifdef __PS3__ @@ -681,7 +681,7 @@ void DirectoryLevelStorage::saveMapIdLookup() if (!file.getName().empty()) { - DWORD NumberOfBytesWritten; + unsigned int NumberOfBytesWritten; FileEntry *fileEntry = m_saveFile->createFile(file); m_saveFile->setFilePointer(fileEntry,0,NULL, FILE_BEGIN); diff --git a/Minecraft.World/Level/Storage/RegionFile.cpp b/Minecraft.World/Level/Storage/RegionFile.cpp index b4bd43a43..10fc067fb 100644 --- a/Minecraft.World/Level/Storage/RegionFile.cpp +++ b/Minecraft.World/Level/Storage/RegionFile.cpp @@ -58,8 +58,8 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) if ((fileEntry->getFileSize() & 0xfff) != 0) { //uint8_t zero = 0; - DWORD numberOfBytesWritten = 0; - DWORD bytesToWrite = 0x1000 - (fileEntry->getFileSize() & 0xfff); + unsigned int numberOfBytesWritten = 0; + unsigned int bytesToWrite = 0x1000 - (fileEntry->getFileSize() & 0xfff); uint8_t *zeroBytes = new uint8_t[ bytesToWrite ]; ZeroMemory(zeroBytes, bytesToWrite); @@ -95,7 +95,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) for (int i = 0; i < SECTOR_INTS; ++i) { unsigned int offset = 0; - DWORD numberOfBytesRead = 0; + unsigned int numberOfBytesRead = 0; if( !m_bIsEmpty ) // 4J added condition, don't read back if we've just created an empty file as we don't immediately write this anymore { m_saveFile->readFile(fileEntry, &offset, 4, &numberOfBytesRead); @@ -115,7 +115,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) for (int i = 0; i < SECTOR_INTS; ++i) { int lastModValue = 0; - DWORD numberOfBytesRead = 0; + unsigned int numberOfBytesRead = 0; if( !m_bIsEmpty ) // 4J added condition, don't read back if we've just created an empty file as we don't immediately write this anymore { m_saveFile->readFile(fileEntry, &lastModValue, 4, &numberOfBytesRead); @@ -138,7 +138,7 @@ void RegionFile::writeAllOffsets() // used for the file ConsoleSaveFile conversi // save all the offsets and timestamps m_saveFile->LockSaveAccess(); - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); m_saveFile->writeFile(fileEntry,offsets, SECTOR_BYTES ,&numberOfBytesWritten); @@ -205,7 +205,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was unsigned int decompLength; unsigned int readDecompLength; - DWORD numberOfBytesRead = 0; + unsigned int numberOfBytesRead = 0; // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data @@ -379,7 +379,7 @@ void RegionFile::write(int x, int z, uint8_t *data, int length) // TODO - was s #ifndef _CONTENT_PACAKGE //wprintf(L"Writing chunk (%d,%d) in %ls from new sector %d to %d\n", x,z, fileEntry->data.filename, sectorNumber, sectorNumber + sectorsNeeded - 1); #endif - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; for (int i = 0; i < sectorsNeeded; ++i) { //WriteFile(file,emptySector.data,SECTOR_BYTES,&numberOfBytesWritten,NULL); @@ -405,7 +405,7 @@ void RegionFile::write(int x, int z, uint8_t *data, int length) // TODO - was s /* write a chunk data to the region file at specified sector number */ void RegionFile::write(int sectorNumber, uint8_t *data, int length, unsigned int compLength) { - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); @@ -424,7 +424,7 @@ void RegionFile::write(int sectorNumber, uint8_t *data, int length, unsigned int void RegionFile::zero(int sectorNumber, int length) { - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten ); @@ -450,7 +450,7 @@ bool RegionFile::hasChunk(int x, int z) void RegionFile::insertInitialSectors() { m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; uint8_t zeroBytes[ SECTOR_BYTES ]; ZeroMemory(zeroBytes, SECTOR_BYTES); @@ -470,7 +470,7 @@ void RegionFile::setOffset(int x, int z, int offset) insertInitialSectors(); // 4J added } - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; offsets[x + z * 32] = offset; m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, NULL, FILE_BEGIN ); @@ -484,7 +484,7 @@ void RegionFile::setTimestamp(int x, int z, int value) insertInitialSectors(); // 4J added } - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; chunkTimestamps[x + z * 32] = value; m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, NULL, FILE_BEGIN ); From 45c22ab6ccf0bacbec0eabe7b3ee186e8f7e2be8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 10:29:24 +1100 Subject: [PATCH 058/192] Use bool for save file IO results --- Minecraft.World/IO/Files/ConsoleSaveFile.h | 6 +++--- .../IO/Files/ConsoleSaveFileInputStream.cpp | 14 +++++++------- .../IO/Files/ConsoleSaveFileOriginal.cpp | 18 +++++++++--------- .../IO/Files/ConsoleSaveFileOriginal.h | 6 +++--- .../IO/Files/ConsoleSaveFileOutputStream.cpp | 14 +++++++------- .../IO/Files/ConsoleSaveFileSplit.cpp | 18 +++++++++--------- .../IO/Files/ConsoleSaveFileSplit.h | 6 +++--- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFile.h b/Minecraft.World/IO/Files/ConsoleSaveFile.h index 6acfb3bd5..f24386aa4 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFile.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFile.h @@ -11,9 +11,9 @@ public: virtual FileEntry *createFile( const ConsoleSavePath &fileName ) = 0; virtual void deleteFile( FileEntry *file ) = 0; virtual void setFilePointer( FileEntry *file,LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) = 0; - virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; - virtual BOOL zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; - virtual BOOL readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ) = 0; + virtual bool writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; + virtual bool zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; + virtual bool readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ) = 0; virtual bool closeHandle( FileEntry *file ) = 0; virtual void finalizeWrite() = 0; virtual void tick() {}; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp index 9118dbf4a..b97622d80 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp @@ -28,14 +28,14 @@ int ConsoleSaveFileInputStream::read() uint8_t byteRead = static_cast(0); unsigned int numberOfBytesRead; - BOOL result = m_saveFile->readFile( + bool result = m_saveFile->readFile( m_file, &byteRead, // data buffer 1, // number of bytes to read &numberOfBytesRead // number of bytes read ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling return -1; @@ -58,14 +58,14 @@ int ConsoleSaveFileInputStream::read(byteArray b) { unsigned int numberOfBytesRead; - BOOL result = m_saveFile->readFile( + bool result = m_saveFile->readFile( m_file, &b.data, // data buffer b.length, // number of bytes to read &numberOfBytesRead // number of bytes read ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling return -1; @@ -94,14 +94,14 @@ int ConsoleSaveFileInputStream::read(byteArray b, unsigned int offset, unsigned unsigned int numberOfBytesRead; - BOOL result = m_saveFile->readFile( + bool result = m_saveFile->readFile( m_file, &b[offset], // data buffer length, // number of bytes to read &numberOfBytesRead // number of bytes read ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling return -1; @@ -123,7 +123,7 @@ void ConsoleSaveFileInputStream::close() { bool result = m_saveFile->closeHandle( m_file ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling } diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 0356b753d..f0fe0c0df 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -337,12 +337,12 @@ void ConsoleSaveFileOriginal::PrepareForWrite( FileEntry *file, unsigned int nNu finalizeWrite(); } -BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) +bool ConsoleSaveFileOriginal::writeFile(FileEntry *file,const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { - return 0; + return false; } LockSaveAccess(); @@ -371,15 +371,15 @@ BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,const void *lpBuffer, un ReleaseSaveAccess(); - return 1; + return true; } -BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) +bool ConsoleSaveFileOriginal::zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { - return 0; + return false; } LockSaveAccess(); @@ -408,16 +408,16 @@ BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, unsigned int nNumberOfBy ReleaseSaveAccess(); - return 1; + return true; } -BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead) +bool ConsoleSaveFileOriginal::readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead) { unsigned int actualBytesToRead; assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { - return 0; + return false; } LockSaveAccess(); @@ -448,7 +448,7 @@ BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, void *lpBuffer, unsigne ReleaseSaveAccess(); - return 1; + return true; } bool ConsoleSaveFileOriginal::closeHandle( FileEntry *file ) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index e613b15d7..ce2944415 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -44,9 +44,9 @@ public: virtual void deleteFile( FileEntry *file ); virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); - virtual BOOL zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); - virtual BOOL readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); + virtual bool writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); + virtual bool zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); + virtual bool readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp index 210f1e988..bef7948af 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp @@ -40,14 +40,14 @@ void ConsoleSaveFileOutputStream::write(unsigned int b) uint8_t value = (uint8_t) b; - BOOL result = m_saveFile->writeFile( + bool result = m_saveFile->writeFile( m_file, &value, // data buffer 1, // number of bytes to write &numberOfBytesWritten // number of bytes written ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling } @@ -64,14 +64,14 @@ void ConsoleSaveFileOutputStream::write(byteArray b) { unsigned int numberOfBytesWritten; - BOOL result = m_saveFile->writeFile( + bool result = m_saveFile->writeFile( m_file, &b.data, // data buffer b.length, // number of bytes to write &numberOfBytesWritten // number of bytes written ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling } @@ -93,14 +93,14 @@ void ConsoleSaveFileOutputStream::write(byteArray b, unsigned int offset, unsign unsigned int numberOfBytesWritten; - BOOL result = m_saveFile->writeFile( + bool result = m_saveFile->writeFile( m_file, &b[offset], // data buffer length, // number of bytes to write &numberOfBytesWritten // number of bytes written ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling } @@ -119,7 +119,7 @@ void ConsoleSaveFileOutputStream::close() { bool result = m_saveFile->closeHandle( m_file ); - if( result == 0 ) + if( !result ) { // TODO 4J Stu - Some kind of error handling } diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 8a34658b7..375063e1a 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -734,12 +734,12 @@ void ConsoleSaveFileSplit::PrepareForWrite( FileEntry *file, unsigned int nNumbe finalizeWrite(); } -BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) +bool ConsoleSaveFileSplit::writeFile(FileEntry *file,const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { - return 0; + return false; } LockSaveAccess(); @@ -784,15 +784,15 @@ BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,const void *lpBuffer, unsig ReleaseSaveAccess(); - return 1; + return true; } -BOOL ConsoleSaveFileSplit::zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) +bool ConsoleSaveFileSplit::zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) { assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { - return 0; + return false; } LockSaveAccess(); @@ -837,16 +837,16 @@ BOOL ConsoleSaveFileSplit::zeroFile(FileEntry *file, unsigned int nNumberOfBytes ReleaseSaveAccess(); - return 1; + return true; } -BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead) +bool ConsoleSaveFileSplit::readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead) { unsigned int actualBytesToRead; assert( pvSaveMem != NULL ); if( pvSaveMem == NULL ) { - return 0; + return false; } LockSaveAccess(); @@ -889,7 +889,7 @@ BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, void *lpBuffer, unsigned i ReleaseSaveAccess(); - return 1; + return true; } bool ConsoleSaveFileSplit::closeHandle( FileEntry *file ) diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index 52ac39d56..21149c76f 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -96,9 +96,9 @@ public: virtual void deleteFile( FileEntry *file ); virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - virtual BOOL writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); - virtual BOOL zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); - virtual BOOL readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); + virtual bool writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); + virtual bool zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); + virtual bool readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); virtual bool closeHandle( FileEntry *file ); virtual void finalizeWrite(); From 83ba8d8384907103db6ea1e2752e77b792d32112 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 10:32:58 +1100 Subject: [PATCH 059/192] Use a portable seek origin for save files --- Minecraft.Client/MinecraftServer.cpp | 4 +-- .../Platform/Common/XUI/XUI_DebugOverlay.cpp | 2 +- Minecraft.World/IO/Files/ConsoleSaveFile.h | 9 ++++++- .../IO/Files/ConsoleSaveFileInputStream.cpp | 4 +-- .../IO/Files/ConsoleSaveFileOriginal.cpp | 17 +++++++++---- .../IO/Files/ConsoleSaveFileOriginal.h | 2 +- .../IO/Files/ConsoleSaveFileOutputStream.cpp | 4 +-- .../IO/Files/ConsoleSaveFileSplit.cpp | 25 ++++++++++++------- .../IO/Files/ConsoleSaveFileSplit.h | 2 +- .../Level/Storage/DirectoryLevelStorage.cpp | 4 +-- Minecraft.World/Level/Storage/RegionFile.cpp | 22 ++++++++-------- 11 files changed, 58 insertions(+), 37 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index a936358be..373bab6c4 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -543,7 +543,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws ba_gameRules.length = fe->getFileSize(); ba_gameRules.data = new BYTE[ ba_gameRules.length ]; - csf->setFilePointer(fe,0,NULL,FILE_BEGIN); + csf->setFilePointer(fe, 0, SaveFileSeekOrigin::Begin); csf->readFile(fe, ba_gameRules.data, ba_gameRules.length, &numberOfBytesRead); assert(numberOfBytesRead == ba_gameRules.length); @@ -809,7 +809,7 @@ void MinecraftServer::saveGameRules() { ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile(); FileEntry *fe = csf->createFile(ConsoleSavePath(GAME_RULE_SAVENAME)); - csf->setFilePointer(fe, 0, NULL, FILE_BEGIN); + csf->setFilePointer(fe, 0, SaveFileSeekOrigin::Begin); unsigned int length; csf->writeFile(fe, ba.data, ba.length, &length ); diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp index 68d349529..6764fb23f 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_DebugOverlay.cpp @@ -308,7 +308,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) FileEntry *origFileEntry = currentSave->createFile( std::wstring( L"level.dat" ) ); byteArray levelData( origFileEntry->getFileSize() ); unsigned int bytesRead; - currentSave->setFilePointer(origFileEntry,0,NULL,FILE_BEGIN); + currentSave->setFilePointer(origFileEntry, 0, SaveFileSeekOrigin::Begin); currentSave->readFile( origFileEntry, levelData.data, // data buffer diff --git a/Minecraft.World/IO/Files/ConsoleSaveFile.h b/Minecraft.World/IO/Files/ConsoleSaveFile.h index f24386aa4..63679bfac 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFile.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFile.h @@ -3,6 +3,13 @@ #include "FileHeader.h" #include "ConsoleSavePath.h" +enum class SaveFileSeekOrigin +{ + Begin, + Current, + End +}; + class ConsoleSaveFile { public: @@ -10,7 +17,7 @@ public: virtual FileEntry *createFile( const ConsoleSavePath &fileName ) = 0; virtual void deleteFile( FileEntry *file ) = 0; - virtual void setFilePointer( FileEntry *file,LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) = 0; + virtual void setFilePointer( FileEntry *file, unsigned int distanceToMove, SaveFileSeekOrigin seekOrigin ) = 0; virtual bool writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; virtual bool zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten) = 0; virtual bool readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ) = 0; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp index b97622d80..36d34e9a9 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp @@ -9,7 +9,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile m_saveFile = saveFile; m_file = m_saveFile->createFile( file ); - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, SaveFileSeekOrigin::Begin ); } ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile, FileEntry *file) @@ -17,7 +17,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile m_saveFile = saveFile; m_file = file; - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, SaveFileSeekOrigin::Begin ); } //Reads a byte of data from this input stream. This method blocks if no input is yet available. diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index f0fe0c0df..0f8bcd41f 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -299,15 +299,22 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file ) ReleaseSaveAccess(); } -void ConsoleSaveFileOriginal::setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) +void ConsoleSaveFileOriginal::setFilePointer(FileEntry *file, unsigned int distanceToMove, SaveFileSeekOrigin seekOrigin) { LockSaveAccess(); - file->currentFilePointer = file->data.startOffset + lDistanceToMove; - - if( dwMoveMethod == FILE_END) + switch( seekOrigin ) { - file->currentFilePointer += file->getFileSize(); + case SaveFileSeekOrigin::Current: + file->currentFilePointer += distanceToMove; + break; + case SaveFileSeekOrigin::End: + file->currentFilePointer = file->data.startOffset + file->getFileSize() + distanceToMove; + break; + case SaveFileSeekOrigin::Begin: + default: + file->currentFilePointer = file->data.startOffset + distanceToMove; + break; } ReleaseSaveAccess(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index ce2944415..d5af2e124 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -43,7 +43,7 @@ public: virtual FileEntry *createFile( const ConsoleSavePath &fileName ); virtual void deleteFile( FileEntry *file ); - virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); + virtual void setFilePointer(FileEntry *file, unsigned int distanceToMove, SaveFileSeekOrigin seekOrigin); virtual bool writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); virtual bool zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); virtual bool readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp index bef7948af..e2e8b68c9 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp @@ -19,7 +19,7 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi m_file = m_saveFile->createFile(file); - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, SaveFileSeekOrigin::Begin ); } ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFile, FileEntry *file) @@ -28,7 +28,7 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi m_file = file; - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, SaveFileSeekOrigin::Begin ); } //Writes the specified byte to this file output stream. Implements the write method of OutputStream. diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 375063e1a..762231d6e 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -423,7 +423,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alr for(AUTO_VAR(it, sourceFiles->begin()); it != sourceFiles->end(); ++it) { FileEntry *sourceEntry = *it; - sourceSave->setFilePointer(sourceEntry,0,NULL,FILE_BEGIN); + sourceSave->setFilePointer(sourceEntry, 0, SaveFileSeekOrigin::Begin); FileEntry *targetEntry = createFile(ConsoleSavePath(sourceEntry->data.filename)); @@ -687,22 +687,29 @@ void ConsoleSaveFileSplit::deleteFile( FileEntry *file ) ReleaseSaveAccess(); } -void ConsoleSaveFileSplit::setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) +void ConsoleSaveFileSplit::setFilePointer(FileEntry *file, unsigned int distanceToMove, SaveFileSeekOrigin seekOrigin) { LockSaveAccess(); - if( file->isRegionFile() ) + if( seekOrigin == SaveFileSeekOrigin::Current ) { - file->currentFilePointer = lDistanceToMove; + file->currentFilePointer += distanceToMove; } else { - file->currentFilePointer = file->data.startOffset + lDistanceToMove; - } + if( file->isRegionFile() ) + { + file->currentFilePointer = distanceToMove; + } + else + { + file->currentFilePointer = file->data.startOffset + distanceToMove; + } - if( dwMoveMethod == FILE_END) - { - file->currentFilePointer += file->getFileSize(); + if( seekOrigin == SaveFileSeekOrigin::End ) + { + file->currentFilePointer += file->getFileSize(); + } } ReleaseSaveAccess(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index 21149c76f..769678e94 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -95,7 +95,7 @@ public: virtual FileEntry *createFile( const ConsoleSavePath &fileName ); virtual void deleteFile( FileEntry *file ); - virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); + virtual void setFilePointer(FileEntry *file, unsigned int distanceToMove, SaveFileSeekOrigin seekOrigin); virtual bool writeFile( FileEntry *file, const void *lpBuffer, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten ); virtual bool zeroFile(FileEntry *file, unsigned int nNumberOfBytesToWrite, unsigned int *lpNumberOfBytesWritten); virtual bool readFile( FileEntry *file, void *lpBuffer, unsigned int nNumberOfBytesToRead, unsigned int *lpNumberOfBytesRead ); diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index 2146216c3..e70c2d49c 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -270,7 +270,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() else #endif { - getSaveFile()->setFilePointer(fileEntry,0,NULL, FILE_BEGIN); + getSaveFile()->setFilePointer(fileEntry, 0, SaveFileSeekOrigin::Begin); #ifdef _LARGE_WORLDS byteArray data(fileEntry->getFileSize()); @@ -683,7 +683,7 @@ void DirectoryLevelStorage::saveMapIdLookup() { unsigned int NumberOfBytesWritten; FileEntry *fileEntry = m_saveFile->createFile(file); - m_saveFile->setFilePointer(fileEntry,0,NULL, FILE_BEGIN); + m_saveFile->setFilePointer(fileEntry, 0, SaveFileSeekOrigin::Begin); #ifdef _LARGE_WORLDS ByteArrayOutputStream baos; diff --git a/Minecraft.World/Level/Storage/RegionFile.cpp b/Minecraft.World/Level/Storage/RegionFile.cpp index 10fc067fb..03e59f4bd 100644 --- a/Minecraft.World/Level/Storage/RegionFile.cpp +++ b/Minecraft.World/Level/Storage/RegionFile.cpp @@ -39,7 +39,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) */ fileEntry = m_saveFile->createFile( fileName->getName() ); - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); + m_saveFile->setFilePointer( fileEntry, 0, SaveFileSeekOrigin::End ); if ( fileEntry->getFileSize() < SECTOR_BYTES) { @@ -91,7 +91,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) sectorFree->at(0) = false; // chunk offset table sectorFree->at(1) = false; // for the last modified info - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, SaveFileSeekOrigin::Begin ); for (int i = 0; i < SECTOR_INTS; ++i) { unsigned int offset = 0; @@ -139,11 +139,11 @@ void RegionFile::writeAllOffsets() // used for the file ConsoleSaveFile conversi m_saveFile->LockSaveAccess(); unsigned int numberOfBytesWritten = 0; - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, SaveFileSeekOrigin::Begin ); m_saveFile->writeFile(fileEntry,offsets, SECTOR_BYTES ,&numberOfBytesWritten); numberOfBytesWritten = 0; - m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES, SaveFileSeekOrigin::Begin ); m_saveFile->writeFile(fileEntry, chunkTimestamps, SECTOR_BYTES, &numberOfBytesWritten); m_saveFile->ReleaseSaveAccess(); @@ -199,7 +199,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was m_saveFile->LockSaveAccess(); //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, SaveFileSeekOrigin::Begin); unsigned int length; unsigned int decompLength; @@ -373,7 +373,7 @@ void RegionFile::write(int x, int z, uint8_t *data, int length) // TODO - was s */ // debug("SAVE", x, z, length, "grow"); //SetFilePointer(file,0,0,FILE_END); - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); + m_saveFile->setFilePointer( fileEntry, 0, SaveFileSeekOrigin::End ); sectorNumber = (int)sectorFree->size(); #ifndef _CONTENT_PACAKGE @@ -407,7 +407,7 @@ void RegionFile::write(int sectorNumber, uint8_t *data, int length, unsigned int { unsigned int numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, SaveFileSeekOrigin::Begin ); // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data @@ -426,7 +426,7 @@ void RegionFile::zero(int sectorNumber, int length) { unsigned int numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, SaveFileSeekOrigin::Begin ); m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten ); } @@ -449,7 +449,7 @@ bool RegionFile::hasChunk(int x, int z) // 4J added - write the initial two sectors that used to be written in the ctor when the file was empty void RegionFile::insertInitialSectors() { - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, SaveFileSeekOrigin::Begin ); unsigned int numberOfBytesWritten = 0; uint8_t zeroBytes[ SECTOR_BYTES ]; ZeroMemory(zeroBytes, SECTOR_BYTES); @@ -472,7 +472,7 @@ void RegionFile::setOffset(int x, int z, int offset) unsigned int numberOfBytesWritten = 0; offsets[x + z * 32] = offset; - m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, SaveFileSeekOrigin::Begin ); m_saveFile->writeFile(fileEntry,&offset,4,&numberOfBytesWritten); } @@ -486,7 +486,7 @@ void RegionFile::setTimestamp(int x, int z, int value) unsigned int numberOfBytesWritten = 0; chunkTimestamps[x + z * 32] = value; - m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, SaveFileSeekOrigin::Begin ); m_saveFile->writeFile(fileEntry,&value,4,&numberOfBytesWritten); } From 0ab0fd9209aefe367fb9b93dbc70010606a8d91c Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:14:32 +1100 Subject: [PATCH 060/192] Standardise fixed-width integer usage in touched files --- Minecraft.Client/Network/PlayerConnection.cpp | 2 +- Minecraft.Client/Network/PlayerList.cpp | 2 +- Minecraft.Client/Network/ServerChunkCache.cpp | 2 +- .../Platform/Common/DLC/DLCAudioFile.cpp | 8 +-- .../Platform/Common/DLC/DLCAudioFile.h | 8 +-- .../Platform/Common/DLC/DLCCapeFile.cpp | 2 +- .../Platform/Common/DLC/DLCCapeFile.h | 2 +- .../Common/DLC/DLCColourTableFile.cpp | 2 +- .../Platform/Common/DLC/DLCColourTableFile.h | 2 +- .../Platform/Common/DLC/DLCFile.h | 4 +- .../Platform/Common/DLC/DLCGameRulesFile.cpp | 4 +- .../Platform/Common/DLC/DLCGameRulesFile.h | 6 +-- .../Common/DLC/DLCGameRulesHeader.cpp | 6 +-- .../Platform/Common/DLC/DLCGameRulesHeader.h | 8 +-- .../Common/DLC/DLCLocalisationFile.cpp | 2 +- .../Platform/Common/DLC/DLCLocalisationFile.h | 4 +- .../Platform/Common/DLC/DLCManager.cpp | 14 ++--- .../Platform/Common/DLC/DLCManager.h | 4 +- .../Platform/Common/DLC/DLCPack.h | 4 +- .../Platform/Common/DLC/DLCSkinFile.cpp | 2 +- .../Platform/Common/DLC/DLCSkinFile.h | 2 +- .../Platform/Common/DLC/DLCTextureFile.cpp | 4 +- .../Platform/Common/DLC/DLCTextureFile.h | 6 +-- .../Platform/Common/DLC/DLCUIDataFile.cpp | 4 +- .../Platform/Common/DLC/DLCUIDataFile.h | 6 +-- .../Platform/Common/UI/IUIScene_StartGame.cpp | 4 +- .../Common/UI/UIScene_CreateWorldMenu.cpp | 24 ++++----- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 18 +++---- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 22 ++++---- .../Platform/Common/XUI/XUI_LoadSettings.cpp | 8 +-- .../Common/XUI/XUI_MultiGameCreate.cpp | 6 +-- .../Common/XUI/XUI_MultiGameJoinLoad.cpp | 4 +- .../PS3/Network/SonyRemoteStorage_PS3.cpp | 6 +-- .../PSVita/Network/SonyRemoteStorage_Vita.cpp | 4 +- Minecraft.Client/Rendering/GameRenderer.cpp | 34 ++++++------ Minecraft.Client/Rendering/GameRenderer.h | 4 +- Minecraft.Client/Rendering/Tesselator.cpp | 52 +++++++++---------- Minecraft.Client/Rendering/Tesselator.h | 2 +- .../Textures/Packs/AbstractTexturePack.cpp | 4 +- .../Textures/Packs/AbstractTexturePack.h | 8 +-- Minecraft.Client/Textures/Packs/TexturePack.h | 4 +- Minecraft.Client/Utils/ArchiveFile.cpp | 4 +- Minecraft.Client/Utils/ArchiveFile.h | 2 +- Minecraft.Client/Utils/StringTable.cpp | 4 +- Minecraft.Client/Utils/StringTable.h | 4 +- .../IO/Files/ConsoleSaveFileConverter.cpp | 2 +- .../IO/Files/ConsoleSaveFileInputStream.cpp | 2 +- .../IO/Files/ConsoleSaveFileOutputStream.cpp | 2 +- Minecraft.World/IO/Files/File.cpp | 4 +- Minecraft.World/IO/Files/FileInputStream.cpp | 2 +- Minecraft.World/IO/Files/FileOutputStream.cpp | 2 +- Minecraft.World/IO/Streams/Compression.cpp | 8 +-- Minecraft.World/Level/CustomLevelSource.cpp | 20 +++---- .../Level/Storage/DirectoryLevelStorage.cpp | 4 +- Minecraft.World/Level/Storage/RegionFile.cpp | 16 +++--- .../Network/Packets/AddPlayerPacket.cpp | 16 +++--- .../Network/Packets/AddPlayerPacket.h | 2 +- .../Network/Packets/KickPlayerPacket.cpp | 2 +- .../Network/Packets/LoginPacket.cpp | 10 ++-- .../Network/Packets/PreLoginPacket.cpp | 2 +- Minecraft.World/Network/Socket.cpp | 18 +++---- Minecraft.World/Network/Socket.h | 4 +- Minecraft.World/Player/Player.cpp | 12 ++--- Minecraft.World/Player/Player.h | 2 +- 64 files changed, 229 insertions(+), 229 deletions(-) diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index 636ea6560..8669e1b91 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -1205,7 +1205,7 @@ void PlayerConnection::handleSetCreativeModeSlot(std::shared_ptrx = centreXC; data->z = centreZC; - data->dimension = (uint8_t) player->level->dimension->id; + data->dimension = (std::uint8_t) player->level->dimension->id; data->setDirty(); } diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index e56efca60..1f48183c8 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -211,7 +211,7 @@ void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptrsend( std::shared_ptr( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), - (uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(), + (std::uint8_t) level->dimension->id, (std::uint8_t) level->getMaxBuildHeight(), (std::uint8_t) getMaxPlayers(), level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) ); playerConnection->send( std::shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index b479f49b2..2814d5f88 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -687,7 +687,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } LevelChunk *chunk = NULL; - uint8_t workingThreads; + std::uint8_t workingThreads; bool chunkSet = false; // Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp index b25c0bec2..f5926fbbc 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp @@ -12,7 +12,7 @@ DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLC m_dataBytes = 0; } -void DLCAudioFile::addData(uint8_t *pbData, std::uint32_t dataBytes) +void DLCAudioFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) { m_pbData = pbData; m_dataBytes = dataBytes; @@ -20,7 +20,7 @@ void DLCAudioFile::addData(uint8_t *pbData, std::uint32_t dataBytes) processDLCDataFile(pbData,dataBytes); } -uint8_t *DLCAudioFile::getData(std::uint32_t &dataBytes) +std::uint8_t *DLCAudioFile::getData(std::uint32_t &dataBytes) { dataBytes = m_dataBytes; return m_pbData; @@ -120,7 +120,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons } } -bool DLCAudioFile::processDLCDataFile(uint8_t *pbData, std::uint32_t dataLength) +bool DLCAudioFile::processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLength) { std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; @@ -164,7 +164,7 @@ bool DLCAudioFile::processDLCDataFile(uint8_t *pbData, std::uint32_t dataLength) dwTemp+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } - uint8_t *pbTemp = reinterpret_cast(pFile); + std::uint8_t *pbTemp = reinterpret_cast(pFile); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; for(unsigned int i=0;i m_parameters; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp index da72eec4b..a9edb92e8 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp @@ -6,7 +6,7 @@ DLCCapeFile::DLCCapeFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy { } -void DLCCapeFile::addData(uint8_t *pbData, std::uint32_t dataBytes) +void DLCCapeFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) { app.AddMemoryTextureFile(m_path,pbData,dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h index df7e51ca8..406ac3dc4 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h @@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile public: DLCCapeFile(const std::wstring &path); - virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); + virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp index 3922bae69..fed962a75 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp @@ -19,7 +19,7 @@ DLCColourTableFile::~DLCColourTableFile() } } -void DLCColourTableFile::addData(uint8_t *pbData, std::uint32_t dataBytes) +void DLCColourTableFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) { ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable(); m_colourTable = new ColourTable(defaultColourTable, pbData, dataBytes); diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h index 8ae18dcad..d75fec458 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h @@ -12,7 +12,7 @@ public: DLCColourTableFile(const std::wstring &path); ~DLCColourTableFile(); - virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); + virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); ColourTable *getColourTable() { return m_colourTable; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCFile.h b/Minecraft.Client/Platform/Common/DLC/DLCFile.h index 9e6482250..3c0da1855 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCFile.h @@ -17,8 +17,8 @@ public: std::wstring getPath() { return m_path; } DWORD getSkinID() { return m_dwSkinId; } - virtual void addData(uint8_t *pbData, std::uint32_t dataBytes) {} - virtual uint8_t *getData(std::uint32_t &dataBytes) { dataBytes = 0; return NULL; } + virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes) {} + virtual std::uint8_t *getData(std::uint32_t &dataBytes) { dataBytes = 0; return NULL; } virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {} virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp index 754aca694..1c91a39e3 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp @@ -8,13 +8,13 @@ DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCM m_dataBytes = 0; } -void DLCGameRulesFile::addData(uint8_t *pbData, std::uint32_t dataBytes) +void DLCGameRulesFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) { m_pbData = pbData; m_dataBytes = dataBytes; } -uint8_t *DLCGameRulesFile::getData(std::uint32_t &dataBytes) +std::uint8_t *DLCGameRulesFile::getData(std::uint32_t &dataBytes) { dataBytes = m_dataBytes; return m_pbData; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h index 8e3ff0abf..56af6cd8c 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h @@ -4,12 +4,12 @@ class DLCGameRulesFile : public DLCGameRules { private: - uint8_t *m_pbData; + std::uint8_t *m_pbData; std::uint32_t m_dataBytes; public: DLCGameRulesFile(const std::wstring &path); - virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); - virtual uint8_t *getData(std::uint32_t &dataBytes); + virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); + virtual std::uint8_t *getData(std::uint32_t &dataBytes); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp index a9c4805d9..09afd4783 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp @@ -21,7 +21,7 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules( lgo = NULL; } -void DLCGameRulesHeader::addData(uint8_t *pbData, std::uint32_t dataBytes) +void DLCGameRulesHeader::addData(std::uint8_t *pbData, std::uint32_t dataBytes) { m_pbData = pbData; m_dataBytes = dataBytes; @@ -73,13 +73,13 @@ void DLCGameRulesHeader::addData(uint8_t *pbData, std::uint32_t dataBytes) #endif } -uint8_t *DLCGameRulesHeader::getData(std::uint32_t &dataBytes) +std::uint8_t *DLCGameRulesHeader::getData(std::uint32_t &dataBytes) { dataBytes = m_dataBytes; return m_pbData; } -void DLCGameRulesHeader::setGrfData(uint8_t *fData, std::uint32_t dataSize, StringTable *st) +void DLCGameRulesHeader::setGrfData(std::uint8_t *fData, std::uint32_t dataSize, StringTable *st) { if (!m_hasData) { diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h index 294180e9f..a947ece81 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h @@ -8,7 +8,7 @@ class DLCGameRulesHeader : public DLCGameRules, public JustGrSource private: // GR-Header - uint8_t *m_pbData; + std::uint8_t *m_pbData; std::uint32_t m_dataBytes; bool m_hasData; @@ -33,10 +33,10 @@ public: public: DLCGameRulesHeader(const std::wstring &path); - virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); - virtual uint8_t *getData(std::uint32_t &dataBytes); + virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); + virtual std::uint8_t *getData(std::uint32_t &dataBytes); - void setGrfData(uint8_t *fData, std::uint32_t dataSize, StringTable *); + void setGrfData(std::uint8_t *fData, std::uint32_t dataSize, StringTable *); virtual bool ready() { return m_hasData; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp index 1c53207ff..c1f9c9e30 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp @@ -8,7 +8,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLC m_strings = NULL; } -void DLCLocalisationFile::addData(uint8_t *pbData, std::uint32_t dataBytes) +void DLCLocalisationFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) { m_strings = new StringTable(pbData, dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h index 77e160cce..46f5782d4 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h @@ -10,9 +10,9 @@ private: public: DLCLocalisationFile(const std::wstring &path); - DLCLocalisationFile(uint8_t *pbData, std::uint32_t dataBytes); // when we load in a texture pack details file from TMS++ + DLCLocalisationFile(std::uint8_t *pbData, std::uint32_t dataBytes); // when we load in a texture pack details file from TMS++ - virtual void addData(uint8_t *pbData, std::uint32_t dataBytes); + virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); StringTable *getStringTable() { return m_strings; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index 3f9311ce5..ff26b88c9 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -12,7 +12,7 @@ static const size_t DLC_WCHAR_BINARY = 2; static std::wstring dlc_read_wstring(const void *data) { - const uint16_t *p = (const uint16_t *)data; + const std::uint16_t *p = (const std::uint16_t *)data; std::wstring s; while (*p) s += (wchar_t)*p++; return s; @@ -363,7 +363,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat } DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); - uint8_t *pbData = new uint8_t[dwFileSize]; + std::uint8_t *pbData = new std::uint8_t[dwFileSize]; BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { @@ -385,7 +385,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack); } -bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, uint8_t *pbData, DWORD dwLength, DLCPack *pack) +bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, std::uint8_t *pbData, DWORD dwLength, DLCPack *pack) { std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; @@ -439,7 +439,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, uint8_t *pbData, DW dwTemp+=DLC_DETAIL_ADV(pFile->dwWchCount); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } - uint8_t *pbTemp = reinterpret_cast(pFile);//+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount; + std::uint8_t *pbTemp = reinterpret_cast(pFile);//+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount; pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; for(unsigned int i=0;idwWchCount); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } - uint8_t *pbTemp = reinterpret_cast(pFile); + std::uint8_t *pbTemp = reinterpret_cast(pFile); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; for(unsigned int i=0;iskins->getTexturePackByIndex(i); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -181,7 +181,7 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) m_labelTexturePackDescription.setLabel(tp->getDesc1()); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); //if(imageBytes > 0 && imageData) //{ diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index efa2cae05..83cf1d1cf 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -168,7 +168,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -759,8 +759,8 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) { - uint16_t pchText[128]; - ZeroMemory(pchText, 128 * sizeof(uint16_t) ); + std::uint16_t pchText[128]; + ZeroMemory(pchText, 128 * sizeof(std::uint16_t) ); InputManager.GetText(pchText); if(pchText[0]!=0) @@ -783,11 +783,11 @@ int UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,bool bR { #ifdef __PSVITA__ //CD - Changed to 2048 [SCE_IME_MAX_TEXT_LENGTH] - uint16_t pchText[2048]; - ZeroMemory(pchText, 2048 * sizeof(uint16_t) ); + std::uint16_t pchText[2048]; + ZeroMemory(pchText, 2048 * sizeof(std::uint16_t) ); #else - uint16_t pchText[128]; - ZeroMemory(pchText, 128 * sizeof(uint16_t) ); + std::uint16_t pchText[128]; + ZeroMemory(pchText, 128 * sizeof(std::uint16_t) ); #endif InputManager.GetText(pchText); pClass->m_editSeed.setLabel((wchar_t *)pchText); @@ -896,7 +896,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); + std::int32_t iResult=sceNpCommerceDialogInitialize(); SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); @@ -975,7 +975,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); + std::int32_t iResult=sceNpCommerceDialogInitialize(); SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); @@ -1023,7 +1023,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); + std::int32_t iResult=sceNpCommerceDialogInitialize(); SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); @@ -1421,14 +1421,14 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor // int UIScene_CreateWorldMenu::PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) // { -// int32_t iResult; +// std::int32_t iResult; // UIScene_CreateWorldMenu *pClass = (UIScene_CreateWorldMenu *)pParam; // // // continue offline, or upsell PS Plus? // if(result==C4JStorage::EMessage_ResultDecline) // { // // upsell psplus -// int32_t iResult=sceNpCommerceDialogInitialize(); +// std::int32_t iResult=sceNpCommerceDialogInitialize(); // // SceNpCommerceDialogParam param; // sceNpCommerceDialogParamInitialize(¶m); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index 9febff710..09ecfe9c6 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -174,7 +174,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye // retrieve the save icon from the texture pack, if there is one TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -193,12 +193,12 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye #if defined(__PS3__) || defined(__ORBIS__)|| defined(_DURANGO) || defined (__PSVITA__) // convert to utf16 - uint16_t u16Message[MAX_SAVEFILENAME_LENGTH]; + std::uint16_t u16Message[MAX_SAVEFILENAME_LENGTH]; size_t srclen,dstlen; srclen=MAX_SAVEFILENAME_LENGTH; dstlen=MAX_SAVEFILENAME_LENGTH; #ifdef __PS3__ - L10nResult lres= UTF8stoUTF16s((uint8_t *)params->saveDetails->UTF8SaveFilename,&srclen,u16Message,&dstlen); + L10nResult lres= UTF8stoUTF16s((std::uint8_t *)params->saveDetails->UTF8SaveFilename,&srclen,u16Message,&dstlen); #elif defined(_DURANGO) // Already utf16 on durango memcpy(u16Message,params->saveDetails->UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); @@ -206,8 +206,8 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye { SceCesUcsContext Context; sceCesUcsContextInit( &Context ); - uint32_t utf8Len, utf16Len; - sceCesUtf8StrToUtf16Str(&Context, (uint8_t *)params->saveDetails->UTF8SaveFilename, srclen, &utf8Len, u16Message, dstlen, &utf16Len); + std::uint32_t utf8Len, utf16Len; + sceCesUtf8StrToUtf16Str(&Context, (std::uint8_t *)params->saveDetails->UTF8SaveFilename, srclen, &utf8Len, u16Message, dstlen, &utf16Len); } #endif m_thumbnailName = (wchar_t *)u16Message; @@ -260,7 +260,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -1259,7 +1259,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); + std::int32_t iResult=sceNpCommerceDialogInitialize(); SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); @@ -1319,7 +1319,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); + std::int32_t iResult=sceNpCommerceDialogInitialize(); SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); @@ -1773,7 +1773,7 @@ int UIScene_LoadMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM // int UIScene_LoadMenu::PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) // { -// int32_t iResult; +// std::int32_t iResult; // UIScene_LoadMenu *pClass = (UIScene_LoadMenu *)pParam; // // // continue offline, or upsell PS Plus? diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index bbfd4ed0d..4c02e5be4 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -657,7 +657,7 @@ void UIScene_LoadOrJoinMenu::tick() if(!m_bExitScene) { // convert to utf16 - uint16_t u16Message[MAX_SAVEFILENAME_LENGTH]; + std::uint16_t u16Message[MAX_SAVEFILENAME_LENGTH]; #ifdef _DURANGO // Already utf16 on durango memcpy(u16Message, m_saveDetails[m_iRequestingThumbnailId].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); @@ -675,19 +675,19 @@ void UIScene_LoadOrJoinMenu::tick() #ifdef __PS3 size_t srcmax,dstmax; #else - uint32_t srcmax,dstmax; - uint32_t srclen,dstlen; + std::uint32_t srcmax,dstmax; + std::uint32_t srclen,dstlen; #endif srcmax=MAX_SAVEFILENAME_LENGTH; dstmax=MAX_SAVEFILENAME_LENGTH; #if defined(__PS3__) - L10nResult lres= UTF8stoUTF16s((uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,&srcmax,u16Message,&dstmax); + L10nResult lres= UTF8stoUTF16s((std::uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,&srcmax,u16Message,&dstmax); #else SceCesUcsContext context; sceCesUcsContextInit(&context); - sceCesUtf8StrToUtf16Str(&context, (uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,srcmax,&srclen,u16Message,dstmax,&dstlen); + sceCesUtf8StrToUtf16Str(&context, (std::uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,srcmax,&srclen,u16Message,dstmax,&dstlen); #endif #endif if( m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData ) @@ -928,7 +928,7 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() m_iMashUpButtonsC++; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId()); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -1172,8 +1172,8 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo pClass->m_bIgnoreInput=false; if (bRes) { - uint16_t ui16Text[128]; - ZeroMemory(ui16Text, 128 * sizeof(uint16_t) ); + std::uint16_t ui16Text[128]; + ZeroMemory(ui16Text, 128 * sizeof(std::uint16_t) ); InputManager.GetText(ui16Text); // check the name is valid @@ -1453,7 +1453,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) // PS Plus upsell // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); + std::int32_t iResult=sceNpCommerceDialogInitialize(); SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); @@ -1692,7 +1692,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() HRESULT hr; std::uint32_t imageBytes = 0; - uint8_t *imageData = NULL; + std::uint8_t *imageData = NULL; if(tp==NULL) { @@ -1727,7 +1727,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(0); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp index 4695a769a..c9c590485 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp @@ -131,7 +131,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // retrieve the save icon from the texture pack, if there is one TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -271,7 +271,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -1281,7 +1281,7 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) m_texturePackDescription.SetText(tp->getDesc1().c_str()); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -1533,7 +1533,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete() ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp index 253f33807..b51ef1a79 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp @@ -185,7 +185,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -1139,7 +1139,7 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) m_texturePackDescription.SetText(tp->getDesc1().c_str()); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { @@ -1288,7 +1288,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete() ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); if(imageBytes > 0 && imageData) { diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp index f60944386..79c0d87eb 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -296,7 +296,7 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons() m_iMashUpButtonsC++; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId()); std::uint32_t imageBytes = 0; - uint8_t *imageData = tp->getPackIcon(imageBytes); + std::uint8_t *imageData = tp->getPackIcon(imageBytes); HXUIBRUSH hXuiBrush; if(imageBytes > 0 && imageData) @@ -1271,7 +1271,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() HRESULT hr; std::uint32_t imageBytes = 0; - uint8_t *imageData = NULL; + std::uint8_t *imageData = NULL; if(tp==NULL) { diff --git a/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp b/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp index c40bc20bd..ab16c7b71 100644 --- a/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp +++ b/Minecraft.Client/Platform/PS3/Network/SonyRemoteStorage_PS3.cpp @@ -85,12 +85,12 @@ int SonyRemoteStorage_PS3::initPreconditions() return 0; } -void SonyRemoteStorage_PS3::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData) +void SonyRemoteStorage_PS3::staticInternalCallback(const SceRemoteStorageEvent event, std::int32_t retCode, void * userData) { ((SonyRemoteStorage_PS3*)userData)->internalCallback(event, retCode); } -void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) +void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event, std::int32_t retCode) { m_lastErrorCode = retCode; @@ -452,7 +452,7 @@ int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bo // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size unsigned int compLength = origFilesize+8; - uint8_t *compData = (uint8_t *)malloc( compLength ); + std::uint8_t *compData = (std::uint8_t *)malloc( compLength ); Compression::UseDefaultThreadStorage(); Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize); ZeroMemory(compData,8); diff --git a/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp b/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp index 1d7a22d42..70117ffce 100644 --- a/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp +++ b/Minecraft.Client/Platform/PSVita/Network/SonyRemoteStorage_Vita.cpp @@ -25,12 +25,12 @@ static SceRemoteStorageData s_getDataOutput; -void SonyRemoteStorage_Vita::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData) +void SonyRemoteStorage_Vita::staticInternalCallback(const SceRemoteStorageEvent event, std::int32_t retCode, void * userData) { ((SonyRemoteStorage_Vita*)userData)->internalCallback(event, retCode); } -void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) +void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, std::int32_t retCode) { m_lastErrorCode = retCode; diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index 70cb0f521..ac338e36f 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -57,7 +57,7 @@ C4JThread* GameRenderer::m_updateThread; C4JThread::EventArray* GameRenderer::m_updateEvents; bool GameRenderer::nearThingsToDo = false; bool GameRenderer::updateRunning = false; -std::vector GameRenderer::m_deleteStackByte; +std::vector GameRenderer::m_deleteStackByte; std::vector GameRenderer::m_deleteStackSparseLightStorage; std::vector GameRenderer::m_deleteStackCompressedTileStorage; std::vector GameRenderer::m_deleteStackSparseDataStorage; @@ -1129,7 +1129,7 @@ void GameRenderer::renderLevel(float a) #ifdef MULTITHREAD_ENABLE // Request that an item be deleted, when it is safe to do so -void GameRenderer::AddForDelete(uint8_t *deleteThis) +void GameRenderer::AddForDelete(std::uint8_t *deleteThis) { EnterCriticalSection(&m_csDeleteStack); m_deleteStackByte.push_back(deleteThis); @@ -1892,9 +1892,9 @@ void GameRenderer::setupClearColor(float a) { unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Clear_Colour ); - uint8_t redComponent = ((colour>>16)&0xFF); - uint8_t greenComponent = ((colour>>8)&0xFF); - uint8_t blueComponent = ((colour)&0xFF); + std::uint8_t redComponent = ((colour>>16)&0xFF); + std::uint8_t greenComponent = ((colour>>8)&0xFF); + std::uint8_t blueComponent = ((colour)&0xFF); fr = (float)redComponent/256;//0.02f; fg = (float)greenComponent/256;//0.02f; @@ -1904,9 +1904,9 @@ void GameRenderer::setupClearColor(float a) { unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Clear_Colour ); - uint8_t redComponent = ((colour>>16)&0xFF); - uint8_t greenComponent = ((colour>>8)&0xFF); - uint8_t blueComponent = ((colour)&0xFF); + std::uint8_t redComponent = ((colour>>16)&0xFF); + std::uint8_t greenComponent = ((colour>>8)&0xFF); + std::uint8_t blueComponent = ((colour)&0xFF); fr = (float)redComponent/256;//0.6f; fg = (float)greenComponent/256;//0.1f; @@ -2048,9 +2048,9 @@ void GameRenderer::setupFog(int i, float alpha) glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06 unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_In_Cloud_Fog_Colour ); - uint8_t redComponent = ((colour>>16)&0xFF); - uint8_t greenComponent = ((colour>>8)&0xFF); - uint8_t blueComponent = ((colour)&0xFF); + std::uint8_t redComponent = ((colour>>16)&0xFF); + std::uint8_t greenComponent = ((colour>>8)&0xFF); + std::uint8_t blueComponent = ((colour)&0xFF); float rr = (float)redComponent/256;//1.0f; float gg = (float)greenComponent/256;//1.0f; @@ -2080,9 +2080,9 @@ void GameRenderer::setupFog(int i, float alpha) } unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Fog_Colour ); - uint8_t redComponent = ((colour>>16)&0xFF); - uint8_t greenComponent = ((colour>>8)&0xFF); - uint8_t blueComponent = ((colour)&0xFF); + std::uint8_t redComponent = ((colour>>16)&0xFF); + std::uint8_t greenComponent = ((colour>>8)&0xFF); + std::uint8_t blueComponent = ((colour)&0xFF); float rr = (float)redComponent/256;//0.4f; float gg = (float)greenComponent/256;//0.4f; @@ -2105,9 +2105,9 @@ void GameRenderer::setupFog(int i, float alpha) glFogf(GL_FOG_DENSITY, 2.0f); // was 0.06 unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Fog_Colour ); - uint8_t redComponent = ((colour>>16)&0xFF); - uint8_t greenComponent = ((colour>>8)&0xFF); - uint8_t blueComponent = ((colour)&0xFF); + std::uint8_t redComponent = ((colour>>16)&0xFF); + std::uint8_t greenComponent = ((colour>>8)&0xFF); + std::uint8_t blueComponent = ((colour)&0xFF); float rr = (float)redComponent/256;//0.4f; float gg = (float)greenComponent/256;//0.3f; diff --git a/Minecraft.Client/Rendering/GameRenderer.h b/Minecraft.Client/Rendering/GameRenderer.h index 57c32f696..3f1dc26fd 100644 --- a/Minecraft.Client/Rendering/GameRenderer.h +++ b/Minecraft.Client/Rendering/GameRenderer.h @@ -156,12 +156,12 @@ public: static bool nearThingsToDo; static bool updateRunning; #endif - static std::vector m_deleteStackByte; + static std::vector m_deleteStackByte; static std::vector m_deleteStackSparseLightStorage; static std::vector m_deleteStackCompressedTileStorage; static std::vector m_deleteStackSparseDataStorage; static CRITICAL_SECTION m_csDeleteStack; - static void AddForDelete(uint8_t *deleteThis); + static void AddForDelete(std::uint8_t *deleteThis); static void AddForDelete(SparseLightStorage *deleteThis); static void AddForDelete(CompressedTileStorage *deleteThis); static void AddForDelete(SparseDataStorage *deleteThis); diff --git a/Minecraft.Client/Rendering/Tesselator.cpp b/Minecraft.Client/Rendering/Tesselator.cpp index f4b12390c..cb48ee3c3 100644 --- a/Minecraft.Client/Rendering/Tesselator.cpp +++ b/Minecraft.Client/Rendering/Tesselator.cpp @@ -329,7 +329,7 @@ void Tesselator::color(int r, int g, int b, int a) col = (r << 24) | (g << 16) | (b << 8) | (a); } -void Tesselator::color(uint8_t r, uint8_t g, uint8_t b) +void Tesselator::color(std::uint8_t r, std::uint8_t g, std::uint8_t b) { color(r & 0xff, g & 0xff, b & 0xff); } @@ -510,16 +510,16 @@ void Tesselator::tileQuad(float x1, float y1, float z1, float u1, float v1, floa count+=4; // AP - alpha cut out is expensive on vita. This will choose the correct data buffer depending on cut out enabled - int16_t* pShortData; + std::int16_t* pShortData; if( !alphaCutOutEnabled ) { - pShortData = (int16_t*)&_array->data[p]; + pShortData = (std::int16_t*)&_array->data[p]; p += 16; vertices+=4; } else { - pShortData = (int16_t*)&_array2->data[p2]; + pShortData = (std::int16_t*)&_array2->data[p2]; p2 += 16; vertices2+=4; } @@ -784,25 +784,25 @@ void Tesselator::vertex(float x, float y, float z) #ifdef __PSVITA__ // AP - alpha cut out is expensive on vita. This will choose the correct data buffer depending on cut out enabled - int16_t* pShortData; + std::int16_t* pShortData; if( !alphaCutOutEnabled ) { - pShortData = (int16_t*)&_array->data[p]; + pShortData = (std::int16_t*)&_array->data[p]; } else { - pShortData = (int16_t*)&_array2->data[p2]; + pShortData = (std::int16_t*)&_array2->data[p2]; } #else - int16_t* pShortData = (int16_t*)&_array->data[p]; + std::int16_t* pShortData = (std::int16_t*)&_array->data[p]; #endif #ifdef __PS3__ - float tex2U = ((int16_t*)&_tex2)[1] + 8; - float tex2V = ((int16_t*)&_tex2)[0] + 8; + float tex2U = ((std::int16_t*)&_tex2)[1] + 8; + float tex2V = ((std::int16_t*)&_tex2)[0] + 8; float colVal1 = ((col&0xff000000)>>24)/256.0f; float colVal2 = ((col&0x00ff0000)>>16)/256.0f; float colVal3 = ((col&0x0000ff00)>>8)/256.0f; @@ -833,8 +833,8 @@ void Tesselator::vertex(float x, float y, float z) pShortData[3] = ipackedcol; pShortData[4] = (((int)(uu * 8192.0f))&0xffff); pShortData[5] = (((int)(v * 8192.0f))&0xffff); - int16_t u2 = ((int16_t*)&_tex2)[0]; - int16_t v2 = ((int16_t*)&_tex2)[1]; + std::int16_t u2 = ((std::int16_t*)&_tex2)[0]; + std::int16_t v2 = ((std::int16_t*)&_tex2)[1]; #if defined _XBOX_ONE || defined __ORBIS__ // Optimisation - pack the second UVs into a single short (they could actually go in a byte), which frees up a short to store the x offset for this chunk in the vertex itself. // This means that when rendering chunks, we don't need to update the vertex constants that specify the location for a chunk, when only the x offset has changed. @@ -943,9 +943,9 @@ void Tesselator::vertex(float x, float y, float z) _array->data[p + 7] = ( ( _tex2 >> 16 ) & 0xffff ) | ( _tex2 << 16 ); #else #ifdef __PS3__ - int16_t tex2U = ((int16_t*)&_tex2)[1] + 8; - int16_t tex2V = ((int16_t*)&_tex2)[0] + 8; - int16_t* pShortArray = (int16_t*)&_array->data[p + 7]; + std::int16_t tex2U = ((std::int16_t*)&_tex2)[1] + 8; + std::int16_t tex2V = ((std::int16_t*)&_tex2)[0] + 8; + std::int16_t* pShortArray = (std::int16_t*)&_array->data[p + 7]; pShortArray[0] = tex2U; pShortArray[1] = tex2V; #else @@ -997,7 +997,7 @@ void Tesselator::noColor() } #ifdef __PS3__ -uint32_t _ConvertF32toX11Y11Z10N(float x, float y, float z) +std::uint32_t _ConvertF32toX11Y11Z10N(float x, float y, float z) { // 11111111111 X 0x000007FF // 1111111111100000000000 Y 0x003FF800 @@ -1022,10 +1022,10 @@ uint32_t _ConvertF32toX11Y11Z10N(float x, float y, float z) if (z<-1.0f || z>1.0f) { printf("Value (%5.3f) should be in range [-1..1]. Conversion will clamp to X11Y11Z10N.\n", z); } #endif - const uint32_t uX = ((int32_t(std::max(std::min(((x)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_X_MASK >> X11Y11Z10N_X_SHIFT)) << X11Y11Z10N_X_SHIFT); - const uint32_t uY = ((int32_t(std::max(std::min(((y)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_Y_MASK >> X11Y11Z10N_Y_SHIFT)) << X11Y11Z10N_Y_SHIFT); - const uint32_t uZ = ((int32_t(std::max(std::min(((z)*1023.f - 1.f)*0.5f, 511.f), -512.f )) & (X11Y11Z10N_Z_MASK >> X11Y11Z10N_Z_SHIFT)) << X11Y11Z10N_Z_SHIFT); - const uint32_t xyz = uX | uY | uZ; + const std::uint32_t uX = ((std::int32_t(std::max(std::min(((x)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_X_MASK >> X11Y11Z10N_X_SHIFT)) << X11Y11Z10N_X_SHIFT); + const std::uint32_t uY = ((std::int32_t(std::max(std::min(((y)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_Y_MASK >> X11Y11Z10N_Y_SHIFT)) << X11Y11Z10N_Y_SHIFT); + const std::uint32_t uZ = ((std::int32_t(std::max(std::min(((z)*1023.f - 1.f)*0.5f, 511.f), -512.f )) & (X11Y11Z10N_Z_MASK >> X11Y11Z10N_Z_SHIFT)) << X11Y11Z10N_Z_SHIFT); + const std::uint32_t xyz = uX | uY | uZ; return xyz; } #endif // __PS3__ @@ -1038,14 +1038,14 @@ void Tesselator::normal(float x, float y, float z) _normal = _ConvertF32toX11Y11Z10N(x,y,z); #elif __PSVITA__ // AP - casting a negative value to 'byte' on Vita results in zero. changed to a signed 8 value - int8_t xx = (int8_t) (x * 127); - int8_t yy = (int8_t) (y * 127); - int8_t zz = (int8_t) (z * 127); + std::int8_t xx = (std::int8_t) (x * 127); + std::int8_t yy = (std::int8_t) (y * 127); + std::int8_t zz = (std::int8_t) (z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); #else - uint8_t xx = (uint8_t) (x * 127); - uint8_t yy = (uint8_t) (y * 127); - uint8_t zz = (uint8_t) (z * 127); + std::uint8_t xx = (std::uint8_t) (x * 127); + std::uint8_t yy = (std::uint8_t) (y * 127); + std::uint8_t zz = (std::uint8_t) (z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); #endif } diff --git a/Minecraft.Client/Rendering/Tesselator.h b/Minecraft.Client/Rendering/Tesselator.h index 59960873c..eefeaa73a 100644 --- a/Minecraft.Client/Rendering/Tesselator.h +++ b/Minecraft.Client/Rendering/Tesselator.h @@ -138,7 +138,7 @@ public: void color(float r, float g, float b, float a); void color(int r, int g, int b); void color(int r, int g, int b, int a); - void color(uint8_t r, uint8_t g, uint8_t b); + void color(std::uint8_t r, std::uint8_t g, std::uint8_t b); void vertexUV(float x, float y, float z, float u, float v); void vertex(float x, float y, float z); void color(int c); diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 4a8aa44e0..1ca33c9af 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -373,14 +373,14 @@ std::wstring AbstractTexturePack::getXuiRootPath() return szResourceLocator; } -uint8_t *AbstractTexturePack::getPackIcon(std::uint32_t &imageBytes) +std::uint8_t *AbstractTexturePack::getPackIcon(std::uint32_t &imageBytes) { if(m_iconSize == 0 || m_iconData == NULL) loadIcon(); imageBytes = m_iconSize; return m_iconData; } -uint8_t *AbstractTexturePack::getPackComparison(std::uint32_t &imageBytes) +std::uint8_t *AbstractTexturePack::getPackComparison(std::uint32_t &imageBytes) { if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison(); diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h index 3c2176622..d9cbd8222 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h @@ -19,10 +19,10 @@ protected: std::wstring desc1; std::wstring desc2; - uint8_t *m_iconData; + std::uint8_t *m_iconData; std::uint32_t m_iconSize; - uint8_t *m_comparisonData; + std::uint8_t *m_comparisonData; std::uint32_t m_comparisonSize; TexturePack *fallback; @@ -84,8 +84,8 @@ public: virtual void loadUI(); virtual void unloadUI(); virtual std::wstring getXuiRootPath(); - virtual uint8_t *getPackIcon(std::uint32_t &imageBytes); - virtual uint8_t *getPackComparison(std::uint32_t &imageBytes); + virtual std::uint8_t *getPackIcon(std::uint32_t &imageBytes); + virtual std::uint8_t *getPackComparison(std::uint32_t &imageBytes); virtual unsigned int getDLCParentPackId(); virtual unsigned char getDLCSubPackId(); virtual ColourTable *getColourTable() { return m_colourTable; } diff --git a/Minecraft.Client/Textures/Packs/TexturePack.h b/Minecraft.Client/Textures/Packs/TexturePack.h index ed36f63dd..045659ac5 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.h +++ b/Minecraft.Client/Textures/Packs/TexturePack.h @@ -47,8 +47,8 @@ public: virtual void loadUI() = 0; virtual void unloadUI() = 0; virtual std::wstring getXuiRootPath() = 0; - virtual uint8_t *getPackIcon(std::uint32_t &imageBytes) = 0; - virtual uint8_t *getPackComparison(std::uint32_t &imageBytes) = 0; + virtual std::uint8_t *getPackIcon(std::uint32_t &imageBytes) = 0; + virtual std::uint8_t *getPackComparison(std::uint32_t &imageBytes) = 0; virtual unsigned int getDLCParentPackId() = 0; virtual unsigned char getDLCSubPackId() = 0; virtual ColourTable *getColourTable() = 0; diff --git a/Minecraft.Client/Utils/ArchiveFile.cpp b/Minecraft.Client/Utils/ArchiveFile.cpp index eddd8a7fa..d39e38591 100644 --- a/Minecraft.Client/Utils/ArchiveFile.cpp +++ b/Minecraft.Client/Utils/ArchiveFile.cpp @@ -122,7 +122,7 @@ byteArray ArchiveFile::getFile(const std::wstring &filename) memcpy( out.data, m_cachedData + data->ptr, data->filesize ); #else const unsigned int fileSize = static_cast(data->filesize); - uint8_t *pbData = new uint8_t[fileSize == 0 ? 1 : fileSize]; + std::uint8_t *pbData = new std::uint8_t[fileSize == 0 ? 1 : fileSize]; out = byteArray(pbData, fileSize); const PortableFileIO::BinaryReadResult readResult = PortableFileIO::ReadBinaryFileSegment( m_sourcefile.getPath(), @@ -151,7 +151,7 @@ byteArray ArchiveFile::getFile(const std::wstring &filename) unsigned int decompressedSize = dis.readInt(); dis.close(); - uint8_t *uncompressedBuffer = new uint8_t[decompressedSize]; + std::uint8_t *uncompressedBuffer = new std::uint8_t[decompressedSize]; Compression::getCompression()->Decompress(uncompressedBuffer, &decompressedSize, out.data+4, out.length-4); delete [] out.data; diff --git a/Minecraft.Client/Utils/ArchiveFile.h b/Minecraft.Client/Utils/ArchiveFile.h index ac2fe84d9..d3f34e8be 100644 --- a/Minecraft.Client/Utils/ArchiveFile.h +++ b/Minecraft.Client/Utils/ArchiveFile.h @@ -13,7 +13,7 @@ class ArchiveFile { protected: File m_sourcefile; - uint8_t *m_cachedData; + std::uint8_t *m_cachedData; typedef struct _MetaData { diff --git a/Minecraft.Client/Utils/StringTable.cpp b/Minecraft.Client/Utils/StringTable.cpp index c86166750..2a675e707 100644 --- a/Minecraft.Client/Utils/StringTable.cpp +++ b/Minecraft.Client/Utils/StringTable.cpp @@ -7,7 +7,7 @@ StringTable::StringTable(void) } // Load string table from a binary blob, filling out with the current localisation data only -StringTable::StringTable(uint8_t *pbData, unsigned int dataSize) +StringTable::StringTable(std::uint8_t *pbData, unsigned int dataSize) { src = byteArray(pbData, dataSize); @@ -119,7 +119,7 @@ StringTable::~StringTable(void) // delete src.data; TODO 4J-JEV: ? } -void StringTable::getData(uint8_t **ppData, unsigned int *pSize) +void StringTable::getData(std::uint8_t **ppData, unsigned int *pSize) { *ppData = src.data; *pSize = src.length; diff --git a/Minecraft.Client/Utils/StringTable.h b/Minecraft.Client/Utils/StringTable.h index 8a66ffdac..c3ce4bccb 100644 --- a/Minecraft.Client/Utils/StringTable.h +++ b/Minecraft.Client/Utils/StringTable.h @@ -61,10 +61,10 @@ public: // }; StringTable(void); - StringTable(uint8_t *pbData, unsigned int dataSize); + StringTable(std::uint8_t *pbData, unsigned int dataSize); ~StringTable(void); - void getData(uint8_t **ppData, unsigned int *pSize); + void getData(std::uint8_t **ppData, unsigned int *pSize); const wchar_t *getString(const std::wstring &id); const wchar_t *getString(int id); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp index e208e1953..819156385 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp @@ -10,7 +10,7 @@ void ConsoleSaveFileConverter::ProcessSimpleFile(ConsoleSaveFile *sourceSave, Fi unsigned int numberOfBytesRead = 0; unsigned int numberOfBytesWritten = 0; - uint8_t *data = new uint8_t[sourceFileEntry->getFileSize()]; + std::uint8_t *data = new std::uint8_t[sourceFileEntry->getFileSize()]; // Read from source sourceSave->readFile(sourceFileEntry, data, sourceFileEntry->getFileSize(), &numberOfBytesRead); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp index 36d34e9a9..7f60b210e 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileInputStream.cpp @@ -25,7 +25,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile //the next byte of data, or -1 if the end of the file is reached. int ConsoleSaveFileInputStream::read() { - uint8_t byteRead = static_cast(0); + std::uint8_t byteRead = static_cast(0); unsigned int numberOfBytesRead; bool result = m_saveFile->readFile( diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp index e2e8b68c9..93a42efb7 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOutputStream.cpp @@ -38,7 +38,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b) { unsigned int numberOfBytesWritten; - uint8_t value = (uint8_t) b; + std::uint8_t value = (std::uint8_t) b; bool result = m_saveFile->writeFile( m_file, diff --git a/Minecraft.World/IO/Files/File.cpp b/Minecraft.World/IO/Files/File.cpp index aa789546a..c3cdc9598 100644 --- a/Minecraft.World/IO/Files/File.cpp +++ b/Minecraft.World/IO/Files/File.cpp @@ -410,7 +410,7 @@ std::vector *File::listFiles() const CellFsErrno err = cellFsOpendir(filePath , &fd); CellFsDirectoryEntry de; - uint32_t count = 0; + std::uint32_t count = 0; err = cellFsGetDirectoryEntries(fd, &de, sizeof(CellFsDirectoryEntry), &count); if(count != 0) { @@ -572,7 +572,7 @@ std::vector *File::listFiles(FileFilter *filter) const CellFsErrno err = cellFsOpendir(filePath, &fd); CellFsDirectoryEntry de; - uint32_t count = 0; + std::uint32_t count = 0; err = cellFsGetDirectoryEntries(fd, &de, sizeof(CellFsDirectoryEntry), &count); if(count != 0) { diff --git a/Minecraft.World/IO/Files/FileInputStream.cpp b/Minecraft.World/IO/Files/FileInputStream.cpp index 14d91f8b2..f3abe198c 100644 --- a/Minecraft.World/IO/Files/FileInputStream.cpp +++ b/Minecraft.World/IO/Files/FileInputStream.cpp @@ -75,7 +75,7 @@ int FileInputStream::read() return -1; } - uint8_t byteRead = static_cast(0); + std::uint8_t byteRead = static_cast(0); const size_t numberOfBytesRead = std::fread(&byteRead, 1, 1, m_fileHandle); if( std::ferror(m_fileHandle) != 0 ) diff --git a/Minecraft.World/IO/Files/FileOutputStream.cpp b/Minecraft.World/IO/Files/FileOutputStream.cpp index 904f6fca7..699f75101 100644 --- a/Minecraft.World/IO/Files/FileOutputStream.cpp +++ b/Minecraft.World/IO/Files/FileOutputStream.cpp @@ -51,7 +51,7 @@ void FileOutputStream::write(unsigned int b) return; } - uint8_t value = (uint8_t) b; + std::uint8_t value = (std::uint8_t) b; const size_t numberOfBytesWritten = std::fwrite(&value, 1, 1, m_fileHandle); const int result = std::ferror(m_fileHandle); diff --git a/Minecraft.World/IO/Streams/Compression.cpp b/Minecraft.World/IO/Streams/Compression.cpp index c38bf096e..2f0947191 100644 --- a/Minecraft.World/IO/Streams/Compression.cpp +++ b/Minecraft.World/IO/Streams/Compression.cpp @@ -312,7 +312,7 @@ HRESULT Compression::Compress(void *pDestination, unsigned int *pDestSize, void *pDestSize = (unsigned int)destSize; return ( ( res == Z_OK ) ? S_OK : -1 ); #elif defined __PS3__ - uint32_t destSize = (uint32_t)(*pDestSize); + std::uint32_t destSize = (std::uint32_t)(*pDestSize); bool res = EdgeZLib::Compress(pDestination, &destSize, pSource, SrcSize); *pDestSize = (unsigned int)destSize; return ( ( res ) ? S_OK : -1 ); @@ -340,7 +340,7 @@ HRESULT Compression::Decompress(void *pDestination, unsigned int *pDestSize, voi *pDestSize = (unsigned int)destSize; return ( ( res == Z_OK ) ? S_OK : -1 ); #elif defined __PS3__ - uint32_t destSize = (uint32_t)(*pDestSize); + std::uint32_t destSize = (std::uint32_t)(*pDestSize); bool res = EdgeZLib::Decompress(pDestination, &destSize, pSource, SrcSize); *pDestSize = (unsigned int)destSize; return ( ( res ) ? S_OK : -1 ); @@ -356,11 +356,11 @@ HRESULT Compression::Decompress(void *pDestination, unsigned int *pDestSize, voi #ifndef _XBOX void Compression::VitaVirtualDecompress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize) // (LPVOID buf, SIZE_T dwSize, LPVOID dst) { - uint8_t *pSrc = (uint8_t *)pSource; + std::uint8_t *pSrc = (std::uint8_t *)pSource; int Offset = 0; int Page = 0; int Index = 0; - uint8_t* Data = (uint8_t*)pDestination; + std::uint8_t* Data = (std::uint8_t*)pDestination; while( Index != SrcSize ) { // is this a normal value diff --git a/Minecraft.World/Level/CustomLevelSource.cpp b/Minecraft.World/Level/CustomLevelSource.cpp index d31aed6b2..a0d4fd057 100644 --- a/Minecraft.World/Level/CustomLevelSource.cpp +++ b/Minecraft.World/Level/CustomLevelSource.cpp @@ -164,11 +164,11 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) // 4J - this comparison used to just be with 0.0f but is now varied by block above if (yc * CHUNK_HEIGHT + y < mapHeight) { - tileId = (uint8_t) Tile::rock_Id; + tileId = (std::uint8_t) Tile::rock_Id; } else if (yc * CHUNK_HEIGHT + y < waterHeight) { - tileId = (uint8_t) Tile::calmWater_Id; + tileId = (std::uint8_t) Tile::calmWater_Id; } // 4J - more extra code to make sure that the column at the edge of the world is just water & rock, to match the infinite sea that @@ -226,8 +226,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi int run = -1; - uint8_t top = b->topMaterial; - uint8_t material = b->material; + std::uint8_t top = b->topMaterial; + std::uint8_t material = b->material; LevelGenerationOptions *lgo = app.getLevelGenerationOptions(); if(lgo != NULL) @@ -250,7 +250,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y <= 1 + random->nextInt(2)) // 4J - changed to make the bedrock not have bits you can get stuck in // if (y <= 0 + random->nextInt(5)) { - blocks[offs] = (uint8_t) Tile::unbreakable_Id; + blocks[offs] = (std::uint8_t) Tile::unbreakable_Id; } else { @@ -267,7 +267,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (runDepth <= 0) { top = 0; - material = (uint8_t) Tile::rock_Id; + material = (std::uint8_t) Tile::rock_Id; } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { @@ -281,8 +281,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y < waterHeight && top == 0) { - if (temp < 0.15f) top = (uint8_t) Tile::ice_Id; - else top = (uint8_t) Tile::calmWater_Id; + if (temp < 0.15f) top = (std::uint8_t) Tile::ice_Id; + else top = (std::uint8_t) Tile::calmWater_Id; } run = runDepth; @@ -299,7 +299,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (run == 0 && material == Tile::sand_Id) { run = random->nextInt(4); - material = (uint8_t) Tile::sandStone_Id; + material = (std::uint8_t) Tile::sandStone_Id; } } } @@ -328,7 +328,7 @@ LevelChunk *CustomLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int blocksSize = Level::maxBuildHeight * 16 * 16; - uint8_t *tileData = (uint8_t *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + std::uint8_t *tileData = (std::uint8_t *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index e70c2d49c..eee1b4068 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -19,7 +19,7 @@ _MapDataMappings::_MapDataMappings() #ifndef _DURANGO ZeroMemory(xuids,sizeof(PlayerUID)*MAXIMUM_MAP_SAVE_DATA); #endif - ZeroMemory(dimensions,sizeof(uint8_t)*(MAXIMUM_MAP_SAVE_DATA/4)); + ZeroMemory(dimensions,sizeof(std::uint8_t)*(MAXIMUM_MAP_SAVE_DATA/4)); } int _MapDataMappings::getDimension(int id) @@ -84,7 +84,7 @@ _MapDataMappings_old::_MapDataMappings_old() #ifndef _DURANGO ZeroMemory(xuids,sizeof(PlayerUID)*MAXIMUM_MAP_SAVE_DATA); #endif - ZeroMemory(dimensions,sizeof(uint8_t)*(MAXIMUM_MAP_SAVE_DATA/8)); + ZeroMemory(dimensions,sizeof(std::uint8_t)*(MAXIMUM_MAP_SAVE_DATA/8)); } int _MapDataMappings_old::getDimension(int id) diff --git a/Minecraft.World/Level/Storage/RegionFile.cpp b/Minecraft.World/Level/Storage/RegionFile.cpp index 03e59f4bd..d47a0eddf 100644 --- a/Minecraft.World/Level/Storage/RegionFile.cpp +++ b/Minecraft.World/Level/Storage/RegionFile.cpp @@ -57,10 +57,10 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) //if ((GetFileSize(file,NULL) & 0xfff) != 0) if ((fileEntry->getFileSize() & 0xfff) != 0) { - //uint8_t zero = 0; + //std::uint8_t zero = 0; unsigned int numberOfBytesWritten = 0; unsigned int bytesToWrite = 0x1000 - (fileEntry->getFileSize() & 0xfff); - uint8_t *zeroBytes = new uint8_t[ bytesToWrite ]; + std::uint8_t *zeroBytes = new std::uint8_t[ bytesToWrite ]; ZeroMemory(zeroBytes, bytesToWrite); /* the file size is not a multiple of 4KB, grow it */ @@ -233,8 +233,8 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was } MemSect(50); - uint8_t *data = new uint8_t[length]; - uint8_t *decomp = new uint8_t[decompLength]; + std::uint8_t *data = new std::uint8_t[length]; + std::uint8_t *decomp = new std::uint8_t[decompLength]; MemSect(0); readDecompLength = decompLength; m_saveFile->readFile(fileEntry,data,length,&numberOfBytesRead); @@ -273,10 +273,10 @@ DataOutputStream *RegionFile::getChunkDataOutputStream(int x, int z) } /* write a chunk at (x,z) with length bytes of data to disk */ -void RegionFile::write(int x, int z, uint8_t *data, int length) // TODO - was synchronized +void RegionFile::write(int x, int z, std::uint8_t *data, int length) // TODO - was synchronized { // 4J Stu - Do the compression here so that we know how much space we need to store the compressed data - uint8_t *compData = new uint8_t[length + 2048]; // presuming compression is going to make this smaller... UPDATE - for some really small things this isn't the case. Added 2K on here to cover those. + std::uint8_t *compData = new std::uint8_t[length + 2048]; // presuming compression is going to make this smaller... UPDATE - for some really small things this isn't the case. Added 2K on here to cover those. unsigned int compLength = length; Compression::getCompression()->CompressLZXRLE(compData,&compLength,data,length); @@ -403,7 +403,7 @@ void RegionFile::write(int x, int z, uint8_t *data, int length) // TODO - was s } /* write a chunk data to the region file at specified sector number */ -void RegionFile::write(int sectorNumber, uint8_t *data, int length, unsigned int compLength) +void RegionFile::write(int sectorNumber, std::uint8_t *data, int length, unsigned int compLength) { unsigned int numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); @@ -451,7 +451,7 @@ void RegionFile::insertInitialSectors() { m_saveFile->setFilePointer( fileEntry, 0, SaveFileSeekOrigin::Begin ); unsigned int numberOfBytesWritten = 0; - uint8_t zeroBytes[ SECTOR_BYTES ]; + std::uint8_t zeroBytes[ SECTOR_BYTES ]; ZeroMemory(zeroBytes, SECTOR_BYTES); /* we need to write the chunk offset table */ diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp index f1c32d19b..fe5a40516 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp @@ -45,9 +45,9 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr player, PlayerUID xuid, // 4J - changed - send current "previously sent" value of rotations to put this in sync with other clients yRot = yRotp; xRot = xRotp; - yHeadRot = static_cast(yHeadRotp); // 4J Added - // yRot = (uint8_t) (player->yRot * 256 / 360); - // xRot = (uint8_t) (player->xRot * 256 / 360); + yHeadRot = static_cast(yHeadRotp); // 4J Added + // yRot = (std::uint8_t) (player->yRot * 256 / 360); + // xRot = (std::uint8_t) (player->xRot * 256 / 360); //printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot); @@ -97,13 +97,13 @@ void AddPlayerPacket::write(DataOutputStream *dos) //throws IOException dos->writeInt(x); dos->writeInt(y); dos->writeInt(z); - dos->writeByte(static_cast(yRot)); - dos->writeByte(static_cast(xRot)); - dos->writeByte(static_cast(m_playerIndex)); // 4J Added + dos->writeByte(static_cast(yRot)); + dos->writeByte(static_cast(xRot)); + dos->writeByte(static_cast(m_playerIndex)); // 4J Added dos->writeShort(carriedItem); dos->writePlayerUID(xuid); dos->writePlayerUID(OnlineXuid); - dos->writeByte(static_cast(m_playerIndex)); // 4J Added + dos->writeByte(static_cast(m_playerIndex)); // 4J Added int skinId = 0; std::memcpy(&skinId, &m_skinId, sizeof(m_skinId)); dos->writeInt(skinId); @@ -122,7 +122,7 @@ void AddPlayerPacket::handle(PacketListener *listener) int AddPlayerPacket::getEstimatedSize() { - int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(std::uint8_t) + sizeof(std::uint8_t) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(std::uint8_t) + sizeof(unsigned int) + sizeof(uint8_t); + int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(std::uint8_t) + sizeof(std::uint8_t) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(std::uint8_t) + sizeof(unsigned int) + sizeof(std::uint8_t); if( entityData != NULL ) { diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.h b/Minecraft.World/Network/Packets/AddPlayerPacket.h index 43b86165f..1cef92752 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.h +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.h @@ -26,7 +26,7 @@ public: std::uint32_t m_skinId; // 4J Added std::uint32_t m_capeId; // 4J Added unsigned int m_uiGamePrivileges; // 4J Added - uint8_t yHeadRot; // 4J Added + std::uint8_t yHeadRot; // 4J Added AddPlayerPacket(); ~AddPlayerPacket(); diff --git a/Minecraft.World/Network/Packets/KickPlayerPacket.cpp b/Minecraft.World/Network/Packets/KickPlayerPacket.cpp index fcbdce6bc..afb1666cf 100644 --- a/Minecraft.World/Network/Packets/KickPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/KickPlayerPacket.cpp @@ -28,7 +28,7 @@ void KickPlayerPacket::read(DataInputStream *dis) //throws IOException void KickPlayerPacket::write(DataOutputStream *dos) //throws IOException { - dos->writeByte((uint8_t)m_networkSmallId); + dos->writeByte((std::uint8_t)m_networkSmallId); } int KickPlayerPacket::getEstimatedSize() diff --git a/Minecraft.World/Network/Packets/LoginPacket.cpp b/Minecraft.World/Network/Packets/LoginPacket.cpp index 83b04924a..9eafe5cc5 100644 --- a/Minecraft.World/Network/Packets/LoginPacket.cpp +++ b/Minecraft.World/Network/Packets/LoginPacket.cpp @@ -146,18 +146,18 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException } dos->writeLong(seed); dos->writeInt(gameType); - dos->writeByte((uint8_t)dimension); - dos->writeByte((uint8_t)mapHeight); - dos->writeByte((uint8_t)maxPlayers); + dos->writeByte((std::uint8_t)dimension); + dos->writeByte((std::uint8_t)mapHeight); + dos->writeByte((std::uint8_t)maxPlayers); dos->writePlayerUID(m_offlineXuid); dos->writePlayerUID(m_onlineXuid); dos->writeBoolean(m_friendsOnlyUGC); int ugcPlayersVersion = 0; std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); dos->writeInt(ugcPlayersVersion); - dos->writeByte((uint8_t)difficulty); + dos->writeByte((std::uint8_t)difficulty); dos->writeInt(m_multiplayerInstanceId); - dos->writeByte((uint8_t)m_playerIndex); + dos->writeByte((std::uint8_t)m_playerIndex); int skinId = 0; std::memcpy(&skinId, &m_playerSkinId, sizeof(m_playerSkinId)); dos->writeInt(skinId); diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.cpp b/Minecraft.World/Network/Packets/PreLoginPacket.cpp index 030c3e88e..d3e746e1a 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.cpp +++ b/Minecraft.World/Network/Packets/PreLoginPacket.cpp @@ -96,7 +96,7 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException std::int32_t ugcPlayersVersion = 0; std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); dos->writeInt(ugcPlayersVersion); - dos->writeByte((uint8_t)m_dwPlayerCount); + dos->writeByte((std::uint8_t)m_dwPlayerCount); for(std::uint32_t i = 0; i < m_dwPlayerCount; ++i) { dos->writePlayerUID( m_playerXuids[i] ); diff --git a/Minecraft.World/Network/Socket.cpp b/Minecraft.World/Network/Socket.cpp index b6d252532..010b29dfe 100644 --- a/Minecraft.World/Network/Socket.cpp +++ b/Minecraft.World/Network/Socket.cpp @@ -11,7 +11,7 @@ // link, the end (0 or 1) is passed as a parameter to the ctor. CRITICAL_SECTION Socket::s_hostQueueLock[2]; -std::queue Socket::s_hostQueue[2]; +std::queue Socket::s_hostQueue[2]; Socket::SocketOutputStreamLocal *Socket::s_hostOutStream[2]; Socket::SocketInputStreamLocal *Socket::s_hostInStream[2]; ServerConnection *Socket::s_serverConnection = NULL; @@ -49,7 +49,7 @@ void Socket::Initialise(ServerConnection *serverConnection) if(TryEnterCriticalSection(&s_hostQueueLock[i])) { // Clear the queue - std::queue empty; + std::queue empty; std::swap( s_hostQueue[i], empty ); LeaveCriticalSection(&s_hostQueueLock[i]); } @@ -298,7 +298,7 @@ int Socket::SocketInputStreamLocal::read() { if( s_hostQueue[m_queueIdx].size() ) { - uint8_t retval = s_hostQueue[m_queueIdx].front(); + std::uint8_t retval = s_hostQueue[m_queueIdx].front(); s_hostQueue[m_queueIdx].pop(); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); return retval; @@ -344,7 +344,7 @@ void Socket::SocketInputStreamLocal::close() { m_streamOpen = false; EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - std::queue().swap(s_hostQueue[m_queueIdx]); + std::queue().swap(s_hostQueue[m_queueIdx]); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -363,7 +363,7 @@ void Socket::SocketOutputStreamLocal::write(unsigned int b) return; } EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - s_hostQueue[m_queueIdx].push((uint8_t)b); + s_hostQueue[m_queueIdx].push((std::uint8_t)b); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -392,7 +392,7 @@ void Socket::SocketOutputStreamLocal::close() { m_streamOpen = false; EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - std::queue().swap(s_hostQueue[m_queueIdx]); + std::queue().swap(s_hostQueue[m_queueIdx]); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -414,7 +414,7 @@ int Socket::SocketInputStreamNetwork::read() { if( m_socket->m_queueNetwork[m_queueIdx].size() ) { - uint8_t retval = m_socket->m_queueNetwork[m_queueIdx].front(); + std::uint8_t retval = m_socket->m_queueNetwork[m_queueIdx].front(); m_socket->m_queueNetwork[m_queueIdx].pop(); LeaveCriticalSection(&m_socket->m_queueLockNetwork[m_queueIdx]); return retval; @@ -474,8 +474,8 @@ void Socket::SocketOutputStreamNetwork::write(unsigned int b) { if( m_streamOpen != true ) return; byteArray barray; - uint8_t bb; - bb = (uint8_t)b; + std::uint8_t bb; + bb = (std::uint8_t)b; barray.data = &bb; barray.length = 1; write(barray, 0, 1); diff --git a/Minecraft.World/Network/Socket.h b/Minecraft.World/Network/Socket.h index aed12b0b7..293f9dd4a 100644 --- a/Minecraft.World/Network/Socket.h +++ b/Minecraft.World/Network/Socket.h @@ -97,12 +97,12 @@ private: // For local connections between the host player and the server static CRITICAL_SECTION s_hostQueueLock[2]; - static std::queue s_hostQueue[2]; + static std::queue s_hostQueue[2]; static SocketOutputStreamLocal *s_hostOutStream[2]; static SocketInputStreamLocal *s_hostInStream[2]; // For network connections - std::queue m_queueNetwork[2]; // For input data + std::queue m_queueNetwork[2]; // For input data CRITICAL_SECTION m_queueLockNetwork[2]; // For input data SocketInputStreamNetwork *m_inputStream[2]; SocketOutputStreamNetwork *m_outputStream[2]; diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index d842e6ea5..5a1361d04 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -183,8 +183,8 @@ void Player::defineSynchedData() { this->Mob::defineSynchedData(); - entityData->define(DATA_PLAYER_FLAGS_ID, (uint8_t) 0); - entityData->define(DATA_PLAYER_RUNNING_ID, (uint8_t) 0); + entityData->define(DATA_PLAYER_FLAGS_ID, (std::uint8_t) 0); + entityData->define(DATA_PLAYER_RUNNING_ID, (std::uint8_t) 0); } std::shared_ptr Player::getUseItem() @@ -572,7 +572,7 @@ void Player::completeUsingItem() } } -void Player::handleEntityEvent(uint8_t id) +void Player::handleEntityEvent(std::uint8_t id) { if (id == EntityEvent::USE_ITEM_COMPLETE) { @@ -1979,14 +1979,14 @@ bool Player::getPlayerFlag(int flag) void Player::setPlayerFlag(int flag, bool value) { - uint8_t currentValue = entityData->getByte(DATA_PLAYER_FLAGS_ID); + std::uint8_t currentValue = entityData->getByte(DATA_PLAYER_FLAGS_ID); if (value) { - entityData->set(DATA_PLAYER_FLAGS_ID, (uint8_t) (currentValue | (1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, (std::uint8_t) (currentValue | (1 << flag))); } else { - entityData->set(DATA_PLAYER_FLAGS_ID, (uint8_t) (currentValue & ~(1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, (std::uint8_t) (currentValue & ~(1 << flag))); } } diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index 04cce224b..62f0a018d 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -161,7 +161,7 @@ protected: virtual void completeUsingItem(); public: - virtual void handleEntityEvent(uint8_t id); + virtual void handleEntityEvent(std::uint8_t id); protected: bool isImmobile(); From 0437fb921f5822278286049bb8dcaacff2c73c1b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:14:50 +1100 Subject: [PATCH 061/192] Use standard byte counts for base save data --- Minecraft.Client/MinecraftServer.cpp | 4 +- .../GameRules/LevelGenerationOptions.cpp | 14 ++--- .../Common/GameRules/LevelGenerationOptions.h | 10 ++-- .../Textures/Packs/DLCTexturePack.cpp | 36 +++++------ .../IO/Files/ConsoleSaveFileOriginal.cpp | 46 +++++++------- .../IO/Files/ConsoleSaveFileOriginal.h | 4 +- .../IO/Files/ConsoleSaveFileSplit.cpp | 60 +++++++++---------- .../IO/Files/ConsoleSaveFileSplit.h | 16 ++--- 8 files changed, 95 insertions(+), 95 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 373bab6c4..bee3bbbca 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -426,8 +426,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); if( levelGen != NULL && levelGen->requiresBaseSave()) { - DWORD fileSize = 0; - LPVOID pvSaveData = levelGen->getBaseSaveData(fileSize); + unsigned int fileSize = 0; + std::uint8_t *pvSaveData = levelGen->getBaseSaveData(fileSize); if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true; } ConsoleSaveFileSplit *newFormatSave = NULL; diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index d2790f1bd..6839434ae 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -55,7 +55,7 @@ LevelGenerationOptions::LevelGenerationOptions() m_bRequiresGameRules = false; m_pbBaseSaveData = NULL; - m_dwBaseSaveSize = 0; + m_baseSaveSize = 0; } LevelGenerationOptions::~LevelGenerationOptions() @@ -331,7 +331,7 @@ void LevelGenerationOptions::clearSchematics() m_schematics.clear(); } -ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstring &filename, PBYTE pbData, DWORD dwLen) +ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstring &filename, std::uint8_t *pbData, unsigned int dataLength) { // If we have already loaded this, just return AUTO_VAR(it, m_schematics.find(filename)); @@ -345,7 +345,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstri } ConsoleSchematicFile *schematic = NULL; - byteArray data(pbData,dwLen); + byteArray data(pbData, dataLength); ByteArrayInputStream bais(data); DataInputStream dis(&bais); schematic = new ConsoleSchematicFile(); @@ -497,10 +497,10 @@ void LevelGenerationOptions::setBaseSavePath(const std::wstring &x) { info()->se bool LevelGenerationOptions::ready() { return info()->ready(); } -void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; } -PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; } -bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; } -void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; } +void LevelGenerationOptions::setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize) { m_pbBaseSaveData = pbData; m_baseSaveSize = dataSize; } +std::uint8_t *LevelGenerationOptions::getBaseSaveData(unsigned int &size) { size = m_baseSaveSize; return m_pbBaseSaveData; } +bool LevelGenerationOptions::hasBaseSaveData() { return m_baseSaveSize > 0 && m_pbBaseSaveData != NULL; } +void LevelGenerationOptions::deleteBaseSaveData() { delete[] m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_baseSaveSize = 0; } bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; } void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; } diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h index 47cc6a649..135e509a0 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h @@ -105,8 +105,8 @@ private: bool m_hasLoadedData; - PBYTE m_pbBaseSaveData; - DWORD m_dwBaseSaveSize; + std::uint8_t *m_pbBaseSaveData; + unsigned int m_baseSaveSize; public: @@ -138,8 +138,8 @@ public: bool ready(); - void setBaseSaveData(PBYTE pbData, DWORD dwSize); - PBYTE getBaseSaveData(DWORD &size); + void setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize); + std::uint8_t *getBaseSaveData(unsigned int &size); bool hasBaseSaveData(); void deleteBaseSaveData(); @@ -188,7 +188,7 @@ private: void clearSchematics(); public: - ConsoleSchematicFile *loadSchematicFile(const std::wstring &filename, PBYTE pbData, DWORD dwLen); + ConsoleSchematicFile *loadSchematicFile(const std::wstring &filename, std::uint8_t *pbData, unsigned int dataLength); public: ConsoleSchematicFile *getSchematicFile(const std::wstring &filename); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 06880099b..9a3d41054 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -22,10 +22,10 @@ namespace { - bool ReadPortableBinaryFile(File &file, uint8_t *&data, DWORD &size) + bool ReadPortableBinaryFile(File &file, std::uint8_t *&data, unsigned int &size) { const __int64 fileLength = file.length(); - if (fileLength < 0 || fileLength > static_cast<__int64>(std::numeric_limits::max())) + if (fileLength < 0 || fileLength > static_cast<__int64>(std::numeric_limits::max())) { data = NULL; size = 0; @@ -33,10 +33,10 @@ namespace } const std::size_t capacity = static_cast(fileLength); - uint8_t *buffer = new uint8_t[capacity == 0 ? 1 : capacity]; + std::uint8_t *buffer = new std::uint8_t[capacity == 0 ? 1 : capacity]; const PortableFileIO::BinaryReadResult readResult = PortableFileIO::ReadBinaryFile(file.getPath(), buffer, capacity); if (readResult.status != PortableFileIO::BinaryReadStatus::ok - || readResult.fileSize > std::numeric_limits::max()) + || readResult.fileSize > std::numeric_limits::max()) { delete [] buffer; data = NULL; @@ -45,7 +45,7 @@ namespace } data = buffer; - size = static_cast(readResult.fileSize); + size = static_cast(readResult.fileSize); return true; } } @@ -223,7 +223,7 @@ void DLCTexturePack::loadColourTable() DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); std::uint32_t dwSize = 0; - uint8_t *pbData = dataFile->getData(dwSize); + std::uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; @@ -343,8 +343,8 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if(xzpPath.exists()) { - uint8_t *pbData = NULL; - DWORD bytesRead = 0; + std::uint8_t *pbData = NULL; + unsigned int bytesRead = 0; if( ReadPortableBinaryFile(xzpPath, pbData, bytesRead) ) { DLCUIDataFile *uiDLCFile = (DLCUIDataFile *)texturePack->m_dlcDataPack->addFile(DLCManager::e_DLCType_UIData,L"TexturePack.xzp"); @@ -374,12 +374,12 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen File grf( getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dlcFile->getGrfPath() ) ); if (grf.exists()) { - uint8_t *pbData = NULL; - DWORD dwFileSize = 0; - if( ReadPortableBinaryFile(grf, pbData, dwFileSize) ) + std::uint8_t *pbData = NULL; + unsigned int fileSize = 0; + if( ReadPortableBinaryFile(grf, pbData, fileSize) ) { // 4J-PB - is it possible that we can get here after a read fail and it's not an error? - dlcFile->setGrfData(pbData, dwFileSize, texturePack->m_stringTable); + dlcFile->setGrfData(pbData, fileSize, texturePack->m_stringTable); delete [] pbData; @@ -397,12 +397,12 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen File grf(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), levelGen->getBaseSavePath() )); if (grf.exists()) { - uint8_t *pbData = NULL; - DWORD dwFileSize = 0; - if( ReadPortableBinaryFile(grf, pbData, dwFileSize) ) + std::uint8_t *pbData = NULL; + unsigned int fileSize = 0; + if( ReadPortableBinaryFile(grf, pbData, fileSize) ) { // 4J-PB - is it possible that we can get here after a read fail and it's not an error? - levelGen->setBaseSaveData(pbData, dwFileSize); + levelGen->setBaseSaveData(pbData, fileSize); } else { @@ -481,7 +481,7 @@ void DLCTexturePack::loadUI() DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); std::uint32_t dwSize = 0; - uint8_t *pbData = dataFile->getData(dwSize); + std::uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; @@ -555,7 +555,7 @@ std::wstring DLCTexturePack::getXuiRootPath() DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); std::uint32_t dwSize = 0; - uint8_t *pbData = dataFile->getData(dwSize); + std::uint8_t *pbData = dataFile->getData(dwSize); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 0f8bcd41f..4dd16bd4a 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -24,7 +24,7 @@ unsigned int ConsoleSaveFileOriginal::pagesCommitted = 0; void *ConsoleSaveFileOriginal::pvHeap = NULL; -ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, void *pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, void *pvSaveData /*= NULL*/, unsigned int initialFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); @@ -44,7 +44,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, v pvSaveMem = pvHeap; m_fileName = fileName; - DWORD fileSize = dFileSize; + unsigned int fileSize = initialFileSize; // Load a save from the game rules bool bLevelGenBaseSave = false; @@ -61,7 +61,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, v if( forceCleanSave ) fileSize = 0; - DWORD heapSize = std::max( fileSize, (DWORD)(1024 * 1024 * 2)); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with + unsigned int heapSize = std::max(fileSize, 1024u * 1024u * 2u); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with // Initially committ enough room to store headSize bytes (using CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one save file at a time, // and the pages should be decommitted in the dtor, so pages committed should always be zero at this point. @@ -173,9 +173,9 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, v } // Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries - DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; + unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - DWORD desiredSize = decompSize; + unsigned int desiredSize = decompSize; if( desiredSize > currentHeapSize ) { @@ -239,13 +239,13 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file ) LockSaveAccess(); - DWORD numberOfBytesRead = 0; - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; const int bufferSize = 4096; int amountToRead = bufferSize; - uint8_t buffer[bufferSize]; - DWORD bufferDataSize = 0; + std::uint8_t buffer[bufferSize]; + unsigned int bufferDataSize = 0; char *readStartOffset = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); @@ -482,15 +482,15 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, unsigned int nNumb const unsigned int bufferSize = 4096; unsigned int amountToRead = bufferSize; //assert( nNumberOfBytesToWrite <= bufferSize ); - static uint8_t buffer1[bufferSize]; - static uint8_t buffer2[bufferSize]; - DWORD buffer1Size = 0; - DWORD buffer2Size = 0; + static std::uint8_t buffer1[bufferSize]; + static std::uint8_t buffer2[bufferSize]; + unsigned int buffer1Size = 0; + unsigned int buffer2Size = 0; // Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries - DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; + unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - DWORD desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; + unsigned int desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; if( desiredSize > currentHeapSize ) { @@ -577,7 +577,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, unsigned int nNumb // Fill buffer 1 from file if( (readStartOffset - bufferSize) < spaceStartOffset ) { - amountToRead = (DWORD)(readStartOffset - spaceStartOffset); + amountToRead = static_cast(readStartOffset - spaceStartOffset); } else { @@ -674,11 +674,11 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) // On PS3, don't compress the data as we can't really afford the extra memory this requires for the output buffer. Instead we'll be writing // directly from the save data. StorageManager.SetSaveData(pvSaveMem,fileSize); - uint8_t *compData = (uint8_t *)pvSaveMem; + std::uint8_t *compData = (std::uint8_t *)pvSaveMem; #else // Attempt to allocate the required memory // We do not own this, it belongs to the StorageManager - uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength ); + std::uint8_t *compData = (std::uint8_t *)StorageManager.AllocateSaveData( compLength ); #ifdef __PSVITA__ // AP - make sure we always allocate just what is needed so it will only SAVE what is needed. @@ -716,7 +716,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) compLength = compLength+8; // Attempt to allocate the required memory - compData = (uint8_t *)StorageManager.AllocateSaveData( compLength ); + compData = (std::uint8_t *)StorageManager.AllocateSaveData( compLength ); } #endif @@ -824,7 +824,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) #if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) -int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) +int ConsoleSaveFileOriginal::SaveSaveDataCallback(void *lpParam, bool bRes) { ConsoleSaveFile *pClass=(ConsoleSaveFile *)lpParam; @@ -842,7 +842,7 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, unsigned int fileSize = header.GetFileSize(); - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; #ifdef _XBOX File targetFileDir(L"GAME:\\Saves"); #else @@ -999,8 +999,8 @@ bool ConsoleSaveFileOriginal::isLocalEndianDifferent( ESavePlatform plat ) void ConsoleSaveFileOriginal::ConvertRegionFile(File sourceFile) { - DWORD numberOfBytesWritten = 0; - DWORD numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; RegionFile sourceRegionFile(this, &sourceFile); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index d5af2e124..6cbf2ce4b 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -33,9 +33,9 @@ private: public: #if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) - static int SaveSaveDataCallback(LPVOID lpParam,bool bRes); + static int SaveSaveDataCallback(void *lpParam, bool bRes); #endif - ConsoleSaveFileOriginal(const std::wstring &fileName, void *pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); + ConsoleSaveFileOriginal(const std::wstring &fileName, void *pvSaveData = NULL, unsigned int fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); virtual ~ConsoleSaveFileOriginal(); // 4J Stu - Initial implementation is intended to have a similar interface to the standard Xbox file access functions diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 762231d6e..200fca5c5 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -54,7 +54,7 @@ void ConsoleSaveFileSplit::RegionFileReference::Compress() unsigned char *dataIn = data; unsigned char *dataInLast = data + fileEntry->data.length; -// int64_t startTime = System::currentTimeMillis(); +// std::int64_t startTime = System::currentTimeMillis(); // One pass through to work out storage space required for compressed data unsigned int outputSize = 4; // 4 bytes required to store the uncompressed size for faster decompression @@ -189,14 +189,14 @@ void ConsoleSaveFileSplit::RegionFileReference::Compress() } assert(( dataOut - dataCompressed ) == outputSize ); dataCompressedSize = outputSize; -// int64_t endTime = System::currentTimeMillis(); +// std::int64_t endTime = System::currentTimeMillis(); // app.DebugPrintf("Compressing region file 0x%.8x from %d to %d bytes - %dms\n", fileEntry->data.regionIndex, fileEntry->data.length, dataCompressedSize, endTime - startTime); } // Decompress from dataCompressed -> data. See comment in Compress method for format void ConsoleSaveFileSplit::RegionFileReference::Decompress() { -// int64_t startTime = System::currentTimeMillis(); +// std::int64_t startTime = System::currentTimeMillis(); fileEntry->data.length = *((unsigned int *)dataCompressed); // If this is unusually large, then test how big it would be when expanded before trying to allocate. Matching the expanded size @@ -285,7 +285,7 @@ void ConsoleSaveFileSplit::RegionFileReference::Decompress() data = NULL; assert(0); } -// int64_t endTime = System::currentTimeMillis(); +// std::int64_t endTime = System::currentTimeMillis(); // app.DebugPrintf("Decompressing region file from 0x%.8x %d to %d bytes - %dms\n", fileEntry->data.regionIndex, dataCompressedSize, fileEntry->data.length, endTime - startTime);// } @@ -380,9 +380,9 @@ FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) return newRef->fileEntry; } -ConsoleSaveFileSplit::ConsoleSaveFileSplit(const std::wstring &fileName, void *pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileSplit::ConsoleSaveFileSplit(const std::wstring &fileName, void *pvSaveData /*= NULL*/, unsigned int initialFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { - DWORD fileSize = dFileSize; + unsigned int fileSize = initialFileSize; // Load a save from the game rules bool bLevelGenBaseSave = false; @@ -419,7 +419,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alr std::vector *sourceFiles = sourceSave->getFilesWithPrefix(L""); - DWORD bytesWritten; + unsigned int bytesWritten = 0; for(AUTO_VAR(it, sourceFiles->begin()); it != sourceFiles->end(); ++it) { FileEntry *sourceEntry = *it; @@ -438,7 +438,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alr } } -void ConsoleSaveFileSplit::_init(const std::wstring &fileName, void *pvSaveData, DWORD fileSize, ESavePlatform plat) +void ConsoleSaveFileSplit::_init(const std::wstring &fileName, void *pvSaveData, unsigned int fileSize, ESavePlatform plat) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); @@ -479,7 +479,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring &fileName, void *pvSaveData, regionFiles[regionIndex] = regionFileRef; } - DWORD heapSize = std::max( fileSize, (DWORD)(1024 * 1024 * 2)); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with + unsigned int heapSize = std::max(fileSize, 1024u * 1024u * 2u); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with // Initially committ enough room to store headSize bytes (using CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one save file at a time, // and the pages should be decommitted in the dtor, so pages committed should always be zero at this point. @@ -538,9 +538,9 @@ void ConsoleSaveFileSplit::_init(const std::wstring &fileName, void *pvSaveData, { // Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries - DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; + unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - DWORD desiredSize = decompSize; + unsigned int desiredSize = decompSize; if( desiredSize > currentHeapSize ) { @@ -637,13 +637,13 @@ void ConsoleSaveFileSplit::deleteFile( FileEntry *file ) LockSaveAccess(); - DWORD numberOfBytesRead = 0; - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; const int bufferSize = 4096; int amountToRead = bufferSize; - uint8_t buffer[bufferSize]; - DWORD bufferDataSize = 0; + std::uint8_t buffer[bufferSize]; + unsigned int bufferDataSize = 0; char *readStartOffset = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); @@ -911,7 +911,7 @@ bool ConsoleSaveFileSplit::closeHandle( FileEntry *file ) // In this method, attempt to write any dirty region files, subject to maintaining a maximum write output rate. Writing is prioritised by time since the region was last written. void ConsoleSaveFileSplit::tick() { - int64_t currentTime = System::currentTimeMillis(); + std::int64_t currentTime = System::currentTimeMillis(); // Don't do anything if the save system is up to something... if( StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) @@ -1052,15 +1052,15 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, unsigned int nNumberO const unsigned int bufferSize = 4096; unsigned int amountToRead = bufferSize; //assert( nNumberOfBytesToWrite <= bufferSize ); - static uint8_t buffer1[bufferSize]; - static uint8_t buffer2[bufferSize]; - DWORD buffer1Size = 0; - DWORD buffer2Size = 0; + static std::uint8_t buffer1[bufferSize]; + static std::uint8_t buffer2[bufferSize]; + unsigned int buffer1Size = 0; + unsigned int buffer2Size = 0; // Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries - DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; + unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - DWORD desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; + unsigned int desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; if( desiredSize > currentHeapSize ) { @@ -1142,7 +1142,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, unsigned int nNumberO // Fill buffer 1 from file if( (readStartOffset - bufferSize) < spaceStartOffset ) { - amountToRead = (DWORD)(readStartOffset - spaceStartOffset); + amountToRead = static_cast(readStartOffset - spaceStartOffset); } else { @@ -1360,7 +1360,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) // Attempt to allocate the required memory // We do not own this, it belongs to the StorageManager - uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength ); + std::uint8_t *compData = (std::uint8_t *)StorageManager.AllocateSaveData( compLength ); // If we failed to allocate then compData will be NULL // Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer @@ -1387,7 +1387,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) compLength = compLength+8; // Attempt to allocate the required memory - compData = (uint8_t *)StorageManager.AllocateSaveData( compLength ); + compData = (std::uint8_t *)StorageManager.AllocateSaveData( compLength ); } if(compData != NULL) @@ -1464,7 +1464,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) } } -int ConsoleSaveFileSplit::SaveSaveDataCallback(LPVOID lpParam,bool bRes) +int ConsoleSaveFileSplit::SaveSaveDataCallback(void *lpParam, bool bRes) { ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam; @@ -1477,7 +1477,7 @@ int ConsoleSaveFileSplit::SaveSaveDataCallback(LPVOID lpParam,bool bRes) return 0; } -int ConsoleSaveFileSplit::SaveRegionFilesCallback(LPVOID lpParam,bool bRes) +int ConsoleSaveFileSplit::SaveRegionFilesCallback(void *lpParam, bool bRes) { ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam; @@ -1496,7 +1496,7 @@ void ConsoleSaveFileSplit::DebugFlushToFile(void *compressedData /*= NULL*/, uns unsigned int fileSize = header.GetFileSize(); - DWORD numberOfBytesWritten = 0; + unsigned int numberOfBytesWritten = 0; File targetFileDir(L"Saves"); @@ -1649,8 +1649,8 @@ void ConsoleSaveFileSplit::setEndian(ByteOrder endian) void ConsoleSaveFileSplit::ConvertRegionFile(File sourceFile) { - DWORD numberOfBytesWritten = 0; - DWORD numberOfBytesRead = 0; + unsigned int numberOfBytesWritten = 0; + unsigned int numberOfBytesRead = 0; RegionFile sourceRegionFile(this, &sourceFile); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index 769678e94..e0f1eeef9 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -19,14 +19,14 @@ private: class WriteHistory { public: - int64_t writeTime; + std::int64_t writeTime; unsigned int writeSize; } ; class DirtyRegionFile { public: - int64_t lastWritten; + std::int64_t lastWritten; unsigned int fileRef; bool operator<(const DirtyRegionFile& rhs) const { return lastWritten < rhs.lastWritten; } }; @@ -46,11 +46,11 @@ private: unsigned int dataCompressedSize; int index; bool dirty; - int64_t lastWritten; + std::int64_t lastWritten; }; std::unordered_map regionFiles; std::vector writeHistory; - int64_t m_lastTickTime; + std::int64_t m_lastTickTime; FileEntry *GetRegionFileEntry(unsigned int regionIndex); @@ -79,14 +79,14 @@ private: void processSubfilesForWrite(); void processSubfilesAfterWrite(); public: - static int SaveSaveDataCallback(LPVOID lpParam,bool bRes); - static int SaveRegionFilesCallback(LPVOID lpParam,bool bRes); + static int SaveSaveDataCallback(void *lpParam, bool bRes); + static int SaveRegionFilesCallback(void *lpParam, bool bRes); private: - void _init(const std::wstring &fileName, void *pvSaveData, DWORD fileSize, ESavePlatform plat); + void _init(const std::wstring &fileName, void *pvSaveData, unsigned int fileSize, ESavePlatform plat); public: - ConsoleSaveFileSplit(const std::wstring &fileName, void *pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); + ConsoleSaveFileSplit(const std::wstring &fileName, void *pvSaveData = NULL, unsigned int fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alreadySmallRegions = true, ProgressListener *progress = NULL); virtual ~ConsoleSaveFileSplit(); From 2bc55b838debea4cbb1fc67e94bd1b583ca51929 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:17:56 +1100 Subject: [PATCH 062/192] Remove Win32 byte types from game rule helpers --- .../Platform/Common/GameRules/BiomeOverride.cpp | 8 ++++---- .../Platform/Common/GameRules/BiomeOverride.h | 8 ++++---- .../Platform/Common/GameRules/LevelGenerationOptions.cpp | 2 +- .../Platform/Common/GameRules/LevelGenerationOptions.h | 2 +- Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp | 4 ++-- Minecraft.Client/Platform/Common/GameRules/LevelRules.h | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp index 9140ed526..d05f98098 100644 --- a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp @@ -52,8 +52,8 @@ bool BiomeOverride::isBiome(int id) return m_biomeId == id; } -void BiomeOverride::getTileValues(BYTE &tile, BYTE &topTile) +void BiomeOverride::getTileValues(std::uint8_t &tile, std::uint8_t &topTile) { - if(m_tile != 0) tile = (BYTE)m_tile; - if(m_topTile != 0) topTile = (BYTE)m_topTile; -} \ No newline at end of file + if(m_tile != 0) tile = m_tile; + if(m_topTile != 0) topTile = m_topTile; +} diff --git a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h index 6ce91bbd1..3259658ef 100644 --- a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h +++ b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h @@ -6,8 +6,8 @@ class BiomeOverride : public GameRuleDefinition { private: - BYTE m_topTile; - BYTE m_tile; + std::uint8_t m_topTile; + std::uint8_t m_tile; int m_biomeId; public: @@ -19,5 +19,5 @@ public: virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool isBiome(int id); - void getTileValues(BYTE &tile, BYTE &topTile); -}; \ No newline at end of file + void getTileValues(std::uint8_t &tile, std::uint8_t &topTile); +}; diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index 6839434ae..39de339cb 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -400,7 +400,7 @@ LPCWSTR LevelGenerationOptions::getString(const std::wstring &key) } } -void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile) +void LevelGenerationOptions::getBiomeOverride(int biomeId, std::uint8_t &tile, std::uint8_t &topTile) { for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it) { diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h index 135e509a0..07597c139 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h @@ -198,7 +198,7 @@ public: void setRequiredGameRules(LevelRuleset *rules); LevelRuleset *getRequiredGameRules(); - void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile); + void getBiomeOverride(int biomeId, std::uint8_t &tile, std::uint8_t &topTile); bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); void loadStringTable(StringTable *table); diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp index a15749b34..94d2d55f7 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp @@ -6,7 +6,7 @@ LevelRules::LevelRules() { } -void LevelRules::addLevelRule(const std::wstring &displayName, PBYTE pbData, DWORD dwLen) +void LevelRules::addLevelRule(const std::wstring &displayName, std::uint8_t *pbData, unsigned int dataLength) { } @@ -17,4 +17,4 @@ void LevelRules::addLevelRule(const std::wstring &displayName, LevelRuleset *roo void LevelRules::removeLevelRule(LevelRuleset *removing) { // TODO ? -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRules.h b/Minecraft.Client/Platform/Common/GameRules/LevelRules.h index e88cd5dac..d32577eef 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRules.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRules.h @@ -7,8 +7,8 @@ class LevelRules public: LevelRules(); - void addLevelRule(const std::wstring &displayName, PBYTE pbData, DWORD dwLen); + void addLevelRule(const std::wstring &displayName, std::uint8_t *pbData, unsigned int dataLength); void addLevelRule(const std::wstring &displayName, LevelRuleset *rootRule); void removeLevelRule(LevelRuleset *removing); -}; \ No newline at end of file +}; From 3e89da8dffb48db9e53125ed7b0456dd78e18be6 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:21:10 +1100 Subject: [PATCH 063/192] Use standard byte buffers for save image metadata --- .../Platform/Common/Consoles_App.cpp | 28 +++++++++---------- .../Platform/Common/Consoles_App.h | 4 +-- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 4 +-- .../IO/Files/ConsoleSaveFileOriginal.cpp | 2 +- .../IO/Files/ConsoleSaveFileSplit.cpp | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index df027e2ae..a8f7f1bc1 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -7631,9 +7631,9 @@ unsigned int CMinecraftApp::FromBigEndian(unsigned int uiValue) #endif } -void CMinecraftApp::GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,std::uint32_t &uiTexturePack) +void CMinecraftApp::GetImageTextData(std::uint8_t *imageData, unsigned int imageBytes, unsigned char *seedText, unsigned int &uiHostOptions, bool &bHostOptionsRead, std::uint32_t &uiTexturePack) { - unsigned char *ucPtr=pbImageData; + std::uint8_t *ucPtr = imageData; unsigned int uiCount=0; unsigned int uiChunkLen; unsigned int uiChunkType; @@ -7648,7 +7648,7 @@ void CMinecraftApp::GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsig uiCount+=8; - while(uiCountgetSaveSeed(), true, app.getRemoteStorage()->getSaveHostOptions(), app.getRemoteStorage()->getSaveTexturePack() ); @@ -2606,7 +2606,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that - BYTE bTextMetadata[88]; + std::uint8_t bTextMetadata[88]; ZeroMemory(bTextMetadata,88); int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, app.getRemoteStorage()->getSaveHostOptions(), app.getRemoteStorage()->getSaveTexturePack() ); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 4dd16bd4a..5e24905a1 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -762,7 +762,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize,&pbDataSaveImage,&dwDataSizeSaveImage); #endif - BYTE bTextMetadata[88]; + std::uint8_t bTextMetadata[88]; ZeroMemory(bTextMetadata,88); __int64 seed = 0; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 200fca5c5..cfd1ad53d 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -1426,7 +1426,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize,&pbDataSaveImage,&dwDataSizeSaveImage); #endif - BYTE bTextMetadata[88]; + std::uint8_t bTextMetadata[88]; ZeroMemory(bTextMetadata,88); __int64 seed = 0; From d2db55e050f38c8979977545d02cf22854ce8844 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:25:06 +1100 Subject: [PATCH 064/192] Use standard thumbnail buffer types --- .../Platform/Common/Consoles_App.h | 2 +- .../Platform/Durango/Durango_App.cpp | 21 ++++++---- .../Platform/Durango/Durango_App.h | 2 +- Minecraft.Client/Platform/Linux/Linux_App.cpp | 2 +- Minecraft.Client/Platform/Linux/Linux_App.h | 2 +- Minecraft.Client/Platform/Orbis/Orbis_App.cpp | 38 ++++++++++++------- Minecraft.Client/Platform/Orbis/Orbis_App.h | 4 +- Minecraft.Client/Platform/PS3/PS3_App.cpp | 36 +++++++++++------- Minecraft.Client/Platform/PS3/PS3_App.h | 4 +- .../Platform/PSVita/PSVita_App.cpp | 38 ++++++++++++------- Minecraft.Client/Platform/PSVita/PSVita_App.h | 4 +- .../Platform/Windows64/Windows64_App.cpp | 2 +- .../Platform/Windows64/Windows64_App.h | 2 +- Minecraft.Client/Platform/Xbox/Xbox_App.cpp | 10 ++--- Minecraft.Client/Platform/Xbox/Xbox_App.h | 4 +- .../IO/Files/ConsoleSaveFileOriginal.cpp | 8 ++-- .../IO/Files/ConsoleSaveFileSplit.cpp | 8 ++-- 17 files changed, 111 insertions(+), 76 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 8951cc908..71a5821b6 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -608,7 +608,7 @@ public: // images for save thumbnail/social post virtual void CaptureSaveThumbnail() =0; - virtual void GetSaveThumbnail(PBYTE*,DWORD*)=0; + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize)=0; virtual void ReleaseSaveThumbnail()=0; virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)=0; diff --git a/Minecraft.Client/Platform/Durango/Durango_App.cpp b/Minecraft.Client/Platform/Durango/Durango_App.cpp index d5dfed695..29db239bf 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_App.cpp @@ -114,25 +114,30 @@ void CConsoleMinecraftApp::CaptureSaveThumbnail() { RenderManager.CaptureThumbnail(&m_ThumbnailBuffer); } -void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) { // on a save caused by a create world, the thumbnail capture won't have happened if(m_ThumbnailBuffer.Allocated()) { - if( pbData ) + if( thumbnailData ) { - *pbData= new BYTE [m_ThumbnailBuffer.GetBufferSize()]; - *pdwSize=m_ThumbnailBuffer.GetBufferSize(); - memcpy(*pbData,m_ThumbnailBuffer.GetBufferPointer(),*pdwSize); + *thumbnailData = new std::uint8_t[m_ThumbnailBuffer.GetBufferSize()]; + *thumbnailSize = static_cast(m_ThumbnailBuffer.GetBufferSize()); + memcpy(*thumbnailData, m_ThumbnailBuffer.GetBufferPointer(), *thumbnailSize); } m_ThumbnailBuffer.Release(); } else { - if( pbData ) + if( thumbnailData ) { // use the default image - StorageManager.GetDefaultSaveThumbnail(pbData,pdwSize); + DWORD defaultSize = 0; + StorageManager.GetDefaultSaveThumbnail(thumbnailData, &defaultSize); + if (thumbnailSize) + { + *thumbnailSize = static_cast(defaultSize); + } } } } @@ -796,4 +801,4 @@ void CConsoleMinecraftApp::ReadLocalDLCList(void) delete pDecompressedData; } -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Durango/Durango_App.h b/Minecraft.Client/Platform/Durango/Durango_App.h index 6e0212329..18a41e003 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.h +++ b/Minecraft.Client/Platform/Durango/Durango_App.h @@ -23,7 +23,7 @@ public: virtual void FatalLoadError(); virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(PBYTE*,DWORD*); + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); diff --git a/Minecraft.Client/Platform/Linux/Linux_App.cpp b/Minecraft.Client/Platform/Linux/Linux_App.cpp index a9520f211..1a520c45a 100644 --- a/Minecraft.Client/Platform/Linux/Linux_App.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_App.cpp @@ -39,7 +39,7 @@ void CConsoleMinecraftApp::FatalLoadError() void CConsoleMinecraftApp::CaptureSaveThumbnail() { } -void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) { } void CConsoleMinecraftApp::ReleaseSaveThumbnail() diff --git a/Minecraft.Client/Platform/Linux/Linux_App.h b/Minecraft.Client/Platform/Linux/Linux_App.h index 39351d55b..ed1f73b83 100644 --- a/Minecraft.Client/Platform/Linux/Linux_App.h +++ b/Minecraft.Client/Platform/Linux/Linux_App.h @@ -12,7 +12,7 @@ public: virtual void FatalLoadError(); virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(PBYTE*,DWORD*); + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp index fa0c48c84..da4735418 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp @@ -227,44 +227,54 @@ void CConsoleMinecraftApp::CaptureSaveThumbnail() { RenderManager.CaptureThumbnail(&m_ThumbnailBuffer,&m_SaveImageBuffer); } -void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *ppbThumbnailData,DWORD *pdwThumbnailSize,PBYTE *ppbDataImage,DWORD *pdwSizeImage) +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize) { // on a save caused by a create world, the thumbnail capture won't have happened if(m_ThumbnailBuffer.Allocated()) { - if( ppbThumbnailData ) + if( thumbnailData ) { - *ppbThumbnailData= new BYTE [m_ThumbnailBuffer.GetBufferSize()]; - *pdwThumbnailSize=m_ThumbnailBuffer.GetBufferSize(); - memcpy(*ppbThumbnailData,m_ThumbnailBuffer.GetBufferPointer(),*pdwThumbnailSize); + *thumbnailData = new std::uint8_t[m_ThumbnailBuffer.GetBufferSize()]; + *thumbnailSize = static_cast(m_ThumbnailBuffer.GetBufferSize()); + memcpy(*thumbnailData, m_ThumbnailBuffer.GetBufferPointer(), *thumbnailSize); } m_ThumbnailBuffer.Release(); } else { - if( ppbThumbnailData ) + if( thumbnailData ) { // use the default image - StorageManager.GetDefaultSaveThumbnail(ppbThumbnailData,pdwThumbnailSize); + DWORD defaultThumbnailSize = 0; + StorageManager.GetDefaultSaveThumbnail(thumbnailData, &defaultThumbnailSize); + if (thumbnailSize) + { + *thumbnailSize = static_cast(defaultThumbnailSize); + } } } if(m_SaveImageBuffer.Allocated()) { - if( ppbDataImage ) + if( saveImageData ) { - *ppbDataImage= new BYTE [m_SaveImageBuffer.GetBufferSize()]; - *pdwSizeImage=m_SaveImageBuffer.GetBufferSize(); - memcpy(*ppbDataImage,m_SaveImageBuffer.GetBufferPointer(),*pdwSizeImage); + *saveImageData = new std::uint8_t[m_SaveImageBuffer.GetBufferSize()]; + *saveImageSize = static_cast(m_SaveImageBuffer.GetBufferSize()); + memcpy(*saveImageData, m_SaveImageBuffer.GetBufferPointer(), *saveImageSize); } m_SaveImageBuffer.Release(); } else { - if( ppbDataImage ) + if( saveImageData ) { // use the default image - StorageManager.GetDefaultSaveImage(ppbDataImage,pdwSizeImage); + DWORD defaultSaveImageSize = 0; + StorageManager.GetDefaultSaveImage(saveImageData, &defaultSaveImageSize); + if (saveImageSize) + { + *saveImageSize = static_cast(defaultSaveImageSize); + } } } } @@ -1278,4 +1288,4 @@ void CConsoleMinecraftApp::PatchAvailableDialogTick() m_bPatchAvailableDialogRunning=false; } } -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.h b/Minecraft.Client/Platform/Orbis/Orbis_App.h index 68be9be45..54302f77b 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.h +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.h @@ -68,8 +68,8 @@ public: virtual void FatalLoadError(); virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(PBYTE*,DWORD*) {}; // NOT USED - virtual void GetSaveThumbnail(PBYTE *ppbThumbnailData,DWORD *pdwThumbnailSize,PBYTE *ppbDataImage,DWORD *pdwSizeImage); + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) {}; // NOT USED + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize); virtual void ReleaseSaveThumbnail(); virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); diff --git a/Minecraft.Client/Platform/PS3/PS3_App.cpp b/Minecraft.Client/Platform/PS3/PS3_App.cpp index 1b9537220..e9ff2c195 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_App.cpp @@ -391,44 +391,54 @@ void CConsoleMinecraftApp::CaptureSaveThumbnail() MemSect(0); } -void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *ppbThumbnailData,DWORD *pdwThumbnailSize,PBYTE *ppbDataImage,DWORD *pdwSizeImage) +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize) { // on a save caused by a create world, the thumbnail capture won't have happened if(m_ThumbnailBuffer.Allocated()) { - if( ppbThumbnailData ) + if( thumbnailData ) { - *ppbThumbnailData= new BYTE [m_ThumbnailBuffer.GetBufferSize()]; - *pdwThumbnailSize=m_ThumbnailBuffer.GetBufferSize(); - memcpy(*ppbThumbnailData,m_ThumbnailBuffer.GetBufferPointer(),*pdwThumbnailSize); + *thumbnailData = new std::uint8_t[m_ThumbnailBuffer.GetBufferSize()]; + *thumbnailSize = static_cast(m_ThumbnailBuffer.GetBufferSize()); + memcpy(*thumbnailData, m_ThumbnailBuffer.GetBufferPointer(), *thumbnailSize); } m_ThumbnailBuffer.Release(); } else { - if( ppbThumbnailData ) + if( thumbnailData ) { // use the default image - StorageManager.GetDefaultSaveThumbnail(ppbThumbnailData,pdwThumbnailSize); + DWORD defaultThumbnailSize = 0; + StorageManager.GetDefaultSaveThumbnail(thumbnailData, &defaultThumbnailSize); + if (thumbnailSize) + { + *thumbnailSize = static_cast(defaultThumbnailSize); + } } } if(m_SaveImageBuffer.Allocated()) { - if( ppbDataImage ) + if( saveImageData ) { - *ppbDataImage= new BYTE [m_SaveImageBuffer.GetBufferSize()]; - *pdwSizeImage=m_SaveImageBuffer.GetBufferSize(); - memcpy(*ppbDataImage,m_SaveImageBuffer.GetBufferPointer(),*pdwSizeImage); + *saveImageData = new std::uint8_t[m_SaveImageBuffer.GetBufferSize()]; + *saveImageSize = static_cast(m_SaveImageBuffer.GetBufferSize()); + memcpy(*saveImageData, m_SaveImageBuffer.GetBufferPointer(), *saveImageSize); } m_SaveImageBuffer.Release(); } else { - if( ppbDataImage ) + if( saveImageData ) { // use the default image - StorageManager.GetDefaultSaveImage(ppbDataImage,pdwSizeImage); + DWORD defaultSaveImageSize = 0; + StorageManager.GetDefaultSaveImage(saveImageData, &defaultSaveImageSize); + if (saveImageSize) + { + *saveImageSize = static_cast(defaultSaveImageSize); + } } } } diff --git a/Minecraft.Client/Platform/PS3/PS3_App.h b/Minecraft.Client/Platform/PS3/PS3_App.h index 305a5f2b5..369b760b2 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.h +++ b/Minecraft.Client/Platform/PS3/PS3_App.h @@ -68,8 +68,8 @@ public: virtual void FatalLoadError(); virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(PBYTE*,DWORD*) {}; // NOT USED - virtual void GetSaveThumbnail(PBYTE*,DWORD*,PBYTE*,DWORD*); + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) {}; // NOT USED + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize); virtual void ReleaseSaveThumbnail(); virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp index ed23f0f15..9e6b8688a 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp @@ -208,44 +208,54 @@ void CConsoleMinecraftApp::CaptureSaveThumbnail() { RenderManager.CaptureThumbnail(&m_ThumbnailBuffer); } -void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *ppbThumbnailData,DWORD *pdwThumbnailSize,PBYTE *ppbDataImage,DWORD *pdwSizeImage) +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize) { // on a save caused by a create world, the thumbnail capture won't have happened if(m_ThumbnailBuffer.Allocated()) { - if( ppbThumbnailData ) + if( thumbnailData ) { - *ppbThumbnailData= new BYTE [m_ThumbnailBuffer.GetBufferSize()]; - *pdwThumbnailSize=m_ThumbnailBuffer.GetBufferSize(); - memcpy(*ppbThumbnailData,m_ThumbnailBuffer.GetBufferPointer(),*pdwThumbnailSize); + *thumbnailData = new std::uint8_t[m_ThumbnailBuffer.GetBufferSize()]; + *thumbnailSize = static_cast(m_ThumbnailBuffer.GetBufferSize()); + memcpy(*thumbnailData, m_ThumbnailBuffer.GetBufferPointer(), *thumbnailSize); } m_ThumbnailBuffer.Release(); } else { - if( ppbThumbnailData ) + if( thumbnailData ) { // use the default image - StorageManager.GetDefaultSaveThumbnail(ppbThumbnailData,pdwThumbnailSize); + DWORD defaultThumbnailSize = 0; + StorageManager.GetDefaultSaveThumbnail(thumbnailData, &defaultThumbnailSize); + if (thumbnailSize) + { + *thumbnailSize = static_cast(defaultThumbnailSize); + } } } if(m_SaveImageBuffer.Allocated()) { - if( ppbDataImage ) + if( saveImageData ) { - *ppbDataImage= new BYTE [m_SaveImageBuffer.GetBufferSize()]; - *pdwSizeImage=m_SaveImageBuffer.GetBufferSize(); - memcpy(*ppbDataImage,m_SaveImageBuffer.GetBufferPointer(),*pdwSizeImage); + *saveImageData = new std::uint8_t[m_SaveImageBuffer.GetBufferSize()]; + *saveImageSize = static_cast(m_SaveImageBuffer.GetBufferSize()); + memcpy(*saveImageData, m_SaveImageBuffer.GetBufferPointer(), *saveImageSize); } m_SaveImageBuffer.Release(); } else { - if( ppbDataImage ) + if( saveImageData ) { // use the default image - StorageManager.GetDefaultSaveImage(ppbDataImage,pdwSizeImage); + DWORD defaultSaveImageSize = 0; + StorageManager.GetDefaultSaveImage(saveImageData, &defaultSaveImageSize); + if (saveImageSize) + { + *saveImageSize = static_cast(defaultSaveImageSize); + } } } } @@ -1669,4 +1679,4 @@ void CConsoleMinecraftApp::finishedDeletingSaves(bool bContinue) if (bContinue) m_bSaveDataDeleteDialogState = eSaveDataDeleteState_continue; else m_bSaveDataDeleteDialogState = eSaveDataDeleteState_abort; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.h b/Minecraft.Client/Platform/PSVita/PSVita_App.h index 24100436b..3cc0c1317 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.h +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.h @@ -70,8 +70,8 @@ public: virtual void FatalLoadError(); virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(PBYTE*,DWORD*) {}; // NOT USED - virtual void GetSaveThumbnail(PBYTE *ppbThumbnailData,DWORD *pdwThumbnailSize,PBYTE *ppbDataImage,DWORD *pdwSizeImage); + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) {}; // NOT USED + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize); virtual void ReleaseSaveThumbnail(); virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp index 2193aedc1..dd20ee37f 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp @@ -37,7 +37,7 @@ void CConsoleMinecraftApp::FatalLoadError() void CConsoleMinecraftApp::CaptureSaveThumbnail() { } -void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) { } void CConsoleMinecraftApp::ReleaseSaveThumbnail() diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.h b/Minecraft.Client/Platform/Windows64/Windows64_App.h index 39351d55b..ed1f73b83 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.h +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.h @@ -12,7 +12,7 @@ public: virtual void FatalLoadError(); virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(PBYTE*,DWORD*); + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); diff --git a/Minecraft.Client/Platform/Xbox/Xbox_App.cpp b/Minecraft.Client/Platform/Xbox/Xbox_App.cpp index c55ef4806..901e025e9 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_App.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_App.cpp @@ -1448,16 +1448,16 @@ void CConsoleMinecraftApp::CaptureSaveThumbnail() RenderManager.CaptureThumbnail(&m_ThumbnailBuffer); MemSect(0); } -void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) { // on a save caused by a create world, the thumbnail capture won't have happened if(m_ThumbnailBuffer!=NULL) { - if( pbData ) + if( thumbnailData ) { - *pbData= new BYTE [m_ThumbnailBuffer->GetBufferSize()]; - *pdwSize=m_ThumbnailBuffer->GetBufferSize(); - memcpy(*pbData,m_ThumbnailBuffer->GetBufferPointer(),*pdwSize); + *thumbnailData = new std::uint8_t[m_ThumbnailBuffer->GetBufferSize()]; + *thumbnailSize = static_cast(m_ThumbnailBuffer->GetBufferSize()); + memcpy(*thumbnailData, m_ThumbnailBuffer->GetBufferPointer(), *thumbnailSize); } m_ThumbnailBuffer->Release(); m_ThumbnailBuffer=NULL; diff --git a/Minecraft.Client/Platform/Xbox/Xbox_App.h b/Minecraft.Client/Platform/Xbox/Xbox_App.h index f64e71423..4f612851e 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_App.h +++ b/Minecraft.Client/Platform/Xbox/Xbox_App.h @@ -50,7 +50,7 @@ public: virtual void CaptureScreenshot(int iPad); virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(PBYTE*,DWORD*); + virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); @@ -194,4 +194,4 @@ private: }; -extern CConsoleMinecraftApp app; \ No newline at end of file +extern CConsoleMinecraftApp app; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 5e24905a1..d3030fdd4 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -750,11 +750,11 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) app.DebugPrintf("Save data compressed from %d to %d\n", fileSize, compLength); #endif - PBYTE pbThumbnailData=NULL; - DWORD dwThumbnailDataSize=0; + std::uint8_t *pbThumbnailData = NULL; + unsigned int dwThumbnailDataSize = 0; - PBYTE pbDataSaveImage=NULL; - DWORD dwDataSizeSaveImage=0; + std::uint8_t *pbDataSaveImage = NULL; + unsigned int dwDataSizeSaveImage = 0; #if ( defined _XBOX || defined _DURANGO ) app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index cfd1ad53d..230f5c239 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -1414,11 +1414,11 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) if(updateThumbnail) { - PBYTE pbThumbnailData=NULL; - DWORD dwThumbnailDataSize=0; + std::uint8_t *pbThumbnailData = NULL; + unsigned int dwThumbnailDataSize = 0; - PBYTE pbDataSaveImage=NULL; - DWORD dwDataSizeSaveImage=0; + std::uint8_t *pbDataSaveImage = NULL; + unsigned int dwDataSizeSaveImage = 0; #if ( defined _XBOX || defined _DURANGO ) app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); From c4947ce99ab87ee4aa9996921943efc8285cc85a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:27:44 +1100 Subject: [PATCH 065/192] Use standard screenshot buffer types --- Minecraft.Client/Platform/Common/Consoles_App.h | 2 +- Minecraft.Client/Platform/Durango/Durango_App.cpp | 2 +- Minecraft.Client/Platform/Durango/Durango_App.h | 2 +- Minecraft.Client/Platform/Linux/Linux_App.cpp | 2 +- Minecraft.Client/Platform/Linux/Linux_App.h | 2 +- Minecraft.Client/Platform/Orbis/Orbis_App.cpp | 2 +- Minecraft.Client/Platform/Orbis/Orbis_App.h | 2 +- Minecraft.Client/Platform/PS3/PS3_App.cpp | 2 +- Minecraft.Client/Platform/PS3/PS3_App.h | 2 +- Minecraft.Client/Platform/PSVita/PSVita_App.cpp | 2 +- Minecraft.Client/Platform/PSVita/PSVita_App.h | 2 +- Minecraft.Client/Platform/Windows64/Windows64_App.cpp | 2 +- Minecraft.Client/Platform/Windows64/Windows64_App.h | 2 +- Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp | 4 ++-- Minecraft.Client/Platform/Xbox/Xbox_App.cpp | 8 ++++---- Minecraft.Client/Platform/Xbox/Xbox_App.h | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 71a5821b6..4914e95c1 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -610,7 +610,7 @@ public: virtual void CaptureSaveThumbnail() =0; virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize)=0; virtual void ReleaseSaveThumbnail()=0; - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)=0; + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize)=0; virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0; diff --git a/Minecraft.Client/Platform/Durango/Durango_App.cpp b/Minecraft.Client/Platform/Durango/Durango_App.cpp index 29db239bf..5a4c95e8f 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_App.cpp @@ -146,7 +146,7 @@ void CConsoleMinecraftApp::ReleaseSaveThumbnail() } -void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) { } diff --git a/Minecraft.Client/Platform/Durango/Durango_App.h b/Minecraft.Client/Platform/Durango/Durango_App.h index 18a41e003..cd775c70e 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.h +++ b/Minecraft.Client/Platform/Durango/Durango_App.h @@ -25,7 +25,7 @@ public: virtual void CaptureSaveThumbnail(); virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt); diff --git a/Minecraft.Client/Platform/Linux/Linux_App.cpp b/Minecraft.Client/Platform/Linux/Linux_App.cpp index 1a520c45a..332537d07 100644 --- a/Minecraft.Client/Platform/Linux/Linux_App.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_App.cpp @@ -46,7 +46,7 @@ void CConsoleMinecraftApp::ReleaseSaveThumbnail() { } -void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) { } diff --git a/Minecraft.Client/Platform/Linux/Linux_App.h b/Minecraft.Client/Platform/Linux/Linux_App.h index ed1f73b83..f15afd928 100644 --- a/Minecraft.Client/Platform/Linux/Linux_App.h +++ b/Minecraft.Client/Platform/Linux/Linux_App.h @@ -14,7 +14,7 @@ public: virtual void CaptureSaveThumbnail(); virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt); diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp index da4735418..16cd30972 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp @@ -284,7 +284,7 @@ void CConsoleMinecraftApp::ReleaseSaveThumbnail() } -void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) { } diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.h b/Minecraft.Client/Platform/Orbis/Orbis_App.h index 54302f77b..ef55633a9 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.h +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.h @@ -71,7 +71,7 @@ public: virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) {}; // NOT USED virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize); virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize); int LoadLocalTMSFile(char *chTMSFile); int LoadLocalDLCImage(SONYDLC *pDLCInfo); diff --git a/Minecraft.Client/Platform/PS3/PS3_App.cpp b/Minecraft.Client/Platform/PS3/PS3_App.cpp index e9ff2c195..b2f8d0646 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_App.cpp @@ -450,7 +450,7 @@ void CConsoleMinecraftApp::ReleaseSaveThumbnail() } } -void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) { } diff --git a/Minecraft.Client/Platform/PS3/PS3_App.h b/Minecraft.Client/Platform/PS3/PS3_App.h index 369b760b2..a643280e9 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.h +++ b/Minecraft.Client/Platform/PS3/PS3_App.h @@ -71,7 +71,7 @@ public: virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) {}; // NOT USED virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize); virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize); // BANNED LEVEL LIST virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp index 9e6b8688a..888e4c854 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp @@ -265,7 +265,7 @@ void CConsoleMinecraftApp::ReleaseSaveThumbnail() } -void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) { } diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.h b/Minecraft.Client/Platform/PSVita/PSVita_App.h index 3cc0c1317..9c262dac3 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.h +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.h @@ -73,7 +73,7 @@ public: virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) {}; // NOT USED virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize, std::uint8_t **saveImageData, unsigned int *saveImageSize); virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt); diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp index dd20ee37f..bc60aa486 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp @@ -44,7 +44,7 @@ void CConsoleMinecraftApp::ReleaseSaveThumbnail() { } -void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) { } diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.h b/Minecraft.Client/Platform/Windows64/Windows64_App.h index ed1f73b83..f15afd928 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.h +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.h @@ -14,7 +14,7 @@ public: virtual void CaptureSaveThumbnail(); virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt); diff --git a/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp b/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp index f61292648..bbcfc7f11 100644 --- a/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp +++ b/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp @@ -459,8 +459,8 @@ bool CSocialManager::PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, DW bool bResult = false; - PBYTE pbData=NULL; - DWORD dwDataSize; + std::uint8_t *pbData = NULL; + unsigned int dwDataSize = 0; app.GetScreenshot(dwUserIndex,&pbData,&dwDataSize); app.GetPreviewImage(dwUserIndex,&m_PostPreviewImage); diff --git a/Minecraft.Client/Platform/Xbox/Xbox_App.cpp b/Minecraft.Client/Platform/Xbox/Xbox_App.cpp index 901e025e9..6f050b2d6 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_App.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_App.cpp @@ -1472,14 +1472,14 @@ void CConsoleMinecraftApp::ReleaseSaveThumbnail() } } -void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) +void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) { // on a save caused by a create world, the thumbnail capture won't have happened if(m_ScreenshotBuffer[iPad]!=NULL) { - *pbData= new BYTE [m_ScreenshotBuffer[iPad]->GetBufferSize()]; - *pdwSize=m_ScreenshotBuffer[iPad]->GetBufferSize(); - memcpy(*pbData,m_ScreenshotBuffer[iPad]->GetBufferPointer(),*pdwSize); + *screenshotData = new std::uint8_t[m_ScreenshotBuffer[iPad]->GetBufferSize()]; + *screenshotSize = static_cast(m_ScreenshotBuffer[iPad]->GetBufferSize()); + memcpy(*screenshotData, m_ScreenshotBuffer[iPad]->GetBufferPointer(), *screenshotSize); m_ScreenshotBuffer[iPad]->Release(); m_ScreenshotBuffer[iPad]=NULL; } diff --git a/Minecraft.Client/Platform/Xbox/Xbox_App.h b/Minecraft.Client/Platform/Xbox/Xbox_App.h index 4f612851e..f32438b1c 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_App.h +++ b/Minecraft.Client/Platform/Xbox/Xbox_App.h @@ -52,7 +52,7 @@ public: virtual void CaptureSaveThumbnail(); virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize); virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); + virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize); virtual void RunFrame(); From 37aa3463be2adca3a9e1bae048133f0540bddeb1 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:53:51 +1100 Subject: [PATCH 066/192] Use standard buffer types for in-memory textures --- Minecraft.Client/Network/ClientConnection.cpp | 8 ++++---- Minecraft.Client/Network/PlayerConnection.cpp | 16 ++++++++-------- Minecraft.Client/Platform/Common/App_structs.h | 8 +++++--- .../Platform/Common/Consoles_App.cpp | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.h | 6 ++++-- .../Platform/Common/UI/UIScene_DLCOffersMenu.cpp | 6 +++--- .../Platform/Common/XUI/XUI_DLCOffers.cpp | 12 ++++++------ Minecraft.Client/Textures/Textures.cpp | 4 ++-- 8 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index d8d07f091..963fb8d35 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -2241,8 +2241,8 @@ void ClientConnection::handleTexture(std::shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str()); #endif - PBYTE pbData=NULL; - DWORD dwBytes=0; + std::uint8_t *pbData=NULL; + unsigned int dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); if(dwBytes!=0) @@ -2273,8 +2273,8 @@ void ClientConnection::handleTextureAndGeometry(std::shared_ptrtextureName.c_str()); #endif - PBYTE pbData=NULL; - DWORD dwBytes=0; + std::uint8_t *pbData=NULL; + unsigned int dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index 8669e1b91..1a4d8721e 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -802,8 +802,8 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str()); #endif - PBYTE pbData=NULL; - DWORD dwBytes=0; + std::uint8_t *pbData=NULL; + unsigned int dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); if(dwBytes!=0) @@ -836,8 +836,8 @@ void PlayerConnection::handleTextureAndGeometry(std::shared_ptrtextureName.c_str()); #endif - PBYTE pbData=NULL; - DWORD dwTextureBytes=0; + std::uint8_t *pbData=NULL; + unsigned int dwTextureBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwTextureBytes); DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); @@ -900,8 +900,8 @@ void PlayerConnection::handleTextureReceived(const std::wstring &textureName) AUTO_VAR(it, find( m_texturesRequested.begin(), m_texturesRequested.end(), textureName )); if( it != m_texturesRequested.end() ) { - PBYTE pbData=NULL; - DWORD dwBytes=0; + std::uint8_t *pbData=NULL; + unsigned int dwBytes=0; app.GetMemFileDetails(textureName,&pbData,&dwBytes); if(dwBytes!=0) @@ -918,8 +918,8 @@ void PlayerConnection::handleTextureAndGeometryReceived(const std::wstring &text AUTO_VAR(it, find( m_texturesRequested.begin(), m_texturesRequested.end(), textureName )); if( it != m_texturesRequested.end() ) { - PBYTE pbData=NULL; - DWORD dwTextureBytes=0; + std::uint8_t *pbData=NULL; + unsigned int dwTextureBytes=0; app.GetMemFileDetails(textureName,&pbData,&dwTextureBytes); DLCSkinFile *pDLCSkinFile=app.m_dlcManager.getSkinFile(textureName); diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 47cc5167c..437a96e08 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -1,5 +1,7 @@ #pragma once +#include + typedef struct { wchar_t *wchFilename; @@ -13,9 +15,9 @@ TMS_FILE; typedef struct { - PBYTE pbData; - DWORD dwBytes; - BYTE ucRefCount; + std::uint8_t *pbData; + unsigned int dwBytes; + std::uint8_t ucRefCount; } MEMDATA,*PMEMDATA; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index a8f7f1bc1..bc5d223ab 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5318,7 +5318,7 @@ bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) return false; } -void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName,PBYTE pbData,DWORD dwBytes) +void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int dwBytes) { EnterCriticalSection(&csMemFilesLock); // check it's not already in @@ -5413,7 +5413,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const std::wstring &wName) return val; } -void CMinecraftApp::GetMemFileDetails(const std::wstring &wName,PBYTE *ppbData,DWORD *pdwBytes) +void CMinecraftApp::GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pdwBytes) { EnterCriticalSection(&csMemFilesLock); AUTO_VAR(it, m_MEM_Files.find(wName)); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 4914e95c1..c71b45687 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -1,5 +1,7 @@ #pragma once +#include + //using namespace std; #include "Audio/Consoles_SoundEngine.h" @@ -339,9 +341,9 @@ public: bool isXuidNotch(PlayerUID xuid); bool isXuidDeadmau5(PlayerUID xuid); - void AddMemoryTextureFile(const std::wstring &wName, PBYTE pbData, DWORD dwBytes); + void AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int dwBytes); void RemoveMemoryTextureFile(const std::wstring &wName); - void GetMemFileDetails(const std::wstring &wName,PBYTE *ppbData,DWORD *pdwBytes); + void GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pdwBytes); bool IsFileInMemoryTextures(const std::wstring &wName); // Texture Pack Data files (icon, banner, comparison shot & text) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp index 5f9d3c78e..30f84df2b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp @@ -855,8 +855,8 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) { if(hasRegisteredSubstitutionTexture(cString)==false) { - BYTE *pData=NULL; - DWORD dwSize=0; + std::uint8_t *pData=NULL; + unsigned int dwSize=0; app.GetMemFileDetails(cString,&pData,&dwSize); // set the image #ifdef _XBOX_ONE @@ -920,4 +920,4 @@ void UIScene_DLCOffersMenu::HandleDLCInstalled() //} -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_DLCOffers.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_DLCOffers.cpp index 1db284ac4..b41d5835f 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_DLCOffers.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_DLCOffers.cpp @@ -449,9 +449,9 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) DLC_INFO *dlc = app.GetDLCInfoForFullOfferID(xOffer.qwOfferID); if (dlc != NULL) { - BYTE *pData=NULL; + std::uint8_t *pData=NULL; UINT uiSize=0; - DWORD dwSize=0; + unsigned int dwSize=0; WCHAR *cString = dlc->wchBanner; // is the file in the TMS XZP? @@ -702,9 +702,9 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha if (dlc != NULL) { - BYTE *pImage=NULL; + std::uint8_t *pImage=NULL; UINT uiSize=0; - DWORD dwSize=0; + unsigned int dwSize=0; WCHAR *cString = dlc->wchBanner; @@ -811,8 +811,8 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) if(bPresent) { - BYTE *pImage=NULL; - DWORD dwSize=0; + std::uint8_t *pImage=NULL; + unsigned int dwSize=0; if(m_hXuiBrush!=NULL) { diff --git a/Minecraft.Client/Textures/Textures.cpp b/Minecraft.Client/Textures/Textures.cpp index 0974a3f66..4ad245265 100644 --- a/Minecraft.Client/Textures/Textures.cpp +++ b/Minecraft.Client/Textures/Textures.cpp @@ -1014,8 +1014,8 @@ MemTexture *Textures::addMemTexture(const std::wstring& name,MemTextureProcessor if(texture == NULL) { // can we find it in the app mem files? - PBYTE pbData=NULL; - DWORD dwBytes=0; + std::uint8_t *pbData=NULL; + unsigned int dwBytes=0; app.GetMemFileDetails(name,&pbData,&dwBytes); if(dwBytes!=0) From 5f991ccd6a3a25b328bbd3963ccf1123cbed0a7e Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:56:26 +1100 Subject: [PATCH 067/192] Use standard buffer types for in-memory TPD data --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.h | 4 ++-- .../Platform/Common/UI/IUIScene_StartGame.cpp | 6 ++++-- .../Platform/Common/UI/UIScene_CreateWorldMenu.cpp | 4 ++-- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 4 ++-- .../Platform/Common/XUI/XUI_LoadSettings.cpp | 10 ++++++---- .../Platform/Common/XUI/XUI_MultiGameCreate.cpp | 10 ++++++---- .../Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp | 8 ++++---- 8 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index bc5d223ab..f58c9c24d 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5426,7 +5426,7 @@ void CMinecraftApp::GetMemFileDetails(const std::wstring &wName, std::uint8_t ** LeaveCriticalSection(&csMemFilesLock); } -void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes) +void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int dwBytes) { EnterCriticalSection(&csMemTPDLock); // check it's not already in @@ -5515,7 +5515,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig) return val; } -void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes) +void CMinecraftApp::GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pdwBytes) { EnterCriticalSection(&csMemTPDLock); AUTO_VAR(it, m_MEM_TPD.find(iConfig)); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index c71b45687..944fe5f18 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -347,10 +347,10 @@ public: bool IsFileInMemoryTextures(const std::wstring &wName); // Texture Pack Data files (icon, banner, comparison shot & text) - void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes); + void AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int dwBytes); void RemoveMemoryTPDFile(int iConfig); bool IsFileInTPD(int iConfig); - void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes); + void GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pdwBytes); int GetTPDSize() {return m_MEM_TPD.size();} #ifndef __PS3__ int GetTPConfigVal(WCHAR *pwchDataFile); diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp index 4db845ed7..035655190 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp @@ -140,8 +140,10 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) #if TO_BE_IMPLEMENTED // this is probably a texture pack icon added from TMS - DWORD dwBytes=0,dwFileBytes=0; - PBYTE pbData=NULL,pbFileData=NULL; + unsigned int dwBytes=0; + DWORD dwFileBytes=0; + std::uint8_t *pbData=NULL; + PBYTE pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 83cf1d1cf..63238cd43 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -708,8 +708,8 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) { if(m_iConfigA[i]!=-1) { - DWORD dwBytes=0; - PBYTE pbData=NULL; + unsigned int dwBytes=0; + std::uint8_t *pbData=NULL; //app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]); app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 9750c2169..432108698 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1696,8 +1696,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() if(tp==NULL) { - DWORD dwBytes=0; - PBYTE pbData=NULL; + unsigned int dwBytes=0; + std::uint8_t *pbData=NULL; app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp index c9c590485..1d00f16bd 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp @@ -783,8 +783,8 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle { if(m_iConfigA[i]!=-1) { - DWORD dwBytes=0; - PBYTE pbData=NULL; + unsigned int dwBytes=0; + std::uint8_t *pbData=NULL; app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); @@ -1241,8 +1241,10 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) if(tp==NULL) { // this is probably a texture pack icon added from TMS - DWORD dwBytes=0,dwFileBytes=0; - PBYTE pbData=NULL,pbFileData=NULL; + unsigned int dwBytes=0; + DWORD dwFileBytes=0; + std::uint8_t *pbData=NULL; + PBYTE pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp index b51ef1a79..c46a8bc75 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp @@ -705,8 +705,8 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled { if(m_iConfigA[i]!=-1) { - DWORD dwBytes=0; - PBYTE pbData=NULL; + unsigned int dwBytes=0; + std::uint8_t *pbData=NULL; //app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]); app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); @@ -1099,8 +1099,10 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) { // this is probably a texture pack icon added from TMS - DWORD dwBytes=0,dwFileBytes=0; - PBYTE pbData=NULL,pbFileData=NULL; + unsigned int dwBytes=0; + DWORD dwFileBytes=0; + std::uint8_t *pbData=NULL; + PBYTE pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp index 79c0d87eb..e0720fef8 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -1275,8 +1275,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() if(tp==NULL) { - DWORD dwBytes=0; - PBYTE pbData=NULL; + unsigned int dwBytes=0; + std::uint8_t *pbData=NULL; app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? @@ -1744,8 +1744,8 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl { if(m_iConfigA[i]!=-1) { - DWORD dwBytes=0; - PBYTE pbData=NULL; + unsigned int dwBytes=0; + std::uint8_t *pbData=NULL; //app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]); app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); From eb52911d25f9a6eb63948466c0196569ffa5ad0d Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:59:36 +1100 Subject: [PATCH 068/192] Use standard buffer types for TPD extraction --- .../Platform/Common/Consoles_App.h | 2 +- .../Platform/Common/UI/IUIScene_StartGame.cpp | 8 ++++---- .../Common/UI/UIScene_CreateWorldMenu.cpp | 4 ++-- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 2 +- .../Platform/Common/XUI/XUI_LoadSettings.cpp | 12 +++++------ .../Common/XUI/XUI_MultiGameCreate.cpp | 12 +++++------ .../Common/XUI/XUI_MultiGameJoinLoad.cpp | 2 +- Minecraft.Client/Platform/Xbox/Xbox_App.cpp | 20 +++++++++---------- Minecraft.Client/Platform/Xbox/Xbox_App.h | 2 +- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 944fe5f18..3e28d4e7b 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -844,7 +844,7 @@ public: std::uint32_t GetRequiredTexturePackID() { return m_dwRequiredTexturePackID; } void SetRequiredTexturePackID(std::uint32_t texturePackId) { m_dwRequiredTexturePackID = texturePackId; } - virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;} + virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;} //XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; } diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp index 035655190..14e4a79c1 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp @@ -141,9 +141,9 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) // this is probably a texture pack icon added from TMS unsigned int dwBytes=0; - DWORD dwFileBytes=0; + unsigned int dwFileBytes=0; std::uint8_t *pbData=NULL; - PBYTE pbFileData=NULL; + std::uint8_t *pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data @@ -160,13 +160,13 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) } app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbFileData,&dwFileBytes ); - if(dwFileBytes >= 0 && pbFileData) + if(dwFileBytes > 0 && pbFileData) { XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackIconBrush); m_texturePackIcon->UseBrush(m_hTexturePackIconBrush); } app.GetFileFromTPD(eTPDFileType_Comparison,pbData,dwBytes,&pbFileData,&dwFileBytes ); - if(dwFileBytes >= 0 && pbFileData) + if(dwFileBytes > 0 && pbFileData) { XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackComparisonBrush); m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 63238cd43..c2332d463 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -717,8 +717,8 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); if(dwBytes > 0 && pbData) { - DWORD dwImageBytes=0; - PBYTE pbImageData=NULL; + unsigned int dwImageBytes=0; + std::uint8_t *pbImageData=NULL; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); ListInfo.fEnabled = TRUE; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 432108698..7964e065f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1701,7 +1701,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? - DWORD tpdImageBytes = 0; + unsigned int tpdImageBytes = 0; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&imageData,&tpdImageBytes ); imageBytes = static_cast(tpdImageBytes); if(imageBytes > 0 && imageData) diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp index 1d00f16bd..2b4dc50a6 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp @@ -790,8 +790,8 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); if(dwBytes > 0 && pbData) { - DWORD dwImageBytes=0; - PBYTE pbImageData=NULL; + unsigned int dwImageBytes=0; + std::uint8_t *pbImageData=NULL; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); ListInfo.fEnabled = TRUE; @@ -1242,9 +1242,9 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) { // this is probably a texture pack icon added from TMS unsigned int dwBytes=0; - DWORD dwFileBytes=0; + unsigned int dwFileBytes=0; std::uint8_t *pbData=NULL; - PBYTE pbFileData=NULL; + std::uint8_t *pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data @@ -1261,13 +1261,13 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) } app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbFileData,&dwFileBytes ); - if(dwFileBytes >= 0 && pbFileData) + if(dwFileBytes > 0 && pbFileData) { XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackIconBrush); m_texturePackIcon->UseBrush(m_hTexturePackIconBrush); } app.GetFileFromTPD(eTPDFileType_Comparison,pbData,dwBytes,&pbFileData,&dwFileBytes ); - if(dwFileBytes >= 0 && pbFileData) + if(dwFileBytes > 0 && pbFileData) { XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackComparisonBrush); m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush); diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp index c46a8bc75..a99b11b1e 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp @@ -714,8 +714,8 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); if(dwBytes > 0 && pbData) { - DWORD dwImageBytes=0; - PBYTE pbImageData=NULL; + unsigned int dwImageBytes=0; + std::uint8_t *pbImageData=NULL; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); ListInfo.fEnabled = TRUE; @@ -1100,9 +1100,9 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) // this is probably a texture pack icon added from TMS unsigned int dwBytes=0; - DWORD dwFileBytes=0; + unsigned int dwFileBytes=0; std::uint8_t *pbData=NULL; - PBYTE pbFileData=NULL; + std::uint8_t *pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data @@ -1119,13 +1119,13 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) } app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbFileData,&dwFileBytes ); - if(dwFileBytes >= 0 && pbFileData) + if(dwFileBytes > 0 && pbFileData) { XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackIconBrush); m_texturePackIcon->UseBrush(m_hTexturePackIconBrush); } app.GetFileFromTPD(eTPDFileType_Comparison,pbData,dwBytes,&pbFileData,&dwFileBytes ); - if(dwFileBytes >= 0 && pbFileData) + if(dwFileBytes > 0 && pbFileData) { XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackComparisonBrush); m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush); diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp index e0720fef8..9e11420a4 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -1280,7 +1280,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? - DWORD tpdImageBytes = 0; + unsigned int tpdImageBytes = 0; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&imageData,&tpdImageBytes ); imageBytes = static_cast(tpdImageBytes); if(imageBytes > 0 && imageData) diff --git a/Minecraft.Client/Platform/Xbox/Xbox_App.cpp b/Minecraft.Client/Platform/Xbox/Xbox_App.cpp index 6f050b2d6..86bb69123 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_App.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_App.cpp @@ -2959,9 +2959,9 @@ WCHAR CConsoleMinecraftApp::m_wchTMSXZP[] = L"file://UPDATE:/res/TMS/TMSFiles.xz #endif -void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) +void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes ) { - PBYTE pbPos=pbData; + std::uint8_t *pbPos=pbData; // icon is the second thing in the file if(pbData && dwBytes>0) { @@ -2973,15 +2973,15 @@ void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD if(eType==eTPDFileType_Loc) { *pdwBytes= uiDecompSize; - *ppbData = new BYTE [uiDecompSize]; + *ppbData = new std::uint8_t[uiDecompSize]; - Compression::getCompression()->Decompress(*ppbData,(UINT *)pdwBytes,&((unsigned int *)pbPos)[2],uiCompSize); + Compression::getCompression()->Decompress(*ppbData, pdwBytes, &((unsigned int *)pbPos)[2], uiCompSize); return; } else { // skip over the data - pbPos=(PBYTE)&((unsigned int *)pbPos)[2]; + pbPos=(std::uint8_t *)&((unsigned int *)pbPos)[2]; pbPos+=uiCompSize; } @@ -2992,15 +2992,15 @@ void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD if(eType==eTPDFileType_Icon) { *pdwBytes= uiDecompSize; - *ppbData = new BYTE [uiDecompSize]; + *ppbData = new std::uint8_t[uiDecompSize]; - Compression::getCompression()->Decompress(*ppbData,(UINT *)pdwBytes,&((unsigned int *)pbPos)[2],uiCompSize); + Compression::getCompression()->Decompress(*ppbData, pdwBytes, &((unsigned int *)pbPos)[2], uiCompSize); return; } else { // skip over the data - pbPos=(PBYTE)&((unsigned int *)pbPos)[2]; + pbPos=(std::uint8_t *)&((unsigned int *)pbPos)[2]; pbPos+=uiCompSize; } @@ -3011,9 +3011,9 @@ void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD if(eType==eTPDFileType_Comparison) { *pdwBytes= uiDecompSize; - *ppbData = new BYTE [uiDecompSize]; + *ppbData = new std::uint8_t[uiDecompSize]; - Compression::getCompression()->Decompress(*ppbData,(UINT *)pdwBytes,&((unsigned int *)pbPos)[2],uiCompSize); + Compression::getCompression()->Decompress(*ppbData, pdwBytes, &((unsigned int *)pbPos)[2], uiCompSize); return; } } diff --git a/Minecraft.Client/Platform/Xbox/Xbox_App.h b/Minecraft.Client/Platform/Xbox/Xbox_App.h index f32438b1c..2884b9c5d 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_App.h +++ b/Minecraft.Client/Platform/Xbox/Xbox_App.h @@ -185,7 +185,7 @@ public: static TMS_FILE TMSFileA[TMS_COUNT]; - virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ); + virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes ); private: static WCHAR m_wchTMSXZP[]; From e83cf9a2f345f53e0888e1960eca54c53761d104 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 20:01:25 +1100 Subject: [PATCH 069/192] Use standard buffer types for TMS files --- Minecraft.Client/Platform/Common/App_structs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 437a96e08..53680568f 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -7,8 +7,8 @@ typedef struct wchar_t *wchFilename; eFileExtensionType eEXT; eTMSFileType eTMSType; - PBYTE pbData; - UINT uiSize; + std::uint8_t *pbData; + unsigned int uiSize; int iConfig; // used for texture pack data files } TMS_FILE; From ca72052b4cbf2039c117f0ffc25f47a6be1611fa Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:30:58 +1100 Subject: [PATCH 070/192] Remove Win32 types from UI substitution textures --- Minecraft.Client/Platform/Common/UI/UIController.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIController.h | 4 +++- Minecraft.Client/Platform/Common/UI/UIScene.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene.h | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index e697b6369..e43f4043e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -1383,7 +1383,7 @@ void RADLINK UIController::TextureSubstitutionDestroyCallback ( void * user_call t->releaseTexture( id ); } -void UIController::registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength) +void UIController::registerSubstitutionTexture(const std::wstring &textureName, std::uint8_t *pbData, unsigned int dwLength) { // Remove it if it already exists unregisterSubstitutionTexture(textureName,false); diff --git a/Minecraft.Client/Platform/Common/UI/UIController.h b/Minecraft.Client/Platform/Common/UI/UIController.h index 4ba7eaefd..41778da78 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.h +++ b/Minecraft.Client/Platform/Common/UI/UIController.h @@ -1,5 +1,7 @@ #pragma once //using namespace std; +#include + #include "IUIController.h" #include "UIEnums.h" #include "UIGroup.h" @@ -256,7 +258,7 @@ protected: virtual void destroySubstitutionTexture(void *destroyCallBackData, GDrawTexture *handle) {} public: - void registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength); + void registerSubstitutionTexture(const std::wstring &textureName, std::uint8_t *pbData, unsigned int dwLength); void unregisterSubstitutionTexture(const std::wstring &textureName, bool deleteData); public: diff --git a/Minecraft.Client/Platform/Common/UI/UIScene.cpp b/Minecraft.Client/Platform/Common/UI/UIScene.cpp index 338e5eee1..e7c35404e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene.cpp @@ -1161,7 +1161,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16 * call) } } -void UIScene::registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength, bool deleteData) +void UIScene::registerSubstitutionTexture(const std::wstring &textureName, std::uint8_t *pbData, unsigned int dwLength, bool deleteData) { m_registeredTextures[textureName] = deleteData;; ui.registerSubstitutionTexture(textureName, pbData, dwLength); @@ -1245,4 +1245,4 @@ size_t UIScene::GetCallbackUniqueId() bool UIScene::isReadyToDelete() { return true; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/UIScene.h b/Minecraft.Client/Platform/Common/UI/UIScene.h index 315229390..a9171ed33 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene.h @@ -4,6 +4,8 @@ //using namespace std; // A scene map directly to an Iggy movie (or more accurately a collection of different sized movies) +#include + #include "UIEnums.h" #include "UIControl_Base.h" @@ -251,7 +253,7 @@ public: #ifdef _XBOX_ONE virtual void HandleDLCLicenseChange() {} #endif - void registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength, bool deleteData = false); + void registerSubstitutionTexture(const std::wstring &textureName, std::uint8_t *pbData, unsigned int dwLength, bool deleteData = false); bool hasRegisteredSubstitutionTexture(const std::wstring &textureName); virtual void handleUnlockFullVersion() {} From 9e20f8007f408a6f29f804664dcecb052d13eb93 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:33:28 +1100 Subject: [PATCH 071/192] Use standard thumbnail types in save list data --- .../Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h | 6 ++++-- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIStructs.h | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp index 5ca70ddbf..a55888486 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -14,7 +14,7 @@ int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(LPVOID lpPar if(pbThumbnail && dwThumbnailBytes) { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = new BYTE[dwThumbnailBytes]; + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = new std::uint8_t[dwThumbnailBytes]; memcpy(pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData, pbThumbnail, dwThumbnailBytes); pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = dwThumbnailBytes; } @@ -500,4 +500,4 @@ int UIScene_InGameSaveManagementMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bool UIScene_InGameSaveManagementMenu::hasFocus(int iPad) { return bHasFocus && (iPad == m_iPad || m_iPad == XUSER_INDEX_ANY); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h index 11ace0c2b..ab4fff8ff 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "IUIScene_StartGame.h" class UIScene_LoadMenu : public IUIScene_StartGame @@ -68,7 +70,7 @@ private: #endif //int *m_iConfigA; // track the texture packs that we don't have installed - PBYTE m_pbThumbnailData; + std::uint8_t *m_pbThumbnailData; unsigned int m_uiThumbnailSize; std::wstring m_thumbnailName; @@ -128,4 +130,4 @@ private: public: static int StartGame_SignInReturned(LPVOID pParam, bool, int); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 7964e065f..66ad44b42 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -59,7 +59,7 @@ int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE p if(pbThumbnail && dwThumbnailBytes) { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = new BYTE[dwThumbnailBytes]; + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = new std::uint8_t[dwThumbnailBytes]; memcpy(pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData, pbThumbnail, dwThumbnailBytes); pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = dwThumbnailBytes; } diff --git a/Minecraft.Client/Platform/Common/UI/UIStructs.h b/Minecraft.Client/Platform/Common/UI/UIStructs.h index 637bdea9b..236cc3608 100644 --- a/Minecraft.Client/Platform/Common/UI/UIStructs.h +++ b/Minecraft.Client/Platform/Common/UI/UIStructs.h @@ -188,8 +188,8 @@ CreateWorldMenuInitData; typedef struct _SaveListDetails { int saveId; - PBYTE pbThumbnailData; - DWORD dwThumbnailSize; + std::uint8_t *pbThumbnailData; + unsigned int dwThumbnailSize; #ifdef _DURANGO wchar_t UTF16SaveName[128]; wchar_t UTF16SaveFilename[MAX_SAVEFILENAME_LENGTH]; From c72b3d757addb1235974d22ea9e53a2ac3f75acc Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:35:47 +1100 Subject: [PATCH 072/192] Use standard pointers and bools in UI structs --- .../Platform/Common/UI/UIStructs.h | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIStructs.h b/Minecraft.Client/Platform/Common/UI/UIStructs.h index 236cc3608..cda4246ed 100644 --- a/Minecraft.Client/Platform/Common/UI/UIStructs.h +++ b/Minecraft.Client/Platform/Common/UI/UIStructs.h @@ -139,8 +139,8 @@ typedef struct _ConnectionProgressParams bool showTooltips; bool setFailTimer; int timerTime; - void (*cancelFunc)(LPVOID param); - LPVOID cancelFuncParam; + void (*cancelFunc)(void *param); + void *cancelFuncParam; _ConnectionProgressParams() { @@ -157,20 +157,20 @@ typedef struct _ConnectionProgressParams // Fullscreen progress typedef struct _UIFullscreenProgressCompletionData { - BOOL bRequiresUserAction; - BOOL bShowBackground; - BOOL bShowLogo; - BOOL bShowTips; + bool bRequiresUserAction; + bool bShowBackground; + bool bShowLogo; + bool bShowTips; ProgressionCompletionType type; int iPad; EUIScene scene; _UIFullscreenProgressCompletionData() { - bRequiresUserAction = FALSE; - bShowBackground = TRUE; - bShowLogo = TRUE; - bShowTips = TRUE; + bRequiresUserAction = false; + bShowBackground = true; + bShowLogo = true; + bShowTips = true; type = e_ProgressCompletion_NoAction; } } UIFullscreenProgressCompletionData; @@ -178,8 +178,8 @@ typedef struct _UIFullscreenProgressCompletionData // Create world typedef struct _CreateWorldMenuInitData { - BOOL bOnline; - BOOL bIsPrivate; + bool bOnline; + bool bIsPrivate; int iPad; } CreateWorldMenuInitData; @@ -284,14 +284,14 @@ LaunchMoreOptionsMenuInitData; typedef struct _LoadingInputParams { C4JThreadStartFunc* func; - LPVOID lpParam; + void *lpParam; UIFullscreenProgressCompletionData *completionData; int cancelText; - void (*cancelFunc)(LPVOID param); - void (*completeFunc)(LPVOID param); - LPVOID m_cancelFuncParam; - LPVOID m_completeFuncParam; + void (*cancelFunc)(void *param); + void (*completeFunc)(void *param); + void *m_cancelFuncParam; + void *m_completeFuncParam; bool waitForThreadToDelete; _LoadingInputParams() @@ -348,8 +348,8 @@ typedef struct _TutorialPopupInfo // Quadrant sign in typedef struct _SignInInfo { - int( *Func)(LPVOID,const bool, const int iPad); - LPVOID lpParam; + int( *Func)(void *,const bool, const int iPad); + void *lpParam; bool requireOnline; } SignInInfo; @@ -370,8 +370,8 @@ typedef struct _MessageBoxInfo UINT *uiOptionA; UINT uiOptionC; DWORD dwPad; - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult); - LPVOID lpParam; + int( *Func)(void *,int,const C4JStorage::EMessageResult); + void *lpParam; //C4JStringTable *pStringTable; // 4J Stu - We don't need this for our internal message boxes WCHAR *pwchFormatString; DWORD dwFocusButton; From d89db4917a08f699fa11d9753c640920cda81a54 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:38:16 +1100 Subject: [PATCH 073/192] Use standard small-id types in player options --- .../Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.h | 6 ++++-- Minecraft.Client/Platform/Common/UI/UIStructs.h | 2 +- .../Platform/Common/XUI/XUI_InGamePlayerOptions.h | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.h index 670da1d4e..a4eeaa87c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "UIScene.h" class UIScene_InGamePlayerOptionsMenu : public UIScene @@ -27,7 +29,7 @@ private: bool m_bShouldNavBack; bool m_editingSelf; - BYTE m_networkSmallId; + std::uint8_t m_networkSmallId; unsigned int m_playerPrivileges; UIControl_Label m_labelGamertag; @@ -87,4 +89,4 @@ private: used after changing the moderator checkbox. */ void resetCheatCheckboxes(); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/UI/UIStructs.h b/Minecraft.Client/Platform/Common/UI/UIStructs.h index cda4246ed..d4b9a09ba 100644 --- a/Minecraft.Client/Platform/Common/UI/UIStructs.h +++ b/Minecraft.Client/Platform/Common/UI/UIStructs.h @@ -388,7 +388,7 @@ DLCOffersParam; typedef struct _InGamePlayerOptionsInitData { int iPad; - BYTE networkSmallId; + std::uint8_t networkSmallId; unsigned int playerPrivileges; } InGamePlayerOptionsInitData; diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.h b/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.h index 487be5afc..cbd137a2f 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.h +++ b/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "../Media/xuiscene_ingame_player_options.h" class CScene_InGamePlayerOptions : public CXuiSceneImpl @@ -79,7 +81,7 @@ public: private: bool m_editingSelf; int m_iPad; - BYTE m_networkSmallId; + std::uint8_t m_networkSmallId; unsigned int m_playerPrivileges; D3DXVECTOR3 m_OriginalPosition; From 4e975540a97bf830294459380e0aaa3250e71477 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:46:33 +1100 Subject: [PATCH 074/192] Remove Win32 types from UI message boxes --- .../Platform/Common/UI/UIController.cpp | 22 +++++++++---------- .../Platform/Common/UI/UIController.h | 12 +++++----- .../Platform/Common/UI/UIStructs.h | 14 ++++++------ .../Platform/Xbox/Xbox_UIController.cpp | 10 ++++----- .../Platform/Xbox/Xbox_UIController.h | 8 +++---- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index e43f4043e..df1581ec4 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -2414,11 +2414,11 @@ void UIController::ClearPressStart() // 4J Stu - For the different StringTable classes. Should really fix the libraries. #ifndef __PS3__ -C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError) +C4JStorage::EMessageResult UIController::RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA, unsigned int uiOptionC, unsigned int dwPad, + int( *Func)(void *,int,const C4JStorage::EMessageResult), void *lpParam, C4JStringTable *pStringTable, wchar_t *pwchFormatString, unsigned int dwFocusButton, bool bIsError) #else -C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, StringTable *pStringTable, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError) +C4JStorage::EMessageResult UIController::RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA, unsigned int uiOptionC, unsigned int dwPad, + int( *Func)(void *,int,const C4JStorage::EMessageResult), void *lpParam, StringTable *pStringTable, wchar_t *pwchFormatString, unsigned int dwFocusButton, bool bIsError) #endif { MessageBoxInfo param; @@ -2440,8 +2440,8 @@ C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT ui // Queue this message box QueuedMessageBoxData *queuedData = new QueuedMessageBoxData(); queuedData->info = param; - queuedData->info.uiOptionA = new UINT[param.uiOptionC]; - memcpy(queuedData->info.uiOptionA, param.uiOptionA, param.uiOptionC * sizeof(UINT)); + queuedData->info.uiOptionA = new unsigned int[param.uiOptionC]; + memcpy(queuedData->info.uiOptionA, param.uiOptionA, param.uiOptionC * sizeof(unsigned int)); queuedData->iPad = dwPad; queuedData->layer = eUILayer_Error; // Ensures that these don't get wiped out by a CloseAllScenes call m_queuedMessageBoxData.push_back(queuedData); @@ -2462,7 +2462,7 @@ C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT ui } } -C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) +C4JStorage::EMessageResult UIController::RequestUGCMessageBox(int title/* = -1 */, int message/* = -1 */, int iPad/* = -1*/, int( *Func)(void *,int,const C4JStorage::EMessageResult)/* = NULL*/, void *lpParam/* = NULL*/) { // Default title / messages if (title == -1) @@ -2484,17 +2484,17 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 return C4JStorage::EMessage_ResultAccept; #elif defined(__PSVITA__) ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad ); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; return ui.RequestMessageBox( title, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false); #else - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; return ui.RequestMessageBox( title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false); #endif } -C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) +C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(int title/* = -1 */, int message/* = -1 */, int iPad/* = -1*/, int( *Func)(void *,int,const C4JStorage::EMessageResult)/* = NULL*/, void *lpParam/* = NULL*/) { // Default title / messages if (title == -1) @@ -2522,7 +2522,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad ); return C4JStorage::EMessage_ResultAccept; #else - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; return ui.RequestMessageBox( title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false); #endif diff --git a/Minecraft.Client/Platform/Common/UI/UIController.h b/Minecraft.Client/Platform/Common/UI/UIController.h index 41778da78..a6c628a8a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.h +++ b/Minecraft.Client/Platform/Common/UI/UIController.h @@ -345,15 +345,15 @@ public: // 4J Stu - Only because of the different StringTable type, should really fix the libraries #ifndef __PS3__ - virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0, bool bIsError = true); + virtual C4JStorage::EMessageResult RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA, unsigned int uiOptionC, unsigned int dwPad = XUSER_INDEX_ANY, + int( *Func)(void *,int,const C4JStorage::EMessageResult)=NULL, void *lpParam=NULL, C4JStringTable *pStringTable=NULL, wchar_t *pwchFormatString=NULL, unsigned int dwFocusButton=0, bool bIsError = true); #else - virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, StringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0, bool bIsError = true); + virtual C4JStorage::EMessageResult RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA, unsigned int uiOptionC, unsigned int dwPad = XUSER_INDEX_ANY, + int( *Func)(void *,int,const C4JStorage::EMessageResult)=NULL, void *lpParam=NULL, StringTable *pStringTable=NULL, wchar_t *pwchFormatString=NULL, unsigned int dwFocusButton=0, bool bIsError = true); #endif - C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); - C4JStorage::EMessageResult RequestContentRestrictedMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); + C4JStorage::EMessageResult RequestUGCMessageBox(int title = -1, int message = -1, int iPad = -1, int( *Func)(void *,int,const C4JStorage::EMessageResult) = NULL, void *lpParam = NULL); + C4JStorage::EMessageResult RequestContentRestrictedMessageBox(int title = -1, int message = -1, int iPad = -1, int( *Func)(void *,int,const C4JStorage::EMessageResult) = NULL, void *lpParam = NULL); virtual void SetWinUserIndex(unsigned int iPad); unsigned int GetWinUserIndex(); diff --git a/Minecraft.Client/Platform/Common/UI/UIStructs.h b/Minecraft.Client/Platform/Common/UI/UIStructs.h index d4b9a09ba..fa58d7815 100644 --- a/Minecraft.Client/Platform/Common/UI/UIStructs.h +++ b/Minecraft.Client/Platform/Common/UI/UIStructs.h @@ -365,16 +365,16 @@ SCreditTextItemDef; // Message box typedef struct _MessageBoxInfo { - UINT uiTitle; - UINT uiText; - UINT *uiOptionA; - UINT uiOptionC; - DWORD dwPad; + unsigned int uiTitle; + unsigned int uiText; + unsigned int *uiOptionA; + unsigned int uiOptionC; + unsigned int dwPad; int( *Func)(void *,int,const C4JStorage::EMessageResult); void *lpParam; //C4JStringTable *pStringTable; // 4J Stu - We don't need this for our internal message boxes - WCHAR *pwchFormatString; - DWORD dwFocusButton; + wchar_t *pwchFormatString; + unsigned int dwFocusButton; } MessageBoxInfo; typedef struct _DLCOffersParam diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp index 495dac0e0..e7eb1fa5b 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp @@ -313,13 +313,13 @@ void ConsoleUIController::SetWinUserIndex(unsigned int iPad) CScene_Win::setWinUserIndex( iPad ); } -C4JStorage::EMessageResult ConsoleUIController::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, CXuiStringTable *pStringTable, WCHAR *pwchFormatString,DWORD dwFocusButton,bool bIsError) +C4JStorage::EMessageResult ConsoleUIController::RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA, unsigned int uiOptionC, unsigned int dwPad, + int( *Func)(void *,int,const C4JStorage::EMessageResult), void *lpParam, CXuiStringTable *pStringTable, wchar_t *pwchFormatString, unsigned int dwFocusButton, bool bIsError) { return StorageManager.RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pStringTable, pwchFormatString, dwFocusButton); } -C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) +C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(int title/* = -1 */, int message/* = -1 */, int iPad/* = -1*/, int( *Func)(void *,int,const C4JStorage::EMessageResult)/* = NULL*/, void *lpParam/* = NULL*/) { // Default title / messages if (title == -1) @@ -335,7 +335,7 @@ C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/ // Default pad to primary player if (iPad == -1) iPad = ProfileManager.GetPrimaryPad(); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; return ui.RequestMessageBox(title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h index 041306a75..7487a3d8d 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h @@ -70,10 +70,10 @@ public: virtual void SetWinUserIndex(unsigned int iPad); - virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, CXuiStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0, bool bIsError = true); + virtual C4JStorage::EMessageResult RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA, unsigned int uiOptionC, unsigned int dwPad = XUSER_INDEX_ANY, + int( *Func)(void *,int,const C4JStorage::EMessageResult)=NULL, void *lpParam=NULL, CXuiStringTable *pStringTable=NULL, wchar_t *pwchFormatString=NULL, unsigned int dwFocusButton=0, bool bIsError = true); - C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); + C4JStorage::EMessageResult RequestUGCMessageBox(int title = -1, int message = -1, int iPad = -1, int( *Func)(void *,int,const C4JStorage::EMessageResult) = NULL, void *lpParam = NULL); }; -extern ConsoleUIController ui; \ No newline at end of file +extern ConsoleUIController ui; From 3e40aa45af5693f7ad7e2db43d97d3c31ceefe70 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:49:58 +1100 Subject: [PATCH 075/192] Remove BOOLs from launch option params --- .../Platform/Common/UI/UIStructs.h | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIStructs.h b/Minecraft.Client/Platform/Common/UI/UIStructs.h index fa58d7815..7d39b37c0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIStructs.h +++ b/Minecraft.Client/Platform/Common/UI/UIStructs.h @@ -238,24 +238,24 @@ typedef struct _JoinMenuInitData // More Options typedef struct _LaunchMoreOptionsMenuInitData { - BOOL bOnlineGame; - BOOL bInviteOnly; - BOOL bAllowFriendsOfFriends; + bool bOnlineGame; + bool bInviteOnly; + bool bAllowFriendsOfFriends; - BOOL bGenerateOptions; - BOOL bStructures; - BOOL bFlatWorld; - BOOL bBonusChest; + bool bGenerateOptions; + bool bStructures; + bool bFlatWorld; + bool bBonusChest; - BOOL bPVP; - BOOL bTrust; - BOOL bFireSpreads; - BOOL bTNT; + bool bPVP; + bool bTrust; + bool bFireSpreads; + bool bTNT; - BOOL bHostPrivileges; - BOOL bResetNether; + bool bHostPrivileges; + bool bResetNether; - BOOL bOnlineSettingChangedBySystem; + bool bOnlineSettingChangedBySystem; int iPad; @@ -268,11 +268,11 @@ typedef struct _LaunchMoreOptionsMenuInitData _LaunchMoreOptionsMenuInitData() { memset((void*)this,0,sizeof(_LaunchMoreOptionsMenuInitData)); - bOnlineGame = TRUE; - bAllowFriendsOfFriends = TRUE; - bPVP = TRUE; - bFireSpreads = TRUE; - bTNT = TRUE; + bOnlineGame = true; + bAllowFriendsOfFriends = true; + bPVP = true; + bFireSpreads = true; + bTNT = true; iPad = -1; worldSize = 3; seed = L""; From 74650536f7d1076b416733b98a9733778c859d42 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:53:28 +1100 Subject: [PATCH 076/192] Use bool launch option flags in common UI --- .../Common/UI/UIScene_CreateWorldMenu.cpp | 54 +++++++------- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 70 +++++++++---------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index c2332d463..68435e3df 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -64,15 +64,15 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); - m_MoreOptionsParams.bGenerateOptions=TRUE; - m_MoreOptionsParams.bStructures=TRUE; - m_MoreOptionsParams.bFlatWorld=FALSE; - m_MoreOptionsParams.bBonusChest=FALSE; - m_MoreOptionsParams.bPVP = TRUE; - m_MoreOptionsParams.bTrust = TRUE; - m_MoreOptionsParams.bFireSpreads = TRUE; - m_MoreOptionsParams.bHostPrivileges = FALSE; - m_MoreOptionsParams.bTNT = TRUE; + m_MoreOptionsParams.bGenerateOptions = true; + m_MoreOptionsParams.bStructures = true; + m_MoreOptionsParams.bFlatWorld = false; + m_MoreOptionsParams.bBonusChest = false; + m_MoreOptionsParams.bPVP = true; + m_MoreOptionsParams.bTrust = true; + m_MoreOptionsParams.bFireSpreads = true; + m_MoreOptionsParams.bHostPrivileges = false; + m_MoreOptionsParams.bTNT = true; m_MoreOptionsParams.iPad = iPad; m_bGameModeSurvival=true; @@ -97,23 +97,23 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay // Set the text for friends of friends, and default to on if( m_bMultiplayerAllowed ) { - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; if(bGameSetting_Online) { // The profile settings say Online, but either the player is offline, or they are not allowed to play online @@ -665,23 +665,23 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) if( bMultiplayerAllowed ) { bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } #if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 @@ -915,7 +915,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() } #endif - if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE) + if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges) { UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -1101,7 +1101,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD } // start the game - bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE); + bool isFlat = pClass->m_MoreOptionsParams.bFlatWorld; __int64 seedValue = 0; NetworkGameInitData *param = new NetworkGameInitData(); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index 09ecfe9c6..f5c7f864c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -79,12 +79,12 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); - m_MoreOptionsParams.bGenerateOptions=FALSE; - m_MoreOptionsParams.bPVP = TRUE; - m_MoreOptionsParams.bTrust = TRUE; - m_MoreOptionsParams.bFireSpreads = TRUE; - m_MoreOptionsParams.bHostPrivileges = FALSE; - m_MoreOptionsParams.bTNT = TRUE; + m_MoreOptionsParams.bGenerateOptions = false; + m_MoreOptionsParams.bPVP = true; + m_MoreOptionsParams.bTrust = true; + m_MoreOptionsParams.bFireSpreads = true; + m_MoreOptionsParams.bHostPrivileges = false; + m_MoreOptionsParams.bTNT = true; m_MoreOptionsParams.iPad = iPad; m_iSaveGameInfoIndex=params->iSaveGameInfoIndex; @@ -112,23 +112,23 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye // Set the text for friends of friends, and default to on if( m_bMultiplayerAllowed) { - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; if(bGameSetting_Online) { // The profile settings say Online, but either the player is offline, or they are not allowed to play online @@ -451,12 +451,12 @@ void UIScene_LoadMenu::tick() // Setup all the text and checkboxes to match what the game was saved with on if(bHostOptionsRead) { - m_MoreOptionsParams.bPVP = app.GetGameHostOption(uiHostOptions,eGameHostOption_PvP)>0?TRUE:FALSE; - m_MoreOptionsParams.bTrust = app.GetGameHostOption(uiHostOptions,eGameHostOption_TrustPlayers)>0?TRUE:FALSE; - m_MoreOptionsParams.bFireSpreads = app.GetGameHostOption(uiHostOptions,eGameHostOption_FireSpreads)>0?TRUE:FALSE; - m_MoreOptionsParams.bTNT = app.GetGameHostOption(uiHostOptions,eGameHostOption_TNT)>0?TRUE:FALSE; - m_MoreOptionsParams.bHostPrivileges = app.GetGameHostOption(uiHostOptions,eGameHostOption_CheatsEnabled)>0?TRUE:FALSE; - m_MoreOptionsParams.bDisableSaving = app.GetGameHostOption(uiHostOptions,eGameHostOption_DisableSaving)>0?TRUE:FALSE; + m_MoreOptionsParams.bPVP = app.GetGameHostOption(uiHostOptions, eGameHostOption_PvP) > 0; + m_MoreOptionsParams.bTrust = app.GetGameHostOption(uiHostOptions, eGameHostOption_TrustPlayers) > 0; + m_MoreOptionsParams.bFireSpreads = app.GetGameHostOption(uiHostOptions, eGameHostOption_FireSpreads) > 0; + m_MoreOptionsParams.bTNT = app.GetGameHostOption(uiHostOptions, eGameHostOption_TNT) > 0; + m_MoreOptionsParams.bHostPrivileges = app.GetGameHostOption(uiHostOptions, eGameHostOption_CheatsEnabled) > 0; + m_MoreOptionsParams.bDisableSaving = app.GetGameHostOption(uiHostOptions, eGameHostOption_DisableSaving) > 0; // turn off creative mode on the save // #ifdef _DEBUG @@ -483,7 +483,7 @@ void UIScene_LoadMenu::tick() bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); if(app.GetGameHostOption(uiHostOptions,eGameHostOption_FriendsOfFriends) && !(m_bMultiplayerAllowed && bGameSetting_Online)) { - m_MoreOptionsParams.bAllowFriendsOfFriends = TRUE; + m_MoreOptionsParams.bAllowFriendsOfFriends = true; } } @@ -828,7 +828,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() #endif // Check if they have the Reset Nether flag set, and confirm they want to do this - if(m_MoreOptionsParams.bResetNether==TRUE) + if(m_MoreOptionsParams.bResetNether) { UINT uiIDA[2]; uiIDA[0]=IDS_DONT_RESET_NETHER; @@ -887,23 +887,23 @@ void UIScene_LoadMenu::handleTimerComplete(int id) if( bMultiplayerAllowed ) { bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } #if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 if(getSceneResolution() == eSceneResolution_1080) @@ -988,7 +988,7 @@ void UIScene_LoadMenu::LaunchGame(void) killTimer(CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID); #endif - if( (m_bGameModeSurvival != true || m_bHasBeenInCreative) || m_MoreOptionsParams.bHostPrivileges == TRUE) + if( (m_bGameModeSurvival != true || m_bHasBeenInCreative) || m_MoreOptionsParams.bHostPrivileges) { UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -1461,7 +1461,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges ); // flag if the user wants to reset the Nether to force a Fortress with netherwart etc. - app.SetResetNether((pClass->m_MoreOptionsParams.bResetNether==TRUE)?true:false); + app.SetResetNether(pClass->m_MoreOptionsParams.bResetNether); // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); @@ -1495,7 +1495,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal void UIScene_LoadMenu::checkStateAndStartGame() { // Check if they have the Reset Nether flag set, and confirm they want to do this - if(m_MoreOptionsParams.bResetNether==TRUE) + if(m_MoreOptionsParams.bResetNether) { UINT uiIDA[2]; uiIDA[0]=IDS_DONT_RESET_NETHER; @@ -1587,7 +1587,7 @@ void UIScene_LoadMenu::LoadLevelGen(LevelGenerationOptions *levelGen) app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,m_MoreOptionsParams.bHostPrivileges ); // flag if the user wants to reset the Nether to force a Fortress with netherwart etc. - app.SetResetNether((m_MoreOptionsParams.bResetNether==TRUE)?true:false); + app.SetResetNether(m_MoreOptionsParams.bResetNether); // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); @@ -1751,7 +1751,7 @@ void UIScene_LoadMenu::handleGainFocus(bool navBack) #if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 if(getSceneResolution() == eSceneResolution_1080) { - m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame == TRUE); + m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame); } #endif } From c3f3bc5a66b29f432fae3f2e2c454791979026ef Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:58:50 +1100 Subject: [PATCH 077/192] Use bool launch option flags in XUI --- .../Platform/Common/XUI/XUI_LoadSettings.cpp | 72 +++++++++---------- .../Common/XUI/XUI_MultiGameCreate.cpp | 54 +++++++------- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp index 2b4dc50a6..0bef66487 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp @@ -51,20 +51,20 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl m_params = (LoadMenuInitData *)pInitData->pvInitData; - m_MoreOptionsParams.bGenerateOptions=FALSE; - m_MoreOptionsParams.bPVP = TRUE; - m_MoreOptionsParams.bTrust = TRUE; - m_MoreOptionsParams.bFireSpreads = TRUE; - m_MoreOptionsParams.bTNT = TRUE; - m_MoreOptionsParams.bHostPrivileges = FALSE; - m_MoreOptionsParams.bResetNether = FALSE; + m_MoreOptionsParams.bGenerateOptions = false; + m_MoreOptionsParams.bPVP = true; + m_MoreOptionsParams.bTrust = true; + m_MoreOptionsParams.bFireSpreads = true; + m_MoreOptionsParams.bTNT = true; + m_MoreOptionsParams.bHostPrivileges = false; + m_MoreOptionsParams.bResetNether = false; m_MoreOptionsParams.iPad = m_params->iPad; // 4J-JEV: Fix for: // TU12: Content: Gameplay: New "Mass Effect World" remembers and uses the settings of another - lately created - World. - m_MoreOptionsParams.bBonusChest = FALSE; - m_MoreOptionsParams.bFlatWorld = FALSE; - m_MoreOptionsParams.bStructures = TRUE; + m_MoreOptionsParams.bBonusChest = false; + m_MoreOptionsParams.bFlatWorld = false; + m_MoreOptionsParams.bStructures = true; m_iPad=m_params->iPad; m_iSaveGameInfoIndex=m_params->iSaveGameInfoIndex; @@ -84,23 +84,23 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // Set the text for friends of friends, and default to on if( m_bMultiplayerAllowed) { - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; if(bGameSetting_Online) { // The profile settings say Online, but either the player is offline, or they are not allowed to play online @@ -195,11 +195,11 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // Setup all the text and checkboxes to match what the game was saved with on if(bHostOptionsRead) { - m_MoreOptionsParams.bPVP = app.GetGameHostOption(uiHostOptions,eGameHostOption_PvP)>0?TRUE:FALSE; - m_MoreOptionsParams.bTrust = app.GetGameHostOption(uiHostOptions,eGameHostOption_TrustPlayers)>0?TRUE:FALSE; - m_MoreOptionsParams.bFireSpreads = app.GetGameHostOption(uiHostOptions,eGameHostOption_FireSpreads)>0?TRUE:FALSE; - m_MoreOptionsParams.bTNT = app.GetGameHostOption(uiHostOptions,eGameHostOption_TNT)>0?TRUE:FALSE; - m_MoreOptionsParams.bHostPrivileges = app.GetGameHostOption(uiHostOptions,eGameHostOption_CheatsEnabled)>0?TRUE:FALSE; + m_MoreOptionsParams.bPVP = app.GetGameHostOption(uiHostOptions, eGameHostOption_PvP) > 0; + m_MoreOptionsParams.bTrust = app.GetGameHostOption(uiHostOptions, eGameHostOption_TrustPlayers) > 0; + m_MoreOptionsParams.bFireSpreads = app.GetGameHostOption(uiHostOptions, eGameHostOption_FireSpreads) > 0; + m_MoreOptionsParams.bTNT = app.GetGameHostOption(uiHostOptions, eGameHostOption_TNT) > 0; + m_MoreOptionsParams.bHostPrivileges = app.GetGameHostOption(uiHostOptions, eGameHostOption_CheatsEnabled) > 0; m_bHasBeenInCreative = app.GetGameHostOption(uiHostOptions,eGameHostOption_HasBeenInCreative)>0; if(app.GetGameHostOption(uiHostOptions,eGameHostOption_HasBeenInCreative)>0) @@ -219,7 +219,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl if(app.GetGameHostOption(uiHostOptions,eGameHostOption_FriendsOfFriends) && !(m_bMultiplayerAllowed && bGameSetting_Online)) { - m_MoreOptionsParams.bAllowFriendsOfFriends = TRUE; + m_MoreOptionsParams.bAllowFriendsOfFriends = true; } } @@ -389,7 +389,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void) // stop the timer running that causes a check for new texture packs in TMS but not installed, since this will run all through the load game, and will crash if it tries to create an hbrush XuiKillTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID); - if( (m_bGameModeSurvival != true || m_bHasBeenInCreative) || m_MoreOptionsParams.bHostPrivileges == TRUE) + if( (m_bGameModeSurvival != true || m_bHasBeenInCreative) || m_MoreOptionsParams.bHostPrivileges) { UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -628,7 +628,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyP XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); // Check if they have the Reset Nether flag set, and confirm they want to do this - if(m_MoreOptionsParams.bResetNether==TRUE) + if(m_MoreOptionsParams.bResetNether) { UINT uiIDA[2]; uiIDA[0]=IDS_DONT_RESET_NETHER; @@ -748,23 +748,23 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle if( bMultiplayerAllowed ) { bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } m_bMultiplayerAllowed = bMultiplayerAllowed; @@ -973,7 +973,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass, app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges ); // flag if the user wants to reset the Nether to force a Fortress with netherwart etc. - app.SetResetNether((pClass->m_MoreOptionsParams.bResetNether==TRUE)?true:false); + app.SetResetNether(pClass->m_MoreOptionsParams.bResetNether); // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); @@ -1474,7 +1474,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen) app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,m_MoreOptionsParams.bHostPrivileges ); // flag if the user wants to reset the Nether to force a Fortress with netherwart etc. - app.SetResetNether((m_MoreOptionsParams.bResetNether==TRUE)?true:false); + app.SetResetNether(m_MoreOptionsParams.bResetNether); // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp index a99b11b1e..049bb3cd2 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp @@ -54,15 +54,15 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle CreateWorldMenuInitData *params = (CreateWorldMenuInitData *)pInitData->pvInitData; - m_MoreOptionsParams.bGenerateOptions=TRUE; - m_MoreOptionsParams.bStructures=TRUE; - m_MoreOptionsParams.bFlatWorld=FALSE; - m_MoreOptionsParams.bBonusChest=FALSE; - m_MoreOptionsParams.bPVP = TRUE; - m_MoreOptionsParams.bTrust = TRUE; - m_MoreOptionsParams.bFireSpreads = TRUE; - m_MoreOptionsParams.bHostPrivileges = FALSE; - m_MoreOptionsParams.bTNT = TRUE; + m_MoreOptionsParams.bGenerateOptions = true; + m_MoreOptionsParams.bStructures = true; + m_MoreOptionsParams.bFlatWorld = false; + m_MoreOptionsParams.bBonusChest = false; + m_MoreOptionsParams.bPVP = true; + m_MoreOptionsParams.bTrust = true; + m_MoreOptionsParams.bFireSpreads = true; + m_MoreOptionsParams.bHostPrivileges = false; + m_MoreOptionsParams.bTNT = true; m_MoreOptionsParams.iPad = params->iPad; m_iPad=params->iPad; delete params; @@ -75,23 +75,23 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle // Set the text for friends of friends, and default to on if( m_bMultiplayerAllowed) { - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; if(bGameSetting_Online) { // The profile settings say Online, but either the player is offline, or they are not allowed to play online @@ -442,7 +442,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr } } - if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE) + if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges) { UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -670,23 +670,23 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled if( bMultiplayerAllowed ) { bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); - m_MoreOptionsParams.bOnlineGame = bGameSetting_Online?TRUE:FALSE; + m_MoreOptionsParams.bOnlineGame = bGameSetting_Online; if(bGameSetting_Online) { - m_MoreOptionsParams.bInviteOnly = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)!=0)?TRUE:FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = (app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)!=0)?TRUE:FALSE; + m_MoreOptionsParams.bInviteOnly = app.GetGameSettings(m_iPad, eGameSetting_InviteOnly) != 0; + m_MoreOptionsParams.bAllowFriendsOfFriends = app.GetGameSettings(m_iPad, eGameSetting_FriendsOfFriends) != 0; } else { - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } } else { - m_MoreOptionsParams.bOnlineGame = FALSE; - m_MoreOptionsParams.bInviteOnly = FALSE; - m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; + m_MoreOptionsParams.bOnlineGame = false; + m_MoreOptionsParams.bInviteOnly = false; + m_MoreOptionsParams.bAllowFriendsOfFriends = false; } m_bMultiplayerAllowed = bMultiplayerAllowed; @@ -903,7 +903,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw } // start the game - bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE); + bool isFlat = pClass->m_MoreOptionsParams.bFlatWorld; __int64 seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements if (wSeed.length() != 0) From 7b3b49c662f2e62136d0bd8a59dabf8d85b57e9a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:04:38 +1100 Subject: [PATCH 078/192] Remove LPCWSTR from shared UI text structs --- Minecraft.Client/Platform/Common/UI/UIStructs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIStructs.h b/Minecraft.Client/Platform/Common/UI/UIStructs.h index 7d39b37c0..018be49be 100644 --- a/Minecraft.Client/Platform/Common/UI/UIStructs.h +++ b/Minecraft.Client/Platform/Common/UI/UIStructs.h @@ -321,8 +321,8 @@ typedef struct _TutorialPopupInfo #else UIScene *interactScene; #endif - LPCWSTR desc; - LPCWSTR title; + const wchar_t *desc; + const wchar_t *title; int icon; int iAuxVal /* = 0 */; bool isFoil /* = false */; @@ -356,7 +356,7 @@ typedef struct _SignInInfo // Credits typedef struct { - LPCWSTR m_Text; // Should contain string, optionally with %s to add in translated string ... e.g. "Andy West - %s" + const wchar_t * m_Text; // Should contain string, optionally with %s to add in translated string ... e.g. "Andy West - %s" int m_iStringID[2]; // May be NO_TRANSLATED_STRING if we do not require to add any translated string. ECreditTextTypes m_eType; } From b4a005fb8c8133da0fc605473b37c7055546afed Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:14:25 +1100 Subject: [PATCH 079/192] Remove Win32 callback types from launch menus --- .../Platform/Common/UI/UIController.cpp | 2 +- .../Platform/Common/UI/UIController.h | 2 +- .../Common/UI/UIScene_CreateWorldMenu.cpp | 16 ++++++------- .../Common/UI/UIScene_CreateWorldMenu.h | 10 ++++---- .../UI/UIScene_LaunchMoreOptionsMenu.cpp | 2 +- .../Common/UI/UIScene_LaunchMoreOptionsMenu.h | 2 +- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 24 +++++++++---------- .../Platform/Common/UI/UIScene_LoadMenu.h | 8 +++---- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index df1581ec4..7bf294d5b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -235,7 +235,7 @@ void UIController::SetSysUIShowing(bool bVal) m_bSystemUIShowing=bVal; } -void UIController::SetSystemUIShowing(LPVOID lpParam,bool bVal) +void UIController::SetSystemUIShowing(void *lpParam,bool bVal) { UIController *pClass=(UIController *)lpParam; pClass->SetSysUIShowing(bVal); diff --git a/Minecraft.Client/Platform/Common/UI/UIController.h b/Minecraft.Client/Platform/Common/UI/UIController.h index a6c628a8a..e37a6e668 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.h +++ b/Minecraft.Client/Platform/Common/UI/UIController.h @@ -225,7 +225,7 @@ public: void setupRenderPosition(S32 xOrigin, S32 yOrigin); void SetSysUIShowing(bool bVal); - static void SetSystemUIShowing(LPVOID lpParam,bool bVal); + static void SetSystemUIShowing(void *lpParam,bool bVal); protected: virtual void setTileOrigin(S32 xPos, S32 yPos) = 0; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 68435e3df..97ade4153 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -484,7 +484,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) } #ifdef _DURANGO -void UIScene_CreateWorldMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad) +void UIScene_CreateWorldMenu::checkPrivilegeCallback(void *lpParam, bool hasPrivilege, int iPad) { UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)lpParam; @@ -752,7 +752,7 @@ void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) } } -int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes) +int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(void *lpParam,bool bRes) { UIScene_CreateWorldMenu *pClass=(UIScene_CreateWorldMenu *)lpParam; pClass->m_bIgnoreInput=false; @@ -774,7 +774,7 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo return 0; } -int UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,bool bRes) +int UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback(void *lpParam,bool bRes) { UIScene_CreateWorldMenu *pClass=(UIScene_CreateWorldMenu *)lpParam; pClass->m_bIgnoreInput=false; @@ -1061,7 +1061,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() } // 4J Stu - Shared functionality that is the same whether we needed a quadrant sign-in or not -void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD dwLocalUsersMask) +void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, int localUsersMask) { #if TO_BE_IMPLEMENTED // stop the timer running that causes a check for new texture packs in TMS but not installed, since this will run all through the create game, and will crash if it tries to create an hbrush @@ -1172,7 +1172,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,pClass->m_MoreOptionsParams.bHostPrivileges); app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges ); - g_NetworkManager.HostGame(dwLocalUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); + g_NetworkManager.HostGame(localUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); param->settings = app.GetGameHostOption( eGameHostOption_All ); @@ -1243,7 +1243,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu // bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; int primaryPad = ProfileManager.GetPrimaryPad(); bool noPrivileges = false; - DWORD dwLocalUsersMask = 0; + int localUsersMask = 0; bool isSignedInLive = ProfileManager.IsSignedInLive(primaryPad); int iPadNotSignedInLive = -1; bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); @@ -1259,7 +1259,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu } if( !ProfileManager.AllowedToPlayMultiplayer(i) ) noPrivileges = true; - dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(i); + localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(i); isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); } } @@ -1326,7 +1326,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu else { // This is NOT called from a storage manager thread, and is in fact called from the main thread in the Profile library tick. Therefore we use the main threads IntCache. - CreateGame(pClass, dwLocalUsersMask); + CreateGame(pClass, localUsersMask); } } } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h index be1f60dd4..4058d6f1a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h @@ -92,16 +92,16 @@ private: bool IsLocalMultiplayerAvailable(); #ifdef _DURANGO - static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad); + static void checkPrivilegeCallback(void *lpParam, bool hasPrivilege, int iPad); #endif protected: - static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,const bool bRes); - static int KeyboardCompleteSeedCallback(LPVOID lpParam,const bool bRes); + static int KeyboardCompleteWorldNameCallback(void *lpParam,const bool bRes); + static int KeyboardCompleteSeedCallback(void *lpParam,const bool bRes); void handlePress(F64 controlId, F64 childId); void handleSliderMove(F64 sliderId, F64 currentValue); - static void CreateGame(UIScene_CreateWorldMenu* pClass, DWORD dwLocalUsersMask); + static void CreateGame(UIScene_CreateWorldMenu* pClass, int localUsersMask); static int ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int StartGame_SignInReturned(void *pParam,bool bContinue, int iPad); static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); @@ -112,4 +112,4 @@ protected: #endif virtual void checkStateAndStartGame(); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index eb959991d..31618ec64 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -398,7 +398,7 @@ void UIScene_LaunchMoreOptionsMenu::handleTimerComplete(int id) };*/ } -int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,bool bRes) +int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(void *lpParam,bool bRes) { UIScene_LaunchMoreOptionsMenu *pClass=(UIScene_LaunchMoreOptionsMenu *)lpParam; pClass->m_bIgnoreInput=false; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h index ef4fe9e93..e939d770e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h @@ -116,7 +116,7 @@ public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleTimerComplete(int id); - static int KeyboardCompleteSeedCallback(LPVOID lpParam,const bool bRes); + static int KeyboardCompleteSeedCallback(void *lpParam,const bool bRes); virtual void handlePress(F64 controlId, F64 childId); virtual void handleSliderMove(F64 sliderId, F64 currentValue); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index f5c7f864c..cbe6ee926 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -31,7 +31,7 @@ int UIScene_LoadMenu::m_iDifficultyTitleSettingA[4]= IDS_DIFFICULTY_TITLE_HARD }; -int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) +int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes) { UIScene_LoadMenu *pClass= (UIScene_LoadMenu *)lpParam; @@ -680,7 +680,7 @@ void UIScene_LoadMenu::handlePress(F64 controlId, F64 childId) } #ifdef _DURANGO -void UIScene_LoadMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad) +void UIScene_LoadMenu::checkPrivilegeCallback(void *lpParam, bool hasPrivilege, int iPad) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)lpParam; @@ -1290,10 +1290,10 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) } } #endif - DWORD dwLocalUsersMask = CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); + int localUsersMask = CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); // No guest problems so we don't need to force a sign-in of players here - StartGameFromSave(pClass, dwLocalUsersMask); + StartGameFromSave(pClass, localUsersMask); } } else @@ -1418,7 +1418,7 @@ int UIScene_LoadMenu::DeleteSaveDataReturned(void *pParam,bool bSuccess) } // 4J Stu - Shared functionality that is the same whether we needed a quadrant sign-in or not -void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask) +void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, int localUsersMask) { INT saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); @@ -1467,7 +1467,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal app.SetGameHostOption(eGameHostOption_GameType,pClass->m_bGameModeSurvival?GameType::SURVIVAL->getId():GameType::CREATIVE->getId() ); - g_NetworkManager.HostGame(dwLocalUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); + g_NetworkManager.HostGame(localUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); param->settings = app.GetGameHostOption( eGameHostOption_All ); @@ -1542,9 +1542,9 @@ void UIScene_LoadMenu::LoadLevelGen(LevelGenerationOptions *levelGen) } - DWORD dwLocalUsersMask = 0; + int localUsersMask = 0; - dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); + localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); // Load data from disc //File saveFile( L"Tutorial\\Tutorial" ); //LoadSaveFromDisk(&saveFile); @@ -1555,7 +1555,7 @@ void UIScene_LoadMenu::LoadLevelGen(LevelGenerationOptions *levelGen) bool isPrivate = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)>0)?true:false; - g_NetworkManager.HostGame(dwLocalUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); + g_NetworkManager.HostGame(localUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; @@ -1627,7 +1627,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int { int primaryPad = ProfileManager.GetPrimaryPad(); bool noPrivileges = false; - DWORD dwLocalUsersMask = 0; + int localUsersMask = 0; bool isSignedInLive = ProfileManager.IsSignedInLive(primaryPad); bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; int iPadNotSignedInLive = -1; @@ -1644,7 +1644,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int } if( !ProfileManager.AllowedToPlayMultiplayer(i) ) noPrivileges = true; - dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(i); + localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(i); isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); } } @@ -1731,7 +1731,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int } #endif // This is NOT called from a storage manager thread, and is in fact called from the main thread in the Profile library tick. Therefore we use the main threads IntCache. - StartGameFromSave(pClass, dwLocalUsersMask); + StartGameFromSave(pClass, localUsersMask); } } } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h index ab4fff8ff..cb826e73c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h @@ -110,15 +110,15 @@ private: void LaunchGame(void); #ifdef _DURANGO - static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad); + static void checkPrivilegeCallback(void *lpParam, bool hasPrivilege, int iPad); #endif static int ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static void StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask); + static void StartGameFromSave(UIScene_LoadMenu* pClass, int localUsersMask); static int LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner); static int TrophyDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int LoadDataComplete(void *pParam); - static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); + static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); static int CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDataReturned(void *pParam,bool bSuccess); @@ -129,5 +129,5 @@ private: #endif public: - static int StartGame_SignInReturned(LPVOID pParam, bool, int); + static int StartGame_SignInReturned(void *pParam, bool, int); }; From 7f1c1ce7f8d6f9b08836e1dda5be1771994ead04 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:19:21 +1100 Subject: [PATCH 080/192] Use bool for tooltip enable state --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/IUIController.h | 2 +- Minecraft.Client/Platform/Common/UI/UIController.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIController.h | 2 +- Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp | 4 ++-- Minecraft.Client/Platform/Xbox/Xbox_UIController.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index f58c9c24d..44360cdb9 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -1270,11 +1270,11 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_Tooltips: if((GameSettingsA[iPad]->usBitmaskValues&0x8000)!=0) { - ui.SetEnableTooltips(iPad,TRUE); + ui.SetEnableTooltips(iPad, true); } else { - ui.SetEnableTooltips(iPad,FALSE); + ui.SetEnableTooltips(iPad, false); } break; case eGameSetting_Clouds: diff --git a/Minecraft.Client/Platform/Common/UI/IUIController.h b/Minecraft.Client/Platform/Common/UI/IUIController.h index b6ecc91f2..0dc12cb99 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIController.h +++ b/Minecraft.Client/Platform/Common/UI/IUIController.h @@ -27,7 +27,7 @@ public: virtual void CheckMenuDisplayed() = 0; virtual void SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID ) = 0; - virtual void SetEnableTooltips( unsigned int iPad, BOOL bVal ) = 0; + virtual void SetEnableTooltips( unsigned int iPad, bool bVal ) = 0; virtual void ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) = 0; virtual void SetTooltips( unsigned int iPad, int iA, int iB=-1, int iX=-1, int iY=-1 , int iLT=-1, int iRT=-1, int iLB=-1, int iRB=-1, int iLS=-1, bool forceUpdate = false) = 0; virtual void EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ) = 0; diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index 7bf294d5b..9b5751c0e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -1883,7 +1883,7 @@ void UIController::SetTooltipText( unsigned int iPad, unsigned int tooltip, int if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetTooltipText(tooltip, iTextID); } -void UIController::SetEnableTooltips( unsigned int iPad, BOOL bVal ) +void UIController::SetEnableTooltips( unsigned int iPad, bool bVal ) { EUIGroup group; if( app.GetGameStarted() ) diff --git a/Minecraft.Client/Platform/Common/UI/UIController.h b/Minecraft.Client/Platform/Common/UI/UIController.h index e37a6e668..84aa15b20 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.h +++ b/Minecraft.Client/Platform/Common/UI/UIController.h @@ -295,7 +295,7 @@ public: // TOOLTIPS virtual void SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID ); - virtual void SetEnableTooltips( unsigned int iPad, BOOL bVal ); + virtual void SetEnableTooltips( unsigned int iPad, bool bVal ); virtual void ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ); virtual void SetTooltips( unsigned int iPad, int iA, int iB=-1, int iX=-1, int iY=-1 , int iLT=-1, int iRT=-1, int iLB=-1, int iRB=-1, int iLS=-1, bool forceUpdate = false); virtual void EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ); diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp index e7eb1fa5b..ac15e4580 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp @@ -106,9 +106,9 @@ void ConsoleUIController::SetTooltipText( unsigned int iPad, unsigned int toolti CXuiSceneBase::SetTooltipText(iPad,tooltip,iTextID); } -void ConsoleUIController::SetEnableTooltips( unsigned int iPad, BOOL bVal ) +void ConsoleUIController::SetEnableTooltips( unsigned int iPad, bool bVal ) { - CXuiSceneBase::SetEnableTooltips(iPad,bVal); + CXuiSceneBase::SetEnableTooltips(iPad, bVal ? TRUE : FALSE); } void ConsoleUIController::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h index 7487a3d8d..3f7503513 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h @@ -28,7 +28,7 @@ public: virtual void AnimateKeyPress(int iPad, int dwKeyCode); virtual void SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID ); - virtual void SetEnableTooltips( unsigned int iPad, BOOL bVal ); + virtual void SetEnableTooltips( unsigned int iPad, bool bVal ); virtual void ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ); virtual void SetTooltips( unsigned int iPad, int iA, int iB=-1, int iX=-1, int iY=-1 , int iLT=-1, int iRT=-1, int iLB=-1, int iRB=-1, int iLS=-1, bool forceUpdate = false); virtual void EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ); From db4ea77ed9ac5990d3101aa10c648fc14f968ae8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:22:37 +1100 Subject: [PATCH 081/192] Use standard timer types in UIController --- .../Platform/Common/UI/UIController.cpp | 30 +++++++++---------- .../Platform/Common/UI/UIController.h | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index 9b5751c0e..cec52e2eb 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -50,7 +50,7 @@ CRITICAL_SECTION UIController::ms_reloadSkinCS; bool UIController::ms_bReloadSkinCSInitialised = false; -DWORD UIController::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; +std::uint32_t UIController::m_dwTrialTimerLimitSecs = DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; static void RADLINK WarningCallback(void *user_callback_data, Iggy *player, IggyResult code, const char *message) { @@ -898,7 +898,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) else if (down) { // Check is enough time has elapsed to be a repeat key - DWORD currentTime = GetTickCount(); + std::uint32_t currentTime = GetTickCount(); if(m_actionRepeatTimer[iPad][key] > 0 && currentTime > m_actionRepeatTimer[iPad][key]) { repeat = true; @@ -935,7 +935,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) else if (down) { // Check is enough time has elapsed to be a repeat key - DWORD currentTime = GetTickCount(); + std::uint32_t currentTime = GetTickCount(); if(m_actionRepeatTimer[iPad][key] > 0 && currentTime > m_actionRepeatTimer[iPad][key]) { repeat = true; @@ -2256,24 +2256,24 @@ void UIController::UpdateTrialTimer(unsigned int iPad) { WCHAR wcTime[20]; - DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); + std::uint32_t timeTicks = (std::uint32_t)app.getTrialTimer(); - if(dwTimeTicks>m_dwTrialTimerLimitSecs) + if(timeTicks > m_dwTrialTimerLimitSecs) { - dwTimeTicks=m_dwTrialTimerLimitSecs; + timeTicks = m_dwTrialTimerLimitSecs; } - dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks; + timeTicks = m_dwTrialTimerLimitSecs - timeTicks; #ifndef _CONTENT_PACKAGE if(true) #else // display the time - only if there's less than 3 minutes - if(dwTimeTicks<180) + if(timeTicks < 180) #endif { - int iMins=dwTimeTicks/60; - int iSeconds=dwTimeTicks%60; + int iMins = timeTicks / 60; + int iSeconds = timeTicks % 60; swprintf( wcTime, 20, L"%d:%02d",iMins,iSeconds); if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcTime); } @@ -2283,7 +2283,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) } // are we out of time? - if((dwTimeTicks==0)) + if(timeTicks == 0) { // Trial over // bring up the pause menu to stop the trial over message box being called again? @@ -2298,14 +2298,14 @@ void UIController::UpdateTrialTimer(unsigned int iPad) void UIController::ReduceTrialTimerValue() { - DWORD dwTimeTicks=(int)app.getTrialTimer(); + std::uint32_t timeTicks = (std::uint32_t)app.getTrialTimer(); - if(dwTimeTicks>m_dwTrialTimerLimitSecs) + if(timeTicks > m_dwTrialTimerLimitSecs) { - dwTimeTicks=m_dwTrialTimerLimitSecs; + timeTicks = m_dwTrialTimerLimitSecs; } - m_dwTrialTimerLimitSecs-=dwTimeTicks; + m_dwTrialTimerLimitSecs -= timeTicks; } void UIController::ShowAutosaveCountdownTimer(bool show) diff --git a/Minecraft.Client/Platform/Common/UI/UIController.h b/Minecraft.Client/Platform/Common/UI/UIController.h index 84aa15b20..707e7de1a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.h +++ b/Minecraft.Client/Platform/Common/UI/UIController.h @@ -32,7 +32,7 @@ private: static const int UI_REPEAT_KEY_DELAY_MS = 300; // How long from press until the first repeat static const int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats - DWORD m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU+1]; + std::uint32_t m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU+1]; float m_fScreenWidth; float m_fScreenHeight; @@ -113,7 +113,7 @@ private: C4JRender::eViewportType m_currentRenderViewport; bool m_bCustomRenderPosition; - static DWORD m_dwTrialTimerLimitSecs; + static std::uint32_t m_dwTrialTimerLimitSecs; std::unordered_map m_substitutionTextures; From b28f6bdbe86542a54c7d3a3e197f193b559e8da6 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:29:21 +1100 Subject: [PATCH 082/192] Remove Win32 callback types from join and load menus --- .../Platform/Common/UI/UIScene_JoinMenu.cpp | 12 ++++++------ .../Platform/Common/UI/UIScene_JoinMenu.h | 2 +- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 14 +++++++------- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.h | 14 +++++++------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp index 0c212dae6..4e773911d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp @@ -329,7 +329,7 @@ void UIScene_JoinMenu::handleFocusChange(F64 controlId, F64 childId) } #ifdef _DURANGO -void UIScene_JoinMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad) +void UIScene_JoinMenu::checkPrivilegeCallback(void *lpParam, bool hasPrivilege, int iPad) { UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)lpParam; @@ -389,7 +389,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { DWORD dwSignedInUsers = 0; bool noPrivileges = false; - DWORD dwLocalUsersMask = 0; + int localUsersMask = 0; bool isSignedInLive = true; int iPadNotSignedInLive = -1; @@ -409,7 +409,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) } if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; - dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); + localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(index); } } @@ -419,7 +419,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) if(ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) { if( !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true; - dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); + localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()); #ifdef __PSVITA__ @@ -507,7 +507,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); } #endif - CGameNetworkManager::eJoinGameResult result = g_NetworkManager.JoinGame( pClass->m_selectedSession, dwLocalUsersMask ); + CGameNetworkManager::eJoinGameResult result = g_NetworkManager.JoinGame( pClass->m_selectedSession, localUsersMask ); // Alert the app the we no longer want to be informed of ethernet connections app.SetLiveLinkRequired( false ); @@ -583,4 +583,4 @@ void UIScene_JoinMenu::handleTimerComplete(int id) } break; }; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h index a97ee5a3e..056415e11 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h @@ -90,7 +90,7 @@ protected: void StartSharedLaunchFlow(); #ifdef _DURANGO - static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad); + static void checkPrivilegeCallback(void *lpParam, bool hasPrivilege, int iPad); #endif static int StartGame_SignInReturned(void *pParam, bool, int); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 66ad44b42..79dc6428a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -51,7 +51,7 @@ C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDet #endif #endif -int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) +int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes) { UIScene_LoadOrJoinMenu *pClass= (UIScene_LoadOrJoinMenu *)lpParam; @@ -74,7 +74,7 @@ int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE p return 0; } -int UIScene_LoadOrJoinMenu::LoadSaveCallback(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::LoadSaveCallback(void *lpParam,bool bRes) { //UIScene_LoadOrJoinMenu *pClass= (UIScene_LoadOrJoinMenu *)lpParam; // Get the save data now @@ -1165,7 +1165,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr } } -int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(void *lpParam,bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled UIScene_LoadOrJoinMenu *pClass=(UIScene_LoadOrJoinMenu *)lpParam; @@ -1224,7 +1224,7 @@ void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) #ifdef SONY_REMOTE_STORAGE_DOWNLOAD -void UIScene_LoadOrJoinMenu::remoteStorageGetSaveCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) +void UIScene_LoadOrJoinMenu::remoteStorageGetSaveCallback(void *lpParam, SonyRemoteStorage::Status s, int error_code) { app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n", error_code); assert(error_code == 0); @@ -1590,7 +1590,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); } -void UIScene_LoadOrJoinMenu::UpdateGamesListCallback(LPVOID pParam) +void UIScene_LoadOrJoinMenu::UpdateGamesListCallback(void *pParam) { if(pParam != NULL) { @@ -2041,7 +2041,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt return 0; } -int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void *lpParam,bool bRes) { ui.EnterCallbackIdCriticalSection(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); @@ -2062,7 +2062,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) } -int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(void *lpParam,bool bRes) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)lpParam; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h index 02f850978..c0511d5dc 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h @@ -124,7 +124,7 @@ public: virtual EUIScene getSceneType() { return eUIScene_LoadOrJoinMenu;} - static void UpdateGamesListCallback(LPVOID pParam); + static void UpdateGamesListCallback(void *pParam); #ifdef _XBOX_ONE void HandleDLCLicenseChange(); #endif @@ -145,14 +145,14 @@ protected: public: - static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); - static int LoadSaveCallback(LPVOID lpParam,bool bRes); + static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); + static int LoadSaveCallback(void *lpParam,bool bRes); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int DeleteSaveDataReturned(LPVOID lpParam,bool bRes); - static int RenameSaveDataReturned(LPVOID lpParam,bool bRes); - static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes); + static int DeleteSaveDataReturned(void *lpParam,bool bRes); + static int RenameSaveDataReturned(void *lpParam,bool bRes); + static int KeyboardCompleteWorldNameCallback(void *lpParam,bool bRes); protected: void handlePress(F64 controlId, F64 childId); void LoadLevelGen(LevelGenerationOptions *levelGen); @@ -172,7 +172,7 @@ private: #if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); static int PSN_SignInReturned(void *pParam,bool bContinue, int iPad); - static void remoteStorageGetSaveCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); + static void remoteStorageGetSaveCallback(void *lpParam, SonyRemoteStorage::Status s, int error_code); #endif #ifdef __ORBIS__ From 3b785b6787b33bc95540069c885a0888336bb657 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:31:56 +1100 Subject: [PATCH 083/192] Remove Win32 callback types from save management menu --- .../Common/UI/UIScene_InGameSaveManagementMenu.cpp | 14 +++++++------- .../Common/UI/UIScene_InGameSaveManagementMenu.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp index a55888486..6ce1bf18e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -6,7 +6,7 @@ #include #endif -int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) +int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes) { UIScene_InGameSaveManagementMenu *pClass= (UIScene_InGameSaveManagementMenu *)lpParam; @@ -276,7 +276,7 @@ void UIScene_InGameSaveManagementMenu::tick() if(!m_bExitScene) { // convert to utf16 - uint16_t u16Message[MAX_SAVEFILENAME_LENGTH]; + std::uint16_t u16Message[MAX_SAVEFILENAME_LENGTH]; #ifdef _DURANGO // Already utf16 on durango memcpy(u16Message, m_saveDetails[m_iRequestingThumbnailId].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); @@ -296,19 +296,19 @@ void UIScene_InGameSaveManagementMenu::tick() #ifdef __PS3 size_t srcmax,dstmax; #else - uint32_t srcmax,dstmax; - uint32_t srclen,dstlen; + std::uint32_t srcmax,dstmax; + std::uint32_t srclen,dstlen; #endif srcmax=MAX_SAVEFILENAME_LENGTH; dstmax=MAX_SAVEFILENAME_LENGTH; #if defined(__PS3__) - L10nResult lres= UTF8stoUTF16s((uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,&srcmax,u16Message,&dstmax); + L10nResult lres= UTF8stoUTF16s((std::uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,&srcmax,u16Message,&dstmax); #else SceCesUcsContext context; sceCesUcsContextInit(&context); - sceCesUtf8StrToUtf16Str(&context, (uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,srcmax,&srclen,u16Message,dstmax,&dstlen); + sceCesUtf8StrToUtf16Str(&context, (std::uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,srcmax,&srclen,u16Message,dstmax,&dstlen); #endif #endif if( m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData ) @@ -481,7 +481,7 @@ int UIScene_InGameSaveManagementMenu::DeleteSaveDialogReturned(void *pParam,int return 0; } -int UIScene_InGameSaveManagementMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) +int UIScene_InGameSaveManagementMenu::DeleteSaveDataReturned(void *lpParam,bool bRes) { UIScene_InGameSaveManagementMenu* pClass = (UIScene_InGameSaveManagementMenu*)lpParam; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h index 904eee00c..f1a317da9 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h @@ -96,9 +96,9 @@ protected: public: - static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); + static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int DeleteSaveDataReturned(LPVOID lpParam,bool bRes); + static int DeleteSaveDataReturned(void *lpParam,bool bRes); protected: void handlePress(F64 controlId, F64 childId); }; From 80f1a8d1b590351ba812f39737723ec7d04a0d82 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:33:45 +1100 Subject: [PATCH 084/192] Remove Win32 callback types from UI keyboard scenes --- Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.h | 4 ++-- .../Platform/Common/UI/UIScene_DebugCreateSchematic.cpp | 4 ++-- .../Platform/Common/UI/UIScene_DebugCreateSchematic.h | 4 ++-- .../Platform/Common/UI/UIScene_DebugSetCamera.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.h | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.h | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp index f3000b74e..5d56e7515 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp @@ -306,7 +306,7 @@ UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection) return control; } -int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) +int UIScene_AnvilMenu::KeyboardCompleteCallback(void *lpParam,bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled UIScene_AnvilMenu *pClass=(UIScene_AnvilMenu *)lpParam; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.h index 53ce46871..829264155 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.h @@ -55,7 +55,7 @@ protected: virtual UIControl *getSection(ESceneSection eSection); - static int KeyboardCompleteCallback(LPVOID lpParam,bool bRes); + static int KeyboardCompleteCallback(void *lpParam,bool bRes); virtual void handleEditNamePressed(); virtual void setEditNameValue(const std::wstring &name); virtual void setEditNameEditable(bool enabled); @@ -63,4 +63,4 @@ protected: void setCostLabel(const std::wstring &label, bool canAfford); void showCross(bool show); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp index 897cebb73..34256547e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -134,7 +134,7 @@ void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, bool sel } } -int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) +int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(void *lpParam,bool bRes) { UIScene_DebugCreateSchematic *pClass=(UIScene_DebugCreateSchematic *)lpParam; @@ -213,4 +213,4 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b return 0; } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.h b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.h index 80ec8d057..763803919 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.h @@ -68,6 +68,6 @@ protected: virtual void handleCheckboxToggled(F64 controlId, bool selected); private: - static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes); + static int KeyboardCompleteCallback(void *lpParam,const bool bRes); }; -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp index 46d2460c8..21d196fd3 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp @@ -116,7 +116,7 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected) } } -int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) +int UIScene_DebugSetCamera::KeyboardCompleteCallback(void *lpParam,bool bRes) { UIScene_DebugSetCamera *pClass=(UIScene_DebugSetCamera *)lpParam; uint16_t pchText[2048];//[128]; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.h b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.h index 926a54040..6a99cdaf8 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.h @@ -64,6 +64,6 @@ protected: virtual void handleCheckboxToggled(F64 controlId, bool selected); private: - static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes); + static int KeyboardCompleteCallback(void *lpParam,const bool bRes); }; -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp index fb85bd56b..c8466f6b1 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp @@ -140,7 +140,7 @@ void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pre } } -int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) +int UIScene_SignEntryMenu::KeyboardCompleteCallback(void *lpParam,bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled UIScene_SignEntryMenu *pClass=(UIScene_SignEntryMenu *)lpParam; @@ -203,4 +203,4 @@ void UIScene_SignEntryMenu::handleDestroy() #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO) InputManager.DestroyKeyboard(); #endif -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.h index d2535ce78..62ac378d0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.h @@ -53,6 +53,6 @@ public: protected: void handlePress(F64 controlId, F64 childId); - static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes); + static int KeyboardCompleteCallback(void *lpParam,const bool bRes); virtual void handleDestroy(); -}; \ No newline at end of file +}; From 9daa8f9c1aa7a158bcde78825ed4f3bb9931bace Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:36:38 +1100 Subject: [PATCH 085/192] Remove Win32 callback types from common UI scenes --- Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp | 6 +++--- Minecraft.Client/Platform/Common/UI/UIScene_MessageBox.h | 6 +++--- .../Platform/Common/UI/UIScene_QuadrantSignin.cpp | 4 ++-- .../Platform/Common/UI/UIScene_QuadrantSignin.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp index 207dc28a5..eeac83238 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp @@ -281,7 +281,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { int primaryPad = ProfileManager.GetPrimaryPad(); - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; + int (*signInReturnedFunc) (void *,const bool, const int iPad) = NULL; switch((int)controlId) { @@ -1042,7 +1042,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; + int (*signInReturnedFunc) (void *,const bool, const int iPad) = NULL; // 4J-PB - Check if there is a patch for the game pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); @@ -1131,7 +1131,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; + int (*signInReturnedFunc) (void *,const bool, const int iPad) = NULL; // 4J-PB - Check if there is a patch for the game pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_MessageBox.h b/Minecraft.Client/Platform/Common/UI/UIScene_MessageBox.h index 38d850d03..fd3813684 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_MessageBox.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_MessageBox.h @@ -15,8 +15,8 @@ private: eControl_COUNT }; - int( *m_Func)(LPVOID,int,const C4JStorage::EMessageResult); - LPVOID m_lpParam; + int( *m_Func)(void *,int,const C4JStorage::EMessageResult); + void *m_lpParam; int m_buttonCount; UIControl_Button m_buttonButtons[eControl_COUNT]; @@ -56,4 +56,4 @@ public: protected: void handlePress(F64 controlId, F64 childId); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp index a035d074d..4f453c4f8 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp @@ -198,7 +198,7 @@ int UIScene_QuadrantSignin::SignInReturned(void *pParam,bool bContinue, int iPad } #ifdef _DURANGO -void UIScene_QuadrantSignin::checkAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad) +void UIScene_QuadrantSignin::checkAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad) { UIScene_QuadrantSignin* pClass = (UIScene_QuadrantSignin*)lpParam; @@ -269,7 +269,7 @@ void UIScene_QuadrantSignin::setControllerState(int iPad, EControllerStatus stat } } -int UIScene_QuadrantSignin::AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) +int UIScene_QuadrantSignin::AvatarReturned(void *lpParam, std::uint8_t *pbThumbnail,DWORD dwThumbnailBytes) { UIScene_QuadrantSignin *pClass = (UIScene_QuadrantSignin *)lpParam; app.DebugPrintf(app.USER_SR,"AvatarReturned callback\n"); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h index bc9bb4325..b082f6fef 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h @@ -99,12 +99,12 @@ public: private: static int SignInReturned(void *pParam,bool bContinue, int iPad); - static int AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); + static int AvatarReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); void updateState(); void setControllerState(int iPad, EControllerStatus state); #ifdef _DURANGO - static void checkAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad); + static void checkAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad); #endif }; From 594e79908922d28e8fdd71c917cb4103f595f656 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:41:01 +1100 Subject: [PATCH 086/192] Remove Win32 callback types from progress scenes --- .../Platform/Common/UI/UIScene_ConnectingProgress.h | 4 ++-- .../Platform/Common/UI/UIScene_FullscreenProgress.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h index 19a5eedd8..4691b6434 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h @@ -10,8 +10,8 @@ private: bool m_showTooltips; bool m_removeLocalPlayer; bool m_showingButton; - void (*m_cancelFunc)(LPVOID param); - LPVOID m_cancelFuncParam; + void (*m_cancelFunc)(void *param); + void *m_cancelFuncParam; enum EControls { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.h b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.h index 2ecb71ea2..f5a6553d0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.h @@ -18,10 +18,10 @@ private: UIFullscreenProgressCompletionData *m_CompletionData; bool m_threadCompleted; int m_iPad; - void (*m_cancelFunc)(LPVOID param); - void (*m_completeFunc)(LPVOID param); - LPVOID m_cancelFuncParam; - LPVOID m_completeFuncParam; + void (*m_cancelFunc)(void *param); + void (*m_completeFunc)(void *param); + void *m_cancelFuncParam; + void *m_completeFuncParam; bool m_bWaitForThreadToDelete; std::wstring m_titleText, m_statusText; From c50aa9c1524138c499bee4cf727e003c18b0b7be Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:43:54 +1100 Subject: [PATCH 087/192] Use portable file IO for UI TTF fonts --- .../Platform/Common/UI/UITTFFont.cpp | 55 ++++++++++++------- .../Platform/Common/UI/UITTFFont.h | 4 +- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UITTFFont.cpp b/Minecraft.Client/Platform/Common/UI/UITTFFont.cpp index 8f1ad34af..81ff9b33b 100644 --- a/Minecraft.Client/Platform/Common/UI/UITTFFont.cpp +++ b/Minecraft.Client/Platform/Common/UI/UITTFFont.cpp @@ -1,40 +1,51 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "UI.h" -#include "../../Minecraft.World/Util/StringHelpers.h" -#include "../../Minecraft.World/IO/Files/File.h" +#include "../../Minecraft.World/Util/PortableFileIO.h" #include "UITTFFont.h" UITTFFont::UITTFFont(const std::string &path, S32 fallbackCharacter) { app.DebugPrintf("UITTFFont opening %s\n",path.c_str()); + pbData = NULL; -#if defined(_UNICODE) && !defined(__linux__) std::wstring wPath = convStringToWstring(path); - HANDLE file = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#endif - if( file == INVALID_HANDLE_VALUE ) + std::FILE *file = PortableFileIO::OpenBinaryFileForRead(wPath); + if( file == NULL ) { - DWORD error = GetLastError(); - app.DebugPrintf("Failed to open TTF file with error code %d (%x)\n", error, error); + app.DebugPrintf("Failed to open TTF file\n"); assert(false); } - DWORD dwHigh=0; - DWORD dwFileSize = GetFileSize(file,&dwHigh); - - if(dwFileSize!=0) + if(!PortableFileIO::Seek(file, 0, SEEK_END)) { - DWORD bytesRead; + std::fclose(file); + app.FatalLoadError(); + } - pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); - if(bSuccess==FALSE) + const __int64 endPosition = PortableFileIO::Tell(file); + if(endPosition < 0) + { + std::fclose(file); + app.FatalLoadError(); + } + + const std::size_t fileSize = static_cast(endPosition); + if(fileSize != 0) + { + if(!PortableFileIO::Seek(file, 0, SEEK_SET)) + { + std::fclose(file); + app.FatalLoadError(); + } + + pbData = new std::uint8_t[fileSize]; + const std::size_t bytesRead = std::fread(pbData, 1, fileSize, file); + const bool failed = std::ferror(file) != 0 || bytesRead != fileSize; + std::fclose(file); + if(failed) { app.FatalLoadError(); } - CloseHandle(file); IggyFontInstallTruetypeUTF8 ( (void *)pbData, IGGY_TTC_INDEX_none, "Mojangles_TTF", -1, IGGY_FONTFLAG_none ); @@ -44,8 +55,12 @@ UITTFFont::UITTFFont(const std::string &path, S32 fallbackCharacter) IggyFontInstallTruetypeUTF8 ( (void *)pbData, IGGY_TTC_INDEX_none, "Times New Roman", -1, IGGY_FONTFLAG_none ); IggyFontInstallTruetypeUTF8 ( (void *)pbData, IGGY_TTC_INDEX_none, "Arial", -1, IGGY_FONTFLAG_none ); } + else + { + std::fclose(file); + } } UITTFFont::~UITTFFont() { -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/UITTFFont.h b/Minecraft.Client/Platform/Common/UI/UITTFFont.h index e489e1e69..6053f9b49 100644 --- a/Minecraft.Client/Platform/Common/UI/UITTFFont.h +++ b/Minecraft.Client/Platform/Common/UI/UITTFFont.h @@ -1,9 +1,11 @@ #pragma once +#include + class UITTFFont { private: - PBYTE pbData; + std::uint8_t *pbData; //DWORD dwDataSize; public: From b9b2e51bc80ef0109bd97c5d7f991572a2744fff Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:45:16 +1100 Subject: [PATCH 088/192] Remove Win32 callback types from UI helper scenes --- Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.h | 4 ++-- .../Platform/Common/UI/UIScene_SkinSelectMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp index dc3701f7f..e86e43aff 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp @@ -391,7 +391,7 @@ int IUIScene_PauseMenu::ExitWorldThreadProc( void* lpParameter ) } // This function performs the meat of exiting from a level. It should be called from a thread other than the main thread. -void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) +void IUIScene_PauseMenu::_ExitWorld(void *lpParameter) { Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -688,4 +688,4 @@ int IUIScene_PauseMenu::DisableAutosaveDialogReturned(void *pParam,int iPad,C4JS app.SetAction(iPad,eAppAction_SaveGame); } return 0; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.h index 7233df3a7..d12e5c140 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.h @@ -17,9 +17,9 @@ public: static int SaveWorldThreadProc( void* lpParameter ); static int ExitWorldThreadProc( void* lpParameter ); - static void _ExitWorld(LPVOID lpParameter); // Call only from a thread + static void _ExitWorld(void *lpParameter); // Call only from a thread protected: virtual void ShowScene(bool show) = 0; virtual void SetIgnoreInput(bool ignoreInput) = 0; -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp index 87ec61804..2bd8866bf 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp @@ -1729,7 +1729,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: return 0; } -int UIScene_SkinSelectMenu::RenableInput(LPVOID lpVoid, int, int) +int UIScene_SkinSelectMenu::RenableInput(void *lpVoid, int, int) { ((UIScene_SkinSelectMenu*) lpVoid)->m_bIgnoreInput = false; return 0; @@ -1795,4 +1795,4 @@ void UIScene_SkinSelectMenu::HandleDLCLicenseChange() // update the lock flag handleSkinIndexChanged(); } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h index 6333451b1..f4215fc50 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h @@ -170,7 +170,7 @@ private: void showNotOnlineDialog(int iPad); static int UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int RenableInput(LPVOID lpVoid, int, int); + static int RenableInput(void *lpVoid, int, int); void AddFavoriteSkin(int iPad,int iSkinID); void InputActionOK(unsigned int iPad); From a55fddf27072f7f30fb17c1d402ef8b798cc44a4 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:48:32 +1100 Subject: [PATCH 089/192] Use standard image buffers in UI scenes --- Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp | 2 +- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp index 30f84df2b..d52f888e7 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp @@ -438,7 +438,7 @@ void UIScene_DLCOffersMenu::tick() if(hasRegisteredSubstitutionTexture(textureName)==false) { - PBYTE pbImageData; + std::uint8_t *pbImageData = NULL; int iImageDataBytes=0; bool bDeleteData; #ifdef __ORBIS__ @@ -570,7 +570,7 @@ void UIScene_DLCOffersMenu::tick() if(hasRegisteredSubstitutionTexture(textureName)==false) { - PBYTE pbImageData; + std::uint8_t *pbImageData = NULL; int iImageDataBytes=0; bool bDeleteData; #ifdef __ORBIS__ diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index cbe6ee926..7482fabc2 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -936,7 +936,7 @@ void UIScene_LoadMenu::handleTimerComplete(int id) if(hasRegisteredSubstitutionTexture(textureName)==false) { - PBYTE pbImageData; + std::uint8_t *pbImageData = NULL; int iImageDataBytes=0; SonyHttp::getDataFromURL(pDLCInfo->chImageURL,(void **)&pbImageData,&iImageDataBytes); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 79dc6428a..27d57421b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1850,7 +1850,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) if(hasRegisteredSubstitutionTexture(textureName)==false) { - PBYTE pbImageData; + std::uint8_t *pbImageData = NULL; int iImageDataBytes=0; SonyHttp::getDataFromURL(pDLCInfo->chImageURL,(void **)&pbImageData,&iImageDataBytes); From 7f917af01c2ab5d45b027acf2d9cb46010f72280 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:50:46 +1100 Subject: [PATCH 090/192] Use standard save image buffers in load or join menu --- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 27d57421b..c002cd9d8 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -2437,10 +2437,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null StorageManager.SetSaveTitle(wSaveName); - PBYTE pbThumbnailData=NULL; + std::uint8_t *pbThumbnailData = NULL; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=NULL; + std::uint8_t *pbDataSaveImage = NULL; DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t @@ -2597,10 +2597,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter StorageManager.ResetSaveData(); { - PBYTE pbThumbnailData=NULL; + std::uint8_t *pbThumbnailData = NULL; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=NULL; + std::uint8_t *pbDataSaveImage = NULL; DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t From 4306e80068017e880a7044e5df83fbb8472cbc14 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:55:45 +1100 Subject: [PATCH 091/192] Remove Win32 player ID types from teleport menu --- .../Platform/Common/UI/UIScene_TeleportMenu.cpp | 10 +++++----- .../Platform/Common/UI/UIScene_TeleportMenu.h | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.cpp index 4a5999a1b..6e0620771 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.cpp @@ -34,10 +34,10 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa m_playerNames[i] = L""; } - DWORD playerCount = g_NetworkManager.GetPlayerCount(); + int playerCount = g_NetworkManager.GetPlayerCount(); m_playersCount = 0; - for(DWORD i = 0; i < playerCount; ++i) + for(int i = 0; i < playerCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); @@ -124,10 +124,10 @@ void UIScene_TeleportMenu::handleGainFocus(bool navBack) void UIScene_TeleportMenu::handleReload() { - DWORD playerCount = g_NetworkManager.GetPlayerCount(); + int playerCount = g_NetworkManager.GetPlayerCount(); m_playersCount = 0; - for(DWORD i = 0; i < playerCount; ++i) + for(int i = 0; i < playerCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); @@ -185,7 +185,7 @@ void UIScene_TeleportMenu::tick() { UIScene::tick(); - for(DWORD i = 0; i < m_playersCount; ++i) + for(int i = 0; i < m_playersCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[i] ); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.h index a608d8248..9cd3cb760 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_TeleportMenu.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "UIScene.h" class UIScene_TeleportMenu : public UIScene @@ -12,7 +14,7 @@ private: bool m_teleportToPlayer; int m_playersCount; - BYTE m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's + std::uint8_t m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's char m_playersVoiceState[MINECRAFT_NET_MAX_PLAYERS]; short m_playersColourState[MINECRAFT_NET_MAX_PLAYERS]; std::wstring m_playerNames[MINECRAFT_NET_MAX_PLAYERS]; @@ -48,4 +50,4 @@ protected: public: static void OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving); -}; \ No newline at end of file +}; From b40e716b2c8501d31f7b5c1265f72fc7a8b4ce4c Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:59:01 +1100 Subject: [PATCH 092/192] Remove Win32 player ID types from in-game info menu --- .../Platform/Common/UI/UIScene_InGameInfoMenu.cpp | 10 +++++----- .../Platform/Common/UI/UIScene_InGameInfoMenu.h | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp index 48e860289..e1f37f1fb 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp @@ -20,10 +20,10 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer m_playerNames[i] = L""; } - DWORD playerCount = g_NetworkManager.GetPlayerCount(); + int playerCount = g_NetworkManager.GetPlayerCount(); m_playersCount = 0; - for(DWORD i = 0; i < playerCount; ++i) + for(int i = 0; i < playerCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); @@ -196,10 +196,10 @@ void UIScene_InGameInfoMenu::handleGainFocus(bool navBack) void UIScene_InGameInfoMenu::handleReload() { - DWORD playerCount = g_NetworkManager.GetPlayerCount(); + int playerCount = g_NetworkManager.GetPlayerCount(); m_playersCount = 0; - for(DWORD i = 0; i < playerCount; ++i) + for(int i = 0; i < playerCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); @@ -270,7 +270,7 @@ void UIScene_InGameInfoMenu::tick() { UIScene::tick(); - for(DWORD i = 0; i < m_playersCount; ++i) + for(int i = 0; i < m_playersCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h index 9bed08c6b..74ef27025 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "UIScene.h" class UIScene_InGameInfoMenu : public UIScene @@ -13,7 +15,7 @@ private: bool m_isHostPlayer; int m_playersCount; - BYTE m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's + std::uint8_t m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's char m_playersVoiceState[MINECRAFT_NET_MAX_PLAYERS]; short m_playersColourState[MINECRAFT_NET_MAX_PLAYERS]; std::wstring m_playerNames[MINECRAFT_NET_MAX_PLAYERS]; From 305d5f0812b158eeba6c73364011e9edf9c8aa15 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:00:33 +1100 Subject: [PATCH 093/192] Use standard player IDs in kick confirmation callbacks --- .../Platform/Common/UI/UIScene_InGameInfoMenu.cpp | 6 +++--- .../Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp index e1f37f1fb..32df02920 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp @@ -455,7 +455,7 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) else if(selectedPlayer->IsLocal() != TRUE && selectedPlayer->IsSameSystem(g_NetworkManager.GetHostPlayer()) != TRUE) { // Only ops will hit this, can kick anyone not local and not local to the host - BYTE *smallId = new BYTE(); + std::uint8_t *smallId = new std::uint8_t(); *smallId = m_players[currentSelection]; UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -550,8 +550,8 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *(BYTE *)pParam; - delete (BYTE*)pParam; + std::uint8_t smallId = *(std::uint8_t *)pParam; + delete (std::uint8_t *)pParam; if(result==C4JStorage::EMessage_ResultAccept) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index 6559e6c53..ddf5586cc 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -346,7 +346,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) { case eControl_Kick: { - BYTE *smallId = new BYTE(); + std::uint8_t *smallId = new std::uint8_t(); *smallId = m_networkSmallId; UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -360,8 +360,8 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *(BYTE *)pParam; - delete (BYTE*)pParam; + std::uint8_t smallId = *(std::uint8_t *)pParam; + delete (std::uint8_t *)pParam; if(result==C4JStorage::EMessage_ResultAccept) { From 12bc5aa597705c08b741fa16feb0041cf86f0110 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:02:42 +1100 Subject: [PATCH 094/192] Remove Win32 state types from player skin preview --- .../Platform/Common/UI/UIControl_PlayerSkinPreview.cpp | 2 +- .../Platform/Common/UI/UIControl_PlayerSkinPreview.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp index 280250286..9d0808393 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -16,7 +16,7 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview() { UIControl::setControlType(UIControl::ePlayerSkinPreview); - m_bDirty = FALSE; + m_bDirty = false; m_fScale = 1.0f; m_fAlpha = 1.0f; diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.h b/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.h index 2ee0729a9..64616f18d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.h +++ b/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "UIControl.h" #include "../../Minecraft.Client/Textures/Textures.h" @@ -23,7 +25,7 @@ private: e_SkinPreviewAnimation_Count, }; - BOOL m_bDirty; + bool m_bDirty; float m_fScale,m_fAlpha; std::wstring m_customTextureUrl; @@ -43,7 +45,7 @@ private: float m_walkAnimPos; bool m_bAutoRotate, m_bRotatingLeft; - BYTE m_rotateTick; + std::uint8_t m_rotateTick; float m_fTargetRotation, m_fOriginalRotation; int m_framesAnimatingRotation; bool m_bAnimatingToFacing; @@ -87,4 +89,4 @@ private: void render(EntityRenderer *renderer, double x, double y, double z, float rot, float a); bool bindTexture(const std::wstring& urlTexture, int backupTexture); bool bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture); -}; \ No newline at end of file +}; From 3b199b9ba26f16a5efe174dc3fb733c19c7d31ce Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:06:33 +1100 Subject: [PATCH 095/192] Remove Win32 input types from abstract container menus --- .../UI/IUIScene_AbstractContainerMenu.cpp | 36 +++++++++---------- .../UI/IUIScene_AbstractContainerMenu.h | 8 ++--- .../Common/UI/IUIScene_CreativeMenu.cpp | 10 +++--- .../Common/UI/IUIScene_CreativeMenu.h | 8 ++--- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp index 503848f5c..9cecd88bc 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -204,7 +204,7 @@ void IUIScene_AbstractContainerMenu::SetToolTip( EToolTipButton eButton, EToolTi void IUIScene_AbstractContainerMenu::UpdateTooltips() { // Table gives us text id for tooltip. - static const DWORD kaToolTipextIds[ eNumToolTips ] = + static const int kaToolTipextIds[ eNumToolTips ] = { IDS_TOOLTIPS_PICKUPPLACE, //eToolTipPickupPlace_OLD IDS_TOOLTIPS_EXIT, // eToolTipExit @@ -231,18 +231,18 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips() IDS_TOOLTIPS_REPAIR, // eToolTipRepair }; - BYTE focusUser = getPad(); + int focusUser = getPad(); for ( int i = 0; i < eToolTipNumButtons; ++i ) { if ( m_aeToolTipSettings[ i ] == eToolTipNone ) { - ui.ShowTooltip( focusUser, i, FALSE ); + ui.ShowTooltip( focusUser, i, false ); } else { ui.SetTooltipText( focusUser, i, kaToolTipextIds[ m_aeToolTipSettings[ i ] ] ); - ui.ShowTooltip( focusUser, i, TRUE ); + ui.ShowTooltip( focusUser, i, true ); } } } @@ -1274,9 +1274,9 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b #endif int buttonNum=0; // 0 = LeftMouse, 1 = RightMouse - BOOL quickKeyHeld=FALSE; // Represents shift key on PC + bool quickKeyHeld = false; // Represents shift key on PC - BOOL validKeyPress = FALSE; + bool validKeyPress = false; //BOOL itemEditorKeyPress = FALSE; // Ignore input from other players @@ -1297,22 +1297,22 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b #endif if(!bRepeat) { - validKeyPress = TRUE; + validKeyPress = true; // Standard left click buttonNum = 0; - quickKeyHeld = FALSE; + quickKeyHeld = false; ui.PlayUISFX(eSFX_Press); } break; case ACTION_MENU_X: if(!bRepeat) { - validKeyPress = TRUE; + validKeyPress = true; // Standard right click buttonNum = 1; - quickKeyHeld = FALSE; + quickKeyHeld = false; ui.PlayUISFX(eSFX_Press); } break; @@ -1327,11 +1327,11 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b // No quick move tooltip is shown if something is carried, so disable the action as well //if(!bIsItemCarried) { - validKeyPress = TRUE; + validKeyPress = true; // Shift and left click buttonNum = 0; - quickKeyHeld = TRUE; + quickKeyHeld = true; ui.PlayUISFX(eSFX_Press); } } @@ -1428,12 +1428,12 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b } } } - bHandled = TRUE; + bHandled = true; } break; }; - if( validKeyPress == TRUE ) + if(validKeyPress) { if(handleValidKeyPress(iPad,buttonNum,quickKeyHeld)) { @@ -1482,7 +1482,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b if( XuiIsInstanceOf( hFocusObjectParent, hClassCXuiCtrlSlotList ) ) { CXuiCtrlSlotList* slotList; - VOID *pObj; + void *pObj; XuiObjectFromHandle( hFocusObjectParent, &pObj ); slotList = (CXuiCtrlSlotList *)pObj; @@ -1517,12 +1517,12 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b return bHandled; } -bool IUIScene_AbstractContainerMenu::handleValidKeyPress(int iUserIndex, int buttonNum, BOOL quickKeyHeld) +bool IUIScene_AbstractContainerMenu::handleValidKeyPress(int iUserIndex, int buttonNum, bool quickKeyHeld) { return false; } -void IUIScene_AbstractContainerMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld) +void IUIScene_AbstractContainerMenu::handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld) { // Drop items. @@ -1540,7 +1540,7 @@ void IUIScene_AbstractContainerMenu::handleAdditionalKeyPress(int iAction) // Do nothing } -void IUIScene_AbstractContainerMenu::handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld) +void IUIScene_AbstractContainerMenu::handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld) { int currentIndex = getCurrentIndex(eSection); diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h index 33c49f689..43e8dbe9a 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h @@ -181,17 +181,17 @@ protected: // 4J - WESTY - Added for pointer prototype. void SetPointerOutsideMenu( bool bOutside ) { m_bPointerOutsideMenu = bOutside; } - void Initialize(int m_iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack=FALSE); + void Initialize(int m_iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack=false); virtual void PlatformInitialize(int iPad, int startIndex) = 0; virtual void InitDataAssociations(int iPad, AbstractContainerMenu *menu, int startIndex = 0) = 0; void onMouseTick(); bool handleKeyDown(int iPad, int iAction, bool bRepeat); - virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, BOOL quickKeyHeld); - virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld); + virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, bool quickKeyHeld); + virtual void handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld); virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey); virtual void handleAdditionalKeyPress(int iAction); - virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld); + virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld); virtual void handleSectionClick(ESceneSection eSection) = 0; void slotClicked(int slotId, int buttonNum, bool quickKey); int getCurrentIndex(ESceneSection eSection); diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp index de3c3d74e..ded89715d 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp @@ -786,7 +786,7 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA return newSection; } -bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL quickKeyHeld) +bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, bool quickKeyHeld) { // 4J Added - Make pressing the X button clear the hotbar if(buttonNum == 1) @@ -808,7 +808,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu return false; } -void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld) +void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld) { // Drop items. Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -882,7 +882,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction) } } -void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld) +void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld) { int currentIndex = getCurrentIndex(eSection); @@ -901,7 +901,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu { playerInventory->setCarried(ItemInstance::clone(clicked)); carried = playerInventory->getCarried(); - if (quickKeyHeld == TRUE) + if(quickKeyHeld) { carried->count = carried->getMaxStackSize(); } @@ -925,7 +925,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu setSectionSelectedSlot(eSectionInventoryCreativeUsing,m_iCurrSlotX,m_iCurrSlotY); currentIndex = getCurrentIndex(eSectionInventoryCreativeUsing); buttonNum = 0; - quickKeyHeld = FALSE; + quickKeyHeld = false; } m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]); std::shared_ptr newItem = m_menu->getSlot(currentIndex)->getItem(); diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h index 4320e3a17..a93463c44 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h @@ -108,10 +108,10 @@ protected: virtual void updateTabHighlightAndText(ECreativeInventoryTabs tab) = 0; virtual void updateScrollCurrentPage(int currentPage, int pageCount) = 0; virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ); - virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, BOOL quickKeyHeld); - virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld); + virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, bool quickKeyHeld); + virtual void handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld); virtual void handleAdditionalKeyPress(int iAction); - virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld); + virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld); bool getEmptyInventorySlot(std::shared_ptr item, int &slotX); int getSectionStartOffset(ESceneSection eSection); virtual bool IsSectionSlotList( ESceneSection eSection ); @@ -119,4 +119,4 @@ protected: virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT); -}; \ No newline at end of file +}; From 147ce20bc5e658262557917561ee4c7a9e2a1eac Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:10:42 +1100 Subject: [PATCH 096/192] Remove Win32 wide string aliases from common UI --- .../Platform/Common/UI/IUIScene_CraftingMenu.cpp | 6 +++--- .../Platform/Common/UI/IUIScene_CraftingMenu.h | 16 ++++++++-------- .../Platform/Common/UI/IUIScene_CreativeMenu.cpp | 2 +- .../Platform/Common/UI/IUIScene_CreativeMenu.h | 4 ++-- .../Common/UI/UIComponent_TutorialPopup.cpp | 2 +- .../Common/UI/UIComponent_TutorialPopup.h | 2 +- .../Platform/Common/UI/UIScene_CraftingMenu.cpp | 8 ++++---- .../Platform/Common/UI/UIScene_CraftingMenu.h | 8 ++++---- .../Platform/Common/UI/UIScene_DebugOptions.cpp | 2 +- .../Platform/Common/UI/UIScene_DebugOptions.h | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp index 261882ad6..60d62372c 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp @@ -28,7 +28,7 @@ Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping9GridA[IUIScene_Cra }; -LPCWSTR IUIScene_CraftingMenu::m_GroupIconNameA[m_iMaxGroup3x3]= +const wchar_t *IUIScene_CraftingMenu::m_GroupIconNameA[m_iMaxGroup3x3]= { L"Structures",//Recipy::eGroupType_Structure, L"Tools",//Recipy::eGroupType_Tool, @@ -118,7 +118,7 @@ IUIScene_CraftingMenu::IUIScene_CraftingMenu() m_iIngredientsC=0; } -LPCWSTR IUIScene_CraftingMenu::GetGroupNameText(int iGroupType) +const wchar_t *IUIScene_CraftingMenu::GetGroupNameText(int iGroupType) { switch(iGroupType) { @@ -907,7 +907,7 @@ void IUIScene_CraftingMenu::UpdateHighlight() // special case for the torch coal/charcoal int id=pTempItemInstAdditional->getDescriptionId(); - LPCWSTR itemstring; + const wchar_t *itemstring; switch(id) { diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.h index c794c9e39..5d088de9a 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.h @@ -54,12 +54,12 @@ protected: int iVSlotIndexA[3]; // index of the v slots currently displayed - static LPCWSTR m_GroupIconNameA[m_iMaxGroup3x3]; + static const wchar_t *m_GroupIconNameA[m_iMaxGroup3x3]; static Recipy::_eGroupType m_GroupTypeMapping4GridA[m_iMaxGroup2x2]; static Recipy::_eGroupType m_GroupTypeMapping9GridA[m_iMaxGroup3x3]; Recipy::_eGroupType *m_pGroupA; - static LPCWSTR m_GroupTabNameA[3]; + static const wchar_t *m_GroupTabNameA[3]; static _eGroupTab m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2]; static _eGroupTab m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3]; _eGroupTab *m_pGroupTabA; @@ -78,7 +78,7 @@ public: IUIScene_CraftingMenu(); protected: - LPCWSTR GetGroupNameText(int iGroupType); + const wchar_t *GetGroupNameText(int iGroupType); void CheckRecipesAvailable(); void UpdateHighlight(); @@ -104,16 +104,16 @@ protected: virtual void setIngredientSlotRedBox(int index, bool show) = 0; virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr item) = 0; virtual void setIngredientDescriptionRedBox(int index, bool show) = 0; - virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0; + virtual void setIngredientDescriptionText(int index, const wchar_t *text) = 0; virtual void setShowCraftHSlot(int iIndex, bool show) = 0; virtual void showTabHighlight(int iIndex, bool show) = 0; - virtual void setGroupText(LPCWSTR text) = 0; - virtual void setDescriptionText(LPCWSTR text) = 0; - virtual void setItemText(LPCWSTR text) = 0; + virtual void setGroupText(const wchar_t *text) = 0; + virtual void setDescriptionText(const wchar_t *text) = 0; + virtual void setItemText(const wchar_t *text) = 0; virtual void scrollDescriptionUp() = 0; virtual void scrollDescriptionDown() = 0; virtual void updateHighlightAndScrollPositions() = 0; virtual void updateVSlotPositions(int iSlots, int i) = 0; virtual void UpdateMultiPanel() = 0; -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp index ded89715d..302f22720 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp @@ -602,7 +602,7 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab) // 4J JEV - Tab Spec Struct -IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups) +IUIScene_CreativeMenu::TabSpec::TabSpec(const wchar_t *icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups) : m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount) { diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h index a93463c44..ac4f3d454 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.h @@ -51,7 +51,7 @@ public: static const int MAX_SIZE = rows * columns; // 4J JEV - Images - const LPCWSTR m_icon; + const wchar_t *m_icon; const int m_descriptionId; const int m_staticGroupsCount; ECreative_Inventory_Groups *m_staticGroupsA; @@ -64,7 +64,7 @@ public: unsigned int m_staticItems; public: - TabSpec( LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups ); + TabSpec( const wchar_t *icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups ); ~TabSpec(); void populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page); diff --git a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp index 333e5dd95..844a8b8ca 100644 --- a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp @@ -199,7 +199,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const st } } -std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc) +std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, const wchar_t *desc) { std::wstring temp(desc); diff --git a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h index 59d038278..904efe745 100644 --- a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h +++ b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h @@ -92,7 +92,7 @@ protected: private: void _SetDescription(UIScene *interactScene, const std::wstring &desc, const std::wstring &title, bool allowFade, bool isReminder); - std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc); + std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, const wchar_t *desc); std::wstring _SetImage(std::wstring &desc); std::wstring ParseDescription(int iPad, std::wstring &text); void UpdateInteractScenePosition(bool visible); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp index ba5673bbf..f2aa4b6d6 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp @@ -666,7 +666,7 @@ void UIScene_CraftingMenu::setIngredientDescriptionRedBox(int index, bool show) m_slotListIngredients[index].showSlotRedBox(0,show); } -void UIScene_CraftingMenu::setIngredientDescriptionText(int index, LPCWSTR text) +void UIScene_CraftingMenu::setIngredientDescriptionText(int index, const wchar_t *text) { m_labelIngredientsDesc[index].setLabel(text); } @@ -690,17 +690,17 @@ void UIScene_CraftingMenu::showTabHighlight(int iIndex, bool show) } } -void UIScene_CraftingMenu::setGroupText(LPCWSTR text) +void UIScene_CraftingMenu::setGroupText(const wchar_t *text) { m_labelGroupName.setLabel(text); } -void UIScene_CraftingMenu::setDescriptionText(LPCWSTR text) +void UIScene_CraftingMenu::setDescriptionText(const wchar_t *text) { m_labelDescription.setLabel(text); } -void UIScene_CraftingMenu::setItemText(LPCWSTR text) +void UIScene_CraftingMenu::setItemText(const wchar_t *text) { m_labelItemName.setLabel(text); } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h index 04318c582..87df8d1ce 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h @@ -190,12 +190,12 @@ protected: virtual void setIngredientSlotRedBox(int index, bool show); virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr item); virtual void setIngredientDescriptionRedBox(int index, bool show); - virtual void setIngredientDescriptionText(int index, LPCWSTR text); + virtual void setIngredientDescriptionText(int index, const wchar_t *text); virtual void setShowCraftHSlot(int iIndex, bool show); virtual void showTabHighlight(int iIndex, bool show); - virtual void setGroupText(LPCWSTR text); - virtual void setDescriptionText(LPCWSTR text); - virtual void setItemText(LPCWSTR text); + virtual void setGroupText(const wchar_t *text); + virtual void setDescriptionText(const wchar_t *text); + virtual void setItemText(const wchar_t *text); virtual void scrollDescriptionUp(); virtual void scrollDescriptionDown(); virtual void updateHighlightAndScrollPositions(); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.cpp index 30ec55b4d..79731d8c5 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIScene_DebugOptions.h" -LPCWSTR UIScene_DebugOptionsMenu::m_DebugCheckboxTextA[eDebugSetting_Max+1]= +const wchar_t *UIScene_DebugOptionsMenu::m_DebugCheckboxTextA[eDebugSetting_Max+1]= { L"Load Saves From Local Folder Mode", L"Write Saves To Local Folder Mode", diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.h b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.h index 6eaa4ed02..51571fa9a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOptions.h @@ -6,7 +6,7 @@ class UIScene_DebugOptionsMenu : public UIScene { private: - static LPCWSTR m_DebugCheckboxTextA[eDebugSetting_Max+1]; + static const wchar_t *m_DebugCheckboxTextA[eDebugSetting_Max+1]; int m_iTotalCheckboxElements; From 470fc532f81151702ad92da35a18966ada22912b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:13:04 +1100 Subject: [PATCH 097/192] Remove Win32 count types from leaderboard UI --- .../Platform/Common/UI/UIScene_LeaderboardsMenu.cpp | 6 +++--- .../Platform/Common/UI/UIScene_LeaderboardsMenu.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp index 8bc4ab11b..091b40f07 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -702,7 +702,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor // Copy the rank leaderboardEntry->m_rank = statsRow->m_rank; - DWORD displayRank = leaderboardEntry->m_rank; + unsigned int displayRank = leaderboardEntry->m_rank; if(displayRank > 9999999) displayRank = 9999999; swprintf(leaderboardEntry->m_wcRank, 12, L"%u", displayRank); @@ -744,7 +744,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor ZeroMemory(leaderboardEntry->m_wcColumns[i],12*sizeof(WCHAR)); if( !isDistanceLeaderboard ) { - DWORD displayValue = leaderboardEntry->m_columns[i]; + unsigned int displayValue = leaderboardEntry->m_columns[i]; if(displayValue > 99999) displayValue = 99999; swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%u",displayValue); #ifdef _DEBUG @@ -869,7 +869,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard(LeaderboardManager::eStatsRet int startIndex = m_newEntryIndex; int entryCount = m_newEntriesCount; - for(DWORD i = startIndex; i < (startIndex + entryCount); ++i) + for(unsigned int i = startIndex; i < (startIndex + entryCount); ++i) { bool isLast = i == ((startIndex + entryCount) - 1); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h index 4d92cef00..94fad3d49 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h @@ -35,7 +35,7 @@ private: struct LeaderboardEntry { PlayerUID m_xuid; unsigned int m_row; // Row identifier for passing to Iggy as a unique identifier - DWORD m_rank; + unsigned int m_rank; WCHAR m_wcRank[12]; WCHAR m_gamerTag[XUSER_NAME_SIZE+1]; //int m_locale; @@ -49,9 +49,9 @@ private: }; struct Leaderboard { - DWORD m_totalEntryCount; //Either total number of entries in leaderboard, or total number of results for a friends query + unsigned int m_totalEntryCount; //Either total number of entries in leaderboard, or total number of results for a friends query std::vector m_entries; - DWORD m_numColumns; + unsigned int m_numColumns; }; Leaderboard m_leaderboard; //All leaderboard data for the currently selected filter From e20cd0acd0f92656811cb716ae2cffc52f4f0370 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:21:33 +1100 Subject: [PATCH 098/192] Remove Win32 callback types from load or join transfers --- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 52 +++++++++---------- .../Common/UI/UIScene_LoadOrJoinMenu.h | 36 ++++++------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index c002cd9d8..fd8037c07 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1578,7 +1578,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1934,7 +1934,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1999,7 +1999,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2029,7 +2029,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt } else { - StorageManager.DeleteSaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC], UIScene_LoadOrJoinMenu::DeleteSaveDataReturned, (LPVOID)pClass->GetCallbackUniqueId()); + StorageManager.DeleteSaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC], UIScene_LoadOrJoinMenu::DeleteSaveDataReturned, reinterpret_cast(pClass->GetCallbackUniqueId())); pClass->m_controlSavesTimer.setVisible( true ); } } @@ -2284,7 +2284,7 @@ void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() { LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc; - loadingParams->lpParam = (LPVOID)this; + loadingParams->lpParam = this; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2303,7 +2303,7 @@ void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() -int UIScene_LoadOrJoinMenu::CreateDummySaveDataCallback(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::CreateDummySaveDataCallback(void *lpParam, bool bRes) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; if(bRes) @@ -2319,7 +2319,7 @@ int UIScene_LoadOrJoinMenu::CreateDummySaveDataCallback(LPVOID lpParam,bool bRes return 0; } -int UIScene_LoadOrJoinMenu::CrossSaveGetSavesInfoCallback(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, bool bRes) +int UIScene_LoadOrJoinMenu::CrossSaveGetSavesInfoCallback(void *lpParam, SAVE_DETAILS *pSaveDetails, bool bRes) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; if(bRes) @@ -2358,7 +2358,7 @@ int UIScene_LoadOrJoinMenu::CrossSaveFinishedCallback(void *pParam,int iPad,C4JS } -int UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned(void *lpParam, bool bRes) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; @@ -2377,7 +2377,7 @@ int UIScene_LoadOrJoinMenu::RemoteSaveNotFoundCallback(void *pParam,int iPad,C4J bool g_bForceVitaSaveWipe = false; -int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void *lpParameter) { Compression::UseDefaultThreadStorage(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; @@ -2769,7 +2769,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter } -void UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) +void UIScene_LoadOrJoinMenu::SaveTransferReturned(void *lpParam, SonyRemoteStorage::Status s, int error_code) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; @@ -2789,7 +2789,7 @@ ConsoleSaveFile* UIScene_LoadOrJoinMenu::SonyCrossSaveConvert() return NULL; } -void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(void *lpParam) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; pClass->m_saveTransferDownloadCancelled = true; @@ -2806,7 +2806,7 @@ void UIScene_LoadOrJoinMenu::LaunchSaveUpload() { LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc; - loadingParams->lpParam = (LPVOID)this; + loadingParams->lpParam = this; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2833,7 +2833,7 @@ int UIScene_LoadOrJoinMenu::CrossSaveUploadFinishedCallback(void *pParam,int iPa } -int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc(void *lpParameter) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; pClass->m_saveTransferUploadCancelled = false; @@ -2922,7 +2922,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) } -void UIScene_LoadOrJoinMenu::SaveUploadReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) +void UIScene_LoadOrJoinMenu::SaveUploadReturned(void *lpParam, SonyRemoteStorage::Status s, int error_code) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; @@ -2941,7 +2941,7 @@ void UIScene_LoadOrJoinMenu::SaveUploadReturned(LPVOID lpParam, SonyRemoteStorag } } -void UIScene_LoadOrJoinMenu::CancelSaveUploadCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelSaveUploadCallback(void *lpParam) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; pClass->m_saveTransferUploadCancelled = true; @@ -2984,7 +2984,7 @@ void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc; - loadingParams->lpParam = (LPVOID)stateContainer; + loadingParams->lpParam = stateContainer; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -3003,7 +3003,7 @@ void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() -int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc(void *lpParameter) { Compression::UseDefaultThreadStorage(); @@ -3270,7 +3270,7 @@ void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass } } -int UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails) +int UIScene_LoadOrJoinMenu::SaveTransferReturned(void *lpParam, C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails) { SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; app.DebugPrintf("Save Transfer - size is %d\n",pSaveTransferDetails->ulFileLen); @@ -3291,7 +3291,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVE return 0; } -int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned long ulBytesReceived) +int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(void *lpParam, unsigned long ulBytesReceived) { WCHAR wcTemp[256]; @@ -3318,7 +3318,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned l return 0; } -void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(void *lpParam) { SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; @@ -3331,7 +3331,7 @@ void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) //pClass->m_bSaveTransferInProgress=false; } -int UIScene_LoadOrJoinMenu::CancelSaveTransferCompleteCallback(LPVOID lpParam) +int UIScene_LoadOrJoinMenu::CancelSaveTransferCompleteCallback(void *lpParam) { SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; // change the state to idle to get the download thread to terminate @@ -3379,7 +3379,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStor { LoadingInputParams *loadingParams = new LoadingInputParams(); - void *uniqueId = (LPVOID)pClass->GetCallbackUniqueId(); + void *uniqueId = reinterpret_cast(pClass->GetCallbackUniqueId()); loadingParams->func = &UIScene_LoadOrJoinMenu::CopySaveThreadProc; loadingParams->lpParam = uniqueId; loadingParams->waitForThreadToDelete = true; @@ -3405,7 +3405,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStor return 0; } -int UIScene_LoadOrJoinMenu::CopySaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::CopySaveThreadProc(void *lpParameter) { Minecraft *pMinecraft=Minecraft::GetInstance(); pMinecraft->progressRenderer->progressStart(IDS_PROGRESS_COPYING_SAVE); @@ -3446,7 +3446,7 @@ int UIScene_LoadOrJoinMenu::CopySaveThreadProc( LPVOID lpParameter ) return 0; } -int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C4JStorage::ESaveGameState stat) +int UIScene_LoadOrJoinMenu::CopySaveDataReturned(void *lpParam, bool success, C4JStorage::ESaveGameState stat) { ui.EnterCallbackIdCriticalSection(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); @@ -3495,7 +3495,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C return 0; } -bool UIScene_LoadOrJoinMenu::CopySaveDataProgress(LPVOID lpParam, int percent) +bool UIScene_LoadOrJoinMenu::CopySaveDataProgress(void *lpParam, int percent) { bool bContinue = false; ui.EnterCallbackIdCriticalSection(); @@ -3511,7 +3511,7 @@ bool UIScene_LoadOrJoinMenu::CopySaveDataProgress(LPVOID lpParam, int percent) return bContinue; } -void UIScene_LoadOrJoinMenu::CancelCopySaveCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelCopySaveCallback(void *lpParam) { ui.EnterCallbackIdCriticalSection(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h index c0511d5dc..4e4504739 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h @@ -205,14 +205,14 @@ private: #endif void LaunchSaveTransfer(); - static int DownloadXbox360SaveThreadProc( LPVOID lpParameter ); + static int DownloadXbox360SaveThreadProc(void *lpParameter); static void RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename ); static void RequestFileData( SaveTransferStateContainer *pClass, wchar_t *filename ); - static int SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails); - static int SaveTransferUpdateProgress(LPVOID lpParam,unsigned long ulBytesReceived); - static void CancelSaveTransferCallback(LPVOID lpParam); + static int SaveTransferReturned(void *lpParam, C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails); + static int SaveTransferUpdateProgress(void *lpParam, unsigned long ulBytesReceived); + static void CancelSaveTransferCallback(void *lpParam); static int NeedSyncMessageReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int CancelSaveTransferCompleteCallback(LPVOID lpParam); + static int CancelSaveTransferCompleteCallback(void *lpParam); #endif @@ -254,17 +254,17 @@ private: char m_downloadedUniqueFilename[64];//SCE_SAVE_DATA_DIRNAME_DATA_MAXSIZE]; bool m_saveTransferDownloadCancelled; void LaunchSaveTransfer(); - static int CreateDummySaveDataCallback(LPVOID lpParam,bool bRes); - static int CrossSaveGetSavesInfoCallback(LPVOID lpParam, SAVE_DETAILS *pSaveDetails,bool bRes); + static int CreateDummySaveDataCallback(void *lpParam, bool bRes); + static int CrossSaveGetSavesInfoCallback(void *lpParam, SAVE_DETAILS *pSaveDetails, bool bRes); static int LoadCrossSaveDataCallback(void *pParam,bool bIsCorrupt, bool bIsOwner); static int CrossSaveFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int CrossSaveDeleteOnErrorReturned(LPVOID lpParam,bool bRes); + static int CrossSaveDeleteOnErrorReturned(void *lpParam, bool bRes); static int RemoteSaveNotFoundCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ); - static void SaveTransferReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); + static int DownloadSonyCrossSaveThreadProc(void *lpParameter); + static void SaveTransferReturned(void *lpParam, SonyRemoteStorage::Status s, int error_code); static ConsoleSaveFile* SonyCrossSaveConvert(); - static void CancelSaveTransferCallback(LPVOID lpParam); + static void CancelSaveTransferCallback(void *lpParam); #endif #ifdef SONY_REMOTE_STORAGE_UPLOAD @@ -282,19 +282,19 @@ private: bool m_saveTransferUploadCancelled; void LaunchSaveUpload(); - static int UploadSonyCrossSaveThreadProc( LPVOID lpParameter ); - static void SaveUploadReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); - static void CancelSaveUploadCallback(LPVOID lpParam); + static int UploadSonyCrossSaveThreadProc(void *lpParameter); + static void SaveUploadReturned(void *lpParam, SonyRemoteStorage::Status s, int error_code); + static void CancelSaveUploadCallback(void *lpParam); static int SaveTransferDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int CrossSaveUploadFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); #endif #if defined _XBOX_ONE || defined __ORBIS__ static int CopySaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int CopySaveThreadProc( LPVOID lpParameter ); - static int CopySaveDataReturned( LPVOID lpParameter, bool success, C4JStorage::ESaveGameState state ); - static bool CopySaveDataProgress(LPVOID lpParam, int percent); - static void CancelCopySaveCallback(LPVOID lpParam); + static int CopySaveThreadProc(void *lpParameter); + static int CopySaveDataReturned(void *lpParameter, bool success, C4JStorage::ESaveGameState state); + static bool CopySaveDataProgress(void *lpParam, int percent); + static void CancelCopySaveCallback(void *lpParam); static int CopySaveErrorDialogFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); #endif }; From 86c900239b8ea0893e5889ec58ce77ec875d637a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:26:35 +1100 Subject: [PATCH 099/192] Remove Win32 index types from skin select menu --- .../Common/UI/UIScene_SkinSelectMenu.cpp | 26 +++++++++---------- .../Common/UI/UIScene_SkinSelectMenu.h | 16 +++++++----- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp index 2bd8866bf..b5b18d24d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp @@ -442,7 +442,7 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr { ui.AnimateKeyPress(iPad, key, repeat, pressed, released); ui.PlayUISFX(eSFX_Scroll); - DWORD startingIndex = m_packIndex; + int startingIndex = m_packIndex; m_packIndex = getPreviousPackIndex(m_packIndex); if(startingIndex != m_packIndex) { @@ -477,7 +477,7 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr { ui.AnimateKeyPress(iPad, key, repeat, pressed, released); ui.PlayUISFX(eSFX_Scroll); - DWORD startingIndex = m_packIndex; + int startingIndex = m_packIndex; m_packIndex = getNextPackIndex(m_packIndex); if(startingIndex != m_packIndex) { @@ -1113,7 +1113,7 @@ TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex) return texture; } -int UIScene_SkinSelectMenu::getNextSkinIndex(DWORD sourceIndex) +int UIScene_SkinSelectMenu::getNextSkinIndex(int sourceIndex) { int nextSkin = sourceIndex; @@ -1147,7 +1147,7 @@ int UIScene_SkinSelectMenu::getNextSkinIndex(DWORD sourceIndex) return nextSkin; } -int UIScene_SkinSelectMenu::getPreviousSkinIndex(DWORD sourceIndex) +int UIScene_SkinSelectMenu::getPreviousSkinIndex(int sourceIndex) { int previousSkin = sourceIndex; switch(m_packIndex) @@ -1200,7 +1200,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() if(m_currentPack != NULL) { bool found; - DWORD currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found); + int currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found); if(found) m_skinIndex = currentSkinIndex; } else @@ -1210,8 +1210,8 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() case SKIN_SELECT_PACK_DEFAULT: if( !GET_IS_DLC_SKIN_FROM_BITMASK(m_originalSkinId) ) { - DWORD ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(m_originalSkinId); - DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId); + std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(m_originalSkinId); + std::uint32_t defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId); if( ugcSkinIndex == 0 ) { m_skinIndex = (EDefaultSkins) defaultSkinIndex; @@ -1229,7 +1229,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) { - DWORD currentSkinIndex = Pack->getSkinIndexAt(m_currentSkinPath, found); + int currentSkinIndex = Pack->getSkinIndexAt(m_currentSkinPath, found); if(found) m_skinIndex = app.GetPlayerFavoriteSkinsPos(m_iPad); } } @@ -1304,7 +1304,7 @@ void UIScene_SkinSelectMenu::updatePackDisplay() } -int UIScene_SkinSelectMenu::getNextPackIndex(DWORD sourceIndex) +int UIScene_SkinSelectMenu::getNextPackIndex(int sourceIndex) { int nextPack = sourceIndex; ++nextPack; @@ -1316,12 +1316,12 @@ int UIScene_SkinSelectMenu::getNextPackIndex(DWORD sourceIndex) return nextPack; } -int UIScene_SkinSelectMenu::getPreviousPackIndex(DWORD sourceIndex) +int UIScene_SkinSelectMenu::getPreviousPackIndex(int sourceIndex) { int previousPack = sourceIndex; if (previousPack == SKIN_SELECT_PACK_DEFAULT) { - DWORD packCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin); + int packCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin); if (packCount > 0) { @@ -1523,7 +1523,7 @@ void UIScene_SkinSelectMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, i if( m_currentNavigation == eSkinNavigation_Pack ) { ui.PlayUISFX(eSFX_Scroll); - DWORD startingIndex = m_packIndex; + int startingIndex = m_packIndex; m_packIndex = getPreviousPackIndex(m_packIndex); if(startingIndex != m_packIndex) { @@ -1535,7 +1535,7 @@ void UIScene_SkinSelectMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, i if( m_currentNavigation == eSkinNavigation_Pack ) { ui.PlayUISFX(eSFX_Scroll); - DWORD startingIndex = m_packIndex; + int startingIndex = m_packIndex; m_packIndex = getNextPackIndex(m_packIndex); if(startingIndex != m_packIndex) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h index f4215fc50..3bd9b74b0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h @@ -1,4 +1,6 @@ #pragma once +#include + #include "../../Minecraft.World/Util/Definitions.h" #include "UIScene.h" #include "UIControl_PlayerSkinPreview.h" @@ -100,8 +102,8 @@ private: UI_END_MAP_ELEMENTS_AND_NAMES() DLCPack *m_currentPack; - DWORD m_packIndex, m_skinIndex; - DWORD m_originalSkinId; + int m_packIndex, m_skinIndex; + std::uint32_t m_originalSkinId; std::wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath; std::vector *m_vAdditionalSkinBoxes; @@ -109,7 +111,7 @@ private: ESkinSelectNavigation m_currentNavigation; bool m_bNoSkinsToShow; - DWORD m_currentPackCount; + int m_currentPackCount; bool m_bIgnoreInput; bool m_bSkinIndexChanged; std::wstring m_leftLabel, m_centreLabel, m_rightLabel; @@ -144,15 +146,15 @@ public: private: void handleSkinIndexChanged(); - int getNextSkinIndex(DWORD sourceIndex); - int getPreviousSkinIndex(DWORD sourceIndex); + int getNextSkinIndex(int sourceIndex); + int getPreviousSkinIndex(int sourceIndex); TEXTURE_NAME getTextureId(int skinIndex); void handlePackIndexChanged(); void updatePackDisplay(); - int getNextPackIndex(DWORD sourceIndex); - int getPreviousPackIndex(DWORD sourceIndex); + int getNextPackIndex(int sourceIndex); + int getPreviousPackIndex(int sourceIndex); void setCharacterSelected(bool selected); void setCharacterLocked(bool locked); From 4506a204f946fcac3c9009e0c8f094edc1f42c84 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:31:02 +1100 Subject: [PATCH 100/192] Remove Win32 preview state types from skin select menu --- .../Platform/Common/UI/UIScene_SkinSelectMenu.cpp | 14 +++++++------- .../Platform/Common/UI/UIScene_SkinSelectMenu.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp index b5b18d24d..71b684362 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp @@ -744,15 +744,15 @@ void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion *region) void UIScene_SkinSelectMenu::handleSkinIndexChanged() { - BOOL showPrevious = FALSE, showNext = FALSE; - DWORD previousIndex = 0, nextIndex = 0; + bool showPrevious = false, showNext = false; + int previousIndex = 0, nextIndex = 0; std::wstring skinName = L""; std::wstring skinOrigin = L""; bool bSkinIsFree=false; bool bLicensed=false; DLCSkinFile *skinFile=NULL; DLCPack *Pack=NULL; - BYTE sidePreviewControlsL,sidePreviewControlsR; + int sidePreviewControlsL, sidePreviewControlsR; m_bNoSkinsToShow=false; TEXTURE_NAME backupTexture = TN_MOB_CHAR; @@ -887,8 +887,8 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() m_characters[eCharacter_Current].SetTexture(m_selectedSkinPath, backupTexture); m_characters[eCharacter_Current].SetCapeTexture(m_selectedCapePath); - showNext = TRUE; - showPrevious = TRUE; + showNext = true; + showPrevious = true; nextIndex = getNextSkinIndex(m_skinIndex); previousIndex = getPreviousSkinIndex(m_skinIndex); @@ -935,7 +935,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() sidePreviewControlsL=sidePreviewControlsR=sidePreviewControls; } - for(BYTE i = 0; i < sidePreviewControlsR; ++i) + for(int i = 0; i < sidePreviewControlsR; ++i) { if(showNext) { @@ -1006,7 +1006,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() - for(BYTE i = 0; i < sidePreviewControlsL; ++i) + for(int i = 0; i < sidePreviewControlsL; ++i) { if(showPrevious) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h index 3bd9b74b0..04175da6a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h @@ -11,7 +11,7 @@ private: static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count]; // 4J Stu - How many to show on each side of the main control - static const BYTE sidePreviewControls = 4; + static const int sidePreviewControls = 4; #ifdef __PSVITA__ enum ETouchInput From 56f6bb8da639bbe799d4259f38c8dc0b86cf1c43 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:33:32 +1100 Subject: [PATCH 101/192] Remove Win32 wide char aliases from skin select menu --- .../Platform/Common/UI/UIScene_SkinSelectMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp index 71b684362..f1a9f929c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp @@ -13,7 +13,7 @@ //#define SKIN_SELECT_PACK_PLAYER_CUSTOM 1 #define SKIN_SELECT_MAX_DEFAULTS 2 -const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]= +const wchar_t *UIScene_SkinSelectMenu::wchDefaultNamesA[]= { L"USE LOCALISED VERSION", // Server selected L"Steve", @@ -1712,7 +1712,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: pScene->m_bIgnoreInput = false; } #elif defined _XBOX_ONE - StorageManager.InstallOffer(1,(WCHAR *)(pScene->m_currentPack->getPurchaseOfferId().c_str()), &RenableInput, pScene, NULL); + StorageManager.InstallOffer(1, const_cast(pScene->m_currentPack->getPurchaseOfferId().c_str()), &RenableInput, pScene, NULL); #endif } else // Is signed in, but not live. diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h index 04175da6a..247314d4f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h @@ -8,7 +8,7 @@ class UIScene_SkinSelectMenu : public UIScene { private: - static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count]; + static const wchar_t *wchDefaultNamesA[eDefaultSkins_Count]; // 4J Stu - How many to show on each side of the main control static const int sidePreviewControls = 4; From 35035cfe4dee06e9dc1bc9c3aa19afb3a0c20046 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:37:28 +1100 Subject: [PATCH 102/192] Remove Win32 wide char types from leaderboard UI --- .../Platform/Common/UI/UIScene_LeaderboardsMenu.cpp | 2 +- .../Platform/Common/UI/UIScene_LeaderboardsMenu.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp index 091b40f07..789e5f487 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -741,7 +741,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor for( unsigned int i=0 ; im_statsSize ; i++ ) { leaderboardEntry->m_columns[i] = statsRow->m_statsData[i]; - ZeroMemory(leaderboardEntry->m_wcColumns[i],12*sizeof(WCHAR)); + ZeroMemory(leaderboardEntry->m_wcColumns[i], 12 * sizeof(wchar_t)); if( !isDistanceLeaderboard ) { unsigned int displayValue = leaderboardEntry->m_columns[i]; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h index 94fad3d49..b9f44b6e8 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.h @@ -36,11 +36,11 @@ private: PlayerUID m_xuid; unsigned int m_row; // Row identifier for passing to Iggy as a unique identifier unsigned int m_rank; - WCHAR m_wcRank[12]; - WCHAR m_gamerTag[XUSER_NAME_SIZE+1]; + wchar_t m_wcRank[12]; + wchar_t m_gamerTag[XUSER_NAME_SIZE+1]; //int m_locale; unsigned int m_columns[7]; - WCHAR m_wcColumns[7][12]; + wchar_t m_wcColumns[7][12]; bool m_bPlayer; //Is the player bool m_bOnline; //Is online bool m_bFriend; //Is friend From 986dbd60ef93c6818b48c64c479ba464977c400f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:40:14 +1100 Subject: [PATCH 103/192] Remove Win32 callback types from pause menu helpers --- Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp index e86e43aff..bfb77504a 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp @@ -278,9 +278,9 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack(); - DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str()); + DLC_INFO *pDLCInfo = app.GetDLCInfoForProductName(const_cast(pDLCPack->getName().c_str())); - StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),NULL,NULL); + StorageManager.InstallOffer(1, const_cast(pDLCInfo->wsProductId.c_str()), NULL, NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -330,7 +330,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 } -int IUIScene_PauseMenu::SaveWorldThreadProc( LPVOID lpParameter ) +int IUIScene_PauseMenu::SaveWorldThreadProc(void *lpParameter) { bool bAutosave=(bool)lpParameter; if(bAutosave) From 015cdd382475e06390edb83f1b50023665d519fe Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:44:14 +1100 Subject: [PATCH 104/192] Remove Win32 string aliases from UI menus --- Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp index d1170900b..45a6aa072 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp @@ -212,7 +212,7 @@ void IUIScene_AnvilMenu::handleTick() } else { - LPCWSTR costString = app.GetString(IDS_REPAIR_COST); + const wchar_t *costString = app.GetString(IDS_REPAIR_COST); wchar_t temp[256]; swprintf(temp, 256, costString, m_repairMenu->cost); m_costString = temp; @@ -269,4 +269,4 @@ void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotI void IUIScene_AnvilMenu::setContainerData(AbstractContainerMenu *container, int id, int value) { -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp index 5d56e7515..ba5b08c20 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp @@ -52,7 +52,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL } else { - LPCWSTR costString = app.GetString(IDS_REPAIR_COST); + const wchar_t *costString = app.GetString(IDS_REPAIR_COST); wchar_t temp[256]; swprintf(temp, 256, costString, m_repairMenu->cost); m_costString = temp; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp index 6bc03ecf8..7ae0f4bff 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp @@ -329,8 +329,8 @@ void UIScene_ControlsMenu::PositionText(int iPad,int iTextID, unsigned char ucAc void UIScene_ControlsMenu::PositionTextDirect(int iPad,int iTextID, int iControlDetailsIndex, bool bShow) { - LPCWSTR text = app.GetString(iTextID); + const wchar_t *text = app.GetString(iTextID); m_labelsPad[iControlDetailsIndex].setLabel(text); m_controlLines[iControlDetailsIndex].setVisible(bShow); -} \ No newline at end of file +} From 7f29aa5d9949d4f9478a8503fe7309db8bb8e9e7 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:46:09 +1100 Subject: [PATCH 105/192] Remove Win32 local types from UI controller --- .../Platform/Common/UI/UIController.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index cec52e2eb..e52429731 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -633,9 +633,9 @@ void UIController::CleanUpSkinReload() if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio()) { #ifdef _DURANGO - DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK"); + const unsigned int result = StorageManager.UnmountInstalledDLC(L"TPACK"); #else - DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); + const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); #endif } } @@ -1568,9 +1568,9 @@ void UIController::NavigateToHomeMenu() // pDLCTexPack->m_pSoundBank->Destroy(); // } #ifdef _XBOX_ONE - DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK"); + const unsigned int result = StorageManager.UnmountInstalledDLC(L"TPACK"); #else - DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); + const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); #endif app.DebugPrintf("Unmount result is %d\n",result); @@ -2199,7 +2199,7 @@ void UIController::UpdatePlayerBasePositions() { Minecraft *pMinecraft = Minecraft::GetInstance(); - for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) + for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if(pMinecraft->localplayers[idx] != NULL) { @@ -2254,7 +2254,7 @@ void UIController::SetTrialTimerLimitSecs(unsigned int uiSeconds) void UIController::UpdateTrialTimer(unsigned int iPad) { - WCHAR wcTime[20]; + wchar_t wcTime[20]; std::uint32_t timeTicks = (std::uint32_t)app.getTrialTimer(); @@ -2316,7 +2316,7 @@ void UIController::ShowAutosaveCountdownTimer(bool show) void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) { #if !(defined(_XBOX_ONE) || defined(__ORBIS__)) - WCHAR wcAutosaveCountdown[100]; + wchar_t wcAutosaveCountdown[100]; swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); #endif From e2bbccf7eb7b33b36faf39de964f6d8df5a51322 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:52:28 +1100 Subject: [PATCH 106/192] Remove Win32 local state types from join and load menus --- .../Platform/Common/UI/UIScene_JoinMenu.cpp | 10 ++++++---- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 18 +++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp index 4e773911d..7b3d42c61 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp @@ -387,8 +387,8 @@ int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int // Shared function to join the game that is the same whether we used the sign-in UI or not void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { - DWORD dwSignedInUsers = 0; bool noPrivileges = false; + int signedInUsers = 0; int localUsersMask = 0; bool isSignedInLive = true; int iPadNotSignedInLive = -1; @@ -402,6 +402,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { if(ProfileManager.IsSignedIn(index)) { + ++signedInUsers; if (isSignedInLive && !ProfileManager.IsSignedInLive(index)) { // Record the first non signed in live pad @@ -418,6 +419,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { if(ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) { + ++signedInUsers; if( !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true; localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); @@ -457,8 +459,8 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; #if defined(__PS3__) || defined(__PSVITA__) if(isSignedInLive) @@ -485,7 +487,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) pClass->m_bIgnoreInput=false; int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; - if(dwSignedInUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; + if(signedInUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText); } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index 7482fabc2..3ac2a49ad 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -1205,8 +1205,8 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; bool bContentRestricted = false; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); #if defined(__PS3__) || defined(__PSVITA__) @@ -1477,7 +1477,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, int localUser LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = param; // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1514,7 +1514,7 @@ void UIScene_LoadMenu::LoadLevelGen(LevelGenerationOptions *levelGen) bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && m_MoreOptionsParams.bOnlineGame; // 4J Stu - If we only have one controller connected, then don't show the sign-in UI again - DWORD connectedControllers = 0; + int connectedControllers = 0; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) ++connectedControllers; @@ -1525,8 +1525,8 @@ void UIScene_LoadMenu::LoadLevelGen(LevelGenerationOptions *levelGen) // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1601,7 +1601,7 @@ void UIScene_LoadMenu::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = param; // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1685,8 +1685,8 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; From 4e102e139143943bb6ef2efb03c7ea9b0572f545 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:54:50 +1100 Subject: [PATCH 107/192] Remove Win32 local state types from create world menu --- .../Common/UI/UIScene_CreateWorldMenu.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 97ade4153..c11dbe262 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -932,7 +932,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() else { // 4J Stu - If we only have one controller connected, then don't show the sign-in UI again - DWORD connectedControllers = 0; + int connectedControllers = 0; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) ++connectedControllers; @@ -941,8 +941,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // Check if user-created content is allowed, as we cannot play multiplayer if it's not //bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && m_MoreOptionsParams.bOnlineGame; bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; bool bContentRestricted = false; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); @@ -1214,7 +1214,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, int lo LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = param; // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1300,8 +1300,8 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1347,7 +1347,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; // 4J Stu - If we only have one controller connected, then don't show the sign-in UI again - DWORD connectedControllers = 0; + int connectedControllers = 0; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) ++connectedControllers; @@ -1367,8 +1367,8 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; From cf1670579fcc3f138028cc398e2a12778fddddea Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:57:35 +1100 Subject: [PATCH 108/192] Remove Win32 exit code types from fullscreen progress --- .../Platform/Common/UI/UIScene_FullscreenProgress.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp index 29190223a..c76912076 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp @@ -99,7 +99,7 @@ void UIScene_FullscreenProgress::updateTooltips() void UIScene_FullscreenProgress::handleDestroy() { int code = thread->GetExitCode(); - DWORD exitcode = *((DWORD *)&code); + const unsigned int exitcode = static_cast(code); // If we're active, have a cancel func, and haven't already cancelled, call cancel func if( exitcode == STILL_ACTIVE && m_cancelFunc != NULL && !m_bWasCancelled) @@ -152,10 +152,10 @@ void UIScene_FullscreenProgress::tick() int code = thread->GetExitCode(); - DWORD exitcode = *((DWORD *)&code); + const unsigned int exitcode = static_cast(code); static int s_FPTickCount = 0; - if(s_FPTickCount % 60 == 0) app.DebugPrintf("[FP] tick #%d exitcode=%u STILL_ACTIVE=%u\n", s_FPTickCount, exitcode, (DWORD)STILL_ACTIVE); + if(s_FPTickCount % 60 == 0) app.DebugPrintf("[FP] tick #%d exitcode=%u STILL_ACTIVE=%u\n", s_FPTickCount, exitcode, static_cast(STILL_ACTIVE)); s_FPTickCount++; //app.DebugPrintf("CScene_FullscreenProgress Timer %d\n",pTimer->nId); @@ -375,4 +375,4 @@ bool UIScene_FullscreenProgress::isReadyToDelete() { return true; } -} \ No newline at end of file +} From 124b3becb65c69c06a0b128929de0c92538a7ec4 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:03:00 +1100 Subject: [PATCH 109/192] Remove Win32 wide char aliases from settings menus --- .../Platform/Common/UI/UIScene_SettingsAudioMenu.cpp | 12 ++++++------ .../Common/UI/UIScene_SettingsControlMenu.cpp | 12 ++++++------ .../Common/UI/UIScene_SettingsGraphicsMenu.cpp | 12 ++++++------ .../Common/UI/UIScene_SettingsOptionsMenu.cpp | 1 - .../Platform/Common/UI/UIScene_SettingsUIMenu.cpp | 12 ++++++------ 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsAudioMenu.cpp index 3e3efb9b5..e4d741a69 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -7,11 +7,11 @@ UIScene_SettingsAudioMenu::UIScene_SettingsAudioMenu(int iPad, void *initData, U // Setup all the Iggy references we need for this scene initialiseMovie(); - WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),app.GetGameSettings(m_iPad,eGameSetting_MusicVolume)); + wchar_t TempString[256]; + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),app.GetGameSettings(m_iPad,eGameSetting_MusicVolume)); m_sliderMusic.init(TempString,eControl_Music,0,100,app.GetGameSettings(m_iPad,eGameSetting_MusicVolume)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); m_sliderSound.init(TempString,eControl_Sound,0,100,app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); doHorizontalResizeCheck(); @@ -92,7 +92,7 @@ void UIScene_SettingsAudioMenu::handleInput(int iPad, int key, bool repeat, bool void UIScene_SettingsAudioMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; + wchar_t TempString[256]; int value = (int)currentValue; switch((int)sliderId) { @@ -100,7 +100,7 @@ void UIScene_SettingsAudioMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderMusic.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_MusicVolume,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),value); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),value); m_sliderMusic.setLabel(TempString); break; @@ -108,7 +108,7 @@ void UIScene_SettingsAudioMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderSound.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_SoundFXVolume,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),value); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),value); m_sliderSound.setLabel(TempString); break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsControlMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsControlMenu.cpp index d34586891..361d8f626 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsControlMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsControlMenu.cpp @@ -7,11 +7,11 @@ UIScene_SettingsControlMenu::UIScene_SettingsControlMenu(int iPad, void *initDat // Setup all the Iggy references we need for this scene initialiseMovie(); - WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame)); + wchar_t TempString[256]; + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame)); m_sliderSensitivityInGame.init(TempString,eControl_SensitivityInGame,0,200,app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu)); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu)); m_sliderSensitivityInMenu.init(TempString,eControl_SensitivityInMenu,0,200,app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu)); doHorizontalResizeCheck(); @@ -92,7 +92,7 @@ void UIScene_SettingsControlMenu::handleInput(int iPad, int key, bool repeat, bo void UIScene_SettingsControlMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; + wchar_t TempString[256]; int value = (int)currentValue; switch((int)sliderId) { @@ -100,7 +100,7 @@ void UIScene_SettingsControlMenu::handleSliderMove(F64 sliderId, F64 currentValu m_sliderSensitivityInGame.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),value); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),value); m_sliderSensitivityInGame.setLabel(TempString); break; @@ -108,7 +108,7 @@ void UIScene_SettingsControlMenu::handleSliderMove(F64 sliderId, F64 currentValu m_sliderSensitivityInMenu.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),value); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),value); m_sliderSensitivityInMenu.setLabel(TempString); break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsGraphicsMenu.cpp index 3e60fb506..7b1813edc 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -14,12 +14,12 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD m_checkboxCustomSkinAnim.init(app.GetString(IDS_CHECKBOX_CUSTOM_SKIN_ANIM),eControl_CustomSkinAnim,(app.GetGameSettings(m_iPad,eGameSetting_CustomSkinAnim)!=0)); - WCHAR TempString[256]; + wchar_t TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); m_sliderGamma.init(TempString,eControl_Gamma,0,100,app.GetGameSettings(m_iPad,eGameSetting_Gamma)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); m_sliderInterfaceOpacity.init(TempString,eControl_InterfaceOpacity,0,100,app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); doHorizontalResizeCheck(); @@ -129,7 +129,7 @@ void UIScene_SettingsGraphicsMenu::handleInput(int iPad, int key, bool repeat, b void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; + wchar_t TempString[256]; int value = (int)currentValue; switch((int)sliderId) { @@ -137,7 +137,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderGamma.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Gamma,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),value); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),value); m_sliderGamma.setLabel(TempString); break; @@ -145,7 +145,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderInterfaceOpacity.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_InterfaceOpacity,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),value); + swprintf(TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),value); m_sliderInterfaceOpacity.setLabel(TempString); break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp index 87870dfd7..96df5d076 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -221,7 +221,6 @@ void UIScene_SettingsOptionsMenu::handleInput(int iPad, int key, bool repeat, bo void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; int value = (int)currentValue; switch((int)sliderId) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsUIMenu.cpp index 100e746ad..837ef000a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsUIMenu.cpp @@ -16,12 +16,12 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer m_checkboxSplitscreen.init(app.GetString(IDS_CHECKBOX_VERTICAL_SPLIT_SCREEN),eControl_Splitscreen,(app.GetGameSettings(m_iPad,eGameSetting_SplitScreenVertical)!=0)); m_checkboxShowSplitscreenGamertags.init(app.GetString(IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS),eControl_ShowSplitscreenGamertags,(app.GetGameSettings(m_iPad,eGameSetting_DisplaySplitscreenGamertags)!=0)); - WCHAR TempString[256]; + wchar_t TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),app.GetGameSettings(m_iPad,eGameSetting_UISize)+1); + swprintf(TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),app.GetGameSettings(m_iPad,eGameSetting_UISize)+1); m_sliderUISize.init(TempString,eControl_UISize,1,3,app.GetGameSettings(m_iPad,eGameSetting_UISize)+1); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1); + swprintf(TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1); m_sliderUISizeSplitscreen.init(TempString,eControl_UISizeSplitscreen,1,3,app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1); doHorizontalResizeCheck(); @@ -145,14 +145,14 @@ void UIScene_SettingsUIMenu::handleInput(int iPad, int key, bool repeat, bool pr void UIScene_SettingsUIMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; + wchar_t TempString[256]; int value = (int)currentValue; switch((int)sliderId) { case eControl_UISize: m_sliderUISize.handleSliderMove(value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),value); + swprintf(TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),value); m_sliderUISize.setLabel(TempString); // is this different from the current value? @@ -167,7 +167,7 @@ void UIScene_SettingsUIMenu::handleSliderMove(F64 sliderId, F64 currentValue) case eControl_UISizeSplitscreen: m_sliderUISizeSplitscreen.handleSliderMove(value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),value); + swprintf(TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),value); m_sliderUISizeSplitscreen.setLabel(TempString); if(value != app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1) From 6b149fdc389f521d0094812050aff542ecc1347b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:05:47 +1100 Subject: [PATCH 110/192] Remove Win32 wide char aliases from world load menus --- .../Platform/Common/UI/UIScene_CreateWorldMenu.cpp | 8 ++++---- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index c11dbe262..167276435 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -60,8 +60,8 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay m_labelTexturePackName.init(L""); m_labelTexturePackDescription.init(L""); - WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); + wchar_t TempString[256]; + swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); m_MoreOptionsParams.bGenerateOptions = true; @@ -628,7 +628,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; + wchar_t TempString[256]; int value = (int)currentValue; switch((int)sliderId) { @@ -636,7 +636,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderDifficulty.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); + swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); m_sliderDifficulty.setLabel(TempString); break; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index 3ac2a49ad..dc2feeb50 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -75,8 +75,8 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_labelTexturePackDescription.init(L""); m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty); - WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); + wchar_t TempString[256]; + swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); m_MoreOptionsParams.bGenerateOptions = false; @@ -439,8 +439,8 @@ void UIScene_LoadMenu::tick() if(szSeed[0]!=0) { - WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %hs", app.GetString( IDS_SEED ),szSeed); + wchar_t TempString[256]; + swprintf(TempString, 256, L"%ls: %hs", app.GetString( IDS_SEED ),szSeed); m_labelSeed.setLabel(TempString); } else @@ -844,7 +844,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; + wchar_t TempString[256]; int value = (int)currentValue; switch((int)sliderId) { @@ -852,7 +852,7 @@ void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderDifficulty.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); + swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); m_sliderDifficulty.setLabel(TempString); break; } From c17c6136922d5f0d6b75d76b0646e27d5d792ec5 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:09:09 +1100 Subject: [PATCH 111/192] Remove Win32 wide char aliases from debug UI scenes --- .../Platform/Common/UI/UIScene_DebugOverlay.cpp | 14 +++++++------- .../Platform/Common/UI/UIScene_DebugSetCamera.cpp | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp index e9fabdfac..af475e573 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp @@ -22,12 +22,12 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa initialiseMovie(); Minecraft *pMinecraft = Minecraft::GetInstance(); - WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", (int)pMinecraft->gameRenderer->GetFovVal()); + wchar_t TempString[256]; + swprintf(TempString, 256, L"Set fov (%d)", (int)pMinecraft->gameRenderer->GetFovVal()); m_sliderFov.init(TempString,eControl_FOV,0,100,(int)pMinecraft->gameRenderer->GetFovVal()); float currentTime = pMinecraft->level->getLevelData()->getTime() % 24000; - swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); + swprintf(TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); m_sliderTime.init(TempString,eControl_Time,0,240,currentTime/100); m_buttonRain.init(L"Toggle Rain",eControl_Rain); @@ -244,9 +244,9 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) MinecraftServer::SetTime(currentValue * 100); pMinecraft->level->getLevelData()->setTime(currentValue * 100); - WCHAR TempString[256]; + wchar_t TempString[256]; float currentTime = currentValue * 100; - swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); + swprintf(TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); m_sliderTime.setLabel(TempString); } break; @@ -255,8 +255,8 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->gameRenderer->SetFovVal((float)currentValue); - WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", (int)currentValue); + wchar_t TempString[256]; + swprintf(TempString, 256, L"Set fov (%d)", (int)currentValue); m_sliderFov.setLabel(TempString); } break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp index 21d196fd3..780205bad 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp @@ -29,21 +29,21 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer currentPosition->m_elev = pMinecraft->localplayers[playerNo]->xRot; } - WCHAR TempString[256]; + wchar_t TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camX); + swprintf(TempString, 256, L"%f", currentPosition->m_camX); m_textInputX.init(TempString, eControl_CamX); - swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camY); + swprintf(TempString, 256, L"%f", currentPosition->m_camY); m_textInputY.init(TempString, eControl_CamY); - swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_camZ); + swprintf(TempString, 256, L"%f", currentPosition->m_camZ); m_textInputZ.init(TempString, eControl_CamZ); - swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_yRot); + swprintf(TempString, 256, L"%f", currentPosition->m_yRot); m_textInputYRot.init(TempString, eControl_YRot); - swprintf( (WCHAR *)TempString, 256, L"%f", currentPosition->m_elev); + swprintf(TempString, 256, L"%f", currentPosition->m_elev); m_textInputElevation.init(TempString, eControl_Elevation); m_checkboxLockPlayer.init(L"Lock Player", eControl_LockPlayer, app.GetFreezePlayers()); From dc342c092dc07a4698b2438e54fd61581d2475dd Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:12:24 +1100 Subject: [PATCH 112/192] Remove Win32 wide char aliases from DLC UI flows --- Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp | 4 ++-- .../Platform/Common/UI/UIScene_DLCOffersMenu.cpp | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp index 14e4a79c1..18eeccd99 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp @@ -58,7 +58,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() char *pchName=app.GetDLCInfoTextures(i); pDLCInfo=app.GetDLCInfo(pchName); #elif defined _XBOX_ONE - pDLCInfo=app.GetDLCInfoForFullOfferID((WCHAR *)app.GetDLCInfoTexturesFullOffer(i).c_str()); + pDLCInfo=app.GetDLCInfoForFullOfferID(const_cast(app.GetDLCInfoTexturesFullOffer(i).c_str())); #else ULONGLONG ull=app.GetDLCInfoTexturesFullOffer(i); pDLCInfo=app.GetDLCInfoForFullOfferID(ull); @@ -362,7 +362,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora app.GetDLCFullOfferIDForPackID(pClass->m_MoreOptionsParams.dwTexturePack,ProductId); - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); + StorageManager.InstallOffer(1, const_cast(ProductId.c_str()), NULL, NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp index d52f888e7..ebbbe505a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp @@ -738,8 +738,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) if(wcsncmp(L"Minecraft ",wstrTemp.c_str(),10)==0) { app.DebugPrintf("Removing Minecraft from name\n"); - WCHAR *pwchNewName=(WCHAR *)wstrTemp.c_str(); - wstrTemp=&pwchNewName[10]; + wstrTemp = wstrTemp.substr(10); } #ifdef _XBOX_ONE @@ -822,7 +821,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) if (dlc != NULL) { - WCHAR *cString = dlc->wchBanner; + wchar_t *cString = dlc->wchBanner; // is the file in the local DLC images? From bd5b092357790e8b396b945254ca67c273ec916c Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:17:21 +1100 Subject: [PATCH 113/192] Remove Win32 local state from common UI helpers --- .../Platform/Common/UI/UIComponent_TutorialPopup.cpp | 8 ++++---- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 8 ++++---- Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp index 844a8b8ca..e3a139cae 100644 --- a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp @@ -334,7 +334,7 @@ std::wstring UIComponent_TutorialPopup::_SetImage(std::wstring &desc) { // 4J Stu - Unused #if 0 - BOOL imageShowAtStart = m_image.IsShown(); + bool imageShowAtStart = m_image.IsShown(); std::wstring openTag(L"{*IMAGE*}"); std::wstring closeTag(L"{*/IMAGE*}"); @@ -348,7 +348,7 @@ std::wstring UIComponent_TutorialPopup::_SetImage(std::wstring &desc) { std::wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); m_image.SetImagePath( id.c_str() ); - m_image.SetShow( TRUE ); + m_image.SetShow( true ); desc.replace(imageTagStartPos, imageEndPos - imageTagStartPos + closeTag.length(), L""); } @@ -356,10 +356,10 @@ std::wstring UIComponent_TutorialPopup::_SetImage(std::wstring &desc) else { // hide the icon slot - m_image.SetShow( FALSE ); + m_image.SetShow( false ); } - BOOL imageShowAtEnd = m_image.IsShown(); + bool imageShowAtEnd = m_image.IsShown(); if(imageShowAtStart != imageShowAtEnd) { float fHeight, fWidth, fIconHeight, fDescHeight, fDescWidth; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index fd8037c07..29f32e602 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1035,7 +1035,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr #elif defined(_DURANGO) if(getControlFocus() == eControl_GamesList && m_buttonListGames.getItemCount() > 0) { - DWORD nIndex = m_buttonListGames.getCurrentSelection(); + const int nIndex = m_buttonListGames.getCurrentSelection(); FriendSessionInfo *pSelectedSession = m_currentSessions->at( nIndex ); PlayerUID uid = pSelectedSession->searchResult.m_playerXuids[0]; @@ -1617,7 +1617,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() FriendSessionInfo *pSelectedSession = NULL; if(DoesGamesListHaveFocus() && m_buttonListGames.getItemCount() > 0) { - unsigned int nIndex = m_buttonListGames.getCurrentSelection(); + const int nIndex = m_buttonListGames.getCurrentSelection(); pSelectedSession = m_currentSessions->at( nIndex ); } @@ -1641,7 +1641,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() unsigned int xuiListSize = m_buttonListGames.getItemCount(); unsigned int filteredListSize = (unsigned int)m_currentSessions->size(); - BOOL gamesListHasFocus = DoesGamesListHaveFocus(); + const bool gamesListHasFocus = DoesGamesListHaveFocus(); if(filteredListSize > 0) { @@ -2204,7 +2204,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS std::wstring ProductId; app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,ProductId); - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); + StorageManager.InstallOffer(1, const_cast(ProductId.c_str()), NULL, NULL); } else { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp index eeac83238..bcd7764fb 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp @@ -2019,7 +2019,7 @@ void UIScene_MainMenu::LoadTrial(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; From 02d3bba5f04b2f63e3ea547f668859c60729db55 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:19:21 +1100 Subject: [PATCH 114/192] Use standard buffer types in load or join save transfer --- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 29f32e602..e5ec9b9fd 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -2438,10 +2438,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void *lpParameter) mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null StorageManager.SetSaveTitle(wSaveName); std::uint8_t *pbThumbnailData = NULL; - DWORD dwThumbnailDataSize=0; + unsigned int dwThumbnailDataSize = 0; std::uint8_t *pbDataSaveImage = NULL; - DWORD dwDataSizeSaveImage=0; + unsigned int dwDataSizeSaveImage = 0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that @@ -2473,7 +2473,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void *lpParameter) // we can't cancel here, we need the saves info so we can delete the file if(pClass->m_saveTransferDownloadCancelled) { - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -2488,7 +2488,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void *lpParameter) case eSaveTransfer_GettingSavesInfo: if(pClass->m_saveTransferDownloadCancelled) { - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -2523,7 +2523,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void *lpParameter) case eSaveTransfer_GettingFileData: { - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; int dataProgress = app.getRemoteStorage()->getDataProgress(); pMinecraft->progressRenderer->progressStagePercentage(dataProgress); @@ -2598,10 +2598,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void *lpParameter) StorageManager.ResetSaveData(); { std::uint8_t *pbThumbnailData = NULL; - DWORD dwThumbnailDataSize=0; + unsigned int dwThumbnailDataSize = 0; std::uint8_t *pbDataSaveImage = NULL; - DWORD dwDataSizeSaveImage=0; + unsigned int dwDataSizeSaveImage = 0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that @@ -2686,7 +2686,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void *lpParameter) { if(pClass->m_saveTransferDownloadCancelled) { - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -2867,7 +2867,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc(void *lpParameter) break; case eSaveUpload_UploadingFileData: { - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; int dataProgress = app.getRemoteStorage()->getDataProgress(); pMinecraft->progressRenderer->progressStagePercentage(dataProgress); @@ -3176,7 +3176,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc(void *lpParameter) if(pStateContainer->m_bSaveTransferCancelled) { - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; pStateContainer->m_bSaveTransferCancelled=false; swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLED)); @@ -3228,7 +3228,7 @@ void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass, wchar_t *filename ) { Minecraft *pMinecraft=Minecraft::GetInstance(); - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; pMinecraft->progressRenderer->progressStagePercentage(0); @@ -3293,7 +3293,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferReturned(void *lpParam, C4JStorage::SAVE int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(void *lpParam, unsigned long ulBytesReceived) { - WCHAR wcTemp[256]; + wchar_t wcTemp[256]; SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; Minecraft *pMinecraft=Minecraft::GetInstance(); From fdf2a6fa786f231717c618fb4edcb8a7553385cd Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:28:02 +1100 Subject: [PATCH 115/192] Remove DWORD from UI thumbnail callback headers --- .../UI/UIScene_InGameSaveManagementMenu.cpp | 14 +++++++++++--- .../UI/UIScene_InGameSaveManagementMenu.h | 4 +++- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 14 +++++++++++--- .../Platform/Common/UI/UIScene_LoadMenu.h | 2 +- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 14 +++++++++++--- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.h | 4 +++- .../Common/UI/UIScene_QuadrantSignin.cpp | 17 +++++++++++++++-- .../Platform/Common/UI/UIScene_QuadrantSignin.h | 6 +++++- 8 files changed, 60 insertions(+), 15 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp index 6ce1bf18e..faaecf340 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -6,7 +6,15 @@ #include #endif -int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes) +namespace +{ +int LoadSaveDataThumbnailReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +{ + return UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); +} +} + +int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int dwThumbnailBytes) { UIScene_InGameSaveManagementMenu *pClass= (UIScene_InGameSaveManagementMenu *)lpParam; @@ -258,7 +266,7 @@ void UIScene_InGameSaveManagementMenu::tick() app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { @@ -323,7 +331,7 @@ void UIScene_InGameSaveManagementMenu::tick() app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { // something went wrong diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h index f1a317da9..d012e149a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "UIScene.h" class UIScene_InGameSaveManagementMenu : public UIScene @@ -96,7 +98,7 @@ protected: public: - static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); + static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int thumbnailBytes); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDataReturned(void *lpParam,bool bRes); protected: diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index dc2feeb50..d4df5a4e7 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -23,6 +23,14 @@ #define CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME 50 #endif +namespace +{ +int LoadSaveDataThumbnailReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +{ + return UIScene_LoadMenu::LoadSaveDataThumbnailReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); +} +} + int UIScene_LoadMenu::m_iDifficultyTitleSettingA[4]= { IDS_DIFFICULTY_TITLE_PEACEFUL, @@ -31,7 +39,7 @@ int UIScene_LoadMenu::m_iDifficultyTitleSettingA[4]= IDS_DIFFICULTY_TITLE_HARD }; -int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes) +int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int dwThumbnailBytes) { UIScene_LoadMenu *pClass= (UIScene_LoadMenu *)lpParam; @@ -225,9 +233,9 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye #ifdef _DURANGO // On Durango, we have an extra flag possible with LoadSaveDataThumbnail, which if true will force the loading of this thumbnail even if the save data isn't sync'd from // the cloud at this stage. This could mean that there could be a pretty large delay before the callback happens, in this case. - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturned,this,true); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturnedThunk,this,true); #else - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturned,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturnedThunk,this); #endif m_bShowTimer = true; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h index cb826e73c..7c33bb516 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h @@ -118,7 +118,6 @@ private: static int LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner); static int TrophyDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int LoadDataComplete(void *pParam); - static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); static int CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDataReturned(void *pParam,bool bSuccess); @@ -129,5 +128,6 @@ private: #endif public: + static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int thumbnailBytes); static int StartGame_SignInReturned(void *pParam, bool, int); }; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index e5ec9b9fd..d63be77b0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -51,7 +51,15 @@ C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDet #endif #endif -int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes) +namespace +{ +int LoadSaveDataThumbnailReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +{ + return UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); +} +} + +int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int dwThumbnailBytes) { UIScene_LoadOrJoinMenu *pClass= (UIScene_LoadOrJoinMenu *)lpParam; @@ -639,7 +647,7 @@ void UIScene_LoadOrJoinMenu::tick() app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { @@ -702,7 +710,7 @@ void UIScene_LoadOrJoinMenu::tick() app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { // something went wrong diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h index 4e4504739..7837308d2 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "UIScene.h" class LevelGenerationOptions; @@ -145,7 +147,7 @@ protected: public: - static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); + static int LoadSaveDataThumbnailReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int thumbnailBytes); static int LoadSaveCallback(void *lpParam,bool bRes); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp index 4f453c4f8..f5d59784b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp @@ -6,6 +6,11 @@ #include "../Network/Sony/SonyHttp.h" #endif +namespace +{ +int AvatarReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes); +} + UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { // Setup all the Iggy references we need for this scene @@ -226,7 +231,7 @@ void UIScene_QuadrantSignin::updateState() if(!m_iconRequested[i]) { app.DebugPrintf(app.USER_SR, "Requesting avatar for %d\n", i); - if(ProfileManager.GetProfileAvatar(i, &UIScene_QuadrantSignin::AvatarReturned, this)) + if(ProfileManager.GetProfileAvatar(i, &AvatarReturnedThunk, this)) { m_iconRequested[i] = true; m_lastRequestedAvatar = i; @@ -251,6 +256,14 @@ void UIScene_QuadrantSignin::updateState() } } +namespace +{ +int AvatarReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +{ + return UIScene_QuadrantSignin::AvatarReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); +} +} + void UIScene_QuadrantSignin::setControllerState(int iPad, EControllerStatus state) { if(m_controllerStatus[iPad] != state) @@ -269,7 +282,7 @@ void UIScene_QuadrantSignin::setControllerState(int iPad, EControllerStatus stat } } -int UIScene_QuadrantSignin::AvatarReturned(void *lpParam, std::uint8_t *pbThumbnail,DWORD dwThumbnailBytes) +int UIScene_QuadrantSignin::AvatarReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int dwThumbnailBytes) { UIScene_QuadrantSignin *pClass = (UIScene_QuadrantSignin *)lpParam; app.DebugPrintf(app.USER_SR,"AvatarReturned callback\n"); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h index b082f6fef..f85be56fc 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "UIScene.h" class UIScene_QuadrantSignin : public UIScene @@ -99,7 +101,6 @@ public: private: static int SignInReturned(void *pParam,bool bContinue, int iPad); - static int AvatarReturned(void *lpParam, std::uint8_t *pbThumbnail, DWORD dwThumbnailBytes); void updateState(); void setControllerState(int iPad, EControllerStatus state); @@ -107,4 +108,7 @@ private: #ifdef _DURANGO static void checkAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad); #endif + +public: + static int AvatarReturned(void *lpParam, std::uint8_t *pbThumbnail, unsigned int thumbnailBytes); }; From b82e0af700a5c4a5ef4c418a299c4f197571678b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:31:41 +1100 Subject: [PATCH 116/192] Use portable file reads for debug save transfer --- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index d63be77b0..5c3e7d75e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -9,6 +9,7 @@ #include "../../Minecraft.World/IO/Files/ConsoleSaveFile.h" #include "../../Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h" #include "../../Minecraft.World/IO/Files/ConsoleSaveFileSplit.h" +#include "../../Minecraft.World/Util/PortableFileIO.h" #include "../../Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h" #include "../../Minecraft.Client/MinecraftServer.h" #include "../../Minecraft.Client/Textures/Packs/TexturePackRepository.h" @@ -3251,17 +3252,24 @@ void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass File targetFile( std::wstring(L"FakeTMSPP\\").append(filename) ); if(targetFile.exists()) { - HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); + const std::size_t fileLength = static_cast(m_debugTransferDetails.ulFileLen); + m_debugTransferDetails.pbData = new std::uint8_t[fileLength]; - m_debugTransferDetails.pbData = new BYTE[m_debugTransferDetails.ulFileLen]; + const PortableFileIO::BinaryReadResult readResult = + PortableFileIO::ReadBinaryFile(targetFile.getPath(), m_debugTransferDetails.pbData, fileLength); - DWORD numberOfBytesRead = 0; - ReadFile( hSaveFile,m_debugTransferDetails.pbData,m_debugTransferDetails.ulFileLen,&numberOfBytesRead,NULL); - assert(numberOfBytesRead == m_debugTransferDetails.ulFileLen); + assert(readResult.status == PortableFileIO::BinaryReadStatus::ok); + assert(readResult.bytesRead == fileLength); - CloseHandle(hSaveFile); - - SaveTransferReturned(pClass,&m_debugTransferDetails); + if ((readResult.status == PortableFileIO::BinaryReadStatus::ok) && (readResult.bytesRead == fileLength)) + { + SaveTransferReturned(pClass,&m_debugTransferDetails); + } + else + { + delete[] m_debugTransferDetails.pbData; + m_debugTransferDetails.pbData = NULL; + } } } else From d285f41969fdf9402f4896102b5c3dee5dd43feb Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:41:46 +1100 Subject: [PATCH 117/192] Use standard types in keyboard request APIs --- 4J.Input/4J_Input.cpp | 6 +++--- 4J.Input/4J_Input.h | 2 +- Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp | 6 +++--- .../Platform/Common/UI/UIScene_CreateWorldMenu.cpp | 8 ++++---- .../Platform/Common/UI/UIScene_DebugCreateSchematic.cpp | 2 +- .../Platform/Common/UI/UIScene_DebugSetCamera.cpp | 2 +- .../Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp | 6 +++--- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 4 ++-- .../Platform/Common/UI/UIScene_SignEntryMenu.cpp | 6 +++--- Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h | 2 +- Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h | 2 +- Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h | 2 +- Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h | 2 +- Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h | 2 +- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/4J.Input/4J_Input.cpp b/4J.Input/4J_Input.cpp index b0946a810..c4135523c 100644 --- a/4J.Input/4J_Input.cpp +++ b/4J.Input/4J_Input.cpp @@ -523,9 +523,9 @@ void C_4JInput::SetMenuDisplayed(int iPad, bool bVal) { // --------------------------------------------------------------------------- // Keyboard (text entry) / string verification stubs // --------------------------------------------------------------------------- -EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR /*Title*/, LPCWSTR /*Text*/, DWORD /*dwPad*/, - UINT /*uiMaxChars*/, - int(*/*Func*/)(LPVOID, const bool), LPVOID /*lpParam*/, +EKeyboardResult C_4JInput::RequestKeyboard(const wchar_t * /*Title*/, const wchar_t * /*Text*/, int /*iPad*/, + unsigned int /*uiMaxChars*/, + int(*/*Func*/)(void *, const bool), void * /*lpParam*/, C_4JInput::EKeyboardMode /*eMode*/) { return EKeyboard_Cancelled; } diff --git a/4J.Input/4J_Input.h b/4J.Input/4J_Input.h index 9ac5c55d1..06d3f5819 100644 --- a/4J.Input/4J_Input.h +++ b/4J.Input/4J_Input.h @@ -109,7 +109,7 @@ public: // EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); // EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); - EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); + EKeyboardResult RequestKeyboard(const wchar_t *Title, const wchar_t *Text, int iPad, unsigned int uiMaxChars, int( *Func)(void *,const bool), void *lpParam, C_4JInput::EKeyboardMode eMode); void GetText(uint16_t *UTF16String); // Online check strings against offensive list - TCR 92 diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp index ba5b08c20..1df13f057 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp @@ -334,15 +334,15 @@ void UIScene_AnvilMenu::handleEditNamePressed() case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_TCHINESE: - InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); break; default: // 4J Stu - Use a different keyboard for non-asian languages so we don't have prediction on - InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended); + InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended); break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); #endif } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 167276435..59dd6e35c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -420,7 +420,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) case eControl_EditWorldName: { m_bIgnoreInput=true; - InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default); } break; case eControl_EditSeed: @@ -433,15 +433,15 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_TCHINESE: - InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),0,60,&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); break; default: // 4J Stu - Use a different keyboard for non-asian languages so we don't have prediction on - InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended); + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),0,60,&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended); break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),0,60,&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); #endif } break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp index 34256547e..67436505f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -113,7 +113,7 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) case eControl_EndY: case eControl_EndZ: m_keyboardCallbackControl = (eControls)((int)controlId); - InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(L"Enter something",L"",0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); break; }; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp index 780205bad..e8f065dfb 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp @@ -101,7 +101,7 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) case eControl_YRot: case eControl_Elevation: m_keyboardCallbackControl = (eControls)((int)controlId); - InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugSetCamera::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(L"Enter something",L"",0,25,&UIScene_DebugSetCamera::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); break; }; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index 31618ec64..a4b98d445 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -430,15 +430,15 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_TCHINESE: - InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); break; default: // 4J Stu - Use a different keyboard for non-asian languages so we don't have prediction on - InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended); + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended); break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); #endif } break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 5c3e7d75e..48e6d0a4b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -2116,7 +2116,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS pClass->m_bIgnoreInput=true; #ifdef _DURANGO // bring up a keyboard - InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), (pClass->m_saveDetails[pClass->m_iSaveListIndex-pClass->m_iDefaultButtonsC]).UTF16SaveName,(DWORD)0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), (pClass->m_saveDetails[pClass->m_iSaveListIndex-pClass->m_iDefaultButtonsC]).UTF16SaveName,0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); #else // bring up a keyboard wchar_t wSaveName[128]; @@ -2124,7 +2124,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS ZeroMemory(wSaveName, 128 * sizeof(wchar_t) ); mbstowcs(wSaveName, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, strlen(pClass->m_saveDetails->UTF8SaveName)+1); // plus null LPWSTR ptr = wSaveName; - InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE),wSaveName,(DWORD)0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE),wSaveName,0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); #endif } break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp index c8466f6b1..62604696a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp @@ -179,14 +179,14 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_TCHINESE: - InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),(DWORD)m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Email); + InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Email); break; default: - InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),(DWORD)m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet); + InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet); break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),(DWORD)m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet); + InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet); #endif } break; diff --git a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h index 884f281e1..656726464 100644 --- a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h @@ -128,7 +128,7 @@ public: // EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); // EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); - EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, int iMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); + EKeyboardResult RequestKeyboard(const wchar_t *Title, const wchar_t *Text, int iPad, int iMaxChars, int( *Func)(void *,const bool), void *lpParam, C_4JInput::EKeyboardMode eMode); void DestroyKeyboard(); bool IsCircleCrossSwapped(); diff --git a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h index 75960c5ab..cd884a58e 100644 --- a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h @@ -191,7 +191,7 @@ public: void SetMenuDisplayed(int iPad, bool bVal); - C_4JInput::EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); + C_4JInput::EKeyboardResult RequestKeyboard(const wchar_t *Title, const wchar_t *Text, int iPad, unsigned int uiMaxChars, int( *Func)(void *,const bool), void *lpParam, C_4JInput::EKeyboardMode eMode); void DestroyKeyboard(); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h index 6f51bba51..0fb3ff58d 100644 --- a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h @@ -132,7 +132,7 @@ public: // EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); // EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); - EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); + EKeyboardResult RequestKeyboard(const wchar_t *Title, const wchar_t *Text, int iPad, unsigned int uiMaxChars, int( *Func)(void *,const bool), void *lpParam, C_4JInput::EKeyboardMode eMode); void DestroyKeyboard(); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h index c0209eb66..381d684f2 100644 --- a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h @@ -147,7 +147,7 @@ public: // EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); // EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); - EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); + EKeyboardResult RequestKeyboard(const wchar_t *Title, const wchar_t *Text, int iPad, unsigned int uiMaxChars, int( *Func)(void *,const bool), void *lpParam, C_4JInput::EKeyboardMode eMode); void GetText(uint16_t *UTF16String); // Online check strings against offensive list - TCR 92 diff --git a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h index 9ac5c55d1..06d3f5819 100644 --- a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h @@ -109,7 +109,7 @@ public: // EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); // EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); - EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); + EKeyboardResult RequestKeyboard(const wchar_t *Title, const wchar_t *Text, int iPad, unsigned int uiMaxChars, int( *Func)(void *,const bool), void *lpParam, C_4JInput::EKeyboardMode eMode); void GetText(uint16_t *UTF16String); // Online check strings against offensive list - TCR 92 From f7e6b02835d2b27efc1bb102a7484c6c16504725 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:48:23 +1100 Subject: [PATCH 118/192] Use standard callback types in 4J input headers --- 4J.Input/4J_Input.cpp | 8 ++++---- 4J.Input/4J_Input.h | 6 +++--- Minecraft.Client/Platform/Common/Consoles_App.cpp | 2 +- Minecraft.Client/Platform/Common/Consoles_App.h | 2 +- Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h | 6 +++--- Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h | 6 +++--- Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h | 6 +++--- Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h | 6 +++--- Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h | 6 +++--- Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Input.h | 6 +++--- Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp | 4 ++-- Minecraft.World/Blocks/TileEntities/SignTileEntity.h | 4 ++-- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/4J.Input/4J_Input.cpp b/4J.Input/4J_Input.cpp index c4135523c..bc5babf89 100644 --- a/4J.Input/4J_Input.cpp +++ b/4J.Input/4J_Input.cpp @@ -512,7 +512,7 @@ void C_4JInput::SetJoypadSensitivity(int /*iPad*/, float /*fSensitivity*/) {} void C_4JInput::SetJoypadStickAxisMap(int /*iPad*/, unsigned int /*uiFrom*/, unsigned int /*uiTo*/) {} void C_4JInput::SetJoypadStickTriggerMap(int /*iPad*/, unsigned int /*uiFrom*/, unsigned int /*uiTo*/) {} void C_4JInput::SetKeyRepeatRate(float /*fRepeatDelaySecs*/, float /*fRepeatRateSecs*/) {} -void C_4JInput::SetDebugSequence(const char * /*chSequenceA*/, int(*/*Func*/)(LPVOID), LPVOID /*lpParam*/) {} +void C_4JInput::SetDebugSequence(const char * /*chSequenceA*/, int(*/*Func*/)(void *), void * /*lpParam*/) {} FLOAT C_4JInput::GetIdleSeconds(int /*iPad*/) { return 0.0f; } bool C_4JInput::IsPadConnected(int iPad) { return iPad == 0; } // slot 0 = keyboard+mouse @@ -530,7 +530,7 @@ EKeyboardResult C_4JInput::RequestKeyboard(const wchar_t * /*Title*/, const wcha return EKeyboard_Cancelled; } void C_4JInput::GetText(uint16_t *UTF16String) { if (UTF16String) UTF16String[0] = 0; } -bool C_4JInput::VerifyStrings(WCHAR ** /*pwStringA*/, int /*iStringC*/, - int(*/*Func*/)(LPVOID, STRING_VERIFY_RESPONSE *), LPVOID /*lpParam*/) { return true; } -void C_4JInput::CancelQueuedVerifyStrings(int(*/*Func*/)(LPVOID, STRING_VERIFY_RESPONSE *), LPVOID /*lpParam*/) {} +bool C_4JInput::VerifyStrings(wchar_t ** /*pwStringA*/, int /*iStringC*/, + int(*/*Func*/)(void *, STRING_VERIFY_RESPONSE *), void * /*lpParam*/) { return true; } +void C_4JInput::CancelQueuedVerifyStrings(int(*/*Func*/)(void *, STRING_VERIFY_RESPONSE *), void * /*lpParam*/) {} void C_4JInput::CancelAllVerifyInProgress(void) {} diff --git a/4J.Input/4J_Input.h b/4J.Input/4J_Input.h index 06d3f5819..51e79b098 100644 --- a/4J.Input/4J_Input.h +++ b/4J.Input/4J_Input.h @@ -93,7 +93,7 @@ public: void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); - void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam ); + void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam ); FLOAT GetIdleSeconds(int iPad); bool IsPadConnected(int iPad); @@ -126,8 +126,8 @@ public: // Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat. // // Intent Protect players from inappropriate language. - bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); - void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); + bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); + void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); void CancelAllVerifyInProgress(void); //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 44360cdb9..f63d3e400 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -4926,7 +4926,7 @@ void CMinecraftApp::SetDebugSequence(const char *pchSeq) { InputManager.SetDebugSequence(pchSeq,&CMinecraftApp::DebugInputCallback,this); } -int CMinecraftApp::DebugInputCallback(LPVOID pParam) +int CMinecraftApp::DebugInputCallback(void *pParam) { CMinecraftApp* pClass = (CMinecraftApp*)pParam; //printf("sequence matched\n"); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 3e28d4e7b..0a0933eb3 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -311,7 +311,7 @@ public: bool DebugSettingsOn() { return false;} #endif void SetDebugSequence(const char *pchSeq); - static int DebugInputCallback(LPVOID pParam); + static int DebugInputCallback(void *pParam); //bool UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); // Installed DLC diff --git a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h index 656726464..96038740c 100644 --- a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Input.h @@ -110,7 +110,7 @@ public: void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); - void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam ); + void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam ); FLOAT GetIdleSeconds(int iPad); unsigned int GetConnectedGamepadCount(); bool IsPadConnected(int iPad); @@ -147,8 +147,8 @@ public: // Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat. // // Intent Protect players from inappropriate language. - bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); - void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); + bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); + void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); void CancelAllVerifyInProgress(void); //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); diff --git a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h index cd884a58e..71c32ebbc 100644 --- a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Input.h @@ -173,7 +173,7 @@ public: void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); - void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam ); + void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam ); FLOAT GetIdleSeconds(int iPad); bool IsPadConnected(int iPad); void SetCircleCrossSwapped(bool swapped); @@ -214,8 +214,8 @@ public: // Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat. // // Intent Protect players from inappropriate language. - bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); - void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); + bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); + void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); void CancelAllVerifyInProgress(void); //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); diff --git a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h index 0fb3ff58d..09e97b0ea 100644 --- a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Input.h @@ -115,7 +115,7 @@ public: void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); - void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam ); + void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam ); FLOAT GetIdleSeconds(int iPad); bool IsPadConnected(int iPad); bool IsCircleCrossSwapped(); @@ -153,8 +153,8 @@ public: // Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat. // // Intent Protect players from inappropriate language. - bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); - void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); + bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); + void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); void CancelAllVerifyInProgress(void); //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); diff --git a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h index 381d684f2..aec2c5c07 100644 --- a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h @@ -124,7 +124,7 @@ public: void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); - void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam ); + void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam ); FLOAT GetIdleSeconds(int iPad); bool IsPadConnected(int iPad); void SetCircleCrossSwapped(bool swapped); @@ -164,8 +164,8 @@ public: // Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat. // // Intent Protect players from inappropriate language. - bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); - void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); + bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); + void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); void CancelAllVerifyInProgress(void); bool IsVitaTV(); diff --git a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h index 06d3f5819..51e79b098 100644 --- a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h @@ -93,7 +93,7 @@ public: void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); - void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam ); + void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam ); FLOAT GetIdleSeconds(int iPad); bool IsPadConnected(int iPad); @@ -126,8 +126,8 @@ public: // Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat. // // Intent Protect players from inappropriate language. - bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); - void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); + bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); + void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); void CancelAllVerifyInProgress(void); //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); diff --git a/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Input.h b/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Input.h index 120e9c7b5..e618d683d 100644 --- a/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Input.h @@ -84,7 +84,7 @@ public: void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); - void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam ); + void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam ); FLOAT GetIdleSeconds(int iPad); bool IsPadConnected(int iPad); @@ -116,8 +116,8 @@ public: // // Intent Protect players from inappropriate language. /* -bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); - void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); +bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); + void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam); void CancelAllVerifyInProgress(void); */ //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); diff --git a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp index 3cc0dc95c..6f410f059 100644 --- a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp @@ -156,7 +156,7 @@ void SignTileEntity::SetMessage(int iIndex,std::wstring &wsText) } // 4J-PB - added for string verification -int SignTileEntity::StringVerifyCallback(LPVOID lpParam,STRING_VERIFY_RESPONSE *pResults) +int SignTileEntity::StringVerifyCallback(void *lpParam,STRING_VERIFY_RESPONSE *pResults) { // results will be in m_pStringVerifyResponse SignTileEntity *pClass=(SignTileEntity *)lpParam; @@ -195,4 +195,4 @@ std::shared_ptr SignTileEntity::clone() result->m_bVerified = m_bVerified; result->m_bCensored = m_bCensored; return result; -} \ No newline at end of file +} diff --git a/Minecraft.World/Blocks/TileEntities/SignTileEntity.h b/Minecraft.World/Blocks/TileEntities/SignTileEntity.h index 6325180b6..b19d413d6 100644 --- a/Minecraft.World/Blocks/TileEntities/SignTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/SignTileEntity.h @@ -42,8 +42,8 @@ public: bool isEditable(); void setEditable(bool isEditable); virtual void setChanged(); - static int StringVerifyCallback(LPVOID lpParam,STRING_VERIFY_RESPONSE *pResults); + static int StringVerifyCallback(void *lpParam,STRING_VERIFY_RESPONSE *pResults); // 4J Added virtual std::shared_ptr clone(); -}; \ No newline at end of file +}; From d0a741544cfcb4ffc675b679022e4b26052f2671 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:53:18 +1100 Subject: [PATCH 119/192] Use standard action helper types in common app --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 12 ++++++------ Minecraft.Client/Platform/Common/Consoles_App.h | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index f63d3e400..0c7d37fbd 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -101,7 +101,7 @@ CMinecraftApp::CMinecraftApp() { m_eTMSAction[i]=eTMSAction_Idle; m_eXuiAction[i]=eAppAction_Idle; - m_eXuiActionParam[i] = NULL; + m_eXuiActionParam[i] = nullptr; //m_dwAdditionalModelParts[i] = 0; DebugPrintf("Player at index %d has guest number %d\n", i,m_currentSigninInfo[i].dwGuestNumber ); @@ -250,14 +250,14 @@ void CMinecraftApp::DebugPrintf(int user, const char *szFormat, ...) va_end(ap); } -LPCWSTR CMinecraftApp::GetString(int iID) +const wchar_t *CMinecraftApp::GetString(int iID) { //return L"DeÄŸiÅŸiklikler ve Yenilikler"; //return L"ÕÕÕÕÖÖÖÖ"; return app.m_stringTable->getString(iID); } -void CMinecraftApp::SetAction(int iPad, eXuiAction action, LPVOID param) +void CMinecraftApp::SetAction(int iPad, eXuiAction action, void *param) { if(m_eXuiAction[iPad] == eAppAction_ExitWorldCapturedThumbnail && action != eAppAction_Idle) { @@ -733,7 +733,7 @@ int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETT // flag the default options to be set pApp->DebugPrintf("Setting default options for player %d", iPad); - pApp->SetAction(iPad,eAppAction_SetDefaultOptions, (LPVOID)pSettings); + pApp->SetAction(iPad,eAppAction_SetDefaultOptions, pSettings); //pApp->SetDefaultOptions(pSettings,iPad); // if the profile data has been changed, then force a profile write @@ -2369,7 +2369,7 @@ int CMinecraftApp::DisplaySavingMessage(void *pParam, C4JStorage::ESavingMessage return 0; } -void CMinecraftApp::SetActionConfirmed(LPVOID param) +void CMinecraftApp::SetActionConfirmed(void *param) { XuiActionParam *actionInfo = (XuiActionParam *)param; app.SetAction(actionInfo->iPad, actionInfo->action); @@ -2380,7 +2380,7 @@ void CMinecraftApp::HandleXuiActions(void) { eXuiAction eAction; eTMSAction eTMS; - LPVOID param; + void *param; Minecraft *pMinecraft=Minecraft::GetInstance(); std::shared_ptr player; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 0a0933eb3..ac3fe3419 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -148,7 +148,7 @@ public: void SetSpecialTutorialCompletionFlag(int iPad, int index); - static LPCWSTR GetString(int iID); + static const wchar_t * GetString(int iID); eGameMode GetGameMode() { return m_eGameMode;} void SetGameMode(eGameMode eMode) { m_eGameMode=eMode;} @@ -156,12 +156,12 @@ public: eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;} void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;} eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];} - void SetAction(int iPad, eXuiAction action, LPVOID param = NULL); + void SetAction(int iPad, eXuiAction action, void *param = nullptr); void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; } eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];} eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];} - LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];} - void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = NULL) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;} + void * GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];} + void SetXuiServerAction(int iPad, eXuiServerAction action, void *param = nullptr) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;} eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;} void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;} @@ -176,7 +176,7 @@ public: // 4J Stu - Added so that we can call this when a confirmation box is selected - static void SetActionConfirmed(LPVOID param); + static void SetActionConfirmed(void *param); void HandleXuiActions(void); // 4J Stu - Functions used for Minecon and other promo work @@ -505,10 +505,10 @@ private: // we'll action these at the end of the game loop eXuiAction m_eXuiAction[XUSER_MAX_COUNT]; eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; - LPVOID m_eXuiActionParam[XUSER_MAX_COUNT]; + void *m_eXuiActionParam[XUSER_MAX_COUNT]; eXuiAction m_eGlobalXuiAction; eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; - LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT]; + void *m_eXuiServerActionParam[XUSER_MAX_COUNT]; eXuiServerAction m_eGlobalXuiServerAction; bool m_bLiveLinkRequired; From dd726f8ba13fec9ea1d487fb44142d847b74d51a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:58:50 +1100 Subject: [PATCH 120/192] Use standard callback params in common app --- .../Platform/Common/App_structs.h | 6 ++-- .../Platform/Common/Consoles_App.cpp | 28 ++++++++-------- .../Platform/Common/Consoles_App.h | 32 +++++++++---------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 53680568f..7ae6eed13 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -216,13 +216,13 @@ typedef struct _TMSPPRequest C4JStorage::eTMS_FILETYPEVAL eFileTypeVal; //char szFilename[MAX_TMSFILENAME_SIZE]; #ifdef _XBOX_ONE - int( *CallbackFunc)(LPVOID,int,int,LPVOID, WCHAR *); + int( *CallbackFunc)(void *,int,int,void *, WCHAR *); #else - int( *CallbackFunc)(LPVOID,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename); + int( *CallbackFunc)(void *,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename); #endif WCHAR wchFilename[MAX_TMSFILENAME_SIZE]; - LPVOID lpCallbackParam; + void *lpCallbackParam; } TMSPPRequest; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 0c7d37fbd..90f309b0c 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -723,9 +723,9 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con } #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) -int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad) +int CMinecraftApp::DefaultOptionsCallback(void *pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad) #else -int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad) +int CMinecraftApp::DefaultOptionsCallback(void *pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad) #endif { CMinecraftApp *pApp=(CMinecraftApp *)pParam; @@ -746,7 +746,7 @@ int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETT #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) #ifdef __ORBIS__ -int CMinecraftApp::OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired) +int CMinecraftApp::OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired) { CMinecraftApp *pApp=(CMinecraftApp *)pParam; pApp->m_eOptionsStatusA[iPad]=eStatus; @@ -760,7 +760,7 @@ int CMinecraftApp::GetOptionsBlocksRequired(int iPad) } #else -int CMinecraftApp::OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus) +int CMinecraftApp::OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus) { CMinecraftApp *pApp=(CMinecraftApp *)pParam; pApp->m_eOptionsStatusA[iPad]=eStatus; @@ -779,7 +779,7 @@ void CMinecraftApp::SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallb } #endif -int CMinecraftApp::OldProfileVersionCallback(LPVOID pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad) +int CMinecraftApp::OldProfileVersionCallback(void *pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad) { // check what needs to be done with this version to update to the current one @@ -4569,7 +4569,7 @@ void CMinecraftApp::ClearSignInChangeUsersMask() } } } -void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChanged,unsigned int uiSignInData) +void CMinecraftApp::SignInChangeCallback(void *pParam,bool bPrimaryPlayerChanged,unsigned int uiSignInData) { #ifdef __PS3__ // this is normally set in the main menu, but we can go online in the create world screens, and the primary player name isn't updated @@ -4744,7 +4744,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange } } -void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam) +void CMinecraftApp::NotificationsCallback(void *pParam,DWORD dwNotification, unsigned int uiParam) { CMinecraftApp* pClass = (CMinecraftApp*)pParam; @@ -4869,7 +4869,7 @@ int CMinecraftApp::NowDisplayFullVersionPurchase(void *pParam, bool bContinue, i return 0; } #endif -void CMinecraftApp::UpsellReturnedCallback(LPVOID pParam, eUpsellType type, eUpsellResponse result, int iUserData) +void CMinecraftApp::UpsellReturnedCallback(void *pParam, eUpsellType type, eUpsellResponse result, int iUserData) { ESen_UpsellID senType; ESen_UpsellOutcome senResponse; @@ -4963,7 +4963,7 @@ int CMinecraftApp::GetLocalPlayerCount(void) return iPlayerC; } -int CMinecraftApp::MarketplaceCountsCallback(LPVOID pParam,C4JStorage::DLC_TMS_DETAILS *pTMSDetails, int iPad) +int CMinecraftApp::MarketplaceCountsCallback(void *pParam,C4JStorage::DLC_TMS_DETAILS *pTMSDetails, int iPad) { app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n",pTMSDetails->dwNewOffers,pTMSDetails->dwTotalOffers); @@ -5008,7 +5008,7 @@ bool CMinecraftApp::StartInstallDLCProcess(int iPad) } // Installed DLC callback -int CMinecraftApp::DLCInstalledCallback(LPVOID pParam,int iInstalledC,int iPad) +int CMinecraftApp::DLCInstalledCallback(void *pParam,int iInstalledC,int iPad) { app.DebugPrintf("--- CMinecraftApp::DLCInstalledCallback: totalDLC=%i, pad=%i.\n", iInstalledC, iPad); app.m_iTotalDLC = iInstalledC; @@ -5077,7 +5077,7 @@ void CMinecraftApp::MountNextDLC(int iPad) #define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName) #endif -int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) +int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) { #if defined(_XBOX) || defined(_DURANGO) || defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined (__PSVITA__) //Chris TODO app.DebugPrintf("--- CMinecraftApp::DLCMountedCallback\n"); @@ -7030,7 +7030,7 @@ int CMinecraftApp::RemoteSaveThreadProc( void* lpParameter ) return 0; } -void CMinecraftApp::ExitGameFromRemoteSave( LPVOID lpParameter ) +void CMinecraftApp::ExitGameFromRemoteSave( void *lpParameter ) { int primaryPad = ProfileManager.GetPrimaryPad(); @@ -8274,11 +8274,11 @@ bool CMinecraftApp::RetrieveNextDLCContent() #if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) #ifdef _XBOX_ONE -int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,LPVOID lpvData, WCHAR* wchFilename) +int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,void *lpvData, WCHAR* wchFilename) { C4JStorage::PTMSPP_FILEDATA pFileData=(C4JStorage::PTMSPP_FILEDATA)lpvData; #else -int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename) +int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename) { #endif diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index ac3fe3419..5233e8b6a 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -126,7 +126,7 @@ public: bool IsAppPaused(); void SetAppPaused(bool val); - static int DisplaySavingMessage(LPVOID pParam,const C4JStorage::ESavingMessage eMsg, int iPad); + static int DisplaySavingMessage(void *pParam,const C4JStorage::ESavingMessage eMsg, int iPad); bool GetGameStarted() {return m_bGameStarted;} void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;} int GetLocalPlayerCount(void); @@ -208,23 +208,23 @@ public: //void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *preview); void InitGameSettings(); - static int OldProfileVersionCallback(LPVOID pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad); + static int OldProfileVersionCallback(void *pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad); #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) - static int DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad); + static int DefaultOptionsCallback(void *pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad); int SetDefaultOptions(C4JStorage::PROFILESETTINGS *pSettings,const int iPad,bool bWriteProfile=true); #ifdef __ORBIS__ - static int OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired); + static int OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired); int GetOptionsBlocksRequired(int iPad); #else - static int OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus); + static int OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus); #endif C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad); void SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallback eStatus); #else - static int DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad); + static int DefaultOptionsCallback(void *pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad); int SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,const int iPad); #endif virtual void SetRichPresenceContext(int iPad, int contextId) = 0; @@ -277,7 +277,7 @@ public: bool IsLocalMultiplayerAvailable(); // for sign in change monitoring - static void SignInChangeCallback(LPVOID pParam, bool bVal, unsigned int uiSignInData); + static void SignInChangeCallback(void *pParam, bool bVal, unsigned int uiSignInData); static void ClearSignInChangeUsersMask(); static int SignoutExitWorldThreadProc( void* lpParameter ); static int PrimaryPlayerSignedOutReturned(void *pParam, int iPad, const C4JStorage::EMessageResult); @@ -288,14 +288,14 @@ public: virtual void FatalLoadError(); // Notifications from the game listener to be passed to the qnet listener - static void NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam); + static void NotificationsCallback(void *pParam,DWORD dwNotification, unsigned int uiParam); // for the ethernet being disconnected - static void LiveLinkChangeCallback(LPVOID pParam,BOOL bConnected); + static void LiveLinkChangeCallback(void *pParam,BOOL bConnected); bool GetLiveLinkRequired() {return m_bLiveLinkRequired;} void SetLiveLinkRequired(bool required) {m_bLiveLinkRequired=required;} - static void UpsellReturnedCallback(LPVOID pParam, eUpsellType type, eUpsellResponse result, int iUserData); + static void UpsellReturnedCallback(void *pParam, eUpsellType type, eUpsellResponse result, int iUserData); #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ static int NowDisplayFullVersionPurchase(void *pParam, bool bContinue, int iPad); @@ -316,16 +316,16 @@ public: // Installed DLC bool StartInstallDLCProcess(int iPad); - static int DLCInstalledCallback(LPVOID pParam,int iOfferC,int iPad); + static int DLCInstalledCallback(void *pParam,int iOfferC,int iPad); void HandleDLCLicenseChange(); - static int DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); + static int DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); void MountNextDLC(int iPad); //static int DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData); void HandleDLC(DLCPack *pack); bool DLCInstallPending() {return m_bDLCInstallPending;} bool DLCInstallProcessCompleted() {return m_bDLCInstallProcessCompleted;} void ClearDLCInstalled() { m_bDLCInstallProcessCompleted=false;} - static int MarketplaceCountsCallback(LPVOID pParam,C4JStorage::DLC_TMS_DETAILS *,int iPad); + static int MarketplaceCountsCallback(void *pParam,C4JStorage::DLC_TMS_DETAILS *,int iPad); bool AlreadySeenCreditText(const std::wstring &wstemp); @@ -562,7 +562,7 @@ public: void UpdateTrialPausedTimer() { mfTrialPausedTime+= m_Time.fElapsedTime;} static int RemoteSaveThreadProc( void* lpParameter ); - static void ExitGameFromRemoteSave( LPVOID lpParameter ); + static void ExitGameFromRemoteSave( void *lpParameter ); static int ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); private: UINT m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP]; @@ -759,10 +759,10 @@ public: #else #ifdef _XBOX_ONE - static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,LPVOID, WCHAR *wchFilename); + static int TMSPPFileReturned(void *pParam,int iPad,int iUserData,void *, WCHAR *wchFilename); std::unordered_map *GetDLCInfo(); #else - static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename); + static int TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename); #endif DLC_INFO *GetDLCInfoTrialOffer(int iIndex); DLC_INFO *GetDLCInfoFullOffer(int iIndex); From 09896918cd0707294f12c06120c5fa34ea556023 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:03:47 +1100 Subject: [PATCH 121/192] Use standard wide string returns in game rules --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 2 +- Minecraft.Client/Platform/Common/Consoles_App.h | 2 +- .../Platform/Common/GameRules/GameRuleManager.cpp | 2 +- Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h | 2 +- .../Platform/Common/GameRules/LevelGenerationOptions.cpp | 2 +- .../Platform/Common/GameRules/LevelGenerationOptions.h | 2 +- Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp | 2 +- Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 90f309b0c..f5af72578 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -7605,7 +7605,7 @@ void CMinecraftApp::setLevelGenerationOptions(LevelGenerationOptions *levelGen) m_gameRules.setLevelGenerationOptions(levelGen); } -LPCWSTR CMinecraftApp::GetGameRulesString(const std::wstring &key) +const wchar_t *CMinecraftApp::GetGameRulesString(const std::wstring &key) { return m_gameRules.GetGameRulesString(key); } diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 5233e8b6a..395854a14 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -719,7 +719,7 @@ public: void setLevelGenerationOptions(LevelGenerationOptions *levelGen); LevelRuleset *getGameRuleDefinitions() { return m_gameRules.getGameRuleDefinitions(); } LevelGenerationOptions *getLevelGenerationOptions() { return m_gameRules.getLevelGenerationOptions(); } - LPCWSTR GetGameRulesString(const std::wstring &key); + const wchar_t *GetGameRulesString(const std::wstring &key); private: BYTE m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index aaa5b40d3..3e0e077aa 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -749,7 +749,7 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen m_currentLevelGenerationOptions->reset_start(); } -LPCWSTR GameRuleManager::GetGameRulesString(const std::wstring &key) +const wchar_t *GameRuleManager::GetGameRulesString(const std::wstring &key) { if(m_currentGameRuleDefinitions != NULL && !key.empty() ) { diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h index 8d55510af..7bc3f2dfd 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h @@ -72,7 +72,7 @@ public: void setLevelGenerationOptions(LevelGenerationOptions *levelGen); LevelRuleset *getGameRuleDefinitions() { return m_currentGameRuleDefinitions; } LevelGenerationOptions *getLevelGenerationOptions() { return m_currentLevelGenerationOptions; } - LPCWSTR GetGameRulesString(const std::wstring &key); + const wchar_t *GetGameRulesString(const std::wstring &key); // 4J-JEV: // Properly cleans-up and unloads the current set of gameRules. diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index 39de339cb..2e2e6c904 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -388,7 +388,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table) m_stringTable = table; } -LPCWSTR LevelGenerationOptions::getString(const std::wstring &key) +const wchar_t *LevelGenerationOptions::getString(const std::wstring &key) { if(m_stringTable == NULL) { diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h index 07597c139..829d03b4e 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h @@ -202,7 +202,7 @@ public: bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); void loadStringTable(StringTable *table); - LPCWSTR getString(const std::wstring &key); + const wchar_t *getString(const std::wstring &key); std::unordered_map *getUnfinishedSchematicFiles(); diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp index 7137e7ac7..0c0e2cb08 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp @@ -44,7 +44,7 @@ void LevelRuleset::loadStringTable(StringTable *table) m_stringTable = table; } -LPCWSTR LevelRuleset::getString(const std::wstring &key) +const wchar_t *LevelRuleset::getString(const std::wstring &key) { if(m_stringTable == NULL) { diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h index 93802450c..1b7810659 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h @@ -19,9 +19,9 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_LevelRules; } void loadStringTable(StringTable *table); - LPCWSTR getString(const std::wstring &key); + const wchar_t *getString(const std::wstring &key); AABB *getNamedArea(const std::wstring &areaName); StringTable *getStringTable() { return m_stringTable; } -}; \ No newline at end of file +}; From 377e1d21926e6a0d6191a59df8669aad0ecd7dda Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:06:36 +1100 Subject: [PATCH 122/192] Use standard wide string returns for item descriptions --- Minecraft.World/Items/Item.cpp | 4 ++-- Minecraft.World/Items/Item.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.World/Items/Item.cpp b/Minecraft.World/Items/Item.cpp index 3eb9a063b..f77644996 100644 --- a/Minecraft.World/Items/Item.cpp +++ b/Minecraft.World/Items/Item.cpp @@ -747,13 +747,13 @@ Item *Item::setDescriptionId(unsigned int id) return this; } -LPCWSTR Item::getDescription() +const wchar_t *Item::getDescription() { return app.GetString(getDescriptionId()); //return I18n::get(getDescriptionId()); } -LPCWSTR Item::getDescription(std::shared_ptr instance) +const wchar_t *Item::getDescription(std::shared_ptr instance) { return app.GetString(getDescriptionId(instance)); //return I18n::get(getDescriptionId(instance)); diff --git a/Minecraft.World/Items/Item.h b/Minecraft.World/Items/Item.h index eb041fed0..4a20b7602 100644 --- a/Minecraft.World/Items/Item.h +++ b/Minecraft.World/Items/Item.h @@ -672,8 +672,8 @@ public: virtual bool isHandEquipped(); virtual bool isMirroredArt(); Item *setDescriptionId(unsigned int id); - LPCWSTR getDescription(); - LPCWSTR getDescription(std::shared_ptr instance); + const wchar_t *getDescription(); + const wchar_t *getDescription(std::shared_ptr instance); virtual unsigned int getDescriptionId(int iData = -1); virtual unsigned int getDescriptionId(std::shared_ptr instance); Item *setUseDescriptionId(unsigned int id); From 8302870fec77bc0cc8df43f87734d5fbf2220b7e Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:08:59 +1100 Subject: [PATCH 123/192] Use standard wide string returns for tutorial messages --- Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp | 4 ++-- Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp index 1e4233f28..dfae8b21c 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp @@ -11,7 +11,7 @@ bool TutorialMessage::canDisplay() return !limitRepeats || (timesShown < numRepeats); } -LPCWSTR TutorialMessage::getMessageForDisplay() +const wchar_t *TutorialMessage::getMessageForDisplay() { if(!canDisplay()) return L""; @@ -20,4 +20,4 @@ LPCWSTR TutorialMessage::getMessageForDisplay() ++timesShown; return app.GetString( messageId ); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h index 6a0b4d460..2a5bb1def 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h @@ -16,5 +16,5 @@ public: TutorialMessage(int messageId, bool limitRepeats = false, unsigned char numRepeats = TUTORIAL_MESSAGE_DEFAULT_SHOW); bool canDisplay(); - LPCWSTR getMessageForDisplay(); -}; \ No newline at end of file + const wchar_t *getMessageForDisplay(); +}; From c9f96cae17299c929c47458f969da11fc78c6a2b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:14:47 +1100 Subject: [PATCH 124/192] Use standard callback params in network session updates --- .../Platform/Common/Network/GameNetworkManager.cpp | 8 ++++---- .../Platform/Common/Network/GameNetworkManager.h | 8 ++++---- .../Common/Network/PlatformNetworkManagerInterface.h | 2 +- .../Common/Network/PlatformNetworkManagerStub.cpp | 6 +++--- .../Platform/Common/Network/PlatformNetworkManagerStub.h | 6 +++--- .../Common/Network/Sony/PlatformNetworkManagerSony.cpp | 6 +++--- .../Common/Network/Sony/PlatformNetworkManagerSony.h | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp index a62be6143..7d59321f7 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp @@ -146,7 +146,7 @@ void CGameNetworkManager::DoWork() #endif } -bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter) +bool CGameNetworkManager::_RunNetworkGame(void *lpParameter) { bool success = true; @@ -184,7 +184,7 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter) return success; } -bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParameter) +bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, void *lpParameter) { #ifdef _DURANGO ProfileManager.SetDeferredSignoutEnabled(true); @@ -645,7 +645,7 @@ bool CGameNetworkManager::GetGameSessionInfo(int iPad, SessionID sessionId,Frien return s_pPlatformNetworkManager->GetGameSessionInfo( iPad, sessionId, foundSession ); } -void CGameNetworkManager::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ) +void CGameNetworkManager::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) { s_pPlatformNetworkManager->SetSessionsUpdatedCallback( SessionsUpdatedCallback, pSearchParam ); } @@ -681,7 +681,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSession return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex )); } -void CGameNetworkManager::CancelJoinGame(LPVOID lpParam) +void CGameNetworkManager::CancelJoinGame(void *lpParam) { #ifdef _XBOX_ONE s_pPlatformNetworkManager->CancelJoinGame(); diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h index 3d4cbc3d5..7110b50ad 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h @@ -54,8 +54,8 @@ public: void Initialise(); void Terminate(); void DoWork(); - bool _RunNetworkGame(LPVOID lpParameter); - bool StartNetworkGame(Minecraft *minecraft, LPVOID lpParameter); + bool _RunNetworkGame(void *lpParameter); + bool StartNetworkGame(Minecraft *minecraft, void *lpParameter); int CorrectErrorIDS(int IDS); // Player management @@ -98,7 +98,7 @@ public: bool SessionHasSpace(unsigned int spaceRequired = 1); std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); - void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); + void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ); void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); void ForceFriendsSessionRefresh(); @@ -106,7 +106,7 @@ public: bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo); eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask); - static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface + static void CancelJoinGame(void *lpParam); // Not part of the shared interface bool LeaveGame(bool bMigrateHost); static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad); void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h index 1ecf14e83..e5987b525 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h @@ -114,7 +114,7 @@ private: public: virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0; virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession) = 0; - virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ) = 0; + virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) = 0; virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) = 0; virtual void ForceFriendsSessionRefresh() = 0; diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp index f9d4ae1b6..aecfd7abf 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp @@ -132,8 +132,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = NULL; - m_SessionsUpdatedCallback = NULL; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -531,7 +531,7 @@ bool CPlatformNetworkManagerStub::GetGameSessionInfo(int iPad, SessionID session return false; } -void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ) +void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) { m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam; } diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h index 1fb9c7e54..19a5a938c 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h @@ -134,8 +134,8 @@ private: int m_lastSearchPad; bool m_bSearchResultsReady; bool m_bSearchPending; - LPVOID m_pSearchParam; - void (*m_SessionsUpdatedCallback)(LPVOID pParam); + void *m_pSearchParam; + void (*m_SessionsUpdatedCallback)(void *pParam); C4JThread* m_SearchingThread; @@ -157,7 +157,7 @@ private: public: virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); - virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); + virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); virtual void ForceFriendsSessionRefresh(); diff --git a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp index 8cec4cdcc..27ef1cf7e 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp @@ -416,8 +416,8 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = NULL; - m_SessionsUpdatedCallback = NULL; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; m_searchResultsCount = 0; m_pSearchResults = NULL; @@ -1254,7 +1254,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session #endif } -void CPlatformNetworkManagerSony::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ) +void CPlatformNetworkManagerSony::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) { m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam; } diff --git a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h index e39a86621..a244c3190 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h @@ -149,8 +149,8 @@ private: int m_lastSearchPad; bool m_bSearchPending; - LPVOID m_pSearchParam; - void (*m_SessionsUpdatedCallback)(LPVOID pParam); + void *m_pSearchParam; + void (*m_SessionsUpdatedCallback)(void *pParam); C4JThread* m_SearchingThread; @@ -168,7 +168,7 @@ private: public: virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); - virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); + virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); virtual void ForceFriendsSessionRefresh(); From 828ab5e2776c80555f42bfc54de926aa06efdac8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:21:50 +1100 Subject: [PATCH 125/192] Use standard types in invite join flow --- .../Platform/Common/Network/GameNetworkManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp index 7d59321f7..1c129576c 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp @@ -1672,8 +1672,8 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; bool bContentRestricted=false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; #if defined(__PS3__) || defined(__PSVITA__) ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL); #else @@ -1840,11 +1840,11 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I { // the FromInvite will make the lib decide how many panes to display based on connected pads/signed in players #ifdef _XBOX - ProfileManager.RequestSignInUI(true, false, false, false, false,&CGameNetworkManager::JoinFromInvite_SignInReturned, (LPVOID)pInviteInfo,userIndex); + ProfileManager.RequestSignInUI(true, false, false, false, false,&CGameNetworkManager::JoinFromInvite_SignInReturned, (void *)pInviteInfo,userIndex); #else SignInInfo info; info.Func = &CGameNetworkManager::JoinFromInvite_SignInReturned; - info.lpParam = (LPVOID)pInviteInfo; + info.lpParam = (void *)pInviteInfo; info.requireOnline = true; app.DebugPrintf("Using fullscreen layer\n"); ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info,eUILayer_Alert,eUIGroup_Fullscreen); From 015fce0b3a0c890dc62064768f38015240328cf3 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:24:47 +1100 Subject: [PATCH 126/192] Use standard wide strings in credit text --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 2 +- Minecraft.Client/Platform/Common/Consoles_App.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index f5af72578..d43e4e073 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -7240,7 +7240,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha } // function to add credits for the DLC packs -void CMinecraftApp::AddCreditText(LPCWSTR lpStr) +void CMinecraftApp::AddCreditText(const wchar_t *lpStr) { DebugPrintf("ADDING CREDIT - %ls\n",lpStr); // add a string from the DLC to a credits vector diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 395854a14..82183e303 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -364,7 +364,7 @@ public: void ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, const INVITE_INFO * pInviteInfo); // Add credits for DLC installed - void AddCreditText(LPCWSTR lpStr); + void AddCreditText(const wchar_t *lpStr); private: PlayerUID m_xuidNotch; From 268ae0388f95794f099ea3f1f94c0d0012ecdf2e Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:28:01 +1100 Subject: [PATCH 127/192] Use standard booleans in client connection checks --- Minecraft.Client/Network/ClientConnection.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 963fb8d35..081fdfe9f 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -1619,11 +1619,11 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) fprintf(stderr, "[LOGIN-CLI] handlePreLogin entered, isHost=%d, userIdx=%d\n", (int)g_NetworkManager.IsHost(), m_userIndex); #if 1 // 4J - Check that we can play with all the players already in the game who have Friends-Only UGC set - BOOL canPlay = TRUE; - BOOL canPlayLocal = TRUE; - BOOL isAtLeastOneFriend = g_NetworkManager.IsHost(); - BOOL isFriendsWithHost = TRUE; - BOOL cantPlayContentRestricted = FALSE; + bool canPlay = true; + bool canPlayLocal = true; + bool isAtLeastOneFriend = g_NetworkManager.IsHost(); + bool isFriendsWithHost = true; + bool cantPlayContentRestricted = false; if(!g_NetworkManager.IsHost()) { @@ -1783,10 +1783,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) } #else // TODO - handle this kind of things for non-360 platforms - canPlay = TRUE; - canPlayLocal = TRUE; - isAtLeastOneFriend = TRUE; - cantPlayContentRestricted= FALSE; + canPlay = true; + canPlayLocal = true; + isAtLeastOneFriend = true; + cantPlayContentRestricted= false; #if ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__) @@ -3243,7 +3243,7 @@ void ClientConnection::handleUpdateProgress(std::shared_ptr packet) { - LPCWSTR string = app.GetGameRulesString(packet->m_messageId); + const wchar_t *string = app.GetGameRulesString(packet->m_messageId); if(string != NULL) { std::wstring message(string); From 1bd031eacb660ca38c6ee3fc35b670fe7b8770b5 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:31:46 +1100 Subject: [PATCH 128/192] Use standard invite types in common app --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 2 +- Minecraft.Client/Platform/Common/Consoles_App.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index d43e4e073..84ba5e822 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5568,7 +5568,7 @@ void CMinecraftApp::ExitGame() // Invites -void CMinecraftApp::ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, const INVITE_INFO * pInviteInfo) +void CMinecraftApp::ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, const INVITE_INFO * pInviteInfo) { m_InviteData.dwUserIndex=dwUserIndex; m_InviteData.dwLocalUsersMask=dwLocalUsersMask; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 82183e303..8a1018b7a 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -30,8 +30,8 @@ typedef struct _JoinFromInviteData { - DWORD dwUserIndex; // dwUserIndex - DWORD dwLocalUsersMask; // dwUserMask + std::uint32_t dwUserIndex; // dwUserIndex + std::uint32_t dwLocalUsersMask; // dwUserMask const INVITE_INFO *pInviteInfo; // pInviteInfo } JoinFromInviteData; @@ -361,7 +361,7 @@ public: // invites //void ProcessInvite(JoinFromInviteData *pJoinData); - void ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, const INVITE_INFO * pInviteInfo); + void ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, const INVITE_INFO * pInviteInfo); // Add credits for DLC installed void AddCreditText(const wchar_t *lpStr); From 09d56dc8537a4a15f1b36af31cf12392701ac665 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:35:14 +1100 Subject: [PATCH 129/192] Use standard skin and cape IDs in common app --- Minecraft.Client/Platform/Common/App_structs.h | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.cpp | 14 +++++++------- Minecraft.Client/Platform/Common/Consoles_App.h | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 7ae6eed13..0775cf0c0 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -62,7 +62,7 @@ typedef struct // adding new flags for interim TU to 1.6.6 // A value that encodes the skin that the player has set as their default - DWORD dwSelectedSkin; + std::uint32_t dwSelectedSkin; // In-Menu sensitivity unsigned char ucMenuSensitivity; @@ -92,7 +92,7 @@ typedef struct unsigned int uiSpecialTutorialBitmask; // A value that encodes the cape that the player has set - DWORD dwSelectedCape; + std::uint32_t dwSelectedCape; unsigned int uiFavoriteSkinA[MAX_FAVORITE_SKINS]; unsigned char ucCurrentFavoriteSkinPos; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 84ba5e822..4809fdc12 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -1334,12 +1334,12 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) void CMinecraftApp::SetPlayerSkin(int iPad,const std::wstring &name) { - DWORD skinId = app.getSkinIdFromPath(name); + std::uint32_t skinId = app.getSkinIdFromPath(name); SetPlayerSkin(iPad,skinId); } -void CMinecraftApp::SetPlayerSkin(int iPad,DWORD dwSkinId) +void CMinecraftApp::SetPlayerSkin(int iPad,std::uint32_t dwSkinId) { DebugPrintf("Setting skin for %d to %08X\n", iPad, dwSkinId); @@ -1357,12 +1357,12 @@ std::wstring CMinecraftApp::GetPlayerSkinName(int iPad) return app.getSkinPathFromId(GameSettingsA[iPad]->dwSelectedSkin); } -DWORD CMinecraftApp::GetPlayerSkinId(int iPad) +std::uint32_t CMinecraftApp::GetPlayerSkinId(int iPad) { // 4J-PB -check the user has rights to use this skin - they may have had at some point but the entitlement has been removed. DLCPack *Pack=NULL; DLCSkinFile *skinFile=NULL; - DWORD dwSkin=GameSettingsA[iPad]->dwSelectedSkin; + std::uint32_t dwSkin=GameSettingsA[iPad]->dwSelectedSkin; wchar_t chars[256]; if( GET_IS_DLC_SKIN_FROM_BITMASK(dwSkin) ) @@ -1402,12 +1402,12 @@ DWORD CMinecraftApp::GetPlayerSkinId(int iPad) void CMinecraftApp::SetPlayerCape(int iPad,const std::wstring &name) { - DWORD capeId = Player::getCapeIdFromPath(name); + std::uint32_t capeId = Player::getCapeIdFromPath(name); SetPlayerCape(iPad,capeId); } -void CMinecraftApp::SetPlayerCape(int iPad,DWORD dwCapeId) +void CMinecraftApp::SetPlayerCape(int iPad,std::uint32_t dwCapeId) { DebugPrintf("Setting cape for %d to %08X\n", iPad, dwCapeId); @@ -1424,7 +1424,7 @@ std::wstring CMinecraftApp::GetPlayerCapeName(int iPad) return Player::getCapePathFromId(GameSettingsA[iPad]->dwSelectedCape); } -DWORD CMinecraftApp::GetPlayerCapeId(int iPad) +std::uint32_t CMinecraftApp::GetPlayerCapeId(int iPad) { return GameSettingsA[iPad]->dwSelectedCape; } diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 8a1018b7a..f6f3fd88b 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -234,9 +234,9 @@ public: unsigned char GetGameSettings(int iPad,eGameSetting eVal); unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad void SetPlayerSkin(int iPad,const std::wstring &name); - void SetPlayerSkin(int iPad,DWORD dwSkinId); + void SetPlayerSkin(int iPad,std::uint32_t dwSkinId); void SetPlayerCape(int iPad,const std::wstring &name); - void SetPlayerCape(int iPad,DWORD dwCapeId); + void SetPlayerCape(int iPad,std::uint32_t dwCapeId); void SetPlayerFavoriteSkin(int iPad, int iIndex,unsigned int uiSkinID); unsigned int GetPlayerFavoriteSkin(int iPad,int iIndex); unsigned char GetPlayerFavoriteSkinsPos(int iPad); @@ -261,9 +261,9 @@ public: public: std::wstring GetPlayerSkinName(int iPad); - DWORD GetPlayerSkinId(int iPad); + std::uint32_t GetPlayerSkinId(int iPad); std::wstring GetPlayerCapeName(int iPad); - DWORD GetPlayerCapeId(int iPad); + std::uint32_t GetPlayerCapeId(int iPad); DWORD GetAdditionalModelParts(int iPad); void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY); void ApplyGameSettingsChanged(int iPad); From 3f8374bc4572d270acee316766b57869913e6fe0 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:38:52 +1100 Subject: [PATCH 130/192] Use standard skin IDs in common app helpers --- .../Platform/Common/Consoles_App.cpp | 32 +++++++++---------- .../Platform/Common/Consoles_App.h | 26 +++++++-------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 4809fdc12..bf55778fa 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -1394,7 +1394,7 @@ std::uint32_t CMinecraftApp::GetPlayerSkinId(int iPad) return dwSkin; } - DWORD CMinecraftApp::GetAdditionalModelParts(int iPad) + std::uint32_t CMinecraftApp::GetAdditionalModelParts(int iPad) { return m_dwAdditionalModelParts[iPad]; } @@ -8598,7 +8598,7 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType) return false; } -void CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC) +void CMinecraftApp::SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX *SkinBoxA, unsigned int dwSkinBoxC) { EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); Model *pModel = renderer->getModel(); @@ -8622,15 +8622,15 @@ void CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, D } - m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); - m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxes) ); + m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); + m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxes) ); LeaveCriticalSection( &csAdditionalSkinBoxes ); LeaveCriticalSection( &csAdditionalModelParts ); } -std::vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, std::vector *pvSkinBoxA) +std::vector * CMinecraftApp::SetAdditionalSkinBoxes(std::uint32_t dwSkinID, std::vector *pvSkinBoxA) { EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); Model *pModel = renderer->getModel(); @@ -8650,8 +8650,8 @@ std::vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, } } - m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); - m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxA) ); + m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); + m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxA) ); LeaveCriticalSection( &csAdditionalSkinBoxes ); LeaveCriticalSection( &csAdditionalModelParts ); @@ -8659,7 +8659,7 @@ std::vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, } -std::vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) +std::vector *CMinecraftApp::GetAdditionalModelParts(std::uint32_t dwSkinID) { EnterCriticalSection( &csAdditionalModelParts ); std::vector *pvModelParts=NULL; @@ -8676,7 +8676,7 @@ std::vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) return pvModelParts; } -std::vector *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID) +std::vector *CMinecraftApp::GetAdditionalSkinBoxes(std::uint32_t dwSkinID) { EnterCriticalSection( &csAdditionalSkinBoxes ); std::vector *pvSkinBoxes=NULL; @@ -8693,7 +8693,7 @@ std::vector *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID) return pvSkinBoxes; } -unsigned int CMinecraftApp::GetAnimOverrideBitmask(DWORD dwSkinID) +unsigned int CMinecraftApp::GetAnimOverrideBitmask(std::uint32_t dwSkinID) { EnterCriticalSection( &csAnimOverrideBitmask ); unsigned int uiAnimOverrideBitmask=0L; @@ -8711,7 +8711,7 @@ unsigned int CMinecraftApp::GetAnimOverrideBitmask(DWORD dwSkinID) return uiAnimOverrideBitmask; } -void CMinecraftApp::SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOverrideBitmask) +void CMinecraftApp::SetAnimOverrideBitmask(std::uint32_t dwSkinID,unsigned int uiAnimOverrideBitmask) { // Make thread safe EnterCriticalSection( &csAnimOverrideBitmask ); @@ -8725,11 +8725,11 @@ void CMinecraftApp::SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOve return; // already in here } } - m_AnimOverrides.insert( std::pair(dwSkinID, uiAnimOverrideBitmask) ); + m_AnimOverrides.insert( std::pair(dwSkinID, uiAnimOverrideBitmask) ); LeaveCriticalSection( &csAnimOverrideBitmask ); } -DWORD CMinecraftApp::getSkinIdFromPath(const std::wstring &skin) +std::uint32_t CMinecraftApp::getSkinIdFromPath(const std::wstring &skin) { bool dlcSkin = false; unsigned int skinId = 0; @@ -8755,7 +8755,7 @@ DWORD CMinecraftApp::getSkinIdFromPath(const std::wstring &skin) return skinId; } -std::wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) +std::wstring CMinecraftApp::getSkinPathFromId(std::uint32_t skinId) { // 4J Stu - This function maps the encoded DWORD we store in the player profile // to a filename that is stored as a memory texture and shared between systems in game @@ -8768,8 +8768,8 @@ std::wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) } else { - DWORD ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); - DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); + std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); + std::uint32_t defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); if( ugcSkinIndex == 0 ) { swprintf(chars, 256, L"defskin%08X.png",defaultSkinIndex); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index f6f3fd88b..9d205621b 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -264,7 +264,7 @@ public: std::uint32_t GetPlayerSkinId(int iPad); std::wstring GetPlayerCapeName(int iPad); std::uint32_t GetPlayerCapeId(int iPad); - DWORD GetAdditionalModelParts(int iPad); + std::uint32_t GetAdditionalModelParts(int iPad); void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY); void ApplyGameSettingsChanged(int iPad); void ClearGameSettingsChangedFlag(int iPad); @@ -804,7 +804,7 @@ private: CRITICAL_SECTION csAnimOverrideBitmask; bool m_bCorruptSaveDeleted; - DWORD m_dwAdditionalModelParts[XUSER_MAX_COUNT]; + std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT]; BYTE *m_pBannedListFileBuffer; DWORD m_dwBannedListFileSize; @@ -818,15 +818,15 @@ public: // static int CallbackBannedListFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); // Storing additional model parts per skin texture - void SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC); - std::vector * SetAdditionalSkinBoxes(DWORD dwSkinID, std::vector *pvSkinBoxA); - std::vector *GetAdditionalModelParts(DWORD dwSkinID); - std::vector *GetAdditionalSkinBoxes(DWORD dwSkinID); - void SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOverrideBitmask); - unsigned int GetAnimOverrideBitmask(DWORD dwSkinID); + void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX *SkinBoxA, unsigned int dwSkinBoxC); + std::vector * SetAdditionalSkinBoxes(std::uint32_t dwSkinID, std::vector *pvSkinBoxA); + std::vector *GetAdditionalModelParts(std::uint32_t dwSkinID); + std::vector *GetAdditionalSkinBoxes(std::uint32_t dwSkinID); + void SetAnimOverrideBitmask(std::uint32_t dwSkinID,unsigned int uiAnimOverrideBitmask); + unsigned int GetAnimOverrideBitmask(std::uint32_t dwSkinID); - static DWORD getSkinIdFromPath(const std::wstring &skin); - static std::wstring getSkinPathFromId(DWORD skinId); + static std::uint32_t getSkinIdFromPath(const std::wstring &skin); + static std::wstring getSkinPathFromId(std::uint32_t skinId); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0; virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)=0; @@ -850,9 +850,9 @@ public: private: // vector of additional skin model parts, indexed by the skin texture id - std::unordered_map *> m_AdditionalModelParts; - std::unordered_map *> m_AdditionalSkinBoxes; - std::unordered_map m_AnimOverrides; + std::unordered_map *> m_AdditionalModelParts; + std::unordered_map *> m_AdditionalSkinBoxes; + std::unordered_map m_AnimOverrides; bool m_bResetNether; From c0e59f652e67b3b8f709ce5a0549ac2d57ae330f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:42:06 +1100 Subject: [PATCH 131/192] Use standard banned list buffers in app structs --- Minecraft.Client/Platform/Common/App_structs.h | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 0775cf0c0..1d73e7c1b 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -196,8 +196,8 @@ FEATURE_DATA; // banned list typedef struct { - BYTE *pBannedList; - DWORD dwBytes; + std::uint8_t *pBannedList; + unsigned int dwBytes; } BANNEDLIST; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 9d205621b..2bb35300c 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -806,8 +806,8 @@ private: std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT]; - BYTE *m_pBannedListFileBuffer; - DWORD m_dwBannedListFileSize; + std::uint8_t *m_pBannedListFileBuffer; + unsigned int m_dwBannedListFileSize; public: DWORD m_dwDLCFileSize; From bdb3341a994a7dc2820c8ff393c9b5ff152cb6a0 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:46:11 +1100 Subject: [PATCH 132/192] Use standard launch data buffers in common app --- Minecraft.Client/Platform/Common/Consoles_App.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 2bb35300c..80a89ef33 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -385,8 +385,8 @@ private: public: // launch data - BYTE* m_pLaunchData; - DWORD m_dwLaunchDataSize; + std::uint8_t *m_pLaunchData; + unsigned int m_dwLaunchDataSize; public: // BAN LIST From c8150b1338edc7c772648c3a3d1d0fff4256b351 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:52:37 +1100 Subject: [PATCH 133/192] Use standard small IDs in player colour tracking --- Minecraft.Client/Network/ClientConnection.cpp | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.cpp | 6 +++--- Minecraft.Client/Platform/Common/Consoles_App.h | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 081fdfe9f..2143a9475 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -305,7 +305,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) //minecraft->setScreen(new ReceivingLevelScreen(this)); minecraft->player->entityId = packet->clientVersion; - BYTE networkSmallId = getSocket()->getSmallId(); + std::uint8_t networkSmallId = getSocket()->getSmallId(); app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges); minecraft->player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -375,7 +375,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) player->setCustomCape( app.GetPlayerCapeId(m_userIndex) ); - BYTE networkSmallId = getSocket()->getSmallId(); + std::uint8_t networkSmallId = getSocket()->getSmallId(); app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index bf55778fa..f0de38ee7 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -7816,7 +7816,7 @@ void CMinecraftApp::ClearTerrainFeaturePosition() } } -void CMinecraftApp::UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges) +void CMinecraftApp::UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges) { for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { @@ -7833,7 +7833,7 @@ void CMinecraftApp::UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourInde } } -short CMinecraftApp::GetPlayerColour(BYTE networkSmallId) +short CMinecraftApp::GetPlayerColour(std::uint8_t networkSmallId) { short index = -1; for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) @@ -7848,7 +7848,7 @@ short CMinecraftApp::GetPlayerColour(BYTE networkSmallId) } -unsigned int CMinecraftApp::GetPlayerPrivileges(BYTE networkSmallId) +unsigned int CMinecraftApp::GetPlayerPrivileges(std::uint8_t networkSmallId) { unsigned int privileges = 0; for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 80a89ef33..3c21780cd 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -722,13 +722,13 @@ public: const wchar_t *GetGameRulesString(const std::wstring &key); private: - BYTE m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's + std::uint8_t m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS]; public: - void UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges); - short GetPlayerColour(BYTE networkSmallId); - unsigned int GetPlayerPrivileges(BYTE networkSmallId); + void UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges); + short GetPlayerColour(std::uint8_t networkSmallId); + unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId); std::wstring getEntityName(eINSTANCEOF type); From 64322c07a3da7313ff2004e1862cc3f58c6c711d Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:56:50 +1100 Subject: [PATCH 134/192] Use standard tip IDs in common app --- Minecraft.Client/Platform/Common/App_structs.h | 2 +- Minecraft.Client/Platform/Common/Consoles_App.cpp | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 1d73e7c1b..50fffa5b7 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -144,7 +144,7 @@ XuiActionParam; typedef struct { int iSortValue; - UINT uiStringID; + int uiStringID; } TIPSTRUCT; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index f0de38ee7..83e9c0906 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5868,7 +5868,7 @@ void CMinecraftApp::InitialiseTips() { // We'll randomise the tips at start up based on their priority - ZeroMemory(m_TipIDA,sizeof(UINT)*MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP); + ZeroMemory(m_TipIDA, sizeof(m_TipIDA)); // Make the first tip tell you that you can play splitscreen in HD modes if you are in SD if(!RenderManager.IsHiDef()) @@ -5932,7 +5932,7 @@ void CMinecraftApp::InitialiseTips() m_uiCurrentTip=0; } -UINT CMinecraftApp::GetNextTip() +int CMinecraftApp::GetNextTip() { static bool bShowSkinDLCTip=true; // don't display the DLC tip in the trial game diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 3c21780cd..93940cac7 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -549,7 +549,7 @@ protected: static Random *TipRandom; public: void InitialiseTips(); - UINT GetNextTip(); + int GetNextTip(); int GetHTMLColour(eMinecraftColour colour); int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); } int GetHTMLFontSize(EHTMLFontSize size); @@ -565,8 +565,8 @@ public: static void ExitGameFromRemoteSave( void *lpParameter ); static int ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); private: - UINT m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP]; - UINT m_uiCurrentTip; + int m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP]; + unsigned int m_uiCurrentTip; static int TipsSortFunction(const void* a, const void* b); // XML From 05f47282dacdd900617af257ae566dd1b40de523 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:58:33 +1100 Subject: [PATCH 135/192] Use standard DLC file buffers in common app --- Minecraft.Client/Platform/Common/Consoles_App.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 93940cac7..a634f2c52 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -810,8 +810,8 @@ private: unsigned int m_dwBannedListFileSize; public: - DWORD m_dwDLCFileSize; - BYTE *m_pDLCFileBuffer; + unsigned int m_dwDLCFileSize; + std::uint8_t *m_pDLCFileBuffer; // static int CallbackReadXuidsFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); // static int CallbackDLCFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); From 7ae8c7c373abee82ac774983f4ae824077562ab8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:02:12 +1100 Subject: [PATCH 136/192] Use standard TMSPP buffers in common app --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 83e9c0906..7198569d0 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -8313,7 +8313,7 @@ int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStor case e_DLC_TexturePackData: { // 4J-PB - we need to allocate memory for the file data and copy into it, since the current data is a reference into the blob download memory - PBYTE pbData = new BYTE [pFileData->dwSize]; + std::uint8_t *pbData = new std::uint8_t[pFileData->dwSize]; memcpy(pbData,pFileData->pbData,pFileData->dwSize); pClass->m_vTMSPPData.push_back(pbData); @@ -8328,7 +8328,7 @@ int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStor if(pFileData->pbData[0]==0x89) { // 4J-PB - we need to allocate memory for the file data and copy into it, since the current data is a reference into the blob download memory - PBYTE pbData = new BYTE [pFileData->dwSize]; + std::uint8_t *pbData = new std::uint8_t[pFileData->dwSize]; memcpy(pbData,pFileData->pbData,pFileData->dwSize); pClass->m_vTMSPPData.push_back(pbData); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index a634f2c52..9503384e3 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -369,9 +369,9 @@ public: private: PlayerUID m_xuidNotch; #ifdef _DURANGO - std::unordered_map m_GTS_Files; + std::unordered_map m_GTS_Files; #else - std::unordered_map m_GTS_Files; + std::unordered_map m_GTS_Files; #endif // for storing memory textures - player skin @@ -858,7 +858,7 @@ private: bool m_bResetNether; std::uint32_t m_dwRequiredTexturePackID; #ifdef _XBOX_ONE - std::vector m_vTMSPPData; + std::vector m_vTMSPPData; #endif #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) From c1594579a2841e106028f45c5485c02baa11607b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:05:31 +1100 Subject: [PATCH 137/192] Use standard banned list buffers in common app --- .../Platform/Common/Consoles_App.cpp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 7198569d0..9aaa1bd0a 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -7132,8 +7132,9 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps if(bWriteToTMS) { - DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); - PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]); + const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); + const unsigned int dataBytes = static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); + PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; int iCount=0; for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it) { @@ -7143,12 +7144,13 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps // 4J-PB - write to TMS++ now - //bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes); + //bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dataBytes); #ifdef _XBOX - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dataBytes,NULL,NULL, 0); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dataBytes,NULL,NULL, 0); #endif + delete[] pBannedList; } // update telemetry too } @@ -7207,8 +7209,9 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha } } - DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); - if(dwDataBytes==0) + const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); + const unsigned int dataBytes = static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); + if(dataBytes==0) { // wipe the file #ifdef _XBOX @@ -7219,19 +7222,18 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha } else { - PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new BYTE [dwDataBytes]); + PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; - int iSize=(int)m_vBannedListA[iPad]->size(); - for(int i=0;iat(i); memcpy(&pBannedList[i],pBannedListData,sizeof(BANNEDLISTDATA)); } #ifdef _XBOX - StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes); + StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dataBytes); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dataBytes,NULL,NULL, 0); #endif delete [] pBannedList; } From 09b12e287c1aef7efaa3f18318e9b4e014c227d1 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:08:01 +1100 Subject: [PATCH 138/192] Use standard notification data in common app --- Minecraft.Client/Platform/Common/App_structs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 50fffa5b7..57a600bc9 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -23,8 +23,8 @@ MEMDATA,*PMEMDATA; typedef struct { - DWORD dwNotification; - UINT uiParam; + unsigned int dwNotification; + unsigned int uiParam; } NOTIFICATION,*PNOTIFICATION; From 1ba21c12508eb2a2bdf36913bd753ab1319f5465 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:10:46 +1100 Subject: [PATCH 139/192] Use standard DLC image buffers in app structs --- Minecraft.Client/Platform/Common/App_structs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 57a600bc9..7c9e201c7 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -170,8 +170,8 @@ typedef struct std::wstring wsDisplayName; // add a store for the local DLC image - PBYTE pbImageData; - DWORD dwImageBytes; + std::uint8_t *pbImageData; + unsigned int dwImageBytes; #else ULONGLONG ullOfferID_Full; ULONGLONG ullOfferID_Trial; From 1b6447a3cadd12cff4b41d64c1a90f248ba42739 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:14:23 +1100 Subject: [PATCH 140/192] Use standard DLC content types in common app --- Minecraft.Client/Platform/Common/App_structs.h | 2 +- Minecraft.Client/Platform/Common/Consoles_App.cpp | 6 +++--- Minecraft.Client/Platform/Common/Consoles_App.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 7c9e201c7..e73248d9e 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -203,7 +203,7 @@ BANNEDLIST; typedef struct _DLCRequest { - DWORD dwType; + std::uint32_t dwType; eDLCContentState eState; } DLCRequest; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 9aaa1bd0a..6d6c85dfa 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -7907,7 +7907,7 @@ std::wstring CMinecraftApp::getEntityName(eINSTANCEOF type) return L""; } -DWORD CMinecraftApp::m_dwContentTypeA[e_Marketplace_MAX]= +std::uint32_t CMinecraftApp::m_dwContentTypeA[e_Marketplace_MAX] = { XMARKETPLACE_OFFERING_TYPE_CONTENT, // e_DLC_SkinPack, e_DLC_TexturePacks, e_DLC_MashupPacks #ifndef _XBOX_ONE @@ -8558,7 +8558,7 @@ int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, in DLCRequest *pCurrent = *it; // avatar items are coming back as type Content, so we can't trust the type setting - if(pCurrent->dwType==dwType) + if(pCurrent->dwType == static_cast(dwType)) { pClass->m_iDLCOfferC = iOfferC; app.DebugPrintf("DLCOffersReturned - type %d, count %d - setting to retrieved\n",dwType,iOfferC); @@ -8570,7 +8570,7 @@ int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, in return 0; } -eDLCContentType CMinecraftApp::Find_eDLCContentType(DWORD dwType) +eDLCContentType CMinecraftApp::Find_eDLCContentType(std::uint32_t dwType) { for(int i=0;i m_DLCDownloadQueue; std::vector m_TMSPPDownloadQueue; - static DWORD m_dwContentTypeA[e_Marketplace_MAX]; + static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX]; int m_iDLCOfferC; bool m_bAllDLCContentRetrieved; bool m_bAllTMSContentRetrieved; From b7886c46d79978a2a69ed940ebe7047ccd599fca Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:19:49 +1100 Subject: [PATCH 141/192] Use standard locale IDs in common app --- Minecraft.Client/Platform/Common/Consoles_App.cpp | 4 ++-- Minecraft.Client/Platform/Common/Consoles_App.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 6d6c85dfa..0b10b2edd 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -9185,13 +9185,13 @@ void CMinecraftApp::getLocale(std::vector &vecWstrLocales) } } -DWORD CMinecraftApp::get_eMCLang(WCHAR *pwchLocale) +int CMinecraftApp::get_eMCLang(WCHAR *pwchLocale) { return m_eMCLangA[pwchLocale]; } -DWORD CMinecraftApp::get_xcLang(WCHAR *pwchLocale) +int CMinecraftApp::get_xcLang(WCHAR *pwchLocale) { return m_xcLangA[pwchLocale]; } diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 148d01014..18c1dfc90 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -875,8 +875,8 @@ public: void LocaleAndLanguageInit(); void getLocale(std::vector &vecWstrLocales); - DWORD get_eMCLang(WCHAR *pwchLocale); - DWORD get_xcLang(WCHAR *pwchLocale); + int get_eMCLang(WCHAR *pwchLocale); + int get_xcLang(WCHAR *pwchLocale); void SetTickTMSDLCFiles(bool bVal); From fba6dd8275bb299ad692cf15b485f09c631f3424 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:25:30 +1100 Subject: [PATCH 142/192] Use standard temporary counters in common app --- .../Platform/Common/Consoles_App.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 0b10b2edd..adfcab42a 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -1243,7 +1243,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) break; case eGameSetting_DisplaySplitscreenGamertags: - for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) + for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if(pMinecraft->localplayers[idx] != NULL) { @@ -3437,9 +3437,9 @@ void CMinecraftApp::HandleXuiActions(void) } #endif #ifdef _DURANGO - DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK"); + const unsigned int result = StorageManager.UnmountInstalledDLC(L"TPACK"); #else - DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); + const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); #endif app.DebugPrintf("Unmount result is %d\n",result); } @@ -4604,7 +4604,7 @@ void CMinecraftApp::SignInChangeCallback(void *pParam,bool bPrimaryPlayerChanged bool hasGuestIdChanged = false; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - DWORD guestNumber = 0; + unsigned int guestNumber = 0; if(ProfileManager.IsSignedIn(i)) { XUSER_SIGNIN_INFO info; @@ -4813,7 +4813,7 @@ void CMinecraftApp::NotificationsCallback(void *pParam,DWORD dwNotification, uns { pDLCTexPack->m_pSoundBank->Destroy(); } - DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); + const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n",result); } } @@ -8915,7 +8915,7 @@ float CMinecraftApp::getTrialTimer(void) bool CMinecraftApp::IsLocalMultiplayerAvailable() { - DWORD connectedControllers = 0; + unsigned int connectedControllers = 0; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) ++connectedControllers; @@ -8955,12 +8955,12 @@ void CMinecraftApp::getLocale(std::vector &vecWstrLocales) { std::vector locales; - DWORD dwSystemLanguage = XGetLanguage( ); + const unsigned int systemLanguage = XGetLanguage( ); // 4J-PB - restrict the 360 language until we're ready to have them in #ifdef _XBOX - switch(dwSystemLanguage) + switch(systemLanguage) { case XC_LANGUAGE_FRENCH : locales.push_back(eMCLang_frFR); @@ -8992,7 +8992,7 @@ void CMinecraftApp::getLocale(std::vector &vecWstrLocales) break; } #else - switch(dwSystemLanguage) + switch(systemLanguage) { case XC_LANGUAGE_ENGLISH: From ab89d415a27385dd441b93a5d269e624db78492f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:28:26 +1100 Subject: [PATCH 143/192] Use standard message option arrays in app flows --- Minecraft.Client/Network/ClientConnection.cpp | 8 +-- .../Platform/Common/Consoles_App.cpp | 62 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 2143a9475..0b3982e81 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -1172,7 +1172,7 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, m_userIndex == ProfileManager.GetPrimaryPad() && !MinecraftServer::saveOnExitAnswered() ) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,NULL, app.GetStringTable()); } @@ -1987,7 +1987,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) else if(cantPlayContentRestricted) reason = DisconnectPacket::eDisconnect_ContentRestricted_Single_Local; app.DebugPrintf("Exiting player %d on handling Pre-Login packet due UGC privileges: %d\n", m_userIndex, reason); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; if(!isFriendsWithHost) ui.RequestMessageBox( IDS_CANTJOIN_TITLE, IDS_NOTALLOWED_FRIENDSOFFRIENDS, uiIDA,1,m_userIndex,NULL,NULL, app.GetStringTable()); else ui.RequestMessageBox( IDS_CANTJOIN_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL, uiIDA,1,m_userIndex,NULL,NULL, app.GetStringTable()); @@ -3291,7 +3291,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E // we need to ask if they are sure they want to overwrite the existing game if(bSaveExists && StorageManager.GetSaveDisabled()) { - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL, app.GetStringTable()); @@ -3306,7 +3306,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E // we need to ask if they are sure they want to overwrite the existing game if(bSaveExists) { - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL, app.GetStringTable()); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index adfcab42a..da9fe0bae 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -2393,7 +2393,7 @@ void CMinecraftApp::HandleXuiActions(void) case eAppAction_DisplayLavaMessage: // Display a warning about placing lava in the spawn area { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CANT_PLACE_NEAR_SPAWN_TITLE, IDS_CANT_PLACE_NEAR_SPAWN_TEXT, uiIDA,1,XUSER_INDEX_ANY,NULL,NULL, app.GetStringTable()); if(result != C4JStorage::EMessage_Busy) SetGlobalXuiAction(eAppAction_Idle); @@ -2479,7 +2479,7 @@ void CMinecraftApp::HandleXuiActions(void) { // ask the player if they would like to upgrade, or they'll lose the level - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, 2,i,&CMinecraftApp::UnlockFullSaveReturned,this,app.GetStringTable()); @@ -2888,7 +2888,7 @@ void CMinecraftApp::HandleXuiActions(void) else { // ask the player if they would like to upgrade, or they'll lose the level - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, 2, i,&CMinecraftApp::UnlockFullExitReturned,this,app.GetStringTable()); @@ -3191,7 +3191,7 @@ void CMinecraftApp::HandleXuiActions(void) // need to clear the player stats - can't assume it'll be done in setlevel - we may not be in the game StatsCounter* pStats = Minecraft::GetInstance()->stats[ i ]; pStats->clear(); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE), uiIDA, 1, i,&CMinecraftApp::EthernetDisconnectReturned,this, app.GetStringTable()); @@ -3209,7 +3209,7 @@ void CMinecraftApp::HandleXuiActions(void) // need to clear the player stats - can't assume it'll be done in setlevel - we may not be in the game StatsCounter* pStats = Minecraft::GetInstance()->stats[ i ]; pStats->clear(); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE), uiIDA, 1, i,&CMinecraftApp::EthernetDisconnectReturned,this, app.GetStringTable()); @@ -3303,7 +3303,7 @@ void CMinecraftApp::HandleXuiActions(void) case eAppAction_TrialOver: { SetAction(i,eAppAction_Idle); - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_UNLOCK_TITLE; uiIDA[1]=IDS_EXIT_GAME; @@ -3317,7 +3317,7 @@ void CMinecraftApp::HandleXuiActions(void) TelemetryManager->RecordUpsellPresented(i, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID); SetAction(i,eAppAction_Idle); - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; @@ -3326,7 +3326,7 @@ void CMinecraftApp::HandleXuiActions(void) break; case eAppAction_ExitAndJoinFromInvite: { - UINT uiIDA[3]; + unsigned int uiIDA[3]; SetAction(i,eAppAction_Idle); // Check the player really wants to do this @@ -3520,7 +3520,7 @@ void CMinecraftApp::HandleXuiActions(void) //return hr; // 4J Stu - Copied this from XUI_FullScreenProgress to properly handle the fail case, as the thread will no longer be failing - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); @@ -3669,7 +3669,7 @@ void CMinecraftApp::HandleXuiActions(void) break; case eAppAction_FailedToJoinNoPrivileges: { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); if(result != C4JStorage::EMessage_Busy) SetAction(i,eAppAction_Idle); @@ -3721,7 +3721,7 @@ void CMinecraftApp::HandleXuiActions(void) break; case eAppAction_LevelInBanLevelList: { - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_BUTTON_REMOVE_FROM_BAN_LIST; uiIDA[1]=IDS_EXIT_GAME; @@ -3799,7 +3799,7 @@ void CMinecraftApp::HandleXuiActions(void) TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); #endif - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_TEXTUREPACK_FULLVERSION; uiIDA[1]=IDS_TEXTURE_PACK_TRIALVERSION; @@ -4317,7 +4317,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); } @@ -4331,7 +4331,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM else { // you're not signed in to PSN! - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable()); @@ -4362,7 +4362,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); } @@ -4376,7 +4376,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes else { // you're not signed in to PSN! - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable()); @@ -4390,14 +4390,14 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes // Signed in to PSN but not connected (no internet access) assert(!ProfileManager.isConnectedToPSN(iPad)); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); } else { // Not signed in to PSN - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable(), NULL, 0, false); } @@ -4427,7 +4427,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); } @@ -4445,7 +4445,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes else { // you're not signed in to PSN! - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial,&app, app.GetStringTable()); @@ -4459,7 +4459,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes // Signed in to PSN but not connected (no internet access) assert(!ProfileManager.isConnectedToPSN(iPad)); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); // still need to exit the trial or we'll be in the Pause menu with input ignored @@ -4468,7 +4468,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes else { // Not signed in to PSN - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial,&app, app.GetStringTable(), NULL, 0, false); } @@ -4500,7 +4500,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); } @@ -4515,7 +4515,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR #if defined(__PS3__) // you're not signed in to PSN! - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable()); @@ -4620,7 +4620,7 @@ void CMinecraftApp::SignInChangeCallback(void *pParam,bool bPrimaryPlayerChanged if( hasGuestIdChanged ) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_GUEST_ORDER_CHANGED_TITLE, IDS_GUEST_ORDER_CHANGED_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL,app.GetStringTable()); } @@ -4874,7 +4874,7 @@ void CMinecraftApp::UpsellReturnedCallback(void *pParam, eUpsellType type, eUpse ESen_UpsellID senType; ESen_UpsellOutcome senResponse; #ifdef __PS3__ - UINT uiIDA[2]; + unsigned int uiIDA[2]; #endif // Map the eUpsellResponse to the enum we use for sentient @@ -5621,7 +5621,7 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad TelemetryManager->RecordUpsellPresented(iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); #endif - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; @@ -5639,7 +5639,7 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad // we need to ask if they are sure they want to overwrite the existing game if(bSaveExists) { - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned,pClass, app.GetStringTable()); @@ -5657,7 +5657,7 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad else { // been a few requests for a confirm on exit without saving - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::ExitAndJoinFromInviteDeclineSaveReturned,pClass, app.GetStringTable()); @@ -5731,7 +5731,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4 TelemetryManager->RecordUpsellPresented(iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); #endif - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; @@ -7034,7 +7034,7 @@ void CMinecraftApp::ExitGameFromRemoteSave( void *lpParameter ) { int primaryPad = ProfileManager.GetPrimaryPad(); - UINT uiIDA[3]; + unsigned int uiIDA[3]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; From 68661e1d4409e7083fccba8937742580f96e99c2 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:42:21 +1100 Subject: [PATCH 144/192] Use standard pre-login indices in client connection --- Minecraft.Client/Network/ClientConnection.cpp | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 0b3982e81..0346a6b87 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -1642,12 +1642,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { if(m_userIndex == ProfileManager.GetPrimaryPad() ) { - for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx) + for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if(ProfileManager.IsSignedIn(m_userIndex) && ProfileManager.IsGuest(idx)) { - canPlay = FALSE; - isFriendsWithHost = FALSE; + canPlay = false; + isFriendsWithHost = false; } else { @@ -1660,12 +1660,11 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // Is this user friends with the host player? BOOL result; - DWORD error; - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); + const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); if(error == ERROR_SUCCESS && result != TRUE) { - canPlay = FALSE; - isFriendsWithHost = FALSE; + canPlay = false; + isFriendsWithHost = false; } } } @@ -1676,8 +1675,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { if(ProfileManager.IsSignedIn(m_userIndex) && ProfileManager.IsGuest(m_userIndex)) { - canPlay = FALSE; - isFriendsWithHost = FALSE; + canPlay = false; + isFriendsWithHost = false; } else { @@ -1690,12 +1689,11 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // Is this user friends with the host player? BOOL result; - DWORD error; - error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); + const unsigned int error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); if(error == ERROR_SUCCESS && result != TRUE) { - canPlay = FALSE; - isFriendsWithHost = FALSE; + canPlay = false; + isFriendsWithHost = false; } } } @@ -1704,10 +1702,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) if( canPlay ) { - for(DWORD i = 0; i < packet->m_dwPlayerCount; ++i) + for(std::uint8_t i = 0; i < packet->m_dwPlayerCount; ++i) { bool localPlayer = false; - for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx) + for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if( ProfileManager.IsSignedInLive(idx) ) { @@ -1735,16 +1733,15 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) // 4J Stu - Everyone joining needs to have at least one friend in the game // Local players are implied friends - if( isAtLeastOneFriend != TRUE ) + if(!isAtLeastOneFriend) { BOOL result; - DWORD error; - for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx) + for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); - if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = TRUE; + const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); + if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = true; } } } @@ -1766,13 +1763,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) if( m_userIndex == ProfileManager.GetPrimaryPad() ) thisQuadrantOnly = false; BOOL result; - DWORD error; - for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx) + for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); - if(error == ERROR_SUCCESS) canPlay &= result; + const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); + if(error == ERROR_SUCCESS) canPlay &= (result == TRUE); } if(!canPlay) break; } @@ -2883,7 +2879,7 @@ void ClientConnection::handleGameEvent(std::shared_ptr gameEven } else if (event == GameEventPacket::WIN_GAME) { - ui.SetWinUserIndex( (BYTE)gameEventPacket->param ); + ui.SetWinUserIndex(static_cast(gameEventPacket->param)); #ifdef _XBOX From 6556b316dc5c9e19b93b544b171498eba4285e20 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:46:44 +1100 Subject: [PATCH 145/192] Use standard counters in DLC manager --- .../Platform/Common/Consoles_App.cpp | 2 +- .../Platform/Common/DLC/DLCManager.cpp | 42 +++++++++---------- .../Platform/Common/DLC/DLCManager.h | 18 ++++---- .../Common/GameRules/GameRuleManager.cpp | 4 +- .../Textures/Packs/DLCTexturePack.cpp | 2 +- .../Textures/Packs/TexturePackRepository.cpp | 2 +- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index da9fe0bae..32aacf9e4 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5172,7 +5172,7 @@ int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dw void CMinecraftApp::HandleDLC(DLCPack *pack) { - DWORD dwFilesProcessed = 0; + unsigned int dwFilesProcessed = 0; #ifndef _XBOX #if defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined (__PSVITA__) || defined(__linux__) std::vector dlcFilenames; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index ff26b88c9..c9983e831 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -62,7 +62,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring &p { EDLCParameterType type = e_DLCParamType_Invalid; - for(DWORD i = 0; i < e_DLCParamType_Max; ++i) + for(unsigned int i = 0; i < e_DLCParamType_Max; ++i) { if(paramName.compare(wchTypeNamesA[i]) == 0) { @@ -74,9 +74,9 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring &p return type; } -DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) +unsigned int DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) { - DWORD packCount = 0; + unsigned int packCount = 0; if( type != e_DLCType_All ) { for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) @@ -90,7 +90,7 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) } else { - packCount = (DWORD)m_packs.size(); + packCount = static_cast(m_packs.size()); } return packCount; } @@ -150,12 +150,12 @@ DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID) } #endif -DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/) +DLCPack *DLCManager::getPack(unsigned int index, EDLCType type /*= e_DLCType_All*/) { DLCPack *pack = NULL; if( type != e_DLCType_All ) { - DWORD currentIndex = 0; + unsigned int currentIndex = 0; DLCPack *currentPack = NULL; for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { @@ -184,9 +184,9 @@ DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/) return pack; } -DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_DLCType_All*/) +unsigned int DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_DLCType_All*/) { - DWORD foundIndex = 0; + unsigned int foundIndex = 0; found = false; if(pack == NULL) { @@ -196,7 +196,7 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D } if( type != e_DLCType_All ) { - DWORD index = 0; + unsigned int index = 0; for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { DLCPack *thisPack = *it; @@ -214,7 +214,7 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D } else { - DWORD index = 0; + unsigned int index = 0; for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { DLCPack *thisPack = *it; @@ -230,11 +230,11 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D return foundIndex; } -DWORD DLCManager::getPackIndexContainingSkin(const std::wstring &path, bool &found) +unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring &path, bool &found) { - DWORD foundIndex = 0; + unsigned int foundIndex = 0; found = false; - DWORD index = 0; + unsigned int index = 0; for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { DLCPack *pack = *it; @@ -285,9 +285,9 @@ DLCSkinFile *DLCManager::getSkinFile(const std::wstring &path) return foundSkinfile; } -DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) +unsigned int DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) { - DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount; + unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount; DLCPack *pack = NULL; DLCPack *firstCorruptPack = NULL; @@ -304,7 +304,7 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) // gotta fix this someday if(corruptDLCCount > 0 && showMessage) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; if(corruptDLCCount == 1 && firstCorruptPack != NULL) { @@ -326,13 +326,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) return corruptDLCCount; } -bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive) +bool DLCManager::readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive) { return readDLCDataFile( dwFilesProcessed, wstringtofilename(path), pack, fromArchive); } -bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive) +bool DLCManager::readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive) { std::wstring wPath = convStringToWstring(path); if (fromArchive && app.getArchiveFileSize(wPath) >= 0) @@ -385,7 +385,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack); } -bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, std::uint8_t *pbData, DWORD dwLength, DLCPack *pack) +bool DLCManager::processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack) { std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; @@ -433,7 +433,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, std::uint8_t *pbDat uiCurrentByte+=sizeof(int); C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; - DWORD dwTemp=uiCurrentByte; + unsigned int dwTemp=uiCurrentByte; for(unsigned int i=0;idwWchCount); @@ -487,7 +487,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, std::uint8_t *pbDat if(dlcTexturePack != NULL) { - DWORD texturePackFilesProcessed = 0; + unsigned int texturePackFilesProcessed = 0; bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,pFile->uiFileSize,dlcTexturePack); pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data if(!validPack || texturePackFilesProcessed == 0) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.h b/Minecraft.Client/Platform/Common/DLC/DLCManager.h index c9dd65228..258b9b546 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.h @@ -55,14 +55,14 @@ private: std::vector m_packs; //bool m_bNeedsUpdated; bool m_bNeedsCorruptCheck; - DWORD m_dwUnnamedCorruptDLCCount; + unsigned int m_dwUnnamedCorruptDLCCount; public: DLCManager(); ~DLCManager(); static EDLCParameterType getParameterType(const std::wstring ¶mName); - DWORD getPackCount(EDLCType type = e_DLCType_All); + unsigned int getPackCount(EDLCType type = e_DLCType_All); //bool NeedsUpdated() { return m_bNeedsUpdated; } //void SetNeedsUpdated(bool val) { m_bNeedsUpdated = val; } @@ -80,21 +80,21 @@ public: #ifdef _XBOX_ONE DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID); #endif - DLCPack *getPack(DWORD index, EDLCType type = e_DLCType_All); - DWORD getPackIndex(DLCPack *pack, bool &found, EDLCType type = e_DLCType_All); + DLCPack *getPack(unsigned int index, EDLCType type = e_DLCType_All); + unsigned int getPackIndex(DLCPack *pack, bool &found, EDLCType type = e_DLCType_All); DLCSkinFile *getSkinFile(const std::wstring &path); // Will hunt all packs of type skin to find the right skinfile DLCPack *getPackContainingSkin(const std::wstring &path); - DWORD getPackIndexContainingSkin(const std::wstring &path, bool &found); + unsigned int getPackIndexContainingSkin(const std::wstring &path, bool &found); - DWORD checkForCorruptDLCAndAlert(bool showMessage = true); + unsigned int checkForCorruptDLCAndAlert(bool showMessage = true); - bool readDLCDataFile(DWORD &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false); - bool readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false); + bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false); + bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false); DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); private: - bool processDLCDataFile(DWORD &dwFilesProcessed, std::uint8_t *pbData, DWORD dwLength, DLCPack *pack); + bool processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack); DWORD retrievePackID(std::uint8_t *pbData, DWORD dwLength, DLCPack *pack); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index 3e0e077aa..d7d6cfdf0 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -663,7 +663,7 @@ void GameRuleManager::loadDefaultGameRules() if(app.getArchiveFileSize(fpTutorial) >= 0) { DLCPack *pack = new DLCPack(L"",0xffffffff); - DWORD dwFilesProcessed = 0; + unsigned int dwFilesProcessed = 0; if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) ) { app.m_dlcManager.addPack(pack); @@ -720,7 +720,7 @@ bool GameRuleManager::loadGameRulesPack(File *path) if(path->exists()) { DLCPack *pack = new DLCPack(L"",0xffffffff); - DWORD dwFilesProcessed = 0; + unsigned int dwFilesProcessed = 0; if( app.m_dlcManager.readDLCDataFile(dwFilesProcessed, path->getPath(),pack)) { app.m_dlcManager.addPack(pack); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 9a3d41054..fed7cbf75 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -324,7 +324,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen app.DebugPrintf("Mounted DLC for texture pack, attempting to load data\n"); texturePack->m_dlcDataPack = new DLCPack(texturePack->m_dlcInfoPack->getName(), dwLicenceMask); texturePack->setHasAudio(false); - DWORD dwFilesProcessed = 0; + unsigned int dwFilesProcessed = 0; // Load the DLC textures std::wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); if(!dataFilePath.empty()) diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index b20bf8f57..9eccc3ff6 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -59,7 +59,7 @@ void TexturePackRepository::addDebugPacks() { wprintf(L"Pack \"%ls\" is not installed, so adding it\n", L"DLCTestPack"); pack = new DLCPack(L"DLCTestPack",0xffffffff); - DWORD dwFilesProcessed = 0; + unsigned int dwFilesProcessed = 0; if( app.m_dlcManager.readDLCDataFile(dwFilesProcessed, "GAME:\\DummyTexturePack\\TexturePack.pck",pack)) { // 4J Stu - Don't need to do this, as the readDLCDataFile now adds texture packs From 80d035d13779b3b192d6783adf15ee852117e296 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:50:10 +1100 Subject: [PATCH 146/192] Use portable file reads in DLC manager --- .../Platform/Common/DLC/DLCManager.cpp | 149 ++++++++++-------- 1 file changed, 81 insertions(+), 68 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index c9983e831..4d40b8d75 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -4,9 +4,12 @@ #include "DLCPack.h" #include "DLCFile.h" #include "../../Minecraft.World/Util/StringHelpers.h" +#include "../../Minecraft.World/Util/PortableFileIO.h" #include "../../Minecraft.Client/Minecraft.h" #include "../../Minecraft.Client/Textures/Packs/TexturePackRepository.h" +#include + #ifdef __linux__ #include static const size_t DLC_WCHAR_BINARY = 2; @@ -26,6 +29,77 @@ static std::wstring dlc_read_wstring(const void *data) #define DLC_DETAIL_ADV(n) (sizeof(C4JStorage::DLC_FILE_DETAILS) + sizeof(WCHAR) * (n)) #endif +namespace +{ + std::wstring getMountedDlcReadPath(const std::string &path) + { + std::wstring readPath = convStringToWstring(path); + +#ifdef _WINDOWS64 + const std::string mountedPath = StorageManager.GetMountedPath(path.c_str()); + if(!mountedPath.empty()) + { + readPath = convStringToWstring(mountedPath); + } +#elif defined(_DURANGO) + const std::wstring mountedPath = StorageManager.GetMountedPath(readPath.c_str()); + if(!mountedPath.empty()) + { + readPath = mountedPath; + } +#endif + + return readPath; + } + + bool readOwnedDlcFile(const std::string &path, std::uint8_t **ppData, unsigned int *pBytesRead) + { + *ppData = NULL; + *pBytesRead = 0; + + const std::wstring readPath = getMountedDlcReadPath(path); + std::FILE *file = PortableFileIO::OpenBinaryFileForRead(readPath); + if(file == NULL) + { + return false; + } + + if(!PortableFileIO::Seek(file, 0, SEEK_END)) + { + std::fclose(file); + return false; + } + + const __int64 endPosition = PortableFileIO::Tell(file); + if(endPosition <= 0 || endPosition > std::numeric_limits::max()) + { + std::fclose(file); + return false; + } + + const unsigned int fileSize = static_cast(endPosition); + if(!PortableFileIO::Seek(file, 0, SEEK_SET)) + { + std::fclose(file); + return false; + } + + std::uint8_t *data = new std::uint8_t[fileSize]; + const std::size_t bytesRead = std::fread(data, 1, fileSize, file); + const bool failed = std::ferror(file) != 0 || bytesRead != fileSize; + std::fclose(file); + if(failed) + { + delete[] data; + return false; + } + + *ppData = data; + *pBytesRead = static_cast(bytesRead); + return true; + } +} + const WCHAR *DLCManager::wchTypeNamesA[]= { L"DISPLAYNAME", @@ -342,46 +416,15 @@ bool DLCManager::readDLCDataFile(unsigned int &dwFilesProcessed, const std::stri } else if (fromArchive) return false; -#ifdef _WINDOWS64 - std::string finalPath = StorageManager.GetMountedPath(path.c_str()); - if(finalPath.size() == 0) finalPath = path; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#elif defined(_DURANGO) - std::wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); - if(finalPath.size() == 0) finalPath = wPath; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#endif - if( file == INVALID_HANDLE_VALUE ) + unsigned int bytesRead = 0; + std::uint8_t *pbData = NULL; + if(!readOwnedDlcFile(path, &pbData, &bytesRead)) { - DWORD error = GetLastError(); - app.DebugPrintf("Failed to open DLC data file with error code %d (%x)\n", error, error); + app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str()); if( dwFilesProcessed == 0 ) removePack(pack); assert(false); return false; } - - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); - std::uint8_t *pbData = new std::uint8_t[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); - if(bSuccess==FALSE) - { - // need to treat the file as corrupt, and flag it, so can't call fatal error - //app.FatalLoadError(); - } - else - { - CloseHandle(file); - } - if(bSuccess==FALSE) - { - // Corrupt or some other error. In any case treat as corrupt - app.DebugPrintf("Failed to read %s from DLC content package\n", path.c_str()); - pack->SetIsCorrupt( true ); - SetNeedsCorruptCheck(true); - return false; - } return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack); } @@ -547,43 +590,13 @@ bool DLCManager::processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t DWORD DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack) { DWORD packId = 0; - std::wstring wPath = convStringToWstring(path); -#ifdef _WINDOWS64 - std::string finalPath = StorageManager.GetMountedPath(path.c_str()); - if(finalPath.size() == 0) finalPath = path; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#elif defined(_DURANGO) - std::wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); - if(finalPath.size() == 0) finalPath = wPath; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -#endif - if( file == INVALID_HANDLE_VALUE ) + unsigned int bytesRead = 0; + std::uint8_t *pbData = NULL; + if(!readOwnedDlcFile(path, &pbData, &bytesRead)) { return 0; } - - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); - std::uint8_t *pbData = new std::uint8_t[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); - if(bSuccess==FALSE) - { - // need to treat the file as corrupt, and flag it, so can't call fatal error - //app.FatalLoadError(); - } - else - { - CloseHandle(file); - } - if(bSuccess==FALSE) - { - // Corrupt or some other error. In any case treat as corrupt - app.DebugPrintf("Failed to read %s from DLC content package\n", path.c_str()); - delete [] pbData; - return 0; - } packId=retrievePackID(pbData, bytesRead, pack); delete [] pbData; From 3c2669b2a7868c4a49b2d99be69a565a9b028662 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:54:11 +1100 Subject: [PATCH 147/192] Use fixed-width pack IDs in DLC packs --- .../Platform/Common/Consoles_App.cpp | 2 +- .../Platform/Common/DLC/DLCManager.cpp | 10 +++++----- .../Platform/Common/DLC/DLCManager.h | 4 ++-- Minecraft.Client/Platform/Common/DLC/DLCPack.cpp | 8 ++++---- Minecraft.Client/Platform/Common/DLC/DLCPack.h | 16 ++++++++-------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 32aacf9e4..e43c0e874 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5211,7 +5211,7 @@ int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dw if(( GetFileAttributes( szFullFilename ) & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) { #ifdef _XBOX - DWORD dwPackID=m_dlcManager.retrievePackIDFromDLCDataFile(szFullFilename,pack); + std::uint32_t dwPackID=m_dlcManager.retrievePackIDFromDLCDataFile(szFullFilename,pack); // Do we need to override the TexturePack.pck with an updated version in a TU? std::wstring wsTemp=getFilePath(dwPackID, std::wstring(L"TexturePack.pck"),false ); diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index 4d40b8d75..6a69d5921 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -587,9 +587,9 @@ bool DLCManager::processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t return true; } -DWORD DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack) +std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack) { - DWORD packId = 0; + std::uint32_t packId = 0; unsigned int bytesRead = 0; std::uint8_t *pbData = NULL; @@ -603,9 +603,9 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack return packId; } -DWORD DLCManager::retrievePackID(std::uint8_t *pbData, DWORD dwLength, DLCPack *pack) +std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack) { - DWORD packId=0; + std::uint32_t packId=0; bool bPackIDSet=false; std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; @@ -650,7 +650,7 @@ DWORD DLCManager::retrievePackID(std::uint8_t *pbData, DWORD dwLength, DLCPack * uiCurrentByte+=sizeof(int); C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; - DWORD dwTemp=uiCurrentByte; + unsigned int dwTemp=uiCurrentByte; for(unsigned int i=0;idwWchCount); diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.h b/Minecraft.Client/Platform/Common/DLC/DLCManager.h index 258b9b546..8f4e46e39 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.h @@ -91,10 +91,10 @@ public: bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false); bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false); - DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); + std::uint32_t retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); private: bool processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack); - DWORD retrievePackID(std::uint8_t *pbData, DWORD dwLength, DLCPack *pack); + std::uint32_t retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp index f02434e91..214ab96d1 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp @@ -101,9 +101,9 @@ XCONTENTDEVICEID DLCPack::GetDLCDeviceID() void DLCPack::addChildPack(DLCPack *childPack) { - int packId = childPack->GetPackId(); + const std::uint32_t packId = childPack->GetPackId(); #ifndef _CONTENT_PACKAGE - if(packId < 0 || packId > 15) + if(packId > 15) { __debugbreak(); } @@ -125,7 +125,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstrin { case DLCManager::e_DLCParamType_PackId: { - DWORD packId = 0; + std::uint32_t packId = 0; std::wstringstream ss; // 4J Stu - numbered using decimal to make it easier for artists/people to number manually @@ -137,7 +137,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstrin break; case DLCManager::e_DLCParamType_PackVersion: { - DWORD version = 0; + std::uint32_t version = 0; std::wstringstream ss; // 4J Stu - numbered using decimal to make it easier for artists/people to number manually diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.h b/Minecraft.Client/Platform/Common/DLC/DLCPack.h index 226709b52..692fca722 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.h @@ -26,8 +26,8 @@ private: ULONGLONG m_ullFullOfferId; #endif bool m_isCorrupt; - DWORD m_packId; - DWORD m_packVersion; + std::uint32_t m_packId; + std::uint32_t m_packVersion; std::uint8_t *m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. public: @@ -45,14 +45,14 @@ public: bool IsCorrupt() { return m_isCorrupt; } void SetIsCorrupt(bool val) { m_isCorrupt = val; } - void SetPackId(DWORD id) { m_packId = id; } - DWORD GetPackId() { return m_packId; } + void SetPackId(std::uint32_t id) { m_packId = id; } + std::uint32_t GetPackId() { return m_packId; } - void SetPackVersion(DWORD version) { m_packVersion = version; } - DWORD GetPackVersion() { return m_packVersion; } + void SetPackVersion(std::uint32_t version) { m_packVersion = version; } + std::uint32_t GetPackVersion() { return m_packVersion; } DLCPack * GetParentPack() { return m_parentPack; } - DWORD GetParentPackId() { return m_parentPack->m_packId; } + std::uint32_t GetParentPackId() { return m_parentPack->m_packId; } void SetDLCMountIndex(DWORD id) { m_dlcMountIndex = id; } DWORD GetDLCMountIndex(); @@ -82,7 +82,7 @@ public: DWORD getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All); DWORD getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found); bool doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path); - DWORD GetPackID() {return m_packId;} + std::uint32_t GetPackID() {return m_packId;} DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); } DWORD getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); } From 86002c2f181fcb26d2c635e664727fa97548713f Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:57:08 +1100 Subject: [PATCH 148/192] Use standard counts in DLC packs --- Minecraft.Client/Platform/Common/DLC/DLCPack.cpp | 14 +++++++------- Minecraft.Client/Platform/Common/DLC/DLCPack.h | 12 ++++++------ .../Platform/Common/XUI/XUI_SkinSelect.cpp | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp index 214ab96d1..ba555534b 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp @@ -278,7 +278,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const std::wstring return hasFile; } -DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) +DLCFile *DLCPack::getFile(DLCManager::EDLCType type, unsigned int index) { DLCFile *file = NULL; if(type == DLCManager::e_DLCType_All) @@ -333,9 +333,9 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const std::wstring &path) return file; } -DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCType_All*/) +unsigned int DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCType_All*/) { - DWORD count = 0; + unsigned int count = 0; switch(type) { @@ -346,13 +346,13 @@ DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCT } break; default: - count = (DWORD)m_files[(int)type].size(); + count = static_cast(m_files[(int)type].size()); break; }; return count; }; -DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found) +unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found) { if(type == DLCManager::e_DLCType_All) { @@ -363,9 +363,9 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &pat return 0; } - DWORD foundIndex = 0; + unsigned int foundIndex = 0; found = false; - DWORD index = 0; + unsigned int index = 0; for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it) { if(path.compare((*it)->getPath()) == 0) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.h b/Minecraft.Client/Platform/Common/DLC/DLCPack.h index 692fca722..7777ed4d3 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.h @@ -76,18 +76,18 @@ public: #endif DLCFile *addFile(DLCManager::EDLCType type, const std::wstring &path); - DLCFile *getFile(DLCManager::EDLCType type, DWORD index); + DLCFile *getFile(DLCManager::EDLCType type, unsigned int index); DLCFile *getFile(DLCManager::EDLCType type, const std::wstring &path); - DWORD getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All); - DWORD getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found); + unsigned int getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All); + unsigned int getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found); bool doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path); std::uint32_t GetPackID() {return m_packId;} - DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); } - DWORD getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); } + unsigned int getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); } + unsigned int getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); } DLCSkinFile *getSkinFile(const std::wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); } - DLCSkinFile *getSkinFile(DWORD index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); } + DLCSkinFile *getSkinFile(unsigned int index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); } bool doesPackContainSkin(const std::wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); } bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path); diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_SkinSelect.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_SkinSelect.cpp index 71f9c9336..189b3bb89 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_SkinSelect.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_SkinSelect.cpp @@ -1007,7 +1007,7 @@ void CScene_SkinSelect::handlePackIndexChanged() if(m_currentPack != NULL) { bool found; - DWORD currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found); + unsigned int currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found); if(found) m_skinIndex = currentSkinIndex; } else @@ -1036,7 +1036,7 @@ void CScene_SkinSelect::handlePackIndexChanged() DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) { - DWORD currentSkinIndex = Pack->getSkinIndexAt(m_currentSkinPath, found); + unsigned int currentSkinIndex = Pack->getSkinIndexAt(m_currentSkinPath, found); if(found) m_skinIndex = app.GetPlayerFavoriteSkinsPos(m_iPad); } } @@ -1441,4 +1441,4 @@ void CScene_SkinSelect::AddFavoriteSkin(int iPad,int iSkinID) app.SetPlayerFavoriteSkin(iPad,(int)ucPos,iSkinID); app.SetPlayerFavoriteSkinsPos(m_iPad,ucPos); -} \ No newline at end of file +} From a798d0f1745b50d2db5b4a18990a5cb05ea21a40 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:00:18 +1100 Subject: [PATCH 149/192] Use standard mount and licence types in DLC packs --- Minecraft.Client/Platform/Common/DLC/DLCPack.cpp | 6 +++--- Minecraft.Client/Platform/Common/DLC/DLCPack.h | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp index ba555534b..55ddbbd44 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp @@ -11,7 +11,7 @@ #include "DLCColourTableFile.h" #include "../../Minecraft.World/Util/StringHelpers.h" -DLCPack::DLCPack(const std::wstring &name,DWORD dwLicenseMask) +DLCPack::DLCPack(const std::wstring &name,std::uint32_t dwLicenseMask) { m_dataPath = L""; m_packName = name; @@ -35,7 +35,7 @@ DLCPack::DLCPack(const std::wstring &name,DWORD dwLicenseMask) } #ifdef _XBOX_ONE -DLCPack::DLCPack(const std::wstring &name,const std::wstring &productID,DWORD dwLicenseMask) +DLCPack::DLCPack(const std::wstring &name,const std::wstring &productID,std::uint32_t dwLicenseMask) { m_dataPath = L""; m_packName = name; @@ -81,7 +81,7 @@ DLCPack::~DLCPack() } } -DWORD DLCPack::GetDLCMountIndex() +int DLCPack::GetDLCMountIndex() { if(m_parentPack != NULL) { diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.h b/Minecraft.Client/Platform/Common/DLC/DLCPack.h index 7777ed4d3..3fdd16973 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.h @@ -17,7 +17,7 @@ private: std::wstring m_packName; std::wstring m_dataPath; - DWORD m_dwLicenseMask; + std::uint32_t m_dwLicenseMask; int m_dlcMountIndex; XCONTENTDEVICEID m_dlcDeviceID; #ifdef _XBOX_ONE @@ -32,9 +32,9 @@ private: std::uint8_t *m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. public: - DLCPack(const std::wstring &name,DWORD dwLicenseMask); + DLCPack(const std::wstring &name,std::uint32_t dwLicenseMask); #ifdef _XBOX_ONE - DLCPack(const std::wstring &name,const std::wstring &productID,DWORD dwLicenseMask); + DLCPack(const std::wstring &name,const std::wstring &productID,std::uint32_t dwLicenseMask); #endif ~DLCPack(); @@ -54,8 +54,8 @@ public: DLCPack * GetParentPack() { return m_parentPack; } std::uint32_t GetParentPackId() { return m_parentPack->m_packId; } - void SetDLCMountIndex(DWORD id) { m_dlcMountIndex = id; } - DWORD GetDLCMountIndex(); + void SetDLCMountIndex(int id) { m_dlcMountIndex = id; } + int GetDLCMountIndex(); void SetDLCDeviceID(XCONTENTDEVICEID deviceId) { m_dlcDeviceID = deviceId; } XCONTENTDEVICEID GetDLCDeviceID(); @@ -65,8 +65,8 @@ public: void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); bool getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int ¶m); - void updateLicenseMask( DWORD dwLicenseMask ) { m_dwLicenseMask = dwLicenseMask; } - DWORD getLicenseMask( ) { return m_dwLicenseMask; } + void updateLicenseMask(std::uint32_t dwLicenseMask) { m_dwLicenseMask = dwLicenseMask; } + std::uint32_t getLicenseMask() { return m_dwLicenseMask; } std::wstring getName() { return m_packName; } #ifdef _XBOX_ONE From 491783c301efcf8be8a8e1745bf44e717285448c Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:04:59 +1100 Subject: [PATCH 150/192] Use fixed-width skin IDs in DLC files --- Minecraft.Client/Platform/Common/DLC/DLCFile.cpp | 2 +- Minecraft.Client/Platform/Common/DLC/DLCFile.h | 4 ++-- Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp index 56bfc4fb1..5ae3551bc 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp @@ -23,4 +23,4 @@ DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring &path) { m_dwSkinId=0; } -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/DLC/DLCFile.h b/Minecraft.Client/Platform/Common/DLC/DLCFile.h index 3c0da1855..cb472a77c 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCFile.h @@ -7,7 +7,7 @@ class DLCFile protected: DLCManager::EDLCType m_type; std::wstring m_path; - DWORD m_dwSkinId; + std::uint32_t m_dwSkinId; public: DLCFile(DLCManager::EDLCType type, const std::wstring &path); @@ -15,7 +15,7 @@ public: DLCManager::EDLCType getType() { return m_type; } std::wstring getPath() { return m_path; } - DWORD getSkinID() { return m_dwSkinId; } + std::uint32_t getSkinID() { return m_dwSkinId; } virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes) {} virtual std::uint8_t *getData(std::uint32_t &dataBytes) { dataBytes = 0; return NULL; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp index a965b64d5..e15fd55a4 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp @@ -157,7 +157,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const std::ws case DLCManager::e_DLCParamType_Anim: // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. swscanf(value.c_str(), L"%X", &m_uiAnimOverrideBitmask); - DWORD skinId = app.getSkinIdFromPath(m_path); + std::uint32_t skinId = app.getSkinIdFromPath(m_path); app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask); break; } From 7a0d3f709e2df42c44ea102031df84315a8ba15c Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:06:11 +1100 Subject: [PATCH 151/192] Remove DWORD from DLC audio parsing --- Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp index f5926fbbc..c7cf23cb1 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp @@ -36,7 +36,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const std::wstr { EAudioParameterType type = e_AudioParamType_Invalid; - for(DWORD i = 0; i < e_AudioParamType_Max; ++i) + for(int i = 0; i < e_AudioParamType_Max; ++i) { if(paramName.compare(wchTypeNamesA[i]) == 0) { @@ -158,11 +158,11 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLe uiCurrentByte+=sizeof(int); C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; - DWORD dwTemp=uiCurrentByte; + unsigned int tempByteOffset = uiCurrentByte; for(unsigned int i=0;idwWchCount*sizeof(WCHAR); - pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; + tempByteOffset += sizeof(C4JStorage::DLC_FILE_DETAILS) + pFile->dwWchCount * sizeof(WCHAR); + pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[tempByteOffset]; } std::uint8_t *pbTemp = reinterpret_cast(pFile); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; From 29edda1cc751e9f5bc6fb518ca251d9ff9b5da65 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:08:43 +1100 Subject: [PATCH 152/192] Remove UINT from game rule attribute writers --- .../Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/AddEnchantmentRuleDefinition.h | 2 +- .../Platform/Common/GameRules/AddItemRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/AddItemRuleDefinition.h | 2 +- .../Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/ApplySchematicRuleDefinition.h | 2 +- Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp | 2 +- Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h | 2 +- .../Platform/Common/GameRules/CollectItemRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/CollectItemRuleDefinition.h | 2 +- .../Platform/Common/GameRules/ConsoleGenerateStructure.cpp | 2 +- .../Platform/Common/GameRules/ConsoleGenerateStructure.h | 2 +- .../Platform/Common/GameRules/GameRuleDefinition.cpp | 2 +- Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h | 2 +- .../Platform/Common/GameRules/LevelGenerationOptions.cpp | 2 +- .../Platform/Common/GameRules/LevelGenerationOptions.h | 2 +- .../Platform/Common/GameRules/NamedAreaRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/NamedAreaRuleDefinition.h | 2 +- Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp | 2 +- Minecraft.Client/Platform/Common/GameRules/StartFeature.h | 2 +- .../Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/UpdatePlayerRuleDefinition.h | 2 +- .../Platform/Common/GameRules/UseTileRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/UseTileRuleDefinition.h | 2 +- .../Common/GameRules/XboxStructureActionGenerateBox.cpp | 2 +- .../Platform/Common/GameRules/XboxStructureActionGenerateBox.h | 2 +- .../Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp | 2 +- .../Platform/Common/GameRules/XboxStructureActionPlaceBlock.h | 2 +- .../Common/GameRules/XboxStructureActionPlaceContainer.cpp | 2 +- .../Common/GameRules/XboxStructureActionPlaceContainer.h | 2 +- .../Common/GameRules/XboxStructureActionPlaceSpawner.cpp | 2 +- .../Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp index 90cdcf816..4bd79aa8e 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp @@ -9,7 +9,7 @@ AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() m_enchantmentId = m_enchantmentLevel = 0; } -void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) +void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) { GameRuleDefinition::writeAttributes(dos, numAttributes + 2); diff --git a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h index bb6f48ae3..d939c0f96 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h @@ -15,7 +15,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddEnchantment; } - virtual void writeAttributes(DataOutputStream *, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); diff --git a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp index f26580add..7ae0aecf9 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp @@ -12,7 +12,7 @@ AddItemRuleDefinition::AddItemRuleDefinition() m_slot = -1; } -void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { GameRuleDefinition::writeAttributes(dos, numAttrs + 5); diff --git a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h index 01ac84eef..d4863ec9b 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h @@ -18,7 +18,7 @@ private: public: AddItemRuleDefinition(); - virtual void writeAttributes(DataOutputStream *, UINT numAttributes); + virtual void writeAttributes(DataOutputStream *, unsigned int numAttributes); virtual void getChildren(std::vector *children); virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddItem; } diff --git a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp index cd235b9e9..02e8ecc63 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp @@ -30,7 +30,7 @@ ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() delete m_location; } -void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { GameRuleDefinition::writeAttributes(dos, numAttrs + 5); diff --git a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h index 7cf307ae1..a7495c841 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h @@ -30,7 +30,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; } - virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); void processSchematic(AABB *chunkBox, LevelChunk *chunk); diff --git a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp index d05f98098..eb8809555 100644 --- a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp @@ -9,7 +9,7 @@ BiomeOverride::BiomeOverride() m_biomeId = 0; } -void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void BiomeOverride::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { GameRuleDefinition::writeAttributes(dos, numAttrs + 3); diff --git a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h index 3259658ef..29cd64f5b 100644 --- a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h +++ b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h @@ -15,7 +15,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_BiomeOverride; } - virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool isBiome(int id); diff --git a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp index 4e6a757cc..a97b585e0 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp @@ -17,7 +17,7 @@ CollectItemRuleDefinition::~CollectItemRuleDefinition() { } -void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) +void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) { GameRuleDefinition::writeAttributes(dos, numAttributes + 3); diff --git a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h index 3a6b981c9..d9bc6b7e3 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h @@ -20,7 +20,7 @@ public: ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CollectItemRule; } - virtual void writeAttributes(DataOutputStream *, UINT numAttributes); + virtual void writeAttributes(DataOutputStream *, unsigned int numAttributes); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); virtual int getGoal(); diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp index 8c78623ef..ad9238a70 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp @@ -55,7 +55,7 @@ GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRu return rule; } -void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { GameRuleDefinition::writeAttributes(dos, numAttrs + 5); diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h index 6ad055949..e9aaaface 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h @@ -23,7 +23,7 @@ public: virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); // StructurePiece diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp index f94f5c573..0aaabb754 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp @@ -29,7 +29,7 @@ void GameRuleDefinition::write(DataOutputStream *dos) (*it)->write(dos); } -void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) +void GameRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) { dos->writeInt(numAttributes + 3); diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h index d41e1aea7..6b7e1afc7 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h @@ -34,7 +34,7 @@ public: virtual void write(DataOutputStream *); - virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); virtual void getChildren(std::vector *); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index 2e2e6c904..ba29442e3 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -90,7 +90,7 @@ LevelGenerationOptions::~LevelGenerationOptions() ConsoleGameRules::EGameRuleType LevelGenerationOptions::getActionType() { return ConsoleGameRules::eGameRuleType_LevelGenerationOptions; } -void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { GameRuleDefinition::writeAttributes(dos, numAttrs + 5); diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h index 829d03b4e..6dee74f27 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h @@ -170,7 +170,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType(); - virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); diff --git a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp index 9e6480016..bf79d1c14 100644 --- a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp @@ -14,7 +14,7 @@ NamedAreaRuleDefinition::~NamedAreaRuleDefinition() delete m_area; } -void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) +void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) { GameRuleDefinition::writeAttributes(dos, numAttributes + 7); diff --git a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h index 8386b3fd4..ff3eb3cb9 100644 --- a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h @@ -12,7 +12,7 @@ public: NamedAreaRuleDefinition(); ~NamedAreaRuleDefinition(); - virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_NamedArea; } diff --git a/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp b/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp index 5ab776b68..be44ca2b4 100644 --- a/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp @@ -9,7 +9,7 @@ StartFeature::StartFeature() m_feature = StructureFeature::eFeature_Temples; } -void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void StartFeature::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { GameRuleDefinition::writeAttributes(dos, numAttrs + 3); diff --git a/Minecraft.Client/Platform/Common/GameRules/StartFeature.h b/Minecraft.Client/Platform/Common/GameRules/StartFeature.h index b725fccc4..6a153bfcd 100644 --- a/Minecraft.Client/Platform/Common/GameRules/StartFeature.h +++ b/Minecraft.Client/Platform/Common/GameRules/StartFeature.h @@ -15,7 +15,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_StartFeature; } - virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); diff --git a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp index 741773782..38ffc2768 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -24,7 +24,7 @@ UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition() } } -void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) +void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) { int attrCount = 3; if(m_bUpdateHealth) ++attrCount; diff --git a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h index 2b14dd508..0ac062dd7 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h @@ -26,7 +26,7 @@ public: virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); virtual void postProcessPlayer(std::shared_ptr player); diff --git a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp index cb2284a25..5b775ea81 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp @@ -8,7 +8,7 @@ UseTileRuleDefinition::UseTileRuleDefinition() m_useCoords = false; } -void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) +void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) { GameRuleDefinition::writeAttributes(dos, numAttributes + 5); diff --git a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h index df3a584ac..ee047d96b 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h @@ -17,7 +17,7 @@ public: ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UseTileRule; } - virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp index 60d64a113..a16822fe9 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp @@ -9,7 +9,7 @@ XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() m_skipAir = false; } -void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h index 3570b5a3f..44ff199c9 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h @@ -19,7 +19,7 @@ public: virtual int getEndY() { return m_y1; } virtual int getEndZ() { return m_z1; } - virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp index c9250561b..dcc5d59ed 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp @@ -8,7 +8,7 @@ XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() m_x = m_y = m_z = m_tile = m_data = 0; } -void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h index 75648965c..4101028a0 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h @@ -18,7 +18,7 @@ public: virtual int getEndY() { return m_y; } virtual int getEndZ() { return m_z; } - virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool placeBlockInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp index f4819e329..04606e7ca 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp @@ -21,7 +21,7 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer() } // 4J-JEV: Super class handles attr-facing fine. -//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs) +//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) void XboxStructureActionPlaceContainer::getChildren(std::vector *children) diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h index bef68bbb9..f9950e1ba 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h @@ -21,7 +21,7 @@ public: virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); // 4J-JEV: Super class handles attr-facing fine. - //virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); + //virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp index 936e7bc8d..af33a418d 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp @@ -15,7 +15,7 @@ XboxStructureActionPlaceSpawner::~XboxStructureActionPlaceSpawner() { } -void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream *dos, UINT numAttrs) +void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) { XboxStructureActionPlaceBlock::writeAttributes(dos, numAttrs + 1); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h index 92899b93e..933a467c4 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h @@ -17,7 +17,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceSpawner; } - virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); + virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); From bfa2fd6715a7a8660cec1dbcdfa4a20a2f26a9f3 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:11:54 +1100 Subject: [PATCH 153/192] Remove UINT from game rule manager sizes --- .../Common/GameRules/GameRuleManager.cpp | 32 +++++++++---------- .../Common/GameRules/GameRuleManager.h | 8 ++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index d7d6cfdf0..42694511d 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -142,7 +142,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack) } } -LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize) +LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, unsigned int dSize) { LevelGenerationOptions *lgo = new LevelGenerationOptions(); lgo->setGrSource( new JustGrSource() ); @@ -153,7 +153,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize) } // 4J-JEV: Reverse of saveGameRules. -void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize) +void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize) { app.DebugPrintf("GameRuleManager::LoadingGameRules:\n"); @@ -174,7 +174,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U app.DebugPrintf("\tcompressionType=%d.\n", compression_type); - UINT compr_len, decomp_len; + unsigned int compr_len, decomp_len; compr_len = dis.readInt(); decomp_len = dis.readInt(); @@ -240,7 +240,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U } // 4J-JEV: Reverse of loadGameRules. -void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize) +void GameRuleManager::saveGameRules(uint8_t **dOut, unsigned int *dSize) { if (m_currentGameRuleDefinitions == NULL && m_currentLevelGenerationOptions == NULL) @@ -264,7 +264,7 @@ void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize) // Write 8 bytes of empty space in case we need them later. // Mainly useful for the ones we save embedded in game saves. - for (UINT i = 0; i < 8; i++) + for (unsigned int i = 0; i < 8; i++) dos.writeByte(0x0); dos.writeByte(APPROPRIATE_COMPRESSION_TYPE); // m_compressionType @@ -373,7 +373,7 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos) m_currentGameRuleDefinitions->write(dos); } -bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings) +bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings) { bool levelGenAdded = false; bool gameRulesAdded = false; @@ -469,15 +469,15 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI } // string lookup. - UINT numStrings = contentDis->readInt(); + unsigned int numStrings = contentDis->readInt(); std::vector tagsAndAtts; - for (UINT i = 0; i < numStrings; i++) + for (unsigned int i = 0; i < numStrings; i++) tagsAndAtts.push_back( contentDis->readUTF() ); std::unordered_map tagIdMap; for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type) { - for(UINT i = 0; i < numStrings; ++i) + for(unsigned int i = 0; i < numStrings; ++i) { if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0) { @@ -492,7 +492,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI std::unordered_map attrIdMap; for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr) { - for (UINT i = 0; i < numStrings; i++) + for (unsigned int i = 0; i < numStrings; i++) { if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0) { @@ -503,8 +503,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI }*/ // subfile - UINT numFiles = contentDis->readInt(); - for (UINT i = 0; i < numFiles; i++) + unsigned int numFiles = contentDis->readInt(); + for (unsigned int i = 0; i < numFiles; i++) { std::wstring sFilename = contentDis->readUTF(); int length = contentDis->readInt(); @@ -519,8 +519,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL; // xml objects - UINT numObjects = contentDis->readInt(); - for(UINT i = 0; i < numObjects; ++i) + unsigned int numObjects = contentDis->readInt(); + for(unsigned int i = 0; i < numObjects; ++i) { int tagId = contentDis->readInt(); ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; @@ -584,7 +584,7 @@ LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh) void GameRuleManager::readAttributes(DataInputStream *dis, std::vector *tagsAndAtts, GameRuleDefinition *rule) { int numAttrs = dis->readInt(); - for (UINT att = 0; att < numAttrs; ++att) + for (unsigned int att = 0; att < static_cast(numAttrs); ++att) { int attID = dis->readInt(); std::wstring value = dis->readUTF(); @@ -596,7 +596,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, std::vector *tagsAndAtts, std::unordered_map *tagIdMap, GameRuleDefinition *rule) { int numChildren = dis->readInt(); - for(UINT child = 0; child < numChildren; ++child) + for(unsigned int child = 0; child < static_cast(numChildren); ++child) { int tagId = dis->readInt(); ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h index 7bc3f2dfd..95a0dbf4d 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h @@ -40,10 +40,10 @@ public: void loadGameRules(DLCPack *); - LevelGenerationOptions *loadGameRules(uint8_t *dIn, UINT dSize); - void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize); + LevelGenerationOptions *loadGameRules(uint8_t *dIn, unsigned int dSize); + void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize); - void saveGameRules(uint8_t **dOut, UINT *dSize); + void saveGameRules(uint8_t **dOut, unsigned int *dSize); private: LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh); @@ -51,7 +51,7 @@ private: void writeRuleFile(DataOutputStream *dos); public: - bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings); + bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings); private: void readAttributes(DataInputStream *dis, std::vector *tagsAndAtts, GameRuleDefinition *rule); From 025d8184d8fdcf33e9398ef8a623550d18b35da0 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:13:24 +1100 Subject: [PATCH 154/192] Use standard byte types in game rule manager --- .../Common/GameRules/GameRuleManager.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index 42694511d..bb64f0c1f 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -103,7 +103,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack) for(int i = 0; i < gameRulesCount; ++i) { DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); - DWORD dSize; + std::uint32_t dSize; uint8_t *dData = dlcHeader->getData(dSize); LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); @@ -125,7 +125,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack) { DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i); - DWORD dSize; + std::uint32_t dSize; uint8_t *dData = dlcFile->getData(dSize); LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); @@ -170,7 +170,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, u for (int i = 0; i < 8; i++) dis.readByte(); - BYTE compression_type = dis.readByte(); + std::uint8_t compression_type = dis.readByte(); app.DebugPrintf("\tcompressionType=%d.\n", compression_type); @@ -183,8 +183,8 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, u // Decompress File Body - byteArray content(new BYTE[decomp_len], decomp_len), - compr_content(new BYTE[compr_len], compr_len); + byteArray content(new std::uint8_t[decomp_len], decomp_len), + compr_content(new std::uint8_t[compr_len], compr_len); dis.read(compr_content); Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type ); @@ -203,14 +203,14 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, u // Read StringTable. byteArray bStringTable; bStringTable.length = dis2.readInt(); - bStringTable.data = new BYTE[ bStringTable.length ]; + bStringTable.data = new std::uint8_t[ bStringTable.length ]; dis2.read(bStringTable); StringTable *strings = new StringTable(bStringTable.data, bStringTable.length); // Read RuleFile. byteArray bRuleFile; bRuleFile.length = content.length - bStringTable.length; - bRuleFile.data = new BYTE[ bRuleFile.length ]; + bRuleFile.data = new std::uint8_t[ bRuleFile.length ]; dis2.read(bRuleFile); // 4J-JEV: I don't believe that the path-name is ever used. @@ -306,7 +306,7 @@ void GameRuleManager::saveGameRules(uint8_t **dOut, unsigned int *dSize) } // Compress compr_dos and write to dos. - byteArray compr_ba(new BYTE[ compr_baos.buf.length ], compr_baos.buf.length); + byteArray compr_ba(new std::uint8_t[ compr_baos.buf.length ], compr_baos.buf.length); Compression::getCompression()->CompressLZXRLE( compr_ba.data, &compr_ba.length, compr_baos.buf.data, compr_baos.buf.length ); @@ -380,8 +380,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, un LevelGenerationOptions *levelGenerator = lgo;//new LevelGenerationOptions(); LevelRuleset *gameRules = new LevelRuleset(); - //DWORD dwLen = 0; - //PBYTE pbData = dlcFile->getData(dwLen); + //std::uint32_t dataLength = 0; + //std::uint8_t *data = dlcFile->getData(dataLength); //byteArray data(pbData,dwLen); byteArray data(dIn, dSize); From 1ab9750fd6b54c78c41534972d811622b119b808 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:15:16 +1100 Subject: [PATCH 155/192] Use standard byte buffers in schematic saves --- .../Platform/Common/GameRules/ConsoleSchematicFile.cpp | 2 +- .../Platform/Common/GameRules/LevelGenerationOptions.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp index 586e29997..e4e8a7707 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp @@ -37,7 +37,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos) dos->writeInt(m_ySize); dos->writeInt(m_zSize); - byteArray ba(new BYTE[ m_data.length ], m_data.length); + byteArray ba(new std::uint8_t[ m_data.length ], m_data.length); Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length, m_data.data, m_data.length); diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h index 6dee74f27..ab3325ffa 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h @@ -43,7 +43,7 @@ public: virtual bool ready()=0; - //virtual void getGrfData(PBYTE &pData, DWORD &pSize)=0; + //virtual void getGrfData(std::uint8_t *&pData, unsigned int &pSize)=0; }; class JustGrSource : public GrSource From a1fdebbc3b31469ffafe5210fea506ceef14671d Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:17:18 +1100 Subject: [PATCH 156/192] Use standard skin locals in player code --- Minecraft.Client/Network/PlayerConnection.cpp | 2 +- Minecraft.World/Player/Player.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index 1a4d8721e..b5b494e81 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -932,7 +932,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const std::wstring &text else { // get the data from the app - DWORD dwSkinID = app.getSkinIdFromPath(textureName); + std::uint32_t dwSkinID = app.getSkinIdFromPath(textureName); std::vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID); diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index 5a1361d04..82f706430 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -666,8 +666,8 @@ void Player::setCustomSkin(std::uint32_t skinId) if(pDLCSkinFile!=NULL) { - DWORD dwBoxC=pDLCSkinFile->getAdditionalBoxesCount(); - if(dwBoxC!=0) + const int additionalBoxCount = pDLCSkinFile->getAdditionalBoxesCount(); + if(additionalBoxCount != 0) { app.DebugPrintf("Got model parts from DLCskin for skin %X\n",m_dwSkinId); pvModelParts=app.SetAdditionalSkinBoxes(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); @@ -2958,8 +2958,8 @@ std::vector *Player::GetAdditionalModelParts() if(pDLCSkinFile!=NULL) { - DWORD dwBoxC=pDLCSkinFile->getAdditionalBoxesCount(); - if(dwBoxC!=0) + const int additionalBoxCount = pDLCSkinFile->getAdditionalBoxesCount(); + if(additionalBoxCount != 0) { app.DebugPrintf("m_bCheckedForModelParts Got model parts from DLCskin for skin %X\n",m_dwSkinId); m_ppAdditionalModelParts=app.SetAdditionalSkinBoxes(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); From e5504399ca856e68e80edcae87e4cfa6ccb740f8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:18:22 +1100 Subject: [PATCH 157/192] Use fixed-width texture channel casts --- Minecraft.Client/Textures/Texture.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Textures/Texture.cpp b/Minecraft.Client/Textures/Texture.cpp index 7b568f402..098642d83 100644 --- a/Minecraft.Client/Textures/Texture.cpp +++ b/Minecraft.Client/Textures/Texture.cpp @@ -224,10 +224,10 @@ void Texture::fill(const Rect2i *rect, int color) int line = y * width * 4; for (int x = myRect->getX(); x < (myRect->getX() + myRect->getWidth()); x++) { - data[0]->put(line + x * 4 + 0, (BYTE)((color >> 24) & 0x000000ff)); - data[0]->put(line + x * 4 + 1, (BYTE)((color >> 16) & 0x000000ff)); - data[0]->put(line + x * 4 + 2, (BYTE)((color >> 8) & 0x000000ff)); - data[0]->put(line + x * 4 + 3, (BYTE)((color >> 0) & 0x000000ff)); + data[0]->put(line + x * 4 + 0, static_cast((color >> 24) & 0x000000ff)); + data[0]->put(line + x * 4 + 1, static_cast((color >> 16) & 0x000000ff)); + data[0]->put(line + x * 4 + 2, static_cast((color >> 8) & 0x000000ff)); + data[0]->put(line + x * 4 + 3, static_cast((color >> 0) & 0x000000ff)); } } delete myRect; From 9c9fff73669bb99d6d31c5c7f119517dfe9d12ca Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:20:05 +1100 Subject: [PATCH 158/192] Use standard message option arrays in network flows --- .../Common/Network/GameNetworkManager.cpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp index 1c129576c..84cdf7740 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp @@ -705,7 +705,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin int npAvailability = ProfileManager.getNPAvailability(iPad); if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); @@ -749,7 +749,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin } else if(noPrivileges) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } @@ -924,7 +924,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) } else { - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CGameNetworkManager::MustSignInReturned_0,lpParam, app.GetStringTable()); @@ -1060,7 +1060,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) MinecraftServer *pServer = MinecraftServer::getInstance(); #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; if( g_NetworkManager.m_bLastDisconnectWasLostRoomOnly ) { @@ -1084,7 +1084,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) #elif defined(_XBOX_ONE) if( g_NetworkManager.m_bFullSessionMessageOnNextSessionChange ) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); @@ -1583,7 +1583,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) { // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable()); } @@ -1592,14 +1592,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * // Signed in to PSN but not connected (no internet access) assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive)); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable()); } else { // Not signed in to PSN - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPadNotSignedInLive, &CGameNetworkManager::MustSignInReturned_1, (void *)pInviteInfo, app.GetStringTable(), NULL, 0, false); } @@ -1633,14 +1633,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * // if (ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) // { // // Signed in to PSN but not connected (no internet access) -// UINT uiIDA[1]; +// unsigned int uiIDA[1]; // uiIDA[0] = IDS_OK; // ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable()); // } // else { // Not signed in to PSN - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &CGameNetworkManager::MustSignInReturned_1, (void *)pInviteInfo, app.GetStringTable(), NULL, 0, false); } @@ -1684,7 +1684,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * #if defined(_XBOX) || defined(__PS3__) if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad()) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; // 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard @@ -1711,7 +1711,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * #endif else if(noPrivileges) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; // 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard @@ -1740,7 +1740,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * } else { - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CGameNetworkManager::MustSignInReturned_1,(void *)pInviteInfo, app.GetStringTable()); @@ -1806,7 +1806,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I if(noPrivileges) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } From 4b5ca6d4960addfff2d6e7d16427a18f61ad85f5 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:24:51 +1100 Subject: [PATCH 159/192] Use standard colour table lengths in texture packs --- .../Textures/Packs/AbstractTexturePack.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 1ca33c9af..3605c4254 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -4,6 +4,8 @@ #include "../../../Minecraft.World/IO/Streams/InputOutputStream.h" #include "../../../Minecraft.World/Util/StringHelpers.h" +#include + AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name) { // 4J init @@ -257,14 +259,22 @@ void AbstractTexturePack::loadDefaultColourTable() if(coloursFile.exists()) { - DWORD dwLength = coloursFile.length(); - byteArray data(dwLength); + const __int64 colourTableLength = coloursFile.length(); + if(colourTableLength < 0 || colourTableLength > static_cast<__int64>(std::numeric_limits::max())) + { + app.DebugPrintf("Failed to load the default colours table\n"); + app.FatalLoadError(); + return; + } + + const unsigned int dataLength = static_cast(colourTableLength); + byteArray data(dataLength); FileInputStream fis(coloursFile); - fis.read(data,0,dwLength); + fis.read(data,0,dataLength); fis.close(); if(m_colourTable != NULL) delete m_colourTable; - m_colourTable = new ColourTable(data.data, dwLength); + m_colourTable = new ColourTable(data.data, dataLength); delete [] data.data; } From c0f890b3236c1e9da892fb444bd5884d76888e66 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:27:59 +1100 Subject: [PATCH 160/192] Use fixed-width casts in skin bitmask macros --- Minecraft.Client/Platform/Common/Minecraft_Macros.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Minecraft_Macros.h b/Minecraft.Client/Platform/Common/Minecraft_Macros.h index 4f1f096a4..1c5b83e76 100644 --- a/Minecraft.Client/Platform/Common/Minecraft_Macros.h +++ b/Minecraft.Client/Platform/Common/Minecraft_Macros.h @@ -1,6 +1,8 @@ #pragma once +#include + // 3 bit user index // 5 bits alpha // 1 bit decoration @@ -35,8 +37,8 @@ #define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) ( (bDlcSkin?0x80000000:0) | (dwSkinId & 0x7FFFFFFF) ) #define IS_SKIN_ID_IN_RANGE(dwSkinId) (dwSkinId <= 0x7FFFFFFF) -#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x7FFFFFFF) -#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x7FFFFFE0) -#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x0000001F) -#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((((DWORD)uiBitmask)&0x80000000)?true:false) +#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast(uiBitmask) & 0x7FFFFFFF) +#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast(uiBitmask) & 0x7FFFFFE0) +#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast(uiBitmask) & 0x0000001F) +#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((static_cast(uiBitmask) & 0x80000000) ? true : false) From a3ea98d3ad8f41a0368046491669705603486151 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:04:11 +1100 Subject: [PATCH 161/192] Use standard types in server implementation --- Minecraft.Client/MinecraftServer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index bee3bbbca..a666de551 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -262,7 +262,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, st // 4J delete passed in save data now - this is only required for the tutorial which is loaded by passing data directly in rather than using the storage manager if( initData->saveData ) { - delete[] (BYTE*)initData->saveData->data; + delete[] reinterpret_cast(initData->saveData->data); initData->saveData->data = 0; initData->saveData->fileSize = 0; } @@ -349,7 +349,7 @@ void MinecraftServer::addPostProcessRequest(ChunkSource *chunkSource, int x, int void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress) { - DWORD status = 0; + std::uint32_t status = 0; EnterCriticalSection(&server->m_postProcessCS); size_t postProcessItemCount = server->m_postProcessRequests.size(); @@ -541,7 +541,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws FileEntry *fe = csf->createFile(filepath); ba_gameRules.length = fe->getFileSize(); - ba_gameRules.data = new BYTE[ ba_gameRules.length ]; + ba_gameRules.data = new std::uint8_t[ ba_gameRules.length ]; csf->setFilePointer(fe, 0, SaveFileSeekOrigin::Begin); csf->readFile(fe, ba_gameRules.data, ba_gameRules.length, &numberOfBytesRead); @@ -1194,7 +1194,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) // Process delayed actions eXuiServerAction eAction; - LPVOID param; + void *param; for(int i=0;i Date: Wed, 11 Mar 2026 07:06:48 +1100 Subject: [PATCH 162/192] Use standard types in minecraft state --- Minecraft.Client/Minecraft.cpp | 22 +++++++++++----------- Minecraft.Client/Minecraft.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 80c75bad5..e697ca8c7 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1415,7 +1415,7 @@ void Minecraft::run_middle() } else { - UINT uiIDA[1] = { IDS_OK }; + unsigned int uiIDA[1] = { IDS_OK }; ui.RequestMessageBox( IDS_CANTJOIN_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, i, NULL, NULL, app.GetStringTable() ); } } @@ -1610,14 +1610,14 @@ void Minecraft::run_middle() // Check if PSN is unavailable because of age restriction if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, i, NULL, NULL, app.GetStringTable()); } else if (ProfileManager.IsSignedIn(i) && !ProfileManager.IsSignedInLive(i)) { // You're not signed in to PSN! - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1] = IDS_CANCEL; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, i,&Minecraft::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false); @@ -1625,7 +1625,7 @@ void Minecraft::run_middle() else #endif { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, i, NULL, NULL, app.GetStringTable()); } @@ -3880,7 +3880,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, std::shar // The level renderer needs to have it's stored level set to NULL so that it doesn't break next time we set one if (levelRenderer != NULL) { - for(DWORD p = 0; p < XUSER_MAX_COUNT; ++p) + for(unsigned int p = 0; p < XUSER_MAX_COUNT; ++p) { levelRenderer->setLevel(p, NULL); } @@ -4211,7 +4211,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) } // Set the animation override if the skin has one - DWORD dwSkinID=app.getSkinIdFromPath(player->customTextureUrl); + std::uint32_t dwSkinID = app.getSkinIdFromPath(player->customTextureUrl); if(GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID)) { player->setAnimOverrideBitmask(player->getSkinAnimOverrideBitmask(dwSkinID)); @@ -4689,7 +4689,7 @@ void Minecraft::playerLeftTutorial(int iPad) // 4J Stu -This telemetry event means something different on XboxOne, so we don't call it for simple state changes like this #ifndef _XBOX_ONE - for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx) + for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if(localplayers[idx] != NULL) { @@ -4701,7 +4701,7 @@ void Minecraft::playerLeftTutorial(int iPad) } #ifdef _DURANGO -void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad) +void Minecraft::inGameSignInCheckAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad) { Minecraft* pClass = (Minecraft*)lpParam; @@ -4713,7 +4713,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP { if( !g_NetworkManager.SessionHasSpace() ) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_OK; ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); ProfileManager.RemoveGamepadFromGame(iPad); @@ -4770,7 +4770,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) #endif if( !g_NetworkManager.SessionHasSpace() ) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_OK; ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); #ifdef _DURANGO @@ -4814,7 +4814,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) // 4J Stu - Don't allow converting to guests as we don't allow any guest sign-in while in the game // Fix for #66516 - TCR #124: MPS Guest Support ; #001: BAS Game Stability: TU8: The game crashes when second Guest signs-in on console which takes part in Xbox LIVE multiplayer session. //ProfileManager.RequestConvertOfflineToGuestUI( &Minecraft::InGame_SignInReturned, pMinecraftClass,iPad); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,iPad,NULL,NULL, app.GetStringTable()); #ifdef _DURANGO diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 0d071fa3f..c4208406f 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -305,7 +305,7 @@ public: static __int64 currentTimeMillis(); #ifdef _DURANGO - static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad); + static void inGameSignInCheckAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad); #endif static int InGame_SignInReturned(void *pParam,bool bContinue, int iPad); // 4J-PB @@ -317,7 +317,7 @@ public: CRITICAL_SECTION m_setLevelCS; private: // A bit field that store whether a particular quadrant is in the full tutorial or not - BYTE m_inFullTutorialBits; + std::uint8_t m_inFullTutorialBits; public: bool isTutorial(); void playerStartedTutorial(int iPad); From 2b5574af95d29d0a489a7d3362ed5e1324bb4177 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:14:06 +1100 Subject: [PATCH 163/192] Use standard types in client connection state --- Minecraft.Client/Network/ClientConnection.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 0346a6b87..6c5040452 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -197,8 +197,8 @@ void ClientConnection::handleLogin(std::shared_ptr packet) if(iUserID!=-1) { - BYTE *pBuffer=NULL; - DWORD dwSize=0; + std::uint8_t *pBuffer = NULL; + unsigned int dwSize = 0; bool bRes; // if there's a special skin or cloak for this player, add it in @@ -1659,9 +1659,9 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) if( playerXuid != INVALID_XUID ) { // Is this user friends with the host player? - BOOL result; + int result = 0; const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); - if(error == ERROR_SUCCESS && result != TRUE) + if(error == ERROR_SUCCESS && result == 0) { canPlay = false; isFriendsWithHost = false; @@ -1688,9 +1688,9 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) if( playerXuid != INVALID_XUID ) { // Is this user friends with the host player? - BOOL result; + int result = 0; const unsigned int error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); - if(error == ERROR_SUCCESS && result != TRUE) + if(error == ERROR_SUCCESS && result == 0) { canPlay = false; isFriendsWithHost = false; @@ -1735,13 +1735,13 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) // Local players are implied friends if(!isAtLeastOneFriend) { - BOOL result; + int result = 0; for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); - if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = true; + if(error == ERROR_SUCCESS && result != 0) isAtLeastOneFriend = true; } } } @@ -1762,13 +1762,13 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) bool thisQuadrantOnly = true; if( m_userIndex == ProfileManager.GetPrimaryPad() ) thisQuadrantOnly = false; - BOOL result; + int result = 0; for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); - if(error == ERROR_SUCCESS) canPlay &= (result == TRUE); + if(error == ERROR_SUCCESS) canPlay &= (result != 0); } if(!canPlay) break; } @@ -2052,11 +2052,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) // All other players we use their offline XUID so that they can play the game offline ProfileManager.GetXUID(m_userIndex,&offlineXUID,false); } - BOOL allAllowed, friendsAllowed; + bool allAllowed = false; + bool friendsAllowed = false; ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed); fprintf(stderr, "[LOGIN] Sending LoginPacket: user=%ls netVer=%d userIdx=%d isHost=%d\n", minecraft->user->name.c_str(), SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex, (int)g_NetworkManager.IsHost()); - send( std::shared_ptr( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE), + send( std::shared_ptr( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (!allAllowed && friendsAllowed), packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex )))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); From e055d8d121395ba67978840bccb3163ad114a4d3 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:16:54 +1100 Subject: [PATCH 164/192] Use standard types in stats state --- Minecraft.Client/GameState/StatsCounter.cpp | 16 ++++++++-------- Minecraft.Client/GameState/StatsCounter.h | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index ab4895a2b..a68e2a46c 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -142,9 +142,9 @@ void StatsCounter::parse(void* data) assert( stats.size() == 0 ); //Pointer to current position in stat array - PBYTE pbData=(PBYTE)data; - pbData+=sizeof(GAME_SETTINGS); - unsigned short* statData = (unsigned short*)pbData;//data + (STAT_DATA_OFFSET/sizeof(unsigned short)); + std::uint8_t* pbData = reinterpret_cast(data); + pbData += sizeof(GAME_SETTINGS); + unsigned short* statData = reinterpret_cast(pbData);//data + (STAT_DATA_OFFSET/sizeof(unsigned short)); //Value being read StatContainer newVal; @@ -215,15 +215,15 @@ void StatsCounter::save(int player, bool force) //Retrieve the data pointer from the profile #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) - PBYTE pbData = (PBYTE)StorageManager.GetGameDefinedProfileData(player); + std::uint8_t* pbData = reinterpret_cast(StorageManager.GetGameDefinedProfileData(player)); #else - PBYTE pbData = (PBYTE)ProfileManager.GetGameDefinedProfileData(player); + std::uint8_t* pbData = reinterpret_cast(ProfileManager.GetGameDefinedProfileData(player)); #endif - pbData+=sizeof(GAME_SETTINGS); + pbData += sizeof(GAME_SETTINGS); //Pointer to current position in stat array //unsigned short* statData = (unsigned short*)data + (STAT_DATA_OFFSET/sizeof(unsigned short)); - unsigned short* statData = (unsigned short*)pbData; + unsigned short* statData = reinterpret_cast(pbData); //Reset all the data to 0 (we're going to replace it with the map data) memset(statData, 0, CConsoleMinecraftApp::GAME_DEFINED_PROFILE_DATA_BYTES-sizeof(GAME_SETTINGS)); @@ -283,7 +283,7 @@ void StatsCounter::save(int player, bool force) } #ifdef _XBOX -void StatsCounter::setLeaderboardProperty(XUSER_PROPERTY* prop, DWORD id, unsigned int value) +void StatsCounter::setLeaderboardProperty(XUSER_PROPERTY* prop, std::uint32_t id, unsigned int value) { app.DebugPrintf("Setting property id: %d to value %d\n", id, value); prop->dwPropertyId = id; diff --git a/Minecraft.Client/GameState/StatsCounter.h b/Minecraft.Client/GameState/StatsCounter.h index 4963d3ab8..55298ae01 100644 --- a/Minecraft.Client/GameState/StatsCounter.h +++ b/Minecraft.Client/GameState/StatsCounter.h @@ -1,4 +1,5 @@ #pragma once +#include class Stat; class Achievement; class StatsSyncher; @@ -95,7 +96,7 @@ private: void dumpStatsToTTY(); #ifdef _XBOX - static void setLeaderboardProperty(XUSER_PROPERTY* prop, DWORD id, unsigned int value); + static void setLeaderboardProperty(XUSER_PROPERTY* prop, std::uint32_t id, unsigned int value); static void setLeaderboardRating(XUSER_PROPERTY* prop, LONGLONG value); #endif From 2975a43ad274fc813cbd6f13624fff652719117d Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:18:31 +1100 Subject: [PATCH 165/192] Use standard RTT types in server player --- Minecraft.Client/Player/ServerPlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index d7eae5841..09fb8f3fd 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -1491,7 +1491,7 @@ int ServerPlayer::getPlayerViewDistanceModifier() if( player != NULL ) { - DWORD rtt = player->GetCurrentRtt(); + int rtt = player->GetCurrentRtt(); value = rtt >> 6; From 36b0e1efbfdeaf6087d36ac2850d0768a33086f4 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:22:05 +1100 Subject: [PATCH 166/192] Use bool for system music state --- Minecraft.Client/Platform/Common/Audio/SoundEngine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/Platform/Common/Audio/SoundEngine.h b/Minecraft.Client/Platform/Common/Audio/SoundEngine.h index be31c662c..e45572461 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Platform/Common/Audio/SoundEngine.h @@ -146,7 +146,7 @@ private: int m_MusicType; AUDIO_INFO m_StreamingAudioInfo; std::wstring m_CDMusic; - BOOL m_bSystemMusicPlaying; + bool m_bSystemMusicPlaying; float m_MasterMusicVolume; float m_MasterEffectsVolume; From fa90fa45e74f02e0456df7d508061770980f827b Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:22:20 +1100 Subject: [PATCH 167/192] Remove unused Win32 timestamp from tutorial messages --- Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h index 2a5bb1def..dbc399819 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h @@ -10,7 +10,6 @@ private: bool limitRepeats; unsigned char numRepeats; unsigned char timesShown; - DWORD lastDisplayed; public: TutorialMessage(int messageId, bool limitRepeats = false, unsigned char numRepeats = TUTORIAL_MESSAGE_DEFAULT_SHOW); From 1265358aecf8f69f09c73c86d17b83c5ef8fc12e Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:24:21 +1100 Subject: [PATCH 168/192] Use standard dialog ID arrays in common UI --- .../Platform/Common/UI/UIScene_ConnectingProgress.cpp | 2 +- .../Platform/Common/UI/UIScene_FullscreenProgress.cpp | 2 +- .../Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp | 2 +- .../Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIScene_SettingsMenu.cpp | 2 +- Minecraft.Client/Platform/Common/UI/UIScene_TrialExitUpsell.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp index e01b99f9b..a09011fb8 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp @@ -186,7 +186,7 @@ void UIScene_ConnectingProgress::handleTimerComplete(int id) } else { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); exitReasonStringId = -1; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp index c76912076..3f4cc5d6e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp @@ -189,7 +189,7 @@ void UIScene_FullscreenProgress::tick() pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );*/ //app.NavigateBack(m_CompletionData->iPad); - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_FAILED), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_SERVER), uiIDA,1, XUSER_INDEX_ANY,NULL,NULL, app.GetStringTable()); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index ddf5586cc..b13dda69f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -348,7 +348,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) { std::uint8_t *smallId = new std::uint8_t(); *smallId = m_networkSmallId; - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index a4b98d445..2961fccdd 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -226,7 +226,7 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, UIControl_CheckBox *checkboxOnline = &m_checkboxes[eLaunchCheckbox_Online]; if ( pressed && controlHasFocus( checkboxOnline->getId()) && !checkboxOnline->IsEnabled() ) { - UINT uiIDA[1] = { IDS_CONFIRM_OK }; + unsigned int uiIDA[1] = { IDS_CONFIRM_OK }; ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); } } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp index 6974e1eae..b60e3288b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp @@ -156,7 +156,7 @@ void UIScene_SaveMessage::handleTimerComplete(int id) app.SetOptionsCallbackStatus(0,C4JStorage::eOptions_Callback_Read_CorruptDeletePending); m_bIgnoreInput=false; // give the option to delete the save - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_CORRUPT_FILE, IDS_CORRUPT_OPTIONS, uiIDA, 1, 0,&UIScene_SaveMessage::DeleteOptionsDialogReturned,this, app.GetStringTable()); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsMenu.cpp index edd011d96..64ac27c5c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsMenu.cpp @@ -138,7 +138,7 @@ void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId) case BUTTON_ALL_RESETTODEFAULTS: { // check they really want to do this - UINT uiIDA[2]; + unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_TrialExitUpsell.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_TrialExitUpsell.cpp index 12ff9020c..272933921 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_TrialExitUpsell.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_TrialExitUpsell.cpp @@ -53,7 +53,7 @@ void UIScene_TrialExitUpsell::handleInput(int iPad, int key, bool repeat, bool p ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { - UINT uiIDA[1]; + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this, app.GetStringTable()); } From 52eb80c3eb0feb6e70bb12f21701bd863574d7e2 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:24:51 +1100 Subject: [PATCH 169/192] Use fixed-width tick counts in tutorial timing --- Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp index 28cac32c2..9f07fa9c8 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp @@ -1634,7 +1634,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) bool hintsOn = m_isFullTutorial || (app.GetGameSettings(m_iPad,eGameSetting_Hints) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)); bool messageShown = false; - DWORD time = GetTickCount(); + std::uint32_t time = GetTickCount(); if(message != NULL && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ( From 9d41d3c35956ee7a3c73b16bfc12b80f6b786292 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:27:46 +1100 Subject: [PATCH 170/192] Use fixed-width byte values in world data --- Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp | 6 +++--- Minecraft.World/Entities/Mob.cpp | 2 +- Minecraft.World/Network/Packets/TileUpdatePacket.cpp | 4 ++-- Minecraft.World/WorldGen/Biomes/DesertBiome.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp index c28e1a903..68b589787 100644 --- a/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/SkullTileEntity.cpp @@ -13,8 +13,8 @@ SkullTileEntity::SkullTileEntity() void SkullTileEntity::save(CompoundTag *tag) { TileEntity::save(tag); - tag->putByte(L"SkullType", (BYTE) (skullType & 0xff)); - tag->putByte(L"Rot", (BYTE) (rotation & 0xff)); + tag->putByte(L"SkullType", static_cast(skullType & 0xff)); + tag->putByte(L"Rot", static_cast(rotation & 0xff)); tag->putString(L"ExtraType", extraType); } @@ -69,4 +69,4 @@ std::shared_ptr SkullTileEntity::clone() result->rotation = rotation; result->extraType = extraType; return result; -} \ No newline at end of file +} diff --git a/Minecraft.World/Entities/Mob.cpp b/Minecraft.World/Entities/Mob.cpp index 4b64f0363..44e733151 100644 --- a/Minecraft.World/Entities/Mob.cpp +++ b/Minecraft.World/Entities/Mob.cpp @@ -1097,7 +1097,7 @@ void Mob::addAdditonalSaveData(CompoundTag *entityTag) MobEffectInstance *effect = it->second; CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Id", (BYTE) effect->getId()); + tag->putByte(L"Id", static_cast(effect->getId())); tag->putByte(L"Amplifier", (char) effect->getAmplifier()); tag->putInt(L"Duration", effect->getDuration()); listTag->add(tag); diff --git a/Minecraft.World/Network/Packets/TileUpdatePacket.cpp b/Minecraft.World/Network/Packets/TileUpdatePacket.cpp index 6c94d0e2b..563461500 100644 --- a/Minecraft.World/Network/Packets/TileUpdatePacket.cpp +++ b/Minecraft.World/Network/Packets/TileUpdatePacket.cpp @@ -33,7 +33,7 @@ void TileUpdatePacket::read(DataInputStream *dis) //throws IOException block = (int)dis->readShort() & 0xffff; - BYTE dataLevel = dis->readByte(); + std::uint8_t dataLevel = dis->readByte(); data = dataLevel & 0xf; levelIdx = (dataLevel>>4) & 0xf; #else @@ -61,7 +61,7 @@ void TileUpdatePacket::write(DataOutputStream *dos) //throws IOException dos->writeInt(z); dos->writeShort(block); - BYTE dataLevel = ((levelIdx & 0xf ) << 4) | (data & 0xf); + std::uint8_t dataLevel = ((levelIdx & 0xf ) << 4) | (data & 0xf); dos->writeByte(dataLevel); #else // 4J - for our fixed size map, we can pack x & z into 10 bits each (-512 -> 511), y into 8 bits (0 to 255) diff --git a/Minecraft.World/WorldGen/Biomes/DesertBiome.cpp b/Minecraft.World/WorldGen/Biomes/DesertBiome.cpp index 09947db05..198d44406 100644 --- a/Minecraft.World/WorldGen/Biomes/DesertBiome.cpp +++ b/Minecraft.World/WorldGen/Biomes/DesertBiome.cpp @@ -10,8 +10,8 @@ DesertBiome::DesertBiome(int id) : Biome(id) friendlies.clear(); friendlies_chicken.clear(); // 4J added friendlies_wolf.clear(); // 4J added - this->topMaterial = (BYTE) Tile::sand_Id; - this->material = (BYTE) Tile::sand_Id; + this->topMaterial = static_cast(Tile::sand_Id); + this->material = static_cast(Tile::sand_Id); decorator->treeCount = -999; decorator->deadBushCount = 2; @@ -30,4 +30,4 @@ void DesertBiome::decorate(Level *level, Random *random, int xo, int zo) Feature *well = new DesertWellFeature(); well->place(level, random, x, level->getHeightmap(x, z) + 1, z); } -} \ No newline at end of file +} From 1bf50e2549aa04fc08fcb1e443a72571945f35a9 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:27:53 +1100 Subject: [PATCH 171/192] Use fixed-width language IDs in sign rendering --- Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp index 9b8d5aa80..d49f23f17 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp @@ -63,7 +63,7 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, std::wstring msg; // need to send the new data // Get the current language setting from the console - DWORD dwLanguage = XGetLanguage( ); + std::uint32_t dwLanguage = XGetLanguage( ); for (int i = 0; i < MAX_SIGN_LINES; i++) // 4J - was sign.messages.length { From d48bd03722349fca4bac50dbdf544526fe0759dd Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:28:03 +1100 Subject: [PATCH 172/192] Use standard byte pointers in decompression helpers --- Minecraft.World/IO/Streams/Compression.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Minecraft.World/IO/Streams/Compression.cpp b/Minecraft.World/IO/Streams/Compression.cpp index 2f0947191..899aae280 100644 --- a/Minecraft.World/IO/Streams/Compression.cpp +++ b/Minecraft.World/IO/Streams/Compression.cpp @@ -426,8 +426,8 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS if (pDestination != NULL) { // Read big-endian srcize from array - PBYTE pbDestSize = (PBYTE) pDestSize; - PBYTE pbSource = (PBYTE) pSource; + std::uint8_t* pbDestSize = reinterpret_cast(pDestSize); + std::uint8_t* pbSource = reinterpret_cast(pSource); for (int i = 3; i >= 0; i--) { pbDestSize[3-i] = pbSource[i]; } @@ -442,7 +442,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS strm.next_out = uncompr.data; strm.avail_out = uncompr.length; // Skip those first 4 bytes - strm.next_in = (PBYTE) pSource + 4; + strm.next_in = reinterpret_cast(pSource) + 4; strm.avail_in = SrcSize - 4; int hr = inflateInit2(&strm, -15); @@ -549,4 +549,3 @@ void Compression::SetDecompressionType(ESavePlatform platform) /*Compression gCompression;*/ - From e5d5fb07bef8fa3fb79a15ebe97104b8104f2f19 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:30:28 +1100 Subject: [PATCH 173/192] Use standard sizes in texture pack locators --- .../Textures/Packs/AbstractTexturePack.cpp | 18 +++++++++--------- .../Textures/Packs/DLCTexturePack.cpp | 10 +++++----- .../Textures/Packs/DefaultTexturePack.cpp | 4 ++-- .../Textures/Packs/FolderTexturePack.cpp | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 3605c4254..f2c92fa20 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -40,13 +40,13 @@ void AbstractTexturePack::loadIcon() { #ifdef _XBOX // 4J Stu - Temporary only - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); - UINT size = 0; + unsigned int size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size); m_iconSize = static_cast(size); #endif @@ -56,13 +56,13 @@ void AbstractTexturePack::loadComparison() { #ifdef _XBOX // 4J Stu - Temporary only - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png"); - UINT size = 0; + unsigned int size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_comparisonData, &size); m_comparisonSize = static_cast(size); #endif @@ -232,7 +232,7 @@ void AbstractTexturePack::loadDefaultUI() const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); // Load new skin - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur"); @@ -291,13 +291,13 @@ void AbstractTexturePack::loadDefaultHTMLColourTable() // load from the .xzp file const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; // Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/HTMLColours.col"); - BYTE *data; - UINT dataLength; + std::uint8_t *data; + unsigned int dataLength; if(XuiResourceLoadAll(szResourceLocator, &data, &dataLength) == S_OK) { m_colourTable->loadColoursFromData(data,dataLength); @@ -376,7 +376,7 @@ std::wstring AbstractTexturePack::getXuiRootPath() const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); // Load new skin - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index fed7cbf75..c68e11384 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -225,13 +225,13 @@ void DLCTexturePack::loadColourTable() std::uint32_t dwSize = 0; std::uint8_t *pbData = dataFile->getData(dwSize); - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; // Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#HTMLColours.col",pbData, dwSize); - BYTE *data; - UINT dataLength; + std::uint8_t *data; + unsigned int dataLength; if(XuiResourceLoadAll(szResourceLocator, &data, &dataLength) == S_OK) { m_colourTable->loadColoursFromData(data,dataLength); @@ -483,7 +483,7 @@ void DLCTexturePack::loadUI() std::uint32_t dwSize = 0; std::uint8_t *pbData = dataFile->getData(dwSize); - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#skin_Minecraft.xur",pbData, dwSize); @@ -557,7 +557,7 @@ std::wstring DLCTexturePack::getXuiRootPath() std::uint32_t dwSize = 0; std::uint8_t *pbData = dataFile->getData(dwSize); - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#",pbData, dwSize); path = szResourceLocator; diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp index 7f49ed7cd..08a4064ce 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp @@ -17,13 +17,13 @@ void DefaultTexturePack::loadIcon() { #ifdef _XBOX // 4J Stu - Temporary only - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); - UINT size = 0; + unsigned int size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size); m_iconSize = size; #else diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp index 39bdd88ec..da6a514a4 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp @@ -79,7 +79,7 @@ void FolderTexturePack::loadUI() // Load new skin if(hasFile(L"TexturePack.xzp")) { - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str()); From ee7945ea5459cb739afbe466a0d3daa462dd68d4 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:32:55 +1100 Subject: [PATCH 174/192] Use standard locals in storage and connection --- Minecraft.World/Level/Storage/McRegionLevelStorage.cpp | 4 ++-- Minecraft.World/Network/Connection.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp index 5dcea66cc..336b2f372 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp @@ -33,7 +33,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) std::vector *netherFiles = m_saveFile->getRegionFilesByDimension(1); if(netherFiles!=NULL) { - DWORD bytesWritten = 0; + unsigned int bytesWritten = 0; for(AUTO_VAR(it, netherFiles->begin()); it != netherFiles->end(); ++it) { m_saveFile->zeroFile(*it, (*it)->getFileSize(), &bytesWritten); @@ -100,4 +100,4 @@ void McRegionLevelStorage::saveLevelData(LevelData *levelData, std::vectorrunning || waitResult == 0 ) && ShutdownManager::ShouldRun(ShutdownManager::eConnectionWriteThreads)) { From 6185c5820399a9dd871a123938c78de3a8b8ceb8 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:33:13 +1100 Subject: [PATCH 175/192] Use standard callback pointers in sign verification --- Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp index 6f410f059..71971e540 100644 --- a/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/SignTileEntity.cpp @@ -36,7 +36,7 @@ SignTileEntity::~SignTileEntity() { // TODO ORBIS_STUBBED; #ifndef __ORBIS__ - // 4J-PB - we don't need to verify strings anymore - InputManager.CancelQueuedVerifyStrings(&SignTileEntity::StringVerifyCallback,(LPVOID)this); + // 4J-PB - we don't need to verify strings anymore - InputManager.CancelQueuedVerifyStrings(&SignTileEntity::StringVerifyCallback, this); #endif } @@ -129,7 +129,7 @@ void SignTileEntity::setChanged() m_bVerified=true; #else - if(!InputManager.VerifyStrings((WCHAR**)&wcMessages,MAX_SIGN_LINES,&SignTileEntity::StringVerifyCallback,(LPVOID)this)) + if(!InputManager.VerifyStrings((WCHAR**)&wcMessages,MAX_SIGN_LINES,&SignTileEntity::StringVerifyCallback, this)) { // Nothing to verify m_bVerified=true; From e18941ced74a497a8136035c59537d5f7b764e79 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:33:23 +1100 Subject: [PATCH 176/192] Use fixed-width pixel data in stitched textures --- Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index 9b55f0132..b07bc5db8 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -178,7 +178,7 @@ void PreStitchedTextureMap::stitch() #ifdef __PSVITA__ // AP - alpha cut out is expensive on vita so we mark which icons actually require it - DWORD *data = (DWORD*) this->getStitchedTexture()->getData()->getBuffer(); + std::uint32_t *data = reinterpret_cast(this->getStitchedTexture()->getData()->getBuffer()); int Width = this->getStitchedTexture()->getWidth(); int Height = this->getStitchedTexture()->getHeight(); for(AUTO_VAR(it, texturesByName.begin()); it != texturesByName.end(); ++it) From c2b3537c62241f72fb996f1fa9bc00c699269ce6 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:33:30 +1100 Subject: [PATCH 177/192] Remove dead Win32 error state from compressed storage --- Minecraft.World/Level/Storage/CompressedTileStorage.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Minecraft.World/Level/Storage/CompressedTileStorage.cpp b/Minecraft.World/Level/Storage/CompressedTileStorage.cpp index 5c41f9114..473316e7a 100644 --- a/Minecraft.World/Level/Storage/CompressedTileStorage.cpp +++ b/Minecraft.World/Level/Storage/CompressedTileStorage.cpp @@ -1051,7 +1051,6 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) unsigned char *newIndicesAndData = (unsigned char *)XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE);//(unsigned char *)malloc( memToAlloc ); if( newIndicesAndData == NULL ) { - DWORD lastError = GetLastError(); #ifndef _DURANGO MEMORYSTATUS memStatus; GlobalMemoryStatus(&memStatus); @@ -1358,4 +1357,4 @@ void CompressedTileStorage::reverseIndices(unsigned char *indices) { System::ReverseUSHORT(&blockIndices[i]); } -} \ No newline at end of file +} From b2942ea9d8b29919fc6a9d420a02888784827a92 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:36:13 +1100 Subject: [PATCH 178/192] Use platform TLS keys in level state --- Minecraft.World/Level/Level.cpp | 48 +++++++++++++++++++++++++++++---- Minecraft.World/Level/Level.h | 8 ++++++ 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/Minecraft.World/Level/Level.cpp b/Minecraft.World/Level/Level.cpp index c09680f92..ba550a66d 100644 --- a/Minecraft.World/Level/Level.cpp +++ b/Minecraft.World/Level/Level.cpp @@ -41,10 +41,48 @@ #include "../../Minecraft.Client/Textures/Packs/DLCTexturePack.h" #include "../../Minecraft.Client/Platform/Common/DLC/DLCPack.h" #include "../../Minecraft.Client/Platform/PS3/PS3Extras/ShutdownManager.h" +#include +namespace +{ +#if defined(_WIN32) + inline void *LevelTlsGetValue(DWORD key) + { + return TlsGetValue(key); + } + + inline void LevelTlsSetValue(DWORD key, void *value) + { + TlsSetValue(key, value); + } +#else + pthread_key_t CreateLevelTlsKey() + { + pthread_key_t key; + pthread_key_create(&key, NULL); + return key; + } + + inline void *LevelTlsGetValue(pthread_key_t key) + { + return pthread_getspecific(key); + } + + inline void LevelTlsSetValue(pthread_key_t key, void *value) + { + pthread_setspecific(key, value); + } +#endif +} + +#if defined(_WIN32) DWORD Level::tlsIdx = TlsAlloc(); DWORD Level::tlsIdxLightCache = TlsAlloc(); +#else +pthread_key_t Level::tlsIdx = CreateLevelTlsKey(); +pthread_key_t Level::tlsIdxLightCache = CreateLevelTlsKey(); +#endif // 4J : WESTY : Added for time played stats. #include "../Headers/net.minecraft.stats.h" @@ -94,12 +132,12 @@ void Level::enableLightingCache() { // Allocate 16K (needs 32K for large worlds) for a 16x16x16x4 byte cache of results, plus 128K required for toCheck array. Rounding up to 256 to keep as multiple of alignement - aligning to 128K boundary for possible cache locking. void *cache = (unsigned char *)XPhysicalAlloc(256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES); - TlsSetValue(tlsIdxLightCache,cache); + LevelTlsSetValue(tlsIdxLightCache, cache); } void Level::destroyLightingCache() { - lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache); + lightCache_t *cache = static_cast(LevelTlsGetValue(tlsIdxLightCache)); XPhysicalFree(cache); } @@ -458,14 +496,14 @@ void Level::flushCache(lightCache_t *cache, __uint64 cacheUse, LightLayer::varie // 4J - added following 2 functions to move instaBuild flag from being a class member, to TLS bool Level::getInstaTick() { - return ((size_t)TlsGetValue(tlsIdx)) != 0; + return reinterpret_cast(LevelTlsGetValue(tlsIdx)) != 0; } void Level::setInstaTick(bool enable) { void *value = 0; if( enable ) value = (void *)1; - TlsSetValue(tlsIdx,value); + LevelTlsSetValue(tlsIdx, value); } // 4J - added @@ -3386,7 +3424,7 @@ inline int GetIndex(int x, int y, int z) // 4J - Made changes here so that lighting goes through a cache, if enabled for this thread void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool force, bool rootOnlyEmissive) { - lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache); + lightCache_t *cache = static_cast(LevelTlsGetValue(tlsIdxLightCache)); __uint64 cacheUse = 0; if( force ) diff --git a/Minecraft.World/Level/Level.h b/Minecraft.World/Level/Level.h index 945341bfa..f6b60ec6f 100644 --- a/Minecraft.World/Level/Level.h +++ b/Minecraft.World/Level/Level.h @@ -9,6 +9,9 @@ #include "../Util/ParticleTypes.h" #include "../WorldGen/Biomes/Biome.h" #include "../Util/C4JThread.h" +#if !defined(_WIN32) +#include +#endif #ifdef __PSVITA__ #include "../../Minecraft.Client/Platform/PSVita/PSVitaExtras/CustomSet.h" @@ -77,8 +80,13 @@ public: int seaLevel; // 4J - added, making instaTick flag use TLS so we can set it in the chunk rebuilding thread without upsetting the main game thread +#if defined(_WIN32) static DWORD tlsIdx; static DWORD tlsIdxLightCache; +#else + static pthread_key_t tlsIdx; + static pthread_key_t tlsIdxLightCache; +#endif static void enableLightingCache(); static void destroyLightingCache(); static bool getCacheTestEnabled(); From 4e8d1c9e179d664c2c147df77d3b77a0c9aa2477 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:40:52 +1100 Subject: [PATCH 179/192] Use platform TLS keys in portal and piston state --- Minecraft.World/Blocks/PistonBaseTile.cpp | 41 ++++++++++++++++++++- Minecraft.World/Blocks/PistonBaseTile.h | 10 ++++- Minecraft.World/Blocks/TheEndPortalTile.cpp | 41 ++++++++++++++++++++- Minecraft.World/Blocks/TheEndPortalTile.h | 10 ++++- 4 files changed, 96 insertions(+), 6 deletions(-) diff --git a/Minecraft.World/Blocks/PistonBaseTile.cpp b/Minecraft.World/Blocks/PistonBaseTile.cpp index 786ee7069..cffdeb760 100644 --- a/Minecraft.World/Blocks/PistonBaseTile.cpp +++ b/Minecraft.World/Blocks/PistonBaseTile.cpp @@ -1,4 +1,5 @@ #include "../Platform/stdafx.h" +#include #include "PistonBaseTile.h" #include "PistonMovingTileEntity.h" #include "TileEntities/PistonPieceTileEntity.h" @@ -19,7 +20,43 @@ const std::wstring PistonBaseTile::INSIDE_TEX = L"piston_inner_top"; const float PistonBaseTile::PLATFORM_THICKNESS = 4.0f; +namespace +{ +#if defined(_WIN32) + inline void *PistonTlsGetValue(DWORD key) + { + return TlsGetValue(key); + } + + inline void PistonTlsSetValue(DWORD key, void *value) + { + TlsSetValue(key, value); + } +#else + pthread_key_t CreatePistonTlsKey() + { + pthread_key_t key; + pthread_key_create(&key, NULL); + return key; + } + + inline void *PistonTlsGetValue(pthread_key_t key) + { + return pthread_getspecific(key); + } + + inline void PistonTlsSetValue(pthread_key_t key, void *value) + { + pthread_setspecific(key, value); + } +#endif +} + +#if defined(_WIN32) DWORD PistonBaseTile::tlsIdx = TlsAlloc(); +#else +pthread_key_t PistonBaseTile::tlsIdx = CreatePistonTlsKey(); +#endif // 4J - NOTE - this ignoreUpdate stuff has been removed from the java version, but I'm not currently sure how the java version does without it... there must be // some other mechanism that we don't have that stops the event from one piston being processed, from causing neighbours to have extra events created for them. @@ -28,12 +65,12 @@ DWORD PistonBaseTile::tlsIdx = TlsAlloc(); // 4J - ignoreUpdate is a static in java, implementing as TLS here to make thread safe bool PistonBaseTile::ignoreUpdate() { - return (TlsGetValue(tlsIdx) != NULL); + return PistonTlsGetValue(tlsIdx) != NULL; } void PistonBaseTile::ignoreUpdate(bool set) { - TlsSetValue(tlsIdx,(LPVOID)(intptr_t)(set?1:0)); + PistonTlsSetValue(tlsIdx, reinterpret_cast(static_cast(set ? 1 : 0))); } PistonBaseTile::PistonBaseTile(int id, bool isSticky) : Tile(id, Material::piston, isSolidRender() ) diff --git a/Minecraft.World/Blocks/PistonBaseTile.h b/Minecraft.World/Blocks/PistonBaseTile.h index 9e5ca11e1..4e844a7e2 100644 --- a/Minecraft.World/Blocks/PistonBaseTile.h +++ b/Minecraft.World/Blocks/PistonBaseTile.h @@ -1,6 +1,10 @@ #pragma once #include "Tile.h" +#if !defined(_WIN32) +#include +#endif + class PistonBaseTile : public Tile { public: @@ -25,7 +29,11 @@ private: Icon *iconBack; Icon *iconPlatform; +#if defined(_WIN32) static DWORD tlsIdx; +#else + static pthread_key_t tlsIdx; +#endif // 4J - was just a static but implemented with TLS for our version static bool ignoreUpdate(); static void ignoreUpdate(bool set); @@ -68,4 +76,4 @@ private: static void stopSharingIfServer(Level *level, int x, int y, int z); // 4J added bool createPush(Level *level, int sx, int sy, int sz, int facing); -}; \ No newline at end of file +}; diff --git a/Minecraft.World/Blocks/TheEndPortalTile.cpp b/Minecraft.World/Blocks/TheEndPortalTile.cpp index 967acae3d..27928c0fc 100644 --- a/Minecraft.World/Blocks/TheEndPortalTile.cpp +++ b/Minecraft.World/Blocks/TheEndPortalTile.cpp @@ -7,18 +7,55 @@ #include "../Headers/net.minecraft.world.entity.h" #include "../Headers/net.minecraft.world.entity.player.h" #include "../Headers/net.minecraft.world.h" +#include +namespace +{ +#if defined(_WIN32) + inline void *TheEndPortalTlsGetValue(DWORD key) + { + return TlsGetValue(key); + } + + inline void TheEndPortalTlsSetValue(DWORD key, void *value) + { + TlsSetValue(key, value); + } +#else + pthread_key_t CreateTheEndPortalTlsKey() + { + pthread_key_t key; + pthread_key_create(&key, NULL); + return key; + } + + inline void *TheEndPortalTlsGetValue(pthread_key_t key) + { + return pthread_getspecific(key); + } + + inline void TheEndPortalTlsSetValue(pthread_key_t key, void *value) + { + pthread_setspecific(key, value); + } +#endif +} + +#if defined(_WIN32) DWORD TheEndPortal::tlsIdx = TlsAlloc(); +#else +pthread_key_t TheEndPortal::tlsIdx = CreateTheEndPortalTlsKey(); +#endif // 4J - allowAnywhere is a static in java, implementing as TLS here to make thread safe bool TheEndPortal::allowAnywhere() { - return (TlsGetValue(tlsIdx) != NULL); + return TheEndPortalTlsGetValue(tlsIdx) != NULL; } void TheEndPortal::allowAnywhere(bool set) { - TlsSetValue(tlsIdx,(LPVOID)(intptr_t)(set?1:0)); + TheEndPortalTlsSetValue(tlsIdx, reinterpret_cast(static_cast(set ? 1 : 0))); } TheEndPortal::TheEndPortal(int id, Material *material) : EntityTile(id, material, isSolidRender()) diff --git a/Minecraft.World/Blocks/TheEndPortalTile.h b/Minecraft.World/Blocks/TheEndPortalTile.h index b344ce796..130a4232b 100644 --- a/Minecraft.World/Blocks/TheEndPortalTile.h +++ b/Minecraft.World/Blocks/TheEndPortalTile.h @@ -1,10 +1,18 @@ #pragma once #include "TileEntities/EntityTile.h" +#if !defined(_WIN32) +#include +#endif + class TheEndPortal : public EntityTile { public: +#if defined(_WIN32) static DWORD tlsIdx; +#else + static pthread_key_t tlsIdx; +#endif // 4J - was just a static but implemented with TLS for our version static bool allowAnywhere(); static void allowAnywhere(bool set); @@ -24,4 +32,4 @@ public: virtual void onPlace(Level *level, int x, int y, int z); virtual int cloneTileId(Level *level, int x, int y, int z); void registerIcons(IconRegister *iconRegister); -}; \ No newline at end of file +}; From a08cb8d190a9e7de127d1e85db5be9146fa0dd0a Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:51:27 +1100 Subject: [PATCH 180/192] Use platform TLS keys for entity small IDs --- Minecraft.World/Blocks/Tile.cpp | 74 ++++++++++++++++++++++------- Minecraft.World/Blocks/Tile.h | 7 +++ Minecraft.World/Entities/Entity.cpp | 57 +++++++++++++++++----- Minecraft.World/Entities/Entity.h | 2 + 4 files changed, 110 insertions(+), 30 deletions(-) diff --git a/Minecraft.World/Blocks/Tile.cpp b/Minecraft.World/Blocks/Tile.cpp index adc7cb714..209b76272 100644 --- a/Minecraft.World/Blocks/Tile.cpp +++ b/Minecraft.World/Blocks/Tile.cpp @@ -16,6 +16,39 @@ #include "../Headers/net.minecraft.h" #include "Tile.h" +namespace +{ +#if defined(_WIN32) + inline void *TileTlsGetValue(DWORD key) + { + return TlsGetValue(key); + } + + inline void TileTlsSetValue(DWORD key, void *value) + { + TlsSetValue(key, value); + } +#else + pthread_key_t CreateTileTlsKey() + { + pthread_key_t key; + const int result = pthread_key_create(&key, nullptr); + assert(result == 0); + return key; + } + + inline void *TileTlsGetValue(pthread_key_t key) + { + return pthread_getspecific(key); + } + + inline void TileTlsSetValue(pthread_key_t key, void *value) + { + pthread_setspecific(key, value); + } +#endif +} + std::wstring Tile::TILE_DESCRIPTION_PREFIX = L"Tile."; const float Tile::INDESTRUCTIBLE_DESTROY_TIME = -1.0f; @@ -201,7 +234,11 @@ Tile *Tile::stairs_quartz = NULL; Tile *Tile::woolCarpet = NULL; +#if defined(_WIN32) DWORD Tile::tlsIdxShape = TlsAlloc(); +#else +pthread_key_t Tile::tlsIdxShape = CreateTileTlsKey(); +#endif Tile::ThreadStorage::ThreadStorage() { @@ -212,12 +249,12 @@ Tile::ThreadStorage::ThreadStorage() void Tile::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - TlsSetValue(Tile::tlsIdxShape, tls); + TileTlsSetValue(Tile::tlsIdxShape, tls); } void Tile::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); delete tls; } @@ -650,7 +687,7 @@ Tile *Tile::disableMipmap() void Tile::setShape(float x0, float y0, float z0, float x1, float y1, float z1) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); tls->xx0 = x0; tls->yy0 = y0; tls->zz0 = z0; @@ -700,7 +737,7 @@ bool Tile::isFaceVisible(Level *level, int x, int y, int z, int f) bool Tile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); if (face == 0 && tls->yy0 > 0) return true; @@ -717,7 +754,7 @@ int Tile::getFaceFlags(LevelSource *level, int x, int y, int z) { int faceFlags = 0; - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); @@ -792,7 +829,7 @@ Icon *Tile::getTexture(int face) AABB *Tile::getTileAABB(Level *level, int x, int y, int z) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); @@ -806,7 +843,7 @@ void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxe AABB *Tile::getAABB(Level *level, int x, int y, int z) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); @@ -941,7 +978,7 @@ HitResult *Tile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) a = a->add(-xt, -yt, -zt); b = b->add(-xt, -yt, -zt); - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); Vec3 *xh0 = a->clipX(b, tls->xx0); Vec3 *xh1 = a->clipX(b, tls->xx1); @@ -978,7 +1015,7 @@ bool Tile::containsX(Vec3 *v) { if( v == NULL) return false; - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return v->y >= tls->yy0 && v->y <= tls->yy1 && v->z >= tls->zz0 && v->z <= tls->zz1; @@ -988,7 +1025,7 @@ bool Tile::containsY(Vec3 *v) { if( v == NULL) return false; - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return v->x >= tls->xx0 && v->x <= tls->xx1 && v->z >= tls->zz0 && v->z <= tls->zz1; @@ -998,7 +1035,7 @@ bool Tile::containsZ(Vec3 *v) { if( v == NULL) return false; - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return v->x >= tls->xx0 && v->x <= tls->xx1 && v->y >= tls->yy0 && v->y <= tls->yy1; @@ -1063,14 +1100,14 @@ void Tile::handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr void Tile::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr forceEntity) // 4J added forceData, forceEntity param { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); } double Tile::getShapeX0() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->xx0; @@ -1078,7 +1115,7 @@ double Tile::getShapeX0() double Tile::getShapeX1() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->xx1; @@ -1086,7 +1123,7 @@ double Tile::getShapeX1() double Tile::getShapeY0() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->yy0; @@ -1094,7 +1131,7 @@ double Tile::getShapeY0() double Tile::getShapeY1() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->yy1; @@ -1102,7 +1139,7 @@ double Tile::getShapeY1() double Tile::getShapeZ0() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->zz0; @@ -1110,7 +1147,7 @@ double Tile::getShapeZ0() double Tile::getShapeZ1() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TileTlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->zz1; @@ -1630,3 +1667,4 @@ const int Tile::quartzBlock_Id; const int Tile::stairs_quartz_Id; const int Tile::woolCarpet_Id; #endif + diff --git a/Minecraft.World/Blocks/Tile.h b/Minecraft.World/Blocks/Tile.h index de71490c4..ea4421fc0 100644 --- a/Minecraft.World/Blocks/Tile.h +++ b/Minecraft.World/Blocks/Tile.h @@ -3,6 +3,9 @@ #include "../Util/Vec3.h" #include "../Util/Definitions.h" #include "../Util/SoundTypes.h" +#if !defined(_WIN32) +#include +#endif class GrassTile; @@ -55,7 +58,11 @@ protected: int tileId; ThreadStorage(); }; +#if defined(_WIN32) static DWORD tlsIdxShape; +#else + static pthread_key_t tlsIdxShape; +#endif public: // Each new thread that needs to use Vec3 pools will need to call one of the following 2 functions, to either create its own // local storage, or share the default storage already allocated by the main thread diff --git a/Minecraft.World/Entities/Entity.cpp b/Minecraft.World/Entities/Entity.cpp index 9c88a00e2..8a238dcf6 100644 --- a/Minecraft.World/Entities/Entity.cpp +++ b/Minecraft.World/Entities/Entity.cpp @@ -21,10 +21,48 @@ #include "../../Minecraft.Client/MinecraftServer.h" #include "../../Minecraft.Client/Level/MultiPlayerLevel.h" #include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h" +#include + +namespace +{ +#if defined(_WIN32) + inline void *EntityTlsGetValue(DWORD key) + { + return TlsGetValue(key); + } + + inline void EntityTlsSetValue(DWORD key, void *value) + { + TlsSetValue(key, value); + } +#else + pthread_key_t CreateEntityTlsKey() + { + pthread_key_t key; + const int result = pthread_key_create(&key, nullptr); + assert(result == 0); + return key; + } + + inline void *EntityTlsGetValue(pthread_key_t key) + { + return pthread_getspecific(key); + } + + inline void EntityTlsSetValue(pthread_key_t key, void *value) + { + pthread_setspecific(key, value); + } +#endif +} int Entity::entityCounter = 2048; // 4J - changed initialiser to 2048, as we are using range 0 - 2047 as special unique smaller ids for things that need network tracked +#if defined(_WIN32) DWORD Entity::tlsIdx = TlsAlloc(); +#else +pthread_key_t Entity::tlsIdx = CreateEntityTlsKey(); +#endif // 4J - added getSmallId & freeSmallId methods unsigned int Entity::entityIdUsedFlags[2048/32] = {0}; @@ -44,12 +82,7 @@ int Entity::getSmallId() // for final notification to the client that the entities are removed. We can't go re-using these small Ids yet, as otherwise we will // potentially end up telling the client that the entity has been removed After we have already re-used its Id and created a new entity. // This ends up with newly created client-side entities being removed by accident, causing invisible mobs. -#ifdef _WIN32 - if( ((size_t)TlsGetValue(tlsIdx) != 0 ) ) -#else - pthread_key_create(&tlsIdx, nullptr); - if ( ((size_t)pthread_getspecific(tlsIdx) != 0) ) -#endif + if( reinterpret_cast(EntityTlsGetValue(tlsIdx)) != 0 ) { MinecraftServer *server = MinecraftServer::getInstance(); if( server ) @@ -130,7 +163,7 @@ void Entity::countFlagsForPIX() void Entity::resetSmallId() { freeSmallId(entityId); - if( ((size_t)pthread_getspecific(tlsIdx) != 0 ) ) + if( reinterpret_cast(EntityTlsGetValue(tlsIdx)) != 0 ) { entityId = getSmallId(); } @@ -138,7 +171,7 @@ void Entity::resetSmallId() void Entity::freeSmallId(int index) { - if( ( (size_t)pthread_getspecific(tlsIdx) ) == 0 ) return; // Don't do anything with small ids if this isn't the server thread + if( reinterpret_cast(EntityTlsGetValue(tlsIdx)) == 0 ) return; // Don't do anything with small ids if this isn't the server thread if( index >= 2048 ) return; // Don't do anything if this isn't a short id unsigned int i = index / 32; @@ -151,7 +184,7 @@ void Entity::freeSmallId(int index) void Entity::useSmallIds() { - pthread_setspecific(tlsIdx,(LPVOID)1); + EntityTlsSetValue(tlsIdx, reinterpret_cast(static_cast(1))); } // Things also added here to be able to manage the concept of a number of extra "wandering" entities - normally path finding entities aren't allowed to @@ -161,7 +194,7 @@ void Entity::useSmallIds() // Let the management system here know whether or not to consider this particular entity for some extra wandering void Entity::considerForExtraWandering(bool enable) { - if( ( (size_t)pthread_getspecific(tlsIdx) ) == 0 ) return; // Don't do anything with small ids if this isn't the server thread + if( reinterpret_cast(EntityTlsGetValue(tlsIdx)) == 0 ) return; // Don't do anything with small ids if this isn't the server thread if( entityId >= 2048 ) return; // Don't do anything if this isn't a short id unsigned int i = entityId / 32; @@ -181,7 +214,7 @@ void Entity::considerForExtraWandering(bool enable) // Should this entity do wandering in addition to what the java code would have done? bool Entity::isExtraWanderingEnabled() { - if( ( (size_t)pthread_getspecific(tlsIdx) ) == 0 ) return false; // Don't do anything with small ids if this isn't the server thread + if( reinterpret_cast(EntityTlsGetValue(tlsIdx)) == 0 ) return false; // Don't do anything with small ids if this isn't the server thread if( entityId >= 2048 ) return false; // Don't do anything if this isn't a short id for( int i = 0; i < extraWanderCount; i++ ) @@ -244,7 +277,7 @@ void Entity::_init(bool useSmallId) // 4J - changed to assign two different types of ids. A range from 0-2047 is used for things that we'll be wanting to identify over the network, // so we should only need 11 bits rather than 32 to uniquely identify them. The rest of the range is used for anything we don't need to track like this, // currently particles. We only ever want to allocate this type of id from the server thread, so using thread local storage to isolate this. - if( useSmallId && ((size_t)pthread_getspecific(tlsIdx) != 0 ) ) + if( useSmallId && reinterpret_cast(EntityTlsGetValue(tlsIdx)) != 0 ) { entityId = getSmallId(); } diff --git a/Minecraft.World/Entities/Entity.h b/Minecraft.World/Entities/Entity.h index bb64e3b79..10cc1553c 100644 --- a/Minecraft.World/Entities/Entity.h +++ b/Minecraft.World/Entities/Entity.h @@ -5,7 +5,9 @@ #include "../IO/NBT/FloatTag.h" #include "../Util/Vec3.h" #include "../Util/Definitions.h" +#if !defined(_WIN32) #include +#endif class Mob; class LightningBolt; From 78fdd89f9d3edd8f82fdbd869761df553c83dd24 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:52:23 +1100 Subject: [PATCH 181/192] Use platform TLS keys in old chunk storage --- .../Level/Storage/OldChunkStorage.cpp | 49 ++++++++++++++++--- .../Level/Storage/OldChunkStorage.h | 7 +++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/Minecraft.World/Level/Storage/OldChunkStorage.cpp b/Minecraft.World/Level/Storage/OldChunkStorage.cpp index f82c5dff8..14523a624 100644 --- a/Minecraft.World/Level/Storage/OldChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/OldChunkStorage.cpp @@ -8,7 +8,45 @@ #include "../../Headers/net.minecraft.world.level.storage.h" #include "../../IO/Files/FileHeader.h" #include "OldChunkStorage.h" -DWORD OldChunkStorage::tlsIdx = 0; +#if defined(_WIN32) +namespace +{ + inline void *OldChunkStorageTlsGetValue(DWORD key) + { + return TlsGetValue(key); + } + + inline void OldChunkStorageTlsSetValue(DWORD key, void *value) + { + TlsSetValue(key, value); + } +} + +DWORD OldChunkStorage::tlsIdx = TlsAlloc(); +#else +namespace +{ + pthread_key_t CreateOldChunkStorageTlsKey() + { + pthread_key_t key; + const int result = pthread_key_create(&key, nullptr); + assert(result == 0); + return key; + } + + inline void *OldChunkStorageTlsGetValue(pthread_key_t key) + { + return pthread_getspecific(key); + } + + inline void OldChunkStorageTlsSetValue(pthread_key_t key, void *value) + { + pthread_setspecific(key, value); + } +} + +pthread_key_t OldChunkStorage::tlsIdx = CreateOldChunkStorageTlsKey(); +#endif OldChunkStorage::ThreadStorage *OldChunkStorage::tlsDefault = NULL; OldChunkStorage::ThreadStorage::ThreadStorage() @@ -32,20 +70,19 @@ void OldChunkStorage::CreateNewThreadStorage() ThreadStorage *tls = new ThreadStorage(); if(tlsDefault == NULL ) { - tlsIdx = TlsAlloc(); tlsDefault = tls; } - TlsSetValue(tlsIdx, tls); + OldChunkStorageTlsSetValue(tlsIdx, tls); } void OldChunkStorage::UseDefaultThreadStorage() { - TlsSetValue(tlsIdx, tlsDefault); + OldChunkStorageTlsSetValue(tlsIdx, tlsDefault); } void OldChunkStorage::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(OldChunkStorageTlsGetValue(tlsIdx)); if( tls == tlsDefault ) return; delete tls; @@ -321,7 +358,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) // Will be fine so long as we only actually create tags for once chunk at a time. // 4J Stu - As we now save on multiple threads, the static data has been moved to TLS - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(OldChunkStorageTlsGetValue(tlsIdx)); PIXBeginNamedEvent(0,"Getting block data"); //static byteArray blockData = byteArray(32768); diff --git a/Minecraft.World/Level/Storage/OldChunkStorage.h b/Minecraft.World/Level/Storage/OldChunkStorage.h index 2d09498c6..34d100720 100644 --- a/Minecraft.World/Level/Storage/OldChunkStorage.h +++ b/Minecraft.World/Level/Storage/OldChunkStorage.h @@ -4,6 +4,9 @@ #include "../../IO/Files/File.h" #include "../../IO/NBT/CompoundTag.h" #include "../../Headers/com.mojang.nbt.h" +#if !defined(_WIN32) +#include +#endif class Level; @@ -22,7 +25,11 @@ private: ThreadStorage(); ~ThreadStorage(); }; +#if defined(_WIN32) static DWORD tlsIdx; +#else + static pthread_key_t tlsIdx; +#endif static ThreadStorage *tlsDefault; public: // Each new thread that needs to use Compression will need to call one of the following 2 functions, to either create its own From 2256d0faddbc033a5fa03ded7cb289f5e240b108 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:56:44 +1100 Subject: [PATCH 182/192] Remove legacy Win32 thread entry state --- Minecraft.Client/Network/ServerChunkCache.cpp | 3 +-- Minecraft.World/Level/Storage/McRegionChunkStorage.cpp | 2 +- Minecraft.World/Level/Storage/McRegionChunkStorage.h | 2 +- Minecraft.World/Network/Connection.cpp | 7 ++----- Minecraft.World/Network/Connection.h | 7 ------- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index 2814d5f88..e05c890b1 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -664,7 +664,6 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) C4JThread::Event *wakeEvent[3]; // This sets off the threads that are waiting to continue C4JThread::Event *notificationEvent[3]; // These are signalled by the threads to let us know they are complete C4JThread *saveThreads[3]; - DWORD threadId[3]; SaveThreadData threadData[3]; ZeroMemory(&threadData[0], sizeof(SaveThreadData)); ZeroMemory(&threadData[1], sizeof(SaveThreadData)); @@ -739,7 +738,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) { char threadName[256]; sprintf(threadName,"Save thread %d\n",j); - SetThreadName(threadId[j], threadName); + SetThreadName(0, threadName); //saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); saveThreads[j] = new C4JThread(runSaveThreadProc,(void *)&threadData[j],threadName); diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp index b13f1c221..988b71be8 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp @@ -345,7 +345,7 @@ void McRegionChunkStorage::staticCtor() } } -int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam) +int McRegionChunkStorage::runSaveThreadProc(void *lpParam) { Compression::CreateNewThreadStorage(); diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.h b/Minecraft.World/Level/Storage/McRegionChunkStorage.h index bcca14c8a..56fa2800c 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.h +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.h @@ -39,5 +39,5 @@ public: private: static void WaitForAllSaves(); static void WaitForSaves(); - static int runSaveThreadProc(LPVOID lpParam); + static int runSaveThreadProc(void *lpParam); }; diff --git a/Minecraft.World/Network/Connection.cpp b/Minecraft.World/Network/Connection.cpp index 653f8ac24..a67ee7623 100644 --- a/Minecraft.World/Network/Connection.cpp +++ b/Minecraft.World/Network/Connection.cpp @@ -33,9 +33,6 @@ void Connection::_init() fakeLag = 0; slowWriteDelay = 50; - saqThreadID = 0; - closeThreadID = 0; - tickCount = 0; } @@ -380,7 +377,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) // return( sum ? (sum / count) : 0 ); -// CreateThread(NULL, 0, runClose, this, 0, &closeThreadID); +// CreateThread(NULL, 0, runClose, this, 0, NULL); running = false; @@ -525,7 +522,7 @@ void Connection::sendAndQuit() close(DisconnectPacket::eDisconnect_Closed); } #else - CreateThread(NULL, 0, runSendAndQuit, this, 0, &saqThreadID); + CreateThread(NULL, 0, runSendAndQuit, this, 0, NULL); #endif } diff --git a/Minecraft.World/Network/Connection.h b/Minecraft.World/Network/Connection.h index 420f82358..c29bf9e71 100644 --- a/Minecraft.World/Network/Connection.h +++ b/Minecraft.World/Network/Connection.h @@ -19,11 +19,6 @@ class ByteArrayOutputStream; class Connection { - friend DWORD WINAPI runRead(LPVOID lpParam); - friend DWORD WINAPI runWrite(LPVOID lpParam); - friend DWORD WINAPI runSendAndQuit(LPVOID lpParam); - friend DWORD WINAPI runClose(LPVOID lpParam); - private: static const int SEND_BUFFER_SIZE = 1024 * 5; @@ -68,8 +63,6 @@ private: C4JThread::Event* m_hWakeReadThread; C4JThread::Event* m_hWakeWriteThread; - DWORD saqThreadID, closeThreadID; - bool disconnected; DisconnectPacket::eDisconnectReason disconnectReason; void **disconnectReasonObjects; // 4J a pointer to an array. From dbc8071183cc3ea50896186c5899ad13379a1425 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 08:01:18 +1100 Subject: [PATCH 183/192] Use standard result types in file helpers --- Minecraft.World/IO/Files/File.cpp | 42 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/Minecraft.World/IO/Files/File.cpp b/Minecraft.World/IO/Files/File.cpp index c3cdc9598..1056cf0f0 100644 --- a/Minecraft.World/IO/Files/File.cpp +++ b/Minecraft.World/IO/Files/File.cpp @@ -160,17 +160,17 @@ bool File::_delete() return true; #endif #elif defined _UNICODE - BOOL result = DeleteFile( getPath().c_str() ); + const bool result = DeleteFile( getPath().c_str() ) != 0; #elif defined(__linux__) // FIXME - BOOL result = 0; + const bool result = false; #else - BOOL result = DeleteFile( wstringtofilename(getPath()) ); + const bool result = DeleteFile( wstringtofilename(getPath()) ) != 0; #endif - if( result == 0 ) + if( !result ) { #if !defined(__linux__) - DWORD error = GetLastError(); + const unsigned int error = GetLastError(); #ifndef _CONTENT_PACKAGE printf( "File::_delete - Error code %d (%#0.8X)\n", error, error ); #endif @@ -257,8 +257,8 @@ bool File::mkdirs() const #ifdef _UNICODE if( GetFileAttributes( pathToHere.c_str() ) == -1 ) { - DWORD result = CreateDirectory( pathToHere.c_str(), NULL); - if( result == 0 ) + const bool result = CreateDirectory( pathToHere.c_str(), NULL) != 0; + if( !result ) { // Failed to create return false; @@ -275,8 +275,8 @@ bool File::mkdirs() const #else if( GetFileAttributes( wstringtofilename(pathToHere) ) == -1 ) { - DWORD result = CreateDirectory( wstringtofilename(pathToHere), NULL); - if( result == 0 ) + const bool result = CreateDirectory( wstringtofilename(pathToHere), NULL) != 0; + if( !result ) { // Failed to create return false; @@ -496,7 +496,6 @@ std::vector *File::listFiles() const int count = 0; do { - //if( !(wfd.dwFileAttributes & dwAttr) ) vOutput->push_back( new File( *this, wfd.cFileName ) ); } while( FindNextFile( hFind, &wfd) ); @@ -514,7 +513,6 @@ std::vector *File::listFiles() const //int count = 0; do { - //if( !(wfd.dwFileAttributes & dwAttr) ) vOutput->push_back( new File( *this, filenametowstring( wfd.cFileName ) ) ); } while( FindNextFile( hFind, &wfd) ); @@ -594,7 +592,6 @@ std::vector *File::listFiles(FileFilter *filter) const WCHAR path[MAX_PATH]; WIN32_FIND_DATA wfd; - DWORD dwAttr = FILE_ATTRIBUTE_DIRECTORY; swprintf( path, L"%ls\\*", getPath().c_str() ); HANDLE hFind = FindFirstFile( path, &wfd); @@ -618,7 +615,6 @@ std::vector *File::listFiles(FileFilter *filter) const #else char path[MAX_PATH]; WIN32_FIND_DATA wfd; - //DWORD dwAttr = FILE_ATTRIBUTE_DIRECTORY; sprintf( path, "%s\\*", wstringtofilename( getPath() ) ); HANDLE hFind = FindFirstFile( path, &wfd); @@ -746,20 +742,20 @@ __int64 File::length() #else WIN32_FILE_ATTRIBUTE_DATA fileInfoBuffer; #ifdef _UNICODE - BOOL result = GetFileAttributesEx( + const bool result = GetFileAttributesEx( getPath().c_str(), // file or directory name GetFileExInfoStandard, // attribute &fileInfoBuffer // attribute information - ); + ) != 0; #else - BOOL result = GetFileAttributesEx( + const bool result = GetFileAttributesEx( wstringtofilename(getPath()), // file or directory name GetFileExInfoStandard, // attribute &fileInfoBuffer // attribute information - ); + ) != 0; #endif - if( result != 0 && !( (fileInfoBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ) + if( result && !( (fileInfoBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ) { // Success LARGE_INTEGER liFileSize; @@ -799,20 +795,20 @@ __int64 File::lastModified() #elif !defined(__linux__) WIN32_FILE_ATTRIBUTE_DATA fileInfoBuffer; #ifdef _UNICODE - BOOL result = GetFileAttributesEx( + const bool result = GetFileAttributesEx( getPath().c_str(), // file or directory name GetFileExInfoStandard, // attribute &fileInfoBuffer // attribute information - ); + ) != 0; #else - BOOL result = GetFileAttributesEx( + const bool result = GetFileAttributesEx( wstringtofilename(getPath()), // file or directory name GetFileExInfoStandard, // attribute &fileInfoBuffer // attribute information - ); + ) != 0; #endif - if( result != 0 && !( (fileInfoBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ) + if( result && !( (fileInfoBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ) { // Success LARGE_INTEGER liLastModified; From 082dc2033df805580f3ac85920cbdbcbad3e2dae Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 15:46:23 +1100 Subject: [PATCH 184/192] Use standard DLC mount callback types --- 4J.Storage/4J_Storage.cpp | 2 +- 4J.Storage/4J_Storage.h | 3 ++- Minecraft.Client/Platform/Common/Consoles_App.cpp | 6 +++--- Minecraft.Client/Platform/Common/Consoles_App.h | 2 +- Minecraft.Client/Platform/Extrax64Stubs.cpp | 2 +- Minecraft.Client/Textures/Packs/DLCTexturePack.cpp | 6 +++--- Minecraft.Client/Textures/Packs/DLCTexturePack.h | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/4J.Storage/4J_Storage.cpp b/4J.Storage/4J_Storage.cpp index afdfd22af..ddc71544d 100644 --- a/4J.Storage/4J_Storage.cpp +++ b/4J.Storage/4J_Storage.cpp @@ -61,7 +61,7 @@ DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int(*Func)( DWORD C4JStorage::GetAvailableDLCCount(int iPad) { return 0; } C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam) { return EDLC_NoInstalledDLC; } XCONTENT_DATA& C4JStorage::GetDLC(DWORD dw) { return s_dummyContentData; } -DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive) { return 0; } +std::uint32_t C4JStorage::MountInstalledDLC(int iPad, std::uint32_t dwDLC, int(*Func)(void *, int, std::uint32_t, std::uint32_t), void *lpParam, LPCSTR szMountDrive) { return 0; } DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; } void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector &fileList) { fileList.clear(); } std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; } diff --git a/4J.Storage/4J_Storage.h b/4J.Storage/4J_Storage.h index aa1d74522..a8168b436 100644 --- a/4J.Storage/4J_Storage.h +++ b/4J.Storage/4J_Storage.h @@ -1,6 +1,7 @@ #pragma once +#include #include //#include @@ -299,7 +300,7 @@ public: C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); XCONTENT_DATA& GetDLC(DWORD dw); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=NULL); + std::uint32_t MountInstalledDLC(int iPad,std::uint32_t dwDLC,int( *Func)(void *, int, std::uint32_t, std::uint32_t),void *lpParam,LPCSTR szMountDrive=NULL); DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index e43c0e874..3c4d315ee 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5077,7 +5077,7 @@ void CMinecraftApp::MountNextDLC(int iPad) #define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName) #endif -int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) +int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,std::uint32_t dwErr,std::uint32_t dwLicenceMask) { #if defined(_XBOX) || defined(_DURANGO) || defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined (__PSVITA__) //Chris TODO app.DebugPrintf("--- CMinecraftApp::DLCMountedCallback\n"); @@ -5085,7 +5085,7 @@ int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dw if(dwErr!=ERROR_SUCCESS) { // corrupt DLC - app.DebugPrintf("Failed to mount DLC for pad %d: %d\n",iPad,dwErr); + app.DebugPrintf("Failed to mount DLC for pad %d: %u\n",iPad,dwErr); app.m_dlcManager.incrementUnnamedCorruptCount(); } else @@ -5126,7 +5126,7 @@ int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dw } else { - app.DebugPrintf("Pack \"%ls\" is already installed. Updating license to %d\n", CONTENT_DATA_DISPLAY_NAME(ContentData), dwLicenceMask); + app.DebugPrintf("Pack \"%ls\" is already installed. Updating license to %u\n", CONTENT_DATA_DISPLAY_NAME(ContentData), dwLicenceMask); pack->SetDLCMountIndex(app.m_iTotalDLCInstalled); pack->SetDLCDeviceID(ContentData.DeviceID); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 18c1dfc90..320dc1048 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -318,7 +318,7 @@ public: bool StartInstallDLCProcess(int iPad); static int DLCInstalledCallback(void *pParam,int iOfferC,int iPad); void HandleDLCLicenseChange(); - static int DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); + static int DLCMountedCallback(void *pParam,int iPad,std::uint32_t dwErr,std::uint32_t dwLicenceMask); void MountNextDLC(int iPad); //static int DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData); void HandleDLC(DLCPack *pack); diff --git a/Minecraft.Client/Platform/Extrax64Stubs.cpp b/Minecraft.Client/Platform/Extrax64Stubs.cpp index 0d7476e9f..9a3c6129a 100644 --- a/Minecraft.Client/Platform/Extrax64Stubs.cpp +++ b/Minecraft.Client/Platform/Extrax64Stubs.cpp @@ -602,7 +602,7 @@ DWORD C4JStorage::InstallOffer(int iOfferIDC,ULONGLONG *ullOfferIDA,int( DWORD C4JStorage::GetAvailableDLCCount( int iPad) { return 0; } XCONTENT_DATA& C4JStorage::GetDLC(DWORD dw) { static XCONTENT_DATA retval = {0}; return retval; } C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam) { return C4JStorage::EDLC_Idle; } -DWORD C4JStorage::MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive) { return 0; } +std::uint32_t C4JStorage::MountInstalledDLC(int iPad,std::uint32_t dwDLC,int( *Func)(void *, int, std::uint32_t, std::uint32_t),void *lpParam,LPCSTR szMountDrive) { return 0; } DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; } C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int),LPVOID lpParam, int iAction) { return C4JStorage::ETMSStatus_Idle; } bool C4JStorage::WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize) { return true; } diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index c68e11384..c99e0ec3b 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -310,14 +310,14 @@ std::wstring DLCTexturePack::getFilePath(std::uint32_t packId, std::wstring file return app.getFilePath(packId,filename,bAddDataFolder); } -int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) +int DLCTexturePack::packMounted(void *pParam,int iPad,std::uint32_t dwErr,std::uint32_t dwLicenceMask) { - DLCTexturePack *texturePack = (DLCTexturePack *)pParam; + DLCTexturePack *texturePack = static_cast(pParam); texturePack->m_bLoadingData = false; if(dwErr!=ERROR_SUCCESS) { // corrupt DLC - app.DebugPrintf("Failed to mount DLC for pad %d: %d\n",iPad,dwErr); + app.DebugPrintf("Failed to mount DLC for pad %d: %u\n",iPad,dwErr); } else { diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.h b/Minecraft.Client/Textures/Packs/DLCTexturePack.h index ef6e5154b..98cecc8de 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.h +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.h @@ -58,7 +58,7 @@ private: static std::wstring getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder=true); public: - static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); + static int packMounted(void *pParam,int iPad,std::uint32_t dwErr,std::uint32_t dwLicenceMask); virtual void loadData(); virtual void loadUI(); virtual void unloadUI(); From 2b638adf9329af84a1a7f9c4d031b836ce62c5c2 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:12:53 +1100 Subject: [PATCH 185/192] Use standard types in storage callbacks --- 4J.Storage/4J_Storage.cpp | 32 +++++++++---------- 4J.Storage/4J_Storage.h | 32 +++++++++---------- .../Platform/Common/Consoles_App.cpp | 4 +-- .../Platform/Common/Consoles_App.h | 2 +- Minecraft.Client/Platform/Extrax64Stubs.cpp | 2 +- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/4J.Storage/4J_Storage.cpp b/4J.Storage/4J_Storage.cpp index ddc71544d..92d9f77cc 100644 --- a/4J.Storage/4J_Storage.cpp +++ b/4J.Storage/4J_Storage.cpp @@ -13,64 +13,64 @@ C4JStorage::C4JStorage() : m_pStringTable(nullptr) {} void C4JStorage::Tick(void) {} C4JStorage::EMessageResult C4JStorage::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA, UINT uiOptionC, DWORD dwPad, - int(*Func)(LPVOID, int, const C4JStorage::EMessageResult), LPVOID lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString, DWORD dwFocusButton) { + int(*Func)(void *, int, const C4JStorage::EMessageResult), void *lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString, DWORD dwFocusButton) { return EMessage_ResultAccept; } C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { return EMessage_Undefined; } -bool C4JStorage::SetSaveDevice(int(*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice) { return true; } +bool C4JStorage::SetSaveDevice(int(*Func)(void *, const bool), void *lpParam, bool bForceResetOfSaveDevice) { return true; } -void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char *pszSavePackName, int iMinimumSaveSize, int(*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID) {} +void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char *pszSavePackName, int iMinimumSaveSize, int(*Func)(void *, const ESavingMessage, int), void *lpParam, LPCSTR szGroupID) {} void C4JStorage::ResetSaveData() {} void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName) {} void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName) {} bool C4JStorage::GetSaveUniqueNumber(INT *piVal) { if (piVal) *piVal = 0; return true; } bool C4JStorage::GetSaveUniqueFilename(char *pszName) { if (pszName) pszName[0] = '\0'; return true; } void C4JStorage::SetSaveUniqueFilename(char *szFilename) {} -void C4JStorage::SetState(ESaveGameControlState eControlState, int(*Func)(LPVOID, const bool), LPVOID lpParam) {} +void C4JStorage::SetState(ESaveGameControlState eControlState, int(*Func)(void *, const bool), void *lpParam) {} void C4JStorage::SetSaveDisabled(bool bDisable) {} bool C4JStorage::GetSaveDisabled(void) { return false; } unsigned int C4JStorage::GetSaveSize() { return 0; } void C4JStorage::GetSaveData(void *pvData, unsigned int *puiBytes) { if (puiBytes) *puiBytes = 0; } PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); } void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes) {} -C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int(*Func)(LPVOID, const bool), LPVOID lpParam) { return ESaveGame_Idle; } -void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int(*Func)(LPVOID lpParam, bool), LPVOID lpParam) {} +C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int(*Func)(void *, const bool), void *lpParam) { return ESaveGame_Idle; } +void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int(*Func)(void *lpParam, bool), void *lpParam) {} void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool *pbExists) { if (pbExists) *pbExists = false; return ESaveGame_Idle; } bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; } void C4JStorage::SetSaveMessageVPosition(float fY) {} -C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int(*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam, char *pszSavePackName) { return ESaveGame_Idle; } +C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int(*Func)(void *lpParam, SAVE_DETAILS *pSaveDetails, const bool), void *lpParam, char *pszSavePackName) { return ESaveGame_Idle; } PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; } void C4JStorage::ClearSavesInfo() {} -C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam) { return ESaveGame_Idle; } +C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), void *lpParam) { return ESaveGame_Idle; } void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA &xContentData) { memset(&xContentData, 0, sizeof(xContentData)); } void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pdwImageBytes) *pdwImageBytes = 0; } -C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam) { return ESaveGame_Idle; } -C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam) { return ESaveGame_Idle; } -void C4JStorage::RegisterMarketplaceCountsCallback(int(*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam) {} +C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, const bool, const bool), void *lpParam) { return ESaveGame_Idle; } +C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, const bool), void *lpParam) { return ESaveGame_Idle; } +void C4JStorage::RegisterMarketplaceCountsCallback(int(*Func)(void *lpParam, C4JStorage::DLC_TMS_DETAILS *, int), void *lpParam) {} void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot) {} -C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask) { return EDLC_NoOffers; } +C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int(*Func)(void *, int, std::uint32_t, int), void *lpParam, DWORD dwOfferTypesBitmask) { return EDLC_NoOffers; } DWORD C4JStorage::CancelGetDLCOffers() { return 0; } void C4JStorage::ClearDLCOffers() {} XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(DWORD dw) { return s_dummyOffer; } int C4JStorage::GetOfferCount() { return 0; } -DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int(*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial) { return 0; } +DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int(*Func)(void *, int, int), void *lpParam, bool bTrial) { return 0; } DWORD C4JStorage::GetAvailableDLCCount(int iPad) { return 0; } -C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam) { return EDLC_NoInstalledDLC; } +C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int(*Func)(void *, int, int), void *lpParam) { return EDLC_NoInstalledDLC; } XCONTENT_DATA& C4JStorage::GetDLC(DWORD dw) { return s_dummyContentData; } std::uint32_t C4JStorage::MountInstalledDLC(int iPad, std::uint32_t dwDLC, int(*Func)(void *, int, std::uint32_t, std::uint32_t), void *lpParam, LPCSTR szMountDrive) { return 0; } DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; } void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector &fileList) { fileList.clear(); } std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; } C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType, - WCHAR *pwchFilename, BYTE **ppBuffer, DWORD *pdwBufferSize, int(*Func)(LPVOID, WCHAR *, int, bool, int), LPVOID lpParam, int iAction) { return ETMSStatus_Fail; } + WCHAR *pwchFilename, BYTE **ppBuffer, DWORD *pdwBufferSize, int(*Func)(void *, WCHAR *, int, bool, int), void *lpParam, int iAction) { return ETMSStatus_Fail; } bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename, BYTE *pBuffer, DWORD dwBufferSize) { return false; } bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename) { return false; } void C4JStorage::StoreTMSPathName(WCHAR *pwchName) {} -C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR), LPVOID lpParam, int iUserData) { return ETMSStatus_Fail; } +C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(void *, int, int, PTMSPP_FILEDATA, LPCSTR), void *lpParam, int iUserData) { return ETMSStatus_Fail; } unsigned int C4JStorage::CRC(unsigned char *buf, int len) { unsigned int crc = 0xFFFFFFFF; for (int i = 0; i < len; i++) { diff --git a/4J.Storage/4J_Storage.h b/4J.Storage/4J_Storage.h index a8168b436..5eebb844a 100644 --- a/4J.Storage/4J_Storage.h +++ b/4J.Storage/4J_Storage.h @@ -243,31 +243,31 @@ public: // Messages C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); + int( *Func)(void *,int,const C4JStorage::EMessageResult)=NULL,void *lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); C4JStorage::EMessageResult GetMessageBoxResult(); // save device - bool SetSaveDevice(int( *Func)(LPVOID,const bool),LPVOID lpParam, bool bForceResetOfSaveDevice=false); + bool SetSaveDevice(int( *Func)(void *,const bool),void *lpParam, bool bForceResetOfSaveDevice=false); // savegame - void Init(unsigned int uiSaveVersion,LPCWSTR pwchDefaultSaveName,char *pszSavePackName,int iMinimumSaveSize,int( *Func)(LPVOID, const ESavingMessage, int),LPVOID lpParam,LPCSTR szGroupID); + void Init(unsigned int uiSaveVersion,LPCWSTR pwchDefaultSaveName,char *pszSavePackName,int iMinimumSaveSize,int( *Func)(void *, const ESavingMessage, int),void *lpParam,LPCSTR szGroupID); void ResetSaveData(); // Call before a new save to clear out stored save file name void SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName); void SetSaveTitle(LPCWSTR pwchDefaultSaveName); bool GetSaveUniqueNumber(INT *piVal); bool GetSaveUniqueFilename(char *pszName); void SetSaveUniqueFilename(char *szFilename); - void SetState(ESaveGameControlState eControlState,int( *Func)(LPVOID,const bool),LPVOID lpParam); + void SetState(ESaveGameControlState eControlState,int( *Func)(void *,const bool),void *lpParam); void SetSaveDisabled(bool bDisable); bool GetSaveDisabled(void); unsigned int GetSaveSize(); void GetSaveData(void *pvData,unsigned int *puiBytes); PVOID AllocateSaveData(unsigned int uiBytes); void SetSaveImages( PBYTE pbThumbnail,DWORD dwThumbnailBytes,PBYTE pbImage,DWORD dwImageBytes, PBYTE pbTextData ,DWORD dwTextDataBytes); // Sets the thumbnail & image for the save, optionally setting the metadata in the png - C4JStorage::ESaveGameState SaveSaveData(int( *Func)(LPVOID ,const bool),LPVOID lpParam); - void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam); + C4JStorage::ESaveGameState SaveSaveData(int( *Func)(void * ,const bool),void *lpParam); + void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(void *lpParam, bool), void *lpParam); void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected); bool GetSaveDeviceSelected(unsigned int iPad); C4JStorage::ESaveGameState DoesSaveExist(bool *pbExists); @@ -275,30 +275,30 @@ public: void SetSaveMessageVPosition(float fY); // The 'Saving' message will display at a default position unless changed // Get the info for the saves - C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName); + C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(void *lpParam,SAVE_DETAILS *pSaveDetails,const bool),void *lpParam,char *pszSavePackName); PSAVE_DETAILS ReturnSavesInfo(); void ClearSavesInfo(); // Clears results - C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo + C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), void *lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo void GetSaveCacheFileInfo(DWORD dwFile,XCONTENT_DATA &xContentData); void GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes); // Load the save. Need to call GetSaveData once the callback is called - C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,const bool, const bool), LPVOID lpParam); - C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,const bool), LPVOID lpParam); + C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,const bool, const bool), void *lpParam); + C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,const bool), void *lpParam); // DLC - void RegisterMarketplaceCountsCallback(int ( *Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam ); + void RegisterMarketplaceCountsCallback(int ( *Func)(void *lpParam, C4JStorage::DLC_TMS_DETAILS *, int), void *lpParam ); void SetDLCPackageRoot(char *pszDLCRoot); - C4JStorage::EDLCStatus GetDLCOffers(int iPad,int( *Func)(LPVOID, int, DWORD, int),LPVOID lpParam, DWORD dwOfferTypesBitmask=XMARKETPLACE_OFFERING_TYPE_CONTENT); + C4JStorage::EDLCStatus GetDLCOffers(int iPad,int( *Func)(void *, int, std::uint32_t, int),void *lpParam, DWORD dwOfferTypesBitmask=XMARKETPLACE_OFFERING_TYPE_CONTENT); DWORD CancelGetDLCOffers(); void ClearDLCOffers(); XMARKETPLACE_CONTENTOFFER_INFO& GetOffer(DWORD dw); int GetOfferCount(); - DWORD InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA,int( *Func)(LPVOID, int, int),LPVOID lpParam, bool bTrial=false); + DWORD InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA,int( *Func)(void *, int, int),void *lpParam, bool bTrial=false); DWORD GetAvailableDLCCount( int iPad); - C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); + C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(void *, int, int),void *lpParam); XCONTENT_DATA& GetDLC(DWORD dw); std::uint32_t MountInstalledDLC(int iPad,std::uint32_t dwDLC,int( *Func)(void *, int, std::uint32_t, std::uint32_t),void *lpParam,LPCSTR szMountDrive=NULL); DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); @@ -307,7 +307,7 @@ public: // Global title storage C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, - WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=NULL,LPVOID lpParam=NULL, int iAction=0); + WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(void *, WCHAR *,int, bool, int)=NULL,void *lpParam=NULL, int iAction=0); bool WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize); bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename); void StoreTMSPathName(WCHAR *pwchName=NULL); @@ -320,7 +320,7 @@ public: // C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(void *,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,void *lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 268c92375..95bb8618d 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -8547,7 +8547,7 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved() LeaveCriticalSection(&csTMSPPDownloadQueue); } -int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad) +int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, std::uint32_t dwType, int iPad) { CMinecraftApp* pClass = (CMinecraftApp *) pParam; @@ -8561,7 +8561,7 @@ int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, in if(pCurrent->dwType == static_cast(dwType)) { pClass->m_iDLCOfferC = iOfferC; - app.DebugPrintf("DLCOffersReturned - type %d, count %d - setting to retrieved\n",dwType,iOfferC); + app.DebugPrintf("DLCOffersReturned - type %u, count %d - setting to retrieved\n",dwType,iOfferC); pCurrent->eState=e_DLC_ContentState_Retrieved; break; } diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 320dc1048..5e8dd13fc 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -737,7 +737,7 @@ public: unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, bool bPromote=false); bool RetrieveNextDLCContent(); bool CheckTMSDLCCanStop(); - static int DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad); + static int DLCOffersReturned(void *pParam, int iOfferC, std::uint32_t dwType, int iPad); std::uint32_t GetDLCContentType(eDLCContentType eType) { return m_dwContentTypeA[eType];} eDLCContentType Find_eDLCContentType(std::uint32_t dwType); int GetDLCOffersCount() { return m_iDLCOfferC;} diff --git a/Minecraft.Client/Platform/Extrax64Stubs.cpp b/Minecraft.Client/Platform/Extrax64Stubs.cpp index 9a3c6129a..09aaa0104 100644 --- a/Minecraft.Client/Platform/Extrax64Stubs.cpp +++ b/Minecraft.Client/Platform/Extrax64Stubs.cpp @@ -593,7 +593,7 @@ PSAVE_DETAILS C4JStorage::ReturnSavesInfo() {return NULL;} void C4JStorage::RegisterMarketplaceCountsCallback(int ( *Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam ) {} void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot) {} -C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad,int( *Func)(LPVOID, int, DWORD, int),LPVOID lpParam, DWORD dwOfferTypesBitmaskT) { return C4JStorage::EDLC_Idle; } +C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad,int( *Func)(void *, int, std::uint32_t, int),void *lpParam, DWORD dwOfferTypesBitmaskT) { return C4JStorage::EDLC_Idle; } DWORD C4JStorage::CancelGetDLCOffers() { return 0; } void C4JStorage::ClearDLCOffers() {} XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(DWORD dw) { static XMARKETPLACE_CONTENTOFFER_INFO retval = {0}; return retval; } From 1490d0b067bb62e5f96004f8fb2f7a4b257f1963 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:21:14 +1100 Subject: [PATCH 186/192] Use standard callback cookies in profile manager --- 4J.Profile/4J_Profile.cpp | 18 +++++++-------- 4J.Profile/4J_Profile.h | 20 +++++++++-------- .../Platform/Common/Consoles_App.cpp | 2 +- .../Platform/Common/Consoles_App.h | 2 +- Minecraft.Client/Platform/Extrax64Stubs.cpp | 22 +++++++++---------- .../Platform/Linux/Linux_Minecraft.cpp | 4 ++-- 6 files changed, 35 insertions(+), 33 deletions(-) diff --git a/4J.Profile/4J_Profile.cpp b/4J.Profile/4J_Profile.cpp index 33b88d143..8aaf7b78c 100644 --- a/4J.Profile/4J_Profile.cpp +++ b/4J.Profile/4J_Profile.cpp @@ -22,9 +22,9 @@ void C_4JProfile::SetLockedProfile(int iProf) {} bool C_4JProfile::IsSignedIn(int iQuadrant) { return iQuadrant == 0; } bool C_4JProfile::IsSignedInLive(int iProf) { return false; } bool C_4JProfile::IsGuest(int iQuadrant) { return false; } -UINT C_4JProfile::RequestSignInUI(bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, bool bMultiplayerSignIn, bool bAddUser, int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; } -UINT C_4JProfile::DisplayOfflineProfile(int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; } -UINT C_4JProfile::RequestConvertOfflineToGuestUI(int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; } +UINT C_4JProfile::RequestSignInUI(bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, bool bMultiplayerSignIn, bool bAddUser, int(*Func)(void *, const bool, const int iPad), void *lpParam, int iQuadrant) { return 0; } +UINT C_4JProfile::DisplayOfflineProfile(int(*Func)(void *, const bool, const int iPad), void *lpParam, int iQuadrant) { return 0; } +UINT C_4JProfile::RequestConvertOfflineToGuestUI(int(*Func)(void *, const bool, const int iPad), void *lpParam, int iQuadrant) { return 0; } void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} bool C_4JProfile::QuerySigninStatus(void) { return true; } void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid, bool bOnlineXuid) { if (pXuid) *pXuid = 0; } @@ -53,15 +53,15 @@ static char s_gamertag[64] = "Player"; char* C_4JProfile::GetGamertag(int iPad) { return s_gamertag; } std::wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; } bool C_4JProfile::IsFullVersion() { return true; } -void C_4JProfile::SetSignInChangeCallback(void(*Func)(LPVOID, bool, unsigned int), LPVOID lpParam) {} -void C_4JProfile::SetNotificationsCallback(void(*Func)(LPVOID, DWORD, unsigned int), LPVOID lpParam) {} +void C_4JProfile::SetSignInChangeCallback(void(*Func)(void *, bool, unsigned int), void *lpParam) {} +void C_4JProfile::SetNotificationsCallback(void(*Func)(void *, std::uint32_t, unsigned int), void *lpParam) {} bool C_4JProfile::RegionIsNorthAmerica(void) { return true; } bool C_4JProfile::LocaleIsUSorCanada(void) { return true; } HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; } bool C_4JProfile::IsSystemUIDisplayed() { return false; } -void C_4JProfile::SetProfileReadErrorCallback(void(*Func)(LPVOID), LPVOID lpParam) {} -int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(LPVOID, PROFILESETTINGS *, const int iPad), LPVOID lpParam) { return 0; } -int C_4JProfile::SetOldProfileVersionCallback(int(*Func)(LPVOID, unsigned char *, const unsigned short, const int), LPVOID lpParam) { return 0; } +void C_4JProfile::SetProfileReadErrorCallback(void(*Func)(void *), void *lpParam) {} +int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(void *, PROFILESETTINGS *, const int iPad), void *lpParam) { return 0; } +int C_4JProfile::SetOldProfileVersionCallback(int(*Func)(void *, unsigned char *, const unsigned short, const int), void *lpParam) { return 0; } static C_4JProfile::PROFILESETTINGS s_defaultSettings = {}; C_4JProfile::PROFILESETTINGS* C_4JProfile::GetDashboardProfileSettings(int iPad) { return &s_defaultSettings; } @@ -82,5 +82,5 @@ void C_4JProfile::RegisterRichPresenceContext(int iGameConfigContextID) {} void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID, int iVal) {} void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence, bool bSetOthersToIdle) {} void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam) {} -void C_4JProfile::SetUpsellCallback(void(*Func)(LPVOID lpParam, eUpsellType type, eUpsellResponse response, int iUserData), LPVOID lpParam) {} +void C_4JProfile::SetUpsellCallback(void(*Func)(void *lpParam, eUpsellType type, eUpsellResponse response, int iUserData), void *lpParam) {} void C_4JProfile::SetDebugFullOverride(bool bVal) {} diff --git a/4J.Profile/4J_Profile.h b/4J.Profile/4J_Profile.h index 4e6fc606c..bdf8ff89c 100644 --- a/4J.Profile/4J_Profile.h +++ b/4J.Profile/4J_Profile.h @@ -1,5 +1,7 @@ #pragma once +#include + enum eAwardType { eAwardType_Achievement = 0, @@ -54,9 +56,9 @@ public: bool IsSignedIn(int iQuadrant); bool IsSignedInLive(int iProf); bool IsGuest(int iQuadrant); - UINT RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY); - UINT DisplayOfflineProfile(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY); - UINT RequestConvertOfflineToGuestUI(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY); + UINT RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant=XUSER_INDEX_ANY); + UINT DisplayOfflineProfile(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant=XUSER_INDEX_ANY); + UINT RequestConvertOfflineToGuestUI(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant=XUSER_INDEX_ANY); void SetPrimaryPlayerChanged(bool bVal); bool QuerySigninStatus(void); void GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid); @@ -78,18 +80,18 @@ public: char* GetGamertag(int iPad); std::wstring GetDisplayName(int iPad); bool IsFullVersion(); - void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); - void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam); + void SetSignInChangeCallback(void ( *Func)(void *, bool, unsigned int),void *lpParam); + void SetNotificationsCallback(void ( *Func)(void *, std::uint32_t, unsigned int),void *lpParam); bool RegionIsNorthAmerica(void); bool LocaleIsUSorCanada(void); HRESULT GetLiveConnectionStatus(); bool IsSystemUIDisplayed(); - void SetProfileReadErrorCallback(void ( *Func)(LPVOID), LPVOID lpParam); + void SetProfileReadErrorCallback(void ( *Func)(void *), void *lpParam); // PROFILE DATA - int SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam); - int SetOldProfileVersionCallback(int( *Func)(LPVOID,unsigned char *, const unsigned short,const int),LPVOID lpParam); + int SetDefaultOptionsCallback(int( *Func)(void *,PROFILESETTINGS *, const int iPad),void *lpParam); + int SetOldProfileVersionCallback(int( *Func)(void *,unsigned char *, const unsigned short,const int),void *lpParam); PROFILESETTINGS * GetDashboardProfileSettings(int iPad); void WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged=false, bool bOverride5MinuteLimitOnProfileWrites=false); void ForceQueuedProfileWrites(int iPad=XUSER_INDEX_ANY); @@ -116,7 +118,7 @@ public: // PURCHASE void DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam = -1); - void SetUpsellCallback(void ( *Func)(LPVOID lpParam, eUpsellType type, eUpsellResponse response, int iUserData),LPVOID lpParam); + void SetUpsellCallback(void ( *Func)(void *lpParam, eUpsellType type, eUpsellResponse response, int iUserData),void *lpParam); // Debug void SetDebugFullOverride(bool bVal); // To override the license version (trail/full). Only in debug/release, not ContentPackage diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 95bb8618d..131b54ab8 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -4744,7 +4744,7 @@ void CMinecraftApp::SignInChangeCallback(void *pParam,bool bPrimaryPlayerChanged } } -void CMinecraftApp::NotificationsCallback(void *pParam,DWORD dwNotification, unsigned int uiParam) +void CMinecraftApp::NotificationsCallback(void *pParam,std::uint32_t dwNotification, unsigned int uiParam) { CMinecraftApp* pClass = (CMinecraftApp*)pParam; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 5e8dd13fc..4b8807399 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -288,7 +288,7 @@ public: virtual void FatalLoadError(); // Notifications from the game listener to be passed to the qnet listener - static void NotificationsCallback(void *pParam,DWORD dwNotification, unsigned int uiParam); + static void NotificationsCallback(void *pParam,std::uint32_t dwNotification, unsigned int uiParam); // for the ethernet being disconnected static void LiveLinkChangeCallback(void *pParam,BOOL bConnected); diff --git a/Minecraft.Client/Platform/Extrax64Stubs.cpp b/Minecraft.Client/Platform/Extrax64Stubs.cpp index 09aaa0104..ad521919b 100644 --- a/Minecraft.Client/Platform/Extrax64Stubs.cpp +++ b/Minecraft.Client/Platform/Extrax64Stubs.cpp @@ -467,9 +467,9 @@ void C_4JProfile::SetLockedProfile(int iProf) {} bool C_4JProfile::IsSignedIn(int iQuadrant) { return ( iQuadrant == 0); } bool C_4JProfile::IsSignedInLive(int iProf) { return true; } bool C_4JProfile::IsGuest(int iQuadrant) { return false; } -UINT C_4JProfile::RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant) { return 0; } -UINT C_4JProfile::DisplayOfflineProfile(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant) { return 0; } -UINT C_4JProfile::RequestConvertOfflineToGuestUI(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant) { return 0; } +UINT C_4JProfile::RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant) { return 0; } +UINT C_4JProfile::DisplayOfflineProfile(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant) { return 0; } +UINT C_4JProfile::RequestConvertOfflineToGuestUI(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant) { return 0; } void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} bool C_4JProfile::QuerySigninStatus(void) { return true; } void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid) {*pXuid = 0xe000d45248242f2e; } @@ -503,22 +503,22 @@ char* C_4JProfile::GetGamertag(int iPad){ return "PlayerName"; } std::wstring C_4JProfile::GetDisplayName(int iPad){ return L"PlayerName"; } #endif bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } -void C_4JProfile::SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam) {} -void C_4JProfile::SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam) {} +void C_4JProfile::SetSignInChangeCallback(void ( *Func)(void *, bool, unsigned int),void *lpParam) {} +void C_4JProfile::SetNotificationsCallback(void ( *Func)(void *, std::uint32_t, unsigned int),void *lpParam) {} bool C_4JProfile::RegionIsNorthAmerica(void) { return false; } bool C_4JProfile::LocaleIsUSorCanada(void) { return false; } HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; } bool C_4JProfile::IsSystemUIDisplayed() { return false; } -void C_4JProfile::SetProfileReadErrorCallback(void ( *Func)(LPVOID), LPVOID lpParam) {} -int( *defaultOptionsCallback)(LPVOID,C_4JProfile::PROFILESETTINGS *, const int iPad) = NULL; -LPVOID lpProfileParam = NULL; -int C_4JProfile::SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam) +void C_4JProfile::SetProfileReadErrorCallback(void ( *Func)(void *), void *lpParam) {} +int( *defaultOptionsCallback)(void *,C_4JProfile::PROFILESETTINGS *, const int iPad) = NULL; +void *lpProfileParam = NULL; +int C_4JProfile::SetDefaultOptionsCallback(int( *Func)(void *,PROFILESETTINGS *, const int iPad),void *lpParam) { defaultOptionsCallback = Func; lpProfileParam = lpParam; return 0; } -int C_4JProfile::SetOldProfileVersionCallback(int( *Func)(LPVOID,unsigned char *, const unsigned short,const int),LPVOID lpParam) { return 0; } +int C_4JProfile::SetOldProfileVersionCallback(int( *Func)(void *,unsigned char *, const unsigned short,const int),void *lpParam) { return 0; } // To store the dashboard preferences for controller flipped, etc. C_4JProfile::PROFILESETTINGS ProfileSettingsA[XUSER_MAX_COUNT]; @@ -548,7 +548,7 @@ void C_4JProfile::RegisterRichPresenceContext(int iGameConfigContextID) {} void C_4JProfile::SetRichPresenceContextValue(int iPad,int iContextID, int iVal) {} void C_4JProfile::SetCurrentGameActivity(int iPad,int iNewPresence, bool bSetOthersToIdle) {} void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam) {} -void C_4JProfile::SetUpsellCallback(void ( *Func)(LPVOID lpParam, eUpsellType type, eUpsellResponse response, int iUserData),LPVOID lpParam) {} +void C_4JProfile::SetUpsellCallback(void ( *Func)(void *lpParam, eUpsellType type, eUpsellResponse response, int iUserData),void *lpParam) {} void C_4JProfile::SetDebugFullOverride(bool bVal) {s_bProfileIsFullVersion = bVal;} void C_4JProfile::ShowProfileCard(int iPad, PlayerUID targetUid) {} diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index 38717792f..14729679c 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -700,10 +700,10 @@ ProfileManager.Initialise(TITLEID_MINECRAFT, ); // set a function to be called when there's a sign in change, so we can exit a level if the primary player signs out -ProfileManager.SetSignInChangeCallback(&CConsoleMinecraftApp::SignInChangeCallback,(LPVOID)&app); +ProfileManager.SetSignInChangeCallback(&CConsoleMinecraftApp::SignInChangeCallback, &app); // Set a callback for when there is a read error on profile data -//StorageManager.SetProfileReadErrorCallback(&CConsoleMinecraftApp::ProfileReadErrorCallback,(LPVOID)&app); +//StorageManager.SetProfileReadErrorCallback(&CConsoleMinecraftApp::ProfileReadErrorCallback, &app); // QNet needs to be setup after profile manager, as we do not want its Notify listener to handle From d2156d417c945d2e2247386d1435bdacad0d0181 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:23:57 +1100 Subject: [PATCH 187/192] Use standard types in profile content helpers --- 4J.Profile/4J_Profile.cpp | 14 +++++++------- 4J.Profile/4J_Profile.h | 10 +++++----- .../Platform/Common/Consoles_App.cpp | 2 +- .../Common/UI/UIScene_QuadrantSignin.cpp | 6 +++--- .../Platform/Common/XUI/XUI_LoadSettings.cpp | 12 ++++++------ .../Platform/Common/XUI/XUI_MultiGameCreate.cpp | 16 ++++++++-------- .../Platform/Common/XUI/XUI_MultiGameInfo.cpp | 4 ++-- Minecraft.Client/Platform/Extrax64Stubs.cpp | 10 +++++----- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/4J.Profile/4J_Profile.cpp b/4J.Profile/4J_Profile.cpp index 8aaf7b78c..5a7cf8baf 100644 --- a/4J.Profile/4J_Profile.cpp +++ b/4J.Profile/4J_Profile.cpp @@ -28,8 +28,8 @@ UINT C_4JProfile::RequestConvertOfflineToGuestUI(int(*Func)(void *, const bool, void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} bool C_4JProfile::QuerySigninStatus(void) { return true; } void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid, bool bOnlineXuid) { if (pXuid) *pXuid = 0; } -BOOL C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; } -BOOL C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return FALSE; } +bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; } +bool C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; } bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; } bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool *pbChatRestricted, bool *pbContentRestricted, int *piAge) { if (pbChatRestricted) *pbChatRestricted = false; @@ -38,13 +38,13 @@ bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool *pbChatRestricted return true; } void C_4JProfile::StartTrialGame() {} -void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed) { - if (allAllowed) *allAllowed = TRUE; - if (friendsAllowed) *friendsAllowed = TRUE; +void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed) { + if (allAllowed) *allAllowed = true; + if (friendsAllowed) *friendsAllowed = true; } -BOOL C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount) { return TRUE; } +bool C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, unsigned int xuidCount) { return true; } void C_4JProfile::ShowProfileCard(int iPad, PlayerUID targetUid) {} -bool C_4JProfile::GetProfileAvatar(int iPad, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam) { return false; } +bool C_4JProfile::GetProfileAvatar(int iPad, int(*Func)(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes), void *lpParam) { return false; } void C_4JProfile::CancelProfileAvatarRequest() {} int C_4JProfile::GetPrimaryPad() { return 0; } void C_4JProfile::SetPrimaryPad(int iPad) {} diff --git a/4J.Profile/4J_Profile.h b/4J.Profile/4J_Profile.h index bdf8ff89c..881480b03 100644 --- a/4J.Profile/4J_Profile.h +++ b/4J.Profile/4J_Profile.h @@ -62,15 +62,15 @@ public: void SetPrimaryPlayerChanged(bool bVal); bool QuerySigninStatus(void); void GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid); - BOOL AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2); - BOOL XUIDIsGuest(PlayerUID xuid); + bool AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2); + bool XUIDIsGuest(PlayerUID xuid); bool AllowedToPlayMultiplayer(int iProf); bool GetChatAndContentRestrictions(int iPad,bool *pbChatRestricted,bool *pbContentRestricted,int *piAge); void StartTrialGame(); // disables saves and leaderboard, and change state to readyforgame from pregame - void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed); - BOOL CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount ); + void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed); + bool CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, unsigned int xuidCount); void ShowProfileCard(int iPad, PlayerUID targetUid); - bool GetProfileAvatar(int iPad,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); + bool GetProfileAvatar(int iPad,int( *Func)(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes), void *lpParam); void CancelProfileAvatarRequest(); diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 131b54ab8..3d2145691 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5298,7 +5298,7 @@ bool CMinecraftApp::isXuidNotch(PlayerUID xuid) { if(m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) { - return ProfileManager.AreXUIDSEqual(xuid, m_xuidNotch) == TRUE; + return ProfileManager.AreXUIDSEqual(xuid, m_xuidNotch); } return false; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp index f5d59784b..476aa49db 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp @@ -8,7 +8,7 @@ namespace { -int AvatarReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes); +int AvatarReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes); } UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) @@ -258,9 +258,9 @@ void UIScene_QuadrantSignin::updateState() namespace { -int AvatarReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +int AvatarReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) { - return UIScene_QuadrantSignin::AvatarReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); + return UIScene_QuadrantSignin::AvatarReturned(lpParam, thumbnailData, thumbnailBytes); } } diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp index 0bef66487..a55bef5eb 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp @@ -857,8 +857,8 @@ int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue) { // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1022,8 +1022,8 @@ int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinu // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(), false, &pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1407,8 +1407,8 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen) { // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp index 049bb3cd2..bf17a2978 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameCreate.cpp @@ -474,8 +474,8 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr // Check if user-created content is allowed, as we cannot play multiplayer if it's not //bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && m_MoreOptionsParams.bOnlineGame; bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -579,8 +579,8 @@ int CScene_MultiGameCreate::WarningTrialTexturePackReturned(void *pParam,int iPa { // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -776,8 +776,8 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -831,8 +831,8 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameInfo.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameInfo.cpp index 20e1f4cac..5e5f662a6 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameInfo.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_MultiGameInfo.cpp @@ -287,8 +287,8 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass) // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; + bool pccAllowed = true; + bool pccFriendsAllowed = true; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; diff --git a/Minecraft.Client/Platform/Extrax64Stubs.cpp b/Minecraft.Client/Platform/Extrax64Stubs.cpp index ad521919b..683ef6f94 100644 --- a/Minecraft.Client/Platform/Extrax64Stubs.cpp +++ b/Minecraft.Client/Platform/Extrax64Stubs.cpp @@ -473,8 +473,8 @@ UINT C_4JProfile::RequestConvertOfflineToGuestUI(int( *Func)(void *,const boo void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} bool C_4JProfile::QuerySigninStatus(void) { return true; } void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid) {*pXuid = 0xe000d45248242f2e; } -BOOL C_4JProfile::AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2) { return false; } -BOOL C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; } +bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2) { return false; } +bool C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; } bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; } #if defined(__ORBIS__) @@ -488,9 +488,9 @@ bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool thisQuadrantOn #endif void C_4JProfile::StartTrialGame() {} -void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed) {} -BOOL C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount ) { return true; } -bool C_4JProfile::GetProfileAvatar(int iPad,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam) { return false; } +void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed) {} +bool C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, unsigned int xuidCount) { return true; } +bool C_4JProfile::GetProfileAvatar(int iPad,int( *Func)(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes), void *lpParam) { return false; } void C_4JProfile::CancelProfileAvatarRequest() {} int C_4JProfile::GetPrimaryPad() { return 0; } void C_4JProfile::SetPrimaryPad(int iPad) {} From f187f89dc3a73d689ad4dbeef2107ed2693d9d89 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:29:02 +1100 Subject: [PATCH 188/192] Use standard thumbnail callbacks in storage --- 4J.Storage/4J_Storage.cpp | 2 +- 4J.Storage/4J_Storage.h | 2 +- .../Platform/Common/Network/Sony/SonyRemoteStorage.cpp | 8 ++++---- .../Platform/Common/Network/Sony/SonyRemoteStorage.h | 6 ++++-- .../Common/UI/UIScene_InGameSaveManagementMenu.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp | 4 ++-- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 4 ++-- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/4J.Storage/4J_Storage.cpp b/4J.Storage/4J_Storage.cpp index 92d9f77cc..50c11bbb8 100644 --- a/4J.Storage/4J_Storage.cpp +++ b/4J.Storage/4J_Storage.cpp @@ -45,7 +45,7 @@ void C4JStorage::SetSaveMessageVPosition(float fY) {} C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int(*Func)(void *lpParam, SAVE_DETAILS *pSaveDetails, const bool), void *lpParam, char *pszSavePackName) { return ESaveGame_Idle; } PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; } void C4JStorage::ClearSavesInfo() {} -C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), void *lpParam) { return ESaveGame_Idle; } +C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes), void *lpParam) { return ESaveGame_Idle; } void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA &xContentData) { memset(&xContentData, 0, sizeof(xContentData)); } void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pdwImageBytes) *pdwImageBytes = 0; } C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, const bool, const bool), void *lpParam) { return ESaveGame_Idle; } diff --git a/4J.Storage/4J_Storage.h b/4J.Storage/4J_Storage.h index 5eebb844a..973352e6b 100644 --- a/4J.Storage/4J_Storage.h +++ b/4J.Storage/4J_Storage.h @@ -278,7 +278,7 @@ public: C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(void *lpParam,SAVE_DETAILS *pSaveDetails,const bool),void *lpParam,char *pszSavePackName); PSAVE_DETAILS ReturnSavesInfo(); void ClearSavesInfo(); // Clears results - C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), void *lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo + C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes), void *lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo void GetSaveCacheFileInfo(DWORD dwFile,XCONTENT_DATA &xContentData); void GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes); diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp index ba34c8e5f..a1e6d3e1d 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp @@ -238,7 +238,7 @@ bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpPara return true; } -int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) +int SonyRemoteStorage::LoadSaveDataThumbnailReturned(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes) { SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam; @@ -250,10 +250,10 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum app.DebugPrintf("Received data for a thumbnail\n"); - if(pbThumbnail && dwThumbnailBytes) + if(thumbnailData && thumbnailBytes) { - pClass->m_thumbnailData = pbThumbnail; - pClass->m_thumbnailDataSize = dwThumbnailBytes; + pClass->m_thumbnailData = thumbnailData; + pClass->m_thumbnailDataSize = thumbnailBytes; } else { diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h index 6e0a4b105..087b4d484 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h @@ -3,6 +3,8 @@ #include "sceRemoteStorage/header/sceRemoteStorage.h" +#include + class SonyRemoteStorage { public: @@ -94,7 +96,7 @@ public: bool setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpParam ); - static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); + static int LoadSaveDataThumbnailReturned(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes); static int setDataThread(void* lpParam); SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} @@ -107,7 +109,7 @@ protected: int m_dataProgress; char *m_pchServiceID; - PBYTE m_thumbnailData; + std::uint8_t *m_thumbnailData; unsigned int m_thumbnailDataSize; C4JThread* m_SetDataThread; PSAVE_INFO m_setDataSaveInfo; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp index faaecf340..dd30006c1 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -8,9 +8,9 @@ namespace { -int LoadSaveDataThumbnailReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +int LoadSaveDataThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) { - return UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); + return UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(lpParam, thumbnailData, thumbnailBytes); } } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index d4df5a4e7..9900ef8c5 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -25,9 +25,9 @@ namespace { -int LoadSaveDataThumbnailReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +int LoadSaveDataThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) { - return UIScene_LoadMenu::LoadSaveDataThumbnailReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); + return UIScene_LoadMenu::LoadSaveDataThumbnailReturned(lpParam, thumbnailData, thumbnailBytes); } } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 48e6d0a4b..eddede221 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -54,9 +54,9 @@ C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDet namespace { -int LoadSaveDataThumbnailReturnedThunk(void *lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) +int LoadSaveDataThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) { - return UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(lpParam, reinterpret_cast(pbThumbnail), dwThumbnailBytes); + return UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(lpParam, thumbnailData, thumbnailBytes); } } From 50693bfc20587a55df6d64af9611daa214240464 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 18:20:13 +1100 Subject: [PATCH 189/192] Use unique thumbnail callback thunks in UI scenes --- .../Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp | 6 +++--- Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp | 6 +++--- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp index dd30006c1..6ffc1903c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -8,7 +8,7 @@ namespace { -int LoadSaveDataThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) +int InGameSaveManagementThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) { return UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(lpParam, thumbnailData, thumbnailBytes); } @@ -266,7 +266,7 @@ void UIScene_InGameSaveManagementMenu::tick() app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&InGameSaveManagementThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { @@ -331,7 +331,7 @@ void UIScene_InGameSaveManagementMenu::tick() app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&InGameSaveManagementThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { // something went wrong diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index 9900ef8c5..c231e047c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -25,7 +25,7 @@ namespace { -int LoadSaveDataThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) +int LoadMenuThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) { return UIScene_LoadMenu::LoadSaveDataThumbnailReturned(lpParam, thumbnailData, thumbnailBytes); } @@ -233,9 +233,9 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye #ifdef _DURANGO // On Durango, we have an extra flag possible with LoadSaveDataThumbnail, which if true will force the loading of this thumbnail even if the save data isn't sync'd from // the cloud at this stage. This could mean that there could be a pretty large delay before the callback happens, in this case. - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturnedThunk,this,true); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadMenuThumbnailReturnedThunk,this,true); #else - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturnedThunk,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadMenuThumbnailReturnedThunk,this); #endif m_bShowTimer = true; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index eddede221..a5cea82fb 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -54,7 +54,7 @@ C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDet namespace { -int LoadSaveDataThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) +int LoadOrJoinThumbnailReturnedThunk(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes) { return UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(lpParam, thumbnailData, thumbnailBytes); } @@ -648,7 +648,7 @@ void UIScene_LoadOrJoinMenu::tick() app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadOrJoinThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { @@ -711,7 +711,7 @@ void UIScene_LoadOrJoinMenu::tick() app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturnedThunk,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadOrJoinThumbnailReturnedThunk,this); if(eLoadStatus!=C4JStorage::ESaveGame_GetSaveThumbnail) { // something went wrong From 85208b12b77a43ab3b100d07ea219eb857d89db7 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:12:25 +1100 Subject: [PATCH 190/192] Keep network player limit as an int constant --- Minecraft.Client/Platform/Xbox/Network/extra.h | 8 ++++++-- Minecraft.World/Platform/x64headers/extraX64.h | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Xbox/Network/extra.h b/Minecraft.Client/Platform/Xbox/Network/extra.h index d09b18b7f..5965b9736 100644 --- a/Minecraft.Client/Platform/Xbox/Network/extra.h +++ b/Minecraft.Client/Platform/Xbox/Network/extra.h @@ -1,4 +1,8 @@ - #pragma once +#include +#include -const int MINECRAFT_NET_MAX_PLAYERS = 8; +constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; + +static_assert(MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), + "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); diff --git a/Minecraft.World/Platform/x64headers/extraX64.h b/Minecraft.World/Platform/x64headers/extraX64.h index 0dac12ca6..51a7b5275 100644 --- a/Minecraft.World/Platform/x64headers/extraX64.h +++ b/Minecraft.World/Platform/x64headers/extraX64.h @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "../../../Minecraft.Client/Rendering/Models/SkinBox.h" @@ -17,12 +19,15 @@ const int XUSER_INDEX_FOCUS = 254; #ifdef __PSVITA__ const int XUSER_MAX_COUNT = 1; -const int MINECRAFT_NET_MAX_PLAYERS = 4; +constexpr int MINECRAFT_NET_MAX_PLAYERS = 4; #else const int XUSER_MAX_COUNT = 4; -const int MINECRAFT_NET_MAX_PLAYERS = 8; +constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; #endif +static_assert(MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), + "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); + #ifdef __ORBIS__ #include #include From 883e98bde0f9ef4859547221e6d1cc565a02e013 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Fri, 13 Mar 2026 19:47:32 +1100 Subject: [PATCH 191/192] Address review feedback on protocol types --- Minecraft.Client/GameState/StatsCounter.cpp | 58 +++++++++++-------- .../Textures/Packs/AbstractTexturePack.cpp | 10 ++-- .../Textures/Packs/DLCTexturePack.cpp | 6 +- .../Textures/Packs/DefaultTexturePack.cpp | 2 +- .../Textures/Packs/FolderTexturePack.cpp | 2 +- .../Stitching/PreStitchedTextureMap.cpp | 7 ++- .../Network/Packets/AddPlayerPacket.cpp | 16 ++--- .../Network/Packets/KickPlayerPacket.cpp | 2 +- .../Network/Packets/LoginPacket.cpp | 27 +++------ .../Network/Packets/PlayerInfoPacket.cpp | 2 +- .../Network/Packets/PreLoginPacket.cpp | 27 +++------ 11 files changed, 73 insertions(+), 86 deletions(-) diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index a68e2a46c..b63e909f7 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -10,6 +10,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../Platform/Common/Leaderboards/LeaderboardManager.h" +#include Stat** StatsCounter::LARGE_STATS[] = { &Stats::walkOneM, @@ -144,7 +145,7 @@ void StatsCounter::parse(void* data) //Pointer to current position in stat array std::uint8_t* pbData = reinterpret_cast(data); pbData += sizeof(GAME_SETTINGS); - unsigned short* statData = reinterpret_cast(pbData);//data + (STAT_DATA_OFFSET/sizeof(unsigned short)); + std::uint8_t* statData = pbData; //Value being read StatContainer newVal; @@ -157,19 +158,22 @@ void StatsCounter::parse(void* data) { if( !isLargeStat(*iter) ) { - if( statData[0] != 0 || statData[1] != 0 || statData[2] != 0 || statData[3] != 0 ) + std::uint16_t difficultyStats[eDifficulty_Max] = {}; + std::memcpy(difficultyStats, statData, sizeof(difficultyStats)); + if( difficultyStats[0] != 0 || difficultyStats[1] != 0 || difficultyStats[2] != 0 || difficultyStats[3] != 0 ) { - newVal.stats[0] = statData[0]; - newVal.stats[1] = statData[1]; - newVal.stats[2] = statData[2]; - newVal.stats[3] = statData[3]; + newVal.stats[0] = difficultyStats[0]; + newVal.stats[1] = difficultyStats[1]; + newVal.stats[2] = difficultyStats[2]; + newVal.stats[3] = difficultyStats[3]; stats.insert( std::make_pair(*iter, newVal) ); } - statData += 4; + statData += sizeof(difficultyStats); } else { - unsigned int* largeStatData = (unsigned int*)statData; + std::uint32_t largeStatData[eDifficulty_Max] = {}; + std::memcpy(largeStatData, statData, sizeof(largeStatData)); if( largeStatData[0] != 0 || largeStatData[1] != 0 || largeStatData[2] != 0 || largeStatData[3] != 0 ) { newVal.stats[0] = largeStatData[0]; @@ -178,21 +182,22 @@ void StatsCounter::parse(void* data) newVal.stats[3] = largeStatData[3]; stats.insert( std::make_pair(*iter, newVal) ); } - largeStatData += 4; - statData = (unsigned short*)largeStatData; + statData += sizeof(largeStatData); } } else { - if( statData[0] != 0 ) + std::uint16_t achievementValue = 0; + std::memcpy(&achievementValue, statData, sizeof(achievementValue)); + if( achievementValue != 0 ) { - newVal.stats[0] = statData[0]; + newVal.stats[0] = achievementValue; newVal.stats[1] = 0; newVal.stats[2] = 0; newVal.stats[3] = 0; stats.insert( std::make_pair(*iter, newVal) ); } - ++statData; + statData += sizeof(achievementValue); } } @@ -222,8 +227,7 @@ void StatsCounter::save(int player, bool force) pbData += sizeof(GAME_SETTINGS); //Pointer to current position in stat array - //unsigned short* statData = (unsigned short*)data + (STAT_DATA_OFFSET/sizeof(unsigned short)); - unsigned short* statData = reinterpret_cast(pbData); + std::uint8_t* statData = pbData; //Reset all the data to 0 (we're going to replace it with the map data) memset(statData, 0, CConsoleMinecraftApp::GAME_DEFINED_PROFILE_DATA_BYTES-sizeof(GAME_SETTINGS)); @@ -239,18 +243,20 @@ void StatsCounter::save(int player, bool force) { if( !isLargeStat(*iter) ) { + std::uint16_t difficultyStats[eDifficulty_Max] = {}; if( val != stats.end() ) { - statData[0] = val->second.stats[0]; - statData[1] = val->second.stats[1]; - statData[2] = val->second.stats[2]; - statData[3] = val->second.stats[3]; + difficultyStats[0] = static_cast(val->second.stats[0]); + difficultyStats[1] = static_cast(val->second.stats[1]); + difficultyStats[2] = static_cast(val->second.stats[2]); + difficultyStats[3] = static_cast(val->second.stats[3]); } - statData += 4; + std::memcpy(statData, difficultyStats, sizeof(difficultyStats)); + statData += sizeof(difficultyStats); } else { - unsigned int* largeStatData = (unsigned int*)statData; + std::uint32_t largeStatData[eDifficulty_Max] = {}; if( val != stats.end() ) { largeStatData[0] = val->second.stats[0]; @@ -258,17 +264,19 @@ void StatsCounter::save(int player, bool force) largeStatData[2] = val->second.stats[2]; largeStatData[3] = val->second.stats[3]; } - largeStatData += 4; - statData = (unsigned short*)largeStatData; + std::memcpy(statData, largeStatData, sizeof(largeStatData)); + statData += sizeof(largeStatData); } } else { + std::uint16_t achievementValue = 0; if( val != stats.end() ) { - statData[0] = val->second.stats[0]; + achievementValue = static_cast(val->second.stats[0]); } - ++statData; + std::memcpy(statData, &achievementValue, sizeof(achievementValue)); + statData += sizeof(achievementValue); } } diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index f2c92fa20..8821e6068 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -40,7 +40,7 @@ void AbstractTexturePack::loadIcon() { #ifdef _XBOX // 4J Stu - Temporary only - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); @@ -56,7 +56,7 @@ void AbstractTexturePack::loadComparison() { #ifdef _XBOX // 4J Stu - Temporary only - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); @@ -232,7 +232,7 @@ void AbstractTexturePack::loadDefaultUI() const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); // Load new skin - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur"); @@ -291,7 +291,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable() // load from the .xzp file const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; // Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable @@ -376,7 +376,7 @@ std::wstring AbstractTexturePack::getXuiRootPath() const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); // Load new skin - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index c99e0ec3b..4d56cf46e 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -225,7 +225,7 @@ void DLCTexturePack::loadColourTable() std::uint32_t dwSize = 0; std::uint8_t *pbData = dataFile->getData(dwSize); - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; // Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable @@ -483,7 +483,7 @@ void DLCTexturePack::loadUI() std::uint32_t dwSize = 0; std::uint8_t *pbData = dataFile->getData(dwSize); - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#skin_Minecraft.xur",pbData, dwSize); @@ -557,7 +557,7 @@ std::wstring DLCTexturePack::getXuiRootPath() std::uint32_t dwSize = 0; std::uint8_t *pbData = dataFile->getData(dwSize); - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#",pbData, dwSize); path = szResourceLocator; diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp index 08a4064ce..a6e59d471 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp @@ -17,7 +17,7 @@ void DefaultTexturePack::loadIcon() { #ifdef _XBOX // 4J Stu - Temporary only - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp index da6a514a4..2365d08cb 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp @@ -79,7 +79,7 @@ void FolderTexturePack::loadUI() // Load new skin if(hasFile(L"TexturePack.xzp")) { - static const int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str()); diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index b07bc5db8..99066524e 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -18,6 +18,7 @@ #include "../../UI/SimpleIcon.h" #include "../CompassTexture.h" #include "../ClockTexture.h" +#include const std::wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno"; @@ -178,7 +179,7 @@ void PreStitchedTextureMap::stitch() #ifdef __PSVITA__ // AP - alpha cut out is expensive on vita so we mark which icons actually require it - std::uint32_t *data = reinterpret_cast(this->getStitchedTexture()->getData()->getBuffer()); + const std::uint8_t *data = this->getStitchedTexture()->getData()->getBuffer(); int Width = this->getStitchedTexture()->getWidth(); int Height = this->getStitchedTexture()->getHeight(); for(AUTO_VAR(it, texturesByName.begin()); it != texturesByName.end(); ++it) @@ -196,8 +197,10 @@ void PreStitchedTextureMap::stitch() { for( int u = u0;u < u1; u+= 1 ) { + std::uint32_t pixel = 0; + std::memcpy(&pixel, data + ((v * Width + u) * sizeof(pixel)), sizeof(pixel)); // is this texel alpha value < 0.1 - if( (data[v * Width + u] & 0xff000000) < 0x20000000 ) + if( (pixel & 0xff000000) < 0x20000000 ) { // this texel is transparent. Mark the icon as such and bail preStitched->setFlags(Icon::IS_ALPHA_CUT_OUT); diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp index fe5a40516..a47257597 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp @@ -78,11 +78,9 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException carriedItem = dis->readShort(); xuid = dis->readPlayerUID(); OnlineXuid = dis->readPlayerUID(); - m_playerIndex = static_cast(dis->readByte()); - int skinId = dis->readInt(); - std::memcpy(&m_skinId, &skinId, sizeof(m_skinId)); - int capeId = dis->readInt(); - std::memcpy(&m_capeId, &capeId, sizeof(m_capeId)); + m_playerIndex = dis->readByte(); + m_skinId = static_cast(dis->readInt()); + m_capeId = static_cast(dis->readInt()); INT privileges = dis->readInt(); m_uiGamePrivileges = *(unsigned int *)&privileges; MemSect(1); @@ -104,12 +102,8 @@ void AddPlayerPacket::write(DataOutputStream *dos) //throws IOException dos->writePlayerUID(xuid); dos->writePlayerUID(OnlineXuid); dos->writeByte(static_cast(m_playerIndex)); // 4J Added - int skinId = 0; - std::memcpy(&skinId, &m_skinId, sizeof(m_skinId)); - dos->writeInt(skinId); - int capeId = 0; - std::memcpy(&capeId, &m_capeId, sizeof(m_capeId)); - dos->writeInt(capeId); + dos->writeInt(static_cast(m_skinId)); + dos->writeInt(static_cast(m_capeId)); dos->writeInt(m_uiGamePrivileges); entityData->packAll(dos); diff --git a/Minecraft.World/Network/Packets/KickPlayerPacket.cpp b/Minecraft.World/Network/Packets/KickPlayerPacket.cpp index afb1666cf..fde36a1b8 100644 --- a/Minecraft.World/Network/Packets/KickPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/KickPlayerPacket.cpp @@ -23,7 +23,7 @@ void KickPlayerPacket::handle(PacketListener *listener) void KickPlayerPacket::read(DataInputStream *dis) //throws IOException { - m_networkSmallId = static_cast(dis->readByte()); + m_networkSmallId = dis->readByte(); } void KickPlayerPacket::write(DataOutputStream *dos) //throws IOException diff --git a/Minecraft.World/Network/Packets/LoginPacket.cpp b/Minecraft.World/Network/Packets/LoginPacket.cpp index 9eafe5cc5..9d2d3364d 100644 --- a/Minecraft.World/Network/Packets/LoginPacket.cpp +++ b/Minecraft.World/Network/Packets/LoginPacket.cpp @@ -107,20 +107,17 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException seed = dis->readLong(); gameType = dis->readInt(); dimension = (int)dis->readByte(); - mapHeight = static_cast(dis->readByte()); - maxPlayers = static_cast(dis->readByte()); + mapHeight = dis->readByte(); + maxPlayers = dis->readByte(); m_offlineXuid = dis->readPlayerUID(); m_onlineXuid = dis->readPlayerUID(); m_friendsOnlyUGC = dis->readBoolean(); - int ugcPlayersVersion = dis->readInt(); - std::memcpy(&m_ugcPlayersVersion, &ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); + m_ugcPlayersVersion = static_cast(dis->readInt()); difficulty = (int)dis->readByte(); m_multiplayerInstanceId = dis->readInt(); - m_playerIndex = static_cast(dis->readByte()); - int skinId = dis->readInt(); - std::memcpy(&m_playerSkinId, &skinId, sizeof(m_playerSkinId)); - int capeId = dis->readInt(); - std::memcpy(&m_playerCapeId, &capeId, sizeof(m_playerCapeId)); + m_playerIndex = dis->readByte(); + m_playerSkinId = static_cast(dis->readInt()); + m_playerCapeId = static_cast(dis->readInt()); m_isGuest = dis->readBoolean(); m_newSeaLevel = dis->readBoolean(); m_uiGamePrivileges = dis->readInt(); @@ -152,18 +149,12 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException dos->writePlayerUID(m_offlineXuid); dos->writePlayerUID(m_onlineXuid); dos->writeBoolean(m_friendsOnlyUGC); - int ugcPlayersVersion = 0; - std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); - dos->writeInt(ugcPlayersVersion); + dos->writeInt(static_cast(m_ugcPlayersVersion)); dos->writeByte((std::uint8_t)difficulty); dos->writeInt(m_multiplayerInstanceId); dos->writeByte((std::uint8_t)m_playerIndex); - int skinId = 0; - std::memcpy(&skinId, &m_playerSkinId, sizeof(m_playerSkinId)); - dos->writeInt(skinId); - int capeId = 0; - std::memcpy(&capeId, &m_playerCapeId, sizeof(m_playerCapeId)); - dos->writeInt(capeId); + dos->writeInt(static_cast(m_playerSkinId)); + dos->writeInt(static_cast(m_playerCapeId)); dos->writeBoolean(m_isGuest); dos->writeBoolean(m_newSeaLevel); dos->writeInt(m_uiGamePrivileges); diff --git a/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp b/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp index 020c9e739..786d2734d 100644 --- a/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp +++ b/Minecraft.World/Network/Packets/PlayerInfoPacket.cpp @@ -38,7 +38,7 @@ PlayerInfoPacket::PlayerInfoPacket(std::shared_ptr player) void PlayerInfoPacket::read(DataInputStream *dis) { - m_networkSmallId = static_cast(dis->readByte()); + m_networkSmallId = dis->readByte(); m_playerColourIndex = dis->readShort(); m_playerPrivileges = dis->readInt(); m_entityId = dis->readInt(); diff --git a/Minecraft.World/Network/Packets/PreLoginPacket.cpp b/Minecraft.World/Network/Packets/PreLoginPacket.cpp index d3e746e1a..9bb385884 100644 --- a/Minecraft.World/Network/Packets/PreLoginPacket.cpp +++ b/Minecraft.World/Network/Packets/PreLoginPacket.cpp @@ -59,10 +59,9 @@ void PreLoginPacket::read(DataInputStream *dis) //throws IOException loginKey = readUtf(dis, 32); - m_friendsOnlyBits = static_cast(dis->readByte()); - std::int32_t ugcPlayersVersion = dis->readInt(); - std::memcpy(&m_ugcPlayersVersion, &ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); - m_dwPlayerCount = static_cast(dis->readByte()); + m_friendsOnlyBits = dis->readByte(); + m_ugcPlayersVersion = static_cast(dis->readInt()); + m_dwPlayerCount = dis->readByte(); if( m_dwPlayerCount > 0 ) { m_playerXuids = new PlayerUID[m_dwPlayerCount]; @@ -75,12 +74,10 @@ void PreLoginPacket::read(DataInputStream *dis) //throws IOException { m_szUniqueSaveName[i] = static_cast(dis->readByte()); } - std::int32_t serverSettings = dis->readInt(); - std::memcpy(&m_serverSettings, &serverSettings, sizeof(m_serverSettings)); - m_hostIndex = static_cast(dis->readByte()); + m_serverSettings = static_cast(dis->readInt()); + m_hostIndex = dis->readByte(); - std::int32_t texturePackId = dis->readInt(); - std::memcpy(&m_texturePackId, &texturePackId, sizeof(m_texturePackId)); + m_texturePackId = static_cast(dis->readInt()); // Set the name of the map so we can check it for players banned lists app.SetUniqueMapName((char *)m_szUniqueSaveName); @@ -93,9 +90,7 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException writeUtf(loginKey, dos); dos->writeByte(m_friendsOnlyBits); - std::int32_t ugcPlayersVersion = 0; - std::memcpy(&ugcPlayersVersion, &m_ugcPlayersVersion, sizeof(m_ugcPlayersVersion)); - dos->writeInt(ugcPlayersVersion); + dos->writeInt(static_cast(m_ugcPlayersVersion)); dos->writeByte((std::uint8_t)m_dwPlayerCount); for(std::uint32_t i = 0; i < m_dwPlayerCount; ++i) { @@ -107,13 +102,9 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException { dos->writeByte(static_cast(m_szUniqueSaveName[i])); } - std::int32_t serverSettings = 0; - std::memcpy(&serverSettings, &m_serverSettings, sizeof(m_serverSettings)); - dos->writeInt(serverSettings); + dos->writeInt(static_cast(m_serverSettings)); dos->writeByte(m_hostIndex); - std::int32_t texturePackId = 0; - std::memcpy(&texturePackId, &m_texturePackId, sizeof(texturePackId)); - dos->writeInt(texturePackId); + dos->writeInt(static_cast(m_texturePackId)); } void PreLoginPacket::handle(PacketListener *listener) From 00d65b8487e45535b90b431868205db849b5aa10 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:11:00 +1100 Subject: [PATCH 192/192] Address remaining review feedback on buffer reads --- .../Platform/Common/Consoles_App.cpp | 17 ++- .../Platform/Common/DLC/DLCAudioFile.cpp | 109 ++++++++++++++---- .../Platform/Common/DLC/DLCManager.cpp | 63 ++++++---- .../Network/Packets/AddPlayerPacket.cpp | 2 +- .../TextureAndGeometryChangePacket.cpp | 8 +- .../Packets/TextureAndGeometryPacket.cpp | 8 +- 6 files changed, 142 insertions(+), 65 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 9f1ecb012..304e1aa0a 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -38,6 +38,7 @@ #include "../Minecraft.World/IO/Streams/InputOutputStream.h" #include "../Minecraft.World/Level/Storage/LevelSettings.h" #include "../Minecraft.Client/Player/User.h" +#include #include "../Minecraft.World/Level/LevelData.h" #include "../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h" @@ -7649,6 +7650,13 @@ unsigned int CMinecraftApp::FromBigEndian(unsigned int uiValue) void CMinecraftApp::GetImageTextData(std::uint8_t *imageData, unsigned int imageBytes, unsigned char *seedText, unsigned int &uiHostOptions, bool &bHostOptionsRead, std::uint32_t &uiTexturePack) { + auto readPngUInt32 = [](const std::uint8_t *data) -> unsigned int + { + unsigned int value = 0; + std::memcpy(&value, data, sizeof(value)); + return value; + }; + std::uint8_t *ucPtr = imageData; unsigned int uiCount=0; unsigned int uiChunkLen; @@ -7666,11 +7674,9 @@ void CMinecraftApp::GetImageTextData(std::uint8_t *imageData, unsigned int image while(uiCount < imageBytes) { - uiChunkLen=*(unsigned int *)&ucPtr[uiCount]; - uiChunkLen=FromBigEndian(uiChunkLen); + uiChunkLen = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); uiCount+=sizeof(int); - uiChunkType=*(unsigned int *)&ucPtr[uiCount]; - uiChunkType=FromBigEndian(uiChunkType); + uiChunkType = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); uiCount+=sizeof(int); if(uiChunkType==PNG_TAG_tEXt) // tEXt @@ -7735,8 +7741,7 @@ void CMinecraftApp::GetImageTextData(std::uint8_t *imageData, unsigned int image } } uiCount+=uiChunkLen; - uiCRC=*(unsigned int*)&ucPtr[uiCount]; - uiCRC=FromBigEndian(uiCRC); + uiCRC = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); uiCount+=sizeof(int); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp index c7cf23cb1..730976f59 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp @@ -1,4 +1,7 @@ #include "../../Minecraft.World/Platform/stdafx.h" +#include +#include +#include #include "DLCManager.h" #include "DLCAudioFile.h" #if defined _XBOX || defined _WINDOWS64 @@ -6,6 +9,64 @@ #include "../../Minecraft.Client/Platform/Xbox/XML/xmlFilesCallback.h" #endif +namespace +{ + constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2; + +#if WCHAR_MAX > 0xFFFF + static std::wstring ReadAudioDlcWString(const void *data) + { + const std::uint16_t *chars = static_cast(data); + const std::uint16_t *end = chars; + while(*end != 0) + { + ++end; + } + + std::wstring out(static_cast(end - chars), 0); + for(std::size_t i = 0; i < out.size(); ++i) + { + out[i] = static_cast(chars[i]); + } + return out; + } +#else + static std::wstring ReadAudioDlcWString(const void *data) + { + return std::wstring(static_cast(data)); + } +#endif + + template + T ReadAudioDlcValue(const std::uint8_t *data, unsigned int offset = 0) + { + T value; + std::memcpy(&value, data + offset, sizeof(value)); + return value; + } + + template + void ReadAudioDlcStruct(T *out, const std::uint8_t *data, unsigned int offset = 0) + { + std::memcpy(out, data + offset, sizeof(*out)); + } + + inline unsigned int AudioParamAdvance(unsigned int wcharCount) + { + return static_cast(sizeof(C4JStorage::DLC_FILE_PARAM) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); + } + + inline unsigned int AudioDetailAdvance(unsigned int wcharCount) + { + return static_cast(sizeof(C4JStorage::DLC_FILE_DETAILS) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); + } + + inline std::wstring ReadAudioParamString(const std::uint8_t *data, unsigned int offset) + { + return ReadAudioDlcWString(data + offset + offsetof(C4JStorage::DLC_FILE_PARAM, wchData)); + } +} + DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) { m_pbData = NULL; @@ -128,7 +189,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLe // File format defined in the AudioPacker // File format: Version 1 - unsigned int uiVersion=*(unsigned int *)pbData; + unsigned int uiVersion = ReadAudioDlcValue(pbData, uiCurrentByte); uiCurrentByte+=sizeof(int); if(uiVersion < CURRENT_AUDIO_VERSION_NUM) @@ -138,60 +199,62 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLe return false; } - unsigned int uiParameterTypeCount=*(unsigned int *)&pbData[uiCurrentByte]; + unsigned int uiParameterTypeCount = ReadAudioDlcValue(pbData, uiCurrentByte); uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; + C4JStorage::DLC_FILE_PARAM paramBuf; + ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte); for(unsigned int i=0;iwchData); + std::wstring parameterName = ReadAudioParamString(pbData, uiCurrentByte); EAudioParameterType type = getParameterType(parameterName); if( type != e_AudioParamType_Invalid ) { - parameterMapping[pParams->dwType] = type; + parameterMapping[paramBuf.dwType] = type; } - uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR)); - pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; + uiCurrentByte += AudioParamAdvance(paramBuf.dwWchCount); + ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte); } - unsigned int uiFileCount=*(unsigned int *)&pbData[uiCurrentByte]; + unsigned int uiFileCount = ReadAudioDlcValue(pbData, uiCurrentByte); uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; + C4JStorage::DLC_FILE_DETAILS fileBuf; + ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); unsigned int tempByteOffset = uiCurrentByte; for(unsigned int i=0;idwWchCount * sizeof(WCHAR); - pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[tempByteOffset]; + tempByteOffset += AudioDetailAdvance(fileBuf.dwWchCount); + ReadAudioDlcStruct(&fileBuf, pbData, tempByteOffset); } - std::uint8_t *pbTemp = reinterpret_cast(pFile); - pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; + std::uint8_t *pbTemp = &pbData[tempByteOffset]; + ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); for(unsigned int i=0;idwType; + EAudioType type = (EAudioType)fileBuf.dwType; // Params - unsigned int uiParameterCount=*(unsigned int *)pbTemp; + unsigned int uiParameterCount = ReadAudioDlcValue(pbTemp); pbTemp+=sizeof(int); - pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; + ReadAudioDlcStruct(¶mBuf, pbTemp); for(unsigned int j=0;jdwType )); + AUTO_VAR(it, parameterMapping.find(paramBuf.dwType)); if(it != parameterMapping.end() ) { - addParameter(type,(EAudioParameterType)pParams->dwType,(WCHAR *)pParams->wchData); + addParameter(type, (EAudioParameterType)paramBuf.dwType, ReadAudioParamString(pbTemp, 0)); } - pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount); - pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; + pbTemp += AudioParamAdvance(paramBuf.dwWchCount); + ReadAudioDlcStruct(¶mBuf, pbTemp); } // Move the pointer to the start of the next files data; - pbTemp+=pFile->uiFileSize; - uiCurrentByte+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); + pbTemp += fileBuf.uiFileSize; + uiCurrentByte += AudioDetailAdvance(fileBuf.dwWchCount); - pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; + ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index 2d7740a27..d633e7223 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -7,6 +7,7 @@ #include "../../Minecraft.World/Util/PortableFileIO.h" #include "../../Minecraft.Client/Minecraft.h" #include "../../Minecraft.Client/Textures/Packs/TexturePackRepository.h" +#include #include #include #include @@ -57,6 +58,20 @@ static_assert( sizeof(wchar_t) == 2, "How did we get here? wide char smaller tha namespace { + template + T ReadDlcValue(const std::uint8_t *data, unsigned int offset = 0) + { + T value; + std::memcpy(&value, data + offset, sizeof(value)); + return value; + } + + template + void ReadDlcStruct(T *out, const std::uint8_t *data, unsigned int offset = 0) + { + std::memcpy(out, data + offset, sizeof(*out)); + } + std::wstring getMountedDlcReadPath(const std::string &path) { std::wstring readPath = convStringToWstring(path); @@ -680,7 +695,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLe // // unsigned long, p = number of parameters // // p * DLC_FILE_PARAM describing each parameter for this file // // ulFileSize bytes of data blob of the file added - unsigned int uiVersion=*(unsigned int *)pbData; + unsigned int uiVersion = ReadDlcValue(pbData, uiCurrentByte); uiCurrentByte+=sizeof(int); if(uiVersion < CURRENT_DLC_VERSION_NUM) @@ -689,46 +704,48 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLe return 0; } pack->SetDataPointer(pbData); - unsigned int uiParameterCount=*(unsigned int *)&pbData[uiCurrentByte]; + unsigned int uiParameterCount = ReadDlcValue(pbData, uiCurrentByte); uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; + C4JStorage::DLC_FILE_PARAM paramBuf; + ReadDlcStruct(¶mBuf, pbData, uiCurrentByte); for(unsigned int i=0;iwchData); + std::wstring parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); if( type != DLCManager::e_DLCParamType_Invalid ) { - parameterMapping[pParams->dwType] = type; + parameterMapping[paramBuf.dwType] = type; } - uiCurrentByte+= DLC_PARAM_ADV(pParams->dwWchCount); - pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; + uiCurrentByte += DLC_PARAM_ADV(paramBuf.dwWchCount); + ReadDlcStruct(¶mBuf, pbData, uiCurrentByte); } - unsigned int uiFileCount=*(unsigned int *)&pbData[uiCurrentByte]; + unsigned int uiFileCount = ReadDlcValue(pbData, uiCurrentByte); uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; + C4JStorage::DLC_FILE_DETAILS fileBuf; + ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); unsigned int dwTemp=uiCurrentByte; for(unsigned int i=0;idwWchCount); - pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; + dwTemp += DLC_DETAIL_ADV(fileBuf.dwWchCount); + ReadDlcStruct(&fileBuf, pbData, dwTemp); } - std::uint8_t *pbTemp = reinterpret_cast(pFile); - pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; + std::uint8_t *pbTemp = &pbData[dwTemp]; + ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); for(unsigned int i=0;idwType; + DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType; // Params - uiParameterCount=*(unsigned int *)pbTemp; + uiParameterCount = ReadDlcValue(pbTemp); pbTemp+=sizeof(int); - pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; + ReadDlcStruct(¶mBuf, pbTemp); for(unsigned int j=0;jdwType )); + AUTO_VAR(it, parameterMapping.find(paramBuf.dwType)); if(it != parameterMapping.end() ) { @@ -736,7 +753,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLe { if(it->second==e_DLCParamType_PackId) { - std::wstring wsTemp = DLC_WSTRING(pParams->wchData); + std::wstring wsTemp = DLC_PARAM_WSTR(pbTemp, 0); std::wstringstream ss; // 4J Stu - numbered using decimal to make it easier for artists/people to number manually ss << std::dec << wsTemp.c_str(); @@ -746,16 +763,16 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLe } } } - pbTemp+=DLC_PARAM_ADV(pParams->dwWchCount); - pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; + pbTemp += DLC_PARAM_ADV(paramBuf.dwWchCount); + ReadDlcStruct(¶mBuf, pbTemp); } if(bPackIDSet) break; // Move the pointer to the start of the next files data; - pbTemp+=pFile->uiFileSize; - uiCurrentByte+=DLC_DETAIL_ADV(pFile->dwWchCount); + pbTemp += fileBuf.uiFileSize; + uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount); - pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; + ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); } parameterMapping.clear(); diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp index a47257597..57c3a5214 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp @@ -82,7 +82,7 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException m_skinId = static_cast(dis->readInt()); m_capeId = static_cast(dis->readInt()); INT privileges = dis->readInt(); - m_uiGamePrivileges = *(unsigned int *)&privileges; + m_uiGamePrivileges = static_cast(privileges); MemSect(1); unpack = SynchedEntityData::unpack(dis); MemSect(0); diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp index 9efedd881..aed41853e 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp @@ -1,5 +1,4 @@ #include "../../Platform/stdafx.h" -#include #include #include "../../IO/Streams/InputOutputStream.h" #include "../../Headers/net.minecraft.world.entity.h" @@ -32,17 +31,14 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(std::shared_ptrreadInt(); - int skinId = dis->readInt(); - std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID)); + dwSkinID = static_cast(dis->readInt()); path = dis->readUTF(); } void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); - int skinId = 0; - std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID)); - dos->writeInt(skinId); + dos->writeInt(static_cast(dwSkinID)); dos->writeUTF(path); } diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp index 941b468ff..fa479a143 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp @@ -1,5 +1,4 @@ #include "../../Platform/stdafx.h" -#include #include #include "../../IO/Streams/InputOutputStream.h" #include "PacketListener.h" @@ -123,8 +122,7 @@ void TextureAndGeometryPacket::handle(PacketListener *listener) void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - int skinId = dis->readInt(); - std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID)); + dwSkinID = static_cast(dis->readInt()); dwTextureBytes = (std::uint32_t)dis->readShort(); if(dwTextureBytes>0) @@ -162,9 +160,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException { dos->writeUTF(textureName); - int skinId = 0; - std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID)); - dos->writeInt(skinId); + dos->writeInt(static_cast(dwSkinID)); dos->writeShort((short)dwTextureBytes); for(std::uint32_t i=0;i