main
aprzn 2 years ago
parent ab9fe11b61
commit ebae56ea31

89
Cargo.lock generated

@ -114,6 +114,12 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270"
[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.21.0" version = "0.21.0"
@ -897,6 +903,19 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "gd_plist"
version = "1.4.1"
source = "git+https://github.com/Syudagye/gd-plist.git#577da4c07496e72cd897db4bab7f45b601b0a45d"
dependencies = [
"base64 0.13.1",
"indexmap",
"line-wrap",
"quick-xml",
"serde",
"time",
]
[[package]] [[package]]
name = "gethostname" name = "gethostname"
version = "0.2.3" version = "0.2.3"
@ -1020,18 +1039,6 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "guider"
version = "0.1.0"
dependencies = [
"base64",
"flate2",
"home",
"iced",
"quick-xml",
"rodio",
]
[[package]] [[package]]
name = "guillotiere" name = "guillotiere"
version = "0.6.2" version = "0.6.2"
@ -1320,6 +1327,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "line-wrap"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
dependencies = [
"safemem",
]
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
version = "0.5.6" version = "0.5.6"
@ -1902,6 +1918,18 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pipedash"
version = "0.1.0"
dependencies = [
"base64 0.21.0",
"flate2",
"gd_plist",
"home",
"iced",
"rodio",
]
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.26" version = "0.3.26"
@ -1954,9 +1982,9 @@ checksum = "74605f360ce573babfe43964cbe520294dcb081afbf8c108fc6e23036b4da2df"
[[package]] [[package]]
name = "quick-xml" name = "quick-xml"
version = "0.27.1" version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc053f057dd768a56f62cd7e434c42c831d296968997e9ac1f76ea7c2d14c41" checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -2129,6 +2157,12 @@ dependencies = [
"bytemuck", "bytemuck",
] ]
[[package]]
name = "safemem"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
[[package]] [[package]]
name = "same-file" name = "same-file"
version = "1.0.6" version = "1.0.6"
@ -2440,6 +2474,33 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "time"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
dependencies = [
"itoa",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]]
name = "time-macros"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"
dependencies = [
"time-core",
]
[[package]] [[package]]
name = "tiny-skia" name = "tiny-skia"
version = "0.7.0" version = "0.7.0"

@ -11,4 +11,4 @@ rodio = {version = "0.16.0"}
home = {version = "0.5.4"} home = {version = "0.5.4"}
base64 = {version = "0.21.0"} base64 = {version = "0.21.0"}
flate2 = {version = "1.0.25"} flate2 = {version = "1.0.25"}
quick-xml = {version = "0.27.1"} gd_plist = {git = "https://github.com/Syudagye/gd-plist.git", version = "1.4.0"}

@ -3,7 +3,6 @@ use std::fs::File;
use std::io::Read; use std::io::Read;
use base64::engine::{general_purpose::URL_SAFE, Engine}; use base64::engine::{general_purpose::URL_SAFE, Engine};
use flate2::read::GzDecoder; use flate2::read::GzDecoder;
use quick_xml::{Reader, events::Event};
struct User { struct User {
name: String, name: String,
@ -88,6 +87,40 @@ impl LevelBuilder {
} }
} }
fn verbosify_plist(plist: &str) -> String {
plist
.replace("</d>","</dict>")
.replace("</k>","</key>")
.replace("<d>","<dict>")
.replace("<d />","<dict />")
.replace("<d/>","<dict />")
.replace("<k>","<key>")
.replace("<s>","<string>")
.replace("</s>","</string>")
.replace("<i>","<integer>")
.replace("</i>","</integer>")
.replace("<t />","<true />")
.replace("<t/>","<true />")
.replace("<r>","<real>")
.replace("</r>","</real>")
}
fn concisify_plist(plist: &str) -> String {
plist
.replace("</dict>","</d>")
.replace("</key>","</k>")
.replace("<dict>","<d>")
.replace("<dict />","<d/>")
.replace("<key>","<k>")
.replace("<string>","<s>")
.replace("</string>","</s>")
.replace("<integer>","<i>")
.replace("</integer>","</i>")
.replace("<true />","<t/>")
.replace("<real>","<r>")
.replace("</real>","</r>")
}
fn get_local_level_plist() -> String { fn get_local_level_plist() -> String {
let raw_save_data = { let raw_save_data = {
let mut save_file = File::open(gd_path().join("CCLocalLevels.dat")).expect("No save file found!"); let mut save_file = File::open(gd_path().join("CCLocalLevels.dat")).expect("No save file found!");
@ -102,19 +135,9 @@ fn get_local_level_plist() -> String {
if let Err(_) = decoder.read_to_string(&mut plist) { if let Err(_) = decoder.read_to_string(&mut plist) {
println!("Warning: Game save likely corrupted (gzip decode failed)"); println!("Warning: Game save likely corrupted (gzip decode failed)");
} }
plist verbosify_plist(&plist)
} }
fn get_outer_levels() -> Vec<Level> { fn get_outer_levels() -> Vec<Level> {
let plist = get_local_level_plist(); let plist = get_local_level_plist();
let mut reader = Reader::from_str(plist.as_ref());
let mut out = vec![];
let builder = LevelBuilder::default();
loop {
let token = reader.read_event().unwrap();
match token {
_ => {}
}
break out;
}
} }

Loading…
Cancel
Save