Detecting one button input each time
Detecting one button input each time
Is there a way of saying:
If(square is pressed and the others buttons are not being pressed) then...
?
Help
If(square is pressed and the others buttons are not being pressed) then...
?
Help
dont use & but do it this way.
I think this should be it or something like this.
Code: Select all
if(pad.buttons == PSP_CTRL_BUTTON_SQUARE){
//do something
}
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
Re: Detecting one button input each time
This logic is very different from your solution of if Only Square is NOT pressed.zydeoN wrote:Is there a way of saying:
If(square is pressed and the others buttons are not being pressed) then...
?
Help
I will just had to add this !(pad.Buttons & ...) to all the buttons.
Btw, why isnt this working:
int pad_ = 0x100000;
if(pad.Buttons & pad_) {...}
The inside of the brackets isnt being processed. I know this uses a bit mask, but they say Buttons is unsigned int. So the problem here could be the type of pad_. What could it be ?
EDIT: just had to use u32 instead of int.
Btw, why isnt this working:
int pad_ = 0x100000;
if(pad.Buttons & pad_) {...}
The inside of the brackets isnt being processed. I know this uses a bit mask, but they say Buttons is unsigned int. So the problem here could be the type of pad_. What could it be ?
EDIT: just had to use u32 instead of int.
actuallt u32 is the same as unsigned int
both the same.
Code: Select all
u32 i = 0;
unsigned int = 0;
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
Anything above 0x8000 is kernel only. You won't ever see 0x100000 at user level. That's why there's a kernel PRX floating around to let user mode homebrew check the HOME button.zydeoN wrote:I will just had to add this !(pad.Buttons & ...) to all the buttons.
Btw, why isnt this working:
int pad_ = 0x100000;
if(pad.Buttons & pad_) {...}
The inside of the brackets isnt being processed. I know this uses a bit mask, but they say Buttons is unsigned int. So the problem here could be the type of pad_. What could it be ?
EDIT: just had to use u32 instead of int.
I don't understand what you're trying to say here. I doubt the mask values of the buttons are related to any of the memory addresses (and whether or not those buttons are readable under user or kernel mode; Those buttons must be permanently masked by software in the syscall version of the functions, thats all). Anything above 0x7FFFFFFF is kernel (the upper 2GiB of the 4GiB of memory addresses the CPU can access).J.F. wrote:Anything above 0x8000 is kernel only. You won't ever see 0x100000 at user level. That's why there's a kernel PRX floating around to let user mode homebrew check the HOME button.zydeoN wrote:I will just had to add this !(pad.Buttons & ...) to all the buttons.
Btw, why isnt this working:
int pad_ = 0x100000;
if(pad.Buttons & pad_) {...}
The inside of the brackets isnt being processed. I know this uses a bit mask, but they say Buttons is unsigned int. So the problem here could be the type of pad_. What could it be ?
EDIT: just had to use u32 instead of int.
Unless I've completely missed a point somewhere =.=*
-
- Posts: 110
- Joined: Tue Feb 27, 2007 9:43 pm
- Contact:
Ok that way... They just got lucky they could split it up like that since the PSP has a limited number of buttons :/SilverSpring wrote:He is saying the button masks above 0x8000 (ie. the volume up/down, note, screen, etc. buttons) can only be read in kernel mode. Only the the normal keypad buttons (of which are masked to values under 0x8000) are readable when under user mode. It has nothing to do with memory addresses.
What he said. Sorry if that confused people. I meant the values that represent individual buttons in the .Buttons field. Those are defined in the pspctrl.h file. 0x0001 to 0x8000 are "normal" buttons like X, O, LTRIGGER, START, etc. Anything from 0x10000 on up are the "extra" buttons on the PSP like HOME, VOLUME_UP, NOTE, etc.SilverSpring wrote:He is saying the button masks above 0x8000 (ie. the volume up/down, note, screen, etc. buttons) can only be read in kernel mode. Only the the normal keypad buttons (of which are masked to values under 0x8000) are readable when under user mode. It has nothing to do with memory addresses.
Every once in a while, you'll see someone complain that their loop waiting on the NOTE button doesn't work, and they're confused since old homebrew had no trouble with that. The old homebrew ran in kernel mode, so NOTE was visible. New homebrew is usually user mode, and so it cannot see that button and the loop waits forever.