The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.

Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old September 6th, 2013 (01:19 AM). Edited November 14th, 2014 by MrDollSteak.
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Move Hacking has come along way recently, especially in the past year.
Karatekid552 and I had at some point started researching Particle effects and the
02 commands. It was also then that Karatekid552 located the Particle and Palette
table. We both believe that the table could be extended, however until now neither
of us had tried. I have since, extended the table and added a new custom particle
and palette entry, and fixed glitches relating to it through ASM.

Just to reiterate all the offsets are for FireRed and Emerald.

Tools Needed:
Spoiler:
A Hex Editor (I recommend HxD, it's free and amazing)
unLZ-GBA (preferably the hacked one)
Windows Calculator, or any other Calculator that can do sums in Hex.


General Information on the structure of the table:
Spoiler:
The table begins at 0x83ACC08 and ends at 0x83ADE18. This table contains both
the particle and palette information.

The actual particle information goes from 3ACC08 to 3AD50F.
Each particle entry is made up of 8 bytes in this format:
XX YY ZZ 08 (pointer to the particle image at ZZ YY XX) XX YY (size of the particle YY XX) XX 28 (the index, the second byte of which will be 27 or 28, for expansion purposes it will be 28)

The palette information goes from 3AD510 to 3ADE18
Each palette entry is made up of 8 bytes in this format:
XX YY ZZ 08 (pointer to the palette at ZZ YY XX) XX 28 (the corresponding particle index) 00 00 (padding)


STEP 1:
Spoiler:
Using your Hex Editor, goto offset 0x83ACC08 in Fire Red or 0x8524B44 in Emerald and select 1210 blocks (hex).




STEP 2:
Spoiler:
Copy the selected area, then find a good free space area to paste it to. Make sure you use Ctrl B (Paste Overwrite) otherwise the Rom will stop working. For this tutorial I'll be using the offset 960000, though you can realistically place it anywhere you want with realistically about 1300 bytes of free space.




STEP 3:
Spoiler:
Now you'll have to change all the pointers to the original offset for those of your current offset. A pointer is laid out in the structure XX YY ZZ 08, wherein XX YY ZZ 08 would point to ZZ YY XX 08. Using the original offset 3ACC08 for Fire Red, the pointer would be 08 CC 3A 08. For the new offset 960000, our pointer would be 00 00 96 08. Navigate to the start of the rom and click Ctrl r (replace). Search for 08 CC 3A 08 in Fire Red or 08 44 4B 52 in Emerald and replace with 00 00 96 08 and click replace all (make sure hex values is selected). There should only be two instances of this pointer located in the 0x8072000 area for Fire Red (this is where the loading routine is located).



STEP 4:
Spoiler:
This is the part in which we add new particles. You will need to make the majority of these yourselves, as I make them I'll be sharing them with the community. For the purposes of this tutorial I've attached the image for Wood particles.

Open up unLZ-GBA. Import your image (make sure it's indexed), and click write to rom. Make sure only 'Export Image' is selected. Type in your desired offset into the image box, for the purposes of this tutorial I'll be using 940000, and click OK.



After doing that navigate to that offset in your Hex Editor and scroll through until you reach free space again, make a note of that offset.



Return to unLZ and once again click write to rom, this time however make sure only 'Export Palette' is selected, then type the offset you just got into the palette box.



STEP 5:
Spoiler:
Now that the particles are in the rom, we have to add them to the table. Unlike other expanded tables, the particle and palette information are part of the same table. As such we can't just add the entries to the end of the table. What we have to do first is navigate to the start of the palette information, now at 960908, and then select the rest of the table, this can be done easily by just selecting 1000 bytes (hex).



Now copy the data and paste it 8 bytes after where it originally was, in this case that would be 960910.



Now at 960908 we have to add our particle entry. As mentioned before the data is set up as a pointer, the size and then the index. First write the pointer to your image, in this case 00 00 94 08.
The size is equal to half the area of the image. eg. Our image is 32x192, which is equal to 1800 in hex. As such, our size would be half of 1800, which is 0C00, so we'd write 00 0C. Finally we'd choose our index number. The last used one in the rom is 30 28, as such anything up from there is available to be used.



Now we just need to add our palette information. This is thankfully easier, just navigate to the end of the table, this can be done easily by searching for FF bytes. If using the offsets of this tutorial it should now be 961218. As mentioned before the palette information is listed in this structure, pointer to the offset of the palette, index number, filler bytes. First write the pointer to your palette, in this A8 04 94 08, follow it up with the same index number you used for the particle in this case 31 28, and then add 00 00.



Congratulations! You've set up your first particle.

Note: For future entries, you will have to repeat the procedure, by constantly moving the palette part of the table back to allow space for entries. It is not particularly convenient, but it's not too difficult either.


STEP 6:
Spoiler:
You may now think, great I have fully working new particles. Well that's not entirely true, first we have to alter the loading routine. If you do not, the moves will just freeze, or the rom will restart, as they will not be able to load the proper information. Luckily its easily fixed by changing a few pointers.

Navigate to the offset 0x80728B7 in Fire Red or 0x80A3D74 in Emerald, you should see two pointers. These are the pointers used in the particle loading routine and the palette loading routine respectively. The reason for this being, that the loading routine takes these offsets and then adds a variable number dependent upon the particle being used in the routine to this offset to reach the relevant area of the table.



We'll have to change these two pointers, so they now properly go to the 960000 area. As such we're going to have to start doing some calculations, so open up Windows Calculator (or an alternative) and access programming mode (alt+3). Subtract the offset of the first pointer (399388) from the original start of the table (3ACC08). You should get the number 13880.



Now substract that number from the offset in which you repointed the table to, and you'll have the offset to change the first pointer at 728B7 to. If using this tutorial, you should get the offset 94C780, and as such, the pointer 80 C7 94 08. Then change the pointer.




The palette pointer is done in more or less the same way. Because we already know the variable number (13880) that is added to both pointers, we can simply substract 13880 from the current start of the palette information, which if you've been using the same offsets will be located at 960910. You should get the offset 94D090, and as such the pointer 90 D0 94 08. Then change the pointer.

Something key to note though. Is that for every new particle you add to the table, you will have to add a value of 0x8 to the palette loading pointer. Eg. If you added an extra particle to the one already added, it would become 98 D0 94 08. You will not need to do this for the particle loading pointer.



IMPORTANT EDIT!

There is one more thing to fix, and that is the Shiny Pokemon entry animation!
Otherwise, if a Shiny Pokemon is sent out into battle the game will freeze.

STEP 7:
Spoiler:
Navigate in your hex editor to 0x80F17E8 in Fire Red or 0x8172FB8 in Emerald, you should see two pointers.
Change the first pointer from what it is to the pointer to the new offset of
the F9 27 particle, which if you followed this tutorial is 960748, for those who
did not use the same offsets, you can easily find it by searching for this string
38 87 D2 08 C0 00 F9 27.

The second pointer is the palette, so just change the pointer to the new offset
of the F9 27 palette. Because each time you extend the table the palette will
change, you'll have to add 8 to this pointer everytime you add a new particle.
To find it search for this string BC 87 D2 08 F9 27 00 00.


And there you have it! Custom particles.


I'd once again like to thank Karatekid552 for getting the ball rolling, and for his documentation.
Also credits to HidoranBlaze for finding the relevant Emerald offsets.
Attached Images
File Type: png Wood Hammer Index.png‎ (927 Bytes, 51 views) (Save to Dropbox)
__________________
Reply With Quote
  #2    
Old September 8th, 2013 (12:19 AM).
pawell6's Avatar
pawell6
The truthseeker
 
Join Date: Feb 2010
Location: Poland
Age: 27
Gender: Male
Great tut! I managed to add and apply 7 new particles (for now). But there are few things I noticed:

1) In step 6 when I correct both pointers all particles load with glitches, but everything is fine when I alter the second pointer only.

2) Some particles load with glitches for certain 02 command and correctly load for others 02 command. For example when I try to load my 32x32 particle with 02 command for shadow ball everything is fine, but when I try to load the same particle with 02 command for karate chop, it shows up with glitches. I think it has something with size for particle. Originally shadow ball and karate chop with indexes CO and 9F respectively have different size in table.
__________________
Most of new moves is done. Fixing timing of some animations and updating learnsets in progress.
Reply With Quote
  #3    
Old September 8th, 2013 (07:29 AM).
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Quote:
Originally Posted by pawell6 View Post
Great tut! I managed to add and apply 7 new particles (for now). But there are few things I noticed:

1) In step 6 when I correct both pointers all particles load with glitches, but everything is fine when I alter the second pointer only.

2) Some particles load with glitches for certain 02 command and correctly load for others 02 command. For example when I try to load my 32x32 particle with 02 command for shadow ball everything is fine, but when I try to load the same particle with 02 command for karate chop, it shows up with glitches. I think it has something with size for particle. Originally shadow ball and karate chop with indexes CO and 9F respectively have different size in table.
In response to your first question, are you adding 8 to both pointers each time? Because you only need to add 8 to the second pointer. I wrote that somewhere from memory.

The glitches you're talking about aren't real glitches, it's because when you follow the 02 command to the offset you need to change the size pointer. If I recall correctly, it's the second to last pointer out of the 18bytes(hex) or 24bytes (dec) that loads the size of the particle. You'll find that it glitches with non-custom particles too if you put say leaf particles into Flamethrower. Just check the sizes of ones of the same index size, look at the pointers they have at the 02 command and adjust those.

Also may I ask what particles you've added, and if you'd want to share them?
If you would like to share them I could add them to either this thread or the 4th gen move resources thread in RnD. I'm probably going to make a shell one soon for Razor Shell and Shell Smash, and then to improve Withdraw.
__________________
Reply With Quote
  #4    
Old September 8th, 2013 (08:44 AM).
pawell6's Avatar
pawell6
The truthseeker
 
Join Date: Feb 2010
Location: Poland
Age: 27
Gender: Male
Thanks for reply, 11bayerf1 and for the tips about 02 command. I'll try it out and see if it works. But for now yes: I can share those particles. The names of archives are also names of moves, where I used those particles, but you can use them in any move you want.
Note about shell blade: the shell is drawn 5 times, because I had problem with certain 02 command and it worked, when I drew it 5 times.
Attached Files
File Type: rar new particles.rar‎ (3.7 KB, 59 views) (Save to Dropbox)
__________________
Most of new moves is done. Fixing timing of some animations and updating learnsets in progress.
Reply With Quote
  #5    
Old December 8th, 2013 (01:26 AM). Edited December 8th, 2013 by robin22gongon.
robin22gongon's Avatar
robin22gongon
 
Join Date: Sep 2012
Location: Want to know? VM me.
Age: 17
Gender: Male
Nature: Quirky
Send a message via Windows Live Messenger to robin22gongon
Hello guys!

I just came here to ask, how do I add the particles I just created to some moves I want to create?

Sorry, noob here.

Thanks.
__________________
LET'S PARTY!
Reply With Quote
  #6    
Old December 15th, 2013 (10:24 PM).
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Quote:
Originally Posted by robin22gongon View Post
Hello guys!

I just came here to ask, how do I add the particles I just created to some moves I want to create?

Sorry, noob here.

Thanks.
In the move animation where you normally put in the particle 00 97 27 or whatever 00 ?? 27/28 command, just use the index of the new move.

Eg. Wood Hammer is 31 28. So in your new move, just place 00 31 28 at the start of the animation.
__________________
Reply With Quote
  #7    
Old December 17th, 2013 (06:29 AM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Great tutorial man! Just added this to the 649 patch.

----------------------------------------------------
Just a tip for any of you planning to add a lot of new particles at once:

You can use asm to create a table much easier than typing everything in HxD. You don't need to know any asm to do this either. Here:

Code:
.align 2 /*Make sure everything is aligned.*/
.text

main:
.word 0x08960000	/*Your pointer to an image, not reversed!*/
	.hword 0xC00	/*Data size, once again, not reversed.*/
	.byte 0x31	/*Particle number.*/
	.byte 0x28	/*Particle table. Either 27 or 28 like mrdollsteak said.*/
So yeah, just compile this using HackMew's compiler or another ARM compiler and you will have an 8 byte entry. For more entries, you can just repeat this template over and over in the same file:

Code:
.align 2 /*Make sure everything is aligned.*/
.text

main:
.word 0x08XXXXXX	/*Your pointer to an image, not reversed!*/
	.hword 0xXXXX	/*Data size, once again, not reversed.*/
	.byte 0xXX	/*Particle number.*/
	.byte 0xXX	/*Particle table. Either 27 or 28 like mrdollsteak said.*/
Like this:

Code:
.align 2
.text

main:
/*Particle 1*/
.word 0x08XXXXXX
	.hword 0xXXXX
	.byte 0xXX
	.byte 0xXX

/*Particle 2*/
.word 0x08XXXXXX
	.hword 0xXXXX
	.byte 0xXX
	.byte 0xXX

/*Particle 3*/
.word 0x08XXXXXX
	.hword 0xXXXX
	.byte 0xXX
	.byte 0xXX

/*Particle 4*/
.word 0x08XXXXXX
	.hword 0xXXXX
	.byte 0xXX
	.byte 0xXX

/*Particle 5*/
.word 0x08XXXXXX
	.hword 0xXXXX
	.byte 0xXX
	.byte 0xXX

/*et cetera*/
__________________

Paired with Simba
Reply With Quote
  #8    
Old December 25th, 2013 (08:27 PM).
HidoranBlaze's Avatar
HidoranBlaze
 
Join Date: Apr 2013
Age: 18
Gender: Male
This is great!
Since I'm planning on hacking Emerald in the future though, I just want to ask this: How did you guys find the offsets for the table? If I can figure out where the offsets are for emerald, I should be able to do the rest myself.
Reply With Quote
  #9    
Old January 12th, 2014 (12:51 PM).
Shiny Lizard's Avatar
Shiny Lizard
 
Join Date: Jul 2013
Gender: Male
You have to replace a move with a new one?
Reply With Quote
  #10    
Old January 16th, 2014 (02:56 AM).
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Quote:
This is great!
Since I'm planning on hacking Emerald in the future though, I just want to ask this: How did you guys find the offsets for the table? If I can figure out where the offsets are for emerald, I should be able to do the rest myself.
If you go into unLZ and find the particles in emerald, just search for the pointers and you should be set.

Quote:
Originally Posted by Shiny Lizard View Post
You have to replace a move with a new one?
__________________
Reply With Quote
  #11    
Old January 16th, 2014 (02:18 PM).
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com (WIP!)
Community Supporter
 
Join Date: Nov 2012
Location: Earth
Age: 16
Gender: Male
Nature: Quiet
Quote:
Originally Posted by Shiny Lizard View Post
You have to replace a move with a new one?
You don't need to replace moves. You're just adding particles that moves can use.
__________________
Reply With Quote
  #12    
Old February 8th, 2014 (08:56 PM).
Germaniac's Avatar
Germaniac
Victoria Concordia Crescit
 
Join Date: May 2009
Location: Jakarta, Indonesia
Age: 16
Gender: Male
Nature: Relaxed
It seems that whenever i try to replace 00 XX 27/28 from an animation, it'll mess the particle up (among all the indexes i've tried, the result is always the same except the default unedited one)
__________________
Reply With Quote
  #13    
Old February 8th, 2014 (09:15 PM).
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Quote:
Originally Posted by Germaniac View Post
It seems that whenever i try to replace 00 XX 27/28 from an animation, it'll mess the particle up (among all the indexes i've tried, the result is always the same except the default unedited one)
You also need to change the index in the 02 command.
__________________
Reply With Quote
  #14    
Old February 8th, 2014 (10:29 PM). Edited February 8th, 2014 by Germaniac.
Germaniac's Avatar
Germaniac
Victoria Concordia Crescit
 
Join Date: May 2009
Location: Jakarta, Indonesia
Age: 16
Gender: Male
Nature: Relaxed
Quote:
Originally Posted by MrDollSteak View Post
You also need to change the index in the 02 command.
An explanation about the bytes pointed by 02 command would be appreciated
EDIT: nevermind, i got it to work
__________________
Reply With Quote
  #15    
Old May 2nd, 2014 (01:47 AM).
Artemis64
 
Join Date: Mar 2014
Gender: Male
How did you find the loader? Just curious, because I want to port this to Ruby.
Reply With Quote
  #16    
Old May 2nd, 2014 (12:38 PM).
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com (WIP!)
Community Supporter
 
Join Date: Nov 2012
Location: Earth
Age: 16
Gender: Male
Nature: Quiet
Quote:
Originally Posted by Artemis64 View Post
How did you find the loader? Just curious, because I want to port this to Ruby.
You should know that porting this to Ruby will be EXTREMELY hard as the coding in Ruby is really bad and unorganized. This is why Fire Red and emerald are further hacked, and have better features implemented by hackers.
__________________
Reply With Quote
  #17    
Old May 3rd, 2014 (09:09 PM).
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Quote:
Originally Posted by Artemis64 View Post
How did you find the loader? Just curious, because I want to port this to Ruby.
Just mucked around with the debugger, following the routine.
I think it's a pretty stupid system myself, but it works.

Ruby'll probably be difficult, because its routines are very
hard to follow.
__________________
Reply With Quote
  #18    
Old July 26th, 2014 (09:22 AM).
Dark Sneasel's Avatar
Dark Sneasel
dem Verdanturf flowers are sexy
Community Supporter
 
Join Date: Jun 2013
Location: Miami, FL
Age: 14
Gender: Male
Nature: Hasty
Emerald support! That is awesome! Thank you MrDollSteak and HidoranBlaze :D
__________________
Pokémon Fluorite Version (Beta 2 Released)


Join Poketch.com, a new ROM hacking community! Click on the image for more!
Reply With Quote
  #19    
Old July 31st, 2014 (04:02 PM).
Lokirety32497
 
Join Date: Jul 2014
Gender: Male
How about ruby? Im hacking a ruby rom and I like your idea
Reply With Quote
  #20    
Old 2 Weeks Ago (02:41 AM).
Saseif97
 
Join Date: Nov 2014
Gender: Male
I can't understand step 7
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 12:51 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.