Visual_Studio

010 Editor GCI Template

Sep 28th, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.04 KB | None | 0 0
  1. //--------------------------------------
  2. //--- 010 Editor v6.0.3 Binary Template
  3. //
  4. // File:        GCI.bt
  5. // Author:      Visual Studio
  6. // Revision:    1.0
  7. // Purpose:     Dissecting GCI save files
  8. //--------------------------------------
  9.  
  10. BigEndian();
  11. BitfieldRightToLeft();
  12.  
  13. typedef uchar u8;
  14. typedef uint16 u16;
  15. typedef uint32 u32;
  16. typedef uint64 u64;
  17.  
  18. typedef struct _GCI_HEADER {
  19.     u8  GameID[3]       <comment="Game identifier",bgcolor=cLtGreen>;
  20.     u8  RegionFlag      <comment="Region Flag",bgcolor=cLtBlue>;
  21.     u8  CompanyID[2]    <comment="Company identifier">;
  22.     u8  pad0            <hidden=true,bgcolor=cLtRed>;
  23.     u8  GraphicFormat   <comment="Graphics Format">;
  24.     u8  FileID[0x20]    <comment="File identifier",bgcolor=cLtGreen>;
  25.     u32 LastModified    <comment="Last Modified Date">;
  26.     u32 GraphicOffset   <comment="Graphics Offset">;
  27.     u8  pad1[0x8]       <hidden=true,bgcolor=cLtRed>;
  28.     u16 NumBlocksUsed   <comment="Number of blocks used">;
  29.     u8  pad2[0x2]       <hidden=true,bgcolor=cLtRed>;
  30.     u32 InfoOffset      <comment="File info offset">;
  31. } GCI_HEADER;
  32.  
  33. typedef struct _FILE_INFO {
  34.     u8  GameName[0x20]  <comment="Game name",bgcolor=cLtGreen>;
  35.     u8  FileInfo[0x20]  <comment="File info">;
  36. } FILE_INFO;
  37.  
  38. local u8 graphic_fmt[0x3];
  39. local u16 graphic_len = 0;
  40.  
  41. // header
  42. GCI_HEADER gci_header;
  43.  
  44. // file info
  45. if(gci_header.InfoOffset > 0)
  46.     FSeek(sizeof(GCI_HEADER) + gci_header.InfoOffset);
  47. FILE_INFO file_info;
  48.  
  49. // graphic
  50. if(gci_header.GraphicFormat == 0x01 || gci_header.GraphicFormat == 0x05) {
  51.     graphic_fmt = "CI8";
  52.     // CI8 then Graphic [3072] + Palete [512] = Total [3584]
  53.     graphic_len = 0xE00;
  54. }
  55. else if(gci_header.GraphicFormat == 0x02 || gci_header.GraphicFormat == 0x06) {
  56.     graphic_fmt = "RGB";
  57.     // RGB5A3  Graphic [6144]
  58.     graphic_len = 0x1800;
  59. }
  60. typedef struct _GRAPHIC {
  61.     u8  Graphic[graphic_len]    <comment="The save graphic">;
  62. } GRAPHIC;
  63. if(gci_header.GraphicOffset > 0)
  64.     FSeek(sizeof(GCI_HEADER) + gci_header.GraphicOffset);
  65. GRAPHIC graphic;
Advertisement
Add Comment
Please, Sign In to add comment