Announcement

Collapse
No announcement yet.

Hacking a joker code on the Nintendo DS that uses the same address multiple times

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hacking a joker code on the Nintendo DS that uses the same address multiple times

    Hello again. So last night night I got the urge to find a music modifier for Sonic 1 on Sonic Classic Collection. So I was able to hack it, and I ran into a problem I've never run into before. I realized that I can't make this code with the normal button hacking method. (I can't just put the the joker address on top and the music address at the bottom)
    I can't do it because the music address is the only address I need, however, I have to use it multiple times to achieve the affect I want.

    What I want to do is, make it so you can hold Select and press Right to go from song 1 to 2,3,4, ect. And then hold Select and press Left to go from song 4 to 3,2,1 ect. I have never hacked a joker code that uses the same address multiple times, I tried, but that just didn't work for me.

    If anyone has any answers I would love to hear them. Thanks for any help in advance.
    I'm retired from code hacking.
    I do not take requests!

  • #2
    What's the problem, it increments the variable too quickly? On other systems, the way to prevent that is to set up a flag. I don't remember DS code types, so here's the gist:

    Code:
    IF NOT REQUIRED_BUTTONS
      FLAG = 0
    ENDIF
    IF REQUIRED_BUTTONS
      IF FLAG IS ZERO
        FLAG = 1
        INCREMENT SONG
      ENDIF
    ENDIF
    Presumably, you need to roll back around to 1 or something, as the songs probably don't run from 0-FF, but I leave that to you.

    Comment


    • #3
      Are you referring to a code that cycles through the music? To make sure that it only +/- 1 to the value in the address per button press, ASM would be the best solution; however, this method also works because it just slows down the execution.

      Code:
      74000100 FF00000C //slow down the execution
      94000130 FFEB0000 //check for select_right
      D9000000 02xxxxxx //load the value at your music address...
      D4000000 00000001 //add 0x1 to it
      D6000000 02xxxxxx //store it back
      D0000000 00000000 //end if
      94000130 FFDB0000 //check for select_left
      D9000000 02xxxxxx //load the value at your music address...
      D4000000 FFFFFFFF //add -0x1 (subtract 0x1)
      D6000000 02xxxxxx //store it back
      D2000000 00000000 //end
      Note: You probably won't need a 32-bit load and store so adjust those to your liking.
      Edit 1: Also, if you're unfamiliar with NDS Code types, Pyriel's example looks like this:

      Code:
      A4000130 FFEB0000 //if you're not pressing select_right
      12000000 00000000 //flag = 0
      D0000000 00000000 //end if
      94000130 FFEB0000 //if you are pressing select_right
      92000000 00000000 //if flag = 0
      12000000 00000001 //flag = 1
      DA000000 02xxxxxx //load song
      D4000000 00000001 //increment song
      D7000000 02xxxxxx //store it
      D2000000 00000000 //end
      and it works just fine (probably a lot better than messing with the execution timer).
      I only bother with things that interest me.

      Comment


      • #4
        Originally posted by Demonic722
        Are you referring to a code that cycles through the music?
        Yes, I am.

        Hmm. I'm still not that good with asm. This might be difficult for me, but I'll do my best no matter what. Thank you guys for trying to help me understand this. I'll give it my best shot. I also hate how I have to screw with the code just to make it not freeze on my Nintendo DS. I have a few questions for you Demonic, but I'll ask them later in a PM or something.

        Edit:I also had no idea joker codes could even do that! Wow! This is incredibly useful to know, thanks!
        Last edited by Dybbles; 05-20-2013, 06:54:15 PM.
        I'm retired from code hacking.
        I do not take requests!

        Comment


        • #5
          In the thread that I linked the ASM reference for nds there is another file there that has great examples like locking a code like what your trying to do so it doesnt go past whatever track you set it to so it doesnt glitch when trying to play music past the known tracks. I used this code type for a kirby game so I could cycle powers and not go past the last ability and freeze the game.
          Spoiler Alert! Click to view...

          THE BAD GUY!!!!!!

          Comment

          Working...
          X