trumank / repak

Unreal Engine .pak file library and CLI in rust
Apache License 2.0
174 stars 25 forks source link

Oodle stuff #14

Closed bananaturtlesandwich closed 8 months ago

bananaturtlesandwich commented 11 months ago
bananaturtlesandwich commented 11 months ago

not sure if it should be kept as a feature since there's no dependencies it needs

trumank commented 11 months ago

I now remember why I was hesitant to implement this. The simple implementation creates a messy API and means oodle must always be loaded up front whether it's actually used or not. I think these could be alleviated by using the builder pattern and instead of passing a function pointer directly, pass a function which can be called to fetch oodle only when necessary:

fn get_oodle() -> Result<DECOMPRESS> {
    // lazily fetch the decompress function when necessary
}

let pak_reader = PakReaderBuilder::new(reader)
    .oodle(get_oodle)
    .build()?;

I think this may also work really nicely for entering AES keys.

Also I'm hesitant to remove the DLL download from the library entirely. I'll probably have to copy the implementation to a few different projects so may as well leave a central implementation in case anyone wants to use it.

bananaturtlesandwich commented 11 months ago

ooh that's a really nice point about the builder pattern - with encryption disabled the .aes() can be missed as for the second point i think that would be better as a separate package on this repo

bananaturtlesandwich commented 11 months ago

this sounds like it just needs a fresh branch so gonna close this PR

bananaturtlesandwich commented 11 months ago

oh wait nvm it's salvageable lol

bananaturtlesandwich commented 11 months ago

might be better to have a oodle init function rather than pass in builder since it only needs to be called once

bananaturtlesandwich commented 11 months ago

this should be good now

bananaturtlesandwich commented 11 months ago

wait need to fix tests

bananaturtlesandwich commented 11 months ago

fixed now