remove more x64 stubs

This commit is contained in:
Tropical 2026-04-01 01:16:47 -05:00
parent 5b9632dc15
commit 7f71a9b980
15 changed files with 32 additions and 44 deletions

View file

@ -343,7 +343,7 @@ ColourTable::ColourTable(std::uint8_t* pbData, std::uint32_t dataLength) {
ColourTable::ColourTable(ColourTable* defaultColours, std::uint8_t* pbData, ColourTable::ColourTable(ColourTable* defaultColours, std::uint8_t* pbData,
std::uint32_t dataLength) { std::uint32_t dataLength) {
// 4J Stu - Default the colours that of the table passed in // 4J Stu - Default the colours that of the table passed in
XMemCpy((void*)m_colourValues, (void*)defaultColours->m_colourValues, memcpy((void*)m_colourValues, (void*)defaultColours->m_colourValues,
sizeof(int) * eMinecraftColour_COUNT); sizeof(int) * eMinecraftColour_COUNT);
loadColoursFromData(pbData, dataLength); loadColoursFromData(pbData, dataLength);
} }

View file

@ -34,25 +34,15 @@ void ATG::XMLParser::RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback) {
} }
#endif #endif
uint32_t XShowPartyUI(uint32_t dwUserIndex) { return 0; }
uint32_t XShowFriendsUI(uint32_t dwUserIndex) { return 0; }
int32_t XPartyGetUserList(void* pUserList) { return 0; } int32_t XPartyGetUserList(void* pUserList) { return 0; }
uint32_t XContentGetThumbnail(uint32_t dwUserIndex,
const XCONTENT_DATA* pContentData,
uint8_t* pbThumbnail, uint32_t* pcbThumbnail,
PXOVERLAPPED* pOverlapped) {
return 0;
}
bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; } bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; }
void XMemCpy(void* a, const void* b, size_t s) { memcpy(a, b, s); }
void XMemSet(void* a, int t, size_t s) { memset(a, t, s); } 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 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) { void* XPhysicalAlloc(size_t a, uintptr_t b, uintptr_t c, uint32_t d) {
return malloc(a); return malloc(a);
} }
void XPhysicalFree(void* a) { free(a); }
D3DXVECTOR3::D3DXVECTOR3() {} D3DXVECTOR3::D3DXVECTOR3() {}
D3DXVECTOR3::D3DXVECTOR3(float x, float y, float z) : x(x), y(y), z(z) {} D3DXVECTOR3::D3DXVECTOR3(float x, float y, float z) : x(x), y(y), z(z) {}

View file

@ -501,7 +501,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(
// Needs to be clamped to the end of our region // Needs to be clamped to the end of our region
uiCopyEnd = uiFromEnd; uiCopyEnd = uiFromEnd;
} }
XMemCpy((void*)(uiCopyStart + nNumberOfBytesToWrite), memcpy((void*)(uiCopyStart + nNumberOfBytesToWrite),
(void*)uiCopyStart, uiCopyEnd - uiCopyStart); (void*)uiCopyStart, uiCopyEnd - uiCopyStart);
} }
} }

View file

@ -1100,7 +1100,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry* file,
// Needs to be clamped to the end of our region // Needs to be clamped to the end of our region
uiCopyEnd = uiFromEnd; uiCopyEnd = uiFromEnd;
} }
XMemCpy((void*)(uiCopyStart + nNumberOfBytesToWrite), memcpy((void*)(uiCopyStart + nNumberOfBytesToWrite),
(void*)uiCopyStart, uiCopyEnd - uiCopyStart); (void*)uiCopyStart, uiCopyEnd - uiCopyStart);
} }
} }

View file

