parent
75905b8474
commit
c072e9cfa9
@ -1,8 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Import hash from the rir dynamic lib."""
|
||||
|
||||
import ctypes
|
||||
import sys
|
||||
from ctypes import cdll
|
||||
|
||||
lib = cdll.LoadLibrary(sys.argv[1])
|
||||
#print(lib.name_hashes.hash("/chr/c0000.anibnd.dcx"))
|
||||
|
||||
lib = ctypes.cdll.LoadLibrary(sys.argv[1])
|
||||
|
||||
s = ctypes.c_char_p(b"/chr/c0000.anibnd.dcx")
|
||||
lib.nam_hash.restype = ctypes.c_uint32
|
||||
h = lib.nam_hash(s)
|
||||
print(hex(h))
|
||||
|
||||
lib.nam_hash_as_string.restype = ctypes.c_char_p
|
||||
h_str = lib.nam_hash_as_string(h)
|
||||
print(h_str)
|
||||
|
@ -0,0 +1,12 @@
|
||||
use std::ffi;
|
||||
|
||||
/// Free a String owned by librir.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn ffi_free_string(s: *mut libc::c_char) {
|
||||
unsafe {
|
||||
if s.is_null() {
|
||||
return;
|
||||
}
|
||||
ffi::CString::from_raw(s)
|
||||
}
|
||||
}
|
Loading…
Reference in new issue