]> FriiDump Source - friidump.git/blob - libfriidump/nintendo_disc_header.h
Harden GCC-4243N A102 HLDS E7 profile
[friidump.git] / libfriidump / nintendo_disc_header.h
1 /***************************************************************************
2  *   Nintendo GameCube/Wii disc-header classifier                         *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  ***************************************************************************/
9
10 #ifndef NINTENDO_DISC_HEADER_H_INCLUDED
11 #define NINTENDO_DISC_HEADER_H_INCLUDED
12
13 #include <stddef.h>
14 #include <stdint.h>
15
16 typedef enum {
17     NINTENDO_DISC_HEADER_UNKNOWN = 0,
18     NINTENDO_DISC_HEADER_GAMECUBE,
19     NINTENDO_DISC_HEADER_WII
20 } nintendo_disc_header_type;
21
22 /*
23  * Classify an unscrambled Nintendo optical-disc header.
24  *
25  * Wii discs carry big-endian magic 0x5d1c9ea3 at byte 0x18.
26  * GameCube discs carry big-endian magic 0xc2339f3d at byte 0x1c.
27  * Wii is checked first, matching the console-side discrimination order.
28  */
29 nintendo_disc_header_type nintendo_disc_header_detect(
30     const uint8_t *sector,
31     size_t sector_length
32 );
33
34 const char *nintendo_disc_header_type_name(
35     nintendo_disc_header_type type
36 );
37
38 #endif