@ -50,7 +50,7 @@ CompressedTileStorage::CompressedTileStorage(CompressedTileStorage* copyFrom) {
indicesAndData = (unsigned char*)XPhysicalAlloc( indicesAndData = (unsigned char*)XPhysicalAlloc(
allocatedSize, MAXULONG_PTR, 4096, allocatedSize, MAXULONG_PTR, 4096,
PAGE_READWRITE); //(unsigned char *)malloc(allocatedSize); PAGE_READWRITE); //(unsigned char *)malloc(allocatedSize);
XMemCpy(indicesAndData, copyFrom->indicesAndData, allocatedSize); memcpy(indicesAndData, copyFrom->indicesAndData, allocatedSize);
} else { } else {
indicesAndData = nullptr; indicesAndData = nullptr;
} }
@ -195,7 +195,7 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage* other) {
} }
CompressedTileStorage::~CompressedTileStorage() { CompressedTileStorage::~CompressedTileStorage() {
if (indicesAndData) XPhysicalFree(indicesAndData); if (indicesAndData) free(indicesAndData);
} }
// Get an index into the normal ordering of tiles for the java game, given a // Get an index into the normal ordering of tiles for the java game, given a
@ -767,7 +767,7 @@ void CompressedTileStorage::tick() {
do { do {
toFree = deleteQueue[freeIndex].Pop(); toFree = deleteQueue[freeIndex].Pop();
// if( toFree ) printf("Deleting 0x%x\n", toFree); // if( toFree ) printf("Deleting 0x%x\n", toFree);
if (toFree) XPhysicalFree(toFree); if (toFree) free(toFree);
} while (toFree); } while (toFree);
deleteQueueIndex = (deleteQueueIndex + 1) % 3; deleteQueueIndex = (deleteQueueIndex + 1) % 3;
@ -981,7 +981,7 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
INDEX_OFFSET_SHIFT) & INDEX_OFFSET_SHIFT) &
INDEX_OFFSET_MASK); INDEX_OFFSET_MASK);
usDataOffset = (usDataOffset + 3) & 0xfffc; usDataOffset = (usDataOffset + 3) & 0xfffc;
XMemCpy(pucData + usDataOffset, packed_data, 64); memcpy(pucData + usDataOffset, packed_data, 64);
newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK) newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK)
<< INDEX_OFFSET_SHIFT; << INDEX_OFFSET_SHIFT;
usDataOffset += 64; usDataOffset += 64;
@ -1000,7 +1000,7 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
// store each tile type // store each tile type
newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK) newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK)
<< INDEX_OFFSET_SHIFT; << INDEX_OFFSET_SHIFT;
XMemCpy(pucData + usDataOffset, packed_data, dataSize); memcpy(pucData + usDataOffset, packed_data, dataSize);
usDataOffset += dataSize; usDataOffset += dataSize;
done = true; done = true;
} }
@ -1072,7 +1072,7 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) {
usDataOffset = usDataOffset =
(usDataOffset + 3) & (usDataOffset + 3) &
0xfffc; // Make sure offset is 4 byte aligned 0xfffc; // Make sure offset is 4 byte aligned
XMemCpy(pucData + usDataOffset, unpacked_data, 64); memcpy(pucData + usDataOffset, unpacked_data, 64);
newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK) newIndices[i] |= (usDataOffset & INDEX_OFFSET_MASK)
<< INDEX_OFFSET_SHIFT; << INDEX_OFFSET_SHIFT;
usDataOffset += 64; usDataOffset += 64;
@ -1229,7 +1229,7 @@ void CompressedTileStorage::read(DataInputStream* dis) {
// chunk is fully read before any external reference is available to it // chunk is fully read before any external reference is available to it
// from another thread // from another thread
if (indicesAndData) { if (indicesAndData) {
XPhysicalFree(indicesAndData); free(indicesAndData);
} }
indicesAndData = (unsigned char*)XPhysicalAlloc( indicesAndData = (unsigned char*)XPhysicalAlloc(
allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE); allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE);

View file

@ -295,11 +295,11 @@ void LevelChunk::stopSharingTilesAndData() {
/* /*
newDataLayer = new DataLayer(skyLight->data.size()*2, level->depthBits); newDataLayer = new DataLayer(skyLight->data.size()*2, level->depthBits);
XMemCpy(newDataLayer->data.data(), skyLight->data.data(), memcpy(newDataLayer->data.data(), skyLight->data.data(),
skyLight->data.size()); skyLight = newDataLayer; skyLight->data.size()); skyLight = newDataLayer;
newDataLayer = new DataLayer(blockLight->data.size()*2, newDataLayer = new DataLayer(blockLight->data.size()*2,
level->depthBits); XMemCpy(newDataLayer->data.data(), level->depthBits); memcpy(newDataLayer->data.data(),
blockLight->data.data(), blockLight->data.size()); blockLight = blockLight->data.data(), blockLight->data.size()); blockLight =
newDataLayer; newDataLayer;
*/ */

View file

@ -40,7 +40,7 @@ SparseDataStorage::SparseDataStorage() {
// from the pool of 4KB pages, the address will in the range of // from the pool of 4KB pages, the address will in the range of
// MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the // MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the
// allocation later, and so free it with the corresponding call to // allocation later, and so free it with the corresponding call to
// XPhysicalFree. // free.
unsigned char* planeIndices = (unsigned char*)malloc(128 * 128); unsigned char* planeIndices = (unsigned char*)malloc(128 * 128);
unsigned char* data = planeIndices + 128; unsigned char* data = planeIndices + 128;
planeIndices[0] = ALL_0_INDEX; planeIndices[0] = ALL_0_INDEX;
@ -65,7 +65,7 @@ SparseDataStorage::SparseDataStorage(bool isUpper) {
// from the pool of 4KB pages, the address will in the range of // from the pool of 4KB pages, the address will in the range of
// MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the // MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the
// allocation later, and so free it with the corresponding call to // allocation later, and so free it with the corresponding call to
// XPhysicalFree. // free.
unsigned char* planeIndices = (unsigned char*)malloc(128); unsigned char* planeIndices = (unsigned char*)malloc(128);
for (int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
planeIndices[i] = ALL_0_INDEX; planeIndices[i] = ALL_0_INDEX;
@ -114,7 +114,7 @@ SparseDataStorage::SparseDataStorage(SparseDataStorage* copyFrom) {
dataAndCount = (sourceDataAndCount & 0xffff000000000000L) | dataAndCount = (sourceDataAndCount & 0xffff000000000000L) |
(((int64_t)destIndicesAndData) & 0x0000ffffffffffffL); (((int64_t)destIndicesAndData) & 0x0000ffffffffffffL);
XMemCpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128); memcpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128);
#if defined(DATA_COMPRESSION_STATS) #if defined(DATA_COMPRESSION_STATS)
count = sourceCount; count = sourceCount;
@ -162,7 +162,7 @@ void SparseDataStorage::setData(std::vector<uint8_t>& dataIn, unsigned int inOff
unsigned char* planeIndices = unsigned char* planeIndices =
(unsigned char*)malloc(128 * allocatedPlaneCount + 128); (unsigned char*)malloc(128 * allocatedPlaneCount + 128);
unsigned char* data = planeIndices + 128; unsigned char* data = planeIndices + 128;
XMemCpy(planeIndices, _planeIndices, 128); memcpy(planeIndices, _planeIndices, 128);
// Second pass through to actually copy the data in to the storage allocated // Second pass through to actually copy the data in to the storage allocated
// for the required planes // for the required planes
@ -408,7 +408,7 @@ void SparseDataStorage::addNewPlane(int y) {
// initialise remainder // initialise remainder
unsigned char* dataPointer = unsigned char* dataPointer =
(unsigned char*)malloc(linesUsed * 128 + 128); (unsigned char*)malloc(linesUsed * 128 + 128);
XMemCpy(dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); memcpy(dataPointer, lastDataPointer, 128 * lastLinesUsed + 128);
XMemSet(dataPointer + (128 * lastLinesUsed) + 128, 0, 128); XMemSet(dataPointer + (128 * lastLinesUsed) + 128, 0, 128);
dataPointer[y] = lastLinesUsed; dataPointer[y] = lastLinesUsed;
@ -551,11 +551,11 @@ int SparseDataStorage::compress() {
unsigned char* newIndicesAndData = unsigned char* newIndicesAndData =
(unsigned char*)malloc(128 + 128 * planesToAlloc); (unsigned char*)malloc(128 + 128 * planesToAlloc);
unsigned char* pucData = newIndicesAndData + 128; unsigned char* pucData = newIndicesAndData + 128;
XMemCpy(newIndicesAndData, _planeIndices, 128); memcpy(newIndicesAndData, _planeIndices, 128);
for (int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
if (newIndicesAndData[i] < ALL_0_INDEX) { if (newIndicesAndData[i] < ALL_0_INDEX) {
XMemCpy(pucData, &data[128 * planeIndices[i]], 128); memcpy(pucData, &data[128 * planeIndices[i]], 128);
pucData += 128; pucData += 128;
} }
} }

View file

@ -41,7 +41,7 @@ SparseLightStorage::SparseLightStorage(bool sky) {
// from the pool of 4KB pages, the address will in the range of // from the pool of 4KB pages, the address will in the range of
// MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the // MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the
// allocation later, and so free it with the corresponding call to // allocation later, and so free it with the corresponding call to
// XPhysicalFree. // free.
unsigned char* planeIndices = (unsigned char*)malloc(128 * 128); unsigned char* planeIndices = (unsigned char*)malloc(128 * 128);
unsigned char* data = planeIndices + 128; unsigned char* data = planeIndices + 128;
planeIndices[127] = sky ? ALL_15_INDEX : ALL_0_INDEX; planeIndices[127] = sky ? ALL_15_INDEX : ALL_0_INDEX;
@ -66,7 +66,7 @@ SparseLightStorage::SparseLightStorage(bool sky, bool isUpper) {
// from the pool of 4KB pages, the address will in the range of // from the pool of 4KB pages, the address will in the range of
// MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the // MM_PHYSICAL_4KB_BASE upwards. We can use this fact to identify the
// allocation later, and so free it with the corresponding call to // allocation later, and so free it with the corresponding call to
// XPhysicalFree. // free.
unsigned char* planeIndices = (unsigned char*)malloc(128); unsigned char* planeIndices = (unsigned char*)malloc(128);
for (int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
planeIndices[i] = sky ? ALL_15_INDEX : ALL_0_INDEX; planeIndices[i] = sky ? ALL_15_INDEX : ALL_0_INDEX;
@ -115,7 +115,7 @@ SparseLightStorage::SparseLightStorage(SparseLightStorage* copyFrom) {
dataAndCount = (sourceDataAndCount & 0xffff000000000000L) | dataAndCount = (sourceDataAndCount & 0xffff000000000000L) |
(((int64_t)destIndicesAndData) & 0x0000ffffffffffffL); (((int64_t)destIndicesAndData) & 0x0000ffffffffffffL);
XMemCpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128); memcpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128);
#if defined(LIGHT_COMPRESSION_STATS) #if defined(LIGHT_COMPRESSION_STATS)
count = sourceCount; count = sourceCount;
@ -164,7 +164,7 @@ void SparseLightStorage::setData(std::vector<uint8_t>& dataIn, unsigned int inOf
unsigned char* planeIndices = unsigned char* planeIndices =
(unsigned char*)malloc(128 * allocatedPlaneCount + 128); (unsigned char*)malloc(128 * allocatedPlaneCount + 128);
unsigned char* data = planeIndices + 128; unsigned char* data = planeIndices + 128;
XMemCpy(planeIndices, _planeIndices, 128); memcpy(planeIndices, _planeIndices, 128);
// Second pass through to actually copy the data in to the storage allocated // Second pass through to actually copy the data in to the storage allocated
// for the required planes // for the required planes
@ -411,7 +411,7 @@ void SparseLightStorage::addNewPlane(int y) {
// initialise remainder // initialise remainder
unsigned char* dataPointer = unsigned char* dataPointer =
(unsigned char*)malloc(linesUsed * 128 + 128); (unsigned char*)malloc(linesUsed * 128 + 128);
XMemCpy(dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); memcpy(dataPointer, lastDataPointer, 128 * lastLinesUsed + 128);
XMemSet(dataPointer + (128 * lastLinesUsed) + 128, prefill, 128); XMemSet(dataPointer + (128 * lastLinesUsed) + 128, prefill, 128);
dataPointer[y] = lastLinesUsed; dataPointer[y] = lastLinesUsed;
@ -561,11 +561,11 @@ int SparseLightStorage::compress() {
unsigned char* newIndicesAndData = unsigned char* newIndicesAndData =
(unsigned char*)malloc(128 + 128 * planesToAlloc); (unsigned char*)malloc(128 + 128 * planesToAlloc);
unsigned char* pucData = newIndicesAndData + 128; unsigned char* pucData = newIndicesAndData + 128;
XMemCpy(newIndicesAndData, _planeIndices, 128); memcpy(newIndicesAndData, _planeIndices, 128);
for (int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
if (newIndicesAndData[i] < ALL_0_INDEX) { if (newIndicesAndData[i] < ALL_0_INDEX) {
XMemCpy(pucData, &data[128 * planeIndices[i]], 128); memcpy(pucData, &data[128 * planeIndices[i]], 128);
pucData += 128; pucData += 128;
} }
} }

View file

@ -395,7 +395,7 @@ LevelChunk* CustomLevelSource::getChunk(int xOffs, int zOffs) {
// now need to free the passed in blocks as the LevelChunk doesn't use the // now need to free the passed in blocks as the LevelChunk doesn't use the
// passed in allocation anymore. // passed in allocation anymore.
LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
XPhysicalFree(tileData); free(tileData);
return levelChunk; return levelChunk;
#else #else

View file

@ -79,7 +79,7 @@ LevelChunk* FlatLevelSource::getChunk(int xOffs, int zOffs) {
// now need to free the passed in blocks as the LevelChunk doesn't use the // now need to free the passed in blocks as the LevelChunk doesn't use the
// passed in allocation anymore. // passed in allocation anymore.
LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
XPhysicalFree(tileData); free(tileData);
levelChunk->recalcHeightmap(); levelChunk->recalcHeightmap();

View file

@ -125,7 +125,7 @@ LevelChunk* HellFlatLevelSource::getChunk(int xOffs, int zOffs) {
// passed in blocks as the LevelChunk doesn't use the passed in allocation // passed in blocks as the LevelChunk doesn't use the passed in allocation
// anymore. // anymore.
LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
XPhysicalFree(tileData); free(tileData);
return levelChunk; return levelChunk;
} }

View file

@ -322,7 +322,7 @@ LevelChunk* HellRandomLevelSource::getChunk(int xOffs, int zOffs) {
// anymore. // anymore.
LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
levelChunk->setCheckAllLight(); levelChunk->setCheckAllLight();
XPhysicalFree(tileData); free(tileData);
return levelChunk; return levelChunk;
} }

View file

@ -520,7 +520,7 @@ LevelChunk* RandomLevelSource::getChunk(int xOffs, int zOffs) {
// now need to free the passed in blocks as the LevelChunk doesn't use the // now need to free the passed in blocks as the LevelChunk doesn't use the
// passed in allocation anymore. // passed in allocation anymore.
LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
XPhysicalFree(tileData); free(tileData);
return levelChunk; return levelChunk;
} }

View file

@ -196,7 +196,7 @@ LevelChunk* TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) {
// now need to free the passed in blocks as the LevelChunk doesn't use the // now need to free the passed in blocks as the LevelChunk doesn't use the
// passed in allocation anymore. // passed in allocation anymore.
LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs); LevelChunk* levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
XPhysicalFree(tileData); free(tileData);
levelChunk->recalcHeightmap(); levelChunk->recalcHeightmap();

View file

@ -56,11 +56,9 @@ public:
} }
}; };
void XMemCpy(void* a, const void* b, size_t s);
void XMemSet(void* a, int t, size_t s); void XMemSet(void* a, int t, size_t s);
void XMemSet128(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); void* XPhysicalAlloc(size_t a, uintptr_t b, uintptr_t c, uint32_t d);
void XPhysicalFree(void* a);
class DLCManager; class DLCManager;
class LevelRuleset; class LevelRuleset;