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

Reply
 
Thread Tools
  #1    
Old March 25th, 2013 (2:31 AM). Edited March 25th, 2013 by Jambo51.
Jambo51's Avatar
Jambo51 Jambo51 is offline
Glory To Arstotzka
     
    Join Date: Jun 2009
    Gender: Male
    Nature: Quiet
    Posts: 732
    Have you ever noticed that FireRed only has 3 pieces of encounter music for trainerbattles? How limiting! Even using Mastermind_X's code doesn't improve things that much, since it requires careful setting and clearing of variables.

    Have you ever wished that you could just define which "Music" number in A-Trainer applied to which track in the ROM?

    If so, this hack is for you!

    Firstly, assemble this code, remembering to change the YY to the number of encounter tracks you will have - 1 (That is, if you have encounter tracks 0-7 (a total of 8), you would put 7 as the YY number).

    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global exclaimhack
    
    main:
    ldr r1, table // Creates a new table for the music to be put on
    cmp r0, #0xYY /*This is the number of encounter music track you want
    to have. If you use a value above this, it loads slot 3 of the table as a
    failsafe*/
    ble back
    mov r0, #0x0 // If the slot the game is trying to load is too large, defaults to this slot to prevent crashes
    back: lsl r0, r0, #0x1 // Multiplies the slot ID by 2
    add r1, r0, r1 // Adds the Slot ID to the Table location
    ldrh r0, [r1, #0x0] // Loads the actual song ID from the table
    ldr r1, place // Returns to normal execution
    bx r1
    .align
    place: .word 0x080806BB
    table: .word 0x08FFFFFF
    Then, in a hex editor, navigate to 0x80650, and overwrite the data there with this:
    Code:
    00 49 08 47 XX XX XX 08
    Where the XX's stand for the pointer to the new routine plus 1.

    All this does is reads the "music" byte which accompanies every trainer battle, and reads a newly created table. This table should have a half word for each entry. Which represents which music slot will be played for that music byte. Create your table wherever you like, then change the table: .word 0x08FFFFFF to be a pointer to this new table.

    Build the table like so:

    Code:
    [Track to Play 0][Track to Play 1]
    putting in as many entries as you defined above (so, using my earlier example, entries 0 to 7.

    So, if you wanted 0x11B to be Encounter 0, 0x11C to be 1 and 0x11D to be 2 (as an example), your table would be:
    Code:
    1B 01 1C 01 1D 01
    Easy, isn't it!
    __________________
    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 March 25th, 2013 (7:04 PM).
    RPD490's Avatar
    RPD490 RPD490 is offline
       
      Join Date: Jan 2009
      Location: Blackthorn City, Johto
      Gender: Male
      Nature: Relaxed
      Posts: 175
      Makes me curious, what exactly are the numbers for the Music function in A-Trainer, I mean there isn't any guide or references to tell you what number goes to what theme. It is rather annoying.
      __________________
      This signature has been disabled.
      Signature is over 600px wide :(
      Please review and fix the issues by reading the signature rules.

      You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

      Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
      Reply With Quote
        #3    
      Old April 3rd, 2013 (8:46 AM).
      GoGoJJTech's Avatar
      GoGoJJTech GoGoJJTech is offline
      (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
      • Gold Tier
       
      Join Date: Nov 2012
      Location: Earth
      Age: 18
      Gender: Female
      Nature: Jolly
      Posts: 2,477
      How do you come up with this jambo?
      You just keep proving yourself to be a guru
      __________________
      I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this into your signature.
      The HGSS Music Patch - The BW/2 Music Patch - ASM: Switch Music Based on Seasons
      Romhack.me Profile - Pokecommunity Profile - Youtube Channel

      Support me at my site!
      Pokémon Platinum Red and Blue
      Reply With Quote
        #4    
      Old April 5th, 2013 (5:11 AM).
      Jambo51's Avatar
      Jambo51 Jambo51 is offline
      Glory To Arstotzka
         
        Join Date: Jun 2009
        Gender: Male
        Nature: Quiet
        Posts: 732
        Quote:
        Originally Posted by RPD490 View Post
        Makes me curious, what exactly are the numbers for the Music function in A-Trainer, I mean there isn't any guide or references to tell you what number goes to what theme. It is rather annoying.
        It's defined by ASM in the background to be (basically) this:

        Code:
        if (musicNumber == 1)
        {
            return 0x11C;
        }
        else if (musicNumber == 0)
        {
            return 0x11D;
        }
        else
        {
            return 0x11B;
        }
        Which works for FR's setup, but isn't much good for what we need to do with it in hacking terms. There are other numbers which refer to the music tracks of course, but largely what I showed above is accurate.

        Quote:
        Originally Posted by gogojjtech View Post
        How do you come up with this jambo?
        Usually boredom combined with an annoyance at a limitation of the engine.

        Quote:
        Originally Posted by gogojjtech View Post
        You just keep proving yourself to be a guru
        No, just... no. Lol.
        __________________
        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 September 21st, 2014 (3:40 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
          How about controlling and extending VICTORY MUSIC? I want to make assigned victory themes for teams, E4, and champion. That's a last thing i need. Thanks.
          __________________

          Userpage


          Pokémon Dark Jade Version (Coming Soon!)


          The Omsoc Empire (Coming Soon!)
          Reply With Quote
          Reply
          Quick Reply

          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 1:32 AM.