ASM Sonic the Fighters - Disassembly (and discoveries from it)

Discussion in 'Engineering & Reverse Engineering' started by biggestsonicfan, Jun 1, 2020.

  1. Ch1pper

    Ch1pper

    Fighting the Battle of Who Could Care Less Member
    685
    16
    18
    Life.
    Huh. A quick glance in-game reveal slight differences in the credits that are displayed:
    - "D.S.P. Programmer Katsunori Itai" and Sound Designer "Takenobu Mitsuyoshi" are skipped over; their names are listed in Special Thanks.
    - Also in Special Thanks are Goho Ogura, Syuji Takahashi and Susumu Takatsuka.

    ...Or is that the point? I could very well have missed something.
     
  2. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    While that is the point when I said the data is manipulated into what ends up finally being displayed, it concerns me that I didn't see a texture for those last 3 names listed... I'm gonna have to investigate this...
     
  3. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    I haven't fully analyzed the credits yet but I found unused content meant for the attract mode.

    Looks like there might have been alternate "subtitle" text in the Sonic the Fighters attract mode. Normally there are subtitles in Japanese text for the scrolling English words. If the game is set to the USA region, nothing appears there. That may not have always been the case.

    sfight045.png

    It should be noted that the text isn't centered properly because I had to adjust the coordinates myself.

    There is also an unused scrolling text ala REVENGE OF DR. ROBOTONIC that says: WHO WILL CHALLENGE "DEATH EGGII"?
    001.png 002.png 003.png

    However I can't really implement it in the game because the text spans 3 textures, and all other areas which the scrolling text is used only spans 2 textures.

    More unused attract mode stuff will be posted as I make it clearly visible.
     
    • Informative Informative x 3
    • List
  4. qwertysonic

    qwertysonic

    Member
    594
    138
    43
    creating the biggest sonic collection
    Who will challenge death?
     
  5. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    Beta Bork (sort of):
    sfight073.png sfight074.png sfight075.png

    Bark apparently went threw a few iterations. The oldest of which use the very, very light tone. This head uses a slightly darker tone, but has his hair tucked under his cap. This unused wincing face (aside from his squished head) is the only one like this. Then you can see his spiky hair (from final Bark) which is the darkest of the 3 different tones.
     
    Last edited: May 13, 2021
  6. SanicDerpy

    SanicDerpy

    Member
    33
    5
    8
    ???
    SMPS2MID & MID2SMPS Conversions and learning to draw.
    Interesting discovery so far! Btw (not to be political) your post says "Bork" like from the Swedish Chef not "Bark" as in you know the polar bear.
     
  7. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    I know I am just being silly.
     
  8. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    So remember this? Yeah, well, the game actually never calls this array or the routine that uses it. It's literally an unused credit sequence. If I figure out how to activate it I will record it, but in the mean time, I need to understand how the credits that do get displayed actually activate in the game's code :british:
     
  9. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    Because I have nothing else to do in life, have some restored code that was previously unrefrenced!
    sfight079.png sfight080.png

    Restored code on the left, what it looks like normally on the right.

    It looks like Ranking data originally just displayed how many times a character beat the game without anything else. I had to fudge with the "RANK TIME NAME CHARACTER" texture to remove it to get this to display properly, else the text was displaying inside the texture which didn't look very nice. You can kind of see where "SONIC" and "FANG" are eating into the RANKING texture itself.
     
  10. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    I apologize for the lack of steam here, but it's hard to identify anything "new" or "different" these days. Also there are a lot of mistakes and undisassembled code in the current repo as of this post, and I am trying to work diligently to refresh the repo with the latest disassembly.

    Until then, there have been some interesting discoveries, as @egregiousguy figured out how to unravel the larger textures from the game.

    e-mech.png

    The lower "E-MECH STARTING UP" is never seen on the final stage with the Mecha Eggman.


    unused-casino-1.png

    In the casino night stage, text can be seen in the background, such as on the slot machine. This appears to be the same font, but isn't used anywhere.

    unused-casino-2.png

    The blimp in the background of the casino night stage has a similar looking font, but this isn't used.

    There are a few other odd things but I can't really tell if they are unused or not.
     
    • Informative Informative x 1
    • List
  11. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    People have claimed in Sonic the Fighters that sometimes fighters can have different winning poses. As it turns out, they can, but it's sudo-random, involving a calculation with the game timer and what the match timer max is set to.

    This is a chart of all the animation values in 4 tables. I believe only 3 of the tables are actually used, however:

    Screenshot_20210822_134710.png

    There also appears to be some logic for holding down a button press but it's... not as clear as "Hold Punch" or "Hold Barrier"... I'll update when I figure this out.
     

    Attached Files:

    • Like Like x 2
    • Informative Informative x 2
    • List
  12. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
  13. SuperSnoopy

    SuperSnoopy

    I like Sonic Advance Member
    1,274
    257
    63
    Lyon, France
    Drawing, studying Japanese
    Looks like Rouge wasn't going to be this series' first furry bait lol
     
  14. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    The amount of hidden content in this game is absolutely mind boggling

     
    • Informative Informative x 2
    • List
  15. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    Alright, so I may have accidentally ran before I could walk here... the menus in the post above are indeed available in the regular debug mode.

    The reason I believed they were new is because of how I typically access debug mode, which is via memory hacking in the LUA script via a keybind. If debug mode is properly accessed via inputs, this mode automatically becomes available by pressing the test menu button with the debug mode flags properly set.

    I will upload a new video and put a disclaimer and card on the old video informing people of the update.
     
    • Informative Informative x 1
    • List
  16. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    Until I make that video, I have been smoothing over some of the stuff in the disassembly and forgot about these. They were partially shown off a while ago in the debug mode discovery thread, but these are the full resolution textures. Yes, they take up the entirety of the screen!

    sfight104.png sfight105.png
     
  17. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    sfight130.png

    The amount of unused data for menus is absolutely staggering
     
    • Like Like x 2
    • Informative Informative x 1
    • List
  18. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    There was some discussion if the "ENEMY RANK" in the Game Assignments menu made any difference in gameplay in the Sonic the Fighters discord today. I decided to investigate.

    Code (Text):
    1. ROM:00011B48 max_energy_init:                        # CODE XREF: ROM:00006B00↑p
    2. ROM:00011B48                                         # CONTINUE_DSP-4FB4↑p ...
    3. ROM:00011B48                 ldob    var_diff, r4    # 0 = normal
    4. ROM:00011B48                                         # 0 = easy
    5. ROM:00011B48                                         # 1 = hard
    6. ROM:00011B48                                         # 2 = hardest
    7. ROM:00011B50                 ld      add_BACKUP_RAM_TO_RAM, r5
    8. ROM:00011B58                 ldob    0x3342(r5), r5  # r5 = BACKUP_RAM_TO_RAM+0x3342
    9. ROM:00011B60                 ldib    working_rate, r15
    10. ROM:00011B68                 stib    r15, use_working
    11. ROM:00011B70                 ld      float_5_0[r4*4], r8
    12. ROM:00011B78                 ld      float_5_1[r4*4], r9
    13. ROM:00011B80                 ld      add_BACKUP_RAM_TO_RAM, r10
    14. ROM:00011B88                 ldob    0x3344(r10), r10 # r10 = BACKUP_RAM_TO_RAM+0x3344
    15. ROM:00011B90                 ld      add_BACKUP_RAM_TO_RAM, r11
    16. ROM:00011B98                 ldob    0x3343(r11), r11 # r11 = BACKUP_RAM_TO_RAM+0x3343
    17. ROM:00011BA0                 ldos    max_energy_vs_list[r10*2], r10 # r10 = 1; then r10 = 8C
    18. ROM:00011BA8                 ldos    max_energy_1p_list[r11*2], r11
    19. ROM:00011BB0                 st      r8, float_5_0_ram
    20. ROM:00011BB8                 st      r9, float_5_1_ram
    21. ROM:00011BC0                 stos    r10, val_vs_energy_max
    22. ROM:00011BC8                 stos    r11, val_1p_energy_max
    23. ROM:00011BD0                 ret
    This is the code that initializes the maximum energy for 1p and versus matches. The difficulty "var_diff" is 0 for both normal and easy, 1 for hard, and 2 for hardest. At offsets 0x11B70 and 0x11B78, two array values are grabbed based on the difficulty setting:

    Code (Text):
    1. ROM:00011BF4 float_5_0:      .float 5.0              # DATA XREF: max_energy_init+28↑r
    2. ROM:00011BF8                 .float 5.0
    3. ROM:00011BFC                 .float 5.0
    4. ROM:00011C00                 .float 5.0
    5. ROM:00011C04 float_5_1:      .float 5.0              # DATA XREF: max_energy_init+30↑r
    6. ROM:00011C08                 .float 5.0
    7. ROM:00011C0C                 .float 5.0
    8. ROM:00011C10                 .float 5.0
    As you can see, it does not matter if "var_diff" is 0 to 3, all values returned will be a float value of "5.0". The code at offset 0x11BB0 and 0x11BB8 store these values to RAM offsets 0x50A700 (float_5_0_ram) and 0x50A704 (float_5_1_ram) respectively.

    The only instance the game ever uses these memory offsets are in this subroutine, and writing the float value of "5.0" to them every time. They are not referenced anywhere else in the game's code and the only other time they would be written to would be when the game boots and initializes all RAM to 0.

    I can only assume this code is carryover from FV or VF2, but I haven't investigated that yet. So an arcade operator wanting to change the game to the "HARDEST" difficult to earn more quarters, well Sega gave them a placebo.

    EDIT: Okay so it looks like the enemy rank definitely does something to the AI, but I'm not sure what or how. In any case this particular part of the code is unused.
     
    Last edited: Oct 2, 2021
    • Informative Informative x 1
    • List
  19. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,323
    223
    43
    Formerly Sonic the Fighters
    Continuing my investigation on how the AI works, it looks like variables are put into what the game looks at to make decisions based on the level id and difficulty:

    (Where g4 is mod_fa_enemy0 if the CPU is Player 1 OR mod_fa_enemy1 if the CPU is Player 2.)
    Code (Text):
    1. ROM:0003B250                 ldob    LEVEL_ID, r3    # Load level AI
    2. ROM:0003B258                 and     0xF, r3, r3
    3. ROM:0003B25C                 shlo    5, r3, r3
    4. ROM:0003B260                 ld      add_BACKUP_RAM_TO_RAM, r15
    5. ROM:0003B268                 ldob    0x3342(r15), r15 # match_enemy_rank
    6. ROM:0003B270                 and     3, r15, r15
    7. ROM:0003B274                 ld      match_enemy_rank_data[r15*4], r5
    8. ROM:0003B27C                 lda     (r5)[r3], r4
    9. ROM:0003B280                 ld      0x0(r4), r15
    10. ROM:0003B284                 st      r15, 0x44(g4)
    11. ROM:0003B288                 ld      4(r4), r15
    12. ROM:0003B28C                 st      r15, 0x48(g4)
    13. ROM:0003B290                 ldis    8(r4), r15
    14. ROM:0003B294                 stis    r15, 0x4C(g4)
    15. ROM:0003B298                 ldis    0xA(r4), r15
    16. ROM:0003B29C                 stis    r15, 0x4E(g4)
    17. ROM:0003B2A0                 ldib    0xC(r4), r15
    18. ROM:0003B2A4                 stib    r15, 0x54(g4)
    19. ROM:0003B2A8                 ldib    0xD(r4), r15
    20. ROM:0003B2AC                 stib    r15, 0x55(g4)
    21. ROM:0003B2B0                 ldib    0xE(r4), r15
    22. ROM:0003B2B4                 stib    r15, 0x56(g4)
    23. ROM:0003B2B8                 ldib    0xF(r4), r15
    24. ROM:0003B2BC                 stib    r15, 0x57(g4)
    25. ROM:0003B2C0                 ldib    0x10(r4), r15
    26. ROM:0003B2C4                 stib    r15, 0x58(g4)
    27. ROM:0003B2C8                 ldib    0x11(r4), r15
    28. ROM:0003B2CC                 stib    r15, 0x59(g4)
    29. ROM:0003B2D0                 ldib    0x12(r4), r15
    30. ROM:0003B2D4                 stib    r15, 0x5A(g4)
    31. ROM:0003B2D8                 ldib    0x13(r4), r15
    32. ROM:0003B2DC                 stib    r15, 0x5B(g4)
    33. ROM:0003B2E0                 ldib    0x14(r4), r15
    34. ROM:0003B2E4                 stib    r15, 0x5C(g4)
    35. ROM:0003B2E8                 ldib    0x15(r4), r15
    36. ROM:0003B2EC                 stib    r15, 0x5D(g4)
    37. ROM:0003B2F0                 ldib    0x16(r4), r15
    38. ROM:0003B2F4                 stib    r15, 0x5E(g4)
    Here is match_enemy_rank_data
    Code (Text):
    1. ROM:0003EF60 match_enemy_rank_data:.long match_enemy_rank_data_easy
    2. ROM:0003EF60                                         # DATA XREF: sub_3B22C+48↑r
    3. ROM:0003EF64                 .long match_enemy_rank_data_normal
    4. ROM:0003EF68                 .long match_enemy_rank_data_hard
    5. ROM:0003EF6C                 .long match_enemy_rank_data_hardest
    Each set of "enemy rank data" is approximately 0x300 bytes long. Well, after match_enemy_rank_data_hardest there are two additional data sets of "enemy rank data" both 0x300 bytes long! The data itself loaded per character (actually level/stage) isn't understood yet, so I do not know what these additional sets of data might have done, or if they were even harder. A code to replace HARD and HARDEST settings in ENEMY RANK is below:

    Code (Text):
    1. -- Script by biggestsonicfan
    2. function Init()
    3.     Romset_PatchDWord(0,0x3EF68, 0x00093428) -- Patch HARD difficulty to first unknown difficulty setting
    4.     Romset_PatchDWord(0,0x3EF6C, 0x00093728) -- Patch HARDEST difficulty to second unknown difficulty setting
    5. end
    Plop this in sfight.lua under the scripts folder (or add to any additional script you may have) and give it a whirl!
     
    Last edited: Oct 10, 2021