1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-06-06 22:57:45 +00:00

Support WebAssembly

This commit is contained in:
Joshua Goins 2024-11-01 16:50:37 -04:00
parent 6e6124a278
commit f83b2013fa
4 changed files with 6 additions and 6 deletions

View file

@ -60,7 +60,7 @@ binrw = { version = "0.14", features = ["std"], default-features = false }
tracing = { version = "0.1", features = ["std"], default-features = false }
# 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
modular-bitfield = "0.11"

View file

@ -3,6 +3,6 @@
fn main() {
// 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();
}

View file

@ -3,7 +3,7 @@
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
mod flate2_zallocation {

View file

@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// 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};
/// CRC used for filepath hashes in index file
@ -45,11 +45,11 @@ impl Jamcrc {
}
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 {
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