don't click here

SonAni2Gif

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Apr 6, 2012.

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    [​IMG]
    [​IMG]
    Download
    OK so here's how you use this:
    On the left click the Add button to load an art file (a dialog will ask the compression type). The rest of the stuff is changing the order art files are used in and what address it's loaded at, allowing you to create a virtual VRAM space. The bottom of the form allows you to view the loaded tiles (you can scroll through it with arrow keys).
    Click "Import Palette" to load a palette file and tell it what offset to load it at. Do this as many times as you need.
    Then in the File menu, you can load Mappings, DPLC and Animations. Each item will have a check mark when it is loaded. For all three, you can specify Binary or ASM and a starting address or label.
    For mappings, you can choose the game and the starting palette line.
    For DPLCs, you can choose the game. Note that S3K's player objects use S2 format, while other objects use a different format.
    On the right you can select an animation, with labels if you loaded ASM mappings, or hex offsets otherwise, and then click "GIF Export".

    Animations which have the speed value set to $FD, $FE or $FF will use a value of 4 instead.

    Animations which are set to loop indefinitely ($FF) will produce infinitely looping GIFs. Animations which jump back a number of frames ($FE) will be split into _intro and _loop GIFs. Animations which change to a different animation ($FD) will go through each animation until it finds a non-FD animation, then it will stop; if the last animation ends with $FE it will be split into _intro and _loop GIFs. All other types will play once, then stop.

    KNOWN BUG: The two pixels on the bottom right are always black. I have no explanation for this.

    Edit: Bugfix, now opens S1 Mappings and DPLC correctly.
     
  2. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    Well this isn't quite what you were going with before, but nonetheless it is still looking pretty sweet. I'm downloading it now, can't wait to try it out!
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    I've updated it to change the handling of $FE animations: it now produces _intro and _loop GIFs.
    [​IMG]
     
  4. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    Like the complex looping programming, didn't know you could do that with GiFs. I could have a lot of fun with this. :D
     
  5. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    This will make it easier to sprite, in it's own way. I've used photoshop many times to see if an animation would look well, this seems to be much easier to use for such a purpose. Awesome work!

    Edit: there seems to be a slight problem though.

    I loaded everything, and for the most part it works fine, however the animations don't all read, it stops at animation $1E, which is SonAni_Balance4 for me. I have around 18 more animations than that.

    Edit2: This is Sonic 2 I am talking about, as always.
     
  6. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    The only reasons I can think of for it to stop is if it reached the address that matches the lowest offset in the table, or an instruction that isn't dc.X, offsetTable, offsetTableEntry.X, align, or even.
     
  7. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I realized that there was a line calling for an animation that is part of the super form animations that was causing some of the trouble, as it isn't in the animation file I made. However, after correcting that I still couldn't get all animations to load.

    Code (Text):
    1. SonicAniData:
    2.     dc.w SonAni_Walk - SonicAniData     ; 0
    3.     dc.w SonAni_Run - SonicAniData      ; 1
    4.     dc.w SonAni_Roll - SonicAniData     ; 2
    5.     dc.w SonAni_Roll2 - SonicAniData    ; 3
    6.     dc.w SonAni_Push - SonicAniData     ; 4
    7.     dc.w SonAni_Wait - SonicAniData     ; 5
    8.     dc.w SonAni_Balance - SonicAniData  ; 6
    9.     dc.w SonAni_LookUp - SonicAniData   ; 7
    10.     dc.w SonAni_Duck - SonicAniData     ; 8
    11.     dc.w SonAni_Spindash - SonicAniData ; 9
    12.     dc.w SonAni_Blink - SonicAniData    ; 10 ; $A
    13.     dc.w SonAni_GetUp - SonicAniData    ; 11 ; $B
    14.     dc.w SonAni_Balance2 - SonicAniData ; 12 ; $C
    15.     dc.w SonAni_Stop - SonicAniData     ; 13 ; $D
    16.     dc.w SonAni_Float - SonicAniData    ; 14 ; $E
    17.     dc.w SonAni_Float2 - SonicAniData   ; 15 ; $F
    18.     dc.w SonAni_Spring - SonicAniData   ; 16 ; $10
    19.     dc.w SonAni_Hang - SonicAniData     ; 17 ; $11
    20.     dc.w SonAni_Dash2 - SonicAniData    ; 18 ; $12
    21.     dc.w SonAni_Dash3 - SonicAniData    ; 19 ; $13
    22.     dc.w SonAni_Hang2 - SonicAniData    ; 20 ; $14
    23.     dc.w SonAni_Bubble - SonicAniData   ; 21 ; $15
    24.     dc.w SonAni_DeathBW - SonicAniData  ; 22 ; $16
    25.     dc.w SonAni_Drown - SonicAniData    ; 23 ; $17
    26.     dc.w SonAni_Death - SonicAniData    ; 24 ; $18
    27.     dc.w SonAni_Hurt - SonicAniData     ; 25 ; $19
    28.     dc.w SonAni_Hurt - SonicAniData     ; 26 ; $1A
    29.     dc.w SonAni_Slide - SonicAniData    ; 27 ; $1B
    30.     dc.w SonAni_Blank - SonicAniData    ; 28 ; $1C
    31.     dc.w SonAni_Balance3 - SonicAniData ; 29 ; $1D
    32.     dc.w SonAni_Balance4 - SonicAniData ; 30 ; $1E
    33.     dc.w SupSonAni_Transform - SonicAniData ; 31 ; $1F
    34.     dc.w SonAni_Lying - SonicAniData    ; 32 ; $20
    35.     dc.w SonAni_LieDown - SonicAniData  ; 33 ; $21
    36.     dc.w SonAni_Peel - SonicAniData         ; 34 ; $22
    37.     dc.w SonAni_PeelCharge - SonicAniData   ; 35 ; $23
    38.     dc.w SonAni_PeelCharge2 - SonicAniData  ; 36 ; $24
    39.     dc.w SonAni_dash - SonicAniData         ; 37 ; $25
    40.     dc.w SonAni_pose - SonicAniData         ; 38 ; $26
    41.         dc.w SonAni_spindashcharge - SonicAniData        ; $27
    42.         dc.w SonAni_spindashcharge2 - SonicAniData        ; $28
    43.         dc.w SonAni_jumpdash - SonicAniData               ; $29
    44.         dc.w SonAni_jump - SonicAniData                   ; $2A ???
    45.         dc.w SonAni_Wallgrab - SonicAniData               ; 2B
    46.         dc.w SonAni_Duck2 - SonicAniData                  ; 2C
    47.         dc.w SonAni_SpindashRev - SonicAniData            ; 2D
    48.         dc.w SonAni_stompfall - SonicAniData
    49.         dc.w SonAni_Stand - SonicAniData
    50. SonAni_Walk:    dc.b $FF, $C,$D,$E,$F,$10,$11, $12, $13,$FF
    51. SonAni_Run: dc.b $FF,$2C,$2D,$2E,$2F,$FF,$FF,$FF,$FF,$FF
    52. SonAni_Roll:    dc.b $FE,$3C,$40,$3D,$40,$3E,$40,$3F,$40,$FF
    53. SonAni_Roll2:   dc.b $FE,$3C,$40,$3D,$40,$3E,$40,$3F,$40,$FF
    54. SonAni_Push:    dc.b $FD,$48,$49,$4A,$4B,$FF,$FF,$FF,$FF,$FF
    55. SonAni_Wait:
    56.     dc.b   5,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1
    57.     dc.b   1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  2
    58.     dc.b   3,  3,  3,  3,  3,  4,  4,  4,  5,  5,  5,  4,  4,  4,  5,  5
    59.     dc.b   5,  4,  4,  4,  5,  5,  5,  4,  4,  4,  5,  5,  5,  6,  6,  6
    60.     dc.b   6,  6,  6,  6,  6,  6,  6,  4,  4,  4,  5,  5,  5,  4,  4,  4
    61.     dc.b   5,  5,  5,  4,  4,  4,  5,  5,  5,  4,  4,  4,  5,  5,  5,  6
    62.     dc.b   6,  6,  6,  6,  6,  6,  6,  6,  6,  4,  4,  4,  5,  5,  5,  4
    63.     dc.b   4,  4,  5,  5,  5,  4,  4,  4,  5,  5,  5,  4,  4,  4,  5,  5
    64.     dc.b   5,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  4,  4,  4,  5,  5
    65.     dc.b   5,  4,  4,  4,  5,  5,  5,  4,  4,  4,  5,  5,  5,  4,  4,  4
    66.     dc.b   5,  5,  5,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  7,  8,  8
    67.     dc.b   8,  9,  9,  9,$FE,  6
    68. SonAni_Balance: dc.b   9,$CC,$CD,$CE,$CD,$FF
    69. SonAni_LookUp:  dc.b   5,$B,$FE,  1  ; 5, $B, $C,$FE,  1
    70. SonAni_Duck:    dc.b   5,$4C,$FE,  1
    71. SonAni_Spindash:dc.b   7,$41,$42,$43,$44,$FF   ; new spindash animation, uses 2 less frames than the original, and unlike the original does not use a frame between each
    72. SonAni_Blink:   dc.b   1,  2,$FD,  0
    73. SonAni_GetUp:   dc.b   3, $A,$FD,  0
    74. SonAni_Balance2:dc.b   3,$C8,$C9,$CA,$CB,$FF
    75. SonAni_Stop:    dc.b   5,$D1,$D2,$D3,$D4,$FD,  0 ; halt/skidding animation
    76. SonAni_Float:   dc.b   7,$54,$59,$FF
    77. SonAni_Float2:  dc.b   7,$54,$55,$56,$57,$58,$FF
    78. SonAni_Spring:  dc.b $2F,$5A,$FD,  2
    79. SonAni_Hang:    dc.b   1,$50,$51,$FF
    80. SonAni_Dash2:   dc.b  $F,$43,$43,$43,$FE,  1
    81. SonAni_Dash3:   dc.b  $F,$43,$44,$FE,  1
    82. SonAni_Hang2:   dc.b $13,$6B,$6C,$FF
    83. SonAni_Bubble:  dc.b  $B,$5A,$5A,$11,$12,$FD,  0 ; breathe
    84. SonAni_DeathBW: dc.b $20,$5E,$FF
    85. SonAni_Drown:   dc.b $20,$5D,$FF
    86. SonAni_Death:   dc.b $20,$5B,$FF
    87. SonAni_Hurt:    dc.b $40,$4E,$FF
    88. SonAni_Slide:   dc.b   9,$4E,$4F,$FF
    89. SonAni_Blank:   dc.b $77,  0,$FD,  0
    90. SonAni_Balance3: dc.b $13,$D0,$D1,$FF
    91. SonAni_Balance4: dc.b   3,$CF,$C8,$C9,$CA,$CB,$FE,  4
    92. SonAni_Lying:   dc.b   9,  8,  9,$FF
    93. SonAni_LieDown: dc.b   3,  7,$FD,  0
    94. SonAni_Peel:    dc.b $FF,$D7,$D8,$D9,$DA,$D7,$D8,$D9,$DA,$FF
    95. SonAni_PeelCharge:  dc.b 2, $E,$F,$10,$11,$2C,$2D,$2E,$2F,$FD,$24 ;3
    96. SonAni_PeelCharge2:dc.b   0,$D6,$D7,$D8,$D9,$D6,$D7,$D6,$D9,$FF
    97. SonAni_dash:    dc.b $20, $E7, $FD, 2
    98. Sonani_pose:    dc.b 0,$5D,$FF
    99. SonAni_spindashcharge:  dc.b 5,$3C,$40,$3D,$40,$3E,$40,$3F,$40,$FD,$28
    100. SonAni_spindashcharge2: dc.b 0,$3C,$40,$3D,$40,$3E,$40,$3F,$40,$FF
    101. SonAni_jumpdash:    dc.b 0,$E7,$E8,$FD,2
    102. SonAni_jump:    dc.b $FE,$3C,$40,$3D,$40,$3E,$40,$3F,$40,$FF
    103. SonAni_Wallgrab:        dc.b 0,$4B,$FF
    104. SonAni_Duck2:   dc.b   $2F,$4C,$FD,  0
    105. SonAni_SpindashRev:    dc.b 7,$E9,$EA,$EB,$EC,$FD, 9
    106. SonAni_stompfall:   dc.b   $2,$4C,$FD, $2F
    107. SonAni_Stand:   dc.b 0, $1,$FF
    108.     even
    109.  
    110.  
    111. SuperSonicAniData:
    112.     dc.w SupSonAni_Walk - SuperSonicAniData     ; 0
    113.     dc.w SupSonAni_Run - SuperSonicAniData          ; 1
    114.     dc.w SonAni_Roll - SuperSonicAniData            ; 2
    115.     dc.w SonAni_Roll2 - SuperSonicAniData           ; 3
    116.     dc.w SupSonAni_Push - SuperSonicAniData         ; 4
    117.     dc.w SupSonAni_Stand - SuperSonicAniData        ; 5
    118.     dc.w SupSonAni_Balance - SuperSonicAniData      ; 6
    119.     dc.w SonAni_LookUp - SuperSonicAniData          ; 7
    120.     dc.w SupSonAni_Duck - SuperSonicAniData         ; 8
    121.     dc.w SonAni_Spindash - SuperSonicAniData        ; 9
    122.     dc.w SonAni_Blink - SuperSonicAniData           ; 10 ; $A
    123.     dc.w SonAni_GetUp - SuperSonicAniData           ; 11 ; $B
    124.     dc.w SonAni_Balance2 - SuperSonicAniData        ; 12 ; $C
    125.     dc.w SonAni_Stop - SuperSonicAniData            ; 13 ; $D
    126.     dc.w SonAni_Float - SuperSonicAniData           ; 14 ; $E
    127.     dc.w SonAni_Float2 - SuperSonicAniData          ; 15 ; $F
    128.     dc.w SonAni_Spring - SuperSonicAniData          ; 16 ; $10
    129.     dc.w SonAni_Hang - SuperSonicAniData            ; 17 ; $11
    130.     dc.w SonAni_Dash2 - SuperSonicAniData           ; 18 ; $12
    131.     dc.w SonAni_Dash3 - SuperSonicAniData           ; 19 ; $13
    132.     dc.w SonAni_Hang2 - SuperSonicAniData           ; 20 ; $14
    133.     dc.w SonAni_Bubble - SuperSonicAniData          ; 21 ; $15
    134.     dc.w SonAni_DeathBW - SuperSonicAniData         ; 22 ; $16
    135.     dc.w SonAni_Drown - SuperSonicAniData           ; 23 ; $17
    136.     dc.w SonAni_Death - SuperSonicAniData           ; 24 ; $18
    137.     dc.w SonAni_Hurt - SuperSonicAniData            ; 25 ; $19
    138.     dc.w SonAni_Hurt - SuperSonicAniData            ; 26 ; $1A
    139.     dc.w SonAni_Slide - SuperSonicAniData           ; 27 ; $1B
    140.     dc.w SonAni_Blank - SuperSonicAniData           ; 28 ; $1C
    141.     dc.w SonAni_Balance3 - SuperSonicAniData        ; 29 ; $1D
    142.     dc.w SonAni_Balance4 - SuperSonicAniData        ; 30 ; $1E
    143.     dc.w SupSonAni_Transform - SuperSonicAniData    ; 31 ; $1F
    144.     dc.w SupSonAni_Peel - SuperSonicAniData         ; 32 ; 20
    145.     dc.w SupSonAni_PeelCharge - SuperSonicAniData   ; 33 ; 21
    146.     dc.w SupSonAni_PeelCharge2 - SuperSonicAniData  ; 34 ; 22
    147.  
    148. SupSonAni_Walk:     dc.b $FF,$77,$78,$79,$7A,$7B,$7C,$75,$76,$FF
    149. SupSonAni_Run:      dc.b $FF,$B5,$B9,$FF,$FF,$FF,$FF,$FF,$FF,$FF
    150. SupSonAni_Push:     dc.b $FD,$BD,$BE,$BF,$C0,$FF,$FF,$FF,$FF,$FF
    151. SupSonAni_Stand:    dc.b   7,$72,$73,$72,$73,$FF
    152. SupSonAni_Balance:  dc.b   9,$C2,$C3,$C4,$C3,$C5,$C6,$C7,$C6,$FF
    153. SupSonAni_Duck:     dc.b   5,$C1,$FF
    154. SupSonAni_Transform:    dc.b   2,$6D,$6D,$6E,$6E,$6F,$70,$71,$70,$71,$70,$71,$70,$71,$FD,  0
    155. SupSonAni_Peel:         dc.b   $FF,$B5,$B9,$B5,$B9,$B5,$B9,$B5,$B9,$FF
    156. SupSonAni_PeelCharge:   dc.b   2, $F,$77,$78,$79,$B5,$B9,$B5,$B9,$FD,$22 ;3
    157. SupSonAni_PeelCharge2:  dc.b   0,$B5,$B9,$B5,$B9,$B5,$B9,$B5,$B9,$FF
    158.     even
    That is the animation file, now however this is what I get in SonAni2Gif: [​IMG]
     
  8. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    SonAni2Gif is case sensitive with labels. In the table, you have "SonAni_pose", but in the mappings you have "Sonani_pose". It can't find the label, so it assumes a value of zero. 0 - 0 = 0, so 0 becomes the new "end of list/start of data" point, which causes the loop to end.
     
  9. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Ah alrighty, so it's me being lazy. Got it. >.<


    Edit: I got the animations to show up in the program, but when exported they show nothing at all...

    SonAni_PeelCharge: dc.b 2, $E,$F,$10,$11,$2C,$2D,$2E,$2F,$FD,$24 ;3
    SonAni_PeelCharge2: dc.b 0,$D6,$D7,$D8,$D9,$D6,$D7,$D6,$D9,$FF
    SonAni_dash: dc.b $20, $E7, $FD, 2
    SonAni_jumpdash: dc.b 0,$E7,$E8,$FD,2
    SonAni_SpindashRev: dc.b 7,$E9,$EA,$EB,$EC,$FD, 9
    SonAni_stompfall: dc.b $2,$4C,$FD, $2F


    Those animations do not export correctly.
     
  10. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    ...Okay, most of those are because I have it stop processing when it reaches a negative (> $7F) value, which is what Sonic 2's AnimateSprite does... but not Sonic_Animate. I have no idea what's up with SonAni_PeelCharge or SonAni_stompfall.

    Edit: frame values between $80 and $EF are now usable.
     
  11. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Edit: Nevermind, error was my fault.

    Program now seems to work without any problems. Nice work. :)
     
  12. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    A bugfix, and a new feature: S3K objects with DPLCs now display properly, and rather than simply rounding the frame delay to the nearest centisecond, it keeps track of the fractional remainder and adds one to the delay when it reaches one.
     
  13. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    A question MainMemory. Is it possible to get it to be able to export to .png?

    Not a big deal really... just curious. (Really just a question of personal preference.)