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
  #451   Link to this post, but load the entire thread.  
Old January 30th, 2015 (2:56 PM).
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
Quote:
Originally Posted by FBI agent View Post
I'm pretty sure that's how it works ingame already. The ability bit doesn't change when a Pokemon evolves in FR. 90% sure.



Yeah, that's exactly how it would be done. Though these kind of evolutions, which can happen at any time are harder to handle in game. We would have to do the checks kinda frequently. The question becomes, how frequent? Well actually not frequent at all. Just two checks in both scenarios. Pokemon reaches max happiness and Pokemon receives item. So if I was coding this I'd make two different breaks at the Happiness adder, and a second at the give item part.

Was that the information you were looking for? Or did you want me to do one for you?
Since you gave the detailed info, it is both, actually, all I know is to make it happens, we must combine Trade holding item and Happiness, and this is a request lol, since you are now accepting again, but you can use Kearnseyboy6's routines to compare, I think
__________________
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
  #452   Link to this post, but load the entire thread.  
Old February 8th, 2015 (7:32 AM).
AkimotoBubble's Avatar
AkimotoBubble AkimotoBubble is offline
 
Join Date: Aug 2014
Gender: Male
Posts: 48
oh it is great and why not have Emerald ASM code?
Reply With Quote
  #453   Link to this post, but load the entire thread.  
