don't click here

[S3K] 2nd player CPU trigger

Discussion in 'Engineering & Reverse Engineering' started by MK, Jun 20, 2008.

Thread Status:
Not open for further replies.
  1. MK

    MK

    Hacker Oldbie
    310
    0
    0
    New England, USA
    Secret :o o:
    Alright so, this is a simple question: what's the location in the ram that tells the game to add Tails?

    I know Player 1 is located at 006AD2/4 and Player 2 at 006AF0/2, but I can't find the location that triggers it to load P2 in the first place, as if you selected Sonic and Tails from the save menu.
     
  2. I'm not quite sure what you mean, but if you want to know how the game chooses which characters to select, it's through the flag, in RAM, at $FFFF08. If this is 0, the game initializes Sonic and Tails objects, if it's 1, it only initializes Sonic, if it's 2, Tails, and if it's 3, Knuckles. The player initialization routine, at $6A76, handles player object initialization on the basis of this flag.
     
  3. MK

    MK

    Hacker Oldbie
    310
    0
    0
    New England, USA
    Secret :o o:
    Well for example, something as simple as getting Knuckles and Tails.

    The way I tried was to start Sonic and Tails, but to force it to load Knuckles into slot 1. However it still loads Sonic's objects and palette.

    So, I tried starting as Knuckles, and forcing Tails as player 2, but since it doesn't flag player 2 to load, Tails doesn't appear. So I need the flag to get it to tell Tails to appear.
     
  4. MathUser

    MathUser

    3rd top wiki contributor Researcher
    2,151
    8
    18
    Play sonic 3 delta, I think you can have tails follow knuckles on it.
     
  5. MK

    MK

    Hacker Oldbie
    310
    0
    0
    New England, USA
    Secret :o o:
    I meant, so I can learn, and do other things with it :P
     
  6. There's no separate flag to tell Tails to appear, Tails only loads as a second player when $FFFF08 is 0. However, what you can do is replace the rts in Knux alone's loading routine with a branch to the Tails Sidekick loading routine. Unfortunately, the branch distance (-$88) is too big to fit in a short branch, so you'll have to overwrite the following instruction, which will mess up slot machine bonus stage loading, but anyway, to do it, just replace the 4E75 at 6B74 with 6000 FF78.

    EDIT: To clarify, what that does is, instead of returning from the subroutine, it branches back to the place where Tails' initialization is handled (inside the Sonic & Tails initialization part). It's much simpler to do stuff like this in ASM, although I think there are a lot of alignment directives which have to be placed inside Stealth's disasm for it to be able to work with location shifts.
     
  7. MoDule

    MoDule

    Tech Member
    327
    24
    18
    Procrastinating from writing bug-fix guides
    The first object in RAM (player 1 during levels) is stored at $FFB000, the next one at $FFB04A. The first four bytes of each object in RAM are a long pointer to the object's code, so if you want the game to load Knuckles instead of Sonic you'd have to change the longword at $FFB000 from $00010A94 to $00016444. This will cause Knuckles to be blue and the game will still think you're Sonic, but Tails will be following you.
    Alternatively, you could change the second object in RAM to be Tails during a Knuckles game. To do this you need to write $0001365C to $FFB04A. Tails won't be there right away, but he'll fly in from above soon enough.

    Be warned, though! If you change these anywhere outside a level the game will crash.

    Edit: wait! Are you using ASM or hacking RAM values with AR codes?
     
  8. MathUser

    MathUser

    3rd top wiki contributor Researcher
    2,151
    8
    18
    So will you charge people to watch you do these "other things" to it?
     
  9. MK

    MK

    Hacker Oldbie
    310
    0
    0
    New England, USA
    Secret :o o:
    The blue Knuckles is what I referenced before, "The way I tried was to start Sonic and Tails, but to force it to load Knuckles into slot 1. However it still loads Sonic's objects and palette." For now I'm screwing with the RAM, as I figure that'd be a precursor to ASM locations and whatnot, and I plan on making an ASM S3K hack.

    ... What?
     
  10. MoDule

    MoDule

    Tech Member
    327
    24
    18
    Procrastinating from writing bug-fix guides
    Did you try this already:
    Tails's position only gets set during player mode 0 (Sonic and Tails), so that's why he's not there right away.
    It will be very hard to get this working 100% with RAM hacking alone.
    Oh, and, go you, if you're making an ASM hack of s3k. It's about time.
     
  11. MK

    MK

    Hacker Oldbie
    310
    0
    0
    New England, USA
    Secret :o o:
    Hm, Tails just won't appear. I'll have to try other things. And thanks; however I'm still learning ASM so you probably won't see anything in a while. I won't make any thread about it until I have some sorta of release.
     
Thread Status:
Not open for further replies.