View Single Post
  #25    
Old August 7th, 2010 (04:33 PM). Edited August 7th, 2010 by metapod23.
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Quote:
Originally Posted by colcolstyles View Post
I'm sorry, I should have been more clear. The Bulbapedia article says that the last two bytes of the Growth substructure are unknown. It groups them together as one halfword. However, because the game reads from that data in bytes, I'm guessing that instead the "unknown halfword" is actually two unknown bytes (though it might be safe to say that the second byte is no longer unknown).

I'm going to go do a little more research on that byte. Perhaps by looking at Mew's data (who I've heard is disobedient unless obtained legally or something like that) I can figure out if there's a certain value which makes a pokémon disobedient.


edit: At '0x0801D402' the game checks if the player's pokémon is Mew. I expanded the routine to add a check for Squirtle (which was the only other pokémon I had in my party at the time). And look what I got:
Spoiler:


In an unedited ROM, all pokémon except Mew will always obey the player unless they don't have enough badges (but I didn't look up those routines). If the player is using a Mew, it checks the top bit of the last byte in the Growth Structure. If it is set, then Mew will obey. If not, then Mew won't obey. By default, all pokémon don't have that bit set but because it isn't checked, it doesn't matter. However, in order to get Mew to obey, you need to use the 'setobedience' command to set that bit, unless you want to do the work of decrypting the Pokémon data and then recalculating the checksum. Once you use 'setobedience', Mew/Squirtle will start to obey again:
Spoiler:


Because I'm a nice guy, here's the code:

Code:
.text
.align 2
.thumb
.thumb_func
.global hijack

	@ put at 0x0801D404
	@ also put 0x0000 at 0x081D402

main:
	ldr r1, .ADDRESS
	bx r1

.align 2
.ADDRESS:
	.word	0x08720001
That branches off to the new routine at '0x720000' (that address can be changed) which is:

Code:
.text
.align 2
.thumb
.thumb_func
.global obedience

main:
	cmp r0, #0x97		@ if current attacker == Mew
	beq disobey
	cmp r0, #0x07		@ if current attacker == Squirtle
	beq disobey
	
	mov r0, #0x01
	ldr r1, .RESUME
	bx r1
	
disobey:
	ldr r1, .DISOBEY
	bx r1
	
branchlink:
	bx r3

.align 2
.RESUME:
	.word	0x0801D42B
.DISOBEY:
	.word	0x0801D415	@ goes on to check obedient byte
Obviously, you should change #0x07 to #0x06 for Charizard. That should do the trick.
You're a saint! lol!

Thank you very much. I really do appreciate it. I'm gonna test it out and then post the code with credit in the first post of the thread.

EDIT: Might I ask something?

In your post you said that 0x0801D415 goes on to check the obedience byte? What I'd really like to do is have a code to change an individual Pokemon obedience byte. So presumably an obedient byte does exist then? While having the Mew type of disobedience would work, I'd prefer it to be more like the traded-overtrained disobedience, where the Pokemon falls asleep, and refused to attack. With the Mew disobedience, Mew simply doesn't do anything, I believe. Maybe if I do checkobedience and use 0x0801D415 as a breakpoint I could figure it out?

Oh, and I'm dumb, so I don't know how to insert the first code into the game properly. Do I copy the code to a specific offset once it's assembled? Or maybe there's a way to assemble it I don't know, since there's a command to tell it where to put it in the code itself. Right now, all I really know is the "thumb" command to create the hex script to be inserted ...

EDIT2: Never mind - got it to work. Had to copy the code 0x1d415. And as HackMew said in the post after this one, only Mew and Deoxys do the complete disobedience thing. I just tried it with Charizard and it worked perfectly.

The last thing I'd like to know is I can undo the setobedience command? See, I kind of want to make Charizard obedient for a bit, then make it disobedient again, then make it obedient once more later. Possible?
__________________
Reply With Quote