Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
codex.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/* Copyright (C) Electronic Arts Canada Inc. 1995-2002. All rights reserved. */
20
21/*------------------------------------------------------------------*/
22/* */
23/* Compression Decompression Exchange(CODEX) v2.00 */
24/* */
25/* by FrANK G. Barchard, EAC */
26/* */
27/* Header Module - Oct 15, 2001 */
28/* */
29/*------------------------------------------------------------------*/
30/* */
31/* Version Date SE History */
32/* ------- ------ -- ------- */
33/* 1.00 990824 FB codex API seperated from huff tool */
34/* 1.01 010427 FB fb6 32 bit size header */
35/* 1.02 011011 FB c++ defaults */
36/* 2.00 011015 FB bool, dest/source, new about struct,no QPUBLIC */
37/* */
38/*------------------------------------------------------------------*/
39
40#ifndef __CODEX_H
41#define __CODEX_H 1
42
43#if defined(_MSC_VER)
44#pragma once
45#endif
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51#define CODEX_VERSION 200
52
53/****************************************************************/
54/* Data Types */
55/****************************************************************/
56
57/* Info structure describing bitmaps */
58
59typedef struct
60{
61 int signature; /* signature of codex ie 'tga ' (optional) */
62 int size; /* size of CODEXABOUT structure */
63 int version; /* version number of CODEXABOUT structure (200) */
64
65 unsigned int decode :1; /* supports decoding */
66 unsigned int encode :1; /* supports encoding */
67 unsigned int size32 :1; /* support 32 bit size field */
68 unsigned int pad :29;
69
70 char versionstr[8]; /* version number of codex module ie 1.00 */
71 char shorttypestr[8]; /* 3 or 4 character type string ie ref */
72 char longtypestr[16]; /* full name of data format ie Refpack */
74
75#define QMAKEID(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
76
77#if !defined(GCALL)
78#if defined(_MSC_VER) && !defined(_XBOX)
79#define GCALL __stdcall
80#else
81#define GCALL
82#endif
83#endif
84
85
86typedef struct QFUNCTIONS
87{
89 bool (GCALL * CODEX_is)(const void *compressed);
90 int (GCALL * CODEX_size)(const void *compressed);
91 int (GCALL * CODEX_decode)(void *dest, const void *source, int *sourcesizeptr);
92 int (GCALL * CODEX_encode)(void *dest, const void *source, int sourcesize, int *opts);
94
95extern struct QFUNCTIONS qfunctions[];
96
97/****************************************************************/
98/* Codex Module Example Prototypes */
99/****************************************************************/
100
101#include "gimex.h" /* for memory IO */
102
103/* Information Functions */
104
106bool GCALL CODEX_is(const void *source);
107int GCALL CODEX_size(const void *source);
108
109/* Decode/Encode Functions */
110
111#ifdef __cplusplus
112int GCALL CODEX_decode(void *dest, const void *source, int *sourcesizeptr=0);
113int GCALL CODEX_encode(void *dest, const void *source, int sourcesize, int *opts=0);
114#else
115int GCALL CODEX_decode(void *dest, const void *source, int *sourcesizeptr);
116int GCALL CODEX_encode(void *dest, const void *source, int sourcesize, int *opts);
117#endif
118
119#ifdef __cplusplus
120}
121#endif
122#endif
123
struct QFUNCTIONS qfunctions[]
CODEXABOUT *GCALL CODEX_about(void)
int GCALL CODEX_size(const void *source)
int GCALL CODEX_decode(void *dest, const void *source, int *sourcesizeptr)
#define GCALL
Definition codex.h:81
bool GCALL CODEX_is(const void *source)
int GCALL CODEX_encode(void *dest, const void *source, int sourcesize, int *opts)
unsigned int size32
Definition codex.h:67
unsigned int encode
Definition codex.h:66
unsigned int pad
Definition codex.h:68
int signature
Definition codex.h:61
char shorttypestr[8]
Definition codex.h:71
int size
Definition codex.h:62
unsigned int decode
Definition codex.h:65
char longtypestr[16]
Definition codex.h:72
int version
Definition codex.h:63
char versionstr[8]
Definition codex.h:70
int(GCALL *CODEX_size)(const void *compressed)
const void int int * opts
Definition codex.h:92
const void int sourcesize
Definition codex.h:92
int(GCALL *CODEX_decode)(void *dest
int(GCALL *CODEX_encode)(void *dest
CODEXABOUT *GCALL * CODEX_about(void)
const void * source
Definition codex.h:91
const void int * sourcesizeptr
Definition codex.h:91
bool(GCALL *CODEX_is)(const void *compressed)