0.1.24 upd
This commit is contained in:
parent
18c077439c
commit
00b74def41
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "itunesdb"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
edition = "2021"
|
||||
authors = ["alterwain"]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
pub mod deserializer {
|
||||
use log::info;
|
||||
use crate::artworkdb::aobjects::{ADataSet, ADatabase, AImageArg, AImageItem, ASomeList};
|
||||
use crate::artworkdb::aobjects::{ADataSet, ADatabase, AImageArg, AImageItem, AImageName, ASomeList};
|
||||
use crate::artworkdb::objects::{ChunkHeader, ChunkType, DataSet, Database, ImageItem, ImageName, LocationTag};
|
||||
|
||||
enum ChunkState {
|
||||
@ -56,8 +56,34 @@ pub mod deserializer {
|
||||
ChunkType::LocationTag => {
|
||||
u = usize::try_from(header.end_of_chunk).unwrap() - 12;
|
||||
let ds: LocationTag = bincode::deserialize(&data[i..i + u]).unwrap();
|
||||
if let ASomeList::Images(images) = &mut adb.find_dataset(1).child {
|
||||
images.last_mut().unwrap().args.push(AImageArg::Location(ds));
|
||||
if ds.tag_type == 3 {
|
||||
if let ASomeList::Images(images) = &mut adb.find_dataset(1).child {
|
||||
if let AImageArg::Name(name) = images.last_mut().unwrap().args.iter_mut().filter(|t| {
|
||||
if let AImageArg::Name(name) = t {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
.last()
|
||||
.unwrap() {
|
||||
|
||||
let mut bytes = Vec::new();
|
||||
let str_end = u32::from_le_bytes(data[i+8..i+12].try_into().unwrap()) as usize;
|
||||
let mut h = i+20;
|
||||
while h < i+str_end {
|
||||
bytes.push(u16::from_le_bytes(data[h..h+2].try_into().unwrap()));
|
||||
h+=2;
|
||||
}
|
||||
let g = String::from_utf16(&bytes).unwrap();
|
||||
info!("str: {}", g);
|
||||
|
||||
name.args.push((ds, String::new()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if let ASomeList::Images(images) = &mut adb.find_dataset(1).child {
|
||||
images.last_mut().unwrap().args.push(AImageArg::Location(ds));
|
||||
}
|
||||
}
|
||||
},
|
||||
ChunkType::ImageName => {
|
||||
@ -65,7 +91,7 @@ pub mod deserializer {
|
||||
u = usize::try_from(header.end_of_chunk).unwrap() - 12;
|
||||
let ds: ImageName = bincode::deserialize(&data[i..i + u]).unwrap();
|
||||
if let ASomeList::Images(images) = &mut adb.find_dataset(1).child {
|
||||
images.last_mut().unwrap().args.push(AImageArg::Name(ds));
|
||||
images.last_mut().unwrap().args.push(AImageArg::Name(AImageName{ data: ds, args: Vec::new() }));
|
||||
}
|
||||
},
|
||||
_ => { u = 1; info!("Unknown stuff happened"); }
|
||||
@ -118,8 +144,14 @@ pub mod aobjects {
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub enum AImageArg {
|
||||
Name(ImageName),
|
||||
Location(LocationTag)
|
||||
Name(AImageName),
|
||||
Location(LocationTag),
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct AImageName {
|
||||
pub data: ImageName,
|
||||
pub args: Vec<(LocationTag, String)>
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +225,7 @@ pub mod objects {
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
|
||||
pub struct LocationTag {
|
||||
tag_type: u32,
|
||||
pub tag_type: u32,
|
||||
unk1: u32,
|
||||
unk2: u32,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user