DVDFormat: Difference between revisions

From GC-Forever Wiki
Jump to navigation Jump to search
Cyndanera (talk | contribs)
No edit summary
Cyndanera (talk | contribs)
updated disc page
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
GameCube Disc Format aka NROM(Read-only) or NR-Disc(Rewritable)
GameCube Disc Format aka NROM(Read-only) or NR-Disc(Recordable)


Please Note this is a work in progress doc.
Please Note this is a work in progress doc.


DVD Sector Scrambling(XOR) is done using Disk ID(gameID+makerID) and a Random Key(2 byte number) by the Disc Drive Firmware, it is stored on a 128KB ROM
DVD Sector Scrambling(XOR) is done using Disk ID(8 bytes) and a Random Number by the Disk Controller Firmware, it is stored on a 128KB on-chip ROM
System Controller firmware uses a ROM 128KB chip.


  Panasonic MN103S (32bit) is the Disk Controller(ECC, Servo Control, Descramble, XADPCM Decoding)
  Panasonic MN103S (32bit), 54MHz is the Disk Controller(ECC, EFM\EFM+, Drive IC Control, Descrambler, XADPCM Decoding)
  Panasonic MN102H (16bit) is the System Controller(Manager, Checks Copy protection, Handles Commands, Checks Disc Type, Etc.)
  Panasonic MN102H (16bit), 33Mhz is the System Controller(System Manager, Copy protection, Handles Commands)


The development tools used to develop for these Panasonic microcontrollers is called Debug Factory 3, it comes with a toolchain that has compiler, linker, assembler.
The development tools used to develop for these Panasonic microcontrollers is called Debug Factory 3, it comes with a toolchain that has compiler, linker, assembler.
Line 32: Line 33:
     // 2064B
     // 2064B


== Random Keys ==
== Random Number Table ==
     0: 3
     0: 3
     1: 48
     1: 48
Line 50: Line 51:
     15: 15
     15: 15


== DiscId ==
== DiskId ==
     char gamecode[4];
     char gamecode[4];
     char makercode[2];
     char makercode[2];
Line 130: Line 131:


BootHeader
BootHeader
     u8 Gamecode[4];
     u8 game_code[4];
     u8 MakerCode[2];
     u8 company_code[2];
     u8 DiskNumber;
     u8 diskNumber;
     u8 GameVersion;
     u8 gameVersion;
     u8 AudioStreaming;
     u8 audioStreaming;
     u8 StreamBufSize;
     u8 streamBufSize;
     u8 unused_1[18];     
     u8 unused_1[18];     
     u32 magic; // 3258163005
     u32 magic; // 3258163005
     char GameName[64];
     char gameName[64];
     u8 unused_2[416];
     u8 unused_2[416];
     u32 NKitMagicWord;
     u32 nkitMagicWord;
     u32 NKitVersion;
     u32 nkitVersion;
     u32 DataCRC;
     u32 dataCRC;
     u32 HeaderCRC;
     u32 headerCRC;
     u32 DataSize;
     u32 dataSize;
     u32 JunkID;
     u32 junkId;
     u8 unused_3[488];
     u8 unused_3[488];
     u32 ApploaderSize;
     u32 ApploaderSize;
Line 152: Line 153:
     u32 ApploaderExit;
     u32 ApploaderExit;
     u8 unused_4[16];
     u8 unused_4[16];
     u32 DOLOffset;
     u32 bootOffset;
     u32 FSTOffset;
     u32 fstOffset;
     u32 FSTSize;
     u32 fstSize;
     u32 MaxFSTSize;
     u32 maxFstSize;
     u32 FSTAddress;
     u32 fstAddress; // debug fstOffset
     u32 UserPos;
     u32 userPos; // disc data offset
     u32 UserLength;
     u32 userLength; // disc data size
     u32 unused_5;
     u32 unused_5;


