From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/ByteBuffer.h | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Minecraft.World/ByteBuffer.h (limited to 'Minecraft.World/ByteBuffer.h') diff --git a/Minecraft.World/ByteBuffer.h b/Minecraft.World/ByteBuffer.h new file mode 100644 index 00000000..2d936374 --- /dev/null +++ b/Minecraft.World/ByteBuffer.h @@ -0,0 +1,57 @@ +#pragma once + +#include "Buffer.h" +#include "Definitions.h" + +class IntBuffer; +class FloatBuffer; + +class ByteBuffer : public Buffer +{ +protected: + byte *buffer; + ByteOrder byteOrder; + +public: + ByteBuffer(unsigned int capacity); + static ByteBuffer *allocateDirect(int capacity); + ByteBuffer( unsigned int capacity, byte *backingArray ); + virtual ~ByteBuffer(); + + static ByteBuffer *wrap(byteArray &b); + static ByteBuffer *allocate(unsigned int capacity); + void order(ByteOrder a); + ByteBuffer *flip(); + byte *getBuffer(); + int getSize(); + int getInt(); + int getInt(unsigned int index); + void get(byteArray) {} // 4J - TODO + byte get(int index); + __int64 getLong(); + short getShort(); + void getShortArray(shortArray &s); + ByteBuffer *put(int index, byte b); + ByteBuffer *putInt(int value); + ByteBuffer *putInt(unsigned int index, int value); + ByteBuffer *putShort(short value); + ByteBuffer *putShortArray(shortArray &s); + ByteBuffer *putLong(__int64 value); + ByteBuffer *put(byteArray inputArray); + byteArray array(); + IntBuffer *asIntBuffer(); + FloatBuffer *asFloatBuffer(); + +}; + + +#ifdef __PS3__ +// we're using the RSX now to upload textures to vram, so we need th main ram textures allocated from io space +class ByteBuffer_IO : public ByteBuffer +{ +public: + ByteBuffer_IO(unsigned int capacity); + ~ByteBuffer_IO(); +}; + +#endif // __PS3__ \ No newline at end of file -- cgit v1.2.3