Coder Social home page Coder Social logo

ck3save's Introduction

ci Version

CK3 Save

CK3 Save is a library to ergonomically work with Crusader Kings III (CK3) saves (ironman + regular).

use ck3save::{
    models::{Gamestate, HeaderBorrowed},
    Ck3File, Encoding, EnvTokens,
};

let data = std::fs::read("assets/saves/Jarl_Ivar_of_the_Isles_867_01_01.ck3")?;
let file = Ck3File::from_slice(&data)?;
assert_eq!(file.encoding(), Encoding::TextZip);

let meta = file.parse_metadata()?;
let header: HeaderBorrowed = meta.deserializer(&EnvTokens).deserialize()?;

let mut zip_sink = Vec::new();
let parsed_file = file.parse(&mut zip_sink)?;
let save: Gamestate = parsed_file.deserializer(&EnvTokens).deserialize()?;
assert_eq!(save.meta_data.version, String::from("1.0.2"));
assert_eq!(header.meta_data.version, String::from("1.0.2"));

Ironman

By default, ironman saves will not be decoded properly.

To enable support, one must supply an environment variable (CK3_IRONMAN_TOKENS) that points to a newline delimited text file of token descriptions. For instance:

0xffff my_test_token
0xeeee my_test_token2

In order to comply with legal restrictions, I cannot share the list of tokens. I am also restricted from divulging how the list of tokens can be derived.

ck3save's People

Contributors

nickbabcock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gooftroop clemux

ck3save's Issues

Unresolved import

Hi Nick,

I'm new to rust, but I don't know where else to turn to solve this issue I'm having. This isn't an issue with the code, I just don't know what I'm doing and can't dm you. With that said:

When I run rustc main.rs, I get this error:

error[E0432]: unresolved import ck3save
--> main.rs:3:5
|
3 | use ck3save::{Ck3Extractor, Encoding};
| ^^^^^^^ maybe a missing crate ck3save?

When I run cargo install --list I get this:

ck3save v0.2.10:
debug_save.exe
fmt.exe
melt.exe

This is probably something to do with my rust environment but I thought I'd ask, sorry for raising this as an issue.

Thanks. 

Zip file restriction is too small

I'm attempting to upload a 34493 KB ck3 file (zip file type) but the extraction is failing due to the file size limit. Can this limit be removed? Or at least made into an option?

Question on AliveData

Not being familiar with Jomni, is it possible to expand the AliveData model to include the remaining fields one would expect (i.e. traits)? Is this just done by adding to the model definition? If so I think I can attempt a PR to do so

[Question] Melting

Do you have an example of how to save the gamestate to a new file? I'm new to rust so reading the melter is only getting me so far

Update melted save id to contain new metadata length

The last 8 characters of the save id line is the metadata length. In the conversion from binary to text this length changes, so etiquette says that we should update the new metadata length as it has been reported that the CK3 menu uses this value to quickly parse the files for display and that incorrect values have the potential to cause the game to crash

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.