Use BYTE Win Typedef instead of byte typedef from Minecraft.World

This commit is contained in:
GabsPuNs
2026-05-10 21:03:03 -04:00
parent 20d395b88d
commit 3e7983ab3c
216 changed files with 798 additions and 800 deletions

View File

@@ -57,10 +57,10 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path)
//if ((GetFileSize(file,nullptr) & 0xfff) != 0)
if ((fileEntry->getFileSize() & 0xfff) != 0)
{
//byte zero = 0;
//BYTE zero = 0;
DWORD numberOfBytesWritten = 0;
DWORD bytesToWrite = 0x1000 - (fileEntry->getFileSize() & 0xfff);
byte *zeroBytes = new byte[ bytesToWrite ];
BYTE *zeroBytes = new BYTE[ bytesToWrite ];
ZeroMemory(zeroBytes, bytesToWrite);
/* the file size is not a multiple of 4KB, grow it */
@@ -207,7 +207,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
DWORD 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
// 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
m_saveFile->readFile(fileEntry,&length,4,&numberOfBytesRead);
@@ -233,8 +233,8 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
}
MemSect(50);
byte *data = new byte[length];
byte *decomp = new byte[decompLength];
BYTE *data = new BYTE[length];
BYTE *decomp = new BYTE[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, byte *data, int length) // TODO - was synchronized
void RegionFile::write(int x, int z, BYTE *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
byte *compData = new byte[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.
BYTE *compData = new BYTE[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,13 +403,13 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync
}
/* write a chunk data to the region file at specified sector number */
void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int compLength)
void RegionFile::write(int sectorNumber, BYTE *data, int length, unsigned int compLength)
{
DWORD numberOfBytesWritten = 0;
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_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
// 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
// 4J Stu - We need to do the compression at a level above this, where it is checking for free space
@@ -451,7 +451,7 @@ void RegionFile::insertInitialSectors()
{
m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN );
DWORD numberOfBytesWritten = 0;
byte zeroBytes[ SECTOR_BYTES ];
BYTE zeroBytes[ SECTOR_BYTES ];
ZeroMemory(zeroBytes, SECTOR_BYTES);
/* we need to write the chunk offset table */