View Single Post
Old August 9th, 2012 (6:01 AM). Edited August 9th, 2012 by Jambo51.
Jambo51's Avatar
Jambo51 Jambo51 is offline
Glory To Arstotzka
    Join Date: Jun 2009
    Gender: Male
    Nature: Quiet
    Posts: 732
    Originally Posted by RichterSnipes View Post
    Ooh, really? That would be great! I tried making a custom item with JPAN's hacked engine late into my work, but I could never get it right. Every time I tried using it, the game froze. I'd love to be able to get this thing working.

    Just out of curiosity, this code will work for making a Key Item, right?

    And don't worry, people. I'll give you access to it right at the beginning of the game.
    Yes, of course it does! That's a major difference between his and mines. Mines works as a key item! However, I do have to admit, mines is based off his, so I can't take full credit. I just worked out how to run it without his engine.

    Originally Posted by RichterSnipes View Post
    It's very humbling to know that I could please someone as accomplished at PokéCommunity as you, BTW.
    Don't do that. I hate it when people treat me like I'm better than them!

    Insert this following code and take note of it's location. It's important for later.

    .align 2
    .global gbpitemroutine2
    	push {r4,lr}
    	ldr r0, return
    	bx r0
    return:	.word 0x080A1323
    Now assemble and insert the following one too. Remember to take note of the location of the routine you just assembled. You'll need it before assembling the next routine.

    .align 2
    .global gbpitemroutine
    	push {r4,r5,lr}
    	lsl r0, r0, #0x18
    	lsr r5, r0, #0x18
    	ldr r0, place
    	ldr r1, place2
    	str r0, [r1, #0x0]
    	ldr r0, script
    	bl scriptexecuter
    	ldr r1, scriptflagset
    	mov r0, #0x1
    	strb r0, [r1, #0x0]
    	add r0, r5, #0x0
    	bl bagexiter
    	pop {r4,r5,pc}
    scriptexecuter:	ldr r1, address
    	bx r1
    bagexiter:	ldr r1, exit
    	bx r1
    script:	.word 0x08FFFFFF
    scriptflagset:	.word 0x03000F9C
    address:	.word 0x08069AE5
    exit:		.word 0x080A103D
    place:		.word 0x08ZZZZZZ
    place2:		.word 0x02039998
    Remember that earlier routine you assembled? Make place: .word 0x08ZZZZZZ point to it, adding one for thumb mode of course! Remember to make the script point to a valid GBP script also.

    Assemble and insert. Note the address down. This is the routine the item will call later to execute a script. (Note how similar it is to JPAN's?)

    Job done! Now you just create the item, and make the field behaviour point to that item routine. Easy, huh?

    Have a listen to that. It's your version of the main square instruments combined with a custom bass track I made. Sounds closer, doesn't it?
    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