コード例 #1
0
class VgmHeader(DataStruct):
    nbytes: int = meta('offset', addr=0x04)
    version: int = meta('u32', addr=0x08)
    nsamp: int = meta('u32', addr=0x18)

    ym2612_clock: int = meta('u32', addr=0x2C)

    # default arguments
    data_addr: int = meta('offset', addr=0x34)

    # magic values become default arguments
    magic: bytes = meta('magic', arg=b'Vgm ', addr=0x00)

    @classmethod
    def decode(cls, ptr: Pointer) -> 'VgmHeader':
        # do I also have to call super().decode in superclass? Maybe.
        obj: VgmHeader = super().decode(ptr)

        if obj.version < 0x150:
            obj.data_addr = 0x40

        return obj
コード例 #2
0
class Write8as8(EventStruct):
    reg: int = meta('u8')
    value: int = meta('u8')
コード例 #3
0
class PSGWrite(EventStruct):
    value: int = meta('u8')
コード例 #4
0
class Wait16Bit(PureWait):
    delay: int = meta('u16')
コード例 #5
0
class Wait4Bit(PureWait):
    """0x7n:
    wait n+1 samples, n can range from 0 to 15.
    """
    delay: int = meta(parameterize=lambda x: x + 1)
コード例 #6
0
class PCMWriteWait(IWait):
    """0x8n:
    YM2612 port 0 address 2A write from the file bank, then wait n samples;
    n can range from 0 to 15. Note that the wait is n, NOT n+1.
    """
    delay: int = meta(parameterize=lambda x: x)
コード例 #7
0
class PCMSeek(EventStruct):
    address: int = meta('u32')
コード例 #8
0
class DataBlock(EventStruct):
    magic: bytes = meta('hexmagic', '66')
    typ: int = meta('u8')
    nbytes: int = meta('u32')
    file: bytes = meta('bytes_', length='nbytes')