The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking > Binary Hack Research & Development
Reload this Page Code ASM Resource Thread

Notices
For all updates, view the main page.

Binary Hack Research & Development Got a well-founded knack with your binary Pokémon hacks? Love reverse-engineering them? For the traditional Pokémon ROM hacker, this is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!

Ad Content
Reply
 
Thread Tools
  #1276   Link to this post, but load the entire thread.  
Old November 27th, 2017 (2:51 PM). Edited November 27th, 2017 by Lunos.
Lunos's Avatar
Lunos Lunos is offline
Random Uruguayan User
 
Join Date: Oct 2008
Location: Montevideo (Uruguay)
Gender: Male
Nature: Lonely
Posts: 3,000
Quote:
Originally Posted by ghoulslash View Post
Here you go! (admittedly I have not tested it)

Code:
.text
.align 2
.thumb
.thumb_func
.global GetHappiness

Main:
	push {r0-r2, lr}
	ldr r0, .var8004
	ldrb r0, [r0]	@slot num
	mov r1, #0x64
	mul r0, r1
	ldr r1, .PartyData
	add r0, r1, r0
	mov r1, #0x20	@happiness
	bl GetAttribute
	ldr r1, .var8004
	strb r0, [r1, #0x2]	@store into var8005
	pop {r0-r2, pc}
	
GetAttribute:
	ldr r2, =(0x0803FBE8 +1)
	bx r2
	
.align 2
.PartyData:	.word 0x02024284
.var8004:	.word 0x020370C0
Welp, it didn't work.
I compiled the routine and dropped it in the offset 71A250, wrote this script and once I checked it In-Game, this was the result.

Note: Just for the record, the savefile is right after defeating my Rival for the very first time, so there's no way for my Pokémon to have 76 points.

Dunno if you'll be able to fix it, but in any case thank you very much.
__________________
Reply With Quote
  #1277   Link to this post, but load the entire thread.  
Old November 27th, 2017 (5:18 PM). Edited November 27th, 2017 by ghoulslash.
ghoulslash's Avatar
ghoulslash ghoulslash is offline
 
Join Date: Mar 2016
Gender: Male
Posts: 238
Quote:
Originally Posted by Lunos View Post
Welp, it didn't work.
I compiled the routine and dropped it in the offset 71A250, wrote this script and once I checked it In-Game, this was the result.

Note: Just for the record, the savefile is right after defeating my Rival for the very first time, so there's no way for my Pokémon to have 76 points.

Dunno if you'll be able to fix it, but in any case thank you very much.
Hmm. It seems like it might be working, as 76 is close enough to base happiness of 70. +5 pts for leveling up during the rival battle and +1 for running 128 steps is feasible.

You could test it by using the following set happiness (slot in 0x8004, value to set in 0x8005) routine with a pokemon that evolves via happiness. I think the threshold for evolving is 220? (Routine is also untested)

Code:
.text
.align 2
.thumb
.thumb_func
.global SetHappiness

Main:
	push {r0-r3, lr}
	ldr r2, .var8004
	ldrb r0, [r2]	@slot num
	add r2, #0x2	@var 0x8005 address where you stored new happiness
	mov r1, #0x64
	mul r0, r1
	ldr r1, .PartyData
	add r0, r1, r0
	mov r1, #0x20	@happiness
	bl SetAttribute
	pop {r0-r3, pc}
	
SetAttribute:
	ldr r3, =(0x0804037C +1)
	bx r3
	
.align 2
.PartyData:	.word 0x02024284
.var8004:	.word 0x020370C0
Reply With Quote
  #1278   Link to this post, but load the entire thread.  
Old November 27th, 2017 (5:45 PM). Edited November 27th, 2017 by Lunos.
Lunos's Avatar
Lunos Lunos is offline
Random Uruguayan User
 
Join Date: Oct 2008
Location: Montevideo (Uruguay)
Gender: Male
Nature: Lonely
Posts: 3,000
Quote:
Originally Posted by ghoulslash View Post
Hmm. It seems like it might be working, as 76 is close enough to base happiness of 70. +5 pts for leveling up during the rival battle and +1 for running 128 steps is feasible.
Oh shoot, you're right! I absolutely forgot the base happiness and the bonus for leveling up!
I thought that the +1 could be because I defeated his Squirtle and that summed one point to my Charmander's happiness, but nope, I tested it by killing a wild Pokémon and it didn't add a point, so I guess the amount of steps must be the answer.

I also fixed my issue with the name by adding the special 0x7C to my script, so yeah, it's over.

Thank you so much for making this routine Ghoul <3
__________________
Reply With Quote
  #1279   Link to this post, but load the entire thread.  
Old December 10th, 2017 (1:02 PM).
Megax Rocker's Avatar
Megax Rocker Megax Rocker is offline
 
Join Date: Jan 2016
Posts: 112
Quote:
Originally Posted by NewDenverCity View Post
SPEEDING UP FIRERED
All this does is make the turbo button on VBA work faster.
Emerald solution is found here. That's also the source of my implementation of this.
Code:
.thumb

.org 0x890
main:
	push {lr}
	ldr r2, super_bits
	ldrh r3, [r2]
	mov r0, #1
	bic r3, r0
	strh r3, [r2]
loop_label:
	swi #2
	ldrh r3, [r2]
	tst r3, r0
	beq loop_label
	pop {pc}

.align 2
super_bits: .word 0x0300310C
Hello.

Is it possible to make turbo unusable by editing this routine?

Basically to prevent the player from abusing it for grinding and so on.
Reply With Quote
  #1280   Link to this post, but load the entire thread.  
Old December 10th, 2017 (1:16 PM). Edited December 10th, 2017 by tkim.
tkim's Avatar
tkim tkim is offline
 
Join Date: May 2011
Posts: 232
Quote:
Originally Posted by Megax Rocker View Post
Hello.

Is it possible to make turbo unusable by editing this routine?

Basically to prevent the player from abusing it for grinding and so on.
You mean the turbo function on VBA? If yes, it's impossible.

Quote:
Originally Posted by MWisBest View Post
I combined this into 1 routine and cut the total size down a lot. All credit to DizzyEgg of course, this is nothing compared to creating the mod in the first place.

Code:
.text
.thumb
.thumb_func
.align 2

@ 0x1C379E: 02 30 00 4A 10 47 XX+1 XX XX 08
@ 0x1C3864: 00 4A 10 47 XX+1 XX XX 08

main:
	@ at this point... r0 contains our return address (- 8). Convenient!
	push {r5-r7}
	
	@ save return address for later.
	mov r6, r0
	add r6, #0x8
	
	@ to determine what function we were called from:
	@ if it was right stats, r9 is 0. if it was left stats, r9 has something in it.
	mov r7, r9 @ can't really use hi registers in thumb, mov it down.
	@ so, to check the function type: cmp r7, #0. eq means right stats.
	
	sub sp, sp, #0x20
	ldr r0, [r4] @pokemon summary pointer. we're free to use r4 after this.
	add r0, #0xA3 @poke nature
	ldrb r1, [r0]
	ldr r0, nature_stat_table
	
	mov r2, #5
	mul r2, r1
	
	mov r1, sp
	mov r5, #0
	
	add r2, r2, r0 @r2 contains nature info
	cmp r7, #0
	beq right_stats_begin


@@ LEFT STAT COLORING BEGIN @@@

left_stats_begin:
	ldr r3, left_stats_string

handle_hp:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #6
	bne handle_hp
	add r3, #6
	add r1, #6
	mov r5, #0

handle_atk:
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_atk
	cmp r0, #0xFF
	bne copy_atk
	bl blue_font
	b copy_atk

red_font_atk:
	bl red_font

copy_atk:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_atk
	add r3, #3
	add r1, #3
	mov r5, #0

handle_def:
	add r2, #1
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_def
	cmp r0, #0xFF
	beq blue_font_def
	bl default_font
	b copy_def

red_font_def:
	bl red_font
	b copy_def

blue_font_def:
	bl blue_font

copy_def:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_def
	b return

@@@ LEFT STAT COLORING END @@


@@@ RIGHT STAT COLORING BEGIN @@@

right_stats_begin:
	add r2, #3 @r2 contains beg of spatk stat
	ldr r3, right_stats_string

handle_spatk:
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_spatk
	cmp r0, #0xFF
	bne copy_spatk
	bl blue_font
	b copy_spatk

red_font_spatk:
	bl red_font

copy_spatk:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_spatk
	add r3, #3
	add r1, #3
	mov r5, #0

handle_spdef:
	add r2, #1
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_spdef
	cmp r0, #0xFF
	beq blue_font_spdef
	bl default_font
	b copy_spdef

red_font_spdef:
	bl red_font
	b copy_spdef

blue_font_spdef:
	bl blue_font

copy_spdef:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_spdef
	add r3, #3
	add r1, #3
	mov r5, #0

handle_spd:
	sub r2, #2
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_spd
	cmp r0, #0xFF
	beq blue_font_spd
	bl default_font
	b copy_spd

red_font_spd:
	bl red_font
	b copy_spd

blue_font_spd:
	bl blue_font

copy_spd:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_spd
	b return

@@@ RIGHT STAT COLORING END @@@


@@@ FONT FUNCTIONS BEGIN @@@

blue_font: @FC 01 07
	mov r4, #7 @color of the lowered stat
	b font_common

red_font: @FC 01 05
	mov r4, #5 @color of the raised stat
	b font_common

default_font: @FC 01 01
	mov r4, #1 @color of the regular stats
	@ just fall through to font_common (no need to branch)

font_common:
	mov r0, #0xFC
	strb r0, [r1]
	add r1, #1
	mov r0, #1
	strb r0, [r1]
	add r1, #1
	strb r4, [r1]
	add r1, #1
	bx lr

@@@ FONT FUNCTIONS END @@@


return:
	ldr r0, displayed_string
	mov r1, sp
	ldr r2, special_f7_string_fct
	bl x_r2
	cmp r7, #0
	beq skip_mov_r0_r9
	mov r0, r9
skip_mov_r0_r9:
	add sp, sp, #0x20
	mov r2, r6
	pop {r5-r7}
x_r2:
	bx r2


.align 2
nature_stat_table: .word 0x0831E818
left_stats_string: .word 0x0861CE82
right_stats_string: .word 0x0861CE8E
displayed_string: .word 0x02021FC4
special_f7_string_fct: .word 0x081AFC29
Does anybody know how I can edit this in order to make it highlight the stat names instead of values? (ex. 'Attack' instead of '255')
Reply With Quote
  #1281   Link to this post, but load the entire thread.  
Old December 12th, 2017 (7:03 AM).
Sensual Sensual is offline
This should be good.
 
Join Date: Sep 2014
Gender: Male
Posts: 106
Is it possible to add or subtract a value from a var? For example, if I have var x4000 set to 0x3, could I call ASM that dynamically subtracts 1 from it (making it 0x2)?
Reply With Quote
  #1282   Link to this post, but load the entire thread.  
Old December 12th, 2017 (8:28 AM). Edited December 12th, 2017 by Pleasure.
Pleasure's Avatar
Pleasure Pleasure is offline
 
Join Date: Apr 2015
Gender: Male
Nature: Timid
Posts: 113
Quote:
Originally Posted by Sensual View Post
Is it possible to add or subtract a value from a var? For example, if I have var x4000 set to 0x3, could I call ASM that dynamically subtracts 1 from it (making it 0x2)?
Addition:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r1, lr}
	
	ldr r0, =(0x[address of var])
	
	ldrh r0, [r0]
	
	add r0, #0x1

	ldr r1, =(0x[address of var])
	strh r0, [r1]
	
	pop {r0-r1, pc}

.align 2


Subtraction
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r1, lr}
	
	ldr r0, =(0x[address of var])
	
	ldrh r0, [r0]
	
	sub r0, #0x1

	ldr r1, =(0x[address of var])
	strh r0, [r1]
	
	pop {r0-r1, pc}

