1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/// A type that represents a reference to a PARAM file within a FROMSOFTWARE game.
///
/// ```
/// #[derive(Debug)]
/// #[repr(C)]
/// pub struct NetworkAreaParam {
///     /// セルサイズX
///     cell_size_x: f32,
///     /// セルサイズY
///     cell_size_y: f32,
///     /// セルサイズZ
///     cell_size_z: f32,
///     /// セルオフセットX
///     cell_offset_x: f32,
///     /// セルオフセットY
///     cell_offset_y: f32,
///    /// セルオフセットZ
///     cell_offset_z: f32,
/// }
///
/// impl me3_game_support_fromsoft::sprj::ParamFileDescriptor for NetworkAreaParam {
///     const ID: usize = 49;
///     type Row = Self;
/// }
/// ```
pub trait ParamFileDescriptor {
    const ID: usize;
    type Row: Sized;
}

/// A helper macro to simplify defining PARAM files for structures that are only referenced within a single PARAM file.
/// ```
/// use me3_game_support_fromsoft::impl_param_file_descriptor;
///
/// pub struct NetworkAreaParam {
///     /// セルサイズX
///     cell_size_x: f32,
///     /// セルサイズY
///     cell_size_y: f32,
///     /// セルサイズZ
///     cell_size_z: f32,
///     /// セルオフセットX
///     cell_offset_x: f32,
///     /// セルオフセットY
///     cell_offset_y: f32,
///     /// セルオフセットZ
///     cell_offset_z: f32,
/// }
///
/// impl_param_file_descriptor!(NetworkAreaParam, 49);
/// ```
#[macro_export]
macro_rules! impl_param_file_descriptor {
    ($ty:ident, $id:expr) => {
        impl me3_game_support_fromsoft::sprj::ParamFileDescriptor for $ty {
            const ID: usize = $id;
            type Row = $ty;
        }
    };
}