A native webfishing installer for macos

V1.1.0 : Fixes option_menu_patch

+14 -6
+13 -5
src/patches/options_menu_patch.rs
··· 14 14 script.read_to_string(&mut script_txt).await.expect("Cannot read script"); 15 15 drop(script); 16 16 17 - let patched_script = script_txt.replace("OS.window_borderless = PlayerData.player_options.fullscreen == 1", "\n"); 17 + let patched_script = script_txt.replace("OS.window_borderless = PlayerData.player_options.fullscreen == 1", "OS.window_borderless\n"); 18 18 let mut script = File::create(SCRIPT_PATH).await.expect("Cannot open script"); 19 19 script.write_all(patched_script.as_bytes()).await.expect("Cannot write"); 20 20 drop(script); ··· 30 30 let mut compiled_pck = File::open(GAME_PCK).await.expect("Cannot open pck"); 31 31 compiled_pck.read_to_end(&mut compiled_pck_bytes).await.expect("Cannot read"); 32 32 drop(compiled_pck); 33 + let mut compiled_pck_bytes: Vec<u8> = compiled_pck_bytes.into_iter().rev().skip_while(|b| (*b) == 0).collect::<Vec<u8>>().into_iter().rev().collect(); 33 34 34 - for _ in 0..16 - (compiled_script_bytes.len() % 16) { 35 - compiled_script_bytes.push(0); 35 + if compiled_script_bytes.len() % 16 > 0 { 36 + let to_add = 16 - (compiled_script_bytes.len() % 16); 37 + for _ in 0..to_add { 38 + compiled_script_bytes.push(0); 39 + } 36 40 } 37 41 38 42 let mut tsc_bytes = Vec::new(); ··· 41 45 drop(tsc); 42 46 43 47 compiled_script_bytes.append(&mut tsc_bytes); 44 - for _ in 0..16 - (compiled_script_bytes.len() % 16) { 45 - compiled_script_bytes.push(0); 48 + let mut compiled_pck_bytes: Vec<u8> = compiled_pck_bytes.into_iter().rev().skip_while(|b| (*b) == 0).collect::<Vec<u8>>().into_iter().rev().collect(); 49 + if compiled_script_bytes.len() % 16 > 0 { 50 + let to_add = 16 - (compiled_script_bytes.len() % 16); 51 + for _ in 0..to_add { 52 + compiled_script_bytes.push(0); 53 + } 46 54 } 47 55 48 56 replace_slice(&mut compiled_pck_bytes,
+1 -1
src/utils/gd_utils.rs
··· 7 7 where 8 8 T: Clone + PartialEq + From<u8>, 9 9 { 10 - for i in 0..=buf.len() - replace_with.len() { 10 + for mut i in 0..=buf.len() - replace_with.len() { 11 11 if buf[i..].starts_with(from) { 12 12 for j in (i + 1)..=buf.len() { 13 13 if buf[j..].starts_with(to) {