-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupport_action_param.rs
59 lines (44 loc) · 1.21 KB
/
support_action_param.rs
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
use binrw::binrw;
use serde::{Serialize, Deserialize};
use super::{NuccBinaryParsed, NuccBinaryType};
// Format reversed by Portable Productions (https://www.youtube.com/@PortableProductions)
#[binrw]
#[derive(Serialize, Deserialize, Debug)]
pub struct Entry {
pub characode_index: u32,
pub unk1: u32,
pub unk2: u32,
pub support_type: u32,
pub unk3: i32,
pub unk4: i32,
}
#[binrw]
#[derive(Serialize, Deserialize, Debug)]
pub struct SupportActionParam {
#[serde(skip)]
#[bw(calc = 1001)]
pub version: u32,
pub entry_count: u32,
#[serde(skip)]
#[bw(calc = 0x8)]
pub entry_ptr: u64,
#[br(count = entry_count)]
pub entries: Vec<Entry>
}
impl NuccBinaryParsed for SupportActionParam {
fn binary_type(&self) -> NuccBinaryType {
NuccBinaryType::SupportActionParam
}
fn extension(&self) -> String {
String::from(".json")
}
fn serialize(&self) -> Vec<u8> {
serde_json::to_string_pretty(self).unwrap().into()
}
fn deserialize(data: &[u8]) -> Self
where
Self: Sized,
{
serde_json::from_slice(data).unwrap()
}
}