.align 2
Reply With Quote
  #1283   Link to this post, but load the entire thread.  
Old December 12th, 2017 (8:51 AM).
Skeli's Avatar
Skeli Skeli is offline
Lord of the Rings
 
Join Date: Apr 2014
Location: Canada
Age: 24
Gender: Male
Nature: Adamant
Posts: 300
Quote:
Originally Posted by Sensual View Post
Is it possible to add or subtract a value from a var? For example, if I have var x4000 set to 0x3, could I call ASM that dynamically subtracts 1 from it (making it 0x2)?
Use the addvar scripting command. Look up in the xse commands how it works.
__________________
Pokemon Unbound

Reply With Quote
  #1284   Link to this post, but load the entire thread.  
Old December 12th, 2017 (9:44 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by Pleasure View Post
Addition:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r1, lr}
	
	ldr r0, =(0x[address of var])
	
	ldrh r0, [r0]
	
	add r0, #0x1

	ldr r1, =(0x[address of var])
	strh r0, [r1]
	
	pop {r0-r1, pc}

.align 2


Subtraction
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r1, lr}
	
	ldr r0, =(0x[address of var])
	
	ldrh r0, [r0]
	
	sub r0, #0x1

	ldr r1, =(0x[address of var])
	strh r0, [r1]
	
	pop {r0-r1, pc}

.align 2
This would break for every var not in the 0x8000s. Most scripting variables shuffle around with the saveblocks and you need to call the var_access function to get their locations. There is also var_set, var_load and over/underflow to think about. Overall, doing this in scripting is recommended as the callasm setup + execution ends up being slower.

Btw, you don't need to push scratch registers unless you were hooking (do so on a case by case basis). Nor the link register here because you're not calling a function.

Code:
.thumb
.align 2

main:
	ldr r0, =addr
	ldrh r1, [r0]
	sub r1, r1, #0x1
	strh r1, [r0]
	bx lr

.align 2
addr:
	.word 0xsomething
Something like this. But as mentioned before it's unadvisable to do it this way.
__________________
...
Reply With Quote
  #1285   Link to this post, but load the entire thread.  
Old December 13th, 2017 (10:21 AM). Edited December 13th, 2017 by Pleasure.
Pleasure's Avatar
Pleasure Pleasure is offline
 
Join Date: Apr 2015
Gender: Male
Nature: Timid
Posts: 113
Quote:
Originally Posted by FBI View Post
This would break for every var not in the 0x8000s. Most scripting variables shuffle around with the saveblocks and you need to call the var_access function to get their locations. There is also var_set, var_load and over/underflow to think about. Overall, doing this in scripting is recommended as the callasm setup + execution ends up being slower.

Btw, you don't need to push scratch registers unless you were hooking (do so on a case by case basis). Nor the link register here because you're not calling a function.

Code:
.thumb
.align 2

main:
	ldr r0, =addr
	ldrh r1, [r0]
	sub r1, r1, #0x1
	strh r1, [r0]
	bx lr

.align 2
addr:
	.word 0xsomething
Something like this. But as mentioned before it's unadvisable to do it this way.
On this note, I want to use something similar to this in the future, but I need the value to stay within a certain range (0x0 - 0x5, for example). Is there a command that checks var values so that the script knows not to add or subtract once the value reaches either end of that range? Or would this require ASM?

Is there a document with all the XSE commands? I can't seem to find one.
Reply With Quote
  #1286   Link to this post, but load the entire thread.  
Old December 13th, 2017 (11:20 AM).
Skeli's Avatar
Skeli Skeli is offline
Lord of the Rings
 
Join Date: Apr 2014
Location: Canada
Age: 24
Gender: Male
Nature: Adamant
Posts: 300
Quote:
Originally Posted by Pleasure View Post
On this note, I want to use something similar to this in the future, but I need the value to stay within a certain range (0x0 - 0x5, for example). Is there a command that checks var values so that the script knows not to add or subtract once the value reaches either end of that range? Or would this require ASM?

Is there a document with all the XSE commands? I can't seem to find one.
Go into XSE and click on the "Help" tab at the top, then "Command Help."

You could do something like:
compare 0x5000 0x5
if >= jump :end
addvar 0x5000 0x1
:end
end
__________________
Pokemon Unbound

Reply With Quote
  #1287   Link to this post, but load the entire thread.  
Old December 26th, 2017 (5:17 AM).
Lunos's Avatar
Lunos Lunos is offline
Random Uruguayan User
 
Join Date: Oct 2008
Location: Montevideo (Uruguay)
Gender: Male
Nature: Lonely
Posts: 3,000
Hi. Does anyone over here have an ASM Routine that allows you to hide and show the Trainer Card's access from the Start Menu at will?


Thanks in advance for reading.
__________________
Reply With Quote
  #1288   Link to this post, but load the entire thread.  
Old December 26th, 2017 (6:53 AM).
ghoulslash's Avatar
ghoulslash ghoulslash is offline
 
Join Date: Mar 2016
Gender: Male
Posts: 238
Quote:
Originally Posted by Lunos View Post
Hi. Does anyone over here have an ASM Routine that allows you to hide and show the Trainer Card's access from the Start Menu at will?


Thanks in advance for reading.
You can adjust this routine to do this. The "noMon" header determines the start menu options after pokedex and pokemon, where
Code:
mov r0, #0xX
ldr r1, =(0x806ED94 +1)
bl linker
shows the start menu option 'X'. So in that particular routine, 0x4 is not being added, which is the 'Save' function. So, to remove the trainer card, you would just leave out the 0x3 index of the start menu
Reply With Quote
  #1289   Link to this post, but load the entire thread.  
Old December 26th, 2017 (7:04 AM).
Delta231's Avatar
Delta231 Delta231 is offline
A noob
 
Join Date: May 2016
Location: India
Gender: Male
Nature: Bold
Posts: 682
I would like someone to make an ASM Routine to have separate palletes for the OWs which appear on the World Map. (Fire Red)

Here are the offsets for the images
Male
Spoiler:


Female
Spoiler:
__________________
HGSS OWs in FR Style
Fire Red NSE Bookmarks


A supporter of


Reply With Quote
  #1290   Link to this post, but load the entire thread.  
Old December 28th, 2017 (7:22 AM).
ghoulslash's Avatar
ghoulslash ghoulslash is offline
 
Join Date: Mar 2016
Gender: Male
Posts: 238
Quote:
Originally Posted by Delta231 View Post
I would like someone to make an ASM Routine to have separate palletes for the OWs which appear on the World Map. (Fire Red)

Here are the offsets for the images
Male
Spoiler:


Female
Spoiler:
You actually probably don't need an assembly routine for this. I would use
Navenatox's dynamic overworld palettes patch
. You can just re-upload the female sprites and it will inherit a different palette number. And combined with JPAN's engine allows you to swap player overworld sprites, all with individual palettes.

Hope this helps :)
Reply With Quote
  #1291   Link to this post, but load the entire thread.  
Old December 28th, 2017 (7:56 AM).
Delta231's Avatar
Delta231 Delta231 is offline
A noob
 
Join Date: May 2016
Location: India
Gender: Male
Nature: Bold
Posts: 682
Quote:
Originally Posted by ghoulslash View Post
You actually probably don't need an assembly routine for this. I would use
Navenatox's dynamic overworld palettes patch
. You can just re-upload the female sprites and it will inherit a different palette number. And combined with JPAN's engine allows you to swap player overworld sprites, all with individual palettes.

Hope this helps :)
Does it really work? I kinda doubt that. :P
__________________
HGSS OWs in FR Style
Fire Red NSE Bookmarks


A supporter of


Reply With Quote
  #1292   Link to this post, but load the entire thread.  
Old December 28th, 2017 (10:56 AM).
ghoulslash's Avatar
ghoulslash ghoulslash is offline
 
Join Date: Mar 2016
Gender: Male
Posts: 238
Quote:
Originally Posted by Delta231 View Post
Does it really work? I kinda doubt that. :P
It should work fine, as long as you haven't overwritten anything. Try it out!
Reply With Quote
  #1293   Link to this post, but load the entire thread.  
Old December 30th, 2017 (12:26 AM).
Lancekoijerwillborough Lancekoijerwillborough is offline
 
Join Date: Jan 2017
Gender: Male
Posts: 41
here is the request of mine:

1. Other Forms
I am looking for a routine that allows 2 or more species to share similar dex number. By that, we can have a feature for Flabébé forms and other Pokémon
Reply With Quote
  #1294   Link to this post, but load the entire thread.  
Old December 30th, 2017 (5:30 PM).
Mystelex
Guest
 
Posts: n/a
Quote:
Originally Posted by Delta231 View Post
Does it really work? I kinda doubt that. :P
Delta, they actually use separate palettes.
Boy: 003EF27C
Girl: 003EF29C

:dansad:
Reply With Quote
  #1295   Link to this post, but load the entire thread.  
Old December 30th, 2017 (9:55 PM).
Delta231's Avatar
Delta231 Delta231 is offline
A noob
 
Join Date: May 2016
Location: India
Gender: Male
Nature: Bold
Posts: 682
Quote:
Originally Posted by Daman View Post
Delta, they actually use separate palettes.
Boy: 003EF27C
Girl: 003EF29C

:dansad:
Thanks
^^

Quote:
Originally Posted by ghoulslash View Post
It should work fine, as long as you haven't overwritten anything. Try it out!
Sorry, I should have double checked. ;-;
__________________
HGSS OWs in FR Style
Fire Red NSE Bookmarks


A supporter of


Reply With Quote
  #1296   Link to this post, but load the entire thread.  
Old January 1st, 2018 (12:02 AM).
DarkPsychic's Avatar
DarkPsychic DarkPsychic is offline
 
Join Date: Jul 2012
Location: CO
Gender: Male
Nature: Timid
Posts: 146
XSE Special Command to delete pokemon

Hello,
After taking a tutorial from FBI we where able to come up with this.

Here is how it works:
Var 0x8004 value
0x0 = Players 1st Pokemon
0x1 = Players 2nd Pokemon
0x2 = Players 3rd Pokemon
0x3 = Players 4th Pokemon
0x4 = Players 5th Pokemon
0x5 = Players 6th Pokemon


So you could use Special 0x9F.
Which will let you choose the Pokemon you want deleted.
Then callasm 0x?????? +1(where "??????" is where you placed this routine).

C source:
Code:

#include 

void delete_pokemon()
{
    u8 slot = var_8004; // get slot id from variable
    if (slot != 5) {
        memcpy(&party_player[slot], &party_player[slot + 1], 100 * (5 - slot));
    }
    memset(&party_player[5], 0x0, 100);
    return;
}
Pre-Compiled version:
Code:

0C 4B 1B 78 10 B5 05 2B 0C D0 64 24 05 22 59 1C 
D2 1A 61 43 63 43 08 48 62 43 09 18 18 18 07 4B 
00 F0 12 F8 64 22 00 21 05 48 06 4B 00 F0 0C F8 
10 BD C0 46 C0 70 03 02 84 42 02 02 79 5E 1E 08 
78 44 02 02 D9 5E 1E 08 18 47 C0 46
Place in free aligned location.

Xse Test Script:
Code:

#dynamic 0x810000

#org @start
lockall
faceplayer
msgbox @question 0x5
compare 0x800D 0x1
if 0x1 goto @yes
msgbox @no 0x6
releaseall
end

#org @yes
msgbox @delete 0x6
special 0x9F
waitstate
callasm 0x??????+1  //make sure to change this to pointer where you put routine
msgbox @done 0x6
release
end


#org @question
= Would you like me to delete a Pokemon?

#org @delete
=Alright then here we go!

#org @done
= There the deed has been done!

#org @no
= Maybe next time then.
Hope this helps and credit to FBI once again.
Hope this helps.
Reply With Quote
  #1297   Link to this post, but load the entire thread.  
