This shows you the differences between two versions of the page.
— |
yoshis_story:object_data [2019/10/04 17:11] (current) shygoo created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Object Data ====== | ||
+ | The object lookup table is at 0x000A1C90 in ROM as an array of 1582 ObjectEntry structs. | ||
+ | |||
+ | ===== ObjectEntry struct ===== | ||
+ | <code C> | ||
+ | struct ObjectEntry | ||
+ | { | ||
+ | /*00*/ u16 objectId; // unique identifier | ||
+ | /*02*/ u16 unk02; // probably padding | ||
+ | /*04*/ u32 boObjectDefA; // bank-offset of ObjectDefA struct | ||
+ | /*08*/ u32 boObjectDefB; // bank-offset of ObjectDefB struct | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | [[yoshis_story:object_ids]] | ||
+ | |||
+ | ===== ObjectDefA_00 struct ===== | ||
+ | This structure defines the properties of an object. | ||
+ | |||
+ | <code C> | ||
+ | struct ObjectDefA_00 | ||
+ | { | ||
+ | /*00*/ u16 type; // structure type (0x0001) | ||
+ | u8 _pad02[2]; | ||
+ | /*04*/ CodeInfo codeInfo; | ||
+ | /*18*/ u16 objectId; // unique identifier | ||
+ | /*1A*/ u16 unk1A; | ||
+ | /*1C*/ u32 tileDimensionsSize; // sizeof(TileDimensions) | ||
+ | /*20*/ u32 boTileDimensions; // bank-offset of TileDimensions struct | ||
+ | /*24*/ u32 tileDataInfoSize; // sizeof(BlockInfo) | ||
+ | /*28*/ u32 boTileDataInfo; // bank-offset of BlockInfo struct for the tiles' 8bit color-index data | ||
+ | /*2C*/ u32 tilePaletteInfoSize; // sizeof(BlockInfo) | ||
+ | /*30*/ u32 boTilePaletteInfo; /* bank-offset of BlockInfo struct for the tiles' palette data | ||
+ | palette data is a 0x200 byte array of rgba5551 (u16) colors */ | ||
+ | /*34*/ u32 tileMapInfoSize; // sizeof(BlockInfo) | ||
+ | /*38*/ u32 boTileMapInfo; /* bank-offset of BlockInfo struct for the tile map | ||
+ | the tile map is a u16 array tile indeces */ | ||
+ | /*3C*/ u32 unkData1InfoSize; // sizeof(BlockInfo) | ||
+ | /*40*/ u32 boUnkData1; // bank-offset of BlockInfo struct for ?? | ||
+ | /*44*/ u32 unkData2InfoSize; // sizeof(BlockInfo) | ||
+ | /*48*/ u32 boUnkData2; // bank-offset of BlockInfo struct for ?? | ||
+ | /*4C*/ u32 collisionMapInfoSize; // sizeof(BlockInfo) | ||
+ | /*50*/ u32 boCollisionMapInfo; /* bank-offset of BlockInfo struct for collision data | ||
+ | the collision map is a u16 array, parallel to the tile map array */ | ||
+ | /*54*/ u8 unk54[16]; // unknown data | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | ===== ObjectDefA_01 struct ===== | ||
+ | This structure defines the properties of the Yoshi player object. | ||
+ | |||
+ | <code C> | ||
+ | struct ObjectDefA_01 // only used for yoshi | ||
+ | { | ||
+ | /*0x00*/ u16 type; // structure type (0x0001) | ||
+ | /*0x04*/ u8 unk04; | ||
+ | /*0x08*/ u32 unk08; | ||
+ | /*0x18*/ u16 unk18; | ||
+ | /*0x1C*/ u8 unk1C; | ||
+ | /*0x1D*/ u8 unk1D; | ||
+ | /*0x20*/ u32 boUnk20; | ||
+ | /*0x24*/ u32 boUnk24; | ||
+ | /*0x28*/ u32 boUnk28; | ||
+ | /*0x2C*/ u32 unk2C; | ||
+ | /*0x30*/ u32 boUnk30; | ||
+ | /*0x34*/ u32 unk34; | ||
+ | /*0x38*/ u32 unk38; | ||
+ | /*0x3C*/ u32 unk3C; | ||
+ | /*0x40*/ u32 boUnk40; | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | ===== ObjectDefA_02 struct ===== | ||
+ | <code C> | ||
+ | struct ObjectDefA_02 | ||
+ | { | ||
+ | /*00*/ u16 type; // structure type (0x0002) | ||
+ | u8 _pad02[2]; | ||
+ | CodeInfo codeInfo; | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | ===== ObjectDefB struct ===== | ||
+ | <code C> | ||
+ | struct ObjectDefB | ||
+ | { | ||
+ | // todo | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | ===== TileDimensions struct ===== | ||
+ | <code C> | ||
+ | struct TileDimensions | ||
+ | { | ||
+ | /*0x00*/ u16 unk00; // ?? related to width | ||
+ | /*0x02*/ u16 unk02; // ?? related to height | ||
+ | /*0x04*/ u16 tileWidth; // width of an individual tile | ||
+ | /*0x06*/ u16 tileHeight; // height of an individual tile | ||
+ | /*0x08*/ u16 mapWidth; // width of the whole map (num tiles X * tileWidth) | ||
+ | /*0x0A*/ u16 mapHeight // height of the whole map (num tiles Y * tileHeight) | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | ===== BlockInfo struct ===== | ||
+ | This structure references a block of data in ROM. The block of data may either be raw or SMSR00 compressed depending on the srcSize and dstSize fields. | ||
+ | <code C> | ||
+ | struct BlockInfo | ||
+ | { | ||
+ | /*0x00*/ u32 dstSize; // decoded block size | ||
+ | /*0x04*/ u32 srcSize; // encoded block size | ||
+ | /*0x08*/ u32 boData; /* bank-offset of the data (may be a CMPR or raw) | ||
+ | if the data is raw, both size and sizeEnc will be the same value */ | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | ===== CodeInfo struct ===== | ||
+ | This struct references code that an object should use. It can either reference an overlay file or a single function already in memory. | ||
+ | <code C> | ||
+ | struct CodeInfo | ||
+ | { | ||
+ | u8 useOverlay; // 1 = use overlay, 0 = use nativeFunc | ||
+ | u8 _pad[3]; // padding | ||
+ | union { | ||
+ | void *nativeFunc; // pointer to native function | ||
+ | struct | ||
+ | { | ||
+ | u32 romStart; // overlay rom start address | ||
+ | u32 romEnd; // overlay rom end address | ||
+ | void *fakeMemStart; // fake ram start address | ||
+ | void *fakeMemEnd; // fake ram end address | ||
+ | } overlay; | ||
+ | }; | ||
+ | }; | ||
+ | </code> | ||