ASM Sonic 3 & Knuckles Hacking

Discussion in 'Engineering & Reverse Engineering' started by Alex Field, Aug 29, 2021.

  1. Alex Field

    Alex Field

    シュート! カオス・エメラルド・ザが消えようとしている! Member
    129
    73
    28
    Downunda, Mobius
    Sonic the Hedgehog 2+, Sonic the Hedgehog 3+
    "Because hackers can't avoid this game forever." - Alex Field, 2021

    Restore Full Super Sonic Palette Cycle:
    This first one is actually related somewhat to a bug in Sonic the Hedgehog 2.

    Specifically, hackers discovered awhile back that the palette cycle for Super Sonic is actually a lot smoother than what is seen in-game, having a proper loop instead of abruptly cutting:

    As-is:
    [​IMG]

    Intended:
    [​IMG]

    Well, as it turns out, this is actually caused by a minor logic error; at "SuperHyper_PalCycle_SuperSonic", you'll see this piece of code.
    Code (Text):
    1.         ; increment palette frame and update Sonic's palette
    2.         lea    (PalCycle_SuperSonic).l,a0
    3.         move.w    (Palette_frame).w,d0
    4.         addq.w    #6,(Palette_frame).w    ; next frame
    5.         cmpi.w    #$36,(Palette_frame).w    ; is it the last frame?
    6.         blo.s    loc_3898        ; <-- if not, branch
    7.         move.w    #$24,(Palette_frame).w    ; reset frame counter (Super Sonic's normal palette cycle starts at $24. Everything before that is for the palette fade)
    The problem is that the game is using 'blo' (branch on lower) instead of 'bls' (branch on lower or equal to), which causes it to miss the last frame of the palette cycle.

    Now that you're aware of the problem, the fix is quite simple, just change it to a 'bls'; keep in mind this also has to be changed at "loc_679D2" (the AIZ1 introduction).

    Sonic 3 Alone Level Select Code in Sonic & Knuckles:
    It's well-known at this point that the Sonic 3 Alone level select code is notoriously hard to input, but did you know it's in Sonic 3 & Knuckles too?

    Indeed! By searching up "S3_Level_Select_Code" in sonic3k.asm, you can see the original coding to handle the... code, with the only modification being a return command; even more interesting, it is not only does the Sonic 3 & Knuckles title screen branch to it, but so does the Sonic & Knuckles title screen.

    Humorously, the way the branch was handled in the Sonic 3 & Knuckles title screen makes it so that it can be inputted after the title screen pops-up; the only prototype this was useful in was Sonic & Knuckles 0608, and even then that was only via lock-on.
     
  2. Clownacy

    Clownacy

    Tech Member
    837
    79
    28
    its title doesn't really make it clear, but this type of thread already exists for Sonic 3 & Knuckles: https://forums.sonicretro.org/index.php?threads/sonic-3-hacking.30778/

    It's a shame that threads like these get buried considering all the neat stuff in them. Aside from having these threads pinned, the only other solution I can think of is to put these fixes on the wiki instead of the forum.
     
    Last edited: Aug 29, 2021
  3. JcFerggy

    JcFerggy

    Do you want to taco 'bout it? Member
    1,322
    23
    18
    Nova Scotia, Canada
    GoldenEye: Source, Other Stuff
    Having these sort of fixes on the wiki would be the ideal solution for easier reference in the future, but more onto that; I'm surprised that a bugfix project has never happened over the communities 20 year history.

    I realize this thread isn't the right place for such a conversation, but occasionally I'll come across articles online talking about fan improvement hacks like the SA-1 improvement hacks for certain SNES games, or DX colorized hacks of original Game Boy games, and I wonder why the Sonic community only comparable example is Sonic 3D Blast: Directors Cut? I suppose the discussion of the recommend way to play Sonic 1, 2, CD, and 3K can already summarized as "The mobile ports" and "Sonic 3 AIR". I'm not asking for a Sonic 1 SIR or Sonic 2 WIR equivalent, but I think a hack that compiles all the bug and slow down fixes, while keeping the game experience fairly vanilla would be appreciated by the greater rom hacking community. Tails and Knuckles can be ported if desired (spindash too), as they are as the original trio, but that's the most I'd want to stray from the originals. Other hacks like Sonic Classic Heroes fill that void for now, but a dedicated project to preserving the originals would be neat.
     
  4. Clownacy

    Clownacy

    Tech Member
    837
    79
    28
    If it helps, I did something like that for Sonic 2.
     
  5. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,548
    142
    43
    SonLVL
    The problem is, "Sonic 2 but there's no bugs" isn't really exciting by itself. Also, Sonic 3D Blast Director's Cut doesn't really count, that's the original developer working with the source code, not the community.

    Also, you're ignoring all the stuff that's been done for 3D games, SADX and SA2 have tons of mods that fix things and add improvements, Sonic Riders DX has been making the rounds at SAGE, and there's certainly more that I'm not thinking of.
     
  6. Alex Field

    Alex Field

    シュート! カオス・エメラルド・ザが消えようとしている! Member
    129
    73
    28
    Downunda, Mobius
    Sonic the Hedgehog 2+, Sonic the Hedgehog 3+
    I agree; sure, some hacks (Sonic 3 Unlocked and Sonic 2: TRoDE) do include a lot of bug fixes, but they also take a lot of liberties with their source material.
     
  7. Black Squirrel

    Black Squirrel

    furthermore known as the JAMs Wiki Sysop
    6,395
    616
    93
    Northumberland, UK
    wiki wild wild west
    In a weird sense I'm almost less bothered about "fixing" the bugs as documenting them:

    Sonic the Hedgehog 3/Bugs
    Sonic & Knuckles/Bugs
    Sonic the Hedgehog 3 & Knuckles/Bugs

    Not that I'm against an all-encompassing "fan revision" (although Sonic 3: AIR probably covers most issues), but it's nice to know what's wrong, so people can come up with their own fixes.

    Because yes, things do get lost in the forums.