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

@@ -271,10 +271,10 @@ void Texture::writeAsBMP(const wstring &name)
// Write the header
outStream->writeShort((short)0x424d); // 0x0000: ID - 'BM'
int byteSize = width * height * 4 + 54;
outStream->writeByte((byte)(byteSize >> 0)); // 0x0002: Raw file size
outStream->writeByte((byte)(byteSize >> 8));
outStream->writeByte((byte)(byteSize >> 16));
outStream->writeByte((byte)(byteSize >> 24));
outStream->writeByte((BYTE)(byteSize >> 0)); // 0x0002: Raw file size
outStream->writeByte((BYTE)(byteSize >> 8));
outStream->writeByte((BYTE)(byteSize >> 16));
outStream->writeByte((BYTE)(byteSize >> 24));
outStream->writeInt(0); // 0x0006: Reserved
outStream->writeByte(54); // 0x000A: Start of pixel data
outStream->writeByte(0);
@@ -284,31 +284,31 @@ void Texture::writeAsBMP(const wstring &name)
outStream->writeByte(0);
outStream->writeByte(0);
outStream->writeByte(0);
outStream->writeByte((byte)(width >> 0)); // 0x0012: Image width, in pixels
outStream->writeByte((byte)(width >> 8));
outStream->writeByte((byte)(width >> 16));
outStream->writeByte((byte)(width >> 24));
outStream->writeByte((byte)(height >> 0)); // 0x0016: Image height, in pixels
outStream->writeByte((byte)(height >> 8));
outStream->writeByte((byte)(height >> 16));
outStream->writeByte((byte)(height >> 24));
outStream->writeByte((BYTE)(width >> 0)); // 0x0012: Image width, in pixels
outStream->writeByte((BYTE)(width >> 8));
outStream->writeByte((BYTE)(width >> 16));
outStream->writeByte((BYTE)(width >> 24));
outStream->writeByte((BYTE)(height >> 0)); // 0x0016: Image height, in pixels
outStream->writeByte((BYTE)(height >> 8));
outStream->writeByte((BYTE)(height >> 16));
outStream->writeByte((BYTE)(height >> 24));
outStream->writeByte(1); // 0x001A: Number of color planes, must be 1
outStream->writeByte(0);
outStream->writeByte(32); // 0x001C: Bit depth (32bpp)
outStream->writeByte(0);
outStream->writeInt(0); // 0x001E: Compression mode (BI_RGB, uncompressed)
int bufSize = width * height * 4;
outStream->writeInt((byte)(bufSize >> 0)); // 0x0022: Raw size of bitmap data
outStream->writeInt((byte)(bufSize >> 8));
outStream->writeInt((byte)(bufSize >> 16));
outStream->writeInt((byte)(bufSize >> 24));
outStream->writeInt((BYTE)(bufSize >> 0)); // 0x0022: Raw size of bitmap data
outStream->writeInt((BYTE)(bufSize >> 8));
outStream->writeInt((BYTE)(bufSize >> 16));
outStream->writeInt((BYTE)(bufSize >> 24));
outStream->writeInt(0); // 0x0026: Horizontal resolution in ppm
outStream->writeInt(0); // 0x002A: Vertical resolution in ppm
outStream->writeInt(0); // 0x002E: Palette size (0 to match bit depth)
outStream->writeInt(0); // 0x0032: Number of important colors, 0 for all
// Pixels follow in inverted Y order
byte[] bytes = new byte[width * height * 4];
BYTE[] bytes = new BYTE[width * height * 4];
data.position(0);
data.get(bytes);
for (int y = height - 1; y >= 0; y--)
@@ -337,7 +337,7 @@ void Texture::writeAsPNG(const wstring &filename)
#if 0
BufferedImage *image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
ByteBuffer *buffer = this->getData();
byte[] bytes = new byte[width * height * 4];
BYTE[] bytes = new BYTE[width * height * 4];
buffer.position(0);
buffer.get(bytes);
@@ -531,10 +531,10 @@ void Texture::transferFromBuffer(intArray buffer)
{
int texel = column + x * 4;
data[0]->position(0);
data[0]->put(texel + byteRemap[0], static_cast<byte>((buffer[texel >> 2] >> 24) & 0xff));
data[0]->put(texel + byteRemap[1], static_cast<byte>((buffer[texel >> 2] >> 16) & 0xff));
data[0]->put(texel + byteRemap[2], static_cast<byte>((buffer[texel >> 2] >> 8) & 0xff));
data[0]->put(texel + byteRemap[3], static_cast<byte>((buffer[texel >> 2] >> 0) & 0xff));
data[0]->put(texel + byteRemap[0], static_cast<BYTE>((buffer[texel >> 2] >> 24) & 0xff));
data[0]->put(texel + byteRemap[1], static_cast<BYTE>((buffer[texel >> 2] >> 16) & 0xff));
data[0]->put(texel + byteRemap[2], static_cast<BYTE>((buffer[texel >> 2] >> 8) & 0xff));
data[0]->put(texel + byteRemap[3], static_cast<BYTE>((buffer[texel >> 2] >> 0) & 0xff));
}
}
}
@@ -590,10 +590,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = static_cast<byte>((tempPixels[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = static_cast<byte>((tempPixels[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = static_cast<byte>((tempPixels[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = static_cast<byte>((tempPixels[intIndex] >> 0) & 0xff);
tempBytes[byteIndex + byteRemap[0]] = static_cast<BYTE>((tempPixels[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = static_cast<BYTE>((tempPixels[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = static_cast<BYTE>((tempPixels[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = static_cast<BYTE>((tempPixels[intIndex] >> 0) & 0xff);
}
}
@@ -642,10 +642,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = static_cast<byte>((tempData[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = static_cast<byte>((tempData[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = static_cast<byte>((tempData[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = static_cast<byte>((tempData[intIndex] >> 0) & 0xff);
tempBytes[byteIndex + byteRemap[0]] = static_cast<BYTE>((tempData[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = static_cast<BYTE>((tempData[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = static_cast<BYTE>((tempData[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = static_cast<BYTE>((tempData[intIndex] >> 0) & 0xff);
}
}
}
@@ -677,10 +677,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = static_cast<byte>((col >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = static_cast<byte>((col >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = static_cast<byte>((col >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = static_cast<byte>((col >> 0) & 0xff);
tempBytes[byteIndex + byteRemap[0]] = static_cast<BYTE>((col >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = static_cast<BYTE>((col >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = static_cast<BYTE>((col >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = static_cast<BYTE>((col >> 0) & 0xff);
}
}
@@ -839,7 +839,7 @@ void Texture::updateOnGPU()
// the ram based buffer to it any more inside RenderManager.TextureDataUpdate
unsigned char *newData = RenderManager.TextureData(width,height,data[0]->getBuffer(),0,C4JRender::TEXTURE_FORMAT_RxGyBzAw);
ByteBuffer *oldBuffer = data[0];
data[0] = new ByteBuffer(data[0]->getSize(), (byte*) newData);
data[0] = new ByteBuffer(data[0]->getSize(), (BYTE*) newData);
delete oldBuffer;
newData += width * height * 4;
#else
@@ -858,7 +858,7 @@ void Texture::updateOnGPU()
// the ram based buffer to it any more inside RenderManager.TextureDataUpdate
RenderManager.TextureDataUpdate(0, 0,levelWidth,levelHeight,data[level]->getBuffer(),level);
ByteBuffer *oldBuffer = data[level];
data[level] = new ByteBuffer(data[level]->getSize(), (byte*) newData);
data[level] = new ByteBuffer(data[level]->getSize(), (BYTE*) newData);
delete oldBuffer;
newData += levelWidth * levelHeight * 4;
#else