Code ASM Resource Thread Page 62

Started by esperance September 19th, 2014 3:13 PM
  • 445804 views
  • 1604 replies
Seen 2 Weeks Ago
Posted February 11th, 2021
146 posts
6.6 Years
Is there a way to change the species of an egg generated from the daycare to be random between parents? like instead of the egg always hatching as the mother's species, it has a chance if being the father's as well.

for example, if you breed Nidoking with with Kanghaskhan, the resulting egg has a 50% chance of being a Nidoran, instead of always generating a Kangaskhan egg.

My idea is to have every pokemon be able to hatch from an egg from normal mothers, male only pokemon are stuck with ditto for mothers.
Male
Seen February 26th, 2022
Posted October 15th, 2021
57 posts
2 Years
Since the start menu only runs asm offset,

I'd like to request an asm routine that targets and runs any chosen normal script offset for the start menu's selection.

Game: BPRE Fire red
Seen February 19th, 2022
Posted November 4th, 2020
7 posts
4.1 Years
I would like to request for someone to make a fire red ASM routine that will always write the text string “Super Effective” if the move effectivness returns greater than 1 and “not very effective” if it returns less than 1.

I made changes to my type effectivness table to add better depth to it and now the game no longer prints the text!

Ive been trying to understand ASM for months now and just cant seem to teach myself fully. Someone with amazing skills...Please help!!!
Age 21
Male
São Paulo, Brazil
Seen May 28th, 2021
Posted November 4th, 2020
1 posts
1.8 Years
Hello.
I'm starting to make a ROM hack (or at least trying to make), and I recently discovered a specific program called TLP which I can edit the sprites.
Just to clarify, my plan is to make a Red or a Gold pokemon hack, with the main objective of maintaining the vintage aesthetic of the first game but with more pokemon beyond those that exist only in the first generation.
These programs were all founded through google, more specificaly in other threads in this forum.
In addition to this program, I am aware of what makes me able to edit the map as a puzzle, but I know that there are still many programs that I need to know and I need to see if I would be able to use it on my computer without problems (many programs that I found through internet had specific problems when I tried to run it, and it certainly has nothing related to problems in my computer, which has a good configuration).
I really want to know if I'm on the right path and if there is things that I need to know before move forward with the project. For now, I'm making the sprites of the story characters. The history that I have in mind is a universe full of life, something that I have several texts telling from different moments besides being something that I share with my friends who help me in the story.
This first ROM hack I plan on will tell only the beginning of the story. If it works, I intend to go to the end. If it goes as planned, I'm sure things will work out.

BluRose

blu rass

Age 21
Male
michigan tech
Seen 19 Hours Ago
Posted June 12th, 2022
815 posts
8.3 Years
Hello.
I'm starting to make a ROM hack (or at least trying to make), and I recently discovered a specific program called TLP which I can edit the sprites.
Just to clarify, my plan is to make a Red or a Gold pokemon hack, with the main objective of maintaining the vintage aesthetic of the first game but with more pokemon beyond those that exist only in the first generation.
These programs were all founded through google, more specificaly in other threads in this forum.
In addition to this program, I am aware of what makes me able to edit the map as a puzzle, but I know that there are still many programs that I need to know and I need to see if I would be able to use it on my computer without problems (many programs that I found through internet had specific problems when I tried to run it, and it certainly has nothing related to problems in my computer, which has a good configuration).
I really want to know if I'm on the right path and if there is things that I need to know before move forward with the project. For now, I'm making the sprites of the story characters. The history that I have in mind is a universe full of life, something that I have several texts telling from different moments besides being something that I share with my friends who help me in the story.
This first ROM hack I plan on will tell only the beginning of the story. If it works, I intend to go to the end. If it goes as planned, I'm sure things will work out.
have you run into the pokered/pokecrystal disassemblies?
heyo check out my github:

BluRosie
highlights:
gen 5 pokémon in heart gold
gen 5 moves in heart gold [wip]
various feature branches in heart gold (fairy type, odd egg, more to come)

also on discord: BluRose#0412

Lioniac

High-level Language Developer trying to learn ASM

Seen November 13th, 2021
Posted March 22nd, 2021
21 posts
5.1 Years
Hello,

This is a request.

I'm learning XSE and trying to create a method to replace tileset dynamically for a map, but I cannot find the right script commands. I guess I'll have to go to ASM. Is it right? If so, it's a long learning curve LOL
Use case explained: I want to use RNG Weather + Battle weather that mimics OW weather + dynamic change OW tiles to snow ones when it's snowing.

- First I tried to create custom tileset, set it in the cities maps (A-Map) and using a script to change every tile using setmaptile... super impractical and waste of resource consumption... super ugly approach.
- Then, I realized the tile positions (X,Y) are static, so creating a "snow tileset" version with tiles in the same position of the original would be much more efficient. I just need a way to dynamic change the tileset when it's snowing.

