mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Remove dependency on bindgen by just running the cli
This commit is contained in:
parent
99ce2f73d5
commit
927a2b61bb
194
mgba-test-runner/Cargo.lock
generated
194
mgba-test-runner/Cargo.lock
generated
|
@ -29,28 +29,6 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.62.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6720a8b7b2d39dd533285ed438d458f65b31b5c257e6ac7bb3d7e82844dd722"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"log",
|
||||
"peeking_take_while",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
|
@ -78,32 +56,12 @@ dependencies = [
|
|||
"jobserver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"libc",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
|
@ -119,12 +77,6 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.24"
|
||||
|
@ -135,12 +87,6 @@ dependencies = [
|
|||
"miniz_oxide 0.5.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.24.5"
|
||||
|
@ -164,43 +110,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.137"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
|
@ -212,18 +127,11 @@ name = "mgba-test-runner"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bindgen",
|
||||
"cc",
|
||||
"image",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.5.4"
|
||||
|
@ -242,16 +150,6 @@ dependencies = [
|
|||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
|
@ -282,18 +180,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.7"
|
||||
|
@ -306,24 +192,6 @@ dependencies = [
|
|||
"miniz_oxide 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.7.0"
|
||||
|
@ -340,65 +208,3 @@ name = "regex-syntax"
|
|||
version = "0.6.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
|
||||
dependencies = [
|
||||
"either",
|
||||
"libc",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
|
|
@ -16,4 +16,3 @@ image = { version = "0.24", default-features = false, features = [ "png", "bmp"
|
|||
|
||||
[build-dependencies]
|
||||
cc = { version = "1", features = ["parallel"] }
|
||||
bindgen = "0.62"
|
|
@ -29,17 +29,6 @@ fn main() {
|
|||
println!("cargo:rustc-link-lib=static=mgba-cycle");
|
||||
println!("cargo:rustc-link-lib=elf");
|
||||
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("c/test-runner.h")
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
bindings
|
||||
.write_to_file(&out_path.join("runner-bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
|
||||
println!("cargo:rerun-if-changed=c/test-runner.c");
|
||||
println!("cargo:rerun-if-changed=c/test-runner.h");
|
||||
println!("cargo:rerun-if-changed=build-mgba.sh");
|
||||
println!("cargo:rerun-if-changed=add_cycles_register.patch");
|
||||
}
|
||||
|
|
3
mgba-test-runner/create-bindings.sh
Executable file
3
mgba-test-runner/create-bindings.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
bindgen c/test-runner.h -o src/bindings.rs
|
330
mgba-test-runner/src/bindings.rs
Normal file
330
mgba-test-runner/src/bindings.rs
Normal file
|
@ -0,0 +1,330 @@
|
|||
/* automatically generated by rust-bindgen 0.63.0 */
|
||||
|
||||
pub const _STDINT_H: u32 = 1;
|
||||
pub const _FEATURES_H: u32 = 1;
|
||||
pub const _DEFAULT_SOURCE: u32 = 1;
|
||||
pub const __GLIBC_USE_ISOC2X: u32 = 0;
|
||||
pub const __USE_ISOC11: u32 = 1;
|
||||
pub const __USE_ISOC99: u32 = 1;
|
||||
pub const __USE_ISOC95: u32 = 1;
|
||||
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
|
||||
pub const _POSIX_SOURCE: u32 = 1;
|
||||
pub const _POSIX_C_SOURCE: u32 = 200809;
|
||||
pub const __USE_POSIX: u32 = 1;
|
||||
pub const __USE_POSIX2: u32 = 1;
|
||||
pub const __USE_POSIX199309: u32 = 1;
|
||||
pub const __USE_POSIX199506: u32 = 1;
|
||||
pub const __USE_XOPEN2K: u32 = 1;
|
||||
pub const __USE_XOPEN2K8: u32 = 1;
|
||||
pub const _ATFILE_SOURCE: u32 = 1;
|
||||
pub const __USE_MISC: u32 = 1;
|
||||
pub const __USE_ATFILE: u32 = 1;
|
||||
pub const __USE_FORTIFY_LEVEL: u32 = 0;
|
||||
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
|
||||
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
|
||||
pub const _STDC_PREDEF_H: u32 = 1;
|
||||
pub const __STDC_IEC_559__: u32 = 1;
|
||||
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
|
||||
pub const __STDC_ISO_10646__: u32 = 201706;
|
||||
pub const __GNU_LIBRARY__: u32 = 6;
|
||||
pub const __GLIBC__: u32 = 2;
|
||||
pub const __GLIBC_MINOR__: u32 = 33;
|
||||
pub const _SYS_CDEFS_H: u32 = 1;
|
||||
pub const __glibc_c99_flexarr_available: u32 = 1;
|
||||
pub const __WORDSIZE: u32 = 64;
|
||||
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
|
||||
pub const __SYSCALL_WORDSIZE: u32 = 64;
|
||||
pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
|
||||
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
|
||||
pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
|
||||
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
|
||||
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
|
||||
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
|
||||
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
|
||||
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
|
||||
pub const _BITS_TYPES_H: u32 = 1;
|
||||
pub const __TIMESIZE: u32 = 64;
|
||||
pub const _BITS_TYPESIZES_H: u32 = 1;
|
||||
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
|
||||
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
|
||||
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
|
||||
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
|
||||
pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
|
||||
pub const __FD_SETSIZE: u32 = 1024;
|
||||
pub const _BITS_TIME64_H: u32 = 1;
|
||||
pub const _BITS_WCHAR_H: u32 = 1;
|
||||
pub const _BITS_STDINT_INTN_H: u32 = 1;
|
||||
pub const _BITS_STDINT_UINTN_H: u32 = 1;
|
||||
pub const INT8_MIN: i32 = -128;
|
||||
pub const INT16_MIN: i32 = -32768;
|
||||
pub const INT32_MIN: i32 = -2147483648;
|
||||
pub const INT8_MAX: u32 = 127;
|
||||
pub const INT16_MAX: u32 = 32767;
|
||||
pub const INT32_MAX: u32 = 2147483647;
|
||||
pub const UINT8_MAX: u32 = 255;
|
||||
pub const UINT16_MAX: u32 = 65535;
|
||||
pub const UINT32_MAX: u32 = 4294967295;
|
||||
pub const INT_LEAST8_MIN: i32 = -128;
|
||||
pub const INT_LEAST16_MIN: i32 = -32768;
|
||||
pub const INT_LEAST32_MIN: i32 = -2147483648;
|
||||
pub const INT_LEAST8_MAX: u32 = 127;
|
||||
pub const INT_LEAST16_MAX: u32 = 32767;
|
||||
pub const INT_LEAST32_MAX: u32 = 2147483647;
|
||||
pub const UINT_LEAST8_MAX: u32 = 255;
|
||||
pub const UINT_LEAST16_MAX: u32 = 65535;
|
||||
pub const UINT_LEAST32_MAX: u32 = 4294967295;
|
||||
pub const INT_FAST8_MIN: i32 = -128;
|
||||
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
|
||||
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
|
||||
pub const INT_FAST8_MAX: u32 = 127;
|
||||
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
|
||||
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
|
||||
pub const UINT_FAST8_MAX: u32 = 255;
|
||||
pub const UINT_FAST16_MAX: i32 = -1;
|
||||
pub const UINT_FAST32_MAX: i32 = -1;
|
||||
pub const INTPTR_MIN: i64 = -9223372036854775808;
|
||||
pub const INTPTR_MAX: u64 = 9223372036854775807;
|
||||
pub const UINTPTR_MAX: i32 = -1;
|
||||
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
|
||||
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
|
||||
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
|
||||
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
|
||||
pub const SIZE_MAX: i32 = -1;
|
||||
pub const WINT_MIN: u32 = 0;
|
||||
pub const WINT_MAX: u32 = 4294967295;
|
||||
pub type __u_char = ::std::os::raw::c_uchar;
|
||||
pub type __u_short = ::std::os::raw::c_ushort;
|
||||
pub type __u_int = ::std::os::raw::c_uint;
|
||||
pub type __u_long = ::std::os::raw::c_ulong;
|
||||
pub type __int8_t = ::std::os::raw::c_schar;
|
||||
pub type __uint8_t = ::std::os::raw::c_uchar;
|
||||
pub type __int16_t = ::std::os::raw::c_short;
|
||||
pub type __uint16_t = ::std::os::raw::c_ushort;
|
||||
pub type __int32_t = ::std::os::raw::c_int;
|
||||
pub type __uint32_t = ::std::os::raw::c_uint;
|
||||
pub type __int64_t = ::std::os::raw::c_long;
|
||||
pub type __uint64_t = ::std::os::raw::c_ulong;
|
||||
pub type __int_least8_t = __int8_t;
|
||||
pub type __uint_least8_t = __uint8_t;
|
||||
pub type __int_least16_t = __int16_t;
|
||||
pub type __uint_least16_t = __uint16_t;
|
||||
pub type __int_least32_t = __int32_t;
|
||||
pub type __uint_least32_t = __uint32_t;
|
||||
pub type __int_least64_t = __int64_t;
|
||||
pub type __uint_least64_t = __uint64_t;
|
||||
pub type __quad_t = ::std::os::raw::c_long;
|
||||
pub type __u_quad_t = ::std::os::raw::c_ulong;
|
||||
pub type __intmax_t = ::std::os::raw::c_long;
|
||||
pub type __uintmax_t = ::std::os::raw::c_ulong;
|
||||
pub type __dev_t = ::std::os::raw::c_ulong;
|
||||
pub type __uid_t = ::std::os::raw::c_uint;
|
||||
pub type __gid_t = ::std::os::raw::c_uint;
|
||||
pub type __ino_t = ::std::os::raw::c_ulong;
|
||||
pub type __ino64_t = ::std::os::raw::c_ulong;
|
||||
pub type __mode_t = ::std::os::raw::c_uint;
|
||||
pub type __nlink_t = ::std::os::raw::c_ulong;
|
||||
pub type __off_t = ::std::os::raw::c_long;
|
||||
pub type __off64_t = ::std::os::raw::c_long;
|
||||
pub type __pid_t = ::std::os::raw::c_int;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct __fsid_t {
|
||||
pub __val: [::std::os::raw::c_int; 2usize],
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout___fsid_t() {
|
||||
const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit();
|
||||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__fsid_t>(),
|
||||
8usize,
|
||||
concat!("Size of: ", stringify!(__fsid_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__fsid_t>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(__fsid_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__fsid_t),
|
||||
"::",
|
||||
stringify!(__val)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub type __clock_t = ::std::os::raw::c_long;
|
||||
pub type __rlim_t = ::std::os::raw::c_ulong;
|
||||
pub type __rlim64_t = ::std::os::raw::c_ulong;
|
||||
pub type __id_t = ::std::os::raw::c_uint;
|
||||
pub type __time_t = ::std::os::raw::c_long;
|
||||
pub type __useconds_t = ::std::os::raw::c_uint;
|
||||
pub type __suseconds_t = ::std::os::raw::c_long;
|
||||
pub type __suseconds64_t = ::std::os::raw::c_long;
|
||||
pub type __daddr_t = ::std::os::raw::c_int;
|
||||
pub type __key_t = ::std::os::raw::c_int;
|
||||
pub type __clockid_t = ::std::os::raw::c_int;
|
||||
pub type __timer_t = *mut ::std::os::raw::c_void;
|
||||
pub type __blksize_t = ::std::os::raw::c_long;
|
||||
pub type __blkcnt_t = ::std::os::raw::c_long;
|
||||
pub type __blkcnt64_t = ::std::os::raw::c_long;
|
||||
pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
|
||||
pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
|
||||
pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
|
||||
pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
|
||||
pub type __fsword_t = ::std::os::raw::c_long;
|
||||
pub type __ssize_t = ::std::os::raw::c_long;
|
||||
pub type __syscall_slong_t = ::std::os::raw::c_long;
|
||||
pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
|
||||
pub type __loff_t = __off64_t;
|
||||
pub type __caddr_t = *mut ::std::os::raw::c_char;
|
||||
pub type __intptr_t = ::std::os::raw::c_long;
|
||||
pub type __socklen_t = ::std::os::raw::c_uint;
|
||||
pub type __sig_atomic_t = ::std::os::raw::c_int;
|
||||
pub type int_least8_t = __int_least8_t;
|
||||
pub type int_least16_t = __int_least16_t;
|
||||
pub type int_least32_t = __int_least32_t;
|
||||
pub type int_least64_t = __int_least64_t;
|
||||
pub type uint_least8_t = __uint_least8_t;
|
||||
pub type uint_least16_t = __uint_least16_t;
|
||||
pub type uint_least32_t = __uint_least32_t;
|
||||
pub type uint_least64_t = __uint_least64_t;
|
||||
pub type int_fast8_t = ::std::os::raw::c_schar;
|
||||
pub type int_fast16_t = ::std::os::raw::c_long;
|
||||
pub type int_fast32_t = ::std::os::raw::c_long;
|
||||
pub type int_fast64_t = ::std::os::raw::c_long;
|
||||
pub type uint_fast8_t = ::std::os::raw::c_uchar;
|
||||
pub type uint_fast16_t = ::std::os::raw::c_ulong;
|
||||
pub type uint_fast32_t = ::std::os::raw::c_ulong;
|
||||
pub type uint_fast64_t = ::std::os::raw::c_ulong;
|
||||
pub type intmax_t = __intmax_t;
|
||||
pub type uintmax_t = __uintmax_t;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct MGBA {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct video_buffer {
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
pub buffer: *mut u32,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_video_buffer() {
|
||||
const UNINIT: ::std::mem::MaybeUninit<video_buffer> = ::std::mem::MaybeUninit::uninit();
|
||||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<video_buffer>(),
|
||||
16usize,
|
||||
concat!("Size of: ", stringify!(video_buffer))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<video_buffer>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(video_buffer))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(video_buffer),
|
||||
"::",
|
||||
stringify!(width)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
|
||||
4usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(video_buffer),
|
||||
"::",
|
||||
stringify!(height)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(video_buffer),
|
||||
"::",
|
||||
stringify!(buffer)
|
||||
)
|
||||
);
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct callback {
|
||||
pub data: *mut ::std::os::raw::c_void,
|
||||
pub callback: ::std::option::Option<
|
||||
unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void, arg2: *mut ::std::os::raw::c_char),
|
||||
>,
|
||||
pub destroy: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_callback() {
|
||||
const UNINIT: ::std::mem::MaybeUninit<callback> = ::std::mem::MaybeUninit::uninit();
|
||||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<callback>(),
|
||||
24usize,
|
||||
concat!("Size of: ", stringify!(callback))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<callback>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(callback))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(callback),
|
||||
"::",
|
||||
stringify!(data)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(callback),
|
||||
"::",
|
||||
stringify!(callback)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { ::std::ptr::addr_of!((*ptr).destroy) as usize - ptr as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(callback),
|
||||
"::",
|
||||
stringify!(destroy)
|
||||
)
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn new_runner(filename: *mut ::std::os::raw::c_char) -> *mut MGBA;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn free_runner(mgba: *mut MGBA);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn set_logger(arg1: *mut MGBA, arg2: callback);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn advance_frame(mgba: *mut MGBA);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn get_video_buffer(mgba: *mut MGBA) -> video_buffer;
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
#![allow(clippy::all)]
|
||||
|
||||
mod bindings;
|
||||
mod runner;
|
||||
|
||||
use anyhow::{anyhow, Error};
|
||||
use image::io::Reader;
|
||||
use image::GenericImage;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use crate::bindings;
|
||||
|
||||
use std::ffi::c_void;
|
||||
use std::ffi::CStr;
|
||||
use std::ffi::CString;
|
||||
|
@ -9,9 +11,6 @@ use std::os::raw::c_char;
|
|||
non_camel_case_types,
|
||||
non_snake_case
|
||||
)]
|
||||
mod bindings {
|
||||
include!(concat!(env!("OUT_DIR"), "/runner-bindings.rs"));
|
||||
}
|
||||
|
||||
pub struct MGBA {
|
||||
mgba: *mut bindings::MGBA,
|
||||
|
|
Loading…
Reference in a new issue