dx9 0.1.8

Rust library for DirectX 9.0c
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
/* 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;
pub type D3DLIGHTTYPE = 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,
        n: DWORD,
        typ: D3DLIGHTTYPE,
        dif: *const f32,
        spc: *const f32,
        amb: *const f32,
        pos: *const f32,
        dir: *const f32,
        range: f32,
    ) -> 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;
}