That would be also useful if you want to generate events that dynamically change the map in general (e.g A HUGE Earthquake), so I believe this request could open many possibilities.

Example:
Spoiler:




Thanks in advance.

PS: Yeah, I know about Seasons by DNS tool but I could not find the source code or anything to edit. The tool does not allow you to freely edit the months... e.g. I live in Brazil and December is Summer, not Winter... if anyone has a Github/source code on that, it should work as well.
Male
Poland
Seen May 24th, 2022
Posted January 3rd, 2022
37 posts
3.5 Years

Frontier Routines - Opponent Party generation



I've been meaning to implement a frontier of sorts into FireRed for some time but never really got a good opportunity to do so. Today I got a little bored and decided that I might as well start up. The first problem is obviously to generate a pseudo random party for the opposing trainer. That's what I've done today!

I had made a generation routine in the past as well, but it was incomplete and a little buggy. This one, as far as I can tell in my tests, should work fine :)


Setting up some prerequisites:
When making the routine for Pokemon generation, it was important that the hacker had some customization about which Pokemon were allowed into the opponents party (to prevent legendary Pokemon, or some specific Pokemon into the competition). The best way to do that is to either make a table of the Pokemon allowed to be in the opponent's party, or a table of the Pokemon not allowed to be in it. I decided to make the hacker do a table of all the Pokemon species allowed to be in the opponent's party.

It's important to remember that Pokemon Species ID takes 2 bytes per species, and that each entry in the table is in reverse hex. Bulbasaur for example would be: "01 00" in the table. The size of the table is up to you. The biggest reason I made the table be a table of all the Pokemon allowed is because this allows you to put more than 1 entry of the same Pokemon (thus increasing it's likelihood to be selected) ==> not all Pokemon species have the same chance of being selected!

Find some half-word aligned free space (offset divisible by 2) and fill up your table with as many entries as you'd like in this format:
[2 bytes (ID)] [2 bytes (ID)] ...
Write down how many entries you have, and where the start of the table is.


How to insert:

First take a look at the routine in the spoiler. Scroll to the very bottom, and you will see two fields which need filling. The first is called "Table". Table is supposed to be a location to the table of IDs we made earlier, replace 0x8750000 with your table location. Tsize is supposed to be the amount of Pokemon your table has in it, adjust that accordingly as well.

Finally, the routine is flag toggled. If flag 0x205 is set, the opponent is generated a random party. To adjust this change these lines accordingly:
	mov r0, #0xFF
	lsl r0, r0, #0x1 @0xFF * 2
	add r0, r0, #0x7 @ 0x1FE + 7
Once the adjustments are complete, compile and insert into free space.
Spoiler:

.text
.align 2
.thumb
.thumb_func

@Hook 080112F8 via r0

main:
	push {r0-r7}
	@flag check 205
	mov r0, #0xFF
	lsl r0, r0, #0x1
	add r0, r0, #0x7
	ldr r4, =(0x806E6D0 +1)
	bl linker
	cmp r0, #0x0
	beq end
	
genAmount:
	ldr r4, =(0x8044EC8 +1)@gen random number
	bl linker
	lsl r0, r0, #0x10
	lsr r0, r0, #0x10
	mov r1, #0x6
	ldr r4, =(0x81E4684 +1)
	bl linker
	add r0, r0, #0x1
	mov r5, r0
	
mallocSpace:
	mov r0, #0x64
	mul r0, r0, r5
	ldr r4, =(0x8002BB0 +1) @malloc
	bl linker
	mov r6, r0
	mov r7, #0x0
	
@R5 = amount of mons
@R6 = free space to put them

genLoop:
	cmp r7, r5
	beq moveParty
	
genSpeciesFromTable:
	ldr r4, =(0x8044EC8 +1)@gen random number
	bl linker
	lsl r0, r0, #0x10
	lsr r0, r0, #0x10
	ldr r1, Tsize
	ldr r4, =(0x81E4684 +1)
	bl linker
	lsl r0, r0, #0x1
	ldr r1, Table
	add r1, r1, r0
	ldrh r1, [r1]
	
createMon:
	mov r0, #0x64
	mul r0, r0, r7
	add r0, r0, r6 @free memory
	ldr r2, =(0x20370BA)
	mov r2, #0x32 @level
	mov r3, #0x20 @cnst
	ldr r4, =(0x803DA54 +1)
	bl linker
	add r7, r7, #0x1
	b genLoop
	
