compress platform module

This commit is contained in:
2021-11-21 23:38:01 +01:00
parent f6d0bdfa8f
commit 88bc4fe364
10 changed files with 67 additions and 24 deletions

View File

@@ -10,6 +10,8 @@ export fn load_uw8(module_size: i32) -> i32 {
let module_end = 0x1e000 + module_size;
if version & 1 {
module_size?0 = 0;
module_size?1 = 0;
module_end = uncompress(1, 0x1e001);
} else {
copy(0x1e000, 0, module_size);

View File

@@ -1,16 +1,25 @@
use std::{fs::File, path::Path};
use std::io::prelude::*;
use std::{fs::File, path::Path};
use anyhow::Result;
fn main() -> Result<()> {
println!("Generating compressed base module");
uw8_tool::BaseModule::create_binary(&Path::new("target/base.upk"))?;
println!("Compiling loader module");
let loader = curlywas::compile_file("src/loader.cwa")?;
File::create("bin/loader.wasm")?.write_all(&loader)?;
println!("Compiling platform module");
let platform = curlywas::compile_file("src/platform.cwa")?;
println!("Compressing platform module");
let platform = uw8_tool::pack(
&platform,
uw8_tool::PackConfig::default().with_compression(),
)?;
File::create("bin/platform.uw8")?.write_all(&platform)?;
println!("All done!");
Ok(())
}