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

Reply
 
Thread Tools
  #1    
Old May 16th, 2013 (4:21 PM).
Jambo51's Avatar
Jambo51 Jambo51 is offline
Glory To Arstotzka
     
    Join Date: Jun 2009
    Gender: Male
    Nature: Quiet
    Posts: 732
    Ever wondered how the Incense items are handled in Gen 3, and have you ever wondered about adding NEW Incense items? Well, wonder no more! As always, what I present works on BPRE 1.0 only, but could easily be ported over to RSE.

    First up, some more ASM code to assemble:

    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global eggspecieschangeitem
    
    main:
    	mov r0, #0xAF
    	lsl r0, r0, #0x1
    	cmp r1, r0
    	bne newchecks
    	ldr r0, returnone
    	bx r0
    newchecks:	bl getparentdata
    	push {r3-r5,r7}
    	ldr r7, terminator
    	ldr r4, newtable
    	mov r0, #0x0
    loop:	lsl r3, r0, #0x1
    	add r3, r3, r0
    	lsl r3, r3, #0x1
    	add r3, r3, r4
    	ldrh r5, [r3, #0x0]
    	cmp r5, r7
    	beq end
    	cmp r1, r5
    	bne skip
    	ldrh r5, [r3, #0x2]
    	cmp r2, r5
    	beq end
    	cmp r6, r5
    	beq end
    	ldrh r1, [r3, #0x4]
    	b end
    skip:	add r0, #0x1
    	b loop
    end:	pop {r3-r5,r7}
    	add r0, r1, #0x0
    	strh r0, [r4, #0x0]
    	pop {r4-r7}
    	pop {r0}
    	bx r0
    getparentdata:	push {lr}
    	push {r1}
    	add r0, r5, #0x0
    	mov r1, #0xC
    	bl decrypt
    	add r6, r0, #0x0
    	add r0, r5, #0x0
    	add r0, #0x8C
    	mov r1, #0xC
    	bl decrypt
    	add r2, r0, #0x0
    	pop {r1}
    	pop {r0}
    	bx r0
    decrypt:	ldr r2, decry
    	bx r2
    .align
    terminator:	.word 0x0000FEFE
    newtable:	.word 0x08FFFFFF
    returnone:	.word 0x08045FB9
    decry:		.word 0x0803FD45
    Now, navigate to 0x45FB4, and put in an ASM branch by changing the code to:

    Code:
    00 48 00 47 XX XX XX 08
    Where the XX's are to point to the insert location of your routine + 1 for THUMB mode.

    Finally, you need to add a new table to your ROM, and repoint the newtable: .word 0x08FFFFFF to it. The table should be arranged as such:

    Code:
    [Species - Half-Word][Held Item - Half-Word][Species 2 - Half-Word]
    Now, I head you ask, why are there 2 species? Well, the first species ID is the baby Pokémon. That is, if we were adding Marill to the table, the species ID we would put first would be Azurill's. Get it? Remember, you must put the index number of the Pokémon, NOT it's national dex number.

    After that, you put in the ID of the item which allows you to breed to the baby species. Simple enough.

    Finally, you put the species that it should revert to if the item is absent. So, in the above example, I'd put Marill's index number.

    Thus, the final result (if I were doing Marill/Azurill egg changing) would be:

    Code:
    5E 01 DC 00 B7 00
    You simply repeat this until you have completed all the new Pokémon, and then tag on a FE FE 00 00 to finish it off

    Code:
    5E 01 DC 00 B7 00 FE FE 00 00
    The FEFE0000 at the end is necessary to limit the table length. On reading that number, the game will stop searching for egg species.

    The table can be as long or as short as you desire. Just ensure it's correctly aligned and has the FEFE0000 delimiter at the end.

    Please note, you should not put Azurill/Marill or Wynaut/Wobbuffet on your new table because they are handled before this routine. This table is explicitly for NEW incense style items/pokemon combinations!
    __________________
    Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
    Reply With Quote

    Relevant Advertising!

      #2    
    Old May 17th, 2013 (2:31 AM).
    Elaitenstile's Avatar
    Elaitenstile Elaitenstile is offline
    I am legend
       
      Join Date: Feb 2013
      Posts: 1,909
      This is AWESOME. I can only imagine the load of finding the offsets and that routine must've been a terror. It's nice to know that you've finally found a way to do this. Another reason why you are so awesome is this.

      #nextbestthingtonewevostones

      With this I may be able to get in Happiny and Mantyke without having to make them preavailable or direct breeding so many thanks, and Imma taking this rightaway!

      Great work!

      Er... another question. Can I make it like two items for a Pokémon A, and if item A is held then the egg contains Pokémon B, but if item B is held by the same Pokémon A, the egg contains Pokémon C?

      This'd help me out with Fakemon ideas.
      __________________
      ~
      Reply With Quote
        #3    
      Old May 17th, 2013 (4:11 AM).
      Jambo51's Avatar
      Jambo51 Jambo51 is offline
      Glory To Arstotzka
         
        Join Date: Jun 2009
        Gender: Male
        Nature: Quiet
        Posts: 732
        No, it's explicitly an extension of the existing system. To do anything more complex, like what you suggest, would require new custom ASM.
        __________________
        Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
        Reply With Quote
          #4    
        Old May 17th, 2013 (4:38 AM).
        Elaitenstile's Avatar
        Elaitenstile Elaitenstile is offline
        I am legend
           
          Join Date: Feb 2013
          Posts: 1,909
          Oh, I see. Well, this is great work! Thanks anyway!
          __________________
          ~
          Reply With Quote
            #5    
          Old April 13th, 2015 (9:45 AM). Edited April 13th, 2015 by You Watanabe.
          You Watanabe's Avatar
          You Watanabe You Watanabe is offline
          Yousoro!
             
            Join Date: Feb 2014
            Location: Shiganshina District, Wall Maria
            Gender: Female
            Nature: Adamant
            Posts: 427

            Emerald New Incense Items Routine


            Sorry for reviving an old thread... but, I have finally found the correct offsets for Emerald and here is the routine:
            Code:
            .text
            .align 2
            .thumb
            .thumb_func
            .global eggspecieschangeitem
            
            main:
            	mov r0, #0xAF
            	lsl r0, r0, #0x1
            	cmp r1, r0
            	bne newchecks
            	ldr r0, returnone
            	bx r0
            newchecks:	bl getparentdata
            	push {r3-r5,r7}
            	ldr r7, terminator
            	ldr r4, newtable
            	mov r0, #0x0
            loop:	lsl r3, r0, #0x1
            	add r3, r3, r0
            	lsl r3, r3, #0x1
            	add r3, r3, r4
            	ldrh r5, [r3, #0x0]
            	cmp r5, r7
            	beq end
            	cmp r1, r5
            	bne skip
            	ldrh r5, [r3, #0x2]
            	cmp r2, r5
            	beq end
            	cmp r6, r5
            	beq end
            	ldrh r1, [r3, #0x4]
            	b end
            skip:	add r0, #0x1
            	b loop
            end:	pop {r3-r5,r7}
            	add r0, r1, #0x0
            	strh r0, [r4, #0x0]
            	pop {r4-r7}
            	pop {r0}
            	bx r0
            getparentdata:	push {lr}
            	push {r1}
            	add r0, r5, #0x0
            	mov r1, #0xC
            	bl decrypt
            	add r6, r0, #0x0
            	add r0, r5, #0x0
            	add r0, #0x8C
            	mov r1, #0xC
            	bl decrypt
            	add r2, r0, #0x0
            	pop {r1}
            	pop {r0}
            	bx r0
            decrypt:	ldr r2, decry
            	bx r2
            .align
            terminator:	.word 0x0000FEFE
            newtable:	.word 0x08FFFFFF
            returnone:	.word 0x0807075D
            decry:		.word 0x0806A675
            Now, navigate to 0x70758, and put in an ASM branch by changing the code to:
            Code:
            00 48 00 47 XX XX XX 08
            Where the XX's are to point to the insert location of your routine + 1 for THUMB mode.

            The next instructions are on the original post and it has the same procedure for Emerald. That's it! Credits to PurpleOrange for correcting me the r1's word.
            __________________

            Sky High's Userpage

            Pokémon Dark Jade Version (Coming Soon!)

            Hairo Region (Coming Soon!)

            Reply With Quote
              #6    
            Old April 13th, 2015 (10:07 AM).
            PurpleOrange's Avatar
            PurpleOrange PurpleOrange is offline
            still don't know what I'm doing
               
              Join Date: Sep 2013
              Location: Littleroot Town (UK)
              Age: 19
              Gender: Male
              Posts: 343
              Quote:
              Originally Posted by RaileysXerilyasRX View Post
              Sorry for reviving an old thread... but, I think I have got the offsets for Emerald.
              Code:
              returnone:	.word 0x0807075D
              decry:		.word 0x0806A685
              0x08070758
              it's actually 0x0806A675 for the decry, the returnone is right though
              __________________

              Reply With Quote
                #7    
              Old April 13th, 2015 (10:13 AM).
              You Watanabe's Avatar
              You Watanabe You Watanabe is offline
              Yousoro!
                 
                Join Date: Feb 2014
                Location: Shiganshina District, Wall Maria
                Gender: Female
                Nature: Adamant
                Posts: 427
                Quote:
                Originally Posted by PurpleOrange View Post
                it's actually 0x0806A675 for the decry, the returnone is right though
                Thanks for that... I've changed the first post.
                Hmm... have you tried this yet to Emerald? Can you test it if it works?
                __________________

                Sky High's Userpage

                Pokémon Dark Jade Version (Coming Soon!)

                Hairo Region (Coming Soon!)

                Reply With Quote
                  #8    
                Old April 13th, 2015 (10:23 AM).
                PurpleOrange's Avatar
                PurpleOrange PurpleOrange is offline
                still don't know what I'm doing
                   
                  Join Date: Sep 2013
                  Location: Littleroot Town (UK)
                  Age: 19
                  Gender: Male
                  Posts: 343
                  Quote:
                  Originally Posted by RaileysXerilyasRX View Post
                  Thanks for that... I've changed the first post.
                  Hmm... have you tried this yet to Emerald? Can you test it if it works?
                  yep, it works completely fine, so the offsets are right
                  __________________

                  Reply With Quote
                  Reply
                  Quick Reply

                  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 1:07 PM.