Minimig CD32pad buttons. Ability to skip the button while mapping.
This commit is contained in:
17
input.c
17
input.c
@@ -463,11 +463,13 @@ static char *get_map_name(int dev)
|
||||
return name;
|
||||
}
|
||||
|
||||
void finish_map_setting()
|
||||
void finish_map_setting(int dismiss)
|
||||
{
|
||||
mapping = 0;
|
||||
if (mapping_dev<0) return;
|
||||
FileSaveConfig(get_map_name(mapping_dev), &input[mapping_dev].map, sizeof(input[mapping_dev].map));
|
||||
|
||||
if(dismiss) input[mapping_dev].has_map = 0;
|
||||
else FileSaveConfig(get_map_name(mapping_dev), &input[mapping_dev].map, sizeof(input[mapping_dev].map));
|
||||
}
|
||||
|
||||
uint16_t get_map_vid()
|
||||
@@ -550,6 +552,8 @@ static void input_cb(struct input_event *ev, int dev)
|
||||
static char keys[6] = { 0,0,0,0,0,0 };
|
||||
static unsigned char mouse_btn = 0;
|
||||
|
||||
int map_skip = (mapping && ev->type == EV_KEY && ev->code == 57 && mapping_dev >= 0);
|
||||
|
||||
switch (ev->type)
|
||||
{
|
||||
case EV_KEY:
|
||||
@@ -575,7 +579,7 @@ static void input_cb(struct input_event *ev, int dev)
|
||||
}
|
||||
|
||||
int key = (ev->code < (sizeof(ev2usb) / sizeof(ev2usb[0]))) ? ev2usb[ev->code] : NONE;
|
||||
if ((key != NONE))
|
||||
if ((key != NONE) && !map_skip)
|
||||
{
|
||||
if (ev->value > 1)
|
||||
{
|
||||
@@ -651,7 +655,7 @@ static void input_cb(struct input_event *ev, int dev)
|
||||
//joystick
|
||||
if (mapping && (mapping_dev >=0 || ev->value))
|
||||
{
|
||||
if (ev->type == EV_KEY && ev->value <= 1 && ev->code >= BTN_JOYSTICK)
|
||||
if ((ev->type == EV_KEY && ev->value <= 1 && ev->code >= BTN_JOYSTICK))
|
||||
{
|
||||
if (mapping_dev < 0) mapping_dev = dev;
|
||||
if (mapping_dev == dev && mapping_button < mapping_count)
|
||||
@@ -676,6 +680,11 @@ static void input_cb(struct input_event *ev, int dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (map_skip && mapping_button < mapping_count && ev->value == 1)
|
||||
{
|
||||
mapping_button++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
2
input.h
2
input.h
@@ -16,7 +16,7 @@ int input_poll(int getchar);
|
||||
|
||||
void start_map_setting(int cnt);
|
||||
int get_map_button();
|
||||
void finish_map_setting();
|
||||
void finish_map_setting(int dismiss);
|
||||
uint16_t get_map_vid();
|
||||
uint16_t get_map_pid();
|
||||
|
||||
|
||||
18
menu.c
18
menu.c
@@ -1114,6 +1114,17 @@ void HandleUI(void)
|
||||
menusub = 0;
|
||||
break;
|
||||
case 1:
|
||||
if (is_minimig())
|
||||
{
|
||||
joy_bcount = 7;
|
||||
strcpy(joy_bnames[0], "Red");
|
||||
strcpy(joy_bnames[1], "Blue");
|
||||
strcpy(joy_bnames[2], "Yellow");
|
||||
strcpy(joy_bnames[3], "Green");
|
||||
strcpy(joy_bnames[4], "Right Front");
|
||||
strcpy(joy_bnames[5], "Left Front");
|
||||
strcpy(joy_bnames[6], "Pause");
|
||||
}
|
||||
start_map_setting(joy_bcount ? joy_bcount+5 : 9);
|
||||
menustate = MENU_JOYDIGMAP;
|
||||
menusub = 0;
|
||||
@@ -1224,13 +1235,14 @@ void HandleUI(void)
|
||||
OsdWrite(3, s, 0, 0);
|
||||
if (get_map_button())
|
||||
{
|
||||
OsdWrite(OsdGetSize() - 1, " finish", menusub == 0, 0);
|
||||
if (get_map_button()<9) sprintf(s, " Joystick ID: %04x:%04x", get_map_vid(), get_map_pid());
|
||||
OsdWrite(OsdGetSize() - 1, " finish (SPACE - skip)", menusub == 0, 0);
|
||||
sprintf(s, " Joystick ID: %04x:%04x", get_map_vid(), get_map_pid());
|
||||
OsdWrite(5, s, 0, 0);
|
||||
}
|
||||
|
||||
if (select || menu || get_map_button() >= (joy_bcount ? joy_bcount + 5 : 9))
|
||||
{
|
||||
finish_map_setting();
|
||||
finish_map_setting(menu);
|
||||
menustate = is_menu_core() ? MENU_FIRMWARE1 : MENU_8BIT_SYSTEM1;
|
||||
menusub = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user