Added final names for pld component

This commit is contained in:
_ 2018-05-16 20:18:37 -07:00
parent 42e2d88734
commit a5abb9d24f
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
from py3devil1pld import PLDHeader from py3devil1pld import PldHeader
from py3devil1tex import TEXturePack, TEXtureBatchDescriptor, TEXtureBatch from py3devil1tex import TEXturePack, TEXtureBatchDescriptor, TEXtureBatch
from py3devil1geo import GEOHeader, MEShHeader, MEsh from py3devil1geo import GEOHeader, MEShHeader, MEsh
@ -68,9 +68,9 @@ if __name__ == "__main__":
def mainx(): def mainx():
with open("pl01.pld", "rb") as f: with open("pl01.pld", "rb") as f:
data = f.read() data = f.read()
pld = PLDHeader(data) pld = PldHeader(data)
pld.show() pld.show()
pld2 = PLDHeader() pld2 = PldHeader()
pld2.show() pld2.show()
with open("pl01.pld_1.txp", "rb") as f: with open("pl01.pld_1.txp", "rb") as f:

View File

@ -6,7 +6,7 @@ from .__init__ import libc
# Basic Struct # Basic Struct
#--------------------------------------+ #--------------------------------------+
class PldHeader(ctypes.Structure): class _PldHeader_(ctypes.Structure):
_pack_ = 1 _pack_ = 1
_fields_ = [ _fields_ = [
("numOffset", ctypes.c_int), ("numOffset", ctypes.c_int),
@ -17,14 +17,14 @@ class Devil1PLD_FN(ctypes.Structure):
_fields_ = [ _fields_ = [
("getheader" , ctypes.CFUNCTYPE( ("getheader" , ctypes.CFUNCTYPE(
ctypes.c_bool, ctypes.c_bool,
ctypes.POINTER(PldHeader), ctypes.POINTER(_PldHeader_),
ctypes.c_char_p)), ctypes.c_char_p)),
("sizeofsector", ctypes.CFUNCTYPE( ("sizeofsector", ctypes.CFUNCTYPE(
ctypes.c_int, ctypes.c_int,
ctypes.POINTER(PldHeader), ctypes.POINTER(_PldHeader_),
ctypes.c_int)), ctypes.c_int)),
("printheader" , ctypes.CFUNCTYPE(None, ("printheader" , ctypes.CFUNCTYPE(None,
ctypes.POINTER(PldHeader))) ctypes.POINTER(_PldHeader_)))
] ]
devil1pld = Devil1PLD_FN.in_dll(libc, "DEVIL1PLD") devil1pld = Devil1PLD_FN.in_dll(libc, "DEVIL1PLD")
@ -34,10 +34,10 @@ del libc
# Pythonic Object # Pythonic Object
#--------------------------------------+ #--------------------------------------+
class PLDHeader: class PldHeader:
def __init__(self, filedata = None): def __init__(self, filedata = None):
# Store C Struct in order to call C functions # Store C Struct in order to call C functions
self.cstruct = PldHeader() self.cstruct = _PldHeader_()
if filedata: if filedata:
devil1pld.getheader(ctypes.byref(self.cstruct), filedata) devil1pld.getheader(ctypes.byref(self.cstruct), filedata)
self.eof = len(filedata) self.eof = len(filedata)