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
  #226   Link to this post, but load the entire thread.  
Old December 11th, 2014 (10:23 PM). Edited December 11th, 2014 by Joexv.
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
ok so anyone whos having the game freeze when the trainer and pokemon are sliding in when using The by turn battle addon change 0xe2e0 to 00 4D 28 47 xx xx xx 08 81 08

Also found a bug. When a Pokemon is deleted with your asm which ever was in slot 2 gets "sent out" and is hovering behind your next pokemon.
__________________
New living flesh vessel who dis?
Reply With Quote
  #227   Link to this post, but load the entire thread.  
Old December 11th, 2014 (11:29 PM).
RichterSnipes's Avatar
RichterSnipes RichterSnipes is offline
Not even a nibble...
 
Join Date: Oct 2011
Location: USA
Age: 30
Gender: Male
Nature: Modest
Posts: 507
Whoa. I've always told myself that I needed to learn ASM if I wanted to do some more crafty things while hacking. These are the kinds of things that are only possible through it! Never did I think a thread like this would exist. A compendium of tons of useful ASM routines, many of which people have been looking for for years! This is incredible! FBI agent, you are doing the work of titans.

I guess if I had to ask of one thing, it'd be this: Could changing what options do in the options menu be done via ASM? I tried changing pointers around areas that had other pointers to text used for it, but nothing seemed to change.

Quote:
Originally Posted by FBI agent View Post
This is a rather pointless feature. TM bag space is limited to I think it's limited to 43 different types of TMs in the TM bag at once. This means that if you convert TMs to the newer generation compatibility (unconsumable) you will run out of bag space. Having studied the bag for my Bag deletion/restoration routines, I can tell you that expanding the bag slots will also be a very hard task. So no, I'm not going to expand TMs, and for anyone who bothers to try, that's a wall they will end up hitting.
By this, do you mean that you cannot carry more than 43 different TMs at once? If so, I don't think that's true. I was able to hold all 50 TMs in FireRed at once (along with all the HMs, of course). There's undoubtedly some tough-to-break limit that's far below 100, but I'm confident it's not 43.
__________________
My hacks:


Reply With Quote
  #228   Link to this post, but load the entire thread.  
Old December 12th, 2014 (3:23 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
Quote:
Originally Posted by FBI agent View Post
For those hackers who like minigames, this routine will delete Pokemon who have fainted in battle. There's a few things that need to happen for this effect to occur.

1) Pokemon who die in battle must be deleted
2) Eggs are spared
3) Pokemon who die outside of battle must be deleted (Poison or another similar effect)
I have saved Pokémon from poison before, so now I shall let them die.
__________________
Reply With Quote
  #229   Link to this post, but load the entire thread.  
Old December 12th, 2014 (8:48 AM).
Urobolos Urobolos is offline
 
Join Date: Nov 2014
Posts: 15
Quote:
Originally Posted by RichterSnipes View Post
By this, do you mean that you cannot carry more than 43 different TMs at once? If so, I don't think that's true. I was able to hold all 50 TMs in FireRed at once (along with all the HMs, of course). There's undoubtedly some tough-to-break limit that's far below 100, but I'm confident it's not 43.
Is it possible to get rid of one of the Pokemon storage boxes from the PC (Say, remove Box 30) and repoint the TM Case contents there to make room for more TMs?
Reply With Quote
  #230   Link to this post, but load the entire thread.  