Old January 7th, 2018 (10:37 PM). Edited January 7th, 2018 by Xencleamas.
Xencleamas's Avatar
Xencleamas Xencleamas is offline
Suddenly lurking in the shadows...
 
Join Date: Feb 2014
Gender: Male
Nature: Adamant
Posts: 456
Quote:
Originally Posted by azurile13 View Post
This post motivated me to create an actual regional dex instead of just giving a national dex at the start, so thanks :D I've added some extra routines to do things like display the correct regional dex number in summary screens, displaying dex info on capture, and having the proper regional dex count. New hooks:
Code:
.thumb
.align

.equ number_of_mons_in_regional_dex,	300	//or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex,	721





data_on_capture_hook:	//0x08106B84 via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0
	bne capture_display_return
	ldr r0, add_task_no_capture_display
	bx r0

capture_display_return:
	ldr r0, add_task_capture_display
	bx r0





habitat_dex_regional_limit_hook:	//0x08106810 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x1
	beq habitat_dex_regional_limit_return	//valid
	mov r0, r4
	bl species_to_regional_dex_number
	cmp r0, #0x0
	beq habitat_dex_regional_limit_return	//not in regional dex, return 0
	mov r0, #0x1

habitat_dex_regional_limit_return:
	pop {r4}
	pop {r1}
	bx r1





dex_seeable_mon_hook:	//0x08043F90 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq only_regional_numbered
//national
	mov r0, r4
	bl species_to_national_dex_number_1
	b dex_seeable_mon_check_valid_species

only_regional_numbered:
	mov r0, r4
	bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
	cmp r0, #0x0
	bne dex_seeable_mon_return
	ldr r0, full_halfword

dex_seeable_mon_return:
	pop {r4}
	pop {r1}
	bx r1
.align
full_halfword:	.word 0xFFFF





dex_evolution_fix_hook:	//0x080CE91A via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0	//not in regional dex, invalid
	beq dex_evolution_failure
	ldr r0, dex_evolution_success_return
	bx r0

