DVDFormat

From GC-Forever Wiki
Revision as of 07:47, 21 September 2024 by Cyndanera (talk | contribs)
Jump to navigation Jump to search

GameCube Disc Format

Please Note this is a work in progress doc

XOR Encryption is done using discID and a randomKey by the Disc Controller Firmware, Panasonic MN103S and is controlled by the System Controller MN102H.

Data Frame

   u32 id; // PSN(Physical Sector Number)
   u16 ied; // ID Error Detection Code, CRC16
   u8 userdata[2048]; // Sector Data
   u8 cpr_mai[6]; // Copyright Management Information(Not used)
   u32 edc; // Error Detection Code, CRC32
   // 2064B

RandomKeys

   0: 3
   1: 48
   2: 32512
   3: 28673
   4: 6
   5: 69
   6: 32256
   7: 24579
   8: 12
   9: 192
   10: 31744
   11: 16391
   12: 24
   13: 384
   14: 30720
   15: 15

DiscId

   char gamecode[4];
   char makercode[2];
   u8 diskNumber;
   u8 version;
   u8 streaming;
   u8 streamingBufferSize;
   u8 pad[16];
   u32 dvdMagic;

Burst Cutting Area

   // UserData(unencrypted), 64B
   u8 optInfo[52];
   u8 manufacturer[2];
   u8 recorderDevice[2];
   u8 bcaSerial;
   u8 discDate[2];
   u8 discTime[2];
   u8 discNumber[3];
   // SecureData(unencrypted), 12B
   u8 key[8];
   u8 id[4];
   // AuthenticationData(encrypted), 48B
   u64 psn[6]; //BCA mark positions
   // 188 Total Bytes

Disc Physical Format

   // Leadin Area
   PhysicalFormatInfo pfi;
   DiscManufacturingInfo dmi;

PhysicalFormatInfo

   u8 reversed[6];
   u8 discMagic; // value is -1.
   u8 discSizeMinTransferRate; // The value is fixed on 16.
   u8 discStructure; // The value is fixed on 1.
   u8 recordedDensity; // The value is fixed on 1.
   DataAreaAllocation m_dataAreaAllocation;
   u8 reversed2[2026];
   u8 reversed3[6];

DiscManufacturingInfo

   u8 reversed[6];
   u8 unknown1[6];
   u8 randomNumber2[6];
   u8 unknown2[6];
   u8 randomNumber3[6];
   char mediaId[19]; // "Nintendo Game Disk"
   u8 randomNumber4[6];
   u8 bookTypePartVersion; // value must be 1.
   u8 discSizeMinReadoutRate; // The value is fixed on 16.
   u8 discStructure; // The value is fixed on 1.
   u8 recordedDensity; // The value is fixed on 0.
   DataAreaAllocation dataAreaAllocation;
   u8 bcaDescriptor; // The value is fixed on 128.
   u8 reversed2[1983];
   u8 reversed3[6];

DataAreaAllocation

   u8 reversed;
   u16 startSector; // 196608
   u8 reversed2;
   u16 endSector; // 909487
   u8 reversed3[3];
   // 12 Bytes

Disc Image Format

   BootHeader m_header; // boot.bin
   BootHeaderInfo m_bi; // bi2.bin
   AppLoader m_apploader; // appldr.img
   FileSystemTable m_fst; // fst.bin
   u8 userdata[0]; // application is stored here, including boot file

BootHeader

   u8 ConsoleID; // G = Gamecube, R = Wii.
   u8 Gamecode[2];
   u8 CountryCode;    //J=JAP . P=PAL . E=USA . D=German
   u8 MakerCode[2];
   u8 DiscID;
   u8 Version;
   u8 AudioStreaming; //01 = Enable it. 00 = Don't
   u8 StreamBufSize; // For the AudioEnable.
   u8 unused_1[18];    
   u32 DVDMagicWord; // 3258163005
   char GameName[64];
   u8 unused_2[416];
   u32 NKitMagicWord;
   u32 NKitVersion;
   u32 DataCRC;
   u32 HeaderCRC;
   u32 DataSize;
   u32 JunkID;
   u8 unused_3[488];
   u32 ApploaderSize;
   u32 ApploaderInit;
   u32 ApploaderMain;
   u32 ApploaderExit;
   u8 unused_4[16];
   u32 DOLOffset;
   u32 FSTOffset;
   u32 FSTSize;
   u32 MaxFSTSize;
   u32 FSTAddress;
   u32 UserPos;
   u32 UserLength;
   u32 unused_5;

BootHeaderInfo

   u32 DebugMonSize;
   u32 SimMemSize;
   u32 ArgOffset;
   u32 DebugFlag;
   u32 DebugOffset;
   u32 DebugSize;
   u32 RegionCode;
   u32 TotalDisc;
   u32 LongFileName;
   u32 PADSpec;
   u32 DOLLimit;
   u8 unused_6[8148];
   // 8192 Bytes

AppLoader

   char revision[16]; // Revision compile date (example "2001/12/17")
   u32 entryAddress;
   u32 size; // Size of apploader code
   u32 rebootSize; // Size of reboot code
   u8 pad[4];
   u8* code;

FileSystemTable

   u32 entryCount;
   FileSystemEntity* m_entity;
   StringTable* m_string;

FileSystemEntity

   u8 flags;
   u16 filenameOffset;
   u32 fileOffset;
   u32 fileSize;

StringTable

   char name[0];
   char dummy;