Old December 12th, 2014 (9:38 AM). Edited December 12th, 2014 by MrDollSteak.
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Quote:
Originally Posted by HidoranBlaze View Post
Ok, this one's for Christos, who requested this on IRC.
EDIT: And for MrDollSteak, cuz rombase. (who doesn't like new items?)

Weather Rocks

The following routines hijack the setweather commands and make them check your held item's effect byte.

First, insert this routine, and keep note of where you inserted this. This returns the held item effect byte to r0
All good Hido, but to burst your bubble just a tad, you don't need to make your own BL to get the held item effect byte. There's a routine in both Fire Red and Emerald that does it for you, and is in fact called in the game several times to do just that (storing it to r6) from there its just a matter of moving it to r0 in your own routines.

While there's nothing wrong with your implementation, running it off the game's BL may be better? Just because I believe the BL uses registers 4-6 meaning you won't need to push anything IIRC. The locations are 0x0809A924 forFire Red and 0x080D74DC for Emerald.

Anyway FBI, these are all amazing. The battle modes hack is great! Sad to see you're no longer working on a custom Day-Care, but understand completely. Your DKnot hack is useful anyway, and realistically you could just do mini hacks like that to simulate modern breeding mechanics. Roaming Pokemon sound great too! Anyway to branch that into Swarms too?
__________________
Reply With Quote
  #231   Link to this post, but load the entire thread.  
Old December 12th, 2014 (9:49 AM). Edited December 12th, 2014 by Blah.
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 RichterSnipes View Post
Whoa. I've always told myself that I needed to learn ASM if I wanted to do some more crafty things while hacking. These are the kinds of things that are only possible through it! Never did I think a thread like this would exist. A compendium of tons of useful ASM routines, many of which people have been looking for for years! This is incredible! FBI agent, you are doing the work of titans.

I guess if I had to ask of one thing, it'd be this: Could changing what options do in the options menu be done via ASM? I tried changing pointers around areas that had other pointers to text used for it, but nothing seemed to change.


By this, do you mean that you cannot carry more than 43 different TMs at once? If so, I don't think that's true. I was able to hold all 50 TMs in FireRed at once (along with all the HMs, of course). There's undoubtedly some tough-to-break limit that's far below 100, but I'm confident it's not 43.
1) The options menu does indeed require ASM. Though it's a big mess like the BRM iirc. I'll confirm later tonight, though it may not be feasible to edit it as there is a lot going on

2) Sorry it's actually 0x3D TMs in the tm bag, I was mixing up my numbers. But even that is just a little over 60.

Quote:
Originally Posted by joexv View Post
ok so anyone whos having the game freeze when the trainer and pokemon are sliding in when using The by turn battle addon change 0xe2e0 to 00 4D 28 47 xx xx xx 08 81 08

Also found a bug. When a Pokemon is deleted with your asm which ever was in slot 2 gets "sent out" and is hovering behind your next pokemon.
Thanks for the bug report. You were right about the delete Pokemon one. I've fixed that now. As for the battle by move, it's working as intended. I haven't got any bugs. The reason you're getting the trainer slide "freeze" is because you've inserted it wrong probably.

Quote:
Originally Posted by daniilS View Post
I have saved Pokémon from poison before, so now I shall let them die.
The routine only handles deaths by battle. For poison you should just call this routine everystep :3

Quote:
Originally Posted by Urobolos View Post
Is it possible to get rid of one of the Pokemon storage boxes from the PC (Say, remove Box 30) and repoint the TM Case contents there to make room for more TMs?
I couldn't tell you. I know the bag is DMA protected, and just "repointing it" isn't very feasible without a lot more research.

Quote:
Originally Posted by MrDollSteak View Post
All good Hido, but to burst your bubble just a tad, you don't need to make your own BL to get the held item effect byte. There's a routine in both Fire Red and Emerald that does it for you, and is in fact called in the game several times to do just that (storing it to r6) from there its just a matter of moving it to r0 in your own routines.

While there's nothing wrong with your implementation, running it off the game's BL may be better? Just because I believe the BL uses registers 4-6 meaning you won't need to push anything IIRC. The locations are 0x0809A924 for Fire Red and 0x080D74DC for Emerald.

Anyway FBI, these are all amazing. The battle modes hack is great! Sad to see you're no longer working on a custom Day-Care, but understand completely. Your DKnot hack is useful anyway, and realistically you could just do mini hacks like that to simulate modern breeding mechanics. Roaming Pokemon sound great too! Anyway to branch that into Swarms too?
I don't know what swarming is, but I'll read about it and get back to you :P


Mini update:
I've updated the battle modes routines to read from tables, and have updated the insertion instructions (no more video :P).

I'v also updated/fixed bugs on: getAverageLevel, RemoveFaintedPokemon, setMoves, start menu swap routines
__________________
...
Reply With Quote
  #232   Link to this post, but load the entire thread.  
Old December 12th, 2014 (12:46 PM).
RichterSnipes's Avatar
RichterSnipes RichterSnipes is offline
Not even a nibble...
 
Join Date: Oct 2011
Location: USA
Age: 30
Gender: Male
Nature: Modest
Posts: 507
Quote:
Originally Posted by FBI agent View Post
1) The options menu does indeed require ASM. Though it's a big mess like the BRM iirc. I'll confirm later tonight, though it may not be feasible to edit it as there is a lot going on
I hoped as such, I wasn't sure if it also required things beyond general ASM (besides the smaller things like scripting). If it'd need to be narrowed down, maybe using the redundant Exit option or repurposing something that isn't useful like Text Speed (lock it at fastest, slower speeds are too slow for anything. Or maybe have IT be the thing that is changed: modify it so one choice for it will skip all text with a button press) would work better. It's alright if it's too involved, I just thought that having a formal change of options would be neat. :)
Quote:
2) Sorry it's actually 0x3D TMs in the tm bag, I was mixing up my numbers. But even that is just a little over 60.
That seems more correct to me! I wouldn't have been able to pinpoint the exact amount like that, though. If people aren't able to add all the TMs they want, there's always other options like move tutors.
__________________
My hacks:


