evdev/MapleType: Controller in port 1 defaults to VMU for Maple device, all other to None

Also allow 0 for "None"
This commit is contained in:
Christoph "baka0815" Schwerdtfeger 2018-08-20 16:35:48 +02:00 committed by Ender's Games
parent a07c3dc9f2
commit c8baaac632
1 changed files with 19 additions and 5 deletions

View File

@ -105,10 +105,15 @@ void emit_WriteCodeCache();
static int joystick_fd = -1; // Joystick file descriptor static int joystick_fd = -1; // Joystick file descriptor
#endif #endif
MapleDeviceType GetMapleDeviceType(int value) MapleDeviceType GetMapleDeviceType(int value, int port)
{ {
switch (value) switch (value)
{ {
case 0:
#if defined(_DEBUG) || defined(DEBUG)
printf("Maple Device: None\n");
#endif
return MDT_None;
case 1: case 1:
#if defined(_DEBUG) || defined(DEBUG) #if defined(_DEBUG) || defined(DEBUG)
printf("Maple Device: VMU\n"); printf("Maple Device: VMU\n");
@ -125,10 +130,19 @@ MapleDeviceType GetMapleDeviceType(int value)
#endif #endif
return MDT_PurupuruPack; return MDT_PurupuruPack;
default: default:
printf("Unsupported configuration (%d) for Maple Device, using VMU\n", value); MapleDeviceType result = MDT_None;
string result_type = "None";
// Controller in port 1 defaults to VMU for Maple device, all other to None
if (port == 1)
{
result_type = "VMU";
result = MDT_SegaVMU;
} }
return MDT_SegaVMU; printf("Unsupported configuration (%d) for Maple Device, using %s\n", value, result_type);
return result;
}
} }
void os_SetupInput() void os_SetupInput()
@ -183,7 +197,7 @@ void os_SetupInput()
} }
} }
mcfg_CreateController(port, GetMapleDeviceType(evdev_controllers[port].mapping->Maple_Device1), GetMapleDeviceType(evdev_controllers[port].mapping->Maple_Device2)); mcfg_CreateController(port, GetMapleDeviceType(evdev_controllers[port].mapping->Maple_Device1, port), GetMapleDeviceType(evdev_controllers[port].mapping->Maple_Device2, port));
} }
} }
#endif #endif