dex_evolution_failure:
	mov r0, #0x11
	strh r0, [r5, #0x8]
	mov r2, #0x1
	ldr r1, dex_evolution_failure_return
	bx r1





dex_display_counts_hook:	//0x08104BBC via r2
	//r0: mode
	push {lr}
	cmp r1, #0x0
	beq call_regional_count
	bl national_pokedex_count
	b dex_display_counts_return

call_regional_count:
	bl dex_regional_count_hook

dex_display_counts_return:
	pop {pc}





dex_regional_count_hook:	//0x08088EDC via r1
	push {r4-r6, lr}
	mov r6, r0	//mode
	mov r4, #0x1	//loop
	mov r5, #0x0	//counter

dex_regional_count_loop:
	lsl r0, r4, #0x1	//loop times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]	//req species
	mov r1, r6	//mode
	mov r2, #0x1	//input is SPECIES
	bl dex_flag_check
	add r5, r5, r0
	add r4, #0x1
	ldr r0, regional_dex_limit
	cmp r4, r0
	blo dex_regional_count_loop
	mov r0, r5
	pop {r4-r6, pc}





dex_display_hook:	//0x0810352C via r1
	ldr r1, regional_dex_limit
	cmp r0, #0x0
	beq store_dex_limit_and_return
	ldr r1, national_dex_limit

store_dex_limit_and_return:
	str r1, [sp, #0x0]
	ldr r0, regional_dex_limit_return
	bx r0





regional_dex_hook:	//0x0810356C via r0
	mov r4, r8
	add r4, #0x1
	lsl r0, r4, #0x1	//index times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]
	bl species_to_national_dex_number_1
	mov r5, r0
	mov r1, #0x0
	ldr r2, regional_dex_hook_return
	bx r2





store_last_dex_seen_hook:	//0x081035B4 via r1
	str r0, [r2]
	mov r10, r4
	mov r4, r3
	ldr r0, def_store_string_dex_number
	bx r0





lazy_regional_dex_end_hook:	//0x081035F4 via r0
	mov r0, r8
	ldr r1, regional_dex_limit
	cmp r0, r1
	blo regional_dex_hook
	ldr r0, end_dex_display_return
	bx r0





display_regional_num_hook:	//0x08104A66 via r1
	mov r5, r0	//save species
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq use_regional_dex_ordering
	ldr r1, dex_malloc_ptr
	ldr r1, [r1]
	add r1, #0x42
	ldrb r1, [r1]
	cmp r1, #0x0	//check if looking at regional dex
	beq use_regional_dex_ordering
	mov r0, r5
	bl species_to_national_dex_number_1
	b display_dex_number_return

use_regional_dex_ordering:
	mov r0, r5
	bl species_to_regional_dex_number	

display_dex_number_return:
	mov r5, r0
	ldr r0, dex_number_display_return
	bx r0





species_to_regional_dex_number:
	adr r3, regional_dex_order
	mov r2, r0	//req species
	mov r0, #0x0	//loop counter
find_regional_number_loop:
	lsl r1, r0, #0x1
	ldrh r1, [r3, r1]
	cmp r1, r2
	beq species_to_regional_dex_return
	add r0, #0x1
	ldr r1, regional_dex_limit
	cmp r0, r1
	bls find_regional_number_loop
	mov r0, #0x0	//not in dex: set number to 0
species_to_regional_dex_return:
	bx lr



species_to_national_dex_number_1:
	ldr r1, f_species_to_nat_dex
	bx r1
.align
f_species_to_nat_dex:	.word 0x08043298 + 1

haz_national_dex_bool:
	ldr r0, f_haz_national_check
	bx r0
.align
f_haz_national_check:	.word 0x0806E25C + 1

dex_flag_check:
	ldr r3, f_dex_flag_check
	bx r3
.align
f_dex_flag_check:	.word 0x08104AB0 + 1

national_pokedex_count:
	ldr r1, f_national_pokedex_count
	bx r1
.align
f_national_pokedex_count:	.word 0x08088E8C + 1



.align
add_task_no_capture_display:	.word 0x08106B90 + 1
add_task_capture_display:	.word 0x08106BA4 + 1
dex_evolution_success_return:	.word 0x080CE948 + 1
dex_evolution_failure_return:	.word 0x080CE924 + 1
regional_dex_limit:	.word number_of_mons_in_regional_dex
national_dex_limit:	.word number_of_mons_in_national_dex
regional_dex_limit_return:	.word 0x0810353a + 1
regional_dex_hook_return:	.word 0x08103578 + 1
def_store_string_dex_number:	.word 0x081035D6 + 1
end_dex_display_return:	.word 0x08103906 + 1
dex_malloc_ptr:			.word 0x0203ACF0
dex_number_display_return:	.word 0x08104A70 + 1

regional_dex_order:
.short 0x0000
.short CHIKORITA
.short BAYLEEF
.short MEGANIUM
etc
For anyone using Touched's scripts/ASMAGIX:
Code:
data_on_capture_hook		08106B84	1
dex_seeable_mon_hook		08043F90	1
dex_evolution_fix_hook		080CE91A	1
dex_display_counts_hook		08104BBC	2
dex_regional_count_hook		08088EDC	1
dex_display_hook		0810352C	1
regional_dex_hook		0810356C	0
store_last_dex_seen_hook	081035B4	1
lazy_regional_dex_end_hook	081035F4	0
display_regional_num_hook	08104A66	1
habitat_dex_regional_limit_hook	08106810	1
I have modified and enhanced azurile13's (credits and kudos to him) routine to make this supported on the Compiler's THUMB.bat. These are the things I modified:
  • Added routines creating the hooks that are to be copy-pasted on their respective locations. There are 11 hooks.
  • Added the master location of the routine in which the hooks will create locations for those routines. Insert your free space on .equ MyLoc. Format: 0x###### (Hexadecimal Number)
  • Created and added a new index list of Pokémon up to Generation VI including the formes in style of KDS/Chacha Dinosaur from the filenames of MrDollSteak's sprites in his Sugimori and Gen VI threads. I think there is no master index list for Generation VII. If there is, please PM me and I will add those.
  • With the list created as stated above, you will just have to create your own Regional Pokédex by copy-pasting from your Excel and Notepad file to below "regional_dex_order" and .hword 0x0000 should be first in the list. Make sure the names are all CAPS-LOCKED. In case of Nidorans, Farfetch'd, Mr. Mime, Ho-Oh, Mime Jr., Porygon-Z, and Flabébé, their characters are changed so you'll have to look for them in the master list. NOTE: Cohagrigus have been filtered out and changed into asterisks (*). Remember to correct its name before generating the binary file otherwise the .asm file won't work.

Custom Regional Pokédex for FireRed:
Spoiler:
Code:
.thumb
.align

.equ number_of_mons_in_regional_dex, 202 @or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex, 386
.equ MyLoc, 0x888888 @insert your location here
.equ RomAreaOffset,	0x8000000

@Kanto

.equ UNKNOWN, 0x0
.equ BULBASAUR, 0x1
.equ IVYSAUR, 0x2
.equ VENUSAUR, 0x3
.equ CHARMANDER, 0x4
.equ CHARMELEON, 0x5
.equ CHARIZARD, 0x6
.equ SQUIRTLE, 0x7
.equ WARTORTLE, 0x8
.equ BLASTOISE, 0x9
.equ CATERPIE, 0xA
.equ METAPOD, 0xB
.equ BUTTERFREE, 0xC
.equ WEEDLE, 0xD
.equ KAKUNA, 0xE
.equ BEEDRILL, 0xF
.equ PIDGEY, 0x10
.equ PIDGEOTTO, 0x11
.equ PIDGEOT, 0x12
.equ RATTATA, 0x13
.equ RATICATE, 0x14
.equ SPEAROW, 0x15
.equ FEAROW, 0x16
.equ EKANS, 0x17
.equ ARBOK, 0x18
.equ PIKACHU, 0x19
.equ RAICHU, 0x1A
.equ SANDSHREW, 0x1B
.equ SANDSLASH, 0x1C
.equ NIDORAN_F, 0x1D
.equ NIDORINA, 0x1E
.equ NIDOQUEEN, 0x1F
.equ NIDORAN_M, 0x20
.equ NIDORINO, 0x21
.equ NIDOKING, 0x22
.equ CLEFAIRY, 0x23
.equ CLEFABLE, 0x24
.equ VULPIX, 0x25
.equ NINETALES, 0x26
.equ JIGGLYPUFF, 0x27
.equ WIGGLYTUFF, 0x28
.equ ZUBAT, 0x29
.equ GOLBAT, 0x2A
.equ ODDISH, 0x2B
.equ GLOOM, 0x2C
.equ VILEPLUME, 0x2D
.equ PARAS, 0x2E
.equ PARASECT, 0x2F
.equ VENONAT, 0x30
.equ VENOMOTH, 0x31
.equ DIGLETT, 0x32
.equ DUGTRIO, 0x33
.equ MEOWTH, 0x34
.equ PERSIAN, 0x35
.equ PSYDUCK, 0x36
.equ GOLDUCK, 0x37
.equ MANKEY, 0x38
.equ PRIMEAPE, 0x39
.equ GROWLITHE, 0x3A
.equ ARCANINE, 0x3B
.equ POLIWAG, 0x3C
.equ POLIWHIRL, 0x3D
.equ POLIWRATH, 0x3E
.equ ABRA, 0x3F
.equ KADABRA, 0x40
.equ ALAKAZAM, 0x41
.equ MACHOP, 0x42
.equ MACHOKE, 0x43
.equ MACHAMP, 0x44
.equ BELLSPROUT, 0x45
.equ WEEPINBELL, 0x46
.equ VICTREEBEL, 0x47
.equ TENTACOOL, 0x48
.equ TENTACRUEL, 0x49
.equ GEODUDE, 0x4A
.equ GRAVELER, 0x4B
.equ GOLEM, 0x4C
.equ PONYTA, 0x4D
.equ RAPIDASH, 0x4E
.equ SLOWPOKE, 0x4F
.equ SLOWBRO, 0x50
.equ MAGNEMITE, 0x51
.equ MAGNETON, 0x52
.equ FARFETCH_D, 0x53
.equ DODUO, 0x54
.equ DODRIO, 0x55
.equ SEEL, 0x56
.equ DEWGONG, 0x57
.equ GRIMER, 0x58
.equ MUK, 0x59
.equ SHELLDER, 0x5A
.equ CLOYSTER, 0x5B
.equ GASTLY, 0x5C
.equ HAUNTER, 0x5D
.equ GENGAR, 0x5E
.equ ONIX, 0x5F
.equ DROWZEE, 0x60
.equ HYPNO, 0x61
.equ KRABBY, 0x62
.equ KINGLER, 0x63
.equ VOLTORB, 0x64
.equ ELECTRODE, 0x65
.equ EXEGGCUTE, 0x66
.equ EXEGGUTOR, 0x67
.equ CUBONE, 0x68
.equ MAROWAK, 0x69
.equ HITMONLEE, 0x6A
.equ HITMONCHAN, 0x6B
.equ LICKITUNG, 0x6C
.equ KOFFING, 0x6D
.equ WEEZING, 0x6E
.equ RHYHORN, 0x6F
.equ RHYDON, 0x70
.equ CHANSEY, 0x71
.equ TANGELA, 0x72
.equ KANGASKHAN, 0x73
.equ HORSEA, 0x74
.equ SEADRA, 0x75
.equ GOLDEEN, 0x76
.equ SEAKING, 0x77
.equ STARYU, 0x78
.equ STARMIE, 0x79
.equ MR_MIME, 0x7A
.equ SCYTHER, 0x7B
.equ JYNX, 0x7C
.equ ELECTABUZZ, 0x7D
.equ MAGMAR, 0x7E
.equ PINSIR, 0x7F
.equ TAUROS, 0x80
.equ MAGIKARP, 0x81
.equ GYARADOS, 0x82
.equ LAPRAS, 0x83
.equ DITTO, 0x84
.equ EEVEE, 0x85
.equ VAPOREON, 0x86
.equ JOLTEON, 0x87
.equ FLAREON, 0x88
.equ PORYGON, 0x89
.equ OMANYTE, 0x8A
.equ OMASTAR, 0x8B
.equ KABUTO, 0x8C
.equ KABUTOPS, 0x8D
.equ AERODACTYL, 0x8E
.equ SNORLAX, 0x8F
.equ ARTICUNO, 0x90
.equ ZAPDOS, 0x91
.equ MOLTRES, 0x92
.equ DRATINI, 0x93
.equ DRAGONAIR, 0x94
.equ DRAGONITE, 0x95
.equ MEWTWO, 0x96
.equ MEW, 0x97
.equ CHIKORITA, 0x98
.equ BAYLEEF, 0x99
.equ MEGANIUM, 0x9A
.equ CYNDAQUIL, 0x9B
.equ QUILAVA, 0x9C
.equ TYPHLOSION, 0x9D
.equ TOTODILE, 0x9E
.equ CROCONAW, 0x9F
.equ FERALIGATR, 0xA0
.equ SENTRET, 0xA1
.equ FURRET, 0xA2
.equ HOOTHOOT, 0xA3
.equ NOCTOWL, 0xA4
.equ LEDYBA, 0xA5
.equ LEDIAN, 0xA6
.equ SPINARAK, 0xA7
.equ ARIADOS, 0xA8
.equ CROBAT, 0xA9
.equ CHINCHOU, 0xAA
.equ LANTURN, 0xAB
.equ PICHU, 0xAC
.equ CLEFFA, 0xAD
.equ IGGLYBUFF, 0xAE
.equ TOGEPI, 0xAF
.equ TOGETIC, 0xB0
.equ NATU, 0xB1
.equ XATU, 0xB2
.equ MAREEP, 0xB3
.equ FLAAFFY, 0xB4
.equ AMPHAROS, 0xB5
.equ BELLOSSOM, 0xB6
.equ MARILL, 0xB7
.equ AZUMARILL, 0xB8
.equ SUDOWOODO, 0xB9
.equ POLITOED, 0xBA
.equ HOPPIP, 0xBB
.equ SKIPLOOM, 0xBC
.equ JUMPLUFF, 0xBD
.equ AIPOM, 0xBE
.equ SUNKERN, 0xBF
.equ SUNFLORA, 0xC0
.equ YANMA, 0xC1
.equ WOOPER, 0xC2
.equ QUAGSIRE, 0xC3
.equ ESPEON, 0xC4
.equ UMBREON, 0xC5
.equ MURKROW, 0xC6
.equ SLOWKING, 0xC7
.equ MISDREAVUS, 0xC8
.equ UNOWN, 0xC9
.equ WOBBUFFET, 0xCA
.equ GIRAFARIG, 0xCB
.equ PINECO, 0xCC
.equ FORRETRESS, 0xCD
.equ DUNSPARCE, 0xCE
.equ GLIGAR, 0xCF
.equ STEELIX, 0xD0
.equ SNUBBULL, 0xD1
.equ GRANBULL, 0xD2
.equ QWILFISH, 0xD3
.equ SCIZOR, 0xD4
.equ SHUCKLE, 0xD5
.equ HERACROSS, 0xD6
.equ SNEASEL, 0xD7
.equ TEDDIURSA, 0xD8
.equ URSARING, 0xD9
.equ SLUGMA, 0xDA
.equ MAGCARGO, 0xDB
.equ SWINUB, 0xDC
.equ PILOSWINE, 0xDD
.equ CORSOLA, 0xDE
.equ REMORAID, 0xDF
.equ OCTILLERY, 0xE0
.equ DELIBIRD, 0xE1
.equ MANTINE, 0xE2
.equ SKARMORY, 0xE3
.equ HOUNDOUR, 0xE4
.equ HOUNDOOM, 0xE5
.equ KINGDRA, 0xE6
.equ PHANPY, 0xE7
.equ DONPHAN, 0xE8
.equ PORYGON2, 0xE9
.equ STANTLER, 0xEA
.equ SMEARGLE, 0xEB
.equ TYROGUE, 0xEC
.equ HITMONTOP, 0xED
.equ SMOOCHUM, 0xEE
.equ ELEKID, 0xEF
.equ MAGBY, 0xF0
.equ MILTANK, 0xF1
.equ BLISSEY, 0xF2
.equ RAIKOU, 0xF3
.equ ENTEI, 0xF4
.equ SUICUNE, 0xF5
.equ LARVITAR, 0xF6
.equ PUPITAR, 0xF7
.equ TYRANITAR, 0xF8
.equ LUGIA, 0xF9
.equ HO_OH, 0xFA
.equ CELEBI, 0xFB
.equ NOPE, 0xFC
.equ NOPE, 0xFD
.equ NOPE, 0xFE
.equ NOPE, 0xFF
.equ NOPE, 0x100
.equ NOPE, 0x101
.equ NOPE, 0x102
.equ NOPE, 0x103
.equ NOPE, 0x104
.equ NOPE, 0x105
.equ NOPE, 0x106
.equ NOPE, 0x107
.equ NOPE, 0x108
.equ NOPE, 0x109
.equ NOPE, 0x10A
.equ NOPE, 0x10B
.equ NOPE, 0x10C
.equ NOPE, 0x10D
.equ NOPE, 0x10E
.equ NOPE, 0x10F
.equ NOPE, 0x110
.equ NOPE, 0x111
.equ NOPE, 0x112
.equ NOPE, 0x113
.equ NOPE, 0x114
.equ TREECKO, 0x115
.equ GROVYLE, 0x116
.equ SCEPTILE, 0x117
.equ TORCHIC, 0x118
.equ COMBUSKEN, 0x119
.equ BLAZIKEN, 0x11A
.equ MUDKIP, 0x11B
.equ MARSHTOMP, 0x11C
.equ SWAMPERT, 0x11D
.equ POOCHYENA, 0x11E
.equ MIGHTYENA, 0x11F
.equ ZIGZAGOON, 0x120
.equ LINOONE, 0x121
.equ WURMPLE, 0x122
.equ SILCOON, 0x123
.equ BEAUTIFLY, 0x124
.equ CASCOON, 0x125
.equ DUSTOX, 0x126
.equ LOTAD, 0x127
.equ LOMBRE, 0x128
.equ LUDICOLO, 0x129
.equ SEEDOT, 0x12A
.equ NUZLEAF, 0x12B
.equ SHIFTRY, 0x12C
.equ NINCADA, 0x12D
.equ NINJASK, 0x12E
.equ SHEDINJA, 0x12F
.equ TAILLOW, 0x130
.equ SWELLOW, 0x131
.equ SHROOMISH, 0x132
.equ BRELOOM, 0x133
.equ SPINDA, 0x134
.equ WINGULL, 0x135
.equ PELIPPER, 0x136
.equ SURSKIT, 0x137
.equ MASQUERAIN, 0x138
.equ WAILMER, 0x139
.equ WAILORD, 0x13A
.equ SKITTY, 0x13B
.equ DELCATTY, 0x13C
.equ KECLEON, 0x13D
.equ BALTOY, 0x13E
.equ CLAYDOL, 0x13F
.equ NOSEPASS, 0x140
.equ TORKOAL, 0x141
.equ SABLEYE, 0x142
.equ BARBOACH, 0x143
.equ WHISCASH, 0x144
.equ LUVDISC, 0x145
.equ CORPHISH, 0x146
.equ CRAWDAUNT, 0x147
.equ FEEBAS, 0x148
.equ MILOTIC, 0x149
.equ CARVANHA, 0x14A
.equ SHARPEDO, 0x14B
.equ TRAPINCH, 0x14C
.equ VIBRAVA, 0x14D
.equ FLYGON, 0x14E
.equ MAKUHITA, 0x14F
.equ HARIYAMA, 0x150
.equ ELECTRIKE, 0x151
.equ MANECTRIC, 0x152
.equ NUMEL, 0x153
.equ CAMERUPT, 0x154
.equ SPHEAL, 0x155
.equ SEALEO, 0x156
.equ WALREIN, 0x157
.equ CACNEA, 0x158
.equ CACTURNE, 0x159
.equ SNORUNT, 0x15A
.equ GLALIE, 0x15B
.equ LUNATONE, 0x15C
.equ SOLROCK, 0x15D
.equ AZURILL, 0x15E
.equ SPOINK, 0x15F
.equ GRUMPIG, 0x160
.equ PLUSLE, 0x161
.equ MINUN, 0x162
.equ MAWILE, 0x163
.equ MEDITITE, 0x164
.equ MEDICHAM, 0x165
.equ SWABLU, 0x166
.equ ALTARIA, 0x167
.equ WYNAUT, 0x168
.equ DUSKULL, 0x169
.equ DUSCLOPS, 0x16A
.equ ROSELIA, 0x16B
.equ SLAKOTH, 0x16C
.equ VIGOROTH, 0x16D
.equ SLAKING, 0x16E
.equ GULPIN, 0x16F
.equ SWALOT, 0x170
.equ TROPIUS, 0x171
.equ WHISMUR, 0x172
.equ LOUDRED, 0x173
.equ EXPLOUD, 0x174
.equ CLAMPERL, 0x175
.equ HUNTAIL, 0x176
.equ GOREBYSS, 0x177
.equ ABSOL, 0x178
.equ SHUPPET, 0x179
.equ BANETTE, 0x17A
.equ SEVIPER, 0x17B
.equ ZANGOOSE, 0x17C
.equ RELICANTH, 0x17D
.equ ARON, 0x17E
.equ LAIRON, 0x17F
.equ AGGRON, 0x180
.equ CASTFORM, 0x181
.equ VOLBEAT, 0x182
.equ ILLUMISE, 0x183
.equ LILEEP, 0x184
.equ CRADILY, 0x185
.equ ANORITH, 0x186
.equ ARMALDO, 0x187
.equ RALTS, 0x188
.equ KIRLIA, 0x189
.equ GARDEVOIR, 0x18A
.equ BAGON, 0x18B
.equ SHELGON, 0x18C
.equ SALAMENCE, 0x18D
.equ BELDUM, 0x18E
.equ METANG, 0x18F
.equ METAGROSS, 0x190
.equ REGIROCK, 0x191
.equ REGICE, 0x192
.equ REGISTEEL, 0x193
.equ KYOGRE, 0x194
.equ GROUDON, 0x195
.equ RAYQUAZA, 0x196
.equ LATIAS, 0x197
.equ LATIOS, 0x198
.equ JIRACHI, 0x199
.equ DEOXYS, 0x19A
.equ CHIMECHO, 0x19B
.equ EGG, 0x19C
.equ UNOWN_B, 0x19D
.equ UNOWN_C, 0x19E
.equ UNOWN_D, 0x19F
.equ UNOWN_E, 0x1A0
.equ UNOWN_F, 0x1A1
.equ UNOWN_G, 0x1A2
.equ UNOWN_H, 0x1A3
.equ UNOWN_I, 0x1A4
.equ UNOWN_J, 0x1A5
.equ UNOWN_K, 0x1A6
.equ UNOWN_L, 0x1A7
.equ UNOWN_M, 0x1A8
.equ UNOWN_N, 0x1A9
.equ UNOWN_O, 0x1AA
.equ UNOWN_P, 0x1AB
.equ UNOWN_Q, 0x1AC
.equ UNOWN_R, 0x1AD
.equ UNOWN_S, 0x1AE
.equ UNOWN_T, 0x1AF
.equ UNOWN_U, 0x1B0
.equ UNOWN_V, 0x1B1
.equ UNOWN_W, 0x1B2
.equ UNOWN_X, 0x1B3
.equ UNOWN_Y, 0x1B4
.equ UNOWN_Z, 0x1B5
.equ UNOWN_EXCLAMATION, 0x1B6
.equ UNOWN_QUESTION, 0x1B7
.equ TURTWIG, 0x1B8
.equ GROTLE, 0x1B9
.equ TORTERRA, 0x1BA
.equ CHIMCHAR, 0x1BB
.equ MONFERNO, 0x1BC
.equ INFERNAPE, 0x1BD
.equ PIPLUP, 0x1BE
.equ PRINPLUP, 0x1BF
.equ EMPOLEON, 0x1C0
.equ STARLY, 0x1C1
.equ STARAVIA, 0x1C2
.equ STARAPTOR, 0x1C3
.equ BIDOOF, 0x1C4
.equ BIBAREL, 0x1C5
.equ KRICKETOT, 0x1C6
.equ KRICKETUNE, 0x1C7
.equ SHINX, 0x1C8
.equ LUXIO, 0x1C9
.equ LUXRAY, 0x1CA
.equ BUDEW, 0x1CB
.equ ROSERADE, 0x1CC
.equ CRANIDOS, 0x1CD
.equ RAMPARDOS, 0x1CE
.equ SHIELDON, 0x1CF
.equ BASTIODON, 0x1D0
.equ BURMY, 0x1D1
.equ WORMADAM, 0x1D2
.equ MOTHIM, 0x1D3
.equ COMBEE, 0x1D4
.equ VESPIQUEN, 0x1D5
.equ PACHIRISU, 0x1D6
.equ BUIZEL, 0x1D7
.equ FLOATZEL, 0x1D8
.equ CHERUBI, 0x1D9
.equ CHERRIM, 0x1DA
.equ SHELLOS, 0x1DB
.equ GASTRODON, 0x1DC
.equ AMBIPOM, 0x1DD
.equ DRIFLOON, 0x1DE
.equ DRIFBLIM, 0x1DF
.equ BUNEARY, 0x1E0
.equ LOPUNNY, 0x1E1
.equ MISMAGIUS, 0x1E2
.equ HONCHKROW, 0x1E3
.equ GLAMEOW, 0x1E4
.equ PURUGLY, 0x1E5
.equ CHINGLING, 0x1E6
.equ STUNKY, 0x1E7
.equ SKUNTANK, 0x1E8
.equ BRONZOR, 0x1E9
.equ BRONZONG, 0x1EA
.equ BONSLY, 0x1EB
.equ MIME_JR, 0x1EC
.equ HAPPINY, 0x1ED
.equ CHATOT, 0x1EE
.equ SPIRITOMB, 0x1EF
.equ GIBLE, 0x1F0
.equ GABITE, 0x1F1
.equ GARCHOMP, 0x1F2
.equ MUNCHLAX, 0x1F3
.equ RIOLU, 0x1F4
.equ LUCARIO, 0x1F5
.equ HIPPOPOTAS, 0x1F6
.equ HIPPOWDON, 0x1F7
.equ SKORUPI, 0x1F8
.equ DRAPION, 0x1F9
.equ CROAGUNK, 0x1FA
.equ TOXICROAK, 0x1FB
.equ CARNIVINE, 0x1FC
.equ FINNEON, 0x1FD
.equ LUMINEON, 0x1FE
.equ MANTYKE, 0x1FF
.equ SNOVER, 0x200
.equ ABOMASNOW, 0x201
.equ WEAVILE, 0x202
.equ MAGNEZONE, 0x203
.equ LICKILICKY, 0x204
.equ RHYPERIOR, 0x205
.equ TANGROWTH, 0x206
.equ ELECTIVIRE, 0x207
.equ MAGMORTAR, 0x208
.equ TOGEKISS, 0x209
.equ YANMEGA, 0x20A
.equ LEAFEON, 0x20B
.equ GLACEON, 0x20C
.equ GLISCOR, 0x20D
.equ MAMOSWINE, 0x20E
.equ PORYGON_Z, 0x20F
.equ GALLADE, 0x210
.equ PROBOPASS, 0x211
.equ DUSKNOIR, 0x212
.equ FROSLASS, 0x213
.equ ROTOM, 0x214
.equ UXIE, 0x215
.equ MESPRIT, 0x216
.equ AZELF, 0x217
.equ DIALGA, 0x218
.equ PALKIA, 0x219
.equ HEATRAN, 0x21A
.equ REGIGIGAS, 0x21B
.equ GIRATINA, 0x21C
.equ CRESSELIA, 0x21D
.equ PHIONE, 0x21E
.equ MANAPHY, 0x21F
.equ DARKRAI, 0x220
.equ SHAYMIN, 0x221
.equ ARCEUS, 0x222
.equ BURMY_SAND, 0x223
.equ BURMY_TRASH, 0x224
.equ WORMADAM_SAND, 0x225
.equ WORMADAM_THRASH, 0x226
.equ SHELLOS_EAST, 0x227
.equ GASTRODON_EAST, 0x228
.equ ROTOM_HEAT, 0x229
.equ ROTOM_WASH, 0x22A
.equ ROTOM_FROST, 0x22B
.equ ROTOM_FAN, 0x22C
.equ ROTOM_MOW, 0x22D
.equ GIRATINA_ORIGIN, 0x22E
.equ SHAYMIN_SKY, 0x22F
.equ ARCEUS_FIGHT, 0x230
.equ ARCEUS_FLYING, 0x231
.equ ARCEUS_POISON, 0x232
.equ ARCEUS_GROUND, 0x233
.equ ARCEUS_ROCK, 0x234
.equ ARCEUS_BUG, 0x235
.equ ARCEUS_GHOST, 0x236
.equ ARCEUS_STEEL, 0x237
.equ ARCEUS_UNKNOWN, 0x238
.equ ARCEUS_FIRE, 0x239
.equ ARCEUS_WATER, 0x23A
.equ ARCEUS_GRASS, 0x23B
.equ ARCEUS_ELECTRIC, 0x23C
.equ ARCEUS_PSYCHIC, 0x23D
.equ ARCEUS_ICE, 0x23E
.equ ARCEUS_DRAGON, 0x23F
.equ ARCEUS_DARK, 0x240
.equ ARCEUS_FAIRY, 0x241
.equ VICTINI, 0x242
.equ SNIVY, 0x243
.equ SERVINE, 0x244
.equ SERPERIOR, 0x245
.equ TEPIG, 0x246
.equ PIGNITE, 0x247
.equ EMBOAR, 0x248
.equ OSHAWOTT, 0x249
.equ DEWOTT, 0x24A
.equ SAMUROTT, 0x24B
.equ PATRAT, 0x24C
.equ WATCHOG, 0x24D
.equ LILLIPUP, 0x24E
.equ HERDIER, 0x24F
.equ STOUTLAND, 0x250
.equ PURRLOIN, 0x251
.equ LIEPARD, 0x252
.equ PANSAGE, 0x253
.equ SIMISAGE, 0x254
.equ PANSEAR, 0x255
.equ SIMISEAR, 0x256
.equ PANPOUR, 0x257
.equ SIMIPOUR, 0x258
.equ MUNNA, 0x259
.equ MUSHARNA, 0x25A
.equ PIDOVE, 0x25B
.equ TRANQUILL, 0x25C
.equ UNFEZANT, 0x25D
.equ BLITZLE, 0x25E
.equ ZEBSTRIKA, 0x25F
.equ ROGGENROLA, 0x260
.equ BOLDORE, 0x261
.equ GIGALITH, 0x262
.equ WOOBAT, 0x263
.equ SWOOBAT, 0x264
.equ DRILBUR, 0x265
.equ EXCADRILL, 0x266
.equ AUDINO, 0x267
.equ TIMBURR, 0x268
.equ GURDURR, 0x269
.equ CONKELDURR, 0x26A
.equ TYMPOLE, 0x26B
.equ PALPITOAD, 0x26C
.equ SEISMITOAD, 0x26D
.equ THROH, 0x26E
.equ SAWK, 0x26F
.equ SEWADDLE, 0x270
.equ SWADLOON, 0x271
.equ LEAVANNY, 0x272
.equ VENIPEDE, 0x273
.equ WHIRLIPEDE, 0x274
.equ SCOLIPEDE, 0x275
.equ COTTONEE, 0x276
.equ WHIMSICOTT, 0x277
.equ PETILIL, 0x278
.equ LILLIGANT, 0x279
.equ BASCULIN, 0x27A
.equ SANDILE, 0x27B
.equ KROKOROK, 0x27C
.equ KROOKODILE, 0x27D
.equ DARUMAKA, 0x27E
.equ DARMANITAN, 0x27F
.equ MARACTUS, 0x280
.equ DWEBBLE, 0x281
.equ CRUSTLE, 0x282
.equ SCRAGGY, 0x283
.equ SCRAFTY, 0x284
.equ SIGILYPH, 0x285
.equ YAMASK, 0x286
.equ COHAGRIGUS, 0x287
.equ TIRTOUGA, 0x288
.equ CARRACOSTA, 0x289
.equ ARCHEN, 0x28A
.equ ARCHEOPS, 0x28B
.equ TRUBBISH, 0x28C
.equ GARBODOR, 0x28D
.equ ZORUA, 0x28E
.equ ZOROARK, 0x28F
.equ MINCCINO, 0x290
.equ CINCCINO, 0x291
.equ GOTHITA, 0x292
.equ GOTHORITA, 0x293
.equ GOTHITELLE, 0x294
.equ SOLOSIS, 0x295
.equ DUOSION, 0x296
.equ REUNICLUS, 0x297
.equ DUCKLETT, 0x298
.equ SWANNA, 0x299
.equ VANILLITE, 0x29A
.equ VANILLISH, 0x29B
.equ VANILLUXE, 0x29C
.equ DEERLING, 0x29D
.equ SAWSBUCK, 0x29E
.equ EMOLGA, 0x29F
.equ KARRABLAST, 0x2A0
.equ ESCAVALIER, 0x2A1
.equ FOONGUS, 0x2A2
.equ AMOONGUSS, 0x2A3
.equ FRILLISH, 0x2A4
.equ JELLICENT, 0x2A5
.equ ALOMOMOLA, 0x2A6
.equ JOLTIK, 0x2A7
.equ GALVANTULA, 0x2A8
.equ FERROSEED, 0x2A9
.equ FERROTHORN, 0x2AA
.equ KLINK, 0x2AB
.equ KLANG, 0x2AC
.equ KLINKLANG, 0x2AD
.equ TYNAMO, 0x2AE
.equ EELEKTRIK, 0x2AF
.equ EELEKTROSS, 0x2B0
.equ ELGYEM, 0x2B1
.equ BEHEEYEM, 0x2B2
.equ LITWICK, 0x2B3
.equ LAMPENT, 0x2B4
.equ CHANDELURE, 0x2B5
.equ AXEW, 0x2B6
.equ FRAXURE, 0x2B7
.equ HAXORUS, 0x2B8
.equ CUBCHOO, 0x2B9
.equ BEARTIC, 0x2BA
.equ CRYOGONAL, 0x2BB
.equ SHELMET, 0x2BC
.equ ACCELGOR, 0x2BD
.equ STUNFISK, 0x2BE
.equ MIENFOO, 0x2BF
.equ MIENSHAO, 0x2C0
.equ DRUDDIGON, 0x2C1
.equ GOLETT, 0x2C2
.equ GOLURK, 0x2C3
.equ PAWNIARD, 0x2C4
.equ BISHARP, 0x2C5
.equ BOUFFALANT, 0x2C6
.equ RUFFLET, 0x2C7
.equ BRAVIARY, 0x2C8
.equ VULLABY, 0x2C9
.equ MANDIBUZZ, 0x2CA
.equ HEATMOR, 0x2CB
.equ DURANT, 0x2CC
.equ DEINO, 0x2CD
.equ ZWEILOUS, 0x2CE
.equ HYDREIGON, 0x2CF
.equ LARVESTA, 0x2D0
.equ VOLCARONA, 0x2D1
.equ COBALION, 0x2D2
.equ TERRAKION, 0x2D3
.equ VIRIZION, 0x2D4
.equ TORNADUS, 0x2D5
.equ THUNDURUS, 0x2D6
.equ RESHIRAM, 0x2D7
.equ ZEKROM, 0x2D8
.equ LANDORUS, 0x2D9
.equ KYUREM, 0x2DA
.equ KELDEO, 0x2DB
.equ MELOETTA, 0x2DC
.equ GENESECT, 0x2DD
.equ BASCULIN_BLUE, 0x2DE
.equ DARMANITAN_ZEN, 0x2DF
.equ DEERLING_SUMMER, 0x2E0
.equ DEERLING_AUTUMN, 0x2E1
.equ DEERLING_WINTER, 0x2E2
.equ SAWSBUCK_SUMMER, 0x2E3
.equ SAWSBUCK_AUTUMN, 0x2E4
.equ SAWSBUCK_WINTER, 0x2E5
.equ KYUREM_WHITE, 0x2E6
.equ KYUREM_BLACK, 0x2E7
.equ MELOETTA_PIROUETTE, 0x2E8
.equ GENESECT_SHOCK, 0x2E9
.equ GENESECT_BURN, 0x2EA
.equ GENESECT_CHILL, 0x2EB
.equ GENESECT_DOUSE, 0x2EC
.equ TORNADUS_THERIAN, 0x2ED
.equ THUNDURUS_THERIAN, 0x2EE
.equ LANDORUS_THERIAN, 0x2EF
.equ KELDEO_RESOLUTE, 0x2F0
.equ CHESPIN, 0x2F1
.equ QUILLADIN, 0x2F2
.equ CHESNAUGHT, 0x2F3
.equ FENNEKIN, 0x2F4
.equ BRAIXEN, 0x2F5
.equ DELPHOX, 0x2F6
.equ FROAKIE, 0x2F7
.equ FROGADIER, 0x2F8
.equ GRENINJA, 0x2F9
.equ BUNNELBY, 0x2FA
.equ DIGGERSBY, 0x2FB
.equ FLETCHLING, 0x2FC
.equ FLETCHINDER, 0x2FD
.equ TALONFLAME, 0x2FE
.equ SCATTERBUG, 0x2FF
.equ SPEWPA, 0x300
.equ VIVILLON, 0x301
.equ LITLEO, 0x302
.equ PYROAR, 0x303
.equ FLABEBE, 0x304
.equ FLOETTE, 0x305
.equ FLORGES, 0x306
.equ SKIDDO, 0x307
.equ GOGOAT, 0x308
.equ PANCHAM, 0x309
.equ PANGORO, 0x30A
.equ FURFROU, 0x30B
.equ ESPURR, 0x30C
.equ MEOWSTIC, 0x30D
.equ HONEDGE, 0x30E
.equ DOUBLADE, 0x30F
.equ AEGISLASH, 0x310
.equ SPRITZEE, 0x311
.equ AROMATISSE, 0x312
.equ SWIRLIX, 0x313
.equ SLURPUFF, 0x314
.equ INKAY, 0x315
.equ MALAMAR, 0x316
.equ BINACLE, 0x317
.equ BARBARACLE, 0x318
.equ SKRELP, 0x319
.equ DRAGALGE, 0x31A
.equ CLAUNCHER, 0x31B
.equ CLAWITZER, 0x31C
.equ HELIOPTILE, 0x31D
.equ HELIOLISK, 0x31E
.equ TYRUNT, 0x31F
.equ TYRANTRUM, 0x320
.equ AMAURA, 0x321
.equ AURORUS, 0x322
.equ SYLVEON, 0x323
.equ HAWLUCHA, 0x324
.equ DEDENNE, 0x325
.equ CARBINK, 0x326
.equ GOOMY, 0x327
.equ SLIGGOO, 0x328
.equ GOODRA, 0x329
.equ KLEFKI, 0x32A
.equ PHANTUMP, 0x32B
.equ TREVENANT, 0x32C
.equ PUMPKABOO, 0x32D
.equ GOURGEIST, 0x32E
.equ BERGMITE, 0x32F
.equ AVALUGG, 0x330
.equ NOIBAT, 0x331
.equ NOIVERN, 0x332
.equ XERNEAS, 0x333
.equ YVELTAL, 0x334
.equ ZYGARDE, 0x335
.equ DIANCIE, 0x336
.equ HOOPA, 0x337
.equ VOLCANION, 0x338
.equ PYROAR_FEMALE, 0x339
.equ FLABEBE_WHITE, 0x33A
.equ FLABEBE_YELLOW, 0x33B
.equ FLABEBE_ORANGE, 0x33C
.equ FLABEBE_BLUE, 0x33D
.equ FLOETTE_WHITE, 0x33E
.equ FLOETTE_YELLOW, 0x33F
.equ FLOETTE_ORANGE, 0x340
.equ FLOETTE_BLUE, 0x341
.equ FLORGES_WHITE, 0x342
.equ FLORGES_YELLOW, 0x343
.equ FLORGES_ORANGE, 0x344
.equ FLORGES_BLUE, 0x345
.equ MEOWSTIC_FEMALE, 0x346
.equ AEGISLASH_BLADE, 0x347
.equ PUMPKABOO_2, 0x348
.equ PUMPKABOO_3, 0x349
.equ PUMPKABOO_4, 0x34A
.equ GOURGEIST_2, 0x34B
.equ GOURGEIST_3, 0x34C
.equ GOURGEIST_4, 0x34D
.equ HOOPA_UNBOUND, 0x34E
.equ VENUSAUR_MEGA, 0x34F
.equ CHARIZARD_MEGAX, 0x350
.equ CHARIZARD_MEGAY, 0x351
.equ BLASTOISE_MEGA, 0x352
.equ BEEDRILL_MEGA, 0x353
.equ PIDGEOT_MEGA, 0x354
.equ ALAKAZAM_MEGA, 0x355
.equ SLOWBRO_MEGA, 0x356
.equ GENGAR_MEGA, 0x357
.equ KANGASKHAN_MEGA, 0x358
.equ PINSIR_MEGA, 0x359
.equ GYARADOS_MEGA, 0x35A
.equ AERODACTYL_MEGA, 0x35B
.equ MEWTWO_MEGAX, 0x35C
.equ MEWTWO_MEGAY, 0x35D
.equ AMPHAROS_MEGA, 0x35E
.equ STEELIX_MEGA, 0x35F
.equ SCIZOR_MEGA, 0x360
.equ HERACROSS_MEGA, 0x361
.equ HOUNDOOM_MEGA, 0x362
.equ TYRANITAR_MEGA, 0x363
.equ SCEPTILE_MEGA, 0x364
.equ BLAZIKEN_MEGA, 0x365
.equ SWAMPERT_MEGA, 0x366
.equ GARDEVOIR_MEGA, 0x367
.equ SABLEYE_MEGA, 0x368
.equ MAWILE_MEGA, 0x369
.equ AGGRON_MEGA, 0x36A
.equ MEDICHAM_MEGA, 0x36B
.equ MANECTRIC_MEGA, 0x36C
.equ SHARPEDO_MEGA, 0x36D
.equ CAMERUPT_MEGA, 0x36E
.equ ALTARIA_MEGA, 0x36F
.equ BANETTE_MEGA, 0x370
.equ ABSOL_MEGA, 0x371
.equ GLALIE_MEGA, 0x372
.equ SALAMENCE_MEGA, 0x373
.equ METAGROSS_MEGA, 0x374
.equ NOPE, 0x375 @Dunno why but maybe a new Latias out from the Soul Dew routine
.equ NOPE, 0x376 @Dunno why but maybe a new Latios out from the Soul Dew routine
.equ LATIAS_MEGA, 0x377
.equ LATIOS_MEGA, 0x378
.equ RAYQUAZA_MEGA, 0x379
.equ LOPUNNY_MEGA, 0x37A
.equ GARCHOMP_MEGA, 0x37B
.equ LUCARIO_MEGA, 0x37C
.equ ABOMASNOW_MEGA, 0x37D
.equ GALLADE_MEGA, 0x37E
.equ AUDINO_MEGA, 0x37F
.equ DIANCIE_MEGA, 0x380
.equ DEOXYS_NORMAL, 0x381 @Renewal of Deoxys' index
.equ DEOXYS_ATTACK, 0x382 @Renewal of Deoxys' index
.equ DEOXYS_DEFENSE, 0x383 @Renewal of Deoxys' index
.equ DEXOYS_SPEED, 0x384 @Renewal of Deoxys' index
.equ NOPE, 0x385 @Generation VII Pokemon starts here

.org 0x43F90, 0xFF
ldr r1, Hook3
bx r1
.align 2
Hook3: .word RomAreaOffset+dex_seeable_mon_hook+1

.org 0x88EDC, 0xFF
ldr r1, Hook6
bx r1
.align 2
Hook6: .word RomAreaOffset+dex_regional_count_hook+1

.org 0xCE91A, 0xFF
ldr r1, Hook4
bx r1
.align 2
Hook4: .word RomAreaOffset+dex_evolution_fix_hook+1

.org 0x10352C, 0xFF
ldr r1, Hook7
bx r1
.align 2
Hook7: .word RomAreaOffset+dex_display_hook+1

.org 0x10356C, 0xFF
ldr r0, Hook8
bx r0
.align 2
Hook8: .word RomAreaOffset+regional_dex_hook+1

.org 0x1035B4, 0xFF
ldr r1, Hook9
bx r1
.align 2
Hook9: .word RomAreaOffset+store_last_dex_seen_hook+1

.org 0x1035F4, 0xFF
ldr r0, HookA
bx r0
.align 2
HookA: .word RomAreaOffset+lazy_regional_dex_end_hook+1

.org 0x104A66, 0xFF
ldr r1, HookB
bx r1
.align 2
HookB: .word RomAreaOffset+display_regional_num_hook+1

.org 0x104BBC, 0xFF
ldr r2, Hook5
bx r2
.align 2
Hook5: .word RomAreaOffset+dex_display_counts_hook+1

.org 0x106810, 0xFF
ldr r1, Hook2
bx r1
.align 2
Hook2: .word RomAreaOffset+habitat_dex_regional_limit_hook+1

.org 0x106B84, 0xFF
ldr r1, Hook1
bx r1
.align 2
Hook1: .word RomAreaOffset+data_on_capture_hook+1

.org MyLoc, 0xFF
data_on_capture_hook:	@0x08106B84 via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0
	bne capture_display_return
	ldr r0, add_task_no_capture_display
	bx r0

capture_display_return:
	ldr r0, add_task_capture_display
	bx r0


.align 2
.pool

.align 2


habitat_dex_regional_limit_hook:	@0x08106810 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x1
	beq habitat_dex_regional_limit_return	@valid
	mov r0, r4
	bl species_to_regional_dex_number
	cmp r0, #0x0
	beq habitat_dex_regional_limit_return	@not in regional dex, return 0
	mov r0, #0x1

habitat_dex_regional_limit_return:
	pop {r4}
	pop {r1}
	bx r1


.align 2
.pool

.align 2


dex_seeable_mon_hook:	@0x08043F90 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq only_regional_numbered
@national
	mov r0, r4
	bl species_to_national_dex_number_1
	b dex_seeable_mon_check_valid_species

only_regional_numbered:
	mov r0, r4
	bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
	cmp r0, #0x0
	bne dex_seeable_mon_return
	ldr r0, full_halfword

dex_seeable_mon_return:
	pop {r4}
	pop {r1}
	bx r1
.align
full_halfword:	.word 0xFFFF


.align 2
.pool

.align 2


dex_evolution_fix_hook:	@0x080CE91A via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0	@not in regional dex, invalid
	beq dex_evolution_failure
	ldr r0, dex_evolution_success_return
	bx r0

dex_evolution_failure:
	mov r0, #0x11
	strh r0, [r5, #0x8]
	mov r2, #0x1
	ldr r1, dex_evolution_failure_return
	bx r1


.align 2
.pool

.align 2


dex_display_counts_hook:	@0x08104BBC via r2
	@r0: mode
	push {lr}
	cmp r1, #0x0
	beq call_regional_count
	bl national_pokedex_count
	b dex_display_counts_return

call_regional_count:
	bl dex_regional_count_hook

dex_display_counts_return:
	pop {pc}


.align 2
.pool

.align 2


dex_regional_count_hook:	@0x08088EDC via r1
	push {r4-r6, lr}
	mov r6, r0	@mode
	mov r4, #0x1	@loop
	mov r5, #0x0	@counter

dex_regional_count_loop:
	lsl r0, r4, #0x1	@loop times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]	@req species
	mov r1, r6	@mode
	mov r2, #0x1	@input is SPECIES
	bl dex_flag_check
	add r5, r5, r0
	add r4, #0x1
	ldr r0, regional_dex_limit
	cmp r4, r0
	blo dex_regional_count_loop
	mov r0, r5
	pop {r4-r6, pc}


.align 2
.pool

.align 2


dex_display_hook:	@0x0810352C via r1
	ldr r1, regional_dex_limit
	cmp r0, #0x0
	beq store_dex_limit_and_return
	ldr r1, national_dex_limit

store_dex_limit_and_return:
	str r1, [sp, #0x0]
	ldr r0, regional_dex_limit_return
	bx r0


.align 2
.pool

.align 2


regional_dex_hook:	@0x0810356C via r0
	mov r4, r8
	add r4, #0x1
	lsl r0, r4, #0x1	@index times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]
	bl species_to_national_dex_number_1
	mov r5, r0
	mov r1, #0x0
	ldr r2, regional_dex_hook_return
	bx r2


.align 2
.pool

.align 2


store_last_dex_seen_hook:	@0x081035B4 via r1
	str r0, [r2]
	mov r10, r4
	mov r4, r3
	ldr r0, def_store_string_dex_number
	bx r0


.align 2
.pool

.align 2


lazy_regional_dex_end_hook:	@0x081035F4 via r0
	mov r0, r8
	ldr r1, regional_dex_limit
	cmp r0, r1
	blo regional_dex_hook
	ldr r0, end_dex_display_return
	bx r0


.align 2
.pool

.align 2


display_regional_num_hook:	@0x08104A66 via r1
	mov r5, r0	@save species
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq use_regional_dex_ordering
	ldr r1, dex_malloc_ptr
	ldr r1, [r1]
	add r1, #0x42
	ldrb r1, [r1]
	cmp r1, #0x0	@check if looking at regional dex
	beq use_regional_dex_ordering
	mov r0, r5
	bl species_to_national_dex_number_1
	b display_dex_number_return

use_regional_dex_ordering:
	mov r0, r5
	bl species_to_regional_dex_number	

display_dex_number_return:
	mov r5, r0
	ldr r0, dex_number_display_return
	bx r0





species_to_regional_dex_number:
	adr r3, regional_dex_order
	mov r2, r0	@req species
	mov r0, #0x0	@loop counter
find_regional_number_loop:
	lsl r1, r0, #0x1
	ldrh r1, [r3, r1]
	cmp r1, r2
	beq species_to_regional_dex_return
	add r0, #0x1
	ldr r1, regional_dex_limit
	cmp r0, r1
	bls find_regional_number_loop
	mov r0, #0x0	@not in dex: set number to 0
species_to_regional_dex_return:
	bx lr



species_to_national_dex_number_1:
	ldr r1, f_species_to_nat_dex
	bx r1
.align
f_species_to_nat_dex:	.word 0x08043298 + 1

haz_national_dex_bool:
	ldr r0, f_haz_national_check
	bx r0
.align
f_haz_national_check:	.word 0x0806E25C + 1

dex_flag_check:
	ldr r3, f_dex_flag_check
	bx r3
.align
f_dex_flag_check:	.word 0x08104AB0 + 1

national_pokedex_count:
	ldr r1, f_national_pokedex_count
	bx r1
.align
f_national_pokedex_count:	.word 0x08088E8C + 1



.align
add_task_no_capture_display:	.word 0x08106B90 + 1
add_task_capture_display:	.word 0x08106BA4 + 1
dex_evolution_success_return:	.word 0x080CE948 + 1
dex_evolution_failure_return:	.word 0x080CE924 + 1
regional_dex_limit:	.word number_of_mons_in_regional_dex
national_dex_limit:	.word number_of_mons_in_national_dex
regional_dex_limit_return:	.word 0x0810353a + 1
regional_dex_hook_return:	.word 0x08103578 + 1
def_store_string_dex_number:	.word 0x081035D6 + 1
end_dex_display_return:	.word 0x08103906 + 1
dex_malloc_ptr:			.word 0x0203ACF0
dex_number_display_return:	.word 0x08104A70 + 1

regional_dex_order:
.hword	0x0000
.hword	TREECKO
.hword	GROVYLE
.hword	SCEPTILE
.hword	TORCHIC
.hword	COMBUSKEN
.hword	BLAZIKEN
.hword	MUDKIP
.hword	MARSHTOMP
.hword	SWAMPERT
.hword	POOCHYENA
.hword	MIGHTYENA
.hword	ZIGZAGOON
.hword	LINOONE
.hword	WURMPLE
.hword	SILCOON
.hword	BEAUTIFLY
.hword	CASCOON
.hword	DUSTOX
.hword	LOTAD
.hword	LOMBRE
.hword	LUDICOLO
.hword	SEEDOT
.hword	NUZLEAF
.hword	SHIFTRY
.hword	TAILLOW
.hword	SWELLOW
.hword	WINGULL
.hword	PELIPPER
.hword	RALTS
.hword	KIRLIA
.hword	GARDEVOIR
.hword	SURSKIT
.hword	MASQUERAIN
.hword	SHROOMISH
.hword	BRELOOM
.hword	SLAKOTH
.hword	VIGOROTH
.hword	SLAKING
.hword	ABRA
.hword	KADABRA
.hword	ALAKAZAM
.hword	NINCADA
.hword	NINJASK
.hword	SHEDINJA
.hword	WHISMUR
.hword	LOUDRED
.hword	EXPLOUD
.hword	MAKUHITA
.hword	HARIYAMA
.hword	GOLDEEN
.hword	SEAKING
.hword	MAGIKARP
.hword	GYARADOS
.hword	AZURILL
.hword	MARILL
.hword	AZUMARILL
.hword	GEODUDE
.hword	GRAVELER
.hword	GOLEM
.hword	NOSEPASS
.hword	SKITTY
.hword	DELCATTY
.hword	ZUBAT
.hword	GOLBAT
.hword	CROBAT
.hword	TENTACOOL
.hword	TENTACRUEL
.hword	SABLEYE
.hword	MAWILE
.hword	ARON
.hword	LAIRON
.hword	AGGRON
.hword	MACHOP
.hword	MACHOKE
.hword	MACHAMP
.hword	MEDITITE
.hword	MEDICHAM
.hword	ELECTRIKE
.hword	MANECTRIC
.hword	PLUSLE
.hword	MINUN
.hword	MAGNEMITE
.hword	MAGNETON
.hword	VOLTORB
.hword	ELECTRODE
.hword	VOLBEAT
.hword	ILLUMISE
.hword	ODDISH
.hword	GLOOM
.hword	VILEPLUME
.hword	BELLOSSOM
.hword	DODUO
.hword	DODRIO
.hword	ROSELIA
.hword	GULPIN
.hword	SWALOT
.hword	CARVANHA
.hword	SHARPEDO
.hword	WAILMER
.hword	WAILORD
.hword	NUMEL
.hword	CAMERUPT
.hword	SLUGMA
.hword	MAGCARGO
.hword	TORKOAL
.hword	GRIMER
.hword	MUK
.hword	KOFFING
.hword	WEEZING
.hword	SPOINK
.hword	GRUMPIG
.hword	SANDSHREW
.hword	SANDSLASH
.hword	SPINDA
.hword	SKARMORY
.hword	TRAPINCH
.hword	VIBRAVA
.hword	FLYGON
.hword	CACNEA
.hword	CACTURNE
.hword	SWABLU
.hword	ALTARIA
.hword	ZANGOOSE
.hword	SEVIPER
.hword	LUNATONE
.hword	SOLROCK
.hword	BARBOACH
.hword	WHISCASH
.hword	CORPHISH
.hword	CRAWDAUNT
.hword	BALTOY
.hword	CLAYDOL
.hword	LILEEP
.hword	CRADILY
.hword	ANORITH
.hword	ARMALDO
.hword	IGGLYBUFF
.hword	JIGGLYPUFF
.hword	WIGGLYTUFF
.hword	FEEBAS
.hword	MILOTIC
.hword	CASTFORM
.hword	STARYU
.hword	STARMIE
.hword	KECLEON
.hword	SHUPPET
.hword	BANETTE
.hword	DUSKULL
.hword	DUSCLOPS
.hword	TROPIUS
.hword	CHIMECHO
.hword	ABSOL
.hword	VULPIX
.hword	NINETALES
.hword	PICHU
.hword	PIKACHU
.hword	RAICHU
.hword	PSYDUCK
.hword	GOLDUCK
.hword	WYNAUT
.hword	WOBBUFFET
.hword	NATU
.hword	XATU
.hword	GIRAFARIG
.hword	PHANPY
.hword	DONPHAN
.hword	PINSIR
.hword	HERACROSS
.hword	RHYHORN
.hword	RHYDON
.hword	SNORUNT
.hword	GLALIE
.hword	SPHEAL
.hword	SEALEO
.hword	WALREIN
.hword	CLAMPERL
.hword	HUNTAIL
.hword	GOREBYSS
.hword	RELICANTH
.hword	CORSOLA
.hword	CHINCHOU
.hword	LANTURN
.hword	LUVDISC
.hword	HORSEA
.hword	SEADRA
.hword	KINGDRA
.hword	BAGON
.hword	SHELGON
.hword	SALAMENCE
.hword	BELDUM
.hword	METANG
.hword	METAGROSS
.hword	REGIROCK
.hword	REGICE
.hword	REGISTEEL
.hword	LATIAS
.hword	LATIOS
.hword	KYOGRE
.hword	GROUDON
.hword	RAYQUAZA
.hword	JIRACHI
.hword	DEOXYS
__________________
Reply With Quote
  #1298   Link to this post, but load the entire thread.  
Old January 14th, 2018 (4:50 PM). Edited June 5th, 2018 by Spherical Ice.
Spherical Ice's Avatar
Spherical Ice Spherical Ice is offline
 
Join Date: Nov 2007
Location: Leicester, UK
Age: 25
Posts: 5,251

Deposit entire team but one



Just going to publish this combination of two routines and a script excerpt that you can use to let the player select one Pokémon from their team, and then deposit the rest of their team.

Spoiler: Script
Code:
...
countpokemon
callasm ROUTINE_ONE+1
compare LASTRESULT 0x1
if B_<> goto @snippet1
msgbox @string1 MSG_NORMAL
call @snippet2
callasm ROUTINE_TWO+1
textcolor 0x2 // black
bufferpartypokemon 0x0 0x0
bufferboxname 0x1 0x4035
checkflag 0x834
if 0x1 goto @snippet3
msgbox @string2 MSG_NORMAL
goto @snippet4

//---------------
#org @snippet1
msgbox @string3 MSG_NORMAL
release
end

//---------------
#org @snippet2
special 0x9F
waitstate
special2 LASTRESULT 0x147
compare LASTRESULT 0x19C
if 0x1 goto @egg
compare 0x8004 0x5
if 0x2 goto @exited_out
return

//---------------
#org @snippet3
msgbox @string4 MSG_NORMAL
goto @snippet4

//---------------
#org @snippet4
...

//---------
// Strings
//---------
#org @string1
= You are only allowed to bring one\nPOKéMON.\pPlease select which one you would\nlike to bring.

#org @string2
= [buffer1] will join you.\pThe rest of your team was\ntransferred to SOMEONE's PC.\pThey were placed starting\nin BOX ["][buffer2]."

#org @string3
= You are only allowed to bring one\nPOKéMON.\pNormally, we would offer to deposit\nthe rest of your team into a BOX.\pHowever, it seems like all of your\nBOXES are full.\pPlease make room and return later.

#org @string4
= [buffer1] will join you.\pThe rest of your team was\ntransferred to BILL's PC.\pThey were placed starting\nin BOX ["][buffer2]."


Spoiler: ROUTINE_ONE
Code:
.thumb

@ This routine loops through the player's boxes to make sure there is room in a given box to deposit the entire team

main:
    push {r4-r7, lr}
    ldr r0, =(0x020370D0) @ var_800D
    ldrh r0, [r0]
    sub r0, #2 @ party size - 1
    mov r4, r0
    mov r5, #0
    
box_loop:
    mov r6, #0 @ box_id
    mov r7, #0 @ pos_in_box
    
pokemon_in_box_loop:
    mov r0, r6
    mov r1, r7
    ldr r3, =(0x0808BD30+1) @ pokemon_by_box_and_position
    bl call_via_r3
    mov r1, #0xB @ req_species
    ldr r3, =(0x0803FD44+1) @ pokemon_getattr_encrypted
    bl call_via_r3
    cmp r0, #0
    beq empty_space_found

next_loop:
    add r7, #1
    cmp r7, #30
    bls pokemon_in_box_loop

completed_current_box:
    add r6, #1
    cmp r6, #14
    bge not_enough_space
    mov r7, #0
    b pokemon_in_box_loop

empty_space_found:
    add r5, #1
    cmp r5, r4
    bls next_loop

enough_space:
    mov r0, #1
    b end
    
not_enough_space:
    mov r0, #0
    
end:
    ldr r1, =(0x020370D0) @ var_800D
    str r0, [r1]
    pop {r4-r7}
    pop {r3}

call_via_r3:
    bx r3

.pool


Spoiler: ROUTINE_TWO
Code:
.thumb

@ This routine loops through the player's party, depositing every slot (slot 0 to 5) except for the slot number in var 8004
@ It then copies the Pokémon in the remaining slot to slot 0, and then erases each Pokémon from slots 1 to 5

main:
    push {r4-r6,lr}
    ldr r4, =(0x020370C0) @ var_8004
    ldrh r4, [r4]
    ldr r5, =(0x02024284) @ party_player
    mov r6, #0

loop:
    cmp r6, #6
    beq continue
    cmp r6, r4
    beq skip
    mov r1, #0x64
    mul r1, r6
    add r0, r1, r5
    ldr r3, =(0x08040B90|1) @ pokemon_add_to_pc
    bl call_via_r3

skip:
    add r6, #1
    b loop

continue:
    mov r1, #0x64
    mul r1, r4
    add r1, r5
    mov r0, r5
    mov r2, #0x64
    ldr r3, =(0x081E5E78|1) @ memcpy
    bl call_via_r3
    ldr r0, =(0x02024284+0x64) @ second Pokémon party address
    ldr r1, =(0x081F42A0) @ just a random 500 (dec) 00 bytes in the ROM
    ldrh r2, =(0x1F4)
    ldr r3, =(0x081E5E78|1) @ memcpy
    bl call_via_r3
    pop {r4-r6}
    pop {r3}

call_via_r3:
    bx r3

.pool
__________________
Reply With Quote
  #1299   Link to this post, but load the entire thread.  
Old February 5th, 2018 (6:45 AM).
Lunos's Avatar
Lunos Lunos is offline
Random Uruguayan User
 
Join Date: Oct 2008
Location: Montevideo (Uruguay)
Gender: Male
Nature: Lonely
Posts: 3,000
Exp. All / Gen. 6 Exp. Share [Emerald]
This routine was created by Samu from Wahack and it was posted right here. All the credits belong to him.

I'm afraid that I'll have to leave the comments in Spanish because I don't know how to properly translate them to English due to my lack of knowledge on the ASM programming language. Sorry :(

ASM Routine:
Code:
.thumb
.align 2

/****** NEW GEN EXP SHARE + EGG EXP FIX *******
************************************************
************************************************
************************************************
Créditos a BluRose & Lunos *********************
************************************************
************************************************/

no_crash:
	ldr r0, [r5]
	mov r1, r0
	add r1, #0x53
	ldrb r0, [r1]
	
flag_check:				@Se encarga de comprobar si hemos activado el flag
	push {r0-r2}
	ldr r0, flag_number
	ldr r2, flag_routine
	push {r1-r3}
	bl linker
	pop {r1-r3}
	cmp r0, #0x1		@Compara el flag con 0x1 (activado)
	bne routine_off
	pop {r0-r2}	
	
main:
	@Comprobar el slot y guardarlo en una variable.
	push {r3-r6}
	ldr r6, slot_var		@Carga en r3 el slot del pokemon
	ldrb r3, [r6]
	ldr r4, is_egg_party	
	mov r5, #0x64			
	mul r5, r5, r3			@Calcula las posiciones a avanzar
	ldrb r4, [r4, r5]		@Carga en r4 el byte egg/not
	cmp r4, #0x6
	beq pokemonIsEgg
	mov r2, #0x1
	b update_slot
	
pokemonIsEgg:
	mov r2, #0x0			@Establece r2 en 0 (no ganará exp)
	
update_slot:				@Actualiza y resetea el valor del slot
	add r3, #0x1
	cmp r3, #0x6
	bne end
	mov r3, #0x0
	
end:
	strh r3, [r6]
	pop {r3-r6}
	
return:
	push {r2}
	ldr r2, return_dir
	bx r2
	
routine_off:				@Ejecuta las instrucciones "originales"
	pop {r0-r2}
	mov r2, #0x1
	and r2, r0
	b return

linker:
	bx r2
	
.align 2
flag_number:
	.word 0x00000XXX 					@Elige el numero del flag
flag_routine:
	.word 0x0809D790 +1				@Rutina que checkea el flag
slot_var: 								@Escoge una variable temporal (no uses la 0x8000,
	.word 0x020275D6 + (0x800Y * 2)	@el juego la utiliza al inicializar combates dobles
is_egg_party:
	.word 0x020244EC + 0x13				@Byte que comprueba si es un huevo
return_dir:
	.word 0x0804A592 + 1				@Dirección de retorno a la rutina
Note: In order to use this routine, you must set a flag and a temp var in the Lines 72 and 76 respectively.

After inserting the routine in your ROM, open your Pokémon Emerald ROM in a hex editor and make the following changes:
-04A4BE: 02 21
-04A634: 01 20
-04A58A: C0 46 00 4A 10 47 XX XX XX 08 04 BC
Note: XX XX XX = Pointer to the ASM Routine, +1.
Example: If I were to put it in E3CF80, I'd have to replace XX XX XX with 81 CF E3.


Relevant information:
The flag handles the effect itself. If the flag you gave to the routine is OFF (0x0) the Exp. Share will work just like in Gen. 3. If it's ON (0x1), it'll work like in Gen. 1/6/7.

Result:

I'm sure there's ways to make this better, so if anyone could give that a try, that'd be awesome :)
__________________
Reply With Quote
  #1300   Link to this post, but load the entire thread.  
Old February 5th, 2018 (9:03 PM).
Skeli's Avatar
Skeli Skeli is offline
Lord of the Rings
 
Join Date: Apr 2014
Location: Canada
Age: 24
Gender: Male
Nature: Adamant
Posts: 300
Custom Victory Music [FR]:
Everyone knows of the code that allows you have custom trainer battle music, but as far as I'm aware, no one has ever written code that allows you have custom victory music (that jingle that plays when you win a battle).
This code is very similar to the custom trainer battle music in which it loads the data from a table structured [Byte - Trainer Class] 00 [HWord - Song ID]. The table is ended with a 0xFFFF.
But before you do anything though, you need to decide how many jingles you want. If you don't need more than 7, just compile the code as it is. If you don't modify the code, the table is at 0x15740 (there's enough space there for 7 jingles, just make sure you put the end 0xFFFF). Otherwise change the last line in the code to your table's pointer.
In order to get this working all you need to do is compile the ASM and copy whatever's at the offset 0x156F4 in the bin into your Rom. Due to the way the original code was written, the new code can be completely pasted over.
Enjoy!
Code:
.text
.align 2
.thumb
.thumb_func
.global victorymusic

@TableFormat: [Byte - Trainer Class] 00 [HWord - Song ID]
.org 0x156F4
Main:
	bl 0x35314
	ldr r1, .ScriptLoc
	ldr r0, =0x81D87EF
	str r0, [r1]
	ldr r2, .TrainerSomething
	ldr r0, .TrainerBattleFlagID

GetTrainerType:
	ldrh    r1, [r0]
	lsl    	r0, r1, #0x2
	add    	r0, r1
	lsl    	r0, #0x3
	add    	r0, r2
	ldrb    r0, [r0, #1]

CheckTable:
	ldr r1, .Table
	ldrh r3, =0xFFFF

Loop:
	ldrb r2, [r1]
	cmp r0, r2
	beq LoadSpecialSong
	add r1, #0x4
	ldrh r2, [r1]
	cmp r2, r3
	beq 0x1575E @Regular Victory Song
	b Loop

LoadSpecialSong:
	add r1, #0x2
	ldrh r0, [r1]
	b 0x15762

.align 2
.ScriptLoc: 		.word 0x2023D74
.TrainerSomething: 	.word 0x823EAC8
.TrainerBattleFlagID: 	.word 0x20386AE
.Table: 		.word 0x8015740
__________________
Pokemon Unbound

Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content
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

Forum Jump


All times are GMT -8. The time now is 8:46 AM.