from collections import namedtuple
from struct import unpack

import sark


ImagePosition = namedtuple('ImagePosition', 'spritesheet image_number y collide x')


def hex_to_sign(value):
    if value >= 0x8000:
        value -= 0x10000
    return value


def byte_to_sign(value):
    if value >= 0x80:
        value -= 0x100
    return value


spritesheets = {
    0: 'kn1.ob',
    4: 'kn2.ob',
    8: 'kn3.ob',
    12: 'kn4.ob',
    16: 'kn4.ob',
}

collide_type = {
    0: 'Collide.NON_SOLID',
    1: 'Collide.COLLIDEE',
    2: 'Collide.COLLIDER',
}


line = sark.Line()
next_line = True
while next_line:
    if line.disasm.startswith("AnimationFrame"):

        sprite, img_num, y, collide, x = unpack('<4BH', line.bytes)
        y = byte_to_sign(y)
        x = hex_to_sign(x)
        sprite = spritesheets[sprite]
        collide = collide_type[collide]

        test = "ImagePosition('{}', {}, {}, {}, {}),".format(sprite, img_num, y, x, collide)
        print test
        line = line.next
    elif line.disasm.startswith('EndOfAnimFrame <0FFh, 0>'):
        line = line.next
        print '),'
        print '('
    elif line.disasm.startswith('EndOfAnimFrame <0FFh, 0FFh>'):
        next_line = False
    else:
        line = line.next

Add ida script to convert ida anim to python anim
Add ida script to convert ida anim to python anim

select the address of the AnimationFrame in ida and run this script and it'll output ImagePositions that I can copy paste into animations
