mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-29 10:12:02 +05:30
Python can read a pld header
This commit is contained in:
parent
3f76eddbce
commit
71f6517a94
@ -7,7 +7,7 @@ class PldHeader(ctypes.Structure):
|
||||
("offsets", ctypes.POINTER(ctypes.c_int))
|
||||
]
|
||||
|
||||
class Devil1FN_PLD(ctypes.Structure):
|
||||
class Devil1PLD_FN(ctypes.Structure):
|
||||
_fields_ = [
|
||||
("getheader" , ctypes.CFUNCTYPE(bool, ctypes.POINTER(PldHeader), ctypes.c_char_p)),
|
||||
("sizeofsector", ctypes.CFUNCTYPE(int, ctypes.POINTER(PldHeader), ctypes.c_int)),
|
||||
@ -16,11 +16,21 @@ class Devil1FN_PLD(ctypes.Structure):
|
||||
|
||||
def main():
|
||||
sharedlib='./lib3ddevil1.so'
|
||||
libc = cdll.LoadLibrary(sharedlib)
|
||||
if (not lib):
|
||||
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
||||
if (not libc):
|
||||
print("Couldn't load %s" % sharedlib)
|
||||
return 1
|
||||
|
||||
|
||||
print("OK")
|
||||
fn = Devil1PLD_FN.in_dll(libc, "DEVIL1PLD")
|
||||
pldh = PldHeader()
|
||||
with open("pl01.pld", "rb") as f:
|
||||
data = f.read()
|
||||
p = PldHeader()
|
||||
fn.getheader(ctypes.byref(pldh), data)
|
||||
fn.printheader(ctypes.byref(pldh))
|
||||
|
||||
#---------------------------------------+
|
||||
|
||||
main()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user