Compare commits
4 Commits
60f53f9e6d
...
ab920a114b
Author | SHA1 | Date |
---|---|---|
BodgeMaster | ab920a114b | |
BodgeMaster | 2b51cdb9cc | |
BodgeMaster | 9b58d165c0 | |
BodgeMaster | 6d6b0dae5a |
4
COPYING
4
COPYING
|
@ -5,6 +5,10 @@ the GNU AGPL version 3. A copy of the license has been provided to you
|
||||||
as `LICENSE.md` in the base directory of the repository or source tree.
|
as `LICENSE.md` in the base directory of the repository or source tree.
|
||||||
It is also available at `https://www.gnu.org/licenses/agpl-3.0.en.html`.
|
It is also available at `https://www.gnu.org/licenses/agpl-3.0.en.html`.
|
||||||
|
|
||||||
|
This software is distributed WITHOUT ANY WARRANTY (without even the
|
||||||
|
implied warranty of merchantability or fitness for any particular purpose)
|
||||||
|
as specified by the AGPL.
|
||||||
|
|
||||||
People who have contributed to this project:
|
People who have contributed to this project:
|
||||||
Jan Danielzick (aka. BodgeMaster)
|
Jan Danielzick (aka. BodgeMaster)
|
||||||
Milan Suman (aka. Shwoomple)
|
Milan Suman (aka. Shwoomple)
|
||||||
|
|
|
@ -42,7 +42,8 @@ all uppercase letters and underscores for their names.
|
||||||
Variables and functions start with a lowercase letter, classes and structs
|
Variables and functions start with a lowercase letter, classes and structs
|
||||||
with an uppercase letter.
|
with an uppercase letter.
|
||||||
|
|
||||||
Avoid abbreviations unless they are well known and universally used acronyms.
|
Avoid abbreviations unless they are well known acronyms and/or
|
||||||
|
universally used.
|
||||||
|
|
||||||
Use explicitly sized data types where possible.
|
Use explicitly sized data types where possible.
|
||||||
For example, use `int32_t` instead of `int`.
|
For example, use `int32_t` instead of `int`.
|
||||||
|
|
|
@ -43,7 +43,7 @@ int endianness_example() {
|
||||||
|
|
||||||
namespace NBT {
|
namespace NBT {
|
||||||
namespace helpers {
|
namespace helpers {
|
||||||
ErrorOr<int8_t> readByte(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition) {
|
ErrorOr<int8_t> readInt8(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition) {
|
||||||
//TODO: implement
|
//TODO: implement
|
||||||
return ErrorOr<int8_t>(0);
|
return ErrorOr<int8_t>(0);
|
||||||
}
|
}
|
||||||
|
@ -81,12 +81,11 @@ namespace NBT {
|
||||||
return ErrorOr<double>(0.0);
|
return ErrorOr<double>(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<std::vector<int8_t>> readByteArray(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition) {
|
ErrorOr<std::vector<int8_t>> readInt8Array(uint8_t* data[], uint64_t dataSize, uint64_t currentPosition) {
|
||||||
//TODO: implement
|
//TODO: implement
|
||||||
return ErrorOr<std::vector<int8_t>>({0});
|
return ErrorOr<std::vector<int8_t>>({0});
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: find suitable string type
|
|
||||||
// Maybe use a struct that holds decoded (de-Java-fied) string
|
// Maybe use a struct that holds decoded (de-Java-fied) string
|
||||||
// data, decoded size, and original size? Original size is needed
|
// data, decoded size, and original size? Original size is needed
|
||||||
// so the parser knows where to continue.
|
// so the parser knows where to continue.
|
||||||
|
|
|
@ -19,16 +19,16 @@
|
||||||
// NBT tags have a type, optionally a name which consists of the name size and the name string, optionally content type, and optionally a payload which can consist of optionally content type, optionally a content size,
|
// NBT tags have a type, optionally a name which consists of the name size and the name string, optionally content type, and optionally a payload which can consist of optionally content type, optionally a content size,
|
||||||
// and the stored content. The format in which they are stored is as follows: <type><name size><name><payload>. All numbers are stored in big endian representation.
|
// and the stored content. The format in which they are stored is as follows: <type><name size><name><payload>. All numbers are stored in big endian representation.
|
||||||
// All tag types:
|
// All tag types:
|
||||||
// generic representation: Tag(Byte:tag_type, String:name, uint16:name_size, byte[]:content, int32:size)
|
// generic representation: Tag(uint8:tag_type, String:name, uint16:name_size, byte[]:content, int32:size)
|
||||||
// None (compound end): Tag( 0, "", 0, None, 0) => used to determine the end of a compound tag, only the type gets stored
|
// None (compound end): Tag( 0, "", 0, None, 0) => used to determine the end of a compound tag, only the type gets stored
|
||||||
// byte: Tag( 1, String:name, uint16:name_size, byte:content, 1) => a single signed byte, size not stored
|
// int8: Tag( 1, String:name, uint16:name_size, int8:content, 1) => a single signed byte, size not stored
|
||||||
// int16: Tag( 2, String:name, uint16:name_size, int16:content, 2) => 16 bit signed integer, size not stored
|
// int16: Tag( 2, String:name, uint16:name_size, int16:content, 2) => 16 bit signed integer, size not stored
|
||||||
// int32: Tag( 3, String:name, uint16:name_size, int32:content, 4) => 32 bit signed integer, size not stored
|
// int32: Tag( 3, String:name, uint16:name_size, int32:content, 4) => 32 bit signed integer, size not stored
|
||||||
// int64: Tag( 4, String:name, uint16:name_size, int64:content, 8) => 64 bit signed integer, size not stored
|
// int64: Tag( 4, String:name, uint16:name_size, int64:content, 8) => 64 bit signed integer, size not stored
|
||||||
// float32: Tag( 5, String:name, uint16:name_size, float32:content,4) => 32 bit IEEE754 floating point number, size not stored
|
// float32: Tag( 5, String:name, uint16:name_size, float32:content,4) => 32 bit IEEE754 floating point number, size not stored
|
||||||
// float64: Tag( 6, String:name, uint16:name_size, float64:content,8) => 64 bit IEEE754 floating point number, size not stored
|
// float64: Tag( 6, String:name, uint16:name_size, float64:content,8) => 64 bit IEEE754 floating point number, size not stored
|
||||||
// byte[]: Tag( 7, String:name, uint16:name_size, byte[]:content, int32:size) => content stored prefixed with size
|
// int8[]: Tag( 7, String:name, uint16:name_size, int8[]:content, int32:size) => content stored prefixed with size
|
||||||
// String: Tag( 8, String:name, uint16:name_size, byte[]:content, uint16:size) => Java style modified UTF-8 string, content stored prefixed with size
|
// String: Tag( 8, String:name, uint16:name_size, String:content, uint16:size) => Java style modified UTF-8 string, content stored prefixed with size
|
||||||
// Tag[] (list): Tag<Tag:type>( 9, String:name, uint16:name_size, Tag[]:content, int32:size) => list of tags of the same type with tag type and name information omitted prefixed by (in order) content type and size
|
// Tag[] (list): Tag<Tag:type>( 9, String:name, uint16:name_size, Tag[]:content, int32:size) => list of tags of the same type with tag type and name information omitted prefixed by (in order) content type and size
|
||||||
// Tag[] (compound): Tag(10, String:name, uint16:name_size, Tag[]:content, int32:size) => list of tags, last tag is always an end tag, size not stored
|
// Tag[] (compound): Tag(10, String:name, uint16:name_size, Tag[]:content, int32:size) => list of tags, last tag is always an end tag, size not stored
|
||||||
// int32[]: Tag(11, String:name, uint16:name_size, int32[]:content,int32:size) => list of 32 bit signed integers prefixed with its size, endianness not verified at this point
|
// int32[]: Tag(11, String:name, uint16:name_size, int32[]:content,int32:size) => list of 32 bit signed integers prefixed with its size, endianness not verified at this point
|
||||||
|
|
Loading…
Reference in New Issue