diff --git a/src/gd.rs b/src/gd.rs index e940a68..23c7ae6 100644 --- a/src/gd.rs +++ b/src/gd.rs @@ -96,7 +96,7 @@ fn get_local_level_plist() -> Value { save_file.read_to_end(&mut sd).unwrap(); sd }; - let data_post_xor: Vec = raw_save_data.iter().map(|b| b ^ 11).collect(); + let data_post_xor: Vec = 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(); diff --git a/src/main.rs b/src/main.rs index 24b3bf5..ca18df4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 { // 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!")} } }