diff --git a/menu.c b/menu.c index cd8dc51..953aa19 100644 --- a/menu.c +++ b/menu.c @@ -98,30 +98,6 @@ static mist_joystick_t mist_joy[3] = { // 3rd one is dummy, used to store defaul }; // state of MIST virtual joystick - - - - -void NumJoysticksSet(unsigned char num) { - mist_joystick_t joy; - StateNumJoysticksSet(num); - if(num<3) { - //clear USB joysticks - if(num<2) - joy = mist_joy[0]; - else - joy = mist_joy[1]; - joy.vid=0; - joy.vid=0; - joy.num_buttons=1; - joy.state=0; - joy.state_extra=0; - joy.usb_state=0; - joy.usb_state_extra=0; - } -} - - // other constants #define DIRSIZE 8 // number of items in directory display window @@ -367,7 +343,7 @@ void get_joystick_state( char *joy_string, char *joy_string2, uint8_t joy_num ) return; } -void get_joystick_state_usb( char *s, unsigned char joy_num ) { +void get_joystick_state_usb( char *s, unsigned char joy_num ) { /* USB specific - current "raw" state (in reverse binary format to correspont to MIST.INI mapping entries) */ @@ -376,7 +352,7 @@ void get_joystick_state_usb( char *s, unsigned char joy_num ) { char binary_string[9]="00000000"; unsigned char joy = 0; unsigned int max_btn = 1; - if (StateNumJoysticks()==0 || (joy_num==1 && StateNumJoysticks()<2)) + if (StateNumJoysticks() <= joy_num) { strcpy( s, " "); return; @@ -415,36 +391,42 @@ void get_joystick_id ( char *usb_id, unsigned char joy_num, short raw_id ) { Builds a string containing the USB VID/PID information of a joystick */ char buffer[32]=""; - mist_joystick_t joystick; - if (joy_num>3) - joystick=mist_joy[2]; - else - joystick=mist_joy[joy_num]; - + if (raw_id==0) { - if (StateNumJoysticks()==0 || (joy_num==1 && StateNumJoysticks()<2)) + if (joy_num >= StateNumJoysticks()) { strcpy( usb_id, " "); - strcat( usb_id, "Atari DB9 Joystick"); + if (joy_num < StateNumJoysticks()+2) { + strcat( usb_id, "Atari DB9 Joystick"); + } else { + strcat( usb_id, "None"); + } return; } } - + //hack populate from outside - joystick.vid = StateUsbVidGet(joy_num); - joystick.pid = StateUsbPidGet(joy_num); - + int vid = StateUsbVidGet(joy_num); + int pid = StateUsbPidGet(joy_num); + memset(usb_id, '\0', sizeof(usb_id)); - if (joystick.vid>0) { + if (vid>0) { if (raw_id == 0) { - strcpy(buffer, get_joystick_alias( joystick.vid, joystick.pid )); + strcpy(buffer, get_joystick_alias( vid, pid )); } if(strlen(buffer)==0) { - append_joystick_usbid( buffer, joystick.vid, joystick.pid ); - } + append_joystick_usbid( buffer, vid, pid ); + } } else { - strcpy(buffer, "Atari DB9 Joystick"); - } + if (joy_num >= StateNumJoysticks()) + { + if (joy_num < StateNumJoysticks()+2) { + strcpy( buffer, "Atari DB9 Joystick"); + } else { + strcpy( buffer, "None"); + } + } + } if(raw_id == 0) siprintf(usb_id, "%*s", (28-strlen(buffer))/2, " "); else @@ -533,6 +515,7 @@ void HandleUI(void) uint16_t keys_ps2[6] = {0,0,0,0,0,0}; mist_joystick_t joy0, joy1; + static unsigned char joytest_num; /* check joystick status */ char joy_string[32]; @@ -1200,20 +1183,20 @@ void HandleUI(void) case MENU_8BIT_CONTROLLERS1: helptext = helptexts[HELPTEXT_NONE]; - menumask=0x3f; + menumask=0x7f; OsdSetTitle("Inputs", 0); menustate = MENU_8BIT_CONTROLLERS2; parentstate=MENU_8BIT_CONTROLLERS1; - OsdWrite(0, " Turbo Settings (disabled) ", menusub==0, 1); //OsdWrite(0, " Turbo Settings \x16", menusub==0, 0); - OsdWrite(1, " Joystick 1 Test \x16", menusub==1, 0); - OsdWrite(2, " Joystick 2 Test \x16", menusub==2, 0); - OsdWrite(3, " Keyboard Test \x16", menusub==3, 0); - OsdWrite(4, " USB status \x16", menusub==4, 0); - OsdWrite(5, "", 0, 0); + OsdWrite(0, " Joystick 1 Test \x16", menusub==0, 0); + OsdWrite(1, " Joystick 2 Test \x16", menusub==1, 0); + OsdWrite(2, " Joystick 3 Test \x16", menusub==2, 0); + OsdWrite(3, " Joystick 4 Test \x16", menusub==3, 0); + OsdWrite(4, " Keyboard Test \x16", menusub==4, 0); + OsdWrite(5, " USB status \x16", menusub==5, 0); //OsdWrite(5, " CHR test \x16", menusub==6, 0); OsdWrite(6, "", 0, 0); - OsdWrite(7, STD_EXIT, menusub==5, 0); + OsdWrite(7, STD_EXIT, menusub==6, 0); break; case MENU_8BIT_CONTROLLERS2: @@ -1225,31 +1208,25 @@ void HandleUI(void) if(select) { switch (menusub) { case 0: - // Turbo config - //menustate = MENU_8BIT_TURBO1; - menusub=0; - break; case 1: - // Joystick1 Test - menustate = MENU_8BIT_JOYTEST_A1; - menusub = 0; - break; case 2: - // Joystick2 test - menustate = MENU_8BIT_JOYTEST_B1; + case 3: + // Joystick Test + menustate = MENU_8BIT_JOYTEST1; + joytest_num = menusub; menusub = 0; break; - case 3: + case 4: // Keyboard test menustate = MENU_8BIT_KEYTEST1; menusub = 0; break; - case 4: + case 5: // USB status menustate=MENU_8BIT_USB1; menusub = 0; break; - case 5: + case 6: // Exit to system menu menustate=MENU_8BIT_SYSTEM1; menusub = 1; @@ -1314,7 +1291,7 @@ void HandleUI(void) if(keys[i]==0x29) { //ESC if(c==KEY_SPACE) { menustate = MENU_8BIT_CONTROLLERS1; - menusub = 2; + menusub = 4; } } } @@ -1326,57 +1303,50 @@ void HandleUI(void) OsdSetTitle("USB", 0); menustate = MENU_8BIT_USB2; parentstate=MENU_8BIT_USB1; - strcpy(usb_id, " "); - get_joystick_id( usb_id, 0, 1); - siprintf(s, " Joy1 - %s", usb_id); - OsdWrite(0, "", 0, 0); - OsdWrite(1, s, 0, 0); - strcpy(usb_id, " "); - get_joystick_id( usb_id, 1, 1); - siprintf(s, " Joy2 - %s", usb_id); - OsdWrite(2, "", 0, 0); - OsdWrite(3, s, 0, 0); - OsdWrite(4, "", 0, 0); - OsdWrite(5, "", 0, 0); + for(i=0;i<6;i++) { + strcpy(usb_id, " "); + get_joystick_id( usb_id, i, 1); + siprintf(s, " Joy%d - %s", i+1, usb_id); + OsdWrite(i, s, 0, 0); + } OsdWrite(6, " ", 0, 0); OsdWrite(7, STD_EXIT, menusub==0, 0); break; - + case MENU_8BIT_USB2: menumask=1; OsdSetTitle("USB", 0); - strcpy(usb_id, " "); - get_joystick_id( usb_id, 0, 1); - siprintf(s, " Joy1 - %s", usb_id); - OsdWrite(0, "", 0, 0); - OsdWrite(1, s, 0, 0); - strcpy(usb_id, " "); - get_joystick_id( usb_id, 1, 1); - siprintf(s, " Joy2 - %s", usb_id); - OsdWrite(2, "", 0, 0); - OsdWrite(3, s, 0, 0); + for(i=0;i<6;i++) { + strcpy(usb_id, " "); + get_joystick_id( usb_id, i, 1); + siprintf(s, " Joy%d - %s", i+1, usb_id); + OsdWrite(i, s, 0, 0); + } + OsdWrite(6, " ", 0, 0); OsdWrite(7, STD_EXIT, menusub==0, 0); // menu key goes back to previous menu if (menu) { menustate = MENU_8BIT_CONTROLLERS1; - menusub = 3; + menusub = 5; } if(select) { if(menusub==0) { menustate = MENU_8BIT_CONTROLLERS1; - menusub = 3; + menusub = 5; } } break; - - case MENU_8BIT_JOYTEST_A1: + + case MENU_8BIT_JOYTEST1: helptext = helptexts[HELPTEXT_NONE]; menumask=1; - get_joystick_id( usb_id, 0, 0); - OsdSetTitle("Joy1", 0); - menustate = MENU_8BIT_JOYTEST_A2; - parentstate=MENU_8BIT_JOYTEST_A1; - OsdWrite(0, " Test Joystick 1", 0, 0); + get_joystick_id( usb_id, joytest_num, 0); + siprintf(s, "Joy%d", joytest_num + 1); + OsdSetTitle(s, 0); + menustate = MENU_8BIT_JOYTEST2; + parentstate=MENU_8BIT_JOYTEST1; + siprintf(s, " Test Joystick %d", joytest_num + 1); + OsdWrite(0, s, 0, 0); OsdWrite(1, usb_id, 0, 0); OsdWrite(2, "", 0, 0); OsdWrite(3, "", 0, 0); @@ -1385,57 +1355,24 @@ void HandleUI(void) OsdWrite(6, " ", 0, 0); OsdWrite(7, STD_SPACE_EXIT, menusub==0, 0); break; - - case MENU_8BIT_JOYTEST_A2: - get_joystick_state( joy_string, joy_string2, 0 ); //grab state of joy 0 - get_joystick_id( usb_id, 0, 0 ); + + case MENU_8BIT_JOYTEST2: + get_joystick_state( joy_string, joy_string2, joytest_num ); //grab state of joy + get_joystick_id( usb_id, joytest_num, 0 ); OsdWrite(1, usb_id, 0, 0); OsdWrite(3, joy_string, 0, 0); OsdWrite(4, joy_string2, 0, 0); OsdWrite(5, " ", 0, 0); // display raw USB input - get_joystick_state_usb ( s, 0 ); + get_joystick_state_usb ( s, joytest_num ); OsdWrite(6, s, 0,0); - // allow allow exit when hitting space + // allow exit when hitting space if(c==KEY_SPACE) { menustate = MENU_8BIT_CONTROLLERS1; - menusub = 0; + menusub = joytest_num; } break; - - case MENU_8BIT_JOYTEST_B1: - helptext = helptexts[HELPTEXT_NONE]; - menumask=1; - get_joystick_id( usb_id, 1, 0); - OsdSetTitle("Joy2", 0); - menustate = MENU_8BIT_JOYTEST_B2; - parentstate=MENU_8BIT_JOYTEST_B1; - OsdWrite(0, " Test Joystick 2", 0, 0); - OsdWrite(1, usb_id, 0, 0); - OsdWrite(2, "", 0, 0); - OsdWrite(3, "", 0, 0); - OsdWrite(4, "", 0, 0); - OsdWrite(5, "", 0, 0); - OsdWrite(6, " ", 0, 0); - OsdWrite(7, STD_SPACE_EXIT, menusub==0, 0); - break; - case MENU_8BIT_JOYTEST_B2: - get_joystick_state( joy_string, joy_string2, 1 ); - get_joystick_id( usb_id, 1, 0); - OsdWrite(1, usb_id, 0, 0); - OsdWrite(3, joy_string, 0, 0); - OsdWrite(4, joy_string2, 0, 0); - OsdWrite(5, " ", 0, 0); - // display raw USB input - get_joystick_state_usb ( s, 1 ); - OsdWrite(6, s, 0,0); - // allow allow exit when hitting space - if(c==KEY_SPACE) { - menustate = MENU_8BIT_CONTROLLERS1; - menusub = 1; - } - break; - + case MENU_8BIT_TURBO1: helptext = helptexts[HELPTEXT_NONE]; menumask=0x1F; diff --git a/menu.h b/menu.h index 72c3939..b5a2081 100644 --- a/menu.h +++ b/menu.h @@ -99,12 +99,10 @@ enum MENU MENU_8BIT_SYSTEM2, MENU_8BIT_ABOUT1, MENU_8BIT_ABOUT2, - MENU_8BIT_CONTROLLERS1, - MENU_8BIT_CONTROLLERS2, - MENU_8BIT_JOYTEST_A1, - MENU_8BIT_JOYTEST_A2, - MENU_8BIT_JOYTEST_B1, - MENU_8BIT_JOYTEST_B2, + MENU_8BIT_CONTROLLERS1, + MENU_8BIT_CONTROLLERS2, + MENU_8BIT_JOYTEST1, + MENU_8BIT_JOYTEST2, MENU_8BIT_KEYTEST1, MENU_8BIT_KEYTEST2, MENU_8BIT_USB1, diff --git a/state.c b/state.c index 7461e36..523e381 100644 --- a/state.c +++ b/state.c @@ -29,83 +29,38 @@ This code keeps status of MiST state //#include "charrom.h" +// for I/O +static mist_joystick_t mist_joystick_temp; -// for I/O -static mist_joystick_t mist_joystick_temp = { - .vid = 0, - .pid = 0, - .num_buttons=1, // DB9 has 1 button - .state=0, - .state_extra=0, - .usb_state=0, - .usb_state_extra=0, - .turbo=0, - .turbo_counter=0, - .turbo_mask=0x30, // A and B buttons - .turbo_state=0xFF // flip state (0 or 1) - }; - -/* latest joystick state */ -static mist_joystick_t mist_joysticks[3] = { // 3rd one is dummy, used to store defaults - { - .vid = 0, - .pid = 0, - .num_buttons=1, // DB9 has 1 button - .state=0, - .state_extra=0, - .usb_state=0, - .usb_state_extra=0, - .turbo=0, - .turbo_counter=0, - .turbo_mask=0x30, // A and B buttons - .turbo_state=0xFF // flip state (0 or 1) - }, - { - .vid = 0, - .pid = 0, - .num_buttons=1, // DB9 has 1 button - .state=0, - .state_extra=0, - .usb_state=0, - .usb_state_extra=0, - .turbo=0, - .turbo_counter=0, - .turbo_mask=0x30, // A and B buttons - .turbo_state=0xFF // flip state (0 or 1) - }, - { - .vid = 0, - .pid = 0, - .num_buttons=1, // DB9 has 1 button - .state=0, - .state_extra=0, - .usb_state=0, - .usb_state_extra=0, - .turbo=0, - .turbo_counter=0, - .turbo_mask=0x30, // A and B buttons - .turbo_state=0xFF // flip state (0 or 1) +#define joy_init { \ + .vid = 0, \ + .pid = 0, \ + .num_buttons=1, \ + .state=0 , \ + .state_extra=0, \ + .usb_state=0, \ + .usb_state_extra=0, \ + .turbo=0, \ + .turbo_counter=0, \ + .turbo_mask=0x30, \ + .turbo_state=0xFF \ } -}; -void joy_reset ( mist_joystick_t joy ) { - joy.vid = 0; - joy.pid = 0; - joy.num_buttons=1; // DB9 has 1 button - joy.state=0; - joy.state_extra=0; - joy.usb_state=0; - joy.usb_state_extra=0; - joy.turbo=0; - joy.turbo_counter=0; - joy.turbo_mask=0x30; // A and B buttons - joy.turbo_state=0xFF; // flip state (0 or 1) -} +/* latest joystick state */ +static mist_joystick_t mist_joysticks[7] = { // 7th one is dummy, used to store defaults + joy_init, + joy_init, + joy_init, + joy_init, + joy_init, + joy_init, + joy_init +}; // sets a joystick to input status void StateJoyCopy ( uint8_t num_joy, mist_joystick_t* joy ) { mist_joystick_t mine; - if(num_joy>1) return; + if(num_joy>5) return; if(!joy) return; mine = mist_joysticks[num_joy]; mine.vid = joy->vid; @@ -123,7 +78,7 @@ void StateJoyCopy ( uint8_t num_joy, mist_joystick_t* joy ) { void StateJoyRead ( uint8_t num_joy, mist_joystick_t* joy ) { mist_joystick_t mine; - if(num_joy>1) return; + if(num_joy>5) return; if(!joy) return; mine = mist_joysticks[num_joy]; joy->vid = mine.vid; @@ -134,7 +89,7 @@ void StateJoyRead ( uint8_t num_joy, mist_joystick_t* joy ) { joy->usb_state=mine.usb_state; joy->usb_state_extra=mine.usb_state_extra; joy->turbo=mine.turbo; - joy->turbo_counter=mine.turbo_counter; + joy->turbo_counter=mine.turbo_counter; joy->turbo_mask=mine.turbo_mask; joy->turbo_state=mine.turbo_state; } @@ -160,82 +115,65 @@ uint8_t StateJoyStructureState ( uint8_t num_joy) { } /* latest joystick state */ -static uint8_t osd_joy; -static uint8_t osd_joy_extra; -static uint8_t osd_joy2; -static uint8_t osd_joy_extra2; +static uint8_t osd_joy[6]; +static uint8_t osd_joy_extra[6]; + void StateJoySet(uint8_t c, uint8_t joy_num) { //iprintf("OSD joy: %x\n", c); - if(joy_num==0) - osd_joy = c; - else - osd_joy2 = c; + if (joy_num > 5) return; + osd_joy[joy_num] = c; } void StateJoySetExtra(uint8_t c, uint8_t joy_num) { - if(joy_num==0) - osd_joy_extra = c; - else - osd_joy_extra2 = c; + if (joy_num > 5) return; + osd_joy_extra[joy_num] = c; } uint8_t StateJoyGet(uint8_t joy_num) { - return joy_num==0?osd_joy:osd_joy2; + return (joy_num < 6) ? osd_joy[joy_num] : 0; } uint8_t StateJoyGetExtra(uint8_t joy_num) { - return joy_num==0?osd_joy_extra:osd_joy_extra2; + return (joy_num < 6) ? osd_joy_extra[joy_num] : 0; } -static uint8_t raw_usb_joy; // four directions and 4 buttons -static uint8_t raw_usb_joy_extra; // eight extra buttons -static uint8_t raw_usb_joy_b; // four directions and 4 buttons -static uint8_t raw_usb_joy_extra_b; // eight extra buttons +static uint8_t raw_usb_joy[6]; // four directions and 4 buttons +static uint8_t raw_usb_joy_extra[6]; // eight extra buttons + void StateUsbJoySet(uint8_t usbjoy, uint8_t usbextra, uint8_t joy_num) { - if(joy_num==0) { - raw_usb_joy = usbjoy; - raw_usb_joy_extra = usbextra; - } else { - raw_usb_joy_b = usbjoy; - raw_usb_joy_extra_b = usbextra; - } + if (joy_num > 5) return; + raw_usb_joy[joy_num] = usbjoy; + raw_usb_joy_extra[joy_num] = usbextra; } uint8_t StateUsbJoyGet(uint8_t joy_num) { - return (joy_num==0)?raw_usb_joy:raw_usb_joy_b; + return (joy_num < 6) ? raw_usb_joy[joy_num] : 0; } uint8_t StateUsbJoyGetExtra(uint8_t joy_num) { - return (joy_num==0)?raw_usb_joy_extra:raw_usb_joy_extra_b; + return (joy_num < 6) ? raw_usb_joy_extra[joy_num] : 0; } -static uint16_t usb_vid; -static uint16_t usb_pid; -static uint8_t num_buttons; -static uint16_t usb_vid_b; -static uint16_t usb_pid_b; -static uint8_t num_buttons_b; +static uint16_t usb_vid[6]; +static uint16_t usb_pid[6]; +static uint8_t num_buttons[6]; + void StateUsbIdSet(uint16_t vid, uint16_t pid, uint8_t num, uint8_t joy_num) { - if(joy_num==0) { - usb_vid=vid; - usb_pid=pid; - num_buttons = num; - } else { - usb_vid_b=vid; - usb_pid_b=pid; - num_buttons_b = num; - } + if (joy_num > 5) return; + usb_vid[joy_num] = vid; + usb_pid[joy_num] = pid; + num_buttons[joy_num] = num; } uint16_t StateUsbVidGet(uint8_t joy_num) { - return joy_num==0?usb_vid:usb_vid_b; + return (joy_num < 6) ? usb_vid[joy_num] : 0; } uint16_t StateUsbPidGet(uint8_t joy_num) { - return joy_num==0?usb_pid:usb_pid_b; + return (joy_num < 6) ? usb_pid[joy_num] : 0; } uint8_t StateUsbGetNumButtons(uint8_t joy_num) { - return (joy_num==0)?num_buttons:num_buttons_b; + return (joy_num < 6) ? num_buttons[joy_num] : 0; } // return joystick state take into account turbo settings void StateJoyState( uint8_t joy_num, mist_joystick_t* joy ) { mist_joystick_t mine; - if (joy_num>1) return; + if (joy_num>5) return; if(!joy) return; joy->vid = StateUsbVidGet(joy_num); joy->pid = StateUsbPidGet(joy_num); @@ -353,7 +291,4 @@ void StateReset() { key_pressed[i]=0; keys_ps2[i]=0; } - //joy_reset(mist_joy[0]); - //joy_reset(mist_joy[1]); - //joy_reset(mist_joy[2]); } \ No newline at end of file diff --git a/usb/hid.c b/usb/hid.c index 4a1a294..6a59b99 100644 --- a/usb/hid.c +++ b/usb/hid.c @@ -473,11 +473,9 @@ static uint8_t usb_hid_release(usb_device_t *dev) { } // one less joystick in the system ... joysticks--; - StateNumJoysticksSet(joysticks); - if (joysticks < 2) - StateUsbIdSet(0, 0, 0, 1); - if (joysticks < 1) - StateUsbIdSet(0, 0, 0, 0); + StateNumJoysticksSet(joysticks); + if (joysticks < 6) + StateUsbIdSet(0, 0, 0, joysticks); } } @@ -765,6 +763,7 @@ static void usb_process_iface (usb_hid_iface_info_t *iface, // report joysticks to OSD idx=iface->jindex; + StateJoySet(jmap, idx); StateJoySetExtra( btn_extra, idx); // swap joystick 0 and 1 since 1 is the one // used primarily on most systems diff --git a/user_io.c b/user_io.c index 219764d..8ecb0a0 100644 --- a/user_io.c +++ b/user_io.c @@ -344,52 +344,22 @@ void user_io_digital_joystick(unsigned char joystick, unsigned char map) { // "only" 6 joysticks are supported if(joystick > 5) return; - - // the physical joysticks (db9 ports at the right device side) - // as well as the joystick emulation are renumbered if usb joysticks - // are present in the system. The USB joystick(s) replace joystick 1 - // and 0 and the physical joysticks are "shifted up". - // Since the primary joystick is in port 1 the first usb joystick - // becomes joystick 1 and only the second one becomes joystick 0 - // (mouse port) - - StateJoySet(state, joystick==0?1:0); - if (joystick==1) { - //StateJoyUpdateTurboStructure(0); - //map = (unsigned char) StateJoyStructureState(0) & 0xFF; - } - else if (joystick==0) {// WARNING: 0 is the second joystick, either USB or DB9 - //StateJoyUpdateTurboStructure(1); - //map = (unsigned char) StateJoyStructureState(1) & 0xFF; - } - - // if osd is open control it via joystick - if(osd_is_visible) { - static const uint8_t joy2kbd[] = { - OSDCTRLMENU, OSDCTRLMENU, OSDCTRLMENU, OSDCTRLSELECT, - OSDCTRLUP, OSDCTRLDOWN, OSDCTRLLEFT, OSDCTRLRIGHT }; - - // iprintf("joy to osd\n"); - - // OsdKeySet(0x80 | usb2ami[pressed[i]]); - - return; - } + // if osd is open, control it via joystick + if(osd_is_visible) + return; //iprintf("j%d: %x\n", joystick, map); - // atari ST handles joystick 0 and 1 through the ikbd emulated by the io controller // but only for joystick 1 and 2 if((core_type == CORE_TYPE_MIST) && (joystick < 2)) { ikbd_joystick(joystick, map); return; } - - // every other core else uses this + + // every other core else uses this // (even MIST, joystick 3 and 4 were introduced later) - spi_uio_cmd8((joystick < 2)?(UIO_JOYSTICK0 + joystick):((UIO_JOYSTICK2 + joystick - 2)), map); - + spi_uio_cmd8((joystick < 2)?(UIO_JOYSTICK0 + joystick):((UIO_JOYSTICK2 + joystick - 2)), map); } void user_io_digital_joystick_ext(unsigned char joystick, uint16_t map) { @@ -971,6 +941,7 @@ void user_io_poll() { if(!(joy0_state & JOY0_BTN2)) joy_map |= JOY_BTN2; user_io_joystick(joystick_renumber(0), joy_map); + StateJoySet(joy_map, hid_get_joysticks()); // send to OSD } static int joy1_state = JOY1; @@ -984,8 +955,9 @@ void user_io_poll() { if(!(joy1_state & JOY1_RIGHT)) joy_map |= JOY_RIGHT; if(!(joy1_state & JOY1_BTN1)) joy_map |= JOY_BTN1; if(!(joy1_state & JOY1_BTN2)) joy_map |= JOY_BTN2; - + user_io_joystick(joystick_renumber(1), joy_map); + StateJoySet(joy_map, hid_get_joysticks()+1); // send to OSD } user_io_send_buttons(0);