moveParty:
	ldr r0, =(0x202402C)
	mov r1, r6
	mov r2, #0x64
	mul r2, r2, r5
	ldr r4, =(0x8040B08 +1) @func
	bl linker
	mov r0, r6
	ldr r4, =(0x8002BC4 +1) @free malloc'd memory
	bl linker
	pop {r0-r7}
	ldr r3, =(0x80116AC +1)
	bx r3
	
end:
	pop {r0-r7}
	ldr r0, =(0x400)
	cmp r1, r0
	bne place
	mov r0, #0x0
	ldr r3, =(0x80116AC +1)
	bx r3
	
place:
	ldr r3, =(0x8011304 +1)
	bx r3
	
linker:
	bx r4

.align 2

Table:
	.word 0x8750000 @your table of Mons
	
Tsize:
	.word 0x32 @Amount of entries in table


Finally, in a hex editor insert the following byte changes at 0x112F8:
00 48 00 47 XX XX XX 08
Where XX XX XX is the place you inserted the routine +1. Note that the trailing 08 may change depending on where you placed the routine.


Usage:

The routine is flag toggled. Set flag 0x205 before entering battle, and the rest is done automatically.
I wonder how to use this code for double battles ...
Seen July 7th, 2021
Posted November 15th, 2020
1 posts
2 Years
Either turn set mode on in the options, or put 28 92 87 1D 08 at x1D8727. Be warned that the latter approach has a nasty side effect; scrubs will complain about your hack being "bugged" or that you removed a feature that should've stayed.
Do you know How to do that in emerald?
Seen 3 Days Ago
Posted 2 Weeks Ago
52 posts
5.1 Years

Changing the Player's Overworld ingame



Intro:

I recently made this routine, it's kind of limited in the sense that you can only be change to 30 different overworlds (excluding the special version of the default characters). While it is limited, I don't really think that that's a problem (you'd probably only be OWs swapping to 2-3 different OWs the entire game anyways, so unless you wanted to player to play as more than 30 characters, this routine will work just fine for you). It's also a little "smaller" in comparison to JPAN's 6 seperate routines which he used (though in his favor, I don't think his limits the amount like mine). I blame the table, it's weird. Actually the whole overworld loading thing is weird..it's done in like 9 places lol.

I should also note that if the OW you're changing to doesn't have a running frame, things are going to look weird when you try to run~

How to insert:

Compile into free space the following routine:
Spoiler:

.text
.align 2
.thumb
.thumb_func

@hook from 0805CA4C via r0
                            
main:
	@flag check
checkFlag:
	mov r0, #0xFF 
	lsl r0, r0, #0x2
	add r0, r0, #0xA @0x3FC + 0xA = @406
	ldr r2, =(0x806E6D0 +1)
	push {r1, r3}
	bl linker
	pop {r1, r3}
	cmp r0, #0x1
	bne noCrash

setOW:
	ldr r0, =(0x20370B8)
	ldrb r0, [r0]
	cmp r0, #0xFF
	beq noCrash
	mov r3, r0
	
noCrash:
	mov r8, r3
	lsl r4, r4, #0x10
	lsr r4, r4, #0x10
	lsl r5, r5, #0x10
	ldr r0, =(0x805CA54 +1)
	bx r0
	
linker:
	bx r2
	
.align 2
Here's a compiled version:
FF 20 80 00 0A 30 09 4A 0A B4 00 F0 0E F8 0A BC 01 28 04 D1 06 48 00 78 FF 28 00 D0 03 1C 98 46 24 04 24 0C 2D 04 03 48 00 47 10 47 D1 E6 06 08 B8 70 03 02 55 CA 05 08


Now navigate to 0x5CA4C and insert the following byte changes:
00 48 00 47 XX XX XX 08
Where XX XX XX is where you inserted this routine +1.


Usage:

The routine requires two conditions to toggle.
1) Flag 0x406 is set
2) Var 0x8000 is not 0xFF

As you may have guessed you need to set variable 0x8000 to a value which matches the overworld you want the player to transform into. Please note that for the effect to happen, you need to warp first.
Here's a list of values and their corresponding sprite to the left:
Spoiler:

0 - male hero
1 - female hero
3 - female hero bike
4 - male hero run
5 - female hero run
6 - male hero vs-seeker
7 - female hero vs-seeker
8 - male hero fishing
9 - female hero fishing
12 - Brendon
13 - May
26 - Male + Female hero Vs seeker on bike
28 - Random guy (A-MAP ID 25)
29 - Little boy
44 - Gem sign thing (buggy)
48 - Spearow
52 - Old man 1 (A-MAP ID 33)
80 - Jogging girl
83 - Blonde dude (A-MAP ID 26)
84 - Fat guy
88 - Old man 2 (A-MAP ID 88)
92 - Scroll backpack thing (buggy)
93 - Team rocket male
104 - Meowth
112 - Chansey
116 - Slowbro
124 - Snorlax
125 - Fisherman
166 - Kid tuber (male)
170 - Old man 3 (A-MAP ID 30)
176 - Green girl (A-MAP ID 40)
213 - Red dress lady
214 - Old lady
228 - Deoxys (I think this one is normal)
245 - Misty
250 - Hey champ in the making guy
251 - Ghost Girl

