successful attempt to decode sgd. Realized, that I need to implement some stream reading
This commit is contained in:
parent
889e2060b3
commit
b43efe1abd
2 changed files with 33 additions and 9 deletions
|
|
@ -33,8 +33,8 @@ next zar = <zar> + 0x1A + unk5
|
||||||
uint8_t unk1[0x48]
|
uint8_t unk1[0x48]
|
||||||
uint32_t N - num strings
|
uint32_t N - num strings
|
||||||
FString[N]
|
FString[N]
|
||||||
|
uint32_t ?
|
||||||
N times
|
N times
|
||||||
uint32_t ?
|
|
||||||
uint32_t M - num strings
|
uint32_t M - num strings
|
||||||
FString[M]
|
FString[M]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,39 @@ impl World {
|
||||||
const WORLD_HDR_LEN: usize = 0x13;
|
const WORLD_HDR_LEN: usize = 0x13;
|
||||||
|
|
||||||
pub fn test(&self) -> Result<()> {
|
pub fn test(&self) -> Result<()> {
|
||||||
let mut a = FString::decode(&self.data, 0xA2, 0)?;
|
let sgd_start: usize = 0x4E;
|
||||||
dbg!(&a);
|
let mut cur = sgd_start;
|
||||||
|
cur += Tag::decode(&self.data, sgd_start, 0)?.get_enc_size();
|
||||||
|
cur += 0x48;
|
||||||
|
|
||||||
|
let mut rdr = Cursor::new(&self.data.mem[..]);
|
||||||
|
rdr.set_position(cur as u64);
|
||||||
|
let N = rdr.read_u32::<LittleEndian>()?;
|
||||||
|
|
||||||
|
let mut names: Vec<FString> = Vec::new();
|
||||||
|
cur += 4;
|
||||||
|
for _ in 0..N {
|
||||||
|
let name = FString::decode(&self.data, cur, 0)?;
|
||||||
|
cur += name.get_enc_size();
|
||||||
|
names.push(name);
|
||||||
|
}
|
||||||
|
//dbg!(names);
|
||||||
|
|
||||||
a.encoding = FStringEncoding::ANSI;
|
let unk1 = rdr.read_u32::<LittleEndian>()?;
|
||||||
let b = a.encode()?;
|
cur += 4;
|
||||||
dbg!(&b);
|
for _ in 0..N {
|
||||||
|
rdr.set_position(cur as u64);
|
||||||
let c = FString::decode(&b, 0, 0)?;
|
let M = rdr.read_u32::<LittleEndian>()?;
|
||||||
dbg!(&c);
|
cur += 4;
|
||||||
|
dbg!(M, cur);
|
||||||
|
let mut strings: Vec<FString> = Vec::new();
|
||||||
|
for _ in 0..M {
|
||||||
|
let str = FString::decode(&self.data, cur, 0)?;
|
||||||
|
cur += str.get_enc_size();
|
||||||
|
strings.push(str);
|
||||||
|
}
|
||||||
|
dbg!(strings);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue