/* automatically generated by rust-bindgen 0.72.1 */

pub type ulonglong = ::std::os::raw::c_ulonglong;
pub type ulong = ::std::os::raw::c_ulong;
pub type uint = ::std::os::raw::c_uint;
pub type uchar = ::std::os::raw::c_uchar;
pub type byte = ::std::os::raw::c_uchar;
unsafe extern "C" {
    pub static mut ref_mat44_i: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_t: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_s: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_r: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_q: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_d: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_z: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_c: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_v: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static mut ref_mat44_p: [[f32; 4usize]; 0usize];
}
unsafe extern "C" {
    pub static ref_mat_column_major: [f32; 0usize];
}
unsafe extern "C" {
    pub static dump_mat_m44: [f32; 0usize];
}
unsafe extern "C" {
    pub static mut dump_mat_m44_u8s: *const byte;
}
unsafe extern "C" {
    pub static mut LOGFILE: *const u16;
}
unsafe extern "C" {
    pub static mut Cpname: [*const ::std::os::raw::c_char; 4usize];
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Cxd_ {
    _unused: [u8; 0],
}
pub type Cxd = Cxd_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TransScreen_ {
    _unused: [u8; 0],
}
pub type TransScreen = TransScreen_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Fuga {
    pub f: *mut usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of Fuga"][::std::mem::size_of::<Fuga>() - 8usize];
    ["Alignment of Fuga"][::std::mem::align_of::<Fuga>() - 8usize];
    ["Offset of field: Fuga::f"][::std::mem::offset_of!(Fuga, f) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Csa_ {
    pub a: *const usize,
    pub n: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of Csa_"][::std::mem::size_of::<Csa_>() - 16usize];
    ["Alignment of Csa_"][::std::mem::align_of::<Csa_>() - 8usize];
    ["Offset of field: Csa_::a"][::std::mem::offset_of!(Csa_, a) - 0usize];
    ["Offset of field: Csa_::n"][::std::mem::offset_of!(Csa_, n) - 8usize];
};
pub type Csa = Csa_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Cvtx_ {
    pub x: f32,
    pub y: f32,
    pub z: f32,
    pub c: uint,
    pub s: uint,
    pub u: f32,
    pub v: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of Cvtx_"][::std::mem::size_of::<Cvtx_>() - 28usize];
    ["Alignment of Cvtx_"][::std::mem::align_of::<Cvtx_>() - 4usize];
    ["Offset of field: Cvtx_::x"][::std::mem::offset_of!(Cvtx_, x) - 0usize];
    ["Offset of field: Cvtx_::y"][::std::mem::offset_of!(Cvtx_, y) - 4usize];
    ["Offset of field: Cvtx_::z"][::std::mem::offset_of!(Cvtx_, z) - 8usize];
    ["Offset of field: Cvtx_::c"][::std::mem::offset_of!(Cvtx_, c) - 12usize];
    ["Offset of field: Cvtx_::s"][::std::mem::offset_of!(Cvtx_, s) - 16usize];
    ["Offset of field: Cvtx_::u"][::std::mem::offset_of!(Cvtx_, u) - 20usize];
    ["Offset of field: Cvtx_::v"][::std::mem::offset_of!(Cvtx_, v) - 24usize];
};
pub type Cvtx = Cvtx_;
unsafe extern "C" {
    pub static FVF_CVTX: ulong;
}
pub type HWND = *mut ::std::os::raw::c_void;
pub type HRESULT = ::std::os::raw::c_long;
pub type DWORD = ulong;
pub type UINT = uint;
pub type D3DPRIMITIVETYPE = DWORD;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct D3DVERTEXELEMENT9 {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct D3DXVECTOR3 {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct D3DXMATRIX {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct D3DXQUATERNION {
    _unused: [u8; 0],
}
unsafe extern "C" {
    pub fn D3DXQuaternionNormalize(
        q: *mut D3DXQUATERNION,
        a: *const D3DXQUATERNION,
    ) -> *mut D3DXQUATERNION;
}
unsafe extern "C" {
    pub fn D3DXQuaternionInverse(
        q: *mut D3DXQUATERNION,
        a: *const D3DXQUATERNION,
    ) -> *mut D3DXQUATERNION;
}
unsafe extern "C" {
    pub fn D3DXQuaternionMultiply(
        q: *mut D3DXQUATERNION,
        a: *const D3DXQUATERNION,
        b: *const D3DXQUATERNION,
    ) -> *mut D3DXQUATERNION;
}
unsafe extern "C" {
    pub fn D3DXQuaternionRotationAxis(
        q: *mut D3DXQUATERNION,
        axis: *const D3DXVECTOR3,
        th: f32,
    ) -> *mut D3DXQUATERNION;
}
unsafe extern "C" {
    pub fn D3DXQuaternionRotationMatrix(
        q: *mut D3DXQUATERNION,
        m: *const D3DXMATRIX,
    ) -> *mut D3DXQUATERNION;
}
unsafe extern "C" {
    pub fn D3DXMatrixRotationQuaternion(
        m: *mut D3DXMATRIX,
        q: *const D3DXQUATERNION,
    ) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixIdentity(m: *mut D3DXMATRIX) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixTranspose(m: *mut D3DXMATRIX, a: *const D3DXMATRIX) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixDeterminant(m: *const D3DXMATRIX) -> f32;
}
unsafe extern "C" {
    pub fn D3DXMatrixInverse(
        m: *mut D3DXMATRIX,
        det: *mut f32,
        a: *const D3DXMATRIX,
    ) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixMultiply(
        m: *mut D3DXMATRIX,
        a: *const D3DXMATRIX,
        b: *const D3DXMATRIX,
    ) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixTranslation(m: *mut D3DXMATRIX, x: f32, y: f32, z: f32) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixScaling(m: *mut D3DXMATRIX, x: f32, y: f32, z: f32) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixRotationAxis(
        m: *mut D3DXMATRIX,
        axis: *const D3DXVECTOR3,
        rad: f32,
    ) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixLookAtLH(
        m: *mut D3DXMATRIX,
        eye: *const D3DXVECTOR3,
        lookat: *const D3DXVECTOR3,
        up: *const D3DXVECTOR3,
    ) -> *mut D3DXMATRIX;
}
unsafe extern "C" {
    pub fn D3DXMatrixPerspectiveFovLH(
        m: *mut D3DXMATRIX,
        rad: f32,
        ratio: f32,
        z0: f32,
        z1: f32,
    ) -> *mut D3DXMATRIX;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct timespec {
    pub tv_sec: ::std::os::raw::c_longlong,
    pub tv_nsec: ::std::os::raw::c_long,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of timespec"][::std::mem::size_of::<timespec>() - 16usize];
    ["Alignment of timespec"][::std::mem::align_of::<timespec>() - 8usize];
    ["Offset of field: timespec::tv_sec"][::std::mem::offset_of!(timespec, tv_sec) - 0usize];
    ["Offset of field: timespec::tv_nsec"][::std::mem::offset_of!(timespec, tv_nsec) - 8usize];
};
unsafe extern "C" {
    pub static CvtxElem: [D3DVERTEXELEMENT9; 0usize];
}
unsafe extern "C" {
    pub fn createD3D() -> *mut Cxd;
}
unsafe extern "C" {
    pub fn destroyD3D(xd: *mut *mut Cxd);
}
unsafe extern "C" {
    pub fn finishD3D(xd: *mut Cxd);
}
unsafe extern "C" {
    pub fn initD3D(xd: *mut Cxd, wnd: HWND) -> HRESULT;
}
unsafe extern "C" {
    pub fn manage_resource_n_pvec(xd: *mut Cxd) -> usize;
}
unsafe extern "C" {
    pub fn manage_resource_ptr_mut(xd: *mut Cxd) -> *mut *mut *mut ::std::os::raw::c_void;
}
unsafe extern "C" {
    pub fn manage_resource_set_disposer(
        xd: *mut Cxd,
        o: *mut ::std::os::raw::c_void,
        d: ::std::option::Option<
            unsafe extern "C" fn(xd: *mut Cxd, o: *mut ::std::os::raw::c_void) -> HRESULT,
        >,
        sa: *const Csa,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn disposeManageResourceElements(xd: *mut Cxd) -> HRESULT;
}
unsafe extern "C" {
    pub fn disposeManageResource(xd: *mut Cxd, o: *mut ::std::os::raw::c_void) -> HRESULT;
}
unsafe extern "C" {
    pub fn initManageResource(
        xd: *mut Cxd,
        o: *mut ::std::os::raw::c_void,
        d: ::std::option::Option<
            unsafe extern "C" fn(xd: *mut Cxd, o: *mut ::std::os::raw::c_void) -> HRESULT,
        >,
        sa: *const Csa,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn initFont(xd: *mut Cxd) -> HRESULT;
}
unsafe extern "C" {
    pub fn initTexture(xd: *mut Cxd) -> HRESULT;
}
unsafe extern "C" {
    pub fn initTextureIndirect(xd: *mut Cxd, n: usize, w: UINT, h: UINT, q: *mut DWORD) -> HRESULT;
}
unsafe extern "C" {
    pub fn readTexture(xd: *mut Cxd, n: usize, w: UINT, h: UINT, q: *mut DWORD) -> HRESULT;
}
unsafe extern "C" {
    pub fn alphaTexture(xd: *mut Cxd, n: usize, w: UINT, h: UINT, mask: DWORD) -> HRESULT;
}
unsafe extern "C" {
    pub fn prepareVertexBuffer(
        xd: *mut Cxd,
        n: UINT,
        vtx: *mut Cvtx,
        sz: UINT,
        fvf: DWORD,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn prepRectFAN(
        xd: *mut Cxd,
        vtx: *mut Cvtx,
        c: *mut DWORD,
        s: *mut DWORD,
        u: f32,
        v: f32,
        w: f32,
        h: f32,
        x: f32,
        y: f32,
        z: f32,
        a: f32,
        b: f32,
        cg: *mut D3DXVECTOR3,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn prepRectSTRIP(
        xd: *mut Cxd,
        vtx: *mut Cvtx,
        c: *mut DWORD,
        s: *mut DWORD,
        u: f32,
        v: f32,
        w: f32,
        h: f32,
        x: f32,
        y: f32,
        z: f32,
        a: f32,
        b: f32,
        cg: *mut D3DXVECTOR3,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn drawVT(
        xd: *mut Cxd,
        t: UINT,
        v: UINT,
        vtx: *mut Cvtx,
        sz: UINT,
        fvf: DWORD,
        ptype: D3DPRIMITIVETYPE,
        st: UINT,
        pc: UINT,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn drawChars(
        xd: *mut Cxd,
        c: *mut DWORD,
        s: *mut DWORD,
        t: UINT,
        cw: ::std::os::raw::c_int,
        ch: ::std::os::raw::c_int,
        sw: ::std::os::raw::c_int,
        sh: ::std::os::raw::c_int,
        x: f32,
        y: f32,
        z: f32,
        w: *const u16,
        l: UINT,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn draw2DText(
        xd: *mut Cxd,
        c: DWORD,
        f: UINT,
        x: ::std::os::raw::c_int,
        y: ::std::os::raw::c_int,
        t: *const u16,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn setLight(xd: *mut Cxd) -> HRESULT;
}
unsafe extern "C" {
    pub fn setCamera(xd: *mut Cxd, ptss: *mut TransScreen) -> HRESULT;
}
unsafe extern "C" {
    pub fn drawD3D(xd: *mut Cxd, ptss: *mut TransScreen) -> HRESULT;
}
unsafe extern "C" {
    pub fn updateD3D(xd: *mut Cxd) -> HRESULT;
}
unsafe extern "C" {
    pub fn rotCG(
        rot: *mut D3DXMATRIX,
        axis: *const D3DXVECTOR3,
        a: f32,
        cg: *const D3DXVECTOR3,
    ) -> HRESULT;
}
unsafe extern "C" {
    pub fn initLog(f: *const u16);
}
unsafe extern "C" {
    pub fn outLog(f: *const u16, fmt: *const u16, ...);
}
unsafe extern "C" {
    pub fn _timespec_now(a: *mut timespec);
}
unsafe extern "C" {
    pub fn _timespec_to_double(a: timespec) -> f64;
}
unsafe extern "C" {
    pub fn _timespec_clear(a: *mut timespec);
}
unsafe extern "C" {
    pub fn _timespec_iszero(a: timespec) -> bool;
}
unsafe extern "C" {
    pub fn _timespec_isset(a: timespec) -> bool;
}
unsafe extern "C" {
    pub fn _timespec_cmp(a: timespec, b: timespec) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn _timespec_sub(r: *mut timespec, a: timespec, b: timespec);
}
unsafe extern "C" {
    pub fn _timespec_add(r: *mut timespec, a: timespec, b: timespec);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DispMatParam_ {
    pub m: *const ::std::os::raw::c_void,
    pub w: usize,
    pub rows: usize,
    pub cols: usize,
    pub fmt: *const uchar,
    pub di: usize,
    pub df: usize,
    pub r: usize,
    pub c: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of DispMatParam_"][::std::mem::size_of::<DispMatParam_>() - 72usize];
    ["Alignment of DispMatParam_"][::std::mem::align_of::<DispMatParam_>() - 8usize];
    ["Offset of field: DispMatParam_::m"][::std::mem::offset_of!(DispMatParam_, m) - 0usize];
    ["Offset of field: DispMatParam_::w"][::std::mem::offset_of!(DispMatParam_, w) - 8usize];
    ["Offset of field: DispMatParam_::rows"][::std::mem::offset_of!(DispMatParam_, rows) - 16usize];
    ["Offset of field: DispMatParam_::cols"][::std::mem::offset_of!(DispMatParam_, cols) - 24usize];
    ["Offset of field: DispMatParam_::fmt"][::std::mem::offset_of!(DispMatParam_, fmt) - 32usize];
    ["Offset of field: DispMatParam_::di"][::std::mem::offset_of!(DispMatParam_, di) - 40usize];
    ["Offset of field: DispMatParam_::df"][::std::mem::offset_of!(DispMatParam_, df) - 48usize];
    ["Offset of field: DispMatParam_::r"][::std::mem::offset_of!(DispMatParam_, r) - 56usize];
    ["Offset of field: DispMatParam_::c"][::std::mem::offset_of!(DispMatParam_, c) - 64usize];
};
pub type DispMatParam = DispMatParam_;
unsafe extern "C" {
    pub fn dump_mat(u8s: *mut uchar, l: usize, m: *const f32, r: usize, c: usize) -> usize;
}
unsafe extern "C" {
    pub fn cb_xll(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize;
}
unsafe extern "C" {
    pub fn cb_x(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize;
}
unsafe extern "C" {
    pub fn cb_ull(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize;
}
unsafe extern "C" {
    pub fn cb_u(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize;
}
unsafe extern "C" {
    pub fn cb_ll(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize;
}
unsafe extern "C" {
    pub fn cb_i(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize;
}
unsafe extern "C" {
    pub fn cb_f(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize;
}
unsafe extern "C" {
    pub fn disp_mat(
        u: *mut uchar,
        l: usize,
        p: *mut DispMatParam,
        cb_element: ::std::option::Option<
            unsafe extern "C" fn(u: *mut uchar, l: usize, p: *mut DispMatParam) -> usize,
        >,
    ) -> usize;
}
#[repr(C)]
pub struct CppBridge__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
#[derive(Debug)]
pub struct CppBridge {
    pub vtable_: *const CppBridge__bindgen_vtable,
    pub p: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of CppBridge"][::std::mem::size_of::<CppBridge>() - 16usize];
    ["Alignment of CppBridge"][::std::mem::align_of::<CppBridge>() - 8usize];
    ["Offset of field: CppBridge::p"][::std::mem::offset_of!(CppBridge, p) - 8usize];
};
unsafe extern "C" {
    #[link_name = "\u{1}?get@CppBridge@@QEAAPEAXXZ"]
    pub fn CppBridge_get(this: *mut CppBridge) -> *mut ::std::os::raw::c_void;
}
unsafe extern "C" {
    #[link_name = "\u{1}??0CppBridge@@QEAA@PEAX@Z"]
    pub fn CppBridge_CppBridge(this: *mut CppBridge, q: *mut ::std::os::raw::c_void);
}
impl CppBridge {
    #[inline]
    pub unsafe fn get(&mut self) -> *mut ::std::os::raw::c_void {
        CppBridge_get(self)
    }
    #[inline]
    pub unsafe fn new(q: *mut ::std::os::raw::c_void) -> Self {
        let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
        CppBridge_CppBridge(__bindgen_tmp.as_mut_ptr(), q);
        __bindgen_tmp.assume_init()
    }
}
unsafe extern "C" {
    #[link_name = "\u{1}??1CppBridge@@UEAA@XZ"]
    pub fn CppBridge_CppBridge_destructor(this: *mut CppBridge);
}
unsafe extern "C" {
    pub fn gget(b: *mut CppBridge) -> ulonglong;
}
