The PokéCommunity Forums Fan Games ROM Hacking Tools, Tutorials & Resources
Tutorial Pokéball hacking guide

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.


Reply
 
Thread Tools
  #26    
Old April 7th, 2015 (7:24 AM).
thehypersonic2338 thehypersonic2338 is offline
     
    Join Date: Dec 2014
    Gender: Male
    Posts: 11
    I don't understand how to take pokeball index part...
    Reply With Quote

    Relevant Advertising!

      #27    
    Old April 7th, 2015 (7:42 AM).
    daniilS's Avatar
    daniilS daniilS is offline
    busy trying to do stuff not done yet
       
      Join Date: Aug 2013
      Age: 19
      Gender: Male
      Posts: 409
      Quote:
      Originally Posted by thehypersonic2338 View Post
      I don't understand how to take pokeball index part...
      Please elaborate what you don't understand exactly.
      __________________
      Reply With Quote
        #28    
      Old April 11th, 2015 (7:13 AM).
      thehypersonic2338 thehypersonic2338 is offline
         
        Join Date: Dec 2014
        Gender: Male
        Posts: 11
        Quote:
        Take the index number of the item, multiply it by 0x2C, then add to it the offset of the item data and finally, add to that 0x1B, and you have the pokeball index field.
        I don't understand this...
        Reply With Quote
          #29    
        Old April 29th, 2015 (1:26 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: 793
          I don't understand this part?

          What are these offsets for?
          Quote:
          Now, in the code you see "somevar". There you must place an address (or use this one I saw in JPAN's original routine) that will keep track of the current pokeball index. Other than in the routine, there are a few places you need to place a pointer to it:
          0802D500
          0802D544
          0802D6A0
          0802D71C
          0802D7B8
          080EF4B4
          080EF4DC
          080EF674
          080EF9AC
          080F0368
          then, should Insert this routine
          Quote:
          .text
          .align 2
          .thumb
          .thumb_func
          .global ballchecker

          main:
          push {lr}
          ldr r1, throwtablepositionstable
          add r0, r0, r1
          ldrb r0, [r0]
          pop {pc}
          shoild I insert it at 080EF52C or the reversed- pointer?
          __________________
          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
            #30    
          Old May 2nd, 2015 (2:39 AM).
          daniilS's Avatar
          daniilS daniilS is offline
          busy trying to do stuff not done yet
             
            Join Date: Aug 2013
            Age: 19
            Gender: Male
            Posts: 409
            Quote:
            Originally Posted by Lance32497 View Post
            I don't understand this part?

            What are these offsets for?
            It literally says this in the part you quoted:
            Quote:
            Now, in the code you see "somevar". There you must place an address (or use this one I saw in JPAN's original routine) that will keep track of the current pokeball index. Other than in the routine, there are a few places you need to place a pointer to it:
            At each of those offsets, put a pointer to the address of somevar.
            Quote:
            Originally Posted by Lance32497 View Post
            then, should Insert this routine


            shoild I insert it at 080EF52C or the reversed- pointer?
            Literally quoting the part right after the routine again:
            Quote:
            Assemble this routine and insert it at 080ef52C.
            __________________
            Reply With Quote
              #31    
            Old May 2nd, 2015 (5:29 AM).
            pokemontutorialTV's Avatar
            pokemontutorialTV pokemontutorialTV is offline
               
              Join Date: Feb 2014
              Location: Germany, Kaiserslautern
              Gender: Male
              Nature: Calm
              Posts: 75
              Question: Is it possible to make Critial Captures like in GEN. 6?
              Also another question: is it possible to make routes/ maps, where youre capture rate is 100%?
              __________________
              Making Youtube Videos about Pokémon.
              _______________________________________________
              Pokémon Zoisit:

              _______________________________________________
              My Youtube Channel with over 1000 videos to Pokémon: http://www.youtube.com/user/pokemontutorialTV
              Reply With Quote
                #32    
              Old May 2nd, 2015 (5:35 AM).
              daniilS's Avatar
              daniilS daniilS is offline
              busy trying to do stuff not done yet
                 
                Join Date: Aug 2013
                Age: 19
                Gender: Male
                Posts: 409
                Quote:
                Originally Posted by pokemontutorialTV View Post
                Question: Is it possible to make Critial Captures like in GEN. 6?
                Also another question: is it possible to make routes/ maps, where youre capture rate is 100%?
                100% rate on certain maps shouldn't be hard to do with a little ASM. Critical capture seems harder.
                __________________
                Reply With Quote
                  #33    
                Old June 9th, 2015 (5:05 AM).
                FamiliaWerneck's Avatar
                FamiliaWerneck FamiliaWerneck is offline
                   
                  Join Date: May 2015
                  Location: São Paulo, Brasil
                  Gender: Male
                  Posts: 274
                  Man, can I edit existing Pokéballs without adding new ones?
                  I mean, with an Item Editor, much can be done (name, image and palettes, animation). But the catch rate and effects (like the healing ball), I don't know how to.
                  I'm working on a code based on your Healing Ball, but I don't know how to simply implement it on every existing Pokéball... Nor changing their catch rates, that is.
                  Do you know how I can add a healing effect on a regular Pokéball? Or will I have to add new Pokéballs and swap them in-game?
                  Thanks for the help. =D
                  Reply With Quote
                    #34    
                  Old June 10th, 2015 (5:32 AM).
                  daniilS's Avatar
                  daniilS daniilS is offline
                  busy trying to do stuff not done yet
                     
                    Join Date: Aug 2013
                    Age: 19
                    Gender: Male
                    Posts: 409
                    Quote:
                    Originally Posted by FamiliaWerneck View Post
                    Man, can I edit existing Pokéballs without adding new ones?
                    I mean, with an Item Editor, much can be done (name, image and palettes, animation). But the catch rate and effects (like the healing ball), I don't know how to.
                    I'm working on a code based on your Healing Ball, but I don't know how to simply implement it on every existing Pokéball... Nor changing their catch rates, that is.
                    Do you know how I can add a healing effect on a regular Pokéball? Or will I have to add new Pokéballs and swap them in-game?
                    Thanks for the help. =D
                    You can easily change the ball index check in the healing routine, or remove it altogether if you want it to work for every ball.
                    __________________
                    Reply With Quote
                      #35    
                    Old June 10th, 2015 (12:57 PM). Edited June 10th, 2015 by FamiliaWerneck.
                    FamiliaWerneck's Avatar
                    FamiliaWerneck FamiliaWerneck is offline
                       
                      Join Date: May 2015
                      Location: São Paulo, Brasil
                      Gender: Male
                      Posts: 274
                      Quote:
                      Originally Posted by daniilS View Post
                      You can easily change the ball index check in the healing routine, or remove it altogether if you want it to work for every ball.
                      Quote:
                      Originally Posted by daniilS View Post
                      This effect was written by me for the Heal Ball:
                      Spoiler:
                      Code:
                      .text
                      .align 2
                      .thumb
                      .thumb_func
                      .global afterpoketranscalc
                      
                      main:
                      	push {lr}
                      recycle:
                      	ldr r3, memcpy
                      	bl bxr3
                      calc:
                      	cmp r7, #0x64
                      	bne ender
                      	ldr r3, somevar
                      	ldrb r3, [r3]
                      	cmp r3, #14	/*ball index of heal ball here*/
                      	bne ender
                      healstuff:
                      	ldr r3, poke_quantity
                      	ldrb r1, [r3]
                      	mov r10, r1
                      	mov r1, #1
                      	strb r1, [r3]
                      heal_recycle:
                      	mov r3, pc
                      	add r3, #0x1d
                      	push {r3}
                      	push {r4-r7}
                      	mov r7, r10
                      	mov r6, r9
                      	mov r5, r8
                      	push {r5-r7}
                      	sub sp, sp, #4
                      	mov r1, #0
                      	mov r8, r1
                      	mov r1, r0
                      	mov r10, r1
                      	mov r6, sp
                      	ldr r3, healpoke
                      	b bxr3
                      heal_finish:
                      	ldr r3, poke_quantity
                      	mov r1, r10
                      	strb r1, [r3]
                      ender:
                      	pop {r3}
                      bxr3:
                      	bx r3
                      
                      .align 2
                      	memcpy:			.word 0x081e5e78+1
                      	somevar:		.word 0x0203fe00
                      	partyadr:		.word 0x02024284
                      	poke_quantity:		.word 0x02024029
                      	healpoke:		.word 0x080a0076+1


                      In this code you must change the values at the ball index and somevar. Then assemble it and insert it anywhere. To activate it, place 00 4B 9F 46 XX XX XX XX at 08040B08, where XXXXXXXX is an inverted pointer to this routine.
                      Basically, I just need to make this code, and delete the ball index check so it works for all Pokéballs? No need to do nothing beyond the special effect itself?
                      Also, can I, instead of fully healing the Pokémon, I just add "(Maximum HP)/2" to the Current HP?
                      Not healing condition status in the process?
                      I see the "healpoke" seems to be a word the game already has that must probably be used when you are at a Pokémon Center. Just to make sure, if I want it to heal half it's HP, I'll have to write a new ASM routine for half healing a Pokémon or I can just change this code you did?
                      After you told me to learn ASM, I went for some help. Just started this week to practice, but I keep using other programming logics. ASMing doesn't seem to work like other programming languages. It's hard getting the hang of it. =P
                      Reply With Quote
                        #36    
                      Old June 21st, 2015 (2:14 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: 793
                        Quote:
                        Originally Posted by thehypersonic2338 View Post
                        I don't understand this...
                        Take the index number of the item, multiply it by 0x2C, then add to it the offset of the item data and finally, add to that 0x1B, and you have the pokeball index field.

                        You need that if you had repointed the Item data in your rom, because, afaik, only Complete Item Editor has a "Ball Slot" feature, other than CIE, no other tools let you edit the ball slot, but that's not a big issue, just open the tool in Hex editor then goto 0x1b00 then change the pointer in your repointed item table
                        __________________
                        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
                          #37    
                        Old September 8th, 2015 (12:43 PM).
                        ~SAGE's Avatar
                        ~SAGE ~SAGE is offline
                        Spanish Rom Hacker
                           
                          Join Date: Jul 2014
                          Location: Italia
                          Age: 23
                          Gender: Male
                          Nature: Lonely
                          Posts: 35
                          I have a doubt



                          At the step 2:
                          should i to replace the bytes at these offsets (the currently bytes are 68 3D 02)
                          with the pointer where i place the routine of the step 2?
                          __________________

                          El inteligente no es aquel que lo sabe todo

                          Si no aquel que sabe utilizar lo poco que sabe
                          Reply With Quote
                            #38    
                          Old October 2nd, 2015 (4:41 AM).
                          Spherical Ice's Avatar
                          Spherical Ice Spherical Ice is offline
                           
                          Join Date: Nov 2007
                          Location: Bristol, UK
                          Age: 20
                          Posts: 5,221
                          A bug I've encountered with this hack is the Egg summary screen. Basically immediately upon loading, the game resets, but in the nanosecond before it crashing you can see the Egg's Poké Ball sprite is instead displayed as a glitched mess. I feel like this could be the case of small missed limiter or pointer of some sort, but I'm not sure where to look. I've also double-checked that I've implemented all the repointing and whatnot correctly, and as far as I can see it's correct.

                          (oh also it's Poké Ball not Pokéball)
                          __________________

                          A Pokemon that is discriminated!
                          Support squirtle and make it everyone's favourite.
                          Reply With Quote
                            #39    
                          Old October 2nd, 2015 (5:29 AM). Edited October 2nd, 2015 by jiangzhengwenjzw.
                          jiangzhengwenjzw's Avatar
                          jiangzhengwenjzw jiangzhengwenjzw is offline
                          You can (not) redo.
                             
                            Join Date: Sep 2012
                            Gender: Male
                            Posts: 147
                            Quote:
                            Originally Posted by laflacapkm View Post
                            I have a doubt



                            At the step 2:
                            should i to replace the bytes at these offsets (the currently bytes are 68 3D 02)
                            with the pointer where i place the routine of the step 2?
                            No, you should replace them with the pointer to the EWRAM offset indicated by the label "somevar" in the routine.

                            Quote:
                            Originally Posted by Spherical Ice View Post
                            A bug I've encountered with this hack is the Egg summary screen. Basically immediately upon loading, the game resets, but in the nanosecond before it crashing you can see the Egg's Poké Ball sprite is instead displayed as a glitched mess. I feel like this could be the case of small missed limiter or pointer of some sort, but I'm not sure where to look. I've also double-checked that I've implemented all the repointing and whatnot correctly, and as far as I can see it's correct.

                            (oh also it's Poké Ball not Pokéball)
                            I've encountered the same problem, as when I went into the egg screen the screen simply faded black.
                            I think there may be something wrong in step I, because he has edited the Pokemon decrypter and encrypter.

                            Edit: not sure now, as I've disassembled the code but I've found no problem.
                            Reply With Quote
                              #40    
                            Old October 4th, 2015 (1:04 AM).
                            MrDollSteak's Avatar
                            MrDollSteak MrDollSteak is offline
                            Formerly known as 11bayerf1
                               
                              Join Date: Dec 2008
                              Location: Hong Kong
                              Age: 23
                              Gender: Male
                              Posts: 829
                              Quote:
                              Originally Posted by Spherical Ice View Post
                              A bug I've encountered with this hack is the Egg summary screen. Basically immediately upon loading, the game resets, but in the nanosecond before it crashing you can see the Egg's Poké Ball sprite is instead displayed as a glitched mess. I feel like this could be the case of small missed limiter or pointer of some sort, but I'm not sure where to look. I've also double-checked that I've implemented all the repointing and whatnot correctly, and as far as I can see it's correct.

                              (oh also it's Poké Ball not Pokéball)
                              This is actually a super easy fix. In step Four Part 1, Daniils says that the zero-th entry of the conversion table is unused. It actually is used by Eggs. So just replace the FF with 00, and its fixed.

                              Hope this helps everyone.
                              __________________
                              Reply With Quote
                                #41    
                              Old November 14th, 2015 (3:27 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: 793
                                I had added new poké balls upto Lure Ball only, any balls thats had been added after that crashes the game
                                __________________
                                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
                                  #42    
                                Old November 15th, 2015 (10:13 PM).
                                kearnseyboy6's Avatar
                                kearnseyboy6 kearnseyboy6 is offline
                                Aussie's Toughest Mudder
                                   
                                  Join Date: Dec 2008
                                  Posts: 300
                                  A crucial part this tutorial is missing is the expansion of the Ball Pocket. As there is only 13 balls allowed in this pocket currently. This won't work if you want to keep all Gen III balls and add in other balls. So here is how to fix it.

                                  The bag routine is located at 0x099E44. Next insert this ASM anywhere (as long as you update your offsets):

                                  Code:
                                  .text
                                  .align 2
                                  .thumb
                                  .thumb_func
                                  .global ball_pocket_hack
                                  
                                  main:
                                  ldr r0, ram_FREE
                                  str r0, [r1, #0x10]
                                  mov r0, #0xNUMBER OF BALLS
                                  strb r0, [r1, #0x14]
                                  add r3, #0x (4x the number of balls you chose)
                                  ldr r0, return
                                  bx r0
                                  
                                  .align
                                  ram_FREE:	.word 0x0203c000
                                  return:	.word 0x08099E6C+1
                                  Then goto 0x099E64 and insert
                                  01 48 00 47 00 00 FF FF FF 08 where:
                                  FF FF FF 08 is the pointer of the asm location+1

                                  You will have to restart the save file. No exceptions.

                                  Alternatively (also more time consuming) you can expand/relocate the TM's/HM's. Then you can just change these bytes as the space you will be overwriting has been moved (TM's follow the ball pocket space allocation):

                                  0x099E66 - Number of balls
                                  0x099E6A - Number of balls x4
                                  __________________
                                  HOLIDAYING CURRENTLY!!
                                  Reply With Quote
                                    #43    
                                  Old November 17th, 2016 (2:28 AM).
                                  Froosty's Avatar
                                  Froosty Froosty is offline
                                  The_Learner
                                     
                                    Join Date: Sep 2014
                                    Location: Somewhere in this world.
                                    Age: 20
                                    Gender: Male
                                    Nature: Brave
                                    Posts: 541
                                    Quote:
                                    Originally Posted by daniilS View Post
                                    Spoiler:
                                    Pokéball Hacking Guide


                                    Introduction
                                    Some months ago, when I was still attempting my first hack, I was wondering whether it was possible to create a custom pokeball. The only thing I found was this post by JPAN. It wasn't complete, and I hadn't seen anyone using it, so I forgot about it.
                                    Now, I am working full-time on Platinum Red&Blue with GoGoJJTech, and had to implement gen IV pokeballs into the hack. I have altered JPAN's asm code a bit, and included documentation on the throwing graphics for everybody to use. Enjoy!


                                    Requirements
                                    • A hex editor (I use Hex Workshop)
                                    • A way to find free space in your rom; FSF recommended
                                    • Images for your balls
                                    • A way to insert those images (I use nse 2.1)
                                    • Basic hex editing/assembly knowledge. I do assume you know how to assemble a routine and place an inverted pointer +1 to it.


                                    Step 1: Dealing with the pokemon data limiters
                                    This is the easiest part. As you can see here, the balls only get four bits of data, and 0 is unused, meaning you can add up to three balls. Since I don't think there are many people who have transferred pokemon from Colosseum or XD to a hack, it's safe to sacrifice the most significant bit used to determine the game of origin, leaving us space for 19 extra balls. If you need more, you will need a different workaround.
                                    You've got to change six bytes:
                                    • At 080400B6, place 80
                                    • At 080400B8, place 44
                                    • At 080400BE, place 0B
                                    • At 08040855, place FC
                                    • At 0804085A, place 1F
                                    • At 0804085E, place 89
                                    • At 08040862, place 7C
                                    Spoiler:
                                    IMPORTANT: If your hack is already released, this will screw up pokemon already in pokeballs: they will all get the ball*2, f.e. a poke in a pokeball will become a poke in a friend ball. This may look like a minor bug at first, but if the ball index is high, the doubled index may not exist, resulting in a crash upon throwing the ball. So, if your hack is already released, you can do three things:
                                    • Force the players to restart the save or not to use pokemon caught in balls with high indexes previously
                                    • Only add up to three balls
                                    • Expand the data like mentioned, and then double all existing ball indexes. Then inflate the catch rate table at part 3 and the conversion table at step four part 1. So instead of [original entry 1][original entry 2]...[entry 12][custom entry 1][custom entry 2]..., they will become [custom/empty entry 1][original entry 1][custom/empty entry 2][original entry 2][custom/empty entry 3][original entry 3]. That should fix the problem.

                                    And you're done! Move on to step 2.


                                    Step 2: Inserting the catch rate routine
                                    JPAN has written a neat routine that replaces the regular check for pokeballs (see the link posted above). However, it requires you to perform a cmp for every ball index, and that's not very efficient and forces you to modify the routine every time you add a ball. Thus, I have modified it, so that it checks what pocket the selected item is in. Now, you only have to give the item the right pocket value and it becomes a ball. The routine:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global ballchecker
                                    
                                    ballcompare:
                                    	mov r0, #0x2C
                                    	mul r0, r1
                                    	mov r10, r1
                                    	ldr r1, itemdata
                                    	add r1, r0, r1
                                    	add r1, #0x1A
                                    	ldrb r0, [r1]
                                    	cmp r0, #0x3
                                    	beq isball
                                    otherstuffcompare:
                                    	mov r1, r10
                                    	cmp r1, #0x50
                                    	beq dolly
                                    	cmp r1, #0x51
                                    	beq dolly
                                    	mov r0, #0xaf
                                    	lsl r0, r0, #0x1
                                    	cmp r1, r0
                                    	beq flute
                                    	ldr r0, return_addr
                                    	bx r0 
                                    isball:
                                    	ldr r0, somevar
                                    	add r1, #0x1
                                    	ldrb r1, [r1]
                                    	strb r1, [r0]
                                    	ldr r0, ball_script
                                    	cmp r1, #0x11	/*If you want to have a second safari ball like the park ball, place its pokeball index here*/
                                    	beq safari	/*Otherwise, remove these two lines*/
                                    	cmp r1, #0x5
                                    	bne preender
                                    safari:
                                    	add r0, #0x28
                                    preender:
                                    	b script_ender
                                    dolly:
                                    	ldr r0, doll_script
                                    	b script_ender
                                    flute:
                                    	ldr r0, flute_script
                                    script_ender:
                                    	ldr r1, script_ptr
                                    	str r0, [r1]
                                    	ldr r1, be3_addr
                                    	mov r10, r1
                                    	ldr r0, end_addr
                                    	bx r0
                                    
                                    .align 2
                                    	ball_script:		.word 0x081D9A14
                                    	doll_script:		.word 0x081D9B7C
                                    	flute_script:		.word 0x081D9B86
                                    	script_ptr:		.word 0x02023d74
                                    	be3_addr:		.word 0x02023be3
                                    	return_addr:		.word 0x080164e9
                                    	end_addr:		.word 0x0801671f
                                    	itemdata:		.word 0x083DB028
                                    	somevar:		.word 0x0203fe00

                                    Now, in the code you see "somevar". There you must place an address (or use this one I saw in JPAN's original routine) that will keep track of the current pokeball index. Other than in the routine, there are a few places you need to place a pointer to it:
                                    • 0802D500
                                    • 0802D544
                                    • 0802D6A0
                                    • 0802D71C
                                    • 0802D7B8
                                    • 080EF4B4
                                    • 080EF4DC
                                    • 080EF674
                                    • 080EF9AC
                                    • 080F0368
                                    You probably don't know what the pokeball index is. Well, it's an unused value in the item structure, and afaik you can only change it with the tool "Item manager". Sadly, it doesn't have ini support, so if you repointed the items, do this:
                                    Take the index number of the item, multiply it by 0x2C, then add to it the offset of the item data and finally, add to that 0x1B, and you have the pokeball index field. Using either method, you need to put there the pokeball number. For regular balls, it is equal to the index number; for custom balls, just continue counting up. Also, set your balls' field usage to 0, battle usage to 2, and code to 80A1E1D. (more information here)
                                    Now you've done all that, it's time to assemble the routine. Insert in anywhere, and place a pointer to it at 08016494. Then at 08016460, type 00 00 00 00 0B 4A 97 46. Done! Move on to the next step to make your ball actually do something.


                                    Step 3: Making the balls do something
                                    The balls with a pokeball index (previously index number) higher than 5 each have their own catch rate calculation subroutine. We need to extend that. To do this, first change the byte at 0802D52C to FF. Then, look at the table at 0802D54C. It has a pointer to a routine for every pokeball starting from 6. At 0802D548 you can see a pointer to the table; repoint it somewhere else. Now, to give a ball a certain catch rate, you must write a routine to load it into r4, and exit to 0802D7A2. Then place a pointer to that routine in the table.
                                    Some example routines:
                                    Quick ball:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global catchratebyturn
                                    
                                    main:
                                    	mov r4, #10
                                    	ldr r0, battleturncounter
                                    	ldrb r0, [r0]
                                    	cmp r0, #0x0
                                    	bne ender
                                    firstturn:
                                    	add r4, #30
                                    ender:
                                    	ldr r0, catchratecalcfunction
                                    	mov pc, r0
                                    	
                                    .align 2
                                    	battleturncounter:	.word 0x03004fa3
                                    	catchratecalcfunction:	.word 0x0802d62a

                                    Dusk ball:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global catchratebyareaortimeofday
                                    
                                    main:
                                    	ldr r0, time
                                    	ldrb r0, [r0, #0x0]
                                    	cmp r0, #0x6
                                    	blt night
                                    	cmp r0, #0x15
                                    	bge night
                                    day:
                                    	mov r4, #10
                                    	ldr r0, maptype
                                    	ldrb r0, [r0]
                                    	cmp r0, #0x4
                                    	bne ender
                                    night:
                                    	mov r4, #35
                                    ender:
                                    	ldr r0, catchratecalcfunction
                                    	mov pc, r0
                                    
                                    .align 2
                                    	time:			.word 0x03005542
                                    	maptype:		.word 0x02036e13
                                    	catchratecalcfunction:	.word 0x0802d62a

                                    Park ball; this one uses a modified safari ball routine, and will get another piece of code later:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global safaricatchmax
                                    
                                    main:
                                    	LDR     R0, dword_2023FE8
                                    	LDR     R0, [R0]
                                    	ADD     R0, #0x7C
                                    	LDR     R0, [R0]
                                    	LSL     R1, R0, #2
                                    	ADD     R1, R1, R0
                                    	LSL     R0, R1, #8
                                    	SUB     R0, R0, R1
                                    	MOV     R1, #0x64
                                    	BL      __divsi3
                                    	LSL     R0, R0, #0x18
                                    	LSR     R5, R0, #0x18
                                    park:
                                    	mov r4, #0xff
                                    	ldr r0, catchratecalcfunction
                                    	mov pc, r0
                                    	
                                    .align 2
                                    	catchratecalcfunction:	.word 0x0802D62A
                                    	dword_2023FE8:		.word 0x02023FE8

                                    Heal ball/Cherish ball (the heal ball will get another piece of code later)
                                    These are special. They load the catch rate from the "Extra value" of the item (add 0x28 to the item offset and change the word you find there). In the case of these balls it's 10, but you can easily change it without altering the code:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global staticcatchrate
                                    
                                    main:
                                    	ldr r4, itembuffer
                                    	ldrh r4, [r4]
                                    	mov r0, #44
                                    	mul r4, r0
                                    	ldr r0, itemdata
                                    	add r0, r4
                                    	add r0, #40
                                    	ldr r4, [r0]
                                    	ldr r0, catchratecalcfunction
                                    	mov pc, r0
                                    	
                                    .align 2
                                    	catchratecalcfunction:	.word 0x0802d62a
                                    	itemdata:		.word 0x083DB028
                                    	itembuffer:		.word 0x02023d68

                                    After inserting the routines, take your ball index, substract six of it, multiply by four, and add to the new offset of the table. Place the offset where you inserted your routine there.
                                    Here comes the part JPAN didn't document: animations. And be prepared, it's a long part.
                                    I didnt get this part !!!!

                                    Spoiler:
                                    Step four: Expanding the throwing graphics part 1
                                    The conversion table
                                    Now, if you've ever looked at the pokeballs in an item viewer and at the throwing graphics of them in an image viewer, you might have noticed they're in a different order. So, there is a routine somewhere that converts the index to the throwing graphics table (or tgt in short because I'm lazy) entry. That routine is located at 080EF52C. Due to the way it's written, there's enough space to replace it by a new routine and a table. First the routine:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global ballchecker
                                    
                                    main:
                                    	push {lr}
                                    	ldr r1, throwtablepositionstable
                                    	add r0, r0, r1
                                    	ldrb r0, [r0]
                                    	pop {pc}
                                    
                                    .align 2
                                    	throwtablepositionstable:	.word 0x080EF53C

                                    Assemble this routine and insert it at 080ef52C. Now, the conversion from index to tgt entry will be done through throwtablepositionstable. By this, we freed up more than enough space at the specified offset, so I recommend you to put the table there. Now for the table, it will look like this:
                                    Code:
                                    (unused zeroth entry) FF 04 03 01 00 02 05 06 07 08 09 0A 0B (insert ongoing numbers for each of your balls here)
                                    It is the easiest if you insert the throwing graphics in the same order as your pokeballs, so just count up. For the five gen 4 balls, it would be
                                    Code:
                                    FF 04 03 01 00 02 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
                                    But be careful: while the pokeball index was one-indexed, the tgt is zero-indexed, which means that in the entry for ball x you will have to type x-1.
                                    After inserting this, remove a limiter by typing 00 00 at 080EF972 and at 080F02D6, and continue to the next step.


                                    Step four: Expanding the throwing graphics part 2
                                    The image and palette tables
                                    Prepare your ball images. Example with gen 4 balls:
                                    Made by Bela. Isn't he awesome? :D
                                    Anyways, you must repoint and extend two tables in this step. First, the one for the images, located at 0826056C. 12 entries, each eight bytes: one word and two halfwords. Repoint it somewhere. Then, append your own balls as follows:
                                    Code:
                                    word		pointer to image
                                    halfword	decompressed size (180)
                                    halfword	tag of ball(I'm not sure which tags are free exactly, but I started with tag 0xFF00 for the first entry and counted up for the following balls/particles and it worked fine.)
                                    The second table is a lot like this one: it's for the palettes. Located at 082605CC, again 12*8 bytes long. Repoint somewhere, and extend this way:
                                    Code:
                                    word		pointer to palette
                                    halfword	tag of ball
                                    halfword	filler (0000)
                                    We just started repointing, and we still have a long way to go.


                                    Step four: Expanding the throwing graphics part 3
                                    Repointing generic tables
                                    Here comes a list of the tables:
                                    Spoiler:

                                    Code:
                                    082606F4	ball object template table
                                    one entry is 24 bytes:
                                    halfword	tag of ball
                                    halfword	tag of ball
                                    word		0826062C
                                    word		08260674
                                    word		00000000
                                    word		082606E0
                                    word		0804ABD5
                                    Code:
                                    0840BF48	unknown particle table
                                    one entry is 8 bytes:
                                    word		08D1A608
                                    halfword	0100
                                    halfword	tag of particle
                                    Code:
                                    0840BFA8	unknown particle table 2
                                    one entry is 8 bytes:
                                    word		08D1A6DC
                                    halfword	tag of particle
                                    halfword	0000
                                    Code:
                                    0840C0A4	particle object template table
                                    one entry is 24 bytes:
                                    halfword	tag of particle
                                    halfword	tag of particle
                                    word		083AC9C8
                                    word		0840C050
                                    word		00000000
                                    word		08231CFC
                                    word		0800760D
                                    After you have done this, you can finally assign particles and animations to your balls.


                                    Step four: Expanding the throwing graphics part 4
                                    The particle and animation tables
                                    As for now, I will only document the tables and their meanings, and how to assign existing animations/particles to new balls. Another part on custom animations may follow later.
                                    The first table you need to repoint and extend is located at 0840C068. For every ball it tells which particle to use. 0=sticks, 1=stars, 2=bubbles, 3=hearts, 4=big green crosses, 5=small green crosses (last two strongly affected by the second table).
                                    The second table is located at 0840C074. Each entry is a pointer to a routine+1 that describes how the particles should act. I can't really describe the effects, so just look at them.
                                    And that's it! Congratulations, you've succesfully expanded the pokeballs! The next parts will describe how to apply some special effects.


                                    Step five: Additional effects part 1
                                    Healing pokemon after capture
                                    This effect was written by me for the Heal Ball:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global afterpoketranscalc
                                    
                                    main:
                                    	push {lr}
                                    recycle:
                                    	ldr r3, memcpy
                                    	bl bxr3
                                    calc:
                                    	cmp r7, #0x64
                                    	bne ender
                                    	ldr r3, somevar
                                    	ldrb r3, [r3]
                                    	cmp r3, #14	/*ball index of heal ball here*/
                                    	bne ender
                                    healstuff:
                                    	ldr r3, poke_quantity
                                    	ldrb r1, [r3]
                                    	mov r10, r1
                                    	mov r1, #1
                                    	strb r1, [r3]
                                    heal_recycle:
                                    	mov r3, pc
                                    	add r3, #0x1d
                                    	push {r3}
                                    	push {r4-r7}
                                    	mov r7, r10
                                    	mov r6, r9
                                    	mov r5, r8
                                    	push {r5-r7}
                                    	sub sp, sp, #4
                                    	mov r1, #0
                                    	mov r8, r1
                                    	mov r1, r0
                                    	mov r10, r1
                                    	mov r6, sp
                                    	ldr r3, healpoke
                                    	b bxr3
                                    heal_finish:
                                    	ldr r3, poke_quantity
                                    	mov r1, r10
                                    	strb r1, [r3]
                                    ender:
                                    	pop {r3}
                                    bxr3:
                                    	bx r3
                                    
                                    .align 2
                                    	memcpy:			.word 0x081e5e78+1
                                    	somevar:		.word 0x0203fe00
                                    	partyadr:		.word 0x02024284
                                    	poke_quantity:		.word 0x02024029
                                    	healpoke:		.word 0x080a0076+1
                                    In this code you must change the values at the ball index and somevar. Then assemble it and insert it anywhere. To activate it, place 00 4B 9F 46 XX XX XX XX at 08040B08, where XXXXXXXX is an inverted pointer to this routine.


                                    Step five: Additional effects part 2
                                    Retaining pokeballs
                                    This effect was written by me for the Park Ball, and will work if the caught poke already has a pokeball, like with the Pal Park:
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global keepballcheck
                                    
                                    main:
                                    	mov r5, r3
                                    	ldr r3, returnadr
                                    	cmp r5, #17
                                    	bne bxr3
                                    	add r3, #4
                                    bxr3:
                                    	bx r3
                                    
                                    .align 2
                                    	returnadr:				.word 0x0802D7A2+1
                                    In this code you must only change the the ball index. Then assemble it and insert it anywhere. To activate it, place 40 4B 9F 46 12 F0 EB FD 13 F0 49 FA at 0802D6EE, and 70 BD XX XX XX XX at 0802D7EE where XXXXXXXX is an inverted pointer to this routine.


                                    Step five: Additional effects part 3
                                    The givepokemon hack
                                    One of the gen 4 balls is the Cherish Ball, which has no effects other than being the standard ball for event pokes. To copy this effect, I wrote a piece of code to change the givepokemon command. Know how it has three unused parameters? Well, the last one, a byte, is now the pokeball the received pokemon will be in. If it's 0, it will be in a regular pokeball.
                                    Anyways, the hack:
                                    Code:
                                    Type A1 68 0A 79 00 2A 00 D1 04 22 05 31 at 0806c014. Activate the hack by typing 29 98 at 0803DC52.
                                    Congratulations! You are finished! If you write more ball effects, I'm sure everybody will gladly take a look at them!


                                    To-do list
                                    • Implement custom particles
                                    • Discover how to write custom animations
                                    • Come up with a solution for the Heavy Ball
                                    • Think of a way to create a ball that catches trainer's pokemon
                                    • Finish the givepokemon hack to include the moveset


                                    Credits
                                    • JPAN, for the original research and his tutorial that actually got me into asm
                                    • knizz, for his disassembly (if you haven't heard about it yet, it's a must-have for any asm hacker: link) and infinite amount of help, with finding tables, answering all my dumb questions, and even answering most of my advanced questions
                                    • GoGo, for pushing me to finish this
                                    • Bela, for drawing the balls
                                    • Jambo51, for the idea of the givepokemon hack
                                    • Mat (bond697), for trying to help me fix a major issue with this. Although the reason for the crash turned out to be something else, I appreciate his help and I learned something

                                    Spoiler:


                                    and also I didnt understood the most of the "step:four.... expanding throwing graphics part"
                                    in the step four for for part 1-4 there are different tables located.. do I need to repoint all the tables there...

                                    and basically, I am also confused with the ball index... is it the index as seen in the G3T item manager...
                                    as for master ball(0), pokeball (1) ????

                                    anyone who know to do this pls help me.. I feel like adding the balls but I am basically stuck at step four.... :(
                                    __________________
                                    Want to talk with me regarding Rom-hacking ??? Want to get access to my works exclusive than anywhere else ???
                                    Click here to get in the discord server here where rom-hacking is a everyday talk and task.

                                    Want to showcase your hack on discord server ??? Click here to get the dask done.

                                    My works:
                                    TOOL: TL's Quick Enhancer
                                    TUTORIAL: Fire red habitat editing
                                    TUTORIAL: Fire red Transparent text-box


                                    | |
                                    Reply With Quote
                                      #44    
                                    Old November 17th, 2016 (5:37 AM).
                                    eMMe97 eMMe97 is offline
                                       
                                      Join Date: Jan 2015
                                      Posts: 28
                                      I create a patch for Pokemon Fire Red (U) v1.0, with "all" balls

                                      level ball F1
                                      esca ball F2
                                      luna ball F3
                                      friend ball F4
                                      love ball F5
                                      peso ball F6
                                      rapid ball F7
                                      cura ball F8
                                      velox ball F9
                                      scuro ball FA
                                      pregio ball FB
                                      parco ball FC

                                      with all animations (I created all animations ;D) and descriptions (sorry but I traslated all in italian), and I implemented another ball: the rocket ball! (FD)
                                      With this ball you can catch the trainers' pokémon (Yes, you can! xD). This ball has the animation, but not the sprite...sorry, you must insert it...
                                      If you catch a trainer's pokémon with this ball the battle end.
                                      The offset is 0x8C00000

                                      Download:

                                      Pokéball Expansion

                                      Credits:
                                      daniilS - tutorial
                                      FBI - rocket ball routine
                                      Bella - ball animations
                                      eMMe97 (me) - another ball animations, fix a "bad egg" bug

                                      P.S. sorry for my bad english :S
                                      Reply With Quote
                                        #45    
                                      Old November 17th, 2016 (5:47 AM).
                                      Froosty's Avatar
                                      Froosty Froosty is offline
                                      The_Learner
                                         
                                        Join Date: Sep 2014
                                        Location: Somewhere in this world.
                                        Age: 20
                                        Gender: Male
                                        Nature: Brave
                                        Posts: 541
                                        Quote:
                                        Originally Posted by eMMe97 View Post
                                        I create a patch for Pokemon Fire Red (U) v1.0, with "all" balls

                                        level ball F1
                                        esca ball F2
                                        luna ball F3
                                        friend ball F4
                                        love ball F5
                                        peso ball F6
                                        rapid ball F7
                                        cura ball F8
                                        velox ball F9
                                        scuro ball FA
                                        pregio ball FB
                                        parco ball FC

                                        with all animations (I created all animations ;D) and descriptions (sorry but I traslated all in italian), and I implemented another ball: the rocket ball! (FD)
                                        With this ball you can catch the trainers' pokémon (Yes, you can! xD). This ball has the animation, but not the sprite...sorry, you must insert it...
                                        If you catch a trainer's pokémon with this ball the battle end.
                                        The offset is 0x8C00000

                                        Download:

                                        Pokéball Expansion

                                        Credits:
                                        daniilS - tutorial
                                        FBI - rocket ball routine
                                        Bella - ball animations
                                        eMMe97 (me) - another ball animations, fix a "bad egg" bug

                                        P.S. sorry for my bad english :S
                                        Well I was seeking for some help... which I am still seeking for..
                                        but I can use this patch to study those data :)
                                        thanks to you...

                                        and one more thing I am not gonna apply it for use but for study :)
                                        __________________
                                        Want to talk with me regarding Rom-hacking ??? Want to get access to my works exclusive than anywhere else ???
                                        Click here to get in the discord server here where rom-hacking is a everyday talk and task.

                                        Want to showcase your hack on discord server ??? Click here to get the dask done.

                                        My works:
                                        TOOL: TL's Quick Enhancer
                                        TUTORIAL: Fire red habitat editing
                                        TUTORIAL: Fire red Transparent text-box


                                        | |
                                        Reply With Quote
                                          #46    
                                        Old November 17th, 2016 (9:51 PM). Edited November 17th, 2016 by Froosty.
                                        Froosty's Avatar
                                        Froosty Froosty is offline
                                        The_Learner
                                           
                                          Join Date: Sep 2014
                                          Location: Somewhere in this world.
                                          Age: 20
                                          Gender: Male
                                          Nature: Brave
                                          Posts: 541
                                          Well I somehow succeded in adding the new balls...
                                          .
                                          But I encountered an error,
                                          can anyone help me fix this..


                                          ^ This happens when the ball gets successful in capturing the pokemon...
                                          its not the error with added balls only but
                                          also the pre-existing balls :(


                                          EDIT:
                                          I checked the whole process more than 5 times, and I cant find any mistakes but the problem exists!!!

                                          can anyone help me ???
                                          __________________
                                          Want to talk with me regarding Rom-hacking ??? Want to get access to my works exclusive than anywhere else ???
                                          Click here to get in the discord server here where rom-hacking is a everyday talk and task.

                                          Want to showcase your hack on discord server ??? Click here to get the dask done.

                                          My works:
                                          TOOL: TL's Quick Enhancer
                                          TUTORIAL: Fire red habitat editing
                                          TUTORIAL: Fire red Transparent text-box


                                          | |
                                          Reply With Quote
                                            #47    
                                          Old December 3rd, 2016 (12:08 PM). Edited December 11th, 2016 by mbcn10ww.
                                          mbcn10ww's Avatar
                                          mbcn10ww mbcn10ww is offline
                                             
                                            Join Date: Oct 2016
                                            Location: Brazil
                                            Gender: Male
                                            Nature: Lonely
                                            Posts: 366
                                            It's all working, but the only issue I've found is the throwing graphics not showing the correct ball:
                                            Poké Ball: Shows Great Ball when threw;
                                            Great Ball: Shows Ultra Ball when threw;
                                            Ultra Ball: Shows Master Ball when threw;
                                            Master Ball: Shows odd things and freezes the game.



                                            How to fix it?
                                            __________________
                                            My Works:
                                            [Fire Red] Adding New Trainer Sprites
                                            [Fire Red] My Version of HMs Type Check
                                            [Fire Red] Touched's Mega Evolution System (PATCH)
                                            Reply With Quote
                                              #48    
                                            Old December 3rd, 2016 (4:52 PM).
                                            Froosty's Avatar
                                            Froosty Froosty is offline
                                            The_Learner
                                               
                                              Join Date: Sep 2014
                                              Location: Somewhere in this world.
                                              Age: 20
                                              Gender: Male
                                              Nature: Brave
                                              Posts: 541
                                              Quote:
                                              Originally Posted by mbcn10ww View Post
                                              It's all working, but the only issue I've found is the throwing graphics not showing the correct ball:
                                              Poké Ball: Shows Great Ball when threw;
                                              Great Ball: Shows Ultra Ball when threw;
                                              Ultra Ball: Shows Master Ball when threw;
                                              Master Ball: Shows odd things a freezes the game.



                                              How to fix it?
                                              Simply in pge or any other item editor increase the special value by 1 for pokeballs.... for master ball change 0 to 1, pokeball 1 to 2 and so on
                                              __________________
                                              Want to talk with me regarding Rom-hacking ??? Want to get access to my works exclusive than anywhere else ???
                                              Click here to get in the discord server here where rom-hacking is a everyday talk and task.

                                              Want to showcase your hack on discord server ??? Click here to get the dask done.

                                              My works:
                                              TOOL: TL's Quick Enhancer
                                              TUTORIAL: Fire red habitat editing
                                              TUTORIAL: Fire red Transparent text-box


                                              | |
                                              Reply With Quote
                                                #49    
                                              Old December 3rd, 2016 (5:51 PM).
                                              mbcn10ww's Avatar
                                              mbcn10ww mbcn10ww is offline
                                                 
                                                Join Date: Oct 2016
                                                Location: Brazil
                                                Gender: Male
                                                Nature: Lonely
                                                Posts: 366
                                                Quote:
                                                Originally Posted by The_learner View Post
                                                Simply in pge or any other item editor increase the special value by 1 for pokeballs.... for master ball change 0 to 1, pokeball 1 to 2 and so on
                                                Thank you. xD
                                                __________________
                                                My Works:
                                                [Fire Red] Adding New Trainer Sprites
                                                [Fire Red] My Version of HMs Type Check
                                                [Fire Red] Touched's Mega Evolution System (PATCH)
                                                Reply With Quote
                                                  #50    
                                                Old December 4th, 2016 (5:34 AM).
                                                mbcn10ww's Avatar
                                                mbcn10ww mbcn10ww is offline
                                                   
                                                  Join Date: Oct 2016
                                                  Location: Brazil
                                                  Gender: Male
                                                  Nature: Lonely
                                                  Posts: 366
                                                  Well, I EXPANDED it, but I have some problems on ADDING the new throwings. I don't know where in the table I will place each ball's throwing.
                                                  __________________
                                                  My Works:
                                                  [Fire Red] Adding New Trainer Sprites
                                                  [Fire Red] My Version of HMs Type Check
                                                  [Fire Red] Touched's Mega Evolution System (PATCH)
                                                  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

                                                  Sponsored Links
                                                  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 6:29 PM.