This commit is contained in:
2025-04-25 21:50:29 -07:00
parent 941b7a1f07
commit 893f7917ef
4 changed files with 67 additions and 7 deletions

Binary file not shown.

View File

@ -164,12 +164,29 @@ unsafe fn write_imports(
prelude.write(&[0xc9, 0xc3]);
}
unsafe fn write_starting_state(binary: *mut u8, reader: &mut Reader) {
unsafe fn write_starting_state(mut out: *mut u8, reader: &mut Reader) {
let length = reader.read::<u32>() as usize;
let ptr = reader.ptr;
println!("length: {:?}", length);
binary.copy_from(ptr, length);
let end = out.byte_add(length);
while out < end {
let code = reader.read::<u8>();
if code > 0 {
// RLE: repeat
let byte = reader.read::<u8>();
for i in 0..code {
*out = byte;
out = out.byte_add(1);
}
} else {
// N literal bytes
let count = reader.read::<u8>();
for _ in 0..count {
let byte = reader.read::<u8>();
*out = byte;
out = out.byte_add(1);
}
}
}
}
unsafe fn _main_remote() {