├── .cargo └── config ├── .gitignore ├── Cargo.toml ├── LICENSE.txt ├── README.md ├── build.rs ├── crates └── bakkesmod-macros │ ├── Cargo.toml │ └── src │ └── lib.rs ├── examples ├── canvastest │ ├── Cargo.toml │ ├── make.bat │ └── src │ │ └── lib.rs ├── rustplugin │ ├── Cargo.toml │ └── src │ │ └── lib.rs └── tinyplugin │ ├── Cargo.toml │ └── src │ └── lib.rs ├── make.bat └── src ├── console.rs ├── errors.rs ├── game.rs ├── internal.rs ├── lib.rs ├── macros.rs └── wrappers ├── canvas.rs ├── cvar.rs ├── macros.rs ├── mmr.rs ├── mod.rs ├── structs.rs └── unreal ├── actor.rs ├── air_control_component.rs ├── attachment_pickup.rs ├── ball.rs ├── ball_car_spring_pickup.rs ├── ball_freeze_pickup.rs ├── ball_lasso_pickup.rs ├── base_camera.rs ├── battarang_pickup.rs ├── boost.rs ├── boost_mod_pickup.rs ├── boost_override_pickup.rs ├── boost_pickup.rs ├── camera.rs ├── camera_x.rs ├── car.rs ├── car_component.rs ├── car_speed_pickup.rs ├── demolish_pickup.rs ├── dodge_component.rs ├── double_jump_component.rs ├── engine_ta.rs ├── flip_car_component.rs ├── fx_actor.rs ├── game_editor.rs ├── game_editor_save_data.rs ├── game_event.rs ├── game_setting_playlist.rs ├── goal.rs ├── grappling_hook_pickup.rs ├── gravity_pickup.rs ├── handbrake_override_pickup.rs ├── hit_force_pickup.rs ├── input_buffer_graph.rs ├── jump_component.rs ├── mod.rs ├── net_stat_graph.rs ├── perf_stat_graph.rs ├── physical_material_property.rs ├── player_controller.rs ├── player_replication_info.rs ├── pri.rs ├── pri_x.rs ├── primitive_component.rs ├── rb_actor.rs ├── replay.rs ├── replay_director.rs ├── replay_soccar.rs ├── rumble_pickup_component.rs ├── sample_history.rs ├── sample_record_settings.rs ├── save_data.rs ├── server.rs ├── spring_pickup.rs ├── stat_graph.rs ├── stat_graph_system.rs ├── swapper_pickup.rs ├── targeted_pickup.rs ├── team.rs ├── team_game_event.rs ├── team_info.rs ├── time_bomb_pickup.rs ├── tornado_pickup.rs ├── training_editor.rs ├── training_editor_save_data.rs ├── tutorial.rs ├── vehicle.rs ├── vehicle_pickup.rs ├── vehicle_sim.rs ├── velcro_pickup.rs └── wheel.rs /.cargo/config: -------------------------------------------------------------------------------- 1 | [target.x86_64-pc-windows-msvc] 2 | rustflags = ["-Ctarget-feature=+crt-static"] 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bakkesmod" 3 | version = "0.2.1" 4 | authors = ["Arator"] 5 | edition = "2018" 6 | description = "Rust SDK for writing BakkesMod plugins." 7 | license = "MIT" 8 | repository = "https://github.com/AratorRL/bakkesmod-rust" 9 | 10 | [dependencies] 11 | bakkesmod-macros = { path = "crates/bakkesmod-macros", version = "0.1.1" } 12 | 13 | [lib] 14 | name = "bakkesmod" 15 | 16 | [workspace] 17 | members = [ 18 | "crates/bakkesmod-macros", 19 | "examples/rustplugin", 20 | "examples/tinyplugin", 21 | "examples/canvastest" 22 | ] 23 | 24 | [package.metadata.docs.rs] 25 | rustc-args = ["--cfg", "docsrs"] -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Bart van der Vecht 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust SDK for BakkesMod plugins 2 | Crates.io version 3 | docs.rs docs 4 | 5 | [Go to the documentation](https://docs.rs/bakkesmod) 6 | 7 | ## Example 8 | ```rust 9 | use bakkesmod::prelude::*; 10 | use bakkesmod::wrappers::unreal::*; 11 | use bakkesmod::{game, console}; 12 | 13 | #[plugin_init] 14 | pub fn on_load() { 15 | console::register_notifier("get_ball_location", Box::new(move |_: Vec| { 16 | let game = match bakkesmod::get_game_event_as_server() { 17 | Some(g) => g, 18 | None => { 19 | log_console!("game is null!"); 20 | return; 21 | } 22 | }; 23 | 24 | match game.get_ball() { 25 | Some(ball) => log_console!("{}", ball.get_location()), 26 | None => log_console!("ball is NULL") 27 | }; 28 | })); 29 | } 30 | ``` 31 | 32 | View more examples in the [examples directory](https://github.com/AratorRL/bakkesmod-rust/tree/master/examples). -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | #[cfg(docsrs)] 4 | fn main() {} 5 | 6 | #[cfg(not(docsrs))] 7 | fn main() { 8 | let bakkesmod_path = env::var("BAKKESMOD_LIB_PATH") 9 | .expect("enviroment variable 'BAKKESMOD_LIB_PATH' not set!"); 10 | 11 | println!("cargo:rustc-link-search={}", bakkesmod_path); 12 | println!("cargo:rustc-link-lib=pluginsdk"); 13 | } -------------------------------------------------------------------------------- /crates/bakkesmod-macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bakkesmod-macros" 3 | version = "0.1.1" 4 | authors = ["Arator"] 5 | edition = "2018" 6 | description = "Procedural macros for the bakkesmod crate" 7 | license = "MIT" 8 | repository = "https://github.com/AratorRL/bakkesmod-rust" 9 | 10 | [lib] 11 | proc-macro = true 12 | 13 | [dependencies] 14 | syn = { version = "1.0", features = ['visit', 'full'] } 15 | quote = "1.0" 16 | proc-macro2 = "1.0" 17 | -------------------------------------------------------------------------------- /crates/bakkesmod-macros/src/lib.rs: -------------------------------------------------------------------------------- 1 | extern crate proc_macro; 2 | 3 | use proc_macro::TokenStream; 4 | use quote::quote; 5 | 6 | #[proc_macro_attribute] 7 | pub fn plugin_init(_attr: TokenStream, input: TokenStream) -> TokenStream { 8 | let parsed_input: syn::ItemFn = syn::parse_macro_input!(input as syn::ItemFn); 9 | let name = parsed_input.clone().sig.ident; 10 | 11 | let tokens = quote! { 12 | #parsed_input 13 | 14 | #[no_mangle] 15 | pub extern "C" fn InitPlugin(id: u64) { 16 | bakkesmod_init(id); 17 | #name(); 18 | } 19 | 20 | #[no_mangle] 21 | pub extern "C" fn ExitPlugin() { 22 | bakkesmod_exit(); 23 | } 24 | }; 25 | 26 | tokens.into() 27 | } -------------------------------------------------------------------------------- /examples/canvastest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "canvastest" 3 | version = "0.1.0" 4 | authors = ["Arator "] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | bakkesmod = { path = "../../" } 9 | 10 | [lib] 11 | name = "canvastest" 12 | crate_type = ["cdylib"] -------------------------------------------------------------------------------- /examples/canvastest/make.bat: -------------------------------------------------------------------------------- 1 | cargo build 2 | copy "..\..\target\debug\canvastest.dll" "%BAKKESMOD_PLUGINS_PATH%\canvastest.dll" -------------------------------------------------------------------------------- /examples/canvastest/src/lib.rs: -------------------------------------------------------------------------------- 1 | use bakkesmod::prelude::*; 2 | use bakkesmod::game; 3 | use bakkesmod::wrappers::canvas::Canvas; 4 | 5 | #[plugin_init] 6 | fn on_load() { 7 | log_console!("This is the canvastest plugin."); 8 | 9 | game::register_drawable(Box::new(move |canvas: Canvas| { 10 | let red = lin_color!(255.0, 0, 0, 255.0); 11 | canvas.set_color(red); 12 | canvas.set_position(vec2!(100, 100)); 13 | canvas.draw_string("henlo"); 14 | 15 | canvas.set_color_chars(0, 255, 0, 255); 16 | canvas.set_position(vec2!(500, 200)); 17 | canvas.draw_string_scale("big green text", 5.0, 5.0); 18 | 19 | canvas.set_color(lin_color!(0, 0, 255, 255)); 20 | canvas.set_position(vec2!(300, 300)); 21 | canvas.fill_triangle(vec2!(300, 100), vec2!(400, 200), vec2!(200, 200)); 22 | })); 23 | 24 | log_console!("Drawables have been registered."); 25 | } -------------------------------------------------------------------------------- /examples/rustplugin/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rustplugin" 3 | version = "0.1.0" 4 | authors = ["Arator"] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | bakkesmod = { path = "../../" } 9 | 10 | [lib] 11 | name = "rustplugin" 12 | crate_type = ["cdylib"] -------------------------------------------------------------------------------- /examples/rustplugin/src/lib.rs: -------------------------------------------------------------------------------- 1 | use std::rc::Rc; 2 | use std::cell::RefCell; 3 | 4 | use bakkesmod::prelude::*; 5 | use bakkesmod::game; 6 | use bakkesmod::console; 7 | use bakkesmod::wrappers::cvar::CVar; 8 | use bakkesmod::wrappers::canvas::Canvas; 9 | use bakkesmod::wrappers::unreal::*; 10 | 11 | #[plugin_init] 12 | pub fn on_load() { 13 | console::register_notifier("rust_demolish", Box::new(move |_: Vec| { 14 | match game::get_local_car() { 15 | Some(car) => car.demolish(), 16 | None => log_console!("Car is NULL") 17 | }; 18 | })); 19 | 20 | console::register_notifier("rust_notifier", Box::new(normal_function_callback)); 21 | 22 | console::register_notifier("rust_set_loc", Box::new(move |_: Vec| { 23 | match game::get_local_car() { 24 | Some(car) => { 25 | let origin = vec3!(0.0, 0.0, 0.0); 26 | let new_loc = origin + vec3!(200.0, 1000.0, 50.0); 27 | car.set_location(new_loc); 28 | } 29 | None => log_console!("Car is NULL") 30 | }; 31 | })); 32 | 33 | let cvar = console::register_cvar("rust_cvar"); 34 | log_console!("cvar name = {}", cvar.get_name()); 35 | 36 | console::register_notifier("rust_set_gravity", Box::new(move |params: Vec| { 37 | if params.len() < 2 { 38 | log_console!("not enough parameters!"); 39 | return; 40 | } 41 | 42 | let new_value_str = ¶ms[1]; 43 | let new_value: f32 = match new_value_str.parse::() { 44 | Ok(val) => val, 45 | Err(_) => { log_console!("invalid input!"); return; } 46 | }; 47 | 48 | match console::get_cvar("sv_soccar_gravity") { 49 | Some(cvar) => { 50 | log_console!("current value: {}", cvar.get_float_value()); 51 | log_console!("setting to {}", new_value); 52 | cvar.set_float_value(new_value); 53 | } 54 | None => log_console!("cvar 'sv_soccar_gravity' not found") 55 | }; 56 | })); 57 | 58 | console::add_on_value_changed(&cvar, Box::new(move |_: String, cvar: CVar| { 59 | log_console!("cvar {} has a new value: {}", cvar.get_name(), cvar.get_string_value()); 60 | })); 61 | 62 | console::register_cvar("rust_ticker"); 63 | 64 | let counter_base = Rc::new(RefCell::new(0)); 65 | let counter_ref = Rc::clone(&counter_base); 66 | 67 | game::hook_event("Function Engine.GameViewportClient.Tick", Box::new(move || { 68 | let ticker = console::get_cvar("rust_ticker").unwrap(); 69 | if !ticker.get_bool_value() { 70 | return; 71 | } 72 | 73 | let mut counter = counter_ref.borrow_mut(); 74 | *counter += 1; 75 | if (*counter % 240) == 0 { 76 | // log_console!("viewport client tick"); 77 | 78 | match game::get_local_car() { 79 | Some(car) => { 80 | let location = car.get_location(); 81 | log_console!("{}", location); 82 | 83 | let vehicle_sim = car.get_vehicle_sim().unwrap(); 84 | let wheels = vehicle_sim.get_wheels(); 85 | let wheel0 = wheels.get(0); 86 | log_console!("wheel 0 spin speed: {}", wheel0.get_spin_speed()); 87 | let wheel3 = wheels.get(3); 88 | log_console!("wheel 3 spin speed: {}", wheel3.get_spin_speed()); 89 | } 90 | None => log_console!("Car is NULL") 91 | }; 92 | } 93 | })); 94 | 95 | game::register_drawable(Box::new(move |canvas: Canvas| { 96 | let top_left = vec2!(100, 100); 97 | let width = vec2!(250, 0); 98 | let height = vec2!(0, 150); 99 | canvas.draw_line(top_left, top_left + width); 100 | canvas.draw_line(top_left + width, top_left + width + height); 101 | canvas.draw_line(top_left, top_left + height); 102 | canvas.draw_line(top_left + height, top_left + width + height); 103 | })); 104 | 105 | game::hook_event_with_caller_post( 106 | "Function TAGame.Car_TA.ApplyBallImpactForces", 107 | Box::new(move |car: Box| { 108 | log_console!("Ball hit!"); 109 | log_console!("car location: {}", car.get_location()); 110 | }) 111 | ); 112 | 113 | console::register_notifier("rust_set_timer", Box::new(move |params: Vec| { 114 | if params.len() < 2 { 115 | log_console!("not enough parameters!"); 116 | } else { 117 | let time_param = ¶ms[1]; 118 | let time: f32 = match time_param.parse::() { 119 | Ok(secs) => secs, 120 | Err(_) => { log_console!("invalid input!"); return; } 121 | }; 122 | game::set_timeout(Box::new(move || { 123 | log_console!("{} secs have passed!", time); 124 | }), time); 125 | } 126 | })); 127 | 128 | console::register_notifier("rust_get_ball_info", Box::new(move |_: Vec| { 129 | let game = match game::get_game_event_as_server() { 130 | Some(g) => g, 131 | None => { 132 | log_console!("game is null!"); 133 | return; 134 | } 135 | }; 136 | 137 | match game.get_ball() { 138 | Some(ball) => log_console!("{}", ball.get_location()), 139 | None => log_console!("ball is NULL") 140 | }; 141 | 142 | })); 143 | 144 | console::register_notifier("rust_spawn_car", Box::new(spawn_car_callback)); 145 | } 146 | 147 | fn normal_function_callback(params: Vec) { 148 | log_console!("this is the callback for rust_notifier!"); 149 | log_console!("params = {:x?}", params); 150 | } 151 | 152 | fn spawn_car_callback(_: Vec) { 153 | let game = match game::get_game_event_as_server() { 154 | Some(g) => g, 155 | None => { 156 | log_console!("game is null!"); 157 | return; 158 | } 159 | }; 160 | 161 | game.spawn_bot(22, "Bors"); 162 | } -------------------------------------------------------------------------------- /examples/tinyplugin/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tinyplugin" 3 | version = "0.1.0" 4 | authors = ["Arator "] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | bakkesmod = { path = "../../" } 9 | 10 | [lib] 11 | name = "tinyplugin" 12 | crate_type = ["cdylib"] -------------------------------------------------------------------------------- /examples/tinyplugin/src/lib.rs: -------------------------------------------------------------------------------- 1 | use bakkesmod::prelude::*; 2 | use bakkesmod::wrappers::unreal::*; 3 | use bakkesmod::{game, console}; 4 | 5 | #[plugin_init] 6 | pub fn on_load() { 7 | console::register_notifier("set_ball_location", Box::new(move |_: Vec| { 8 | let game = match game::get_game_event_as_server() { 9 | Some(g) => g, 10 | None => { 11 | log_console!("game is null!"); 12 | return; 13 | } 14 | }; 15 | 16 | match game.get_ball() { 17 | Some(ball) => log_console!("{}", ball.get_location()), 18 | None => log_console!("ball is null") 19 | }; 20 | })); 21 | } -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | cargo build -p rustplugin 2 | copy "target\debug\rustplugin.dll" "%BAKKESMOD_PLUGINS_PATH%\rustplugin.dll" 3 | 4 | cargo build -p tinyplugin 5 | copy "target\debug\tinyplugin.dll" "%BAKKESMOD_PLUGINS_PATH%\tinyplugin.dll" 6 | 7 | cargo build -p canvastest 8 | copy "target\debug\canvastest.dll" "%BAKKESMOD_PLUGINS_PATH%\canvastest.dll" -------------------------------------------------------------------------------- /src/console.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use std::ffi::{CString, CStr}; 4 | use std::os::raw::c_char; 5 | 6 | use crate::log_console; 7 | use crate::errors::BakkesModError; 8 | 9 | use crate::internal; 10 | use crate::internal::{NotifierCallback, OnValueChangedCallback}; 11 | use crate::wrappers::cvar::CVar; 12 | 13 | 14 | 15 | pub fn console_print(text: &str) { 16 | let id = internal::bakkesmod().id(); 17 | let c_text = CString::new(text).unwrap(); 18 | let c_text: *const c_char = c_text.as_ptr(); 19 | unsafe { LogConsole(id, c_text); } 20 | } 21 | 22 | 23 | pub fn register_notifier(name: &str, callback: Box) { 24 | let callback = Box::new(callback); 25 | let cb_addr = Box::into_raw(callback) as usize; 26 | 27 | let bm = internal::bakkesmod(); 28 | bm.add_notifier_callback(cb_addr); 29 | 30 | let id = bm.id(); 31 | let c_name = CString::new(name).unwrap(); 32 | let c_name: *const c_char = c_name.as_ptr(); 33 | let c_desc= CString::new("").unwrap(); 34 | let c_desc: *const c_char = c_desc.as_ptr(); 35 | let c_callback = notifier_callback as usize; 36 | 37 | unsafe { RegisterNotifier(id, cb_addr, c_name, c_callback, c_desc, 0); } 38 | } 39 | 40 | extern "C" fn notifier_callback(addr: usize, params: *const *const c_char, len: u32) { 41 | if len <= 0 { log_console!("callback called but len is <= 0 !"); return; } 42 | 43 | let params_ptr_ptr = params as *const *const c_char; 44 | if params_ptr_ptr.is_null() { log_console!("ptr to params ptr is null!"); return; } 45 | 46 | let mut rust_params: Vec = Vec::new(); 47 | 48 | for i in 0..len { 49 | let params_ptr = unsafe { *(params_ptr_ptr.offset(i as isize)) as *const c_char }; 50 | if params_ptr.is_null() { log_console!("params ptr is null!"); return; } 51 | 52 | let params_c_str = unsafe { CStr::from_ptr(params_ptr) }; 53 | match params_c_str.to_str() { 54 | Ok(s) => rust_params.push(String::from(s)), 55 | Err(_) => { log_console!("params null"); return; } 56 | }; 57 | } 58 | 59 | let mut closure = unsafe { Box::from_raw(addr as *mut Box) }; 60 | closure(rust_params); 61 | let _ = Box::into_raw(closure); 62 | } 63 | 64 | pub fn remove_notifier(name: &str) -> Result<(), Box> { 65 | let bm = internal::bakkesmod(); 66 | let id = bm.id(); 67 | let c_name = CString::new(name).unwrap(); 68 | let c_name: *const c_char = c_name.as_ptr(); 69 | 70 | unsafe { 71 | if RemoveNotifier(id, c_name) { 72 | Ok(()) 73 | } else { 74 | bakkesmod_error!("Could not remove notifier {}", name) 75 | } 76 | } 77 | } 78 | 79 | pub fn register_cvar(name: &str) -> CVar { 80 | let id = internal::bakkesmod().id(); 81 | let c_name = CString::new(name).unwrap(); 82 | let c_name: *const c_char = c_name.as_ptr(); 83 | let c_defval = CString::new("").unwrap(); 84 | let c_defval: *const c_char = c_defval.as_ptr(); 85 | let c_desc= CString::new("").unwrap(); 86 | let c_desc: *const c_char = c_desc.as_ptr(); 87 | let cvar = unsafe { 88 | RegisterCVar(id, c_name, c_defval, c_desc, true, false, 0.0, false, 0.0, false) 89 | }; 90 | CVar::new(cvar) 91 | } 92 | 93 | pub fn remove_cvar(name: &str) -> Result<(), Box> { 94 | let bm = internal::bakkesmod(); 95 | let id = bm.id(); 96 | let c_name = CString::new(name).unwrap(); 97 | let c_name: *const c_char = c_name.as_ptr(); 98 | 99 | unsafe { 100 | if RemoveCvar(id, c_name) { 101 | Ok(()) 102 | } else { 103 | bakkesmod_error!("Could not remove cvar {}", name) 104 | } 105 | } 106 | } 107 | 108 | pub fn get_cvar(name: &str) -> Option { 109 | let c_name = CString::new(name).unwrap(); 110 | let c_name: *const c_char = c_name.as_ptr(); 111 | let cvar = unsafe { 112 | GetCVar(c_name) 113 | }; 114 | 115 | match cvar { 116 | 0 => None, 117 | addr => Some(CVar::new(addr)) 118 | } 119 | } 120 | 121 | pub fn execute_command(command: &str, log: bool) { 122 | let c_string = CString::new(command).unwrap(); 123 | let c_string: *const c_char = c_string.as_ptr(); 124 | unsafe { ExecuteCommand(c_string, log); } 125 | } 126 | 127 | pub fn get_bind_string_for_key(key: &str) -> String { 128 | let c_string = CString::new(key).unwrap(); 129 | let c_string: *const c_char = c_string.as_ptr(); 130 | 131 | let result: *const c_char = 0 as *const c_char; 132 | let result_ptr: *const *const c_char = &result as *const *const c_char; 133 | 134 | unsafe { 135 | GetBindStringForKey(c_string, result_ptr); 136 | let result = *result_ptr; 137 | let c_result = CStr::from_ptr(result); 138 | match c_result.to_str() { 139 | Ok(s) => String::from(s), 140 | Err(_) => String::new() 141 | } 142 | } 143 | } 144 | 145 | pub fn set_bind(key: &str, command: &str) { 146 | let c_key = CString::new(key).unwrap(); 147 | let c_key: *const c_char = c_key.as_ptr(); 148 | let c_command = CString::new(command).unwrap(); 149 | let c_command: *const c_char = c_command.as_ptr(); 150 | 151 | unsafe { SetBind(c_key, c_command); } 152 | } 153 | 154 | pub fn get_alias(alias: &str) -> String { 155 | let c_string = CString::new(alias).unwrap(); 156 | let c_string: *const c_char = c_string.as_ptr(); 157 | 158 | let result: *const c_char = 0 as *const c_char; 159 | let result_ptr: *const *const c_char = &result as *const *const c_char; 160 | 161 | unsafe { 162 | GetAlias(c_string, result_ptr); 163 | let result = *result_ptr; 164 | let c_result = CStr::from_ptr(result); 165 | match c_result.to_str() { 166 | Ok(s) => String::from(s), 167 | Err(_) => String::new() 168 | } 169 | } 170 | } 171 | 172 | pub fn set_alias(key: &str, script: &str) { 173 | let c_key = CString::new(key).unwrap(); 174 | let c_key: *const c_char = c_key.as_ptr(); 175 | let c_script = CString::new(script).unwrap(); 176 | let c_script: *const c_char = c_script.as_ptr(); 177 | 178 | unsafe { SetBind(c_key, c_script); } 179 | } 180 | 181 | pub fn backup_cfg(path: &str) { 182 | let c_path = CString::new(path).unwrap(); 183 | let c_path: *const c_char = c_path.as_ptr(); 184 | unsafe { BackupCfg(c_path); } 185 | } 186 | 187 | pub fn backup_binds(path: &str) { 188 | let c_path = CString::new(path).unwrap(); 189 | let c_path: *const c_char = c_path.as_ptr(); 190 | unsafe { BackupBinds(c_path); } 191 | } 192 | 193 | pub fn load_cfg(path: &str) { 194 | let c_path = CString::new(path).unwrap(); 195 | let c_path: *const c_char = c_path.as_ptr(); 196 | unsafe { LoadCfg(c_path); } 197 | } 198 | 199 | pub fn add_on_value_changed(cvar: &CVar, callback: Box) { 200 | let callback = Box::new(callback); 201 | let cb_addr = Box::into_raw(callback) as usize; 202 | 203 | let bm = internal::bakkesmod(); 204 | bm.add_on_value_changed_callback(cb_addr); 205 | let id = bm.id(); 206 | 207 | let c_callback = on_value_changed_callback as usize; 208 | 209 | unsafe { CVar_AddOnValueChanged(cvar.addr(), id, cb_addr, c_callback); } 210 | } 211 | 212 | extern "C" fn on_value_changed_callback(addr: usize, _old: *const c_char, cvar: usize) { 213 | let mut closure = unsafe { Box::from_raw(addr as *mut Box) }; 214 | 215 | // TODO: use old string value 216 | closure(String::new(), CVar::new(cvar)); 217 | let _ = Box::into_raw(closure); 218 | } 219 | 220 | 221 | #[allow(unused)] 222 | extern "C" { 223 | fn LogConsole(id: u64, text: *const c_char); 224 | fn RegisterNotifier(id: u64, user_data: usize, cvar: *const c_char, callback: usize, description: *const c_char, permissions: u8); 225 | fn RemoveNotifier(id: u64, cvar: *const c_char) -> bool; 226 | fn RegisterCVar(id: u64, cvar: *const c_char, default_value: *const c_char, desc: *const c_char, searchable: bool, has_min: bool, min: f32, has_max: bool, max: f32, save_to_cfg: bool) -> usize; 227 | fn RemoveCvar(id: u64, cvar: *const c_char) -> bool; 228 | fn GetCVar(name: *const c_char) -> usize; 229 | 230 | fn ExecuteCommand(command: *const c_char, log: bool); 231 | fn GetBindStringForKey(key: *const c_char, result: *const *const c_char); 232 | fn SetBind(key: *const c_char, command: *const c_char); 233 | fn GetAlias(alias: *const c_char, result: *const *const c_char); 234 | fn SetAlias(key: *const c_char, script: *const c_char); 235 | fn BackupCfg(path: *const c_char); 236 | fn BackupBinds(path: *const c_char); 237 | fn LoadCfg(path: *const c_char); 238 | 239 | fn CVar_AddOnValueChanged(p_cvar: usize, id: u64, user_data: usize, callback: usize); 240 | fn CVar_RemoveOnValueChanged(p_cvar: usize, id: u64); 241 | } -------------------------------------------------------------------------------- /src/errors.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | use std::fmt; 3 | 4 | #[derive(Debug)] 5 | pub struct BakkesModError(String); 6 | impl Error for BakkesModError {} 7 | 8 | impl BakkesModError { 9 | pub fn new(msg: &str) -> BakkesModError { 10 | Self(msg.to_owned()) 11 | } 12 | } 13 | 14 | impl fmt::Display for BakkesModError { 15 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 16 | write!(f, "{}", self.0) 17 | } 18 | } 19 | 20 | #[macro_export] 21 | macro_rules! bakkesmod_error { 22 | ($($arg:tt)*) => ({ 23 | log_console!("Error: {}", &format!($($arg)*)); 24 | Err(Box::new(BakkesModError::new(&format!($($arg)*)))) 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /src/game.rs: -------------------------------------------------------------------------------- 1 | use std::ffi::CString; 2 | use std::os::raw::c_char; 3 | 4 | use crate::internal; 5 | use crate::internal::{ 6 | HookCallback, 7 | HookWithCallerCallback, 8 | HookWithCallerCallbackInternal, 9 | DrawableCallback, 10 | TimeoutCallback 11 | }; 12 | 13 | use crate::wrappers::Object; 14 | 15 | use crate::wrappers::unreal::{ 16 | CarWrapper, 17 | PlayerControllerWrapper, 18 | EngineTAWrapper, 19 | CameraWrapper, 20 | ServerWrapper, 21 | }; 22 | 23 | use crate::wrappers::canvas::Canvas; 24 | 25 | 26 | pub fn hook_event(name: &str, callback: Box) { 27 | hook_event_internal(name, callback, false); 28 | } 29 | 30 | pub fn hook_event_post(name: &str, callback: Box) { 31 | hook_event_internal(name, callback, true); 32 | } 33 | 34 | fn hook_event_internal(name: &str, callback: Box, post: bool) { 35 | let callback = Box::new(callback); 36 | let cb_addr = Box::into_raw(callback) as usize; 37 | 38 | let bm = internal::bakkesmod(); 39 | bm.add_hook_callback(cb_addr); 40 | 41 | let id = bm.id(); 42 | let c_name = CString::new(name).unwrap(); 43 | let c_name: *const c_char = c_name.as_ptr(); 44 | let c_callback = hook_callback as usize; 45 | 46 | if post { 47 | unsafe { HookEventPost(id, cb_addr, c_name, c_callback); } 48 | } else { 49 | unsafe { HookEvent(id, cb_addr, c_name, c_callback); } 50 | } 51 | } 52 | 53 | extern "C" fn hook_callback(addr: usize) { 54 | let mut closure = unsafe { Box::from_raw(addr as *mut Box) }; 55 | closure(); 56 | let _ = Box::into_raw(closure); 57 | } 58 | 59 | pub fn unhook_event(name: &str) { 60 | let id = internal::bakkesmod().id(); 61 | let c_name = CString::new(name).unwrap(); 62 | let c_name: *const c_char = c_name.as_ptr(); 63 | unsafe { UnhookEvent(id, c_name); } 64 | } 65 | 66 | pub fn hook_event_with_caller(name: &str, mut callback: Box>) { 67 | let wrapper_callback = Box::new(move |caller: usize, _params: usize| { 68 | let obj_wrapper = T::new(caller); 69 | callback(Box::new(obj_wrapper)); 70 | }); 71 | 72 | hook_event_with_caller_internal(name, wrapper_callback, false); 73 | } 74 | 75 | pub fn hook_event_with_caller_post(name: &str, mut callback: Box>) { 76 | let wrapper_callback = Box::new(move |caller: usize, _params: usize| { 77 | let obj_wrapper = T::new(caller); 78 | callback(Box::new(obj_wrapper)); 79 | }); 80 | 81 | hook_event_with_caller_internal(name, wrapper_callback, true); 82 | } 83 | 84 | fn hook_event_with_caller_internal(name: &str, callback: Box, post: bool) { 85 | let callback = Box::new(callback); 86 | let cb_addr = Box::into_raw(callback) as usize; 87 | 88 | let bm = internal::bakkesmod(); 89 | bm.add_hook_caller_callback(cb_addr); 90 | 91 | let id = bm.id(); 92 | let c_name = CString::new(name).unwrap(); 93 | let c_name: *const c_char = c_name.as_ptr(); 94 | let c_callback = hook_with_caller_callback as usize; 95 | 96 | if post { 97 | unsafe { HookEventWithCallerPost(id, cb_addr, c_name, c_callback); } 98 | } else { 99 | unsafe { HookEventWithCaller(id, cb_addr, c_name, c_callback); } 100 | } 101 | } 102 | 103 | extern "C" fn hook_with_caller_callback(addr: usize, caller: usize, params: usize) { 104 | let mut closure = unsafe { Box::from_raw(addr as *mut Box) }; 105 | closure(caller, params); 106 | let _ = Box::into_raw(closure); 107 | } 108 | 109 | pub fn register_drawable(callback: Box) { 110 | let callback = Box::new(callback); 111 | let cb_addr = Box::into_raw(callback) as usize; 112 | 113 | let bm = internal::bakkesmod(); 114 | bm.add_drawable_callback(cb_addr); 115 | 116 | let id = bm.id(); 117 | let c_callback = drawable_callback as usize; 118 | 119 | unsafe { RegisterDrawable(id, cb_addr, c_callback); } 120 | } 121 | 122 | extern "C" fn drawable_callback(addr: usize, canvas: usize) { 123 | let mut closure = unsafe { Box::from_raw(addr as *mut Box) }; 124 | let canvas = Canvas::new(canvas); 125 | closure(canvas); 126 | let _ = Box::into_raw(closure); 127 | } 128 | 129 | pub fn set_timeout(callback: Box, time: f32) { 130 | let callback = Box::new(callback); 131 | let cb_addr = Box::into_raw(callback) as usize; 132 | 133 | let bm = internal::bakkesmod(); 134 | bm.add_timeout_callback(cb_addr); 135 | 136 | let id = bm.id(); 137 | let c_callback = timeout_callback as usize; 138 | 139 | unsafe { SetTimeout(id, cb_addr, c_callback, time); } 140 | } 141 | 142 | pub fn execute(callback: Box) { 143 | set_timeout(callback, 0.0); 144 | } 145 | 146 | extern "C" fn timeout_callback(addr: usize) { 147 | let mut closure = unsafe { Box::from_raw(addr as *mut Box) }; 148 | closure(); 149 | let _ = Box::into_raw(closure); 150 | } 151 | 152 | 153 | pub fn is_in_game() -> bool { 154 | unsafe { IsInGame() } 155 | } 156 | 157 | pub fn is_in_online_game() -> bool { 158 | unsafe { IsInOnlineGame() } 159 | } 160 | 161 | pub fn is_in_freeplay() -> bool { 162 | unsafe { IsInFreeplay() } 163 | } 164 | 165 | pub fn is_in_custom_training() -> bool { 166 | unsafe { IsInCustomTraining() } 167 | } 168 | 169 | pub fn is_spectating_in_online_game() -> bool { 170 | unsafe { IsSpectatingInOnlineGame() } 171 | } 172 | 173 | pub fn is_paused() -> bool { 174 | unsafe { IsPaused() } 175 | } 176 | 177 | pub fn get_online_game() -> Option { 178 | unsafe { ServerWrapper::try_new(GetOnlineGame()) } 179 | } 180 | 181 | pub fn get_game_event_as_server() -> Option { 182 | unsafe { ServerWrapper::try_new(GetGameEventAsServer()) } 183 | } 184 | 185 | pub fn get_local_car() -> Option { 186 | unsafe { CarWrapper::try_new(GetLocalCar()) } 187 | } 188 | 189 | pub fn get_camera() -> Option { 190 | unsafe { CameraWrapper::try_new(GetCamera()) } 191 | } 192 | 193 | pub fn get_engine() -> Option { 194 | unsafe { EngineTAWrapper::try_new(GetEngine()) } 195 | } 196 | 197 | pub fn get_player_controller() -> Option { 198 | unsafe { PlayerControllerWrapper::try_new(GetPlayerController()) } 199 | } 200 | 201 | 202 | #[allow(unused)] 203 | extern "C" { 204 | fn HookEvent(id: u64, user_data: usize, event_name: *const c_char, callback: usize); 205 | fn HookEventPost(id: u64, user_data: usize, event_name: *const c_char, callback: usize); 206 | fn UnhookEvent(id: u64, event_name: *const c_char); 207 | fn HookEventWithCaller(id: u64, user_data: usize, event_name: *const c_char, callback: usize); 208 | fn HookEventWithCallerPost(id: u64, user_data: usize, event_name: *const c_char, callback: usize); 209 | fn UnhookEventPost(id: u64, event_name: *const c_char); 210 | fn RegisterDrawable(id: u64, user_data: usize, callback: usize); 211 | fn UnregisterDrawables(id: u64); 212 | fn SetTimeout(id: u64, user_data: usize, callback: usize, time: f32); 213 | fn Execute(id: u64, user_data: usize, callback: usize); 214 | 215 | fn IsInGame() -> bool; 216 | fn IsInOnlineGame() -> bool; 217 | fn IsInFreeplay() -> bool; 218 | fn IsInReplay() -> bool; 219 | fn IsInCustomTraining() -> bool; 220 | fn IsSpectatingInOnlineGame() -> bool; 221 | fn IsPaused() -> bool; 222 | 223 | fn GetOnlineGame() -> usize; 224 | fn GetGameEventAsServer() -> usize; 225 | fn GetLocalCar() -> usize; 226 | fn GetCamera() -> usize; 227 | fn GetEngine() -> usize; 228 | fn GetPlayerController() -> usize; 229 | } -------------------------------------------------------------------------------- /src/internal.rs: -------------------------------------------------------------------------------- 1 | use std::sync::Mutex; 2 | 3 | use crate::wrappers::canvas::Canvas; 4 | use crate::wrappers::cvar::CVar; 5 | 6 | pub type HookCallback = dyn FnMut(); 7 | pub type HookWithCallerCallback = dyn FnMut(Box); 8 | pub type HookWithCallerCallbackInternal = dyn FnMut(usize, usize); 9 | pub type DrawableCallback = dyn FnMut(Canvas); 10 | pub type TimeoutCallback = dyn FnMut(); 11 | 12 | pub type NotifierCallback = dyn FnMut(Vec); 13 | pub type OnValueChangedCallback = dyn FnMut(String, CVar); 14 | 15 | pub trait BakkesMod { 16 | fn id(&self) -> u64; 17 | fn add_notifier_callback(&self, addr: usize); 18 | fn add_on_value_changed_callback(&self, addr: usize); 19 | fn add_hook_callback(&self, addr: usize); 20 | fn add_hook_caller_callback(&self, addr: usize); 21 | fn add_drawable_callback(&self, addr: usize); 22 | fn add_timeout_callback(&self, addr: usize); 23 | 24 | fn get_notifier_callbacks(&self) -> Vec; 25 | fn get_on_value_changed_callbacks(&self) -> Vec; 26 | fn get_hook_callbacks(&self) -> Vec; 27 | fn get_hook_caller_callbacks(&self) -> Vec; 28 | fn get_drawable_callbacks(&self) -> Vec; 29 | fn get_timeout_callbacks(&self) -> Vec; 30 | } 31 | 32 | static mut BAKKESMOD: &dyn BakkesMod = &Dummy; 33 | 34 | pub fn bakkesmod_init(id: u64) { 35 | let bm_wrapper = Box::new(BakkesModWrapper { 36 | id, 37 | notifier_callbacks: Mutex::new(Vec::new()), 38 | on_value_changed_callbacks: Mutex::new(Vec::new()), 39 | hook_callbacks: Mutex::new(Vec::new()), 40 | hook_caller_callbacks: Mutex::new(Vec::new()), 41 | drawable_callbacks: Mutex::new(Vec::new()), 42 | timeout_callbacks: Mutex::new(Vec::new()), 43 | }); 44 | unsafe { BAKKESMOD = Box::leak(bm_wrapper); } 45 | } 46 | 47 | pub fn bakkesmod_exit() { 48 | drop_notifier_callbacks(); 49 | drop_on_value_changed_callbacks(); 50 | drop_hook_callbacks(); 51 | drop_hook_caller_callbacks(); 52 | drop_drawable_callbacks(); 53 | drop_timeout_callbacks(); 54 | } 55 | 56 | pub fn bakkesmod() -> &'static dyn BakkesMod { 57 | unsafe { BAKKESMOD } 58 | } 59 | 60 | 61 | struct BakkesModWrapper { 62 | pub id: u64, 63 | pub notifier_callbacks: Mutex>, 64 | pub on_value_changed_callbacks: Mutex>, 65 | pub hook_callbacks: Mutex>, 66 | pub hook_caller_callbacks: Mutex>, 67 | pub drawable_callbacks: Mutex>, 68 | pub timeout_callbacks: Mutex>, 69 | } 70 | 71 | impl BakkesMod for BakkesModWrapper { 72 | fn id(&self) -> u64 { 73 | self.id 74 | } 75 | 76 | fn add_notifier_callback(&self, addr: usize) { 77 | let mut callbacks = self.notifier_callbacks.lock().unwrap(); 78 | callbacks.push(addr); 79 | } 80 | 81 | fn add_on_value_changed_callback(&self, addr: usize) { 82 | let mut callbacks = self.on_value_changed_callbacks.lock().unwrap(); 83 | callbacks.push(addr); 84 | } 85 | 86 | fn add_hook_callback(&self, addr: usize) { 87 | let mut callbacks = self.hook_callbacks.lock().unwrap(); 88 | callbacks.push(addr); 89 | } 90 | 91 | fn add_hook_caller_callback(&self, addr: usize) { 92 | let mut callbacks = self.hook_caller_callbacks.lock().unwrap(); 93 | callbacks.push(addr); 94 | } 95 | 96 | fn add_drawable_callback(&self, addr: usize) { 97 | let mut callbacks = self.drawable_callbacks.lock().unwrap(); 98 | callbacks.push(addr); 99 | } 100 | 101 | fn add_timeout_callback(&self, addr: usize) { 102 | let mut callbacks = self.timeout_callbacks.lock().unwrap(); 103 | callbacks.push(addr); 104 | } 105 | 106 | fn get_notifier_callbacks(&self) -> Vec { 107 | let callbacks = self.notifier_callbacks.lock().unwrap(); 108 | callbacks.clone() 109 | } 110 | 111 | fn get_on_value_changed_callbacks(&self) -> Vec { 112 | let callbacks = self.on_value_changed_callbacks.lock().unwrap(); 113 | callbacks.clone() 114 | } 115 | 116 | fn get_hook_callbacks(&self) -> Vec { 117 | let callbacks = self.hook_callbacks.lock().unwrap(); 118 | callbacks.clone() 119 | } 120 | 121 | fn get_hook_caller_callbacks(&self) -> Vec { 122 | let callbacks = self.hook_caller_callbacks.lock().unwrap(); 123 | callbacks.clone() 124 | } 125 | 126 | fn get_drawable_callbacks(&self) -> Vec { 127 | let callbacks = self.drawable_callbacks.lock().unwrap(); 128 | callbacks.clone() 129 | } 130 | 131 | fn get_timeout_callbacks(&self) -> Vec { 132 | let callbacks = self.timeout_callbacks.lock().unwrap(); 133 | callbacks.clone() 134 | } 135 | } 136 | 137 | fn drop_hook_callbacks() { 138 | let bm = bakkesmod(); 139 | let notifiers = bm.get_hook_callbacks(); 140 | for addr in notifiers { 141 | let _ = unsafe { Box::from_raw(addr as *mut Box) }; 142 | } 143 | } 144 | 145 | pub fn drop_hook_caller_callbacks() { 146 | let bm = bakkesmod(); 147 | let notifiers = bm.get_hook_caller_callbacks(); 148 | for addr in notifiers { 149 | let _ = unsafe { Box::from_raw(addr as *mut Box) }; 150 | } 151 | } 152 | 153 | pub fn drop_drawable_callbacks() { 154 | let bm = bakkesmod(); 155 | let notifiers = bm.get_drawable_callbacks(); 156 | for addr in notifiers { 157 | let _ = unsafe { Box::from_raw(addr as *mut Box) }; 158 | } 159 | } 160 | 161 | pub fn drop_timeout_callbacks() { 162 | let bm = bakkesmod(); 163 | let notifiers = bm.get_timeout_callbacks(); 164 | for addr in notifiers { 165 | let _ = unsafe { Box::from_raw(addr as *mut Box) }; 166 | } 167 | } 168 | 169 | pub fn drop_notifier_callbacks() { 170 | let bm = bakkesmod(); 171 | let notifiers = bm.get_notifier_callbacks(); 172 | for addr in notifiers { 173 | let _ = unsafe { Box::from_raw(addr as *mut Box) }; 174 | } 175 | } 176 | 177 | pub fn drop_on_value_changed_callbacks() { 178 | let bm = bakkesmod(); 179 | let notifiers = bm.get_on_value_changed_callbacks(); 180 | for addr in notifiers { 181 | let _ = unsafe { Box::from_raw(addr as *mut Box) }; 182 | } 183 | } 184 | 185 | struct Dummy; 186 | 187 | impl BakkesMod for Dummy { 188 | fn id(&self) -> u64 { 0 } 189 | fn add_notifier_callback(&self, _: usize) {} 190 | fn add_on_value_changed_callback(&self, _: usize) {} 191 | fn add_hook_callback(&self, _: usize) {} 192 | fn add_hook_caller_callback(&self, _: usize) {} 193 | fn add_drawable_callback(&self, _: usize) {} 194 | fn add_timeout_callback(&self, _: usize) {} 195 | 196 | fn get_notifier_callbacks(&self) -> Vec { Vec::new() } 197 | fn get_on_value_changed_callbacks(&self) -> Vec { Vec::new() } 198 | fn get_hook_callbacks(&self) -> Vec { Vec::new() } 199 | fn get_hook_caller_callbacks(&self) -> Vec { Vec::new() } 200 | fn get_drawable_callbacks(&self) -> Vec { Vec::new() } 201 | fn get_timeout_callbacks(&self) -> Vec { Vec::new() } 202 | } -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! SDK for writing plugins for [BakkesMod](https://bakkesmod.com), a mod framework for Rocket League. 2 | //! 3 | //! This SDK is an alternative to the C++ SDK found [here](https://github.com/bakkesmodorg/BakkesModSDK), 4 | //! allowing to write plugins in Rust. Plugins built with the Rust SDK can be loaded into the game 5 | //! in the exact same way as C++ plugins. 6 | //! 7 | //! Note however that not all functionality in the C++ SDK is available here yet, and **importantly, 8 | //! the Rust SDK has had very little testing, so some things might be completely broken**. 9 | //! 10 | //! ### Prerequisites 11 | //! Make sure you have installed [Rust](https://www.rust-lang.org/tools/install) and [BakkesMod](https://bakkesmod.com). 12 | //! 13 | //! Also, add an environment variable called `BAKKESMOD_LIB_PATH` containing the path to `pluginsdk.lib` (e.g. `C:\Program Files (x86)\Steam\steamapps\common\rocketleague\Binaries\Win64\bakkesmod\bakkesmodsdk\lib`). 14 | //! 15 | //! 16 | //! ### Create the project 17 | //! Create a new Rust library project with `cargo new --lib `. 18 | //! 19 | //! Add the following to the generated `Cargo.toml`: 20 | //! ```toml 21 | //! [dependencies] 22 | //! bakkesmod = "0.2" 23 | //! 24 | //! [lib] 25 | //! name = "mycoolplugin" 26 | //! crate_type = ["cdylib"] 27 | //! ``` 28 | //! 29 | //! Write your plugin code in `src/lib.rs` (and possibly add more files). 30 | //! Make sure you have exactly one function with the `#[plugin_init]` attribute. This function will be called when the plugin is loaded. 31 | //! 32 | //! ### Building 33 | //! Use `cargo build` or `cargo build --release` to build. A `.dll` file is created in `target/debug` or `target/release`. 34 | //! Copy this file to your `bakkesmod/plugins` folder. It can now be loaded in-game with `plugin load `. 35 | //! 36 | //! 37 | //! # Guide 38 | //! 39 | //! See also [the examples directory](https://github.com/AratorRL/bakkesmod-rust/tree/master/examples) on GitHub for some examples. 40 | //! 41 | //! BakkesMod plugins are loaded in-game using the `plugin load ` command in the console, or automatically when listed in 42 | //! the `plugins.cfg` file. When a plugin is loaded, the function with the `plugin_init` attribute is executed. It makes sense to 43 | //! call this function something like `on_load`. 44 | //! After this, plugin code is only executed through callbacks, which can trigger when e.g. a game event happens, or a console command 45 | //! is executed. Typically, the `on_load` function will register these callbacks, and the rest of the plugin's execution happens 46 | //! inside these callbacks. 47 | //! 48 | //! As an example: 49 | //! ```rust 50 | //! use bakkesmod::{game, console}; 51 | //! 52 | //! #[plugin_init] 53 | //! pub fn on_load() { 54 | //! // register a 'notifier' (a console command) 55 | //! console::register_notifier("my_notifier", Box::new(move |params: Vec| { 56 | //! // callback code 57 | //! })); 58 | //! 59 | //! // register a hook on a game event 60 | //! game::hook_event("Function Engine.GameViewportClient.Tick", Box::new(move || { 61 | //! // callback code 62 | //! })); 63 | //! 64 | //! // use a normal function instead of a lambda 65 | //! game::hook_event("Function TAGame.Car_TA.ApplyBallImpactForces", Box::new(my_callback)); 66 | //! } 67 | //! 68 | //! fn my_callback() { 69 | //! // callback code 70 | //! } 71 | //! ``` 72 | //! 73 | //! BakkesMod-specific functionality like hooking, registering notifiers or drawables, is found in the 74 | //! `game` and `console` modules. 75 | //! 76 | //! The `wrappers::unreal` module contains auto-generated wrappers around game classes, that are written in unrealscript. 77 | //! Since Rust doesn't have struct inheritance, and since BakkesMod provides only methods on these classes anyway, 78 | //! *traits* are used to model functionality on these wrappers. 79 | //! 80 | //! This means that each game object is represented as simple `XXXWrapper` struct, without any methods. 81 | //! Methods on these wrappers are implemented as part of traits, with names `XXX` (without Wrapper). 82 | //! For example, the `CarWrapper` struct implementents the `Car` trait, which allows you to call e.g. `demolish` 83 | //! (defined in `Car`) on a `CarWrapper` instance. `CarWrapper` also implements the `Vehicle`, `RBActor` and `Actor` traits, 84 | //! so all methods defined in those traits are also callable on a `CarWrapper` instance. This is how the unrealscript 85 | //! inheritance is mimicked. 86 | //! 87 | //! It's also recommended to import the `prelude` module (`use bakkesmod::prelude::*;`) 88 | //! so that all macros are brought into scope. 89 | //! Macros include `log_console!` (print to the in-game console using the same formatting as Rust's `println!`), 90 | //! and `vec3!` and `vec2!` for creating vectors. 91 | //! 92 | 93 | 94 | #[macro_use] mod macros; 95 | #[macro_use] mod errors; 96 | 97 | pub mod game; 98 | pub mod console; 99 | pub mod wrappers; 100 | 101 | mod internal; 102 | 103 | pub mod prelude { 104 | pub use {log_console, vec2, vec3, color, lin_color}; 105 | pub use bakkesmod_error; 106 | pub use crate::console::console_print; 107 | pub use crate::internal::{bakkesmod_init, bakkesmod_exit}; 108 | pub use crate::wrappers::*; 109 | pub use bakkesmod_macros::plugin_init; 110 | } -------------------------------------------------------------------------------- /src/macros.rs: -------------------------------------------------------------------------------- 1 | #[macro_export] 2 | macro_rules! log_console { 3 | ($($arg:tt)*) => ({ 4 | $crate::console::console_print(&format!($($arg)*)); 5 | }) 6 | } 7 | 8 | #[macro_export] 9 | macro_rules! vec3 { 10 | ($x:expr, $y:expr, $z:expr) => ( 11 | $crate::wrappers::structs::Vector::from($x as f32, $y as f32, $z as f32) 12 | ); 13 | } 14 | 15 | #[macro_export] 16 | macro_rules! vec2 { 17 | ($x:expr, $y:expr) => ( 18 | $crate::wrappers::structs::Vector2::from($x as i32, $y as i32) 19 | ); 20 | } 21 | 22 | #[macro_export] 23 | macro_rules! color { 24 | ($r:expr, $g:expr, $b:expr, $a:expr) => ( 25 | $crate::wrappers::structs::Color::from($r as u8, $g as u8, $b as u8, $a as u8) 26 | ); 27 | } 28 | 29 | #[macro_export] 30 | macro_rules! lin_color { 31 | ($r:expr, $g:expr, $b:expr, $a:expr) => ( 32 | $crate::wrappers::structs::LinearColor::from($r as f32, $g as f32, $b as f32, $a as f32) 33 | ); 34 | } -------------------------------------------------------------------------------- /src/wrappers/canvas.rs: -------------------------------------------------------------------------------- 1 | use std::ffi::{CString, CStr}; 2 | use std::os::raw::c_char; 3 | 4 | use crate::wrappers::structs::{ 5 | Vector, 6 | Vector2, 7 | Vector2f, 8 | LinearColor 9 | }; 10 | 11 | pub struct Canvas(usize); 12 | 13 | impl Canvas { 14 | pub fn new(addr: usize) -> Canvas { 15 | Canvas(addr) 16 | } 17 | 18 | pub fn addr(&self) -> usize { 19 | self.0 20 | } 21 | 22 | pub fn set_position>(&self, pos: T) { 23 | let pos: Vector2f = pos.into(); 24 | let pos = &pos as *const Vector2f; 25 | unsafe { Canvas_SetPosition(self.addr(), pos); } 26 | } 27 | 28 | pub fn get_position_float(&self) -> Vector2f { 29 | let mut result = Vector2f::new(); 30 | let result_ptr = &result as *const Vector2f; 31 | unsafe { Canvas_GetPositionFloat(self.addr(), result_ptr); } 32 | result 33 | } 34 | 35 | pub fn set_color_chars(&self, red: u8, green: u8, blue: u8, alpha: u8) { 36 | unsafe { Canvas_SetColor_chars(self.addr(), red, green, blue, alpha); } 37 | } 38 | 39 | pub fn set_color(&self, color: LinearColor) { 40 | let color = &color as *const LinearColor; 41 | unsafe { Canvas_SetColor(self.addr(), color); } 42 | } 43 | 44 | pub fn get_color(&self) -> LinearColor { 45 | let mut result = LinearColor::new(); 46 | let result_ptr = &result as *const LinearColor; 47 | unsafe { Canvas_GetColor(self.addr(), result_ptr); } 48 | result 49 | } 50 | 51 | pub fn draw_box>(&self, size: T) { 52 | let size: Vector2f = size.into(); 53 | let size = &size as *const Vector2f; 54 | unsafe { Canvas_DrawBox(self.addr(), size); } 55 | } 56 | 57 | pub fn fill_box>(&self, size: T) { 58 | let size: Vector2f = size.into(); 59 | let size = &size as *const Vector2f; 60 | unsafe { Canvas_FillBox(self.addr(), size); } 61 | } 62 | 63 | pub fn fill_triangle>(&self, p1: T, p2: T, p3: T) { 64 | let p1: Vector2f = p1.into(); 65 | let p1 = &p1 as *const Vector2f; 66 | let p2: Vector2f = p2.into(); 67 | let p2 = &p2 as *const Vector2f; 68 | let p3: Vector2f = p3.into(); 69 | let p3 = &p3 as *const Vector2f; 70 | unsafe { Canvas_FillTriangle(self.addr(), p1, p2, p3); } 71 | } 72 | 73 | pub fn fill_triangle_color>(&self, p1: T, p2: T, p3: T, color: LinearColor) { 74 | let p1: Vector2f = p1.into(); 75 | let p1 = &p1 as *const Vector2f; 76 | let p2: Vector2f = p2.into(); 77 | let p2 = &p2 as *const Vector2f; 78 | let p3: Vector2f = p3.into(); 79 | let p3 = &p3 as *const Vector2f; 80 | let color = &color as *const LinearColor; 81 | unsafe { Canvas_FillTriangle_color(self.addr(), p1, p2, p3, color); } 82 | } 83 | 84 | pub fn draw_string(&self, text: &str) { 85 | let c_text = CString::new(text).unwrap(); 86 | let c_text: *const c_char = c_text.as_ptr(); 87 | unsafe { Canvas_DrawString(self.addr(), c_text); } 88 | } 89 | 90 | pub fn draw_string_scale(&self, text: &str, x_scale: f32, y_scale: f32) { 91 | let c_text = CString::new(text).unwrap(); 92 | let c_text: *const c_char = c_text.as_ptr(); 93 | unsafe { Canvas_DrawString_pos(self.addr(), c_text, x_scale, y_scale); } 94 | } 95 | 96 | pub fn get_string_size(&self, text: &str, x_scale: f32, y_scale: f32) -> Vector2f { 97 | let c_text = CString::new(text).unwrap(); 98 | let c_text: *const c_char = c_text.as_ptr(); 99 | let mut result = Vector2f::new(); 100 | let result_ptr = &result as *const Vector2f; 101 | unsafe { Canvas_GetStringSize(self.addr(), c_text, x_scale, y_scale, result_ptr); } 102 | result 103 | } 104 | 105 | pub fn draw_line>(&self, start: T, end: T) { 106 | let start: Vector2f = start.into(); 107 | let start = &start as *const Vector2f; 108 | let end: Vector2f = end.into(); 109 | let end = &end as *const Vector2f; 110 | unsafe { Canvas_DrawLine(self.addr(), start, end); } 111 | } 112 | 113 | pub fn draw_line_width>(&self, start: T, end: T, width: f32) { 114 | let start: Vector2f = start.into(); 115 | let start = &start as *const Vector2f; 116 | let end: Vector2f = end.into(); 117 | let end = &end as *const Vector2f; 118 | unsafe { Canvas_DrawLine_width(self.addr(), start, end, width); } 119 | } 120 | 121 | pub fn draw_rect>(&self, start: T, end: T) { 122 | let start: Vector2f = start.into(); 123 | let start = &start as *const Vector2f; 124 | let end: Vector2f = end.into(); 125 | let end = &end as *const Vector2f; 126 | unsafe { Canvas_DrawRect(self.addr(), start, end); } 127 | } 128 | 129 | pub fn project(&self, location: Vector) -> Vector2 { 130 | let location = &location as *const Vector; 131 | let mut result = Vector2::new(); 132 | let result_ptr = &result as *const Vector2; 133 | unsafe { Canvas_Project(self.addr(), location, result_ptr); } 134 | result 135 | } 136 | 137 | pub fn project_f(&self, location: Vector) -> Vector2f { 138 | let location = &location as *const Vector; 139 | let mut result = Vector2f::new(); 140 | let result_ptr = &result as *const Vector2f; 141 | unsafe { Canvas_ProjectF(self.addr(), location, result_ptr); } 142 | result 143 | } 144 | pub fn get_size(&self) -> Vector2 { 145 | let mut result = Vector2::new(); 146 | let result_ptr = &result as *const Vector2; 147 | unsafe { Canvas_GetSize(self.addr(), result_ptr); } 148 | result 149 | } 150 | } 151 | 152 | extern "C" { 153 | fn Canvas_SetPosition(obj: usize, pos: *const Vector2f); 154 | fn Canvas_GetPositionFloat(obj: usize, result: *const Vector2f); 155 | fn Canvas_SetColor_chars(obj: usize, Red: u8, Green: u8, Blue: u8, Alpha: u8); 156 | fn Canvas_SetColor(obj: usize, color: *const LinearColor); 157 | fn Canvas_GetColor(obj: usize, result: *const LinearColor); 158 | fn Canvas_DrawBox(obj: usize, size: *const Vector2f); 159 | fn Canvas_FillBox(obj: usize, size: *const Vector2f); 160 | fn Canvas_FillTriangle(obj: usize, p1: *const Vector2f, p2: *const Vector2f, p3: *const Vector2f); 161 | fn Canvas_FillTriangle_color(obj: usize, p1: *const Vector2f, p2: *const Vector2f, p3: *const Vector2f, color: *const LinearColor); 162 | fn Canvas_DrawString(obj: usize, text: *const c_char); 163 | fn Canvas_DrawString_pos(obj: usize, text: *const c_char, xScale: f32, yScale: f32); 164 | fn Canvas_GetStringSize(obj: usize, text: *const c_char, xScale: f32, yScale: f32, result: *const Vector2f); 165 | fn Canvas_DrawLine(obj: usize, start: *const Vector2f, end: *const Vector2f); 166 | fn Canvas_DrawLine_width(obj: usize, start: *const Vector2f, end: *const Vector2f, width: f32); 167 | fn Canvas_DrawRect(obj: usize, start: *const Vector2f, end: *const Vector2f); 168 | fn Canvas_SetPositionI(obj: usize, pos: *const Vector2); 169 | fn Canvas_GetPositionI(obj: usize, result: *const Vector2); 170 | fn Canvas_DrawBoxI(obj: usize, size: *const Vector2); 171 | fn Canvas_FillBoxI(obj: usize, size: *const Vector2); 172 | fn Canvas_FillTriangleI(obj: usize, p1: *const Vector2, p2: *const Vector2, p3: *const Vector2); 173 | fn Canvas_FillTriangle_colorI(obj: usize, p1: *const Vector2, p2: *const Vector2, p3: *const Vector2, color: *const LinearColor); 174 | fn Canvas_DrawLineI(obj: usize, start: *const Vector2, end: *const Vector2); 175 | fn Canvas_DrawLineWidthI(obj: usize, start: *const Vector2, end: *const Vector2, width: f32); 176 | fn Canvas_DrawRectI(obj: usize, start: *const Vector2, end: *const Vector2); 177 | fn Canvas_Project(obj: usize, location: *const Vector, result: *const Vector2); 178 | fn Canvas_ProjectF(obj: usize, location: *const Vector, result: *const Vector2f); 179 | fn Canvas_GetSize(obj: usize, result: *const Vector2); 180 | } -------------------------------------------------------------------------------- /src/wrappers/cvar.rs: -------------------------------------------------------------------------------- 1 | use std::ffi::{CString, CStr}; 2 | use std::os::raw::c_char; 3 | 4 | pub struct CVar(usize); 5 | 6 | impl CVar { 7 | pub fn new(addr: usize) -> CVar { 8 | CVar(addr) 9 | } 10 | 11 | pub fn addr(&self) -> usize { self.0 } 12 | 13 | pub fn get_name(&self) -> String { 14 | let c_name = unsafe { CVar_GetName(self.0) }; 15 | 16 | if c_name.is_null() { log_console!("name ptr is null!"); return String::new(); } 17 | let name = unsafe { CStr::from_ptr(c_name) }; 18 | 19 | match name.to_str() { 20 | Ok(s) => String::from(s), 21 | Err(_) => { log_console!("cannot convert CStr to &str"); return String::new(); } 22 | } 23 | } 24 | 25 | pub fn get_int_value(&self) -> i32 { 26 | unsafe { CVar_GetIntValue(self.0) } 27 | } 28 | 29 | pub fn get_float_value(&self) -> f32 { 30 | unsafe { CVar_GetFloatValue(self.0) } 31 | } 32 | 33 | pub fn get_bool_value(&self) -> bool { 34 | unsafe { CVar_GetBoolValue(self.0) } 35 | } 36 | 37 | pub fn get_string_value(&self) -> String { 38 | let c_value = unsafe { CVar_GetStringValue(self.0) }; 39 | if c_value.is_null() { log_console!("value ptr is null!"); return String::new(); } 40 | let value = unsafe { CStr::from_ptr(c_value) }; 41 | 42 | match value.to_str() { 43 | Ok(s) => String::from(s), 44 | Err(_) => { log_console!("cannot convert CStr to &str"); return String::new(); } 45 | } 46 | } 47 | 48 | pub fn get_description(&self) -> String { 49 | let c_value = unsafe { CVar_GetDescription(self.0) }; 50 | if c_value.is_null() { log_console!("value ptr is null!"); return String::new(); } 51 | let value = unsafe { CStr::from_ptr(c_value) }; 52 | 53 | match value.to_str() { 54 | Ok(s) => String::from(s), 55 | Err(_) => { log_console!("cannot convert CStr to &str"); return String::new(); } 56 | } 57 | } 58 | 59 | pub fn set_string_value(&self, value: &str) { 60 | let c_value = CString::new(value).unwrap(); 61 | let c_value: *const c_char = c_value.as_ptr(); 62 | unsafe { CVar_SetStringValue(self.0, c_value); } 63 | } 64 | 65 | pub fn set_int_value(&self, value: i32) { 66 | unsafe { CVar_SetIntValue(self.0, value); } 67 | } 68 | 69 | pub fn set_float_value(&self, value: f32) { 70 | unsafe { CVar_SetFloatValue(self.0, value); } 71 | } 72 | } 73 | 74 | extern "C" { 75 | fn CVar_GetName(p_cvar: usize) -> *const c_char; 76 | fn CVar_GetIntValue(p_cvar: usize) -> i32; 77 | fn CVar_GetFloatValue(p_cvar: usize) -> f32; 78 | fn CVar_GetBoolValue(p_cvar: usize) -> bool; 79 | fn CVar_GetStringValue(p_cvar: usize) -> *const c_char; 80 | fn CVar_GetDescription(p_cvar: usize) -> *const c_char; 81 | fn CVar_notify(p_cvar: usize); 82 | fn CVar_SetStringValue(p_cvar: usize, value: *const c_char); 83 | fn CVar_SetIntValue(p_cvar: usize, value: i32); 84 | fn CVar_SetFloatValue(p_cvar: usize, value: f32); 85 | } -------------------------------------------------------------------------------- /src/wrappers/macros.rs: -------------------------------------------------------------------------------- 1 | macro_rules! impl_object { 2 | ($name: ident) => { 3 | impl Object for $name { 4 | fn new(addr: usize) -> Self { 5 | Self(addr) 6 | } 7 | 8 | fn try_new(addr: usize) -> Option { 9 | match addr { 10 | 0 => None, 11 | _ => Some(Self(addr)) 12 | } 13 | } 14 | 15 | fn addr(&self) -> usize { 16 | self.0 17 | } 18 | } 19 | 20 | impl UnrealPointer for $name { 21 | fn from_ptr(addr: usize) -> Self { Self(addr) } 22 | } 23 | } 24 | } 25 | 26 | macro_rules! impl_unreal_pointer_struct { 27 | ($name: ident) => { 28 | impl UnrealPointer for $name { 29 | fn from_ptr(addr: usize) -> Self { 30 | unsafe { *(addr as *const Self) } 31 | } 32 | } 33 | } 34 | } 35 | 36 | macro_rules! struct_default_new { 37 | ($name: ident) => { 38 | impl $name { 39 | pub fn new() -> Self { Self(0) } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/wrappers/mmr.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::structs::{ 2 | UniqueNetId, 3 | SkillRating, 4 | SkillRank 5 | }; 6 | 7 | pub fn is_syncing(player_id: UniqueNetId) -> bool { 8 | unsafe { IsSyncing(player_id) } 9 | } 10 | 11 | pub fn is_synced(player_id: UniqueNetId, playlist_id: i32) -> bool { 12 | unsafe { IsSynced(player_id, playlist_id) } 13 | } 14 | 15 | pub fn is_ranked(playlist_id: i32) -> bool { 16 | unsafe { IsRanked(playlist_id) } 17 | } 18 | 19 | pub fn get_player_skill_rating(player_id: UniqueNetId, playlist_id: i32) -> SkillRating { 20 | let mut result = SkillRating::new(); 21 | let result_ptr = &mut result as *const SkillRating; 22 | 23 | unsafe { GetPlayerSkillRating(player_id, playlist_id, result_ptr) } 24 | result 25 | } 26 | 27 | pub fn get_player_rank(player_id: UniqueNetId, playlist_id: i32) -> SkillRank { 28 | let mut result = SkillRank::new(); 29 | let result_ptr = &mut result as *const SkillRank; 30 | 31 | unsafe { GetPlayerRank(player_id, playlist_id, result_ptr) } 32 | result 33 | } 34 | 35 | pub fn get_player_mmr(player_id: UniqueNetId, playlist_id: i32) -> f32 { 36 | unsafe { GetPlayerMMR(player_id, playlist_id) } 37 | } 38 | 39 | pub fn calculate_mmr(skill_rating: SkillRating, disregard_placements: bool) -> f32 { 40 | let skill_rating = &skill_rating as *const SkillRating; 41 | unsafe { CalculateMMR(skill_rating, disregard_placements) } 42 | } 43 | 44 | pub fn get_current_playlist() -> i32 { 45 | unsafe { GetCurrentPlaylist() } 46 | } 47 | 48 | extern "C" { 49 | fn IsSyncing(playerID: UniqueNetId) -> bool; 50 | fn IsSynced(playerID: UniqueNetId, playlistID: i32) -> bool; 51 | fn IsRanked(playlistID: i32) -> bool; 52 | fn GetPlayerSkillRating(playerID: UniqueNetId, playlistID: i32, result: *const SkillRating); 53 | fn GetPlayerRank(playerID: UniqueNetId, playlistID: i32, result: *const SkillRank); 54 | fn GetPlayerMMR(playerID: UniqueNetId, playlistID: i32) -> f32; 55 | fn CalculateMMR(sr: *const SkillRating, disregardPlacements: bool) -> f32; 56 | fn GetCurrentPlaylist() -> i32; 57 | } -------------------------------------------------------------------------------- /src/wrappers/mod.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused)] 2 | 3 | use std::fmt; 4 | use std::ops; 5 | use std::convert::From; 6 | use std::marker::{PhantomData, Sized}; 7 | 8 | use std::ffi::{CString, CStr}; 9 | use std::os::raw::c_char; 10 | 11 | use crate::prelude::*; 12 | 13 | #[macro_use] mod macros; 14 | 15 | pub mod cvar; 16 | pub mod canvas; 17 | pub mod mmr; 18 | pub mod structs; 19 | pub mod unreal; 20 | 21 | pub trait UnrealPointer { 22 | fn from_ptr(addr: usize) -> Self; 23 | } 24 | 25 | pub trait Object: UnrealPointer { 26 | fn new(addr: usize) -> Self; 27 | fn try_new(addr: usize) -> Option where Self: Sized; 28 | fn addr(&self) -> usize; 29 | } 30 | 31 | 32 | pub struct ObjectWrapper(pub usize); 33 | impl_object!(ObjectWrapper); 34 | -------------------------------------------------------------------------------- /src/wrappers/unreal/air_control_component.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct AirControlComponentWrapper(pub usize); 5 | impl_object!(AirControlComponentWrapper); 6 | 7 | impl AirControlComponent for AirControlComponentWrapper {} 8 | impl CarComponent for AirControlComponentWrapper {} 9 | impl Actor for AirControlComponentWrapper {} 10 | 11 | pub trait AirControlComponent : CarComponent { 12 | fn get_air_torque(&self) -> Rotator { 13 | unsafe { 14 | let mut result = Rotator::new(); 15 | let result_ptr: *mut Rotator = &mut result as *mut Rotator; 16 | CarComponent_AirControl_TA_Get_AirTorque(self.addr(), result_ptr); 17 | result 18 | } 19 | } 20 | fn get_air_damping(&self) -> Rotator { 21 | unsafe { 22 | let mut result = Rotator::new(); 23 | let result_ptr: *mut Rotator = &mut result as *mut Rotator; 24 | CarComponent_AirControl_TA_Get_AirDamping(self.addr(), result_ptr); 25 | result 26 | } 27 | } 28 | fn get_throttle_force(&self) -> f32 { 29 | unsafe { 30 | CarComponent_AirControl_TA_Get_ThrottleForce(self.addr()) 31 | } 32 | } 33 | fn get_air_control_sensitivity(&self) -> f32 { 34 | unsafe { 35 | CarComponent_AirControl_TA_Get_AirControlSensitivity(self.addr()) 36 | } 37 | } 38 | fn apply_forces(&self, active_time: f32) { 39 | unsafe { 40 | CarComponent_AirControl_TA_ApplyForces(self.addr(), active_time); 41 | } 42 | } 43 | fn on_created(&self) { 44 | unsafe { 45 | CarComponent_AirControl_TA_OnCreated(self.addr()); 46 | } 47 | } 48 | 49 | } 50 | 51 | extern "C" { 52 | fn CarComponent_AirControl_TA_Get_AirTorque(obj: usize, result: *mut Rotator); 53 | fn AirControlComponentWrapper_SetAirTorque(obj: usize, new_val: *mut Rotator); 54 | fn CarComponent_AirControl_TA_Get_AirDamping(obj: usize, result: *mut Rotator); 55 | fn AirControlComponentWrapper_SetAirDamping(obj: usize, new_val: *mut Rotator); 56 | fn CarComponent_AirControl_TA_Get_ThrottleForce(obj: usize) -> f32; 57 | fn AirControlComponentWrapper_SetThrottleForce(obj: usize, new_val: f32); 58 | fn CarComponent_AirControl_TA_Get_AirControlSensitivity(obj: usize) -> f32; 59 | fn AirControlComponentWrapper_SetAirControlSensitivity(obj: usize, new_val: f32); 60 | fn CarComponent_AirControl_TA_ApplyForces(obj: usize, ActiveTime: f32); 61 | fn CarComponent_AirControl_TA_OnCreated(obj: usize); 62 | 63 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/attachment_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct AttachmentPickupWrapper(pub usize); 5 | impl_object!(AttachmentPickupWrapper); 6 | 7 | impl AttachmentPickup for AttachmentPickupWrapper {} 8 | impl RumblePickupComponent for AttachmentPickupWrapper {} 9 | impl CarComponent for AttachmentPickupWrapper {} 10 | impl Actor for AttachmentPickupWrapper {} 11 | 12 | pub trait AttachmentPickup : RumblePickupComponent { 13 | fn pickup_end(&self) { 14 | unsafe { 15 | SpecialPickup_Attachment_TA_PickupEnd(self.addr()); 16 | } 17 | } 18 | fn pickup_start(&self) { 19 | unsafe { 20 | SpecialPickup_Attachment_TA_PickupStart(self.addr()); 21 | } 22 | } 23 | 24 | } 25 | 26 | extern "C" { 27 | fn SpecialPickup_Attachment_TA_PickupEnd(obj: usize); 28 | fn SpecialPickup_Attachment_TA_PickupStart(obj: usize); 29 | 30 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/ball_car_spring_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct BallCarSpringPickupWrapper(pub usize); 5 | impl_object!(BallCarSpringPickupWrapper); 6 | 7 | impl BallCarSpringPickup for BallCarSpringPickupWrapper {} 8 | impl SpringPickup for BallCarSpringPickupWrapper {} 9 | impl TargetedPickup for BallCarSpringPickupWrapper {} 10 | impl RumblePickupComponent for BallCarSpringPickupWrapper {} 11 | impl CarComponent for BallCarSpringPickupWrapper {} 12 | impl Actor for BallCarSpringPickupWrapper {} 13 | 14 | pub trait BallCarSpringPickup : SpringPickup { 15 | fn scale_spring_mesh_to_location(&self, new_location: Vector, target_location: Vector) { 16 | unsafe { 17 | let mut new_location = new_location; 18 | let new_location: *mut Vector = &mut new_location as *mut Vector; 19 | let mut target_location = target_location; 20 | let target_location: *mut Vector = &mut target_location as *mut Vector; 21 | SpecialPickup_BallCarSpring_TA_ScaleSpringMeshToLocation(self.addr(), new_location, target_location); 22 | } 23 | } 24 | 25 | } 26 | 27 | extern "C" { 28 | fn SpecialPickup_BallCarSpring_TA_ScaleSpringMeshToLocation(obj: usize, NewLocation: *mut Vector, TargetLocation: *mut Vector); 29 | 30 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/ball_freeze_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct BallFreezePickupWrapper(pub usize); 5 | impl_object!(BallFreezePickupWrapper); 6 | 7 | impl BallFreezePickup for BallFreezePickupWrapper {} 8 | impl TargetedPickup for BallFreezePickupWrapper {} 9 | impl RumblePickupComponent for BallFreezePickupWrapper {} 10 | impl CarComponent for BallFreezePickupWrapper {} 11 | impl Actor for BallFreezePickupWrapper {} 12 | 13 | pub trait BallFreezePickup : TargetedPickup { 14 | fn get_freeze_break_fx_archetype(&self) -> Option { 15 | unsafe { 16 | FXActorWrapper::try_new(SpecialPickup_BallFreeze_TA_Get_FreezeBreakFXArchetype(self.addr())) 17 | } 18 | } 19 | fn get_freeze_fx_archetype(&self) -> Option { 20 | unsafe { 21 | FXActorWrapper::try_new(SpecialPickup_BallFreeze_TA_Get_FreezeFXArchetype(self.addr())) 22 | } 23 | } 24 | fn get_b_maintain_momentum(&self) -> bool { 25 | unsafe { 26 | SpecialPickup_BallFreeze_TA_Get_bMaintainMomentum(self.addr()) 27 | } 28 | } 29 | fn get_b_touched(&self) -> bool { 30 | unsafe { 31 | SpecialPickup_BallFreeze_TA_Get_bTouched(self.addr()) 32 | } 33 | } 34 | fn get_time_to_stop(&self) -> f32 { 35 | unsafe { 36 | SpecialPickup_BallFreeze_TA_Get_TimeToStop(self.addr()) 37 | } 38 | } 39 | fn get_stop_momentum_percentage(&self) -> f32 { 40 | unsafe { 41 | SpecialPickup_BallFreeze_TA_Get_StopMomentumPercentage(self.addr()) 42 | } 43 | } 44 | fn get_ball(&self) -> Option { 45 | unsafe { 46 | BallWrapper::try_new(SpecialPickup_BallFreeze_TA_Get_Ball(self.addr())) 47 | } 48 | } 49 | fn get_orig_linear_velocity(&self) -> Vector { 50 | unsafe { 51 | let mut result = Vector::new(); 52 | let result_ptr: *mut Vector = &mut result as *mut Vector; 53 | SpecialPickup_BallFreeze_TA_Get_OrigLinearVelocity(self.addr(), result_ptr); 54 | result 55 | } 56 | } 57 | fn get_orig_angular_velocity(&self) -> Vector { 58 | unsafe { 59 | let mut result = Vector::new(); 60 | let result_ptr: *mut Vector = &mut result as *mut Vector; 61 | SpecialPickup_BallFreeze_TA_Get_OrigAngularVelocity(self.addr(), result_ptr); 62 | result 63 | } 64 | } 65 | fn get_orig_speed(&self) -> f32 { 66 | unsafe { 67 | SpecialPickup_BallFreeze_TA_Get_OrigSpeed(self.addr()) 68 | } 69 | } 70 | fn get_rep_orig_speed(&self) -> f32 { 71 | unsafe { 72 | SpecialPickup_BallFreeze_TA_Get_RepOrigSpeed(self.addr()) 73 | } 74 | } 75 | fn get_freeze_fx(&self) -> Option { 76 | unsafe { 77 | FXActorWrapper::try_new(SpecialPickup_BallFreeze_TA_Get_FreezeFX(self.addr())) 78 | } 79 | } 80 | fn pickup_end(&self) { 81 | unsafe { 82 | SpecialPickup_BallFreeze_TA_PickupEnd(self.addr()); 83 | } 84 | } 85 | fn handle_ball_exploded(&self, in_ball: BallWrapper) { 86 | unsafe { 87 | SpecialPickup_BallFreeze_TA_HandleBallExploded(self.addr(), in_ball.addr()); 88 | } 89 | } 90 | fn handle_ball_hit(&self, in_ball: BallWrapper, in_car: CarWrapper, hit_type: u8) { 91 | unsafe { 92 | SpecialPickup_BallFreeze_TA_HandleBallHit(self.addr(), in_ball.addr(), in_car.addr(), hit_type); 93 | } 94 | } 95 | fn apply_forces(&self, active_time: f32) { 96 | unsafe { 97 | SpecialPickup_BallFreeze_TA_ApplyForces(self.addr(), active_time); 98 | } 99 | } 100 | fn on_target_changed(&self) { 101 | unsafe { 102 | SpecialPickup_BallFreeze_TA_OnTargetChanged(self.addr()); 103 | } 104 | } 105 | fn pickup_start(&self) { 106 | unsafe { 107 | SpecialPickup_BallFreeze_TA_PickupStart(self.addr()); 108 | } 109 | } 110 | 111 | } 112 | 113 | extern "C" { 114 | fn SpecialPickup_BallFreeze_TA_Get_FreezeBreakFXArchetype(obj: usize) -> usize; 115 | fn BallFreezePickup_SetFreezeBreakFXArchetype(obj: usize, new_val: usize); 116 | fn SpecialPickup_BallFreeze_TA_Get_FreezeFXArchetype(obj: usize) -> usize; 117 | fn BallFreezePickup_SetFreezeFXArchetype(obj: usize, new_val: usize); 118 | fn SpecialPickup_BallFreeze_TA_Get_bMaintainMomentum(obj: usize) -> bool; 119 | fn BallFreezePickup_SetbMaintainMomentum(obj: usize, new_val: bool); 120 | fn SpecialPickup_BallFreeze_TA_Get_bTouched(obj: usize) -> bool; 121 | fn BallFreezePickup_SetbTouched(obj: usize, new_val: bool); 122 | fn SpecialPickup_BallFreeze_TA_Get_TimeToStop(obj: usize) -> f32; 123 | fn BallFreezePickup_SetTimeToStop(obj: usize, new_val: f32); 124 | fn SpecialPickup_BallFreeze_TA_Get_StopMomentumPercentage(obj: usize) -> f32; 125 | fn BallFreezePickup_SetStopMomentumPercentage(obj: usize, new_val: f32); 126 | fn SpecialPickup_BallFreeze_TA_Get_Ball(obj: usize) -> usize; 127 | fn BallFreezePickup_SetBall(obj: usize, new_val: usize); 128 | fn SpecialPickup_BallFreeze_TA_Get_OrigLinearVelocity(obj: usize, result: *mut Vector); 129 | fn BallFreezePickup_SetOrigLinearVelocity(obj: usize, new_val: *mut Vector); 130 | fn SpecialPickup_BallFreeze_TA_Get_OrigAngularVelocity(obj: usize, result: *mut Vector); 131 | fn BallFreezePickup_SetOrigAngularVelocity(obj: usize, new_val: *mut Vector); 132 | fn SpecialPickup_BallFreeze_TA_Get_OrigSpeed(obj: usize) -> f32; 133 | fn BallFreezePickup_SetOrigSpeed(obj: usize, new_val: f32); 134 | fn SpecialPickup_BallFreeze_TA_Get_RepOrigSpeed(obj: usize) -> f32; 135 | fn BallFreezePickup_SetRepOrigSpeed(obj: usize, new_val: f32); 136 | fn SpecialPickup_BallFreeze_TA_Get_FreezeFX(obj: usize) -> usize; 137 | fn BallFreezePickup_SetFreezeFX(obj: usize, new_val: usize); 138 | fn SpecialPickup_BallFreeze_TA_PickupEnd(obj: usize); 139 | fn SpecialPickup_BallFreeze_TA_HandleBallExploded(obj: usize, InBall: usize); 140 | fn SpecialPickup_BallFreeze_TA_HandleBallHit(obj: usize, InBall: usize, InCar: usize, HitType: u8); 141 | fn SpecialPickup_BallFreeze_TA_ApplyForces(obj: usize, ActiveTime: f32); 142 | fn SpecialPickup_BallFreeze_TA_OnTargetChanged(obj: usize); 143 | fn SpecialPickup_BallFreeze_TA_PickupStart(obj: usize); 144 | 145 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/ball_lasso_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct BallLassoPickupWrapper(pub usize); 5 | impl_object!(BallLassoPickupWrapper); 6 | 7 | impl BallLassoPickup for BallLassoPickupWrapper {} 8 | impl SpringPickup for BallLassoPickupWrapper {} 9 | impl TargetedPickup for BallLassoPickupWrapper {} 10 | impl RumblePickupComponent for BallLassoPickupWrapper {} 11 | impl CarComponent for BallLassoPickupWrapper {} 12 | impl Actor for BallLassoPickupWrapper {} 13 | 14 | pub trait BallLassoPickup : SpringPickup { 15 | fn scale_spring_mesh_to_location(&self, new_location: Vector, target_location: Vector) { 16 | unsafe { 17 | let mut new_location = new_location; 18 | let new_location: *mut Vector = &mut new_location as *mut Vector; 19 | let mut target_location = target_location; 20 | let target_location: *mut Vector = &mut target_location as *mut Vector; 21 | SpecialPickup_BallLasso_TA_ScaleSpringMeshToLocation(self.addr(), new_location, target_location); 22 | } 23 | } 24 | fn do_spring(&self, b_first_hit: bool) { 25 | unsafe { 26 | SpecialPickup_BallLasso_TA_DoSpring(self.addr(), b_first_hit); 27 | } 28 | } 29 | 30 | } 31 | 32 | extern "C" { 33 | fn SpecialPickup_BallLasso_TA_ScaleSpringMeshToLocation(obj: usize, NewLocation: *mut Vector, TargetLocation: *mut Vector); 34 | fn SpecialPickup_BallLasso_TA_DoSpring(obj: usize, bFirstHit: bool); 35 | 36 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/battarang_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct BattarangPickupWrapper(pub usize); 5 | impl_object!(BattarangPickupWrapper); 6 | 7 | impl BattarangPickup for BattarangPickupWrapper {} 8 | impl BallLassoPickup for BattarangPickupWrapper {} 9 | impl SpringPickup for BattarangPickupWrapper {} 10 | impl TargetedPickup for BattarangPickupWrapper {} 11 | impl RumblePickupComponent for BattarangPickupWrapper {} 12 | impl CarComponent for BattarangPickupWrapper {} 13 | impl Actor for BattarangPickupWrapper {} 14 | 15 | pub trait BattarangPickup : BallLassoPickup { 16 | fn get_spin_speed(&self) -> f32 { 17 | unsafe { 18 | SpecialPickup_Batarang_TA_Get_SpinSpeed(self.addr()) 19 | } 20 | } 21 | fn get_cur_rotation(&self) -> f32 { 22 | unsafe { 23 | SpecialPickup_Batarang_TA_Get_CurRotation(self.addr()) 24 | } 25 | } 26 | 27 | } 28 | 29 | extern "C" { 30 | fn SpecialPickup_Batarang_TA_Get_SpinSpeed(obj: usize) -> f32; 31 | fn BattarangPickup_SetSpinSpeed(obj: usize, new_val: f32); 32 | fn SpecialPickup_Batarang_TA_Get_CurRotation(obj: usize) -> f32; 33 | fn BattarangPickup_SetCurRotation(obj: usize, new_val: f32); 34 | 35 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/boost_mod_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct BoostModPickupWrapper(pub usize); 5 | impl_object!(BoostModPickupWrapper); 6 | 7 | impl BoostModPickup for BoostModPickupWrapper {} 8 | impl RumblePickupComponent for BoostModPickupWrapper {} 9 | impl CarComponent for BoostModPickupWrapper {} 10 | impl Actor for BoostModPickupWrapper {} 11 | 12 | pub trait BoostModPickup : RumblePickupComponent { 13 | fn get_b_unlimited_boost(&self) -> bool { 14 | unsafe { 15 | SpecialPickup_BoostMod_TA_Get_bUnlimitedBoost(self.addr()) 16 | } 17 | } 18 | fn get_boost_strength(&self) -> f32 { 19 | unsafe { 20 | SpecialPickup_BoostMod_TA_Get_BoostStrength(self.addr()) 21 | } 22 | } 23 | fn get_old_boost_strength(&self) -> f32 { 24 | unsafe { 25 | SpecialPickup_BoostMod_TA_Get_OldBoostStrength(self.addr()) 26 | } 27 | } 28 | fn pickup_end(&self) { 29 | unsafe { 30 | SpecialPickup_BoostMod_TA_PickupEnd(self.addr()); 31 | } 32 | } 33 | fn pickup_start(&self) { 34 | unsafe { 35 | SpecialPickup_BoostMod_TA_PickupStart(self.addr()); 36 | } 37 | } 38 | 39 | } 40 | 41 | extern "C" { 42 | fn SpecialPickup_BoostMod_TA_Get_bUnlimitedBoost(obj: usize) -> bool; 43 | fn BoostModPickup_SetbUnlimitedBoost(obj: usize, new_val: bool); 44 | fn SpecialPickup_BoostMod_TA_Get_BoostStrength(obj: usize) -> f32; 45 | fn BoostModPickup_SetBoostStrength(obj: usize, new_val: f32); 46 | fn SpecialPickup_BoostMod_TA_Get_OldBoostStrength(obj: usize) -> f32; 47 | fn BoostModPickup_SetOldBoostStrength(obj: usize, new_val: f32); 48 | fn SpecialPickup_BoostMod_TA_PickupEnd(obj: usize); 49 | fn SpecialPickup_BoostMod_TA_PickupStart(obj: usize); 50 | 51 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/boost_override_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct BoostOverridePickupWrapper(pub usize); 5 | impl_object!(BoostOverridePickupWrapper); 6 | 7 | impl BoostOverridePickup for BoostOverridePickupWrapper {} 8 | impl TargetedPickup for BoostOverridePickupWrapper {} 9 | impl RumblePickupComponent for BoostOverridePickupWrapper {} 10 | impl CarComponent for BoostOverridePickupWrapper {} 11 | impl Actor for BoostOverridePickupWrapper {} 12 | 13 | pub trait BoostOverridePickup : TargetedPickup { 14 | fn get_other_car(&self) -> Option { 15 | unsafe { 16 | CarWrapper::try_new(SpecialPickup_BoostOverride_TA_Get_OtherCar(self.addr())) 17 | } 18 | } 19 | fn pickup_end(&self) { 20 | unsafe { 21 | SpecialPickup_BoostOverride_TA_PickupEnd(self.addr()); 22 | } 23 | } 24 | fn on_target_changed(&self) { 25 | unsafe { 26 | SpecialPickup_BoostOverride_TA_OnTargetChanged(self.addr()); 27 | } 28 | } 29 | fn pickup_start(&self) { 30 | unsafe { 31 | SpecialPickup_BoostOverride_TA_PickupStart(self.addr()); 32 | } 33 | } 34 | 35 | } 36 | 37 | extern "C" { 38 | fn SpecialPickup_BoostOverride_TA_Get_OtherCar(obj: usize) -> usize; 39 | fn BoostOverridePickup_SetOtherCar(obj: usize, new_val: usize); 40 | fn SpecialPickup_BoostOverride_TA_PickupEnd(obj: usize); 41 | fn SpecialPickup_BoostOverride_TA_OnTargetChanged(obj: usize); 42 | fn SpecialPickup_BoostOverride_TA_PickupStart(obj: usize); 43 | 44 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/boost_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct BoostPickupWrapper(pub usize); 5 | impl_object!(BoostPickupWrapper); 6 | 7 | impl BoostPickup for BoostPickupWrapper {} 8 | impl VehiclePickup for BoostPickupWrapper {} 9 | impl Actor for BoostPickupWrapper {} 10 | 11 | pub trait BoostPickup : VehiclePickup { 12 | fn get_boost_amount(&self) -> f32 { 13 | unsafe { 14 | VehiclePickup_Boost_TA_Get_BoostAmount(self.addr()) 15 | } 16 | } 17 | fn get_boost_type(&self) -> u8 { 18 | unsafe { 19 | VehiclePickup_Boost_TA_Get_BoostType(self.addr()) 20 | } 21 | } 22 | fn play_picked_up_fx(&self) { 23 | unsafe { 24 | VehiclePickup_Boost_TA_PlayPickedUpFX(self.addr()); 25 | } 26 | } 27 | fn pickup(&self, car: CarWrapper) { 28 | unsafe { 29 | VehiclePickup_Boost_TA_Pickup(self.addr(), car.addr()); 30 | } 31 | } 32 | fn can_pickup(&self, car: CarWrapper) -> bool { 33 | unsafe { 34 | VehiclePickup_Boost_TA_CanPickup(self.addr(), car.addr()) 35 | } 36 | } 37 | 38 | } 39 | 40 | extern "C" { 41 | fn VehiclePickup_Boost_TA_Get_BoostAmount(obj: usize) -> f32; 42 | fn BoostPickupWrapper_SetBoostAmount(obj: usize, new_val: f32); 43 | fn VehiclePickup_Boost_TA_Get_BoostType(obj: usize) -> u8; 44 | fn BoostPickupWrapper_SetBoostType(obj: usize, new_val: u8); 45 | fn VehiclePickup_Boost_TA_PlayPickedUpFX(obj: usize); 46 | fn VehiclePickup_Boost_TA_Pickup(obj: usize, Car: usize); 47 | fn VehiclePickup_Boost_TA_CanPickup(obj: usize, Car: usize) -> bool; 48 | 49 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/camera_x.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct CameraXWrapper(pub usize); 5 | impl_object!(CameraXWrapper); 6 | 7 | impl CameraX for CameraXWrapper {} 8 | impl BaseCamera for CameraXWrapper {} 9 | impl Actor for CameraXWrapper {} 10 | 11 | pub trait CameraX : BaseCamera { 12 | fn get_pc_delta_rotation(&self) -> Rotator { 13 | unsafe { 14 | let mut result = Rotator::new(); 15 | let result_ptr: *mut Rotator = &mut result as *mut Rotator; 16 | Camera_X_Get_PCDeltaRotation(self.addr(), result_ptr); 17 | result 18 | } 19 | } 20 | fn get_old_controller_rotation(&self) -> Rotator { 21 | unsafe { 22 | let mut result = Rotator::new(); 23 | let result_ptr: *mut Rotator = &mut result as *mut Rotator; 24 | Camera_X_Get_OldControllerRotation(self.addr(), result_ptr); 25 | result 26 | } 27 | } 28 | fn get_pc_delta_location(&self) -> Vector { 29 | unsafe { 30 | let mut result = Vector::new(); 31 | let result_ptr: *mut Vector = &mut result as *mut Vector; 32 | Camera_X_Get_PCDeltaLocation(self.addr(), result_ptr); 33 | result 34 | } 35 | } 36 | fn get_old_controller_location(&self) -> Vector { 37 | unsafe { 38 | let mut result = Vector::new(); 39 | let result_ptr: *mut Vector = &mut result as *mut Vector; 40 | Camera_X_Get_OldControllerLocation(self.addr(), result_ptr); 41 | result 42 | } 43 | } 44 | fn get_shake_location_offset(&self) -> Vector { 45 | unsafe { 46 | let mut result = Vector::new(); 47 | let result_ptr: *mut Vector = &mut result as *mut Vector; 48 | Camera_X_Get_ShakeLocationOffset(self.addr(), result_ptr); 49 | result 50 | } 51 | } 52 | fn get_shake_rotation_offset(&self) -> Rotator { 53 | unsafe { 54 | let mut result = Rotator::new(); 55 | let result_ptr: *mut Rotator = &mut result as *mut Rotator; 56 | Camera_X_Get_ShakeRotationOffset(self.addr(), result_ptr); 57 | result 58 | } 59 | } 60 | fn get_shake_fov_offset(&self) -> f32 { 61 | unsafe { 62 | Camera_X_Get_ShakeFOVOffset(self.addr()) 63 | } 64 | } 65 | fn get_start_fade_color(&self) -> Color { 66 | unsafe { 67 | let mut result = Color::new(); 68 | let result_ptr: *mut Color = &mut result as *mut Color; 69 | Camera_X_Get_StartFadeColor(self.addr(), result_ptr); 70 | result 71 | } 72 | } 73 | fn get_end_fade_color(&self) -> Color { 74 | unsafe { 75 | let mut result = Color::new(); 76 | let result_ptr: *mut Color = &mut result as *mut Color; 77 | Camera_X_Get_EndFadeColor(self.addr(), result_ptr); 78 | result 79 | } 80 | } 81 | fn get_clip_offset(&self) -> Vector { 82 | unsafe { 83 | let mut result = Vector::new(); 84 | let result_ptr: *mut Vector = &mut result as *mut Vector; 85 | Camera_X_Get_ClipOffset(self.addr(), result_ptr); 86 | result 87 | } 88 | } 89 | fn get_b_disable_camera_shake(&self) -> bool { 90 | unsafe { 91 | Camera_X_Get_bDisableCameraShake(self.addr()) 92 | } 93 | } 94 | fn get_b_snap_next_transition(&self) -> bool { 95 | unsafe { 96 | Camera_X_Get_bSnapNextTransition(self.addr()) 97 | } 98 | } 99 | fn is_transitioning(&self) -> bool { 100 | unsafe { 101 | Camera_X_IsTransitioning(self.addr()) 102 | } 103 | } 104 | fn snap_transition(&self) { 105 | unsafe { 106 | Camera_X_SnapTransition(self.addr()); 107 | } 108 | } 109 | fn copy_fade(&self, other: CameraXWrapper) { 110 | unsafe { 111 | Camera_X_CopyFade(self.addr(), other.addr()); 112 | } 113 | } 114 | fn update_fade(&self, delta_time: f32) { 115 | unsafe { 116 | Camera_X_UpdateFade(self.addr(), delta_time); 117 | } 118 | } 119 | fn remove_roll(&self, in_rot: Rotator) -> Rotator { 120 | unsafe { 121 | let mut result = Rotator::new(); 122 | let result_ptr: *mut Rotator = &mut result as *mut Rotator; 123 | let mut in_rot = in_rot; 124 | let in_rot: *mut Rotator = &mut in_rot as *mut Rotator; 125 | Camera_X_RemoveRoll(self.addr(), in_rot, result_ptr); 126 | result 127 | } 128 | } 129 | fn update_camera_state(&self) { 130 | unsafe { 131 | Camera_X_UpdateCameraState(self.addr()); 132 | } 133 | } 134 | fn instance_camera_states(&self) { 135 | unsafe { 136 | Camera_X_InstanceCameraStates(self.addr()); 137 | } 138 | } 139 | fn on_loading_movie_closesd(&self) { 140 | unsafe { 141 | Camera_X_OnLoadingMovieClosesd(self.addr()); 142 | } 143 | } 144 | 145 | } 146 | 147 | extern "C" { 148 | fn Camera_X_Get_PCDeltaRotation(obj: usize, result: *mut Rotator); 149 | fn CameraXWrapper_SetPCDeltaRotation(obj: usize, new_val: *mut Rotator); 150 | fn Camera_X_Get_OldControllerRotation(obj: usize, result: *mut Rotator); 151 | fn CameraXWrapper_SetOldControllerRotation(obj: usize, new_val: *mut Rotator); 152 | fn Camera_X_Get_PCDeltaLocation(obj: usize, result: *mut Vector); 153 | fn CameraXWrapper_SetPCDeltaLocation(obj: usize, new_val: *mut Vector); 154 | fn Camera_X_Get_OldControllerLocation(obj: usize, result: *mut Vector); 155 | fn CameraXWrapper_SetOldControllerLocation(obj: usize, new_val: *mut Vector); 156 | fn Camera_X_Get_ShakeLocationOffset(obj: usize, result: *mut Vector); 157 | fn CameraXWrapper_SetShakeLocationOffset(obj: usize, new_val: *mut Vector); 158 | fn Camera_X_Get_ShakeRotationOffset(obj: usize, result: *mut Rotator); 159 | fn CameraXWrapper_SetShakeRotationOffset(obj: usize, new_val: *mut Rotator); 160 | fn Camera_X_Get_ShakeFOVOffset(obj: usize) -> f32; 161 | fn CameraXWrapper_SetShakeFOVOffset(obj: usize, new_val: f32); 162 | fn Camera_X_Get_StartFadeColor(obj: usize, result: *mut Color); 163 | fn CameraXWrapper_SetStartFadeColor(obj: usize, new_val: *mut Color); 164 | fn Camera_X_Get_EndFadeColor(obj: usize, result: *mut Color); 165 | fn CameraXWrapper_SetEndFadeColor(obj: usize, new_val: *mut Color); 166 | fn Camera_X_Get_ClipOffset(obj: usize, result: *mut Vector); 167 | fn CameraXWrapper_SetClipOffset(obj: usize, new_val: *mut Vector); 168 | fn Camera_X_Get_bDisableCameraShake(obj: usize) -> bool; 169 | fn CameraXWrapper_SetbDisableCameraShake(obj: usize, new_val: bool); 170 | fn Camera_X_Get_bSnapNextTransition(obj: usize) -> bool; 171 | fn CameraXWrapper_SetbSnapNextTransition(obj: usize, new_val: bool); 172 | fn Camera_X_IsTransitioning(obj: usize) -> bool; 173 | fn Camera_X_SnapTransition(obj: usize); 174 | fn Camera_X_CopyFade(obj: usize, Other: usize); 175 | fn Camera_X_UpdateFade(obj: usize, DeltaTime: f32); 176 | fn Camera_X_RemoveRoll(obj: usize, InRot: *mut Rotator, result: *mut Rotator); 177 | fn Camera_X_UpdateCameraState(obj: usize); 178 | fn Camera_X_InstanceCameraStates(obj: usize); 179 | fn Camera_X_OnLoadingMovieClosesd(obj: usize); 180 | 181 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/car_speed_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct CarSpeedPickupWrapper(pub usize); 5 | impl_object!(CarSpeedPickupWrapper); 6 | 7 | impl CarSpeedPickup for CarSpeedPickupWrapper {} 8 | impl RumblePickupComponent for CarSpeedPickupWrapper {} 9 | impl CarComponent for CarSpeedPickupWrapper {} 10 | impl Actor for CarSpeedPickupWrapper {} 11 | 12 | pub trait CarSpeedPickup : RumblePickupComponent { 13 | fn get_gravity_scale(&self) -> f32 { 14 | unsafe { 15 | SpecialPickup_CarGravity_TA_Get_GravityScale(self.addr()) 16 | } 17 | } 18 | fn get_added_force(&self) -> Vector { 19 | unsafe { 20 | let mut result = Vector::new(); 21 | let result_ptr: *mut Vector = &mut result as *mut Vector; 22 | SpecialPickup_CarGravity_TA_Get_AddedForce(self.addr(), result_ptr); 23 | result 24 | } 25 | } 26 | fn get_orig_gravity_scale(&self) -> f32 { 27 | unsafe { 28 | SpecialPickup_CarGravity_TA_Get_OrigGravityScale(self.addr()) 29 | } 30 | } 31 | fn pickup_end(&self) { 32 | unsafe { 33 | SpecialPickup_CarGravity_TA_PickupEnd(self.addr()); 34 | } 35 | } 36 | fn pickup_start(&self) { 37 | unsafe { 38 | SpecialPickup_CarGravity_TA_PickupStart(self.addr()); 39 | } 40 | } 41 | 42 | } 43 | 44 | extern "C" { 45 | fn SpecialPickup_CarGravity_TA_Get_GravityScale(obj: usize) -> f32; 46 | fn CarSpeedPickup_SetGravityScale(obj: usize, new_val: f32); 47 | fn SpecialPickup_CarGravity_TA_Get_AddedForce(obj: usize, result: *mut Vector); 48 | fn CarSpeedPickup_SetAddedForce(obj: usize, new_val: *mut Vector); 49 | fn SpecialPickup_CarGravity_TA_Get_OrigGravityScale(obj: usize) -> f32; 50 | fn CarSpeedPickup_SetOrigGravityScale(obj: usize, new_val: f32); 51 | fn SpecialPickup_CarGravity_TA_PickupEnd(obj: usize); 52 | fn SpecialPickup_CarGravity_TA_PickupStart(obj: usize); 53 | 54 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/demolish_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct DemolishPickupWrapper(pub usize); 5 | impl_object!(DemolishPickupWrapper); 6 | 7 | impl DemolishPickup for DemolishPickupWrapper {} 8 | impl RumblePickupComponent for DemolishPickupWrapper {} 9 | impl CarComponent for DemolishPickupWrapper {} 10 | impl Actor for DemolishPickupWrapper {} 11 | 12 | pub trait DemolishPickup : RumblePickupComponent { 13 | fn get_demolish_target(&self) -> u8 { 14 | unsafe { 15 | SpecialPickup_Demolish_TA_Get_DemolishTarget(self.addr()) 16 | } 17 | } 18 | fn get_demolish_speed(&self) -> u8 { 19 | unsafe { 20 | SpecialPickup_Demolish_TA_Get_DemolishSpeed(self.addr()) 21 | } 22 | } 23 | fn get_old_target(&self) -> u8 { 24 | unsafe { 25 | SpecialPickup_Demolish_TA_Get_OldTarget(self.addr()) 26 | } 27 | } 28 | fn get_old_speed(&self) -> u8 { 29 | unsafe { 30 | SpecialPickup_Demolish_TA_Get_OldSpeed(self.addr()) 31 | } 32 | } 33 | fn pickup_end(&self) { 34 | unsafe { 35 | SpecialPickup_Demolish_TA_PickupEnd(self.addr()); 36 | } 37 | } 38 | fn pickup_start(&self) { 39 | unsafe { 40 | SpecialPickup_Demolish_TA_PickupStart(self.addr()); 41 | } 42 | } 43 | 44 | } 45 | 46 | extern "C" { 47 | fn SpecialPickup_Demolish_TA_Get_DemolishTarget(obj: usize) -> u8; 48 | fn DemolishPickup_SetDemolishTarget(obj: usize, new_val: u8); 49 | fn SpecialPickup_Demolish_TA_Get_DemolishSpeed(obj: usize) -> u8; 50 | fn DemolishPickup_SetDemolishSpeed(obj: usize, new_val: u8); 51 | fn SpecialPickup_Demolish_TA_Get_OldTarget(obj: usize) -> u8; 52 | fn DemolishPickup_SetOldTarget(obj: usize, new_val: u8); 53 | fn SpecialPickup_Demolish_TA_Get_OldSpeed(obj: usize) -> u8; 54 | fn DemolishPickup_SetOldSpeed(obj: usize, new_val: u8); 55 | fn SpecialPickup_Demolish_TA_PickupEnd(obj: usize); 56 | fn SpecialPickup_Demolish_TA_PickupStart(obj: usize); 57 | 58 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/dodge_component.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct DodgeComponentWrapper(pub usize); 5 | impl_object!(DodgeComponentWrapper); 6 | 7 | impl DodgeComponent for DodgeComponentWrapper {} 8 | impl CarComponent for DodgeComponentWrapper {} 9 | impl Actor for DodgeComponentWrapper {} 10 | 11 | pub trait DodgeComponent : CarComponent { 12 | fn get_dodge_input_threshold(&self) -> f32 { 13 | unsafe { 14 | CarComponent_Dodge_TA_Get_DodgeInputThreshold(self.addr()) 15 | } 16 | } 17 | fn get_side_dodge_impulse(&self) -> f32 { 18 | unsafe { 19 | CarComponent_Dodge_TA_Get_SideDodgeImpulse(self.addr()) 20 | } 21 | } 22 | fn get_side_dodge_impulse_max_speed_scale(&self) -> f32 { 23 | unsafe { 24 | CarComponent_Dodge_TA_Get_SideDodgeImpulseMaxSpeedScale(self.addr()) 25 | } 26 | } 27 | fn get_forward_dodge_impulse(&self) -> f32 { 28 | unsafe { 29 | CarComponent_Dodge_TA_Get_ForwardDodgeImpulse(self.addr()) 30 | } 31 | } 32 | fn get_forward_dodge_impulse_max_speed_scale(&self) -> f32 { 33 | unsafe { 34 | CarComponent_Dodge_TA_Get_ForwardDodgeImpulseMaxSpeedScale(self.addr()) 35 | } 36 | } 37 | fn get_backward_dodge_impulse(&self) -> f32 { 38 | unsafe { 39 | CarComponent_Dodge_TA_Get_BackwardDodgeImpulse(self.addr()) 40 | } 41 | } 42 | fn get_backward_dodge_impulse_max_speed_scale(&self) -> f32 { 43 | unsafe { 44 | CarComponent_Dodge_TA_Get_BackwardDodgeImpulseMaxSpeedScale(self.addr()) 45 | } 46 | } 47 | fn get_side_dodge_torque(&self) -> f32 { 48 | unsafe { 49 | CarComponent_Dodge_TA_Get_SideDodgeTorque(self.addr()) 50 | } 51 | } 52 | fn get_forward_dodge_torque(&self) -> f32 { 53 | unsafe { 54 | CarComponent_Dodge_TA_Get_ForwardDodgeTorque(self.addr()) 55 | } 56 | } 57 | fn get_dodge_torque_time(&self) -> f32 { 58 | unsafe { 59 | CarComponent_Dodge_TA_Get_DodgeTorqueTime(self.addr()) 60 | } 61 | } 62 | fn get_min_dodge_torque_time(&self) -> f32 { 63 | unsafe { 64 | CarComponent_Dodge_TA_Get_MinDodgeTorqueTime(self.addr()) 65 | } 66 | } 67 | fn get_dodge_z_damping(&self) -> f32 { 68 | unsafe { 69 | CarComponent_Dodge_TA_Get_DodgeZDamping(self.addr()) 70 | } 71 | } 72 | fn get_dodge_z_damping_delay(&self) -> f32 { 73 | unsafe { 74 | CarComponent_Dodge_TA_Get_DodgeZDampingDelay(self.addr()) 75 | } 76 | } 77 | fn get_dodge_z_damping_up_time(&self) -> f32 { 78 | unsafe { 79 | CarComponent_Dodge_TA_Get_DodgeZDampingUpTime(self.addr()) 80 | } 81 | } 82 | fn get_dodge_impulse_scale(&self) -> f32 { 83 | unsafe { 84 | CarComponent_Dodge_TA_Get_DodgeImpulseScale(self.addr()) 85 | } 86 | } 87 | fn get_dodge_torque_scale(&self) -> f32 { 88 | unsafe { 89 | CarComponent_Dodge_TA_Get_DodgeTorqueScale(self.addr()) 90 | } 91 | } 92 | fn get_dodge_torque(&self) -> Vector { 93 | unsafe { 94 | let mut result = Vector::new(); 95 | let result_ptr: *mut Vector = &mut result as *mut Vector; 96 | CarComponent_Dodge_TA_Get_DodgeTorque(self.addr(), result_ptr); 97 | result 98 | } 99 | } 100 | fn get_dodge_direction(&self) -> Vector { 101 | unsafe { 102 | let mut result = Vector::new(); 103 | let result_ptr: *mut Vector = &mut result as *mut Vector; 104 | CarComponent_Dodge_TA_Get_DodgeDirection(self.addr(), result_ptr); 105 | result 106 | } 107 | } 108 | fn set_dodge_settings(&self) { 109 | unsafe { 110 | CarComponent_Dodge_TA_SetDodgeSettings(self.addr()); 111 | } 112 | } 113 | fn apply_torque_forces(&self, active_time: f32) { 114 | unsafe { 115 | CarComponent_Dodge_TA_ApplyTorqueForces(self.addr(), active_time); 116 | } 117 | } 118 | fn apply_dodge_impulse(&self) { 119 | unsafe { 120 | CarComponent_Dodge_TA_ApplyDodgeImpulse(self.addr()); 121 | } 122 | } 123 | fn get_dodge_impulse(&self, dodge_dir: Vector) -> Vector { 124 | unsafe { 125 | let mut result = Vector::new(); 126 | let result_ptr: *mut Vector = &mut result as *mut Vector; 127 | let mut dodge_dir = dodge_dir; 128 | let dodge_dir: *mut Vector = &mut dodge_dir as *mut Vector; 129 | CarComponent_Dodge_TA_GetDodgeImpulse(self.addr(), dodge_dir, result_ptr); 130 | result 131 | } 132 | } 133 | fn apply_forces(&self, active_time: f32) { 134 | unsafe { 135 | CarComponent_Dodge_TA_ApplyForces(self.addr(), active_time); 136 | } 137 | } 138 | fn can_activate(&self) -> bool { 139 | unsafe { 140 | CarComponent_Dodge_TA_CanActivate(self.addr()) 141 | } 142 | } 143 | fn on_created(&self) { 144 | unsafe { 145 | CarComponent_Dodge_TA_OnCreated(self.addr()); 146 | } 147 | } 148 | 149 | } 150 | 151 | extern "C" { 152 | fn CarComponent_Dodge_TA_Get_DodgeInputThreshold(obj: usize) -> f32; 153 | fn DodgeComponentWrapper_SetDodgeInputThreshold(obj: usize, new_val: f32); 154 | fn CarComponent_Dodge_TA_Get_SideDodgeImpulse(obj: usize) -> f32; 155 | fn DodgeComponentWrapper_SetSideDodgeImpulse(obj: usize, new_val: f32); 156 | fn CarComponent_Dodge_TA_Get_SideDodgeImpulseMaxSpeedScale(obj: usize) -> f32; 157 | fn DodgeComponentWrapper_SetSideDodgeImpulseMaxSpeedScale(obj: usize, new_val: f32); 158 | fn CarComponent_Dodge_TA_Get_ForwardDodgeImpulse(obj: usize) -> f32; 159 | fn DodgeComponentWrapper_SetForwardDodgeImpulse(obj: usize, new_val: f32); 160 | fn CarComponent_Dodge_TA_Get_ForwardDodgeImpulseMaxSpeedScale(obj: usize) -> f32; 161 | fn DodgeComponentWrapper_SetForwardDodgeImpulseMaxSpeedScale(obj: usize, new_val: f32); 162 | fn CarComponent_Dodge_TA_Get_BackwardDodgeImpulse(obj: usize) -> f32; 163 | fn DodgeComponentWrapper_SetBackwardDodgeImpulse(obj: usize, new_val: f32); 164 | fn CarComponent_Dodge_TA_Get_BackwardDodgeImpulseMaxSpeedScale(obj: usize) -> f32; 165 | fn DodgeComponentWrapper_SetBackwardDodgeImpulseMaxSpeedScale(obj: usize, new_val: f32); 166 | fn CarComponent_Dodge_TA_Get_SideDodgeTorque(obj: usize) -> f32; 167 | fn DodgeComponentWrapper_SetSideDodgeTorque(obj: usize, new_val: f32); 168 | fn CarComponent_Dodge_TA_Get_ForwardDodgeTorque(obj: usize) -> f32; 169 | fn DodgeComponentWrapper_SetForwardDodgeTorque(obj: usize, new_val: f32); 170 | fn CarComponent_Dodge_TA_Get_DodgeTorqueTime(obj: usize) -> f32; 171 | fn DodgeComponentWrapper_SetDodgeTorqueTime(obj: usize, new_val: f32); 172 | fn CarComponent_Dodge_TA_Get_MinDodgeTorqueTime(obj: usize) -> f32; 173 | fn DodgeComponentWrapper_SetMinDodgeTorqueTime(obj: usize, new_val: f32); 174 | fn CarComponent_Dodge_TA_Get_DodgeZDamping(obj: usize) -> f32; 175 | fn DodgeComponentWrapper_SetDodgeZDamping(obj: usize, new_val: f32); 176 | fn CarComponent_Dodge_TA_Get_DodgeZDampingDelay(obj: usize) -> f32; 177 | fn DodgeComponentWrapper_SetDodgeZDampingDelay(obj: usize, new_val: f32); 178 | fn CarComponent_Dodge_TA_Get_DodgeZDampingUpTime(obj: usize) -> f32; 179 | fn DodgeComponentWrapper_SetDodgeZDampingUpTime(obj: usize, new_val: f32); 180 | fn CarComponent_Dodge_TA_Get_DodgeImpulseScale(obj: usize) -> f32; 181 | fn DodgeComponentWrapper_SetDodgeImpulseScale(obj: usize, new_val: f32); 182 | fn CarComponent_Dodge_TA_Get_DodgeTorqueScale(obj: usize) -> f32; 183 | fn DodgeComponentWrapper_SetDodgeTorqueScale(obj: usize, new_val: f32); 184 | fn CarComponent_Dodge_TA_Get_DodgeTorque(obj: usize, result: *mut Vector); 185 | fn DodgeComponentWrapper_SetDodgeTorque(obj: usize, new_val: *mut Vector); 186 | fn CarComponent_Dodge_TA_Get_DodgeDirection(obj: usize, result: *mut Vector); 187 | fn DodgeComponentWrapper_SetDodgeDirection(obj: usize, new_val: *mut Vector); 188 | fn CarComponent_Dodge_TA_SetDodgeSettings(obj: usize); 189 | fn CarComponent_Dodge_TA_ApplyTorqueForces(obj: usize, ActiveTime: f32); 190 | fn CarComponent_Dodge_TA_ApplyDodgeImpulse(obj: usize); 191 | fn CarComponent_Dodge_TA_GetDodgeImpulse(obj: usize, DodgeDir: *mut Vector, result: *mut Vector); 192 | fn CarComponent_Dodge_TA_ApplyForces(obj: usize, ActiveTime: f32); 193 | fn CarComponent_Dodge_TA_CanActivate(obj: usize) -> bool; 194 | fn CarComponent_Dodge_TA_OnCreated(obj: usize); 195 | 196 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/double_jump_component.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct DoubleJumpComponentWrapper(pub usize); 5 | impl_object!(DoubleJumpComponentWrapper); 6 | 7 | impl DoubleJumpComponent for DoubleJumpComponentWrapper {} 8 | impl CarComponent for DoubleJumpComponentWrapper {} 9 | impl Actor for DoubleJumpComponentWrapper {} 10 | 11 | pub trait DoubleJumpComponent : CarComponent { 12 | fn get_impulse_scale(&self) -> f32 { 13 | unsafe { 14 | CarComponent_DoubleJump_TA_Get_ImpulseScale(self.addr()) 15 | } 16 | } 17 | fn apply_forces(&self, active_time: f32) { 18 | unsafe { 19 | CarComponent_DoubleJump_TA_ApplyForces(self.addr(), active_time); 20 | } 21 | } 22 | fn on_created(&self) { 23 | unsafe { 24 | CarComponent_DoubleJump_TA_OnCreated(self.addr()); 25 | } 26 | } 27 | 28 | } 29 | 30 | extern "C" { 31 | fn DoubleJumpComponentWrapper_SetJumpImpulse(obj: usize, new_val: f32); 32 | fn CarComponent_DoubleJump_TA_Get_ImpulseScale(obj: usize) -> f32; 33 | fn DoubleJumpComponentWrapper_SetImpulseScale(obj: usize, new_val: f32); 34 | fn CarComponent_DoubleJump_TA_ApplyForces(obj: usize, ActiveTime: f32); 35 | fn CarComponent_DoubleJump_TA_OnCreated(obj: usize); 36 | 37 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/flip_car_component.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct FlipCarComponentWrapper(pub usize); 5 | impl_object!(FlipCarComponentWrapper); 6 | 7 | impl FlipCarComponent for FlipCarComponentWrapper {} 8 | impl CarComponent for FlipCarComponentWrapper {} 9 | impl Actor for FlipCarComponentWrapper {} 10 | 11 | pub trait FlipCarComponent : CarComponent { 12 | fn get_flip_car_impulse(&self) -> f32 { 13 | unsafe { 14 | CarComponent_FlipCar_TA_Get_FlipCarImpulse(self.addr()) 15 | } 16 | } 17 | fn get_flip_car_torque(&self) -> f32 { 18 | unsafe { 19 | CarComponent_FlipCar_TA_Get_FlipCarTorque(self.addr()) 20 | } 21 | } 22 | fn get_flip_car_time(&self) -> f32 { 23 | unsafe { 24 | CarComponent_FlipCar_TA_Get_FlipCarTime(self.addr()) 25 | } 26 | } 27 | fn get_b_flip_right(&self) -> bool { 28 | unsafe { 29 | CarComponent_FlipCar_TA_Get_bFlipRight(self.addr()) 30 | } 31 | } 32 | fn init_flip(&self) { 33 | unsafe { 34 | CarComponent_FlipCar_TA_InitFlip(self.addr()); 35 | } 36 | } 37 | fn apply_forces(&self, active_time: f32) { 38 | unsafe { 39 | CarComponent_FlipCar_TA_ApplyForces(self.addr(), active_time); 40 | } 41 | } 42 | fn can_activate(&self) -> bool { 43 | unsafe { 44 | CarComponent_FlipCar_TA_CanActivate(self.addr()) 45 | } 46 | } 47 | fn on_created(&self) { 48 | unsafe { 49 | CarComponent_FlipCar_TA_OnCreated(self.addr()); 50 | } 51 | } 52 | 53 | } 54 | 55 | extern "C" { 56 | fn CarComponent_FlipCar_TA_Get_FlipCarImpulse(obj: usize) -> f32; 57 | fn FlipCarComponentWrapper_SetFlipCarImpulse(obj: usize, new_val: f32); 58 | fn CarComponent_FlipCar_TA_Get_FlipCarTorque(obj: usize) -> f32; 59 | fn FlipCarComponentWrapper_SetFlipCarTorque(obj: usize, new_val: f32); 60 | fn CarComponent_FlipCar_TA_Get_FlipCarTime(obj: usize) -> f32; 61 | fn FlipCarComponentWrapper_SetFlipCarTime(obj: usize, new_val: f32); 62 | fn CarComponent_FlipCar_TA_Get_bFlipRight(obj: usize) -> bool; 63 | fn FlipCarComponentWrapper_SetbFlipRight(obj: usize, new_val: bool); 64 | fn CarComponent_FlipCar_TA_InitFlip(obj: usize); 65 | fn CarComponent_FlipCar_TA_ApplyForces(obj: usize, ActiveTime: f32); 66 | fn CarComponent_FlipCar_TA_CanActivate(obj: usize) -> bool; 67 | fn CarComponent_FlipCar_TA_OnCreated(obj: usize); 68 | 69 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/fx_actor.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct FXActorWrapper(pub usize); 5 | impl_object!(FXActorWrapper); 6 | 7 | impl FXActor for FXActorWrapper {} 8 | impl Actor for FXActorWrapper {} 9 | 10 | pub trait FXActor : Actor { 11 | fn get_b_deactivate_when_owner_destroyed(&self) -> bool { 12 | unsafe { 13 | FXActor_X_Get_bDeactivateWhenOwnerDestroyed(self.addr()) 14 | } 15 | } 16 | fn get_b_allow_shadow_casting(&self) -> bool { 17 | unsafe { 18 | FXActor_X_Get_bAllowShadowCasting(self.addr()) 19 | } 20 | } 21 | fn get_b_auto_activate(&self) -> bool { 22 | unsafe { 23 | FXActor_X_Get_bAutoActivate(self.addr()) 24 | } 25 | } 26 | fn get_b_render_inactive(&self) -> bool { 27 | unsafe { 28 | FXActor_X_Get_bRenderInactive(self.addr()) 29 | } 30 | } 31 | fn get_b_active(&self) -> bool { 32 | unsafe { 33 | FXActor_X_Get_bActive(self.addr()) 34 | } 35 | } 36 | fn get_b_had_owner(&self) -> bool { 37 | unsafe { 38 | FXActor_X_Get_bHadOwner(self.addr()) 39 | } 40 | } 41 | fn get_parent(&self) -> Option { 42 | unsafe { 43 | FXActorWrapper::try_new(FXActor_X_Get_Parent(self.addr())) 44 | } 45 | } 46 | fn get_attachment_actor(&self) -> Option { 47 | unsafe { 48 | ActorWrapper::try_new(FXActor_X_Get_AttachmentActor(self.addr())) 49 | } 50 | } 51 | fn get_destroy_wait_time(&self) -> f32 { 52 | unsafe { 53 | FXActor_X_Get_DestroyWaitTime(self.addr()) 54 | } 55 | } 56 | fn get_destroy_time(&self) -> f32 { 57 | unsafe { 58 | FXActor_X_Get_DestroyTime(self.addr()) 59 | } 60 | } 61 | fn get_edit_id(&self) -> i32 { 62 | unsafe { 63 | FXActor_X_Get_EditID(self.addr()) 64 | } 65 | } 66 | fn inherit(&self, other: FXActorWrapper) { 67 | unsafe { 68 | FXActor_X_Inherit(self.addr(), other.addr()); 69 | } 70 | } 71 | fn reset_particles(&self) { 72 | unsafe { 73 | FXActor_X_ResetParticles(self.addr()); 74 | } 75 | } 76 | fn stop_all_effects(&self) { 77 | unsafe { 78 | FXActor_X_StopAllEffects(self.addr()); 79 | } 80 | } 81 | fn update_fx_states(&self) { 82 | unsafe { 83 | FXActor_X_UpdateFXStates(self.addr()); 84 | } 85 | } 86 | fn is_locally_controlled(&self) -> bool { 87 | unsafe { 88 | FXActor_X_IsLocallyControlled(self.addr()) 89 | } 90 | } 91 | fn deactivate(&self) { 92 | unsafe { 93 | FXActor_X_Deactivate(self.addr()); 94 | } 95 | } 96 | fn activate(&self) { 97 | unsafe { 98 | FXActor_X_Activate(self.addr()); 99 | } 100 | } 101 | fn bind_to(&self, parent_fx_actor: FXActorWrapper) { 102 | unsafe { 103 | FXActor_X_BindTo(self.addr(), parent_fx_actor.addr()); 104 | } 105 | } 106 | fn set_attachment_actor2(&self, attach_to_actor: ActorWrapper) { 107 | unsafe { 108 | FXActor_X_SetAttachmentActor2(self.addr(), attach_to_actor.addr()); 109 | } 110 | } 111 | fn post_begin_play(&self) { 112 | unsafe { 113 | FXActor_X_PostBeginPlay(self.addr()); 114 | } 115 | } 116 | 117 | } 118 | 119 | extern "C" { 120 | fn FXActor_X_Get_bDeactivateWhenOwnerDestroyed(obj: usize) -> bool; 121 | fn FXActorWrapper_SetbDeactivateWhenOwnerDestroyed(obj: usize, new_val: bool); 122 | fn FXActor_X_Get_bAllowShadowCasting(obj: usize) -> bool; 123 | fn FXActorWrapper_SetbAllowShadowCasting(obj: usize, new_val: bool); 124 | fn FXActor_X_Get_bAutoActivate(obj: usize) -> bool; 125 | fn FXActorWrapper_SetbAutoActivate(obj: usize, new_val: bool); 126 | fn FXActor_X_Get_bRenderInactive(obj: usize) -> bool; 127 | fn FXActorWrapper_SetbRenderInactive(obj: usize, new_val: bool); 128 | fn FXActor_X_Get_bActive(obj: usize) -> bool; 129 | fn FXActorWrapper_SetbActive(obj: usize, new_val: bool); 130 | fn FXActor_X_Get_bHadOwner(obj: usize) -> bool; 131 | fn FXActorWrapper_SetbHadOwner(obj: usize, new_val: bool); 132 | fn FXActor_X_Get_Parent(obj: usize) -> usize; 133 | fn FXActorWrapper_SetParent(obj: usize, new_val: usize); 134 | fn FXActor_X_Get_AttachmentActor(obj: usize) -> usize; 135 | fn FXActorWrapper_SetAttachmentActor(obj: usize, new_val: usize); 136 | fn FXActor_X_Get_DestroyWaitTime(obj: usize) -> f32; 137 | fn FXActorWrapper_SetDestroyWaitTime(obj: usize, new_val: f32); 138 | fn FXActor_X_Get_DestroyTime(obj: usize) -> f32; 139 | fn FXActorWrapper_SetDestroyTime(obj: usize, new_val: f32); 140 | fn FXActor_X_Get_EditID(obj: usize) -> i32; 141 | fn FXActorWrapper_SetEditID(obj: usize, new_val: i32); 142 | fn FXActor_X_Inherit(obj: usize, Other: usize); 143 | fn FXActor_X_ResetParticles(obj: usize); 144 | fn FXActor_X_StopAllEffects(obj: usize); 145 | fn FXActor_X_UpdateFXStates(obj: usize); 146 | fn FXActor_X_IsLocallyControlled(obj: usize) -> bool; 147 | fn FXActor_X_Deactivate(obj: usize); 148 | fn FXActor_X_Activate(obj: usize); 149 | fn FXActor_X_BindTo(obj: usize, ParentFXActor: usize); 150 | fn FXActor_X_SetAttachmentActor2(obj: usize, AttachToActor: usize); 151 | fn FXActor_X_PostBeginPlay(obj: usize); 152 | 153 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/game_editor_save_data.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct GameEditorSaveDataWrapper(pub usize); 5 | impl_object!(GameEditorSaveDataWrapper); 6 | 7 | impl GameEditorSaveData for GameEditorSaveDataWrapper {} 8 | impl SaveData for GameEditorSaveDataWrapper {} 9 | 10 | pub trait GameEditorSaveData : SaveData { 11 | fn get_loaded_save_name(&self) -> RLString { 12 | unsafe { 13 | let mut result = RLString::new(); 14 | let result_ptr: *mut RLString = &mut result as *mut RLString; 15 | SaveData_GameEditor_Training_TA_Get_LoadedSaveName(self.addr(), result_ptr); 16 | result 17 | } 18 | } 19 | fn get_training_data(&self) -> Option { 20 | unsafe { 21 | TrainingEditorSaveDataWrapper::try_new(SaveData_GameEditor_Training_TA_Get_TrainingData(self.addr())) 22 | } 23 | } 24 | fn get_player_team_number(&self) -> i32 { 25 | unsafe { 26 | SaveData_GameEditor_Training_TA_Get_PlayerTeamNumber(self.addr()) 27 | } 28 | } 29 | fn get_b_unowned(&self) -> bool { 30 | unsafe { 31 | SaveData_GameEditor_Training_TA_Get_bUnowned(self.addr()) 32 | } 33 | } 34 | fn get_shots_completed(&self) -> i32 { 35 | unsafe { 36 | SaveData_GameEditor_Training_TA_Get_ShotsCompleted(self.addr()) 37 | } 38 | } 39 | fn get_favorites_folder_path(&self) -> RLString { 40 | unsafe { 41 | let mut result = RLString::new(); 42 | let result_ptr: *mut RLString = &mut result as *mut RLString; 43 | SaveData_GameEditor_Training_TA_Get_FavoritesFolderPath(self.addr(), result_ptr); 44 | result 45 | } 46 | } 47 | fn get_my_training_folder_path(&self) -> RLString { 48 | unsafe { 49 | let mut result = RLString::new(); 50 | let result_ptr: *mut RLString = &mut result as *mut RLString; 51 | SaveData_GameEditor_Training_TA_Get_MyTrainingFolderPath(self.addr(), result_ptr); 52 | result 53 | } 54 | } 55 | fn get_downloaded_folder_path(&self) -> RLString { 56 | unsafe { 57 | let mut result = RLString::new(); 58 | let result_ptr: *mut RLString = &mut result as *mut RLString; 59 | SaveData_GameEditor_Training_TA_Get_DownloadedFolderPath(self.addr(), result_ptr); 60 | result 61 | } 62 | } 63 | fn get_training_save_type(&self, b_owned: bool, b_favorited: bool) -> u8 { 64 | unsafe { 65 | SaveData_GameEditor_Training_TA_GetTrainingSaveType(self.addr(), b_owned, b_favorited) 66 | } 67 | } 68 | fn init(&self) { 69 | unsafe { 70 | SaveData_GameEditor_Training_TA_Init(self.addr()); 71 | } 72 | } 73 | 74 | } 75 | 76 | extern "C" { 77 | fn SaveData_GameEditor_Training_TA_Get_LoadedSaveName(obj: usize, result: *mut RLString); 78 | fn SaveData_GameEditor_Training_TA_Get_TrainingData(obj: usize) -> usize; 79 | fn GameEditorSaveDataWrapper_SetTrainingData(obj: usize, new_val: usize); 80 | fn SaveData_GameEditor_Training_TA_Get_PlayerTeamNumber(obj: usize) -> i32; 81 | fn GameEditorSaveDataWrapper_SetPlayerTeamNumber(obj: usize, new_val: i32); 82 | fn SaveData_GameEditor_Training_TA_Get_bUnowned(obj: usize) -> bool; 83 | fn GameEditorSaveDataWrapper_SetbUnowned(obj: usize, new_val: bool); 84 | fn SaveData_GameEditor_Training_TA_Get_ShotsCompleted(obj: usize) -> i32; 85 | fn GameEditorSaveDataWrapper_SetShotsCompleted(obj: usize, new_val: i32); 86 | fn SaveData_GameEditor_Training_TA_Get_FavoritesFolderPath(obj: usize, result: *mut RLString); 87 | fn SaveData_GameEditor_Training_TA_Get_MyTrainingFolderPath(obj: usize, result: *mut RLString); 88 | fn SaveData_GameEditor_Training_TA_Get_DownloadedFolderPath(obj: usize, result: *mut RLString); 89 | fn SaveData_GameEditor_Training_TA_GetTrainingSaveType(obj: usize, bOwned: bool, bFavorited: bool) -> u8; 90 | fn SaveData_GameEditor_Training_TA_Init(obj: usize); 91 | 92 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/game_setting_playlist.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct GameSettingPlaylistWrapper(pub usize); 5 | impl_object!(GameSettingPlaylistWrapper); 6 | 7 | impl GameSettingPlaylist for GameSettingPlaylistWrapper {} 8 | 9 | pub trait GameSettingPlaylist : Object { 10 | fn get_title(&self) -> RLString { 11 | unsafe { 12 | let mut result = RLString::new(); 13 | let result_ptr: *mut RLString = &mut result as *mut RLString; 14 | GameSettingPlaylist_X_Get_Title(self.addr(), result_ptr); 15 | result 16 | } 17 | } 18 | fn get_description(&self) -> RLString { 19 | unsafe { 20 | let mut result = RLString::new(); 21 | let result_ptr: *mut RLString = &mut result as *mut RLString; 22 | GameSettingPlaylist_X_Get_Description(self.addr(), result_ptr); 23 | result 24 | } 25 | } 26 | fn get_player_count(&self) -> i32 { 27 | unsafe { 28 | GameSettingPlaylist_X_Get_PlayerCount(self.addr()) 29 | } 30 | } 31 | fn get_b_standard(&self) -> bool { 32 | unsafe { 33 | GameSettingPlaylist_X_Get_bStandard(self.addr()) 34 | } 35 | } 36 | fn get_b_ranked(&self) -> bool { 37 | unsafe { 38 | GameSettingPlaylist_X_Get_bRanked(self.addr()) 39 | } 40 | } 41 | fn get_b_solo(&self) -> bool { 42 | unsafe { 43 | GameSettingPlaylist_X_Get_bSolo(self.addr()) 44 | } 45 | } 46 | fn get_b_new(&self) -> bool { 47 | unsafe { 48 | GameSettingPlaylist_X_Get_bNew(self.addr()) 49 | } 50 | } 51 | fn get_b_apply_quit_penalty(&self) -> bool { 52 | unsafe { 53 | GameSettingPlaylist_X_Get_bApplyQuitPenalty(self.addr()) 54 | } 55 | } 56 | fn get_b_allow_forfeit(&self) -> bool { 57 | unsafe { 58 | GameSettingPlaylist_X_Get_bAllowForfeit(self.addr()) 59 | } 60 | } 61 | fn get_b_disable_ranked_reconnect(&self) -> bool { 62 | unsafe { 63 | GameSettingPlaylist_X_Get_bDisableRankedReconnect(self.addr()) 64 | } 65 | } 66 | fn get_b_ignore_assign_teams(&self) -> bool { 67 | unsafe { 68 | GameSettingPlaylist_X_Get_bIgnoreAssignTeams(self.addr()) 69 | } 70 | } 71 | fn get_b_kick_on_migrate(&self) -> bool { 72 | unsafe { 73 | GameSettingPlaylist_X_Get_bKickOnMigrate(self.addr()) 74 | } 75 | } 76 | fn get_b_allow_clubs(&self) -> bool { 77 | unsafe { 78 | GameSettingPlaylist_X_Get_bAllowClubs(self.addr()) 79 | } 80 | } 81 | fn get_b_players_vs_bots(&self) -> bool { 82 | unsafe { 83 | GameSettingPlaylist_X_Get_bPlayersVSBots(self.addr()) 84 | } 85 | } 86 | fn get_playlist_id(&self) -> i32 { 87 | unsafe { 88 | GameSettingPlaylist_X_Get_PlaylistId(self.addr()) 89 | } 90 | } 91 | fn get_server_command(&self) -> RLString { 92 | unsafe { 93 | let mut result = RLString::new(); 94 | let result_ptr: *mut RLString = &mut result as *mut RLString; 95 | GameSettingPlaylist_X_Get_ServerCommand(self.addr(), result_ptr); 96 | result 97 | } 98 | } 99 | fn is_lan_match(&self) -> bool { 100 | unsafe { 101 | GameSettingPlaylist_X_IsLanMatch(self.addr()) 102 | } 103 | } 104 | fn is_private_match(&self) -> bool { 105 | unsafe { 106 | GameSettingPlaylist_X_IsPrivateMatch(self.addr()) 107 | } 108 | } 109 | fn should_update_skills(&self) -> bool { 110 | unsafe { 111 | GameSettingPlaylist_X_ShouldUpdateSkills(self.addr()) 112 | } 113 | } 114 | fn is_valid_id(&self, in_playlist_id: i32) -> bool { 115 | unsafe { 116 | GameSettingPlaylist_X_IsValidID(self.addr(), in_playlist_id) 117 | } 118 | } 119 | fn is_valid(&self) -> bool { 120 | unsafe { 121 | GameSettingPlaylist_X_IsValid(self.addr()) 122 | } 123 | } 124 | 125 | } 126 | 127 | extern "C" { 128 | fn GameSettingPlaylist_X_Get_Title(obj: usize, result: *mut RLString); 129 | fn GameSettingPlaylist_X_Get_Description(obj: usize, result: *mut RLString); 130 | fn GameSettingPlaylist_X_Get_PlayerCount(obj: usize) -> i32; 131 | fn GameSettingPlaylistWrapper_SetPlayerCount(obj: usize, new_val: i32); 132 | fn GameSettingPlaylist_X_Get_bStandard(obj: usize) -> bool; 133 | fn GameSettingPlaylistWrapper_SetbStandard(obj: usize, new_val: bool); 134 | fn GameSettingPlaylist_X_Get_bRanked(obj: usize) -> bool; 135 | fn GameSettingPlaylistWrapper_SetbRanked(obj: usize, new_val: bool); 136 | fn GameSettingPlaylist_X_Get_bSolo(obj: usize) -> bool; 137 | fn GameSettingPlaylistWrapper_SetbSolo(obj: usize, new_val: bool); 138 | fn GameSettingPlaylist_X_Get_bNew(obj: usize) -> bool; 139 | fn GameSettingPlaylistWrapper_SetbNew(obj: usize, new_val: bool); 140 | fn GameSettingPlaylist_X_Get_bApplyQuitPenalty(obj: usize) -> bool; 141 | fn GameSettingPlaylistWrapper_SetbApplyQuitPenalty(obj: usize, new_val: bool); 142 | fn GameSettingPlaylist_X_Get_bAllowForfeit(obj: usize) -> bool; 143 | fn GameSettingPlaylistWrapper_SetbAllowForfeit(obj: usize, new_val: bool); 144 | fn GameSettingPlaylist_X_Get_bDisableRankedReconnect(obj: usize) -> bool; 145 | fn GameSettingPlaylistWrapper_SetbDisableRankedReconnect(obj: usize, new_val: bool); 146 | fn GameSettingPlaylist_X_Get_bIgnoreAssignTeams(obj: usize) -> bool; 147 | fn GameSettingPlaylistWrapper_SetbIgnoreAssignTeams(obj: usize, new_val: bool); 148 | fn GameSettingPlaylist_X_Get_bKickOnMigrate(obj: usize) -> bool; 149 | fn GameSettingPlaylistWrapper_SetbKickOnMigrate(obj: usize, new_val: bool); 150 | fn GameSettingPlaylist_X_Get_bAllowClubs(obj: usize) -> bool; 151 | fn GameSettingPlaylistWrapper_SetbAllowClubs(obj: usize, new_val: bool); 152 | fn GameSettingPlaylist_X_Get_bPlayersVSBots(obj: usize) -> bool; 153 | fn GameSettingPlaylistWrapper_SetbPlayersVSBots(obj: usize, new_val: bool); 154 | fn GameSettingPlaylist_X_Get_PlaylistId(obj: usize) -> i32; 155 | fn GameSettingPlaylistWrapper_SetPlaylistId(obj: usize, new_val: i32); 156 | fn GameSettingPlaylist_X_Get_ServerCommand(obj: usize, result: *mut RLString); 157 | fn GameSettingPlaylist_X_IsLanMatch(obj: usize) -> bool; 158 | fn GameSettingPlaylist_X_IsPrivateMatch(obj: usize) -> bool; 159 | fn GameSettingPlaylist_X_ShouldUpdateSkills(obj: usize) -> bool; 160 | fn GameSettingPlaylist_X_IsValidID(obj: usize, InPlaylistID: i32) -> bool; 161 | fn GameSettingPlaylist_X_IsValid(obj: usize) -> bool; 162 | 163 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/gravity_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct GravityPickupWrapper(pub usize); 5 | impl_object!(GravityPickupWrapper); 6 | 7 | impl GravityPickup for GravityPickupWrapper {} 8 | impl RumblePickupComponent for GravityPickupWrapper {} 9 | impl CarComponent for GravityPickupWrapper {} 10 | impl Actor for GravityPickupWrapper {} 11 | 12 | pub trait GravityPickup : RumblePickupComponent { 13 | fn get_ball_gravity(&self) -> f32 { 14 | unsafe { 15 | SpecialPickup_BallGravity_TA_Get_BallGravity(self.addr()) 16 | } 17 | } 18 | fn get_range(&self) -> f32 { 19 | unsafe { 20 | SpecialPickup_BallGravity_TA_Get_Range(self.addr()) 21 | } 22 | } 23 | fn get_offset(&self) -> Vector { 24 | unsafe { 25 | let mut result = Vector::new(); 26 | let result_ptr: *mut Vector = &mut result as *mut Vector; 27 | SpecialPickup_BallGravity_TA_Get_Offset(self.addr(), result_ptr); 28 | result 29 | } 30 | } 31 | fn get_b_deactivate_on_touch(&self) -> bool { 32 | unsafe { 33 | SpecialPickup_BallGravity_TA_Get_bDeactivateOnTouch(self.addr()) 34 | } 35 | } 36 | fn get_record_ball_hit_rate(&self) -> f32 { 37 | unsafe { 38 | SpecialPickup_BallGravity_TA_Get_RecordBallHitRate(self.addr()) 39 | } 40 | } 41 | fn get_last_recorded_ball_hit_time(&self) -> f32 { 42 | unsafe { 43 | SpecialPickup_BallGravity_TA_Get_LastRecordedBallHitTime(self.addr()) 44 | } 45 | } 46 | fn get_prev_ball(&self) -> Option { 47 | unsafe { 48 | BallWrapper::try_new(SpecialPickup_BallGravity_TA_Get_PrevBall(self.addr())) 49 | } 50 | } 51 | fn update_visual(&self) { 52 | unsafe { 53 | SpecialPickup_BallGravity_TA_UpdateVisual(self.addr()); 54 | } 55 | } 56 | fn apply_forces(&self, active_time: f32) { 57 | unsafe { 58 | SpecialPickup_BallGravity_TA_ApplyForces(self.addr(), active_time); 59 | } 60 | } 61 | fn pickup_end(&self) { 62 | unsafe { 63 | SpecialPickup_BallGravity_TA_PickupEnd(self.addr()); 64 | } 65 | } 66 | fn pickup_start(&self) { 67 | unsafe { 68 | SpecialPickup_BallGravity_TA_PickupStart(self.addr()); 69 | } 70 | } 71 | 72 | } 73 | 74 | extern "C" { 75 | fn SpecialPickup_BallGravity_TA_Get_BallGravity(obj: usize) -> f32; 76 | fn GravityPickup_SetBallGravity(obj: usize, new_val: f32); 77 | fn SpecialPickup_BallGravity_TA_Get_Range(obj: usize) -> f32; 78 | fn GravityPickup_SetRange(obj: usize, new_val: f32); 79 | fn SpecialPickup_BallGravity_TA_Get_Offset(obj: usize, result: *mut Vector); 80 | fn GravityPickup_SetOffset(obj: usize, new_val: *mut Vector); 81 | fn SpecialPickup_BallGravity_TA_Get_bDeactivateOnTouch(obj: usize) -> bool; 82 | fn GravityPickup_SetbDeactivateOnTouch(obj: usize, new_val: bool); 83 | fn SpecialPickup_BallGravity_TA_Get_RecordBallHitRate(obj: usize) -> f32; 84 | fn GravityPickup_SetRecordBallHitRate(obj: usize, new_val: f32); 85 | fn SpecialPickup_BallGravity_TA_Get_LastRecordedBallHitTime(obj: usize) -> f32; 86 | fn GravityPickup_SetLastRecordedBallHitTime(obj: usize, new_val: f32); 87 | fn SpecialPickup_BallGravity_TA_Get_PrevBall(obj: usize) -> usize; 88 | fn GravityPickup_SetPrevBall(obj: usize, new_val: usize); 89 | fn SpecialPickup_BallGravity_TA_UpdateVisual(obj: usize); 90 | fn SpecialPickup_BallGravity_TA_ApplyForces(obj: usize, ActiveTime: f32); 91 | fn SpecialPickup_BallGravity_TA_PickupEnd(obj: usize); 92 | fn SpecialPickup_BallGravity_TA_PickupStart(obj: usize); 93 | 94 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/handbrake_override_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct HandbrakeOverridePickupWrapper(pub usize); 5 | impl_object!(HandbrakeOverridePickupWrapper); 6 | 7 | impl HandbrakeOverridePickup for HandbrakeOverridePickupWrapper {} 8 | impl TargetedPickup for HandbrakeOverridePickupWrapper {} 9 | impl RumblePickupComponent for HandbrakeOverridePickupWrapper {} 10 | impl CarComponent for HandbrakeOverridePickupWrapper {} 11 | impl Actor for HandbrakeOverridePickupWrapper {} 12 | 13 | pub trait HandbrakeOverridePickup : TargetedPickup { 14 | fn get_other_car(&self) -> Option { 15 | unsafe { 16 | CarWrapper::try_new(SpecialPickup_HandbrakeOverride_TA_Get_OtherCar(self.addr())) 17 | } 18 | } 19 | fn pickup_end(&self) { 20 | unsafe { 21 | SpecialPickup_HandbrakeOverride_TA_PickupEnd(self.addr()); 22 | } 23 | } 24 | fn pickup_start(&self) { 25 | unsafe { 26 | SpecialPickup_HandbrakeOverride_TA_PickupStart(self.addr()); 27 | } 28 | } 29 | 30 | } 31 | 32 | extern "C" { 33 | fn SpecialPickup_HandbrakeOverride_TA_Get_OtherCar(obj: usize) -> usize; 34 | fn HandbrakeOverridePickup_SetOtherCar(obj: usize, new_val: usize); 35 | fn SpecialPickup_HandbrakeOverride_TA_PickupEnd(obj: usize); 36 | fn SpecialPickup_HandbrakeOverride_TA_PickupStart(obj: usize); 37 | 38 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/hit_force_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct HitForcePickupWrapper(pub usize); 5 | impl_object!(HitForcePickupWrapper); 6 | 7 | impl HitForcePickup for HitForcePickupWrapper {} 8 | impl RumblePickupComponent for HitForcePickupWrapper {} 9 | impl CarComponent for HitForcePickupWrapper {} 10 | impl Actor for HitForcePickupWrapper {} 11 | 12 | pub trait HitForcePickup : RumblePickupComponent { 13 | fn get_b_ball_force(&self) -> bool { 14 | unsafe { 15 | SpecialPickup_HitForce_TA_Get_bBallForce(self.addr()) 16 | } 17 | } 18 | fn get_b_car_force(&self) -> bool { 19 | unsafe { 20 | SpecialPickup_HitForce_TA_Get_bCarForce(self.addr()) 21 | } 22 | } 23 | fn get_b_demolish_cars(&self) -> bool { 24 | unsafe { 25 | SpecialPickup_HitForce_TA_Get_bDemolishCars(self.addr()) 26 | } 27 | } 28 | fn get_ball_hit_force(&self) -> f32 { 29 | unsafe { 30 | SpecialPickup_HitForce_TA_Get_BallHitForce(self.addr()) 31 | } 32 | } 33 | fn get_car_hit_force(&self) -> f32 { 34 | unsafe { 35 | SpecialPickup_HitForce_TA_Get_CarHitForce(self.addr()) 36 | } 37 | } 38 | fn get_min_fx_time(&self) -> f32 { 39 | unsafe { 40 | SpecialPickup_HitForce_TA_Get_MinFXTime(self.addr()) 41 | } 42 | } 43 | fn get_orig_ball_hit_force(&self) -> f32 { 44 | unsafe { 45 | SpecialPickup_HitForce_TA_Get_OrigBallHitForce(self.addr()) 46 | } 47 | } 48 | fn get_orig_car_hit_force(&self) -> f32 { 49 | unsafe { 50 | SpecialPickup_HitForce_TA_Get_OrigCarHitForce(self.addr()) 51 | } 52 | } 53 | fn get_last_fx_time(&self) -> f32 { 54 | unsafe { 55 | SpecialPickup_HitForce_TA_Get_LastFXTime(self.addr()) 56 | } 57 | } 58 | fn pickup_end(&self) { 59 | unsafe { 60 | SpecialPickup_HitForce_TA_PickupEnd(self.addr()); 61 | } 62 | } 63 | fn pickup_start(&self) { 64 | unsafe { 65 | SpecialPickup_HitForce_TA_PickupStart(self.addr()); 66 | } 67 | } 68 | 69 | } 70 | 71 | extern "C" { 72 | fn SpecialPickup_HitForce_TA_Get_bBallForce(obj: usize) -> bool; 73 | fn HitForcePickup_SetbBallForce(obj: usize, new_val: bool); 74 | fn SpecialPickup_HitForce_TA_Get_bCarForce(obj: usize) -> bool; 75 | fn HitForcePickup_SetbCarForce(obj: usize, new_val: bool); 76 | fn SpecialPickup_HitForce_TA_Get_bDemolishCars(obj: usize) -> bool; 77 | fn HitForcePickup_SetbDemolishCars(obj: usize, new_val: bool); 78 | fn SpecialPickup_HitForce_TA_Get_BallHitForce(obj: usize) -> f32; 79 | fn HitForcePickup_SetBallHitForce(obj: usize, new_val: f32); 80 | fn SpecialPickup_HitForce_TA_Get_CarHitForce(obj: usize) -> f32; 81 | fn HitForcePickup_SetCarHitForce(obj: usize, new_val: f32); 82 | fn SpecialPickup_HitForce_TA_Get_MinFXTime(obj: usize) -> f32; 83 | fn HitForcePickup_SetMinFXTime(obj: usize, new_val: f32); 84 | fn SpecialPickup_HitForce_TA_Get_OrigBallHitForce(obj: usize) -> f32; 85 | fn HitForcePickup_SetOrigBallHitForce(obj: usize, new_val: f32); 86 | fn SpecialPickup_HitForce_TA_Get_OrigCarHitForce(obj: usize) -> f32; 87 | fn HitForcePickup_SetOrigCarHitForce(obj: usize, new_val: f32); 88 | fn SpecialPickup_HitForce_TA_Get_LastFXTime(obj: usize) -> f32; 89 | fn HitForcePickup_SetLastFXTime(obj: usize, new_val: f32); 90 | fn SpecialPickup_HitForce_TA_PickupEnd(obj: usize); 91 | fn SpecialPickup_HitForce_TA_PickupStart(obj: usize); 92 | 93 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/input_buffer_graph.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct InputBufferGraphWrapper(pub usize); 5 | impl_object!(InputBufferGraphWrapper); 6 | 7 | impl InputBufferGraph for InputBufferGraphWrapper {} 8 | impl StatGraph for InputBufferGraphWrapper {} 9 | 10 | pub trait InputBufferGraph : StatGraph { 11 | fn get_buffer(&self) -> Option { 12 | unsafe { 13 | SampleHistoryWrapper::try_new(InputBufferGraph_TA_Get_Buffer(self.addr())) 14 | } 15 | } 16 | fn get_buffer_target(&self) -> Option { 17 | unsafe { 18 | SampleHistoryWrapper::try_new(InputBufferGraph_TA_Get_BufferTarget(self.addr())) 19 | } 20 | } 21 | fn get_over_under_frames(&self) -> Option { 22 | unsafe { 23 | SampleHistoryWrapper::try_new(InputBufferGraph_TA_Get_OverUnderFrames(self.addr())) 24 | } 25 | } 26 | fn get_physics_rate(&self) -> Option { 27 | unsafe { 28 | SampleHistoryWrapper::try_new(InputBufferGraph_TA_Get_PhysicsRate(self.addr())) 29 | } 30 | } 31 | fn get_max_physics_rate(&self) -> f32 { 32 | unsafe { 33 | InputBufferGraph_TA_Get_MaxPhysicsRate(self.addr()) 34 | } 35 | } 36 | fn get_min_physics_rate(&self) -> f32 { 37 | unsafe { 38 | InputBufferGraph_TA_Get_MinPhysicsRate(self.addr()) 39 | } 40 | } 41 | fn create_buffer_history(&self, title: RLString) -> Option { 42 | unsafe { 43 | let mut title = title; 44 | let title: *mut RLString = &mut title as *mut RLString; 45 | SampleHistoryWrapper::try_new(InputBufferGraph_TA_CreateBufferHistory(self.addr(), title)) 46 | } 47 | } 48 | 49 | } 50 | 51 | extern "C" { 52 | fn InputBufferGraph_TA_Get_Buffer(obj: usize) -> usize; 53 | fn InputBufferGraphWrapper_SetBuffer(obj: usize, new_val: usize); 54 | fn InputBufferGraph_TA_Get_BufferTarget(obj: usize) -> usize; 55 | fn InputBufferGraphWrapper_SetBufferTarget(obj: usize, new_val: usize); 56 | fn InputBufferGraph_TA_Get_OverUnderFrames(obj: usize) -> usize; 57 | fn InputBufferGraphWrapper_SetOverUnderFrames(obj: usize, new_val: usize); 58 | fn InputBufferGraph_TA_Get_PhysicsRate(obj: usize) -> usize; 59 | fn InputBufferGraphWrapper_SetPhysicsRate(obj: usize, new_val: usize); 60 | fn InputBufferGraph_TA_Get_MaxPhysicsRate(obj: usize) -> f32; 61 | fn InputBufferGraphWrapper_SetMaxPhysicsRate(obj: usize, new_val: f32); 62 | fn InputBufferGraph_TA_Get_MinPhysicsRate(obj: usize) -> f32; 63 | fn InputBufferGraphWrapper_SetMinPhysicsRate(obj: usize, new_val: f32); 64 | fn InputBufferGraph_TA_CreateBufferHistory(obj: usize, Title: *mut RLString) -> usize; 65 | 66 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/jump_component.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct JumpComponentWrapper(pub usize); 5 | impl_object!(JumpComponentWrapper); 6 | 7 | impl JumpComponent for JumpComponentWrapper {} 8 | impl CarComponent for JumpComponentWrapper {} 9 | impl Actor for JumpComponentWrapper {} 10 | 11 | pub trait JumpComponent : CarComponent { 12 | fn get_min_jump_time(&self) -> f32 { 13 | unsafe { 14 | CarComponent_Jump_TA_Get_MinJumpTime(self.addr()) 15 | } 16 | } 17 | fn get_jump_impulse(&self) -> f32 { 18 | unsafe { 19 | CarComponent_Jump_TA_Get_JumpImpulse(self.addr()) 20 | } 21 | } 22 | fn get_jump_force(&self) -> f32 { 23 | unsafe { 24 | CarComponent_Jump_TA_Get_JumpForce(self.addr()) 25 | } 26 | } 27 | fn get_jump_force_time(&self) -> f32 { 28 | unsafe { 29 | CarComponent_Jump_TA_Get_JumpForceTime(self.addr()) 30 | } 31 | } 32 | fn get_podium_jump_force_time(&self) -> f32 { 33 | unsafe { 34 | CarComponent_Jump_TA_Get_PodiumJumpForceTime(self.addr()) 35 | } 36 | } 37 | fn get_jump_impulse_speed(&self) -> f32 { 38 | unsafe { 39 | CarComponent_Jump_TA_Get_JumpImpulseSpeed(self.addr()) 40 | } 41 | } 42 | fn get_jump_accel(&self) -> f32 { 43 | unsafe { 44 | CarComponent_Jump_TA_Get_JumpAccel(self.addr()) 45 | } 46 | } 47 | fn get_max_jump_height(&self) -> f32 { 48 | unsafe { 49 | CarComponent_Jump_TA_Get_MaxJumpHeight(self.addr()) 50 | } 51 | } 52 | fn get_max_jump_height_time(&self) -> f32 { 53 | unsafe { 54 | CarComponent_Jump_TA_Get_MaxJumpHeightTime(self.addr()) 55 | } 56 | } 57 | fn get_b_deactivate(&self) -> bool { 58 | unsafe { 59 | CarComponent_Jump_TA_Get_bDeactivate(self.addr()) 60 | } 61 | } 62 | fn apply_forces(&self, active_time: f32) { 63 | unsafe { 64 | CarComponent_Jump_TA_ApplyForces(self.addr(), active_time); 65 | } 66 | } 67 | fn cache_jump_data(&self) { 68 | unsafe { 69 | CarComponent_Jump_TA_CacheJumpData(self.addr()); 70 | } 71 | } 72 | fn on_created(&self) { 73 | unsafe { 74 | CarComponent_Jump_TA_OnCreated(self.addr()); 75 | } 76 | } 77 | 78 | } 79 | 80 | extern "C" { 81 | fn CarComponent_Jump_TA_Get_MinJumpTime(obj: usize) -> f32; 82 | fn JumpComponentWrapper_SetMinJumpTime(obj: usize, new_val: f32); 83 | fn CarComponent_Jump_TA_Get_JumpImpulse(obj: usize) -> f32; 84 | fn JumpComponentWrapper_SetJumpImpulse(obj: usize, new_val: f32); 85 | fn CarComponent_Jump_TA_Get_JumpForce(obj: usize) -> f32; 86 | fn JumpComponentWrapper_SetJumpForce(obj: usize, new_val: f32); 87 | fn CarComponent_Jump_TA_Get_JumpForceTime(obj: usize) -> f32; 88 | fn JumpComponentWrapper_SetJumpForceTime(obj: usize, new_val: f32); 89 | fn CarComponent_Jump_TA_Get_PodiumJumpForceTime(obj: usize) -> f32; 90 | fn JumpComponentWrapper_SetPodiumJumpForceTime(obj: usize, new_val: f32); 91 | fn CarComponent_Jump_TA_Get_JumpImpulseSpeed(obj: usize) -> f32; 92 | fn JumpComponentWrapper_SetJumpImpulseSpeed(obj: usize, new_val: f32); 93 | fn CarComponent_Jump_TA_Get_JumpAccel(obj: usize) -> f32; 94 | fn JumpComponentWrapper_SetJumpAccel(obj: usize, new_val: f32); 95 | fn CarComponent_Jump_TA_Get_MaxJumpHeight(obj: usize) -> f32; 96 | fn JumpComponentWrapper_SetMaxJumpHeight(obj: usize, new_val: f32); 97 | fn CarComponent_Jump_TA_Get_MaxJumpHeightTime(obj: usize) -> f32; 98 | fn JumpComponentWrapper_SetMaxJumpHeightTime(obj: usize, new_val: f32); 99 | fn CarComponent_Jump_TA_Get_bDeactivate(obj: usize) -> bool; 100 | fn JumpComponentWrapper_SetbDeactivate(obj: usize, new_val: bool); 101 | fn CarComponent_Jump_TA_ApplyForces(obj: usize, ActiveTime: f32); 102 | fn CarComponent_Jump_TA_CacheJumpData(obj: usize); 103 | fn CarComponent_Jump_TA_OnCreated(obj: usize); 104 | 105 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/mod.rs: -------------------------------------------------------------------------------- 1 | mod input_buffer_graph; 2 | pub use input_buffer_graph::*; 3 | mod primitive_component; 4 | pub use primitive_component::*; 5 | mod swapper_pickup; 6 | pub use swapper_pickup::*; 7 | mod replay_soccar; 8 | pub use replay_soccar::*; 9 | mod team_game_event; 10 | pub use team_game_event::*; 11 | mod rb_actor; 12 | pub use rb_actor::*; 13 | mod ball_car_spring_pickup; 14 | pub use ball_car_spring_pickup::*; 15 | mod game_event; 16 | pub use game_event::*; 17 | mod physical_material_property; 18 | pub use physical_material_property::*; 19 | mod training_editor_save_data; 20 | pub use training_editor_save_data::*; 21 | mod double_jump_component; 22 | pub use double_jump_component::*; 23 | mod wheel; 24 | pub use wheel::*; 25 | mod camera; 26 | pub use camera::*; 27 | mod ball_freeze_pickup; 28 | pub use ball_freeze_pickup::*; 29 | mod replay; 30 | pub use replay::*; 31 | mod dodge_component; 32 | pub use dodge_component::*; 33 | mod car_component; 34 | pub use car_component::*; 35 | mod ball; 36 | pub use ball::*; 37 | mod perf_stat_graph; 38 | pub use perf_stat_graph::*; 39 | mod training_editor; 40 | pub use training_editor::*; 41 | mod vehicle_sim; 42 | pub use vehicle_sim::*; 43 | mod vehicle; 44 | pub use vehicle::*; 45 | mod sample_history; 46 | pub use sample_history::*; 47 | mod pri; 48 | pub use pri::*; 49 | mod tutorial; 50 | pub use tutorial::*; 51 | mod engine_ta; 52 | pub use engine_ta::*; 53 | mod spring_pickup; 54 | pub use spring_pickup::*; 55 | mod gravity_pickup; 56 | pub use gravity_pickup::*; 57 | mod tornado_pickup; 58 | pub use tornado_pickup::*; 59 | mod boost_override_pickup; 60 | pub use boost_override_pickup::*; 61 | mod flip_car_component; 62 | pub use flip_car_component::*; 63 | mod hit_force_pickup; 64 | pub use hit_force_pickup::*; 65 | mod base_camera; 66 | pub use base_camera::*; 67 | mod stat_graph_system; 68 | pub use stat_graph_system::*; 69 | mod attachment_pickup; 70 | pub use attachment_pickup::*; 71 | mod pri_x; 72 | pub use pri_x::*; 73 | mod vehicle_pickup; 74 | pub use vehicle_pickup::*; 75 | mod game_editor; 76 | pub use game_editor::*; 77 | mod boost_pickup; 78 | pub use boost_pickup::*; 79 | mod replay_director; 80 | pub use replay_director::*; 81 | mod car; 82 | pub use car::*; 83 | mod rumble_pickup_component; 84 | pub use rumble_pickup_component::*; 85 | mod targeted_pickup; 86 | pub use targeted_pickup::*; 87 | mod server; 88 | pub use server::*; 89 | mod team_info; 90 | pub use team_info::*; 91 | mod boost; 92 | pub use boost::*; 93 | mod player_controller; 94 | pub use player_controller::*; 95 | mod time_bomb_pickup; 96 | pub use time_bomb_pickup::*; 97 | mod air_control_component; 98 | pub use air_control_component::*; 99 | mod handbrake_override_pickup; 100 | pub use handbrake_override_pickup::*; 101 | mod sample_record_settings; 102 | pub use sample_record_settings::*; 103 | mod grappling_hook_pickup; 104 | pub use grappling_hook_pickup::*; 105 | mod car_speed_pickup; 106 | pub use car_speed_pickup::*; 107 | mod goal; 108 | pub use goal::*; 109 | mod ball_lasso_pickup; 110 | pub use ball_lasso_pickup::*; 111 | mod actor; 112 | pub use actor::*; 113 | mod boost_mod_pickup; 114 | pub use boost_mod_pickup::*; 115 | mod player_replication_info; 116 | pub use player_replication_info::*; 117 | mod battarang_pickup; 118 | pub use battarang_pickup::*; 119 | mod stat_graph; 120 | pub use stat_graph::*; 121 | mod game_setting_playlist; 122 | pub use game_setting_playlist::*; 123 | mod save_data; 124 | pub use save_data::*; 125 | mod demolish_pickup; 126 | pub use demolish_pickup::*; 127 | mod team; 128 | pub use team::*; 129 | mod fx_actor; 130 | pub use fx_actor::*; 131 | mod jump_component; 132 | pub use jump_component::*; 133 | mod camera_x; 134 | pub use camera_x::*; 135 | mod game_editor_save_data; 136 | pub use game_editor_save_data::*; 137 | mod net_stat_graph; 138 | pub use net_stat_graph::*; 139 | mod velcro_pickup; 140 | pub use velcro_pickup::*; 141 | -------------------------------------------------------------------------------- /src/wrappers/unreal/net_stat_graph.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct NetStatGraphWrapper(pub usize); 5 | impl_object!(NetStatGraphWrapper); 6 | 7 | impl NetStatGraph for NetStatGraphWrapper {} 8 | impl StatGraph for NetStatGraphWrapper {} 9 | 10 | pub trait NetStatGraph : StatGraph { 11 | fn get_packets_out(&self) -> Option { 12 | unsafe { 13 | SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_PacketsOut(self.addr())) 14 | } 15 | } 16 | fn get_packets_in(&self) -> Option { 17 | unsafe { 18 | SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_PacketsIn(self.addr())) 19 | } 20 | } 21 | fn get_lost_packets_out(&self) -> Option { 22 | unsafe { 23 | SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_LostPacketsOut(self.addr())) 24 | } 25 | } 26 | fn get_lost_packets_in(&self) -> Option { 27 | unsafe { 28 | SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_LostPacketsIn(self.addr())) 29 | } 30 | } 31 | fn get_bytes_out(&self) -> Option { 32 | unsafe { 33 | SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_BytesOut(self.addr())) 34 | } 35 | } 36 | fn get_bytes_in(&self) -> Option { 37 | unsafe { 38 | SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_BytesIn(self.addr())) 39 | } 40 | } 41 | fn get_latency(&self) -> Option { 42 | unsafe { 43 | SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_Latency(self.addr())) 44 | } 45 | } 46 | fn get_expected_out_packet_rate(&self) -> f32 { 47 | unsafe { 48 | NetStatGraph_TA_Get_ExpectedOutPacketRate(self.addr()) 49 | } 50 | } 51 | fn get_expected_in_packet_rate(&self) -> f32 { 52 | unsafe { 53 | NetStatGraph_TA_Get_ExpectedInPacketRate(self.addr()) 54 | } 55 | } 56 | fn get_max_bytes_rate(&self) -> f32 { 57 | unsafe { 58 | NetStatGraph_TA_Get_MaxBytesRate(self.addr()) 59 | } 60 | } 61 | fn create_bytes_summary(&self, title: RLString) -> Option { 62 | unsafe { 63 | let mut title = title; 64 | let title: *mut RLString = &mut title as *mut RLString; 65 | SampleHistoryWrapper::try_new(NetStatGraph_TA_CreateBytesSummary(self.addr(), title)) 66 | } 67 | } 68 | fn create_loss_summary(&self, title: RLString) -> Option { 69 | unsafe { 70 | let mut title = title; 71 | let title: *mut RLString = &mut title as *mut RLString; 72 | SampleHistoryWrapper::try_new(NetStatGraph_TA_CreateLossSummary(self.addr(), title)) 73 | } 74 | } 75 | fn create_pkt_summary(&self, title: RLString) -> Option { 76 | unsafe { 77 | let mut title = title; 78 | let title: *mut RLString = &mut title as *mut RLString; 79 | SampleHistoryWrapper::try_new(NetStatGraph_TA_CreatePktSummary(self.addr(), title)) 80 | } 81 | } 82 | 83 | } 84 | 85 | extern "C" { 86 | fn NetStatGraph_TA_Get_PacketsOut(obj: usize) -> usize; 87 | fn NetStatGraphWrapper_SetPacketsOut(obj: usize, new_val: usize); 88 | fn NetStatGraph_TA_Get_PacketsIn(obj: usize) -> usize; 89 | fn NetStatGraphWrapper_SetPacketsIn(obj: usize, new_val: usize); 90 | fn NetStatGraph_TA_Get_LostPacketsOut(obj: usize) -> usize; 91 | fn NetStatGraphWrapper_SetLostPacketsOut(obj: usize, new_val: usize); 92 | fn NetStatGraph_TA_Get_LostPacketsIn(obj: usize) -> usize; 93 | fn NetStatGraphWrapper_SetLostPacketsIn(obj: usize, new_val: usize); 94 | fn NetStatGraph_TA_Get_BytesOut(obj: usize) -> usize; 95 | fn NetStatGraphWrapper_SetBytesOut(obj: usize, new_val: usize); 96 | fn NetStatGraph_TA_Get_BytesIn(obj: usize) -> usize; 97 | fn NetStatGraphWrapper_SetBytesIn(obj: usize, new_val: usize); 98 | fn NetStatGraph_TA_Get_Latency(obj: usize) -> usize; 99 | fn NetStatGraphWrapper_SetLatency(obj: usize, new_val: usize); 100 | fn NetStatGraph_TA_Get_ExpectedOutPacketRate(obj: usize) -> f32; 101 | fn NetStatGraphWrapper_SetExpectedOutPacketRate(obj: usize, new_val: f32); 102 | fn NetStatGraph_TA_Get_ExpectedInPacketRate(obj: usize) -> f32; 103 | fn NetStatGraphWrapper_SetExpectedInPacketRate(obj: usize, new_val: f32); 104 | fn NetStatGraph_TA_Get_MaxBytesRate(obj: usize) -> f32; 105 | fn NetStatGraphWrapper_SetMaxBytesRate(obj: usize, new_val: f32); 106 | fn NetStatGraph_TA_CreateBytesSummary(obj: usize, Title: *mut RLString) -> usize; 107 | fn NetStatGraph_TA_CreateLossSummary(obj: usize, Title: *mut RLString) -> usize; 108 | fn NetStatGraph_TA_CreatePktSummary(obj: usize, Title: *mut RLString) -> usize; 109 | 110 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/perf_stat_graph.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct PerfStatGraphWrapper(pub usize); 5 | impl_object!(PerfStatGraphWrapper); 6 | 7 | impl PerfStatGraph for PerfStatGraphWrapper {} 8 | impl StatGraph for PerfStatGraphWrapper {} 9 | 10 | pub trait PerfStatGraph : StatGraph { 11 | fn get_fps(&self) -> Option { 12 | unsafe { 13 | SampleHistoryWrapper::try_new(PerfStatGraph_TA_Get_FPS(self.addr())) 14 | } 15 | } 16 | fn get_frame_time(&self) -> Option { 17 | unsafe { 18 | SampleHistoryWrapper::try_new(PerfStatGraph_TA_Get_FrameTime(self.addr())) 19 | } 20 | } 21 | fn get_game_thread_time(&self) -> Option { 22 | unsafe { 23 | SampleHistoryWrapper::try_new(PerfStatGraph_TA_Get_GameThreadTime(self.addr())) 24 | } 25 | } 26 | fn get_render_thread_time(&self) -> Option { 27 | unsafe { 28 | SampleHistoryWrapper::try_new(PerfStatGraph_TA_Get_RenderThreadTime(self.addr())) 29 | } 30 | } 31 | fn get_gpu_frame_time(&self) -> Option { 32 | unsafe { 33 | SampleHistoryWrapper::try_new(PerfStatGraph_TA_Get_GPUFrameTime(self.addr())) 34 | } 35 | } 36 | fn get_frame_time_histories(&self) -> RLArray { 37 | unsafe { 38 | let mut result = RLArrayRaw::new(); 39 | let result_ptr: *mut RLArrayRaw = &mut result as *mut RLArrayRaw; 40 | PerfStatGraph_TA_Get_FrameTimeHistories(self.addr(), result_ptr); 41 | RLArray::from_raw(result) 42 | } 43 | } 44 | fn get_max_fps(&self) -> f32 { 45 | unsafe { 46 | PerfStatGraph_TA_Get_MaxFPS(self.addr()) 47 | } 48 | } 49 | fn get_target_fps(&self) -> f32 { 50 | unsafe { 51 | PerfStatGraph_TA_Get_TargetFPS(self.addr()) 52 | } 53 | } 54 | fn create_frame_time_history(&self, title: RLString) -> Option { 55 | unsafe { 56 | let mut title = title; 57 | let title: *mut RLString = &mut title as *mut RLString; 58 | SampleHistoryWrapper::try_new(PerfStatGraph_TA_CreateFrameTimeHistory(self.addr(), title)) 59 | } 60 | } 61 | fn create_fps_history(&self, title: RLString) -> Option { 62 | unsafe { 63 | let mut title = title; 64 | let title: *mut RLString = &mut title as *mut RLString; 65 | SampleHistoryWrapper::try_new(PerfStatGraph_TA_CreateFpsHistory(self.addr(), title)) 66 | } 67 | } 68 | 69 | } 70 | 71 | extern "C" { 72 | fn PerfStatGraph_TA_Get_FPS(obj: usize) -> usize; 73 | fn PerfStatGraphWrapper_SetFPS(obj: usize, new_val: usize); 74 | fn PerfStatGraph_TA_Get_FrameTime(obj: usize) -> usize; 75 | fn PerfStatGraphWrapper_SetFrameTime(obj: usize, new_val: usize); 76 | fn PerfStatGraph_TA_Get_GameThreadTime(obj: usize) -> usize; 77 | fn PerfStatGraphWrapper_SetGameThreadTime(obj: usize, new_val: usize); 78 | fn PerfStatGraph_TA_Get_RenderThreadTime(obj: usize) -> usize; 79 | fn PerfStatGraphWrapper_SetRenderThreadTime(obj: usize, new_val: usize); 80 | fn PerfStatGraph_TA_Get_GPUFrameTime(obj: usize) -> usize; 81 | fn PerfStatGraphWrapper_SetGPUFrameTime(obj: usize, new_val: usize); 82 | fn PerfStatGraph_TA_Get_FrameTimeHistories(obj: usize, result: *mut RLArrayRaw); 83 | fn PerfStatGraph_TA_Get_MaxFPS(obj: usize) -> f32; 84 | fn PerfStatGraphWrapper_SetMaxFPS(obj: usize, new_val: f32); 85 | fn PerfStatGraph_TA_Get_TargetFPS(obj: usize) -> f32; 86 | fn PerfStatGraphWrapper_SetTargetFPS(obj: usize, new_val: f32); 87 | fn PerfStatGraph_TA_CreateFrameTimeHistory(obj: usize, Title: *mut RLString) -> usize; 88 | fn PerfStatGraph_TA_CreateFpsHistory(obj: usize, Title: *mut RLString) -> usize; 89 | 90 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/physical_material_property.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct PhysicalMaterialPropertyWrapper(pub usize); 5 | impl_object!(PhysicalMaterialPropertyWrapper); 6 | 7 | impl PhysicalMaterialProperty for PhysicalMaterialPropertyWrapper {} 8 | 9 | pub trait PhysicalMaterialProperty : Object { 10 | fn get_b_sticky_wheels(&self) -> bool { 11 | unsafe { 12 | PhysicalMaterialProperty_TA_Get_bStickyWheels(self.addr()) 13 | } 14 | } 15 | fn get_b_consider_for_ground(&self) -> bool { 16 | unsafe { 17 | PhysicalMaterialProperty_TA_Get_bConsiderForGround(self.addr()) 18 | } 19 | } 20 | 21 | } 22 | 23 | extern "C" { 24 | fn PhysicalMaterialProperty_TA_Get_bStickyWheels(obj: usize) -> bool; 25 | fn PhysicalMaterialPropertyWrapper_SetbStickyWheels(obj: usize, new_val: bool); 26 | fn PhysicalMaterialProperty_TA_Get_bConsiderForGround(obj: usize) -> bool; 27 | fn PhysicalMaterialPropertyWrapper_SetbConsiderForGround(obj: usize, new_val: bool); 28 | 29 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/pri_x.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct PriXWrapper(pub usize); 5 | impl_object!(PriXWrapper); 6 | 7 | impl PriX for PriXWrapper {} 8 | impl PlayerReplicationInfo for PriXWrapper {} 9 | impl Actor for PriXWrapper {} 10 | 11 | pub trait PriX : PlayerReplicationInfo { 12 | fn on_unique_id_changed(&self) { 13 | unsafe { 14 | PRI_X_OnUniqueIdChanged(self.addr()); 15 | } 16 | } 17 | fn set_unique_id(&self, player_unique_id: UniqueNetId) { 18 | unsafe { 19 | let mut player_unique_id = player_unique_id; 20 | let player_unique_id: *mut UniqueNetId = &mut player_unique_id as *mut UniqueNetId; 21 | PRI_X_SetUniqueId(self.addr(), player_unique_id); 22 | } 23 | } 24 | fn unregister_player_from_session(&self) { 25 | unsafe { 26 | PRI_X_UnregisterPlayerFromSession(self.addr()); 27 | } 28 | } 29 | fn register_player_with_session(&self) { 30 | unsafe { 31 | PRI_X_RegisterPlayerWithSession(self.addr()); 32 | } 33 | } 34 | fn event_destroyed(&self, pri: PriXWrapper) { 35 | unsafe { 36 | PRI_X_EventDestroyed(self.addr(), pri.addr()); 37 | } 38 | } 39 | fn event_unique_id_changed(&self, pri: PriXWrapper) { 40 | unsafe { 41 | PRI_X_EventUniqueIdChanged(self.addr(), pri.addr()); 42 | } 43 | } 44 | fn event_player_name_changed(&self, pri: PriXWrapper) { 45 | unsafe { 46 | PRI_X_EventPlayerNameChanged(self.addr(), pri.addr()); 47 | } 48 | } 49 | 50 | } 51 | 52 | extern "C" { 53 | fn PRI_X_OnUniqueIdChanged(obj: usize); 54 | fn PRI_X_SetUniqueId(obj: usize, PlayerUniqueId: *mut UniqueNetId); 55 | fn PRI_X_UnregisterPlayerFromSession(obj: usize); 56 | fn PRI_X_RegisterPlayerWithSession(obj: usize); 57 | fn PRI_X_EventDestroyed(obj: usize, PRI: usize); 58 | fn PRI_X_EventUniqueIdChanged(obj: usize, PRI: usize); 59 | fn PRI_X_EventPlayerNameChanged(obj: usize, PRI: usize); 60 | 61 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/replay_soccar.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct ReplaySoccarWrapper(pub usize); 5 | impl_object!(ReplaySoccarWrapper); 6 | 7 | impl ReplaySoccar for ReplaySoccarWrapper {} 8 | impl Replay for ReplaySoccarWrapper {} 9 | 10 | pub trait ReplaySoccar : Replay { 11 | fn get_team_size(&self) -> i32 { 12 | unsafe { 13 | Replay_Soccar_TA_Get_TeamSize(self.addr()) 14 | } 15 | } 16 | fn get_unfair_team_size(&self) -> i32 { 17 | unsafe { 18 | Replay_Soccar_TA_Get_UnfairTeamSize(self.addr()) 19 | } 20 | } 21 | fn get_b_unfair_bots(&self) -> bool { 22 | unsafe { 23 | Replay_Soccar_TA_Get_bUnfairBots(self.addr()) 24 | } 25 | } 26 | fn get_primary_player_team(&self) -> i32 { 27 | unsafe { 28 | Replay_Soccar_TA_Get_PrimaryPlayerTeam(self.addr()) 29 | } 30 | } 31 | fn get_team0_score(&self) -> i32 { 32 | unsafe { 33 | Replay_Soccar_TA_Get_Team0Score(self.addr()) 34 | } 35 | } 36 | fn get_team1_score(&self) -> i32 { 37 | unsafe { 38 | Replay_Soccar_TA_Get_Team1Score(self.addr()) 39 | } 40 | } 41 | fn remove_timeline_keyframe(&self, keyframe_index: i32) { 42 | unsafe { 43 | Replay_Soccar_TA_RemoveTimelineKeyframe(self.addr(), keyframe_index); 44 | } 45 | } 46 | fn record_user_event(&self) { 47 | unsafe { 48 | Replay_Soccar_TA_RecordUserEvent(self.addr()); 49 | } 50 | } 51 | fn add_player(&self, pri: PriWrapper) { 52 | unsafe { 53 | Replay_Soccar_TA_AddPlayer(self.addr(), pri.addr()); 54 | } 55 | } 56 | 57 | } 58 | 59 | extern "C" { 60 | fn Replay_Soccar_TA_Get_TeamSize(obj: usize) -> i32; 61 | fn ReplaySoccarWrapper_SetTeamSize(obj: usize, new_val: i32); 62 | fn Replay_Soccar_TA_Get_UnfairTeamSize(obj: usize) -> i32; 63 | fn ReplaySoccarWrapper_SetUnfairTeamSize(obj: usize, new_val: i32); 64 | fn Replay_Soccar_TA_Get_bUnfairBots(obj: usize) -> bool; 65 | fn ReplaySoccarWrapper_SetbUnfairBots(obj: usize, new_val: bool); 66 | fn Replay_Soccar_TA_Get_PrimaryPlayerTeam(obj: usize) -> i32; 67 | fn ReplaySoccarWrapper_SetPrimaryPlayerTeam(obj: usize, new_val: i32); 68 | fn Replay_Soccar_TA_Get_Team0Score(obj: usize) -> i32; 69 | fn ReplaySoccarWrapper_SetTeam0Score(obj: usize, new_val: i32); 70 | fn Replay_Soccar_TA_Get_Team1Score(obj: usize) -> i32; 71 | fn ReplaySoccarWrapper_SetTeam1Score(obj: usize, new_val: i32); 72 | fn Replay_Soccar_TA_RemoveTimelineKeyframe(obj: usize, KeyframeIndex: i32); 73 | fn Replay_Soccar_TA_RecordUserEvent(obj: usize); 74 | fn Replay_Soccar_TA_AddPlayer(obj: usize, PRI: usize); 75 | 76 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/rumble_pickup_component.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct RumblePickupComponentWrapper(pub usize); 5 | impl_object!(RumblePickupComponentWrapper); 6 | 7 | impl RumblePickupComponent for RumblePickupComponentWrapper {} 8 | impl CarComponent for RumblePickupComponentWrapper {} 9 | impl Actor for RumblePickupComponentWrapper {} 10 | 11 | pub trait RumblePickupComponent : CarComponent { 12 | fn get_pickup_name(&self) -> RLString { 13 | unsafe { 14 | let mut result = RLString::new(); 15 | let result_ptr: *mut RLString = &mut result as *mut RLString; 16 | SpecialPickup_TA_Get_PickupName(self.addr(), result_ptr); 17 | result 18 | } 19 | } 20 | fn get_b_hud_ignore_use_time(&self) -> bool { 21 | unsafe { 22 | SpecialPickup_TA_Get_bHudIgnoreUseTime(self.addr()) 23 | } 24 | } 25 | fn get_b_has_activated(&self) -> bool { 26 | unsafe { 27 | SpecialPickup_TA_Get_bHasActivated(self.addr()) 28 | } 29 | } 30 | fn get_b_is_active(&self) -> bool { 31 | unsafe { 32 | SpecialPickup_TA_Get_bIsActive(self.addr()) 33 | } 34 | } 35 | fn get_activation_duration(&self) -> f32 { 36 | unsafe { 37 | SpecialPickup_TA_Get_ActivationDuration(self.addr()) 38 | } 39 | } 40 | fn get_pickup_fx_archetype(&self) -> Option { 41 | unsafe { 42 | FXActorWrapper::try_new(SpecialPickup_TA_Get_PickupFXArchetype(self.addr())) 43 | } 44 | } 45 | fn get_pickup_fx(&self) -> Option { 46 | unsafe { 47 | FXActorWrapper::try_new(SpecialPickup_TA_Get_PickupFX(self.addr())) 48 | } 49 | } 50 | fn has_activated(&self) -> bool { 51 | unsafe { 52 | SpecialPickup_TA_HasActivated(self.addr()) 53 | } 54 | } 55 | fn get_client_target(&self) -> Option { 56 | unsafe { 57 | RBActorWrapper::try_new(SpecialPickup_TA_GetClientTarget(self.addr())) 58 | } 59 | } 60 | fn on_vehicle_setup_complete(&self) { 61 | unsafe { 62 | SpecialPickup_TA_OnVehicleSetupComplete(self.addr()); 63 | } 64 | } 65 | fn get_active_time_percent(&self) -> f32 { 66 | unsafe { 67 | SpecialPickup_TA_GetActiveTimePercent(self.addr()) 68 | } 69 | } 70 | fn pickup_end(&self) { 71 | unsafe { 72 | SpecialPickup_TA_PickupEnd(self.addr()); 73 | } 74 | } 75 | fn pickup_start(&self) { 76 | unsafe { 77 | SpecialPickup_TA_PickupStart(self.addr()); 78 | } 79 | } 80 | fn get_boost_component(&self) -> Option { 81 | unsafe { 82 | BoostWrapper::try_new(SpecialPickup_TA_GetBoostComponent(self.addr())) 83 | } 84 | } 85 | fn deactivate_pickup(&self) { 86 | unsafe { 87 | SpecialPickup_TA_DeactivatePickup(self.addr()); 88 | } 89 | } 90 | fn try_activate(&self, target_override: RBActorWrapper) -> bool { 91 | unsafe { 92 | SpecialPickup_TA_TryActivate(self.addr(), target_override.addr()) 93 | } 94 | } 95 | fn on_created(&self) { 96 | unsafe { 97 | SpecialPickup_TA_OnCreated(self.addr()); 98 | } 99 | } 100 | fn can_pickup(&self, in_car: CarWrapper) -> bool { 101 | unsafe { 102 | SpecialPickup_TA_CanPickup(self.addr(), in_car.addr()) 103 | } 104 | } 105 | fn apply_pickup(&self, in_car: CarWrapper) { 106 | unsafe { 107 | SpecialPickup_TA_ApplyPickup(self.addr(), in_car.addr()); 108 | } 109 | } 110 | 111 | } 112 | 113 | extern "C" { 114 | fn SpecialPickup_TA_Get_PickupName(obj: usize, result: *mut RLString); 115 | fn SpecialPickup_TA_Get_bHudIgnoreUseTime(obj: usize) -> bool; 116 | fn RumblePickupComponentWrapper_SetbHudIgnoreUseTime(obj: usize, new_val: bool); 117 | fn SpecialPickup_TA_Get_bHasActivated(obj: usize) -> bool; 118 | fn RumblePickupComponentWrapper_SetbHasActivated(obj: usize, new_val: bool); 119 | fn SpecialPickup_TA_Get_bIsActive(obj: usize) -> bool; 120 | fn RumblePickupComponentWrapper_SetbIsActive(obj: usize, new_val: bool); 121 | fn SpecialPickup_TA_Get_ActivationDuration(obj: usize) -> f32; 122 | fn RumblePickupComponentWrapper_SetActivationDuration(obj: usize, new_val: f32); 123 | fn SpecialPickup_TA_Get_PickupFXArchetype(obj: usize) -> usize; 124 | fn RumblePickupComponentWrapper_SetPickupFXArchetype(obj: usize, new_val: usize); 125 | fn SpecialPickup_TA_Get_PickupFX(obj: usize) -> usize; 126 | fn RumblePickupComponentWrapper_SetPickupFX(obj: usize, new_val: usize); 127 | fn SpecialPickup_TA_HasActivated(obj: usize) -> bool; 128 | fn SpecialPickup_TA_GetClientTarget(obj: usize) -> usize; 129 | fn SpecialPickup_TA_OnVehicleSetupComplete(obj: usize); 130 | fn SpecialPickup_TA_GetActiveTimePercent(obj: usize) -> f32; 131 | fn SpecialPickup_TA_PickupEnd(obj: usize); 132 | fn SpecialPickup_TA_PickupStart(obj: usize); 133 | fn SpecialPickup_TA_GetBoostComponent(obj: usize) -> usize; 134 | fn SpecialPickup_TA_DeactivatePickup(obj: usize); 135 | fn SpecialPickup_TA_TryActivate(obj: usize, TargetOverride: usize) -> bool; 136 | fn SpecialPickup_TA_OnCreated(obj: usize); 137 | fn SpecialPickup_TA_CanPickup(obj: usize, InCar: usize) -> bool; 138 | fn SpecialPickup_TA_ApplyPickup(obj: usize, InCar: usize); 139 | 140 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/sample_history.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct SampleHistoryWrapper(pub usize); 5 | impl_object!(SampleHistoryWrapper); 6 | 7 | impl SampleHistory for SampleHistoryWrapper {} 8 | 9 | pub trait SampleHistory : Object { 10 | fn get_record_settings(&self) -> Option { 11 | unsafe { 12 | SampleRecordSettingsWrapper::try_new(SampleHistory_TA_Get_RecordSettings(self.addr())) 13 | } 14 | } 15 | fn get_title(&self) -> RLString { 16 | unsafe { 17 | let mut result = RLString::new(); 18 | let result_ptr: *mut RLString = &mut result as *mut RLString; 19 | SampleHistory_TA_Get_Title(self.addr(), result_ptr); 20 | result 21 | } 22 | } 23 | fn get_y_min(&self) -> f32 { 24 | unsafe { 25 | SampleHistory_TA_Get_YMin(self.addr()) 26 | } 27 | } 28 | fn get_y_max(&self) -> f32 { 29 | unsafe { 30 | SampleHistory_TA_Get_YMax(self.addr()) 31 | } 32 | } 33 | fn get_good_value(&self) -> f32 { 34 | unsafe { 35 | SampleHistory_TA_Get_GoodValue(self.addr()) 36 | } 37 | } 38 | fn get_bad_value(&self) -> f32 { 39 | unsafe { 40 | SampleHistory_TA_Get_BadValue(self.addr()) 41 | } 42 | } 43 | fn get_base_value(&self) -> f32 { 44 | unsafe { 45 | SampleHistory_TA_Get_BaseValue(self.addr()) 46 | } 47 | } 48 | fn get_samples(&self) -> RLArray { 49 | unsafe { 50 | let mut result = RLArrayRaw::new(); 51 | let result_ptr: *mut RLArrayRaw = &mut result as *mut RLArrayRaw; 52 | SampleHistory_TA_Get_Samples(self.addr(), result_ptr); 53 | RLArray::from_raw(result) 54 | } 55 | } 56 | fn get_sample_index(&self) -> i32 { 57 | unsafe { 58 | SampleHistory_TA_Get_SampleIndex(self.addr()) 59 | } 60 | } 61 | fn get_accum_time(&self) -> f32 { 62 | unsafe { 63 | SampleHistory_TA_Get_AccumTime(self.addr()) 64 | } 65 | } 66 | fn get_pending_sample(&self) -> Sample { 67 | unsafe { 68 | let mut result = Sample::new(); 69 | let result_ptr: *mut Sample = &mut result as *mut Sample; 70 | SampleHistory_TA_Get_PendingSample(self.addr(), result_ptr); 71 | result 72 | } 73 | } 74 | fn get_b_has_pending_sample(&self) -> bool { 75 | unsafe { 76 | SampleHistory_TA_Get_bHasPendingSample(self.addr()) 77 | } 78 | } 79 | fn tick(&self, delta_time: f32) { 80 | unsafe { 81 | SampleHistory_TA_Tick(self.addr(), delta_time); 82 | } 83 | } 84 | fn add_sample(&self, new_value: f32) { 85 | unsafe { 86 | SampleHistory_TA_AddSample(self.addr(), new_value); 87 | } 88 | } 89 | fn get_summary_value(&self, type_: u8, max_sample_age: f32, b_absolute_value: bool) -> f32 { 90 | unsafe { 91 | SampleHistory_TA_GetSummaryValue(self.addr(), type_, max_sample_age, b_absolute_value) 92 | } 93 | } 94 | fn set_base_value2(&self, in_base_value: f32) -> Option { 95 | unsafe { 96 | SampleHistoryWrapper::try_new(SampleHistory_TA_SetBaseValue2(self.addr(), in_base_value)) 97 | } 98 | } 99 | fn set_good_bad_values(&self, in_good_value: f32, in_bad_value: f32) -> Option { 100 | unsafe { 101 | SampleHistoryWrapper::try_new(SampleHistory_TA_SetGoodBadValues(self.addr(), in_good_value, in_bad_value)) 102 | } 103 | } 104 | fn set_graph_max_min(&self, max_value: f32, min_value: f32) -> Option { 105 | unsafe { 106 | SampleHistoryWrapper::try_new(SampleHistory_TA_SetGraphMaxMin(self.addr(), max_value, min_value)) 107 | } 108 | } 109 | fn set_title(&self, in_title: RLString) -> Option { 110 | unsafe { 111 | let mut in_title = in_title; 112 | let in_title: *mut RLString = &mut in_title as *mut RLString; 113 | SampleHistoryWrapper::try_new(SampleHistory_TA_SetTitle(self.addr(), in_title)) 114 | } 115 | } 116 | 117 | } 118 | 119 | extern "C" { 120 | fn SampleHistory_TA_Get_RecordSettings(obj: usize) -> usize; 121 | fn SampleHistoryWrapper_SetRecordSettings(obj: usize, new_val: usize); 122 | fn SampleHistory_TA_Get_Title(obj: usize, result: *mut RLString); 123 | fn SampleHistory_TA_Get_YMin(obj: usize) -> f32; 124 | fn SampleHistoryWrapper_SetYMin(obj: usize, new_val: f32); 125 | fn SampleHistory_TA_Get_YMax(obj: usize) -> f32; 126 | fn SampleHistoryWrapper_SetYMax(obj: usize, new_val: f32); 127 | fn SampleHistory_TA_Get_GoodValue(obj: usize) -> f32; 128 | fn SampleHistoryWrapper_SetGoodValue(obj: usize, new_val: f32); 129 | fn SampleHistory_TA_Get_BadValue(obj: usize) -> f32; 130 | fn SampleHistoryWrapper_SetBadValue(obj: usize, new_val: f32); 131 | fn SampleHistory_TA_Get_BaseValue(obj: usize) -> f32; 132 | fn SampleHistoryWrapper_SetBaseValue(obj: usize, new_val: f32); 133 | fn SampleHistory_TA_Get_Samples(obj: usize, result: *mut RLArrayRaw); 134 | fn SampleHistory_TA_Get_SampleIndex(obj: usize) -> i32; 135 | fn SampleHistoryWrapper_SetSampleIndex(obj: usize, new_val: i32); 136 | fn SampleHistory_TA_Get_AccumTime(obj: usize) -> f32; 137 | fn SampleHistoryWrapper_SetAccumTime(obj: usize, new_val: f32); 138 | fn SampleHistory_TA_Get_PendingSample(obj: usize, result: *mut Sample); 139 | fn SampleHistoryWrapper_SetPendingSample(obj: usize, new_val: *mut Sample); 140 | fn SampleHistory_TA_Get_bHasPendingSample(obj: usize) -> bool; 141 | fn SampleHistoryWrapper_SetbHasPendingSample(obj: usize, new_val: bool); 142 | fn SampleHistory_TA_Tick(obj: usize, DeltaTime: f32); 143 | fn SampleHistory_TA_AddSample(obj: usize, NewValue: f32); 144 | fn SampleHistory_TA_GetSummaryValue(obj: usize, Type: u8, MaxSampleAge: f32, bAbsoluteValue: bool) -> f32; 145 | fn SampleHistory_TA_SetBaseValue2(obj: usize, InBaseValue: f32) -> usize; 146 | fn SampleHistory_TA_SetGoodBadValues(obj: usize, InGoodValue: f32, InBadValue: f32) -> usize; 147 | fn SampleHistory_TA_SetGraphMaxMin(obj: usize, MaxValue: f32, MinValue: f32) -> usize; 148 | fn SampleHistory_TA_SetTitle(obj: usize, InTitle: *mut RLString) -> usize; 149 | 150 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/sample_record_settings.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct SampleRecordSettingsWrapper(pub usize); 5 | impl_object!(SampleRecordSettingsWrapper); 6 | 7 | impl SampleRecordSettings for SampleRecordSettingsWrapper {} 8 | 9 | pub trait SampleRecordSettings : Object { 10 | fn get_max_sample_age(&self) -> f32 { 11 | unsafe { 12 | SampleRecordSettings_TA_Get_MaxSampleAge(self.addr()) 13 | } 14 | } 15 | fn get_record_rate(&self) -> f32 { 16 | unsafe { 17 | SampleRecordSettings_TA_Get_RecordRate(self.addr()) 18 | } 19 | } 20 | 21 | } 22 | 23 | extern "C" { 24 | fn SampleRecordSettings_TA_Get_MaxSampleAge(obj: usize) -> f32; 25 | fn SampleRecordSettingsWrapper_SetMaxSampleAge(obj: usize, new_val: f32); 26 | fn SampleRecordSettings_TA_Get_RecordRate(obj: usize) -> f32; 27 | fn SampleRecordSettingsWrapper_SetRecordRate(obj: usize, new_val: f32); 28 | 29 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/save_data.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct SaveDataWrapper(pub usize); 5 | impl_object!(SaveDataWrapper); 6 | 7 | impl SaveData for SaveDataWrapper {} 8 | 9 | pub trait SaveData : Object { 10 | fn get_directory_path(&self) -> RLString { 11 | unsafe { 12 | let mut result = RLString::new(); 13 | let result_ptr: *mut RLString = &mut result as *mut RLString; 14 | Save_TA_Get_DirectoryPath(self.addr(), result_ptr); 15 | result 16 | } 17 | } 18 | fn get_save_type(&self) -> RLString { 19 | unsafe { 20 | let mut result = RLString::new(); 21 | let result_ptr: *mut RLString = &mut result as *mut RLString; 22 | Save_TA_Get_SaveType(self.addr(), result_ptr); 23 | result 24 | } 25 | } 26 | fn get_save_ext(&self) -> RLString { 27 | unsafe { 28 | let mut result = RLString::new(); 29 | let result_ptr: *mut RLString = &mut result as *mut RLString; 30 | Save_TA_Get_SaveExt(self.addr(), result_ptr); 31 | result 32 | } 33 | } 34 | fn get_b_exact_file_match(&self) -> bool { 35 | unsafe { 36 | Save_TA_Get_bExactFileMatch(self.addr()) 37 | } 38 | } 39 | fn init(&self) { 40 | unsafe { 41 | Save_TA_Init(self.addr()); 42 | } 43 | } 44 | 45 | } 46 | 47 | extern "C" { 48 | fn Save_TA_Get_DirectoryPath(obj: usize, result: *mut RLString); 49 | fn Save_TA_Get_SaveType(obj: usize, result: *mut RLString); 50 | fn Save_TA_Get_SaveExt(obj: usize, result: *mut RLString); 51 | fn Save_TA_Get_bExactFileMatch(obj: usize) -> bool; 52 | fn SaveDataWrapper_SetbExactFileMatch(obj: usize, new_val: bool); 53 | fn Save_TA_Init(obj: usize); 54 | 55 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/stat_graph.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct StatGraphWrapper(pub usize); 5 | impl_object!(StatGraphWrapper); 6 | 7 | impl StatGraph for StatGraphWrapper {} 8 | 9 | pub trait StatGraph : Object { 10 | fn get_record_settings(&self) -> Option { 11 | unsafe { 12 | SampleRecordSettingsWrapper::try_new(StatGraph_TA_Get_RecordSettings(self.addr())) 13 | } 14 | } 15 | fn get_last_tick_time(&self) -> Double { 16 | unsafe { 17 | let mut result = Double::new(); 18 | let result_ptr: *mut Double = &mut result as *mut Double; 19 | StatGraph_TA_Get_LastTickTime(self.addr(), result_ptr); 20 | result 21 | } 22 | } 23 | fn get_sample_histories(&self) -> RLArray { 24 | unsafe { 25 | let mut result = RLArrayRaw::new(); 26 | let result_ptr: *mut RLArrayRaw = &mut result as *mut RLArrayRaw; 27 | StatGraph_TA_Get_SampleHistories(self.addr(), result_ptr); 28 | RLArray::from_raw(result) 29 | } 30 | } 31 | fn stop_drawing(&self) { 32 | unsafe { 33 | StatGraph_TA_StopDrawing(self.addr()); 34 | } 35 | } 36 | fn create_sample_history(&self, title: RLString) -> Option { 37 | unsafe { 38 | let mut title = title; 39 | let title: *mut RLString = &mut title as *mut RLString; 40 | SampleHistoryWrapper::try_new(StatGraph_TA_CreateSampleHistory(self.addr(), title)) 41 | } 42 | } 43 | fn add_sample_history(&self, history: SampleHistoryWrapper) -> Option { 44 | unsafe { 45 | SampleHistoryWrapper::try_new(StatGraph_TA_AddSampleHistory(self.addr(), history.addr())) 46 | } 47 | } 48 | 49 | } 50 | 51 | extern "C" { 52 | fn StatGraph_TA_Get_RecordSettings(obj: usize) -> usize; 53 | fn StatGraphWrapper_SetRecordSettings(obj: usize, new_val: usize); 54 | fn StatGraph_TA_Get_LastTickTime(obj: usize, result: *mut Double); 55 | fn StatGraphWrapper_SetLastTickTime(obj: usize, new_val: *mut Double); 56 | fn StatGraph_TA_Get_SampleHistories(obj: usize, result: *mut RLArrayRaw); 57 | fn StatGraph_TA_StopDrawing(obj: usize); 58 | fn StatGraph_TA_CreateSampleHistory(obj: usize, Title: *mut RLString) -> usize; 59 | fn StatGraph_TA_AddSampleHistory(obj: usize, History: usize) -> usize; 60 | 61 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/stat_graph_system.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct StatGraphSystemWrapper(pub usize); 5 | impl_object!(StatGraphSystemWrapper); 6 | 7 | impl StatGraphSystem for StatGraphSystemWrapper {} 8 | 9 | pub trait StatGraphSystem : Object { 10 | fn get_graph_sample_time(&self) -> f32 { 11 | unsafe { 12 | StatGraphSystem_TA_Get_GraphSampleTime(self.addr()) 13 | } 14 | } 15 | fn get_graph_level(&self) -> u8 { 16 | unsafe { 17 | StatGraphSystem_TA_Get_GraphLevel(self.addr()) 18 | } 19 | } 20 | fn get_perf_stat_graph(&self) -> Option { 21 | unsafe { 22 | PerfStatGraphWrapper::try_new(StatGraphSystem_TA_Get_PerfStatGraph(self.addr())) 23 | } 24 | } 25 | fn get_net_stat_graph(&self) -> Option { 26 | unsafe { 27 | NetStatGraphWrapper::try_new(StatGraphSystem_TA_Get_NetStatGraph(self.addr())) 28 | } 29 | } 30 | fn get_input_buffer_graph(&self) -> Option { 31 | unsafe { 32 | InputBufferGraphWrapper::try_new(StatGraphSystem_TA_Get_InputBufferGraph(self.addr())) 33 | } 34 | } 35 | fn get_stat_graphs(&self) -> RLArray { 36 | unsafe { 37 | let mut result = RLArrayRaw::new(); 38 | let result_ptr: *mut RLArrayRaw = &mut result as *mut RLArrayRaw; 39 | StatGraphSystem_TA_Get_StatGraphs(self.addr(), result_ptr); 40 | RLArray::from_raw(result) 41 | } 42 | } 43 | fn get_visible_stat_graphs(&self) -> RLArray { 44 | unsafe { 45 | let mut result = RLArrayRaw::new(); 46 | let result_ptr: *mut RLArrayRaw = &mut result as *mut RLArrayRaw; 47 | StatGraphSystem_TA_Get_VisibleStatGraphs(self.addr(), result_ptr); 48 | RLArray::from_raw(result) 49 | } 50 | } 51 | fn graphtime(&self, seconds: f32) { 52 | unsafe { 53 | StatGraphSystem_TA_Graphtime(self.addr(), seconds); 54 | } 55 | } 56 | fn stat_graph_next(&self) { 57 | unsafe { 58 | StatGraphSystem_TA_StatGraphNext(self.addr()); 59 | } 60 | } 61 | fn get_graph_sample_time2(&self, level: u8) -> f32 { 62 | unsafe { 63 | StatGraphSystem_TA_GetGraphSampleTime2(self.addr(), level) 64 | } 65 | } 66 | fn set_graph_level2(&self, level: u8) { 67 | unsafe { 68 | StatGraphSystem_TA_SetGraphLevel2(self.addr(), level); 69 | } 70 | } 71 | 72 | } 73 | 74 | extern "C" { 75 | fn StatGraphSystem_TA_Get_GraphSampleTime(obj: usize) -> f32; 76 | fn StatGraphSystemWrapper_SetGraphSampleTime(obj: usize, new_val: f32); 77 | fn StatGraphSystem_TA_Get_GraphLevel(obj: usize) -> u8; 78 | fn StatGraphSystemWrapper_SetGraphLevel(obj: usize, new_val: u8); 79 | fn StatGraphSystem_TA_Get_PerfStatGraph(obj: usize) -> usize; 80 | fn StatGraphSystemWrapper_SetPerfStatGraph(obj: usize, new_val: usize); 81 | fn StatGraphSystem_TA_Get_NetStatGraph(obj: usize) -> usize; 82 | fn StatGraphSystemWrapper_SetNetStatGraph(obj: usize, new_val: usize); 83 | fn StatGraphSystem_TA_Get_InputBufferGraph(obj: usize) -> usize; 84 | fn StatGraphSystemWrapper_SetInputBufferGraph(obj: usize, new_val: usize); 85 | fn StatGraphSystem_TA_Get_StatGraphs(obj: usize, result: *mut RLArrayRaw); 86 | fn StatGraphSystem_TA_Get_VisibleStatGraphs(obj: usize, result: *mut RLArrayRaw); 87 | fn StatGraphSystem_TA_Graphtime(obj: usize, Seconds: f32); 88 | fn StatGraphSystem_TA_StatGraphNext(obj: usize); 89 | fn StatGraphSystem_TA_GetGraphSampleTime2(obj: usize, Level: u8) -> f32; 90 | fn StatGraphSystem_TA_SetGraphLevel2(obj: usize, Level: u8); 91 | 92 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/swapper_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct SwapperPickupWrapper(pub usize); 5 | impl_object!(SwapperPickupWrapper); 6 | 7 | impl SwapperPickup for SwapperPickupWrapper {} 8 | impl TargetedPickup for SwapperPickupWrapper {} 9 | impl RumblePickupComponent for SwapperPickupWrapper {} 10 | impl CarComponent for SwapperPickupWrapper {} 11 | impl Actor for SwapperPickupWrapper {} 12 | 13 | pub trait SwapperPickup : TargetedPickup { 14 | fn get_other_car(&self) -> Option { 15 | unsafe { 16 | CarWrapper::try_new(SpecialPickup_Swapper_TA_Get_OtherCar(self.addr())) 17 | } 18 | } 19 | fn pickup_end(&self) { 20 | unsafe { 21 | SpecialPickup_Swapper_TA_PickupEnd(self.addr()); 22 | } 23 | } 24 | fn on_target_changed(&self) { 25 | unsafe { 26 | SpecialPickup_Swapper_TA_OnTargetChanged(self.addr()); 27 | } 28 | } 29 | fn pickup_start(&self) { 30 | unsafe { 31 | SpecialPickup_Swapper_TA_PickupStart(self.addr()); 32 | } 33 | } 34 | 35 | } 36 | 37 | extern "C" { 38 | fn SpecialPickup_Swapper_TA_Get_OtherCar(obj: usize) -> usize; 39 | fn SwapperPickup_SetOtherCar(obj: usize, new_val: usize); 40 | fn SpecialPickup_Swapper_TA_PickupEnd(obj: usize); 41 | fn SpecialPickup_Swapper_TA_OnTargetChanged(obj: usize); 42 | fn SpecialPickup_Swapper_TA_PickupStart(obj: usize); 43 | 44 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/targeted_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct TargetedPickupWrapper(pub usize); 5 | impl_object!(TargetedPickupWrapper); 6 | 7 | impl TargetedPickup for TargetedPickupWrapper {} 8 | impl RumblePickupComponent for TargetedPickupWrapper {} 9 | impl CarComponent for TargetedPickupWrapper {} 10 | impl Actor for TargetedPickupWrapper {} 11 | 12 | pub trait TargetedPickup : RumblePickupComponent { 13 | fn get_b_can_target_ball(&self) -> bool { 14 | unsafe { 15 | SpecialPickup_Targeted_TA_Get_bCanTargetBall(self.addr()) 16 | } 17 | } 18 | fn get_b_can_target_cars(&self) -> bool { 19 | unsafe { 20 | SpecialPickup_Targeted_TA_Get_bCanTargetCars(self.addr()) 21 | } 22 | } 23 | fn get_b_can_target_enemy_cars(&self) -> bool { 24 | unsafe { 25 | SpecialPickup_Targeted_TA_Get_bCanTargetEnemyCars(self.addr()) 26 | } 27 | } 28 | fn get_b_can_target_team_cars(&self) -> bool { 29 | unsafe { 30 | SpecialPickup_Targeted_TA_Get_bCanTargetTeamCars(self.addr()) 31 | } 32 | } 33 | fn get_b_use_directional_targeting(&self) -> bool { 34 | unsafe { 35 | SpecialPickup_Targeted_TA_Get_bUseDirectionalTargeting(self.addr()) 36 | } 37 | } 38 | fn get_b_require_trace(&self) -> bool { 39 | unsafe { 40 | SpecialPickup_Targeted_TA_Get_bRequireTrace(self.addr()) 41 | } 42 | } 43 | fn get_range(&self) -> f32 { 44 | unsafe { 45 | SpecialPickup_Targeted_TA_Get_Range(self.addr()) 46 | } 47 | } 48 | fn get_directional_targeting_accuracy(&self) -> f32 { 49 | unsafe { 50 | SpecialPickup_Targeted_TA_Get_DirectionalTargetingAccuracy(self.addr()) 51 | } 52 | } 53 | fn get_client_target(&self) -> Option { 54 | unsafe { 55 | RBActorWrapper::try_new(SpecialPickup_Targeted_TA_Get_ClientTarget(self.addr())) 56 | } 57 | } 58 | fn get_targeted(&self) -> Option { 59 | unsafe { 60 | RBActorWrapper::try_new(SpecialPickup_Targeted_TA_Get_Targeted(self.addr())) 61 | } 62 | } 63 | fn get_client_target2(&self) -> Option { 64 | unsafe { 65 | RBActorWrapper::try_new(SpecialPickup_Targeted_TA_GetClientTarget2(self.addr())) 66 | } 67 | } 68 | fn target_changed(&self) { 69 | unsafe { 70 | SpecialPickup_Targeted_TA_TargetChanged(self.addr()); 71 | } 72 | } 73 | fn on_target_changed(&self) { 74 | unsafe { 75 | SpecialPickup_Targeted_TA_OnTargetChanged(self.addr()); 76 | } 77 | } 78 | fn try_activate(&self, target_override: RBActorWrapper) -> bool { 79 | unsafe { 80 | SpecialPickup_Targeted_TA_TryActivate(self.addr(), target_override.addr()) 81 | } 82 | } 83 | fn validate_target_trace(&self, in_target: RBActorWrapper) -> bool { 84 | unsafe { 85 | SpecialPickup_Targeted_TA_ValidateTargetTrace(self.addr(), in_target.addr()) 86 | } 87 | } 88 | fn validate_target(&self, in_target: RBActorWrapper) -> bool { 89 | unsafe { 90 | SpecialPickup_Targeted_TA_ValidateTarget(self.addr(), in_target.addr()) 91 | } 92 | } 93 | fn get_target(&self) -> Option { 94 | unsafe { 95 | RBActorWrapper::try_new(SpecialPickup_Targeted_TA_GetTarget(self.addr())) 96 | } 97 | } 98 | 99 | } 100 | 101 | extern "C" { 102 | fn SpecialPickup_Targeted_TA_Get_bCanTargetBall(obj: usize) -> bool; 103 | fn TargetedPickup_SetbCanTargetBall(obj: usize, new_val: bool); 104 | fn SpecialPickup_Targeted_TA_Get_bCanTargetCars(obj: usize) -> bool; 105 | fn TargetedPickup_SetbCanTargetCars(obj: usize, new_val: bool); 106 | fn SpecialPickup_Targeted_TA_Get_bCanTargetEnemyCars(obj: usize) -> bool; 107 | fn TargetedPickup_SetbCanTargetEnemyCars(obj: usize, new_val: bool); 108 | fn SpecialPickup_Targeted_TA_Get_bCanTargetTeamCars(obj: usize) -> bool; 109 | fn TargetedPickup_SetbCanTargetTeamCars(obj: usize, new_val: bool); 110 | fn SpecialPickup_Targeted_TA_Get_bUseDirectionalTargeting(obj: usize) -> bool; 111 | fn TargetedPickup_SetbUseDirectionalTargeting(obj: usize, new_val: bool); 112 | fn SpecialPickup_Targeted_TA_Get_bRequireTrace(obj: usize) -> bool; 113 | fn TargetedPickup_SetbRequireTrace(obj: usize, new_val: bool); 114 | fn SpecialPickup_Targeted_TA_Get_Range(obj: usize) -> f32; 115 | fn TargetedPickup_SetRange(obj: usize, new_val: f32); 116 | fn SpecialPickup_Targeted_TA_Get_DirectionalTargetingAccuracy(obj: usize) -> f32; 117 | fn TargetedPickup_SetDirectionalTargetingAccuracy(obj: usize, new_val: f32); 118 | fn SpecialPickup_Targeted_TA_Get_ClientTarget(obj: usize) -> usize; 119 | fn TargetedPickup_SetClientTarget(obj: usize, new_val: usize); 120 | fn SpecialPickup_Targeted_TA_Get_Targeted(obj: usize) -> usize; 121 | fn TargetedPickup_SetTargeted(obj: usize, new_val: usize); 122 | fn SpecialPickup_Targeted_TA_GetClientTarget2(obj: usize) -> usize; 123 | fn SpecialPickup_Targeted_TA_TargetChanged(obj: usize); 124 | fn SpecialPickup_Targeted_TA_OnTargetChanged(obj: usize); 125 | fn SpecialPickup_Targeted_TA_TryActivate(obj: usize, TargetOverride: usize) -> bool; 126 | fn SpecialPickup_Targeted_TA_ValidateTargetTrace(obj: usize, InTarget: usize) -> bool; 127 | fn SpecialPickup_Targeted_TA_ValidateTarget(obj: usize, InTarget: usize) -> bool; 128 | fn SpecialPickup_Targeted_TA_GetTarget(obj: usize) -> usize; 129 | 130 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/team_info.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct TeamInfoWrapper(pub usize); 5 | impl_object!(TeamInfoWrapper); 6 | 7 | impl TeamInfo for TeamInfoWrapper {} 8 | impl Actor for TeamInfoWrapper {} 9 | 10 | pub trait TeamInfo : Actor { 11 | fn get_team_name(&self) -> RLString { 12 | unsafe { 13 | let mut result = RLString::new(); 14 | let result_ptr: *mut RLString = &mut result as *mut RLString; 15 | TeamInfo_Get_TeamName(self.addr(), result_ptr); 16 | result 17 | } 18 | } 19 | fn get_size(&self) -> i32 { 20 | unsafe { 21 | TeamInfo_Get_Size(self.addr()) 22 | } 23 | } 24 | fn get_score(&self) -> i32 { 25 | unsafe { 26 | TeamInfo_Get_Score(self.addr()) 27 | } 28 | } 29 | fn get_team_index(&self) -> i32 { 30 | unsafe { 31 | TeamInfo_Get_TeamIndex(self.addr()) 32 | } 33 | } 34 | fn get_team_color(&self) -> Color { 35 | unsafe { 36 | let mut result = Color::new(); 37 | let result_ptr: *mut Color = &mut result as *mut Color; 38 | TeamInfo_Get_TeamColor(self.addr(), result_ptr); 39 | result 40 | } 41 | } 42 | fn get_team_num(&self) -> u8 { 43 | unsafe { 44 | TeamInfo_GetTeamNum(self.addr()) 45 | } 46 | } 47 | 48 | } 49 | 50 | extern "C" { 51 | fn TeamInfo_Get_TeamName(obj: usize, result: *mut RLString); 52 | fn TeamInfo_Get_Size(obj: usize) -> i32; 53 | fn TeamInfoWrapper_SetSize(obj: usize, new_val: i32); 54 | fn TeamInfo_Get_Score(obj: usize) -> i32; 55 | fn TeamInfoWrapper_SetScore(obj: usize, new_val: i32); 56 | fn TeamInfo_Get_TeamIndex(obj: usize) -> i32; 57 | fn TeamInfoWrapper_SetTeamIndex(obj: usize, new_val: i32); 58 | fn TeamInfo_Get_TeamColor(obj: usize, result: *mut Color); 59 | fn TeamInfoWrapper_SetTeamColor(obj: usize, new_val: *mut Color); 60 | fn TeamInfo_GetTeamNum(obj: usize) -> u8; 61 | 62 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/time_bomb_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct TimeBombPickupWrapper(pub usize); 5 | impl_object!(TimeBombPickupWrapper); 6 | 7 | impl TimeBombPickup for TimeBombPickupWrapper {} 8 | impl RumblePickupComponent for TimeBombPickupWrapper {} 9 | impl CarComponent for TimeBombPickupWrapper {} 10 | impl Actor for TimeBombPickupWrapper {} 11 | 12 | pub trait TimeBombPickup : RumblePickupComponent { 13 | fn get_radius(&self) -> f32 { 14 | unsafe { 15 | SpecialPickup_TimeBomb_TA_Get_Radius(self.addr()) 16 | } 17 | } 18 | fn get_almost_ready_duration(&self) -> f32 { 19 | unsafe { 20 | SpecialPickup_TimeBomb_TA_Get_AlmostReadyDuration(self.addr()) 21 | } 22 | } 23 | fn get_start_mat_speed(&self) -> f32 { 24 | unsafe { 25 | SpecialPickup_TimeBomb_TA_Get_StartMatSpeed(self.addr()) 26 | } 27 | } 28 | fn get_almost_ready_mat_speed(&self) -> f32 { 29 | unsafe { 30 | SpecialPickup_TimeBomb_TA_Get_AlmostReadyMatSpeed(self.addr()) 31 | } 32 | } 33 | fn get_impulse_force(&self) -> f32 { 34 | unsafe { 35 | SpecialPickup_TimeBomb_TA_Get_ImpulseForce(self.addr()) 36 | } 37 | } 38 | fn get_car_vertical_force(&self) -> f32 { 39 | unsafe { 40 | SpecialPickup_TimeBomb_TA_Get_CarVerticalForce(self.addr()) 41 | } 42 | } 43 | fn get_car_torque(&self) -> f32 { 44 | unsafe { 45 | SpecialPickup_TimeBomb_TA_Get_CarTorque(self.addr()) 46 | } 47 | } 48 | fn get_b_demolish(&self) -> bool { 49 | unsafe { 50 | SpecialPickup_TimeBomb_TA_Get_bDemolish(self.addr()) 51 | } 52 | } 53 | fn get_b_impulse(&self) -> bool { 54 | unsafe { 55 | SpecialPickup_TimeBomb_TA_Get_bImpulse(self.addr()) 56 | } 57 | } 58 | fn pickup_end(&self) { 59 | unsafe { 60 | SpecialPickup_TimeBomb_TA_PickupEnd(self.addr()); 61 | } 62 | } 63 | fn almost_ready(&self) { 64 | unsafe { 65 | SpecialPickup_TimeBomb_TA_AlmostReady(self.addr()); 66 | } 67 | } 68 | fn pickup_start(&self) { 69 | unsafe { 70 | SpecialPickup_TimeBomb_TA_PickupStart(self.addr()); 71 | } 72 | } 73 | 74 | } 75 | 76 | extern "C" { 77 | fn SpecialPickup_TimeBomb_TA_Get_Radius(obj: usize) -> f32; 78 | fn TimeBombPickup_SetRadius(obj: usize, new_val: f32); 79 | fn SpecialPickup_TimeBomb_TA_Get_AlmostReadyDuration(obj: usize) -> f32; 80 | fn TimeBombPickup_SetAlmostReadyDuration(obj: usize, new_val: f32); 81 | fn SpecialPickup_TimeBomb_TA_Get_StartMatSpeed(obj: usize) -> f32; 82 | fn TimeBombPickup_SetStartMatSpeed(obj: usize, new_val: f32); 83 | fn SpecialPickup_TimeBomb_TA_Get_AlmostReadyMatSpeed(obj: usize) -> f32; 84 | fn TimeBombPickup_SetAlmostReadyMatSpeed(obj: usize, new_val: f32); 85 | fn SpecialPickup_TimeBomb_TA_Get_ImpulseForce(obj: usize) -> f32; 86 | fn TimeBombPickup_SetImpulseForce(obj: usize, new_val: f32); 87 | fn SpecialPickup_TimeBomb_TA_Get_CarVerticalForce(obj: usize) -> f32; 88 | fn TimeBombPickup_SetCarVerticalForce(obj: usize, new_val: f32); 89 | fn SpecialPickup_TimeBomb_TA_Get_CarTorque(obj: usize) -> f32; 90 | fn TimeBombPickup_SetCarTorque(obj: usize, new_val: f32); 91 | fn SpecialPickup_TimeBomb_TA_Get_bDemolish(obj: usize) -> bool; 92 | fn TimeBombPickup_SetbDemolish(obj: usize, new_val: bool); 93 | fn SpecialPickup_TimeBomb_TA_Get_bImpulse(obj: usize) -> bool; 94 | fn TimeBombPickup_SetbImpulse(obj: usize, new_val: bool); 95 | fn SpecialPickup_TimeBomb_TA_PickupEnd(obj: usize); 96 | fn SpecialPickup_TimeBomb_TA_AlmostReady(obj: usize); 97 | fn SpecialPickup_TimeBomb_TA_PickupStart(obj: usize); 98 | 99 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/tornado_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct TornadoPickupWrapper(pub usize); 5 | impl_object!(TornadoPickupWrapper); 6 | 7 | impl TornadoPickup for TornadoPickupWrapper {} 8 | impl RumblePickupComponent for TornadoPickupWrapper {} 9 | impl CarComponent for TornadoPickupWrapper {} 10 | impl Actor for TornadoPickupWrapper {} 11 | 12 | pub trait TornadoPickup : RumblePickupComponent { 13 | fn get_height(&self) -> f32 { 14 | unsafe { 15 | SpecialPickup_Tornado_TA_Get_Height(self.addr()) 16 | } 17 | } 18 | fn get_radius(&self) -> f32 { 19 | unsafe { 20 | SpecialPickup_Tornado_TA_Get_Radius(self.addr()) 21 | } 22 | } 23 | fn get_offset(&self) -> Vector { 24 | unsafe { 25 | let mut result = Vector::new(); 26 | let result_ptr: *mut Vector = &mut result as *mut Vector; 27 | SpecialPickup_Tornado_TA_Get_Offset(self.addr(), result_ptr); 28 | result 29 | } 30 | } 31 | fn get_rotational_force(&self) -> f32 { 32 | unsafe { 33 | SpecialPickup_Tornado_TA_Get_RotationalForce(self.addr()) 34 | } 35 | } 36 | fn get_torque(&self) -> f32 { 37 | unsafe { 38 | SpecialPickup_Tornado_TA_Get_Torque(self.addr()) 39 | } 40 | } 41 | fn get_fx_scale(&self) -> Vector { 42 | unsafe { 43 | let mut result = Vector::new(); 44 | let result_ptr: *mut Vector = &mut result as *mut Vector; 45 | SpecialPickup_Tornado_TA_Get_FXScale(self.addr(), result_ptr); 46 | result 47 | } 48 | } 49 | fn get_fx_offset(&self) -> Vector { 50 | unsafe { 51 | let mut result = Vector::new(); 52 | let result_ptr: *mut Vector = &mut result as *mut Vector; 53 | SpecialPickup_Tornado_TA_Get_FXOffset(self.addr(), result_ptr); 54 | result 55 | } 56 | } 57 | fn get_mesh_offset(&self) -> Vector { 58 | unsafe { 59 | let mut result = Vector::new(); 60 | let result_ptr: *mut Vector = &mut result as *mut Vector; 61 | SpecialPickup_Tornado_TA_Get_MeshOffset(self.addr(), result_ptr); 62 | result 63 | } 64 | } 65 | fn get_mesh_scale(&self) -> Vector { 66 | unsafe { 67 | let mut result = Vector::new(); 68 | let result_ptr: *mut Vector = &mut result as *mut Vector; 69 | SpecialPickup_Tornado_TA_Get_MeshScale(self.addr(), result_ptr); 70 | result 71 | } 72 | } 73 | fn get_max_velocity_offset(&self) -> f32 { 74 | unsafe { 75 | SpecialPickup_Tornado_TA_Get_MaxVelocityOffset(self.addr()) 76 | } 77 | } 78 | fn get_ball_multiplier(&self) -> f32 { 79 | unsafe { 80 | SpecialPickup_Tornado_TA_Get_BallMultiplier(self.addr()) 81 | } 82 | } 83 | fn get_b_debug_vis(&self) -> bool { 84 | unsafe { 85 | SpecialPickup_Tornado_TA_Get_bDebugVis(self.addr()) 86 | } 87 | } 88 | fn get_velocity_ease(&self) -> f32 { 89 | unsafe { 90 | SpecialPickup_Tornado_TA_Get_VelocityEase(self.addr()) 91 | } 92 | } 93 | fn get_vel(&self) -> Vector { 94 | unsafe { 95 | let mut result = Vector::new(); 96 | let result_ptr: *mut Vector = &mut result as *mut Vector; 97 | SpecialPickup_Tornado_TA_Get_Vel(self.addr(), result_ptr); 98 | result 99 | } 100 | } 101 | fn get_affecting(&self) -> RLArray { 102 | unsafe { 103 | let mut result = RLArrayRaw::new(); 104 | let result_ptr: *mut RLArrayRaw = &mut result as *mut RLArrayRaw; 105 | SpecialPickup_Tornado_TA_Get_Affecting(self.addr(), result_ptr); 106 | RLArray::from_raw(result) 107 | } 108 | } 109 | fn apply_forces(&self, active_time: f32) { 110 | unsafe { 111 | SpecialPickup_Tornado_TA_ApplyForces(self.addr(), active_time); 112 | } 113 | } 114 | fn play_car_sfx(&self, in_actor: RBActorWrapper) { 115 | unsafe { 116 | SpecialPickup_Tornado_TA_PlayCarSFX(self.addr(), in_actor.addr()); 117 | } 118 | } 119 | fn play_ball_sfx(&self, in_actor: RBActorWrapper) { 120 | unsafe { 121 | SpecialPickup_Tornado_TA_PlayBallSFX(self.addr(), in_actor.addr()); 122 | } 123 | } 124 | 125 | } 126 | 127 | extern "C" { 128 | fn SpecialPickup_Tornado_TA_Get_Height(obj: usize) -> f32; 129 | fn TornadoPickup_SetHeight(obj: usize, new_val: f32); 130 | fn SpecialPickup_Tornado_TA_Get_Radius(obj: usize) -> f32; 131 | fn TornadoPickup_SetRadius(obj: usize, new_val: f32); 132 | fn SpecialPickup_Tornado_TA_Get_Offset(obj: usize, result: *mut Vector); 133 | fn TornadoPickup_SetOffset(obj: usize, new_val: *mut Vector); 134 | fn SpecialPickup_Tornado_TA_Get_RotationalForce(obj: usize) -> f32; 135 | fn TornadoPickup_SetRotationalForce(obj: usize, new_val: f32); 136 | fn SpecialPickup_Tornado_TA_Get_Torque(obj: usize) -> f32; 137 | fn TornadoPickup_SetTorque(obj: usize, new_val: f32); 138 | fn SpecialPickup_Tornado_TA_Get_FXScale(obj: usize, result: *mut Vector); 139 | fn TornadoPickup_SetFXScale(obj: usize, new_val: *mut Vector); 140 | fn SpecialPickup_Tornado_TA_Get_FXOffset(obj: usize, result: *mut Vector); 141 | fn TornadoPickup_SetFXOffset(obj: usize, new_val: *mut Vector); 142 | fn SpecialPickup_Tornado_TA_Get_MeshOffset(obj: usize, result: *mut Vector); 143 | fn TornadoPickup_SetMeshOffset(obj: usize, new_val: *mut Vector); 144 | fn SpecialPickup_Tornado_TA_Get_MeshScale(obj: usize, result: *mut Vector); 145 | fn TornadoPickup_SetMeshScale(obj: usize, new_val: *mut Vector); 146 | fn SpecialPickup_Tornado_TA_Get_MaxVelocityOffset(obj: usize) -> f32; 147 | fn TornadoPickup_SetMaxVelocityOffset(obj: usize, new_val: f32); 148 | fn SpecialPickup_Tornado_TA_Get_BallMultiplier(obj: usize) -> f32; 149 | fn TornadoPickup_SetBallMultiplier(obj: usize, new_val: f32); 150 | fn SpecialPickup_Tornado_TA_Get_bDebugVis(obj: usize) -> bool; 151 | fn TornadoPickup_SetbDebugVis(obj: usize, new_val: bool); 152 | fn SpecialPickup_Tornado_TA_Get_VelocityEase(obj: usize) -> f32; 153 | fn TornadoPickup_SetVelocityEase(obj: usize, new_val: f32); 154 | fn SpecialPickup_Tornado_TA_Get_Vel(obj: usize, result: *mut Vector); 155 | fn TornadoPickup_SetVel(obj: usize, new_val: *mut Vector); 156 | fn SpecialPickup_Tornado_TA_Get_Affecting(obj: usize, result: *mut RLArrayRaw); 157 | fn SpecialPickup_Tornado_TA_ApplyForces(obj: usize, ActiveTime: f32); 158 | fn SpecialPickup_Tornado_TA_PlayCarSFX(obj: usize, InActor: usize); 159 | fn SpecialPickup_Tornado_TA_PlayBallSFX(obj: usize, InActor: usize); 160 | 161 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/training_editor_save_data.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct TrainingEditorSaveDataWrapper(pub usize); 5 | impl_object!(TrainingEditorSaveDataWrapper); 6 | 7 | impl TrainingEditorSaveData for TrainingEditorSaveDataWrapper {} 8 | 9 | pub trait TrainingEditorSaveData : Object { 10 | fn get_code(&self) -> RLString { 11 | unsafe { 12 | let mut result = RLString::new(); 13 | let result_ptr: *mut RLString = &mut result as *mut RLString; 14 | TrainingEditorData_TA_Get_Code(self.addr(), result_ptr); 15 | result 16 | } 17 | } 18 | fn get_tm_name(&self) -> RLString { 19 | unsafe { 20 | let mut result = RLString::new(); 21 | let result_ptr: *mut RLString = &mut result as *mut RLString; 22 | TrainingEditorData_TA_Get_TM_Name(self.addr(), result_ptr); 23 | result 24 | } 25 | } 26 | fn get_type(&self) -> u8 { 27 | unsafe { 28 | TrainingEditorData_TA_Get_Type(self.addr()) 29 | } 30 | } 31 | fn get_difficulty(&self) -> u8 { 32 | unsafe { 33 | TrainingEditorData_TA_Get_Difficulty(self.addr()) 34 | } 35 | } 36 | fn get_creator_name(&self) -> RLString { 37 | unsafe { 38 | let mut result = RLString::new(); 39 | let result_ptr: *mut RLString = &mut result as *mut RLString; 40 | TrainingEditorData_TA_Get_CreatorName(self.addr(), result_ptr); 41 | result 42 | } 43 | } 44 | fn get_description(&self) -> RLString { 45 | unsafe { 46 | let mut result = RLString::new(); 47 | let result_ptr: *mut RLString = &mut result as *mut RLString; 48 | TrainingEditorData_TA_Get_Description(self.addr(), result_ptr); 49 | result 50 | } 51 | } 52 | fn get_num_rounds(&self) -> i32 { 53 | unsafe { 54 | TrainingEditorData_TA_Get_NumRounds(self.addr()) 55 | } 56 | } 57 | fn get_created_at(&self) -> i64 { 58 | unsafe { 59 | TrainingEditorData_TA_Get_CreatedAt(self.addr()) 60 | } 61 | } 62 | fn get_updated_at(&self) -> i64 { 63 | unsafe { 64 | TrainingEditorData_TA_Get_UpdatedAt(self.addr()) 65 | } 66 | } 67 | fn get_creator_player_id(&self) -> UniqueNetId { 68 | unsafe { 69 | let mut result = UniqueNetId::new(); 70 | let result_ptr: *mut UniqueNetId = &mut result as *mut UniqueNetId; 71 | TrainingEditorData_TA_Get_CreatorPlayerID(self.addr(), result_ptr); 72 | result 73 | } 74 | } 75 | fn init(&self) { 76 | unsafe { 77 | TrainingEditorData_TA_Init(self.addr()); 78 | } 79 | } 80 | 81 | } 82 | 83 | extern "C" { 84 | fn TrainingEditorData_TA_Get_Code(obj: usize, result: *mut RLString); 85 | fn TrainingEditorData_TA_Get_TM_Name(obj: usize, result: *mut RLString); 86 | fn TrainingEditorData_TA_Get_Type(obj: usize) -> u8; 87 | fn TrainingEditorSaveDataWrapper_SetType(obj: usize, new_val: u8); 88 | fn TrainingEditorData_TA_Get_Difficulty(obj: usize) -> u8; 89 | fn TrainingEditorSaveDataWrapper_SetDifficulty(obj: usize, new_val: u8); 90 | fn TrainingEditorData_TA_Get_CreatorName(obj: usize, result: *mut RLString); 91 | fn TrainingEditorData_TA_Get_Description(obj: usize, result: *mut RLString); 92 | fn TrainingEditorData_TA_Get_NumRounds(obj: usize) -> i32; 93 | fn TrainingEditorSaveDataWrapper_SetNumRounds(obj: usize, new_val: i32); 94 | fn TrainingEditorData_TA_Get_CreatedAt(obj: usize) -> i64; 95 | fn TrainingEditorSaveDataWrapper_SetCreatedAt(obj: usize, new_val: i64); 96 | fn TrainingEditorData_TA_Get_UpdatedAt(obj: usize) -> i64; 97 | fn TrainingEditorSaveDataWrapper_SetUpdatedAt(obj: usize, new_val: i64); 98 | fn TrainingEditorData_TA_Get_CreatorPlayerID(obj: usize, result: *mut UniqueNetId); 99 | fn TrainingEditorSaveDataWrapper_SetCreatorPlayerID(obj: usize, new_val: *mut UniqueNetId); 100 | fn TrainingEditorData_TA_Init(obj: usize); 101 | 102 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/vehicle_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct VehiclePickupWrapper(pub usize); 5 | impl_object!(VehiclePickupWrapper); 6 | 7 | impl VehiclePickup for VehiclePickupWrapper {} 8 | impl Actor for VehiclePickupWrapper {} 9 | 10 | pub trait VehiclePickup : Actor { 11 | fn get_respawn_delay(&self) -> f32 { 12 | unsafe { 13 | VehiclePickup_TA_Get_RespawnDelay(self.addr()) 14 | } 15 | } 16 | fn get_fx_actor_archetype(&self) -> Option { 17 | unsafe { 18 | FXActorWrapper::try_new(VehiclePickup_TA_Get_FXActorArchetype(self.addr())) 19 | } 20 | } 21 | fn get_fx_actor(&self) -> Option { 22 | unsafe { 23 | FXActorWrapper::try_new(VehiclePickup_TA_Get_FXActor(self.addr())) 24 | } 25 | } 26 | fn get_b_net_relevant(&self) -> bool { 27 | unsafe { 28 | VehiclePickup_TA_Get_bNetRelevant(self.addr()) 29 | } 30 | } 31 | fn get_b_no_pickup(&self) -> bool { 32 | unsafe { 33 | VehiclePickup_TA_Get_bNoPickup(self.addr()) 34 | } 35 | } 36 | fn play_picked_up_fx(&self) { 37 | unsafe { 38 | VehiclePickup_TA_PlayPickedUpFX(self.addr()); 39 | } 40 | } 41 | fn is_touching_a_vehicle(&self) -> bool { 42 | unsafe { 43 | VehiclePickup_TA_IsTouchingAVehicle(self.addr()) 44 | } 45 | } 46 | fn update_tick_disabled(&self) { 47 | unsafe { 48 | VehiclePickup_TA_UpdateTickDisabled(self.addr()); 49 | } 50 | } 51 | fn set_net_relevant(&self, b_relevant: bool) { 52 | unsafe { 53 | VehiclePickup_TA_SetNetRelevant(self.addr(), b_relevant); 54 | } 55 | } 56 | fn respawn(&self) { 57 | unsafe { 58 | VehiclePickup_TA_Respawn(self.addr()); 59 | } 60 | } 61 | fn pickup(&self, car: CarWrapper) { 62 | unsafe { 63 | VehiclePickup_TA_Pickup(self.addr(), car.addr()); 64 | } 65 | } 66 | fn can_pickup(&self, car: CarWrapper) -> bool { 67 | unsafe { 68 | VehiclePickup_TA_CanPickup(self.addr(), car.addr()) 69 | } 70 | } 71 | fn on_touch(&self, car: CarWrapper) { 72 | unsafe { 73 | VehiclePickup_TA_OnTouch(self.addr(), car.addr()); 74 | } 75 | } 76 | fn on_pick_up(&self) { 77 | unsafe { 78 | VehiclePickup_TA_OnPickUp(self.addr()); 79 | } 80 | } 81 | fn on_spawn(&self) { 82 | unsafe { 83 | VehiclePickup_TA_OnSpawn(self.addr()); 84 | } 85 | } 86 | fn set_no_pickup(&self) { 87 | unsafe { 88 | VehiclePickup_TA_SetNoPickup(self.addr()); 89 | } 90 | } 91 | fn setup_replicate_no_pickup(&self) { 92 | unsafe { 93 | VehiclePickup_TA_SetupReplicateNoPickup(self.addr()); 94 | } 95 | } 96 | fn init_fx(&self) { 97 | unsafe { 98 | VehiclePickup_TA_InitFX(self.addr()); 99 | } 100 | } 101 | fn event_picked_up(&self, pickup: VehiclePickupWrapper) { 102 | unsafe { 103 | VehiclePickup_TA_EventPickedUp(self.addr(), pickup.addr()); 104 | } 105 | } 106 | fn event_spawned(&self, pickup: VehiclePickupWrapper) { 107 | unsafe { 108 | VehiclePickup_TA_EventSpawned(self.addr(), pickup.addr()); 109 | } 110 | } 111 | 112 | } 113 | 114 | extern "C" { 115 | fn VehiclePickup_TA_Get_RespawnDelay(obj: usize) -> f32; 116 | fn VehiclePickupWrapper_SetRespawnDelay(obj: usize, new_val: f32); 117 | fn VehiclePickup_TA_Get_FXActorArchetype(obj: usize) -> usize; 118 | fn VehiclePickupWrapper_SetFXActorArchetype(obj: usize, new_val: usize); 119 | fn VehiclePickup_TA_Get_FXActor(obj: usize) -> usize; 120 | fn VehiclePickupWrapper_SetFXActor(obj: usize, new_val: usize); 121 | fn VehiclePickup_TA_Get_bNetRelevant(obj: usize) -> bool; 122 | fn VehiclePickupWrapper_SetbNetRelevant(obj: usize, new_val: bool); 123 | fn VehiclePickup_TA_Get_bNoPickup(obj: usize) -> bool; 124 | fn VehiclePickupWrapper_SetbNoPickup(obj: usize, new_val: bool); 125 | fn VehiclePickup_TA_PlayPickedUpFX(obj: usize); 126 | fn VehiclePickup_TA_IsTouchingAVehicle(obj: usize) -> bool; 127 | fn VehiclePickup_TA_UpdateTickDisabled(obj: usize); 128 | fn VehiclePickup_TA_SetNetRelevant(obj: usize, bRelevant: bool); 129 | fn VehiclePickup_TA_Respawn(obj: usize); 130 | fn VehiclePickup_TA_Pickup(obj: usize, Car: usize); 131 | fn VehiclePickup_TA_CanPickup(obj: usize, Car: usize) -> bool; 132 | fn VehiclePickup_TA_OnTouch(obj: usize, Car: usize); 133 | fn VehiclePickup_TA_OnPickUp(obj: usize); 134 | fn VehiclePickup_TA_OnSpawn(obj: usize); 135 | fn VehiclePickup_TA_SetNoPickup(obj: usize); 136 | fn VehiclePickup_TA_SetupReplicateNoPickup(obj: usize); 137 | fn VehiclePickup_TA_InitFX(obj: usize); 138 | fn VehiclePickup_TA_EventPickedUp(obj: usize, Pickup: usize); 139 | fn VehiclePickup_TA_EventSpawned(obj: usize, Pickup: usize); 140 | 141 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/vehicle_sim.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct VehicleSimWrapper(pub usize); 5 | impl_object!(VehicleSimWrapper); 6 | 7 | impl VehicleSim for VehicleSimWrapper {} 8 | 9 | pub trait VehicleSim : Object { 10 | fn get_wheels(&self) -> RLArray { 11 | unsafe { 12 | let mut result = RLArrayRaw::new(); 13 | let result_ptr: *mut RLArrayRaw = &mut result as *mut RLArrayRaw; 14 | VehicleSim_TA_Get_Wheels(self.addr(), result_ptr); 15 | RLArray::from_raw(result) 16 | } 17 | } 18 | fn get_drive_torque(&self) -> f32 { 19 | unsafe { 20 | VehicleSim_TA_Get_DriveTorque(self.addr()) 21 | } 22 | } 23 | fn get_brake_torque(&self) -> f32 { 24 | unsafe { 25 | VehicleSim_TA_Get_BrakeTorque(self.addr()) 26 | } 27 | } 28 | fn get_stop_threshold(&self) -> f32 { 29 | unsafe { 30 | VehicleSim_TA_Get_StopThreshold(self.addr()) 31 | } 32 | } 33 | fn get_idle_brake_factor(&self) -> f32 { 34 | unsafe { 35 | VehicleSim_TA_Get_IdleBrakeFactor(self.addr()) 36 | } 37 | } 38 | fn get_opposite_brake_factor(&self) -> f32 { 39 | unsafe { 40 | VehicleSim_TA_Get_OppositeBrakeFactor(self.addr()) 41 | } 42 | } 43 | fn get_b_use_ackermann_steering(&self) -> bool { 44 | unsafe { 45 | VehicleSim_TA_Get_bUseAckermannSteering(self.addr()) 46 | } 47 | } 48 | fn get_b_was_attached(&self) -> bool { 49 | unsafe { 50 | VehicleSim_TA_Get_bWasAttached(self.addr()) 51 | } 52 | } 53 | fn get_output_throttle(&self) -> f32 { 54 | unsafe { 55 | VehicleSim_TA_Get_OutputThrottle(self.addr()) 56 | } 57 | } 58 | fn get_output_steer(&self) -> f32 { 59 | unsafe { 60 | VehicleSim_TA_Get_OutputSteer(self.addr()) 61 | } 62 | } 63 | fn get_output_brake(&self) -> f32 { 64 | unsafe { 65 | VehicleSim_TA_Get_OutputBrake(self.addr()) 66 | } 67 | } 68 | fn get_output_handbrake(&self) -> f32 { 69 | unsafe { 70 | VehicleSim_TA_Get_OutputHandbrake(self.addr()) 71 | } 72 | } 73 | fn get_vehicle(&self) -> Option { 74 | unsafe { 75 | VehicleWrapper::try_new(VehicleSim_TA_Get_Vehicle(self.addr())) 76 | } 77 | } 78 | fn get_car(&self) -> Option { 79 | unsafe { 80 | CarWrapper::try_new(VehicleSim_TA_Get_Car(self.addr())) 81 | } 82 | } 83 | fn get_steering_sensitivity(&self) -> f32 { 84 | unsafe { 85 | VehicleSim_TA_Get_SteeringSensitivity(self.addr()) 86 | } 87 | } 88 | 89 | } 90 | 91 | extern "C" { 92 | fn VehicleSim_TA_Get_Wheels(obj: usize, result: *mut RLArrayRaw); 93 | fn VehicleSim_TA_Get_DriveTorque(obj: usize) -> f32; 94 | fn VehicleSimWrapper_SetDriveTorque(obj: usize, new_val: f32); 95 | fn VehicleSim_TA_Get_BrakeTorque(obj: usize) -> f32; 96 | fn VehicleSimWrapper_SetBrakeTorque(obj: usize, new_val: f32); 97 | fn VehicleSim_TA_Get_StopThreshold(obj: usize) -> f32; 98 | fn VehicleSimWrapper_SetStopThreshold(obj: usize, new_val: f32); 99 | fn VehicleSim_TA_Get_IdleBrakeFactor(obj: usize) -> f32; 100 | fn VehicleSimWrapper_SetIdleBrakeFactor(obj: usize, new_val: f32); 101 | fn VehicleSim_TA_Get_OppositeBrakeFactor(obj: usize) -> f32; 102 | fn VehicleSimWrapper_SetOppositeBrakeFactor(obj: usize, new_val: f32); 103 | fn VehicleSim_TA_Get_bUseAckermannSteering(obj: usize) -> bool; 104 | fn VehicleSimWrapper_SetbUseAckermannSteering(obj: usize, new_val: bool); 105 | fn VehicleSim_TA_Get_bWasAttached(obj: usize) -> bool; 106 | fn VehicleSimWrapper_SetbWasAttached(obj: usize, new_val: bool); 107 | fn VehicleSim_TA_Get_OutputThrottle(obj: usize) -> f32; 108 | fn VehicleSimWrapper_SetOutputThrottle(obj: usize, new_val: f32); 109 | fn VehicleSim_TA_Get_OutputSteer(obj: usize) -> f32; 110 | fn VehicleSimWrapper_SetOutputSteer(obj: usize, new_val: f32); 111 | fn VehicleSim_TA_Get_OutputBrake(obj: usize) -> f32; 112 | fn VehicleSimWrapper_SetOutputBrake(obj: usize, new_val: f32); 113 | fn VehicleSim_TA_Get_OutputHandbrake(obj: usize) -> f32; 114 | fn VehicleSimWrapper_SetOutputHandbrake(obj: usize, new_val: f32); 115 | fn VehicleSim_TA_Get_Vehicle(obj: usize) -> usize; 116 | fn VehicleSimWrapper_SetVehicle(obj: usize, new_val: usize); 117 | fn VehicleSim_TA_Get_Car(obj: usize) -> usize; 118 | fn VehicleSimWrapper_SetCar(obj: usize, new_val: usize); 119 | fn VehicleSim_TA_Get_SteeringSensitivity(obj: usize) -> f32; 120 | fn VehicleSimWrapper_SetSteeringSensitivity(obj: usize, new_val: f32); 121 | 122 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/velcro_pickup.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct VelcroPickupWrapper(pub usize); 5 | impl_object!(VelcroPickupWrapper); 6 | 7 | impl VelcroPickup for VelcroPickupWrapper {} 8 | impl RumblePickupComponent for VelcroPickupWrapper {} 9 | impl CarComponent for VelcroPickupWrapper {} 10 | impl Actor for VelcroPickupWrapper {} 11 | 12 | pub trait VelcroPickup : RumblePickupComponent { 13 | fn get_ball_offset(&self) -> Vector { 14 | unsafe { 15 | let mut result = Vector::new(); 16 | let result_ptr: *mut Vector = &mut result as *mut Vector; 17 | SpecialPickup_BallVelcro_TA_Get_BallOffset(self.addr(), result_ptr); 18 | result 19 | } 20 | } 21 | fn get_b_use_real_offset(&self) -> bool { 22 | unsafe { 23 | SpecialPickup_BallVelcro_TA_Get_bUseRealOffset(self.addr()) 24 | } 25 | } 26 | fn get_b_hit(&self) -> bool { 27 | unsafe { 28 | SpecialPickup_BallVelcro_TA_Get_bHit(self.addr()) 29 | } 30 | } 31 | fn get_b_broken(&self) -> bool { 32 | unsafe { 33 | SpecialPickup_BallVelcro_TA_Get_bBroken(self.addr()) 34 | } 35 | } 36 | fn get_after_hit_duration(&self) -> f32 { 37 | unsafe { 38 | SpecialPickup_BallVelcro_TA_Get_AfterHitDuration(self.addr()) 39 | } 40 | } 41 | fn get_post_break_duration(&self) -> f32 { 42 | unsafe { 43 | SpecialPickup_BallVelcro_TA_Get_PostBreakDuration(self.addr()) 44 | } 45 | } 46 | fn get_min_break_force(&self) -> f32 { 47 | unsafe { 48 | SpecialPickup_BallVelcro_TA_Get_MinBreakForce(self.addr()) 49 | } 50 | } 51 | fn get_min_break_time(&self) -> f32 { 52 | unsafe { 53 | SpecialPickup_BallVelcro_TA_Get_MinBreakTime(self.addr()) 54 | } 55 | } 56 | fn get_check_last_touch_rate(&self) -> f32 { 57 | unsafe { 58 | SpecialPickup_BallVelcro_TA_Get_CheckLastTouchRate(self.addr()) 59 | } 60 | } 61 | fn get_welded_ball(&self) -> Option { 62 | unsafe { 63 | BallWrapper::try_new(SpecialPickup_BallVelcro_TA_Get_WeldedBall(self.addr())) 64 | } 65 | } 66 | fn get_old_ball_mass(&self) -> f32 { 67 | unsafe { 68 | SpecialPickup_BallVelcro_TA_Get_OldBallMass(self.addr()) 69 | } 70 | } 71 | fn get_attach_time(&self) -> f32 { 72 | unsafe { 73 | SpecialPickup_BallVelcro_TA_Get_AttachTime(self.addr()) 74 | } 75 | } 76 | fn get_last_touch_check_time(&self) -> f32 { 77 | unsafe { 78 | SpecialPickup_BallVelcro_TA_Get_LastTouchCheckTime(self.addr()) 79 | } 80 | } 81 | fn get_break_time(&self) -> f32 { 82 | unsafe { 83 | SpecialPickup_BallVelcro_TA_Get_BreakTime(self.addr()) 84 | } 85 | } 86 | fn do_break(&self) { 87 | unsafe { 88 | SpecialPickup_BallVelcro_TA_DoBreak(self.addr()); 89 | } 90 | } 91 | fn handle_car_touch(&self, in_ball: BallWrapper, in_car: CarWrapper, hit_type: u8) { 92 | unsafe { 93 | SpecialPickup_BallVelcro_TA_HandleCarTouch(self.addr(), in_ball.addr(), in_car.addr(), hit_type); 94 | } 95 | } 96 | fn pickup_end(&self) { 97 | unsafe { 98 | SpecialPickup_BallVelcro_TA_PickupEnd(self.addr()); 99 | } 100 | } 101 | fn on_ball_hit(&self) { 102 | unsafe { 103 | SpecialPickup_BallVelcro_TA_OnBallHit(self.addr()); 104 | } 105 | } 106 | fn pickup_start(&self) { 107 | unsafe { 108 | SpecialPickup_BallVelcro_TA_PickupStart(self.addr()); 109 | } 110 | } 111 | 112 | } 113 | 114 | extern "C" { 115 | fn SpecialPickup_BallVelcro_TA_Get_BallOffset(obj: usize, result: *mut Vector); 116 | fn VelcroPickup_SetBallOffset(obj: usize, new_val: *mut Vector); 117 | fn SpecialPickup_BallVelcro_TA_Get_bUseRealOffset(obj: usize) -> bool; 118 | fn VelcroPickup_SetbUseRealOffset(obj: usize, new_val: bool); 119 | fn SpecialPickup_BallVelcro_TA_Get_bHit(obj: usize) -> bool; 120 | fn VelcroPickup_SetbHit(obj: usize, new_val: bool); 121 | fn SpecialPickup_BallVelcro_TA_Get_bBroken(obj: usize) -> bool; 122 | fn VelcroPickup_SetbBroken(obj: usize, new_val: bool); 123 | fn SpecialPickup_BallVelcro_TA_Get_AfterHitDuration(obj: usize) -> f32; 124 | fn VelcroPickup_SetAfterHitDuration(obj: usize, new_val: f32); 125 | fn SpecialPickup_BallVelcro_TA_Get_PostBreakDuration(obj: usize) -> f32; 126 | fn VelcroPickup_SetPostBreakDuration(obj: usize, new_val: f32); 127 | fn SpecialPickup_BallVelcro_TA_Get_MinBreakForce(obj: usize) -> f32; 128 | fn VelcroPickup_SetMinBreakForce(obj: usize, new_val: f32); 129 | fn SpecialPickup_BallVelcro_TA_Get_MinBreakTime(obj: usize) -> f32; 130 | fn VelcroPickup_SetMinBreakTime(obj: usize, new_val: f32); 131 | fn SpecialPickup_BallVelcro_TA_Get_CheckLastTouchRate(obj: usize) -> f32; 132 | fn VelcroPickup_SetCheckLastTouchRate(obj: usize, new_val: f32); 133 | fn SpecialPickup_BallVelcro_TA_Get_WeldedBall(obj: usize) -> usize; 134 | fn VelcroPickup_SetWeldedBall(obj: usize, new_val: usize); 135 | fn SpecialPickup_BallVelcro_TA_Get_OldBallMass(obj: usize) -> f32; 136 | fn VelcroPickup_SetOldBallMass(obj: usize, new_val: f32); 137 | fn SpecialPickup_BallVelcro_TA_Get_AttachTime(obj: usize) -> f32; 138 | fn VelcroPickup_SetAttachTime(obj: usize, new_val: f32); 139 | fn SpecialPickup_BallVelcro_TA_Get_LastTouchCheckTime(obj: usize) -> f32; 140 | fn VelcroPickup_SetLastTouchCheckTime(obj: usize, new_val: f32); 141 | fn SpecialPickup_BallVelcro_TA_Get_BreakTime(obj: usize) -> f32; 142 | fn VelcroPickup_SetBreakTime(obj: usize, new_val: f32); 143 | fn SpecialPickup_BallVelcro_TA_DoBreak(obj: usize); 144 | fn SpecialPickup_BallVelcro_TA_HandleCarTouch(obj: usize, InBall: usize, InCar: usize, HitType: u8); 145 | fn SpecialPickup_BallVelcro_TA_PickupEnd(obj: usize); 146 | fn SpecialPickup_BallVelcro_TA_OnBallHit(obj: usize); 147 | fn SpecialPickup_BallVelcro_TA_PickupStart(obj: usize); 148 | 149 | } -------------------------------------------------------------------------------- /src/wrappers/unreal/wheel.rs: -------------------------------------------------------------------------------- 1 | use crate::wrappers::{*, structs::*, unreal::*}; 2 | use super::*; 3 | 4 | pub struct WheelWrapper(pub usize); 5 | impl_object!(WheelWrapper); 6 | 7 | impl Wheel for WheelWrapper {} 8 | 9 | pub trait Wheel : Object { 10 | fn get_steer_factor(&self) -> f32 { 11 | unsafe { 12 | Wheel_TA_Get_SteerFactor(self.addr()) 13 | } 14 | } 15 | fn get_wheel_radius(&self) -> f32 { 16 | unsafe { 17 | Wheel_TA_Get_WheelRadius(self.addr()) 18 | } 19 | } 20 | fn get_suspension_stiffness(&self) -> f32 { 21 | unsafe { 22 | Wheel_TA_Get_SuspensionStiffness(self.addr()) 23 | } 24 | } 25 | fn get_suspension_damping_compression(&self) -> f32 { 26 | unsafe { 27 | Wheel_TA_Get_SuspensionDampingCompression(self.addr()) 28 | } 29 | } 30 | fn get_suspension_damping_relaxation(&self) -> f32 { 31 | unsafe { 32 | Wheel_TA_Get_SuspensionDampingRelaxation(self.addr()) 33 | } 34 | } 35 | fn get_suspension_travel(&self) -> f32 { 36 | unsafe { 37 | Wheel_TA_Get_SuspensionTravel(self.addr()) 38 | } 39 | } 40 | fn get_suspension_max_raise(&self) -> f32 { 41 | unsafe { 42 | Wheel_TA_Get_SuspensionMaxRaise(self.addr()) 43 | } 44 | } 45 | fn get_contact_force_distance(&self) -> f32 { 46 | unsafe { 47 | Wheel_TA_Get_ContactForceDistance(self.addr()) 48 | } 49 | } 50 | fn get_spin_speed_decay_rate(&self) -> f32 { 51 | unsafe { 52 | Wheel_TA_Get_SpinSpeedDecayRate(self.addr()) 53 | } 54 | } 55 | fn get_bone_offset(&self) -> Vector { 56 | unsafe { 57 | let mut result = Vector::new(); 58 | let result_ptr: *mut Vector = &mut result as *mut Vector; 59 | Wheel_TA_Get_BoneOffset(self.addr(), result_ptr); 60 | result 61 | } 62 | } 63 | fn get_preset_rest_position(&self) -> Vector { 64 | unsafe { 65 | let mut result = Vector::new(); 66 | let result_ptr: *mut Vector = &mut result as *mut Vector; 67 | Wheel_TA_Get_PresetRestPosition(self.addr(), result_ptr); 68 | result 69 | } 70 | } 71 | fn get_local_suspension_ray_start(&self) -> Vector { 72 | unsafe { 73 | let mut result = Vector::new(); 74 | let result_ptr: *mut Vector = &mut result as *mut Vector; 75 | Wheel_TA_Get_LocalSuspensionRayStart(self.addr(), result_ptr); 76 | result 77 | } 78 | } 79 | fn get_local_rest_position(&self) -> Vector { 80 | unsafe { 81 | let mut result = Vector::new(); 82 | let result_ptr: *mut Vector = &mut result as *mut Vector; 83 | Wheel_TA_Get_LocalRestPosition(self.addr(), result_ptr); 84 | result 85 | } 86 | } 87 | fn get_vehicle_sim(&self) -> Option { 88 | unsafe { 89 | VehicleSimWrapper::try_new(Wheel_TA_Get_VehicleSim(self.addr())) 90 | } 91 | } 92 | fn get_wheel_index(&self) -> i32 { 93 | unsafe { 94 | Wheel_TA_Get_WheelIndex(self.addr()) 95 | } 96 | } 97 | fn get_contact(&self) -> WheelContactData { 98 | unsafe { 99 | let mut result = WheelContactData::new(); 100 | let result_ptr: *mut WheelContactData = &mut result as *mut WheelContactData; 101 | Wheel_TA_Get_Contact(self.addr(), result_ptr); 102 | result 103 | } 104 | } 105 | fn get_b_draw_debug(&self) -> bool { 106 | unsafe { 107 | Wheel_TA_Get_bDrawDebug(self.addr()) 108 | } 109 | } 110 | fn get_b_had_contact(&self) -> bool { 111 | unsafe { 112 | Wheel_TA_Get_bHadContact(self.addr()) 113 | } 114 | } 115 | fn get_friction_curve_input(&self) -> f32 { 116 | unsafe { 117 | Wheel_TA_Get_FrictionCurveInput(self.addr()) 118 | } 119 | } 120 | fn get_aerial_throttle_to_velocity_factor(&self) -> f32 { 121 | unsafe { 122 | Wheel_TA_Get_AerialThrottleToVelocityFactor(self.addr()) 123 | } 124 | } 125 | fn get_aerial_acceleration_factor(&self) -> f32 { 126 | unsafe { 127 | Wheel_TA_Get_AerialAccelerationFactor(self.addr()) 128 | } 129 | } 130 | fn get_spin_speed(&self) -> f32 { 131 | unsafe { 132 | Wheel_TA_Get_SpinSpeed(self.addr()) 133 | } 134 | } 135 | fn get_ref_wheel_location(&self) -> Vector { 136 | unsafe { 137 | let mut result = Vector::new(); 138 | let result_ptr: *mut Vector = &mut result as *mut Vector; 139 | Wheel_TA_GetRefWheelLocation(self.addr(), result_ptr); 140 | result 141 | } 142 | } 143 | fn get_suspension_distance(&self) -> f32 { 144 | unsafe { 145 | Wheel_TA_GetSuspensionDistance(self.addr()) 146 | } 147 | } 148 | fn get_linear_velocity(&self) -> Vector { 149 | unsafe { 150 | let mut result = Vector::new(); 151 | let result_ptr: *mut Vector = &mut result as *mut Vector; 152 | Wheel_TA_GetLinearVelocity(self.addr(), result_ptr); 153 | result 154 | } 155 | } 156 | fn event_contact_changed(&self, wheel: WheelWrapper) { 157 | unsafe { 158 | Wheel_TA_EventContactChanged(self.addr(), wheel.addr()); 159 | } 160 | } 161 | 162 | } 163 | 164 | extern "C" { 165 | fn Wheel_TA_Get_SteerFactor(obj: usize) -> f32; 166 | fn WheelWrapper_SetSteerFactor(obj: usize, new_val: f32); 167 | fn Wheel_TA_Get_WheelRadius(obj: usize) -> f32; 168 | fn WheelWrapper_SetWheelRadius(obj: usize, new_val: f32); 169 | fn Wheel_TA_Get_SuspensionStiffness(obj: usize) -> f32; 170 | fn WheelWrapper_SetSuspensionStiffness(obj: usize, new_val: f32); 171 | fn Wheel_TA_Get_SuspensionDampingCompression(obj: usize) -> f32; 172 | fn WheelWrapper_SetSuspensionDampingCompression(obj: usize, new_val: f32); 173 | fn Wheel_TA_Get_SuspensionDampingRelaxation(obj: usize) -> f32; 174 | fn WheelWrapper_SetSuspensionDampingRelaxation(obj: usize, new_val: f32); 175 | fn Wheel_TA_Get_SuspensionTravel(obj: usize) -> f32; 176 | fn WheelWrapper_SetSuspensionTravel(obj: usize, new_val: f32); 177 | fn Wheel_TA_Get_SuspensionMaxRaise(obj: usize) -> f32; 178 | fn WheelWrapper_SetSuspensionMaxRaise(obj: usize, new_val: f32); 179 | fn Wheel_TA_Get_ContactForceDistance(obj: usize) -> f32; 180 | fn WheelWrapper_SetContactForceDistance(obj: usize, new_val: f32); 181 | fn Wheel_TA_Get_SpinSpeedDecayRate(obj: usize) -> f32; 182 | fn WheelWrapper_SetSpinSpeedDecayRate(obj: usize, new_val: f32); 183 | fn Wheel_TA_Get_BoneOffset(obj: usize, result: *mut Vector); 184 | fn WheelWrapper_SetBoneOffset(obj: usize, new_val: *mut Vector); 185 | fn Wheel_TA_Get_PresetRestPosition(obj: usize, result: *mut Vector); 186 | fn WheelWrapper_SetPresetRestPosition(obj: usize, new_val: *mut Vector); 187 | fn Wheel_TA_Get_LocalSuspensionRayStart(obj: usize, result: *mut Vector); 188 | fn WheelWrapper_SetLocalSuspensionRayStart(obj: usize, new_val: *mut Vector); 189 | fn Wheel_TA_Get_LocalRestPosition(obj: usize, result: *mut Vector); 190 | fn WheelWrapper_SetLocalRestPosition(obj: usize, new_val: *mut Vector); 191 | fn Wheel_TA_Get_VehicleSim(obj: usize) -> usize; 192 | fn WheelWrapper_SetVehicleSim(obj: usize, new_val: usize); 193 | fn Wheel_TA_Get_WheelIndex(obj: usize) -> i32; 194 | fn WheelWrapper_SetWheelIndex(obj: usize, new_val: i32); 195 | fn Wheel_TA_Get_Contact(obj: usize, result: *mut WheelContactData); 196 | fn WheelWrapper_SetContact(obj: usize, new_val: *mut WheelContactData); 197 | fn Wheel_TA_Get_bDrawDebug(obj: usize) -> bool; 198 | fn WheelWrapper_SetbDrawDebug(obj: usize, new_val: bool); 199 | fn Wheel_TA_Get_bHadContact(obj: usize) -> bool; 200 | fn WheelWrapper_SetbHadContact(obj: usize, new_val: bool); 201 | fn Wheel_TA_Get_FrictionCurveInput(obj: usize) -> f32; 202 | fn WheelWrapper_SetFrictionCurveInput(obj: usize, new_val: f32); 203 | fn Wheel_TA_Get_AerialThrottleToVelocityFactor(obj: usize) -> f32; 204 | fn WheelWrapper_SetAerialThrottleToVelocityFactor(obj: usize, new_val: f32); 205 | fn Wheel_TA_Get_AerialAccelerationFactor(obj: usize) -> f32; 206 | fn WheelWrapper_SetAerialAccelerationFactor(obj: usize, new_val: f32); 207 | fn Wheel_TA_Get_SpinSpeed(obj: usize) -> f32; 208 | fn WheelWrapper_SetSpinSpeed(obj: usize, new_val: f32); 209 | fn Wheel_TA_GetRefWheelLocation(obj: usize, result: *mut Vector); 210 | fn Wheel_TA_GetSuspensionDistance(obj: usize) -> f32; 211 | fn Wheel_TA_GetLinearVelocity(obj: usize, result: *mut Vector); 212 | fn Wheel_TA_EventContactChanged(obj: usize, Wheel: usize); 213 | 214 | } --------------------------------------------------------------------------------