BootHeaderInfo
BootHeaderInfo
     u32 DebugMonSize;
     u32 debugMonSize; // debug monitor size
     u32 SimMemSize;
     u32 simMemSize; // simulator memory size
     u32 ArgOffset;
     u32 argOffset;
     u32 DebugFlag;
     u32 debugFlag;
     u32 DebugOffset;
     u32 debugOffset;
     u32 DebugSize;
     u32 debugSize;
     u32 RegionCode;
     u32 country;
     u32 TotalDisc;
     u32 totalDisc;
     u32 LongFileName;
     u32 supportLongFileName;
     u32 PADSpec;
     u32 padSpec;
     u32 DOLLimit;
     u32 dolLimit;
     u8 unused_6[8148];
     u8 unused_6[8148];
     // 8192 Bytes
     // 8192 Bytes


AppLoader
AppLoader
     char date[16];
     char date[16]; // date string
     u32 entryAddress;
     u32 entryAddress;
     u32 size;
     u32 size;

Latest revision as of 16:16, 7 January 2025

GameCube Disc Format aka NROM(Read-only) or NR-Disc(Recordable)

Please Note this is a work in progress doc.

DVD Sector Scrambling(XOR) is done using Disk ID(8 bytes) and a Random Number by the Disk Controller Firmware, it is stored on a 128KB on-chip ROM System Controller firmware uses a ROM 128KB chip.

Panasonic MN103S (32bit), 54MHz is the Disk Controller(ECC, EFM\EFM+, Drive IC Control, Descrambler, XADPCM Decoding)
Panasonic MN102H (16bit), 33Mhz is the System Controller(System Manager, Copy protection, Handles Commands)

The development tools used to develop for these Panasonic microcontrollers is called Debug Factory 3, it comes with a toolchain that has compiler, linker, assembler.

In the firmware the text "Nintendo Game Disk" can be found this is the Media ID 19 byte string that is used as meta data in the lead-in area of the DVD.
MN102H looks for this string to check if the disc type is a GameCube\Wii Game Disc.
It's also does the BCA copy protection check.

Data Types

  u8 = unsigned char (1 byte) or string
  s8 = signed char (1 byte)
  u16 = unsigned short (2 bytes)
  s16 = signed short (2 bytes)
  u32 = unsigned int (4 bytes)
  s32 = signed int (4 bytes)
  u64 = unsigned long long (8 bytes)
  s64 = signed long long (8 bytes)

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

Random Number Table

   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

DiskId

   char gamecode[4];
   char makercode[2];
   u8 diskNumber;
   u8 version;
   u8 streaming;
   u8 streamingBufferSize;
   u8 pad[18];
   u32 magic;

Burst Cutting Area

   // UserData(unencrypted), 64B
   u8 optionalInfo[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
   PsnRegion psn[6]; // 6 sector locations
   // 188 Total Bytes
   
   struct_PsnRegion
   {
       u32 start;
       u32 end;
   };

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;
   u8 reversed2;
   u16 endSector;
   u8 reversed3[3];
   // 12 Bytes

Disc Image Format

   BootHeader m_header;
   BootHeaderInfo m_bi;
   AppLoader m_apploader;
   FileSystemTable m_fst;
   u8 userdata[0]; // application is stored here, including boot file

BootHeader

   u8 game_code[4];
   u8 company_code[2];
   u8 diskNumber;
   u8 gameVersion;
   u8 audioStreaming;
   u8 streamBufSize;
   u8 unused_1[18];    
   u32 magic; // 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 bootOffset;
   u32 fstOffset;
   u32 fstSize;
   u32 maxFstSize;
   u32 fstAddress; // debug fstOffset
   u32 userPos; // disc data offset
   u32 userLength; // disc data size
   u32 unused_5;

BootHeaderInfo

   u32 debugMonSize; // debug monitor size
   u32 simMemSize; // simulator memory size
   u32 argOffset;
   u32 debugFlag;
   u32 debugOffset;
   u32 debugSize;
   u32 country;
   u32 totalDisc;
   u32 supportLongFileName;
   u32 padSpec;
   u32 dolLimit;
   u8 unused_6[8148];
   // 8192 Bytes

AppLoader

   char date[16]; // date string
   u32 entryAddress;
   u32 size;
   u32 rebootSize;
   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;
   u8 pad;