commented out some test stuff, fixed a strange bug where there were null bytes in the ^11'd string

main
aprzn 2 years ago
parent e86a1dffbb
commit b7829be9b0

@ -96,7 +96,7 @@ fn get_local_level_plist() -> Value {
save_file.read_to_end(&mut sd).unwrap();
sd
};
let data_post_xor: Vec<u8> = raw_save_data.iter().map(|b| b ^ 11).collect();
let data_post_xor: Vec<u8> = raw_save_data.iter().map(|b| b ^ 11).filter(|&b| b != 0u8).collect();
let data_post_b64 = URL_SAFE.decode(data_post_xor).unwrap();
let mut decoder = GzDecoder::<&[u8]>::new(data_post_b64.as_ref());
let mut plist = String::new();

@ -30,33 +30,24 @@ use gd::gd_path;
struct Guider {
sink: Sink,
}
#[derive(Debug, Clone, Copy)]
enum Message {
Play,
Pause,
Msg,
}
impl Sandbox for Guider {
type Message = Message;
fn new() -> Self {
let gd_path = gd_path();
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
let sink = Sink::try_new(&stream_handle).unwrap();
let music_file = BufReader::new(File::open(gd_path.join("613929.mp3")).unwrap());
let source = Decoder::new(music_file).unwrap();
//sink.append(source);
//sink.pause();
Self {sink}
Self {}
}
fn view(&self) -> Element<Message> {
// column![button("pause").on_press(Message::Pause), button("play").on_press(Message::Play)].into()
row![
scrollable(["lvl 1", "lvl 2", "lvl 3"].iter().fold(
Column::new(), |col, item| col.push(button(*item).on_press(Message::Pause))
Column::new(), |col, item| col.push(button(*item).on_press(Message::Msg))
)),
column![
row![
@ -75,8 +66,7 @@ impl Sandbox for Guider {
fn update(&mut self, message: Message) {
match message {
Message::Pause => self.sink.pause(),
Message::Play => self.sink.play(),
Message::Msg => {println!("Message received!")}
}
}

Loading…
Cancel
Save