From 7df158d2664e63798fe8585813ae826fb872d6d1 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Wed, 1 Apr 2026 01:18:36 -0500 Subject: [PATCH] replace XMemSet/XMemSet128 --- .../Common/Source Files/Colours/ColourTable.cpp | 1 + .../Minecraft.Client/Source Files/Extrax64Stubs.cpp | 2 -- .../net/minecraft/client/renderer/TileRenderer.cpp | 2 +- .../net/minecraft/world/level/Level.cpp | 2 +- .../world/level/chunk/CompressedTileStorage.cpp | 10 +++++----- .../minecraft/world/level/chunk/SparseDataStorage.cpp | 6 +++--- .../minecraft/world/level/chunk/SparseLightStorage.cpp | 6 +++--- .../world/level/levelgen/CustomLevelSource.cpp | 2 +- .../minecraft/world/level/levelgen/FlatLevelSource.cpp | 2 +- .../world/level/levelgen/HellFlatLevelSource.cpp | 2 +- .../world/level/levelgen/HellRandomLevelSource.cpp | 2 +- .../world/level/levelgen/RandomLevelSource.cpp | 2 +- .../level/levelgen/TheEndLevelRandomLevelSource.cpp | 2 +- minecraft/Minecraft.World/x64headers/extraX64.h | 2 -- 14 files changed, 20 insertions(+), 23 deletions(-) diff --git a/minecraft/Minecraft.Client/Common/Source Files/Colours/ColourTable.cpp b/minecraft/Minecraft.Client/Common/Source Files/Colours/ColourTable.cpp index 05ef7ec5b..ebb8a0f02 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/Colours/ColourTable.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/Colours/ColourTable.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "ColourTable.h" #include "Minecraft.World/ConsoleHelpers/StringHelpers.h" diff --git a/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp b/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp index 7c2c98360..d9c8e313a 100644 --- a/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp +++ b/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp @@ -38,8 +38,6 @@ int32_t XPartyGetUserList(void* pUserList) { return 0; } bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; } -void XMemSet(void* a, int t, size_t s) { memset(a, t, s); } -void XMemSet128(void* a, int t, size_t s) { memset(a, t, s); } void* XPhysicalAlloc(size_t a, uintptr_t b, uintptr_t c, uint32_t d) { return malloc(a); } diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/TileRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/TileRenderer.cpp index 877ac5fbb..5b0dd9b82 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/TileRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/TileRenderer.cpp @@ -210,7 +210,7 @@ TileRenderer::TileRenderer(LevelSource* level, int xMin, int yMin, int zMin, this->zMin2 = zMin - 2; this->tileIds = tileIds; cache = new unsigned int[32 * 32 * 32]; - XMemSet(cache, 0, 32 * 32 * 32 * sizeof(unsigned int)); + memset(cache, 0, 32 * 32 * 32 * sizeof(unsigned int)); } TileRenderer::~TileRenderer() { diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp index 41913b1b6..7781106bb 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp @@ -145,7 +145,7 @@ void Level::initCacheComplete(lightCache_t* cache, int xc, int yc, int zc) { old[4] = cache[GetIndex(xc, yc + 1, zc)]; } - XMemSet128(cache, 0, 16 * 16 * 16 * sizeof(lightCache_t)); + memset(cache, 0, 16 * 16 * 16 * sizeof(lightCache_t)); if (!(yc & 0xffffff00)) { cache[GetIndex(xc, yc, zc)] = old[0]; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/CompressedTileStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/CompressedTileStorage.cpp index 89c877c92..089681d55 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -386,8 +386,8 @@ void CompressedTileStorage::setData(std::vector& dataIn, unsigned int i unsigned char* tile_types = pucData + usDataOffset; repacked = tile_types + tiletypecount; - XMemSet(tile_types, 255, tiletypecount); - XMemSet(repacked, 0, tiledatasize); + memset(tile_types, 255, tiletypecount); + memset(repacked, 0, tiledatasize); newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK) << INDEX_OFFSET_SHIFT; usDataOffset += tiletypecount + tiledatasize; @@ -1017,7 +1017,7 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) { unpacked_data = tempdata; int value = (blockIndices[i] >> INDEX_TILE_SHIFT) & INDEX_TILE_MASK; - XMemSet(tempdata, value, 64); + memset(tempdata, value, 64); } else { unpacked_data = data + ((blockIndices[i] >> INDEX_OFFSET_SHIFT) & @@ -1102,8 +1102,8 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) { tile_types = pucData + usDataOffset; repacked = tile_types + tiletypecount; - XMemSet(tile_types, 255, tiletypecount); - XMemSet(repacked, 0, tiledatasize); + memset(tile_types, 255, tiletypecount); + memset(repacked, 0, tiledatasize); newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK) << INDEX_OFFSET_SHIFT; usDataOffset += tiletypecount + tiledatasize; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseDataStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseDataStorage.cpp index 6323d1e7e..b507cbc92 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -47,7 +47,7 @@ SparseDataStorage::SparseDataStorage() { for (int i = 1; i < 128; i++) { planeIndices[i] = i - 1; } - XMemSet(data, 0, 128 * 127); + memset(data, 0, 128 * 127); // Data and count packs together the pointer to our data and the count of // planes allocated - 127 planes allocated in this case @@ -202,7 +202,7 @@ void SparseDataStorage::setData(std::vector& dataIn, unsigned int inOff // Gets all data values into an array of length 16384. Destination data will // have same order as original java game. void SparseDataStorage::getData(std::vector& retArray, unsigned int retOffset) { - XMemSet(retArray.data() + +retOffset, 0, 16384); + memset(retArray.data() + +retOffset, 0, 16384); unsigned char *planeIndices, *data; getPlaneIndicesAndData(&planeIndices, &data); @@ -409,7 +409,7 @@ void SparseDataStorage::addNewPlane(int y) { unsigned char* dataPointer = (unsigned char*)malloc(linesUsed * 128 + 128); memcpy(dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); - XMemSet(dataPointer + (128 * lastLinesUsed) + 128, 0, 128); + memset(dataPointer + (128 * lastLinesUsed) + 128, 0, 128); dataPointer[y] = lastLinesUsed; // Get new data and count packed info diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseLightStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseLightStorage.cpp index 0acb3002e..5a439777e 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -48,7 +48,7 @@ SparseLightStorage::SparseLightStorage(bool sky) { for (int i = 0; i < 127; i++) { planeIndices[i] = i; } - XMemSet(data, 0, 128 * 127); + memset(data, 0, 128 * 127); // Data and count packs together the pointer to our data and the count of // planes allocated - 127 planes allocated in this case @@ -204,7 +204,7 @@ void SparseLightStorage::setData(std::vector& dataIn, unsigned int inOf // Gets all lighting values into an array of length 16384. Destination data will // have same order as original java game. void SparseLightStorage::getData(std::vector& retArray, unsigned int retOffset) { - XMemSet(retArray.data() + retOffset, 0, 16384); + memset(retArray.data() + retOffset, 0, 16384); unsigned char *planeIndices, *data; getPlaneIndicesAndData(&planeIndices, &data); @@ -412,7 +412,7 @@ void SparseLightStorage::addNewPlane(int y) { unsigned char* dataPointer = (unsigned char*)malloc(linesUsed * 128 + 128); memcpy(dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); - XMemSet(dataPointer + (128 * lastLinesUsed) + 128, prefill, 128); + memset(dataPointer + (128 * lastLinesUsed) + 128, prefill, 128); dataPointer[y] = lastLinesUsed; // Get new data and count packed info diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp index 2d1b506e2..efb2d91c8 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -353,7 +353,7 @@ LevelChunk* CustomLevelSource::getChunk(int xOffs, int zOffs) { int blocksSize = Level::maxBuildHeight * 16 * 16; uint8_t* tileData = (uint8_t*)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); - XMemSet128(tileData, 0, blocksSize); + memset(tileData, 0, blocksSize); std::vector blocks = std::vector(tileData, tileData + blocksSize); // std::vector blocks = std::vector(16 * level->depth * 16); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.cpp index 17ce4ffa6..12b2b96cc 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -61,7 +61,7 @@ LevelChunk* FlatLevelSource::getChunk(int xOffs, int zOffs) { int chunksSize = Level::genDepth * 16 * 16; uint8_t* tileData = (uint8_t*)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); - XMemSet128(tileData, 0, chunksSize); + memset(tileData, 0, chunksSize); std::vector blocks = std::vector(tileData, tileData + chunksSize); // std::vector blocks = std::vector(16 * level->depth * 16); prepareHeights(blocks); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp index c48e3b71a..b43dddb3e 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -108,7 +108,7 @@ LevelChunk* HellFlatLevelSource::getChunk(int xOffs, int zOffs) { int chunksSize = Level::genDepth * 16 * 16; uint8_t* tileData = (uint8_t*)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); - XMemSet128(tileData, 0, chunksSize); + memset(tileData, 0, chunksSize); std::vector blocks = std::vector(tileData, tileData + chunksSize); // std::vector blocks = std::vector(16 * level->depth * 16); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellRandomLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellRandomLevelSource.cpp index d2294c9da..87860736f 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellRandomLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/HellRandomLevelSource.cpp @@ -306,7 +306,7 @@ LevelChunk* HellRandomLevelSource::getChunk(int xOffs, int zOffs) { int blocksSize = Level::genDepth * 16 * 16; uint8_t* tileData = (uint8_t*)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); - XMemSet128(tileData, 0, blocksSize); + memset(tileData, 0, blocksSize); std::vector blocks = std::vector(tileData, tileData + blocksSize); // std::vector blocks = std::vector(16 * level->depth * 16); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp index 6be3f9773..cbeb9e88e 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -478,7 +478,7 @@ LevelChunk* RandomLevelSource::getChunk(int xOffs, int zOffs) { int blocksSize = Level::genDepth * 16 * 16; uint8_t* tileData = (uint8_t*)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); - XMemSet128(tileData, 0, blocksSize); + memset(tileData, 0, blocksSize); std::vector blocks = std::vector(tileData, tileData + blocksSize); // std::vector blocks = std::vector(16 * level->depth * 16); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp index 7eb9ba07f..d839a840a 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp @@ -179,7 +179,7 @@ LevelChunk* TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) { unsigned int blocksSize = Level::genDepth * 16 * 16; uint8_t* tileData = (uint8_t*)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); - XMemSet128(tileData, 0, blocksSize); + memset(tileData, 0, blocksSize); std::vector blocks = std::vector(tileData, tileData + blocksSize); // std::vector blocks = std::vector(16 * level->depth * 16); diff --git a/minecraft/Minecraft.World/x64headers/extraX64.h b/minecraft/Minecraft.World/x64headers/extraX64.h index cbadaf7a5..2d577eb61 100644 --- a/minecraft/Minecraft.World/x64headers/extraX64.h +++ b/minecraft/Minecraft.World/x64headers/extraX64.h @@ -56,8 +56,6 @@ public: } }; -void XMemSet(void* a, int t, size_t s); -void XMemSet128(void* a, int t, size_t s); void* XPhysicalAlloc(size_t a, uintptr_t b, uintptr_t c, uint32_t d); class DLCManager;