While no particular value will cause a crash, I've excluded values which are "repeated" OWs. If you experience bugs, use it in conjunction with the backsprite hack I made. If you still have bugs, report them here!
Anyone out there that can help me with this? I want my temp sprite at the beginning of the game to disappear right after the first battle with Gary in Oaks lab
Male
Seen 2 Weeks Ago
Posted December 26th, 2021
409 posts
2.2 Years
Anyone out there that can help me with this? I want my temp sprite at the beginning of the game to disappear right after the first battle with Gary in Oaks lab
Assemble the routine. The open your rom in your hex editor and paste the contents of the .bin into your rom, overwriting enough FF bytes, and make sure the offset ends in 0, 4, 8, or C. Then Copy the offset and add 1 to it. Then reverse it: Example:
Let's say the offset is 800000:
800000+1=800001: 01 00 80
Or if the number of digits is odd:
5673C+1=5673D=05673D: 3D 67 05
Then overwrite bytes at 5CA4C
00 48 00 47 [reverse hex pointer] 08
Then make the script

BluRose

blu rass

Age 21
Male
michigan tech
Seen 19 Hours Ago
Posted June 12th, 2022
815 posts
8.3 Years
I've noticed significant demand for working Dawn Stone evolutions, specifically ones that require the mon to be a specific gender. My bad if this is already posted somewhere but here y'all go:

.org 0x4318e
lsl r0, r0, #0x0
ldr r2, .MethodAddr
bx r2

.MethodAddr: .word 0x085B2521 #UPDATE THIS TO MAIN FUNCTION OFFSET+1


.org 0x5B2520 #UPDATE THIS TO MOST CONVENIENT FREE SPACE IN YOUR HACK
cmp r0, #0x7
beq StandardStone
cmp r0, #0x14 #UPDATE THIS
beq MaleStone
cmp r0, #0x15 #UPDATE THIS
beq FemaleStone
b NoEvo

MaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0x0
beq StandardStone
b NoEvo