Reply With Quote
  #233   Link to this post, but load the entire thread.  
Old December 12th, 2014 (2:29 PM).
HidoranBlaze's Avatar
HidoranBlaze HidoranBlaze is offline
 
Join Date: Apr 2013
Age: 26
Gender: Male
Posts: 252
Quote:
Originally Posted by MrDollSteak View Post
All good Hido, but to burst your bubble just a tad, you don't need to make your own BL to get the held item effect byte. There's a routine in both Fire Red and Emerald that does it for you, and is in fact called in the game several times to do just that (storing it to r6) from there its just a matter of moving it to r0 in your own routines.

While there's nothing wrong with your implementation, running it off the game's BL may be better? Just because I believe the BL uses registers 4-6 meaning you won't need to push anything IIRC. The locations are 0x0809A924 forFire Red and 0x080D74DC for Emerald.

Anyway FBI, these are all amazing. The battle modes hack is great! Sad to see you're no longer working on a custom Day-Care, but understand completely. Your DKnot hack is useful anyway, and realistically you could just do mini hacks like that to simulate modern breeding mechanics. Roaming Pokemon sound great too! Anyway to branch that into Swarms too?
Ah, I didn't know that bl existed. Thanks for that. From what I'm seeing, it accepts the mon's held item ID as a parameter, and returns the held item effect byte to r0 (it'd be convenient if it got the user's held item ID itself instead of me having to give it, but oh well). I think I'll just modify my own bl a bit so that it gets the user's held item ID and does a bl to the routine you mentioned.
Reply With Quote
  #234   Link to this post, but load the entire thread.  
Old December 12th, 2014 (4:37 PM).
LocksmithArmy's Avatar
LocksmithArmy LocksmithArmy is offline
Mew!
 
Join Date: Feb 2013
Age: 34
Gender: Male
Posts: 416
Quote:
Originally Posted by FBI agent View Post

Swapping between two possible start menus


sooooo the goal was to REMOVE the save function... but it also ADDS Pokedex, and Pokemon, if they were not previously there. this is a problem, my hack wont have a pokedex (or the ability to save)

without the pokedex flag being set, the icon is useless (funny lol). maybe I could just set the actual text to nothing... if only I knew where that multi choice box was stored...
__________________
Reply With Quote
  #235   Link to this post, but load the entire thread.  
Old December 12th, 2014 (4:41 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
Quote:
Originally Posted by LocksmithArmy View Post
sooooo the goal was to REMOVE the save function... but it also ADDS Pokedex, and Pokemon, if they were not previously there. this is a problem, my hack wont have a pokedex (or the ability to save)

without the pokedex flag being set, the icon is useless (funny lol). maybe I could just set the actual text to nothing... if only I knew where that multi choice box was stored...
http://www.pokecommunity.com/showthread.php?p=8168936#8168936
__________________
Reply With Quote
  #236   Link to this post, but load the entire thread.  
Old December 12th, 2014 (5:00 PM). Edited December 12th, 2014 by LocksmithArmy.
LocksmithArmy's Avatar
LocksmithArmy LocksmithArmy is offline
Mew!
 
Join Date: Feb 2013
Age: 34
Gender: Male
Posts: 416
Quote:
Originally Posted by Dark Sneasel View Post
lol, thanks... but I already found it ;)

totally woulda saved me the 5 mins of searching in GoldFinger tho (the word pokedex shows up alot... fyi)

ive got the text repointed to a single space character for both the Pokedex and its description...

but the menu does not show the player card anymore(not that I need it)... not sure if it will when I set some flags (like the pokemon shouldnt be showing if I have never owned one) so well see how it works out
__________________
Reply With Quote
  #237   Link to this post, but load the entire thread.  
