mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-04-29 21:37:45 +00:00
Working turbo/autofire function (now needs config)
This commit is contained in:
1
osd.c
1
osd.c
@@ -852,6 +852,7 @@ void OsdTurboSet ( uint16_t turbo, uint16_t mask, uint8_t joy_num ) {
|
||||
uint8_t OsdJoyState ( uint8_t joy_num ) {
|
||||
if(joy_num>1) return 0;
|
||||
uint8_t result = mist_joy[joy_num].state;
|
||||
if(mist_joy[joy_num].turbo==0) return result;
|
||||
result &= mist_joy[joy_num].turbo_state;
|
||||
return result;
|
||||
}
|
||||
|
||||
16
usb/hid.c
16
usb/hid.c
@@ -754,20 +754,18 @@ static void usb_process_iface (usb_hid_iface_info_t *iface,
|
||||
//if (jmap != 0) iprintf("JMAP post map:%d\n", jmap);
|
||||
|
||||
// report joystick extra buttons to OSD
|
||||
OsdJoySetExtra( btn_extra, iface->jindex );
|
||||
idx = iface->jindex;
|
||||
OsdJoySet( jmap, idx );
|
||||
OsdJoySetExtra( btn_extra, idx );
|
||||
|
||||
// swap joystick 0 and 1 since 1 is the one
|
||||
// used primarily on most systems
|
||||
idx = iface->jindex;
|
||||
|
||||
if(idx == 0) idx = 1;
|
||||
else if(idx == 1) idx = 0;
|
||||
|
||||
// check if joystick state has changed
|
||||
if(jmap != iface->jmap) {
|
||||
// and feed into joystick input system
|
||||
user_io_digital_joystick(idx, jmap);
|
||||
iface->jmap = jmap;
|
||||
}
|
||||
|
||||
// run even if not changed
|
||||
user_io_digital_joystick(idx, jmap);
|
||||
|
||||
// also send analog values
|
||||
user_io_analog_joystick(idx, a[0]-128, a[1]-128);
|
||||
|
||||
@@ -328,11 +328,13 @@ void user_io_digital_joystick(unsigned char joystick, unsigned char map) {
|
||||
|
||||
if (joystick==1) {
|
||||
OsdJoySet(map, 0);
|
||||
//map = (unsigned char)OsdJoyState(0); //apply turbo
|
||||
OsdTurboUpdate(0);
|
||||
map = (unsigned char)OsdJoyState(0); //apply turbo
|
||||
}
|
||||
else if (joystick==0) {// WARNING: 0 is the second joystick, either USB or DB9
|
||||
OsdJoySet(map, 1);
|
||||
//map = (unsigned char)OsdJoyState(1); //apply turbo
|
||||
OsdTurboUpdate(1);
|
||||
map = (unsigned char)OsdJoyState(1); //apply turbo
|
||||
}
|
||||
|
||||
// if osd is open control it via joystick
|
||||
|
||||
Reference in New Issue
Block a user