FemaleStone:
push {r1-r3}
mov r0, r7
mov r1, r8
ldr r1, [r1, #0x0]
bl DetermineGender
pop {r1-r3}
cmp r0, #0xFE
beq StandardStone
b NoEvo


StandardStone:
ldrh r0, [r1, #0x2]
cmp r0, r9
beq Finish

NoEvo:
ldr r2, .NoEvoReturn
bx r2

DetermineGender:
ldr r2, .DetermineGenderFunc
bx r2

Finish:
ldr r2, .EvoReturn
bx r2

.NoEvoReturn: .word 0x08043199
.EvoReturn: .word 0x0804317d
.DetermineGenderFunc: .word 0x0803f78d
Change the values in the lines marked UPDATE THIS to the indexes of male stone evos and female stone evos. Leave their entries blank in the general evolution table; stone evolutions function differently from level-up evolutions.
this is 5 years old, but don't leave the entries blank in the general evolution table: it misbehaves when interacting with other evolutions.
if my kirlia has a level-up evolution method and a gendered stone evolution method, then when leveling up the game will crash. adding the pointers for the stone evolution in the gendered stone entries will fix the crash. in effect, write 26 30 04 08 in those entries.
heyo check out my github:

BluRosie
highlights:
gen 5 pokémon in heart gold
gen 5 moves in heart gold [wip]
various feature branches in heart gold (fairy type, odd egg, more to come)

also on discord: BluRose#0412

FireFig

Ignite

Age 16
Male
Seen June 19th, 2022
Posted April 6th, 2021
200 posts
2.2 Years
Request for FIRERED:

An asm routine that gets into the Item storage in PC directly without opening any kind of menu first if (you get the gist ryt?) through calling the asm in a script.

It would be useful in many ways. Thanks :)
“Fire burns brighter in darkness."

AkameTheBulbasaur

Akame Marukawa of Iyotono

Age 25
Male
A place :D
Seen July 9th, 2022
Posted July 9th, 2022
404 posts
9.2 Years
Summary Screen Wrap-Around


First of all, I would like to thank Zeturic for creating the original routine for this. My routine is different from theirs, and I have extended it a bit, which is why I am posting this here.

Anyway, this patch modifies the summary screens in both the Party Menu and in the PC so that if you are on the first Pokemon and you go upwards, you will loop around to the last Pokemon (and vice versa). Ordinarily, in this circumstance, nothing would happen.

(Download)

This folder contains the patch itself, and the two routines that comprise it. There were two functions which were replaced, and both of the new functions were shorter than the originals (hence why this could be turned into a patch).

This patch will skip over Eggs when scrolling while in the Party or PC, but if you want to see the Egg's summary (to see how long it will take to hatch), you can select their summary individually.
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo

/JASHIN/

Age 28
Male
Canada
Seen January 22nd, 2022
Posted July 1st, 2021
62 posts
3.8 Years
Toggle Run Away

It can work with Toggle Capture very well, or completely independently.
If you use the same Variable as Toggle Capture, if the value is set to 0x1,
a Pokemon will be uncapturable, and you will be unable to Run Away from it.
If the value is 0x0, the game is as normal. If the value is anything else,
you cannot Run Away from the Pokemon BUT you can catch it.

However if you use a completely different variable you will be able to
run away, but not to catch the Pokemon, though to me this is pointless,
because if you have an uncatchable Pokemon, why would you be able to
Run Away from it?

Anyway here is the routine!

Fire Red


Spoiler:
.text
.align 2
.thumb
.thumb_func
.global ToggleRunAawayFR

Main:
	ldr r0, .Variable
	ldrb r0, [r0]
	cmp r0, #0x0
	bne CannotRun
Return:
	ldr r1, =(0x2023BE2)
	ldr r0, =(0x2023BCC)
	ldrb r0, [r0]
	strb r0, [r1]
	ldr r1, =(0x2023E8A)
	ldr r0, = (0x8016888 +1)
	bx r0
CannotRun:
	mov r6, #0x0
	ldr r0, = (0x801688C +1)
	bx r0

.align 2
.Variable:
	.word 0x020270B8 + (0x8000 * 2) @change to var of your choice if you want
Insert 01 48 00 47 00 00 xx xx xx 08 at 0801687E.


Once I finish porting other abilities I'll make a brand new post for the
Emerald version of this.
I'm probably very late to the party with this one, but I've run into an issue, where whenever the player obtains any items, be it a gift from a trainer, or a hidden item on the ground, the game locks running away. I have no code that sets it, but it instead auto sets and won't be dismissed until the var 0x8000 is set back to 0 via an event. Any one else face this problem and if so what was your solution? I know var 8000 is used quite a bit as a temporary var behind the scenes, so i was wondering if there was a safer one? I've tried using regular vars, but it seems as though it needs to be one of the temp ones specifically?

Edit: I fixed the issue by changing the var to 0x8003, for some reason 8001 and 8002 were insufficient, as obtaining an item from an NPC would still trigger the lock. Now what I'm wondering/ am worried about is whether or not the game is going to trigger this var behind the scenes like it did with the others, if so are there any temporary vars that go completely unused? Thanks :)
POKEMON PULSAR VERSION PHASE 02 THREAD: https://www.pokecommunity.com/showthread.php?t=421565
(Phase 03 in development)


POKEMON PULSAR VERSION PHASE 02 TRAILER:https://www.youtube.com/watch?v=zPY7_ZvoO7E
(Formerly known as Pokemon Jashin Version)


-Praise Be To Jashin

Paperfairy

WHAT ARE U LOOKIN' AT?

Age 30
he / him / his
San Francisco, CA
Seen March 16th, 2022
Posted February 1st, 2021
62 posts
18 Years
Here are the byte changes he wants you to do inorder to achieve an intro skip similar to Pokemon Rose (which you guys should all checkout, Bela's it's quite an awesome project).
So this works perfectly for removing the blue screen intro and the Oak intro. I am trying to retain the blue screen intro, but remove the Oak intro (I'll handle setting the player name with a custom routine later).

I tried editing this line by line to check and see what works, but didn't have any success or changes aside from noticing a binary change. Could somebody please point me in the right direction?

Dreamaker

Banned

Asgard
Seen April 12th, 2022
Posted November 19th, 2021
160 posts
12.9 Years
So because I have a life, I spent way too long yesterday writing a routine to change the measurements for the height and weight in the PokeDex to be in metric (for those who eschew the imperial system).

EDIT: I neglected to have this change the units for SEEN entries as well as CAUGHT entries. I fixed that now.



Height (Feet to Metres - (Uncaught Pokemon)):
Spoiler:
/* Assemble this at 0x1059D0 */
.text
.align 2
.thumb
.thumb_func

Main:
add r0, r13, #0xC
mov r1, #0xAC /* ? */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0xAC /* ? */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0x0 /* */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0xE1 /* m */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0xFF /* FF */
strb r1, [r0]
mov r0, r0
ldr r0, .Return
bx r0

.align 2
.Return: .word 0x081059FF


Height (Feet to Metres):
Spoiler:
/*00 48 00 47 XX XX XX 08 at 0x105924*/
.text
.align 2
.thumb
.thumb_func

/*r4 has the height number*/



Main:
mov r1, #0xB

Clear:
mov r2, r13
add r2, r2, r1
mov r0, #0x0
strb r0, [r2]
cmp r1, #0x10
beq Next
add r1, r1, #0x1
b Clear

Next:
mov r0, r4
cmp r4, #0xA
blt OneDigit
cmp r4, #0x64
blt TwoDigit

ThreeDigit:
mov r1, #0x64
bl Divide
mov r6, r0
mov r2, r13
add r2, r2, #0xC
mov r0, r6
add r0, r0, #0xA1
strb r0, [r2]
mul r1, r6
sub r0, r4, r1
mov r4, r0

TwoDigit:
mov r1, #0xA
bl Divide
mov r5, r0
mov r2, r13
add r2, r2, #0xD
mov r0, r5
add r0, r0, #0xA1
strb r0, [r2]
mul r1, r5
sub r0, r4, r1
mov r4, r0

OneDigit:
mov r2, r13
add r2, r2, #0xF
mov r0, r4
add r0, r0, #0xA1
strb r0, [r2]

PutTextIn:
mov r2, r13
add r2, r2, #0xE
mov r0, #0xAD
strb r0, [r2]
add r2, r2, #0x2
mov r0, #0x00
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xE1
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xFF
strb r0, [r2]
ldr r1, .Return
bx r1

Divide:
ldr r2, .Divide
bx r2

.align 2
.Return: .word 0x081059FF
.Divide: .word 0x081E4019


Weight (Pounds to Kilograms):
Spoiler:
/* 00 48 00 47 XX XX XX 08 at 0x105A94 */
/* Put AC 00 DF DB at 0x415FA0 */
.text
.align 2
.thumb
.thumb_func

/* r4 has the weight number */

Main:
mov r1, #0xB

Clear:
mov r2, r13
add r2, r2, r1
mov r0, #0x0
strb r0, [r2]
cmp r1, #0x10
beq Next
add r1, r1, #0x1
b Clear

Next:
mov r0, r4
cmp r4, #0xA
blt OneDigit
cmp r4, #0x64
blt TwoDigit
ldr r1, .Thousand
cmp r4, r1
blt ThreeDigit

FourDigit:
ldr r1, .Thousand
bl Divide
mov r6, r0
mov r2, r13
add r2, r2, #0xB
mov r0, r6
add r0, r0, #0xA1
strb r0, [r2]
ldr r1, .Thousand
mul r1, r6
sub r0, r4, r1
mov r4, r0

ThreeDigit:
mov r1, #0x64
bl Divide
mov r6, r0
mov r2, r13
add r2, r2, #0xC
mov r0, r6
add r0, r0, #0xA1
strb r0, [r2]
mov r1, #0x64
mul r1, r6
sub r0, r4, r1
mov r4, r0

TwoDigit:
mov r1, #0xA
bl Divide
mov r5, r0
mov r2, r13
add r2, r2, #0xD
mov r0, r5
add r0, r0, #0xA1
strb r0, [r2]
mov r1, #0xA
mul r1, r5
sub r0, r4, r1
mov r4, r0

OneDigit:
mov r2, r13
add r2, r2, #0xF
mov r0, r4
add r0, r0, #0xA1
strb r0, [r2]

PutTextIn:
mov r2, r13
add r2, r2, #0xE
mov r0, #0xAD
strb r0, [r2]
add r2, r2, #0x2
mov r0, #0x00
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xDF
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xDB
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0x00
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xFF
strb r0, [r2]
ldr r1, .Return
bx r1

Divide:
ldr r2, .Divide
bx r2

.align 2
.Return: .word 0x08105BE7
.Divide: .word 0x081E4019
.Thousand: .word 0x000003E8


Seen 3 Days Ago
Posted May 31st, 2021
183 posts
4.7 Years

Party Stat Checker



I promised someone that I'd post this once I found it. Well, I found it :P

How to insert:
Compile the following routine into free space:

Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r6, lr}
	ldr r6, =(0x2024029)
	ldrb r6, [r6]
	mov r5, #0x0

PokeLoop:
	cmp r6, r5
	beq none
	mov r0, #0x64
	mul r0, r0, r5
	mov r1, r0
	ldr r0, =(0x2024284)
	add r0, r0, r1
	ldr r1, .INDEX
	ldrb r1, [r1]
	ldr r2, =(0x803FBE8 +1)
	bl linker
	ldr r3, .ARG
	ldrb r3, [r3]
	cmp r0, r3
	bge PokeMatch

next:
	add r5, r5, #0x1
	b PokeLoop
	

PokeMatch:
	ldr r3, .ARG
	strb r5, [r3]
	pop {r0-r6, pc}

none:
	ldr r3, .ARG
	mov r5, #0x6
	strb r5, [r3]
	pop {r0-r6, pc}
	
linker:
	bx r2
	
.align 2


.ARG:
	.word 0x020270B8 + (0x8000 *2) 

.INDEX:
	.word 0x020270B8 + (0x8001 *2)
Here's a compiled version:
7F B5 10 4E 36 78 00 25 AE 42 12 D0 64 20 68 43 01 1C 0D 48 40 18 0A 49 09 78 0C 4A 00 F0 0D F8 06 4B 1B 78 98 42 01 DA 01 35 ED E7 03 4B 1D 70 7F BD 02 4B 06 25 1D 70 7F BD 10 47 B8 70 03 02 BA 70 03 02 29 40 02 02 84 42 02 02 E9 FB 03 08


Usage:
setvar 0x8001 0x[stat you want to retreive]
setvar 0x8000 0x[value you want stat to match]
callasm 0x[routine +1]

The return value will be stored in var 0x8000

Here's a brief list of useful stats you may be interested in checking:
Spoiler:

0x0B - Species
0x0C - Held Item
0x0D - Attack 1
0x0E - Attack 2
0x0F - Attack 3
0x10 - Attack 4
0x11 - PP 1
0x12 - PP 2
0x13 - PP 3
0x14 - PP 4
0x37 - Status Ailment
0x38 - Level
0x39 - Current HP
0x3A - Total HP
0x3B - Attack
0x3C - Defence
0x3D - Speed
0x3E - Sp. Attack
0x3F - Sp. Defence
This routine is odd. It's supposed to use 8001 to see which stat you want, then searches your entire team for a pokemon that has that stat equal to 8000 and then saves the first party slot number that matches that in 8000 (or outputs number 6 if none).

But the problem is that it thinks that the pokemon is valid, as long as it has the stat HIGHER or equal to what you use. For stuff like levels, atk, def etc. this has a use. But when searching stuff like species, items, attack or status ailments it completely falls apart (unless you want to check how deep down the pokedex a party member is? lol)

Anyway, my ASM knowledge is probably negative, but for searching these I think that "bge PokeMatch" would need to be changed to "beq PokeMatch", if you want to match the stats you search (correct me if I'm wrong) and in a cavemanish way, have two of these inserted and using one when you need higher than and the other one for matching the stat.

Honestly, it took me a while to figure out how the function is even supposed to work, since it's not very clearly explained.
This one caused me quite a headache, so hopefully this helps some poor lad out.
Seen 3 Days Ago
Posted May 31st, 2021
183 posts
4.7 Years
Nature Changing
Before I begin, I should mention that this only works for FireRed at the moment. This is because it uses the Lustre stat, which in FireRed is unused but in Emerald is not. If you can find another stat to use, (or you don't have contests in your Emerald hack), then you can use this.

Offsets listed here are for FireRed, though, so keep that in mind if you decide to port it.

Anyway, without further ado, I present Nature Changing!

How Does It Work?
Skip this if you don't care about the behind the scenes stuff.

Basically, this hijacks the GetNature function. It first checks the Lustre stat of the Pokemon in question. If it's equal to zero, then it gets the Nature form the PID as usual. If it's not zero, then it uses the Lustre value as the Nature, effectively changing the Pokemon's Nature without messing with the PID (and potentially messing up other stuff like the Pokemon's gender, Shininess, etc.).

This does mean you can't set the Nature to Hardy, but this is not that big of a deal since there are other neutral Natures you can use.

The Main Event
I have written an instruction manual that explains how to use the hack in detail. It also contains links to download everything.

The link presented below is the link to download the folder with the Instruction Manual and all the routines. Not every routine in the folder is one you need to insert, as there are a couple of optional add-ons to make changed Natures compatible with other hacks.

Download: Here!
Would it be possible to use a similar system to this one to change Pokemon IVs? I'm guessing it's not as simple as using 0x8005 to change IVs directly, but perhaps it would be possible to use other useless stats (like Lustre), to change IVs of pre-existing pokemon?

AkameTheBulbasaur

Akame Marukawa of Iyotono

Age 25
Male
A place :D
Seen July 9th, 2022
Posted July 9th, 2022
404 posts
9.2 Years
Would it be possible to use a similar system to this one to change Pokemon IVs? I'm guessing it's not as simple as using 0x8005 to change IVs directly, but perhaps it would be possible to use other useless stats (like Lustre), to change IVs of pre-existing pokemon?
You can use the Decrypt Function used in the Nature Changing Routine to change the IVs. Each IV is controlled individually, so if you use the right index number in the Decrypt Function, then you can edit the IVs.

The IVs are:
HP = 0x27
Attack = 0x28
Defence = 0x29
Speed = 0x2A
Sp. Attack = 0x2B
Sp. Defence = 0x2C

So, it actually is as simple as using 0x8005 to modify the IVs directly.
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo

JK0JK

JK is JK

any, mostly he/him
???, Portugal
Seen June 8th, 2022
Posted July 20th, 2021
23 posts
1.3 Years
Spoiler:

0 - male hero
1 - female hero
3 - female hero bike
4 - male hero run
5 - female hero run
6 - male hero vs-seeker
7 - female hero vs-seeker
8 - male hero fishing
9 - female hero fishing
12 - Brendon
13 - May
26 - Male + Female hero Vs seeker on bike
28 - Random guy (A-MAP ID 25)
29 - Little boy
44 - Gem sign thing (buggy)
48 - Spearow
52 - Old man 1 (A-MAP ID 33)
80 - Jogging girl
83 - Blonde dude (A-MAP ID 26)
84 - Fat guy
88 - Old man 2 (A-MAP ID 88)
92 - Scroll backpack thing (buggy)
93 - Team rocket male
104 - Meowth
112 - Chansey
116 - Slowbro
124 - Snorlax
125 - Fisherman
166 - Kid tuber (male)
170 - Old man 3 (A-MAP ID 30)
176 - Green girl (A-MAP ID 40)
213 - Red dress lady
214 - Old lady
228 - Deoxys (I think this one is normal)
245 - Misty
250 - Hey champ in the making guy
251 - Ghost Girl

While no particular value will cause a crash, I've excluded values which are "repeated" OWs. If you experience bugs, use it in conjunction with the backsprite hack I made. If you still have bugs, report them here!
How would I go about cloning to the Male Hero Bike sprite without using a bike or having it be the Female Hero Bike sprite?
Also, what do you mean by "repeated" OWs?

Any more clonable sprites are always helpful, especially in the rom hack I'm making.

JK0JK

JK is JK

any, mostly he/him
???, Portugal
Seen June 8th, 2022
Posted July 20th, 2021
23 posts
1.3 Years
Trying to make it work. Got a few questions, though...
  1. 0x5CA4C already has things on it. Should I worry about overriting the already existing data? What does the data already in do and what did you change?
  2. What does flag 0x406 do? It's also not free space but what other scripts use it?
  3. Variable 0x8000 is also not free space by default. What does it do normally?
  4. Variable 0x8000 needs to be set to a number. Should we convert that number to bytes or does the game do that automatically?

Sorry for the noob questions, this is my first experience with Rom Hacking.
Seen April 1st, 2022
Posted April 28th, 2021
2 posts
1.3 Years
You would use the party checker routine to check if Mewtwo is holding the item. Then, depending on the return you would call silent evolution. It's just simply combining two routines I've already done.


Thanks.

Get Pokemon Type



Recently, someone commented on the limitations of my special 0x12b edit. Honestly speaking it is very limited, and only really has a use for checking if you have a certain type of Pokemon. If you had multiple pokemon of the same type it would only return the first one..ect.ect. Well I decided to customize it a little more. It's less powerful now, but more useful (hopefully). All it does is return the type of a Pokemon in a certain slot.

How to insert:

Compile and insert into free space the following routine:
Spoiler:

.text
.align 2
.thumb
.thumb_func

main: 
	push {r0-r2, lr}
	ldr r1, =(0x20370B8) @var 0x8000 is slot (0x0 to 0x5)
	ldrb r1, [r1]
	mov r0, #0x64
	mul r1, r1, r0 @slot to check
	ldr r0, =(0x2024284)	
	add r0, r0, r1
	mov r1, #0xB
	ldr r2, =(0x803FBE8 +1)
	bl linker
	lsl r0, r0, #0x10
	lsr r0, r0, #0x10
	lsl r1, r0, #0x3
	sub r1, r1, r0
	lsl r1, r1, #0x2
	ldr r2, =(0x8254784)
	add r1, r1, r2
	ldrb r0, [r1, #0x6]
	ldr r1, =(0x20370B8)
	strb r0, [r1]
	pop {r0-r2, pc}

linker:
	bx r2	
	

.align 2
Sorry, too lazy to fetch compiled version :D


Usage:
setvar 0x8000 0x[pokemon slot from 0 to 5]
callasm 0x[routine +1]

It will store the Pokemon's type in variable 0x8000 in the form of an integer. The values in decimal follow this table (it will be stored in hex of course):
0x0 - Normal
0x1 - Fighting	
0x2 - Flying
0x3 - Poison
0x4 - Ground
0x5 - Rock
0x6 - Bug
0x7 - Ghost
0x8 - Steel
0x9 - ???
0xA - Fire
0xB - Water
0xC - Grass
0xD - Electric
0xE - Psychic
0xF - Ice
0x10 - Dragon
0x11 - Dark