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
  #651   Link to this post, but load the entire thread.  
Old August 5th, 2015 (5:54 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 FamiliaWerneck View Post
I've got a HUGE problem with this!!!!
I was playing and normally using TMs for 20k Pokémon (not a number, I'm exaggerating). I'm after the league now, and I was giving Toxic to some Pokémon, to help me catch others, so I could get the 60 Pokémon to get National Dex and be able to go to Four Island.
Problem is, when I was going to give Toxic to my Chansey, it was gone! Then I looked for the Psychic TM (other move I give to her, I took it out briefly for Rock Smash), and it was gone too. What the hell happened?
Is there a limit for this?
I got my save back, from the GBA in-game save, and I had Toxic yet. I tested giving it to one Pokémon and it didn't disappear. Then I gave it to other and then it wasn't there anymore. Is there a limited amout of times I can use a TM? Or there's something incomplete about this hack?
No, there shouldn't be a limit. Can anyone else confirm this bug? Also can you give me a specific case for when the TM disappears? There was a bug where it can get consumed if 4 moves were already learned. I fixed that already (it's in a separate post).
__________________
...
Reply With Quote
  #652   Link to this post, but load the entire thread.  
Old August 5th, 2015 (6:21 AM).
FamiliaWerneck's Avatar
FamiliaWerneck FamiliaWerneck is offline
 
Join Date: May 2015
Location: São Paulo, Brasil
Gender: Male
Posts: 275
Quote:
Originally Posted by FBI agent View Post
No, there shouldn't be a limit. Can anyone else confirm this bug? Also can you give me a specific case for when the TM disappears? There was a bug where it can get consumed if 4 moves were already learned. I fixed that already (it's in a separate post).
I'll confirm this second bug. Also, if you want, I can record a video of me making the TM move magically disappear. HAHAHAHA

EDIT: Second bug not confirmed!
When I noticed this, I used it in my Abra, which only had Teleport. Then it was gone after I used it in my Ekans, which had 4 moves learned.
But now, I used in an Ekans with 4 moves learned first, and I kept the TM. Then I used in my Abra, which had only one, and then the TM disappeared.
So, 4 moves learned bug is not my problem, so it seems.
__________________
My Main Team:


Reply With Quote
  #653   Link to this post, but load the entire thread.  
