1 // This file is part of libreallive, a dependency of RLVM.
2 //
3 // -----------------------------------------------------------------------
4 //
5 // Copyright (c) 2006 Peter Jolly
6 //
7 // Permission is hereby granted, free of charge, to any person
8 // obtaining a copy of this software and associated documentation
9 // files (the "Software"), to deal in the Software without
10 // restriction, including without limitation the rights to use, copy,
11 // modify, merge, publish, distribute, sublicense, and/or sell copies
12 // of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be
16 // included in all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22 // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 // SOFTWARE.
26 //
27 // -----------------------------------------------------------------------
28 
29 #ifndef SRC_LIBREALLIVE_COMPRESSION_H_
30 #define SRC_LIBREALLIVE_COMPRESSION_H_
31 
32 #include <string>
33 
34 #include "libreallive/defs.h"
35 
36 namespace libreallive {
37 namespace compression {
38 
39 // An individual xor key; some games use multiple ones.
40 struct XorKey {
41   char xor_key[16];
42   int xor_offset;
43   int xor_length;
44 };
45 
46 // Per game xor keys to be passed to decompress, terminated with -1 offset
47 // entries.
48 extern const XorKey little_busters_xor_mask[];
49 extern const XorKey clannad_full_voice_xor_mask[];
50 extern const XorKey little_busters_ex_xor_mask[];
51 extern const XorKey snow_standard_edition_xor_mask[];
52 extern const XorKey kud_wafter_xor_mask[];
53 extern const XorKey kud_wafter_all_ages_xor_mask[];
54 
55 void Decompress(const char* src, size_t src_len, char* dst, size_t dst_len,
56                 const XorKey* per_game_xor_key);
57 
58 }  // namespace compression
59 }  // namespace libreallive
60 
61 #endif  // SRC_LIBREALLIVE_COMPRESSION_H_
62