Oxnite Posted April 26, 2012 Posted April 26, 2012 (edited) When you're spotted by another Trainer, you hear a certain kind of music. For example, when an Ace Trainer or Veteran Trainer has spotted you, this music's being played: http://www.youtube.com/watch?v=KJ4HsOAZwho And when you are about to battle a Psychic, you hear this strange music: http://www.youtube.com/watch?v=HTFbRZT-HCs The encounter music is determined by the Trainer Class you are about to battle. If you are about to battle a Psychic with an Ace Trainer's overworld sprite, you still hear the Psychic's encounter music. tl;dr Is there a way to edit the encounter music and assign a different encounter music to a certain Trainer Class? ------------------------------------------------------------------------------------------------------------------------------------------------ Additional information For example, I am going to add the Aroma Lady Trainer Class in my hack. Therefore, I am replacing an old Trainer Class, the Baker. But I want a different encounter music because I find the ''Parasol Lady'' music better for the Aroma Lady: http://www.youtube.com/watch?v=ac1JCG7vsAI In other words, can I assign the Parasol Lady encounter music to the Baker's Trainer Class? Edited January 29, 2016 by Oxnite
Andibad Posted April 27, 2012 Posted April 27, 2012 if you mean changing sound on NPC? you can using : Method 1 : go to http://projectpokemon.org/forums/showthread.php?21005-B-W-Champion-Music (changing some hex value on SDat, using crystaltile and hex editor) actually is same because all sound is stored on sdat except for pokemon musical. Method 2 : ...
Oxnite Posted May 1, 2012 Author Posted May 1, 2012 (edited) Thanks a lot for your reply, Andibad, but I already found something else. Actually thanks to elementking, who taught me that the arm9.bin file is compressed. By decompressing it, I found very valuable hex data. So in the decompressed arm9.bin file, I actually found data for the encounter music. The offset is, exactly, 0xA35C8. The first line is as follows: 02 00 5A 04 03 00 5B 04 04 00 5A 04 05 00 5B 04 32 00 5D 04 02 00 means Trainer Class 2 (which is the Youngster). 5A 04 corresponds with the different Trainer Class music versions. 5A 04 is the Youngster, joyful encounter music: ''EYE1''. The following is a complete list with Encounter music, in combination with their hex numbers: 045A Youngster045B Lass045C Twins045D Ace Trainer045E Roughneck045F Parasol Lady0460 Cyclist0461 Psychic0462 Scientist0463 Harlequin0464 Hiker0465 Clerk0466 Gentleman0467 If you look at the third and fourth hex digits, it shows the following. 03 00 means Trainer Class 3 (which is the Lass). 5B 04 corresponds with ''EYE2''. Which is true. Even more: 32 00 means Trainer Class 50 (which is the Male Ace Trainer). 5D 04 corresponds with ''EYE4''. Which is true again. I checked EVERY Trainer Class this way and it works like this everytime. For example, Trainer Class 23 00, which is the Psychic (Male) Trainer Class, has 04 61 = EYE8 encounter music. This again is true. In other words, this must be the correct data. The narc even says field_sound_system at the top of this data. HOWEVER! Here's the problem that I would like some help with. When I change a certain number (either the Trainer Class number or the corresponding ''EYE'' music number), literally nothing happens. I really don't know what I'm doing wrong. It could possibly be the way I insert / extract (decompress / compress) the arm9.bin file. Though I'm pretty sure I do it the correct way. Could anybody somehow test this?.. Or does anybody know what I am doing wrong? Or whether there could be anything else I have to change? I really doubt it because this data is so.. obviously right. Edited May 11, 2012 by Oxnite
Andibad Posted May 2, 2012 Posted May 2, 2012 Yes you right. But i think is have missing step (last i touch arm9.bin, i was done to recompress them correctly and replace is seems correct, after i test it is nothing but another problem i was break arm9 ). Is another method and seems you try change id trainer on *.bin . For now i can't help you about edit arm and overllay stuff, i no have time to do or prepare them because my brain was mixed with my midtest is very very hard And sorry i can't help you maybe mid july i get my time PS: and your new beta is make me relax a while , and you have time to teach me something i can't? For arm9 and overllay i was know about them and thank you for you explain but i was know about that. Yeah swarming pokemon too on that part. I using CUE for compressing and dscemp for decompressing.
Oxnite Posted May 2, 2012 Author Posted May 2, 2012 Yes you right. But i think is have missing step (last i touch arm9.bin, i was done to recompress them correctly and replace is seems correct, after i test it is nothing but another problem i was break arm9 ). Is another method and seems you try change id trainer on *.bin . For now i can't help you about edit arm and overllay stuff, i no have time to do or prepare them because my brain was mixed with my midtest is very very hard And sorry i can't help you maybe mid july i get my time PS: and your new beta is make me relax a while , and you have time to teach me something i can't? For arm9 and overllay i was know about them and thank you for you explain but i was know about that. Yeah swarming pokemon too on that part. I using CUE for compressing and dscemp for decompressing. So in other words, arm9.bin always .. breaks when you try to recompress it? Could that be causing the problems? And could you maybe tell me the offset for the Swarm Pokémon?
supagokuman2 Posted June 4, 2012 Posted June 4, 2012 i inserted my own song to the rival battle, but it stops after a while and the battle is just mute. Do you know how to fix that?
supagokuman2 Posted June 4, 2012 Posted June 4, 2012 How do I loop it? Plus, the song is a bit slow. On another song I also did it has long pauses.
Kaphotics Posted June 4, 2012 Posted June 4, 2012 this thread is about assigning different pre-existing music to a trainer, not assigning new music. there's a few guides on how to loop sseq's (I know pokecommunity has one), so look there; change the bpm in your midi editor (fl studio etc)
supagokuman2 Posted June 4, 2012 Posted June 4, 2012 You're right, and I have successfully looped it, but it's missing some instruments and at parts slows down/speeds up, or plays the same note for a long period of time. If you can help, PM me. ON-TOPIC: That music that plays as an encounter is th EYE files, right?
Bond697 Posted June 4, 2012 Posted June 4, 2012 So in other words, arm9.bin always .. breaks when you try to recompress it? Could that be causing the problems?And could you maybe tell me the offset for the Swarm Pokémon? you don't need to recompress it. just put it back in. MIi_UncompressBackwards() just won't do anything when it goes to decompress the arm9 on booting. it should work. e: btw, i just did the disassembly. this is a lookup table of trainer ids and music that is accessed by the subroutine at 2029E38. the function takes the id of the trainer and uses that to look up what music matches that. interesting little routine. e2: here you go: http://pastebin.com/7XHzR3ys RAM_ARM9:02029E38 ; =============== S U B R O U T I N E ======================================= RAM_ARM9:02029E38 RAM_ARM9:02029E38 RAM_ARM9:02029E38 ; u16 __fastcall getNPCBattleMusic__(u16 npcID) RAM_ARM9:02029E38 getNPCBattleMusic__ RAM_ARM9:02029E38 18 B4 PUSH {R3,R4} RAM_ARM9:02029E3A 0A 4A LDR R2, =word_20A75C8 ; LUT pointer RAM_ARM9:02029E3C 00 24 MOVS R4, #0 ; int i = 0 RAM_ARM9:02029E3E 11 88 LDRH R1, [R2] ; load first LUT entry, see if we even need to loop RAM_ARM9:02029E40 69 29 CMP R1, #0x69 ; 'i' ; this should pretty much never be equal RAM_ARM9:02029E42 0C D0 BEQ loc_2029E5E RAM_ARM9:02029E44 RAM_ARM9:02029E44 loc_2029E44 ; CODE XREF: getNPCBattleMusic__+24j RAM_ARM9:02029E44 A3 00 LSLS R3, R4, #2 ; each entry is 4 bytes (u16 npcID and u16 songVal), so loop counter *4 to hit each entry in a row RAM_ARM9:02029E46 D1 5A LDRH R1, [R2,R3] ; LUT_base + loop_counter * 4 to run through each entry, fetching the npcID to test against the passed arg RAM_ARM9:02029E48 88 42 CMP R0, R1 ; npcID == LUTnpcID RAM_ARM9:02029E4A 03 D1 BNE loc_2029E54 ; if not, jump past the return statement RAM_ARM9:02029E4C 06 48 LDR R0, =0x20A75CA ; if they are equal, LUT_base + 2(to align for the songVal) RAM_ARM9:02029E4E C0 5A LDRH R0, [R0,R3] ; (LUT_base + 2) + (loop_counter * 4) to adjust for alignment + 2nd half of each entry- return songVal RAM_ARM9:02029E50 18 BC POP {R3,R4} RAM_ARM9:02029E52 70 47 BX LR RAM_ARM9:02029E54 ; --------------------------------------------------------------------------- RAM_ARM9:02029E54 RAM_ARM9:02029E54 loc_2029E54 ; CODE XREF: getNPCBattleMusic__+12j RAM_ARM9:02029E54 64 1C ADDS R4, R4, #1 ; i++ if the npcID didn't pan out on the previous run RAM_ARM9:02029E56 A1 00 LSLS R1, R4, #2 ; loop_counter * 4 for alignment RAM_ARM9:02029E58 51 5A LDRH R1, [R2,R1] ; (loop_counter * 4) + LUT_base, jump into LUT to next entry RAM_ARM9:02029E5A 69 29 CMP R1, #0x69 ; 'i' ; is the npcID the max? RAM_ARM9:02029E5C F2 D1 BNE loc_2029E44 ; if not, run the loop again and jump into the LUT at the next entry RAM_ARM9:02029E5E RAM_ARM9:02029E5E loc_2029E5E ; CODE XREF: getNPCBattleMusic__+Aj RAM_ARM9:02029E5E 03 48 LDR R0, =0x45A ; if it is the max value, return the default battle music RAM_ARM9:02029E60 18 BC POP {R3,R4} RAM_ARM9:02029E62 70 47 BX LR RAM_ARM9:02029E62 ; End of function getNPCBattleMusic__ RAM_ARM9:02029E62 RAM_ARM9:02029E62 ; --------------------------------------------------------------------------- RAM_ARM9:02029E64 C8 75 0A 02 off_2029E64 DCD word_20A75C8 ; DATA XREF: getNPCBattleMusic__+2r RAM_ARM9:02029E68 CA 75 0A 02 dword_2029E68 DCD 0x20A75CA ; DATA XREF: getNPCBattleMusic__+14r RAM_ARM9:02029E6C 5A 04 00 00 dword_2029E6C DCD 0x45A ; DATA XREF: getNPCBattleMusic__:loc_2029E5Er
Oxnite Posted June 5, 2012 Author Posted June 5, 2012 The solution has been found, with great thanks to Bond697! This is what I asked him: Hi, Bond697!Thanks for your information in this topic: http://projectpokemon.org/forums/showthread.php?22308-Pok%E9mon-Black-and-White-Assigning-different-Trainer-Music However, I still can't get it to work. Are you saying that I should decompress the original arm9.bin file (by using ''Extract'' in CrystalTile2), then edit it by using a hex editor, and then add it to the .nds file again using CrystalTile2's ''Import'' function? This means that I'm adding an uncompressed file that's bigger than the original arm9.bin (because it's uncompressed this time). Is that OK? And what should I do when this message shows up? I tried editing the following part (it's the encounter music information, starting at 0xA35C8 of arm9.bin): 02 00 5A 04 03 00 5B 04 04 00 5A 04 05 00 5B 04 32 00 5D 04 31 00 5D 04 46 00 5D 04 47 00 5D 04 19 00 5D 04 18 00 5D 04 12 00 5F 04 11 00 5A 04 2E 00 62 04 34 00 62 04 2A 00 5B 04 29 00 5A 04 4B 00 66 04 4C 00 66 04 33 00 61 04 40 00 61 04 3C 00 63 04 3B 00 63 04 1D 00 64 04 5B 00 60 04 5A 00 60 04 55 00 5F 04 54 00 60 04 06 00 64 04 49 00 64 04 35 00 64 04 07 00 64 04 2B 00 65 04 2C 00 65 04 1A 00 65 04 22 00 65 04 0D 00 5F 04 42 00 65 04 30 00 5F 04 43 00 65 04 3A 00 65 04 1B 00 64 04 1C 00 64 04 3D 00 65 04 3E 00 65 04 23 00 61 04 24 00 61 04 53 00 65 04 39 00 5E 04 48 00 61 04 1F 00 5E 04 1E 00 63 04 20 00 63 04 21 00 66 04 56 00 65 04 57 00 66 04 41 00 5F 04 4A 00 64 04 10 00 5C 04 3F 00 5E 04 44 00 63 04 45 00 63 04 27 00 67 04 4D 00 67 04 2D 00 64 04 0F 00 5C 04 0E 00 5C 04 08 00 65 04 09 00 65 04 The red aligned part holds information for the Black Belt Trainer Class. 33 00 is the id of the Black Belt trainer; 61 04 correctly corresponds with . Say I want Black Belts to have the Gentleman's encounter music. Then I'd have to change 61 04 to 66 04, right? (Because 66 04 corresponds with ). However, that's what I did but the Black Belt still has its own encounter music. What am I doing wrong..? (...) The solution is very simple. It turns out that inserting the arm9.bin file into the rom using CrystalTile2 method doesn't work (at least, for me). Therefore, you should use this method: use dsbuff and unpack the rom. decompress the arm9 however(or use ct2 to extract a decompressed copy). change the stuff you want like you said and repack the rom with dsbuff. DSBuff just repacks the entire rom (without the need of replacing the arm9.bin file). Thank you very much for your help, again, Bond697!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now