Old December 12th, 2014 (5:58 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 RichterSnipes View Post
I hoped as such, I wasn't sure if it also required things beyond general ASM (besides the smaller things like scripting). If it'd need to be narrowed down, maybe using the redundant Exit option or repurposing something that isn't useful like Text Speed (lock it at fastest, slower speeds are too slow for anything. Or maybe have IT be the thing that is changed: modify it so one choice for it will skip all text with a button press) would work better. It's alright if it's too involved, I just thought that having a formal change of options would be neat. :)

That seems more correct to me! I wouldn't have been able to pinpoint the exact amount like that, though. If people aren't able to add all the TMs they want, there's always other options like move tutors.
I'll get back to you on the Options menu...soon :P

Quote:
Originally Posted by LocksmithArmy View Post
sooooo the goal was to REMOVE the save function... but it also ADDS Pokedex, and Pokemon, if they were not previously there. this is a problem, my hack wont have a pokedex (or the ability to save)

without the pokedex flag being set, the icon is useless (funny lol). maybe I could just set the actual text to nothing... if only I knew where that multi choice box was stored...
Use this one:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
main:
	mov r0, #0x94 @flag 0x250 divided by 4 (change if you want)
	lsl r0, #0x2
	ldr r1, =(0x806E6D0 +1)
	bl linker
	cmp r0, #0x0
	bne showMine

end:
	mov r0, #0x1
	ldr r1, =(0x806ED70 +1)
	bx r1
 
showMine:
	mov r0, #0x82
	lsl r0, r0, #0x4
	add r0, r0, #0x9
	ldr r1, =(0x806E6D0 +1)
	bl linker
	cmp r0, #0x0
	beq noDex
	mov r0, #0x0
	ldr r1, =(0x806ED94 +1)
	bl linker

noDex:
	mov r0, #0x82
	lsl r0, r0, #0x4
	add r0, r0, #0x8
	ldr r1, =(0x806E6D0 +1)
	bl linker
	cmp r0, #0x0
	beq noMon
	mov r0, #0x1
	ldr r1, =(0x806ED94 +1)
	bl linker

noMon:
	mov r0, #0x2
	ldr r1, =(0x806ED94 +1)
	bl linker
	mov r0, #0x3
	ldr r1, =(0x806ED94 +1)
	bl linker
	mov r0, #0x5
	ldr r1, =(0x806ED94 +1)
	bl linker
	mov r0, #0x6
	ldr r1, =(0x806ED94 +1)
	bl linker
	pop {r0}
	bx r0
 
linker2:
	bx r0
 
linker:
	bx r1

.align 2


The routine was just to swap between two. This one here is what you're trying to do.

Quote:
Originally Posted by Dark Sneasel View Post
I don't personally recommend changing pointers around. That's a good find in terms of locations of data, but I wouldn't just simply change the pointers, as you mess up the menu quite nicely.

Quote:
Originally Posted by LocksmithArmy View Post
lol, thanks... but I already found it ;)

totally woulda saved me the 5 mins of searching in GoldFinger tho (the word pokedex shows up alot... fyi)

ive got the text repointed to a single space character for both the Pokedex and its description...

but the menu does not show the player card anymore(not that I need it)... not sure if it will when I set some flags (like the pokemon shouldnt be showing if I have never owned one) so well see how it works out
RIP. Don't use that. Use the code I gave you a few quotes up.
__________________
...
Reply With Quote
  #238   Link to this post, but load the entire thread.  
Old December 12th, 2014 (7:58 PM).
LocksmithArmy's Avatar
LocksmithArmy LocksmithArmy is offline
Mew!
 
Join Date: Feb 2013
Age: 34
Gender: Male
Posts: 416
Quote:
Originally Posted by FBI agent View Post
Use this one:
sooo funny story...

I kept getting errors when I tried to test if the pokemon menu item would appear. every time I gave the user a pokemon it would go all rainbow and freeze up... test after test after test... failure... turns out... I was using a text "'player' got the 'buffered name' from oak" and i forgot to buffer the name lol

anyway. it works perfectly thanks so much ;)
__________________
Reply With Quote
  #239   Link to this post, but load the entire thread.  
Old December 12th, 2014 (9:50 PM). Edited January 6th, 2016 by MrDollSteak.
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Toggle Run Away

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

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

Anyway here is the routine!

Fire Red


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

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

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


Once I finish porting other abilities I'll make a brand new post for the
Emerald version of this.
__________________
Reply With Quote
  #240   Link to this post, but load the entire thread.  
Old December 12th, 2014 (10:01 PM). Edited December 19th, 2014 by HidoranBlaze.
HidoranBlaze's Avatar
HidoranBlaze HidoranBlaze is offline
 
Join Date: Apr 2013
Age: 26
Gender: Male
Posts: 252
So here's something you don't see here everyday: a port to EM!

FBI's battle mode hacks are looking awesome, and it'd be a cardinal sin if EM didn't have these features.

