kitgit

tirbofish/dropbear · commit

0911f33227e87406d41bca3e92b70a037ae85268

fix: fix up native since i remove collidercollisionsarray.

Unverified

Thribhu K <4tkbytes@pm.me> · 2026-04-03 13:29

view full diff

diff --git a/crates/goanna-gen/src/lib.rs b/crates/goanna-gen/src/lib.rs
index 0fff27c..fe594e6 100644
--- a/crates/goanna-gen/src/lib.rs
+++ b/crates/goanna-gen/src/lib.rs
@@ -14,10 +14,28 @@ pub fn generate_c_header() -> anyhow::Result<()> {
     let mut functions = Vec::new();
     let mut structs = std::collections::HashMap::new();
     let mut enums = Vec::new();
+
+    seed_well_known_extern_types(&mut structs);
+
+    // Scan sibling crates for additional type definitions (not function exports)
+    let crates_dir = workspace_root.join("crates");
+    if let Ok(entries) = std::fs::read_dir(&crates_dir) {
+        let mut sorted: Vec<_> = entries.filter_map(Result::ok).collect();
+        sorted.sort_by_key(|e| e.path());
+        for entry in sorted {
+            let crate_src = entry.path().join("src");
+            // Only scan other crates, not the current one
+            if crate_src.exists() && crate_src != src_dir {
+                let _ = collect_type_definitions_only(&crate_src, &mut structs, &mut enums);
+            }
+        }
+    }
+
     collect_exported_functions(&src_dir, &mut functions, &mut structs, &mut enums)?;
 
     functions.sort_by(|a, b| a.name.cmp(&b.name));
     enums.sort_by(|a, b| a.name.cmp(&b.name));
+    enums.dedup_by(|a, b| a.name == b.name);
 
     let header = render_header(&functions, &structs, &enums);
     if let Ok(existing) = std::fs::read_to_string(&output_path) {
@@ -31,6 +49,66 @@ pub fn generate_c_header() -> anyhow::Result<()> {
     Ok(())
 }
 
+fn seed_well_known_extern_types(structs: &mut std::collections::HashMap<String, StructDef>) {
+    // glam::Vec3 - #[repr(C)] with f32 x/y/z fields
+    structs.entry("Vec3".to_string()).or_insert(StructDef {
+        name: "Vec3".to_string(),
+        fields: vec![
+            ExportParam { name: "x".to_string(), ty: "float".to_string() },
+            ExportParam { name: "y".to_string(), ty: "float".to_string() },
+            ExportParam { name: "z".to_string(), ty: "float".to_string() },
+        ],
+        is_repr_c: true,
+    });
+    // glam::Vec4 - #[repr(C)] with f32 x/y/z/w fields
+    structs.entry("Vec4".to_string()).or_insert(StructDef {

Large diffs are not rendered by default. Showing the first 50 of 831 lines. Show full diff