|
Post by Tom Maneiro on Sept 5, 2005 23:18:03 GMT -5
I returned to work on CrazyBus, and i'm now working on a better bus selection screen. I have this code for now (on BEX 0.19):
vars: pagina=0 rpad=0 mainmenu: 'ADVERTENCIA: Este codigo funciona bien en Gens 'pero no en Fusion. Error de BEX o de Snake? 'Confirmar con el hardware real waitpadup 0 rpad=0 while rpad=0 rpad=joypad(0) wend waitpadup 0 'izq if rpad.2 then if pagina>1 then pagina-- else pagina=3 endif endif 'der if rpad.3 then if pagina<3 then pagina++ else pagina=1 endif endif cls if pagina=1 then print "Irizar" else if pagina=2 then print "Busscar" else if pagina=3 then print "ENCAVA" endif endif endif print pagina print "Pad: ";rpad goto mainmenu
Now compile it and run in Gens. It works fine, no problem. Then try it on Fusion, the so-called "most accurate Genesis emulator", and...
-Pad readings are 2048+the pressed button (Gens only returns the pressed button) -When i hit L or R (the keys used in this menu), these are not always recognized, and i just get 2048. So i must press a key several times to scroll between bus choices, in this code.
Known BEX bug, Fusion bug or Gens bug? What the heck is happening there? Can anyone test this in real hardware?
I will try with 0.26 beta later.
|
|
|
Post by Tom Maneiro on Sept 6, 2005 21:42:13 GMT -5
I rechecked my code, and i found in the BEX FAQ a fix: add "sleep 1" after reading the pad. This solved the "hard keys" issue on Fusion (and maybe, in the real thing), but the pad readings are still weirdo...
Want a WIP screenshot? Later!
|
|
oompa loompa
I AM THE GOVERNATOR
"Git 'Er Dun!"
Posts: 1,301
|
Post by oompa loompa on Sept 12, 2005 17:28:31 GMT -5
what do you mean by the pad readings being wierdo? does it mean that when you push up, a different key is shown on, or does pressing the key not react very fast to the program, or when pushing a key does the key appear to oscillate in the program?
also, there is a huge difference when you use 6 button joypads and 3 button joypads on the emulators, be sure to check it in your emulator settings. if you are using a 3 button joypad, and are not using the X, Y, Z, and MODE buttons on the 6 button controller (duh =P), but intend on your program to be compatible with the 6 button joypad, then discard any joypad values read that are not within the first 8 bits of the joypad result.
btw, don't use basiegaxorz 0.19, use 0.25 beta =P
|
|
|
Post by Snake on Mar 1, 2006 2:55:53 GMT -5
First off, you're only supposed to read the pad once *per frame*. You appear to be reading it constantly until something happens. This is bad. This will break with some pads on real hardware - with a 6 button pad it will ALWAYS break.
So, you should read once *per frame* only, and simply do nothing if no buttons are pressed.
I'd need to look at the code produced to find out more.
|
|
|
Post by jlf65 on Mar 1, 2006 23:44:39 GMT -5
Having used SEGA controllers on an Amiga, I can tell you that is the case - most SEGA controllers cannot be read more than once every 60th of a second. The standard code SEGA reccomends for reading pads is called once during the vertical blank interrupt. Attempting to read a SEGA controller more than 60 times per second yields undefined results.
|
|