Even though it's quite simple, I still find lots of people that don't know how to do that, so that's why I decided to make that tutorial!
What you need:
PART 1 - GETTING THE .BIN FILE
PART 2 - INSERTING IT INTO THE ROM AND REPOINTING BYTES
PART 3 - CREATING THE TABLE
Credits:
Me - Writing this tutorial!
Jambo51 - The routines & teaching me how to insert an ASM routine!
What you need:
Spoiler:
- A hex editor (I use HxD)
- A THUMB compiler (I use HackMew's)
- Notepad
- A ROM (For this tutorial, I use FireRed)
- A THUMB compiler (I use HackMew's)
- Notepad
- A ROM (For this tutorial, I use FireRed)
PART 1 - GETTING THE .BIN FILE
Spoiler:
Okay, for this one let's take Jambo51's battle mugshots extention.
(Link: http://www.pokecommunity.com/showthread.php?t=240183)
Okay, first routine:
Copy that and paste into notepad. Once you've done copying the code, click Save As. Down, where it says ".txt file", click and change it to "All Files", and call the file [randomname].asm. Remember to save it on the folder where you put the THUMB compiler.
Now, simply drag the .asm file you created into the file "thumb". Now, there should be a new .bin file. That's the file we want!
(Link: http://www.pokecommunity.com/showthread.php?t=240183)
Okay, first routine:
Code:
.text
.align 2
.thumb
.thumb_func
.global mugshothackone
main:
ldrb r5, [r4, #0x3]
lsl r5, r5, #0x18
lsr r5, r5, #0x18
cmp r5, #0x0
beq normalchecks
mov r1, #0x5A
ldr r5, returnone
bx r5
normalchecks: cmp r1, #0x57
bne later
add r1, r2, #0x0
mov r0, #0xCD
ldr r5, returntwo
bx r5
later: ldr r5, returnone
bx r5
.align
returntwo: .word 0x0807FFA5
returnone: .word 0x08080009
Now, simply drag the .asm file you created into the file "thumb". Now, there should be a new .bin file. That's the file we want!
PART 2 - INSERTING IT INTO THE ROM AND REPOINTING BYTES
Spoiler:
Okay, inserting the code into the ROM is so easy. Open the newly created .BIN file in your hex editor. You should see this code:
Now, also open your ROM with the hex editor. Seek for a free space. I always look for a free space that ends with "0" (for example: 0x800000, 0x960000, 0x862180 etc.).
Once you found the free space, press CTRL+B (NEVER CTRL+V). Write down the offset where the ASM code start at. Add 1 to it, and reverse it. If what I said right now was too complicated, well, let me explain it:
If you picked up the offset 0x800000, add 1 to it. 800000 + 1 = 800001. To make it look more simple, after every byte (Byte = XX), press space, so it will now like that: 80 00 01. Now, switch the first byte with the last byte, so it will result: 01 00 80. Easy, isn't it?
Press CTRL+G, or Go to the written offset. the written offset is 0807FF90, but wait... This offset doesn't even exist in the ROM! Just remove the 080, it's not necessary for navigating to specific offsets. Now, go to 7FF90, and change the bytes there to
Instead of the XX XX XX, put the offset we reversed earlier, so it will be
Good job! Now, there are three routines, so do what I did with the first routine, but do it with the other routines.
Now, once you've done all the 3 routines,
Just navigate to080801F5 and change the byte there to 78.
Code:
E5 78 2D 06 2D 0E 00 2D 02 D0 5A 21 05 4D 28 47 57 29 03 D1 11 1C CD 20 01 4D 28 47 01 4D 28 47 A5 FF 07 08 09 00 08 08
Once you found the free space, press CTRL+B (NEVER CTRL+V). Write down the offset where the ASM code start at. Add 1 to it, and reverse it. If what I said right now was too complicated, well, let me explain it:
If you picked up the offset 0x800000, add 1 to it. 800000 + 1 = 800001. To make it look more simple, after every byte (Byte = XX), press space, so it will now like that: 80 00 01. Now, switch the first byte with the last byte, so it will result: 01 00 80. Easy, isn't it?
Jambo51 said:Musghot Hack One:
Insert at 0x0807FF90:
004A1047XXXXXX08
Press CTRL+G, or Go to the written offset. the written offset is 0807FF90, but wait... This offset doesn't even exist in the ROM! Just remove the 080, it's not necessary for navigating to specific offsets. Now, go to 7FF90, and change the bytes there to
Code:
00 4A 10 47 XX XX XX 08
Code:
00 4A 10 47 01 00 80 08
Now, once you've done all the 3 routines,
Jambo51 said:Finally, change the byte at 0x080801F5 to 0x78
Just navigate to
PART 3 - CREATING THE TABLE
Spoiler:
Navigate to another free space in your ROM, and now take a look:
All of these offsets are for the pallets that the mugshot uses, so just write pointers to them. Here, I already made it:
Now, in order to make it appear ingame, before battle, write a normal trainer battle script:
(Message3 used if you want something to happen right after the battle).
Replace A with the battle type, replace B with the trainer number and replace C with the pallet you want. Agatha is the first, so it will be 100. Bruno is the second, so it will be 200 and Female Player BG is the last, so it will be 700. Simple, huh?
Now, let's test ingame... And it worked! If it doesn't you probably did something wrong :O
Thanks for reading, I hope this actually helps!
Jambo51 said:0x3FA660 (Agatha)
0x3FA680 (Bruno)
0x3FA6A0 (Lorelei)
0x3FA6C0 (Lance)
0x3FA6E0 (Gary Champion)
0x3FA700 (Male Player BG)
0x3FA720 (Female Player BG)
All of these offsets are for the pallets that the mugshot uses, so just write pointers to them. Here, I already made it:
Code:
60 A6 3F 08 80 A3 3F 08 A0 A6 3F 08 C0 A6 3F 08 E0 A6 3F 08 00 A7 3F 08 20 A7 3F 08
Code:
trainerbattle 0xA 0xB 0xC @Message1 @Message2 @Message3
Replace A with the battle type, replace B with the trainer number and replace C with the pallet you want. Agatha is the first, so it will be 100. Bruno is the second, so it will be 200 and Female Player BG is the last, so it will be 700. Simple, huh?
Now, let's test ingame... And it worked! If it doesn't you probably did something wrong :O
Thanks for reading, I hope this actually helps!
Credits:
Me - Writing this tutorial!
Jambo51 - The routines & teaching me how to insert an ASM routine!