Input: show message if joystick not defined. Request to define the joystick in Menu core.
This commit is contained in:
23
input.cpp
23
input.cpp
@@ -1211,12 +1211,17 @@ void finish_map_setting(int dismiss)
|
||||
|
||||
uint16_t get_map_vid()
|
||||
{
|
||||
return (mapping_dev >= 0) ? input[mapping_dev].vid : 0;
|
||||
return (mapping && mapping_dev >= 0) ? input[mapping_dev].vid : 0;
|
||||
}
|
||||
|
||||
uint16_t get_map_pid()
|
||||
{
|
||||
return (mapping_dev >= 0) ? input[mapping_dev].pid : 0;
|
||||
return (mapping && mapping_dev >= 0) ? input[mapping_dev].pid : 0;
|
||||
}
|
||||
|
||||
int has_default_map()
|
||||
{
|
||||
return (mapping_dev >= 0) ? (input[mapping_dev].has_mmap == 1) : 0;
|
||||
}
|
||||
|
||||
static char kr_fn_table[] =
|
||||
@@ -1575,8 +1580,9 @@ static void input_cb(struct input_event *ev, struct input_absinfo *absinfo, int
|
||||
if (!FileLoadConfig(get_map_name(dev, 1), &input[dev].mmap, sizeof(input[dev].mmap)))
|
||||
{
|
||||
memset(input[dev].mmap, 0, sizeof(input[dev].mmap));
|
||||
input[dev].has_mmap++;
|
||||
}
|
||||
input[dev].has_mmap = 1;
|
||||
input[dev].has_mmap++;
|
||||
}
|
||||
|
||||
//mapping
|
||||
@@ -1879,13 +1885,14 @@ 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, BTN_OSD);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input[dev].has_map == 2)
|
||||
{
|
||||
Info("This joystick is not defined\n Using default map");
|
||||
input[dev].has_map = 1;
|
||||
}
|
||||
|
||||
for (uint i = 0; i < BTN_NUM; i++)
|
||||
{
|
||||
if (ev->code == input[dev].map[i])
|
||||
|
||||
1
input.h
1
input.h
@@ -43,6 +43,7 @@ int get_map_type();
|
||||
void finish_map_setting(int dismiss);
|
||||
uint16_t get_map_vid();
|
||||
uint16_t get_map_pid();
|
||||
int has_default_map();
|
||||
|
||||
uint32_t get_key_mod();
|
||||
uint32_t get_ps2_code(uint16_t key);
|
||||
|
||||
31
menu.cpp
31
menu.cpp
@@ -96,6 +96,7 @@ enum MENU
|
||||
MENU_STORAGE,
|
||||
MENU_JOYDIGMAP,
|
||||
MENU_JOYDIGMAP1,
|
||||
MENU_JOYDIGMAP2,
|
||||
MENU_JOYKBDMAP,
|
||||
MENU_JOYKBDMAP1,
|
||||
MENU_KBDMAP,
|
||||
@@ -1773,13 +1774,25 @@ void HandleUI(void)
|
||||
OsdWrite(3, s, 0, 0);
|
||||
if (get_map_vid() || get_map_pid())
|
||||
{
|
||||
sprintf(s, " %s ID: %04x:%04x", get_map_type() ? "Joystick" : "Keyboard", get_map_vid(), get_map_pid());
|
||||
if (get_map_button() > 0)
|
||||
if (!is_menu_core() && get_map_type() && !has_default_map())
|
||||
{
|
||||
OsdWrite(9, " Enter -> Finish", 0, 0);
|
||||
if(!get_map_type()) OsdWrite(10);
|
||||
for (int i = 0; i < OsdGetSize(); i++) OsdWrite(i, "", 0, 0);
|
||||
OsdWrite(6, " You need to define this");
|
||||
OsdWrite(7, " joystick in Menu core first");
|
||||
OsdWrite(9, " Press ESC/Enter");
|
||||
finish_map_setting(1);
|
||||
menustate = MENU_JOYDIGMAP2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(s, " %s ID: %04x:%04x", get_map_type() ? "Joystick" : "Keyboard", get_map_vid(), get_map_pid());
|
||||
if (get_map_button() > 0)
|
||||
{
|
||||
OsdWrite(9, " Enter -> Finish", 0, 0);
|
||||
if (!get_map_type()) OsdWrite(10);
|
||||
}
|
||||
OsdWrite(5, s, 0, 0);
|
||||
}
|
||||
OsdWrite(5, s, 0, 0);
|
||||
}
|
||||
|
||||
if (select || menu || get_map_button() >= (joy_bcount ? joy_bcount + 4 : 8))
|
||||
@@ -1799,6 +1812,14 @@ void HandleUI(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_JOYDIGMAP2:
|
||||
if (select || menu)
|
||||
{
|
||||
menustate = MENU_8BIT_SYSTEM1;
|
||||
menusub = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_JOYKBDMAP:
|
||||
helptext = 0;
|
||||
menumask = 1;
|
||||
|
||||
Reference in New Issue
Block a user