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(); save_file.read_to_end(&mut sd).unwrap();
sd 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 data_post_b64 = URL_SAFE.decode(data_post_xor).unwrap();
let mut decoder = GzDecoder::<&[u8]>::new(data_post_b64.as_ref()); let mut decoder = GzDecoder::<&[u8]>::new(data_post_b64.as_ref());
let mut plist = String::new(); let mut plist = String::new();

@ -30,33 +30,24 @@ use gd::gd_path;
struct Guider { struct Guider {
sink: Sink,
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
enum Message { enum Message {
Play, Msg,
Pause,
} }
impl Sandbox for Guider { impl Sandbox for Guider {
type Message = Message; type Message = Message;
fn new() -> Self { fn new() -> Self {
let gd_path = gd_path(); Self {}
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}
} }
fn view(&self) -> Element<Message> { fn view(&self) -> Element<Message> {
// column![button("pause").on_press(Message::Pause), button("play").on_press(Message::Play)].into() // column![button("pause").on_press(Message::Pause), button("play").on_press(Message::Play)].into()
row![ row![
scrollable(["lvl 1", "lvl 2", "lvl 3"].iter().fold( 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![ column![
row![ row![
@ -75,8 +66,7 @@ impl Sandbox for Guider {
fn update(&mut self, message: Message) { fn update(&mut self, message: Message) {
match message { match message {
Message::Pause => self.sink.pause(), Message::Msg => {println!("Message received!")}
Message::Play => self.sink.play(),
} }
} }

Loading…
Cancel
Save