|
|
@ -3,17 +3,13 @@ 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;
|
|
|
|
use quick_xml::{Reader, events::Event};
|
|
|
|
|
|
|
|
|
|
|
|
struct User {
|
|
|
|
struct User {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
|
id: Option<u64>,
|
|
|
|
id: Option<u64>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct InnerLevel; // TODO: write this
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type Difficulty = u8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum Song {
|
|
|
|
enum Song {
|
|
|
|
Official{id: i32 /*k8*/},
|
|
|
|
Official{id: i32 /*k8*/},
|
|
|
|
Newgrounds{id: i32 /*k45*/},
|
|
|
|
Newgrounds{id: i32 /*k45*/},
|
|
|
@ -24,6 +20,11 @@ struct Level {
|
|
|
|
song: Song,
|
|
|
|
song: Song,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct OuterLevel {
|
|
|
|
|
|
|
|
name: String, // k2
|
|
|
|
|
|
|
|
inner: String, // k4
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn gd_path() -> PathBuf {
|
|
|
|
pub fn gd_path() -> PathBuf {
|
|
|
|
let mut path_buf = home::home_dir().unwrap();
|
|
|
|
let mut path_buf = home::home_dir().unwrap();
|
|
|
|
#[cfg(unix)]
|
|
|
|
#[cfg(unix)]
|
|
|
@ -36,7 +37,7 @@ pub fn gd_path() -> PathBuf {
|
|
|
|
path_buf
|
|
|
|
path_buf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn load_levels() -> Vec<Level> {
|
|
|
|
fn load_levels() -> Vec<OuterLevel> {
|
|
|
|
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!");
|
|
|
|
let mut sd = Vec::new();
|
|
|
|
let mut sd = Vec::new();
|
|
|
@ -53,9 +54,13 @@ fn load_levels() -> Vec<Level> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
plist
|
|
|
|
plist
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let reader = Reader::from_str(plist.as_ref());
|
|
|
|
let mut reader = Reader::from_str(plist.as_ref());
|
|
|
|
let mut out = vec![];
|
|
|
|
let mut out = vec![];
|
|
|
|
loop {
|
|
|
|
loop {
|
|
|
|
|
|
|
|
let token = reader.read_event().unwrap();
|
|
|
|
|
|
|
|
match token {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
break out;
|
|
|
|
break out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|