Compare commits
22 Commits
Author | SHA1 | Date |
---|---|---|
BodgeMaster | 53173dd7c7 | |
BodgeMaster | 8482194b01 | |
BodgeMaster | 229392a7fe | |
BodgeMaster | a48c4dcd33 | |
BodgeMaster | a787a89493 | |
BodgeMaster | b9006cc6ea | |
BodgeMaster | eb8db35615 | |
BodgeMaster | 9dd4489141 | |
BodgeMaster | d1c855857c | |
BodgeMaster | 8f8d51f459 | |
BodgeMaster | 8b13f72acc | |
Joca | 6ef1d401bb | |
Joca | 1bcc5eae64 | |
BodgeMaster | 97b844c6d1 | |
BodgeMaster | 20857cb8c5 | |
BodgeMaster | abc5491192 | |
BodgeMaster | ad54f0a012 | |
BodgeMaster | ae71322ba1 | |
BodgeMaster | 01e5f5eaac | |
BodgeMaster | 6112da2e6f | |
BodgeMaster | b07d6e2ff6 | |
BodgeMaster | 4247bd295a |
|
@ -24,6 +24,9 @@
|
||||||
# ignore nano's temp files
|
# ignore nano's temp files
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
|
# Ignore sublime text project files.
|
||||||
|
*.sublime-*
|
||||||
|
|
||||||
#vscode
|
#vscode
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -1,13 +1,3 @@
|
||||||
# WARNING: This is the Windows branch.
|
|
||||||
|
|
||||||
- Do NOT work on this branch. It is intended for building only.
|
|
||||||
- Do NOT merge back to master. This branch contains changes that would break the master branch.
|
|
||||||
- Original commits on this branch should only ever be made regarding fixes
|
|
||||||
to the build system or otherwise necessary changes to get FOSS-VG to build
|
|
||||||
and run on Windows.
|
|
||||||
- This branch will only be maintained as needed.
|
|
||||||
|
|
||||||
|
|
||||||
# FOSS-VG (FOSS Voxel Generator)
|
# FOSS-VG (FOSS Voxel Generator)
|
||||||
|
|
||||||
This is a WIP Minecraft clone.
|
This is a WIP Minecraft clone.
|
||||||
|
|
|
@ -22,10 +22,8 @@ each file.
|
||||||
Don't use excessive comments, use descriptive names instead.
|
Don't use excessive comments, use descriptive names instead.
|
||||||
There is no such thing as too long names (within reason, of course).
|
There is no such thing as too long names (within reason, of course).
|
||||||
|
|
||||||
Don't have comments that go beyond 80 characters per line, preferably
|
|
||||||
slightly less.
|
|
||||||
|
|
||||||
Put comments on their own lines.
|
Put comments on their own lines.
|
||||||
|
Format comments to improve readability, don't have long single-line comments.
|
||||||
|
|
||||||
Indent by four spaces.
|
Indent by four spaces.
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,122 @@
|
||||||
|
[0: Compound]:
|
||||||
|
|–Header: 3 bytes
|
||||||
|
|–Payload: 232 bytes
|
||||||
|
|–Total: 235 bytes
|
||||||
|
|–Length: 4
|
||||||
|
|
|
||||||
|
|–[3: List] int8 arrays:
|
||||||
|
| |–Header: 14 bytes
|
||||||
|
| |–Payload: 29 bytes
|
||||||
|
| |–Total: 43 bytes
|
||||||
|
| |–Contained Type: Array of 8 Bit Integers
|
||||||
|
| |–Length: 3
|
||||||
|
| |
|
||||||
|
| |–[22: Array of 8 Bit Integers]:
|
||||||
|
| | |–Payload: 8 bytes
|
||||||
|
| | |–Total: 8 bytes
|
||||||
|
| | |–Length: 4
|
||||||
|
| | '–Values:
|
||||||
|
| | |–13
|
||||||
|
| | |–37
|
||||||
|
| | |–52
|
||||||
|
| | '–81
|
||||||
|
| |
|
||||||
|
| |–[30: Array of 8 Bit Integers]:
|
||||||
|
| | |–Payload: 8 bytes
|
||||||
|
| | |–Total: 8 bytes
|
||||||
|
| | |–Length: 4
|
||||||
|
| | '–Values:
|
||||||
|
| | |–80
|
||||||
|
| | |–0
|
||||||
|
| | |–81
|
||||||
|
| | '–35
|
||||||
|
| |
|
||||||
|
| '–[38: Array of 8 Bit Integers]:
|
||||||
|
| |–Payload: 8 bytes
|
||||||
|
| |–Total: 8 bytes
|
||||||
|
| |–Length: 4
|
||||||
|
| '–Values:
|
||||||
|
| |–0
|
||||||
|
| |–0
|
||||||
|
| |–34
|
||||||
|
| '–-65
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|–[46: List] int32 arrays:
|
||||||
|
| |–Header: 15 bytes
|
||||||
|
| |–Payload: 97 bytes
|
||||||
|
| |–Total: 112 bytes
|
||||||
|
| |–Contained Type: Array of 32 Bit Integers
|
||||||
|
| |–Length: 3
|
||||||
|
| |
|
||||||
|
| |–[66: Array of 32 Bit Integers]:
|
||||||
|
| | |–Payload: 16 bytes
|
||||||
|
| | |–Total: 16 bytes
|
||||||
|
| | |–Length: 3
|
||||||
|
| | '–Values:
|
||||||
|
| | |–13859
|
||||||
|
| | |–7677676
|
||||||
|
| | '–1337
|
||||||
|
| |
|
||||||
|
| |–[82: Array of 32 Bit Integers]:
|
||||||
|
| | |–Payload: 68 bytes
|
||||||
|
| | |–Total: 68 bytes
|
||||||
|
| | |–Length: 16
|
||||||
|
| | '–Values:
|
||||||
|
| | |–1
|
||||||
|
| | |–2
|
||||||
|
| | |–4
|
||||||
|
| | |–8
|
||||||
|
| | |–16
|
||||||
|
| | |–32
|
||||||
|
| | |–64
|
||||||
|
| | |–128
|
||||||
|
| | |–256
|
||||||
|
| | |–512
|
||||||
|
| | |–1024
|
||||||
|
| | |–2048
|
||||||
|
| | |–4096
|
||||||
|
| | |–8192
|
||||||
|
| | |–16384
|
||||||
|
| | '–32768
|
||||||
|
| |
|
||||||
|
| '–[150: Array of 32 Bit Integers]:
|
||||||
|
| |–Payload: 8 bytes
|
||||||
|
| |–Total: 8 bytes
|
||||||
|
| |–Length: 1
|
||||||
|
| '–Values:
|
||||||
|
| '–-100000
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|–[158: List] int64 arrays:
|
||||||
|
| |–Header: 15 bytes
|
||||||
|
| |–Payload: 61 bytes
|
||||||
|
| |–Total: 76 bytes
|
||||||
|
| |–Contained Type: Array of 64 Bit Integers
|
||||||
|
| |–Length: 2
|
||||||
|
| |
|
||||||
|
| |–[178: Array of 64 Bit Integers]:
|
||||||
|
| | |–Payload: 28 bytes
|
||||||
|
| | |–Total: 28 bytes
|
||||||
|
| | |–Length: 3
|
||||||
|
| | '–Values:
|
||||||
|
| | |–9999999998
|
||||||
|
| | |–0
|
||||||
|
| | '–77777666666666
|
||||||
|
| |
|
||||||
|
| '–[206: Array of 64 Bit Integers]:
|
||||||
|
| |–Payload: 28 bytes
|
||||||
|
| |–Total: 28 bytes
|
||||||
|
| |–Length: 3
|
||||||
|
| '–Values:
|
||||||
|
| |–-2141414141414141
|
||||||
|
| |–7680
|
||||||
|
| '–900
|
||||||
|
|
|
||||||
|
|
|
||||||
|
'–[234: End]:
|
||||||
|
|–Header: 1 byte
|
||||||
|
|–Payload: 0 bytes
|
||||||
|
'–Total: 1 byte
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[0: 64 Bit Integer] test:
|
||||||
|
|–Header: 7 bytes
|
||||||
|
|–Payload: 8 bytes
|
||||||
|
|–Total: 15 bytes
|
||||||
|
'–Value: 9223372036854775807
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[0: 64 Bit Integer] test:
|
||||||
|
|–Header: 7 bytes
|
||||||
|
|–Payload: 8 bytes
|
||||||
|
|–Total: 15 bytes
|
||||||
|
'–Value: 9223372036854775807
|
||||||
|
|
||||||
|
[15: 32 Bit Integer] int32:
|
||||||
|
|–Header: 8 bytes
|
||||||
|
|–Payload: 4 bytes
|
||||||
|
|–Total: 12 bytes
|
||||||
|
'–Value: 1866009202
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,592 @@
|
||||||
|
[0: Compound]:
|
||||||
|
|–Header: 3 bytes
|
||||||
|
|–Payload: 792 bytes
|
||||||
|
|–Total: 795 bytes
|
||||||
|
|–Length: 3
|
||||||
|
|
|
||||||
|
|–[3: List] 60:
|
||||||
|
| |–Header: 5 bytes
|
||||||
|
| |–Payload: 222 bytes
|
||||||
|
| |–Total: 227 bytes
|
||||||
|
| |–Contained Type: List
|
||||||
|
| |–Length: 5
|
||||||
|
| |
|
||||||
|
| |–[13: List]:
|
||||||
|
| | |–Payload: 81 bytes
|
||||||
|
| | |–Total: 81 bytes
|
||||||
|
| | |–Contained Type: String
|
||||||
|
| | |–Length: 3
|
||||||
|
| | |
|
||||||
|
| | |–[18: String]:
|
||||||
|
| | | |–Payload: 18 bytes
|
||||||
|
| | | |–Total: 18 bytes
|
||||||
|
| | | '–Value: Du bist so dumm,
|
||||||
|
| | |
|
||||||
|
| | |–[36: String]:
|
||||||
|
| | | |–Payload: 38 bytes
|
||||||
|
| | | |–Total: 38 bytes
|
||||||
|
| | | '–Value: Du wirfst ’nen Stein auf’n Boden
|
||||||
|
| | |
|
||||||
|
| | '–[74: String]:
|
||||||
|
| | |–Payload: 20 bytes
|
||||||
|
| | |–Total: 20 bytes
|
||||||
|
| | '–Value: und triffst nicht.
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |–[94: List]:
|
||||||
|
| | |–Payload: 12 bytes
|
||||||
|
| | |–Total: 12 bytes
|
||||||
|
| | |–Contained Type: 8 Bit Integer
|
||||||
|
| | |–Length: 7
|
||||||
|
| | |
|
||||||
|
| | |–[99: 8 Bit Integer]:
|
||||||
|
| | | |–Payload: 1 byte
|
||||||
|
| | | |–Total: 1 byte
|
||||||
|
| | | '–Value: 115
|
||||||
|
| | |
|
||||||
|
| | |–[100: 8 Bit Integer]:
|
||||||
|
| | | |–Payload: 1 byte
|
||||||
|
| | | |–Total: 1 byte
|
||||||
|
| | | '–Value: 35
|
||||||
|
| | |
|
||||||
|
| | |–[101: 8 Bit Integer]:
|
||||||
|
| | | |–Payload: 1 byte
|
||||||
|
| | | |–Total: 1 byte
|
||||||
|
| | | '–Value: 7
|
||||||
|
| | |
|
||||||
|
| | |–[102: 8 Bit Integer]:
|
||||||
|
| | | |–Payload: 1 byte
|
||||||
|
| | | |–Total: 1 byte
|
||||||
|
| | | '–Value: -3
|
||||||
|
| | |
|
||||||
|
| | |–[103: 8 Bit Integer]:
|
||||||
|
| | | |–Payload: 1 byte
|
||||||
|
| | | |–Total: 1 byte
|
||||||
|
| | | '–Value: 56
|
||||||
|
| | |
|
||||||
|
| | |–[104: 8 Bit Integer]:
|
||||||
|
| | | |–Payload: 1 byte
|
||||||
|
| | | |–Total: 1 byte
|
||||||
|
| | | '–Value: 105
|
||||||
|
| | |
|
||||||
|
| | '–[105: 8 Bit Integer]:
|
||||||
|
| | |–Payload: 1 byte
|
||||||
|
| | |–Total: 1 byte
|
||||||
|
| | '–Value: 125
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |–[106: List]:
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 5 bytes
|
||||||
|
| | |–Contained Type: End
|
||||||
|
| | '–Length: 0
|
||||||
|
| |
|
||||||
|
| |–[111: List]:
|
||||||
|
| | |–Payload: 77 bytes
|
||||||
|
| | |–Total: 77 bytes
|
||||||
|
| | |–Contained Type: Compound
|
||||||
|
| | |–Length: 3
|
||||||
|
| | |
|
||||||
|
| | |–[116: Compound]:
|
||||||
|
| | | |–Payload: 6 bytes
|
||||||
|
| | | |–Total: 6 bytes
|
||||||
|
| | | |–Length: 2
|
||||||
|
| | | |
|
||||||
|
| | | |–[116: 8 Bit Integer] 3:
|
||||||
|
| | | | |–Header: 4 bytes
|
||||||
|
| | | | |–Payload: 1 byte
|
||||||
|
| | | | |–Total: 5 bytes
|
||||||
|
| | | | '–Value: 105
|
||||||
|
| | | |
|
||||||
|
| | | '–[121: End]:
|
||||||
|
| | | |–Header: 1 byte
|
||||||
|
| | | |–Payload: 0 bytes
|
||||||
|
| | | '–Total: 1 byte
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | |–[122: Compound]:
|
||||||
|
| | | |–Payload: 38 bytes
|
||||||
|
| | | |–Total: 38 bytes
|
||||||
|
| | | |–Length: 3
|
||||||
|
| | | |
|
||||||
|
| | | |–[122: String] 600:
|
||||||
|
| | | | |–Header: 6 bytes
|
||||||
|
| | | | |–Payload: 5 bytes
|
||||||
|
| | | | |–Total: 11 bytes
|
||||||
|
| | | | '–Value: 800
|
||||||
|
| | | |
|
||||||
|
| | | |–[133: List] cookie:
|
||||||
|
| | | | |–Header: 9 bytes
|
||||||
|
| | | | |–Payload: 17 bytes
|
||||||
|
| | | | |–Total: 26 bytes
|
||||||
|
| | | | |–Contained Type: String
|
||||||
|
| | | | |–Length: 3
|
||||||
|
| | | | |
|
||||||
|
| | | | |–[147: String]:
|
||||||
|
| | | | | |–Payload: 5 bytes
|
||||||
|
| | | | | |–Total: 5 bytes
|
||||||
|
| | | | | '–Value: eat
|
||||||
|
| | | | |
|
||||||
|
| | | | |–[152: String]:
|
||||||
|
| | | | | |–Payload: 4 bytes
|
||||||
|
| | | | | |–Total: 4 bytes
|
||||||
|
| | | | | '–Value: it
|
||||||
|
| | | | |
|
||||||
|
| | | | '–[156: String]:
|
||||||
|
| | | | |–Payload: 3 bytes
|
||||||
|
| | | | |–Total: 3 bytes
|
||||||
|
| | | | '–Value: !
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | '–[159: End]:
|
||||||
|
| | | |–Header: 1 byte
|
||||||
|
| | | |–Payload: 0 bytes
|
||||||
|
| | | '–Total: 1 byte
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | '–[160: Compound]:
|
||||||
|
| | |–Payload: 28 bytes
|
||||||
|
| | |–Total: 28 bytes
|
||||||
|
| | |–Length: 2
|
||||||
|
| | |
|
||||||
|
| | |–[160: Compound]:
|
||||||
|
| | | |–Header: 3 bytes
|
||||||
|
| | | |–Payload: 24 bytes
|
||||||
|
| | | |–Total: 27 bytes
|
||||||
|
| | | |–Length: 2
|
||||||
|
| | | |
|
||||||
|
| | | |–[163: Compound] e:
|
||||||
|
| | | | |–Header: 4 bytes
|
||||||
|
| | | | |–Payload: 19 bytes
|
||||||
|
| | | | |–Total: 23 bytes
|
||||||
|
| | | | |–Length: 3
|
||||||
|
| | | | |
|
||||||
|
| | | | |–[167: 32 Bit Integer] a:
|
||||||
|
| | | | | |–Header: 4 bytes
|
||||||
|
| | | | | |–Payload: 4 bytes
|
||||||
|
| | | | | |–Total: 8 bytes
|
||||||
|
| | | | | '–Value: 544502633
|
||||||
|
| | | | |
|
||||||
|
| | | | |–[175: Compound] f:
|
||||||
|
| | | | | |–Header: 4 bytes
|
||||||
|
| | | | | |–Payload: 6 bytes
|
||||||
|
| | | | | |–Total: 10 bytes
|
||||||
|
| | | | | |–Length: 2
|
||||||
|
| | | | | |
|
||||||
|
| | | | | |–[179: Compound] o:
|
||||||
|
| | | | | | |–Header: 4 bytes
|
||||||
|
| | | | | | |–Payload: 1 byte
|
||||||
|
| | | | | | |–Total: 5 bytes
|
||||||
|
| | | | | | |–Length: 1
|
||||||
|
| | | | | | |
|
||||||
|
| | | | | | '–[183: End]:
|
||||||
|
| | | | | | |–Header: 1 byte
|
||||||
|
| | | | | | |–Payload: 0 bytes
|
||||||
|
| | | | | | '–Total: 1 byte
|
||||||
|
| | | | | |
|
||||||
|
| | | | | |
|
||||||
|
| | | | | '–[184: End]:
|
||||||
|
| | | | | |–Header: 1 byte
|
||||||
|
| | | | | |–Payload: 0 bytes
|
||||||
|
| | | | | '–Total: 1 byte
|
||||||
|
| | | | |
|
||||||
|
| | | | |
|
||||||
|
| | | | '–[185: End]:
|
||||||
|
| | | | |–Header: 1 byte
|
||||||
|
| | | | |–Payload: 0 bytes
|
||||||
|
| | | | '–Total: 1 byte
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | '–[186: End]:
|
||||||
|
| | | |–Header: 1 byte
|
||||||
|
| | | |–Payload: 0 bytes
|
||||||
|
| | | '–Total: 1 byte
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | '–[187: End]:
|
||||||
|
| | |–Header: 1 byte
|
||||||
|
| | |–Payload: 0 bytes
|
||||||
|
| | '–Total: 1 byte
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| '–[188: List]:
|
||||||
|
| |–Payload: 42 bytes
|
||||||
|
| |–Total: 42 bytes
|
||||||
|
| |–Contained Type: List
|
||||||
|
| |–Length: 2
|
||||||
|
| |
|
||||||
|
| |–[193: List]:
|
||||||
|
| | |–Payload: 20 bytes
|
||||||
|
| | |–Total: 20 bytes
|
||||||
|
| | |–Contained Type: String
|
||||||
|
| | |–Length: 5
|
||||||
|
| | |
|
||||||
|
| | |–[198: String]:
|
||||||
|
| | | |–Payload: 3 bytes
|
||||||
|
| | | |–Total: 3 bytes
|
||||||
|
| | | '–Value: a
|
||||||
|
| | |
|
||||||
|
| | |–[201: String]:
|
||||||
|
| | | |–Payload: 3 bytes
|
||||||
|
| | | |–Total: 3 bytes
|
||||||
|
| | | '–Value: b
|
||||||
|
| | |
|
||||||
|
| | |–[204: String]:
|
||||||
|
| | | |–Payload: 3 bytes
|
||||||
|
| | | |–Total: 3 bytes
|
||||||
|
| | | '–Value: c
|
||||||
|
| | |
|
||||||
|
| | |–[207: String]:
|
||||||
|
| | | |–Payload: 3 bytes
|
||||||
|
| | | |–Total: 3 bytes
|
||||||
|
| | | '–Value: d
|
||||||
|
| | |
|
||||||
|
| | '–[210: String]:
|
||||||
|
| | |–Payload: 3 bytes
|
||||||
|
| | |–Total: 3 bytes
|
||||||
|
| | '–Value: e
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| '–[213: List]:
|
||||||
|
| |–Payload: 17 bytes
|
||||||
|
| |–Total: 17 bytes
|
||||||
|
| |–Contained Type: 32 Bit Integer
|
||||||
|
| |–Length: 3
|
||||||
|
| |
|
||||||
|
| |–[218: 32 Bit Integer]:
|
||||||
|
| | |–Payload: 4 bytes
|
||||||
|
| | |–Total: 4 bytes
|
||||||
|
| | '–Value: 457829
|
||||||
|
| |
|
||||||
|
| |–[222: 32 Bit Integer]:
|
||||||
|
| | |–Payload: 4 bytes
|
||||||
|
| | |–Total: 4 bytes
|
||||||
|
| | '–Value: 300
|
||||||
|
| |
|
||||||
|
| '–[226: 32 Bit Integer]:
|
||||||
|
| |–Payload: 4 bytes
|
||||||
|
| |–Total: 4 bytes
|
||||||
|
| '–Value: 60
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|–[230: Compound] compound_level_1:
|
||||||
|
| |–Header: 19 bytes
|
||||||
|
| |–Payload: 545 bytes
|
||||||
|
| |–Total: 564 bytes
|
||||||
|
| |–Length: 5
|
||||||
|
| |
|
||||||
|
| |–[249: List] 100:
|
||||||
|
| | |–Header: 6 bytes
|
||||||
|
| | |–Payload: 291 bytes
|
||||||
|
| | |–Total: 297 bytes
|
||||||
|
| | |–Contained Type: Compound
|
||||||
|
| | |–Length: 4
|
||||||
|
| | |
|
||||||
|
| | |–[260: Compound]:
|
||||||
|
| | | |–Payload: 6 bytes
|
||||||
|
| | | |–Total: 6 bytes
|
||||||
|
| | | |–Length: 2
|
||||||
|
| | | |
|
||||||
|
| | | |–[260: 8 Bit Integer] 3:
|
||||||
|
| | | | |–Header: 4 bytes
|
||||||
|
| | | | |–Payload: 1 byte
|
||||||
|
| | | | |–Total: 5 bytes
|
||||||
|
| | | | '–Value: 3
|
||||||
|
| | | |
|
||||||
|
| | | '–[265: End]:
|
||||||
|
| | | |–Header: 1 byte
|
||||||
|
| | | |–Payload: 0 bytes
|
||||||
|
| | | '–Total: 1 byte
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | |–[266: Compound]:
|
||||||
|
| | | |–Payload: 125 bytes
|
||||||
|
| | | |–Total: 125 bytes
|
||||||
|
| | | |–Length: 4
|
||||||
|
| | | |
|
||||||
|
| | | |–[266: Array of 8 Bit Integers] 600:
|
||||||
|
| | | | |–Header: 6 bytes
|
||||||
|
| | | | |–Payload: 16 bytes
|
||||||
|
| | | | |–Total: 22 bytes
|
||||||
|
| | | | |–Length: 12
|
||||||
|
| | | | '–Values:
|
||||||
|
| | | | |–69
|
||||||
|
| | | | |–36
|
||||||
|
| | | | |–67
|
||||||
|
| | | | |–66
|
||||||
|
| | | | |–40
|
||||||
|
| | | | |–-121
|
||||||
|
| | | | |–98
|
||||||
|
| | | | |–-46
|
||||||
|
| | | | |–21
|
||||||
|
| | | | |–101
|
||||||
|
| | | | |–104
|
||||||
|
| | | | '–97
|
||||||
|
| | | |
|
||||||
|
| | | |–[288: 64 Bit Integer] eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee:
|
||||||
|
| | | | |–Header: 85 bytes
|
||||||
|
| | | | |–Payload: 8 bytes
|
||||||
|
| | | | |–Total: 93 bytes
|
||||||
|
| | | | '–Value: 317827579944
|
||||||
|
| | | |
|
||||||
|
| | | |–[381: 16 Bit Integer] nose:
|
||||||
|
| | | | |–Header: 7 bytes
|
||||||
|
| | | | |–Payload: 2 bytes
|
||||||
|
| | | | |–Total: 9 bytes
|
||||||
|
| | | | '–Value: 12547
|
||||||
|
| | | |
|
||||||
|
| | | '–[390: End]:
|
||||||
|
| | | |–Header: 1 byte
|
||||||
|
| | | |–Payload: 0 bytes
|
||||||
|
| | | '–Total: 1 byte
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | |–[391: Compound]:
|
||||||
|
| | | |–Payload: 154 bytes
|
||||||
|
| | | |–Total: 154 bytes
|
||||||
|
| | | |–Length: 3
|
||||||
|
| | | |
|
||||||
|
| | | |–[391: List] 681:
|
||||||
|
| | | | |–Header: 6 bytes
|
||||||
|
| | | | |–Payload: 8 bytes
|
||||||
|
| | | | |–Total: 14 bytes
|
||||||
|
| | | | |–Contained Type: 8 Bit Integer
|
||||||
|
| | | | |–Length: 3
|
||||||
|
| | | | |
|
||||||
|
| | | | |–[402: 8 Bit Integer]:
|
||||||
|
| | | | | |–Payload: 1 byte
|
||||||
|
| | | | | |–Total: 1 byte
|
||||||
|
| | | | | '–Value: 3
|
||||||
|
| | | | |
|
||||||
|
| | | | |–[403: 8 Bit Integer]:
|
||||||
|
| | | | | |–Payload: 1 byte
|
||||||
|
| | | | | |–Total: 1 byte
|
||||||
|
| | | | | '–Value: 3
|
||||||
|
| | | | |
|
||||||
|
| | | | '–[404: 8 Bit Integer]:
|
||||||
|
| | | | |–Payload: 1 byte
|
||||||
|
| | | | |–Total: 1 byte
|
||||||
|
| | | | '–Value: 5
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | |–[405: Compound] moar:
|
||||||
|
| | | | |–Header: 7 bytes
|
||||||
|
| | | | |–Payload: 132 bytes
|
||||||
|
| | | | |–Total: 139 bytes
|
||||||
|
| | | | |–Length: 2
|
||||||
|
| | | | |
|
||||||
|
| | | | |–[412: Compound] nesting:
|
||||||
|
| | | | | |–Header: 10 bytes
|
||||||
|
| | | | | |–Payload: 121 bytes
|
||||||
|
| | | | | |–Total: 131 bytes
|
||||||
|
| | | | | |–Length: 2
|
||||||
|
| | | | | |
|
||||||
|
| | | | | |–[422: Compound] go:
|
||||||
|
| | | | | | |–Header: 5 bytes
|
||||||
|
| | | | | | |–Payload: 115 bytes
|
||||||
|
| | | | | | |–Total: 120 bytes
|
||||||
|
| | | | | | |–Length: 2
|
||||||
|
| | | | | | |
|
||||||
|
| | | | | | |–[427: Compound] brrrrr:
|
||||||
|
| | | | | | | |–Header: 9 bytes
|
||||||
|
| | | | | | | |–Payload: 105 bytes
|
||||||
|
| | | | | | | |–Total: 114 bytes
|
||||||
|
| | | | | | | |–Length: 7
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |–[436: 16 Bit Integer] anyway:
|
||||||
|
| | | | | | | | |–Header: 9 bytes
|
||||||
|
| | | | | | | | |–Payload: 2 bytes
|
||||||
|
| | | | | | | | |–Total: 11 bytes
|
||||||
|
| | | | | | | | '–Value: 12547
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |–[447: List] data:
|
||||||
|
| | | | | | | | |–Header: 7 bytes
|
||||||
|
| | | | | | | | |–Payload: 21 bytes
|
||||||
|
| | | | | | | | |–Total: 28 bytes
|
||||||
|
| | | | | | | | |–Contained Type: 32 Bit Integer
|
||||||
|
| | | | | | | | |–Length: 4
|
||||||
|
| | | | | | | | |
|
||||||
|
| | | | | | | | |–[459: 32 Bit Integer]:
|
||||||
|
| | | | | | | | | |–Payload: 4 bytes
|
||||||
|
| | | | | | | | | |–Total: 4 bytes
|
||||||
|
| | | | | | | | | '–Value: 10
|
||||||
|
| | | | | | | | |
|
||||||
|
| | | | | | | | |–[463: 32 Bit Integer]:
|
||||||
|
| | | | | | | | | |–Payload: 4 bytes
|
||||||
|
| | | | | | | | | |–Total: 4 bytes
|
||||||
|
| | | | | | | | | '–Value: 808464643
|
||||||
|
| | | | | | | | |
|
||||||
|
| | | | | | | | |–[467: 32 Bit Integer]:
|
||||||
|
| | | | | | | | | |–Payload: 4 bytes
|
||||||
|
| | | | | | | | | |–Total: 4 bytes
|
||||||
|
| | | | | | | | | '–Value: 645
|
||||||
|
| | | | | | | | |
|
||||||
|
| | | | | | | | '–[471: 32 Bit Integer]:
|
||||||
|
| | | | | | | | |–Payload: 4 bytes
|
||||||
|
| | | | | | | | |–Total: 4 bytes
|
||||||
|
| | | | | | | | '–Value: 1337
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |–[475: 8 Bit Integer] here:
|
||||||
|
| | | | | | | | |–Header: 7 bytes
|
||||||
|
| | | | | | | | |–Payload: 1 byte
|
||||||
|
| | | | | | | | |–Total: 8 bytes
|
||||||
|
| | | | | | | | '–Value: 3
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |–[483: Double] is:
|
||||||
|
| | | | | | | | |–Header: 5 bytes
|
||||||
|
| | | | | | | | |–Payload: 8 bytes
|
||||||
|
| | | | | | | | |–Total: 13 bytes
|
||||||
|
| | | | | | | | '–Value: 7.29293e-304
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |–[496: 32 Bit Integer] so:
|
||||||
|
| | | | | | | | |–Header: 5 bytes
|
||||||
|
| | | | | | | | |–Payload: 4 bytes
|
||||||
|
| | | | | | | | |–Total: 9 bytes
|
||||||
|
| | | | | | | | '–Value: 808464643
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | |–[505: Array of 32 Bit Integers] some:
|
||||||
|
| | | | | | | | |–Header: 7 bytes
|
||||||
|
| | | | | | | | |–Payload: 28 bytes
|
||||||
|
| | | | | | | | |–Total: 35 bytes
|
||||||
|
| | | | | | | | |–Length: 6
|
||||||
|
| | | | | | | | '–Values:
|
||||||
|
| | | | | | | | |–3865431
|
||||||
|
| | | | | | | | |–230597146
|
||||||
|
| | | | | | | | |–2147483647
|
||||||
|
| | | | | | | | |–-1870208349
|
||||||
|
| | | | | | | | |–-1195067710
|
||||||
|
| | | | | | | | '–-2031966525
|
||||||
|
| | | | | | | |
|
||||||
|
| | | | | | | '–[540: End]:
|
||||||
|
| | | | | | | |–Header: 1 byte
|
||||||
|
| | | | | | | |–Payload: 0 bytes
|
||||||
|
| | | | | | | '–Total: 1 byte
|
||||||
|
| | | | | | |
|
||||||
|
| | | | | | |
|
||||||
|
| | | | | | '–[541: End]:
|
||||||
|
| | | | | | |–Header: 1 byte
|
||||||
|
| | | | | | |–Payload: 0 bytes
|
||||||
|
| | | | | | '–Total: 1 byte
|
||||||
|
| | | | | |
|
||||||
|
| | | | | |
|
||||||
|
| | | | | '–[542: End]:
|
||||||
|
| | | | | |–Header: 1 byte
|
||||||
|
| | | | | |–Payload: 0 bytes
|
||||||
|
| | | | | '–Total: 1 byte
|
||||||
|
| | | | |
|
||||||
|
| | | | |
|
||||||
|
| | | | '–[543: End]:
|
||||||
|
| | | | |–Header: 1 byte
|
||||||
|
| | | | |–Payload: 0 bytes
|
||||||
|
| | | | '–Total: 1 byte
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | '–[544: End]:
|
||||||
|
| | | |–Header: 1 byte
|
||||||
|
| | | |–Payload: 0 bytes
|
||||||
|
| | | '–Total: 1 byte
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | '–[545: Compound]:
|
||||||
|
| | |–Payload: 1 byte
|
||||||
|
| | |–Total: 1 byte
|
||||||
|
| | |–Length: 1
|
||||||
|
| | |
|
||||||
|
| | '–[545: End]:
|
||||||
|
| | |–Header: 1 byte
|
||||||
|
| | |–Payload: 0 bytes
|
||||||
|
| | '–Total: 1 byte
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |–[546: Compound] compound_level_2a:
|
||||||
|
| | |–Header: 20 bytes
|
||||||
|
| | |–Payload: 1 byte
|
||||||
|
| | |–Total: 21 bytes
|
||||||
|
| | |–Length: 1
|
||||||
|
| | |
|
||||||
|
| | '–[566: End]:
|
||||||
|
| | |–Header: 1 byte
|
||||||
|
| | |–Payload: 0 bytes
|
||||||
|
| | '–Total: 1 byte
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |–[567: Compound] compound_level_2b:
|
||||||
|
| | |–Header: 20 bytes
|
||||||
|
| | |–Payload: 191 bytes
|
||||||
|
| | |–Total: 211 bytes
|
||||||
|
| | |–Length: 3
|
||||||
|
| | |
|
||||||
|
| | |–[587: Float] 300:
|
||||||
|
| | | |–Header: 6 bytes
|
||||||
|
| | | |–Payload: 4 bytes
|
||||||
|
| | | |–Total: 10 bytes
|
||||||
|
| | | '–Value: 1.89896e+28
|
||||||
|
| | |
|
||||||
|
| | |–[597: List] 900:
|
||||||
|
| | | |–Header: 6 bytes
|
||||||
|
| | | |–Payload: 174 bytes
|
||||||
|
| | | |–Total: 180 bytes
|
||||||
|
| | | |–Contained Type: String
|
||||||
|
| | | |–Length: 6
|
||||||
|
| | | |
|
||||||
|
| | | |–[608: String]:
|
||||||
|
| | | | |–Payload: 7 bytes
|
||||||
|
| | | | |–Total: 7 bytes
|
||||||
|
| | | | '–Value: aaaaa
|
||||||
|
| | | |
|
||||||
|
| | | |–[615: String]:
|
||||||
|
| | | | |–Payload: 30 bytes
|
||||||
|
| | | | |–Total: 30 bytes
|
||||||
|
| | | | '–Value: bbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||||
|
| | | |
|
||||||
|
| | | |–[645: String]:
|
||||||
|
| | | | |–Payload: 6 bytes
|
||||||
|
| | | | |–Total: 6 bytes
|
||||||
|
| | | | '–Value: nose
|
||||||
|
| | | |
|
||||||
|
| | | |–[651: String]:
|
||||||
|
| | | | |–Payload: 13 bytes
|
||||||
|
| | | | |–Total: 13 bytes
|
||||||
|
| | | | '–Value: hello there
|
||||||
|
| | | |
|
||||||
|
| | | |–[664: String]:
|
||||||
|
| | | | |–Payload: 37 bytes
|
||||||
|
| | | | |–Total: 37 bytes
|
||||||
|
| | | | '–Value: Eat more bricks, they’re healthy.
|
||||||
|
| | | |
|
||||||
|
| | | '–[701: String]:
|
||||||
|
| | | |–Payload: 76 bytes
|
||||||
|
| | | |–Total: 76 bytes
|
||||||
|
| | | '–Value: ŧ€æ ̣←¶ĸæ↓ŧŧþ€ł„ ̣€æ€“¢↓ø→ł¶€¶„ŋ
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
| | '–[777: End]:
|
||||||
|
| | |–Header: 1 byte
|
||||||
|
| | |–Payload: 0 bytes
|
||||||
|
| | '–Total: 1 byte
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |–[778: List] eeeeeee:
|
||||||
|
| | |–Header: 10 bytes
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 15 bytes
|
||||||
|
| | |–Contained Type: End
|
||||||
|
| | '–Length: 0
|
||||||
|
| |
|
||||||
|
| '–[793: End]:
|
||||||
|
| |–Header: 1 byte
|
||||||
|
| |–Payload: 0 bytes
|
||||||
|
| '–Total: 1 byte
|
||||||
|
|
|
||||||
|
|
|
||||||
|
'–[794: End]:
|
||||||
|
|–Header: 1 byte
|
||||||
|
|–Payload: 0 bytes
|
||||||
|
'–Total: 1 byte
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
[0: Compound]:
|
||||||
|
|–Header: 3 bytes
|
||||||
|
|–Payload: 2395 bytes
|
||||||
|
|–Total: 2398 bytes
|
||||||
|
|–Length: 2
|
||||||
|
|
|
||||||
|
|–[3: List] servers:
|
||||||
|
| |–Header: 10 bytes
|
||||||
|
| |–Payload: 2384 bytes
|
||||||
|
| |–Total: 2394 bytes
|
||||||
|
| |–Contained Type: Compound
|
||||||
|
| |–Length: 2
|
||||||
|
| |
|
||||||
|
| |–[18: Compound]:
|
||||||
|
| | |–Payload: 1184 bytes
|
||||||
|
| | |–Total: 1184 bytes
|
||||||
|
| | |–Length: 4
|
||||||
|
| | |
|
||||||
|
| | |–[18: String] ip:
|
||||||
|
| | | |–Header: 5 bytes
|
||||||
|
| | | |–Payload: 14 bytes
|
||||||
|
| | | |–Total: 19 bytes
|
||||||
|
| | | '–Value: minecraft.ip
|
||||||
|
| | |
|
||||||
|
| | |–[37: String] name:
|
||||||
|
| | | |–Header: 7 bytes
|
||||||
|
| | | |–Payload: 20 bytes
|
||||||
|
| | | |–Total: 27 bytes
|
||||||
|
| | | '–Value: Survival0 Internal
|
||||||
|
| | |
|
||||||
|
| | |–[64: String] icon:
|
||||||
|
| | | |–Header: 7 bytes
|
||||||
|
| | | |–Payload: 1130 bytes
|
||||||
|
| | | |–Total: 1137 bytes
|
||||||
|
| | | '–Value: iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADFUlEQVR4Xt2bPW4UQRCFx9qUA+wBkJB8ElIkbmAJn4GYhNQ38AmcEBORcA8OQdjQbfeq9pvq6und/pv9pCeL/qv3amakHS9elsY45w7ucg48bxcwRS1YZyr++7uj4Ybcsf4wvBm668jYRtDNKOirOTQwC/TZBBadDfqtCovNCn1XgUVmh/6vgofvBea4CB66N5inCB62V5hrEzwk4qdaqSVLCdwsCdN/f1RXpmwVmDMJN0bClGK+lozSVWBOFW6ShGlhtpZ6NcCzWLjMi01Y8mb0829XTfLcDqRfoLiShCVKAyIMtlXy3B6cp37DXXj1NRjwbP2f90Ecl+d3YH0XcAUJS5QGlGqSBqzvAi4gYUlhAyIc1yTP78FF4a0G3L8cT5LhI1xPsUYPihuQCq81ICdJHJN1elClATI4xbUMLhnWAJf5vX00dW0DPNxLsVYHDtkqNCUDeRiaDSAMPbgBLltFu/1JHH/69G4Vylovdf/1GNT9MeAA0RqQUqoBmmLgqOcvH4KmagBvSZqWyjWA62NgijVbY1agGZqVYkCK61NizdaYFeTtSKMt1fMxMCvM2AA/VioLczYaiWZ6yXoE5PwWaWdIzNnSYrWlmY+e2DRNqTMk5uzMDeA6GZpzFuYsOzpCJIwpzaL8J9GrG5DCH/rr5/dqypmUbG1AVO5sdZZXYQZd481CnQ2blG6OEkMwoKUcfsXqdTg24PHh4ybRcKkeH76d/Ts+vy/H9XPMgFtk8Prf8DgahhSjoyQtlnpT4p0I4a0G8EqnxKK1pTXA/8yJe0kI71EmViZGSlrUvDE051KcGuDBRNjMK50Si9aWtKeF1JT7HHAW3oPJ6SS9MawluVeyEJf4asxP8YNLD71aWuPHS6Ww/mrMw1UePzxKKbjOksaSwiXughtDv/oRrr41mFeFm24F5kzCjbcCc5pw895hvk3wkL3CXEXwsL3BPBfBQ/cCc1wFD58d+q8Ci8wKfVeFxWaDfpvAorNAn82hgVHQV1fc2Bco+8WmJ94M3TVknuAadFsL1tkFTvneoYDmfz7/D2WFu2nv97K8AAAAAElFTkSuQmCC
|
||||||
|
| | |
|
||||||
|
| | '–[1201: End]:
|
||||||
|
| | |–Header: 1 byte
|
||||||
|
| | |–Payload: 0 bytes
|
||||||
|
| | '–Total: 1 byte
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| '–[1202: Compound]:
|
||||||
|
| |–Payload: 1195 bytes
|
||||||
|
| |–Total: 1195 bytes
|
||||||
|
| |–Length: 4
|
||||||
|
| |
|
||||||
|
| |–[1202: String] ip:
|
||||||
|
| | |–Header: 5 bytes
|
||||||
|
| | |–Payload: 25 bytes
|
||||||
|
| | |–Total: 30 bytes
|
||||||
|
| | '–Value: lostcave.ddnss.de:45539
|
||||||
|
| |
|
||||||
|
| |–[1232: String] name:
|
||||||
|
| | |–Header: 7 bytes
|
||||||
|
| | |–Payload: 20 bytes
|
||||||
|
| | |–Total: 27 bytes
|
||||||
|
| | '–Value: Survival0 External
|
||||||
|
| |
|
||||||
|
| |–[1259: String] icon:
|
||||||
|
| | |–Header: 7 bytes
|
||||||
|
| | |–Payload: 1130 bytes
|
||||||
|
| | |–Total: 1137 bytes
|
||||||
|
| | '–Value: iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADFUlEQVR4Xt2bPW4UQRCFx9qUA+wBkJB8ElIkbmAJn4GYhNQ38AmcEBORcA8OQdjQbfeq9pvq6und/pv9pCeL/qv3amakHS9elsY45w7ucg48bxcwRS1YZyr++7uj4Ybcsf4wvBm668jYRtDNKOirOTQwC/TZBBadDfqtCovNCn1XgUVmh/6vgofvBea4CB66N5inCB62V5hrEzwk4qdaqSVLCdwsCdN/f1RXpmwVmDMJN0bClGK+lozSVWBOFW6ShGlhtpZ6NcCzWLjMi01Y8mb0829XTfLcDqRfoLiShCVKAyIMtlXy3B6cp37DXXj1NRjwbP2f90Ecl+d3YH0XcAUJS5QGlGqSBqzvAi4gYUlhAyIc1yTP78FF4a0G3L8cT5LhI1xPsUYPihuQCq81ICdJHJN1elClATI4xbUMLhnWAJf5vX00dW0DPNxLsVYHDtkqNCUDeRiaDSAMPbgBLltFu/1JHH/69G4Vylovdf/1GNT9MeAA0RqQUqoBmmLgqOcvH4KmagBvSZqWyjWA62NgijVbY1agGZqVYkCK61NizdaYFeTtSKMt1fMxMCvM2AA/VioLczYaiWZ6yXoE5PwWaWdIzNnSYrWlmY+e2DRNqTMk5uzMDeA6GZpzFuYsOzpCJIwpzaL8J9GrG5DCH/rr5/dqypmUbG1AVO5sdZZXYQZd481CnQ2blG6OEkMwoKUcfsXqdTg24PHh4ybRcKkeH76d/Ts+vy/H9XPMgFtk8Prf8DgahhSjoyQtlnpT4p0I4a0G8EqnxKK1pTXA/8yJe0kI71EmViZGSlrUvDE051KcGuDBRNjMK50Si9aWtKeF1JT7HHAW3oPJ6SS9MawluVeyEJf4asxP8YNLD71aWuPHS6Ww/mrMw1UePzxKKbjOksaSwiXughtDv/oRrr41mFeFm24F5kzCjbcCc5pw895hvk3wkL3CXEXwsL3BPBfBQ/cCc1wFD58d+q8Ci8wKfVeFxWaDfpvAorNAn82hgVHQV1fc2Bco+8WmJ94M3TVknuAadFsL1tkFTvneoYDmfz7/D2WFu2nv97K8AAAAAElFTkSuQmCC
|
||||||
|
| |
|
||||||
|
| '–[2396: End]:
|
||||||
|
| |–Header: 1 byte
|
||||||
|
| |–Payload: 0 bytes
|
||||||
|
| '–Total: 1 byte
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
'–[2397: End]:
|
||||||
|
|–Header: 1 byte
|
||||||
|
|–Payload: 0 bytes
|
||||||
|
'–Total: 1 byte
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,223 @@
|
||||||
|
[0: Compound]:
|
||||||
|
|–Header: 3 bytes
|
||||||
|
|–Payload: 475 bytes
|
||||||
|
|–Total: 478 bytes
|
||||||
|
|–Length: 15
|
||||||
|
|
|
||||||
|
|–[3: String] Spaces and special characters are allowed in tag names, right?:
|
||||||
|
| |–Header: 65 bytes
|
||||||
|
| |–Payload: 24 bytes
|
||||||
|
| |–Total: 89 bytes
|
||||||
|
| '–Value: Idk. Let’s find out.
|
||||||
|
|
|
||||||
|
|–[92: Compound] compound:
|
||||||
|
| |–Header: 11 bytes
|
||||||
|
| |–Payload: 45 bytes
|
||||||
|
| |–Total: 56 bytes
|
||||||
|
| |–Length: 3
|
||||||
|
| |
|
||||||
|
| |–[103: 32 Bit Integer] some_number:
|
||||||
|
| | |–Header: 14 bytes
|
||||||
|
| | |–Payload: 4 bytes
|
||||||
|
| | |–Total: 18 bytes
|
||||||
|
| | '–Value: -754506943
|
||||||
|
| |
|
||||||
|
| |–[121: String] some_text:
|
||||||
|
| | |–Header: 12 bytes
|
||||||
|
| | |–Payload: 14 bytes
|
||||||
|
| | |–Total: 26 bytes
|
||||||
|
| | '–Value: eat a cookie
|
||||||
|
| |
|
||||||
|
| '–[147: End]:
|
||||||
|
| |–Header: 1 byte
|
||||||
|
| |–Payload: 0 bytes
|
||||||
|
| '–Total: 1 byte
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|–[148: Double] double:
|
||||||
|
| |–Header: 9 bytes
|
||||||
|
| |–Payload: 8 bytes
|
||||||
|
| |–Total: 17 bytes
|
||||||
|
| '–Value: 623594
|
||||||
|
|
|
||||||
|
|–[165: Float] float:
|
||||||
|
| |–Header: 8 bytes
|
||||||
|
| |–Payload: 4 bytes
|
||||||
|
| |–Total: 12 bytes
|
||||||
|
| '–Value: 35.2678
|
||||||
|
|
|
||||||
|
|–[177: 16 Bit Integer] int16:
|
||||||
|
| |–Header: 8 bytes
|
||||||
|
| |–Payload: 2 bytes
|
||||||
|
| |–Total: 10 bytes
|
||||||
|
| '–Value: 2000
|
||||||
|
|
|
||||||
|
|–[187: 32 Bit Integer] int32:
|
||||||
|
| |–Header: 8 bytes
|
||||||
|
| |–Payload: 4 bytes
|
||||||
|
| |–Total: 12 bytes
|
||||||
|
| '–Value: 10101010
|
||||||
|
|
|
||||||
|
|–[199: Array of 32 Bit Integers] int32_array:
|
||||||
|
| |–Header: 14 bytes
|
||||||
|
| |–Payload: 20 bytes
|
||||||
|
| |–Total: 34 bytes
|
||||||
|
| |–Length: 4
|
||||||
|
| '–Values:
|
||||||
|
| |–398452796
|
||||||
|
| |–43259
|
||||||
|
| |–2147483647
|
||||||
|
| '–1634890337
|
||||||
|
|
|
||||||
|
|–[233: 64 Bit Integer] int64:
|
||||||
|
| |–Header: 8 bytes
|
||||||
|
| |–Payload: 8 bytes
|
||||||
|
| |–Total: 16 bytes
|
||||||
|
| '–Value: 810001800766
|
||||||
|
|
|
||||||
|
|–[249: Array of 64 Bit Integers] int64_array:
|
||||||
|
| |–Header: 14 bytes
|
||||||
|
| |–Payload: 44 bytes
|
||||||
|
| |–Total: 58 bytes
|
||||||
|
| |–Length: 5
|
||||||
|
| '–Values:
|
||||||
|
| |–239865
|
||||||
|
| |–23586749
|
||||||
|
| |–9223372036854775807
|
||||||
|
| |–188944201329624
|
||||||
|
| '–3116157694992754
|
||||||
|
|
|
||||||
|
|–[307: 8 Bit Integer] int8:
|
||||||
|
| |–Header: 7 bytes
|
||||||
|
| |–Payload: 1 byte
|
||||||
|
| |–Total: 8 bytes
|
||||||
|
| '–Value: 100
|
||||||
|
|
|
||||||
|
|–[315: Array of 8 Bit Integers] int8_array:
|
||||||
|
| |–Header: 13 bytes
|
||||||
|
| |–Payload: 12 bytes
|
||||||
|
| |–Total: 25 bytes
|
||||||
|
| |–Length: 8
|
||||||
|
| '–Values:
|
||||||
|
| |–113
|
||||||
|
| |–53
|
||||||
|
| |–119
|
||||||
|
| |–98
|
||||||
|
| |–84
|
||||||
|
| |–100
|
||||||
|
| |–-11
|
||||||
|
| '–50
|
||||||
|
|
|
||||||
|
|–[340: List] list_int8:
|
||||||
|
| |–Header: 12 bytes
|
||||||
|
| |–Payload: 10 bytes
|
||||||
|
| |–Total: 22 bytes
|
||||||
|
| |–Contained Type: 8 Bit Integer
|
||||||
|
| |–Length: 5
|
||||||
|
| |
|
||||||
|
| |–[357: 8 Bit Integer]:
|
||||||
|
| | |–Payload: 1 byte
|
||||||
|
| | |–Total: 1 byte
|
||||||
|
| | '–Value: 65
|
||||||
|
| |
|
||||||
|
| |–[358: 8 Bit Integer]:
|
||||||
|
| | |–Payload: 1 byte
|
||||||
|
| | |–Total: 1 byte
|
||||||
|
| | '–Value: 96
|
||||||
|
| |
|
||||||
|
| |–[359: 8 Bit Integer]:
|
||||||
|
| | |–Payload: 1 byte
|
||||||
|
| | |–Total: 1 byte
|
||||||
|
| | '–Value: 78
|
||||||
|
| |
|
||||||
|
| |–[360: 8 Bit Integer]:
|
||||||
|
| | |–Payload: 1 byte
|
||||||
|
| | |–Total: 1 byte
|
||||||
|
| | '–Value: 127
|
||||||
|
| |
|
||||||
|
| '–[361: 8 Bit Integer]:
|
||||||
|
| |–Payload: 1 byte
|
||||||
|
| |–Total: 1 byte
|
||||||
|
| '–Value: -6
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|–[362: List] list_strings:
|
||||||
|
| |–Header: 15 bytes
|
||||||
|
| |–Payload: 77 bytes
|
||||||
|
| |–Total: 92 bytes
|
||||||
|
| |–Contained Type: String
|
||||||
|
| |–Length: 12
|
||||||
|
| |
|
||||||
|
| |–[382: String]:
|
||||||
|
| | |–Payload: 8 bytes
|
||||||
|
| | |–Total: 8 bytes
|
||||||
|
| | '–Value: Pacman
|
||||||
|
| |
|
||||||
|
| |–[390: String]:
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 5 bytes
|
||||||
|
| | '–Value: ate
|
||||||
|
| |
|
||||||
|
| |–[395: String]:
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 5 bytes
|
||||||
|
| | '–Value: all
|
||||||
|
| |
|
||||||
|
| |–[400: String]:
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 5 bytes
|
||||||
|
| | '–Value: the
|
||||||
|
| |
|
||||||
|
| |–[405: String]:
|
||||||
|
| | |–Payload: 6 bytes
|
||||||
|
| | |–Total: 6 bytes
|
||||||
|
| | '–Value: dots
|
||||||
|
| |
|
||||||
|
| |–[411: String]:
|
||||||
|
| | |–Payload: 4 bytes
|
||||||
|
| | |–Total: 4 bytes
|
||||||
|
| | '–Value: so
|
||||||
|
| |
|
||||||
|
| |–[415: String]:
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 5 bytes
|
||||||
|
| | '–Value: now
|
||||||
|
| |
|
||||||
|
| |–[420: String]:
|
||||||
|
| | |–Payload: 8 bytes
|
||||||
|
| | |–Total: 8 bytes
|
||||||
|
| | '–Value: he’s
|
||||||
|
| |
|
||||||
|
| |–[428: String]:
|
||||||
|
| | |–Payload: 8 bytes
|
||||||
|
| | |–Total: 8 bytes
|
||||||
|
| | '–Value: coming
|
||||||
|
| |
|
||||||
|
| |–[436: String]:
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 5 bytes
|
||||||
|
| | '–Value: for
|
||||||
|
| |
|
||||||
|
| |–[441: String]:
|
||||||
|
| | |–Payload: 5 bytes
|
||||||
|
| | |–Total: 5 bytes
|
||||||
|
| | '–Value: the
|
||||||
|
| |
|
||||||
|
| '–[446: String]:
|
||||||
|
| |–Payload: 8 bytes
|
||||||
|
| |–Total: 8 bytes
|
||||||
|
| '–Value: words.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|–[454: String] string:
|
||||||
|
| |–Header: 9 bytes
|
||||||
|
| |–Payload: 14 bytes
|
||||||
|
| |–Total: 23 bytes
|
||||||
|
| '–Value: Hello World!
|
||||||
|
|
|
||||||
|
'–[477: End]:
|
||||||
|
|–Header: 1 byte
|
||||||
|
|–Payload: 0 bytes
|
||||||
|
'–Total: 1 byte
|
||||||
|
|
||||||
|
|
|
@ -59,3 +59,9 @@ Usage: `check_endianness > header_file`
|
||||||
Note that, while this tool should in theory be able to detect
|
Note that, while this tool should in theory be able to detect
|
||||||
PDP and Honeywell-316-style endianness, the FOSS-VG project itself
|
PDP and Honeywell-316-style endianness, the FOSS-VG project itself
|
||||||
does not support these.
|
does not support these.
|
||||||
|
|
||||||
|
## region_files
|
||||||
|
|
||||||
|
Exactly what the name says. At this point just a random region file I grabbed
|
||||||
|
from Minecraft, will probably contain synthetic files for test cases in the
|
||||||
|
future as well.
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,90 @@
|
||||||
|
if [ "$1" = "-v" ]; then
|
||||||
|
VERBOSE=true
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
VERBOSE=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "-n" ]; then
|
||||||
|
DECOMPRESS=false
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
DECOMPRESS=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f "$1" ]; then
|
||||||
|
echo "Usage: $0 [-v] [-n] FILE"
|
||||||
|
echo " -v display raw content and NBT dump"
|
||||||
|
echo " -n don't decompress"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pointer data
|
||||||
|
OFFSET_HEX="0x$(dd bs=1 if="$1" count=3 2>/dev/null | hexdump -e '3/1 "%02x" "\n"')"
|
||||||
|
OFFSET="$(baseconvert -d $OFFSET_HEX)"
|
||||||
|
echo " offset: $OFFSET ($OFFSET_HEX)"
|
||||||
|
LENGTH_HEX="0x$(dd bs=1 if="$1" count=1 skip=3 2>/dev/null | hexdump -e '1/1 "%02x" "\n"')"
|
||||||
|
LENGTH="$(baseconvert -d $LENGTH_HEX)"
|
||||||
|
echo " length: $LENGTH ($LENGTH_HEX)"
|
||||||
|
|
||||||
|
#TODO: last modified
|
||||||
|
|
||||||
|
# chunk
|
||||||
|
DATA="$(dd if="$1" bs=4096 count=$LENGTH skip=$OFFSET 2>/dev/null | hexdump -v -e '16/1 "%02x" "\n"' | tr -d '
|
||||||
|
')"
|
||||||
|
|
||||||
|
# blob header
|
||||||
|
# bs=2 because each byte is two digits hex
|
||||||
|
COMPRESSED_LENGTH_HEX="0x$(dd bs=2 count=4 2> /dev/null <<< $DATA)"
|
||||||
|
COMPRESSED_LENGTH="$(baseconvert -d $COMPRESSED_LENGTH_HEX)"
|
||||||
|
echo " compressed length in bytes: $COMPRESSED_LENGTH ($COMPRESSED_LENGTH_HEX)"
|
||||||
|
FORMAT_HEX="0x$(dd bs=2 skip=4 count=1 2> /dev/null <<< $DATA)"
|
||||||
|
case $FORMAT_HEX in
|
||||||
|
"0x01")
|
||||||
|
FORMAT="gzip"
|
||||||
|
function UNCOMPRESS {
|
||||||
|
gzip -dc
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
"0x02")
|
||||||
|
FORMAT="zlib"
|
||||||
|
function UNCOMPRESS {
|
||||||
|
cat > /tmp/chunk_zlib_decompress
|
||||||
|
python3 <<< "
|
||||||
|
import zlib,sys
|
||||||
|
a = open('/tmp/chunk_zlib_decompress', 'rb')
|
||||||
|
data = a.read()
|
||||||
|
a.close()
|
||||||
|
sys.stdout.buffer.write(zlib.decompress(data))
|
||||||
|
sys.stdout.buffer.flush()
|
||||||
|
"
|
||||||
|
rm /tmp/chunk_zlib_decompress
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
FORMAT="unknown"
|
||||||
|
function UNCOMPRESS {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo " format: $FORMAT ($FORMAT_HEX)"
|
||||||
|
|
||||||
|
|
||||||
|
if $DECOMPRESS; then
|
||||||
|
dd if="$1" bs=4096 count=$LENGTH skip=$OFFSET 2>/dev/null | dd bs=1 skip=5 count=$(($COMPRESSED_LENGTH-1)) 2>/dev/null | UNCOMPRESS > /tmp/chunk_uncompressed_nbt
|
||||||
|
else
|
||||||
|
dd if="$1" bs=4096 count=$LENGTH skip=$OFFSET 2>/dev/null | dd bs=1 skip=5 count=$(($COMPRESSED_LENGTH-1)) 2>/dev/null > /tmp/chunk_compressed_nbt
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $VERBOSE; then
|
||||||
|
echo "Raw chunk data:"
|
||||||
|
echo "$DATA"
|
||||||
|
echo "NBT dump:"
|
||||||
|
|
||||||
|
#TODO: use pipes instead of a file
|
||||||
|
#TODO: fix this up to work with both compressed and uncompressed NBT
|
||||||
|
dumpnbt /tmp/chunk_uncompressed_nbt
|
||||||
|
rm /tmp/chunk_uncompressed_nbt
|
||||||
|
fi
|
Binary file not shown.
|
@ -35,10 +35,19 @@ fi
|
||||||
# dynamically linked libraries.
|
# dynamically linked libraries.
|
||||||
echo ">>> Building libs..."
|
echo ">>> Building libs..."
|
||||||
create_directory bin/lib
|
create_directory bin/lib
|
||||||
for lib in $(find ./src/lib -name "*.cpp"); do
|
COMPILE_COMMANDS=(
|
||||||
COMPILE_COMMAND="$CXX_WITH_FLAGS -I ./include -fPIC -shared -o $(sed -e 's/^.\/src/.\/bin/;s/cpp$/so/' <<< $lib) $lib"
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/net/connection.so ./src/lib/net/connection.cpp"
|
||||||
echo $COMPILE_COMMAND
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/cli.so ./src/lib/cli.cpp"
|
||||||
$COMPILE_COMMAND &
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/file.so ./src/lib/file.cpp"
|
||||||
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/game/block.so ./src/lib/game/block.cpp"
|
||||||
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/game/entity.so ./src/lib/game/entity.cpp"
|
||||||
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/nbt.so ./src/lib/nbt.cpp"
|
||||||
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/region.so ./src/lib/region.cpp"
|
||||||
|
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -l:libz.so -o ./bin/lib/zlibutil.so ./src/lib/zlibutil.cpp"
|
||||||
|
)
|
||||||
|
for command in ${!COMPILE_COMMANDS[@]}; do
|
||||||
|
echo "${COMPILE_COMMANDS[command]}"
|
||||||
|
${COMPILE_COMMANDS[command]} &
|
||||||
$WAIT_ANYWAY
|
$WAIT_ANYWAY
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -55,15 +64,16 @@ wait
|
||||||
# How to run a tool: specify the library path to use for the dynamic linker
|
# How to run a tool: specify the library path to use for the dynamic linker
|
||||||
# when running a program
|
# when running a program
|
||||||
# Example: LD_LIBRARY_PATH=bin/lib bin/tools/dumpnbt
|
# Example: LD_LIBRARY_PATH=bin/lib bin/tools/dumpnbt
|
||||||
echo ">>> Building tools..."
|
echo ">>> Building programs..."
|
||||||
create_directory bin/tools
|
create_directory bin/tools
|
||||||
# add compile commands to this array
|
# add compile commands to this array
|
||||||
COMPILE_COMMANDS=(
|
COMPILE_COMMANDS=(
|
||||||
"$CXX_WITH_FLAGS src/tools/dumpnbt.cpp -I./include -Lbin/lib -l:nbt.so -l:cli.so -o bin/tools/dumpnbt"
|
"$CXX_WITH_FLAGS src/tools/dumpnbt.cpp -I./include -Lbin/lib -l:nbt.so -l:cli.so -o bin/tools/dumpnbt"
|
||||||
"$CXX_WITH_FLAGS src/tools/arraydump.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -o bin/tools/arraydump"
|
"$CXX_WITH_FLAGS src/tools/arraydump.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -o bin/tools/arraydump"
|
||||||
"$CXX_WITH_FLAGS src/tools/baseconvert.cpp -I./include -Lbin/lib -l:cli.so -o bin/tools/baseconvert"
|
"$CXX_WITH_FLAGS src/tools/baseconvert.cpp -I./include -Lbin/lib -l:cli.so -o bin/tools/baseconvert"
|
||||||
|
"$CXX_WITH_FLAGS src/tools/zlibutil.cpp -I./include -Lbin/lib -l:cli.so -l:file.so -l:zlibutil.so -l:libz.so -o bin/tools/zlibutil"
|
||||||
"$CXX_WITH_FLAGS -pthread src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet"
|
"$CXX_WITH_FLAGS -pthread src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet"
|
||||||
"$CXX_WITH_FLAGS src/fossvg.cpp -I./include -Lbin/lib -l:cli.so -lglfw -o bin/fossvg"
|
"$CXX_WITH_FLAGS -DFOSSVG_DEBUG src/fossvg.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -lglfw -lvulkan -o bin/fossvg"
|
||||||
"$CXX_WITH_FLAGS src/fossvgd.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvgd"
|
"$CXX_WITH_FLAGS src/fossvgd.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvgd"
|
||||||
)
|
)
|
||||||
for command in ${!COMPILE_COMMANDS[@]}; do
|
for command in ${!COMPILE_COMMANDS[@]}; do
|
||||||
|
@ -73,3 +83,21 @@ for command in ${!COMPILE_COMMANDS[@]}; do
|
||||||
done
|
done
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
||||||
|
echo ">>> Compiling shaders..."
|
||||||
|
create_directory bin/shaders
|
||||||
|
for shader in $(find ./src/shaders -name "*.vsh"); do
|
||||||
|
COMPILE_COMMAND="dependencies/shaderc/bin/glslc -o $(sed -e 's/^.\/src/.\/bin/;s/vsh$/vsh.spv/' <<< $shader) -fshader-stage=vertex $shader"
|
||||||
|
echo $COMPILE_COMMAND
|
||||||
|
$COMPILE_COMMAND &
|
||||||
|
$WAIT_ANYWAY
|
||||||
|
done
|
||||||
|
|
||||||
|
for shader in $(find ./src/shaders -name "*.fsh"); do
|
||||||
|
COMPILE_COMMAND="dependencies/shaderc/bin/glslc -o $(sed -e 's/^.\/src/.\/bin/;s/fsh$/fsh.spv/' <<< $shader) -fshader-stage=fragment $shader"
|
||||||
|
echo $COMPILE_COMMAND
|
||||||
|
$COMPILE_COMMAND &
|
||||||
|
$WAIT_ANYWAY
|
||||||
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
|
@ -29,16 +29,17 @@ create_directory ./bin/lib/net
|
||||||
create_directory ./include
|
create_directory ./include
|
||||||
|
|
||||||
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
|
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
|
||||||
ln -vs ../../dependencies/sockpp-0.7.1/build/cygsockpp-0.dll bin/lib/libsockpp.so
|
ln -vs ../../dependencies/sockpp-0.8.1/build/cygsockpp-0.dll bin/lib/libsockpp.so
|
||||||
ln -vs ../../dependencies/sockpp-0.7.1/build/cygsockpp-0.dll bin/lib/
|
ln -vs ../../dependencies/sockpp-0.8.1/build/cygsockpp-0.dll bin/lib/
|
||||||
else
|
else
|
||||||
ln -vs ../../dependencies/sockpp-0.7.1/build/libsockpp.so bin/lib/
|
ln -vs ../../dependencies/sockpp-0.8.1/build/libsockpp.so bin/lib/
|
||||||
ln -vs ../../dependencies/sockpp-0.7.1/build/libsockpp.so.0 bin/lib/
|
ln -vs ../../dependencies/sockpp-0.8.1/build/libsockpp.so.0 bin/lib/
|
||||||
ln -vs ../../dependencies/sockpp-0.7.1/build/libsockpp.so.0.7.1 bin/lib/
|
ln -vs ../../dependencies/sockpp-0.8.1/build/libsockpp.so.0.8.1 bin/lib/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -vs ../dependencies/sockpp-0.7.1/include/sockpp/ ./include/
|
ln -vs ../dependencies/sockpp-0.8.1/include/sockpp/ ./include/
|
||||||
ln -vs ../dependencies/tiny-utf8-4.4.3/include/tinyutf8/ ./include/
|
ln -vs ../dependencies/tiny-utf8-4.4.3/include/tinyutf8/ ./include/
|
||||||
|
ln -vs ../dependencies/zlib-1.3.1/ ./include/zlib
|
||||||
|
|
||||||
create_file ./bin/.placeholder
|
create_file ./bin/.placeholder
|
||||||
create_file ./include/.placeholder
|
create_file ./include/.placeholder
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
source scripts/lib.sh
|
source scripts/lib.sh
|
||||||
|
|
||||||
|
#TODO: move this to download.sh
|
||||||
echo ">>> Checking download cache for unneeded or corrupted files..."
|
echo ">>> Checking download cache for unneeded or corrupted files..."
|
||||||
for file in $(ls .download_cache); do
|
for file in $(ls .download_cache); do
|
||||||
#TODO: remove if unknown shasum
|
#TODO: remove if unknown shasum
|
||||||
|
@ -35,6 +36,6 @@ done
|
||||||
echo "
|
echo "
|
||||||
>>> Cleaning dependencies..."
|
>>> Cleaning dependencies..."
|
||||||
|
|
||||||
remove ./dependencies
|
remove -f ./dependencies
|
||||||
create_directory ./dependencies
|
create_directory ./dependencies
|
||||||
create_file ./dependencies/.placeholder
|
create_file ./dependencies/.placeholder
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
if [ "$#" -lt 3 -o "$#" -gt 3 ]; then
|
||||||
|
echo "Usage: $0 URL DESTINATION SHA256SUM"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source scripts/lib.sh
|
||||||
|
|
||||||
|
URL="$1"
|
||||||
|
DESTINATION="$2"
|
||||||
|
SHA256SUM="$3"
|
||||||
|
|
||||||
|
if command -v wget >/dev/null 2>&1; then
|
||||||
|
USE_WGET=yes
|
||||||
|
else
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
USE_WGET=no
|
||||||
|
else
|
||||||
|
echo "Found neither wget nor curl. Aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d .download_cache ]; then
|
||||||
|
echo "Cache directory missing."
|
||||||
|
create_directory .download_cache
|
||||||
|
fi
|
||||||
|
|
||||||
|
#TODO: keep track of which cached file is downloaded to which destination
|
||||||
|
#TODO: when downloading a file with a new hash to the same destination, mark the old one as no longer in use
|
||||||
|
#TODO: if there is an even older one for the same download path, delete it
|
||||||
|
#TODO: remove cache maintenance from clean_dependencies
|
||||||
|
|
||||||
|
if [ -f ".download_cache/$SHA256SUM" ]; then
|
||||||
|
if check_sha256 ".download_cache/$SHA256SUM" "$SHA256SUM"; then
|
||||||
|
echo "Using locally cached file for $DESTINATION"
|
||||||
|
cp ".download_cache/$SHA256SUM" "$DESTINATION"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Locally cached file for $DESTINATION is corrupted."
|
||||||
|
rm ".download_cache/$SHA256SUM"
|
||||||
|
$0 "$URL" "$DESTINATION" "$SHA256SUM"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -n "Downloading $URL to $DESTINATION... "
|
||||||
|
if [ $USE_WGET = yes ]; then
|
||||||
|
wget -O ".download_cache/$SHA256SUM" "$URL" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
curl -L "$URL" --output ".download_cache/$SHA256SUM" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
if check_sha256 ".download_cache/$SHA256SUM" "$SHA256SUM"; then
|
||||||
|
cp ".download_cache/$SHA256SUM" "$DESTINATION"
|
||||||
|
echo "done."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "error."
|
||||||
|
echo "Checksum verification failed. Your download is either corrupted or the file has been altered. Removing file."
|
||||||
|
rm ".download_cache/$SHA256SUM"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -57,11 +57,18 @@ fi
|
||||||
# `rm -v` only prints the names of the removed things instead of a more
|
# `rm -v` only prints the names of the removed things instead of a more
|
||||||
# comprehensible message like "removing NAME".
|
# comprehensible message like "removing NAME".
|
||||||
function remove {
|
function remove {
|
||||||
echo "Removing $1..."
|
local USE_FORCE=""
|
||||||
if [ -d "$1" ]; then
|
if [ "$1" = "-f" ]; then
|
||||||
rm -rv "$1"
|
USE_FORCE="f"
|
||||||
|
shift
|
||||||
|
echo "Forcefully removing $1..."
|
||||||
else
|
else
|
||||||
rm -v "$1"
|
echo "Removing $1..."
|
||||||
|
fi;
|
||||||
|
if [ -d "$1" ]; then
|
||||||
|
rm -"$USE_FORCE"rv "$1"
|
||||||
|
else
|
||||||
|
rm -"$USE_FORCE"v "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,68 +17,19 @@
|
||||||
|
|
||||||
source scripts/lib.sh
|
source scripts/lib.sh
|
||||||
|
|
||||||
echo -n "Wget or curl? "
|
|
||||||
if command -v wget >/dev/null 2>&1; then
|
|
||||||
USE_WGET=yes
|
|
||||||
echo "wget"
|
|
||||||
else
|
|
||||||
if command -v curl >/dev/null 2>&1; then
|
|
||||||
USE_WGET=no
|
|
||||||
echo "curl"
|
|
||||||
else
|
|
||||||
echo "Found neither wget nor curl. Aborting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
function download {
|
|
||||||
URL="$1"
|
|
||||||
DESTINATION="$2"
|
|
||||||
SHA256SUM="$3"
|
|
||||||
|
|
||||||
if [ ! -d .download_cache ]; then
|
|
||||||
echo "Cache directory missing."
|
|
||||||
create_directory .download_cache
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f ".download_cache/$SHA256SUM" ]; then
|
|
||||||
if check_sha256 ".download_cache/$SHA256SUM" "$SHA256SUM"; then
|
|
||||||
echo "Using locally cached file for $DESTINATION"
|
|
||||||
cp ".download_cache/$SHA256SUM" "$DESTINATION"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo "Locally cached file for $DESTINATION is corrupted."
|
|
||||||
rm ".download_cache/$SHA256SUM"
|
|
||||||
download "$URL" "$DESTINATION" "$SHA256SUM"
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -n "Downloading $URL to $DESTINATION... "
|
|
||||||
if [ $USE_WGET = yes ]; then
|
|
||||||
wget -O ".download_cache/$SHA256SUM" "$URL" >/dev/null 2>&1
|
|
||||||
else
|
|
||||||
curl -L "$URL" --output ".download_cache/$SHA256SUM" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
if check_sha256 ".download_cache/$SHA256SUM" "$SHA256SUM"; then
|
|
||||||
cp ".download_cache/$SHA256SUM" "$DESTINATION"
|
|
||||||
echo "done."
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo "error."
|
|
||||||
echo "Checksum verification failed. Your download is either corrupted or the file has been altered. Removing file."
|
|
||||||
rm ".download_cache/$SHA256SUM"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
scripts/clean.sh
|
scripts/clean.sh
|
||||||
scripts/clean_dependencies.sh
|
scripts/clean_dependencies.sh
|
||||||
|
|
||||||
set -e # failures are not acceptable here
|
set -e # failures are not acceptable here
|
||||||
create_directory dependencies/tmp
|
create_directory dependencies/tmp
|
||||||
download https://github.com/DuffsDevice/tiny-utf8/archive/refs/tags/v4.4.3.tar.gz dependencies/tmp/tiny-utf8.tar.gz 8e3f61651909c9f3105d3501932a96aa65733127fb6e7cf94cb1b0a2dff42c8f
|
scripts/download.sh https://github.com/DuffsDevice/tiny-utf8/archive/refs/tags/v4.4.3.tar.gz dependencies/tmp/tiny-utf8.tar.gz 8e3f61651909c9f3105d3501932a96aa65733127fb6e7cf94cb1b0a2dff42c8f
|
||||||
download https://github.com/fpagliughi/sockpp/archive/refs/tags/v0.7.1.tar.gz dependencies/tmp/sockpp.tar.gz 2e023528bebbd2ac083fc91fbe6d5c4158c3336bedbcff48f594f3b28f53b940
|
scripts/download.sh https://github.com/fpagliughi/sockpp/archive/refs/tags/v0.8.1.tar.gz dependencies/tmp/sockpp.tar.gz a8aedff8bd8c1da530b91be650352008fddabc9f1df0d19701d76cbc359c8651
|
||||||
|
scripts/download.sh https://www.zlib.net/zlib-1.3.1.tar.xz dependencies/tmp/zlib.tar.xz 38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32
|
||||||
|
|
||||||
|
#TODO: figure out how to cache shaderc
|
||||||
|
#also TODO: target a specific commit
|
||||||
|
git clone --branch known-good https://github.com/google/shaderc.git dependencies/tmp/shaderc
|
||||||
|
#scripts/download.sh https://github.com/google/shaderc/archive/refs/tags/v2023.7.tar.gz dependencies/tmp/shaderc.tar.gz 681e1340726a0bf46bea7e31f10cbfe78e01e4446a35d90fedc2b78d400fcdeb
|
||||||
|
|
||||||
echo -n ">>> Extracting tiny-utf8... "
|
echo -n ">>> Extracting tiny-utf8... "
|
||||||
gzip -d dependencies/tmp/tiny-utf8.tar.gz
|
gzip -d dependencies/tmp/tiny-utf8.tar.gz
|
||||||
|
@ -90,13 +41,60 @@ gzip -d dependencies/tmp/sockpp.tar.gz
|
||||||
tar -xf dependencies/tmp/sockpp.tar -C dependencies
|
tar -xf dependencies/tmp/sockpp.tar -C dependencies
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
|
echo -n ">>> Extracting zlib... "
|
||||||
|
xz -d dependencies/tmp/zlib.tar.xz
|
||||||
|
tar -xf dependencies/tmp/zlib.tar -C dependencies
|
||||||
|
echo "done"
|
||||||
|
|
||||||
echo ">>> Building sockpp..."
|
echo ">>> Building sockpp..."
|
||||||
pushd dependencies/sockpp-0.7.1/ >/dev/null 2>&1
|
pushd dependencies/sockpp-0.8.1/ >/dev/null 2>&1
|
||||||
|
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
|
||||||
|
echo "Adding Cygwin workaound for building sockpp."
|
||||||
|
|
||||||
cmake -G "MinGW Makefiles" -Bbuild .
|
#for FILE in "$(find ./ -type f)"; do
|
||||||
|
# sed -i -e 's/_WIN32/PLEASE_DO_NOT_DEFINE_THIS_MACRO/g' $FILE
|
||||||
|
#done
|
||||||
|
#mv ./include/sockpp/socket.h ./include/sockpp/socket.h_original
|
||||||
|
#echo '#include <sys/time.h>
|
||||||
|
##include "socket.h_original"' > ./include/sockpp/socket.h
|
||||||
|
sed -i -e 's/SO_REUSEPORT/SO_REUSEADDR/g' ./src/acceptor.cpp
|
||||||
|
|
||||||
|
#CFLAGS="-D_XOPEN_SOURCE=700" CXXFLAGS="-D_XOPEN_SOURCE=700" cmake -Bbuild
|
||||||
|
#CFLAGS="-D_XOPEN_SOURCE=700" CXXFLAGS="-D_XOPEN_SOURCE=700" cmake --build build
|
||||||
|
cmake -Bbuild .
|
||||||
cmake --build build
|
cmake --build build
|
||||||
|
else
|
||||||
|
cmake -Bbuild .
|
||||||
|
cmake --build build
|
||||||
|
fi
|
||||||
popd >/dev/null 2>&1
|
popd >/dev/null 2>&1
|
||||||
|
echo ">>> done"
|
||||||
|
|
||||||
|
echo ">>> Dealing with shaderc shenanigans..."
|
||||||
|
pushd dependencies/tmp/shaderc
|
||||||
|
echo "Getting sources using the provided script..."
|
||||||
|
./update_shaderc_sources.py
|
||||||
|
SHADERC_BUILD="build-$(dd if=/dev/urandom bs=1 count=5 2>/dev/null | base32)"
|
||||||
|
echo "Creating and entering directory $SHADERC_BUILD."
|
||||||
|
mkdir "$SHADERC_BUILD"
|
||||||
|
cd "$SHADERC_BUILD"
|
||||||
|
echo "Running CMake..."
|
||||||
|
CXXFLAGS="-Wno-error" cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../src/
|
||||||
|
echo "Running Ninja..."
|
||||||
|
ninja
|
||||||
|
popd >/dev/null 2>&1
|
||||||
|
#if needed copy more relevant files to dependencies/shaderc
|
||||||
|
echo "Copying binary to dependencies/shaderc/bin..."
|
||||||
|
mkdir -vp dependencies/shaderc/bin
|
||||||
|
cp -v "dependencies/tmp/shaderc/$SHADERC_BUILD/glslc/glslc" dependencies/shaderc/bin
|
||||||
|
echo ">>> done"
|
||||||
|
|
||||||
|
echo ">>> Building zlib..."
|
||||||
|
pushd dependencies/zlib-1.3.1/
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
popd
|
||||||
|
echo "done"
|
||||||
|
|
||||||
echo ">>> Cleaning up..."
|
echo ">>> Cleaning up..."
|
||||||
remove dependencies/tmp
|
remove -f dependencies/tmp
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright 2022, FOSS-VG Developers and Contributers
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU Affero General Public License as published
|
|
||||||
# by the Free Software Foundation, version 3.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied
|
|
||||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# version 3 along with this program.
|
|
||||||
# If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
||||||
|
|
||||||
echo "################################################################################
|
|
||||||
Testing hexnet
|
|
||||||
################################################################################"
|
|
||||||
|
|
||||||
echo "Test not yet implemented."
|
|
||||||
#TODO: implement unit test after merging back with master
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "================================================================================"
|
||||||
|
echo "Testing \`zlibutil\`:"
|
||||||
|
echo "--------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d -t fossvg-zlibutil-XXXXX)"
|
||||||
|
TMPDATA="$(dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64)"
|
||||||
|
|
||||||
|
echo -n "Compression test... "
|
||||||
|
|
||||||
|
echo -n "$TMPDATA" >> "$TMPDIR/compress"
|
||||||
|
zlibutil "$TMPDIR/compress"
|
||||||
|
|
||||||
|
python3 <<< "
|
||||||
|
import zlib, sys
|
||||||
|
tmpfile = open('$TMPDIR/compress.zz', 'rb')
|
||||||
|
data = tmpfile.read()
|
||||||
|
tmpfile.close()
|
||||||
|
try:
|
||||||
|
if zlib.decompress(data)==b'$TMPDATA':
|
||||||
|
print('PASS')
|
||||||
|
else:
|
||||||
|
print('FAIL: Wrong data.')
|
||||||
|
except:
|
||||||
|
print('FAIL: Exception.')
|
||||||
|
"
|
||||||
|
|
||||||
|
echo -n "Decompression test... "
|
||||||
|
#TODO: create a compressed file using another implementation (Python)
|
||||||
|
python3 <<< "
|
||||||
|
import zlib
|
||||||
|
tmpfile = open('$TMPDIR/decompress.zz', 'wb')
|
||||||
|
tmpfile.write(zlib.compress(b'$TMPDATA'))
|
||||||
|
tmpfile.close()
|
||||||
|
"
|
||||||
|
|
||||||
|
zlibutil -d "$TMPDIR/decompress.zz"
|
||||||
|
if [ "$(cat "$TMPDIR/decompress")" = "$TMPDATA" ]; then
|
||||||
|
echo "PASS"
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -r "$TMPDIR"
|
||||||
|
|
||||||
|
echo "================================================================================"
|
|
@ -13,7 +13,7 @@
|
||||||
# version 3 along with this program.
|
# version 3 along with this program.
|
||||||
# If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
# If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
echo ">>> Loading Windows-specific shell environment for FOSS-VG development..."
|
echo ">>> Loading shell environment for FOSS-VG development..."
|
||||||
|
|
||||||
export PROJECT_BASE_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
|
export PROJECT_BASE_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
echo "Project base directory is $PROJECT_BASE_DIR"
|
echo "Project base directory is $PROJECT_BASE_DIR"
|
||||||
|
@ -42,13 +42,19 @@ function build {
|
||||||
echo "Added aliases and functions."
|
echo "Added aliases and functions."
|
||||||
|
|
||||||
export PATH="$PROJECT_BASE_DIR/bin:$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH"
|
export PATH="$PROJECT_BASE_DIR/bin:$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH"
|
||||||
|
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
|
||||||
# Windows workaround:
|
echo "Adding Cygwin workaound for library path."
|
||||||
# Windows doesn't have LD_LIBRARY_PATH and searches for libraries on PATH instead.
|
|
||||||
export PATH="$PROJECT_BASE_DIR/bin/lib:$PATH"
|
export PATH="$PROJECT_BASE_DIR/bin/lib:$PATH"
|
||||||
|
fi
|
||||||
echo "PATH is $PATH"
|
echo "PATH is $PATH"
|
||||||
|
|
||||||
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
||||||
|
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib
|
||||||
|
else
|
||||||
|
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib:"$LD_LIBRARY_PATH"
|
||||||
|
fi
|
||||||
|
echo "LD_LIBRARY_PATH is $LD_LIBRARY_PATH"
|
||||||
|
|
||||||
echo ">>> Checking for dependencies..."
|
echo ">>> Checking for dependencies..."
|
||||||
MISSING_DEPS=0
|
MISSING_DEPS=0
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,10 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#define GLFW_INCLUDE_VULKAN
|
||||||
|
extern "C" {
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
}
|
||||||
|
|
||||||
#include "./lib/cli.hpp"
|
#include "./lib/cli.hpp"
|
||||||
|
|
||||||
|
@ -29,24 +32,27 @@
|
||||||
#define EXIT_RUNTIME 1
|
#define EXIT_RUNTIME 1
|
||||||
#define EXIT_USAGE 2
|
#define EXIT_USAGE 2
|
||||||
|
|
||||||
|
uint32_t windowWidth = 1366;
|
||||||
|
uint32_t windowHeight = 768;
|
||||||
|
|
||||||
//TODO: check the TODO above glfwInit() in void main()
|
//TODO: check the TODO above glfwInit() in void main()
|
||||||
// #### Callbacks ##############################################################
|
// #### Callbacks ##############################################################
|
||||||
void cursorPositionCallback(GLFWwindow* window, double x, double y) {
|
void cursorPositionCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] double x, [[maybe_unused]] double y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyCallback(GLFWwindow* window, int32_t key, int32_t scancode, int32_t action, int32_t mods) {
|
void keyCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] int32_t key, [[maybe_unused]] int32_t scancode, [[maybe_unused]] int32_t action, [[maybe_unused]] int32_t mods) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void textInputCallback(GLFWwindow* window, uint32_t codepoint) {
|
void textInputCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] uint32_t codepoint) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursorEnterLeaveCallback(GLFWwindow* window, int32_t entered) {
|
void cursorEnterLeaveCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] int32_t entered) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseButtonCallback(GLFWwindow* window, int32_t button, int32_t action, int32_t mods) {
|
void mouseButtonCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] int32_t button, [[maybe_unused]] int32_t action, [[maybe_unused]] int32_t mods) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollCallback(GLFWwindow* window, double x, double y) {
|
void scrollCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] double x, [[maybe_unused]] double y) {
|
||||||
}
|
}
|
||||||
// #### End Callbacks ##########################################################
|
// #### End Callbacks ##########################################################
|
||||||
|
|
||||||
|
@ -55,6 +61,8 @@ int main(int argc, char* argv[]) {
|
||||||
flags.push_back(CLI::Flag('h', "help", "print help and exit"));
|
flags.push_back(CLI::Flag('h', "help", "print help and exit"));
|
||||||
flags.push_back(CLI::Flag('l', "license", "print license information and exit"));
|
flags.push_back(CLI::Flag('l', "license", "print license information and exit"));
|
||||||
std::vector<CLI::Option> options;
|
std::vector<CLI::Option> options;
|
||||||
|
options.push_back(CLI::Option('x', "window-width", "PIXELS", "window width on startup"));
|
||||||
|
options.push_back(CLI::Option('y', "window-height", "PIXELS", "window height on startup"));
|
||||||
std::vector<CLI::Argument> arguments;
|
std::vector<CLI::Argument> arguments;
|
||||||
CLI::ArgumentsParser cliParser = CLI::ArgumentsParser(argc, argv, flags, options, arguments, "FOSS-VG Client");
|
CLI::ArgumentsParser cliParser = CLI::ArgumentsParser(argc, argv, flags, options, arguments, "FOSS-VG Client");
|
||||||
|
|
||||||
|
@ -88,6 +96,14 @@ int main(int argc, char* argv[]) {
|
||||||
return EXIT_USAGE;
|
return EXIT_USAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cliParser.getOption("window-width").errorCode != ErrorCodes::NOT_PRESENT) {
|
||||||
|
windowWidth = std::stoi(cliParser.getOption("window-width").value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cliParser.getOption("window-height").errorCode != ErrorCodes::NOT_PRESENT) {
|
||||||
|
windowHeight = std::stoi(cliParser.getOption("window-height").value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: Find a better place for this
|
// TODO: Find a better place for this
|
||||||
// Ideally, the window management and rendering portion of FOSS-VG should
|
// Ideally, the window management and rendering portion of FOSS-VG should
|
||||||
|
@ -99,9 +115,11 @@ int main(int argc, char* argv[]) {
|
||||||
return EXIT_RUNTIME;
|
return EXIT_RUNTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: allow to set startup window size using CLI options
|
// do not create OpenGL context
|
||||||
uint32_t windowWidth = 1366;
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
uint32_t windowHeight = 768;
|
|
||||||
|
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
|
|
||||||
//TODO: add a version macro
|
//TODO: add a version macro
|
||||||
// (for example Git commit hash passed on the compiler command line)
|
// (for example Git commit hash passed on the compiler command line)
|
||||||
std::string windowTitle = "FOSS-VG";
|
std::string windowTitle = "FOSS-VG";
|
||||||
|
@ -113,9 +131,6 @@ int main(int argc, char* argv[]) {
|
||||||
return EXIT_RUNTIME;
|
return EXIT_RUNTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// What dis do? It was in a tutorial.
|
|
||||||
glfwMakeContextCurrent(window);
|
|
||||||
|
|
||||||
glfwSetCursorPosCallback(window, cursorPositionCallback);
|
glfwSetCursorPosCallback(window, cursorPositionCallback);
|
||||||
glfwSetKeyCallback(window, keyCallback);
|
glfwSetKeyCallback(window, keyCallback);
|
||||||
glfwSetCharCallback(window, textInputCallback);
|
glfwSetCharCallback(window, textInputCallback);
|
||||||
|
@ -124,12 +139,10 @@ int main(int argc, char* argv[]) {
|
||||||
glfwSetScrollCallback(window, scrollCallback);
|
glfwSetScrollCallback(window, scrollCallback);
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window)) {
|
while (!glfwWindowShouldClose(window)) {
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
|
||||||
|
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glfwDestroyWindow(window);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: needed macros:
|
||||||
|
// TRY: takes a variable, a function call, and the ErrorOr return type of the calling function - intended to automatically unwrap the ErrorOr data type or propagate the error upwards
|
||||||
|
// RAISE: takes an error code and optionally a message to produce something like `return ErrorOr<T>(true, errorCode, file, lineNumber, message)`
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct ErrorOr {
|
struct ErrorOr {
|
||||||
bool isError;
|
bool isError;
|
||||||
|
@ -100,6 +105,9 @@ namespace ErrorCodes {
|
||||||
// when too much data is available
|
// when too much data is available
|
||||||
const uint8_t OVERFLOW = 13;
|
const uint8_t OVERFLOW = 13;
|
||||||
|
|
||||||
|
const uint8_t COMPRESSION = 14;
|
||||||
|
const uint8_t DECOMPRESSION = 15;
|
||||||
|
|
||||||
const uint8_t UNIMPLEMENTED = 254;
|
const uint8_t UNIMPLEMENTED = 254;
|
||||||
|
|
||||||
const uint8_t UNKNOWN = 255;
|
const uint8_t UNKNOWN = 255;
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace block {
|
||||||
|
|
||||||
|
// For internal use only. These are examples, we will probably need
|
||||||
|
// a different way of assigning IDs in the future but a list should
|
||||||
|
// be fine for now, I guess.
|
||||||
|
// I don’t know how Minecraft assigns its IDs or if it even matters
|
||||||
|
// given that it has used string IDs for a while now. We just need an
|
||||||
|
// internal way to distinguish between classes.
|
||||||
|
namespace ids {
|
||||||
|
const uint16_t AIR = 0;
|
||||||
|
const uint16_t STONE = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// These are intended to be combined using bitwise OR.
|
||||||
|
namespace collisionBehavior {
|
||||||
|
// Let the block handle it.
|
||||||
|
// A function on the relevant block class will deal with it.
|
||||||
|
const uint8_t UNKNOWN = 0b00000000;
|
||||||
|
|
||||||
|
// Collision box inhibits movement?
|
||||||
|
// (stone or stone slab)
|
||||||
|
const uint8_t SOLID = 0b00000001;
|
||||||
|
|
||||||
|
// Does collision box fill entire block?
|
||||||
|
// (stone or grass block)
|
||||||
|
//
|
||||||
|
// The shape of the collision box is part of the relevant block class
|
||||||
|
// when this bit is unset.
|
||||||
|
const uint8_t FULL_BLOCK = 0b00000010;
|
||||||
|
|
||||||
|
const uint8_t SOLID_FULL_BLOCK = SOLID | FULL_BLOCK;
|
||||||
|
|
||||||
|
// Slow down entities when inside the block?
|
||||||
|
// (vines or soulsand)
|
||||||
|
//
|
||||||
|
// Entities are considered to be inside a given block when rounding
|
||||||
|
// their coordinates results in the coordinates of the block.
|
||||||
|
//
|
||||||
|
// The amount of slowdown is controlled by a function on the relevant
|
||||||
|
// block class.
|
||||||
|
const uint8_t SLOWDOWN = 0b00000100;
|
||||||
|
|
||||||
|
// Slow down entities when touching the collision box of the block?
|
||||||
|
// (honey block)
|
||||||
|
//
|
||||||
|
// The amount of slowdown is controlled by a function on the relevant
|
||||||
|
// block class.
|
||||||
|
const uint8_t SURFACE_SLOWDOWN = 0b00001000;
|
||||||
|
|
||||||
|
// Deal damage when entities are inside it?
|
||||||
|
// (berry bush)
|
||||||
|
//
|
||||||
|
// Entities are considered to be inside a given block when rounding
|
||||||
|
// their coordinates results in the coordinates of the block.
|
||||||
|
//
|
||||||
|
// The amount of damage is controlled by a function on the relevant
|
||||||
|
// block class.
|
||||||
|
const uint8_t DAMAGE = 0b00010000;
|
||||||
|
|
||||||
|
// Deal damage when entities touch the collision box?
|
||||||
|
// (magma block)
|
||||||
|
//
|
||||||
|
// The amount of damage is controlled by a function on the relevant
|
||||||
|
// block class.
|
||||||
|
const uint8_t SURFACE_DAMAGE = 0b00010000;
|
||||||
|
|
||||||
|
// Is the block bouncy?
|
||||||
|
// (bed or slime block)
|
||||||
|
//
|
||||||
|
// The bounciness of the block is handled by the relevant block class.
|
||||||
|
const uint8_t BOUNCY = 0b00100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Generic {
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
virtual uint16_t id() = 0;
|
||||||
|
virtual uint8_t collisionBehavior() = 0;
|
||||||
|
|
||||||
|
//TODO: (not pure) virtual functions for collision box, slowdown, damage, bounciness, etc.
|
||||||
|
|
||||||
|
//TODO: (not pure) virtual function for hitbox (defaults to full block)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Air {
|
||||||
|
public:
|
||||||
|
uint16_t id() {
|
||||||
|
return ids::AIR;
|
||||||
|
}
|
||||||
|
uint8_t collisionBehavior() {
|
||||||
|
// is a full block but doesn't collide or anything else
|
||||||
|
return collisionBehavior::FULL_BLOCK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockGeneric* getNewBlockFromID(uint16_t id) {
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
}
|
|
@ -1311,7 +1311,8 @@ namespace NBT {
|
||||||
goto returnError;
|
goto returnError;
|
||||||
}
|
}
|
||||||
contents.push_back(new Tag::Int8Array("", nextArray.value));
|
contents.push_back(new Tag::Int8Array("", nextArray.value));
|
||||||
*processedDataSize += (uint64_t) nextArray.value.size();
|
// +4 for the header of the array
|
||||||
|
*processedDataSize += (uint64_t) nextArray.value.size() + 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1370,7 +1371,8 @@ namespace NBT {
|
||||||
goto returnError;
|
goto returnError;
|
||||||
}
|
}
|
||||||
contents.push_back(new Tag::Int32Array("", nextArray.value));
|
contents.push_back(new Tag::Int32Array("", nextArray.value));
|
||||||
*processedDataSize += (uint64_t) nextArray.value.size() * 4;
|
// +4 for the header of the array
|
||||||
|
*processedDataSize += (uint64_t) nextArray.value.size() * 4 + 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1382,7 +1384,8 @@ namespace NBT {
|
||||||
goto returnError;
|
goto returnError;
|
||||||
}
|
}
|
||||||
contents.push_back(new Tag::Int64Array("", nextArray.value));
|
contents.push_back(new Tag::Int64Array("", nextArray.value));
|
||||||
*processedDataSize += (uint64_t) nextArray.value.size() * 8;
|
// +4 for the header of the array
|
||||||
|
*processedDataSize += (uint64_t) nextArray.value.size() * 8 + 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1630,8 @@ namespace NBT {
|
||||||
if (nextArray.isError) {
|
if (nextArray.isError) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*processedDataSize += (uint64_t) nextArray.value.size();
|
// +4 for the header of the array
|
||||||
|
*processedDataSize += (uint64_t) nextArray.value.size() + 4;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1678,7 +1682,8 @@ namespace NBT {
|
||||||
if (nextArray.isError) {
|
if (nextArray.isError) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*processedDataSize += (uint64_t) nextArray.value.size() * 4;
|
// +4 for the header of the array
|
||||||
|
*processedDataSize += (uint64_t) nextArray.value.size() * 4 + 4;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1688,7 +1693,8 @@ namespace NBT {
|
||||||
if (nextArray.isError) {
|
if (nextArray.isError) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*processedDataSize += (uint64_t) nextArray.value.size() * 8;
|
// +4 for the header of the array
|
||||||
|
*processedDataSize += (uint64_t) nextArray.value.size() * 8 + 4;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright 2022, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// Author(s):
|
||||||
|
// BodgeMaster
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "../error.hpp"
|
||||||
|
|
||||||
|
namespace network {
|
||||||
|
struct Connection {
|
||||||
|
}
|
||||||
|
|
||||||
|
// host could be a hostname or address
|
||||||
|
ErrorOr<Connection> connect(std::string host);
|
||||||
|
void disconnect(Connection);
|
||||||
|
|
||||||
|
// start listening for incoming connections
|
||||||
|
ErrorOrVoid startListening();
|
||||||
|
// stop listening for new incoming connections but keep existing
|
||||||
|
// connections open
|
||||||
|
void stopListening();
|
||||||
|
// stop listening for incoming connections and disconnect all
|
||||||
|
void stopCommunication();
|
||||||
|
|
||||||
|
ErrorOr<Connection> acceptNextIncoming();
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright 2022, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// Author(s):
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2023, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// Author(s):
|
||||||
|
// BodgeMaster
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
@ -0,0 +1,57 @@
|
||||||
|
// Copyright 2023, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// Author(s):
|
||||||
|
// BodgeMaster
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
|
|
||||||
|
// File structure:
|
||||||
|
// 4K table of uint32_t: pointing to chunks
|
||||||
|
// -> 24bit offset, 8 bit length
|
||||||
|
// -> both offset and length are multiplied by 4096 to get the real value
|
||||||
|
// -> lowest valid offset = 2
|
||||||
|
// -> chunk is not present if pointer=0
|
||||||
|
// -> chunk calculation: ((x % 32) + (z % 32) * 32) * 4
|
||||||
|
// -> what about negative chunks?
|
||||||
|
// 4k table of uint32_t: last modified timestamps
|
||||||
|
// individual chunks
|
||||||
|
// -> 5 byte header
|
||||||
|
// -> 4 byte length
|
||||||
|
// -> 1 byte compression type: 0?? 1->gzip 2->zlib
|
||||||
|
// -> extension idea: support for other compression algorithms
|
||||||
|
// - lzma
|
||||||
|
// - xz
|
||||||
|
// - lz4
|
||||||
|
// - zstd
|
||||||
|
// -> compressed NBT data
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
class Region {
|
||||||
|
uint32_t storagePointers[1024];
|
||||||
|
uint32_t lastModifiedTimestamps[1024];
|
||||||
|
|
||||||
|
// Chunk coordinates are uint8_t here bc they are 0<=x<32.
|
||||||
|
uint32_t* coordsToStoragePointer(uint8_t x, uint8_t z) {
|
||||||
|
return &storagePointers[z*32 + x];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chunk coordinates are uint8_t here bc they are 0<=x<32.
|
||||||
|
uint32_t* coordsToLastModified(uint8_t x, uint8_t z) {
|
||||||
|
return &lastModifiedTimestamps[z*32 + x];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
// Copyright 2022, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// Author(s):
|
||||||
|
// Jocadbz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
|
// includes vector and error.hpp
|
||||||
|
#include "zlibutil.hpp"
|
||||||
|
|
||||||
|
#include <zlib/zlib.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#define EXIT_SUCCESS 0
|
||||||
|
#define EXIT_RUNTIME 1
|
||||||
|
#define EXIT_USAGE 2
|
||||||
|
|
||||||
|
#define CHUNK_SIZE 16384 // Chunk size
|
||||||
|
|
||||||
|
namespace zlib {
|
||||||
|
|
||||||
|
ErrorOr<std::vector<uint8_t>> compressData(std::vector<uint8_t> data) {
|
||||||
|
// I, too, love the fact that raw bytes are signed and therefore can have negative values. -_-
|
||||||
|
std::vector<int8_t> signedData = std::vector<int8_t>(data.begin(), data.end());
|
||||||
|
|
||||||
|
z_stream zs;
|
||||||
|
memset(&zs, 0, sizeof(zs));
|
||||||
|
|
||||||
|
if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) != Z_OK) {
|
||||||
|
return ErrorOr<std::vector<uint8_t>>(true, ErrorCodes::COMPRESSION);
|
||||||
|
//TODO: include error message once implemented
|
||||||
|
//throw(std::runtime_error("deflateInit failed while compressing."));
|
||||||
|
}
|
||||||
|
|
||||||
|
zs.next_in = reinterpret_cast<Bytef*>(reinterpret_cast<char*>(signedData.data()));
|
||||||
|
zs.avail_in = signedData.size();
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
char outbuffer[CHUNK_SIZE];
|
||||||
|
std::vector<char> compressedData;
|
||||||
|
|
||||||
|
do {
|
||||||
|
zs.next_out = reinterpret_cast<Bytef*>(outbuffer);
|
||||||
|
zs.avail_out = CHUNK_SIZE;
|
||||||
|
|
||||||
|
ret = deflate(&zs, Z_FINISH);
|
||||||
|
|
||||||
|
if (compressedData.size() < zs.total_out)
|
||||||
|
compressedData.insert(compressedData.end(), outbuffer, outbuffer + CHUNK_SIZE - zs.avail_out);
|
||||||
|
} while (ret == Z_OK);
|
||||||
|
|
||||||
|
deflateEnd(&zs);
|
||||||
|
|
||||||
|
if (ret != Z_STREAM_END) {
|
||||||
|
return ErrorOr<std::vector<uint8_t>>(true, ErrorCodes::COMPRESSION);
|
||||||
|
//TODO: include error message once implemented
|
||||||
|
//throw(std::runtime_error("Error while compressing: " + std::to_string(ret)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ErrorOr<std::vector<uint8_t>>(std::vector<uint8_t>(compressedData.begin(), compressedData.end()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ErrorOr<std::vector<uint8_t>> decompressData(std::vector<uint8_t> data) {
|
||||||
|
// I, too, love the fact that raw bytes are signed and therefore can have negative values. -_-
|
||||||
|
std::vector<int8_t> signedData = std::vector<int8_t>(data.begin(), data.end());
|
||||||
|
|
||||||
|
z_stream zs;
|
||||||
|
memset(&zs, 0, sizeof(zs));
|
||||||
|
|
||||||
|
if (inflateInit(&zs) != Z_OK) {
|
||||||
|
return ErrorOr<std::vector<uint8_t>>(true, ErrorCodes::DECOMPRESSION);
|
||||||
|
//TODO: include error message once implemented
|
||||||
|
//throw(std::runtime_error("inflateInit failed while decompressing."));
|
||||||
|
}
|
||||||
|
|
||||||
|
zs.next_in = reinterpret_cast<Bytef*>(reinterpret_cast<char*>(signedData.data()));
|
||||||
|
zs.avail_in = signedData.size();
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
char outbuffer[CHUNK_SIZE];
|
||||||
|
std::vector<char> decompressedData;
|
||||||
|
|
||||||
|
do {
|
||||||
|
zs.next_out = reinterpret_cast<Bytef*>(outbuffer);
|
||||||
|
zs.avail_out = CHUNK_SIZE;
|
||||||
|
|
||||||
|
ret = inflate(&zs, 0);
|
||||||
|
|
||||||
|
if (decompressedData.size() < zs.total_out)
|
||||||
|
decompressedData.insert(decompressedData.end(), outbuffer, outbuffer + CHUNK_SIZE - zs.avail_out);
|
||||||
|
} while (ret == Z_OK);
|
||||||
|
|
||||||
|
inflateEnd(&zs);
|
||||||
|
|
||||||
|
if (ret != Z_STREAM_END) {
|
||||||
|
return ErrorOr<std::vector<uint8_t>>(true, ErrorCodes::DECOMPRESSION);
|
||||||
|
//TODO: include error message once implemented
|
||||||
|
//throw(std::runtime_error("Error while decompressing: " + std::to_string(ret)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ErrorOr<std::vector<uint8_t>>(std::vector<uint8_t>(decompressedData.begin(), decompressedData.end()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright 2024, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// Author(s):
|
||||||
|
// Jocadbz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "error.hpp"
|
||||||
|
|
||||||
|
namespace zlib {
|
||||||
|
ErrorOr<std::vector<uint8_t>> compressData(std::vector<uint8_t> data);
|
||||||
|
ErrorOr<std::vector<uint8_t>> decompressData(std::vector<uint8_t> data);
|
||||||
|
}
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Copyright 2024, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// Author(s):
|
||||||
|
// Jocadbz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
|
#include <bitset>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <tinyutf8/tinyutf8.h>
|
||||||
|
#include <zlib/zlib.h>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "../lib/cli.hpp"
|
||||||
|
#include "../lib/file.hpp"
|
||||||
|
#include "../lib/zlibutil.hpp"
|
||||||
|
#include "../lib/error.hpp"
|
||||||
|
|
||||||
|
#define EXIT_SUCCESS 0
|
||||||
|
#define EXIT_RUNTIME 1
|
||||||
|
#define EXIT_USAGE 2
|
||||||
|
|
||||||
|
#define CHUNK_SIZE 16384 // Chunk size
|
||||||
|
|
||||||
|
/*
|
||||||
|
Finally, the main file
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⢠⣤⣄⣀⣠⣤⣶⣿⣯⣿⣽⣾⣷⣶⣶⡦⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⢀⣿⣟⣯⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣟⣦⣄⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣾⡷⣄⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣾⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣳⡀⠀⠀⠀
|
||||||
|
⠀⠀⢠⣿⣿⣽⣿⢿⣿⣿⣿⣿⡿⣿⣿⣿⣿⢿⡿⣽⣿⣿⡿⣿⣿⣏⣿⣿⣿⣟⣿⣳⡄⠀⠀
|
||||||
|
⠀⠀⣾⣿⣿⣽⣾⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⢿⣿⣾⢿⣷⡿⣿⣿⣷⢿⣿⣿⣷⡿⣷⠀⠀
|
||||||
|
⠀⢸⣿⣿⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣳⣿⣟⣿⣿⣿⣻⣽⣿⣿⡽⡇⠀
|
||||||
|
⠀⡿⣿⣿⣿⣿⣾⣿⣿⣿⣿⢿⣿⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⡀
|
||||||
|
⢸⣿⣿⣿⣿⣿⣿⣿⣏⠀⠈⠀⣿⣿⣿⣿⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣿⢿⡇
|
||||||
|
⢨⣿⣿⣿⣿⣽⣿⣿⣇⣀⡤⠤⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣿⣿⣿⣿⠎⠀
|
||||||
|
⢰⣿⡿⣿⣿⣿⣿⣿⠃⠀⠀⠐⠃⠘⠙⢹⠿⡘⣿⠟⠉⢹⡂⠿⡞⣿⣿⣿⣿⣿⣿⣿⣿⠂⠀
|
||||||
|
⠀⣿⣿⣿⣿⣿⣿⡞⠅⣀⣀⣀⣀⠉⠓⠚⠀⠁⡏⠀⢛⠋⢀⣀⣀⣋⠸⣿⣿⣿⣿⣿⣿⠃⠀
|
||||||
|
⠀⣷⣟⣿⣿⣿⣿⣆⠠⡟⣿⣿⣿⡿⠦⠀⠀⠀⠀⠀⠠⢿⣿⣿⣿⠻⢇⣿⣿⣿⣿⣿⣿⠀⠀
|
||||||
|
⠀⠈⢸⣻⣿⣿⣿⢯⡃⢀⠹⣿⡿⠗⠀⠀⠀⠀⠀⠀⠀⠘⢿⣿⠏⣈⠈⣿⣿⣿⣿⣿⣿⠀⠀
|
||||||
|
⠀⠀⠈⣿⣿⣿⣿⣇⡗⠈⠉⠉⠉⠉⠀⠀⢐⡀⠀⠀⠀⠈⠉⠉⠉⠑⢸⣸⣿⡟⣿⣿⡟⠀⠀
|
||||||
|
⠀⠀⠀⢻⣿⣽⣿⡏⢿⡆⠀⠀⠀⠀⠀⠀⠸⢆⡄⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⡿⠇⠀⠀
|
||||||
|
⠀⠀⠀⠈⠿⣿⢿⡇⠀⠙⢦⡀⠀⠀⠀⠐⠲⠤⠔⠂⠀⠀⠀⢀⣴⣾⣿⣿⣿⣿⣿⡟⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠘⣿⣇⠀⠀⠀⠙⠢⣄⡀⠀⠀⠀⠀⣀⣐⣺⣵⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠙⠋⠀⠀⠀⠀⠀⢹⢨⠑⠲⠤⠞⠋⠉⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡼⠈⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⢀⣀⣠⢤⡠⠒⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⣠⠔⠒⠉⠁⠀⠀⠘⠶⣲⠄⠀⠀⠈⠀⠀⠀⢠⢀⠀⠀⣀⠤⢻⣿⣿⣿⡏⠐⠲⣄⠀⠀
|
||||||
|
⠀⢰⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠓⠒⠚⢕⡀⠀⠀⣠⠖⠒⠚⠁⠀⢾⣿⣿⣿⡁⠀⠀⠨⡆⠀
|
||||||
|
⠀⢸⠀⠀⠀⠒⠒⠒⠒⠒⠂⠀⠐⠚⠑⠆⠀⠀⠒⠓⠀⠀⠀⠀⠀⣿⣿⣿⣿⡆⠀⠀⠀⣇⠀
|
||||||
|
⠀⠈⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠁⠀
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
std::vector<CLI::Flag> flags;
|
||||||
|
flags.push_back(CLI::Flag('d', "decompress", "descompress a file"));
|
||||||
|
std::vector<CLI::Option> options;
|
||||||
|
std::vector<CLI::Argument> arguments;
|
||||||
|
arguments.push_back(CLI::Argument("FILE", "path of the file to compress/decompress"));
|
||||||
|
CLI::ArgumentsParser cliParser = CLI::ArgumentsParser(argc, argv, flags, options, arguments, "Compress or decompress files using zlib");
|
||||||
|
|
||||||
|
if (cliParser.getFlag("help").value) {
|
||||||
|
std::cout << cliParser.getUsage() << std::endl;
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cliParser.getFlag("license").value){
|
||||||
|
std::cout
|
||||||
|
<< "Copyright 2022, FOSS-VG Developers and Contributers\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "ZlibUtil is part of the FOSS-VG development tool suite.\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "This program is free software: you can redistribute it and/or modify it\n"
|
||||||
|
<< "under the terms of the GNU Affero General Public License as published\n"
|
||||||
|
<< "by the Free Software Foundation, version 3.\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "This program is distributed in the hope that it will be useful,\n"
|
||||||
|
<< "but WITHOUT ANY WARRANTY; without even the implied\n"
|
||||||
|
<< "warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
|
||||||
|
<< "See the GNU Affero General Public License for more details.\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "You should have received a copy of the GNU Affero General Public License\n"
|
||||||
|
<< "version 3 along with this program.\n"
|
||||||
|
<< "If not, see https://www.gnu.org/licenses/agpl-3.0.en.html"
|
||||||
|
<< std::endl;
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cliParser.wrongUsage) {
|
||||||
|
std::cout << cliParser.getUsage() << std::endl;
|
||||||
|
return EXIT_USAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string filename = cliParser.getArgument(0).value;
|
||||||
|
|
||||||
|
ErrorOr<File*> filePointer = File::open(filename, 'r');
|
||||||
|
if (filePointer.isError) {
|
||||||
|
std::cout << "Failed to open file: " << filename << std::endl;
|
||||||
|
return EXIT_RUNTIME;
|
||||||
|
}
|
||||||
|
File* file = filePointer.value;
|
||||||
|
File* writeFile;
|
||||||
|
|
||||||
|
if (cliParser.getFlag("decompress").value) {
|
||||||
|
std::vector<uint8_t> bytes = file->read(file->size.value).value;
|
||||||
|
|
||||||
|
ErrorOr<std::vector<uint8_t>> decompressed = zlib::decompressData(bytes);
|
||||||
|
if (decompressed.isError) {
|
||||||
|
std::cout << "Error: Failed to decompress: " << filename << std::endl;
|
||||||
|
delete file;
|
||||||
|
// not cleaning up writeFile here bc it hasn't been created
|
||||||
|
return EXIT_RUNTIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string outFilename;
|
||||||
|
if (filename.length() > 3 && filename.rfind(".zz") == filename.length()-3) {
|
||||||
|
outFilename = filename.substr(0, filename.length()-3);
|
||||||
|
} else {
|
||||||
|
outFilename = filename + ".uncompressed";
|
||||||
|
}
|
||||||
|
writeFile = File::open(outFilename, 'w').value;
|
||||||
|
writeFile->write(decompressed.value);
|
||||||
|
writeFile->close();
|
||||||
|
} else {
|
||||||
|
std::vector<uint8_t> bytes = file->read(file->size.value).value;
|
||||||
|
|
||||||
|
ErrorOr<std::vector<uint8_t>> compressed = zlib::compressData(bytes);
|
||||||
|
if (compressed.isError) {
|
||||||
|
std::cout << "Error: Failed to compress: " << filename << std::endl;
|
||||||
|
delete file;
|
||||||
|
// not cleaning up writeFile here bc it hasn't been created
|
||||||
|
return EXIT_RUNTIME;
|
||||||
|
}
|
||||||
|
writeFile = File::open(filename + ".zz", 'w').value;
|
||||||
|
writeFile->write(compressed.value);
|
||||||
|
writeFile->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete file;
|
||||||
|
delete writeFile;
|
||||||
|
}
|
Loading…
Reference in New Issue