mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-04-25 03:55:33 +00:00
Move joystick_reset to StateReset(), remove unused code
This commit is contained in:
15
menu.c
15
menu.c
@@ -354,19 +354,6 @@ void get_joystick_id ( char *usb_id, unsigned char joy_num, short raw_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// De-init all joysticks, useful when changing core
|
||||
void joystick_reset() {
|
||||
uint8_t idx;
|
||||
|
||||
for(idx=0; idx<6; idx++) {
|
||||
StateJoySet(0, idx);
|
||||
StateJoySetExtra(0, idx);
|
||||
StateUsbIdSet(0, 0, 0, idx);
|
||||
StateUsbJoySet(0, 0, idx);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char getIdx(char *opt) {
|
||||
if((opt[1]>='0') && (opt[1]<='9')) return opt[1]-'0';
|
||||
if((opt[1]>='A') && (opt[1]<='V')) return opt[1]-'A'+10;
|
||||
@@ -3376,7 +3363,7 @@ void HandleUI(void)
|
||||
fpga_init(file.name);
|
||||
|
||||
// De-init joysticks to allow re-ordering for new core
|
||||
joystick_reset();
|
||||
StateReset();
|
||||
|
||||
menustate = MENU_NONE1;
|
||||
break;
|
||||
|
||||
41
state.c
41
state.c
@@ -57,6 +57,18 @@ static mist_joystick_t mist_joysticks[7] = { // 7th one is dummy, used to store
|
||||
joy_init
|
||||
};
|
||||
|
||||
// De-init all joysticks, useful when changing core
|
||||
void StateReset() {
|
||||
uint8_t idx;
|
||||
|
||||
for(idx=0; idx<6; idx++) {
|
||||
StateJoySet(0, idx);
|
||||
StateJoySetExtra(0, idx);
|
||||
StateUsbIdSet(0, 0, 0, idx);
|
||||
StateUsbJoySet(0, 0, idx);
|
||||
}
|
||||
}
|
||||
|
||||
// sets a joystick to input status
|
||||
void StateJoyCopy ( uint8_t num_joy, mist_joystick_t* joy ) {
|
||||
mist_joystick_t mine;
|
||||
@@ -120,11 +132,11 @@ 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 > 5) return;
|
||||
if (joy_num > 5) return;
|
||||
osd_joy[joy_num] = c;
|
||||
}
|
||||
void StateJoySetExtra(uint8_t c, uint8_t joy_num) {
|
||||
if (joy_num > 5) return;
|
||||
if (joy_num > 5) return;
|
||||
osd_joy_extra[joy_num] = c;
|
||||
}
|
||||
uint8_t StateJoyGet(uint8_t joy_num) {
|
||||
@@ -138,7 +150,7 @@ 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 > 5) return;
|
||||
if (joy_num > 5) return;
|
||||
raw_usb_joy[joy_num] = usbjoy;
|
||||
raw_usb_joy_extra[joy_num] = usbextra;
|
||||
}
|
||||
@@ -155,7 +167,7 @@ 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 > 5) return;
|
||||
if (joy_num > 5) return;
|
||||
usb_vid[joy_num] = vid;
|
||||
usb_pid[joy_num] = pid;
|
||||
num_buttons[joy_num] = num;
|
||||
@@ -271,24 +283,3 @@ void StateKeyboardPressed(uint8_t *keycodes) {
|
||||
keycodes[i]=key_pressed[i];
|
||||
}
|
||||
|
||||
|
||||
/* core currently loaded */
|
||||
static char lastcorename[261+10] = "CORE";
|
||||
void StateCoreNameSet(const char* str) {
|
||||
siprintf(lastcorename, "%s", str);
|
||||
}
|
||||
char* StateCoreName() {
|
||||
return lastcorename;
|
||||
}
|
||||
|
||||
// clear all states
|
||||
void StateReset() {
|
||||
strcpy(lastcorename, "CORE");
|
||||
//State_key = 0;
|
||||
//joysticks=0;
|
||||
key_modifier = 0;
|
||||
for(int i=0; i<6; i++) {
|
||||
key_pressed[i]=0;
|
||||
keys_ps2[i]=0;
|
||||
}
|
||||
}
|
||||
6
state.h
6
state.h
@@ -27,6 +27,8 @@ typedef struct {
|
||||
* Various functions to retrieve hardware state from the State
|
||||
*/
|
||||
|
||||
void StateReset();
|
||||
|
||||
// USB raw data for joystick
|
||||
void StateUsbJoySet(uint8_t usbjoy, uint8_t usbextra, uint8_t joy_num);
|
||||
void StateUsbIdSet(uint16_t vid, uint16_t pid, uint8_t num_buttons, uint8_t joy_num);
|
||||
@@ -74,9 +76,5 @@ uint8_t StateKeyboardModifiers();
|
||||
void StateKeyboardPressed(uint8_t *pressed);
|
||||
void StateKeyboardPressedPS2(uint16_t *keycodes);
|
||||
|
||||
// get/set core currently loaded
|
||||
void StateCoreNameSet(const char* str);
|
||||
char* StateCoreName();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user