So here, have the Battle Routine by Move. (and the deletePokemon routine)

Battle Routine by Move (EM)
Spoiler:
.text
.align 2
.thumb
.thumb_func

main:
push {r0-r4}
mov r0, #0xBF @flag to check divided by 4
lsl r0, r0, #0x2
ldr r1, =(0x809D790 +1)
bl linker
cmp r0, #0x0
beq noCrash
ldr r4, .table

loop:
ldr r1, [r4]
cmp r1, #0x0 @check table entry is null
beq noCrash
bl linker @call table routine
add r4, r4, #0x4 @get next table routine
b loop

noCrash:
pop {r0-r4}
lsr r0, r0, #0x18
mov r10, r0
lsl r1, r1, #0x10
lsr r1, r1, #0x10
ldr r2, =(0x2022D10)
ldr r0, =(0x8033BFA +1)
bx r0

linker:
bx r1


.align 2

.table:
.word 0x08XXXXXX

@ insert 00 4D 28 47 XX XX XX 08 at 08033BF0


Delete Pokemon (EM)
Spoiler:
.text
.align 2
.thumb
.thumb_func

main:
push {r0-r5, lr}
@mov r0, #0x[flag/4]
@lsl r0, r0, #0x2
@ldr r3, =(0x806E6D0 +1)
@bl linker
@cmp r0, #0x0
@beq end
ldr r0, =(0x202433A)
ldrb r0, [r0]
cmp r0, #0x0
beq realEnd
mov r5, #0x0

loop:
ldr r0, =(0x20244E9)
ldrb r4, [r0]
cmp r5, r4
beq end
ldr r0, =(0x20244EC)
mov r1, #0x64
mul r1, r1, r5 @slot
add r0, r0, r1 @address
mov r1, #0x39 @C_HP
push {r4-r5}
ldr r3, =(0x806A518 +1)
bl linker
pop {r4-r5}
cmp r0, #0x0
beq adjustSlots

skip:
add r5, r5, #0x1
b loop


adjustSlots:
cmp r5, #0x5
bge writeLastZero
mov r2, #0x5
sub r2, r2, r5
mov r0, #0x64
mul r2, r2, r0 @size
mov r1, r5
mul r1, r1, r0
ldr r0, =(0x20244EC)
add r0, r0, r1 @dest
mov r1, #0x64
add r1, r0, r1 @src
push {r4-r5}
ldr r3, =(0x806B408 +1)
bl linker
pop {r4-r5}


writeLastZero:
ldr r0, =(0x2024618)
mov r1, #0x0
mov r2, #0x64
push {r4-r5}
ldr r3, =(0x82E9434 +1)
bl linker
pop {r4-r5}

correctCounters:
ldr r0, =(0x20244E9)
ldrb r1, [r0]
sub r1, r1, #0x1
strb r1, [r0]
next:
mov r5, #0x0
b loop

end:
ldr r0, =(0x20244E9)
ldrb r0, [r0]
cmp r0, #0x0
bne realEnd
mov r0, #0x5E
lsl r0, r0, #0x4
ldr r3, =(0x809D768 +1)
bl linker
b realEnd


linker:
bx r3

realEnd:
pop {r0-r5, pc}


.align 2
Reply With Quote
  #241   Link to this post, but load the entire thread.  
Old December 13th, 2014 (1:02 AM).
Lance32497's Avatar
Lance32497 Lance32497 is offline
LanceKoijer of Pokemon_Addicts
 
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Posts: 792
A routine that changes the pokemon nature/Ability through script
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
  #242   Link to this post, but load the entire thread.  
Old December 13th, 2014 (4:12 AM).
jiangzhengwenjzw's Avatar
jiangzhengwenjzw jiangzhengwenjzw is offline
now working on katam
 
Join Date: Sep 2012
Gender: Male
Posts: 175
Although I do not know ASM, I use Ur hack "Trainer Capture toggle by Pokeball". The ball depending system works right but when I captured trainers' Pokemon the Pokemon changed into bad egg.
Another question: What should be the reversed hex pointer? If the original pointer is 0x123456, then the reversed pointer plus one should be 573412 or 754321?

If I mistake 754321 for 573412, that may be the reason why bad egg occurs.
Forgive my terrible English.
Reply With Quote
  #243   Link to this post, but load the entire thread.  
