1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) 2010-2011 Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 
13 // gfdConstant.h
14 //
15 // Constants for Cafe graphics binary files (for example, .gtx and .gsh).
16 
17 #ifndef _CAFE_GFD_CONSTANT_H_
18 #define _CAFE_GFD_CONSTANT_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif // __cplusplus
24 
25 #include <cafe/gfd.h>
26 
27 /// @addtogroup GFDConstantGroup
28 /// @{
29 
30 #ifdef LITTLEENDIAN_CPU
31 #define _GFD_CREATE_MAGIC(a,b,c,d)    ((a<<0) | (b<<8) | (c<<16) | (d<<24))
32 #else
33 #define _GFD_CREATE_MAGIC(a,b,c,d)    ((a<<24) | (b<<16) | (c<<8) | (d<<0))
34 #endif
35 
36 //
37 // Structure version for gfd.dll structures.
38 //
39 
40 /// \brief GFD ABI version for structures used by gfd.dll.
41 /// The version number is encoded in the bottom nibble.
42 #define GFD_DLL_ABI_VERSION 0x47666400 // "\0dfG"
43 
44 /// \brief GFD ABI magic mask for structures used by gfd.dll.
45 #define GFD_DLL_ABI_TYPE(a) (a & 0xFFFFFF00)
46 
47 /// \brief GFD ABI version mask for structures used by gfd.dll.
48 #define GFD_DLL_ABI_VERSION_NUM(a) (a & 0x000000FF)
49 
50 //
51 // For top header
52 //
53 
54 /// \brief  Magic number for the header of a GFD file
55 #define GFD_HEADER_MAGIC _GFD_CREATE_MAGIC('G','f','x','2')
56 
57 /// \brief Size of the GFD file header in bytes
58 #define GFD_HEADER_SIZE sizeof(GFDHeader)
59 
60 /// \brief Major file version for all GFD files.  Error if not equal.
61 #define GFD_HEADER_MAJOR 7
62 
63 /// \brief Minor file version for GFD files.  Warning if greater
64 #define GFD_HEADER_MINOR 1
65 
66 // For block header
67 
68 /// \brief Magic number for the block header of each block in a GFD file
69 #define GFD_BLOCK_HEADER_MAGIC _GFD_CREATE_MAGIC('B','L','K','{')
70 
71 /// \brief Size of the GFD file header in bytes
72 #define GFD_BLOCK_HEADER_SIZE sizeof(GFDBlockHeader)
73 
74 /// \brief Default major version for all block types.
75 #define GFD_BLOCK_HEADER_MAJOR 1
76 
77 /// \brief Default minor version for all block types
78 #define GFD_BLOCK_HEADER_MINOR 0
79 
80 //
81 // For relocation header
82 //
83 
84 /// \brief Magic number a the begining of every SerializationTrailer block in a GFD file
85 #define GFD_BLOCK_RELOCATION_HEADER_MAGIC _GFD_CREATE_MAGIC('}','B','L','K')
86 
87 //
88 // For Error checking
89 //
90 
91 /// \brief Magic constant to OR with data offsets. Used to validate file during read
92 #define GFD_TAG_DAT 0xD0600000
93 
94 /// \brief Magic constant to OR with string table offsets. Used to validate file during read
95 #define GFD_TAG_STR 0xCA700000
96 
97 /// \brief Mask for our magic offset bits
98 #define GFD_TAG_MASK 0xFFF00000
99 
100 /// @}
101 
102 #ifdef __cplusplus
103 }
104 #endif // __cplusplus
105 
106 #endif // _CAFE_GFD_CONSTANT_H_
107