well from what i read here http://bulbapedia.bulbagarden.net/wiki/Personality_value
gender is part of the pokemon's personality value, wouldn't it be somewhere on the first 4 byte?
here's how i understand it at least(im not totally sure but here goes):
lets say my bulbasaur in my FR save has a personality value of C5CA4F52 which is 11000101110010100100111101010010 in binary. the lowest byte which is 01010010 (82) determines its Pgender value you then compare this value to the gender threshold of bulbasaur(look at YAPE) which is 31 if its greater or equal than the threshold value it is a male otherwise it is a female.
but before all that you need to perform a check for 100% male/females and genderless just to be safe
please someone correct me if im wrong >.<
Hmm for some reason I thought it was set to the 6th byte... Okay, so the value isn't actually set to a particular byte. Instead, it's set to the lowest byte. So in this example : FC6A446D 44 would be the gender byte?
The routine still shouldn't have made the game crash though right? It should return a value of some sort and the value will either be greater than 20 or less than 20, regardless of whether the particular value is the gender value. So I still need to figure out the problem with the routine itself.