Old December 13th, 2014 (8:44 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
Like promised, here's a routine to let Pokémon die from poison in the overworld:

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

@flagcheck:
@	mov r0, #0x__ /*flag/4*/
@	lsl r0, r0, #0x2
@	ldr r3, decryptflag
@	bl jump2
@	cmp r0, #0x0
@	beq end
main:
	ldr r3, deletefaintedpokemon
	bl jump
end:
	add sp, #0x4
	pop {r4, r5, pc}
jump:
	push {r0-r5, lr}
jump2:
	mov pc, r3

.align 2
decryptflag:		.word 0x0806E6D0
deletefaintedpokemon:	.word [email protected]+0xE /*offset of FBI's routine*/

/*remove the last @ if you're using a flag check in FBI's routine.
Remove all other @s if using a flag check in this routine.*/
/*Insert anywhere. Then, at 080A04F2, type C0 46 00 4B 9F 46 XX XX XX XX,
where XXXXXXXX is an inverted pointer to this routine.*/
__________________
Reply With Quote
  #244   Link to this post, but load the entire thread.  
Old December 13th, 2014 (10:51 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 LocksmithArmy View Post
sooo funny story...

I kept getting errors when I tried to test if the pokemon menu item would appear. every time I gave the user a pokemon it would go all rainbow and freeze up... test after test after test... failure... turns out... I was using a text "'player' got the 'buffered name' from oak" and i forgot to buffer the name lol

anyway. it works perfectly thanks so much ;)
No problem.

Quote:
Originally Posted by MrDollSteak View Post
[RUN AWAY]
Once I finish porting other abilities I'll make a brand new post for the
Emerald version of this.
Good work! I'll add it to the first post.

Quote:
Originally Posted by HidoranBlaze View Post
So here's something you don't see here everyday: a port to EM!

FBI's battle mode hacks are looking awesome, and it'd be a cardinal sin if EM didn't have these features.

So here, have the Battle Routine by Move. (and the deletePokemon routine)
[ROUTINES]
eww, Emerald. I'm just joking, good work :P
I'll add it to the first post.

Quote:
Originally Posted by Lance32497 View Post
A routine that changes the pokemon nature/Ability through script
Pokemon Nature and Ability are determined by it's PID. While it is possible to change the PID to match certain properties like ability and nature, you may end up changing other things like Shinyness and gender. That's why I'm going to say no to this.

Quote:
Originally Posted by jiangzhengwenjzw View Post
Although I do not know ASM, I use Ur hack "Trainer Capture toggle by Pokeball". The ball depending system works right but when I captured trainers' Pokemon the Pokemon changed into bad egg.
Another question: What should be the reversed hex pointer? If the original pointer is 0x123456, then the reversed pointer plus one should be 573412 or 754321?

If I mistake 754321 for 573412, that may be the reason why bad egg occurs.
Forgive my terrible English.
You missed a byte change. There's one for making the trainer Pokemon capturable, and another to make it so it's not a bad egg. Look at the first post and find capturing trainer Pokemon.

Quote:
Originally Posted by daniilS View Post
Like promised, here's a routine to let Pokémon die from poison in the overworld:
[routine]
Nice work. I'll add it to the first post.


Random Natural Number Generator



There's a Random Number generator in scripting thats limited to [0, 255) results. This one is a routine that returns a random number from [0, 65535). So in some ways it's more "random" because it does have a larger domain. Well I'll let you think up of what you'll use it for. The reason I'm posting it seperately is because it does have standalone uses, AND I'll be using it for Roaming Pokemon and Swarming Pokemon. So you kinda need this for those :)

How to insert:

Simply compile into free space the following routine:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r4, lr}
	ldr r4, =(0x8044EC8 +1)@gen random number
	bl linker
	lsl r0, r0, #0x10
	lsr r0, r0, #0x10
	ldr r1, =(0x20370B8) @convert to int between 0x0 to [var 0x8000] exclusive
	ldrh r1, [r1]
	ldr r4, =(0x81E4684 +1)
	bl linker
	ldr r1, =(0x20370D0) @store in last result
	strh r0, [r1]
	pop {r4, pc}

linker:
	bx r4

.align 2


Usage:
Set variable 0x8000 to the amount of results you want in hex. It will do 0x0 to 0xFFFF exclusive. The resulting random (natural) number is placed is variable 0x8000. That's all :)


I'm going to be making a few more of these "mini-functions" because Roaming Pokemon like in the new generation has a lot of mechanics in the background which I'm implementing. Also if you're posting routines please keep it in spoiler tags :x
__________________
...
Reply With Quote
  #245   Link to this post, but load the entire thread.  
Old December 13th, 2014 (11:09 AM). Edited December 13th, 2014 by Christos.
Christos's Avatar
Christos Christos is offline
 
