- 352
- Posts
- 8
- Years
- Seen Mar 10, 2022
Hi everyone, I've seen some people seeking for a way to add new trainer sprites in Fire Red instead of replacing, I don't know if it was posted, but I'm here to help that people.
You can only expand the trainer's sprites up to 255 sprites. (But it will be 0xFE because the 0x0 is counted too.) I tested and it already have support for 2 bytes indexes.
Tools used:
First you will need to find the offsets of "Trainer Sprite Table" & "Trainer Palette Table":
Explanation about TST and TPT structures:
Repointing:
Adding new sprites:
Inserting at the tables:
Using on editor:
UPDATE (Credit to Shiny Quagsire & xGGxToiZ and Wesley FG)
Trainer Animation Table:
I hope I have helped all the people who were looking for this tutorial.
Tools used:
Spoiler:
HxD (Hex Editor)
FreeSpaceFinder
NSE 1.7.5.0
HTE - Hopeless Trainer Editor
Photoshop CS6
Irfan View
FreeSpaceFinder
NSE 1.7.5.0
HTE - Hopeless Trainer Editor
Photoshop CS6
Irfan View
First you will need to find the offsets of "Trainer Sprite Table" & "Trainer Palette Table":
Spoiler:
The offsets of the pointers are:
TST = 0x3473C (here you probably find the original pointer - 7C 95 23 08 = table offset 0x23957C size 1184 bytes / 4A0 in Hex)
TPT = 0x3474C (here you probably find the original pointer - 1C 9A 23 08 = table offset 0x239A1C size 1184 bytes / 4A0 in Hex)
TST = 0x3473C (here you probably find the original pointer - 7C 95 23 08 = table offset 0x23957C size 1184 bytes / 4A0 in Hex)
TPT = 0x3474C (here you probably find the original pointer - 1C 9A 23 08 = table offset 0x239A1C size 1184 bytes / 4A0 in Hex)
Explanation about TST and TPT structures:
Spoiler:
Trainer Sprite Table
Each sprite have 8 bytes of data = BC 90 E4 08 00 08 01 00
BC 90 E4 08 = pointer to the sprite
00 08 = must be unmodified, some have 00 10 instead but I don't know what is it
01 00 = half word ID of the trainer image
Trainer Palette Table
Each palette have 8 bytes of data = 1C 94 E4 08 01 00 00 00
1C 94 E4 08 = pointer to the palette
01 00 = half word ID of the trainer image
00 00 = unused, always 00 00
Each sprite have 8 bytes of data = BC 90 E4 08 00 08 01 00
BC 90 E4 08 = pointer to the sprite
00 08 = must be unmodified, some have 00 10 instead but I don't know what is it
01 00 = half word ID of the trainer image
Trainer Palette Table
Each palette have 8 bytes of data = 1C 94 E4 08 01 00 00 00
1C 94 E4 08 = pointer to the palette
01 00 = half word ID of the trainer image
00 00 = unused, always 00 00
Repointing:
Spoiler:
You have to repoint those tables in some free space, I will use the following offsets for Sprite & Palette respectively:
TST = 0x990000
TPT = 0x996000
Place pointers to the TST (00 00 99 08) at:
0x3473C
0x347A4
0x37E8C
0x38060
0x3CAE8
0x838E4
0x83928
0x10BC3C
0x158528
Place pointers to the TPT (00 60 99 08) at:
0x3474C
0x347A0
0x37E88
0x3805C
0x3CAE4
0x838E0
0x8392C
0x10BD1C
0x10BD3C
0x10BD7C
0x158524
TST = 0x990000
TPT = 0x996000
Place pointers to the TST (00 00 99 08) at:
0x3473C
0x347A4
0x37E8C
0x38060
0x3CAE8
0x838E4
0x83928
0x10BC3C
0x158528
Place pointers to the TPT (00 60 99 08) at:
0x3474C
0x347A0
0x37E88
0x3805C
0x3CAE4
0x838E0
0x8392C
0x10BD1C
0x10BD3C
0x10BD7C
0x158524
Adding new sprites:
Spoiler:
First you will need a 64x64 trainer sprite:
1- Index it with Photoshop and make it 16 color or lower with Irfan View.
2- Now find some free space for sprite and palette, open that free offset on NSE, load the trainer image, then insert it compressed. (Remember to save the offsets of the sprite and palette.)
1- Index it with Photoshop and make it 16 color or lower with Irfan View.
2- Now find some free space for sprite and palette, open that free offset on NSE, load the trainer image, then insert it compressed. (Remember to save the offsets of the sprite and palette.)
Inserting at the tables:
Spoiler:
Remember the data structure of each table? You will use that now.
The total amount of trainer sprites present in each table is from 0 to 147 (0 to 93 in Hex).
You must have to add only 8 bytes for a new sprite/palette in each table:
Trainer Sprite Table:
Trainer Palette Table:
The total amount of trainer sprites present in each table is from 0 to 147 (0 to 93 in Hex).
You must have to add only 8 bytes for a new sprite/palette in each table:
Trainer Sprite Table:
Spoiler:
XX XX XX 08 00 08 94 00
XX XX XX 08 = Reverse pointer to the offset of the new sprite
94 00 = half word ID of the new trainer image - 148 (94 in Hex)
Repeat it until you reach the desired number of new trainer sprites.
XX XX XX 08 = Reverse pointer to the offset of the new sprite
94 00 = half word ID of the new trainer image - 148 (94 in Hex)
Repeat it until you reach the desired number of new trainer sprites.
Trainer Palette Table:
Spoiler:
XX XX XX 08 94 00 00 00
XX XX XX 08 = Reverse pointer to the offset of the new palette
94 00 = half word ID of the new trainer image - 148 (94 in Hex)
Repeat it until you reach the desired number of new trainer palettes.
XX XX XX 08 = Reverse pointer to the offset of the new palette
94 00 = half word ID of the new trainer image - 148 (94 in Hex)
Repeat it until you reach the desired number of new trainer palettes.
Using on editor:
Spoiler:
I use the Hopeless Trainer Editor (HTE), it is the most simple thing to do, just open the .ini of your editor and look at [BPRE] and you will see "NumberOfTrainerSprites=147", change the "147" to the new amount of trainer sprites you have. Finally, go to your editor and you will see the new trainer sprites there.
UPDATE (Credit to Shiny Quagsire & xGGxToiZ and Wesley FG)
Trainer Animation Table:
Spoiler:
Needed Tables:
Repointing:
Inserting new trainers:
Spoiler:
The offsets of the tables are:
0x238E8C (592 bytes / 250 in Hex)
0x2390DC (592 bytes / 250 in Hex)
0x23932C (592 bytes / 250 in Hex)
0x238E8C (592 bytes / 250 in Hex)
0x2390DC (592 bytes / 250 in Hex)
0x23932C (592 bytes / 250 in Hex)
Repointing:
Spoiler:
The first table (0x238E8C) don't need to be large as it is, we just need 4 bytes for it because it have only pointers to the same offset, you can fill that table with FFs if you want:
Find a free space (0x989796) then put E8 47 23 08, save the offset.
The second table (0x2390DC) have the pointers to each pointer on the first table, then if you have repointed the first table using only 4 bytes, the second table only needs pointers to the offset of the first table, fill all of it with your reversed offset like this 96 97 98 08, then repoint this table to some free space, and place a pointer at 0x3F8F4 and 0x10BDA8.
The third table (0x23932C) is filled with 08 01 00 00, only four of them are 08 02 00 00, but that four are unused trainers then you can change it to 08 01 00 00 too, but I don't know if it will affect anything, then repoint that table to some free space and place a pointer at 0x37E78, 0x3804C, 0x3CAD4 and 0x158514. (You don't need to repoint this table because of many repoints we made it will have free space at the end of the table.)
Find a free space (0x989796) then put E8 47 23 08, save the offset.
The second table (0x2390DC) have the pointers to each pointer on the first table, then if you have repointed the first table using only 4 bytes, the second table only needs pointers to the offset of the first table, fill all of it with your reversed offset like this 96 97 98 08, then repoint this table to some free space, and place a pointer at 0x3F8F4 and 0x10BDA8.
The third table (0x23932C) is filled with 08 01 00 00, only four of them are 08 02 00 00, but that four are unused trainers then you can change it to 08 01 00 00 too, but I don't know if it will affect anything, then repoint that table to some free space and place a pointer at 0x37E78, 0x3804C, 0x3CAD4 and 0x158514. (You don't need to repoint this table because of many repoints we made it will have free space at the end of the table.)
Inserting new trainers:
Spoiler:
It will be the easiest step of the Trainer Animation Table, you only need to copy the last 4 bytes of the second and third table, and paste at the end of them respectively. That's it, you're now ready to use your new trainer sprites.
I hope I have helped all the people who were looking for this tutorial.
Last edited: