#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use crate::support::{BorrowedSlice, Bytes};
#[repr(i32)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum FormatVersion {
V1 = 0,
V2 = 1,
}
impl TryFrom<i32> for FormatVersion {
type Error = crate::Error;
fn try_from(v: i32) -> Result<Self, crate::Error> {
match v {
0 => Ok(FormatVersion::V1),
1 => Ok(FormatVersion::V2),
other => Err(crate::Error::UnknownEnum {
name: "FormatVersion",
value: other,
}),
}
}
}
#[repr(i32)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Compression {
None = 0,
Huffman = 1,
Zlib = 2,
PKware = 8,
BZip2 = 16,
Sparse = 32,
AdpcmMono = 64,
AdpcmStereo = -128,
}
impl TryFrom<i32> for Compression {
type Error = crate::Error;
fn try_from(v: i32) -> Result<Self, crate::Error> {
match v {
0 => Ok(Compression::None),
1 => Ok(Compression::Huffman),
2 => Ok(Compression::Zlib),
8 => Ok(Compression::PKware),
16 => Ok(Compression::BZip2),
32 => Ok(Compression::Sparse),
64 => Ok(Compression::AdpcmMono),
-128 => Ok(Compression::AdpcmStereo),
other => Err(crate::Error::UnknownEnum {
name: "Compression",
value: other,
}),
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct FileFlags(pub i32);
impl FileFlags {
pub const NONE: Self = Self(0);
pub const COMPRESSED: Self = Self(512);
pub const ENCRYPTED: Self = Self(65536);
pub const SINGLE_UNIT: Self = Self(16777216);
pub const EXISTS: Self = Self(-2147483648);
#[inline]
pub const fn contains(self, other: Self) -> bool {
(self.0 & other.0) == other.0
}
#[inline]
pub const fn is_empty(self) -> bool {
self.0 == 0
}
}
impl core::ops::BitOr for FileFlags {
type Output = Self;
#[inline]
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl core::ops::BitAnd for FileFlags {
type Output = Self;
#[inline]
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl core::ops::Not for FileFlags {
type Output = Self;
#[inline]
fn not(self) -> Self {
Self(!self.0)
}
}
impl core::fmt::Debug for FileFlags {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "FileFlags({:#x})", self.0)
}
}
pub struct FileInfo {
pub(crate) raw: core::ptr::NonNull<ffi::whiteout_MpqFileInfo>,
}
impl Drop for FileInfo {
fn drop(&mut self) {
unsafe { ffi::whiteout_mpq_MpqFileInfo_delete(self.raw.as_ptr()) }
}
}
impl FileInfo {
#[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_MpqFileInfo) -> Option<Self> {
core::ptr::NonNull::new(raw).map(|raw| FileInfo { raw })
}
}
unsafe impl Send for FileInfo {}
impl core::fmt::Debug for FileInfo {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("FileInfo").finish_non_exhaustive()
}
}
impl FileInfo {
pub fn new() -> Self {
unsafe {
let raw = ffi::whiteout_mpq_MpqFileInfo_new();
Self::from_raw(raw).expect("native FileInfo allocation failed")
}
}
pub fn name(&self) -> String {
unsafe {
crate::support::take_string(ffi::whiteout_mpq_MpqFileInfo_get_name(self.raw.as_ptr()))
}
}
pub fn set_name(&mut self, value: &str) {
let value = std::ffi::CString::new(value).unwrap_or_default();
unsafe { ffi::whiteout_mpq_MpqFileInfo_set_name(self.raw.as_ptr(), value.as_ptr()) }
}
pub fn compressed_size(&self) -> u32 {
unsafe { ffi::whiteout_mpq_MpqFileInfo_get_compressedSize(self.raw.as_ptr()) }
}
pub fn set_compressed_size(&mut self, value: u32) {
unsafe { ffi::whiteout_mpq_MpqFileInfo_set_compressedSize(self.raw.as_ptr(), value) }
}
pub fn uncompressed_size(&self) -> u32 {
unsafe { ffi::whiteout_mpq_MpqFileInfo_get_uncompressedSize(self.raw.as_ptr()) }
}
pub fn set_uncompressed_size(&mut self, value: u32) {
unsafe { ffi::whiteout_mpq_MpqFileInfo_set_uncompressedSize(self.raw.as_ptr(), value) }
}
pub fn flags(&self) -> FileFlags {
FileFlags(unsafe { ffi::whiteout_mpq_MpqFileInfo_get_flags(self.raw.as_ptr()) })
}
pub fn set_flags(&mut self, value: FileFlags) {
unsafe { ffi::whiteout_mpq_MpqFileInfo_set_flags(self.raw.as_ptr(), value.0) }
}
pub fn locale(&self) -> u16 {
unsafe { ffi::whiteout_mpq_MpqFileInfo_get_locale(self.raw.as_ptr()) }
}
pub fn set_locale(&mut self, value: u16) {
unsafe { ffi::whiteout_mpq_MpqFileInfo_set_locale(self.raw.as_ptr(), value) }
}
}
impl Default for FileInfo {
fn default() -> Self {
Self::new()
}
}
pub struct ArchiveInfo {
pub(crate) raw: core::ptr::NonNull<ffi::whiteout_MpqArchiveInfo>,
}
impl Drop for ArchiveInfo {
fn drop(&mut self) {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_delete(self.raw.as_ptr()) }
}
}
impl ArchiveInfo {
#[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_MpqArchiveInfo) -> Option<Self> {
core::ptr::NonNull::new(raw).map(|raw| ArchiveInfo { raw })
}
}
unsafe impl Send for ArchiveInfo {}
impl core::fmt::Debug for ArchiveInfo {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("ArchiveInfo").finish_non_exhaustive()
}
}
impl ArchiveInfo {
pub fn new() -> Self {
unsafe {
let raw = ffi::whiteout_mpq_MpqArchiveInfo_new();
Self::from_raw(raw).expect("native ArchiveInfo allocation failed")
}
}
pub fn format_version(&self) -> u16 {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_get_formatVersion(self.raw.as_ptr()) }
}
pub fn set_format_version(&mut self, value: u16) {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_set_formatVersion(self.raw.as_ptr(), value) }
}
pub fn hash_table_entries(&self) -> u32 {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_get_hashTableEntries(self.raw.as_ptr()) }
}
pub fn set_hash_table_entries(&mut self, value: u32) {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_set_hashTableEntries(self.raw.as_ptr(), value) }
}
pub fn block_table_entries(&self) -> u32 {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_get_blockTableEntries(self.raw.as_ptr()) }
}
pub fn set_block_table_entries(&mut self, value: u32) {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_set_blockTableEntries(self.raw.as_ptr(), value) }
}
pub fn sector_size(&self) -> u32 {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_get_sectorSize(self.raw.as_ptr()) }
}
pub fn set_sector_size(&mut self, value: u32) {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_set_sectorSize(self.raw.as_ptr(), value) }
}
pub fn archive_size(&self) -> u64 {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_get_archiveSize(self.raw.as_ptr()) }
}
pub fn set_archive_size(&mut self, value: u64) {
unsafe { ffi::whiteout_mpq_MpqArchiveInfo_set_archiveSize(self.raw.as_ptr(), value) }
}
}
impl Default for ArchiveInfo {
fn default() -> Self {
Self::new()
}
}
pub struct WriteOptions {
pub(crate) raw: core::ptr::NonNull<ffi::whiteout_MpqWriteOptions>,
}
impl Drop for WriteOptions {
fn drop(&mut self) {
unsafe { ffi::whiteout_mpq_MpqWriteOptions_delete(self.raw.as_ptr()) }
}
}
impl WriteOptions {
#[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_MpqWriteOptions) -> Option<Self> {
core::ptr::NonNull::new(raw).map(|raw| WriteOptions { raw })
}
}
unsafe impl Send for WriteOptions {}
impl core::fmt::Debug for WriteOptions {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("WriteOptions").finish_non_exhaustive()
}
}
impl WriteOptions {
pub fn new() -> Self {
unsafe {
let raw = ffi::whiteout_mpq_MpqWriteOptions_new();
Self::from_raw(raw).expect("native WriteOptions allocation failed")
}
}
pub fn compression(&self) -> Compression {
unsafe { ffi::whiteout_mpq_MpqWriteOptions_get_compression(self.raw.as_ptr()) }
.try_into()
.expect("unknown enum discriminant from the native library")
}
pub fn set_compression(&mut self, value: Compression) {
unsafe {
ffi::whiteout_mpq_MpqWriteOptions_set_compression(self.raw.as_ptr(), value as i32)
}
}
pub fn locale(&self) -> u16 {
unsafe { ffi::whiteout_mpq_MpqWriteOptions_get_locale(self.raw.as_ptr()) }
}
pub fn set_locale(&mut self, value: u16) {
unsafe { ffi::whiteout_mpq_MpqWriteOptions_set_locale(self.raw.as_ptr(), value) }
}
pub fn encrypt(&self) -> bool {
unsafe { ffi::whiteout_mpq_MpqWriteOptions_get_encrypt(self.raw.as_ptr()) != 0 }
}
pub fn set_encrypt(&mut self, value: bool) {
unsafe {
ffi::whiteout_mpq_MpqWriteOptions_set_encrypt(
self.raw.as_ptr(),
if value { 1 } else { 0 },
)
}
}
pub fn single_unit(&self) -> bool {
unsafe { ffi::whiteout_mpq_MpqWriteOptions_get_singleUnit(self.raw.as_ptr()) != 0 }
}
pub fn set_single_unit(&mut self, value: bool) {
unsafe {
ffi::whiteout_mpq_MpqWriteOptions_set_singleUnit(
self.raw.as_ptr(),
if value { 1 } else { 0 },
)
}
}
}
impl Default for WriteOptions {
fn default() -> Self {
Self::new()
}
}
pub struct CreateOptions {
pub(crate) raw: core::ptr::NonNull<ffi::whiteout_MpqCreateOptions>,
}
impl Drop for CreateOptions {
fn drop(&mut self) {
unsafe { ffi::whiteout_mpq_MpqCreateOptions_delete(self.raw.as_ptr()) }
}
}
impl CreateOptions {
#[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_MpqCreateOptions) -> Option<Self> {
core::ptr::NonNull::new(raw).map(|raw| CreateOptions { raw })
}
}
unsafe impl Send for CreateOptions {}
impl core::fmt::Debug for CreateOptions {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CreateOptions").finish_non_exhaustive()
}
}
impl CreateOptions {
pub fn new() -> Self {
unsafe {
let raw = ffi::whiteout_mpq_MpqCreateOptions_new();
Self::from_raw(raw).expect("native CreateOptions allocation failed")
}
}
pub fn version(&self) -> FormatVersion {
unsafe { ffi::whiteout_mpq_MpqCreateOptions_get_version(self.raw.as_ptr()) }
.try_into()
.expect("unknown enum discriminant from the native library")
}
pub fn set_version(&mut self, value: FormatVersion) {
unsafe { ffi::whiteout_mpq_MpqCreateOptions_set_version(self.raw.as_ptr(), value as i32) }
}
pub fn hash_table_size(&self) -> u32 {
unsafe { ffi::whiteout_mpq_MpqCreateOptions_get_hashTableSize(self.raw.as_ptr()) }
}
pub fn set_hash_table_size(&mut self, value: u32) {
unsafe { ffi::whiteout_mpq_MpqCreateOptions_set_hashTableSize(self.raw.as_ptr(), value) }
}
pub fn sector_size_shift(&self) -> u16 {
unsafe { ffi::whiteout_mpq_MpqCreateOptions_get_sectorSizeShift(self.raw.as_ptr()) }
}
pub fn set_sector_size_shift(&mut self, value: u16) {
unsafe { ffi::whiteout_mpq_MpqCreateOptions_set_sectorSizeShift(self.raw.as_ptr(), value) }
}
}
impl Default for CreateOptions {
fn default() -> Self {
Self::new()
}
}
pub struct Storage {
pub(crate) raw: core::ptr::NonNull<ffi::whiteout_MpqStorage>,
}
impl Drop for Storage {
fn drop(&mut self) {
unsafe { ffi::whiteout_mpq_MpqStorage_delete(self.raw.as_ptr()) }
}
}
impl Storage {
#[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_MpqStorage) -> Option<Self> {
core::ptr::NonNull::new(raw).map(|raw| Storage { raw })
}
}
unsafe impl Send for Storage {}
impl core::fmt::Debug for Storage {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("Storage").finish_non_exhaustive()
}
}
impl Storage {
pub fn open(path: &str, pool: Option<&crate::interfaces::HostWorkerPool>) -> Option<Storage> {
let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
unsafe {
Storage::from_raw(ffi::whiteout_mpq_MpqStorage_open(
path_cstr.as_ptr(),
pool.map_or(core::ptr::null_mut(), |v| v.as_ptr()),
))
}
}
pub fn create(
opts: &CreateOptions,
pool: Option<&crate::interfaces::HostWorkerPool>,
) -> Option<Storage> {
unsafe {
Storage::from_raw(ffi::whiteout_mpq_MpqStorage_create(
opts.raw.as_ptr(),
pool.map_or(core::ptr::null_mut(), |v| v.as_ptr()),
))
}
}
pub fn close(&mut self) {
unsafe {
ffi::whiteout_mpq_MpqStorage_close(self.raw.as_ptr());
}
}
pub fn read_file(&self, name: &str) -> Option<Bytes> {
let name_cstr = std::ffi::CString::new(name).unwrap_or_default();
unsafe {
Bytes::from_raw(ffi::whiteout_mpq_MpqStorage_readFile(
self.raw.as_ptr(),
name_cstr.as_ptr(),
))
}
}
pub fn read_file_name_locale(&self, name: &str, locale: u16) -> Option<Bytes> {
let name_cstr = std::ffi::CString::new(name).unwrap_or_default();
unsafe {
Bytes::from_raw(ffi::whiteout_mpq_MpqStorage_readFile_name_locale(
self.raw.as_ptr(),
name_cstr.as_ptr(),
locale,
))
}
}
pub fn file_exists(&self, name: &str) -> bool {
let name_cstr = std::ffi::CString::new(name).unwrap_or_default();
unsafe {
ffi::whiteout_mpq_MpqStorage_fileExists(self.raw.as_ptr(), name_cstr.as_ptr()) != 0
}
}
pub fn file_info(&self, name: &str) -> Option<FileInfo> {
let name_cstr = std::ffi::CString::new(name).unwrap_or_default();
unsafe {
FileInfo::from_raw(ffi::whiteout_mpq_MpqStorage_fileInfo(
self.raw.as_ptr(),
name_cstr.as_ptr(),
))
}
}
pub fn archive_info(&self) -> Option<ArchiveInfo> {
unsafe {
ArchiveInfo::from_raw(ffi::whiteout_mpq_MpqStorage_archiveInfo(self.raw.as_ptr()))
}
}
pub fn list_files(&self) -> Vec<String> {
unsafe {
let list = ffi::whiteout_mpq_MpqStorage_listFiles(self.raw.as_ptr());
if list.is_null() {
return Vec::new();
}
let n = ffi::whiteout_mpq_StringList_size(list);
let out = (0..n)
.map(|i| crate::support::take_string(ffi::whiteout_mpq_StringList_at(list, i)))
.collect();
ffi::whiteout_mpq_StringList_delete(list);
out
}
}
pub fn write_file(&mut self, name: &[u8], data: &[u8], opts: &WriteOptions) -> bool {
unsafe {
ffi::whiteout_mpq_MpqStorage_writeFile(
self.raw.as_ptr(),
name.as_ptr(),
name.len(),
data.as_ptr(),
data.len(),
opts.raw.as_ptr(),
) != 0
}
}
pub fn delete_file(&mut self, name: &str) -> bool {
let name_cstr = std::ffi::CString::new(name).unwrap_or_default();
unsafe {
ffi::whiteout_mpq_MpqStorage_deleteFile(self.raw.as_ptr(), name_cstr.as_ptr()) != 0
}
}
pub fn save(&mut self) -> bool {
unsafe { ffi::whiteout_mpq_MpqStorage_save(self.raw.as_ptr()) != 0 }
}
pub fn save_path(&mut self, path: &str) -> bool {
let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
unsafe {
ffi::whiteout_mpq_MpqStorage_save_path(self.raw.as_ptr(), path_cstr.as_ptr()) != 0
}
}
}
pub struct FileSystem {
pub(crate) raw: core::ptr::NonNull<ffi::whiteout_MpqFileSystem>,
}
impl Drop for FileSystem {
fn drop(&mut self) {
unsafe { ffi::whiteout_mpq_MpqFileSystem_delete(self.raw.as_ptr()) }
}
}
impl FileSystem {
#[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_MpqFileSystem) -> Option<Self> {
core::ptr::NonNull::new(raw).map(|raw| FileSystem { raw })
}
}
unsafe impl Send for FileSystem {}
impl core::fmt::Debug for FileSystem {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("FileSystem").finish_non_exhaustive()
}
}
impl FileSystem {
pub fn read_file(&self, path: &str) -> Bytes {
let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
unsafe {
Bytes::from_raw(ffi::whiteout_mpq_MpqFileSystem_readFile(
self.raw.as_ptr(),
path_cstr.as_ptr(),
))
.unwrap_or_else(Bytes::empty)
}
}
pub fn write_file(&mut self, path: &str, data: &[u8]) -> bool {
let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
unsafe {
ffi::whiteout_mpq_MpqFileSystem_writeFile(
self.raw.as_ptr(),
path_cstr.as_ptr(),
data.as_ptr(),
data.len(),
) != 0
}
}
pub fn file_exists(&self, path: &str) -> bool {
let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
unsafe {
ffi::whiteout_mpq_MpqFileSystem_fileExists(self.raw.as_ptr(), path_cstr.as_ptr()) != 0
}
}
}
#[doc(hidden)]
pub mod ffi {
#![allow(missing_debug_implementations)]
#[allow(unused_imports)]
use crate::support::{RawBytes, RawCString};
#[repr(C)]
pub struct whiteout_MpqFileInfo {
_private: [u8; 0],
}
#[repr(C)]
pub struct whiteout_MpqArchiveInfo {
_private: [u8; 0],
}
#[repr(C)]
pub struct whiteout_MpqWriteOptions {
_private: [u8; 0],
}
#[repr(C)]
pub struct whiteout_MpqCreateOptions {
_private: [u8; 0],
}
#[repr(C)]
pub struct whiteout_MpqStorage {
_private: [u8; 0],
}
#[repr(C)]
pub struct whiteout_MpqFileSystem {
_private: [u8; 0],
}
#[repr(C)]
pub struct whiteout_StringList {
_private: [u8; 0],
}
extern "C" {
pub fn whiteout_mpq_StringList_size(self_: *mut whiteout_StringList) -> usize;
pub fn whiteout_mpq_StringList_at(
self_: *mut whiteout_StringList,
index: usize,
) -> RawCString;
pub fn whiteout_mpq_StringList_delete(self_: *mut whiteout_StringList);
pub fn whiteout_mpq_MpqFileInfo_new() -> *mut whiteout_MpqFileInfo;
pub fn whiteout_mpq_MpqFileInfo_delete(self_: *mut whiteout_MpqFileInfo);
pub fn whiteout_mpq_MpqFileInfo_get_name(self_: *mut whiteout_MpqFileInfo) -> RawCString;
pub fn whiteout_mpq_MpqFileInfo_set_name(
self_: *mut whiteout_MpqFileInfo,
value: *const core::ffi::c_char,
);
pub fn whiteout_mpq_MpqFileInfo_get_compressedSize(self_: *mut whiteout_MpqFileInfo)
-> u32;
pub fn whiteout_mpq_MpqFileInfo_set_compressedSize(
self_: *mut whiteout_MpqFileInfo,
value: u32,
);
pub fn whiteout_mpq_MpqFileInfo_get_uncompressedSize(
self_: *mut whiteout_MpqFileInfo,
) -> u32;
pub fn whiteout_mpq_MpqFileInfo_set_uncompressedSize(
self_: *mut whiteout_MpqFileInfo,
value: u32,
);
pub fn whiteout_mpq_MpqFileInfo_get_flags(self_: *mut whiteout_MpqFileInfo) -> i32;
pub fn whiteout_mpq_MpqFileInfo_set_flags(self_: *mut whiteout_MpqFileInfo, value: i32);
pub fn whiteout_mpq_MpqFileInfo_get_locale(self_: *mut whiteout_MpqFileInfo) -> u16;
pub fn whiteout_mpq_MpqFileInfo_set_locale(self_: *mut whiteout_MpqFileInfo, value: u16);
pub fn whiteout_mpq_MpqArchiveInfo_new() -> *mut whiteout_MpqArchiveInfo;
pub fn whiteout_mpq_MpqArchiveInfo_delete(self_: *mut whiteout_MpqArchiveInfo);
pub fn whiteout_mpq_MpqArchiveInfo_get_formatVersion(
self_: *mut whiteout_MpqArchiveInfo,
) -> u16;
pub fn whiteout_mpq_MpqArchiveInfo_set_formatVersion(
self_: *mut whiteout_MpqArchiveInfo,
value: u16,
);
pub fn whiteout_mpq_MpqArchiveInfo_get_hashTableEntries(
self_: *mut whiteout_MpqArchiveInfo,
) -> u32;
pub fn whiteout_mpq_MpqArchiveInfo_set_hashTableEntries(
self_: *mut whiteout_MpqArchiveInfo,
value: u32,
);
pub fn whiteout_mpq_MpqArchiveInfo_get_blockTableEntries(
self_: *mut whiteout_MpqArchiveInfo,
) -> u32;
pub fn whiteout_mpq_MpqArchiveInfo_set_blockTableEntries(
self_: *mut whiteout_MpqArchiveInfo,
value: u32,
);
pub fn whiteout_mpq_MpqArchiveInfo_get_sectorSize(
self_: *mut whiteout_MpqArchiveInfo,
) -> u32;
pub fn whiteout_mpq_MpqArchiveInfo_set_sectorSize(
self_: *mut whiteout_MpqArchiveInfo,
value: u32,
);
pub fn whiteout_mpq_MpqArchiveInfo_get_archiveSize(
self_: *mut whiteout_MpqArchiveInfo,
) -> u64;
pub fn whiteout_mpq_MpqArchiveInfo_set_archiveSize(
self_: *mut whiteout_MpqArchiveInfo,
value: u64,
);
pub fn whiteout_mpq_MpqWriteOptions_new() -> *mut whiteout_MpqWriteOptions;
pub fn whiteout_mpq_MpqWriteOptions_delete(self_: *mut whiteout_MpqWriteOptions);
pub fn whiteout_mpq_MpqWriteOptions_get_compression(
self_: *mut whiteout_MpqWriteOptions,
) -> i32;
pub fn whiteout_mpq_MpqWriteOptions_set_compression(
self_: *mut whiteout_MpqWriteOptions,
value: i32,
);
pub fn whiteout_mpq_MpqWriteOptions_get_locale(self_: *mut whiteout_MpqWriteOptions)
-> u16;
pub fn whiteout_mpq_MpqWriteOptions_set_locale(
self_: *mut whiteout_MpqWriteOptions,
value: u16,
);
pub fn whiteout_mpq_MpqWriteOptions_get_encrypt(
self_: *mut whiteout_MpqWriteOptions,
) -> i32;
pub fn whiteout_mpq_MpqWriteOptions_set_encrypt(
self_: *mut whiteout_MpqWriteOptions,
value: i32,
);
pub fn whiteout_mpq_MpqWriteOptions_get_singleUnit(
self_: *mut whiteout_MpqWriteOptions,
) -> i32;
pub fn whiteout_mpq_MpqWriteOptions_set_singleUnit(
self_: *mut whiteout_MpqWriteOptions,
value: i32,
);
pub fn whiteout_mpq_MpqCreateOptions_new() -> *mut whiteout_MpqCreateOptions;
pub fn whiteout_mpq_MpqCreateOptions_delete(self_: *mut whiteout_MpqCreateOptions);
pub fn whiteout_mpq_MpqCreateOptions_get_version(
self_: *mut whiteout_MpqCreateOptions,
) -> i32;
pub fn whiteout_mpq_MpqCreateOptions_set_version(
self_: *mut whiteout_MpqCreateOptions,
value: i32,
);
pub fn whiteout_mpq_MpqCreateOptions_get_hashTableSize(
self_: *mut whiteout_MpqCreateOptions,
) -> u32;
pub fn whiteout_mpq_MpqCreateOptions_set_hashTableSize(
self_: *mut whiteout_MpqCreateOptions,
value: u32,
);
pub fn whiteout_mpq_MpqCreateOptions_get_sectorSizeShift(
self_: *mut whiteout_MpqCreateOptions,
) -> u16;
pub fn whiteout_mpq_MpqCreateOptions_set_sectorSizeShift(
self_: *mut whiteout_MpqCreateOptions,
value: u16,
);
pub fn whiteout_mpq_MpqStorage_delete(self_: *mut whiteout_MpqStorage);
pub fn whiteout_mpq_MpqStorage_open(
path: *const core::ffi::c_char,
pool: *mut core::ffi::c_void,
) -> *mut whiteout_MpqStorage;
pub fn whiteout_mpq_MpqStorage_create(
opts: *mut whiteout_MpqCreateOptions,
pool: *mut core::ffi::c_void,
) -> *mut whiteout_MpqStorage;
pub fn whiteout_mpq_MpqStorage_close(self_: *mut whiteout_MpqStorage);
pub fn whiteout_mpq_MpqStorage_readFile(
self_: *mut whiteout_MpqStorage,
name: *const core::ffi::c_char,
) -> RawBytes;
pub fn whiteout_mpq_MpqStorage_readFile_name_locale(
self_: *mut whiteout_MpqStorage,
name: *const core::ffi::c_char,
locale: u16,
) -> RawBytes;
pub fn whiteout_mpq_MpqStorage_fileExists(
self_: *mut whiteout_MpqStorage,
name: *const core::ffi::c_char,
) -> i32;
pub fn whiteout_mpq_MpqStorage_fileInfo(
self_: *mut whiteout_MpqStorage,
name: *const core::ffi::c_char,
) -> *mut whiteout_MpqFileInfo;
pub fn whiteout_mpq_MpqStorage_archiveInfo(
self_: *mut whiteout_MpqStorage,
) -> *mut whiteout_MpqArchiveInfo;
pub fn whiteout_mpq_MpqStorage_listFiles(
self_: *mut whiteout_MpqStorage,
) -> *mut whiteout_StringList;
pub fn whiteout_mpq_MpqStorage_writeFile(
self_: *mut whiteout_MpqStorage,
name: *const u8,
name_size: usize,
data: *const u8,
data_size: usize,
opts: *mut whiteout_MpqWriteOptions,
) -> i32;
pub fn whiteout_mpq_MpqStorage_deleteFile(
self_: *mut whiteout_MpqStorage,
name: *const core::ffi::c_char,
) -> i32;
pub fn whiteout_mpq_MpqStorage_save(self_: *mut whiteout_MpqStorage) -> i32;
pub fn whiteout_mpq_MpqStorage_save_path(
self_: *mut whiteout_MpqStorage,
path: *const core::ffi::c_char,
) -> i32;
pub fn whiteout_mpq_MpqFileSystem_new_storage(
_0: *mut core::ffi::c_void,
) -> *mut whiteout_MpqFileSystem;
pub fn whiteout_mpq_MpqFileSystem_delete(self_: *mut whiteout_MpqFileSystem);
pub fn whiteout_mpq_MpqFileSystem_readFile(
self_: *mut whiteout_MpqFileSystem,
path: *const core::ffi::c_char,
) -> RawBytes;
pub fn whiteout_mpq_MpqFileSystem_writeFile(
self_: *mut whiteout_MpqFileSystem,
path: *const core::ffi::c_char,
data: *const u8,
data_size: usize,
) -> i32;
pub fn whiteout_mpq_MpqFileSystem_fileExists(
self_: *mut whiteout_MpqFileSystem,
path: *const core::ffi::c_char,
) -> i32;
}
}