Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old December 30th, 2012 (7:08 AM). Edited June 24th, 2013 by Jambo51.
Jambo51's Avatar
Jambo51 Jambo51 is offline
Glory To Arstotzka
     
    Join Date: Jun 2009
    Gender: Male
    Nature: Quiet
    Posts: 732
    Hey there, Jambo51 here with another ASM/Hex editing combination tutorial.

    In Fire Red, you will surely have noticed, that apart from a few specific classes (Champion, Leader and Elite 4) there is absolutely no class based music for the trainer battles. Generally speaking, that is fine, since you don't want the average Youngsters etc to have special battle music, but what about Team Rocket? Shouldn't they have a special battle theme?

    What?!

    You can't do that with Fire Red?!

    I beg to differ! Follow this tutorial, and we'll have class based music in no time!

    So, firstly, assemble and insert this routine, and note down the location of your insert.

    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global battlemusichack
    
    main:
    	ldr r0, there
    	ldr r1, [r0, #0x0]
    	mov r0, #0x80
    	lsl r0, r0, #0x5
    	and r0, r1
    	cmp r0, #0x0
    	bne later
    	mov r0, #0x80
    	lsl r0, r0, #0x7
    	and r0, r1
    	cmp r0, #0x0
    	bne later2
    	mov r0, #0x2
    	and r0, r1
    	cmp r0, #0x0
    	beq one
    later2:	mov r0, #0x85
    	lsl r0, r0, #0x1
    	b return2
    later:	mov r0, #0x95
    	lsl r0, r0, #0x1
    	b return2
    one:	mov r0, #0x8
    	and r1, r0
    	cmp r1, #0x0
    	beq wild
    	ldr r2, table
    	ldr r2, [r2, #0x0]
    	ldr r0, ramoffset
    	ldrh r1, [r0, #0x0]
    	lsl r0, r1, #0x2
    	add r0, r0, r1
    	lsl r0, r0, #0x3
    	add r0, r0, r2
    	ldrb r0, [r0, #0x1]
    	cmp r0, #0x54
    	beq gym
            cmp r0, #0x57
            beq gym
            cmp r0, #0x5A
            beq champ
    normal:	push {r2,r3}
    	ldr r3, terminate
    	ldr r1, classtable
    loop:	ldrh r2, [r1, #0x0]
    	cmp r2, r0
    	beq loadmusic
    	cmp r2, r3
    	beq carryon
    	add r1, #0x4
    	b loop
    carryon:	mov r0, #0x2
    	pop {r2,r3}
    	b return
    loadmusic:	ldrh r0, [r1, #0x2]
    	pop {r2,r3}
    	b return2
    wild:	ldr r0, there
    	ldr r0, [r0, #0x0]
    	mov r1, #0x1
    	and r0, r1
    	cmp r0, #0x0
    	bne alternate
    	mov r0, #0x0
    	b return
    alternate:	mov r0, #0x1
    	b return
    gym:	mov r0, #0x3
    	b return
    champ:	mov r0, #0x4
    return:	push {r2-r7}
    	mov r11, r0
    	ldr r0, variable
    	bl vardecrypt
    	ldrh r0, [r0, #0x0]
    	mov r1, #0xA
    	mul r0, r1
    	ldr r1, normaltable
    	add r0, r0, r1
    	mov r1, r11
    	lsl r1, r1, #0x1
            add r0, r0, r1
    	ldrh r0, [r0, #0x0]
    	mov r1, #0x0
    	mov r11, r1
    	pop {r2-r7}
    return2:	pop {r1}
    	bx r1
    vardecrypt:	ldr r1, vardec
    	bx r1
    .align
    table:		.word 0x08044028
    there:		.word 0x02022B4C
    ramoffset:	.word 0x020386AE
    terminate:	.word 0x0000FEFE
    classtable:	.word 0x08FDFDFD
    normaltable:	.word 0x08FEFEFE
    vardec:		.word 0x0806E455
    variable:	.word 0x000040F6
    Now, navigate to 0x43FF2 and change the code to 01 48 00 47 00 00 XX XX XX 08, where the XX's stand for your reversed pointer to the ASM you just inserted, plus 1 for THUMB mode, of course.

    Now, we're still not done, of course, so return to the location of the inserted ASM.

    Now, we must create a table which contains definitions for the class based music. This allows you to define as many EXTRA classes as you want, but you CANNOT change the music assigned to the Champion/Elite 4/Gym Leaders using this.

    So, in some aligned free space, create a table in this format:

    [Trainer Class - Byte][00 - Byte][Song to play - Half-Word]

    So, for example, I wanted the Team Rocket class to have track 0x130, I would put the following set of bytes into the table:

    Code:
    55 00 30 01
    You must do this for every class you wish to have custom music.

    When you're done with this, place:

    FE FE 00 00 at the end of the table, so in my example, it would be:

    Code:
    55 00 30 01 FE FE 00 00
    Easy, huh? Note down the location of this table and navigate to The ASM's insert location + 0xC0. Change the pointer here (should be FD FD FD 08) to point to the table you just created, NOT plus one.

    Now, for anyone who knows ASM, or is eagle eyed, you will have noticed it also contains a variable check. This variable check allows you to have regional music!

    Now, to create a set of regional music, navigate to some aligned free space, and start by putting the following set of values in:

    Code:
    2A 01 54 01 29 01 28 01 2B 01
    You may recognise these as the existing battle theme track numbers. If you don't intend to use regional music, you can move on from here straight to the changing the pointer later on.

    However, if you want regional music, you should follow the existing values with this format:

    [Wild Battle Track - Half-Word][Double Wild Battle Track - Half-Word][Trainer Battle Track - Half-Word][Gym Battle Track - Half-Word][Champion Battle Track - Half-Word]

    If you want any tracks to use the same values as their "normal" versions, you must set them to the same value. Eg, I want tracks 0x10A (wild), 0x140 (double wild), 0x109 (trainer), 0x154 (gym) but want to keep the Champion battle as 0x12B, then I would add the following values:

    Code:
    0A 01 40 01 09 01 54 01 2B 01
    When you're done adding new values, note down the start location of this table, and then navigate to the start of the ASM + 0xC4. The pointer here should be FE FE FE 08. Now you must change it to point to the new regional table you just created.

    Once you have done this, you are done!

    In terms of in game use, you don't have to do anything to get the class based music, it will immediately start working. For the regional music, you must set variable number 0x40F6 to the set of regional music you want to use.

    That is, for the "normal" set, set the variable to 0, and for any additional sets, set it to the correct number to pick that set. Everything else is handled in the background.
    __________________
    Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
    Reply With Quote

    Relevant Advertising!

      #2    
    Old December 30th, 2012 (4:12 PM).
    tajaros's Avatar
    tajaros tajaros is offline
    Hi I'm dawg
       
      Join Date: Apr 2012
      Location: Philippines
      Age: 18
      Gender: Male
      Nature: Timid
      Posts: 857
      This is great Jambo it would be really cool to have a specific music for a trainer class... :3

      I'm gonna try this out for my hack thanks for sharing this :)
      __________________
      Reply With Quote
        #3    
      Old December 30th, 2012 (11:32 PM).
      SchokoInc SchokoInc is offline
         
        Join Date: Nov 2012
        Posts: 20
        Awesome thanks :) Great tutorial :)
        But somehow it causes the title screen to freeze and also the begin of every battle :(

        This is what i did:
        I assembled your routine and inserted it at offset 0x800000
        (code:
        Spoiler:
        2C 48 01 68 80 20 40 01 08 40 00 28 FE D1 80 20 C0 01 08 40 00 28 03 D1 02 20 08 40 00 28 02 D0 85 20 40 00 FE E7 08 20 01 40 00 29 1E D0 20 4A 12 68 21 48 01 88 88 00 40 18 C0 00 80 18 40 78 54 28 1D D0 57 28 1B D0 5A 28 1B D0 0C B4 1B 4B 1B 49 0A 88 82 42 06 D0 9A 42 01 D0 04 31 F8 E7 02 20 0C BC 0F E0 48 88 0C BC 1C E0 11 48 00 68 01 21 08 40 00 28 01 D1 00 20 04 E0 01 20 02 E0 03 20 00 E0 04 20 FC B4 83 46 10 48 00 F0 0D F8 00 88 0A 21 48 43 0B 49 40 18 59 46 40 18 00 88 00 21 8B 46 FC BC 02 BC 08 47 07 49 08 47 C0 46 28 40 04 08 4C 2B 02 02 AE 86 03 02 FE FE 00 00 D0 00 08 08 FE FE FE 08 55 E4 06 08 F 640 00 00

        (D0 00 08 08 is the pointer to the table at 0x8000D0)


        Then i replaced offset 0x043FF2 with 01 48 00 47 00 00 01 00 80 08

        And finally i added 55 00 0A 01 FE FE 00 00 at offset 0x8000D0 which should make the hoenn-trainer-battle music play when I'd fight rocket grunts :)

        Do you know what went wrong? :)
        Reply With Quote
          #4    
        Old December 31st, 2012 (5:49 AM).
        Jambo51's Avatar
        Jambo51 Jambo51 is offline
        Glory To Arstotzka
           
          Join Date: Jun 2009
          Gender: Male
          Nature: Quiet
          Posts: 732
          You've not set up the regional part of the hack. Even of you don't intend to use the regional music, you must still set up the "normal" set of music. You also screwed up your pointer to the class music, it points to 0x800D0 instead of 0x8000D0, like it should.
          __________________
          Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
          Reply With Quote
            #5    
          Old December 31st, 2012 (1:09 PM).
          SchokoInc SchokoInc is offline
             
            Join Date: Nov 2012
            Posts: 20
            Oh thanks i didn't get i had to do that too even if i don't use it :< (the FEFEFE08 bytes still confused me :o ) but even with the pointers changed to D0 00 80 08 and 00 01 80 08 and
            0A 01 40 01 09 01 54 01 2B 01 inserted at 0x800100 the game still freezes right at the intro :< (not even the game-freak-logo anymore :o ) while it already plays the screen-fading before a battle and freezes afterwards and not before :) Oh and a-map can't open any maps in the rom anymore :O Sorry for bothering again :(
            Reply With Quote
              #6    
            Old December 31st, 2012 (1:48 PM).
            Jambo51's Avatar
            Jambo51 Jambo51 is offline
            Glory To Arstotzka
               
              Join Date: Jun 2009
              Gender: Male
              Nature: Quiet
              Posts: 732
              Quote:
              Originally Posted by SchokoInc View Post
              Oh thanks i didn't get i had to do that too even if i don't use it :< (the FEFEFE08 bytes still confused me :o ) but even with the pointers changed to D0 00 80 08 and 00 01 80 08 and
              0A 01 40 01 09 01 54 01 2B 01 inserted at 0x800100 the game still freezes right at the intro :< (not even the game-freak-logo anymore :o ) while it already plays the screen-fading before a battle and freezes afterwards and not before Oh and a-map can't open any maps in the rom anymore :O Sorry for bothering again
              I don't know what the second half of that post actually means, as to the title screen freezing (or earlier) that could only happen if there's some sort of conflict with another existing hack, or if you screwed up somewhere, since this is the same code that runs in LC (and runs fine, I may add).
              __________________
              Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
              Reply With Quote
                #7    
              Old January 1st, 2013 (11:20 AM).
              FrozenInfernoZX's Avatar
              FrozenInfernoZX FrozenInfernoZX is offline
              What is out there?
                 
                Join Date: Jun 2012
                Location: United States
                Gender: Male
                Nature: Adamant
                Posts: 769
                Awesome. Since I'll be having two regions in my hack. Regional music would great!
                __________________

                Current Live Update: Build 3.0 RC 2.73 No more Flag Errors!
                Always periodically make backup saves!
                Reply With Quote
                  #8    
                Old January 1st, 2013 (2:00 PM).
                PokemonMasters's Avatar
                PokemonMasters PokemonMasters is offline
                Always Remember Forever&After
                   
                  Join Date: Jun 2012
                  Location: Nuvema Town, Unova
                  Gender: Male
                  Nature: Calm
                  Posts: 403
                  Oh wow, this is cool. This will really be helpful. Thanks for sharing Jambo! :D
                  __________________

                  +ForeverDash on PC's Battle Server | Pair | VM/PM |Partner In Crime
                  Reply With Quote
                    #9    
                  Old January 5th, 2013 (1:25 PM).
                  bwburke94's Avatar
                  bwburke94 bwburke94 is offline
                  Still Aspertia's Aspie
                     
                    Join Date: Mar 2010
                    Location: Belchertown, Massachusetts
                    Age: 22
                    Gender: Male
                    Nature: Lonely
                    Posts: 742
                    Since double wild battles aren't coded into the hack I'm making, should I set that half-word to the wild battle track?
                    __________________
                    3DS Friend Code: 0645-5804-7602
                    Reply With Quote
                      #10    
                    Old January 5th, 2013 (3:57 PM).
                    Jambo51's Avatar
                    Jambo51 Jambo51 is offline
                    Glory To Arstotzka
                       
                      Join Date: Jun 2009
                      Gender: Male
                      Nature: Quiet
                      Posts: 732
                      Quote:
                      Originally Posted by bwburke94 View Post
                      Since double wild battles aren't coded into the hack I'm making, should I set that half-word to the wild battle track?
                      You can set it to whatever you like.
                      __________________
                      Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
                      Reply With Quote
                        #11    
                      Old January 5th, 2013 (10:35 PM).
                      bwburke94's Avatar
                      bwburke94 bwburke94 is offline
                      Still Aspertia's Aspie
                         
                        Join Date: Mar 2010
                        Location: Belchertown, Massachusetts
                        Age: 22
                        Gender: Male
                        Nature: Lonely
                        Posts: 742
                        Quote:
                        Originally Posted by Jambo51 View Post
                        You can set it to whatever you like.
                        OK, that's good to know. I'll use the wild battle music just in case.
                        __________________
                        3DS Friend Code: 0645-5804-7602
                        Reply With Quote
                          #12    
                        Old February 4th, 2013 (12:42 PM). Edited February 4th, 2013 by SchokoInc.
                        SchokoInc SchokoInc is offline
                           
                          Join Date: Nov 2012
                          Posts: 20
                          Turns out I was just VEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEERY bad at hex editing sorry :( But well as everything is fine now (and team rocket finally has their own battle theme) i noticed that trainer, gym and champ-battles are silent now (but wild battles still do and i can change their theme with the regional table). Is it possible that this happens due to me not having any wild double battles? :(

                          EDIT.: fixed it.
                          and the byte responsible for the wild double battle changes the rivals battle theme for me o.O
                          Reply With Quote
                            #13    
                          Old May 22nd, 2013 (1:23 AM).
                          vizor vizor is offline
                             
                            Join Date: Dec 2011
                            Gender: Female
                            Posts: 25
                            I tried it for a german Firred ROM, and found all the ROM Offsets i need, but somehow it doesnt work for me. All Trainerbattle are muted now and every time i walk in a wildbattle, game freezes isntantly. I guess its because of the RAM-Offsets, wich may be different in FRE and FRD.
                            But how can i find those?
                            Reply With Quote
                              #14    
                            Old July 3rd, 2013 (6:41 AM).
                            xGal xGal is offline
                            Mhm
                               
                              Join Date: Nov 2011
                              Location: A tree
                              Gender: Other
                              Nature: Relaxed
                              Posts: 243
                              Quote:
                              Originally Posted by SchokoInc View Post
                              Oh thanks i didn't get i had to do that too even if i don't use it :< (the FEFEFE08 bytes still confused me :o ) but even with the pointers changed to D0 00 80 08 and 00 01 80 08 and
                              0A 01 40 01 09 01 54 01 2B 01 inserted at 0x800100 the game still freezes right at the intro :< (not even the game-freak-logo anymore :o ) while it already plays the screen-fading before a battle and freezes afterwards and not before Oh and a-map can't open any maps in the rom anymore :O Sorry for bothering again
                              There thing freezes your TitleScreen/Intro is so simple that I am considuring that to "funny". Make sure you're on Overwrite mode on your Hex Editor, NEVER insert! (That's what jambo told me hihi). Second, while pasting the ASM code into the ROM, make sure you don't press CTRL+V to paste. NEVER! It is "Paste Insert". Use CTRL+B. It's Paste Overwrite. Well, I'd like to hear if it worked or not
                              __________________
                              Reply With Quote
                                #15    
                              Old July 6th, 2013 (1:08 PM).
                              designmadman designmadman is offline
                                 
                                Join Date: Dec 2012
                                Location: USA
                                Gender: Male
                                Nature: Adamant
                                Posts: 13
                                Here's a YouTube tutorial for this: youtube.com/watch?v=EtlUiGeydHQ
                                Reply With Quote
                                  #16    
                                Old July 17th, 2013 (2:56 PM).
                                xGal xGal is offline
                                Mhm
                                   
                                  Join Date: Nov 2011
                                  Location: A tree
                                  Gender: Other
                                  Nature: Relaxed
                                  Posts: 243
                                  Quote:
                                  Originally Posted by designmadman View Post
                                  Here's a YouTube tutorial for this: youtube.com/watch?v=EtlUiGeydHQ
                                  Yea, sure there is, because I created it . Of course Jambo gave me permission for making that, if he wouldn't give me, I will never do a tutorial on this. It just follows the original tutorial (this) to help people that don't know how to ASM.
                                  __________________
                                  Reply With Quote
                                    #17    
                                  Old May 1st, 2014 (10:06 PM).
                                  You Watanabe's Avatar
                                  You Watanabe You Watanabe is offline
                                  Now Leaving...
                                     
                                    Join Date: Feb 2014
                                    Location: Shiganshina District, Wall Maria
                                    Gender: Female
                                    Nature: Adamant
                                    Posts: 430
                                    What program do you use to do this? :/
                                    __________________

                                    Userpage


                                    Pokémon Dark Jade Version (Coming Soon!)


                                    The Omsoc Empire (Coming Soon!)
                                    Reply With Quote
                                      #18    
                                    Old May 1st, 2014 (10:36 PM).
                                    Shadowraze's Avatar
                                    Shadowraze Shadowraze is offline
                                    ur mum
                                       
                                      Join Date: Apr 2013
                                      Location: ur mum
                                      Age: 18
                                      Gender: Other
                                      Nature: Lonely
                                      Posts: 798
                                      Quote:
                                      Originally Posted by RaileysXerilyasRX View Post
                                      What program do you use to do this? :/
                                      Well to insert it you need a Hex Editor(HxD), and an ASM Compiler. I suggest you learn how to compile ASM codes first and get the basics in using a Hex Editor.
                                      Reply With Quote
                                        #19    
                                      Old May 4th, 2014 (4:01 AM). Edited May 18th, 2014 by You Watanabe.
                                      You Watanabe's Avatar
                                      You Watanabe You Watanabe is offline
                                      Now Leaving...
                                         
                                        Join Date: Feb 2014
                                        Location: Shiganshina District, Wall Maria
                                        Gender: Female
                                        Nature: Adamant
                                        Posts: 430
                                        Quote:
                                        Originally Posted by Shadowraze View Post
                                        Well to insert it you need a Hex Editor(HxD), and an ASM Compiler. I suggest you learn how to compile ASM codes first and get the basics in using a Hex Editor.
                                        Ahh. I see. Ok. Well, I just don't know about this "ASM" thing. :3

                                        Quote:
                                        Originally Posted by Jambo51 View Post
                                        Hey there, Jambo51 here with another ASM/Hex editing combination tutorial.

                                        In Fire Red, you will surely have noticed, that apart from a few specific classes (Champion, Leader and Elite 4) there is absolutely no class based music for the trainer battles. Generally speaking, that is fine, since you don't want the average Youngsters etc to have special battle music, but what about Team Rocket? Shouldn't they have a special battle theme?

                                        What?!

                                        You can't do that with Fire Red?!

                                        I beg to differ! Follow this tutorial, and we'll have class based music in no time!

                                        So, firstly, assemble and insert this routine, and note down the location of your insert.

                                        Code:
                                        .text
                                        .align 2
                                        .thumb
                                        .thumb_func
                                        .global battlemusichack
                                        
                                        main:
                                        	ldr r0, there
                                        	ldr r1, [r0, #0x0]
                                        	mov r0, #0x80
                                        	lsl r0, r0, #0x5
                                        	and r0, r1
                                        	cmp r0, #0x0
                                        	bne later
                                        	mov r0, #0x80
                                        	lsl r0, r0, #0x7
                                        	and r0, r1
                                        	cmp r0, #0x0
                                        	bne later2
                                        	mov r0, #0x2
                                        	and r0, r1
                                        	cmp r0, #0x0
                                        	beq one
                                        later2:	mov r0, #0x85
                                        	lsl r0, r0, #0x1
                                        	b return2
                                        later:	mov r0, #0x95
                                        	lsl r0, r0, #0x1
                                        	b return2
                                        one:	mov r0, #0x8
                                        	and r1, r0
                                        	cmp r1, #0x0
                                        	beq wild
                                        	ldr r2, table
                                        	ldr r2, [r2, #0x0]
                                        	ldr r0, ramoffset
                                        	ldrh r1, [r0, #0x0]
                                        	lsl r0, r1, #0x2
                                        	add r0, r0, r1
                                        	lsl r0, r0, #0x3
                                        	add r0, r0, r2
                                        	ldrb r0, [r0, #0x1]
                                        	cmp r0, #0x54
                                        	beq gym
                                                cmp r0, #0x57
                                                beq gym
                                                cmp r0, #0x5A
                                                beq champ
                                        normal:	push {r2,r3}
                                        	ldr r3, terminate
                                        	ldr r1, classtable
                                        loop:	ldrh r2, [r1, #0x0]
                                        	cmp r2, r0
                                        	beq loadmusic
                                        	cmp r2, r3
                                        	beq carryon
                                        	add r1, #0x4
                                        	b loop
                                        carryon:	mov r0, #0x2
                                        	pop {r2,r3}
                                        	b return
                                        loadmusic:	ldrh r0, [r1, #0x2]
                                        	pop {r2,r3}
                                        	b return2
                                        wild:	ldr r0, there
                                        	ldr r0, [r0, #0x0]
                                        	mov r1, #0x1
                                        	and r0, r1
                                        	cmp r0, #0x0
                                        	bne alternate
                                        	mov r0, #0x0
                                        	b return
                                        alternate:	mov r0, #0x1
                                        	b return
                                        gym:	mov r0, #0x3
                                        	b return
                                        champ:	mov r0, #0x4
                                        return:	push {r2-r7}
                                        	mov r11, r0
                                        	ldr r0, variable
                                        	bl vardecrypt
                                        	ldrh r0, [r0, #0x0]
                                        	mov r1, #0xA
                                        	mul r0, r1
                                        	ldr r1, normaltable
                                        	add r0, r0, r1
                                        	mov r1, r11
                                        	lsl r1, r1, #0x1
                                                add r0, r0, r1
                                        	ldrh r0, [r0, #0x0]
                                        	mov r1, #0x0
                                        	mov r11, r1
                                        	pop {r2-r7}
                                        return2:	pop {r1}
                                        	bx r1
                                        vardecrypt:	ldr r1, vardec
                                        	bx r1
                                        .align
                                        table:		.word 0x08044028
                                        there:		.word 0x02022B4C
                                        ramoffset:	.word 0x020386AE
                                        terminate:	.word 0x0000FEFE
                                        classtable:	.word 0x08FDFDFD
                                        normaltable:	.word 0x08FEFEFE
                                        vardec:		.word 0x0806E455
                                        variable:	.word 0x000040F6
                                        Now, navigate to 0x43FF2 and change the code to 01 48 00 47 00 00 XX XX XX 08, where the XX's stand for your reversed pointer to the ASM you just inserted, plus 1 for THUMB mode, of course.

                                        Now, we're still not done, of course, so return to the location of the inserted ASM.

                                        Now, we must create a table which contains definitions for the class based music. This allows you to define as many EXTRA classes as you want, but you CANNOT change the music assigned to the Champion/Elite 4/Gym Leaders using this.

                                        So, in some aligned free space, create a table in this format:

                                        [Trainer Class - Byte][00 - Byte][Song to play - Half-Word]

                                        So, for example, I wanted the Team Rocket class to have track 0x130, I would put the following set of bytes into the table:

                                        Code:
                                        55 00 30 01
                                        You must do this for every class you wish to have custom music.

                                        When you're done with this, place:

                                        FE FE 00 00 at the end of the table, so in my example, it would be:

                                        Code:
                                        55 00 30 01 FE FE 00 00
                                        Easy, huh? Note down the location of this table and navigate to The ASM's insert location + 0xC0. Change the pointer here (should be FD FD FD 08) to point to the table you just created, NOT plus one.

                                        Now, for anyone who knows ASM, or is eagle eyed, you will have noticed it also contains a variable check. This variable check allows you to have regional music!

                                        Now, to create a set of regional music, navigate to some aligned free space, and start by putting the following set of values in:

                                        Code:
                                        2A 01 54 01 29 01 28 01 2B 01
                                        You may recognise these as the existing battle theme track numbers. If you don't intend to use regional music, you can move on from here straight to the changing the pointer later on.

                                        However, if you want regional music, you should follow the existing values with this format:

                                        [Wild Battle Track - Half-Word][Double Wild Battle Track - Half-Word][Trainer Battle Track - Half-Word][Gym Battle Track - Half-Word][Champion Battle Track - Half-Word]

                                        If you want any tracks to use the same values as their "normal" versions, you must set them to the same value. Eg, I want tracks 0x10A (wild), 0x140 (double wild), 0x109 (trainer), 0x154 (gym) but want to keep the Champion battle as 0x12B, then I would add the following values:

                                        Code:
                                        0A 01 40 01 09 01 54 01 2B 01
                                        When you're done adding new values, note down the start location of this table, and then navigate to the start of the ASM + 0xC4. The pointer here should be FE FE FE 08. Now you must change it to point to the new regional table you just created.

                                        Once you have done this, you are done!

                                        In terms of in game use, you don't have to do anything to get the class based music, it will immediately start working. For the regional music, you must set variable number 0x40F6 to the set of regional music you want to use.

                                        That is, for the "normal" set, set the variable to 0, and for any additional sets, set it to the correct number to pick that set. Everything else is handled in the background.
                                        Nice work! It worked by the way! :D Well, what about for victory themes?
                                        __________________

                                        Userpage


                                        Pokémon Dark Jade Version (Coming Soon!)


                                        The Omsoc Empire (Coming Soon!)
                                        Reply With Quote
                                          #20    
                                        Old November 30th, 2014 (5:58 AM).
                                        You Watanabe's Avatar
                                        You Watanabe You Watanabe is offline
                                        Now Leaving...
                                           
                                          Join Date: Feb 2014
                                          Location: Shiganshina District, Wall Maria
                                          Gender: Female
                                          Nature: Adamant
                                          Posts: 430
                                          Quote:
                                          Originally Posted by Alexalphawolf View Post
                                          Hi sir Jambo I am Alex and this is my first blog to pokecommunity.I was wondering if you could help me out with my hack on pokemon fire red as I also checked the video of youtube but still am having problem.I want to put the CHAMPION class battle music on PKMN TRAINER class music.I also donot have the trainer editor that you created that can tell you the number of the player classes.I need your help.I can give you my hacked file of fire red so can you do me this favour or if you cannot then can you give me the trainer class editor that you created please no mediafire link because it keeps on giving the captchas.Thanks.by Alex form Alexalphaworld.blogspot.com
                                          http://www.pokecommunity.com/attachment.php?attachmentid=69465&d=1377878402
                                          Actually, it has the trainer class numbers (in hex)... and look for the music ini from advance map to check songs in hex. good luck dude. Hope this helps you.
                                          __________________

                                          Userpage


                                          Pokémon Dark Jade Version (Coming Soon!)


                                          The Omsoc Empire (Coming Soon!)
                                          Reply With Quote
                                            #21    
                                          Old February 26th, 2015 (9:56 AM).
                                          Alquimia2101 Alquimia2101 is offline
                                             
                                            Join Date: Nov 2014
                                            Gender: Male
                                            Posts: 1
                                            Quote:
                                            Originally Posted by Jambo51 View Post
                                            I don't know what the second half of that post actually means, as to the title screen freezing (or earlier) that could only happen if there's some sort of conflict with another existing hack, or if you screwed up somewhere, since this is the same code that runs in LC (and runs fine, I may add).
                                            Hello happens to me something like that in my case only begins the battle but no music.
                                            Reply With Quote
                                              #22    
                                            Old June 27th, 2015 (4:31 PM).
                                            Bela's Avatar
                                            Bela Bela is offline
                                            Pokémon Rose Creator
                                            • Silver Tier
                                             
                                            Join Date: Apr 2009
                                            Location: United States
                                            Age: 27
                                            Gender: Male
                                            Nature: Modest
                                            Posts: 332
                                            Touched wrote an asm routine for me that lets you play custom victory music for a Trainer based on its class, mimicking the format of Jambo's routine here. I'm posting it here because he's too lazy to do it. =P

                                            Code:
                                            .thumb
                                            .align 2
                                            
                                            main:
                                                lsl r0, r1, #2
                                                add r0, r1
                                                lsl r0, #3
                                                add r0, r2
                                                ldrb r0, [r0, #1]
                                            
                                                mov r1, r0
                                                push {r1-r3}
                                                bl search
                                                pop {r1-r3}
                                                cmp r0, #0
                                                bne play_custom
                                            
                                                mov r0, r1
                                                ldr r1, =(0x0801570E + 1)
                                                bx r1
                                            
                                            play_custom:
                                                ldr r1, =(0x080722A0 + 1)
                                                bl linker
                                                ldr r1, =(0x0801576E + 1)
                                                bx r1
                                            
                                            linker:
                                                bx r1
                                            
                                            search:
                                                ldr r3, =0xFEFE
                                            
                                                ldr r2, victory_table
                                            
                                            search_loop:
                                                ldrh r1, [r2]
                                                cmp r1, r3
                                                beq search_return_none
                                            
                                                cmp r1, r0
                                                beq search_found
                                            
                                                add r2, #4
                                                b search_loop
                                            
                                            search_return_none:
                                                mov r0, #0
                                                b search_return
                                            
                                            search_found:
                                                ldrh r0, [r2, #2]
                                            
                                            search_return:
                                                bx lr
                                            
                                            .align 2
                                            victory_table: .word 0x08AAAAAA
                                            So, following what Jambo did with his routine, you would create a table in this format:

                                            [Trainer Class - Byte][00 - Byte][Song to play - Half-Word]

                                            So, for example, say you want the Team Aqua class to have track 0x130 as the victory theme to play when you beat them. You would put the following set of bytes into the table:

                                            Code:
                                            03 00 30 01
                                            As before, you must do this for every class you wish to have custom music.

                                            When you're done with this, place:

                                            FE FE at the end of the table (as opposed to FEFE0000 like Jambo had you do with his routine). So to finish the example, it would be:

                                            Code:
                                            03 00 30 01 FE FE
                                            Take the offset of your table and replace it with the 0x8AAAAAA you see in the routine. So if your table offset is say 0x845670, you would write 0x8845670 into the routine instead.

                                            Now you need to hook your routine so the game will read it. To do this, go to offset 0x15704 and write the following:

                                            Code:
                                            00 48 00 47 XX+1 XX XX 08
                                            Where the XXs are your routine +1. So in our example, you would put the following at 0x15704:

                                            Code:
                                            00 48 00 47 71 56 84 08
                                            And there you go!
                                            __________________
                                            Reply With Quote
                                            Reply

                                            Quick Reply

                                            Join the conversation!

                                            Create an account to post a reply in this thread, participate in other discussions, and more!

                                            Create a PokéCommunity Account

                                            Sponsored Links
                                            Thread Tools

                                            Posting Rules
                                            You may not post new threads
                                            You may not post replies
                                            You may not post attachments
                                            You may not edit your posts

                                            BB code is On
                                            Smilies are On
                                            [IMG] code is On
                                            HTML code is Off

                                            Forum Jump


                                            All times are GMT -8. The time now is 12:09 PM.