···14 script.read_to_string(&mut script_txt).await.expect("Cannot read script");
15 drop(script);
1617- let patched_script = script_txt.replace("OS.window_borderless = PlayerData.player_options.fullscreen == 1", "\n");
18 let mut script = File::create(SCRIPT_PATH).await.expect("Cannot open script");
19 script.write_all(patched_script.as_bytes()).await.expect("Cannot write");
20 drop(script);
···30 let mut compiled_pck = File::open(GAME_PCK).await.expect("Cannot open pck");
31 compiled_pck.read_to_end(&mut compiled_pck_bytes).await.expect("Cannot read");
32 drop(compiled_pck);
03334- for _ in 0..16 - (compiled_script_bytes.len() % 16) {
35- compiled_script_bytes.push(0);
00036 }
3738 let mut tsc_bytes = Vec::new();
···41 drop(tsc);
4243 compiled_script_bytes.append(&mut tsc_bytes);
44- for _ in 0..16 - (compiled_script_bytes.len() % 16) {
45- compiled_script_bytes.push(0);
000046 }
4748 replace_slice(&mut compiled_pck_bytes,
···14 script.read_to_string(&mut script_txt).await.expect("Cannot read script");
15 drop(script);
1617+ let patched_script = script_txt.replace("OS.window_borderless = PlayerData.player_options.fullscreen == 1", "OS.window_borderless\n");
18 let mut script = File::create(SCRIPT_PATH).await.expect("Cannot open script");
19 script.write_all(patched_script.as_bytes()).await.expect("Cannot write");
20 drop(script);
···30 let mut compiled_pck = File::open(GAME_PCK).await.expect("Cannot open pck");
31 compiled_pck.read_to_end(&mut compiled_pck_bytes).await.expect("Cannot read");
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();
3435+ 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+ }
40 }
4142 let mut tsc_bytes = Vec::new();
···45 drop(tsc);
4647 compiled_script_bytes.append(&mut tsc_bytes);
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+ }
54 }
5556 replace_slice(&mut compiled_pck_bytes,
+1-1
src/utils/gd_utils.rs
···7where
8 T: Clone + PartialEq + From<u8>,
9{
10- for i in 0..=buf.len() - replace_with.len() {
11 if buf[i..].starts_with(from) {
12 for j in (i + 1)..=buf.len() {
13 if buf[j..].starts_with(to) {
···7where
8 T: Clone + PartialEq + From<u8>,
9{
10+ for mut i in 0..=buf.len() - replace_with.len() {
11 if buf[i..].starts_with(from) {
12 for j in (i + 1)..=buf.len() {
13 if buf[j..].starts_with(to) {