new file: output

modified:   src/main.rs
	modified:   src/objects.rs
	modified:   src/xobjects.rs
This commit is contained in:
Michael Wain 2025-02-08 21:54:39 +03:00
parent d4de8dc8e2
commit c2b6f178c9
4 changed files with 11772 additions and 9 deletions

11749
output Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
use std::{fs::File, io::{Read, Write}};
use env_logger::Builder;
use log::{error, info, LevelFilter};
use xobjects::{XArgument, XSomeList};
mod objects;
mod xobjects;
@ -25,8 +26,21 @@ fn main() {
match f.read_to_end(&mut buf) {
Ok(n) => {
let data = &buf[..n];
let xdb = deserializer::parse_bytes(data);
//info!("XDB: {:?}", xdb);
let mut xdb = deserializer::parse_bytes(data);
//info!("XDB: {:#?}", xdb);
if let XSomeList::TrackList(tracks) = &mut xdb.find_dataset(1).child {
let mut item = (*tracks.last().unwrap()).clone();
let mut xargs = Vec::new();
xargs.push(XArgument { arg_type: 1, val: String::from("They beat you") });
xargs.push(XArgument { arg_type: 3, val: String::from("IC3PEAK EP") });
xargs.push(XArgument { arg_type: 4, val: String::from("IC3PEAK") });
xargs.push(XArgument { arg_type: 6, val: String::from("MPEG audio file")});
xargs.push(XArgument { arg_type: 2, val: String::from(":iPod_Control:Music:F38:ZJUQ.mp3") });
item.args = xargs;
item.data.number_of_strings = 5;
item.data.unique_id = 99;
tracks.push(item);
}
let mut op = File::create("outdb").unwrap();
info!("Write res: {:?}", op.write(&serializer::to_bytes(xdb)));
},

View File

@ -50,7 +50,7 @@ impl From<ChunkType> for [u8; 4] {
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
pub struct ChunkHeader {
pub chunk_type: [u8; 4],
pub end_of_chunk: u32,
@ -72,7 +72,7 @@ pub struct Database {
unk2: [u8; 20]
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
pub struct DataSet {
pub data_type: u32
}
@ -86,10 +86,10 @@ pub struct AlbumItem {
unknown1: u32
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
pub struct TrackItem {
number_of_strings: u32, // number of mhod's count
unique_id: u32,
pub number_of_strings: u32, // number of mhod's count
pub unique_id: u32,
visible: u32,
filetype: u32,
type1: u8,

View File

@ -15,7 +15,7 @@ pub struct XDataSet {
pub child: XSomeList
}
#[derive(Debug, serde::Serialize)]
#[derive(Debug, serde::Serialize, Clone)]
pub struct XTrackItem {
pub header: ChunkHeader,
pub data: TrackItem,
@ -57,7 +57,7 @@ pub struct XLetterJump {
pub v: Vec<JumpTable>
}
#[derive(Debug, serde::Serialize)]
#[derive(Debug, serde::Serialize, Clone)]
pub struct XArgument {
pub arg_type: u32,
pub val: String