├── .gitignore ├── .gitattributes ├── src ├── lua │ ├── mod.rs │ ├── luac_interface.rs │ └── luastate.rs ├── lib.rs └── defines │ ├── lua2rs.lua │ └── mod.rs ├── .github ├── dependabot.yml └── workflows │ └── rust.yml ├── rivets-macros ├── Cargo.toml ├── Cargo.lock └── src │ └── lib.rs ├── rivets-shared ├── Cargo.toml ├── src │ └── lib.rs └── Cargo.lock ├── Cargo.toml ├── LICENSE.md ├── README.md └── Cargo.lock /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | structs.hpp filter=lfs diff=lfs merge=lfs -text 2 | 3 | src/defines/mod.rs linguist-generated=true 4 | -------------------------------------------------------------------------------- /src/lua/mod.rs: -------------------------------------------------------------------------------- 1 | //! Lua bindings to the `LuaC` API for Rivets. 2 | 3 | mod luac_interface; 4 | mod luastate; 5 | 6 | pub use luac_interface::*; 7 | pub use luastate::*; 8 | -------------------------------------------------------------------------------- /src/lua/luac_interface.rs: -------------------------------------------------------------------------------- 1 | use crate as rivets; 2 | use crate::lua::luastate; 3 | use rivets_macros::import; 4 | 5 | #[import(lua_gettop)] 6 | pub extern "C" fn get_top(lua_state: *mut luastate::lua_State) -> i64 {} 7 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | #![warn(missing_docs)] 3 | 4 | pub mod defines; 5 | pub mod lua; 6 | 7 | extern crate rivets_macros; 8 | pub use rivets_macros::*; 9 | 10 | extern crate rivets_shared; 11 | pub use rivets_shared::*; 12 | 13 | pub use dll_syringe; 14 | pub use retour; 15 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: cargo 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | target-branch: "dev" 9 | commit-message: 10 | prefix: "deps(cargo)" 11 | 12 | - package-ecosystem: github-actions 13 | directory: "/" 14 | schedule: 15 | interval: "weekly" 16 | target-branch: "dev" 17 | commit-message: 18 | prefix: "deps(ci)" 19 | -------------------------------------------------------------------------------- /rivets-macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rivets-macros" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Zachary Picco "] 6 | description = "Rivets is a Factorio mod loader written in Rust. Hook into compiled functions and change their behavior." 7 | repository = "https://github.com/factorio-rivets/rivets" 8 | 9 | [dependencies] 10 | syn = "2.0" 11 | quote = "1.0" 12 | proc-macro2 = "1.0" 13 | rivets-shared = { path = "../rivets-shared" } 14 | anyhow = "1.0" 15 | lazy-regex = "3.1" 16 | darling = "0.20" 17 | 18 | [lib] 19 | proc-macro = true 20 | -------------------------------------------------------------------------------- /rivets-shared/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rivets-shared" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Zachary Picco "] 6 | description = "Rivets is a Factorio mod loader written in Rust. Hook into compiled functions and change their behavior." 7 | repository = "https://github.com/factorio-rivets/rivets" 8 | 9 | [dependencies] 10 | cpp_demangle = "0.4" 11 | undname = "1.1" 12 | syn = "2.0" 13 | pdb = "0.8" 14 | anyhow = "1.0" 15 | windows = { version = "0.58", features = [ 16 | "Win32", 17 | "Win32_System", 18 | "Win32_System_LibraryLoader", 19 | ] } 20 | serde = { version = "1.0", features = ["derive"] } 21 | retour = { version = "0.3", features = ["static-detour"] } 22 | 23 | [lib] 24 | name = "rivets_shared" 25 | crate-type = ["lib"] 26 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rivets" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Zachary Picco "] 6 | description = "Rivets is a Factorio mod loader written in Rust. Hook into compiled functions and change their behavior." 7 | license-file = "LICENSE.md" 8 | repository = "https://github.com/factorio-rivets/rivets-rs" 9 | 10 | [dependencies] 11 | rivets-macros = { path = "rivets-macros" } 12 | rivets-shared = { path = "rivets-shared" } 13 | retour = { version = "0.3", features = ["static-detour"] } 14 | dll-syringe = { version = "0.15", features = ["full"] } 15 | 16 | [lints.clippy] 17 | nursery = { level = "warn", priority = -1 } 18 | pedantic = { level = "warn", priority = -1 } 19 | unwrap_used = "warn" 20 | expect_used = "allow" 21 | trivial_regex = "allow" 22 | 23 | [lib] 24 | crate-type = ["lib"] -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2024 Zachary Picco 2 | Rivets License 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | 1. Any modifications, adaptations, or derivative works (collectively "Mods") 12 | developed using the Software must be released under an open-source license 13 | as defined by the Open Source Initiative (OSI) (https://opensource.org/osd). 14 | 15 | 2. Mods may not be released under any license that restricts access to the source 16 | code, including but not limited to proprietary or closed-source licenses. 17 | 18 | 3. Mods must include source code, and must allow distribution in source code as 19 | well as compiled form. Where some form of a product is not distributed with 20 | source code, there must be a well-publicized means of obtaining the source 21 | code for no more than a reasonable reproduction cost, preferably downloading 22 | via the Internet without charge. The source code must be the preferred form 23 | in which a programmer would modify the program. Deliberately obfuscated source 24 | code is not allowed. Intermediate forms such as the output of a preprocessor 25 | or translator are not allowed. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | SOFTWARE. 34 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: rust 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - opened 7 | - reopened 8 | - synchronize 9 | - ready_for_review 10 | push: 11 | branches: 12 | - main 13 | 14 | env: 15 | CARGO_TERM_COLOR: always 16 | 17 | jobs: 18 | fmt: 19 | name: Check formatting 20 | runs-on: windows-latest 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v4 24 | - name: Stable rust toolchain 25 | run: rustup toolchain install stable --profile minimal 26 | - name: Check formatting 27 | run: cargo fmt --all -- --check 28 | 29 | clippy: 30 | name: Clippy 31 | runs-on: windows-latest 32 | if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} 33 | permissions: 34 | security-events: write 35 | steps: 36 | - name: Checkout 37 | uses: actions/checkout@v4 38 | - name: Nightly rust toolchain 39 | run: rustup toolchain install nightly --profile minimal 40 | - name: Select nightly toolchain 41 | run: rustup default nightly 42 | - name: Add Clippy 43 | run: rustup component add clippy 44 | - name: Rust cache 45 | uses: Swatinem/rust-cache@v2 46 | with: 47 | prefix-key: "rust-nightly" 48 | shared-key: "clippy" 49 | - name: Install cargo-binstall 50 | uses: cargo-bins/cargo-binstall@main 51 | - name: Install sarif-fmt & clippy-sarif 52 | run: cargo binstall --no-confirm --force sarif-fmt clippy-sarif 53 | - name: Run Clippy 54 | run: cargo clippy --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt 55 | - name: Upload SARIF file 56 | uses: github/codeql-action/upload-sarif@v3 57 | with: 58 | sarif_file: results.sarif 59 | 60 | build: 61 | name: Build ${{ matrix.platform.os_name }} [rust ${{ matrix.toolchain }}] 62 | runs-on: ${{ matrix.platform.os }} 63 | if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} 64 | strategy: 65 | matrix: 66 | platform: 67 | - os_name: Windows-x86_64 68 | os: windows-latest 69 | target: x86_64-pc-windows-gnu 70 | # - os_name: Linux-x86_64 71 | # os: ubuntu-latest 72 | # target: x86_64-unknown-linux-gnu 73 | toolchain: 74 | - nightly 75 | steps: 76 | - name: Checkout 77 | uses: actions/checkout@v4 78 | - name: Setup ${{ matrix.toolchain }} toolchain 79 | run: rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.platform.target }} --profile minimal 80 | - name: Select ${{ matrix.toolchain }} toolchain 81 | run: rustup default ${{ matrix.toolchain }} 82 | - name: Rust cache 83 | uses: Swatinem/rust-cache@v2 84 | with: 85 | prefix-key: "rust-${{ matrix.toolchain }}" 86 | shared-key: "build-${{ matrix.platform.target }}" 87 | - name: Build 88 | run: cargo build --target ${{ matrix.platform.target }} 89 | -------------------------------------------------------------------------------- /src/defines/lua2rs.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This file automatically generates rust bindings for the defines table. 3 | Run this inside factorio as a /c command. 4 | --]] 5 | 6 | local function string_split(inputstr, sep) 7 | if sep == nil then 8 | sep = '%s' 9 | end 10 | local t = {} 11 | for str in string.gmatch(inputstr, '([^' .. sep .. ']+)') do 12 | table.insert(t, str) 13 | end 14 | return t 15 | end 16 | 17 | local function figure_out_enum_return_type(table) 18 | local _, first = next(table) 19 | if type(first) == 'string' then 20 | return 'str' 21 | elseif type(first) == 'number' then 22 | local has_negatives = false 23 | for _, v in pairs(table) do 24 | if v < 0 then 25 | has_negatives = true 26 | break 27 | end 28 | end 29 | local highest_number_of_bits = 0 30 | for _, v in pairs(table) do 31 | if has_negatives then 32 | if v >= -128 and v <= 127 then 33 | highest_number_of_bits = math.max(highest_number_of_bits, 8) 34 | elseif v >= -32768 and v <= 32767 then 35 | highest_number_of_bits = math.max(highest_number_of_bits, 16) 36 | elseif v >= -2147483648 and v <= 2147483647 then 37 | highest_number_of_bits = math.max(highest_number_of_bits, 32) 38 | elseif v >= -9223372036854775808 and v <= 9223372036854775807 then 39 | highest_number_of_bits = math.max(highest_number_of_bits, 64) 40 | else 41 | highest_number_of_bits = 128 42 | break 43 | end 44 | else 45 | if v <= 255 then 46 | highest_number_of_bits = math.max(highest_number_of_bits, 8) 47 | elseif v <= 65535 then 48 | highest_number_of_bits = math.max(highest_number_of_bits, 16) 49 | elseif v <= 4294967295 then 50 | highest_number_of_bits = math.max(highest_number_of_bits, 32) 51 | elseif v <= 18446744073709551615 then 52 | highest_number_of_bits = math.max(highest_number_of_bits, 64) 53 | else 54 | highest_number_of_bits = 128 55 | break 56 | end 57 | end 58 | end 59 | return (has_negatives and 'i' or 'u') .. highest_number_of_bits 60 | else 61 | error('Unknown type: ' .. type(first)) 62 | end 63 | end 64 | 65 | local function do_indent(structure) 66 | return structure:gsub('\n', '\n ') 67 | end 68 | 69 | local function convert_to_valid_rust_identifier(token) 70 | token = token:gsub('-', '_') 71 | if token == 'type' then return 'r#type' end 72 | return token 73 | end 74 | 75 | local function convert_to_rust(name, table) 76 | local _, first = next(table) 77 | local is_module = type(first) == 'table' 78 | name = convert_to_valid_rust_identifier(name) 79 | 80 | if is_module then 81 | local module = '' 82 | for k, v in pairs(table) do 83 | module = module .. '\n' .. convert_to_rust(k, v) 84 | end 85 | return 'pub mod ' .. name .. ' {\n' .. 86 | ' use super::*;\n' .. 87 | do_indent(module) .. '\n}' 88 | end 89 | 90 | local enum = '#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)]\n' .. 91 | '#[factorio_define(kind = ' .. figure_out_enum_return_type(table) .. ')]\n' .. 92 | 'pub enum ' .. name .. ' {\n' 93 | for k, representation in pairs(table) do 94 | if type(representation) == 'string' then 95 | representation = '"' .. representation .. '"' 96 | end 97 | 98 | enum = enum .. ' #[value = ' .. representation .. ']\n' .. 99 | ' ' .. convert_to_valid_rust_identifier(k) .. ',\n' 100 | end 101 | 102 | return enum .. '}\n' 103 | end 104 | 105 | local header = '#![allow(clippy::wildcard_imports)]\n' .. 106 | '#![allow(clippy::enum_variant_names)]\n' .. 107 | '#![allow(clippy::too_many_lines)]\n' .. 108 | '#![allow(clippy::match_same_arms)]\n' .. 109 | '#![allow(unreachable_patterns)]\n' .. 110 | '#![allow(missing_docs)]\n' .. 111 | '#![allow(non_camel_case_types)]\n\n' .. 112 | 'pub trait Define: std::ops::Deref {\n' .. 113 | ' fn variants() -> &\'static [Self; COUNT] where Self: Sized;\n' .. 114 | '}\n' 115 | 116 | local rust = header .. '\n' 117 | for k, v in pairs(defines) do 118 | rust = rust .. convert_to_rust(k, v) .. '\n\n' 119 | end 120 | 121 | log('\n\nSTARTING POINT\n' .. rust) 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | Rivets 🔩 - the Factorio mod loader 6 | 7 | 8 | 9 | [![Discord](https://img.shields.io/discord/1260754935952314418?color=lightblue&label=Community%20Chat&logo=Discord&logoColor=aqua)](https://discord.gg/xRYEZYz5WR) 10 | ![Downloads](https://img.shields.io/crates/d/rivets) 11 | [![](https://img.shields.io/badge/License-Rivets_2024-green)](https://github.com/notnotmelon/rivets/blob/master/LICENSE.md) 12 | 13 |
14 | 15 | # Rivets 🔩 16 | 17 | Welcome to Rivets, a Factorio mod loader written in Rust! Rivets injects code into the Factorio binary via DLL injection, providing a powerful toolset for modding and enhancing the game. 18 | 19 | Mods written in Rivets have access to functionality not possible within the traditional Lua API. 20 | - Directly modifiy functionality in the compiled Factorio executable. 21 | - Add new prototypes such as [LinkedRail](https://mods.factorio.com/mod/linked-rail). 22 | - Access to a huge library of crates via the Rust [package manager](https://crates.io/). 23 | - Go blazingly fast with Rust memory safety guarantees and multithreading. 24 | - A superset of all the functionality possible within the vanilla Lua scripting language. 25 | 26 | ## Features 27 | 28 | - **Procedural Macros**: Utilize idiomatic proc macros to overwrite or detour compiled Factorio functions. 29 | 30 | Here is an example of how to detour the `main` function: 31 | ```rust 32 | #[detour(main)] 33 | fn main(argc: c_int, argv: *const c_char, envp: *const c_char) { 34 | info!("Detoured into main! 🦀🔩"); 35 | } 36 | ``` 37 | This will intercept the `main` function call and execute your custom logic, allowing you to modify the behavior of the game. 38 | 39 | - **Seamless interop with Factorio Lua**: Mods written with Rivets can easily subscribe to lua events, and call `remote` API's to share data with Factorio mods written in Lua. 40 | 41 | ```rust 42 | #[on_event(defines::events::on_player_died)] 43 | fn on_player_died(player_index: u32, cause: LuaEntity) { 44 | let player: LuaPlayer = game::get_player(player_index); 45 | player.print("You just lost the game 💀"); 46 | } 47 | ``` 48 | 49 | - **Leverage existing modding infrastructure**: Rivets' design goal is to not reinvent the wheel. Mods written in Rust can be hosted on the offical Factorio modding website. Rivets is also designed to easily allow both Lua and Rust in the same Factorio mod. 50 | 51 | ## Contributing 52 | 53 | We are actively seeking contributors to help expand this project, particularly for adding Unix support. If you're interested in contributing, please fork the repository and submit a pull request. 54 | 55 | ### Steps to Contribute: 56 | 57 | 1. **Fork the repository** 58 | 2. **Create a new branch** (`git checkout -b feature-branch`) 59 | 3. **Make your changes** 60 | 4. **Commit your changes** (`git commit -m 'Add some feature'`) 61 | 5. **Push to the branch** (`git push origin feature-branch`) 62 | 6. **Open a pull request** 63 | 64 | We welcome contributions of all kinds, including bug fixes, new features, documentation improvements, and more. 65 | See our open [issues](https://github.com/notnotmelon/rivets/issues) if you are interested in becoming a contributor. 66 | 67 | ## Credits 68 | 69 | A huge thank-you to the following crates, without which this project would not be possible. 70 | - [Retour](https://crates.io/crates/retour) - Allows directly modifying Factorio's ASM to detour functions. 71 | - [DLL Syringe](https://crates.io/crates/dll-syringe) - Injects .DLL files into the Factorio executable. 72 | - [PDB](https://crates.io/crates/pdb) - Used to parse the .PDB file format and allows debug symbols to be read on Windows. 73 | - [Gimli](https://crates.io/crates/gimli) - Used to parse the .DWARF file format and allows debug symbols to be read on *nix systems. 74 | - [Bindgen](https://crates.io/crates/bindgen) - Automatically generates Rust bindings for Factorio datatypes defined in the .pdb 75 | 76 | ## License 77 | 78 | This project is licensed under a custom license. See the [license](https://github.com/notnotmelon/rivets?tab=License-1-ov-file) file for details. 79 | Any mods released using Rivets must have freely available source code. 80 | 81 | ``` 82 | 1. Any modifications, adaptations, or derivative works (collectively "Mods") 83 | developed using the Software must be released under an open-source license 84 | as defined by the Open Source Initiative (OSI) (https://opensource.org/osd). 85 | ``` 86 | 87 | ## Contact 88 | 89 | For any questions or support, please open an issue on GitHub or use GitHub discussions. 90 | 91 | --- 92 | 93 | _This project is not affiliated with or endorsed by the developers of Factorio._ 94 | 95 | --- 96 | 97 | Happy modding! 98 | -------------------------------------------------------------------------------- /rivets-shared/src/lib.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{bail, Result}; 2 | use cpp_demangle::Symbol; 3 | use pdb::{FallibleIterator, PDB}; 4 | use serde::{Deserialize as SerdeDeserialize, Serialize as SerdeSerialize}; 5 | use std::collections::HashMap; 6 | use std::ffi::{CStr, CString}; 7 | use std::fs::File; 8 | use std::ops::Deref; 9 | use std::path::Path; 10 | use undname::Flags; 11 | use windows::core::PCSTR; 12 | use windows::Win32::System::LibraryLoader::GetModuleHandleA; 13 | 14 | pub trait AsPcstr { 15 | fn as_pcstr(&self) -> PCSTR; 16 | } 17 | 18 | impl AsPcstr for CStr { 19 | fn as_pcstr(&self) -> PCSTR { 20 | PCSTR(self.as_ptr().cast()) 21 | } 22 | } 23 | 24 | /// Attempts to demangle a mangled MSVC C++ symbol name. First tries MSVC demangling, then falls back to Itanium. 25 | #[must_use] 26 | pub fn demangle(mangled: &str) -> Option { 27 | undname::demangle(mangled.into(), Flags::NO_ACCESS_SPECIFIER).map_or_else( 28 | |_| Symbol::new(mangled).ok().map(|x| x.to_string()), 29 | |x| Some(x.to_string()), 30 | ) 31 | } 32 | 33 | /// Takes an unmangled C++ MSVC symbol name and returns the calling convention. 34 | /// Fails if the calling convention is not one of cdecl, stdcall, fastcall, thiscall, or vectorcall. 35 | #[must_use] 36 | pub fn get_calling_convention(abi: &str) -> Option { 37 | Some(match abi { 38 | "__cdecl" => syn::parse_quote! { extern "C" }, 39 | "__stdcall" => syn::parse_quote! { extern "stdcall" }, 40 | "__fastcall" => syn::parse_quote! { extern "fastcall" }, 41 | "__thiscall" => syn::parse_quote! { extern "thiscall" }, 42 | "__vectorcall" => syn::parse_quote! { extern "vectorcall" }, 43 | _ => return None, 44 | }) 45 | } 46 | 47 | /// Repersents a pointer to any opaque FFI data. (normally detour args or FFI struct pointers) 48 | /// 49 | /// # Examples 50 | /// ``` 51 | /// #[detour(...)] 52 | /// fn run( 53 | /// this: Opaque, 54 | /// lua_event_type: i32, 55 | /// map_tick_type: Opaque, 56 | /// lua_game_script: Opaque, 57 | /// game_action: Opaque, 58 | /// ) { 59 | /// unsafe { back(this, lua_event_type, map_tick_type, lua_game_script, game_action) } 60 | /// } 61 | /// ``` 62 | pub type Opaque = *const std::ffi::c_void; 63 | 64 | pub struct RivetsHook { 65 | pub mangled_name: String, 66 | pub hook: unsafe fn(u64) -> Result<(), retour::Error>, 67 | } 68 | 69 | #[derive(SerdeSerialize, SerdeDeserialize)] 70 | pub struct SymbolCache { 71 | symbol_addresses: HashMap, 72 | module_name: String, 73 | } 74 | 75 | impl SymbolCache { 76 | /// Creates a new `SymbolCache` instance. 77 | /// 78 | /// # Arguments 79 | /// * `pdb_path` - The path to the PDB file. 80 | /// * `module_name` - The name of the module to get the base address of. 81 | #[cfg(target_os = "windows")] 82 | pub fn new(pdb_path: impl AsRef, module_name: impl AsRef) -> Result { 83 | use anyhow::Context; 84 | 85 | let file = File::open(&pdb_path).with_context(|| format!("Failed to open factorio.pdb file at path {}. Does this file actually exist? If not, reinstall factorio.", pdb_path.as_ref().display()))?; 86 | let mut pdb = PDB::open(file)?; 87 | 88 | let mut symbol_addresses = HashMap::new(); 89 | let symbol_table = pdb.global_symbols()?; 90 | let address_map = pdb.address_map()?; 91 | 92 | symbol_table 93 | .iter() 94 | .for_each(|symbol| match symbol.parse() { 95 | Ok(pdb::SymbolData::Public(data)) if data.function => { 96 | let rva = data.offset.to_rva(&address_map).unwrap_or_default(); 97 | symbol_addresses.insert(data.name.to_string().into(), rva.0); 98 | Ok(()) 99 | } 100 | Err(e) => Err(e), 101 | _ => Ok(()), 102 | })?; 103 | 104 | Ok(Self { 105 | symbol_addresses, 106 | module_name: module_name.as_ref().to_string(), 107 | }) 108 | } 109 | 110 | #[cfg(target_os = "linux")] 111 | pub fn new(pdb_path: impl AsRef, module_name: &str) -> Result { 112 | todo!(); 113 | } 114 | 115 | pub fn get_function_address(&self, base_address: u64, mangled_name: &str) -> Option { 116 | self.symbol_addresses 117 | .get(mangled_name) 118 | .copied() 119 | .map(|x| base_address + u64::from(x)) 120 | } 121 | 122 | #[cfg(target_os = "windows")] 123 | pub fn get_module_base_address(&self) -> Result { 124 | let module_name = self.module_name.clone(); 125 | let result = unsafe { GetModuleHandleA(CString::new(module_name)?.as_pcstr()) }; 126 | match result { 127 | Ok(handle) => Ok(handle.0 as u64), 128 | Err(err) => bail!(err), 129 | } 130 | } 131 | 132 | #[cfg(target_os = "linux")] 133 | fn get_module_base_address(module_name: &str) -> Result { 134 | todo!(); 135 | } 136 | 137 | /// Injects a detour into a Factorio compiled function. 138 | /// 139 | /// # Arguments 140 | /// * `factorio_path` - The path to the Factorio binary directory. 141 | /// * `function_name` - The name of the function to inject the detour into. 142 | /// * `hook` - The detour function to inject. 143 | /// 144 | /// # Safety 145 | /// todo! 146 | pub unsafe fn inject(&self, base_address: u64, hook: &RivetsHook) -> Result<()> { 147 | let Some(address) = self.get_function_address(base_address, hook.mangled_name.as_str()) 148 | else { 149 | bail!( 150 | "Failed to find address for the following mangled function inside the PDB: {}", 151 | hook.mangled_name 152 | ); 153 | }; 154 | 155 | Ok((hook.hook)(address)?) 156 | } 157 | } 158 | 159 | /// Represents a function that has been imported from a C++ compiled DLL. 160 | /// Invariant: If the function is not initialized, it is UB to dereference it. 161 | /// The rivets::finalize!() macro should be used to ensure that the function is initialized. 162 | pub enum UnsafeSummonedFunction 163 | where 164 | T: 'static + Sized, 165 | { 166 | Function(T), 167 | Uninitialized, 168 | } 169 | 170 | impl Deref for UnsafeSummonedFunction { 171 | type Target = T; 172 | 173 | #[inline] 174 | #[track_caller] 175 | fn deref(&self) -> &Self::Target { 176 | match self { 177 | Self::Function(x) => x, 178 | Self::Uninitialized => unsafe { std::hint::unreachable_unchecked() }, 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /src/lua/luastate.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_camel_case_types, non_snake_case, dead_code, missing_docs)] 2 | 3 | use std::ffi::{ 4 | c_char, c_double, c_int, c_longlong, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, 5 | }; 6 | use std::fmt::Debug; 7 | 8 | type size_t = c_ulong; // c_size_t is nightly only, defaults to usize currently -> 64 bit 9 | type lu_byte = c_char; 10 | type lua_Number = c_double; 11 | type lua_CFunction = unsafe extern "C-unwind" fn(L: *mut lua_State) -> c_int; 12 | type lua_Hook = unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug); 13 | type lua_Alloc = unsafe extern "C-unwind" fn( 14 | ud: *mut c_void, 15 | ptr: *mut c_void, 16 | osize: usize, 17 | nsize: usize, 18 | ) -> *mut c_void; 19 | type Instruction = c_uint; // 32 bit 20 | type ptrdiff_t = isize; // https://en.cppreference.com/w/cpp/types/ptrdiff_t 21 | type luai_jmpbuf = c_int; 22 | type lu_mem = size_t; 23 | type l_mem = ptrdiff_t; 24 | 25 | #[derive(Clone, Copy, Debug)] 26 | #[repr(C)] 27 | pub struct GCheader { 28 | previous: *mut GCObject, 29 | next: *mut GCObject, 30 | tt: lu_byte, 31 | marked: lu_byte, 32 | } 33 | 34 | #[derive(Clone, Copy)] 35 | #[repr(C)] 36 | union L_Umaxalign { 37 | u: c_double, 38 | s: *mut c_void, 39 | l: c_longlong, 40 | } 41 | 42 | #[derive(Clone, Copy)] 43 | #[repr(C)] 44 | union TString { 45 | dummy: L_Umaxalign, 46 | tsv: TStringInner, 47 | } 48 | 49 | #[derive(Clone, Copy, Debug)] 50 | #[repr(C)] 51 | pub struct TStringInner { 52 | // common header 53 | previous: *mut GCObject, 54 | next: *mut GCObject, 55 | tt: lu_byte, 56 | marked: lu_byte, 57 | // common header 58 | extra: lu_byte, 59 | hash: c_uint, 60 | len: size_t, 61 | } 62 | 63 | #[derive(Clone, Copy)] 64 | #[repr(C)] 65 | union Udata { 66 | dummy: L_Umaxalign, 67 | uv: UdataInner, 68 | } 69 | 70 | #[derive(Clone, Copy, Debug)] 71 | #[repr(C)] 72 | pub struct UdataInner { 73 | // common header 74 | previous: *mut GCObject, 75 | next: *mut GCObject, 76 | tt: lu_byte, 77 | marked: lu_byte, 78 | // common header 79 | metatable: *mut Table, 80 | env: *mut Table, 81 | len: c_ulong, // c_size_t is nightly only, defaults to usize currently -> 64 bit 82 | } 83 | 84 | #[derive(Clone, Copy, Debug)] 85 | #[repr(C)] 86 | pub struct Table { 87 | // common header 88 | previous: *mut GCObject, 89 | next: *mut GCObject, 90 | tt: lu_byte, 91 | marked: lu_byte, 92 | // common header 93 | flags: lu_byte, 94 | lsizenode: lu_byte, 95 | customflags: lu_byte, 96 | metatable: *mut Table, 97 | array: *mut TValue, 98 | node: *mut Node, 99 | lastfree: *mut Node, 100 | gclist: *mut GCObject, 101 | sizearray: c_int, 102 | firstadded: *mut Node, 103 | lastadded: *mut Node, 104 | customdata: *mut c_void, 105 | } 106 | 107 | #[derive(Clone, Copy, Debug)] 108 | #[repr(C)] 109 | pub struct TValue { 110 | value_: Value, 111 | tt_: c_int, 112 | } 113 | 114 | type StkId = *mut TValue; 115 | 116 | #[derive(Clone, Copy)] 117 | #[repr(C)] 118 | union Value { 119 | gc: *mut GCObject, 120 | p: *mut c_void, 121 | b: bool, 122 | f: lua_CFunction, 123 | n: lua_Number, 124 | } 125 | 126 | impl Debug for Value { 127 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 128 | write!(f, "Value") 129 | } 130 | } 131 | 132 | #[derive(Clone, Copy)] 133 | #[repr(C)] 134 | union TKey { 135 | nk: TKeyInner, 136 | tvk: TValue, 137 | } 138 | 139 | impl Debug for TKey { 140 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 141 | write!(f, "TKey") 142 | } 143 | } 144 | 145 | #[derive(Clone, Copy, Debug)] 146 | #[repr(C)] 147 | pub struct TKeyInner { 148 | value_: Value, 149 | tt_: c_int, 150 | next: *mut Node, 151 | } 152 | 153 | #[derive(Clone, Copy, Debug)] 154 | #[repr(C)] 155 | pub struct Node { 156 | i_val: TValue, 157 | i_key: TKey, 158 | next: *mut Node, 159 | prev: *mut Node, 160 | } 161 | 162 | #[derive(Clone, Copy, Debug)] 163 | #[repr(C)] 164 | pub struct CClosure { 165 | // closure header 166 | // common header 167 | previous: *mut GCObject, 168 | next: *mut GCObject, 169 | tt: lu_byte, 170 | marked: lu_byte, 171 | // common header 172 | nupvalues: lu_byte, 173 | gclist: *mut GCObject, 174 | // closure header 175 | f: lua_CFunction, 176 | upvalue: [TValue; 1], 177 | } 178 | 179 | #[derive(Clone, Copy, Debug)] 180 | #[repr(C)] 181 | pub struct LClosure { 182 | // closure header 183 | // common header 184 | previous: *mut GCObject, 185 | next: *mut GCObject, 186 | tt: lu_byte, 187 | marked: lu_byte, 188 | // common header 189 | nupvalues: lu_byte, 190 | gclist: *mut GCObject, 191 | // closure header 192 | p: *mut Proto, 193 | upvals: *mut [UpVal; 1], 194 | } 195 | 196 | #[derive(Clone, Copy)] 197 | #[repr(C)] 198 | union Closure { 199 | c: CClosure, 200 | l: LClosure, 201 | } 202 | 203 | #[derive(Clone, Copy)] 204 | #[repr(C)] 205 | union GCObject { 206 | gch: GCheader, 207 | ts: TString, 208 | u: Udata, 209 | cl: Closure, 210 | } 211 | 212 | #[derive(Clone, Copy, Debug)] 213 | #[repr(C)] 214 | pub struct Proto { 215 | // common header 216 | previous: *mut GCObject, 217 | next: *mut GCObject, 218 | tt: lu_byte, 219 | marked: lu_byte, 220 | // common header 221 | k: *mut TValue, 222 | code: *mut Instruction, 223 | p: *mut *mut Proto, 224 | lineinfo: *mut c_int, 225 | locvars: *mut LocVar, 226 | upvalues: *mut Upvaldesc, 227 | cache: *mut Closure, 228 | source: *mut TString, 229 | sizeupvalues: c_int, 230 | sizek: c_int, 231 | sizecode: c_int, 232 | sizelineinfo: c_int, 233 | sizep: c_int, 234 | sizelocvars: c_int, 235 | linedefined: c_int, 236 | lastlinedefined: c_int, 237 | gclist: *mut GCObject, 238 | numparams: lu_byte, 239 | is_vararg: lu_byte, 240 | maxstacksize: lu_byte, 241 | } 242 | 243 | #[derive(Clone, Copy, Debug)] 244 | #[repr(C)] 245 | pub struct UpVal { 246 | // common header 247 | previous: *mut GCObject, 248 | next: *mut GCObject, 249 | tt: lu_byte, 250 | marked: lu_byte, 251 | // common header 252 | v: *mut TValue, 253 | u: UpValInternal, 254 | } 255 | 256 | #[derive(Clone, Copy)] 257 | #[repr(C)] 258 | union UpValInternal { 259 | value: TValue, 260 | l: UpValInternalInternal, 261 | } 262 | 263 | impl Debug for UpValInternal { 264 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 265 | write!(f, "UpValInternal") 266 | } 267 | } 268 | 269 | #[derive(Clone, Copy, Debug)] 270 | #[repr(C)] 271 | pub struct UpValInternalInternal { 272 | prev: *mut UpVal, 273 | next: *mut UpVal, 274 | } 275 | 276 | #[derive(Clone, Copy, Debug)] 277 | #[repr(C)] 278 | pub struct LocVar { 279 | varname: *mut TString, 280 | startpc: c_int, 281 | endpc: c_int, 282 | } 283 | 284 | #[derive(Clone, Copy, Debug)] 285 | #[repr(C)] 286 | pub struct Upvaldesc { 287 | name: *mut TString, 288 | instack: lu_byte, 289 | idx: lu_byte, 290 | } 291 | 292 | #[derive(Clone, Copy, Debug)] 293 | #[repr(C)] 294 | pub struct CallInfo { 295 | func: StkId, /* function index in the stack */ 296 | top: StkId, /* top for this function */ 297 | previous: *mut CallInfo, /* dynamic call link */ 298 | next: *mut CallInfo, /* dynamic call link */ 299 | nresults: c_short, /* expected number of results from this function */ 300 | callstatus: lu_byte, 301 | extra: ptrdiff_t, 302 | u: CallInfoInternal, 303 | } 304 | 305 | #[derive(Clone, Copy)] 306 | #[repr(C)] 307 | union CallInfoInternal { 308 | l: CallInfoInternalL, 309 | c: CallInfoInternalC, 310 | } 311 | 312 | impl Debug for CallInfoInternal { 313 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 314 | write!(f, "CallInfoInternal") 315 | } 316 | } 317 | 318 | #[derive(Clone, Copy, Debug)] 319 | #[repr(C)] 320 | pub struct CallInfoInternalL { 321 | base: StkId, 322 | savedpc: *const Instruction, 323 | } 324 | 325 | #[derive(Clone, Copy, Debug)] 326 | #[repr(C)] 327 | pub struct CallInfoInternalC { 328 | ctx: c_int, 329 | k: lua_CFunction, 330 | old_errfunc: ptrdiff_t, 331 | old_allowhook: lu_byte, 332 | status: lu_byte, 333 | } 334 | 335 | #[derive(Clone, Copy, Debug)] 336 | #[repr(C)] 337 | pub struct lua_longjmp { 338 | previous: *mut lua_longjmp, 339 | b: luai_jmpbuf, 340 | status: c_int, 341 | } 342 | 343 | #[derive(Clone, Copy, Debug)] 344 | #[repr(C)] 345 | pub struct lua_State { 346 | // common header 347 | previous: *mut GCObject, 348 | next: *mut GCObject, 349 | tt: lu_byte, 350 | marked: lu_byte, 351 | // common header 352 | status: lu_byte, 353 | top: StkId, /* first free slot in the stack */ 354 | l_G: *mut global_State, 355 | ci: *mut CallInfo, /* call info for current function */ 356 | oldpc: *const Instruction, /* last pc traced */ 357 | stack_last: StkId, /* last free slot in the stack */ 358 | stack: StkId, /* stack base */ 359 | stacksize: c_int, 360 | nny: c_ushort, /* number of non-yieldable calls in stack */ 361 | nCcalls: c_ushort, /* number of nested C calls */ 362 | hookmask: lu_byte, 363 | allowhook: lu_byte, 364 | basehookcount: c_int, 365 | hookcount: c_int, 366 | hook: lua_Hook, 367 | openupval: *mut GCObject, /* list of open upvalues in this stack */ 368 | gclist: *mut GCObject, 369 | errorJmp: *mut lua_longjmp, /* current error recover point */ 370 | errfunc: ptrdiff_t, /* current error handling function (stack index) */ 371 | base_ci: CallInfo, /* CallInfo for first level (C calling Lua) */ 372 | userData1: *mut c_void, /* custom user-data pointer */ 373 | userData2: *mut c_void, /* custom user-data pointer */ 374 | } 375 | 376 | #[derive(Clone, Copy, Debug)] 377 | #[repr(C)] 378 | pub struct Mbuffer { 379 | buffer: *mut c_char, 380 | n: size_t, 381 | buffsize: size_t, 382 | } 383 | 384 | #[derive(Clone, Copy, Debug)] 385 | #[repr(C)] 386 | pub struct stringtable { 387 | hash: *mut *mut GCObject, 388 | nuse: c_uint, 389 | size: c_int, 390 | } 391 | 392 | pub const TM_N: usize = 17; // count of variants in this enum (excluding the last one) https://github.com/Rseding91/Factorio-Lua/blob/ce12474c7fcee694bde1aa0f668dce488aca0806/src/ltm.h#L18 393 | pub const LUA_NUMTAGS: usize = 9; 394 | 395 | #[derive(Clone, Copy, Debug)] 396 | #[repr(C)] 397 | pub struct global_State { 398 | frealloc: lua_Alloc, 399 | ud: *mut c_void, 400 | totalbytes: lu_mem, 401 | GCdebt: l_mem, 402 | GCmemtrav: lu_mem, 403 | GCestimate: lu_mem, 404 | strt: stringtable, 405 | l_registry: TValue, 406 | seed: c_uint, 407 | currentwhite: lu_byte, 408 | gcstate: lu_byte, 409 | gckind: lu_byte, 410 | gcrunning: lu_byte, 411 | gcblocked: lu_byte, 412 | sweepstrgc: c_int, 413 | allgc: *mut GCObject, 414 | finobj: *mut GCObject, 415 | sweepgc: *mut *mut GCObject, 416 | sweepfin: *mut *mut GCObject, 417 | gray: *mut GCObject, 418 | grayagain: *mut GCObject, 419 | weak: *mut GCObject, 420 | ephemeron: *mut GCObject, 421 | allweak: *mut GCObject, 422 | tobefnz: *mut GCObject, 423 | uvhead: UpVal, 424 | buff: Mbuffer, 425 | gcpause: c_int, 426 | gcmajorinc: c_int, 427 | gcstepmul: c_int, 428 | panic: lua_CFunction, 429 | mainthread: *mut lua_State, 430 | version: *const lua_Number, 431 | memerrmsg: *mut TString, 432 | tmname: *mut [TString; TM_N], 433 | mt: *mut [Table; LUA_NUMTAGS], 434 | } 435 | 436 | pub const LUA_IDSIZE: usize = 60; 437 | 438 | #[derive(Clone, Copy, Debug)] 439 | #[repr(C)] 440 | pub struct lua_Debug { 441 | event: c_int, 442 | name: *const c_char, 443 | namewhat: *const c_char, 444 | what: *const c_char, 445 | source: *const c_char, 446 | currentline: c_int, 447 | currentpc: c_int, 448 | linedefined: c_int, 449 | lastlinedefined: c_int, 450 | nups: c_uchar, 451 | nparams: c_uchar, 452 | isvararg: c_char, 453 | istailcall: c_char, 454 | short_src: [c_char; LUA_IDSIZE], 455 | i_ci: *mut CallInfo, 456 | } 457 | /* 458 | impl lua_State { 459 | /// Get the lua global table 460 | pub fn global(&self) -> Table { 461 | self.check_stack(1).expect("stack"); 462 | self.raw_geti(LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); 463 | self.top_val().try_into().expect("global table") 464 | } 465 | 466 | pub fn check_stack(&self, n: i32) -> Result<()> { 467 | if UnsafeLuaApi::check_stack(self, n) { 468 | Ok(()) 469 | } else { 470 | Err(Error::runtime(format!("check stack {n}"))) 471 | } 472 | } 473 | 474 | pub(crate) fn top_val(&self) -> ValRef { 475 | self.try_replace_top().unwrap_or_else(|| { 476 | let top = self.get_top(); 477 | ValRef { 478 | state: self, 479 | index: top, 480 | } 481 | }) 482 | } 483 | 484 | pub(crate) fn try_replace_top(&self) -> Option { 485 | let top = self.get_top(); 486 | while let Some(slot) = self.free.borrow_mut().pop() { 487 | if slot < top { 488 | self.replace(slot); 489 | return Some(ValRef { 490 | state: self, 491 | index: slot, 492 | }); 493 | } 494 | } 495 | None 496 | } 497 | } */ 498 | -------------------------------------------------------------------------------- /rivets-shared/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "abi_stable" 7 | version = "0.11.3" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "69d6512d3eb05ffe5004c59c206de7f99c34951504056ce23fc953842f12c445" 10 | dependencies = [ 11 | "abi_stable_derive", 12 | "abi_stable_shared", 13 | "const_panic", 14 | "core_extensions", 15 | "crossbeam-channel", 16 | "generational-arena", 17 | "libloading", 18 | "lock_api", 19 | "parking_lot", 20 | "paste", 21 | "repr_offset", 22 | "rustc_version", 23 | "serde", 24 | "serde_derive", 25 | "serde_json", 26 | ] 27 | 28 | [[package]] 29 | name = "abi_stable_derive" 30 | version = "0.11.3" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | checksum = "d7178468b407a4ee10e881bc7a328a65e739f0863615cca4429d43916b05e898" 33 | dependencies = [ 34 | "abi_stable_shared", 35 | "as_derive_utils", 36 | "core_extensions", 37 | "proc-macro2", 38 | "quote", 39 | "rustc_version", 40 | "syn 1.0.109", 41 | "typed-arena", 42 | ] 43 | 44 | [[package]] 45 | name = "abi_stable_shared" 46 | version = "0.11.0" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "b2b5df7688c123e63f4d4d649cba63f2967ba7f7861b1664fca3f77d3dad2b63" 49 | dependencies = [ 50 | "core_extensions", 51 | ] 52 | 53 | [[package]] 54 | name = "anyhow" 55 | version = "1.0.86" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" 58 | 59 | [[package]] 60 | name = "arrayvec" 61 | version = "0.7.4" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 64 | 65 | [[package]] 66 | name = "as_derive_utils" 67 | version = "0.11.0" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "ff3c96645900a44cf11941c111bd08a6573b0e2f9f69bc9264b179d8fae753c4" 70 | dependencies = [ 71 | "core_extensions", 72 | "proc-macro2", 73 | "quote", 74 | "syn 1.0.109", 75 | ] 76 | 77 | [[package]] 78 | name = "autocfg" 79 | version = "1.3.0" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 82 | 83 | [[package]] 84 | name = "bitflags" 85 | version = "2.6.0" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 88 | 89 | [[package]] 90 | name = "bstr" 91 | version = "1.10.0" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" 94 | dependencies = [ 95 | "memchr", 96 | "regex-automata", 97 | "serde", 98 | ] 99 | 100 | [[package]] 101 | name = "bumpalo" 102 | version = "3.16.0" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 105 | 106 | [[package]] 107 | name = "cfg-if" 108 | version = "1.0.0" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 111 | 112 | [[package]] 113 | name = "const_panic" 114 | version = "0.2.8" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" 117 | 118 | [[package]] 119 | name = "core_extensions" 120 | version = "1.5.3" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "92c71dc07c9721607e7a16108336048ee978c3a8b129294534272e8bac96c0ee" 123 | dependencies = [ 124 | "core_extensions_proc_macros", 125 | ] 126 | 127 | [[package]] 128 | name = "core_extensions_proc_macros" 129 | version = "1.5.3" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "69f3b219d28b6e3b4ac87bc1fc522e0803ab22e055da177bff0068c4150c61a6" 132 | 133 | [[package]] 134 | name = "cpp_demangle" 135 | version = "0.4.3" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" 138 | dependencies = [ 139 | "cfg-if", 140 | ] 141 | 142 | [[package]] 143 | name = "crossbeam-channel" 144 | version = "0.5.13" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" 147 | dependencies = [ 148 | "crossbeam-utils", 149 | ] 150 | 151 | [[package]] 152 | name = "crossbeam-utils" 153 | version = "0.8.20" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" 156 | 157 | [[package]] 158 | name = "fallible-iterator" 159 | version = "0.2.0" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 162 | 163 | [[package]] 164 | name = "generational-arena" 165 | version = "0.2.9" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "877e94aff08e743b651baaea359664321055749b398adff8740a7399af7796e7" 168 | dependencies = [ 169 | "cfg-if", 170 | ] 171 | 172 | [[package]] 173 | name = "itoa" 174 | version = "1.0.11" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 177 | 178 | [[package]] 179 | name = "libc" 180 | version = "0.2.155" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" 183 | 184 | [[package]] 185 | name = "libloading" 186 | version = "0.7.4" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" 189 | dependencies = [ 190 | "cfg-if", 191 | "winapi", 192 | ] 193 | 194 | [[package]] 195 | name = "lock_api" 196 | version = "0.4.12" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 199 | dependencies = [ 200 | "autocfg", 201 | "scopeguard", 202 | ] 203 | 204 | [[package]] 205 | name = "memchr" 206 | version = "2.7.4" 207 | source = "registry+https://github.com/rust-lang/crates.io-index" 208 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 209 | 210 | [[package]] 211 | name = "nonmax" 212 | version = "0.5.5" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" 215 | 216 | [[package]] 217 | name = "parking_lot" 218 | version = "0.12.3" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 221 | dependencies = [ 222 | "lock_api", 223 | "parking_lot_core", 224 | ] 225 | 226 | [[package]] 227 | name = "parking_lot_core" 228 | version = "0.9.10" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 231 | dependencies = [ 232 | "cfg-if", 233 | "libc", 234 | "redox_syscall", 235 | "smallvec", 236 | "windows-targets", 237 | ] 238 | 239 | [[package]] 240 | name = "paste" 241 | version = "1.0.15" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" 244 | 245 | [[package]] 246 | name = "pdb" 247 | version = "0.8.0" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "82040a392923abe6279c00ab4aff62d5250d1c8555dc780e4b02783a7aa74863" 250 | dependencies = [ 251 | "fallible-iterator", 252 | "scroll", 253 | "uuid", 254 | ] 255 | 256 | [[package]] 257 | name = "proc-macro2" 258 | version = "1.0.86" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 261 | dependencies = [ 262 | "unicode-ident", 263 | ] 264 | 265 | [[package]] 266 | name = "quote" 267 | version = "1.0.36" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 270 | dependencies = [ 271 | "proc-macro2", 272 | ] 273 | 274 | [[package]] 275 | name = "redox_syscall" 276 | version = "0.5.3" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" 279 | dependencies = [ 280 | "bitflags", 281 | ] 282 | 283 | [[package]] 284 | name = "regex-automata" 285 | version = "0.4.7" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" 288 | 289 | [[package]] 290 | name = "repr_offset" 291 | version = "0.2.2" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "fb1070755bd29dffc19d0971cab794e607839ba2ef4b69a9e6fbc8733c1b72ea" 294 | dependencies = [ 295 | "tstr", 296 | ] 297 | 298 | [[package]] 299 | name = "rivets-shared" 300 | version = "0.1.0" 301 | dependencies = [ 302 | "abi_stable", 303 | "anyhow", 304 | "cpp_demangle", 305 | "pdb", 306 | "syn 2.0.72", 307 | "undname", 308 | ] 309 | 310 | [[package]] 311 | name = "rustc_version" 312 | version = "0.4.0" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 315 | dependencies = [ 316 | "semver", 317 | ] 318 | 319 | [[package]] 320 | name = "ryu" 321 | version = "1.0.18" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 324 | 325 | [[package]] 326 | name = "scopeguard" 327 | version = "1.2.0" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 330 | 331 | [[package]] 332 | name = "scroll" 333 | version = "0.11.0" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" 336 | 337 | [[package]] 338 | name = "semver" 339 | version = "1.0.23" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" 342 | 343 | [[package]] 344 | name = "serde" 345 | version = "1.0.205" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" 348 | dependencies = [ 349 | "serde_derive", 350 | ] 351 | 352 | [[package]] 353 | name = "serde_derive" 354 | version = "1.0.205" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" 357 | dependencies = [ 358 | "proc-macro2", 359 | "quote", 360 | "syn 2.0.72", 361 | ] 362 | 363 | [[package]] 364 | name = "serde_json" 365 | version = "1.0.124" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" 368 | dependencies = [ 369 | "itoa", 370 | "memchr", 371 | "ryu", 372 | "serde", 373 | ] 374 | 375 | [[package]] 376 | name = "smallvec" 377 | version = "1.13.2" 378 | source = "registry+https://github.com/rust-lang/crates.io-index" 379 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 380 | 381 | [[package]] 382 | name = "syn" 383 | version = "1.0.109" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 386 | dependencies = [ 387 | "proc-macro2", 388 | "quote", 389 | "unicode-ident", 390 | ] 391 | 392 | [[package]] 393 | name = "syn" 394 | version = "2.0.72" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" 397 | dependencies = [ 398 | "proc-macro2", 399 | "quote", 400 | "unicode-ident", 401 | ] 402 | 403 | [[package]] 404 | name = "thiserror" 405 | version = "1.0.63" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" 408 | dependencies = [ 409 | "thiserror-impl", 410 | ] 411 | 412 | [[package]] 413 | name = "thiserror-impl" 414 | version = "1.0.63" 415 | source = "registry+https://github.com/rust-lang/crates.io-index" 416 | checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" 417 | dependencies = [ 418 | "proc-macro2", 419 | "quote", 420 | "syn 2.0.72", 421 | ] 422 | 423 | [[package]] 424 | name = "tstr" 425 | version = "0.2.4" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "7f8e0294f14baae476d0dd0a2d780b2e24d66e349a9de876f5126777a37bdba7" 428 | dependencies = [ 429 | "tstr_proc_macros", 430 | ] 431 | 432 | [[package]] 433 | name = "tstr_proc_macros" 434 | version = "0.2.2" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a" 437 | 438 | [[package]] 439 | name = "typed-arena" 440 | version = "2.0.2" 441 | source = "registry+https://github.com/rust-lang/crates.io-index" 442 | checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" 443 | 444 | [[package]] 445 | name = "undname" 446 | version = "1.1.2" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "8f76889af53deca091b038f6ebb04efa45fcba08908e69c0049e8b8c281f16f9" 449 | dependencies = [ 450 | "arrayvec", 451 | "bitflags", 452 | "bstr", 453 | "bumpalo", 454 | "nonmax", 455 | "smallvec", 456 | "thiserror", 457 | ] 458 | 459 | [[package]] 460 | name = "unicode-ident" 461 | version = "1.0.12" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 464 | 465 | [[package]] 466 | name = "uuid" 467 | version = "1.10.0" 468 | source = "registry+https://github.com/rust-lang/crates.io-index" 469 | checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" 470 | 471 | [[package]] 472 | name = "winapi" 473 | version = "0.3.9" 474 | source = "registry+https://github.com/rust-lang/crates.io-index" 475 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 476 | dependencies = [ 477 | "winapi-i686-pc-windows-gnu", 478 | "winapi-x86_64-pc-windows-gnu", 479 | ] 480 | 481 | [[package]] 482 | name = "winapi-i686-pc-windows-gnu" 483 | version = "0.4.0" 484 | source = "registry+https://github.com/rust-lang/crates.io-index" 485 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 486 | 487 | [[package]] 488 | name = "winapi-x86_64-pc-windows-gnu" 489 | version = "0.4.0" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 492 | 493 | [[package]] 494 | name = "windows-targets" 495 | version = "0.52.6" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 498 | dependencies = [ 499 | "windows_aarch64_gnullvm", 500 | "windows_aarch64_msvc", 501 | "windows_i686_gnu", 502 | "windows_i686_gnullvm", 503 | "windows_i686_msvc", 504 | "windows_x86_64_gnu", 505 | "windows_x86_64_gnullvm", 506 | "windows_x86_64_msvc", 507 | ] 508 | 509 | [[package]] 510 | name = "windows_aarch64_gnullvm" 511 | version = "0.52.6" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 514 | 515 | [[package]] 516 | name = "windows_aarch64_msvc" 517 | version = "0.52.6" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 520 | 521 | [[package]] 522 | name = "windows_i686_gnu" 523 | version = "0.52.6" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 526 | 527 | [[package]] 528 | name = "windows_i686_gnullvm" 529 | version = "0.52.6" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 532 | 533 | [[package]] 534 | name = "windows_i686_msvc" 535 | version = "0.52.6" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 538 | 539 | [[package]] 540 | name = "windows_x86_64_gnu" 541 | version = "0.52.6" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 544 | 545 | [[package]] 546 | name = "windows_x86_64_gnullvm" 547 | version = "0.52.6" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 550 | 551 | [[package]] 552 | name = "windows_x86_64_msvc" 553 | version = "0.52.6" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 556 | -------------------------------------------------------------------------------- /rivets-macros/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aho-corasick" 7 | version = "1.1.3" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 10 | dependencies = [ 11 | "memchr", 12 | ] 13 | 14 | [[package]] 15 | name = "anyhow" 16 | version = "1.0.86" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" 19 | 20 | [[package]] 21 | name = "arrayvec" 22 | version = "0.7.4" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 25 | 26 | [[package]] 27 | name = "bitflags" 28 | version = "2.6.0" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 31 | 32 | [[package]] 33 | name = "bstr" 34 | version = "1.10.0" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" 37 | dependencies = [ 38 | "memchr", 39 | "regex-automata", 40 | "serde", 41 | ] 42 | 43 | [[package]] 44 | name = "bumpalo" 45 | version = "3.16.0" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 48 | 49 | [[package]] 50 | name = "cfg-if" 51 | version = "1.0.0" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 54 | 55 | [[package]] 56 | name = "cpp_demangle" 57 | version = "0.4.3" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" 60 | dependencies = [ 61 | "cfg-if", 62 | ] 63 | 64 | [[package]] 65 | name = "darling" 66 | version = "0.20.10" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" 69 | dependencies = [ 70 | "darling_core", 71 | "darling_macro", 72 | ] 73 | 74 | [[package]] 75 | name = "darling_core" 76 | version = "0.20.10" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" 79 | dependencies = [ 80 | "fnv", 81 | "ident_case", 82 | "proc-macro2", 83 | "quote", 84 | "strsim", 85 | "syn", 86 | ] 87 | 88 | [[package]] 89 | name = "darling_macro" 90 | version = "0.20.10" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" 93 | dependencies = [ 94 | "darling_core", 95 | "quote", 96 | "syn", 97 | ] 98 | 99 | [[package]] 100 | name = "dirs" 101 | version = "5.0.1" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" 104 | dependencies = [ 105 | "dirs-sys", 106 | ] 107 | 108 | [[package]] 109 | name = "dirs-sys" 110 | version = "0.4.1" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" 113 | dependencies = [ 114 | "libc", 115 | "option-ext", 116 | "redox_users", 117 | "windows-sys", 118 | ] 119 | 120 | [[package]] 121 | name = "fallible-iterator" 122 | version = "0.2.0" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 125 | 126 | [[package]] 127 | name = "fnv" 128 | version = "1.0.7" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 131 | 132 | [[package]] 133 | name = "getrandom" 134 | version = "0.2.15" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 137 | dependencies = [ 138 | "cfg-if", 139 | "libc", 140 | "wasi", 141 | ] 142 | 143 | [[package]] 144 | name = "ident_case" 145 | version = "1.0.1" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 148 | 149 | [[package]] 150 | name = "lazy-regex" 151 | version = "3.2.0" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | checksum = "576c8060ecfdf2e56995cf3274b4f2d71fa5e4fa3607c1c0b63c10180ee58741" 154 | dependencies = [ 155 | "lazy-regex-proc_macros", 156 | "once_cell", 157 | "regex", 158 | ] 159 | 160 | [[package]] 161 | name = "lazy-regex-proc_macros" 162 | version = "3.2.0" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | checksum = "9efb9e65d4503df81c615dc33ff07042a9408ac7f26b45abee25566f7fbfd12c" 165 | dependencies = [ 166 | "proc-macro2", 167 | "quote", 168 | "regex", 169 | "syn", 170 | ] 171 | 172 | [[package]] 173 | name = "libc" 174 | version = "0.2.155" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" 177 | 178 | [[package]] 179 | name = "libredox" 180 | version = "0.1.3" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" 183 | dependencies = [ 184 | "bitflags", 185 | "libc", 186 | ] 187 | 188 | [[package]] 189 | name = "memchr" 190 | version = "2.7.4" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 193 | 194 | [[package]] 195 | name = "nonmax" 196 | version = "0.5.5" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" 199 | 200 | [[package]] 201 | name = "once_cell" 202 | version = "1.19.0" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 205 | 206 | [[package]] 207 | name = "option-ext" 208 | version = "0.2.0" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" 211 | 212 | [[package]] 213 | name = "pdb" 214 | version = "0.8.0" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | checksum = "82040a392923abe6279c00ab4aff62d5250d1c8555dc780e4b02783a7aa74863" 217 | dependencies = [ 218 | "fallible-iterator", 219 | "scroll", 220 | "uuid", 221 | ] 222 | 223 | [[package]] 224 | name = "proc-macro2" 225 | version = "1.0.86" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 228 | dependencies = [ 229 | "unicode-ident", 230 | ] 231 | 232 | [[package]] 233 | name = "quote" 234 | version = "1.0.36" 235 | source = "registry+https://github.com/rust-lang/crates.io-index" 236 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 237 | dependencies = [ 238 | "proc-macro2", 239 | ] 240 | 241 | [[package]] 242 | name = "redox_users" 243 | version = "0.4.5" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" 246 | dependencies = [ 247 | "getrandom", 248 | "libredox", 249 | "thiserror", 250 | ] 251 | 252 | [[package]] 253 | name = "regex" 254 | version = "1.10.6" 255 | source = "registry+https://github.com/rust-lang/crates.io-index" 256 | checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" 257 | dependencies = [ 258 | "aho-corasick", 259 | "memchr", 260 | "regex-automata", 261 | "regex-syntax", 262 | ] 263 | 264 | [[package]] 265 | name = "regex-automata" 266 | version = "0.4.7" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" 269 | dependencies = [ 270 | "aho-corasick", 271 | "memchr", 272 | "regex-syntax", 273 | ] 274 | 275 | [[package]] 276 | name = "regex-syntax" 277 | version = "0.8.4" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" 280 | 281 | [[package]] 282 | name = "rivets-macros" 283 | version = "0.1.0" 284 | dependencies = [ 285 | "anyhow", 286 | "darling", 287 | "lazy-regex", 288 | "proc-macro2", 289 | "quote", 290 | "rivets-shared", 291 | "syn", 292 | ] 293 | 294 | [[package]] 295 | name = "rivets-shared" 296 | version = "0.1.0" 297 | dependencies = [ 298 | "anyhow", 299 | "cpp_demangle", 300 | "dirs", 301 | "pdb", 302 | "proc-macro2", 303 | "syn", 304 | "undname", 305 | "windows", 306 | ] 307 | 308 | [[package]] 309 | name = "scroll" 310 | version = "0.11.0" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" 313 | 314 | [[package]] 315 | name = "serde" 316 | version = "1.0.205" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" 319 | dependencies = [ 320 | "serde_derive", 321 | ] 322 | 323 | [[package]] 324 | name = "serde_derive" 325 | version = "1.0.205" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" 328 | dependencies = [ 329 | "proc-macro2", 330 | "quote", 331 | "syn", 332 | ] 333 | 334 | [[package]] 335 | name = "smallvec" 336 | version = "1.13.2" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 339 | 340 | [[package]] 341 | name = "strsim" 342 | version = "0.11.1" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 345 | 346 | [[package]] 347 | name = "syn" 348 | version = "2.0.72" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" 351 | dependencies = [ 352 | "proc-macro2", 353 | "quote", 354 | "unicode-ident", 355 | ] 356 | 357 | [[package]] 358 | name = "thiserror" 359 | version = "1.0.63" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" 362 | dependencies = [ 363 | "thiserror-impl", 364 | ] 365 | 366 | [[package]] 367 | name = "thiserror-impl" 368 | version = "1.0.63" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" 371 | dependencies = [ 372 | "proc-macro2", 373 | "quote", 374 | "syn", 375 | ] 376 | 377 | [[package]] 378 | name = "undname" 379 | version = "1.1.2" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "8f76889af53deca091b038f6ebb04efa45fcba08908e69c0049e8b8c281f16f9" 382 | dependencies = [ 383 | "arrayvec", 384 | "bitflags", 385 | "bstr", 386 | "bumpalo", 387 | "nonmax", 388 | "smallvec", 389 | "thiserror", 390 | ] 391 | 392 | [[package]] 393 | name = "unicode-ident" 394 | version = "1.0.12" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 397 | 398 | [[package]] 399 | name = "uuid" 400 | version = "1.10.0" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" 403 | 404 | [[package]] 405 | name = "wasi" 406 | version = "0.11.0+wasi-snapshot-preview1" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 409 | 410 | [[package]] 411 | name = "windows" 412 | version = "0.58.0" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" 415 | dependencies = [ 416 | "windows-core", 417 | "windows-targets 0.52.6", 418 | ] 419 | 420 | [[package]] 421 | name = "windows-core" 422 | version = "0.58.0" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" 425 | dependencies = [ 426 | "windows-implement", 427 | "windows-interface", 428 | "windows-result", 429 | "windows-strings", 430 | "windows-targets 0.52.6", 431 | ] 432 | 433 | [[package]] 434 | name = "windows-implement" 435 | version = "0.58.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" 438 | dependencies = [ 439 | "proc-macro2", 440 | "quote", 441 | "syn", 442 | ] 443 | 444 | [[package]] 445 | name = "windows-interface" 446 | version = "0.58.0" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" 449 | dependencies = [ 450 | "proc-macro2", 451 | "quote", 452 | "syn", 453 | ] 454 | 455 | [[package]] 456 | name = "windows-result" 457 | version = "0.2.0" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" 460 | dependencies = [ 461 | "windows-targets 0.52.6", 462 | ] 463 | 464 | [[package]] 465 | name = "windows-strings" 466 | version = "0.1.0" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" 469 | dependencies = [ 470 | "windows-result", 471 | "windows-targets 0.52.6", 472 | ] 473 | 474 | [[package]] 475 | name = "windows-sys" 476 | version = "0.48.0" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 479 | dependencies = [ 480 | "windows-targets 0.48.5", 481 | ] 482 | 483 | [[package]] 484 | name = "windows-targets" 485 | version = "0.48.5" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 488 | dependencies = [ 489 | "windows_aarch64_gnullvm 0.48.5", 490 | "windows_aarch64_msvc 0.48.5", 491 | "windows_i686_gnu 0.48.5", 492 | "windows_i686_msvc 0.48.5", 493 | "windows_x86_64_gnu 0.48.5", 494 | "windows_x86_64_gnullvm 0.48.5", 495 | "windows_x86_64_msvc 0.48.5", 496 | ] 497 | 498 | [[package]] 499 | name = "windows-targets" 500 | version = "0.52.6" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 503 | dependencies = [ 504 | "windows_aarch64_gnullvm 0.52.6", 505 | "windows_aarch64_msvc 0.52.6", 506 | "windows_i686_gnu 0.52.6", 507 | "windows_i686_gnullvm", 508 | "windows_i686_msvc 0.52.6", 509 | "windows_x86_64_gnu 0.52.6", 510 | "windows_x86_64_gnullvm 0.52.6", 511 | "windows_x86_64_msvc 0.52.6", 512 | ] 513 | 514 | [[package]] 515 | name = "windows_aarch64_gnullvm" 516 | version = "0.48.5" 517 | source = "registry+https://github.com/rust-lang/crates.io-index" 518 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 519 | 520 | [[package]] 521 | name = "windows_aarch64_gnullvm" 522 | version = "0.52.6" 523 | source = "registry+https://github.com/rust-lang/crates.io-index" 524 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 525 | 526 | [[package]] 527 | name = "windows_aarch64_msvc" 528 | version = "0.48.5" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 531 | 532 | [[package]] 533 | name = "windows_aarch64_msvc" 534 | version = "0.52.6" 535 | source = "registry+https://github.com/rust-lang/crates.io-index" 536 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 537 | 538 | [[package]] 539 | name = "windows_i686_gnu" 540 | version = "0.48.5" 541 | source = "registry+https://github.com/rust-lang/crates.io-index" 542 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 543 | 544 | [[package]] 545 | name = "windows_i686_gnu" 546 | version = "0.52.6" 547 | source = "registry+https://github.com/rust-lang/crates.io-index" 548 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 549 | 550 | [[package]] 551 | name = "windows_i686_gnullvm" 552 | version = "0.52.6" 553 | source = "registry+https://github.com/rust-lang/crates.io-index" 554 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 555 | 556 | [[package]] 557 | name = "windows_i686_msvc" 558 | version = "0.48.5" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 561 | 562 | [[package]] 563 | name = "windows_i686_msvc" 564 | version = "0.52.6" 565 | source = "registry+https://github.com/rust-lang/crates.io-index" 566 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 567 | 568 | [[package]] 569 | name = "windows_x86_64_gnu" 570 | version = "0.48.5" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 573 | 574 | [[package]] 575 | name = "windows_x86_64_gnu" 576 | version = "0.52.6" 577 | source = "registry+https://github.com/rust-lang/crates.io-index" 578 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 579 | 580 | [[package]] 581 | name = "windows_x86_64_gnullvm" 582 | version = "0.48.5" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 585 | 586 | [[package]] 587 | name = "windows_x86_64_gnullvm" 588 | version = "0.52.6" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 591 | 592 | [[package]] 593 | name = "windows_x86_64_msvc" 594 | version = "0.48.5" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 597 | 598 | [[package]] 599 | name = "windows_x86_64_msvc" 600 | version = "0.52.6" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 603 | -------------------------------------------------------------------------------- /rivets-macros/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![warn(missing_docs)] 2 | #![feature(proc_macro_diagnostic)] 3 | 4 | //! Contains the proc macros for rivets. 5 | 6 | use anyhow::{bail, Result}; 7 | use darling::FromDeriveInput; 8 | use lazy_regex::regex; 9 | use proc_macro::{self, Diagnostic, Level, Span, TokenStream}; 10 | use proc_macro2::TokenStream as TokenStream2; 11 | use quote::quote; 12 | use std::sync::{atomic::AtomicBool, LazyLock, Mutex}; 13 | use syn::{parse_macro_input, Abi, DeriveInput, Error, Expr, FnArg, Ident, ItemFn, Variant}; 14 | 15 | static IS_FINALIZED: AtomicBool = AtomicBool::new(false); 16 | static MANGLED_NAMES: LazyLock>> = LazyLock::new(|| Mutex::new(vec![])); 17 | static CPP_IMPORTS: LazyLock>> = LazyLock::new(|| Mutex::new(vec![])); 18 | 19 | macro_rules! derive_error { 20 | ($string: tt) => { 21 | Error::new(proc_macro2::Span::call_site(), $string) 22 | .to_compile_error() 23 | .into() 24 | }; 25 | } 26 | 27 | macro_rules! check_finalized { 28 | () => { 29 | // this check causes issues with rust-analyer. disable during debug builds. 30 | #[cfg(not(debug_assertions))] 31 | if IS_FINALIZED.load(std::sync::atomic::Ordering::Relaxed) { 32 | panic!("The rivets library has already been finalized!"); 33 | } 34 | }; 35 | } 36 | 37 | fn failure(callback: proc_macro2::TokenStream, error_message: &str) -> TokenStream { 38 | Diagnostic::spanned(Span::call_site(), Level::Error, error_message).emit(); 39 | callback.into() 40 | } 41 | 42 | fn determine_calling_convention(input: &ItemFn, unmangled_name: &str) -> Result { 43 | if let Some(abi) = &input.sig.abi { 44 | return Ok(abi.clone()); 45 | } 46 | 47 | let abi = regex!(r" __[a-zA-Z]+ ").find(unmangled_name); 48 | let abi = match abi { 49 | Some(abi) => abi.as_str(), 50 | None => bail!("Failed to automatically determine calling convention for {unmangled_name}. Try specifying the calling convention manually. Example: extern \"C\" fn() {}", "{}"), 51 | }; 52 | let abi = &abi[1..abi.len() - 1]; 53 | if let Some(calling_convention) = rivets_shared::get_calling_convention(abi) { 54 | Ok(calling_convention) 55 | } else { 56 | bail!("Calling convention {abi} is not currently supported by rivets. Please report this issue to the rivets developers."); 57 | } 58 | } 59 | 60 | /// A procedural macro for detouring a C++ compiled function. 61 | /// 62 | /// The argument to the macro is the mangled name of the C++ function to detour. 63 | /// I recommend finding these mangled names by using `IDA Free with the Hex-Rays Decompiler` to inspect the factorio binary. 64 | /// 65 | /// This macro is useful in the following scenarios: 66 | /// - Running rust code after a C++ function is called. 67 | /// - Running rust code before a C++ function is called. 68 | /// - Overwriting a C++ function with a rust function. 69 | /// - Preforming some operation on the arguments of a C++ function before calling the original function. 70 | /// - Preforming some operation on the return value of a C++ function before returning it to the caller. 71 | /// 72 | /// This macro cannot hook into the middle of a C++ function. It can only hook into the beginning or end of a function. 73 | /// 74 | /// This macro cannot hook into a function that has been inlined by the compiler. Prominent examples of this include `lua_gettop`. 75 | /// 76 | /// Exposes an `unsafe` `back` function that can be called in order to resume control flow to the original C++ function. 77 | /// 78 | /// Internally uses the `retour` crate to create a static detour for the function and thus inherits the safety guarantees of that crate. 79 | /// 80 | /// # Examples 81 | /// ``` 82 | /// #[detour(?run@LuaEventDispatcher@@AEAAXW4LuaEventType@@VMapTickType@@P8LuaGameScript@@EAA_NAEBVGameAction@@@Z2@Z)] 83 | /// fn run( 84 | /// this: Opaque, 85 | /// lua_event_type: i32, 86 | /// map_tick_type: Opaque, 87 | /// lua_game_script: Opaque, 88 | /// game_action: Opaque, 89 | /// ) { 90 | /// let event: Result = (lua_event_type as u8).try_into(); 91 | /// if let Ok(event) = event { 92 | /// info!("A simple Rust event handler! {:?}", q); 93 | /// } 94 | /// unsafe { back(this, lua_event_type, map_tick_type, lua_game_script, game_action) } 95 | /// } 96 | /// ``` 97 | /// 98 | /// # Safety 99 | /// The arguments to the detoured function are the raw FFI pointers to the arguments of the original C++ function. 100 | /// It is up to the user to ensure that the arguments are valid FFI types. 101 | /// All structs, classes, enums, and union arguments must have a corresponding `#[repr(C)]` attribute and must also have the correct offsets and sizes. 102 | /// Alternatively, the user can use the `rivets::Opaque` type to represent any arbitrary FFI data if you do not intend to interact with the data. 103 | /// See the `pdb2hpp` module for a tool that can generate the correct FFI types for C++ functions. 104 | #[proc_macro_attribute] 105 | pub fn detour(attr: TokenStream, item: TokenStream) -> TokenStream { 106 | check_finalized!(); 107 | 108 | let mangled_name = attr.to_string(); 109 | let unmangled_name = 110 | rivets_shared::demangle(&mangled_name).unwrap_or_else(|| mangled_name.clone()); 111 | 112 | let mut input = parse_macro_input!(item as ItemFn); 113 | let name = &input.sig.ident; 114 | let return_type = &input.sig.output; 115 | 116 | let inputs = &input.sig.inputs; 117 | let mut arg_names: Vec = vec![]; 118 | let arguments: Vec = inputs 119 | .iter() 120 | .map(|arg| match arg { 121 | FnArg::Receiver(_) => { 122 | quote! {compile_error!("Detour functions cannot use the self parameter.")} 123 | } 124 | FnArg::Typed(pat) => { 125 | let attrs = &pat.attrs; 126 | let ty = &pat.ty; 127 | let pat = &pat.pat; 128 | arg_names.push(quote! { #pat }); 129 | quote! { #(#attrs)* #ty } 130 | } 131 | }) 132 | .collect(); 133 | let arguments = quote! { #( #arguments ),* }; 134 | let arg_names = quote! { #( #arg_names ),* }; 135 | 136 | let calling_convention = match determine_calling_convention(&input, &unmangled_name) { 137 | Ok(calling_convention) => calling_convention, 138 | Err(e) => return failure(quote! { #input }, &e.to_string()), 139 | }; 140 | input.sig.abi = None; 141 | let callback = quote! { #input }; 142 | 143 | let cpp_function_header = quote! { 144 | unsafe #calling_convention fn(#arguments) #return_type 145 | }; 146 | 147 | let result = quote! { 148 | mod #name { 149 | use super::*; 150 | 151 | rivets::retour::static_detour! { 152 | static Detour : #cpp_function_header; 153 | } 154 | 155 | unsafe fn back(#inputs) #return_type { 156 | Detour.call(#arg_names) 157 | } 158 | 159 | #[doc = #unmangled_name] 160 | #[allow(unused_variables)] 161 | #callback 162 | 163 | pub unsafe fn hook(address: u64) -> Result<(), rivets::retour::Error> { 164 | let compiled_function: #cpp_function_header = std::mem::transmute(address); // todo: rust documentation recommends casting this to a raw function pointer. address as *const _ 165 | Detour.initialize(compiled_function, #name)?.enable()?; 166 | Ok(()) 167 | } 168 | } 169 | }; 170 | 171 | MANGLED_NAMES 172 | .lock() 173 | .expect("Failed to lock mangled names") 174 | .push((mangled_name.clone(), name.to_string())); 175 | 176 | Diagnostic::spanned(Span::call_site(), Level::Note, unmangled_name.clone()).emit(); 177 | 178 | result.into() 179 | } 180 | 181 | /// A procedural macro for importing a C++ compiled function into the rust scope. 182 | /// This macro is useful in the case where you need to directly call any C++ function from rust. 183 | /// 184 | /// # Arguments 185 | /// * `mangled_name` - The mangled name of the C++ function to import. 186 | /// * `dll_name` (optional) - Argument for the name of the DLL to import the function from. If not provided, factorio.exe will be used. 187 | /// 188 | /// Note that most Factorio libraries (such as allegro and lua) are statically linked. In this case, the `dll_name` argument is not needed. 189 | /// 190 | /// # Examples 191 | /// ``` 192 | /// // Summons the lua_gettop function from the compiled lua library. 193 | /// // lua_gettop is compiled without name mangling, so calling convention (in this case, extern "C") must be manually provided. 194 | /// #[import(lua_gettop)] 195 | /// extern "C" fn lua_gettop(lua_state: *mut luastate::lua_State) -> i64 {} 196 | /// 197 | /// // Calls the lua_gettop function with correct arguments. 198 | /// fn my_func(*mut luastate::lua_State) { 199 | /// let top = unsafe { lua_gettop(lua_state) }; 200 | /// println!("Lua stack top: {top}"); 201 | /// } 202 | /// ``` 203 | /// 204 | /// # Safety 205 | /// The arguments and return type of the imported function must be exactly matching FFI types. 206 | /// All structs, classes, enums, and union arguments must have a corresponding `#[repr(C)]` attribute and must also have the correct offsets and sizes. 207 | /// Alternatively, the user can use the `rivets::Opaque` type to represent any arbitrary FFI data if you do not intend to interact with the data. 208 | /// See the `pdb2hpp` module for a tool that can generate the correct FFI types for C++ functions. 209 | /// 210 | /// The user must also ensure that the calling convention is correct. 211 | /// Rivets attempts to automatically parse this information from the mangled name however 212 | /// - If the calling convention is not one of cdecl, stdcall, fastcall, thiscall, or vectorcall, the user must specify the calling convention manually. 213 | /// - If the calling convention is not present in the mangled name, the user must specify the calling convention manually. 214 | /// - In rare cases the function may use a non-standard calling convention. In this case, the user must manually populate the required stack and registers via inline assembly. 215 | /// 216 | /// Calling any imported function repersents calling into the C++ compiled codebase and thus is inherently unsafe. 217 | #[proc_macro_attribute] 218 | pub fn import(attr: TokenStream, item: TokenStream) -> TokenStream { 219 | check_finalized!(); 220 | 221 | let mangled_name = attr.to_string(); 222 | let unmangled_name = 223 | rivets_shared::demangle(&mangled_name).unwrap_or_else(|| mangled_name.clone()); 224 | 225 | let input = parse_macro_input!(item as ItemFn); 226 | 227 | let calling_convention = match determine_calling_convention(&input, &unmangled_name) { 228 | Ok(calling_convention) => Some(calling_convention), 229 | Err(e) => return failure(quote! { #input }, &e.to_string()), 230 | }; 231 | 232 | let arg_types = input.sig.inputs.iter().map(|arg| match arg { 233 | FnArg::Receiver(_) => { 234 | quote! {compile_error!("Summoned functions cannot use the self parameter.")} 235 | } 236 | FnArg::Typed(pat) => { 237 | let ty = &pat.ty; 238 | quote! { #ty } 239 | } 240 | }); 241 | 242 | let return_type = &input.sig.output; 243 | let vis = &input.vis; 244 | let attr = &input.attrs; 245 | let attr = quote! { #(#attr)* }; 246 | 247 | let name = &input.sig.ident; 248 | let function_type = quote! { unsafe #calling_convention fn(#(#arg_types),*) #return_type }; 249 | 250 | CPP_IMPORTS 251 | .lock() 252 | .expect("Failed to lock cpp imports") 253 | .push((mangled_name.clone(), name.to_string())); 254 | 255 | Diagnostic::spanned(Span::call_site(), Level::Note, unmangled_name.clone()).emit(); 256 | 257 | quote! { 258 | #[allow(non_upper_case_globals)] 259 | #[allow(missing_docs)] 260 | #attr #vis static mut #name: rivets::UnsafeSummonedFunction<#function_type> = rivets::UnsafeSummonedFunction::Uninitialized; 261 | }.into() 262 | } 263 | 264 | fn get_hooks() -> Vec { 265 | MANGLED_NAMES 266 | .lock() 267 | .expect("Failed to lock mangled names") 268 | .iter() 269 | .map(|(mangled_name, module_name)| { 270 | let module_name = Ident::new(module_name, proc_macro2::Span::call_site()); 271 | quote! { 272 | hooks.push( 273 | rivets::RivetsHook { 274 | mangled_name: #mangled_name.into(), 275 | hook: #module_name::hook 276 | } 277 | ); 278 | } 279 | }) 280 | .collect() 281 | } 282 | 283 | fn get_imports() -> Vec { 284 | CPP_IMPORTS.lock().expect("Failed to lock cpp imports") 285 | .iter() 286 | .map(|(mangled_name, rust_name)| { 287 | let rust_name = Ident::new(rust_name, proc_macro2::Span::call_site()); 288 | quote! { 289 | let Some(address) = symbol_cache.get_function_address(base_address, #mangled_name) 290 | else { 291 | panic!( 292 | "Failed to find address for the following mangled function inside the PDB: {}", #mangled_name 293 | ); 294 | }; 295 | let function = unsafe { 296 | std::mem::transmute(address) // todo: rust documentation recommends casting this to a raw function pointer. address as *const _ 297 | }; 298 | unsafe { #rust_name = rivets::UnsafeSummonedFunction::Function(function); } 299 | } 300 | }) 301 | .collect() 302 | } 303 | 304 | /// A procedural macro for finalizing the rivets library. 305 | /// This macro should be called once at the end of the `main.rs` file. 306 | /// It will finalize the rivets library and inject all of the detours. 307 | #[proc_macro] 308 | pub fn finalize(_: TokenStream) -> TokenStream { 309 | check_finalized!(); 310 | IS_FINALIZED.store(true, std::sync::atomic::Ordering::Relaxed); 311 | 312 | let hooks = get_hooks(); 313 | let imports = get_imports(); 314 | 315 | let finalize = quote! { 316 | fn rivets_finalize(symbol_cache: rivets::SymbolCache) -> Option { 317 | let base_address = match symbol_cache.get_module_base_address() { 318 | Ok(base_address) => base_address, 319 | Err(e) => return Some(format!("{e}")), 320 | }; 321 | 322 | #(#imports)* 323 | 324 | let mut hooks: Vec = Vec::new(); 325 | #(#hooks)* 326 | for hook in &hooks { 327 | let inject_result = unsafe { symbol_cache.inject(base_address, hook) }; 328 | if inject_result.is_err() { 329 | return Some(format!("{inject_result:?}")); 330 | } 331 | } 332 | None 333 | } 334 | }; 335 | 336 | quote! { rivets::dll_syringe::payload_procedure! { #finalize } }.into() 337 | } 338 | 339 | #[derive(FromDeriveInput)] 340 | #[darling(attributes(factorio_define))] 341 | struct DefineOpts { 342 | kind: Ident, 343 | } 344 | 345 | /// A procedural macro for constructing the factorio defines table. 346 | #[proc_macro_derive(FactorioDefine, attributes(factorio_define, value))] 347 | pub fn define_derive(input: TokenStream) -> TokenStream { 348 | let input = parse_macro_input!(input); 349 | let Ok(DefineOpts { kind }) = DefineOpts::from_derive_input(&input) else { 350 | return derive_error!("Missing #[kind(?)] attribute!"); 351 | }; 352 | let DeriveInput { ident, data, .. } = input; 353 | 354 | let syn::Data::Enum(data) = data else { 355 | return derive_error!("FactorioDefine can only be used on enums!"); 356 | }; 357 | 358 | let count = data.variants.len(); 359 | let mut deref_matches = TokenStream2::new(); 360 | let mut from_matches = TokenStream2::new(); 361 | let mut variants = TokenStream2::new(); 362 | 363 | for variant in data.variants { 364 | let mut value = None; 365 | for attr in &variant.attrs { 366 | let syn::Meta::NameValue(nv) = &attr.meta else { 367 | continue; 368 | }; 369 | 370 | if !nv.path.is_ident::("value") { 371 | continue; 372 | } 373 | 374 | let Expr::Lit(syn::PatLit { lit, .. }) = &nv.value else { 375 | return derive_error!("All variants must have a #[value(?)] attribute!"); 376 | }; 377 | 378 | value = Some(lit.clone()); 379 | 380 | break; 381 | } 382 | 383 | let Some(value) = value else { 384 | return derive_error!("All variants must have a #[value = ?] attribute!"); 385 | }; 386 | 387 | let Variant { ident, .. } = variant; 388 | 389 | deref_matches.extend(std::iter::once(quote! { 390 | Self::#ident => &#value, 391 | })); 392 | 393 | from_matches.extend(std::iter::once(quote! { 394 | #value => Ok(Self::#ident), 395 | })); 396 | 397 | variants.extend(std::iter::once(quote! { 398 | Self::#ident, 399 | })); 400 | } 401 | 402 | let str_kind = format!("{kind}"); 403 | let mut impl_from = { 404 | let kind = if str_kind == "str" { 405 | quote! { 406 | &#kind 407 | } 408 | } else { 409 | quote! { 410 | #kind 411 | } 412 | }; 413 | 414 | quote! { 415 | impl std::convert::TryFrom<#kind> for #ident { 416 | type Error = &'static str; 417 | 418 | fn try_from(value: #kind) -> Result { 419 | match value { 420 | #from_matches 421 | _ => Err("Invalid value"), 422 | } 423 | } 424 | } 425 | } 426 | }; 427 | 428 | if str_kind == "i8" 429 | || str_kind == "i16" 430 | || str_kind == "i32" 431 | || str_kind == "i64" 432 | || str_kind == "i128" 433 | { 434 | impl_from = quote! { 435 | #impl_from 436 | 437 | impl std::convert::TryFrom<&isize> for #ident { 438 | type Error = &'static str; 439 | 440 | fn try_from(value: &isize) -> Result { 441 | match value { 442 | #from_matches 443 | _ => Err("Invalid value"), 444 | } 445 | } 446 | } 447 | }; 448 | } else if str_kind == "u8" 449 | || str_kind == "u16" 450 | || str_kind == "u32" 451 | || str_kind == "u64" 452 | || str_kind == "u128" 453 | { 454 | impl_from = quote! { 455 | #impl_from 456 | 457 | impl std::convert::TryFrom<&usize> for #ident { 458 | type Error = &'static str; 459 | 460 | fn try_from(value: &usize) -> Result { 461 | match value { 462 | #from_matches 463 | _ => Err("Invalid value"), 464 | } 465 | } 466 | } 467 | }; 468 | } 469 | 470 | let output = quote! { 471 | impl std::ops::Deref for #ident { 472 | type Target = #kind; 473 | 474 | fn deref(&self) -> &'static #kind { 475 | match self { 476 | #deref_matches 477 | } 478 | } 479 | } 480 | 481 | #impl_from 482 | 483 | impl Define<#count> for #ident { 484 | fn variants() -> &'static [Self; #count] { 485 | &[ 486 | #variants 487 | ] 488 | } 489 | } 490 | }; 491 | 492 | output.into() 493 | } 494 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "abi_stable" 7 | version = "0.11.3" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "69d6512d3eb05ffe5004c59c206de7f99c34951504056ce23fc953842f12c445" 10 | dependencies = [ 11 | "abi_stable_derive", 12 | "abi_stable_shared", 13 | "const_panic", 14 | "core_extensions", 15 | "crossbeam-channel", 16 | "generational-arena", 17 | "libloading", 18 | "lock_api", 19 | "parking_lot", 20 | "paste", 21 | "repr_offset", 22 | "rustc_version", 23 | "serde", 24 | "serde_derive", 25 | "serde_json", 26 | ] 27 | 28 | [[package]] 29 | name = "abi_stable_derive" 30 | version = "0.11.3" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | checksum = "d7178468b407a4ee10e881bc7a328a65e739f0863615cca4429d43916b05e898" 33 | dependencies = [ 34 | "abi_stable_shared", 35 | "as_derive_utils", 36 | "core_extensions", 37 | "proc-macro2", 38 | "quote", 39 | "rustc_version", 40 | "syn 1.0.109", 41 | "typed-arena", 42 | ] 43 | 44 | [[package]] 45 | name = "abi_stable_shared" 46 | version = "0.11.0" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "b2b5df7688c123e63f4d4d649cba63f2967ba7f7861b1664fca3f77d3dad2b63" 49 | dependencies = [ 50 | "core_extensions", 51 | ] 52 | 53 | [[package]] 54 | name = "aho-corasick" 55 | version = "1.1.3" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 58 | dependencies = [ 59 | "memchr", 60 | ] 61 | 62 | [[package]] 63 | name = "anyhow" 64 | version = "1.0.86" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" 67 | 68 | [[package]] 69 | name = "arrayvec" 70 | version = "0.7.4" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 73 | 74 | [[package]] 75 | name = "as_derive_utils" 76 | version = "0.11.0" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "ff3c96645900a44cf11941c111bd08a6573b0e2f9f69bc9264b179d8fae753c4" 79 | dependencies = [ 80 | "core_extensions", 81 | "proc-macro2", 82 | "quote", 83 | "syn 1.0.109", 84 | ] 85 | 86 | [[package]] 87 | name = "autocfg" 88 | version = "1.3.0" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 91 | 92 | [[package]] 93 | name = "bitflags" 94 | version = "1.3.2" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 97 | 98 | [[package]] 99 | name = "bitflags" 100 | version = "2.6.0" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 103 | 104 | [[package]] 105 | name = "bstr" 106 | version = "1.10.0" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" 109 | dependencies = [ 110 | "memchr", 111 | "regex-automata", 112 | "serde", 113 | ] 114 | 115 | [[package]] 116 | name = "bumpalo" 117 | version = "3.16.0" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 120 | 121 | [[package]] 122 | name = "cc" 123 | version = "1.1.10" 124 | source = "registry+https://github.com/rust-lang/crates.io-index" 125 | checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" 126 | 127 | [[package]] 128 | name = "cfg-if" 129 | version = "1.0.0" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 132 | 133 | [[package]] 134 | name = "const_panic" 135 | version = "0.2.8" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" 138 | 139 | [[package]] 140 | name = "core_extensions" 141 | version = "1.5.3" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "92c71dc07c9721607e7a16108336048ee978c3a8b129294534272e8bac96c0ee" 144 | dependencies = [ 145 | "core_extensions_proc_macros", 146 | ] 147 | 148 | [[package]] 149 | name = "core_extensions_proc_macros" 150 | version = "1.5.3" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "69f3b219d28b6e3b4ac87bc1fc522e0803ab22e055da177bff0068c4150c61a6" 153 | 154 | [[package]] 155 | name = "cpp_demangle" 156 | version = "0.4.3" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" 159 | dependencies = [ 160 | "cfg-if", 161 | ] 162 | 163 | [[package]] 164 | name = "crossbeam-channel" 165 | version = "0.5.13" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" 168 | dependencies = [ 169 | "crossbeam-utils", 170 | ] 171 | 172 | [[package]] 173 | name = "crossbeam-utils" 174 | version = "0.8.20" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" 177 | 178 | [[package]] 179 | name = "darling" 180 | version = "0.20.10" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" 183 | dependencies = [ 184 | "darling_core", 185 | "darling_macro", 186 | ] 187 | 188 | [[package]] 189 | name = "darling_core" 190 | version = "0.20.10" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" 193 | dependencies = [ 194 | "fnv", 195 | "ident_case", 196 | "proc-macro2", 197 | "quote", 198 | "strsim", 199 | "syn 2.0.72", 200 | ] 201 | 202 | [[package]] 203 | name = "darling_macro" 204 | version = "0.20.10" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" 207 | dependencies = [ 208 | "darling_core", 209 | "quote", 210 | "syn 2.0.72", 211 | ] 212 | 213 | [[package]] 214 | name = "fallible-iterator" 215 | version = "0.2.0" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 218 | 219 | [[package]] 220 | name = "fnv" 221 | version = "1.0.7" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 224 | 225 | [[package]] 226 | name = "generational-arena" 227 | version = "0.2.9" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | checksum = "877e94aff08e743b651baaea359664321055749b398adff8740a7399af7796e7" 230 | dependencies = [ 231 | "cfg-if", 232 | ] 233 | 234 | [[package]] 235 | name = "generic-array" 236 | version = "0.14.7" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 239 | dependencies = [ 240 | "typenum", 241 | "version_check", 242 | ] 243 | 244 | [[package]] 245 | name = "ident_case" 246 | version = "1.0.1" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 249 | 250 | [[package]] 251 | name = "itoa" 252 | version = "1.0.11" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 255 | 256 | [[package]] 257 | name = "lazy-regex" 258 | version = "3.2.0" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "576c8060ecfdf2e56995cf3274b4f2d71fa5e4fa3607c1c0b63c10180ee58741" 261 | dependencies = [ 262 | "lazy-regex-proc_macros", 263 | "once_cell", 264 | "regex", 265 | ] 266 | 267 | [[package]] 268 | name = "lazy-regex-proc_macros" 269 | version = "3.2.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "9efb9e65d4503df81c615dc33ff07042a9408ac7f26b45abee25566f7fbfd12c" 272 | dependencies = [ 273 | "proc-macro2", 274 | "quote", 275 | "regex", 276 | "syn 2.0.72", 277 | ] 278 | 279 | [[package]] 280 | name = "libc" 281 | version = "0.2.155" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" 284 | 285 | [[package]] 286 | name = "libloading" 287 | version = "0.7.4" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" 290 | dependencies = [ 291 | "cfg-if", 292 | "winapi", 293 | ] 294 | 295 | [[package]] 296 | name = "libudis86-sys" 297 | version = "0.2.1" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "139bbf9ddb1bfc90c1ac64dd2923d9c957cd433cee7315c018125d72ab08a6b0" 300 | dependencies = [ 301 | "cc", 302 | "libc", 303 | ] 304 | 305 | [[package]] 306 | name = "lock_api" 307 | version = "0.4.12" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 310 | dependencies = [ 311 | "autocfg", 312 | "scopeguard", 313 | ] 314 | 315 | [[package]] 316 | name = "mach2" 317 | version = "0.4.2" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" 320 | dependencies = [ 321 | "libc", 322 | ] 323 | 324 | [[package]] 325 | name = "memchr" 326 | version = "2.7.4" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 329 | 330 | [[package]] 331 | name = "mmap-fixed-fixed" 332 | version = "0.1.3" 333 | source = "registry+https://github.com/rust-lang/crates.io-index" 334 | checksum = "0681853891801e4763dc252e843672faf32bcfee27a0aa3b19733902af450acc" 335 | dependencies = [ 336 | "libc", 337 | "winapi", 338 | ] 339 | 340 | [[package]] 341 | name = "nonmax" 342 | version = "0.5.5" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" 345 | 346 | [[package]] 347 | name = "once_cell" 348 | version = "1.19.0" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 351 | 352 | [[package]] 353 | name = "parking_lot" 354 | version = "0.12.3" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 357 | dependencies = [ 358 | "lock_api", 359 | "parking_lot_core", 360 | ] 361 | 362 | [[package]] 363 | name = "parking_lot_core" 364 | version = "0.9.10" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 367 | dependencies = [ 368 | "cfg-if", 369 | "libc", 370 | "redox_syscall", 371 | "smallvec", 372 | "windows-targets", 373 | ] 374 | 375 | [[package]] 376 | name = "paste" 377 | version = "1.0.15" 378 | source = "registry+https://github.com/rust-lang/crates.io-index" 379 | checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" 380 | 381 | [[package]] 382 | name = "pdb" 383 | version = "0.8.0" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "82040a392923abe6279c00ab4aff62d5250d1c8555dc780e4b02783a7aa74863" 386 | dependencies = [ 387 | "fallible-iterator", 388 | "scroll", 389 | "uuid", 390 | ] 391 | 392 | [[package]] 393 | name = "proc-macro2" 394 | version = "1.0.86" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 397 | dependencies = [ 398 | "unicode-ident", 399 | ] 400 | 401 | [[package]] 402 | name = "quote" 403 | version = "1.0.36" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 406 | dependencies = [ 407 | "proc-macro2", 408 | ] 409 | 410 | [[package]] 411 | name = "redox_syscall" 412 | version = "0.5.3" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" 415 | dependencies = [ 416 | "bitflags 2.6.0", 417 | ] 418 | 419 | [[package]] 420 | name = "regex" 421 | version = "1.10.6" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" 424 | dependencies = [ 425 | "aho-corasick", 426 | "memchr", 427 | "regex-automata", 428 | "regex-syntax", 429 | ] 430 | 431 | [[package]] 432 | name = "regex-automata" 433 | version = "0.4.7" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" 436 | dependencies = [ 437 | "aho-corasick", 438 | "memchr", 439 | "regex-syntax", 440 | ] 441 | 442 | [[package]] 443 | name = "regex-syntax" 444 | version = "0.8.4" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" 447 | 448 | [[package]] 449 | name = "region" 450 | version = "3.0.2" 451 | source = "registry+https://github.com/rust-lang/crates.io-index" 452 | checksum = "e6b6ebd13bc009aef9cd476c1310d49ac354d36e240cf1bd753290f3dc7199a7" 453 | dependencies = [ 454 | "bitflags 1.3.2", 455 | "libc", 456 | "mach2", 457 | "windows-sys", 458 | ] 459 | 460 | [[package]] 461 | name = "repr_offset" 462 | version = "0.2.2" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "fb1070755bd29dffc19d0971cab794e607839ba2ef4b69a9e6fbc8733c1b72ea" 465 | dependencies = [ 466 | "tstr", 467 | ] 468 | 469 | [[package]] 470 | name = "retour" 471 | version = "0.3.1" 472 | source = "registry+https://github.com/rust-lang/crates.io-index" 473 | checksum = "a9af44d40e2400b44d491bfaf8eae111b09f23ac4de6e92728e79d93e699c527" 474 | dependencies = [ 475 | "cfg-if", 476 | "generic-array", 477 | "libc", 478 | "libudis86-sys", 479 | "mmap-fixed-fixed", 480 | "once_cell", 481 | "region", 482 | "slice-pool2", 483 | ] 484 | 485 | [[package]] 486 | name = "rivets" 487 | version = "0.1.0" 488 | dependencies = [ 489 | "abi_stable", 490 | "retour", 491 | "rivets-macros", 492 | "rivets-shared", 493 | ] 494 | 495 | [[package]] 496 | name = "rivets-macros" 497 | version = "0.1.0" 498 | dependencies = [ 499 | "anyhow", 500 | "darling", 501 | "lazy-regex", 502 | "proc-macro2", 503 | "quote", 504 | "rivets-shared", 505 | "syn 2.0.72", 506 | ] 507 | 508 | [[package]] 509 | name = "rivets-shared" 510 | version = "0.1.0" 511 | dependencies = [ 512 | "abi_stable", 513 | "anyhow", 514 | "cpp_demangle", 515 | "pdb", 516 | "serde", 517 | "syn 2.0.72", 518 | "undname", 519 | "windows", 520 | ] 521 | 522 | [[package]] 523 | name = "rustc_version" 524 | version = "0.4.0" 525 | source = "registry+https://github.com/rust-lang/crates.io-index" 526 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 527 | dependencies = [ 528 | "semver", 529 | ] 530 | 531 | [[package]] 532 | name = "ryu" 533 | version = "1.0.18" 534 | source = "registry+https://github.com/rust-lang/crates.io-index" 535 | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 536 | 537 | [[package]] 538 | name = "scopeguard" 539 | version = "1.2.0" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 542 | 543 | [[package]] 544 | name = "scroll" 545 | version = "0.11.0" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" 548 | 549 | [[package]] 550 | name = "semver" 551 | version = "1.0.23" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" 554 | 555 | [[package]] 556 | name = "serde" 557 | version = "1.0.205" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" 560 | dependencies = [ 561 | "serde_derive", 562 | ] 563 | 564 | [[package]] 565 | name = "serde_derive" 566 | version = "1.0.205" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" 569 | dependencies = [ 570 | "proc-macro2", 571 | "quote", 572 | "syn 2.0.72", 573 | ] 574 | 575 | [[package]] 576 | name = "serde_json" 577 | version = "1.0.124" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" 580 | dependencies = [ 581 | "itoa", 582 | "memchr", 583 | "ryu", 584 | "serde", 585 | ] 586 | 587 | [[package]] 588 | name = "slice-pool2" 589 | version = "0.4.3" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "7a3d689654af89bdfeba29a914ab6ac0236d382eb3b764f7454dde052f2821f8" 592 | 593 | [[package]] 594 | name = "smallvec" 595 | version = "1.13.2" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 598 | 599 | [[package]] 600 | name = "strsim" 601 | version = "0.11.1" 602 | source = "registry+https://github.com/rust-lang/crates.io-index" 603 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 604 | 605 | [[package]] 606 | name = "syn" 607 | version = "1.0.109" 608 | source = "registry+https://github.com/rust-lang/crates.io-index" 609 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 610 | dependencies = [ 611 | "proc-macro2", 612 | "quote", 613 | "unicode-ident", 614 | ] 615 | 616 | [[package]] 617 | name = "syn" 618 | version = "2.0.72" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" 621 | dependencies = [ 622 | "proc-macro2", 623 | "quote", 624 | "unicode-ident", 625 | ] 626 | 627 | [[package]] 628 | name = "thiserror" 629 | version = "1.0.63" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" 632 | dependencies = [ 633 | "thiserror-impl", 634 | ] 635 | 636 | [[package]] 637 | name = "thiserror-impl" 638 | version = "1.0.63" 639 | source = "registry+https://github.com/rust-lang/crates.io-index" 640 | checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" 641 | dependencies = [ 642 | "proc-macro2", 643 | "quote", 644 | "syn 2.0.72", 645 | ] 646 | 647 | [[package]] 648 | name = "tstr" 649 | version = "0.2.4" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | checksum = "7f8e0294f14baae476d0dd0a2d780b2e24d66e349a9de876f5126777a37bdba7" 652 | dependencies = [ 653 | "tstr_proc_macros", 654 | ] 655 | 656 | [[package]] 657 | name = "tstr_proc_macros" 658 | version = "0.2.2" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a" 661 | 662 | [[package]] 663 | name = "typed-arena" 664 | version = "2.0.2" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" 667 | 668 | [[package]] 669 | name = "typenum" 670 | version = "1.17.0" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 673 | 674 | [[package]] 675 | name = "undname" 676 | version = "1.1.2" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "8f76889af53deca091b038f6ebb04efa45fcba08908e69c0049e8b8c281f16f9" 679 | dependencies = [ 680 | "arrayvec", 681 | "bitflags 2.6.0", 682 | "bstr", 683 | "bumpalo", 684 | "nonmax", 685 | "smallvec", 686 | "thiserror", 687 | ] 688 | 689 | [[package]] 690 | name = "unicode-ident" 691 | version = "1.0.12" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 694 | 695 | [[package]] 696 | name = "uuid" 697 | version = "1.10.0" 698 | source = "registry+https://github.com/rust-lang/crates.io-index" 699 | checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" 700 | 701 | [[package]] 702 | name = "version_check" 703 | version = "0.9.5" 704 | source = "registry+https://github.com/rust-lang/crates.io-index" 705 | checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" 706 | 707 | [[package]] 708 | name = "winapi" 709 | version = "0.3.9" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 712 | dependencies = [ 713 | "winapi-i686-pc-windows-gnu", 714 | "winapi-x86_64-pc-windows-gnu", 715 | ] 716 | 717 | [[package]] 718 | name = "winapi-i686-pc-windows-gnu" 719 | version = "0.4.0" 720 | source = "registry+https://github.com/rust-lang/crates.io-index" 721 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 722 | 723 | [[package]] 724 | name = "winapi-x86_64-pc-windows-gnu" 725 | version = "0.4.0" 726 | source = "registry+https://github.com/rust-lang/crates.io-index" 727 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 728 | 729 | [[package]] 730 | name = "windows" 731 | version = "0.58.0" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" 734 | dependencies = [ 735 | "windows-core", 736 | "windows-targets", 737 | ] 738 | 739 | [[package]] 740 | name = "windows-core" 741 | version = "0.58.0" 742 | source = "registry+https://github.com/rust-lang/crates.io-index" 743 | checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" 744 | dependencies = [ 745 | "windows-implement", 746 | "windows-interface", 747 | "windows-result", 748 | "windows-strings", 749 | "windows-targets", 750 | ] 751 | 752 | [[package]] 753 | name = "windows-implement" 754 | version = "0.58.0" 755 | source = "registry+https://github.com/rust-lang/crates.io-index" 756 | checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" 757 | dependencies = [ 758 | "proc-macro2", 759 | "quote", 760 | "syn 2.0.72", 761 | ] 762 | 763 | [[package]] 764 | name = "windows-interface" 765 | version = "0.58.0" 766 | source = "registry+https://github.com/rust-lang/crates.io-index" 767 | checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" 768 | dependencies = [ 769 | "proc-macro2", 770 | "quote", 771 | "syn 2.0.72", 772 | ] 773 | 774 | [[package]] 775 | name = "windows-result" 776 | version = "0.2.0" 777 | source = "registry+https://github.com/rust-lang/crates.io-index" 778 | checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" 779 | dependencies = [ 780 | "windows-targets", 781 | ] 782 | 783 | [[package]] 784 | name = "windows-strings" 785 | version = "0.1.0" 786 | source = "registry+https://github.com/rust-lang/crates.io-index" 787 | checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" 788 | dependencies = [ 789 | "windows-result", 790 | "windows-targets", 791 | ] 792 | 793 | [[package]] 794 | name = "windows-sys" 795 | version = "0.52.0" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 798 | dependencies = [ 799 | "windows-targets", 800 | ] 801 | 802 | [[package]] 803 | name = "windows-targets" 804 | version = "0.52.6" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 807 | dependencies = [ 808 | "windows_aarch64_gnullvm", 809 | "windows_aarch64_msvc", 810 | "windows_i686_gnu", 811 | "windows_i686_gnullvm", 812 | "windows_i686_msvc", 813 | "windows_x86_64_gnu", 814 | "windows_x86_64_gnullvm", 815 | "windows_x86_64_msvc", 816 | ] 817 | 818 | [[package]] 819 | name = "windows_aarch64_gnullvm" 820 | version = "0.52.6" 821 | source = "registry+https://github.com/rust-lang/crates.io-index" 822 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 823 | 824 | [[package]] 825 | name = "windows_aarch64_msvc" 826 | version = "0.52.6" 827 | source = "registry+https://github.com/rust-lang/crates.io-index" 828 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 829 | 830 | [[package]] 831 | name = "windows_i686_gnu" 832 | version = "0.52.6" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 835 | 836 | [[package]] 837 | name = "windows_i686_gnullvm" 838 | version = "0.52.6" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 841 | 842 | [[package]] 843 | name = "windows_i686_msvc" 844 | version = "0.52.6" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 847 | 848 | [[package]] 849 | name = "windows_x86_64_gnu" 850 | version = "0.52.6" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 853 | 854 | [[package]] 855 | name = "windows_x86_64_gnullvm" 856 | version = "0.52.6" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 859 | 860 | [[package]] 861 | name = "windows_x86_64_msvc" 862 | version = "0.52.6" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 865 | -------------------------------------------------------------------------------- /src/defines/mod.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::wildcard_imports)] 2 | #![allow(clippy::enum_variant_names)] 3 | #![allow(clippy::too_many_lines)] 4 | #![allow(clippy::match_same_arms)] 5 | #![allow(non_camel_case_types)] 6 | #![allow(unreachable_patterns)] 7 | #![allow(missing_docs)] 8 | 9 | pub trait Define: std::ops::Deref { 10 | fn variants() -> &'static [Self; COUNT] 11 | where 12 | Self: Sized; 13 | } 14 | 15 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 16 | #[factorio_define(kind = u8)] 17 | pub enum inventory { 18 | #[value = 1] 19 | fuel, 20 | #[value = 6] 21 | burnt_result, 22 | #[value = 1] 23 | chest, 24 | #[value = 2] 25 | furnace_source, 26 | #[value = 3] 27 | furnace_result, 28 | #[value = 4] 29 | furnace_modules, 30 | #[value = 1] 31 | character_main, 32 | #[value = 3] 33 | character_guns, 34 | #[value = 4] 35 | character_ammo, 36 | #[value = 5] 37 | character_armor, 38 | #[value = 7] 39 | character_vehicle, 40 | #[value = 8] 41 | character_trash, 42 | #[value = 2] 43 | god_main, 44 | #[value = 1] 45 | editor_main, 46 | #[value = 3] 47 | editor_guns, 48 | #[value = 4] 49 | editor_ammo, 50 | #[value = 5] 51 | editor_armor, 52 | #[value = 1] 53 | roboport_robot, 54 | #[value = 2] 55 | roboport_material, 56 | #[value = 1] 57 | robot_cargo, 58 | #[value = 2] 59 | robot_repair, 60 | #[value = 2] 61 | assembling_machine_input, 62 | #[value = 3] 63 | assembling_machine_output, 64 | #[value = 4] 65 | assembling_machine_modules, 66 | #[value = 2] 67 | lab_input, 68 | #[value = 3] 69 | lab_modules, 70 | #[value = 2] 71 | mining_drill_modules, 72 | #[value = 1] 73 | item_main, 74 | #[value = 5] 75 | rocket_silo_rocket, 76 | #[value = 6] 77 | rocket_silo_result, 78 | #[value = 2] 79 | rocket_silo_input, 80 | #[value = 3] 81 | rocket_silo_output, 82 | #[value = 4] 83 | rocket_silo_modules, 84 | #[value = 1] 85 | rocket, 86 | #[value = 2] 87 | car_trunk, 88 | #[value = 3] 89 | car_ammo, 90 | #[value = 1] 91 | cargo_wagon, 92 | #[value = 1] 93 | turret_ammo, 94 | #[value = 1] 95 | beacon_modules, 96 | #[value = 1] 97 | character_corpse, 98 | #[value = 1] 99 | artillery_turret_ammo, 100 | #[value = 1] 101 | artillery_wagon_ammo, 102 | #[value = 2] 103 | spider_trunk, 104 | #[value = 3] 105 | spider_ammo, 106 | #[value = 4] 107 | spider_trash, 108 | } 109 | 110 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 111 | #[factorio_define(kind = u8)] 112 | pub enum transport_line { 113 | #[value = 1] 114 | left_line, 115 | #[value = 2] 116 | right_line, 117 | #[value = 3] 118 | left_underground_line, 119 | #[value = 4] 120 | right_underground_line, 121 | #[value = 3] 122 | secondary_left_line, 123 | #[value = 4] 124 | secondary_right_line, 125 | #[value = 5] 126 | left_split_line, 127 | #[value = 6] 128 | right_split_line, 129 | #[value = 7] 130 | secondary_left_split_line, 131 | #[value = 8] 132 | secondary_right_split_line, 133 | } 134 | 135 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 136 | #[factorio_define(kind = u8)] 137 | pub enum direction { 138 | #[value = 0] 139 | north, 140 | #[value = 1] 141 | northeast, 142 | #[value = 2] 143 | east, 144 | #[value = 3] 145 | southeast, 146 | #[value = 4] 147 | south, 148 | #[value = 5] 149 | southwest, 150 | #[value = 6] 151 | west, 152 | #[value = 7] 153 | northwest, 154 | } 155 | 156 | pub mod riding { 157 | use super::*; 158 | 159 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 160 | #[factorio_define(kind = u8)] 161 | pub enum acceleration { 162 | #[value = 0] 163 | nothing, 164 | #[value = 1] 165 | accelerating, 166 | #[value = 2] 167 | braking, 168 | #[value = 3] 169 | reversing, 170 | } 171 | 172 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 173 | #[factorio_define(kind = u8)] 174 | pub enum direction { 175 | #[value = 0] 176 | left, 177 | #[value = 1] 178 | straight, 179 | #[value = 2] 180 | right, 181 | } 182 | } 183 | 184 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 185 | #[factorio_define(kind = u8)] 186 | pub enum shooting { 187 | #[value = 0] 188 | not_shooting, 189 | #[value = 1] 190 | shooting_enemies, 191 | #[value = 2] 192 | shooting_selected, 193 | } 194 | 195 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 196 | #[factorio_define(kind = u8)] 197 | pub enum command { 198 | #[value = 1] 199 | attack, 200 | #[value = 2] 201 | go_to_location, 202 | #[value = 3] 203 | compound, 204 | #[value = 4] 205 | group, 206 | #[value = 5] 207 | attack_area, 208 | #[value = 6] 209 | wander, 210 | #[value = 8] 211 | flee, 212 | #[value = 9] 213 | stop, 214 | #[value = 7] 215 | build_base, 216 | } 217 | 218 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 219 | #[factorio_define(kind = u8)] 220 | pub enum distraction { 221 | #[value = 0] 222 | none, 223 | #[value = 1] 224 | by_enemy, 225 | #[value = 3] 226 | by_anything, 227 | #[value = 4] 228 | by_damage, 229 | } 230 | 231 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 232 | #[factorio_define(kind = u8)] 233 | pub enum compound_command { 234 | #[value = 0] 235 | logical_and, 236 | #[value = 1] 237 | logical_or, 238 | #[value = 2] 239 | return_last, 240 | } 241 | 242 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 243 | #[factorio_define(kind = u8)] 244 | pub enum difficulty { 245 | #[value = 0] 246 | easy, 247 | #[value = 1] 248 | normal, 249 | #[value = 2] 250 | hard, 251 | } 252 | 253 | pub mod difficulty_settings { 254 | use super::*; 255 | 256 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 257 | #[factorio_define(kind = u8)] 258 | pub enum recipe_difficulty { 259 | #[value = 0] 260 | normal, 261 | #[value = 1] 262 | expensive, 263 | } 264 | 265 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 266 | #[factorio_define(kind = u8)] 267 | pub enum technology_difficulty { 268 | #[value = 0] 269 | normal, 270 | #[value = 1] 271 | expensive, 272 | } 273 | } 274 | 275 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 276 | #[factorio_define(kind = u8)] 277 | pub enum events { 278 | #[value = 183] 279 | on_player_input_method_changed, 280 | #[value = 182] 281 | on_cutscene_finished, 282 | #[value = 181] 283 | on_cutscene_started, 284 | #[value = 180] 285 | on_entity_color_changed, 286 | #[value = 179] 287 | on_gui_leave, 288 | #[value = 178] 289 | on_gui_hover, 290 | #[value = 177] 291 | on_player_alt_reverse_selected_area, 292 | #[value = 176] 293 | on_player_reverse_selected_area, 294 | #[value = 175] 295 | on_equipment_removed, 296 | #[value = 174] 297 | on_equipment_inserted, 298 | #[value = 173] 299 | on_entity_logistic_slot_changed, 300 | #[value = 172] 301 | on_spider_command_completed, 302 | #[value = 171] 303 | on_player_used_spider_remote, 304 | #[value = 170] 305 | on_player_configured_spider_remote, 306 | #[value = 169] 307 | on_cutscene_cancelled, 308 | #[value = 168] 309 | on_permission_group_added, 310 | #[value = 167] 311 | on_permission_group_deleted, 312 | #[value = 166] 313 | on_pre_permission_group_deleted, 314 | #[value = 165] 315 | on_permission_string_imported, 316 | #[value = 164] 317 | on_pre_permission_string_imported, 318 | #[value = 163] 319 | on_permission_group_edited, 320 | #[value = 162] 321 | on_player_flushed_fluid, 322 | #[value = 161] 323 | on_player_clicked_gps_tag, 324 | #[value = 160] 325 | on_entity_destroyed, 326 | #[value = 159] 327 | on_script_inventory_resized, 328 | #[value = 158] 329 | on_pre_script_inventory_resized, 330 | #[value = 157] 331 | on_pre_player_toggled_map_editor, 332 | #[value = 156] 333 | on_player_set_quick_bar_slot, 334 | #[value = 155] 335 | on_script_trigger_effect, 336 | #[value = 154] 337 | on_string_translated, 338 | #[value = 153] 339 | on_force_cease_fire_changed, 340 | #[value = 152] 341 | on_force_friends_changed, 342 | #[value = 151] 343 | on_gui_switch_state_changed, 344 | #[value = 150] 345 | on_gui_selected_tab_changed, 346 | #[value = 149] 347 | on_gui_location_changed, 348 | #[value = 148] 349 | on_gui_confirmed, 350 | #[value = 147] 351 | on_chart_tag_removed, 352 | #[value = 146] 353 | on_chart_tag_modified, 354 | #[value = 145] 355 | on_chart_tag_added, 356 | #[value = 144] 357 | on_trigger_fired_artillery, 358 | #[value = 143] 359 | on_build_base_arrived, 360 | #[value = 142] 361 | on_unit_group_finished_gathering, 362 | #[value = 141] 363 | on_unit_removed_from_group, 364 | #[value = 140] 365 | on_unit_added_to_group, 366 | #[value = 139] 367 | on_unit_group_created, 368 | #[value = 138] 369 | on_pre_player_removed, 370 | #[value = 137] 371 | on_entity_spawned, 372 | #[value = 136] 373 | on_post_entity_died, 374 | #[value = 135] 375 | on_robot_exploded_cliff, 376 | #[value = 134] 377 | on_pre_robot_exploded_cliff, 378 | #[value = 133] 379 | on_pre_chunk_deleted, 380 | #[value = 132] 381 | on_player_fast_transferred, 382 | #[value = 131] 383 | on_player_repaired_entity, 384 | #[value = 130] 385 | on_player_toggled_alt_mode, 386 | #[value = 129] 387 | on_surface_renamed, 388 | #[value = 128] 389 | on_surface_imported, 390 | #[value = 127] 391 | on_game_created_from_scenario, 392 | #[value = 126] 393 | on_brush_cloned, 394 | #[value = 125] 395 | on_area_cloned, 396 | #[value = 124] 397 | on_entity_cloned, 398 | #[value = 123] 399 | on_player_toggled_map_editor, 400 | #[value = 122] 401 | on_cancelled_upgrade, 402 | #[value = 121] 403 | on_marked_for_upgrade, 404 | #[value = 120] 405 | on_ai_command_completed, 406 | #[value = 119] 407 | on_script_path_request_finished, 408 | #[value = 118] 409 | on_rocket_launch_ordered, 410 | #[value = 117] 411 | on_player_unbanned, 412 | #[value = 116] 413 | on_player_kicked, 414 | #[value = 115] 415 | on_player_banned, 416 | #[value = 114] 417 | on_train_schedule_changed, 418 | #[value = 113] 419 | on_chunk_deleted, 420 | #[value = 112] 421 | on_pre_surface_cleared, 422 | #[value = 111] 423 | on_surface_cleared, 424 | #[value = 110] 425 | on_pre_player_left_game, 426 | #[value = 109] 427 | on_player_trash_inventory_changed, 428 | #[value = 108] 429 | on_forces_merged, 430 | #[value = 107] 431 | on_land_mine_armed, 432 | #[value = 106] 433 | on_force_reset, 434 | #[value = 105] 435 | on_technology_effects_reset, 436 | #[value = 104] 437 | on_chunk_charted, 438 | #[value = 103] 439 | on_entity_damaged, 440 | #[value = 102] 441 | on_player_cancelled_crafting, 442 | #[value = 101] 443 | on_pre_player_crafted_item, 444 | #[value = 100] 445 | on_player_display_scale_changed, 446 | #[value = 99] 447 | on_player_display_resolution_changed, 448 | #[value = 98] 449 | on_player_pipette, 450 | #[value = 97] 451 | on_pre_ghost_upgraded, 452 | #[value = 96] 453 | on_pre_ghost_deconstructed, 454 | #[value = 95] 455 | on_character_corpse_expired, 456 | #[value = 94] 457 | on_player_cheat_mode_disabled, 458 | #[value = 93] 459 | on_player_cheat_mode_enabled, 460 | #[value = 92] 461 | on_player_unmuted, 462 | #[value = 91] 463 | on_player_muted, 464 | #[value = 90] 465 | on_gui_value_changed, 466 | #[value = 89] 467 | on_gui_closed, 468 | #[value = 88] 469 | on_gui_opened, 470 | #[value = 87] 471 | on_mod_item_opened, 472 | #[value = 86] 473 | on_player_changed_position, 474 | #[value = 85] 475 | on_worker_robot_expired, 476 | #[value = 84] 477 | on_combat_robot_expired, 478 | #[value = 83] 479 | script_raised_set_tiles, 480 | #[value = 82] 481 | script_raised_teleported, 482 | #[value = 81] 483 | script_raised_revive, 484 | #[value = 80] 485 | script_raised_destroy, 486 | #[value = 79] 487 | script_raised_built, 488 | #[value = 78] 489 | on_player_demoted, 490 | #[value = 77] 491 | on_player_promoted, 492 | #[value = 76] 493 | on_player_used_capsule, 494 | #[value = 75] 495 | on_player_removed, 496 | #[value = 74] 497 | on_console_command, 498 | #[value = 73] 499 | on_console_chat, 500 | #[value = 72] 501 | on_player_configured_blueprint, 502 | #[value = 71] 503 | on_player_deconstructed_area, 504 | #[value = 70] 505 | on_player_setup_blueprint, 506 | #[value = 69] 507 | on_gui_elem_changed, 508 | #[value = 68] 509 | on_train_created, 510 | #[value = 67] 511 | on_player_mined_entity, 512 | #[value = 66] 513 | on_robot_mined_entity, 514 | #[value = 65] 515 | on_pre_surface_deleted, 516 | #[value = 64] 517 | on_surface_deleted, 518 | #[value = 63] 519 | on_surface_created, 520 | #[value = 62] 521 | on_difficulty_settings_changed, 522 | #[value = 61] 523 | on_runtime_mod_setting_changed, 524 | #[value = 60] 525 | on_gui_selection_state_changed, 526 | #[value = 59] 527 | on_entity_renamed, 528 | #[value = 58] 529 | on_player_changed_force, 530 | #[value = 57] 531 | on_biter_base_built, 532 | #[value = 56] 533 | on_player_dropped_item, 534 | #[value = 55] 535 | on_market_item_purchased, 536 | #[value = 54] 537 | on_selected_entity_changed, 538 | #[value = 53] 539 | on_player_changed_surface, 540 | #[value = 52] 541 | on_player_alt_selected_area, 542 | #[value = 51] 543 | on_player_selected_area, 544 | #[value = 50] 545 | on_robot_mined_tile, 546 | #[value = 49] 547 | on_robot_built_tile, 548 | #[value = 48] 549 | on_player_mined_tile, 550 | #[value = 47] 551 | on_player_built_tile, 552 | #[value = 46] 553 | on_player_left_game, 554 | #[value = 45] 555 | on_player_joined_game, 556 | #[value = 44] 557 | on_player_respawned, 558 | #[value = 43] 559 | on_player_died, 560 | #[value = 42] 561 | on_pre_player_died, 562 | #[value = 41] 563 | on_player_removed_equipment, 564 | #[value = 40] 565 | on_player_placed_equipment, 566 | #[value = 39] 567 | on_player_gun_inventory_changed, 568 | #[value = 38] 569 | on_player_ammo_inventory_changed, 570 | #[value = 37] 571 | on_player_armor_inventory_changed, 572 | #[value = 36] 573 | on_lua_shortcut, 574 | #[value = 35] 575 | on_cutscene_waypoint_reached, 576 | #[value = 34] 577 | on_player_main_inventory_changed, 578 | #[value = 33] 579 | on_entity_settings_pasted, 580 | #[value = 32] 581 | on_pre_entity_settings_pasted, 582 | #[value = 31] 583 | on_player_cursor_stack_changed, 584 | #[value = 30] 585 | on_forces_merging, 586 | #[value = 29] 587 | on_force_created, 588 | #[value = 28] 589 | on_player_driving_changed_state, 590 | #[value = 27] 591 | on_resource_depleted, 592 | #[value = 26] 593 | on_player_created, 594 | #[value = 25] 595 | on_train_changed_state, 596 | #[value = 24] 597 | on_trigger_created_entity, 598 | #[value = 23] 599 | on_cancelled_deconstruction, 600 | #[value = 22] 601 | on_marked_for_deconstruction, 602 | #[value = 21] 603 | on_player_rotated_entity, 604 | #[value = 20] 605 | on_research_cancelled, 606 | #[value = 19] 607 | on_research_reversed, 608 | #[value = 18] 609 | on_research_finished, 610 | #[value = 17] 611 | on_research_started, 612 | #[value = 16] 613 | on_robot_mined, 614 | #[value = 15] 615 | on_robot_pre_mined, 616 | #[value = 14] 617 | on_robot_built_entity, 618 | #[value = 13] 619 | on_player_crafted_item, 620 | #[value = 12] 621 | on_chunk_generated, 622 | #[value = 11] 623 | on_pre_player_mined_item, 624 | #[value = 10] 625 | on_rocket_launched, 626 | #[value = 9] 627 | on_pre_build, 628 | #[value = 8] 629 | on_player_mined_item, 630 | #[value = 7] 631 | on_sector_scanned, 632 | #[value = 6] 633 | on_built_entity, 634 | #[value = 5] 635 | on_picked_up_item, 636 | #[value = 4] 637 | on_entity_died, 638 | #[value = 3] 639 | on_gui_checked_state_changed, 640 | #[value = 2] 641 | on_gui_text_changed, 642 | #[value = 1] 643 | on_gui_click, 644 | #[value = 0] 645 | on_tick, 646 | } 647 | 648 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 649 | #[factorio_define(kind = u8)] 650 | pub enum controllers { 651 | #[value = 0] 652 | ghost, 653 | #[value = 1] 654 | character, 655 | #[value = 2] 656 | god, 657 | #[value = 4] 658 | editor, 659 | #[value = 6] 660 | cutscene, 661 | #[value = 5] 662 | spectator, 663 | } 664 | 665 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 666 | #[factorio_define(kind = u8)] 667 | pub enum group_state { 668 | #[value = 0] 669 | gathering, 670 | #[value = 1] 671 | moving, 672 | #[value = 2] 673 | attacking_distraction, 674 | #[value = 3] 675 | attacking_target, 676 | #[value = 4] 677 | finished, 678 | #[value = 5] 679 | pathfinding, 680 | #[value = 6] 681 | wander_in_group, 682 | } 683 | 684 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 685 | #[factorio_define(kind = u8)] 686 | pub enum wire_type { 687 | #[value = 2] 688 | red, 689 | #[value = 3] 690 | green, 691 | #[value = 1] 692 | copper, 693 | } 694 | 695 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 696 | #[factorio_define(kind = u8)] 697 | pub enum circuit_connector_id { 698 | #[value = 1] 699 | accumulator, 700 | #[value = 1] 701 | constant_combinator, 702 | #[value = 1] 703 | container, 704 | #[value = 1] 705 | linked_container, 706 | #[value = 1] 707 | programmable_speaker, 708 | #[value = 1] 709 | rail_signal, 710 | #[value = 1] 711 | rail_chain_signal, 712 | #[value = 1] 713 | roboport, 714 | #[value = 1] 715 | storage_tank, 716 | #[value = 1] 717 | wall, 718 | #[value = 1] 719 | electric_pole, 720 | #[value = 1] 721 | inserter, 722 | #[value = 1] 723 | lamp, 724 | #[value = 1] 725 | combinator_input, 726 | #[value = 2] 727 | combinator_output, 728 | #[value = 1] 729 | offshore_pump, 730 | #[value = 1] 731 | pump, 732 | } 733 | 734 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 735 | #[factorio_define(kind = u8)] 736 | pub enum circuit_condition_index { 737 | #[value = 1] 738 | inserter_circuit, 739 | #[value = 2] 740 | inserter_logistic, 741 | #[value = 1] 742 | lamp, 743 | #[value = 1] 744 | arithmetic_combinator, 745 | #[value = 1] 746 | decider_combinator, 747 | #[value = 1] 748 | constant_combinator, 749 | #[value = 1] 750 | offshore_pump, 751 | #[value = 1] 752 | pump, 753 | } 754 | 755 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 756 | #[factorio_define(kind = u8)] 757 | pub enum wire_connection_id { 758 | #[value = 0] 759 | electric_pole, 760 | #[value = 0] 761 | power_switch_left, 762 | #[value = 1] 763 | power_switch_right, 764 | } 765 | 766 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 767 | #[factorio_define(kind = u8)] 768 | pub enum train_state { 769 | #[value = 0] 770 | on_the_path, 771 | #[value = 1] 772 | path_lost, 773 | #[value = 2] 774 | no_schedule, 775 | #[value = 3] 776 | no_path, 777 | #[value = 4] 778 | arrive_signal, 779 | #[value = 5] 780 | wait_signal, 781 | #[value = 6] 782 | arrive_station, 783 | #[value = 7] 784 | wait_station, 785 | #[value = 8] 786 | manual_control_stop, 787 | #[value = 9] 788 | manual_control, 789 | #[value = 10] 790 | destination_full, 791 | } 792 | 793 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 794 | #[factorio_define(kind = u8)] 795 | pub enum signal_state { 796 | #[value = 0] 797 | open, 798 | #[value = 1] 799 | closed, 800 | #[value = 2] 801 | reserved, 802 | #[value = 3] 803 | reserved_by_circuit_network, 804 | } 805 | 806 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 807 | #[factorio_define(kind = u8)] 808 | pub enum chain_signal_state { 809 | #[value = 0] 810 | none, 811 | #[value = 1] 812 | all_open, 813 | #[value = 2] 814 | partially_open, 815 | #[value = 3] 816 | none_open, 817 | } 818 | 819 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 820 | #[factorio_define(kind = u8)] 821 | pub enum rail_direction { 822 | #[value = 0] 823 | front, 824 | #[value = 1] 825 | back, 826 | } 827 | 828 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 829 | #[factorio_define(kind = u8)] 830 | pub enum rail_connection_direction { 831 | #[value = 0] 832 | left, 833 | #[value = 1] 834 | straight, 835 | #[value = 2] 836 | right, 837 | #[value = 3] 838 | none, 839 | } 840 | 841 | pub mod control_behavior { 842 | use super::*; 843 | 844 | pub mod inserter { 845 | use super::*; 846 | 847 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 848 | #[factorio_define(kind = u8)] 849 | pub enum circuit_mode_of_operation { 850 | #[value = 3] 851 | none, 852 | #[value = 0] 853 | enable_disable, 854 | #[value = 1] 855 | set_filters, 856 | #[value = 2] 857 | read_hand_contents, 858 | #[value = 4] 859 | set_stack_size, 860 | } 861 | 862 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 863 | #[factorio_define(kind = u8)] 864 | pub enum hand_read_mode { 865 | #[value = 1] 866 | hold, 867 | #[value = 0] 868 | pulse, 869 | } 870 | } 871 | pub mod logistic_container { 872 | use super::*; 873 | 874 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 875 | #[factorio_define(kind = u8)] 876 | pub enum circuit_mode_of_operation { 877 | #[value = 0] 878 | send_contents, 879 | #[value = 1] 880 | set_requests, 881 | } 882 | } 883 | pub mod lamp { 884 | use super::*; 885 | 886 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 887 | #[factorio_define(kind = u8)] 888 | pub enum circuit_mode_of_operation { 889 | #[value = 0] 890 | use_colors, 891 | } 892 | } 893 | pub mod mining_drill { 894 | use super::*; 895 | 896 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 897 | #[factorio_define(kind = u8)] 898 | pub enum resource_read_mode { 899 | #[value = 0] 900 | this_miner, 901 | #[value = 1] 902 | entire_patch, 903 | } 904 | } 905 | pub mod transport_belt { 906 | use super::*; 907 | 908 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 909 | #[factorio_define(kind = u8)] 910 | pub enum content_read_mode { 911 | #[value = 0] 912 | pulse, 913 | #[value = 1] 914 | hold, 915 | } 916 | } 917 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 918 | #[factorio_define(kind = u8)] 919 | pub enum r#type { 920 | #[value = 1] 921 | container, 922 | #[value = 2] 923 | generic_on_off, 924 | #[value = 3] 925 | inserter, 926 | #[value = 4] 927 | lamp, 928 | #[value = 5] 929 | logistic_container, 930 | #[value = 6] 931 | roboport, 932 | #[value = 7] 933 | storage_tank, 934 | #[value = 8] 935 | train_stop, 936 | #[value = 9] 937 | decider_combinator, 938 | #[value = 10] 939 | arithmetic_combinator, 940 | #[value = 11] 941 | constant_combinator, 942 | #[value = 12] 943 | transport_belt, 944 | #[value = 13] 945 | accumulator, 946 | #[value = 14] 947 | rail_signal, 948 | #[value = 18] 949 | rail_chain_signal, 950 | #[value = 15] 951 | wall, 952 | #[value = 16] 953 | mining_drill, 954 | #[value = 17] 955 | programmable_speaker, 956 | } 957 | } 958 | 959 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 960 | #[factorio_define(kind = u8)] 961 | pub enum chunk_generated_status { 962 | #[value = 0] 963 | nothing, 964 | #[value = 10] 965 | custom_tiles, 966 | #[value = 20] 967 | basic_tiles, 968 | #[value = 30] 969 | corrected_tiles, 970 | #[value = 40] 971 | tiles, 972 | #[value = 50] 973 | entities, 974 | } 975 | 976 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 977 | #[factorio_define(kind = u8)] 978 | pub enum logistic_mode { 979 | #[value = 0] 980 | none, 981 | #[value = 1] 982 | active_provider, 983 | #[value = 2] 984 | storage, 985 | #[value = 3] 986 | requester, 987 | #[value = 4] 988 | passive_provider, 989 | #[value = 5] 990 | buffer, 991 | } 992 | 993 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 994 | #[factorio_define(kind = u8)] 995 | pub enum logistic_member_index { 996 | #[value = 0] 997 | logistic_container, 998 | #[value = 1] 999 | vehicle_storage, 1000 | #[value = 0] 1001 | character_requester, 1002 | #[value = 1] 1003 | character_storage, 1004 | #[value = 2] 1005 | character_provider, 1006 | #[value = 0] 1007 | generic_on_off_behavior, 1008 | } 1009 | 1010 | pub mod deconstruction_item { 1011 | use super::*; 1012 | 1013 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1014 | #[factorio_define(kind = u8)] 1015 | pub enum entity_filter_mode { 1016 | #[value = 0] 1017 | whitelist, 1018 | #[value = 1] 1019 | blacklist, 1020 | } 1021 | 1022 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1023 | #[factorio_define(kind = u8)] 1024 | pub enum tile_filter_mode { 1025 | #[value = 0] 1026 | whitelist, 1027 | #[value = 1] 1028 | blacklist, 1029 | } 1030 | 1031 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1032 | #[factorio_define(kind = u8)] 1033 | pub enum tile_selection_mode { 1034 | #[value = 0] 1035 | normal, 1036 | #[value = 1] 1037 | always, 1038 | #[value = 2] 1039 | never, 1040 | #[value = 3] 1041 | only, 1042 | } 1043 | } 1044 | 1045 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1046 | #[factorio_define(kind = u8)] 1047 | pub enum alert_type { 1048 | #[value = 0] 1049 | entity_destroyed, 1050 | #[value = 1] 1051 | entity_under_attack, 1052 | #[value = 2] 1053 | not_enough_construction_robots, 1054 | #[value = 3] 1055 | no_material_for_construction, 1056 | #[value = 4] 1057 | not_enough_repair_packs, 1058 | #[value = 5] 1059 | turret_fire, 1060 | #[value = 6] 1061 | custom, 1062 | #[value = 7] 1063 | no_storage, 1064 | #[value = 8] 1065 | train_out_of_fuel, 1066 | } 1067 | 1068 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1069 | #[factorio_define(kind = u8)] 1070 | pub enum mouse_button_type { 1071 | #[value = 1] 1072 | none, 1073 | #[value = 2] 1074 | left, 1075 | #[value = 4] 1076 | right, 1077 | #[value = 8] 1078 | middle, 1079 | } 1080 | 1081 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1082 | #[factorio_define(kind = u8)] 1083 | pub enum input_action { 1084 | #[value = 45] 1085 | activate_copy, 1086 | #[value = 46] 1087 | activate_cut, 1088 | #[value = 47] 1089 | activate_paste, 1090 | #[value = 227] 1091 | add_permission_group, 1092 | #[value = 96] 1093 | add_train_station, 1094 | #[value = 195] 1095 | admin_action, 1096 | #[value = 164] 1097 | alt_reverse_select_area, 1098 | #[value = 162] 1099 | alt_select_area, 1100 | #[value = 121] 1101 | alt_select_blueprint_entities, 1102 | #[value = 119] 1103 | alternative_copy, 1104 | #[value = 2] 1105 | begin_mining, 1106 | #[value = 62] 1107 | begin_mining_terrain, 1108 | #[value = 60] 1109 | build, 1110 | #[value = 159] 1111 | build_rail, 1112 | #[value = 152] 1113 | build_terrain, 1114 | #[value = 83] 1115 | cancel_craft, 1116 | #[value = 144] 1117 | cancel_deconstruct, 1118 | #[value = 18] 1119 | cancel_new_blueprint, 1120 | #[value = 160] 1121 | cancel_research, 1122 | #[value = 145] 1123 | cancel_upgrade, 1124 | #[value = 100] 1125 | change_active_character_tab, 1126 | #[value = 98] 1127 | change_active_item_group_for_crafting, 1128 | #[value = 99] 1129 | change_active_item_group_for_filters, 1130 | #[value = 231] 1131 | change_active_quick_bar, 1132 | #[value = 146] 1133 | change_arithmetic_combinator_parameters, 1134 | #[value = 147] 1135 | change_decider_combinator_parameters, 1136 | #[value = 158] 1137 | change_entity_label, 1138 | #[value = 157] 1139 | change_item_description, 1140 | #[value = 156] 1141 | change_item_label, 1142 | #[value = 194] 1143 | change_multiplayer_config, 1144 | #[value = 199] 1145 | change_picking_state, 1146 | #[value = 149] 1147 | change_programmable_speaker_alert_parameters, 1148 | #[value = 150] 1149 | change_programmable_speaker_circuit_parameters, 1150 | #[value = 148] 1151 | change_programmable_speaker_parameters, 1152 | #[value = 63] 1153 | change_riding_state, 1154 | #[value = 77] 1155 | change_shooting_state, 1156 | #[value = 97] 1157 | change_train_stop_station, 1158 | #[value = 153] 1159 | change_train_wait_condition, 1160 | #[value = 154] 1161 | change_train_wait_condition_data, 1162 | #[value = 12] 1163 | clear_cursor, 1164 | #[value = 9] 1165 | connect_rolling_stock, 1166 | #[value = 118] 1167 | copy, 1168 | #[value = 20] 1169 | copy_entity_settings, 1170 | #[value = 124] 1171 | copy_opened_blueprint, 1172 | #[value = 23] 1173 | copy_opened_item, 1174 | #[value = 75] 1175 | craft, 1176 | #[value = 71] 1177 | cursor_split, 1178 | #[value = 70] 1179 | cursor_transfer, 1180 | #[value = 155] 1181 | custom_input, 1182 | #[value = 33] 1183 | cycle_blueprint_book_backwards, 1184 | #[value = 32] 1185 | cycle_blueprint_book_forwards, 1186 | #[value = 116] 1187 | deconstruct, 1188 | #[value = 43] 1189 | delete_blueprint_library, 1190 | #[value = 129] 1191 | delete_blueprint_record, 1192 | #[value = 225] 1193 | delete_custom_tag, 1194 | #[value = 226] 1195 | delete_permission_group, 1196 | #[value = 67] 1197 | destroy_item, 1198 | #[value = 22] 1199 | destroy_opened_item, 1200 | #[value = 10] 1201 | disconnect_rolling_stock, 1202 | #[value = 180] 1203 | drag_train_schedule, 1204 | #[value = 181] 1205 | drag_train_wait_condition, 1206 | #[value = 128] 1207 | drop_blueprint_record, 1208 | #[value = 59] 1209 | drop_item, 1210 | #[value = 137] 1211 | edit_blueprint_tool_preview, 1212 | #[value = 172] 1213 | edit_custom_tag, 1214 | #[value = 173] 1215 | edit_permission_group, 1216 | #[value = 139] 1217 | export_blueprint, 1218 | #[value = 215] 1219 | fast_entity_split, 1220 | #[value = 213] 1221 | fast_entity_transfer, 1222 | #[value = 54] 1223 | flush_opened_entity_fluid, 1224 | #[value = 198] 1225 | flush_opened_entity_specific_fluid, 1226 | #[value = 240] 1227 | go_to_train_station, 1228 | #[value = 127] 1229 | grab_blueprint_record, 1230 | #[value = 102] 1231 | gui_checked_state_changed, 1232 | #[value = 92] 1233 | gui_click, 1234 | #[value = 93] 1235 | gui_confirmed, 1236 | #[value = 178] 1237 | gui_elem_changed, 1238 | #[value = 249] 1239 | gui_hover, 1240 | #[value = 250] 1241 | gui_leave, 1242 | #[value = 107] 1243 | gui_location_changed, 1244 | #[value = 104] 1245 | gui_selected_tab_changed, 1246 | #[value = 103] 1247 | gui_selection_state_changed, 1248 | #[value = 106] 1249 | gui_switch_state_changed, 1250 | #[value = 101] 1251 | gui_text_changed, 1252 | #[value = 105] 1253 | gui_value_changed, 1254 | #[value = 140] 1255 | import_blueprint, 1256 | #[value = 174] 1257 | import_blueprint_string, 1258 | #[value = 141] 1259 | import_blueprints_filtered, 1260 | #[value = 175] 1261 | import_permissions_string, 1262 | #[value = 82] 1263 | inventory_split, 1264 | #[value = 73] 1265 | inventory_transfer, 1266 | #[value = 15] 1267 | launch_rocket, 1268 | #[value = 196] 1269 | lua_shortcut, 1270 | #[value = 191] 1271 | map_editor_action, 1272 | #[value = 95] 1273 | market_offer, 1274 | #[value = 170] 1275 | mod_settings_changed, 1276 | #[value = 31] 1277 | open_achievements_gui, 1278 | #[value = 57] 1279 | open_blueprint_library_gui, 1280 | #[value = 126] 1281 | open_blueprint_record, 1282 | #[value = 29] 1283 | open_bonus_gui, 1284 | #[value = 7] 1285 | open_character_gui, 1286 | #[value = 8] 1287 | open_current_vehicle_gui, 1288 | #[value = 69] 1289 | open_equipment, 1290 | #[value = 5] 1291 | open_gui, 1292 | #[value = 64] 1293 | open_item, 1294 | #[value = 40] 1295 | open_logistic_gui, 1296 | #[value = 68] 1297 | open_mod_item, 1298 | #[value = 65] 1299 | open_parent_of_opened_item, 1300 | #[value = 16] 1301 | open_production_gui, 1302 | #[value = 14] 1303 | open_technology_gui, 1304 | #[value = 56] 1305 | open_tips_and_tricks_gui, 1306 | #[value = 221] 1307 | open_train_gui, 1308 | #[value = 238] 1309 | open_train_station_gui, 1310 | #[value = 30] 1311 | open_trains_gui, 1312 | #[value = 21] 1313 | paste_entity_settings, 1314 | #[value = 108] 1315 | place_equipment, 1316 | #[value = 188] 1317 | quick_bar_pick_slot, 1318 | #[value = 189] 1319 | quick_bar_set_selected_page, 1320 | #[value = 187] 1321 | quick_bar_set_slot, 1322 | #[value = 125] 1323 | reassign_blueprint, 1324 | #[value = 138] 1325 | remove_cables, 1326 | #[value = 239] 1327 | remove_train_station, 1328 | #[value = 13] 1329 | reset_assembling_machine, 1330 | #[value = 66] 1331 | reset_item, 1332 | #[value = 163] 1333 | reverse_select_area, 1334 | #[value = 214] 1335 | rotate_entity, 1336 | #[value = 161] 1337 | select_area, 1338 | #[value = 120] 1339 | select_blueprint_entities, 1340 | #[value = 183] 1341 | select_entity_slot, 1342 | #[value = 182] 1343 | select_item, 1344 | #[value = 185] 1345 | select_mapper_slot, 1346 | #[value = 41] 1347 | select_next_valid_gun, 1348 | #[value = 184] 1349 | select_tile_slot, 1350 | #[value = 111] 1351 | send_spidertron, 1352 | #[value = 207] 1353 | set_auto_launch_rocket, 1354 | #[value = 204] 1355 | set_autosort_inventory, 1356 | #[value = 212] 1357 | set_behavior_mode, 1358 | #[value = 229] 1359 | set_car_weapons_control, 1360 | #[value = 86] 1361 | set_circuit_condition, 1362 | #[value = 91] 1363 | set_circuit_mode_of_operation, 1364 | #[value = 166] 1365 | set_controller_logistic_trash_filter_item, 1366 | #[value = 224] 1367 | set_deconstruction_item_tile_selection_mode, 1368 | #[value = 223] 1369 | set_deconstruction_item_trees_and_rocks_only, 1370 | #[value = 222] 1371 | set_entity_color, 1372 | #[value = 171] 1373 | set_entity_energy_property, 1374 | #[value = 167] 1375 | set_entity_logistic_trash_filter_item, 1376 | #[value = 84] 1377 | set_filter, 1378 | #[value = 205] 1379 | set_flat_controller_gui, 1380 | #[value = 237] 1381 | set_heat_interface_mode, 1382 | #[value = 236] 1383 | set_heat_interface_temperature, 1384 | #[value = 168] 1385 | set_infinity_container_filter_item, 1386 | #[value = 228] 1387 | set_infinity_container_remove_unfiltered_items, 1388 | #[value = 169] 1389 | set_infinity_pipe_filter, 1390 | #[value = 220] 1391 | set_inserter_max_stack_size, 1392 | #[value = 113] 1393 | set_inventory_bar, 1394 | #[value = 248] 1395 | set_linked_container_link_i_d, 1396 | #[value = 89] 1397 | set_logistic_filter_item, 1398 | #[value = 90] 1399 | set_logistic_filter_signal, 1400 | #[value = 244] 1401 | set_player_color, 1402 | #[value = 206] 1403 | set_recipe_notifications, 1404 | #[value = 230] 1405 | set_request_from_buffers, 1406 | #[value = 219] 1407 | set_research_finished_stops_game, 1408 | #[value = 87] 1409 | set_signal, 1410 | #[value = 234] 1411 | set_splitter_priority, 1412 | #[value = 216] 1413 | set_train_stopped, 1414 | #[value = 246] 1415 | set_trains_limit, 1416 | #[value = 151] 1417 | set_vehicle_automatic_targeting_parameters, 1418 | #[value = 78] 1419 | setup_assembling_machine, 1420 | #[value = 122] 1421 | setup_blueprint, 1422 | #[value = 123] 1423 | setup_single_blueprint_record, 1424 | #[value = 80] 1425 | smart_pipette, 1426 | #[value = 132] 1427 | spawn_item, 1428 | #[value = 81] 1429 | stack_split, 1430 | #[value = 72] 1431 | stack_transfer, 1432 | #[value = 115] 1433 | start_repair, 1434 | #[value = 88] 1435 | start_research, 1436 | #[value = 61] 1437 | start_walking, 1438 | #[value = 53] 1439 | stop_building_by_moving, 1440 | #[value = 211] 1441 | switch_connect_to_logistic_network, 1442 | #[value = 208] 1443 | switch_constant_combinator_state, 1444 | #[value = 210] 1445 | switch_inserter_filter_mode_state, 1446 | #[value = 209] 1447 | switch_power_switch_state, 1448 | #[value = 28] 1449 | switch_to_rename_stop_gui, 1450 | #[value = 109] 1451 | take_equipment, 1452 | #[value = 38] 1453 | toggle_deconstruction_item_entity_filter_mode, 1454 | #[value = 39] 1455 | toggle_deconstruction_item_tile_filter_mode, 1456 | #[value = 4] 1457 | toggle_driving, 1458 | #[value = 37] 1459 | toggle_enable_vehicle_logistics_while_moving, 1460 | #[value = 52] 1461 | toggle_entity_logistic_requests, 1462 | #[value = 50] 1463 | toggle_equipment_movement_bonus, 1464 | #[value = 42] 1465 | toggle_map_editor, 1466 | #[value = 51] 1467 | toggle_personal_logistic_requests, 1468 | #[value = 49] 1469 | toggle_personal_roboport, 1470 | #[value = 24] 1471 | toggle_show_entity_info, 1472 | #[value = 197] 1473 | translate_string, 1474 | #[value = 48] 1475 | undo, 1476 | #[value = 117] 1477 | upgrade, 1478 | #[value = 131] 1479 | upgrade_opened_blueprint_by_item, 1480 | #[value = 130] 1481 | upgrade_opened_blueprint_by_record, 1482 | #[value = 112] 1483 | use_artillery_remote, 1484 | #[value = 110] 1485 | use_item, 1486 | #[value = 76] 1487 | wire_dragging, 1488 | #[value = 94] 1489 | write_to_console, 1490 | } 1491 | 1492 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1493 | #[factorio_define(kind = u8)] 1494 | pub enum build_check_type { 1495 | #[value = 0] 1496 | script, 1497 | #[value = 1] 1498 | manual, 1499 | #[value = 3] 1500 | manual_ghost, 1501 | #[value = 2] 1502 | script_ghost, 1503 | #[value = 4] 1504 | blueprint_ghost, 1505 | #[value = 5] 1506 | ghost_revive, 1507 | } 1508 | 1509 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1510 | #[factorio_define(kind = u8)] 1511 | pub enum gui_type { 1512 | #[value = 0] 1513 | none, 1514 | #[value = 1] 1515 | entity, 1516 | #[value = 2] 1517 | research, 1518 | #[value = 3] 1519 | controller, 1520 | #[value = 4] 1521 | production, 1522 | #[value = 5] 1523 | item, 1524 | #[value = 6] 1525 | bonus, 1526 | #[value = 7] 1527 | trains, 1528 | #[value = 8] 1529 | achievement, 1530 | #[value = 9] 1531 | blueprint_library, 1532 | #[value = 10] 1533 | equipment, 1534 | #[value = 11] 1535 | logistic, 1536 | #[value = 12] 1537 | other_player, 1538 | #[value = 14] 1539 | permissions, 1540 | #[value = 15] 1541 | tutorials, 1542 | #[value = 16] 1543 | custom, 1544 | #[value = 17] 1545 | server_management, 1546 | #[value = 18] 1547 | player_management, 1548 | #[value = 19] 1549 | tile, 1550 | #[value = 23] 1551 | script_inventory, 1552 | } 1553 | 1554 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1555 | #[factorio_define(kind = u8)] 1556 | pub enum behavior_result { 1557 | #[value = 0] 1558 | in_progress, 1559 | #[value = 1] 1560 | fail, 1561 | #[value = 2] 1562 | success, 1563 | #[value = 3] 1564 | deleted, 1565 | } 1566 | 1567 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1568 | #[factorio_define(kind = u8)] 1569 | pub enum flow_precision_index { 1570 | #[value = 0] 1571 | five_seconds, 1572 | #[value = 1] 1573 | one_minute, 1574 | #[value = 2] 1575 | ten_minutes, 1576 | #[value = 3] 1577 | one_hour, 1578 | #[value = 4] 1579 | ten_hours, 1580 | #[value = 5] 1581 | fifty_hours, 1582 | #[value = 6] 1583 | two_hundred_fifty_hours, 1584 | #[value = 7] 1585 | one_thousand_hours, 1586 | } 1587 | 1588 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1589 | #[factorio_define(kind = u8)] 1590 | pub enum entity_status { 1591 | #[value = 1] 1592 | working, 1593 | #[value = 2] 1594 | normal, 1595 | #[value = 38] 1596 | no_power, 1597 | #[value = 12] 1598 | low_power, 1599 | #[value = 37] 1600 | no_fuel, 1601 | #[value = 39] 1602 | disabled_by_control_behavior, 1603 | #[value = 41] 1604 | opened_by_circuit_network, 1605 | #[value = 40] 1606 | closed_by_circuit_network, 1607 | #[value = 42] 1608 | disabled_by_script, 1609 | #[value = 44] 1610 | marked_for_deconstruction, 1611 | #[value = 3] 1612 | not_plugged_in_electric_network, 1613 | #[value = 4] 1614 | networks_connected, 1615 | #[value = 5] 1616 | networks_disconnected, 1617 | #[value = 6] 1618 | charging, 1619 | #[value = 7] 1620 | discharging, 1621 | #[value = 8] 1622 | fully_charged, 1623 | #[value = 13] 1624 | out_of_logistic_network, 1625 | #[value = 15] 1626 | no_recipe, 1627 | #[value = 14] 1628 | no_ingredients, 1629 | #[value = 19] 1630 | no_input_fluid, 1631 | #[value = 16] 1632 | no_research_in_progress, 1633 | #[value = 17] 1634 | no_minable_resources, 1635 | #[value = 18] 1636 | low_input_fluid, 1637 | #[value = 20] 1638 | fluid_ingredient_shortage, 1639 | #[value = 22] 1640 | full_output, 1641 | #[value = 23] 1642 | full_burnt_result_output, 1643 | #[value = 21] 1644 | item_ingredient_shortage, 1645 | #[value = 24] 1646 | missing_required_fluid, 1647 | #[value = 25] 1648 | missing_science_packs, 1649 | #[value = 26] 1650 | waiting_for_source_items, 1651 | #[value = 27] 1652 | waiting_for_space_in_destination, 1653 | #[value = 28] 1654 | preparing_rocket_for_launch, 1655 | #[value = 29] 1656 | waiting_to_launch_rocket, 1657 | #[value = 30] 1658 | launching_rocket, 1659 | #[value = 31] 1660 | no_modules_to_transmit, 1661 | #[value = 32] 1662 | recharging_after_power_outage, 1663 | #[value = 33] 1664 | waiting_for_target_to_be_built, 1665 | #[value = 34] 1666 | waiting_for_train, 1667 | #[value = 35] 1668 | no_ammo, 1669 | #[value = 36] 1670 | low_temperature, 1671 | #[value = 43] 1672 | disabled, 1673 | #[value = 9] 1674 | turned_off_during_daytime, 1675 | #[value = 11] 1676 | not_connected_to_rail, 1677 | #[value = 10] 1678 | cant_divide_segments, 1679 | } 1680 | 1681 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1682 | #[factorio_define(kind = u8)] 1683 | pub enum rocket_silo_status { 1684 | #[value = 0] 1685 | building_rocket, 1686 | #[value = 1] 1687 | create_rocket, 1688 | #[value = 2] 1689 | lights_blinking_open, 1690 | #[value = 3] 1691 | doors_opening, 1692 | #[value = 4] 1693 | doors_opened, 1694 | #[value = 5] 1695 | rocket_rising, 1696 | #[value = 6] 1697 | arms_advance, 1698 | #[value = 7] 1699 | rocket_ready, 1700 | #[value = 8] 1701 | launch_starting, 1702 | #[value = 9] 1703 | engine_starting, 1704 | #[value = 10] 1705 | arms_retract, 1706 | #[value = 11] 1707 | rocket_flying, 1708 | #[value = 12] 1709 | lights_blinking_close, 1710 | #[value = 13] 1711 | doors_closing, 1712 | #[value = 14] 1713 | launch_started, 1714 | } 1715 | 1716 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1717 | #[factorio_define(kind = u8)] 1718 | pub enum render_mode { 1719 | #[value = 1] 1720 | game, 1721 | #[value = 2] 1722 | chart, 1723 | #[value = 3] 1724 | chart_zoomed_in, 1725 | } 1726 | 1727 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1728 | #[factorio_define(kind = u8)] 1729 | pub enum input_method { 1730 | #[value = 0] 1731 | keyboard_and_mouse, 1732 | #[value = 1] 1733 | game_controller, 1734 | } 1735 | 1736 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1737 | #[factorio_define(kind = u8)] 1738 | pub enum game_controller_interaction { 1739 | #[value = 0] 1740 | always, 1741 | #[value = 2] 1742 | never, 1743 | #[value = 1] 1744 | normal, 1745 | } 1746 | 1747 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1748 | #[factorio_define(kind = u8)] 1749 | pub enum rich_text_setting { 1750 | #[value = 17] 1751 | enabled, 1752 | #[value = 0] 1753 | disabled, 1754 | #[value = 30] 1755 | highlight, 1756 | } 1757 | 1758 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1759 | #[factorio_define(kind = u8)] 1760 | pub enum relative_gui_position { 1761 | #[value = 0] 1762 | top, 1763 | #[value = 1] 1764 | bottom, 1765 | #[value = 2] 1766 | left, 1767 | #[value = 3] 1768 | right, 1769 | } 1770 | 1771 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1772 | #[factorio_define(kind = str)] 1773 | pub enum relative_gui_type { 1774 | #[value = "blueprint-library-gui"] 1775 | blueprint_library_gui, 1776 | #[value = "production-gui"] 1777 | production_gui, 1778 | #[value = "train-stop-gui"] 1779 | train_stop_gui, 1780 | #[value = "bonus-gui"] 1781 | bonus_gui, 1782 | #[value = "tile-variations-gui"] 1783 | tile_variations_gui, 1784 | #[value = "trains-gui"] 1785 | trains_gui, 1786 | #[value = "achievement-gui"] 1787 | achievement_gui, 1788 | #[value = "furnace-gui"] 1789 | furnace_gui, 1790 | #[value = "permissions-gui"] 1791 | permissions_gui, 1792 | #[value = "logistic-gui"] 1793 | logistic_gui, 1794 | #[value = "heat-interface-gui"] 1795 | heat_interface_gui, 1796 | #[value = "controller-gui"] 1797 | controller_gui, 1798 | #[value = "script-inventory-gui"] 1799 | script_inventory_gui, 1800 | #[value = "server-config-gui"] 1801 | server_config_gui, 1802 | #[value = "armor-gui"] 1803 | armor_gui, 1804 | #[value = "admin-gui"] 1805 | admin_gui, 1806 | #[value = "burner-equipment-gui"] 1807 | burner_equipment_gui, 1808 | #[value = "other-player-gui"] 1809 | other_player_gui, 1810 | #[value = "rename-stop-gui"] 1811 | rename_stop_gui, 1812 | #[value = "entity-with-energy-source-gui"] 1813 | entity_with_energy_source_gui, 1814 | #[value = "loader-gui"] 1815 | loader_gui, 1816 | #[value = "blueprint-book-gui"] 1817 | blueprint_book_gui, 1818 | #[value = "item-with-inventory-gui"] 1819 | item_with_inventory_gui, 1820 | #[value = "decider-combinator-gui"] 1821 | decider_combinator_gui, 1822 | #[value = "programmable-speaker-gui"] 1823 | programmable_speaker_gui, 1824 | #[value = "equipment-grid-gui"] 1825 | equipment_grid_gui, 1826 | #[value = "spider-vehicle-gui"] 1827 | spider_vehicle_gui, 1828 | #[value = "deconstruction-item-gui"] 1829 | deconstruction_item_gui, 1830 | #[value = "mining-drill-gui"] 1831 | mining_drill_gui, 1832 | #[value = "upgrade-item-gui"] 1833 | upgrade_item_gui, 1834 | #[value = "transport-belt-gui"] 1835 | transport_belt_gui, 1836 | #[value = "blueprint-setup-gui"] 1837 | blueprint_setup_gui, 1838 | #[value = "inserter-gui"] 1839 | inserter_gui, 1840 | #[value = "assembling-machine-gui"] 1841 | assembling_machine_gui, 1842 | #[value = "splitter-gui"] 1843 | splitter_gui, 1844 | #[value = "lamp-gui"] 1845 | lamp_gui, 1846 | #[value = "infinity-pipe-gui"] 1847 | infinity_pipe_gui, 1848 | #[value = "pipe-gui"] 1849 | pipe_gui, 1850 | #[value = "standalone-character-gui"] 1851 | standalone_character_gui, 1852 | #[value = "lab-gui"] 1853 | lab_gui, 1854 | #[value = "generic-on-off-entity-gui"] 1855 | generic_on_off_entity_gui, 1856 | #[value = "wall-gui"] 1857 | wall_gui, 1858 | #[value = "storage-tank-gui"] 1859 | storage_tank_gui, 1860 | #[value = "power-switch-gui"] 1861 | power_switch_gui, 1862 | #[value = "rail-signal-gui"] 1863 | rail_signal_gui, 1864 | #[value = "rail-chain-signal-gui"] 1865 | rail_chain_signal_gui, 1866 | #[value = "beacon-gui"] 1867 | beacon_gui, 1868 | #[value = "accumulator-gui"] 1869 | accumulator_gui, 1870 | #[value = "reactor-gui"] 1871 | reactor_gui, 1872 | #[value = "car-gui"] 1873 | car_gui, 1874 | #[value = "container-gui"] 1875 | container_gui, 1876 | #[value = "linked-container-gui"] 1877 | linked_container_gui, 1878 | #[value = "assembling-machine-select-recipe-gui"] 1879 | assembling_machine_select_recipe_gui, 1880 | #[value = "electric-network-gui"] 1881 | electric_network_gui, 1882 | #[value = "train-gui"] 1883 | train_gui, 1884 | #[value = "rocket-silo-gui"] 1885 | rocket_silo_gui, 1886 | #[value = "roboport-gui"] 1887 | roboport_gui, 1888 | #[value = "arithmetic-combinator-gui"] 1889 | arithmetic_combinator_gui, 1890 | #[value = "constant-combinator-gui"] 1891 | constant_combinator_gui, 1892 | #[value = "electric-energy-interface-gui"] 1893 | electric_energy_interface_gui, 1894 | #[value = "market-gui"] 1895 | market_gui, 1896 | #[value = "additional-entity-info-gui"] 1897 | additional_entity_info_gui, 1898 | #[value = "resource-entity-gui"] 1899 | resource_entity_gui, 1900 | #[value = "entity-variations-gui"] 1901 | entity_variations_gui, 1902 | } 1903 | 1904 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1905 | #[factorio_define(kind = u8)] 1906 | pub enum disconnect_reason { 1907 | #[value = 0] 1908 | quit, 1909 | #[value = 1] 1910 | dropped, 1911 | #[value = 2] 1912 | reconnect, 1913 | #[value = 3] 1914 | wrong_input, 1915 | #[value = 4] 1916 | desync_limit_reached, 1917 | #[value = 5] 1918 | cannot_keep_up, 1919 | #[value = 6] 1920 | afk, 1921 | #[value = 7] 1922 | kicked, 1923 | #[value = 8] 1924 | kicked_and_deleted, 1925 | #[value = 9] 1926 | banned, 1927 | #[value = 11] 1928 | switching_servers, 1929 | } 1930 | 1931 | pub mod prototypes { 1932 | use super::*; 1933 | 1934 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1935 | #[factorio_define(kind = u8)] 1936 | pub enum achievement { 1937 | #[value = 0] 1938 | achievement, 1939 | #[value = 0] 1940 | build_entity_achievement, 1941 | #[value = 0] 1942 | combat_robot_count, 1943 | #[value = 0] 1944 | construct_with_robots_achievement, 1945 | #[value = 0] 1946 | deconstruct_with_robots_achievement, 1947 | #[value = 0] 1948 | deliver_by_robots_achievement, 1949 | #[value = 0] 1950 | dont_build_entity_achievement, 1951 | #[value = 0] 1952 | dont_craft_manually_achievement, 1953 | #[value = 0] 1954 | dont_use_entity_in_energy_production_achievement, 1955 | #[value = 0] 1956 | finish_the_game_achievement, 1957 | #[value = 0] 1958 | group_attack_achievement, 1959 | #[value = 0] 1960 | kill_achievement, 1961 | #[value = 0] 1962 | player_damaged_achievement, 1963 | #[value = 0] 1964 | produce_achievement, 1965 | #[value = 0] 1966 | produce_per_hour_achievement, 1967 | #[value = 0] 1968 | research_achievement, 1969 | #[value = 0] 1970 | train_path_achievement, 1971 | } 1972 | 1973 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1974 | #[factorio_define(kind = u8)] 1975 | pub enum ambient_sound { 1976 | #[value = 0] 1977 | ambient_sound, 1978 | } 1979 | 1980 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1981 | #[factorio_define(kind = u8)] 1982 | pub enum ammo_category { 1983 | #[value = 0] 1984 | ammo_category, 1985 | } 1986 | 1987 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1988 | #[factorio_define(kind = u8)] 1989 | pub enum animation { 1990 | #[value = 0] 1991 | animation, 1992 | } 1993 | 1994 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 1995 | #[factorio_define(kind = u8)] 1996 | pub enum autoplace_control { 1997 | #[value = 0] 1998 | autoplace_control, 1999 | } 2000 | 2001 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2002 | #[factorio_define(kind = u8)] 2003 | pub enum custom_input { 2004 | #[value = 0] 2005 | custom_input, 2006 | } 2007 | 2008 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2009 | #[factorio_define(kind = u8)] 2010 | pub enum damage_type { 2011 | #[value = 0] 2012 | damage_type, 2013 | } 2014 | 2015 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2016 | #[factorio_define(kind = u8)] 2017 | pub enum decorative { 2018 | #[value = 0] 2019 | optimized_decorative, 2020 | } 2021 | 2022 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2023 | #[factorio_define(kind = u8)] 2024 | pub enum editor_controller { 2025 | #[value = 0] 2026 | editor_controller, 2027 | } 2028 | 2029 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2030 | #[factorio_define(kind = u8)] 2031 | pub enum entity { 2032 | #[value = 0] 2033 | accumulator, 2034 | #[value = 0] 2035 | ammo_turret, 2036 | #[value = 0] 2037 | arithmetic_combinator, 2038 | #[value = 0] 2039 | arrow, 2040 | #[value = 0] 2041 | artillery_flare, 2042 | #[value = 0] 2043 | artillery_projectile, 2044 | #[value = 0] 2045 | artillery_turret, 2046 | #[value = 0] 2047 | artillery_wagon, 2048 | #[value = 0] 2049 | assembling_machine, 2050 | #[value = 0] 2051 | beacon, 2052 | #[value = 0] 2053 | beam, 2054 | #[value = 0] 2055 | boiler, 2056 | #[value = 0] 2057 | burner_generator, 2058 | #[value = 0] 2059 | car, 2060 | #[value = 0] 2061 | cargo_wagon, 2062 | #[value = 0] 2063 | character, 2064 | #[value = 0] 2065 | character_corpse, 2066 | #[value = 0] 2067 | cliff, 2068 | #[value = 0] 2069 | combat_robot, 2070 | #[value = 0] 2071 | constant_combinator, 2072 | #[value = 0] 2073 | construction_robot, 2074 | #[value = 0] 2075 | container, 2076 | #[value = 0] 2077 | corpse, 2078 | #[value = 0] 2079 | curved_rail, 2080 | #[value = 0] 2081 | decider_combinator, 2082 | #[value = 0] 2083 | deconstructible_tile_proxy, 2084 | #[value = 0] 2085 | electric_energy_interface, 2086 | #[value = 0] 2087 | electric_pole, 2088 | #[value = 0] 2089 | electric_turret, 2090 | #[value = 0] 2091 | entity_ghost, 2092 | #[value = 0] 2093 | explosion, 2094 | #[value = 0] 2095 | fire, 2096 | #[value = 0] 2097 | fish, 2098 | #[value = 0] 2099 | flame_thrower_explosion, 2100 | #[value = 0] 2101 | fluid_turret, 2102 | #[value = 0] 2103 | fluid_wagon, 2104 | #[value = 0] 2105 | flying_text, 2106 | #[value = 0] 2107 | furnace, 2108 | #[value = 0] 2109 | gate, 2110 | #[value = 0] 2111 | generator, 2112 | #[value = 0] 2113 | heat_interface, 2114 | #[value = 0] 2115 | heat_pipe, 2116 | #[value = 0] 2117 | highlight_box, 2118 | #[value = 0] 2119 | infinity_container, 2120 | #[value = 0] 2121 | infinity_pipe, 2122 | #[value = 0] 2123 | inserter, 2124 | #[value = 0] 2125 | item_entity, 2126 | #[value = 0] 2127 | item_request_proxy, 2128 | #[value = 0] 2129 | lab, 2130 | #[value = 0] 2131 | lamp, 2132 | #[value = 0] 2133 | land_mine, 2134 | #[value = 0] 2135 | leaf_particle, 2136 | #[value = 0] 2137 | linked_belt, 2138 | #[value = 0] 2139 | linked_container, 2140 | #[value = 0] 2141 | loader, 2142 | #[value = 0] 2143 | loader_1x1, 2144 | #[value = 0] 2145 | locomotive, 2146 | #[value = 0] 2147 | logistic_container, 2148 | #[value = 0] 2149 | logistic_robot, 2150 | #[value = 0] 2151 | market, 2152 | #[value = 0] 2153 | mining_drill, 2154 | #[value = 0] 2155 | offshore_pump, 2156 | #[value = 0] 2157 | particle, 2158 | #[value = 0] 2159 | particle_source, 2160 | #[value = 0] 2161 | pipe, 2162 | #[value = 0] 2163 | pipe_to_ground, 2164 | #[value = 0] 2165 | player_port, 2166 | #[value = 0] 2167 | power_switch, 2168 | #[value = 0] 2169 | programmable_speaker, 2170 | #[value = 0] 2171 | projectile, 2172 | #[value = 0] 2173 | pump, 2174 | #[value = 0] 2175 | radar, 2176 | #[value = 0] 2177 | rail_chain_signal, 2178 | #[value = 0] 2179 | rail_remnants, 2180 | #[value = 0] 2181 | rail_signal, 2182 | #[value = 0] 2183 | reactor, 2184 | #[value = 0] 2185 | resource, 2186 | #[value = 0] 2187 | roboport, 2188 | #[value = 0] 2189 | rocket_silo, 2190 | #[value = 0] 2191 | rocket_silo_rocket, 2192 | #[value = 0] 2193 | rocket_silo_rocket_shadow, 2194 | #[value = 0] 2195 | simple_entity, 2196 | #[value = 0] 2197 | simple_entity_with_force, 2198 | #[value = 0] 2199 | simple_entity_with_owner, 2200 | #[value = 0] 2201 | smoke, 2202 | #[value = 0] 2203 | smoke_with_trigger, 2204 | #[value = 0] 2205 | solar_panel, 2206 | #[value = 0] 2207 | speech_bubble, 2208 | #[value = 0] 2209 | spider_leg, 2210 | #[value = 0] 2211 | spider_vehicle, 2212 | #[value = 0] 2213 | splitter, 2214 | #[value = 0] 2215 | sticker, 2216 | #[value = 0] 2217 | storage_tank, 2218 | #[value = 0] 2219 | straight_rail, 2220 | #[value = 0] 2221 | stream, 2222 | #[value = 0] 2223 | tile_ghost, 2224 | #[value = 0] 2225 | train_stop, 2226 | #[value = 0] 2227 | transport_belt, 2228 | #[value = 0] 2229 | tree, 2230 | #[value = 0] 2231 | turret, 2232 | #[value = 0] 2233 | underground_belt, 2234 | #[value = 0] 2235 | unit, 2236 | #[value = 0] 2237 | unit_spawner, 2238 | #[value = 0] 2239 | wall, 2240 | } 2241 | 2242 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2243 | #[factorio_define(kind = u8)] 2244 | pub enum equipment { 2245 | #[value = 0] 2246 | active_defense_equipment, 2247 | #[value = 0] 2248 | battery_equipment, 2249 | #[value = 0] 2250 | belt_immunity_equipment, 2251 | #[value = 0] 2252 | energy_shield_equipment, 2253 | #[value = 0] 2254 | generator_equipment, 2255 | #[value = 0] 2256 | movement_bonus_equipment, 2257 | #[value = 0] 2258 | night_vision_equipment, 2259 | #[value = 0] 2260 | roboport_equipment, 2261 | #[value = 0] 2262 | solar_panel_equipment, 2263 | } 2264 | 2265 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2266 | #[factorio_define(kind = u8)] 2267 | pub enum equipment_category { 2268 | #[value = 0] 2269 | equipment_category, 2270 | } 2271 | 2272 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2273 | #[factorio_define(kind = u8)] 2274 | pub enum equipment_grid { 2275 | #[value = 0] 2276 | equipment_grid, 2277 | } 2278 | 2279 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2280 | #[factorio_define(kind = u8)] 2281 | pub enum fluid { 2282 | #[value = 0] 2283 | fluid, 2284 | } 2285 | 2286 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2287 | #[factorio_define(kind = u8)] 2288 | pub enum font { 2289 | #[value = 0] 2290 | font, 2291 | } 2292 | 2293 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2294 | #[factorio_define(kind = u8)] 2295 | pub enum fuel_category { 2296 | #[value = 0] 2297 | fuel_category, 2298 | } 2299 | 2300 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2301 | #[factorio_define(kind = u8)] 2302 | pub enum god_controller { 2303 | #[value = 0] 2304 | god_controller, 2305 | } 2306 | 2307 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2308 | #[factorio_define(kind = u8)] 2309 | pub enum gui_style { 2310 | #[value = 0] 2311 | gui_style, 2312 | } 2313 | 2314 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2315 | #[factorio_define(kind = u8)] 2316 | pub enum item { 2317 | #[value = 0] 2318 | ammo, 2319 | #[value = 0] 2320 | armor, 2321 | #[value = 0] 2322 | blueprint, 2323 | #[value = 0] 2324 | blueprint_book, 2325 | #[value = 0] 2326 | capsule, 2327 | #[value = 0] 2328 | copy_paste_tool, 2329 | #[value = 0] 2330 | deconstruction_item, 2331 | #[value = 0] 2332 | gun, 2333 | #[value = 0] 2334 | item, 2335 | #[value = 0] 2336 | item_with_entity_data, 2337 | #[value = 0] 2338 | item_with_inventory, 2339 | #[value = 0] 2340 | item_with_label, 2341 | #[value = 0] 2342 | item_with_tags, 2343 | #[value = 0] 2344 | mining_tool, 2345 | #[value = 0] 2346 | module, 2347 | #[value = 0] 2348 | rail_planner, 2349 | #[value = 0] 2350 | repair_tool, 2351 | #[value = 0] 2352 | selection_tool, 2353 | #[value = 0] 2354 | spidertron_remote, 2355 | #[value = 0] 2356 | tool, 2357 | #[value = 0] 2358 | upgrade_item, 2359 | } 2360 | 2361 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2362 | #[factorio_define(kind = u8)] 2363 | pub enum item_group { 2364 | #[value = 0] 2365 | item_group, 2366 | } 2367 | 2368 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2369 | #[factorio_define(kind = u8)] 2370 | pub enum item_subgroup { 2371 | #[value = 0] 2372 | item_subgroup, 2373 | } 2374 | 2375 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2376 | #[factorio_define(kind = u8)] 2377 | pub enum map_gen_presets { 2378 | #[value = 0] 2379 | map_gen_presets, 2380 | } 2381 | 2382 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2383 | #[factorio_define(kind = u8)] 2384 | pub enum map_settings { 2385 | #[value = 0] 2386 | map_settings, 2387 | } 2388 | 2389 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2390 | #[factorio_define(kind = u8)] 2391 | pub enum module_category { 2392 | #[value = 0] 2393 | module_category, 2394 | } 2395 | 2396 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2397 | #[factorio_define(kind = u8)] 2398 | pub enum mouse_cursor { 2399 | #[value = 0] 2400 | mouse_cursor, 2401 | } 2402 | 2403 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2404 | #[factorio_define(kind = u8)] 2405 | pub enum noise_expression { 2406 | #[value = 0] 2407 | noise_expression, 2408 | } 2409 | 2410 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2411 | #[factorio_define(kind = u8)] 2412 | pub enum noise_layer { 2413 | #[value = 0] 2414 | noise_layer, 2415 | } 2416 | 2417 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2418 | #[factorio_define(kind = u8)] 2419 | pub enum particle { 2420 | #[value = 0] 2421 | optimized_particle, 2422 | } 2423 | 2424 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2425 | #[factorio_define(kind = u8)] 2426 | pub enum recipe { 2427 | #[value = 0] 2428 | recipe, 2429 | } 2430 | 2431 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2432 | #[factorio_define(kind = u8)] 2433 | pub enum recipe_category { 2434 | #[value = 0] 2435 | recipe_category, 2436 | } 2437 | 2438 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2439 | #[factorio_define(kind = u8)] 2440 | pub enum resource_category { 2441 | #[value = 0] 2442 | resource_category, 2443 | } 2444 | 2445 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2446 | #[factorio_define(kind = u8)] 2447 | pub enum shortcut { 2448 | #[value = 0] 2449 | shortcut, 2450 | } 2451 | 2452 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2453 | #[factorio_define(kind = u8)] 2454 | pub enum sound { 2455 | #[value = 0] 2456 | sound, 2457 | } 2458 | 2459 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2460 | #[factorio_define(kind = u8)] 2461 | pub enum spectator_controller { 2462 | #[value = 0] 2463 | spectator_controller, 2464 | } 2465 | 2466 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2467 | #[factorio_define(kind = u8)] 2468 | pub enum sprite { 2469 | #[value = 0] 2470 | sprite, 2471 | } 2472 | 2473 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2474 | #[factorio_define(kind = u8)] 2475 | pub enum technology { 2476 | #[value = 0] 2477 | technology, 2478 | } 2479 | 2480 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2481 | #[factorio_define(kind = u8)] 2482 | pub enum tile { 2483 | #[value = 0] 2484 | tile, 2485 | } 2486 | 2487 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2488 | #[factorio_define(kind = u8)] 2489 | pub enum tile_effect { 2490 | #[value = 0] 2491 | tile_effect, 2492 | } 2493 | 2494 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2495 | #[factorio_define(kind = u8)] 2496 | pub enum tips_and_tricks_item { 2497 | #[value = 0] 2498 | tips_and_tricks_item, 2499 | } 2500 | 2501 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2502 | #[factorio_define(kind = u8)] 2503 | pub enum tips_and_tricks_item_category { 2504 | #[value = 0] 2505 | tips_and_tricks_item_category, 2506 | } 2507 | 2508 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2509 | #[factorio_define(kind = u8)] 2510 | pub enum trigger_target_type { 2511 | #[value = 0] 2512 | trigger_target_type, 2513 | } 2514 | 2515 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2516 | #[factorio_define(kind = u8)] 2517 | pub enum trivial_smoke { 2518 | #[value = 0] 2519 | trivial_smoke, 2520 | } 2521 | 2522 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2523 | #[factorio_define(kind = u8)] 2524 | pub enum tutorial { 2525 | #[value = 0] 2526 | tutorial, 2527 | } 2528 | 2529 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2530 | #[factorio_define(kind = u8)] 2531 | pub enum utility_constants { 2532 | #[value = 0] 2533 | utility_constants, 2534 | } 2535 | 2536 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2537 | #[factorio_define(kind = u8)] 2538 | pub enum utility_sounds { 2539 | #[value = 0] 2540 | utility_sounds, 2541 | } 2542 | 2543 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2544 | #[factorio_define(kind = u8)] 2545 | pub enum utility_sprites { 2546 | #[value = 0] 2547 | utility_sprites, 2548 | } 2549 | 2550 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2551 | #[factorio_define(kind = u8)] 2552 | pub enum virtual_signal { 2553 | #[value = 0] 2554 | virtual_signal, 2555 | } 2556 | 2557 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2558 | #[factorio_define(kind = u8)] 2559 | pub enum wind_sound { 2560 | #[value = 0] 2561 | wind_sound, 2562 | } 2563 | } 2564 | 2565 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2566 | #[factorio_define(kind = u8)] 2567 | pub enum print_sound { 2568 | #[value = 1] 2569 | always, 2570 | #[value = 0] 2571 | never, 2572 | #[value = 2] 2573 | use_player_settings, 2574 | } 2575 | 2576 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, rivets_macros::FactorioDefine)] 2577 | #[factorio_define(kind = u8)] 2578 | pub enum print_skip { 2579 | #[value = 0] 2580 | never, 2581 | #[value = 1] 2582 | if_redundant, 2583 | #[value = 2] 2584 | if_visible, 2585 | } 2586 | --------------------------------------------------------------------------------