mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 11:16:42 +01:00
compress platform module
This commit is contained in:
2
platform/Cargo.lock
generated
2
platform/Cargo.lock
generated
@@ -94,7 +94,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||
[[package]]
|
||||
name = "curlywas"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/exoticorn/curlywas.git?rev=788a565#788a5657b535448f0532b1481fbfe9a77ee3b5e1"
|
||||
source = "git+https://github.com/exoticorn/curlywas.git?rev=c0140d0#c0140d0671e81b57e8fd142c66c675a659fd50f8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ariadne",
|
||||
|
||||
@@ -6,6 +6,6 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
curlywas = { git="https://github.com/exoticorn/curlywas.git", rev="788a565" }
|
||||
curlywas = { git="https://github.com/exoticorn/curlywas.git", rev="c0140d0" }
|
||||
uw8-tool = { path="../uw8-tool" }
|
||||
anyhow = "1"
|
||||
Binary file not shown.
Binary file not shown.
@@ -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);
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user