The above video goes away if you are a member and logged in, so log in now!
Controller Pad –
I was reading over the example pad.c program that came with the ps2sdk provided by ps2dev.org. I confused at the part where it is reading the actual button values. Why can't you just do a comparison such as if(buttons.btns == PAD_LEFT). Why is it first being exclusive OR'ed with 0xffff and then bit ANDed with the old value of btns? Why should it even matter what the previous value of btns is? Thanks for clearing this up?
Nevermind. I looked at the code some more and I got was going on. It looks like that bit-wise AND is just so the code doesn't print a million times if you hold down a button. Also the value is XOR'd with all 1's because btns contains a single zero in a particular bit position whereas the values such as PAD_LEFT have a 1 in a particular bit position.