Join Date: Feb 2006
Gender: Male
Nature: Serious
Posts: 6,355
I love how this thread is progressing and how people are contributing their routines so I'm going to make it sticky. Everyone's contributions will be updated to the main post and organised properly. :) Keep it up!

Aaand I'm also going to move this to Research & Development now as it fits there more.
__________________

A Pokemon that is discriminated!
Support squirtle and make it everyone's favourite.
Reply With Quote
  #246   Link to this post, but load the entire thread.  
Old December 13th, 2014 (11:40 AM). Edited December 13th, 2014 by Blah.
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Shiny Pokemon



Brief-ish intro:

Spoiler:

Every time a new Pokemon is created the Game generates a new PID and sets it as the Pokemon's PID. While this is fine and dandy, the chance that this PID yields a shiny Pokemon is low. So many "shiny hacks" out there generate a PID which works and sets it.

Code:
A pokemon is shiny iff 0<= C  < 8, where C is defined by:

A = TrainerID XOR SecretID
B = PID[1st half] XOR PID[2nd half]
C = A XOR B
Other Implementations:
Spoiler:

You may know of HackMew's shiny Pokemon code. It's great in the sense that it works as intended. However, the way he implements it is less than ideal. He takes the trainer ID and secret ID, XORs them, and creates a PID (that's not random at all) and then sets the random seed. This results in Pokemon with PIDs that are very similar, I.E shiny Pokemon generated from his hack aren't going to differ by much, many will have the same IVs, natures, ect.
Anyways, HackMew still deserves some level of credit, because he made his code back when documentation is scarce :)



Well, my implementation is actually better. Here's a quick run-down:
Spoiler:

1) Take the PID (This is generated randomly and is the natural PID of the Pokemon)
2) XOR Trainer ID and Secret ID
3) Take the second half of the natural PID (keeps gender, nature and to a degree ability random)
4) Randomize C from 0-8
5) Formulate value of first half of PID given random C, random second half PID and A.


My implementation allows for a Shiny Pokemon that is actually relatively random, and I don't fiddle with the random seed. The Pokemon will have different stats, natures, abilities every time because I'm utilizing the game generated random PID and a random C. Luckily I can do that because XOR is a special function in the sense that the inverse function of XOR is XOR!


How to insert:

Before you can insert this routine you need to have inserted the Random number generating routine from before. Remember the offset which you inserted it because you're going to need to remember in a short while.

Look at the Orange text in spoiled code below. Insert inside the brackets the location of where you compiled the random number generator code. Make sure to add an 0x8 prefix. So if I compiled the random number generator at 0x743210, I'd write:
Code:
ldr r4, =(0x8743210 +1)
After you've fixed that line, compile the code and insert into free space.
Spoiler:

PID Generator:
Code:
.text
.align 2
.thumb
.thumb_func

main:
	ldr r0, =(0x20370BC) @0x8002 is shiny flag
	ldrb r0, [r0]
	cmp r0, #0xFF
	bne noCrash
	push {r4-r7}
	ldr r0, =(0x20370BC) @set back to 0x0 because users tend to be retarded
	mov r1, #0x0
	strb r1, [r0]
	bl generatePID
	mov r4, r0
	@c = A xor B; 0<= C <8; use random to determine C
	ldr r0, =(0x20370B8)
	mov r1, #0x8
	strb r1, [r0]
	ldr r4, =(OFFSET OF RANDOM)
	bl linker
	mov r3, r0
	@(TID xor SID)
	ldr r0, =(0x300500C)
	ldr r0, [r0]
	mov r1, #0xA
	add r1, r1, [email protected]
	ldrh r1,[r1]
	mov r2, #0xC
	add r0, r0, r2 @SID
	ldrh r0, [r0]
	eor r0, r0, r1 @(TID XOR SID) = A
	eor r3, r3, r0 @(C XOR A) = B
	@B = (PID[half-word] xor PID2[half-word])
	lsl r4, r4, #0x10
	lsr r4, r4, #0x10
	eor r3, r3, r4 @(PID[half-word] XOR B) = PID2
	@concatinate r4 + r3
	lsl r3, #0x10
	orr r3,r3, r4 @PID for shiny
	pop {r4-r7}
	str r3, [SP, #0x14]
	b end


noCrash:
	bl generatePID
	mov r4, r0
	b old

generatePID:
	push {r4, lr}
	ldr r4, =(0x8044EC8 +1)
	bl linker
	mov r4, r0
	ldr r3, =(0x8044EC8 +1)
	bl linkerThree
	lsl r4, r4, #0x10
	lsr r4, r4, #0x10
	lsl r0, r0, #0x10
	orr r4, r0
	mov r0, r4
	pop {r4, pc}

old:
	str r4, [SP, #0x14]

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

linker:
	bx r4

linkerThree:
	bx r3

.align 2


Now navigate to 0x3DB00 and insert the following byte changes:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer of where you compiled the PID generating routine +1.

Finally, go to 0x3DAF6 and insert the following byte changes:
Code:
00 00 02 E0
Usage:
setvar 0x8002 0xFF 'This line makes it so the next Pokemon you encounter, or are given is a shiny Pokemon with a properly generated PID. I've made it so the code sets 0xFF back to 0x0 so you don't have to disable it after. There's only an enable switch :)

Here are two Tyranitars generated with the same hack (No EVs)

__________________
...
Reply With Quote
  #247   Link to this post, but load the entire thread.  
Old December 13th, 2014 (1:03 PM).
LocksmithArmy's Avatar
LocksmithArmy LocksmithArmy is offline
Mew!
 
Join Date: Feb 2013
Age: 34
Gender: Male
Posts: 416
Quote:
Originally Posted by FBI agent View Post
setvar 0x8002 0xFF 'This line makes it so the next Pokemon you encounter, or are given is a shiny Pokemon with a properly generated PID. I've made it so the code sets 0xFF back to 0x0 so you don't have to disable it after. There's only an enable switch :)
Did you put in functionality for more than 1 pokemon.
like the shinyizer you can set it for a whole trainers belt (where some are shiny and others are not)

