mirror of
https://github.com/xavo95/repak.git
synced 2025-02-22 07:53:45 +00:00
Silence oodle logging
This commit is contained in:
parent
cff54acadb
commit
aaa16b7800
1 changed files with 18 additions and 8 deletions
|
@ -90,6 +90,8 @@ mod oodle_lz {
|
||||||
|
|
||||||
pub type GetCompressedBufferSizeNeeded =
|
pub type GetCompressedBufferSizeNeeded =
|
||||||
unsafe extern "system" fn(compressor: Compressor, rawSize: usize) -> usize;
|
unsafe extern "system" fn(compressor: Compressor, rawSize: usize) -> usize;
|
||||||
|
|
||||||
|
pub type SetPrintf = unsafe extern "system" fn(printf: *const ());
|
||||||
}
|
}
|
||||||
|
|
||||||
static OODLE_VERSION: &str = "2.9.10";
|
static OODLE_VERSION: &str = "2.9.10";
|
||||||
|
@ -187,8 +189,23 @@ pub struct Oodle {
|
||||||
compress: oodle_lz::Compress,
|
compress: oodle_lz::Compress,
|
||||||
decompress: oodle_lz::Decompress,
|
decompress: oodle_lz::Decompress,
|
||||||
get_compressed_buffer_size_needed: oodle_lz::GetCompressedBufferSizeNeeded,
|
get_compressed_buffer_size_needed: oodle_lz::GetCompressedBufferSizeNeeded,
|
||||||
|
set_printf: oodle_lz::SetPrintf,
|
||||||
}
|
}
|
||||||
impl Oodle {
|
impl Oodle {
|
||||||
|
fn new(lib: libloading::Library) -> Result<Self> {
|
||||||
|
unsafe {
|
||||||
|
let res = Oodle {
|
||||||
|
compress: *lib.get(b"OodleLZ_Compress")?,
|
||||||
|
decompress: *lib.get(b"OodleLZ_Decompress")?,
|
||||||
|
get_compressed_buffer_size_needed: *lib
|
||||||
|
.get(b"OodleLZ_GetCompressedBufferSizeNeeded")?,
|
||||||
|
set_printf: *lib.get(b"OodleCore_Plugins_SetPrintf")?,
|
||||||
|
_library: lib,
|
||||||
|
};
|
||||||
|
(res.set_printf)(std::ptr::null()); // silence oodle logging
|
||||||
|
Ok(res)
|
||||||
|
}
|
||||||
|
}
|
||||||
pub fn compress(
|
pub fn compress(
|
||||||
&self,
|
&self,
|
||||||
input: &[u8],
|
input: &[u8],
|
||||||
|
@ -255,14 +272,7 @@ fn load_oodle() -> Result<Oodle> {
|
||||||
let path = fetch_oodle()?;
|
let path = fetch_oodle()?;
|
||||||
unsafe {
|
unsafe {
|
||||||
let library = libloading::Library::new(path)?;
|
let library = libloading::Library::new(path)?;
|
||||||
|
Oodle::new(library)
|
||||||
Ok(Oodle {
|
|
||||||
compress: *library.get(b"OodleLZ_Compress")?,
|
|
||||||
decompress: *library.get(b"OodleLZ_Decompress")?,
|
|
||||||
get_compressed_buffer_size_needed: *library
|
|
||||||
.get(b"OodleLZ_GetCompressedBufferSizeNeeded")?,
|
|
||||||
_library: library,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue