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
  #376   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (2:15 AM).
Shiny Quagsire's Avatar
Shiny Quagsire Shiny Quagsire is offline
I'm Still Alive, Elsewhere
 
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 25
Gender: Male
Nature: Jolly
Posts: 697
Quote:
Originally Posted by Smeargle View Post
I love the all asm everyone on this topic has created for the community,
That being said, with permission, I am going to take it one small step further to make some of the more complicated asm into fully compatible patches; just for those of you out there who see these features, love them to bits, but can't work a hex editor to save your soul. ;P

Anyways, I was just going to go down the line of codes and patch them but I think it may be better to ask what you guys want as patches.
I'd like to also be careful I don't derail this thread by turning it into a patch request section, so if you do have one you would like send me a vm or pm so we can keep things organised here.

Furthermore, all future patches will be placed onto this post here, along with notes containing the locations of all the routines inside the rom.
I feel like the only issue with patches is that they don't adjust well to existing ROMs. If you patch the ROM with the routine at 800000, then it could mess up someone else's hack by causing existing data to be overwritten. It would actually be kinda interesting (and maybe worthwhile as a personal project) to have a patcher which adjusts properly to different offsets and freespace, ie it could contain the binary data for the routine and a list of offsets to modify, and then just relocate the data as needed.
__________________



Reply With Quote
  #377   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (3:55 AM).
Percy's Avatar
Percy Percy is offline
 
Join Date: Sep 2014
Location: Asia
Gender: Male
Nature: Quiet
Posts: 3,045
Quote:
Originally Posted by Smeargle View Post
I love the all asm everyone on this topic has created for the community,
That being said, with permission, I am going to take it one small step further to make some of the more complicated asm into fully compatible patches; just for those of you out there who see these features, love them to bits, but can't work a hex editor to save your soul. ;P

Anyways, I was just going to go down the line of codes and patch them but I think it may be better to ask what you guys want as patches.
I'd like to also be careful I don't derail this thread by turning it into a patch request section, so if you do have one you would like send me a vm or pm so we can keep things organised here.

Furthermore, all future patches will be placed onto this post here, along with notes containing the locations of all the routines inside the rom.
Patches would be incredible to some FireRed hackers out there. And if you can do the find free space thing Shiny Quagsire was talking about, its gonna be legendary.
__________________
i don't want to have a signature
Reply With Quote
  #378   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (7:22 AM). Edited December 23rd, 2014 by Smeargle.
Smeargle's Avatar
Smeargle Smeargle is offline
Illusory
 
Join Date: Nov 2012
Location: In the fabric of life
Gender: Other
Nature: Timid
Posts: 160
Quote:
Originally Posted by Shiny Quagsire View Post
I feel like the only issue with patches is that they don't adjust well to existing ROMs. If you patch the ROM with the routine at 800000, then it could mess up someone else's hack by causing existing data to be overwritten. It would actually be kinda interesting (and maybe worthwhile as a personal project) to have a patcher which adjusts properly to different offsets and freespace, ie it could contain the binary data for the routine and a list of offsets to modify, and then just relocate the data as needed.
That's a really good idea, I've already written down areas of free space compatible with Jpan and Mrsteakdolls Rom-bases so I will definitely get looking into a more organized way of using these patches. Compatibility is my main concern with these patches, I had already made plans to make them modular as best I could.

I totally agree though, it's about time patches got more love.
Once I get a bit of planning done, I will look to collaborate with someone around the forum who can make a tool.
The idea now, based off what you've said, is to create a table of offsets leading to the actual routines which the program would locate the space for. However if I cannot get assistance from anyone with knowledge I will work my best to replicate a system using data near the end of the 16mb rom (ie. 80EB0000+) and one for a 32mb rom.
The new idea would be an easy way to add and remove patches, like a mod system. The program would look at the table of offsets, were you could then have the choice to delete, add, or edit. I understand some routines require hooks into vanilla stuff, but I imagine someone with programming skills can have it save a backup of all edits made in case deletion is required.

I actually think I may make a new thread on this, this will get more attention that way. But before I do I will make some form of a mockup.
Reply With Quote
  #379   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (1:39 PM).
LocksmithArmy's Avatar
LocksmithArmy LocksmithArmy is offline
Mew!
 
Join Date: Feb 2013
Age: 34
Gender: Male
Posts: 416
I agree patches are a bad idea... a tool is a far better idea... maybe someone should get on that... hrmm that locksmitharmy guy might be tempted to make one. ;)

Im just worried about how adjustible they should be. I could make a tool that is expandible to add more stuff later...

What would we call it... the "awesome asm adder tool"?
__________________
Reply With Quote
  #380   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (4:59 PM).
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
While it seems pretty obvious most people are against a patch, I'd also like to say that I think that a patch would be a bad idea. It gets rid of the whole customisation aspect, as well as having quite a few logistical issues to work.

Quote:
Originally Posted by LocksmithArmy View Post
I agree patches are a bad idea... a tool is a far better idea... maybe someone should get on that... hrmm that locksmitharmy guy might be tempted to make one. ;)

Im just worried about how adjustible they should be. I could make a tool that is expandible to add more stuff later...

What would we call it... the "awesome asm adder tool"?
What about naming it something to do with FBI, such as FBI's Babies Inserter. Something like that.
(Babies cause y'know these routines are his babies).
__________________
Reply With Quote
  #381   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (6:38 PM).
Tlachtli's Avatar
Tlachtli Tlachtli is offline
Crit happens.
 
Join Date: Jan 2012
Location: Faraway place
Age: 32
Gender: Male
Nature: Lax
Posts: 267
Quote:
Originally Posted by FBI agent View Post

Check Pokemon Gender



This is a simple routine to check a certain Pokemon in your party's gender given a slot number.

[...]
This is really great! I've been trying forever to figure out how to implement Rivalry in my little project, and this may have just helped me crack it. It shouldn't take much to modify it to read values in-battle ^^

(If I do get it working in-battle I'll be sure to credit you for it)
__________________
Pokemon Sigma Σmerald:
(now under management by DraconianWing)

A Gen 3 remake de-make, featuring many new encounters and Gen VI mechanics

Reply With Quote
  #382   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (8:45 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
Tool is better than patch, but its not bad to make a patch for it. The disadvantages are it might overwrite the datas that are already consumed and it may cause a bug for edited rom. Tool is much better, it allows us to use free spaces.
Well, Im looking forward for tht kind of tool, FBIs awesome projects conpiler(FAPC), or Advance FBI Routines inserter(AFRI)
Lelz, just kidding
__________________
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
  #383   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (10:05 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 Smeargle View Post
I can't believe my little scheme worked{D:}
Jokes aside glad to hear you accepted the request, I look forward to seeing what you do with it :)

Thank you, It's like a Christmas present... Kinda x3
:)

Quote:
Originally Posted by Ephraim225 View Post
-stuffs-
And my request is an ASM code to Check the number of ribbons a Pokemon has from a particular contest. I'm not sure if Emerald has anything like Special 0x9F from Fire Red so if the code is only able to read the first Pokemon in the party I'm okay with that as I can check a Pokemon's ribbons from a particular contest and have that be output to LASTRESULT or something. I could probably do this on my own actually, but, I don't know where the game stores ribbon data, unfortunately.

Yes, I am a contest nut.
Err, this is unfortunate, but I don't hack Emerald. Before the thread was stickied it was practically only me writing the routines (so I had a few personal rules one which included that I only work on FireRed). These mini-rules were removed at the assumption that other ASM hackers would be able to fill in and do requests from other ROM bases. So I'm afraid I will have to personally reject your request for a ribbon counter, however, maybe someone else can help you :)

Quote:
Originally Posted by Knight of Duty View Post
And the minute checker routine can execute scripts? Ie. I loaded my scripts location in r0 and branch(exchange) to r0? Is it possible?
You need to make a routine which runs scripts. Then call that routine in Minute Routines to have the script run every minute.

Quote:
Originally Posted by Dark Sneasel View Post
A bit late, but actually, the gender of a Pokemon is determined by the "trainer gender" if and only if the Pokemon has a 50-50 gender. Other than that, it goes to the one that has a higher chance, like for example, a trainer's Torchic will always be male unless edited.
Thanks

Quote:
Originally Posted by Mystery Man View Post
Thank you so much for all of your work. So many conveniences we can easily add to our hacks! Really, thank you!

I do have some requests, mostly for those who seek to make battle facilities (i.e. tournaments) and the like into their hacks.
…The ability to turn off experience gain upon setting a flag (and on upon clearing it). This could also work well with the set level routine you’ve made, especially in parts where the team is temporarily set to a level to match the opponents (to avoid having the slightest advantage over them (gaining a level during the fight.))
…The ability to change battle styles (Shift, Set) via script. The battle style in battle facilities is always Set. In addition to that, this can be useful to people who want to make the important fights in their hack more challenging and perhaps "fairer" -- by eliminating that one huge advantage the player has over the opponent temporarily.
…Givepokemon with custom attacks. Like Extremespeed Dratini in Crystal and event Pokémon.
Hi, I'll look into some of these. Though I'm not a fan of battle routines :X

Quote:
Originally Posted by Volt-Ikazuchi View Post
How about some requests to actually break some trainers?

Can you add a battle mode like Battle Frontier battles? (You can't use items, battle is turned to set, you don't get XP during the battle.)
Let's say you use this battle style for certain trainers like Gym Leaders and Rivals. It would ramp up the difficulty of a hack without needing for some crazy stuff like giving Brock a lv.100 Diancie for the player's first gym battle.

Another suggestion I think that it would be interesting is expanded trainer sight.
For example, a trainer can spot you from a wider range (I always thought it was weird seeing the player at a diagonal spot close to the trainer and the trainer not even noticing.

How about a player detection system? Let's say the player is captured by team rocket.
The player needs to get out of the rocket base and there are no allied pokémon or cardboard boxes, so he needs to avoid the grunts patrolling. If he gets caught, he gets locked in again. That would be interesting to use with the expanded trainer sight I mentioned earlier.

A NPC that explicitly tells a pokémon's current IV and EV spread would be cool too, but I don't know if that can be done just with scripting.

Another NPC that tells what moves a pokémon can learn via level-up would be very useful too, since most hacks mess up with movepools, and since most hackers don't post their movepool changes the players are often left in the dark. And that's terrible.

And just some personal curiosity here. Is there a limit to how many Move Tutors you can have in the game?
Edit: More random curiosity. Since apparently there's no simple tool to edit some move effects of MrDollSteak's Rom Base, could you explain how I can edit the moves manually? I wanted to get more moves boosted by Mega Launcher, but I really have no idea on how to do that. Since it could require ASM, I figured that you might know something.

Good luck with your hack. Considering how much you've done just in this thread, I know that it's something to look forward to.
I'll look into battle frontier like battles. For the can't use items one, you can use the temporary bag deletion and delete the bag and restore it later. EXP during battles and set mode battling will be something I'll look into.


Quote:
Originally Posted by Shiny Quagsire View Post
I feel like the only issue with patches is that they don't adjust well to existing ROMs. If you patch the ROM with the routine at 800000, then it could mess up someone else's hack by causing existing data to be overwritten. It would actually be kinda interesting (and maybe worthwhile as a personal project) to have a patcher which adjusts properly to different offsets and freespace, ie it could contain the binary data for the routine and a list of offsets to modify, and then just relocate the data as needed.
Finish wizard d/n patch first please :D


Quote:
Originally Posted by Smeargle View Post
That's a really good idea, I've already written down areas of free space compatible with Jpan and Mrsteakdolls Rom-bases so I will definitely get looking into a more organized way of using these patches. Compatibility is my main concern with these patches, I had already made plans to make them modular as best I could.

I totally agree though, it's about time patches got more love.
Once I get a bit of planning done, I will look to collaborate with someone around the forum who can make a tool.
The idea now, based off what you've said, is to create a table of offsets leading to the actual routines which the program would locate the space for. However if I cannot get assistance from anyone with knowledge I will work my best to replicate a system using data near the end of the 16mb rom (ie. 80EB0000+) and one for a 32mb rom.
The new idea would be an easy way to add and remove patches, like a mod system. The program would look at the table of offsets, were you could then have the choice to delete, add, or edit. I understand some routines require hooks into vanilla stuff, but I imagine someone with programming skills can have it save a backup of all edits made in case deletion is required.

I actually think I may make a new thread on this, this will get more attention that way. But before I do I will make some form of a mockup.
The patching problem isn't as simple to solve as it may seem. Some of the routines require editing before being compiled, some of them use custom-sizable tables and the largest problem of all is that I note certain things in the comments about limiters in the routines. Those limiters for the most part are things which most people may find interest in changing.

Quote:
Originally Posted by LocksmithArmy View Post
I agree patches are a bad idea... a tool is a far better idea... maybe someone should get on that... hrmm that locksmitharmy guy might be tempted to make one. ;)

Im just worried about how adjustible they should be. I could make a tool that is expandible to add more stuff later...

What would we call it... the "awesome asm adder tool"?
Call it... ASMAGIX Inserter. Nvm, I was never good with names :P

Quote:
Originally Posted by MrDollSteak View Post
While it seems pretty obvious most people are against a patch, I'd also like to say that I think that a patch would be a bad idea. It gets rid of the whole customisation aspect, as well as having quite a few logistical issues to work.



What about naming it something to do with FBI, such as FBI's Babies Inserter. Something like that.
(Babies cause y'know these routines are his babies).
pls no. That's just embarrassing lol.

Quote:
Originally Posted by Tlachtli View Post
This is really great! I've been trying forever to figure out how to implement Rivalry in my little project, and this may have just helped me crack it. It shouldn't take much to modify it to read values in-battle ^^

(If I do get it working in-battle I'll be sure to credit you for it)
I'm glad to hear it!


On a side note:
Do we really need patches/tools for insertion? I think I've made the insertion instructions rather simple and honestly the most complicated thing in the process is knowing how to reverse hex a pointer and then add 1 to it :X
Well, I don't really mind if people make tools/patches. These routines are for public use, and can be used/modified in whatever way you wish.

On a more side side note:
Recently I've been working on chain fishing. FireRed's super rod Fishing Routines are actually rather limited. They don't support the suction cups or stick hold abilities, they don't cancel the fishing sequence if you hit A early and they don't let the Pokemon get away if you press A too late either. Anyways, I've got the chain fishing part and abilities working. For the pressing A too early and pressing A too late, I made my own routines for detecting key presses and such, everything works fine, but the game freezes afterwards. I'm not sure why that's happening, nor do I really want to investigate longer than the 3 days-ish I have been. I think I'm going to just post what I have, and maybe if I find myself with some extra time I'll add to it later.
__________________
...
Reply With Quote
  #384   Link to this post, but load the entire thread.  
Old December 23rd, 2014 (11:08 PM). Edited December 26th, 2014 by Blah.
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Chain Fishing



This is a semi-complete port of the ORAS chain fishing feature onto FireRed. There are a few pre-requisite routines that you need to insert first as well, so make sure you've inserted those.

Prerequisites:
Random Number Generator
Shiny Generator



Reset Chain if fishing spot changes



This is simply a routine that's run every step. Every time you take a step it sets variable 0x8002 to 0x0. This is completely save unless you're using 0x8002 for something long term (which you shouldn't because it IS a temporary variable).

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

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r1}
	ldr r0, =(0x20370BC)
	mov r1, #0x0
	strb r1,[r0]
	pop {r0-r1}

end:
	lsl r0, r0, #0x18
	lsr r0, r0, #0x18
	cmp r0, #0x1
	beq linker
	mov r0, r5
	ldr r1, =(0x806D600 +1)
	bx r1

linker:
	ldr r0, =(0x806D650 +1)
	bx r0
	
	
.align 2
Here's a compiled version:
Code:
03 B4 06 48 00 21 01 70 03 BC 00 06 00 0E 01 28 02 D0 28 1C 02 49 08 47 02 48 00 47 BC 70 03 02 01 D6 06 08 51 D6 06 08


Now navigate to 0x6D5F6 and insert the following byte changes:
Code:
01 4A 10 47 00 00 XX XX XX 08
Where XX XX XX is where you inserted this routine +1.

Usage:
The routine is run automatically once a step is taken (i.e tile displacement occurs)


Ability Number getter



Very simply, just gets the abilityID of the first Pokemon in your party.

How to insert:

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

Code:
.text
.align 2
.thumb
.thumb_func


main:
	push {r0-r4, lr}
	ldr r0, =(0x2024284)
	mov r1, #0xB
	ldr r3, =(0x803FBE8 +1) @get species
	bl linker

getSpeciesBaseStats:
	ldr r2, .BaseStatTable
	mov r1, #0x1C
	mul r1, r1, r0 
	add r2, r2, r1 @base stats table for species

checkAbility:
	mov r0, r4 @slot
	mov r4, r2 @save base stats table for species
	mov r1, #0x2E
	ldr r3, =(0x803FBE8 +1) @get ability bit of Pokemon in slot specified by 0x8004
	bl linker

getAbility:
	add r0, r0, #0x16 @first ability location + ability bit = ability number
	add r4, r4, r0 @this is the ability number
	ldrb r1, [r4]
	cmp r1, #0x0
	bne setReturn
	
firstAbility:
	sub r4, r4, #0x1
	
setReturn:
	ldr r1, =(0x20370B8)
	ldrb r4, [r4]
	strb r4, [r1]

end:
	pop {r0-r4, pc}
	

linker:
	bx r3

.align 2

.BaseStatTable:
	.word 0x8254784

.AbilityNames:
	.word 0x824FC40


Usage:
This one is a standalone routine actually. It will store into variable 0x8000 the ID number of the ability of your first Pokemon. It becomes needed for Sticky Hold and Suction Cups later!



Fixing the Suction cup/Sticky Hold abilities



This routine just takes into account suction cups and stick hold for the fishing rod routines. It is also expandable, so you can add your own things to increase catch rate. If you have questions about that feel free to ask later (I'm a little lazy to type out everything :D).

How to insert:

You need to have inserted the Random Number Generating routine and the ability number routine before you can continue and insert the main one. Once you've done that, look at the last line in the following routine and replace the ".word 0x8[OFFSET +1]" with the pointer to the RNG routine (not in reverse hex). Finally there's an all caps comment. It requires you to set the pointer there to the ability ID routine from before.

After that compile and insert into free space:

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func


main:
	mov r1, #0x8
	ldrsh r0, [r4, r1]
	lsl r0, r0, #0x2
	add r0, r0, r5
	ldr r1, [r0]
	
change:
	ldr r0, =(0x805D7C0 +1)
	cmp r0, r1
	bne normal
	
reset:
	ldr r1, =(0x8[OFFSET +1]) @ABILITY ID ROUTINE FIX POINTER PLEASE
	bl linker
	ldr r1, =(0x20370B8)
	ldrb r0, [r1]
	cmp r0, #0x15
	beq higherCatchChance
	cmp r0, #0x3C
	bne noCatch
	
higherCatchChance:
	mov r0, #0x2
	str r0, [r1]
	push {r2-r3}
	ldr r1, .random
	bl linker
	pop {r2-r3}
	cmp r0, #0x1
	beq reFish
	
noCatch:
	ldr r1, =(0x805D7C0 +1)
	b normal
	
reFish:
	ldr r1, =(0x805D5EC +1)
	
normal:
	ldr r0, =(0x805D320 +1)
	bx r0
	
	
linker:
	bx r1
	
linkerTwo:
	bx r2

.align 2

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


Finally, navigate to 0x5D316 and insert the following byte changes:
Code:
00 00 00 49 08 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted this routine +1.

Usage:
It's automated. There isn't a usage :)



Increment Counter on Successful Chain



It simply increments 0x8002 by one if a Pokemon is hooked.

How to insert:

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

Code:
.text
.align 2
.thumb
.thumb_func
 
main:
	push {r0-r3}
	ldr r0, =(0x20370BC)
	ldrb r1, [r0]
	add r1, r1, #0x1
	strb r1, [r0]
	pop {r0-r3}
	sub SP, SP, #0x10
	mov r4, r0
	ldr r0, =(0x2037078)
	ldrb r1, [r0, #0x4]
	lsl r0, r1, #0x4
	add r0, r0, r1
	lsl r0, r0, #0x2
	ldr r1, =(0x805D67C +1)
	bx r1
	
linker:
	bx r2
 
.align 2
Here is a compiled version:
Code:
0F B4 07 48 01 78 01 31 01 70 0F BC 84 B0 04 1C 04 48 01 79 08 01 40 18 80 00 03 49 08 47 10 47 BC 70 03 02 78 70 03 02 7D D6 05 08


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

Usage:
The increments are automated...actually everything here will be automated. I'm just keeping this section here for consistency :)



Increased Shiny Encounter Chance



This feature isn't very documented at all. There's no numbers on it in any site I've tried, so I just kinda made up my own algorithm to create an increased chance-based shiny encounter with the amount of successful chains greatly swaying the chances. I'll explain how all the math comes together in a later section.

How to insert:

Before inserting this routine you need to have inserted my RNG routine from the prerequisites section. Once you've done that change the last line of this routine to match where you inserted the RNG routine (not reversed). After that, you can compile and insert into free space.

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func


main:
	@make sure boolean is not set. if it is, clear chain
	push {r0-r5}
	ldr r0, =(0x20370BC)
	ldrb r0, [r0]
	mov r1, #0x2
	ldr r5, =(0x81E4684 + 1)
	bl linker
	cmp r0, #0x1
	beq resetChain
	ldr r0, =(0x20370B8)
	mov r1, #0xFF
	lsl r1, r1, #0x8
	add r1, r1, #0xFF
	strh r1, [r0]
	ldr r5, .random
	bl linker
	ldr r1, =(0x20370BC)
	ldrb r1, [r1]
	lsl r1, r1, #0x7
	cmp r0, r1
	ble setShiny
	pop {r0-r5}
	b fishing_start
	
setShiny:
	ldr r0, =(0x20370BC)
	mov r1,#0xFE
	strb r1, [r0]
	pop {r0-r5}
	b fishing_start
	
resetChain:
	ldr r0, =(0x20370BC)
	mov r1, #0x0
	strb r1, [r0]
	pop {r0-r5}

fishing_start:
	mov r4, r0
	lsl r4, r4, #0x18
	lsr r4, r4, #0x18
	ldr r5, =(0x805D304 +1)
	mov r0, r5
	ldr r1, =(0x805D2CC +1)
	bx r1
	
	
linker:
	bx r5

.align 2

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


Finally, navigate to 0x5D2C2 and insert the following byte changes:
Code:
00 00 00 4D 28 47 XX XX XX 08

Usage:
None, it's automated every time you use your rod.



Explanation of Functionality



First of all, a successful chain is defined as every time the player hooks a Pokemon.

The chain counter starts at 0 and is increased by 0x1 once the Rod is used and again by 0x1 once a Pokemon is hooked. This means chainCounter%2 != 1 is a successful chain. Everytime the Rod is used this calculation is confirmed, and the chain counter is reset if the condition isn't matched.

How big of a margin does the chainCounter affect shiny encounters?

32640/65535 = approx 50% chance at max chains
The numerator starts at 0, and increases to by 128 per successful chain.

I've also done a little "pity" thing for the unlucky souls like me out there. Basically after 255 successful chains, you're guaranteed a shiny. The chance of this occurring is:
Sum of (i=0 to 255) {PR(x = (128 * i)/ 65535) : [rand (y = 65535) && y < 128 * i] } ; currentSum < 1

It's very very unlikely unless your the bad luck god like myself. Also, you'll have to forgive my dirty notation.

Happy Fishing :D
__________________
...
Reply With Quote
  #385   Link to this post, but load the entire thread.  
Old December 24th, 2014 (12:39 AM).
Volt-Ikazuchi's Avatar
Volt-Ikazuchi Volt-Ikazuchi is offline
 
Join Date: Dec 2013
Gender: Male
Posts: 33
Quote:
Originally Posted by FBI agent View Post
:)
Hi, I'll look into some of these. Though I'm not a fan of battle routines :X



I'll look into battle frontier like battles. For the can't use items one, you can use the temporary bag deletion and delete the bag and restore it later. EXP during battles and set mode battling will be something I'll look into.

Call it... ASMAGIX Inserter. Nvm, I was never good with names :P
Nice. It's going to be fun to see hacks where trainers can't overlevel or bribe their way to victory via healing item spam. Thanks for the hard work.
Now if we could block saving in certain areas like the Elite 4 rooms...

I vote for ASMAGIX Inserter. Despite the fact that I'm terrible with naming too.
Reply With Quote
  #386   Link to this post, but load the entire thread.  
Old December 24th, 2014 (1:02 AM).
klingt klingt is offline
Living Poetry
 
Join Date: Dec 2014
Gender: Male
Posts: 13
I'm looking for a way to turn multichoice scrollable and have 102 entries to make a standings list of sorts in FR
__________________
The experienced are the dead, collapsed in their heaps
The beyond is ahead and you can only hope to catch a glimpse
You peer into the fabric mirage
There is no form, no color
A new scene without compare nor equal
Reply With Quote
  #387   Link to this post, but load the entire thread.  
Old December 24th, 2014 (10:32 AM).
LocksmithArmy's Avatar
LocksmithArmy LocksmithArmy is offline
Mew!
 
Join Date: Feb 2013
Age: 34
Gender: Male
Posts: 416
I like ASMAGIX lol ...

Ill have to work on it in segments since there is sooo much here.
__________________
Reply With Quote
  #388   Link to this post, but load the entire thread.  
Old December 24th, 2014 (10:35 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
Quote:
Originally Posted by LocksmithArmy View Post
I like ASMAGIX lol ...

Ill have to work on it in segments since there is sooo much here.
I could help you out with it. I've finally got your class working so we could each do a chunk and then share code and merge.
__________________
New living flesh vessel who dis?
Reply With Quote
  #389   Link to this post, but load the entire thread.  
Old December 24th, 2014 (11:56 AM).
LocksmithArmy's Avatar
LocksmithArmy LocksmithArmy is offline
Mew!
 
Join Date: Feb 2013
Age: 34
Gender: Male
Posts: 416
Quote:
Originally Posted by joexv View Post
I could help you out with it. I've finally got your class working so we could each do a chunk and then share code and merge.
Let me get the main selector area finished and well split up how the asm insertions will work ok. Ill put it on git hub.
__________________
Reply With Quote
  #390   Link to this post, but load the entire thread.  
Old December 25th, 2014 (1:43 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 Volt-Ikazuchi View Post
Nice. It's going to be fun to see hacks where trainers can't overlevel or bribe their way to victory via healing item spam. Thanks for the hard work.
Now if we could block saving in certain areas like the Elite 4 rooms...

I vote for ASMAGIX Inserter. Despite the fact that I'm terrible with naming too.
I made a routine to remove the save option from the start menu temporarily and restore it afterwards. Take a look at that.

Quote:
Originally Posted by klingt View Post
I'm looking for a way to turn multichoice scrollable and have 102 entries to make a standings list of sorts in FR
I'm afraid you're late to the party, I'm not taking anymore requests right now. Though this could be quite interesting to have, so hopefully someone else will help you.

Quote:
Originally Posted by joexv View Post
I could help you out with it. I've finally got your class working so we could each do a chunk and then share code and merge.
Quote:
Originally Posted by LocksmithArmy View Post
Let me get the main selector area finished and well split up how the asm insertions will work ok. Ill put it on git hub.
Depending on the language I can help too.


On a side note I've decided to drop these requests:
- Battle style set/shift toggling
- Other battle script related stuff

Battle style set/shift was done in a battle script as far as I could tell. I was hoping there'd be a byte in RAM I could just find and manipulate, but I couldn't find one (though I'm 65% sure it's probably done like this).

Also for this one
Quote:
Originally Posted by someone's request
Givepokemon with custom attacks. Like Extremespeed Dratini in Crystal and event Pokémon.
It looks like my custom attacks for wild Pokemon routine is shared with given Pokemon :)
Link: http://www.pokecommunity.com/showthread.php?p=8509300#8509300

I'll post what I've done so far soon. Progress has been rather slow because I got sick and spent pretty much most of the last couple of days in bed X_X
__________________
...
Reply With Quote
  #391   Link to this post, but load the entire thread.  
Old December 25th, 2014 (1:58 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Temporarily disabling EXP gains from battle



It was brought to my attention by some requesters that for their battle/tournament events they wouldn't want their Pokemon leveling up. This routine disables the exp gains in battle. Note that the player can still use stuff like Rare Candy to level. The fix to that is exactly the same as this, but with slight modifications. I hope you don't give the player a chance to rare candy in battle though or I will go to your hack's thread and severly criticize your lack of common sense :c


How to insert:

Compile and insert the following routine into free space:

Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r3}
	mov r0, #0xFF
	lsl r0, r0, #0x1
	add r0, r0, #0x4
	ldr r2, =(0x806E6D0 +1) @checkflag 0xFF *0x2 + 4 = 0x202
	bl linker
	cmp r0, #0x1
	beq skip
	pop {r0-r3}
	cmp r0, #0x64
	beq noCrash
	ldr r0, =(0x8021D24 +1)
	bx r0
	
skip:
	pop {r0-r3}
	
noCrash:
	ldr r1, [r5]
	add r1, #0x53
	ldrb r0, [r1]
	ldr r2, =(0x8021D04 +1)

linker:
	bx r2
		
.align 2
Here's a compiled version:
Code:
0F B4 FF 20 40 00 04 30 07 4A 00 F0 0C F8 01 28 04 D0 0F BC 64 28 02 D0 04 48 00 47 0F BC 29 68 53 31 08 78 02 4A 10 47 D1 E6 06 08 25 1D 02 08 05 1D 02 08


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

Usage:

If flag 0x202 is set, the EXP gains will be disabled. Obviously, to re-enable just clear the flag.
Currently the way I'm doing this is by making the game act like the player's party is already max level, so therefore they don't gain exp :)
__________________
...
Reply With Quote
  #392   Link to this post, but load the entire thread.  
Old December 25th, 2014 (2:09 PM). Edited June 8th, 2017 by Blah.
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924

Adjusting Shiny encounter chance



Pre-requisites:
- Shiny Pokemon Generator
- Random Number Generator


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
	ldr r0, =(1365) @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
	ldr r0, =(1365) @1/1365 chance with shiny charm
	b calcChance
	
normal:
	ldr r0, =(4096) @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.
__________________
...
Reply With Quote
  #393   Link to this post, but load the entire thread.  
Old December 25th, 2014 (4:26 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
Depending on the language I can help too.
i work mainly in c#... if youd prefer another language i know a few and would enjoy the challenge, but progress would be quite a bit slower.
__________________
Reply With Quote
  #394   Link to this post, but load the entire thread.  
Old December 25th, 2014 (5:15 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
i work mainly in c#... if youd prefer another language i know a few and would enjoy the challenge, but progress would be quite a bit slower.
It would probably be best for you to work on it in your language of preference then. I'm feeling a little lazy all of a sudden :D
__________________
...
Reply With Quote
  #395   Link to this post, but load the entire thread.  
Old December 25th, 2014 (5:23 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
It would probably be best for you to work on it in your language of preference then. I'm feeling a little lazy all of a sudden :D
Youve done so much work already... i dont blame you at all for not adding more to your plate.
__________________
Reply With Quote
  #396   Link to this post, but load the entire thread.  
Old December 25th, 2014 (11:07 PM).
TheRabbit TheRabbit is offline
Banned
 
Join Date: Jul 2014
Gender: Male
Posts: 69
Quote:
Originally Posted by FBI agent View Post

Adjusting Shiny encounter chance



Pre-requisites:
- Shiny Pokemon Generator
- Random Number Generator


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
	ldr r1, =(0x20370BC)
	strb 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.
You don't know how long I've wanted this. You're the man.
Reply With Quote
  #397   Link to this post, but load the entire thread.  
Old December 26th, 2014 (10:55 AM). Edited February 6th, 2015 by Trainer 781.
Trainer 781
Guest
 
Posts: n/a
Black Sludge Implementation:

-> Insert at x1BE18: 00 49 08 47 XX+1 XX XX 08 00 00

-> Routine at XXXXXX:
Spoiler:

ZZ is the index of mystery byte
KK is the index of magic guard (If you don't have magic guard remove the bolded part of ASM)

Code:
.text
.align 2
.thumb
.thumb_func

main:
      sub r0, r5, #0x1
      cmp r0, #0x2A
      bls table
      cmp r5, #0xZZ
      beq bsludge
      b exit

table:
      ldr r1, =0x0801BE23
      bx r1

bsludge:
      mov r0, #0x58
      mul r0, r7
      mov r2, r8
      add r1, r0, r2
      add r1, #0x20
      ldrb r3, [r1, #0x1]
      cmp r3, #0x3
      beq healer
     
      ldrb r3, [r1, #0x2]
      cmp r3, #0x3
      beq healer

      ldrb r3, [r1, #0x0]
      cmp r3, #0xKK
      beq exit

      cmp r6, #0x0
      bne exit
      
      add r1, r0, r2
      ldr r3, =0x02023D50
      ldrh r0, [r1, #0x2c]       
      lsr r0, r0, #0x03
      cmp r0, #0x0
      bne nonZeroDamage
      mov r0, #0x1

nonZeroDamage:
      str r0, [r3, #0x0]
      ldr r0, DSPointer
      bl scriptManager
      mov r0, #0x4
      str r0, [sp, #0xC]
      add r0, r7, #0x0
      add r1, r5, #0x0
      bl scriptDelayer
      b exit

healer:
     ldr r1, =0x0801C09F
     bx r1

exit:       
     ldr r2, =0x0801C953
     bx r2

scriptManager:
     ldr r1, =0x0801BBE5
     bx r1

scriptDelayer:
     ldr r2, =0x080C7209
     bx r2

.align 2
DSPointer: .word 0x08GGGGGG


-> Battle Script at GGGGGG:
Spoiler:

Code:
#org @start
call @func
end2

#org @func
playanimation 0x1 0x1B 0x0
setword 0x203C020 0x08SSSSSS
printstring 0x184
waitmessage 0x40
orword 0x2023DD0 0x100
graphicalhpupdate 0x1
datahpupdate 0x1
faintpokemon 0x1 0x0 0x0
return
String at SSSSSS:
Code:
FD 0F 00 DD E7 00 DC E9 E6 E8 FE D6 ED 00 FD 16 AB FF
The animation of negative sludge can be improved by some expert in animation hacking.


(OPTIONAL) Update the Leftovers message to latest Generation (used for positive Black Sludge too):
-> At 1C0F4: HH HH HH 08 (In reverse hex)

-> Battle Script at HHHHHH:
Spoiler:

Code:
#org @start
call @func
end2

#org @func
playanimation 0x1 0x7 0x0
setword 0x203C020 0x08TTTTTT
printstring 0x184
waitmessage 0x40
orword 0x2023DD0 0x100
graphicalhpupdate 0x1
datahpupdate 0x1
return
String at TTTTTT:
Code:
FD 0F 00 E6 D9 E7 E8 E3 E6 D9 D8 FE D5 00 E0 DD E8 E8 E0 D9 00 C2 CA 00 E9 E7 DD E2 DB 00 DD E8 E7 00 FD 16 AB FF
Reply With Quote
  #398   Link to this post, but load the entire thread.  
Old December 26th, 2014 (2:41 PM).
jAvAcOlA jAvAcOlA is offline
Banned
 
Join Date: Sep 2008
Gender:
Posts: 152
Quote:
Originally Posted by FBI agent View Post
I'll look into battle frontier like battles. For the can't use items one, you can use the temporary bag deletion and delete the bag and restore it later. EXP during battles and set mode battling will be something I'll look into.
Kind of ties into this as well:

Do you have any kind of experience into implementing a battle frontier into FR? Not totally sure how many and what kind of ASM routines would be needed. Sort of a general question.
Reply With Quote
  #399   Link to this post, but load the entire thread.  
Old December 26th, 2014 (4:00 PM).
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
Hey fbi how would I go about making the battle by move asm to use a different flag for each routine? Cause I dont want the prevent whiteout and the delete pokemon on at the same time.:(
__________________
New living flesh vessel who dis?
Reply With Quote
  #400   Link to this post, but load the entire thread.  
Old December 26th, 2014 (4:13 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
Youve done so much work already... i dont blame you at all for not adding more to your plate.
Thanks :)

Quote:
Originally Posted by TheRabbit View Post
You don't know how long I've wanted this. You're the man.
I'm glad you find use for it!

Quote:
Originally Posted by KDS View Post
Black Sludge Implementation:
-stuffs-
Jeez KDS, I don't wanna have to update the first post this often :P
Good job, lol.

Quote:
Originally Posted by jAvAcOlA View Post
Kind of ties into this as well:

Do you have any kind of experience into implementing a battle frontier into FR? Not totally sure how many and what kind of ASM routines would be needed. Sort of a general question.
Hi, most of the hard Battle Frontier ones are also very stupid (like the random attack one). There are fun ones which are hard to do, like the rent a party/swap it with opponents party one. Some of the good ones like battle pyramid are easy though. I should mention I'm done writing public routines atm. There won't be more unless I'm very very bored on an eventless evening.

Quote:
Originally Posted by joexv View Post
Hey fbi how would I go about making the battle by move asm to use a different flag for each routine? Cause I dont want the prevent whiteout and the delete pokemon on at the same time.:(
Hi FBI here, I'll answer this in place of fbi. You would put the flag check in the separate routines. If you've got more questions about how, you can ask in the ASM help thread.
__________________
...
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.