#pragma once #include "common.h" #include "tmd.h" #define CMD_SIZE_N(n) (sizeof(CmdHeader) + ((n)*(sizeof(u32)+sizeof(u32)+0x10))) #define CMD_SIZE_NS(n) (sizeof(CmdHeader) + ((n)*(sizeof(u32)+sizeof(u32)))) // from: http://3dbrew.org/wiki/Titles#Data_Structure typedef struct { u32 cmd_id; // same as filename id, .cmd u32 n_entries; // matches highest content index u32 n_cmacs; // number of cmacs in file (excluding the one @0x10) u32 unknown; // usually 1 u8 cmac[0x10]; // calculated from first 0x10 byte of data, no hashing // followed by u32 list of content ids (sorted by index, 0xFFFFFFFF for unavailable) // followed by u32 list of content ids (sorted by id?) // followed by CMACs (may contain garbage) } __attribute__((packed, aligned(4))) CmdHeader; u32 CheckCmdSize(CmdHeader* cmd, u64 fsize); u32 BuildCmdData(CmdHeader* cmd, TitleMetaData* tmd);