ive got an item I use in some hacks called shiny spray, it gives you a 50% chance of seeing a shiny pokemon for the next 3 battles (guaranteed to see 1 shiny). so in order to utilize your "better" IV seed, your routine would need to be able to read (and apply) more than 1 poke in the future.
__________________
Reply With Quote
  #248   Link to this post, but load the entire thread.  
Old December 13th, 2014 (1:50 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 LocksmithArmy View Post
Did you put in functionality for more than 1 pokemon.
like the shinyizer you can set it for a whole trainers belt (where some are shiny and others are not)

ive got an item I use in some hacks called shiny spray, it gives you a 50% chance of seeing a shiny pokemon for the next 3 battles (guaranteed to see 1 shiny). so in order to utilize your "better" IV seed, your routine would need to be able to read (and apply) more than 1 poke in the future.
No it doesn't work for trainers, only Pokemon the player encounters, or battles in a script, or is given. This routine is perfect for a single encounter, and isn't suited for opponent trainers with teams full of shiny Pokemon. For your shiny spray, I would change the item mechanics rather than the routine.
Spoiler:

Code:
compare 0x4011 0x2 'charges on item
if == jump @guaranteed 
random 0x2
compare LASTRESULT 0x0
if == jump @set
jump @used

#org @guaranteed
compare 0x4012 0x1 'atleast one guaranteed shiny
if == jump @end
jump @set

#org @set
setvar 0x8002 0xFF 'set shiny
setvar 0x4012 0x1 'guarenteed flag
addvar 0x4011 0x1 'increment charges
jump @used

#org @end
msgbox @outOfCharges 'out of spray charges
callstd MSG_NORMAL
release
end

#org @used
msgbox @applied 'The spray is applied
callstd MSG_NORMAL
release
end


Also it's not a better IV seed. It's an actually random shiny PID generator, which happens to be the determining factor for IVs :)
__________________
...
Reply With Quote
  #249   Link to this post, but load the entire thread.  
Old December 13th, 2014 (8:52 PM).
Sisyphean Sisyphean is offline
 
Join Date: Nov 2014
Location: California
Gender: Male
Nature: Bold
Posts: 16
I have had an idea for some time about creating a system where the levitate ability is not an ability but rather a toggle-able byte on each pokemon. For instance, one could feasibly create a Hydreigon with the ability intimidate that also has the benefits of levitate, (by virtue of the hack). It's always bothered me that I had to choose between giving pokemon that weren't flying-type like venomoth the ability levitate or a real ability.
__________________
Though I'm far from a pro, I try can help you on your ROM with scripting, ASM, mapping WHATEVER.

Just ask
Reply With Quote
  #250   Link to this post, but load the entire thread.  
Old December 13th, 2014 (9:57 PM).
Trainer 781
Guest
 
Posts: n/a
A suggestion.
Hey how about implementing an Ability Capsule from Gen VI which helps you to toggle between the primary and secondary abilities of a mon in the overworld.
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.