aboutsummaryrefslogtreecommitdiff
path: root/project/src/lib-rkc.h
blob: ec44445ce7be8ef672ce9966e39418622bf8cb32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

/***************************************************************************
 *                         _______ _______ _______                         *
 *                        |  ___  |____   |  ___  |                        *
 *                        | |   |_|    / /| |   |_|                        *
 *                        | |_____    / / | |_____                         *
 *                        |_____  |  / /  |_____  |                        *
 *                         _    | | / /    _    | |                        *
 *                        | |___| |/ /____| |___| |                        *
 *                        |_______|_______|_______|                        *
 *                                                                         *
 *                            Wiimms SZS Tools                             *
 *                          https://szs.wiimm.de/                          *
 *                                                                         *
 ***************************************************************************
 *                                                                         *
 *   This file is part of the SZS project.                                 *
 *   Visit https://szs.wiimm.de/ for project details and sources.          *
 *                                                                         *
 *   Copyright (c) 2011-2022 by Dirk Clemens <wiimm@wiimm.de>              *
 *                                                                         *
 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 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 General Public License for more details.                          *
 *                                                                         *
 *   See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt       *
 *                                                                         *
 ***************************************************************************/

///////////////////////////////////////////////////////////////////////////////

#ifndef SZS_LIB_RKC_H
#define SZS_LIB_RKC_H 1

#include "lib-std.h"

///////////////////////////////////////////////////////////////////////////////
///////////////			definitions			///////////////
///////////////////////////////////////////////////////////////////////////////

#define RKCT_MAGIC		"RKCT"
#define RKCT_MAGIC_NUM		0x524b4354

#define RKCO_MAGIC		"RKCO"
#define RKCO_MAGIC_NUM		0x524b434f
#define RKCO_FILENAME		"rkco.bin"

#define RKC_VERSION		 0x640
#define RKC_U8_OFFSET		  0x50
#define RKC_U8_LIMIT		0x5000
#define RKC_U8_FILENAME		"rkc.szs"

//
///////////////////////////////////////////////////////////////////////////////
///////////////			struct rkct_t			///////////////
///////////////////////////////////////////////////////////////////////////////

typedef struct rkco_t
{
   /*00*/   u32		magic;		// always RKCO_MAGIC_NUM
   /*04*/   u8		xdata[0x40-4];	// misc data
}
__attribute__ ((packed)) rkco_t;

//
///////////////////////////////////////////////////////////////////////////////
///////////////			struct rkct_t			///////////////
///////////////////////////////////////////////////////////////////////////////

typedef struct rkct_t
{
   /*00*/   u32		magic;		// always RKCT_MAGIC_NUM
   /*04*/   u32		size;		// total RKC size
   /*08*/   u32		u8_off;		// Offset uf U8-archice (YAZ0 compressed)
					// usually RKC_U8_OFFSET
   /*0c*/   u32		version;	// always 0x640 (RKC_VERSION)
   /*ff*/   rkco_t	rkco[0];
}
__attribute__ ((packed)) rkct_t;

//
///////////////////////////////////////////////////////////////////////////////
///////////////			    interface			///////////////
///////////////////////////////////////////////////////////////////////////////

struct szs_iterator_t;

int IterateFilesRKC
(
    struct szs_iterator_t	*it,	// iterator struct with all infos
    bool			term	// true: termination hint
);

//-----------------------------------------------------------------------------

struct szs_file_t;

enumError CreateRKC
(
    struct szs_file_t	*szs,		// valid szs
    ccp			source_dir	// NULL or path to source dir
);

//
///////////////////////////////////////////////////////////////////////////////
///////////////			    END				///////////////
///////////////////////////////////////////////////////////////////////////////

#endif // SZS_LIB_RKC_H