Old August 5th, 2015 (9:27 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

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:
Code:
[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:
Code:
	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:

Code:
.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:
Code:
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.
__________________
...
Reply With Quote
  #654   Link to this post, but load the entire thread.  
Old August 5th, 2015 (9:30 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 FamiliaWerneck View Post
I'll confirm this second bug. Also, if you want, I can record a video of me making the TM move magically disappear. HAHAHAHA

EDIT: Second bug not confirmed!
When I noticed this, I used it in my Abra, which only had Teleport. Then it was gone after I used it in my Ekans, which had 4 moves learned.
But now, I used in an Ekans with 4 moves learned first, and I kept the TM. Then I used in my Abra, which had only one, and then the TM disappeared.
So, 4 moves learned bug is not my problem, so it seems.
Try the fix I posted for the 4 move bug. I'm pretty sure it's the same fix for both problems.
__________________
...
Reply With Quote
  #655   Link to this post, but load the entire thread.  
Old August 5th, 2015 (9:37 AM).
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 FBI agent View Post

Set static party level

Is it just me OR and the opponent/AI as well?
__________________
Reply With Quote
  #656   Link to this post, but load the entire thread.  
Old August 5th, 2015 (11:26 AM).
azurile13 azurile13 is offline
 
Join Date: Mar 2015
Posts: 417
Quote:
Originally Posted by FBI agent View Post

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:
Code:
[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:
Code:
	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:

Code:
.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:
Code:
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.
This is quite a useful routine. Are there any issues you imagine arising from extending the entries to include custom movesets, held items, ev/iv etc?
Reply With Quote
  #657   Link to this post, but load the entire thread.  
Old August 5th, 2015 (7:24 PM).
FamiliaWerneck's Avatar
FamiliaWerneck FamiliaWerneck is offline
 
Join Date: May 2015
Location: São Paulo, Brasil
Gender: Male
Posts: 275
Quote:
Originally Posted by FBI agent View Post
Try the fix I posted for the 4 move bug. I'm pretty sure it's the same fix for both problems.
It seemed to work. I'll report back if I find anything else.
Bro, please update your Reusable TM post with this information.
Not for me, I already have it working. For other people not to stumble in the same issue.
Thanks for the help!
__________________
My Main Team:


Reply With Quote
  #658   Link to this post, but load the entire thread.  
Old August 6th, 2015 (7:41 PM).
esperance's Avatar
esperance esperance is offline
 
Join Date: Mar 2010
Location: OH
Age: 26
Gender: Male
Nature: Relaxed
Posts: 3,830
Quote:
Originally Posted by FamiliaWerneck View Post
It seemed to work. I'll report back if I find anything else.
Bro, please update your Reusable TM post with this information.
Not for me, I already have it working. For other people not to stumble in the same issue.
Thanks for the help!
Don't worry, they're both linked in the first post. :3
__________________
What are you so afraid of?
Reply With Quote
  #659   Link to this post, but load the entire thread.  
Old August 7th, 2015 (6:29 PM). Edited August 7th, 2015 by GoGoJJTech.
GoGoJJTech's Avatar
GoGoJJTech GoGoJJTech is offline
(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
 
Join Date: Nov 2012
Location: Earth
Age: 24
Gender: Female
Nature: Jolly
Posts: 2,475
Quote:
Originally Posted by FBI agent View Post
I don't really feel like doing a challenge cup. Also some of your features can be achieved using the already created party checker routine. Species Clause, Evasion Clause, OHKO clause can all be done by it. Maybe if I feel like it in future :P


Custom nicknames for enemy Pokemon



So this works for any wild or trainer Pokemon. It basically allows you to nickname a Pokemon on the enemy team prior to battling. For those special trainers or maybe special Pokemon :)

How to insert:

There's actually a little bit of work before you can compile and insert routines. First look at the routine below. You'll notice at the last line there is a Pointer to something that I call "TABLE". This table is going to be a table full of nickname with each entry 0xB bytes long. Find some space in your ROM which you will use for this table and correct the offset accordingly.

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	mov r0, #0x9C
	lsl r0, #0x2
	push {r1-r7}
    	ldr r2, =(0x806E6D0 +1)
	bl linker
	pop {r1-r7}
	cmp r0, #0x0
	beq old

nick:
	ldr r0, =(0x202402C)
	sub r0, r7, r0
	mov r1, #0x64
	ldr r2, =(0x81E4018 +1) @slot number
	bl linker
	mov r3, r0
	ldr r1, = (0x20370B8) @table entry position
	ldrb r1, [r1]
	mov r2, #0xB
	mul r1, r1, r2
	ldr r0, .TABLE
	add r0, r0, r1 @table start position
	mul r3, r3, r2
	add r0, r0, r3 @name to give
	mov r1, r7
	add r1, r1, #0x8 @nickname location
	mov r4, #0x0

nameLoop:
	cmp r4, #0xB
	beq end
	ldrb r3, [r0]
	strb r3, [r1]
	add r1, r1, #0x1
	add r0, r0, #0x1
	add r4, r4, #0x1
	b nameLoop

end:
	ldr r0, =(0x8040ADA +1)
	bx r0

old:
	mov r2, #0x0
	mov r3, r7
	add r3, #0x8

oldLoop:
	add r0, r3, r2
	add r1, r4, r2
	ldrb r1, [r1]
	strb r1, [r0]
	add r2, r2, #0x1
	cmp r2, #0x9
	ble oldLoop
	ldr r0, =(0x8040ADA +1)
	bx r0

linker:
	bx r2

.align 2

.TABLE:
	.word 0x8760000

Once you've made the modification to the pointer, compile and insert the routine into freespace.
Next navigate to offset 0x406DC and insert the following:
Code:
00 48 00 47 XX XX XX 08
Where XX is the pointer to the above routine in reverse hex +1.

Usage:
First navigate to your table which will contain the nicknames (it should be the offset in the routine you changed). You need to keep the table formatted like this [10 bytes (Name in hex)] [1 byte (0xFF)]. Insert as many names as you'd like.

Next, to activate the routine, you must setflag 0x270 AND you need to setvar 0x8000 0x[table starting index].
If you're battling a trainer with 6 Pokemon, the nicknames will be determined from the table. It will read six nicknames starting from the starting index given by variable 0x8000. There is no need to callasm. :)

Danny told me to find this for Emerald, and so I did. 0x406DC is for Fire Red, 0x6AFA8 is for Emerald. I did not test this, but it should theoretically work. (Of course the offsets in the routine will have to be changed, I can start doing that but it's late and stuff)

EDIT: If you ever want me to find the Emerald offsets for you, I'd be glad to.
EDIT^2: Edited routine for Emerald (Changes in Red)

Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func

main:
	mov r0, #0x9C @0x9C * 4 (which is what the next line does) = 0x270. Change this for the flag since it's most likely not free in Emerald
	lsl r0, #0x2
	push {r1-r7}
    	ldr r2, =(0x809D790 +1) @Flag Check
	bl linker
	pop {r1-r7}
	cmp r0, #0x0
	beq old

nick:
	ldr r0, =(0x2024744) @Opponent RAM location
	sub r0, r7, r0
	mov r1, #0x64
	ldr r2, =(0x82E7540 +1) @slot number
	bl linker
	mov r3, r0
	ldr r1, = (0x20375D8) @table entry position
	ldrb r1, [r1]
	mov r2, #0xB
	mul r1, r1, r2
	ldr r0, .TABLE
	add r0, r0, r1 @table start position
	mul r3, r3, r2
	add r0, r0, r3 @name to give
	mov r1, r7
	add r1, r1, #0x8 @nickname location
	mov r4, #0x0

nameLoop:
	cmp r4, #0xB
	beq end
	ldrb r3, [r0]
	strb r3, [r1]
	add r1, r1, #0x1
	add r0, r0, #0x1
	add r4, r4, #0x1
	b nameLoop

end:
	ldr r0, =(0x806B3D8 +1)
	bx r0

old:
	mov r2, #0x0
	mov r3, r7
	add r3, #0x8

oldLoop:
	add r0, r3, r2
	add r1, r4, r2
	ldrb r1, [r1]
	strb r1, [r0]
	add r2, r2, #0x1
	cmp r2, #0x9
	ble oldLoop
	ldr r0, =(0x806B3D8 +1)
	bx r0

linker:
	bx r2

.align 2

.TABLE:
	.word 0x8760000
__________________
I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this into your signature.
The HGSS Music Patch - The BW/2 Music Patch - ASM: Switch Music Based on Seasons
Romhack.me Profile - Pokecommunity Profile - Youtube Channel

Support me at my site!
Pokémon Platinum Red and Blue
Reply With Quote
  #660   Link to this post, but load the entire thread.  
Old August 7th, 2015 (7:10 PM).
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 Sky High View Post
Is it just me OR and the opponent/AI as well?
Just your party.

Quote:
Originally Posted by azurile13 View Post
This is quite a useful routine. Are there any issues you imagine arising from extending the entries to include custom movesets, held items, ev/iv etc?
Yeah that's not too hard, but I think you'd prefer to make your own trainer if you'd have something memorable like custom items and movesets no? It would mean more tables, and more work for the inserter. So much to the point that it wouldn't really be worth the effort, kind of like having 100 TMs.

Quote:
Originally Posted by Lost Heart View Post
Don't worry, they're both linked in the first post. :3
Thanks I was too lazy to edit my post anyways!

Quote:
Originally Posted by GoGoJJTech View Post
Danny told me to find this for Emerald, and so I did. 0x406DC is for Fire Red, 0x6AFA8 is for Emerald. I did not test this, but it should theoretically work. (Of course the offsets in the routine will have to be changed, I can start doing that but it's late and stuff)

EDIT: If you ever want me to find the Emerald offsets for you, I'd be glad to.
My old routines make my eyes bleed my eyes X_X
Someone who's keen can go back and make efficiency changes to some of these. A brave and unlazy soul!
__________________
...
Reply With Quote
  #661   Link to this post, but load the entire thread.  
Old August 7th, 2015 (7:11 PM).
GoGoJJTech's Avatar
GoGoJJTech GoGoJJTech is offline
(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
 
Join Date: Nov 2012
Location: Earth
Age: 24
Gender: Female
Nature: Jolly
Posts: 2,475
Quote:
Originally Posted by FBI agent View Post

HP Regeneration per step



Intro:
Basically a routine to regenerate a Pokemon's HP every step. In this routine it's set to 3 per step. You may want to modify the exact amount to a percentage or something (see the commented line).

How to insert:

First compile and insert the following routine into free space.

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

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

	
loop:
	cmp r6, r7
	beq end
	mov r1, #0x64
	mul r1, r1, r6
	add r0, r0, r1
	mov r5, r0
	mov r1, #0x39
	ldr r3, =(0x803FBE8 +1)
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
	mov r0, r5
	mov r1, #0x3A
	ldr r3, =(0x803FBE8 +1)
	bl linker
	add r6, r6, #0x1
	cmp r4, r0
	beq loop

addOn:
	add r4, r4, #0x3 @amount to add per step. Here it's 3
	cmp r4, r0
	ble cont
	mov r4, r0
	
cont:
	mov r0, r5
	mov r1, #0x39
	ldr r2, =(0x20370D0)
	strh r4, [r2]
	ldr r3, =(0x804037C)
	bl linker
	b loop
	
next:
	add r6, r6, #0x1
	b loop

end:
	pop {r0-r7}
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	beq brancher
	mov r0, r5
	ldr r1, =(0x806D600 +1)
	bx r1

brancher:
	ldr r0, =(0x806D650 +1)
	bx r0
	
linker:
	bx r3
	
.align 2


Now in a hex editor navigate to 0x6D5F6. There you will need to insert the following byte changes:
Code:
 01 4A 10 47 00 00 XX XX XX 08
Where XX XX XX is the pointer to where you inserted the above routine +1.

Usage:

There isn't any usage. It's automatically done. You can change the amount generated by reading the line in the code which I've commented.
For Emerald (Changes in Red):
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r7}
	ldr r0, =(0x20244EC) @Party Pokémon
	mov r6, #0x0
	ldr r7, =(0x20244E9) @Party Quantity
	ldrb r7, [r7]

	
loop:
	cmp r6, r7
	beq end
	mov r1, #0x64
	mul r1, r1, r6
	add r0, r0, r1
	mov r5, r0
	mov r1, #0x39
	ldr r3, =(0x806A518 +1) @Pokemon Get Attribute
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
	mov r0, r5
	mov r1, #0x3A
	ldr r3, =(0x806A518 +1) @Pokemon Get Attribute
	bl linker
	add r6, r6, #0x1
	cmp r4, r0
	beq loop

addOn:
	add r4, r4, #0x3 @amount to add per step. Here it's 3
	cmp r4, r0
	ble cont
	mov r4, r0
	
cont:
	mov r0, r5
	mov r1, #0x39
	ldr r2, =(0x20375F0) @Var 0x800D (Lastresult)
	strh r4, [r2]
	ldr r3, =(0x806ACAC) @Pokemon Set Attribute
	bl linker
	b loop
	
next:
	add r6, r6, #0x1
	b loop

end:
	pop {r0-r7}
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	beq brancher
	mov r0, r5
	ldr r1, =(0x809C8F4 +1)
	bx r1

brancher:
	ldr r0, =(0x809C92E +1) @This may actually fail the routine, needs testing
	bx r0
	
linker:
	bx r3
	
.align 2

Insert at 0x9C8EA.
__________________
I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this into your signature.
The HGSS Music Patch - The BW/2 Music Patch - ASM: Switch Music Based on Seasons
Romhack.me Profile - Pokecommunity Profile - Youtube Channel

Support me at my site!
Pokémon Platinum Red and Blue
Reply With Quote
  #662   Link to this post, but load the entire thread.  
Old August 7th, 2015 (7:45 PM). Edited August 7th, 2015 by Blah.
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Battle Frontier routines (Generate a random trainer sprite)



Something to compliment my opponent party generation routine, it generates a random trainer sprite for the opponent from a table of possible sprite entries. Incase you haven't noticed, tables are awesome and tables make things customizable! Lets cut to the chase.

An important note about multi-use

You may or may not be familiar with the Rival and Champion trainer class functions so I will briefly explain that to explain this multi-use. In short, if you assign a trainer the trainer class "Rival" or "Champion" they will automatically be assigned the name of your Rival (the one you name in the Oak intro).

Some people have hacks in which there are more than 2 Rivals, and it may be important to you to have this said rival's sprite appear when battling them. I've removed the class dependency, and added that capability to the sprite generator.

How to insert:

Before compiling the routine in the spoiler below, there's a few things which you may want to customize.
1) The routine is flag toggled. By default I made this flag 0x205. See spoiler below about code to modify this
Spoiler:

Code:
@change these lines
	mov r0, #0xFF
	lsl r0, r0, #0x1
	add r0, r0, #0x7


2) This routine reads from a table of byte long entries, each of the entries correspond to a specific sprite. See spoiler for info
Spoiler:

Code:
@change 0x8750000 to where your table of sprite IDs are
@change 0x32 to the amount of sprite entries in your table
@Please note that each entry in the table of sprite IDs takes 1 byte

Table:
	.word 0x8750000
	
Tsize:
	.word 0x32


3) This routine has an optional section described in the previous section.

To remove this section please see the spoiler below.
Spoiler:

To remove, delete:
Code:
optional:
	ldr r4, =(0x20370B8)
	ldrh r4, [r4]
	cmp r4, #0xFF
	bne randSprite
	ldr r0, location
	b end
Also delete:
Code:
Location:
	.word 0x8


To learn how to customize the optional section see the spoiler below.
Spoiler:

The optional code is run when variable 0x8000 = 0xFF. If this is the case, and the flag 0x205 is set, then the sprite ID at the label location is used. Change this sprite ID here:

Code:
@Change 0x8 to your sprite's ID!
Location:
	.word 0x8


The routine:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

@Hook via r4 @08037D30

main:
	@flag check 0x205
	push {r0-r3}
	mov r0, #0xFF
	lsl r0, r0, #0x1
	add r0, r0, #0x7
	ldr r4, =(0x806E6D0 +1)
	bl linker
	cmp r0, #0x0
	beq norm
	pop {r0-r3}
	
optional:
	ldr r4, =(0x20370B8)
	ldrh r4, [r4]
	cmp r4, #0xFF
	bne randSprite
	ldr r0, location
	b end
	
randSprite:
	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
	ldr r1, Table
	add r0, r0, r1
	ldrb r0, [r0]
	ldr r4, =(0x20370BA)
	strb r0, [r4]
	b end
	
	
norm:
	pop {r0-r3}
	lsl r0, r1, #0x2
	add r0, r0, r1
	lsl r0, r0, #0x3
	add r0, r0, r2
	ldrb r0, [r0, #0x3]
	
end:
	ldr r4, =(0x8037D3A +1)
	
linker:
	bx r4

.align 2

Table:
	.word 0x8750000
	
Tsize:
	.word 0x32
	
Location:
	.word 0x8


Once the changes have been made, compile and insert into free space. Then navigate to 0x37D30 and make the following byte changes:
Code:
00 4C 20 47 XX XX XX 08
Where XX XX XX is where you inserted the routine +1. Note the trailing 08 may change depending on where you've inserted the routine.


Usage:

Just set flag 0x205 and let the magic happen. Set variable 0x8000 to 0xFF for the optional part mentioned throughout the post.


Important:
Please direct questions in the ASM help thread and not to my poor PM box :(
__________________
...
Reply With Quote
  #663   Link to this post, but load the entire thread.  
Old August 7th, 2015 (8:06 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Battle Frontier routines (Generate a random trainer name)



So I've done generating the sprite, generating the team, now it's time to give our random trainer their name. Naming is a little trickier because we can't assign a male name to a female sprite and vise versa. I decided to make a simple system to avoid that which I will now explain here. Skip to the next section if you're uninterested and want to risk making your female sprite be named Arnold.

Basically, without mentioning, in my previous post's routine I secretly stored the sprite's ID in variable 0x8001. This routine uses that information to generate a name which fits the sprite. Obviously, the only way to do that is to make a table whose entries are directly linked to the sprite table. How it works is, every sprite ID has a set amount of names which can be assigned to it, when a sprite is chosen at random, a name from the table which corresponds to the sprite is chosen at random.

Here is how the table is formatted"
Code:
[13 bytes (Possible name ID 1)] [13 bytes (Possible name ID 1)] [13 bytes (Possible name ID 1)] ....[13 bytes (Possible name ID 2)] ...
Names are 0xFF terminated of course.

An important note about multi-use

You may or may not be familiar with the Rival and Champion trainer class functions so I will briefly explain that to explain this multi-use. In short, if you assign a trainer the trainer class "Rival" or "Champion" they will automatically be assigned the name of your Rival (the one you name in the Oak intro).

Some people have hacks in which there are more than 2 Rivals, and if you use some of my naming routines, the player has the ability to name the second rival. This implies that the 2nd rival or important character's name will not be written into the ROM, but rather stored somewhere in the RAM. Which means you cannot just create a custom trainer and have it have the second Rival or important character's name (because like the rival's name, you don't know it to hard code it!). I've taken this into consideration and added some optional code to support this. I've removed the class dependency as well. Now you just need to set variable 0x8000 to 0xFF

How to insert:

Before compiling the routine in the spoiler below, there's a few things which you may want to customize.
1) The routine is flag toggled. By default I made this flag 0x205. See spoiler below about code to modify this
Spoiler:

Code:
@change these lines
	mov r0, #0xFF
	lsl r0, r0, #0x1
	add r0, r0, #0x7


2) This routine reads from a table of 13 byte long entries, each of the entries correspond to a specific name for a sprite. See spoiler for info.
Spoiler:

Code:
@change 0x8750000 to where your table of names are
@change 0x32 to the amount of names there are per sprite
@Please note that each entry in the table of sprite IDs takes 13 bytes and is 0xff terminated

Table:
	.word 0x8750000
	
Tsize:
	.word 0x32


3) This routine has an optional section described in the previous section.

To remove this section please see the spoiler below.
Spoiler:

To remove, delete:
Code:
optionalSecondRival:
	ldr r4, =(0x20370B8)
	ldrh r4, [r4]
	cmp r4, #0xFF
	bne randName
	ldr r4, Location
	b end
Also delete:
Code:
Location:
	.word 0x8


To learn how to customize the optional section see the spoiler below.
Spoiler:

The optional code is run when variable 0x8001 = 0xFF. If this is the case, and the flag 0x205 is set, then the 0xFF terminated string at the label location is used. Change this name's location here (note the location can be in RAM or in the ROM):

Code:
@Change 0x8 to your sprite's ID!
Location:
	.word 0x8


The routine:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

@Hook via r2 080D8134

main:
	@flag check 0x205
	push {r0-r3}
	mov r0, #0xFF
	lsl r0, r0, #0x1
	add r0, r0, #0x7
	ldr r4, =(0x806E6D0 +1)
	bl linker
	cmp r0, #0x0
	beq norm
	pop {r0-r3}
	
optionalSecondRival:
	ldr r4, =(0x20370B8)
	ldrh r4, [r4]
	cmp r4, #0xFF
	bne randName
	ldr r4, Location
	b end
	
randName:
	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
	@Get a name from the table of names
	ldr r4, =(0x20370BA)
	ldrh r4, [r4]
	add r4, r4, r0
	mov r1, #0xD
	mul r1, r1, r4
	ldr r4, Table
	add r4, r4, r1	
	b end
	
	
norm:
	pop {r0-r3}
	ldr r2, =(0x823EAC8)
	ldrh r0, [r5]
	lsl r1, r0, #0x2
	add r1, r1, r0
	lsl r1, r1, #0x3
	ldr r0, =(0x80D813E +1)
	bx r0
	
end:
	ldr r4, =(0x80D8382 +1)
	
linker:
	bx r4

.align 2

Table:
	.word 0x8750000
	
Tsize:
	.word 0x32
	
Location:
	.word 0x8740000


Once the changes have been made, compile and insert into free space. Then navigate to 0xD8134 and make the following byte changes:
Code:
00 4C 20 47 XX XX XX 08
Where XX XX XX is where you inserted the routine +1. Note the trailing 08 may change depending on where you've inserted the routine.


Usage:

Just set flag 0x205 and let the magic happen. Set variable 0x8000 to 0xFF for the optional part mentioned throughout the post.


Important:
Please direct questions in the ASM help thread and not to my poor PM box :(
__________________
...
Reply With Quote
  #664   Link to this post, but load the entire thread.  
Old August 7th, 2015 (8:30 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Excuse my triple post, but I have an update about the third routine which deals with actually making the trainer temporary. The whole idea of generating a randomized trainer using ASM routines, rather than using a script to pick a random battle from 50 or so, efficiency and time saving aside, is to save the Hacker 50 or so trainer slots which they would have used to make the trainers.

However, it became apparent to me while working on this that there was no need to make a custom trainerID or temporary trainer ID. In any frontier routine, the battle style would be
Code:
trainerbattle 0x1 0xID 0x0 @stuff @stuff
so the hacker can just clear the trainerflag after the battle, and use one trainer flag for a large selection of custom trainers. As such, I will not be making a routine for this.

I think this concludes the biggest problem about implementing a battle frontier in Fire Red. Some of the competitions, atleast the interesting ones, can be done with smart usage of the Pokemon storage system routines, and small edits of game code. I encourage people to post their solutions to said problems.

I'm currently working on making minigames in FR. Let me know some of your ideas :)
__________________
...
Reply With Quote
  #665   Link to this post, but load the entire thread.  
Old August 7th, 2015 (8:51 PM).
chrunch chrunch is offline
 
Join Date: Oct 2009
Gender: Male
Posts: 1,343
Quote:
Originally Posted by chrunch View Post
Not sure if you're still taking these, but I have a small request: a way to force set mode that can be toggled on/off. Would be very useful for battle frontier type places.
Just going to repost this because I believe it's relevant to the other battle frontier routines, for people that don't want to permanently enable set mode.
Reply With Quote
  #666   Link to this post, but load the entire thread.  
Old August 7th, 2015 (10:18 PM).
Danny0317's Avatar
Danny0317 Danny0317 is offline
Fluorite's back, brah
 
Join Date: Jun 2013
Age: 23
Gender: Male
Nature: Hasty
Posts: 1,067
Before I post this, I want to say thank you to everyone here for contributing to this thread, I'd do something if I wasn't so noob at ASM XD..

Anyways, is there a way to lose HP every step instead of regenerate?
__________________
Reply With Quote
  #667   Link to this post, but load the entire thread.  
Old August 8th, 2015 (4:51 AM). Edited August 28th, 2015 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
Quote:
Originally Posted by FBI agent View Post

My condition for using this hack


Unlike most hacks, this is a little different. It's open source, and you're free to use it. However, I require you post the script you use for any of your moves. This is because I want people to keep anything regarding this hack public.
Just post the script you use in your own thread, and that'll be it (like the Sunny Day script I used).
Here's my Rock Climb script, just posting here for convenience. It's worth noting this script was made for FireRed, and uses JPAN's special 0x7F; of course, you can just compile the routine and replace special 0x7F with callasm instead.

For Emerald, I believe you need to change the pointer to evaluator to be 0x081A8D95, as well as changing the movement bytes and the animation (?). Special 0x8F isn't in Emerald afaik, so just replace instances of it with getplayerpos 0x8004 0x8005 (EDIT: it seems to not work if it isnt a special, so it's still easiest to replace one of the specials which point to a nop to point to the routine instead).

All instances of 0xA5 should be replaced with the Rock Climb behaviour byte, and all instances of 0x1AF with your attack ID for Rock Climb.

This works for any height of Rock Climb wall, provided each Rock Climb wall tile has the behaviour byte specified in this script. You should also assign this script to the behaviour byte, as well as for the field move, so it's multipurpose in that sense. The script could probably be far more efficient, the movement isn't ideal, the "Rock Climb can't be used here" isn't consistent with how trying to Surf where you cannot works, and (due to horizontal Rock Climbing being impossible / ugly with the Gen 3's 2D engine) horizontal movement doesn't work, but for all intents and purposes it's functional.

Code:
#dynamic 0x800000

'---------------
#org @start
lock
special 0x8F
comparefarbytetobyte 0x2036E50 0x11
if 0x1 call @snippet1
comparefarbytetobyte 0x2036E50 0x22
if 0x1 call @snippet2
special 0x7F
compare 0x8005 0xA5
if 0x1 goto @snippet3
goto @snippet4

'---------------
#org @snippet1
addvar 0x8005 0x1
return

'---------------
#org @snippet2
subvar 0x8005 0x1
return

'---------------
#org @snippet3
lock
special 0x8F
comparefarbytetobyte 0x2036E50 0x33
if 0x1 goto @snippet5
comparefarbytetobyte 0x2036E50 0x44
if 0x1 goto @snippet5
checkattack 0x1AF
compare LASTRESULT 0x6
if 0x1 goto @snippet5
setanimation 0x0 LASTRESULT
bufferpartypokemon 0x0 LASTRESULT
bufferattack 0x1 0x1AF
msgbox @string1 MSG_YESNO '"The wall is very rocky[.]\nWould y..."
compare LASTRESULT 0x0
if 0x1 goto @snippet6
msgbox @string2 MSG_KEEPOPEN '"[buffer1] used [buffer2]!"
closeonkeypress
doanimation 0x2
waitstate
special 0x8F
setvar 0x8006 0x0
copyvar 0x4001 0x8004
copyvar 0x4002 0x8005
comparefarbytetobyte 0x2036E50 0x11
if 0x1 goto @snippet7
comparefarbytetobyte 0x2036E50 0x22
if 0x1 goto @snippet8
goto @snippet4

'---------------
#org @snippet4
msgbox @string3 MSG_NORMAL '"Rock Climb can't be used here!"
release
end

'---------------
#org @snippet5
msgbox @string4 MSG_SIGN '"The wall is very rocky[.]\nWill a ..."
release
end

'---------------
#org @snippet6
closeonkeypress
release
end

'---------------
#org @snippet7
copyvar 0x8004 0x4001
addvar 0x4002 0x1
copyvar 0x8005 0x4002
addvar 0x8006 0x1
special 0x7F
compare 0x8005 0xA5
if 0x1 goto @snippet7
goto @snippet9

'---------------
#org @snippet8
copyvar 0x8004 0x4001
subvar 0x4002 0x1
copyvar 0x8005 0x4002
addvar 0x8006 0x1
special 0x7F
compare 0x8005 0xA5
if 0x1 goto @snippet8
goto @snippet9

'---------------
#org @snippet9
compare 0x8006 0x0
if 0x1 goto @snippet10
comparefarbytetobyte 0x2036E50 0x11
if 0x1 call @snippet11
comparefarbytetobyte 0x2036E50 0x22
if 0x1 call @snippet12
subvar 0x8006 0x1
goto @snippet9

'---------------
#org @snippet10
release
end

'---------------
#org @snippet11
applymovement MOVE_PLAYER @move1
waitmovement 0x0
return

'---------------
#org @snippet12
applymovement MOVE_PLAYER @move2
waitmovement 0x0
return


'---------
' Strings
'---------
#org @string1
= The wall is very rocky[.]\nWould you like to use [buffer2]?

#org @string2
= [buffer1] used [buffer2]!

#org @string3
= Rock Climb can't be used here!

#org @string4
= The wall is very rocky[.]\nWill a Pokémon's move scale it?


'-----------
' Movements
'-----------
#org @move1
#raw 0x35 'Slide Down (Normal)
#raw 0xFE 'End of Movements

#org @move2
#raw 0x36 'Slide Up (Normal)
#raw 0xFE 'End of Movements
Give credit, of course, to JPAN and FBI agent.
__________________
Reply With Quote
  #668   Link to this post, but load the entire thread.  
Old August 8th, 2015 (7:05 AM).
Joexv's Avatar
Joexv Joexv is offline
ManMadeOfGouda
joexv.github.io
 
Join Date: Oct 2012
Location: Oregon
Age: 25
Gender: Male
Nature: Sassy
Posts: 1,035
Here are some of Jpans routines ported to Emerald.
All of which will be included in DSLN.

Check D-Pad
Spoiler:
Code:
.align 2
.thumb

/*Special 0x2c checks for the D-pad. Returns
0x0 if no direction is pressed
0x1 if up is pressed
0x2 if left is pressed 
0x3 if down is pressed
0x4 if right is pressed

special_2c:	ldr r0, key_reg1
		ldrh r0, [r0]
		mvn r0, r0
		lsl r0, r0, #0x18
		lsr r0, r0, #0x1c
		cmp r0, #0xE
		beq right
		cmp r0, #0xD
		beq left
		cmp r0, #0xB
		beq up
		cmp r0, #0x7
		beq down
                cmp r0, #0xFF
                beq None

		bx lr
up:		mov r0, #0x1
		bx lr
left:		mov r0, #0x2
		bx lr
down:		mov r0, #0x3
		bx lr
right:		mov r0, #0x4
		bx lr
None:           mov r0, #0x0
                bx lr

.hword .0x0000
key_reg1: .word 0x04000130


Delete Pokemon From party(special 62)
Spoiler:
Code:
.thumb
.align 2

/*Special 0x62 destroys a pokemon in your party
what it does is move all other pokemon from your party up one level until it 
gets to the last, that is replaced by 0's
0x8004 is the pokemon slot to delete, f erases entire party.
returns 0 if no pokemon was left, the number of pokemon if any remained.
It will delete any pokemon, even if your last*/

special_62: 	push {r1-r7, lr}
		mov r0, #0x0
		ldr r7, var_8004
		ldr r6, party_addr
		ldr r5, poke_quantity
		ldrh r7, [r7]
		cmp r7, #0xf
		beq delete_all
		
		cmp r7, #0x5
		bgt end_62

		cmp r7, #0x0
		blt end_62
		
		ldrb r4, [r5]
		cmp r7, r4
		bge end_62
		
		mov r4, #0x5
		sub r4, r4, r7

make_address:	cmp r7, #0x0
		beq made_address
		add r6, #0x64
		sub r7, #0x1
		b make_address
	
made_address:	add r7, r4, #0x0
		add r4, r6, #0x0
		add r4, #0x64

copy_loop:	cmp r7, #0x0
		beq erase_loop
		add r0, r4, #0x0
		add r1, r6, #0x0
		mov r2, #0x64
		swi #0xb
		sub r7, #0x1
		add r6, #0x64
		add r4, #0x64
		b copy_loop
erase_loop:	mov r0, #0x6
		mov r1, #0x0
		mov r2, #0x0
		mov r3, #0x0
		mov r4, #0x0 
erase_last:	stmia r6!, {r1-r4}
		sub r0, #0x1
		cmp r0, #0x0
		bne erase_last
		str r6, [r1]
		ldrb r0, [r5]
		sub r0, #0x1
		strb r0, [r5]
end_62:		pop {r1-r7, pc}

delete_all:	mov r0, #0x4b
		mov r1, #0x0
		mov r2, #0x0
		mov r3, #0x0
		mov r4, #0x0 
continue:	stmia r6!, {r1-r4}
		sub r0, #0x2
		cmp r0, #0x1
		bne continue
		stmia r6!, {r1,r2}
		mov r0, #0x0
		strb r0, [r5]
		pop {r1-r7, pc}

var_8004: .word 0x020375e0
poke_quantity: .word 0x020244E9
party_addr: .word 0x020244EC


Check pokemon Status (Special 63)
Spoiler:
Code:
.thumb
.align 2

/*Special 0x63 is a status checker. It allows you to check your party pokemon
status. Receives 0x8004 as the slot and returns the pokemon's status byte*/

Special_63:	push {r1, lr}
		ldr r0, var_8004
		mov r1, #0x64
		ldrb r0, [r0]
		cmp r0, #0x5
		bgt end_63
		mul r0, r1
		ldr r1, party_status_address
		add r0, r0, r1
		ldrb r0, [r0]
end_63:		pop {r1, pc}
.hword 0x0000
var_8004: .word 0x020375e0
party_status_address: .word 0x020244EC + 0x50
Inflict Status Effect(Special 64)
Spoiler:
Code:
.thumb
.align 2

/*Special 0x64 is the inflict status to pokemon special. Simply use the status
key at 0x8005 to inflict it to the pokemon in slot 0x8004, or to all if 0x8004
is 0xf*/

Special_64:	push {r1-r4, lr}
		ldr r1, var_8004
		ldrh r0, [r1,#0x2]
		ldrh r1, [r1]
		cmp r1, #0xf
		beq apply_all
		
		cmp r1, #0x5
		bgt end_64
		
		mov r2, #0x64
		mul r2, r1
		ldr r1, party_status_address
		add r1, r2, r1
		strb r0, [r1, #0x0]
end_64:		pop {r1-r4, pc}

apply_all:	mov r2, #0x6
		ldr r1, party_status_address
loop:		strb r0, [r1, #0x0]
		sub r2, #0x1
		add r1, #0x64
		cmp r2, #0x0
		bne loop
		pop {r1-r4, pc}
var_8004: .word 0x020375e0
party_status_address: .word 0x020244EC + 0x50
Hp Checker (Special 65)
Spoiler:
Code:
.thumb
.align 2

/*Special 0x65 is a HP checker. It allows you to check your party pokemon
current HP. Receives 0x8004 as the slot and returns the pokemon's current HP*/

Special_65:	push {r1, lr}
		ldr r0, var_8004
		mov r1, #0x64
		ldrb r0, [r0]
		cmp r0, #0x5
		bgt end_65
		mul r0, r1
		ldr r1, party_HP_address
		add r0, r0, r1
		ldrh r0, [r0]
end_65:		pop {r1, pc}
.hword 0x0000
var_8004: .word 0x020375e0
party_HP_address: .word 0x020244EC + 0x56

Change HP (Special 66)
Spoiler:
Code:
.thumb
.align 2

/*Special 0x66 is the Change HP pokemon special. Slot 0x8004 is the pokemon slot,
0x8005 is the HP quantity and var 0x8006 must be 1 to add, anything else to
subtract.*/


Special_66:	push {r1-r4, lr}
		ldr r1, var_8004
		ldrh r0, [r1,#0x2]
		ldrh r3, [r1, #0x4]
		ldrh r1, [r1]
		cmp r1, #0xf
		beq apply_all
		
		cmp r1, #0x5
		bgt end_64
		
		mov r2, #0x64
		mul r2, r1
		ldr r1, party_HP_address
		add r1, r2, r1
		ldrh r4, [r1]
		cmp r3, #0x1
		beq recover_one
		
		sub r0, r4, r0
		cmp r0, #0x0
		bge store_one
		mov r0, #0x0
		b store_one
		
recover_one:	add r0, r0, r4
		ldrh r4, [r1, #0x2]
		cmp r0, r4
		ble store_one
		add r0, r4, #0x0 
store_one:	strh r0, [r1, #0x0]
end_66:		pop {r1-r4, pc}

apply_all:	mov r2, #0x6
		ldr r1, party_HP_address
		cmp r3, #0x1
		beq add_loop
loop:		ldrh r4, [r1, #0x0]
		sub r3, r4, r0
		cmp r3, #0x0
		bge sub_fin
		mov r3, #0x0
sub_fin:	strh r3, [r1, #0x0]
		sub r2, #0x1
		add r1, #0x64
		cmp r2, #0x0
		bne loop
		pop {r1-r4, pc}

add_loop:	ldrh r4, [r1, #0x0]
		add r3, r4, r0
		ldrh r4, [r1, #0x2]
		cmp r3, r4
		ble add_fin
		add r3, r4, #0x0
add_fin:	strh r3, [r1, #0x0]
		sub r2, #0x1
		add r1, #0x64
		cmp r2, #0x0
		bne add_loop
		pop {r1-r4, pc}
.hword 0x0000
var_8004: .word 0x020270c0
party_HP_address: .word 0x02024562


More to come when I feel like it.
__________________
New living flesh vessel who dis?
Reply With Quote
  #669   Link to this post, but load the entire thread.  
Old August 8th, 2015 (8:24 AM).
daniilS's Avatar
daniilS daniilS is offline
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 23
Gender: Male
Posts: 409
If anybody ever wants the Wally thingy to use your rival's backsprite in Emerald for whatever reason, here's a routine that does just that:
Code:
.thumb

reloadpal:
	and r0, r1
	beq abort
	cmp r4, #0
	beq genderbend
abort:
	ldr r3, =0x080A96B2
	mov pc, r3

reloadsprite:
	mov r1, r0
	add r3, #1
	mov lr, r3
	ldr r3, =0x0806A12C
	b genderbend

enterfield:
	ldr r4, =0x02024064
	ldrb r1, [r4]
genderbend:
	ldr r0, =0x03005D90
	ldr r0, [r0]
	ldrb r5, [r0, #8]
	mov r0, #1
	eor r0, r5
	mov r5, r0
	mov pc, r3

loadpal:
	ldr r0, =0x03005D90
	ldr r0, [r0]
	ldrb r0, [r0, #8]
	ldr r1, =0x08305D8C
	cmp r0, #0
	bne next
	add r1, #8
next:
	ldr r0, [r1]
	ldr r3, =0x0816A9B8
	mov pc, r3
	
/*01 4A 01 A3 97 46 XX XX XX XX C0 46 at 0x0A969E and 0x0A98E6(+C), 00 A3 A7 46 at 0x169ECC and 0x169F98, XX XX XX XX(+16) at 0x169F70 and 0x16A03C, 28 1C at 0x169EE0 and 0x169FAC, 87 46 at 0x16A9B6, and XX XX XX XX(+28) at 0x16AA60*/
Insertion instructions are found at the bottom. (+number) means you'll need to add that number to the XX XX XX XX (pointer to the routine) when you make the byte changes at that address (so if I inserted it at 0x08123456, I'd put 01 4A 01 A3 97 46 62 34 12 08 C0 46 at 0x0A98E6).
__________________
Reply With Quote
  #670   Link to this post, but load the entire thread.  
Old August 8th, 2015 (8:29 AM).
GoGoJJTech's Avatar
GoGoJJTech GoGoJJTech is offline
(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
 
Join Date: Nov 2012
Location: Earth
Age: 24
Gender: Female
Nature: Jolly
Posts: 2,475
Quote:
Originally Posted by Spherical Ice View Post
For Emerald, I believe you need to change the pointer to evaluator to be 0x081A8D95, as well as changing the movement bytes and the animation (?). Special 0x8F isn't in Emerald afaik, so just replace instances of it with getplayerpos 0x8004 0x8005.
That special is 0x92 in Emerald. List here will be updated in the future: http://www.pokecommunity.com/showthread.php?p=8881985#post8881985
__________________
I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this into your signature.
The HGSS Music Patch - The BW/2 Music Patch - ASM: Switch Music Based on Seasons
Romhack.me Profile - Pokecommunity Profile - Youtube Channel

Support me at my site!
Pokémon Platinum Red and Blue
Reply With Quote
  #671   Link to this post, but load the entire thread.  
Old August 8th, 2015 (9:15 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Warp redirection



This is something similar to FR's elevator scripts in Celadon dept store. What it does is it redirects all warps to a specific one assigned by two variables (one for map bank and second for map number, I know you can make one variable to hold both of these, but I think the reverse hexing and math calculations might confuse people so 2 variables).

I think this will be useful for a single warp or multiple warps which warps you to a different map depending on what's happening. It's better than FR's elevator script because you can have a default warp position, and the redirection only takes 2 setvar instructions (could've been one, but you know) :D

How to insert:

Code:
MBank:
	.word 0x4012

MNumb:
	.word 0x4013
Change these two to the variables you want to use for map bank and map number (should be two non-temp vars). Then compile and insert the following routine into free space:

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	mov r0, #0x7
	ldrsb r0, [r4, r0]
	mov r1, #0x6
	ldrsb r1, [r4, r1]
	mov r2, #0x5
	ldrsb r2, [r4, r2]
	
checkAltMap:
	push {r0-r2}
	ldr r0, MBank
	ldr r1, =(0x806E568 +1)
	bl linker
	cmp r0, #0x0
	bne setWarp
	pop {r0-r2}
	b noCrash

setWarp:
	ldr r0, MNumb
	ldr r1, =(0x806E568 +1)
	bl linker
	mov r1, r0
	ldr r0, =(0x20370B8)
	ldrb r0, [r0]
	
	
noCrash:
	ldr r3, =(0x806DC84 +1)
	bx r3
		
linker:
	bx r1
	
	
.align 2

MBank:
	.word 0x4012

MNumb:
	.word 0x4013


Insert the following byte changes at 0x6DC78:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is where you inserted this routine +1. Note that 08 may change depending on where you insert it.

Usage

Unlike other similar routines I made, this one reads the variables to determine if it should execute. Have the Mbank var not equal to 0 to toggle execution. Of course, Mbank = map bank var and Mnumb = Map number var.
__________________
...
Reply With Quote
  #672   Link to this post, but load the entire thread.  
Old August 8th, 2015 (7:48 PM). Edited August 9th, 2015 by GoGoJJTech.
GoGoJJTech's Avatar
GoGoJJTech GoGoJJTech is offline
(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
 
Join Date: Nov 2012
Location: Earth
Age: 24
Gender: Female
Nature: Jolly
Posts: 2,475

HP Removal per step



Intro:
Basically a routine to remove a Pokemon's HP every step. In this routine it's set to 3 per step. You may want to modify the exact amount to a percentage or something (see the commented lines).

How to insert:

First compile and insert the following routine into free space.

Fire Red:
Spoiler:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r7}
	mov r0, #0x9C @0x9C * 4 (which is what the next line does) = 0x270. Change this for the flag
	lsl r0, #0x2
	ldr r3, =(0x806E6D0 +1) @Flag Check
	bl linker
	cmp r0, #0x0
	beq end
	ldr r0, =(0x2024284)
	mov r6, #0x0
	ldr r7, =(0x2024029)
	ldrb r7, [r7]

	
loop:
	cmp r6, r7
	beq end
	mov r1, #0x64
	mul r1, r1, r6
	add r0, r0, r1
	mov r5, r0
	mov r1, #0x39
	ldr r3, =(0x803FBE8 +1)
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
	mov r0, r5
	add r6, r6, #0x1

removeHP:
	cmp r4, #0x3 @assuming you're taking away 3 HP
	bge cont
	mov r4, #0x0
	
cont:
	mov r0, r5
	mov r1, #0x39
	ldr r2, =(0x20370D0)
	strh r4, [r2]
	ldr r3, =(0x804037C)
	bl linker
	b loop
	
next:
	add r6, r6, #0x1
	b loop

end:
	pop {r0-r7}
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	beq brancher
	mov r0, r5
	ldr r1, =(0x806D600 +1)
	bx r1

brancher:
	ldr r0, =(0x806D650 +1)
	bx r0
	
linker:
	bx r3
	
.align 2


Now in a hex editor navigate to 0x6D5F6. There you will need to insert the following byte changes:
Code:
 01 4A 10 47 00 00 XX XX XX XX
Where XX XX XX is the pointer to where you inserted the above routine +1.


Emerald:
Spoiler:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r7}
	mov r0, #0x9C @0x9C * 4 (which is what the next line does) = 0x270. Change this for the flag since it's most likely not free in Emerald
	lsl r0, #0x2
	ldr r3, =(0x809D790 +1) @Flag Check
	bl linker
	cmp r0, #0x0
	beq end
	ldr r0, =(0x20244EC)
	mov r6, #0x0
	ldr r7, =(0x20244E9)
	ldrb r7, [r7]

	
loop:
	cmp r6, r7
	beq end
	mov r1, #0x64
	mul r1, r1, r6
	add r0, r0, r1
	mov r5, r0
	mov r1, #0x39
	ldr r3, =(0x806A518 +1)
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
	mov r0, r5
	add r6, r6, #0x1

removeHP:
	cmp r4, #0x3 @assuming you're taking away 3 HP
	bge cont
	mov r4, #0x0
	
cont:
	mov r0, r5
	mov r1, #0x39
	ldr r2, =(0x20375F0)
	strh r4, [r2]
	ldr r3, =(0x806ACAC)
	bl linker
	b loop
	
next:
	add r6, r6, #0x1
	b loop

end:
	pop {r0-r7}
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	beq brancher
	mov r0, r5
	ldr r1, =(0x809C8F4 +1)
	bx r1

brancher:
	ldr r0, =(0x809C92E +1) @This may actually fail the routine, needs testing
	bx r0
	
linker:
	bx r3
	
.align 2


Now in a hex editor navigate to 0x9C8EA. There you will need to insert the following byte changes:
Code:
 01 4A 10 47 00 00 XX XX XX XX
Where XX XX XX is the pointer to where you inserted the above routine +1.


Usage:

Set flag 0x270 (or the flag you customized in the routine), then the HP automatically decreases based on the amount you set in the routine every step. You can change the amount removed by reading the lines in the code which I've commented.

Note: I did not test any of these; they should work in theory even though I didn't try it personally. This routine is a modification of FBI's, and is requested by Danny. Not sure why you'd want all Pokémon to constantly lose HP per step, so I added a flag check so it's toggle-able. This also doesn't work with the previous regeneration per step routine, if you thought it would for some reason.
__________________
I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this into your signature.
The HGSS Music Patch - The BW/2 Music Patch - ASM: Switch Music Based on Seasons
Romhack.me Profile - Pokecommunity Profile - Youtube Channel

Support me at my site!
Pokémon Platinum Red and Blue
Reply With Quote
  #673   Link to this post, but load the entire thread.  
Old August 9th, 2015 (7:47 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 GoGoJJTech View Post

HP Removal per step



Intro:
Basically a routine to remove a Pokemon's HP every step. In this routine it's set to 3 per step. You may want to modify the exact amount to a percentage or something (see the commented lines).

How to insert:

First compile and insert the following routine into free space.

Fire Red:
Spoiler:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r7}
	mov r0, #0x9C @0x9C * 4 (which is what the next line does) = 0x270. Change this for the flag
	lsl r0, #0x2
	ldr r3, =(0x806E6D0 +1) @Flag Check
	bl linker
	cmp r0, #0x0
	beq end
	ldr r0, =(0x2024284)
	mov r6, #0x0
	ldr r7, =(0x2024029)
	ldrb r7, [r7]

	
loop:
	cmp r6, r7
	beq end
	mov r1, #0x64
	mul r1, r1, r6
	add r0, r0, r1
	mov r5, r0
	mov r1, #0x39
	ldr r3, =(0x803FBE8 +1)
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
	mov r0, r5
	mov r1, #0x3A
	ldr r3, =(0x803FBE8 +1)
	bl linker
	add r6, r6, #0x1
	cmp r4, r0
	beq loop

removeHP:
	sub r1, r4 #0x3 @amount to remove per step. Customize it
	cmp r1, #0x0
	bgt cont
	mov r4, #0x0
	
cont:
	mov r0, r5
	mov r1, #0x39
	ldr r2, =(0x20370D0)
	strh r4, [r2]
	ldr r3, =(0x804037C)
	bl linker
	b loop
	
next:
	add r6, r6, #0x1
	b loop

end:
	pop {r0-r7}
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	beq brancher
	mov r0, r5
	ldr r1, =(0x806D600 +1)
	bx r1

brancher:
	ldr r0, =(0x806D650 +1)
	bx r0
	
linker:
	bx r3
	
.align 2


Now in a hex editor navigate to 0x6D5F6. There you will need to insert the following byte changes:
Code:
 01 4A 10 47 00 00 XX XX XX XX
Where XX XX XX is the pointer to where you inserted the above routine +1.


Emerald:
Spoiler:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r7}
	mov r0, #0x9C @0x9C * 4 (which is what the next line does) = 0x270. Change this for the flag since it's most likely not free in Emerald
	lsl r0, #0x2
	ldr r3, =(0x809D790 +1) @Flag Check
	bl linker
	cmp r0, #0x0
	beq end
	ldr r0, =(0x20244EC)
	mov r6, #0x0
	ldr r7, =(0x20244E9)
	ldrb r7, [r7]

	
loop:
	cmp r6, r7
	beq end
	mov r1, #0x64
	mul r1, r1, r6
	add r0, r0, r1
	mov r5, r0
	mov r1, #0x39
	ldr r3, =(0x806A518 +1)
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
	mov r0, r5
	mov r1, #0x3A
	ldr r3, =(0x806A518 +1)
	bl linker
	add r6, r6, #0x1
	cmp r4, r0
	beq loop

removeHP:
	sub r1, r4 #0x3 @amount to remove per step. Customize it
	cmp r1, #0x0
	bgt cont
	mov r4, #0x0
	
cont:
	mov r0, r5
	mov r1, #0x39
	ldr r2, =(0x20375F0)
	strh r4, [r2]
	ldr r3, =(0x806ACAC)
	bl linker
	b loop
	
next:
	add r6, r6, #0x1
	b loop

end:
	pop {r0-r7}
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	beq brancher
	mov r0, r5
	ldr r1, =(0x809C8F4 +1)
	bx r1

brancher:
	ldr r0, =(0x809C92E +1) @This may actually fail the routine, needs testing
	bx r0
	
linker:
	bx r3
	
.align 2


Now in a hex editor navigate to 0x9C8EA. There you will need to insert the following byte changes:
Code:
 01 4A 10 47 00 00 XX XX XX XX
Where XX XX XX is the pointer to where you inserted the above routine +1.


Usage:

Set flag 0x270 (or the flag you customized in the routine), then the HP automatically decreases based on the amount you set in the routine every step. You can change the amount removed by reading the lines in the code which I've commented.

Note: I did not test any of these; they should work in theory even though I didn't try it personally. This routine is a modification of FBI's, and is requested by Danny. Not sure why you'd want all Pokémon to constantly lose HP per step, so I added a flag check so it's toggle-able. This also doesn't work with the previous regeneration per step routine, if you thought it would for some reason.
Uhh, the FR routine is incorrect, so I guess that means the EM routine is not working either.

To explain the gain routine a little more in detail, lets look at the parts which require changing.

Code:
	mov r1, #0x39
	ldr r3, =(0x803FBE8 +1)
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
OK, here we're checking if current HP of this Pokemon is 0x0. If it is, it's fainted so move on to the next Pokemon. So far, so good. But it's important to note that in r4 right now the Pokemon's current HP is held.


Code:
	mov r0, r5
	mov r1, #0x3A
	ldr r3, =(0x803FBE8 +1)
	bl linker
	add r6, r6, #0x1
	cmp r4, r0
	beq loop
Here we have the total HP the Pokemon has being stored in R0. Note that Total HP is not Current HP. They are very distinct. What's happening here is a check to see if Total HP == Current HP. If it is, we'll move on to the next Pokemon. This is good if the routine was to increment HP, as we can't increment the HP of a full HP Pokemon. But if you're taking away HP, the total HP doesn't matter. Instead you should check that if you take away HP, it's current HP would be negative.

Code:
removeHP:
	sub r1, r4 #0x3 @amount to remove per step. Customize it
	cmp r1, #0x0
	bgt cont
	mov r4, #0x0
Uh, the compare should not be comparing to zero. Try this:

Code:
cmp r4, #0x3 @assuming you're taking away 3 HP
bge cont
mov r4, #0x0

I thought I'd just help you out by pointing out some of the inconsistencies and the changes you'd need to make to make this work. I know you're just editing my gain HP routine, and trying to help. Good luck GoGo. :)
__________________
...
Reply With Quote
  #674   Link to this post, but load the entire thread.  
Old August 9th, 2015 (7:53 AM).
GoGoJJTech's Avatar
GoGoJJTech GoGoJJTech is offline
(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
 
Join Date: Nov 2012
Location: Earth
Age: 24
Gender: Female
Nature: Jolly
Posts: 2,475
Quote:
Originally Posted by FBI agent View Post
Uhh, the FR routine is incorrect, so I guess that means the EM routine is not working either.

To explain the gain routine a little more in detail, lets look at the parts which require changing.

Code:
	mov r1, #0x39
	ldr r3, =(0x803FBE8 +1)
	bl linker
	mov r4, r0
	cmp r4, #0x0
	beq next
OK, here we're checking if current HP of this Pokemon is 0x0. If it is, it's fainted so move on to the next Pokemon. So far, so good. But it's important to note that in r4 right now the Pokemon's current HP is held.


Code:
	mov r0, r5
	mov r1, #0x3A
	ldr r3, =(0x803FBE8 +1)
	bl linker
	add r6, r6, #0x1
	cmp r4, r0
	beq loop
Here we have the total HP the Pokemon has being stored in R0. Note that Total HP is not Current HP. They are very distinct. What's happening here is a check to see if Total HP == Current HP. If it is, we'll move on to the next Pokemon. This is good if the routine was to increment HP, as we can't increment the HP of a full HP Pokemon. But if you're taking away HP, the total HP doesn't matter. Instead you should check that if you take away HP, it's current HP would be negative.

Code:
removeHP:
	sub r1, r4 #0x3 @amount to remove per step. Customize it
	cmp r1, #0x0
	bgt cont
	mov r4, #0x0
Uh, the compare should not be comparing to zero. Try this:

Code:
cmp r4, #0x3 @assuming you're taking away 3 HP
bge cont
mov r4, #0x0

I thought I'd just help you out by pointing out some of the inconsistencies and the changes you'd need to make to make this work. I know you're just editing my gain HP routine, and trying to help. Good luck GoGo. :)
This is what I get for not testing :P
Changes added to the post
__________________
I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this into your signature.
The HGSS Music Patch - The BW/2 Music Patch - ASM: Switch Music Based on Seasons
Romhack.me Profile - Pokecommunity Profile - Youtube Channel

Support me at my site!
Pokémon Platinum Red and Blue
Reply With Quote
  #675   Link to this post, but load the entire thread.  
Old August 10th, 2015 (6:23 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 pokemontutorialTV View Post
It would be great, if i could warp via ASM in a script to a warp of my choice / to a location of my choice. I do not understand really function of this ASM snippet, because you don't say, which warp will be changed.
This particular routine changes every warp to a specific warp given by the variables. For the type of warping you describe, there are script commands which do that.
__________________
...
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

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:47 AM.