evdev/maple: Set devices via config

This commit is contained in:
Christoph "baka0815" Schwerdtfeger 2018-08-13 13:00:24 +02:00 committed by Ender's Games
parent 17d9159b82
commit f75ba32fa9
3 changed files with 60 additions and 11 deletions

View File

@ -75,8 +75,9 @@ void mcfg_Create(MapleDeviceType type,u32 bus,u32 port)
void mcfg_CreateDevices()
{
int numberOfControl = cfgLoadInt("players", "nb", 1);
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
int numberOfControl = cfgLoadInt("players", "nb", 1);
if (numberOfControl <= 0)
numberOfControl = 1;
if (numberOfControl > 4)
@ -84,10 +85,15 @@ int numberOfControl = cfgLoadInt("players", "nb", 1);
for (int i = 0; i < numberOfControl; i++){
mcfg_Create(MDT_SegaController, i, 5);
// mcfg_Create(MDT_PurupuruPack, i, 1);
}
// if using evdev they will be created later on
#if !defined(USE_EVDEV)
mcfg_Create(MDT_SegaVMU, 0, 0);
mcfg_Create(MDT_SegaVMU, 0, 1);
#endif
#else
mcfg_Create(MDT_NaomiJamma, 0, 5);
#endif

View File

@ -1,5 +1,6 @@
#pragma once
#include "types.h"
#include "maple_devs.h"
enum PlainJoystickButtonId
{
@ -63,6 +64,8 @@ struct IMapleConfigMap
virtual ~IMapleConfigMap() {}
};
void mcfg_Create(MapleDeviceType type, u32 bus, u32 port);
#ifndef _ANDROID
void mcfg_CreateDevices();
#else

View File

@ -37,6 +37,8 @@
#if defined(USE_EVDEV)
#include "linux-dist/evdev.h"
#include "hw/maple/maple_cfg.h"
#include "hw/maple/maple_devs.h"
#endif
#if defined(USE_JOYSTICK)
@ -154,6 +156,44 @@ void SetupInput()
}
}
}
switch (evdev_controllers[port].mapping->Maple_Device1)
{
case 1:
printf("Maple Device 1: VMU\n");
mcfg_Create(MDT_SegaVMU, port, 0);
break;
case 2:
printf("Maple Device 1: Microphone\n");
mcfg_Create(MDT_Microphone, port, 0);
break;
case 3:
printf("Maple Device 1: PuruPuruPack\n");
mcfg_Create(MDT_PurupuruPack, port, 0);
break;
default:
printf("Unsupported configuration for Maple Device 1 (using VMU): %d\n", evdev_controllers[port].mapping->Maple_Device1);
mcfg_Create(MDT_SegaVMU, port, 0);
}
switch (evdev_controllers[port].mapping->Maple_Device2)
{
case 1:
printf("Maple Device 2: VMU\n");
mcfg_Create(MDT_SegaVMU, port, 1);
break;
case 2:
printf("Maple Device 2: Microphone\n");
mcfg_Create(MDT_Microphone, port, 1);
break;
case 3:
printf("Maple Device 2: PuruPuruPack\n");
mcfg_Create(MDT_PurupuruPack, port, 1);
break;
default:
printf("Unsupported configuration for Maple Device 2 (using VMU): %d\n", evdev_controllers[port].mapping->Maple_Device2);
mcfg_Create(MDT_SegaVMU, port, 1);
}
}
}
#endif