Old February 8th, 2015 (7:39 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 AkimotoBubble View Post
oh it is great and why not have Emerald ASM code?
FBI likes being silly so he hates Emerald :P. I do believe some routines on here are for Em though, and you can always port the others yourself.
__________________
Reply With Quote
  #454   Link to this post, but load the entire thread.  
Old February 13th, 2015 (10:04 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
I'd like to report an issue with the code pertaining to the Infinte TM Usage implementation for FireRed. If you teach a TM to a Pokémon with less than four known moves and watch the entire TM learning animation, the TM will be removed from your TM Case.

I actually would have never noticed that this happened had someone else not pointed it out to me. Everything else works wonders!
__________________
My hacks:


Reply With Quote
  #455   Link to this post, but load the entire thread.  
Old February 15th, 2015 (6:20 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 hihohilton View Post
What i mean is that say in your hack you had given bulbasaur overgrow and effect spore but you wanted a special gift one with chlorophyll well would it be possible to do that and by carried by evolution i mean if said bulbasaur was to evolve it would still have chlorophyll
I know what you're talking about, but abilities are done wierdly so they don't allow themselves to be easily changed/edited to any arbitrary ability. Abilities in FireRed are derrived from the PID and is represented by a single bit. If that bit is ON then the Pokemon gets it's second ability otherwise it gets it's first ability as defined in the Pokemon table. My ability swapper hack simply just inverses the bit, however you're restricted here. Since the ability is stored as a single bit, there is no way for us to calculate which ability to give, because it simply only has two possible states. You can't really expand this because the bit is stored in the Pokemon data structure in RAM which doesn't have very much free space. While I probably can find a little bit of space inbetween the 0x0 padding of values, these bytes are probably better used for things like a Pokerus feature.

Quote:
Originally Posted by Lance32497 View Post
I googled it so I dont know if it has been done, I have watched a youtube vid about changing player OW in FireRed but the uploader didnt give the code, could you find that out?
You'll see my version...soon.

Quote:
Originally Posted by RichterSnipes View Post
I'd like to report an issue with the code pertaining to the Infinte TM Usage implementation for FireRed. If you teach a TM to a Pokémon with less than four known moves and watch the entire TM learning animation, the TM will be removed from your TM Case.

I actually would have never noticed that this happened had someone else not pointed it out to me. Everything else works wonders!
Thanks for reporting it, I'll look into the cause!

For everyone using these routines:
If you find any bugs in anything please do report them. Make sure that the bugs are caused by the code and not insertions errors on your part though, ty.
__________________
...
Reply With Quote
  #456   Link to this post, but load the entire thread.  
Old February 15th, 2015 (6:45 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Changing the Player's Overworld ingame



Intro:

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

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

How to insert:

Compile into free space the following routine:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

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

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


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


Usage:

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

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

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

While no particular value will cause a crash, I've excluded values which are "repeated" OWs. If you experience bugs, use it in conjunction with the backsprite hack I made. If you still have bugs, report them here!
__________________
...
Reply With Quote
  #457   Link to this post, but load the entire thread.  
Old February 15th, 2015 (8:14 PM).
Sounak's Avatar
Sounak Sounak is offline
Black Charizard
 
Join Date: Oct 2014
Gender: Male
Nature: Careful
Posts: 7
Can you please describe how to make my hunger idea possible?
Reply With Quote
  #458   Link to this post, but load the entire thread.  
Old February 15th, 2015 (8:55 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 Sounak View Post
Can you please describe how to make my hunger idea possible?
I did, in your thread. It involved using some RAM to keep track of hunger levels and PID. Other than that, there's no real way to do it easily. http://www.pokecommunity.com/showpost.php?p=8619691&postcount=2
__________________
...
Reply With Quote
  #459   Link to this post, but load the entire thread.  
Old February 17th, 2015 (3:40 PM).
Edwearth's Avatar
Edwearth Edwearth is offline
 
Join Date: May 2014
Location: Paris
Gender: Male
Posts: 40
Is it possible to make an effect like Absorb, but which the percentage of recover HP can be chosen?
I have a little idea on how to do this but i think the animation will not work.
Reply With Quote
  #460   Link to this post, but load the entire thread.  
Old February 18th, 2015 (1:59 PM). Edited February 18th, 2015 by El Diabeetus.
El Diabeetus's Avatar
El Diabeetus El Diabeetus is offline
Amateur Voice Actor / ROM Editor ('Hacker')
 
Join Date: Jul 2006
Age: 29
Nature: Lonely
Posts: 1,064
Is it possible to make a different track play for a last Pokémon like the Gym Leaders in Black and White/cut the HP sound off after a few beeps like X/Y? Or if Characteristic / colored text for +/- stats due to ability?

I know I ask a lot of questions, but, these are things I wonder if it's possible to do.
__________________
Hacks I'm currently working on (at a super slow pace):

Chinpokomon Big/Small (would leave the titles, but apparently exceeded sig limit)

Check my Japanese inspired Logo edits for Gens 1-7!:
http://www.pokecommunity.com/showpost.php?p=9137003
Reply With Quote
  #461   Link to this post, but load the entire thread.  
Old February 19th, 2015 (12:21 AM).
BLAx501!'s Avatar
BLAx501! BLAx501! is offline
Pokemon Flux
 
Join Date: Oct 2013
Location: Madrid, Spain
Gender: Male
Nature: Gentle
Posts: 80
Hey FBI, it's been a looooooooong time I don't post anything here xD. Well. I've been thinking about something I couldn't solve and since I think it may be ASM-Related, I summon you :P

I was wondering if it is possible to change from one map to another (like a warp or something) and keep the music that you started playing on the previous map.
Reply With Quote
  #462   Link to this post, but load the entire thread.  
Old February 19th, 2015 (1:43 AM).
Mickey` Mickey` is offline
 
Join Date: May 2011
Posts: 88
If the music is the same on both maps, the music won't change.
Reply With Quote
  #463   Link to this post, but load the entire thread.  
Old February 19th, 2015 (4:23 AM).
BLAx501!'s Avatar
BLAx501! BLAx501! is offline
Pokemon Flux
 
Join Date: Oct 2013
Location: Madrid, Spain
Gender: Male
Nature: Gentle
Posts: 80
Quote:
Originally Posted by Mickey` View Post
If the music is the same on both maps, the music won't change.
Of course, what I was meant to say is when the maps have different songs...
Reply With Quote
  #464   Link to this post, but load the entire thread.  
Old February 19th, 2015 (7:40 AM).
metapod23's Avatar
metapod23 metapod23 is offline
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Posts: 673
I'm interested in inserting a Focus Sash that is reusable in Fire Red. What I mean by that is that the Focus Sash, rather than being consumed like berries, will stay held by the Pokémon, but will only activate if the user has all of its available HP. I don't like that it is a one use item lol. The Focus Band in Fire Red does the same thing, and you can change it so it always activates, but it would need to be changed to check the user's current HP with its current maximum HP.

I don't really care if it replaces Focus Band in the game, because I find it to be relatively useless as an item due to its unreliability.

Thanks in advance for anyone willing to help!
__________________
Reply With Quote
  #465   Link to this post, but load the entire thread.  
Old February 19th, 2015 (8:17 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 Edwearth View Post
Is it possible to make an effect like Absorb, but which the percentage of recover HP can be chosen?
I have a little idea on how to do this but i think the animation will not work.
Quote:
Originally Posted by SSJ4 Furanki View Post
Is it possible to make a different track play for a last Pokémon like the Gym Leaders in Black and White/cut the HP sound off after a few beeps like X/Y? Or if Characteristic / colored text for +/- stats due to ability?

I know I ask a lot of questions, but, these are things I wonder if it's possible to do.
Quote:
Originally Posted by metapod23 View Post
I'm interested in inserting a Focus Sash that is reusable in Fire Red. What I mean by that is that the Focus Sash, rather than being consumed like berries, will stay held by the Pokémon, but will only activate if the user has all of its available HP. I don't like that it is a one use item lol. The Focus Band in Fire Red does the same thing, and you can change it so it always activates, but it would need to be changed to check the user's current HP with its current maximum HP.

I don't really care if it replaces Focus Band in the game, because I find it to be relatively useless as an item due to its unreliability.

Thanks in advance for anyone willing to help!
Hi, I specifically don't do graphical ASM or battle related things. Hopefully someone will hop in and help you three out. I can tell you everything you've asked for in indeed doable. You just need to find someone willing :)


Quote:
Originally Posted by BLAxTOISE View Post
Hey FBI, it's been a looooooooong time I don't post anything here xD. Well. I've been thinking about something I couldn't solve and since I think it may be ASM-Related, I summon you :P

I was wondering if it is possible to change from one map to another (like a warp or something) and keep the music that you started playing on the previous map.
Hey, it is ASM related, but fairly easy to do if I'm thinking about it right. I'll look into it.

For the bug where the TM gets consumed upon use after the animation:

Insert: 00 00 00 00 at 0x124F78

I'll update my TM post with this information too.
__________________
...
Reply With Quote
  #466   Link to this post, but load the entire thread.  
Old February 19th, 2015 (12:47 PM).
El Diabeetus's Avatar
El Diabeetus El Diabeetus is offline
Amateur Voice Actor / ROM Editor ('Hacker')
 
Join Date: Jul 2006
Age: 29
Nature: Lonely
Posts: 1,064
Quote:
Originally Posted by FBI agent View Post
Hi, I specifically don't do graphical ASM or battle related things. Hopefully someone will hop in and help you three out. I can tell you everything you've asked for in indeed doable. You just need to find someone willing :)




Hey, it is ASM related, but fairly easy to do if I'm thinking about it right. I'll look into it.

For the bug where the TM gets consumed upon use after the animation:

Insert: 00 00 00 00 at 0x124F78

I'll update my TM post with this information too.
Very nice! Is it supposed to be 4 sets of 00 though? I went to that offset and they already were those numbers.
__________________
Hacks I'm currently working on (at a super slow pace):

Chinpokomon Big/Small (would leave the titles, but apparently exceeded sig limit)

Check my Japanese inspired Logo edits for Gens 1-7!:
http://www.pokecommunity.com/showpost.php?p=9137003
Reply With Quote
  #467   Link to this post, but load the entire thread.  
Old February 19th, 2015 (1:17 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 SSJ4 Furanki View Post
Very nice! Is it supposed to be 4 sets of 00 though? I went to that offset and they already were those numbers.
Yup the link to the deletion function takes 4 bytes. We null out the 4 bytes by doing lsl r0, r0, #0x0. I.e the zeros.
__________________
...
Reply With Quote
  #468   Link to this post, but load the entire thread.  
Old February 19th, 2015 (1:29 PM).
El Diabeetus's Avatar
El Diabeetus El Diabeetus is offline
Amateur Voice Actor / ROM Editor ('Hacker')
 
Join Date: Jul 2006
Age: 29
Nature: Lonely
Posts: 1,064
Quote:
Originally Posted by FBI agent View Post
Yup the link to the deletion function takes 4 bytes. We null out the 4 bytes by doing lsl r0, r0, #0x0. I.e the zeros.
Huh, alrighty. Not complaining then.
__________________
Hacks I'm currently working on (at a super slow pace):

Chinpokomon Big/Small (would leave the titles, but apparently exceeded sig limit)

Check my Japanese inspired Logo edits for Gens 1-7!:
http://www.pokecommunity.com/showpost.php?p=9137003
Reply With Quote
  #469   Link to this post, but load the entire thread.  
Old February 21st, 2015 (9:59 PM).
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
How about fixing The "Your foe's weakness" thingy after I send out my desired pokemon?

I always encounter that text string although my Pokemon isn't my foe's weakness
__________________
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
  #470   Link to this post, but load the entire thread.  
Old February 22nd, 2015 (11:15 AM). Edited February 22nd, 2015 by Dionen.
Dionen's Avatar
Dionen Dionen is offline
deprived of sleep
 
Join Date: Jun 2011
Location: Brazil
Gender: Male
Nature: Quirky
Posts: 295
Fire Red gives you one trainer card with 8 gym badges, but some hacks have more than 8 gyms/travels to different regions. Is it possible to create more than one sets of badges? and maybe changing the trainer card backdrop/tileset with it. playing as a different person, stealing badges, there are many possibilities of events with it. It can be easily done with key-items, but come on, it's not the same thing. Well, just an idea. ^_^
All badges are only in one image, so a swapping routine would deal with that, I suppose. The rest of it can be handled via scripts
__________________
Reply With Quote
  #471   Link to this post, but load the entire thread.  
Old February 22nd, 2015 (2:59 PM).
eMMe97 eMMe97 is offline
 
Join Date: Jan 2015
Posts: 51
Hello dude! (sorry for my english but i'm italian :S)
For many days (ehm...months xD) I try to create a new pokemon menù (the menù that appeared when you press "start"), to change the classical pokémon menù, and I want to change text with pictures (for example the picture of pokédex, or a ball for pokémon etc), and replace menù in the left of the game (however the upper side is ok, but the menù must be in horizontal in this case).
Can you help me please?
Reply With Quote
  #472   Link to this post, but load the entire thread.  
Old February 24th, 2015 (9:35 PM).
HungLikeATauros HungLikeATauros is offline
Banned
 
Join Date: Feb 2015
Gender: Male
Posts: 46
Quote:
Originally Posted by FBI agent View Post

Adjusting Shiny encounter chance




How to insert:

Before compiling the routine look at the last line. There is a .word 0x8[RANDOM +1]. Change the content after the 0x8 to be a pointer to where you inserted RANDOM +1.

Once you've done that, look for the line that says "mov r0, #0x1 @item ID". Change 0x1 to the Item ID for your Shiny charm item. If you don't have one implemented, delete these lines:
Code:
	mov r0, #0x1 @item ID
	mov r1, #0x1
	ldr r2, =(0x8099F40 +1)
	bl linker
	cmp r0, #0x0
	beq normal
	mov r0, #0xA
	lsl r0, r0, #0x7
	add r0, r0, #0x55 @1/1365 chance with shiny charm
	b calcChance
After you've done that, compile and insert the following routine into free space:

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func


main:
	push {r0-r3}
	mov r0, #0x1 @item ID
	mov r1, #0x1
	ldr r2, =(0x8099F40 +1)
	bl linker
	cmp r0, #0x0
	beq normal
	mov r0, #0xA
	lsl r0, r0, #0x7
	add r0, r0, #0x55 @1/1365 chance with shiny charm
	b calcChance
	
normal:
	mov r0, #0x20
	lsl r0, r0, #0x7 @1/4096 chance normally
	
calcChance:
	ldr r1, =(0x20370B8)
	strh r0, [r1]
	ldr r2, .random
	bl linker
	cmp r0, #0xFF
	bne end
	ldr r1, =(0x20370BC)
	strh r0, [r1]
	ldr r1, =(0x20370B8)
	mov r0, #0x0
	strh r0, [r1]

end:
	pop {r0-r3}
	sub SP, SP, #0x20
	mov r7, r0
	ldr r4, [SP, #0x40]
	ldr r4, [SP, #0x48]
	mov r5, #0xE
	ldr r6, =(0x803DAD8 +1)
	bx r6
	
linker:
	bx r2
	
	
.align 2

.random:
	.word 0x8[RANDOM +1]


Now navigate to 0x3DACE and insert the following byte changes:
Code:
00 00 00 4F 38 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer +1 to where you inserted this routine.


Usage:

It's Automagic, also happens to give the shiny chance to Pokemon in wild, trainer Pokemon, given Pokemon ect.

Right now encounter chance is 1/4096 without shiny charm, and 1/1356 with it.
Figured I'd ask you in the thread instead of on your profile. I've got the two prerequisites inserted but I can't seem to get this code to compile. I'm getting this error message every time:
Quote:
ShinyCharm.asm: 9 : Error: invalid immediate: 279 is out of range
This is my script:
Spoiler:
.text
.align 2
.thumb
.thumb_func


main:
push {r0-r3}
mov r0, #0x117 @item ID
mov r1, #0x1
ldr r2, =(0x8099F40 +1)
bl linker
cmp r0, #0x0
beq normal
mov r0, #0xA
lsl r0, r0, #0x7
add r0, r0, #0x55 @1/1365 chance with shiny charm
b calcChance

normal:
mov r0, #0x20
lsl r0, r0, #0x7 @1/4096 chance normally

calcChance:
ldr r1, =(0x20370B8)
strh r0, [r1]
ldr r2, .random
bl linker
cmp r0, #0xFF
bne end
ldr r1, =(0x20370BC)
strh r0, [r1]
ldr r1, =(0x20370B8)
mov r0, #0x0
strh r0, [r1]

end:
pop {r0-r3}
sub SP, SP, #0x20
mov r7, r0
ldr r4, [SP, #0x40]
ldr r4, [SP, #0x48]
mov r5, #0xE
ldr r6, =(0x803DAD8 +1)
bx r6

linker:
bx r2


.align 2

.random:
.word 0x874B7A4 +1


Any idea why?
Reply With Quote
  #473   Link to this post, but load the entire thread.  
Old February 24th, 2015 (9:56 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 HungLikeATauros View Post
Figured I'd ask you in the thread instead of on your profile. I've got the two prerequisites inserted but I can't seem to get this code to compile. I'm getting this error message every time:


This is my script:
Spoiler:
.text
.align 2
.thumb
.thumb_func


main:
push {r0-r3}
mov r0, #0x117 @item ID
mov r1, #0x1
ldr r2, =(0x8099F40 +1)
bl linker
cmp r0, #0x0
beq normal
mov r0, #0xA
lsl r0, r0, #0x7
add r0, r0, #0x55 @1/1365 chance with shiny charm
b calcChance

normal:
mov r0, #0x20
lsl r0, r0, #0x7 @1/4096 chance normally

calcChance:
ldr r1, =(0x20370B8)
strh r0, [r1]
ldr r2, .random
bl linker
cmp r0, #0xFF
bne end
ldr r1, =(0x20370BC)
strh r0, [r1]
ldr r1, =(0x20370B8)
mov r0, #0x0
strh r0, [r1]

end:
pop {r0-r3}
sub SP, SP, #0x20
mov r7, r0
ldr r4, [SP, #0x40]
ldr r4, [SP, #0x48]
mov r5, #0xE
ldr r6, =(0x803DAD8 +1)
bx r6

linker:
bx r2


.align 2

.random:
.word 0x874B7A4 +1


Any idea why?
mov r0, #0x117 @item ID

Mov can only load upto 0xFF. From there you need to derrive the number. Take a look at my second beginner tutorial to see how that problem is fixed. Here's the solution:

Code:
mov r0, #0xFF
add r0, #0x18
__________________
...
Reply With Quote
  #474   Link to this post, but load the entire thread.  
Old February 24th, 2015 (11:46 PM).
HungLikeATauros HungLikeATauros is offline
Banned
 
Join Date: Feb 2015
Gender: Male
Posts: 46
Quote:
Originally Posted by FBI agent View Post
mov r0, #0x117 @item ID

Mov can only load upto 0xFF. From there you need to derrive the number. Take a look at my second beginner tutorial to see how that problem is fixed. Here's the solution:

Code:
mov r0, #0xFF
add r0, #0x18
So replace the item ID line with those two lines, correct? I did that and I'm not encountering any shinys after running around for over an hour with the item. For testing purposes I changed it to a 1/1 chance and I'm still not finding any.
Reply With Quote
  #475   Link to this post, but load the entire thread.  
Old February 25th, 2015 (5:37 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 HungLikeATauros View Post
So replace the item ID line with those two lines, correct? I did that and I'm not encountering any shinys after running around for over an hour with the item. For testing purposes I changed it to a 1/1 chance and I'm still not finding any.
You need the random number routine and the shiny generator routine I made. The three of them work in conjunction to make this effect happen. I know it works, because my test ROM is only shinies :x
__________________
...
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:46 AM.