Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 246 additions & 9 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ lines_lossy = "0.1.0"
zip = { git = "https://github.com/x87/zip.git" }
const_format = "0.2.32"
cached = "0.50.0"
gta-ide-parser = "0.0.4"
gta-ide-parser = "0.0.4"
byteorder = "1.5"
clap = { version = "4.5", features = ["derive"] }
crc32fast = "1.4"
encoding_rs = "0.8"
quick-xml = { version = "0.36", features = ["serialize"] }
glob = "0.3"
31 changes: 31 additions & 0 deletions src/gxt/ffi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use std::ffi::CString;
use crate::common_ffi::*;
use super::parser::GxtParser;

#[no_mangle]
pub extern "C" fn gxt_new() -> *mut GxtParser {
ptr_new(GxtParser::new())
}

#[no_mangle]
pub unsafe extern "C" fn gxt_free(p: *mut GxtParser) {
ptr_free(p)
}

#[no_mangle]
pub unsafe extern "C" fn gxt_load_file(p: *mut GxtParser, path: PChar) -> bool {
boolclosure!({
let path = pchar_to_str(path)?;
(*p).load_file(path).ok()
})
}

#[no_mangle]
pub unsafe extern "C" fn gxt_get(p: *mut GxtParser, key: PChar, out: *mut PChar) -> bool {
boolclosure!({
let key = pchar_to_str(key)?;
let value = (*p).get(key)?;
*out = CString::new(value).unwrap().into_raw();
Some(())
})
}
2 changes: 2 additions & 0 deletions src/gxt/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod parser;
pub mod ffi;
Loading
Loading