Device: Re-use magic reference across Structures

This commit is contained in:
rlaphoenix 2022-07-21 16:23:19 +01:00
parent f2174dfa72
commit 70e79825b3

View File

@ -23,13 +23,15 @@ class _Types(Enum):
class _Structures: class _Structures:
magic = Const(b"WVD")
header = Struct( header = Struct(
"signature" / Const(b"WVD"), "signature" / magic,
"version" / Int8ub "version" / Int8ub
) )
v2 = Struct( v2 = Struct(
"signature" / Const(b"WVD"), "signature" / magic,
"version" / Const(Int8ub, 2), "version" / Const(Int8ub, 2),
"type_" / CEnum( "type_" / CEnum(
Int8ub, Int8ub,
@ -47,7 +49,7 @@ class _Structures:
) )
v1 = Struct( v1 = Struct(
"signature" / Const(b"WVD"), "signature" / magic,
"version" / Const(Int8ub, 1), "version" / Const(Int8ub, 1),
"type_" / CEnum( "type_" / CEnum(
Int8ub, Int8ub,