Tabs beat spaces

This commit is contained in:
Elliot Nunn 2019-05-25 16:17:55 +08:00
parent 01b9eeff03
commit ce6a1e747f

View File

@ -7,9 +7,9 @@ class MyParcelStruct(NamedTupleStruct, StringStruct):
MAGIC = b'prcl\x01\x00\x00\x00' MAGIC = b'prcl\x01\x00\x00\x00'
def pad(offset, align): def pad(offset, align):
x = offset + align - 1 x = offset + align - 1
x -= x % align x -= x % align
return x return x
PrclNodeStruct = MyParcelStruct('>I 4s I I I I 32s 32s', name='PrclNodeStruct', PrclNodeStruct = MyParcelStruct('>I 4s I I I I 32s 32s', name='PrclNodeStruct',
fields=['link', 'ostype', 'hdr_size', 'flags', 'n_children', 'child_size', 'a', 'b']) fields=['link', 'ostype', 'hdr_size', 'flags', 'n_children', 'child_size', 'a', 'b'])
@ -18,16 +18,16 @@ PrclChildStruct = MyParcelStruct('>4s I 4s I I I I 32s', name='PrclChildStruct',
fields=['ostype', 'flags', 'compress', 'unpackedlen', 'cksum', 'packedlen', 'ptr', 'name']) fields=['ostype', 'flags', 'compress', 'unpackedlen', 'cksum', 'packedlen', 'ptr', 'name'])
SuperMarioHeader = NamedTupleStruct('>I I B B I I H B B L L L L L L B B 4L L L L L', name='SuperMarioHeader', SuperMarioHeader = NamedTupleStruct('>I I B B I I H B B L L L L L L B B 4L L L L L', name='SuperMarioHeader',
fields=['CheckSum', 'ResetPC', 'MachineNumber', 'ROMVersion', fields=['CheckSum', 'ResetPC', 'MachineNumber', 'ROMVersion',
'ReStartJMP', 'BadDiskJMP', 'ROMRelease', 'PatchFlags', 'unused1', 'ReStartJMP', 'BadDiskJMP', 'ROMRelease', 'PatchFlags', 'unused1',
'ForeignOSTbl', 'RomRsrc', 'EjectJMP', 'DispTableOff', 'ForeignOSTbl', 'RomRsrc', 'EjectJMP', 'DispTableOff',
'CriticalJMP', 'ResetEntryJMP', 'RomLoc', 'unused2', 'CheckSum0', 'CriticalJMP', 'ResetEntryJMP', 'RomLoc', 'unused2', 'CheckSum0',
'CheckSum1', 'CheckSum2', 'CheckSum3', 'RomSize', 'EraseIconOff', 'CheckSum1', 'CheckSum2', 'CheckSum3', 'RomSize', 'EraseIconOff',
'InitSys7ToolboxOff', 'SubVers']) 'InitSys7ToolboxOff', 'SubVers'])
SuperMarioForeignOS = NamedTupleStruct('>7I', name='SuperMarioForeignOS', SuperMarioForeignOS = NamedTupleStruct('>7I', name='SuperMarioForeignOS',
fields=['InitDispatcher', 'EMT1010', 'BadTrap', 'StartSDeclMgr', fields=['InitDispatcher', 'EMT1010', 'BadTrap', 'StartSDeclMgr',
'InitMemVect', 'SwitchMMU', 'InitRomVectors']) 'InitMemVect', 'SwitchMMU', 'InitRomVectors'])
COMBO_FIELDS = { COMBO_FIELDS = {
0x40 << 56: 'AppleTalk1', 0x40 << 56: 'AppleTalk1',
@ -39,34 +39,34 @@ COMBO_FIELDS = {
} }
ResHeader = NamedTupleStruct('>L B B H H 6x', name='ResHeader', ResHeader = NamedTupleStruct('>L B B H H 6x', name='ResHeader',
fields=['offsetToFirst', 'maxValidIndex', 'comboFieldSize', fields=['offsetToFirst', 'maxValidIndex', 'comboFieldSize',
'comboVersion', 'headerSize']) 'comboVersion', 'headerSize'])
ResEntry = NamedTupleStruct('>Q L L 4s h B 256p', name='ResEntry', ResEntry = NamedTupleStruct('>Q L L 4s h B 256p', name='ResEntry',
fields=['combo', 'offsetToNext', 'offsetToData', 'rsrcType', fields=['combo', 'offsetToNext', 'offsetToData', 'rsrcType',
'rsrcID', 'rsrcAttr', 'rsrcName']) 'rsrcID', 'rsrcAttr', 'rsrcName'])
def ResEntry_padded_len(entry_tuple): def ResEntry_padded_len(entry_tuple):
return pad(ResEntry.size - 256 + len(entry_tuple.rsrcName), 16) return pad(ResEntry.size - 256 + len(entry_tuple.rsrcName), 16)
FakeMMHeader = NamedTupleStruct('>4s L L L', name='FakeMMHeader', FakeMMHeader = NamedTupleStruct('>4s L L L', name='FakeMMHeader',
fields=['MagicKurt', 'MagicC0A00000', 'dataSizePlus12', 'bogusOff']) fields=['MagicKurt', 'MagicC0A00000', 'dataSizePlus12', 'bogusOff'])
ConfigInfo = NamedTupleStruct('>40x lLL lL lL lL lL lL lL 16sLLL LL LLLLbxxx LLLLL L LLLLLL 128s128s128s128s 128s LLLL L L lL LLL', name='ConfigInfo', ConfigInfo = NamedTupleStruct('>40x lLL lL lL lL lL lL lL 16sLLL LL LLLLbxxx LLLLL L LLLLLL 128s128s128s128s 128s LLLL L L lL LLL', name='ConfigInfo',
fields=['ROMImageBaseOffset', 'ROMImageSize', 'ROMImageVersion', fields=['ROMImageBaseOffset', 'ROMImageSize', 'ROMImageVersion',
'Mac68KROMOffset', 'Mac68KROMSize', 'ExceptionTableOffset', 'Mac68KROMOffset', 'Mac68KROMSize', 'ExceptionTableOffset',
'ExceptionTableSize', 'HWInitCodeOffset', 'HWInitCodeSize', 'ExceptionTableSize', 'HWInitCodeOffset', 'HWInitCodeSize',
'KernelCodeOffset', 'KernelCodeSize', 'EmulatorCodeOffset', 'KernelCodeOffset', 'KernelCodeSize', 'EmulatorCodeOffset',
'EmulatorCodeSize', 'OpcodeTableOffset', 'OpcodeTableSize', 'EmulatorCodeSize', 'OpcodeTableOffset', 'OpcodeTableSize',
'BootstrapVersion', 'BootVersionOffset', 'ECBOffset', 'BootstrapVersion', 'BootVersionOffset', 'ECBOffset',
'IplValueOffset', 'EmulatorEntryOffset', 'KernelTrapTableOffset', 'IplValueOffset', 'EmulatorEntryOffset', 'KernelTrapTableOffset',
'TestIntMaskInit', 'ClearIntMaskInit', 'PostIntMaskInit', 'TestIntMaskInit', 'ClearIntMaskInit', 'PostIntMaskInit',
'LA_InterruptCtl', 'InterruptHandlerKind', 'LA_InfoRecord', 'LA_InterruptCtl', 'InterruptHandlerKind', 'LA_InfoRecord',
'LA_KernelData', 'LA_EmulatorData', 'LA_DispatchTable', 'LA_KernelData', 'LA_EmulatorData', 'LA_DispatchTable',
'LA_EmulatorCode', 'MacLowMemInitOffset', 'PageAttributeInit', 'LA_EmulatorCode', 'MacLowMemInitOffset', 'PageAttributeInit',
'PageMapInitSize', 'PageMapInitOffset', 'PageMapIRPOffset', 'PageMapInitSize', 'PageMapInitOffset', 'PageMapIRPOffset',
'PageMapKDPOffset', 'PageMapEDPOffset', 'SegMap32SupInit', 'SegMap32UsrInit', 'SegMap32CPUInit', 'SegMap32OvlInit', 'BATRangeInit', 'PageMapKDPOffset', 'PageMapEDPOffset', 'SegMap32SupInit', 'SegMap32UsrInit', 'SegMap32CPUInit', 'SegMap32OvlInit', 'BATRangeInit',
'BatMap32SupInit', 'BatMap32UsrInit', 'BatMap32CPUInit', 'BatMap32SupInit', 'BatMap32UsrInit', 'BatMap32CPUInit',
'BatMap32OvlInit', 'SharedMemoryAddr', 'PA_RelocatedLowMemInit', 'BatMap32OvlInit', 'SharedMemoryAddr', 'PA_RelocatedLowMemInit',
'OpenFWBundleOffset', 'OpenFWBundleSize', 'LA_OpenFirmware', 'OpenFWBundleOffset', 'OpenFWBundleSize', 'LA_OpenFirmware',
'PA_OpenFirmware', 'LA_HardwarePriv']) 'PA_OpenFirmware', 'LA_HardwarePriv'])