diff --git a/Cargo.lock b/Cargo.lock index 8f205ef..ec3ca47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,17 +4,17 @@ version = 3 [[package]] name = "bindgen" -version = "0.65.1" +version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ "bitflags", "cexpr", "clang-sys", + "itertools", "lazy_static", "lazycell", "log", - "peeking_take_while", "prettyplease", "proc-macro2", "quote", @@ -27,9 +27,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.2.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "cexpr" @@ -69,6 +69,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -134,17 +143,11 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "prettyplease" -version = "0.2.4" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ceca8aaf45b5c46ec7ed39fff75f57290368c1846d33d24a122ca81416ab058" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", "syn", @@ -152,18 +155,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.27" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -197,16 +200,16 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "simconnect" -version = "0.3.1" +version = "0.3.2" dependencies = [ "bindgen", ] [[package]] name = "syn" -version = "2.0.15" +version = "2.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index ab14675..2a1c35d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "simconnect" license = "MIT" description = "Rust bindings for SimConnect" -version = "0.3.1" +version = "0.3.2" authors = ["Connor T"] edition = "2018" @@ -20,4 +20,4 @@ name = "aircraft_inputs" path = "examples/aircraft_inputs/main.rs" [build-dependencies] -bindgen = "0.65" +bindgen = "0.69.4" diff --git a/Readme.md b/Readme.md index 3e61ad5..86f4109 100644 --- a/Readme.md +++ b/Readme.md @@ -1,24 +1,30 @@ ![crates.io](https://img.shields.io/crates/v/simconnect) + # SimConnect Bindings for Rust ## Requirements + - [CLang](https://clang.llvm.org/get_started.html) (See the [Rust Bindgen Documentation](https://rust-lang.github.io/rust-bindgen/requirements.html)) - MSVC x64 Rust build (`x86_64-pc-windows-msvc`, see [The rustup book](https://rust-lang.github.io/rustup/installation/windows.html)) ## Using + Add this to your `Cargo.toml` + ```toml [dependencies] -simconnect = "0.3.1" +simconnect = "0.3.2" ``` ## Building -*The SimConnect binaries are included within this repository, but they may not be up-to-date.* + +_The SimConnect binaries are included within this repository, but they may not be up-to-date._ 1. run `cargo build` 2. Add `use simconnect` at the top of your file ## Example + Read float position data ``` @@ -26,11 +32,13 @@ cargo run --example aircraft_updates ``` Requests tagged data with thresholds from SimConnect and reads floats/strings + ``` cargo run --example aircraft_updates_on_change ``` -*You must have SimConnect.dll in the same directory as the compiled exe for it to run (e.g. in )* +_You must have SimConnect.dll in the same directory as the compiled exe for it to run (e.g. in )_ ### Remarks + I have not tested every single function from the api. If you find an error, feel free to make an issue or a pull request. diff --git a/SimConnect.dll b/SimConnect.dll index da40b73..2aa284c 100644 Binary files a/SimConnect.dll and b/SimConnect.dll differ diff --git a/build.rs b/build.rs index de6db9c..e43d4da 100644 --- a/build.rs +++ b/build.rs @@ -6,7 +6,7 @@ fn main() { let bindings = bindgen::Builder::default() .header("libsrc/include/SimConnect.hpp") - .parse_callbacks(Box::new(bindgen::CargoCallbacks)) + .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) .allowlist_var("SIMCONNECT_UNUSED") .allowlist_var("SIMCONNECT_OBJECT_ID_USER") .allowlist_var("SIMCONNECT_CAMERA_IGNORE_FIELD") @@ -66,6 +66,7 @@ fn main() { .allowlist_var("UNKNOWN_GROUP") .allowlist_var("SIMCONNECT_CLOUD_STATE_ARRAY_WIDTH") .allowlist_var("SIMCONNECT_CLOUD_STATE_ARRAY_SIZE") + .allowlist_type("HANDLE") .allowlist_type("SIMCONNECT_RECV_ID") .allowlist_type("SIMCONNECT_DATATYPE") .allowlist_type("SIMCONNECT_EXCEPTION") diff --git a/libsrc/include/SimConnect.hpp b/libsrc/include/SimConnect.hpp index 99cbf68..0da2083 100644 --- a/libsrc/include/SimConnect.hpp +++ b/libsrc/include/SimConnect.hpp @@ -4,7 +4,7 @@ // //----------------------------------------------------------------------------- -#include "Windows.h" +#include #ifndef _SIMCONNECT_H_ #define _SIMCONNECT_H_