aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ByteBuffer.h
blob: 56ac0b9604c84b8db9e4c1f5fbc1a836bbcd1de6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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_t 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_t 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__