ireko/src/struct_property.rs

95 lines
3 KiB
Rust
Raw Normal View History

use crate::structs::{CarryCountProperty, DAAssembleIdDataStruct, DABuildDataStruct, DACharacterCommonStatusStruct, DALoadOptionStruct, DAMachineColoringDataStruct, DAModuleColorStruct, DAModuleItemDataStruct, DateTimeStruct, GuidStruct, LinearColorStruct, ParamsStruct, PrimaryAssetIdStruct, PrimaryAssetNameProperty, SaveSlotInfoStruct};
2025-02-19 19:34:13 -05:00
use binrw::binrw;
#[binrw]
#[derive(Debug)]
pub enum Struct {
#[br(magic = b"DateTime\0")]
DateTime(DateTimeStruct),
#[br(magic = b"DALoadOption\0")]
DALoadOption(DALoadOptionStruct),
#[br(magic = b"SaveSlotInfo\0")]
SaveSlotInfo(SaveSlotInfoStruct),
#[br(magic = b"DACharacterCommonStatus\0")]
DACharacterCommonStatus(DACharacterCommonStatusStruct),
#[br(magic = b"Params\0")]
Params(ParamsStruct),
#[br(magic = b"PrimaryAssetType\0")]
PrimaryAssetType {
#[br(pad_before = 17)]
2025-02-23 15:04:04 -05:00
name: PrimaryAssetNameProperty,
#[br(pad_before = 9)] // "None" and it's length in bytes plus the null terminator
#[br(pad_after = 9)] // ditto
2025-02-23 15:04:04 -05:00
primary_asset_name: PrimaryAssetNameProperty,
},
2025-02-19 19:34:13 -05:00
#[br(magic = b"PrimaryAssetId\0")]
PrimaryAssetId(PrimaryAssetIdStruct),
#[br(magic = b"DAModuleItemData\0")]
DAModuleItemData(DAModuleItemDataStruct),
#[br(magic = b"DABuildData\0")]
DABuildData(DABuildDataStruct),
#[br(magic = b"DAAssembleIdData\0")]
DAAssembleIdData(DAAssembleIdDataStruct),
#[br(magic = b"Guid\0")]
Guid(GuidStruct),
#[br(magic = b"DAMachineColoringData\0")]
DAMachineColoringData(DAMachineColoringDataStruct),
#[br(magic = b"DAModuleColor\0")]
DAModuleColor(DAModuleColorStruct),
#[br(magic = b"LinearColor\0")]
LinearColor(LinearColorStruct),
#[br(magic = b"CarryCount\0")]
CarryCount {
2025-02-23 15:04:04 -05:00
carry_count: CarryCountProperty,
2025-02-23 15:04:04 -05:00
#[br(pad_before = 15)] // "StoreCount" + 4 bytes for length + 1 byte for endofstring
#[br(pad_after = 9)] // "None" + 1 byte for endofstring + 4 bytes for length
store_count: CarryCountProperty,
},
#[br(magic = b"Map\0")]
Map {
2025-02-23 15:04:04 -05:00
#[br(pad_after = 9)] // "None" + 1 byte for endofstring + 4 bytes for length
map: CarryCountProperty,
},
// TODO: im almost certain this isn't a struct name
#[br(magic = b"ID\0")]
ID {
unk: [u8; 149], // not sure how to parse this yet
2025-02-23 15:04:04 -05:00
#[br(pad_after = 9)] // "None" and it's length in bytes plus the null terminator
name: PrimaryAssetNameProperty,
2025-02-23 15:04:04 -05:00
#[br(pad_after = 9)] // "None" and it's length in bytes plus the null terminator
primary_asset_name: PrimaryAssetNameProperty,
2025-02-23 15:04:04 -05:00
data: [u8; 137],
},
#[br(magic = b"Set\0")]
Set {
2025-02-23 15:04:04 -05:00
#[br(pad_after = 9)] // "None" + 1 byte for endofstring + 4 bytes for length
set: CarryCountProperty,
},
#[br(magic = b"ItemSlots\0")]
ItemSlots {
unk: [u8; 2125]
},
2025-02-19 19:34:13 -05:00
}
#[binrw]
#[derive(Debug)]
pub struct StructProperty {
pub unk: u32,
#[br(temp)]
#[bw(ignore)]
#[br(pad_before = 4)]
pub name_length: u32,
pub r#struct: Struct,
}