ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 80 00 00 00 80 08 06 00 00 00 c3 3e 61 | .PNG........IHDR..............>a |
0020 | cb 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 | .....bKGD..............pHYs..... |
0040 | 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e1 05 1f 12 32 18 30 e8 11 07 00 00 1c 37 49 | ............tIME.....2.0......7I |
0060 | 44 41 54 78 da ed 9d 4b 8f 63 cb 96 d7 7f 11 b1 5f b6 d3 76 66 65 56 9e 2a ee b9 f7 f4 80 6e 06 | DATx...K.c......_..vfeV.*.....n. |
0080 | ad 6e 86 30 00 31 40 e2 0b 30 41 62 86 e8 19 12 df 84 11 b3 46 4c 18 a2 e6 03 20 f1 21 68 d1 6a | .n.0.1@..0Ab........FL......!h.j |
00a0 | b5 1a 5d a1 f3 a8 3a 55 27 9f 7e ed 67 44 30 58 b1 73 67 65 3a 6d 67 de 7b 2b 6d 69 87 54 2a 67 | ..]...:U'.~.gD0X.sge:mg.{+mi.T*g |
00c0 | d8 7b 7b 6d c7 8a 15 eb f5 5f 4b f1 c4 f8 37 7f 9c fa da 2a 7c d3 60 34 58 3c 1a 88 e2 88 fb f3 | .{{m....._K...7....*|.`4X<...... |
00e0 | ff f1 bf fd af a7 6e c1 7f fa b7 ff 72 e3 b5 0f e7 5d d5 80 01 e5 3d 46 81 d5 11 58 fb ac 7b ac | ......n.....r....]....=F...X..{. |
0100 | 9b ff 0f ff f5 7f b2 69 fc e7 7f f7 af 5e 44 d7 ff f8 be 51 7c c5 f1 4f 4e f1 97 b7 54 ff e8 37 | .......i.....^D..../*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "irrlichttypes.h"
#include "exceptions.h"
#include <iostream>
#include "util/pointer.h"
/*
Map format serialization version
--------------------------------
For map data (blocks, nodes, sectors).
NOTE: The goal is to increment this so that saved maps will be
loadable by any version. Other compatibility is not
maintained.
0: original networked test with 1-byte nodes
1: update with 2-byte nodes
2: lighting is transmitted in param
3: optional fetching of far blocks
4: block compression
5: sector objects NOTE: block compression was left accidentally out
6: failed attempt at switching block compression on again
7: block compression switched on again
8: server-initiated block transfers and all kinds of stuff
9: block objects
10: water pressure
11: zlib'd blocks, block flags
12: UnlimitedHeightmap now uses interpolated areas
13: Mapgen v2
14: NodeMetadata
15: StaticObjects
16: larger maximum size of node metadata, and compression
17: MapBlocks contain timestamp
18: new generator (not really necessary, but it's there)
19: new content type handling
20: many existing content types translated to extended ones
21: dynamic content type allocation
22: minerals removed, facedir & wallmounted changed
23: new node metadata format
24: 16-bit node ids and node timers (never released as stable)
25: Improved node timer format
26: Never written; read the same as 25
27: Added light spreading flags to blocks
28: Added "private" flag to NodeMetadata
*/
// This represents an uninitialized or invalid format
#define SER_FMT_VER_INVALID 255
// Highest supported serialization version
#define SER_FMT_VER_HIGHEST_READ 28
// Saved on disk version
#define SER_FMT_VER_HIGHEST_WRITE 28
// Lowest supported serialization version
#define SER_FMT_VER_LOWEST_READ 0
// Lowest serialization version for writing
// Can't do < 24 anymore; we have 16-bit dynamically allocated node IDs
// in memory; conversion just won't work in this direction.
#define SER_FMT_VER_LOWEST_WRITE 24
inline bool ser_ver_supported(s32 v) {
return v >= SER_FMT_VER_LOWEST_READ && v <= SER_FMT_VER_HIGHEST_READ;
}
/*
Misc. serialization functions
*/
void compressZlib(const u8 *data, size_t data_size, std::ostream &os, int level = -1);
void compressZlib(const std::string &data, std::ostream &os, int level = -1);
void decompressZlib(std::istream &is, std::ostream &os, size_t limit = 0);
// These choose between zlib and a self-made one according to version
void compress(const SharedBuffer<u8> &data, std::ostream &os, u8 version);
//void compress(const std::string &data, std::ostream &os, u8 version);
void decompress(std::istream &is, std::ostream &os, u8 version);
|