add reverse-engineering notes
This commit is contained in:
parent
8787394a26
commit
22ccc2fa26
3 changed files with 30 additions and 39 deletions
30
format.txt
Normal file
30
format.txt
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
string format - uint32_t len, 31 bit represents encoding where 0 is UTF-7 (ASCII), and 1 is UTF-16 (WCS-2)
|
||||
|
||||
tag format ?
|
||||
<TAG>\0version\0
|
||||
|
||||
/*<zar>
|
||||
uint32_t unk1
|
||||
uint32_t unk2
|
||||
uint8_t unk3 ?
|
||||
uint32_t unk4
|
||||
0x46C - <zar> + 0x15 + (unk4 << 2) - B2 00
|
||||
0x46D - unk5
|
||||
|
||||
next zar = <zar> + 0x1A + unk5
|
||||
0xBC22 + (0x100<<2) = unk5 0x7659*/
|
||||
|
||||
<saveh>
|
||||
+0x0A - int16_t ?
|
||||
+0x0B - 4 strings.
|
||||
1. uknown
|
||||
2. name
|
||||
3. location
|
||||
4. date
|
||||
|
||||
<campaign_save>
|
||||
uint32_t unk1 - used in calloc, unk1 * 0x10C
|
||||
|
||||
<world>
|
||||
uint32_t uncompressed_size;
|
||||
uint32_t uncompressed_size;
|
||||
|
|
@ -5,9 +5,6 @@ use std::fs::OpenOptions;
|
|||
use std::path::Path;
|
||||
use anyhow::Result;
|
||||
|
||||
// I can use traits to dynamically implement encode/decode for every header
|
||||
// or I can just pass Vec<Block> with already encoded data to patch file
|
||||
|
||||
pub struct Raw {
|
||||
pub offset: usize,
|
||||
pub size: usize,
|
||||
|
|
|
|||
|
|
@ -79,42 +79,6 @@ impl Save {
|
|||
}
|
||||
|
||||
pub fn save(&self, path: &Path) -> Result<()> {
|
||||
let mut file = OpenOptions::new()
|
||||
.create(true).truncate(true).write(true).open(path)?;
|
||||
|
||||
// write unknown block
|
||||
/*let unk_size = match self.worlds.first() {
|
||||
Some(w) => w.offset - 1,
|
||||
None => return Err(anyhow!("no offsets found"))
|
||||
};
|
||||
file.write(&self.raw[..unk_size])?;
|
||||
|
||||
for world in self.worlds.iter() {
|
||||
file.write(&self.raw[world.offset..world.offset+0x12])?;
|
||||
file.write(&world.encode())?;
|
||||
}*/
|
||||
|
||||
// determine world block size be next campaign
|
||||
/*const START: usize = 0x99A84;
|
||||
const END: usize = 0xD1B1E; //0xD1B1E;
|
||||
const SIZE: usize = 0x38088;
|
||||
//let world = self.worlds.last().unwrap();
|
||||
let world = World::decode(&self.raw, START, END - START)?;
|
||||
file.write(&self.raw[..START])?;
|
||||
|
||||
file.write(&self.raw[world.offset..world.offset+0x13])?;
|
||||
{
|
||||
let enc = world.encode();
|
||||
let real_len = SIZE;
|
||||
println!("enc len {} real_len {}", enc.len(), real_len);
|
||||
file.write(&enc)?;
|
||||
if (enc.len() < real_len) {
|
||||
file.write(&vec![0; real_len - enc.len()])?;
|
||||
}
|
||||
}
|
||||
|
||||
file.write(&self.raw[END+1..])?;*/
|
||||
|
||||
let raw = Raw { offset: 0, size: self.raw.len(), mem: self.raw.clone() };
|
||||
|
||||
const START: usize = 0x99A84;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue