-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swap compile time tokens to embedded runtime decoding
Greatly helps with compile times.
- Loading branch information
1 parent
54d91da
commit ada4895
Showing
11 changed files
with
65 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../tokens/tokens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
fn main() { | ||
std::fs::create_dir_all("assets/tokens").expect("to create tokens directory"); | ||
for game in ["ck3", "hoi4", "eu4", "imperator", "vic3"] { | ||
let fp = format!("assets/tokens/{game}.txt"); | ||
let p = std::path::Path::new(&fp); | ||
if !p.exists() { | ||
std::fs::write(p, "").expect("to write file"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
mod cli; | ||
mod json; | ||
mod melt; | ||
mod tokens; | ||
|
||
fn main() { | ||
std::process::exit(match cli::run() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
pub fn eu4_tokens_resolver() -> eu4save::BasicTokenResolver { | ||
let data = include_bytes!("../assets/tokens/eu4.txt"); | ||
eu4save::BasicTokenResolver::from_text_lines(&data[..]).expect("embedded tokens invalid format") | ||
} | ||
|
||
pub fn ck3_tokens_resolver() -> ck3save::BasicTokenResolver { | ||
let data = include_bytes!("../assets/tokens/ck3.txt"); | ||
ck3save::BasicTokenResolver::from_text_lines(&data[..]).expect("embedded tokens invalid format") | ||
} | ||
|
||
pub fn vic3_tokens_resolver() -> vic3save::BasicTokenResolver { | ||
let data = include_bytes!("../assets/tokens/vic3.txt"); | ||
vic3save::BasicTokenResolver::from_text_lines(&data[..]).expect("embedded tokens invalid format") | ||
} | ||
|
||
pub fn imperator_tokens_resolver() -> imperator_save::BasicTokenResolver { | ||
let data = include_bytes!("../assets/tokens/imperator.txt"); | ||
imperator_save::BasicTokenResolver::from_text_lines(&data[..]).expect("embedded tokens invalid format") | ||
} | ||
|
||
pub fn hoi4_tokens_resolver() -> hoi4save::BasicTokenResolver { | ||
let data = include_bytes!("../assets/tokens/hoi4.txt"); | ||
hoi4save::BasicTokenResolver::from_text_lines(&data[..]).expect("embedded tokens invalid format") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters