Pages: 1
Posted on 06-08-20, 04:16 pm (rev. 21 by  poudink on 07-24-20, 01:44 am)
Hammer Brother
"The man that doesn't know his own limits is a fucking idiot." - Confucius

Karma: 2470
Posts: 1049/1087
Since: 02-12-16
Ever since NSMB hacking started in the late 2000s on jul, more and more of the game's file formats have been figured out and became editable. With the recent completion of a certain blender plugin which finally made Maya SDK plugins obsolete, SPA has become just about the only format in the whole game that is still uneditable. Until now. While this tutorial won't be going over how to make your own completely custom particles (not because I don't know how, but because drawing in a hex editor is too tedious for anybody to bother), I will be going over how to delete particles (we can finally get rid of those pesky snowflakes in the World 5 worldmap), how to replace any particle with any other particle from the game (as well as other games that use the same version of the format), as well as (incomplete) format documentation for anyone who might want to create a proper SPA editor tool or people who really want to draw custom particles in hex, made from various information shared by  Gericom and Ed_IT.

Tools Needed

Finding Your Particle
The first step to editing the particle you want to edit will always obviously be to first find the particle you want to edit in the rom and then in your hex editor. This is what MKDSCM is needed for, as it is still the only program with the ability to view SPA files. Open your rom in MKDSCM and navigate to the particle folder, which contains every SPA file in the game. Then, open each file one by one and check every particle in them until you have found the one you were looking for. Write down the particle ID and extract the SPA file.

Now, open the SPA file you've extracted in HxD. Every particle starts with 20 54 50 53 (" TPS" in text) and ends at the start of the next particle, except of course for the last particle which ends at the end of the SPA file. Their order within the file is the same as their order in MKDSCM, as such particle ID 0 will be the first particle in the file, particle ID 1 will be the second, and so on. Based on the particle ID you wrote down earlier, find the instance of 20 54 50 53 that belongs to your particle (I recommend using Find (Ctrl+F) and Find again (F3) for that) and select all of it. Write down the offsets, just in case. Then, move on to either Deleting a Particle or Replacing a Particle.

Deleting a Particle
Replace the particle you've selected with this (thanks Ed_IT):
20 54 50 53 06 F0 01 7C 40 00 00 00 60 00 00 00 10 00 00 00 70 00 00 00 00 00 00 00 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Save and insert the edited SPA in the rom with NSMBe.

Replacing a Particle
Repeat everything you did in Finding a Particle to find your replacement particle. Copy it in HxD and paste it over the particle you wanted to replace. You can take any other particle from the game you're editing or any other game that uses the SPA format. Multiple formats of the SPA format exist, but the SPT block, which is what we're editing, is the same for each of them. Here is listed each game that is known to use SPA as well as what version of the format they each use:

Super Mario 64 DS1.01
Nintendogs: Best Friends1.10
Nintendogs: Chihuahua & Friends1.10
Nintendogs: Dachshund & Friends1.10
Nintendogs: Dalmatian & Friends1.10
Nintendogs: Lab & Friends1.10
Animal Crossing: Wild World1.20
Mario Kart DS1.21
Pokémon Black1.21
Pokémon Black 21.21
Pokémon Diamond1.21
Pokémon Heartgold1.21
Pokémon Pearl1.21
Pokémon Platinum1.21
Pokémon Soulsilver1.21
Pokémon White1.21
Pokémon White 21.21
Mario vs. Donkey Kong: Mini-Land Mayhem!1.22
New Super Mario Bros.1.22
The Legend of Zelda: Phantom Hourglass1.22
The Legend of Zelda: Spirit Tracks1.22
Tomodachi Collection1.22

Save and insert the edited SPA in the rom with NSMBe.

SPA Header:
0x000x04String" APS" (magic ID)
0x040x04StringVersion (see the Replacing a Particle version for what games use what version)
0x080x02UInt16Number of particles
0x0A0x02UInt16Number of textures
0x100x04UInt32Particle block length
0x140x04UInt32Texture block length
0x180x04UInt32Texture block offset (start offset of first texture)

SPT Particle Header (1.22):
0x000x04String" TPS" (magic ID)
0x080x04UInt32Texture data Length (=T)
0x0C0x04UInt32Palette offset
0x100x04UInt32Palette data Length (=P)
0x140x04UInt32Texture 4x4 offset?
0x180x04UInt32Texture 4x4 Data Length? (=T44)
0x1C0x04UInt32Texture size?
0x20TTexture data
0x20 + TPPalette data
0x20 + T + PT44Texture 4x4 data?

*TexImageParam (1.22):
0-2TexFmt (0=NONE, 1=A3I5, 2=PLTT4, 3=PLTT16, 4=PLTT256, 5=COMP4x4, 6=A5I3, 7=DIRECT)
4-7Size S (Width = 8 << Value)
8-11Size T (Height = 8 << Value)
12Repeat S (0 = S8 ... 7= S1024)
13Repeat T (0 = T8 ... 7= T1024)
14Flip S
15Flip T
16Palette color 0 (0 = USE, 1 = TRNS)


  • Document the particle block
  • Cover flipping and mirroring

Nothing to say, so jadnjkfmnjamnfjkldnajfnjkanfjdksan jsdnvj m.

Pages: 1