mirror of
https://github.com/redstrate/Physis.git
synced 2025-06-07 23:27:45 +00:00
Support WebAssembly
This commit is contained in:
parent
6e6124a278
commit
f83b2013fa
4 changed files with 6 additions and 6 deletions
|
@ -60,7 +60,7 @@ binrw = { version = "0.14", features = ["std"], default-features = false }
|
||||||
tracing = { version = "0.1", features = ["std"], default-features = false }
|
tracing = { version = "0.1", features = ["std"], default-features = false }
|
||||||
|
|
||||||
# used for zlib compression in sqpack files
|
# used for zlib compression in sqpack files
|
||||||
libz-ng-sys = { version = "1.1" }
|
libz-sys = { version = "1.1" }
|
||||||
|
|
||||||
# nice to have features rust is lacking at the moment
|
# nice to have features rust is lacking at the moment
|
||||||
modular-bitfield = "0.11"
|
modular-bitfield = "0.11"
|
||||||
|
|
2
build.rs
2
build.rs
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Windows doesn't ship pkgconfig files, typically. At least in our build system.
|
// Windows doesn't ship pkgconfig files, typically. At least in our build system.
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(all(not(target_os = "windows"), not(target_family = "wasm")))]
|
||||||
system_deps::Config::new().probe().unwrap();
|
system_deps::Config::new().probe().unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use std::ptr::null_mut;
|
use std::ptr::null_mut;
|
||||||
|
|
||||||
use libz_ng_sys::*;
|
use libz_sys::*;
|
||||||
|
|
||||||
// This module's functions are licensed under MIT from https://github.com/rust-lang/flate2-rs
|
// This module's functions are licensed under MIT from https://github.com/rust-lang/flate2-rs
|
||||||
mod flate2_zallocation {
|
mod flate2_zallocation {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
use libz_ng_sys::z_off_t;
|
use libz_sys::z_off_t;
|
||||||
use std::ops::{Add, AddAssign, BitXor, BitXorAssign};
|
use std::ops::{Add, AddAssign, BitXor, BitXorAssign};
|
||||||
|
|
||||||
/// CRC used for filepath hashes in index file
|
/// CRC used for filepath hashes in index file
|
||||||
|
@ -45,11 +45,11 @@ impl Jamcrc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crc32(crc: u32, s: &[u8]) -> u32 {
|
fn crc32(crc: u32, s: &[u8]) -> u32 {
|
||||||
unsafe { libz_ng_sys::crc32(crc, s.as_ptr(), s.len() as u32) as u32 }
|
unsafe { libz_sys::crc32(crc.into(), s.as_ptr(), s.len() as u32) as u32 }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crc32_combine(crc1: u32, crc2: u32, len2: usize) -> u32 {
|
fn crc32_combine(crc1: u32, crc2: u32, len2: usize) -> u32 {
|
||||||
unsafe { libz_ng_sys::crc32_combine(crc1, crc2, len2 as z_off_t) as u32 }
|
unsafe { libz_sys::crc32_combine(crc1.into(), crc2.into(), len2 as z_off_t) as u32 }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CRC used for shader keys
|
/// CRC used for shader keys
|
||||||
|
|
Loading…
Add table
Reference in a new issue