Open joystick buttons setup menu if not defined.
This commit is contained in:
12
input.cpp
12
input.cpp
@@ -1190,8 +1190,8 @@ void finish_map_setting(int dismiss)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dismiss) input[mapping_dev].has_map = 0;
|
||||
else FileSaveConfig(get_map_name(mapping_dev, 0), &input[mapping_dev].map, sizeof(input[mapping_dev].map));
|
||||
for (int i = 0; i < NUMDEV; i++) input[i].has_map = 0;
|
||||
if (!dismiss) FileSaveConfig(get_map_name(mapping_dev, 0), &input[mapping_dev].map, sizeof(input[mapping_dev].map));
|
||||
if (is_menu_core()) input[mapping_dev].has_mmap = 0;
|
||||
}
|
||||
}
|
||||
@@ -1545,8 +1545,9 @@ static void input_cb(struct input_event *ev, struct input_absinfo *absinfo, int
|
||||
input[dev].map[13] = 0;
|
||||
input[dev].map[14] = 0;
|
||||
input[dev].map[15] = 0;
|
||||
input[dev].has_map++;
|
||||
}
|
||||
input[dev].has_map = 1;
|
||||
input[dev].has_map++;
|
||||
}
|
||||
|
||||
if (!input[dev].has_mmap)
|
||||
@@ -1716,6 +1717,11 @@ static void input_cb(struct input_event *ev, struct input_absinfo *absinfo, int
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (input[dev].has_map == 2)
|
||||
{
|
||||
if (ev->value == 1) joy_digital(0, 0, 0, 3, 17);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i <= 15; i++)
|
||||
|
||||
16
menu.cpp
16
menu.cpp
@@ -1567,11 +1567,11 @@ void HandleUI(void)
|
||||
case MENU_JOYDIGMAP:
|
||||
helptext = 0;
|
||||
menumask = 1;
|
||||
OsdSetTitle("Joystick", 0);
|
||||
OsdSetTitle("Define buttons", 0);
|
||||
menustate = MENU_JOYDIGMAP1;
|
||||
parentstate = MENU_JOYDIGMAP;
|
||||
for (int i = 0; i < OsdGetSize() - 1; i++) OsdWrite(i, "", 0, 0);
|
||||
OsdWrite(OsdGetSize() - 1, " Cancel", menusub == 0, 0);
|
||||
OsdWrite(OsdGetSize() - 1, " ESC \x16 Cancel", menusub == 0, 0);
|
||||
break;
|
||||
|
||||
case MENU_JOYDIGMAP1:
|
||||
@@ -1603,7 +1603,7 @@ void HandleUI(void)
|
||||
OsdWrite(3, s, 0, 0);
|
||||
if (get_map_button())
|
||||
{
|
||||
if (get_map_type()) OsdWrite(OsdGetSize() - 1, " finish (SPACE - skip)", menusub == 0, 0);
|
||||
if (get_map_type()) OsdWrite(OsdGetSize() - 1, " Enter \x16 Finish, Space \x16 Skip", menusub == 0, 0);
|
||||
else OsdWrite(OsdGetSize() - 1, "", 0, 0);
|
||||
|
||||
sprintf(s, " %s ID: %04x:%04x", get_map_type() ? "Joystick" : "Keyboard", get_map_vid(), get_map_pid());
|
||||
@@ -3393,6 +3393,16 @@ void HandleUI(void)
|
||||
}
|
||||
}
|
||||
|
||||
void open_joystick_setup()
|
||||
{
|
||||
OsdSetSize(16);
|
||||
menusub = 0;
|
||||
OsdClear();
|
||||
OsdEnable(DISABLE_KEYBOARD);
|
||||
start_map_setting(joy_bcount ? joy_bcount + 4 : 8);
|
||||
menustate = MENU_JOYDIGMAP;
|
||||
}
|
||||
|
||||
void ScrollLongName(void)
|
||||
{
|
||||
// this function is called periodically when file selection window is displayed
|
||||
|
||||
2
menu.h
2
menu.h
@@ -26,4 +26,6 @@ void substrcpy(char *d, char *s, char idx);
|
||||
extern char joy_bnames[12][32];
|
||||
extern int joy_bcount;
|
||||
|
||||
void open_joystick_setup();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2473,8 +2473,8 @@ void user_io_kbd(uint16_t key, int press)
|
||||
else
|
||||
{
|
||||
if (is_menu_core()) printf("PS2 code(make)%s for core: %d(0x%X)\n", (code & EXT) ? "(ext)" : "", code & 255, code & 255);
|
||||
|
||||
if ((has_menu() || osd_is_visible || (get_key_mod() & (LALT | RALT | RGUI | LGUI))) && (((key == KEY_F12) && ((!is_x86_core() && !is_archie()) || (get_key_mod() & (RGUI | LGUI)))) || key == KEY_MENU)) menu_key_set(KEY_F12);
|
||||
if (!osd_is_visible && !is_menu_core() && key == KEY_MENU && press == 3) open_joystick_setup();
|
||||
else if ((has_menu() || osd_is_visible || (get_key_mod() & (LALT | RALT | RGUI | LGUI))) && (((key == KEY_F12) && ((!is_x86_core() && !is_archie()) || (get_key_mod() & (RGUI | LGUI)))) || key == KEY_MENU)) menu_key_set(KEY_F12);
|
||||
else if (osd_is_visible)
|
||||
{
|
||||
if (press == 1) menu_key_set(key);
|
||||
|
||||
Reference in New Issue
Block a user