Advice on controller input


Established Member
I'm having a problem with the input. Suppose a user hits the start button on my main menu, it will go on to the first choice, and then that button press will sometimes be retained for the next controller query.

For example if the user hits start on "Format Device", it should go to another screen asking the user to confirm. Sometimes (ok most times) it will automatically go forward, as if the user hit start again (I found out this the hard way, but on the bright side that probably makes me the first guy to ever program a virus for the saturn :devil).

So any tips on avoiding this problem? Thanks in advance.
Your problem may be you're simply just pollling the pads too rapidly. If you want to check for two consecutive "start" presses, check that "start" is NOT pressed inbetween.
You have to detect whether the state of the start button actually changed or not. In order to do that, function like these to know if the button has been pressed (or released).

// 1->0

Uint16 pad_GetDownFront (Uint16 prev, Uint16 cur) {

 Uint16 downfront;

 downfront = (~((~prev) & cur)); 

 return downfront;


// 0->1

Uint16 pad_GetUpFront (Uint16 prev, Uint16 cur) {

 Uint16 upfront = 0;

 upfront = pad_GetDownFront(cur,prev);

 return upfront;


You have to save the last known state (prev) somewhere; update it each time you check the button state.
I found much more simple : use Smpc_Peripheral->push

pptr = Smpc_Peripheral;

padd   = ~pptr->data;

padpush = ~pptr->push;

if(padp & PER_DGT_TA){

 // do something when the button is being pushed

Yes, I would also advice to use the push data.

But you have to take care of nested function calls that use that pad data. This can cause the user flipping through menus with one button press!

The thing is that it seems like the pad data keeps constant till the next slSynch(); is done.

In my project, I inserted a waitRelease() at the top of every function that looks at controller input.

Another thing: for 2 player games, the pad data for second player is Smpc_Peripheral[15].data .

And lastly: on my japanese model 1 Saturn, the peripheral check fails!!!

For some unknown reason, the variable Per_Connect1 is not 1 for any controller I got!? The game works very well on the european Saturn.... .

OK, bye then.

The Rockin'-B