diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/input.cpp | 39 | ||||
-rw-r--r-- | src/emu/input.h | 10 | ||||
-rw-r--r-- | src/osd/modules/input/input_common.h | 15 | ||||
-rw-r--r-- | src/osd/modules/input/input_dinput.cpp | 16 | ||||
-rw-r--r-- | src/osd/modules/input/input_dinput.h | 13 | ||||
-rw-r--r-- | src/osd/modules/input/input_rawinput.cpp | 33 | ||||
-rw-r--r-- | src/osd/modules/input/input_sdl.cpp | 32 | ||||
-rw-r--r-- | src/osd/modules/input/input_win32.cpp | 18 | ||||
-rw-r--r-- | src/osd/modules/input/input_x11.cpp | 12 | ||||
-rw-r--r-- | src/osd/modules/input/input_xinput.cpp | 6 | ||||
-rw-r--r-- | src/osd/modules/input/input_xinput.h | 2 |
11 files changed, 103 insertions, 93 deletions
diff --git a/src/emu/input.cpp b/src/emu/input.cpp index 2a65ff4c688..4c8aad97307 100644 --- a/src/emu/input.cpp +++ b/src/emu/input.cpp @@ -794,9 +794,10 @@ void input_seq::replace(input_code oldcode, input_code newcode) // input_device - constructor //------------------------------------------------- -input_device::input_device(input_class &_class, int devindex, const char *name, void *internal) +input_device::input_device(input_class &_class, int devindex, const char *name, const char *id, void *internal) : m_class(_class), m_name(name), + m_id(id), m_devindex(devindex), m_maxitem(input_item_id(0)), m_internal(internal), @@ -942,19 +943,19 @@ void input_device::apply_steadykey() const } //------------------------------------------------- -// match_device_name - match device name via +// match_device_id - match device id via // substring search //------------------------------------------------- -bool input_device::match_device_name(const char *devicename) +bool input_device::match_device_id(const char *deviceid) { - std::string devicenameupper(devicename); - std::string nameupper(m_name); + std::string deviceidupper(deviceid); + std::string idupper(m_id); - strmakeupper(devicenameupper); - strmakeupper(nameupper); + strmakeupper(deviceidupper); + strmakeupper(idupper); - return std::string::npos == nameupper.find(devicenameupper) ? false : true; + return std::string::npos == idupper.find(deviceidupper) ? false : true; } @@ -983,7 +984,7 @@ input_class::input_class(input_manager &manager, input_device_class devclass, bo // add_device - add a new input device //------------------------------------------------- -input_device *input_class::add_device(const char *name, void *internal) +input_device *input_class::add_device(const char *name, const char *id, void *internal) { // find the next empty index int devindex; @@ -992,23 +993,28 @@ input_device *input_class::add_device(const char *name, void *internal) break; // call through - return add_device(devindex, name, internal); + return add_device(devindex, name, id, internal); } -input_device *input_class::add_device(int devindex, const char *name, void *internal) +input_device *input_class::add_device(int devindex, const char *name, const char *id, void *internal) { assert_always(machine().phase() == MACHINE_PHASE_INIT, "Can only call input_class::add_device at init time!"); assert(name != nullptr); + assert(id != nullptr); assert(devindex >= 0 && devindex < DEVICE_INDEX_MAXIMUM); assert(m_device[devindex] == nullptr); // allocate a new device - m_device[devindex] = std::make_unique<input_device>(*this, devindex, name, internal); + m_device[devindex] = std::make_unique<input_device>(*this, devindex, name, id, internal); // update the maximum index found m_maxindex = std::max(m_maxindex, devindex); - osd_printf_verbose("Input: Adding %s #%d: %s\n", (*devclass_string_table)[m_devclass], devindex, name); + if (0 == strlen(id)) + osd_printf_verbose("Input: Adding %s #%d: %s\n", (*devclass_string_table)[m_devclass], devindex, name); + else + osd_printf_verbose("Input: Adding %s #%d: %s (device id: %s)\n", (*devclass_string_table)[m_devclass], devindex, name, id); + return m_device[devindex].get(); } @@ -2111,7 +2117,7 @@ bool input_manager::map_device_to_controller(const devicemap_table_type *devicem for (devicemap_table_type::const_iterator it = devicemap_table->begin(); it != devicemap_table->end(); it++) { - const char *devicename = it->first.c_str(); + const char *deviceid = it->first.c_str(); const char *controllername = it->second.c_str(); // tokenize the controller name into device class and index (i.e. controller name should be of the form "GUNCODE_1") @@ -2151,11 +2157,12 @@ bool input_manager::map_device_to_controller(const devicemap_table_type *devicem for (int devnum = 0; devnum <= input_devclass->maxindex(); devnum++) { input_device *device = input_devclass->device(devnum); - if (device != nullptr && device->match_device_name(devicename)) + if (device != nullptr && device->match_device_id(deviceid)) { // remap devindex input_devclass->remap_device_index(device->devindex(), devindex); - osd_printf_verbose("Input: Remapped %s #%d: %s\n", (*devclass_string_table)[input_devclass->devclass()], devindex, device->name()); + osd_printf_verbose("Input: Remapped %s #%d: %s (device id: %s)\n", (*devclass_string_table)[input_devclass->devclass()], devindex, device->name(), device->id()); + break; } } diff --git a/src/emu/input.h b/src/emu/input.h index 1c4276fef3d..dff829f5d54 100644 --- a/src/emu/input.h +++ b/src/emu/input.h @@ -549,13 +549,14 @@ class input_device public: // construction/destruction - input_device(input_class &_class, int _devindex, const char *_name, void *_internal); + input_device(input_class &_class, int _devindex, const char *_name, const char *_id, void *_internal); // getters input_class &device_class() const { return m_class; } input_manager &manager() const; running_machine &machine() const; input_device_class devclass() const; const char *name() const { return m_name.c_str(); } + const char *id() const { return m_id.c_str(); } int devindex() const { return m_devindex; } input_device_item *item(input_item_id index) const { return m_item[index].get(); } input_item_id maxitem() const { return m_maxitem; } @@ -574,12 +575,13 @@ public: // helpers INT32 apply_deadzone_and_saturation(INT32 value) const; void apply_steadykey() const; - bool match_device_name(const char * devicename); + bool match_device_id(const char * deviceid); private: // internal state input_class & m_class; // reference to our class std::string m_name; // string name of device + std::string m_id; // id of device int m_devindex; // device index of this device std::unique_ptr<input_device_item> m_item[ITEM_ID_ABSOLUTE_MAXIMUM+1]; // array of pointers to items input_item_id m_maxitem; // maximum item index @@ -617,8 +619,8 @@ public: void set_multi(bool multi = true) { m_multi = multi; } // device management - input_device *add_device(const char *name, void *internal = nullptr); - input_device *add_device(int devindex, const char *name, void *internal = nullptr); + input_device *add_device(const char *name, const char *id, void *internal = nullptr); + input_device *add_device(int devindex, const char *name, const char *id, void *internal = nullptr); // misc helpers input_item_class standard_item_class(input_item_id itemid); diff --git a/src/osd/modules/input/input_common.h b/src/osd/modules/input/input_common.h index 43c77f16b06..f59ee472758 100644 --- a/src/osd/modules/input/input_common.h +++ b/src/osd/modules/input/input_common.h @@ -202,6 +202,7 @@ class device_info private: std::string m_name; + std::string m_id; input_device * m_device; running_machine & m_machine; input_module & m_module; @@ -209,8 +210,9 @@ private: public: // Constructor - device_info(running_machine &machine, const char *name, input_device_class deviceclass, input_module &module) + device_info(running_machine &machine, const char *name, const char *id, input_device_class deviceclass, input_module &module) : m_name(name), + m_id(id), m_device(nullptr), m_machine(machine), m_module(module), @@ -224,6 +226,7 @@ public: // Getters running_machine & machine() const { return m_machine; } const char * name() const { return m_name.c_str(); } + const char * id() const { return m_id.c_str(); } input_device * device() const { return m_device; } input_module & module() const { return m_module; } input_device_class deviceclass() const { return m_deviceclass; } @@ -251,8 +254,8 @@ protected: virtual void process_event(TEvent &ev) = 0; public: - event_based_device(running_machine &machine, const char *name, input_device_class deviceclass, input_module &module) - : device_info(machine, name, deviceclass, module) + event_based_device(running_machine &machine, const char *name, const char *id, input_device_class deviceclass, input_module &module) + : device_info(machine, name, id, deviceclass, module) { } @@ -327,13 +330,13 @@ public: } template <typename TActual, typename... TArgs> - TActual* create_device(running_machine &machine, const char *name, input_module &module, TArgs&&... args) + TActual* create_device(running_machine &machine, const char *name, const char *id, input_module &module, TArgs&&... args) { // allocate the device object - auto devinfo = std::make_unique<TActual>(machine, name, module, std::forward<TArgs>(args)...); + auto devinfo = std::make_unique<TActual>(machine, name, id, module, std::forward<TArgs>(args)...); // Add the device to the machine - devinfo->m_device = machine.input().device_class(devinfo->deviceclass()).add_device(devinfo->name(), devinfo.get()); + devinfo->m_device = machine.input().device_class(devinfo->deviceclass()).add_device(devinfo->name(), devinfo->id(), devinfo.get()); // append us to the list m_list.push_back(std::move(devinfo)); diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp index 01e920f2953..b17cf3a61a3 100644 --- a/src/osd/modules/input/input_dinput.cpp +++ b/src/osd/modules/input/input_dinput.cpp @@ -68,8 +68,8 @@ static HRESULT dinput_set_dword_property(ComPtr<IDirectInputDevice> device, REFG // dinput_device - base directinput device //============================================================ -dinput_device::dinput_device(running_machine &machine, const char *name, input_device_class deviceclass, input_module &module) - : device_info(machine, name, deviceclass, module), +dinput_device::dinput_device(running_machine &machine, const char *name, const char *id, input_device_class deviceclass, input_module &module) + : device_info(machine, name, id, deviceclass, module), dinput({nullptr}) { } @@ -110,8 +110,8 @@ HRESULT dinput_device::poll_dinput(LPVOID pState) const // dinput_keyboard_device - directinput keyboard device //============================================================ -dinput_keyboard_device::dinput_keyboard_device(running_machine &machine, const char *name, input_module &module) - : dinput_device(machine, name, DEVICE_CLASS_KEYBOARD, module), +dinput_keyboard_device::dinput_keyboard_device(running_machine &machine, const char *name, const char *id, input_module &module) + : dinput_device(machine, name, id, DEVICE_CLASS_KEYBOARD, module), keyboard({{0}}) { } @@ -328,8 +328,8 @@ public: }; -dinput_mouse_device::dinput_mouse_device(running_machine &machine, const char *name, input_module &module) - : dinput_device(machine, name, DEVICE_CLASS_MOUSE, module), +dinput_mouse_device::dinput_mouse_device(running_machine &machine, const char *name, const char *id, input_module &module) + : dinput_device(machine, name, id, DEVICE_CLASS_MOUSE, module), mouse({0}) { } @@ -427,8 +427,8 @@ public: } }; -dinput_joystick_device::dinput_joystick_device(running_machine &machine, const char *name, input_module &module) - : dinput_device(machine, name, DEVICE_CLASS_JOYSTICK, module), +dinput_joystick_device::dinput_joystick_device(running_machine &machine, const char *name, const char *id, input_module &module) + : dinput_device(machine, name, id, DEVICE_CLASS_JOYSTICK, module), joystick({{0}}) { } diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h index d7142c35480..db640490dc6 100644 --- a/src/osd/modules/input/input_dinput.h +++ b/src/osd/modules/input/input_dinput.h @@ -81,8 +81,11 @@ public: // convert instance name to utf8 std::string utf8_instance_name = utf8_from_tstring(instance->tszInstanceName); + // set device id to name + std::string utf8_instance_id = utf8_instance_name; + // allocate memory for the device object - TDevice* devinfo = module.devicelist()->create_device<TDevice>(machine, utf8_instance_name.c_str(), module); + TDevice* devinfo = module.devicelist()->create_device<TDevice>(machine, utf8_instance_name.c_str(), utf8_instance_id.c_str(), module); // attempt to create a device result = m_dinput->CreateDevice(instance->guidInstance, devinfo->dinput.device.GetAddressOf(), nullptr); @@ -137,7 +140,7 @@ class dinput_device : public device_info public: dinput_api_state dinput; - dinput_device(running_machine &machine, const char *name, input_device_class deviceclass, input_module &module); + dinput_device(running_machine &machine, const char *name, const char *id, input_device_class deviceclass, input_module &module); virtual ~dinput_device(); protected: @@ -152,7 +155,7 @@ private: public: keyboard_state keyboard; - dinput_keyboard_device(running_machine &machine, const char *name, input_module &module); + dinput_keyboard_device(running_machine &machine, const char *name, const char *id, input_module &module); void poll() override; void reset() override; @@ -164,7 +167,7 @@ public: mouse_state mouse; public: - dinput_mouse_device(running_machine &machine, const char *name, input_module &module); + dinput_mouse_device(running_machine &machine, const char *name, const char *id, input_module &module); void poll() override; void reset() override; }; @@ -182,7 +185,7 @@ class dinput_joystick_device : public dinput_device public: dinput_joystick_state joystick; public: - dinput_joystick_device(running_machine &machine, const char *name, input_module &module); + dinput_joystick_device(running_machine &machine, const char *name, const char *id, input_module &module); void reset() override; void poll() override; int configure(); diff --git a/src/osd/modules/input/input_rawinput.cpp b/src/osd/modules/input/input_rawinput.cpp index 44fba696e2c..f9d111f2f8e 100644 --- a/src/osd/modules/input/input_rawinput.cpp +++ b/src/osd/modules/input/input_rawinput.cpp @@ -289,8 +289,8 @@ private: HANDLE m_handle; public: - rawinput_device(running_machine& machine, const char* name, input_device_class deviceclass, input_module& module) - : event_based_device(machine, name, deviceclass, module), + rawinput_device(running_machine& machine, const char *name, const char *id, input_device_class deviceclass, input_module& module) + : event_based_device(machine, name, id, deviceclass, module), m_handle(nullptr) { } @@ -308,8 +308,8 @@ class rawinput_keyboard_device : public rawinput_device public: keyboard_state keyboard; - rawinput_keyboard_device(running_machine& machine, const char* name, input_module& module) - : rawinput_device(machine, name, DEVICE_CLASS_KEYBOARD, module), + rawinput_keyboard_device(running_machine& machine, const char *name, const char *id, input_module& module) + : rawinput_device(machine, name, id, DEVICE_CLASS_KEYBOARD, module), keyboard({{0}}) { } @@ -344,8 +344,8 @@ private: public: mouse_state mouse; - rawinput_mouse_device(running_machine& machine, const char* name, input_module& module) - : rawinput_device(machine, name, DEVICE_CLASS_MOUSE, module), + rawinput_mouse_device(running_machine& machine, const char *name, const char *id, input_module& module) + : rawinput_device(machine, name, id, DEVICE_CLASS_MOUSE, module), mouse({0}) { } @@ -404,8 +404,8 @@ private: public: mouse_state lightgun; - rawinput_lightgun_device(running_machine& machine, const char* name, input_module& module) - : rawinput_device(machine, name, DEVICE_CLASS_LIGHTGUN, module), + rawinput_lightgun_device(running_machine& machine, const char *name, const char *id, input_module& module) + : rawinput_device(machine, name, id, DEVICE_CLASS_LIGHTGUN, module), lightgun({0}) { } @@ -572,18 +572,13 @@ protected: // improve the name and then allocate a device std::wstring name = rawinput_device_improve_name(tname.get()); - // convert name to utf8. Preserve raw name as well (if different than improved name) to allow mapping of device to controller. - std::string utf8_name; - if (0 == name.compare(tname.get())) - { - utf8_name = utf8_from_wstring(name.c_str()); - } - else - { - utf8_name = util::string_format("%s (%s)", utf8_from_wstring(name.c_str()), utf8_from_wstring(tname.get())); - } + // convert name to utf8 + std::string utf8_name = utf8_from_wstring(name.c_str()); + + // set device id to raw input name + std::string utf8_id = utf8_from_wstring(tname.get()); - devinfo = devicelist()->create_device<TDevice>(machine, utf8_name.c_str(), *this); + devinfo = devicelist()->create_device<TDevice>(machine, utf8_name.c_str(), utf8_id.c_str(), *this); // Add the handle devinfo->set_handle(rawinputdevice->hDevice); diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index b234efee7c4..9a8180b7088 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -110,8 +110,8 @@ static int lookup_sdl_code(const char *scode) class sdl_device : public event_based_device<SDL_Event> { public: - sdl_device(running_machine &machine, const char* name, input_device_class devclass, input_module &module) - : event_based_device(machine, name, devclass, module) + sdl_device(running_machine &machine, const char *name, const char *id, input_device_class devclass, input_module &module) + : event_based_device(machine, name, id, devclass, module) { } @@ -132,8 +132,8 @@ class sdl_keyboard_device : public sdl_device public: keyboard_state keyboard; - sdl_keyboard_device(running_machine &machine, const char* name, input_module &module) - : sdl_device(machine, name, DEVICE_CLASS_KEYBOARD, module), + sdl_keyboard_device(running_machine &machine, const char *name, const char *id, input_module &module) + : sdl_device(machine, name, id, DEVICE_CLASS_KEYBOARD, module), keyboard({{0}}) { } @@ -201,8 +201,8 @@ private: public: mouse_state mouse; - sdl_mouse_device(running_machine &machine, const char* name, input_module &module) - : sdl_device(machine, name, DEVICE_CLASS_MOUSE, module), + sdl_mouse_device(running_machine &machine, const char *name, const char *id, input_module &module) + : sdl_device(machine, name, id, DEVICE_CLASS_MOUSE, module), last_x(0), last_y(0), mouse({0}) @@ -338,8 +338,8 @@ public: sdl_joystick_state joystick; sdl_api_state sdl_state; - sdl_joystick_device(running_machine &machine, const char *name, input_module &module) - : sdl_device(machine, name, DEVICE_CLASS_JOYSTICK, module), + sdl_joystick_device(running_machine &machine, const char *name, const char *id, input_module &module) + : sdl_device(machine, name, id, DEVICE_CLASS_JOYSTICK, module), joystick({{0}}), sdl_state({ nullptr }) { @@ -419,8 +419,8 @@ public: class sdl_sixaxis_joystick_device : public sdl_joystick_device { public: - sdl_sixaxis_joystick_device(running_machine &machine, const char *name, input_module &module) - : sdl_joystick_device(machine, name, module) + sdl_sixaxis_joystick_device(running_machine &machine, const char *name, const char *id, input_module &module) + : sdl_joystick_device(machine, name, id, module) { } @@ -536,7 +536,7 @@ public: osd_printf_verbose("Keyboard: Start initialization\n"); // SDL only has 1 keyboard add it now - devinfo = devicelist()->create_device<sdl_keyboard_device>(machine, "System keyboard", *this); + devinfo = devicelist()->create_device<sdl_keyboard_device>(machine, "System keyboard", "System keyboard", *this); // populate it for (int keynum = 0; local_table[keynum].mame_key != ITEM_ID_INVALID; keynum++) @@ -672,7 +672,7 @@ public: osd_printf_verbose("Mouse: Start initialization\n"); // SDL currently only supports one mouse - devinfo = devicelist()->create_device<sdl_mouse_device>(machine, "System mouse", *this); + devinfo = devicelist()->create_device<sdl_mouse_device>(machine, "System mouse", "System mouse", *this); // add the axes devinfo->device()->add_item("X", ITEM_ID_XAXIS, generic_axis_get_state<std::int32_t>, &devinfo->mouse.lX); @@ -890,16 +890,16 @@ private: { snprintf(tempname, ARRAY_LENGTH(tempname), "NC%d", index); m_sixaxis_mode - ? devicelist()->create_device<sdl_sixaxis_joystick_device>(machine, tempname, *this) - : devicelist()->create_device<sdl_joystick_device>(machine, tempname, *this); + ? devicelist()->create_device<sdl_sixaxis_joystick_device>(machine, tempname, tempname, *this) + : devicelist()->create_device<sdl_joystick_device>(machine, tempname, tempname, *this); } return nullptr; } return m_sixaxis_mode - ? devicelist()->create_device<sdl_sixaxis_joystick_device>(machine, devmap->map[index].name.c_str(), *this) - : devicelist()->create_device<sdl_joystick_device>(machine, devmap->map[index].name.c_str(), *this); + ? devicelist()->create_device<sdl_sixaxis_joystick_device>(machine, devmap->map[index].name.c_str(), devmap->map[index].name.c_str(), *this) + : devicelist()->create_device<sdl_joystick_device>(machine, devmap->map[index].name.c_str(), devmap->map[index].name.c_str(), *this); } }; diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp index 78e162f296b..ccae2be2861 100644 --- a/src/osd/modules/input/input_win32.cpp +++ b/src/osd/modules/input/input_win32.cpp @@ -38,8 +38,8 @@ class win32_keyboard_device : public event_based_device<KeyPressEventArgs> public: keyboard_state keyboard; - win32_keyboard_device(running_machine& machine, const char *name, input_module &module) - : event_based_device(machine, name, DEVICE_CLASS_KEYBOARD, module), + win32_keyboard_device(running_machine& machine, const char *name, const char *id, input_module &module) + : event_based_device(machine, name, id, DEVICE_CLASS_KEYBOARD, module), keyboard({{0}}) { } @@ -73,7 +73,7 @@ public: virtual void input_init(running_machine &machine) override { // Add a single win32 keyboard device that we'll monitor using Win32 - win32_keyboard_device *devinfo = devicelist()->create_device<win32_keyboard_device>(machine, "Win32 Keyboard 1", *this); + win32_keyboard_device *devinfo = devicelist()->create_device<win32_keyboard_device>(machine, "Win32 Keyboard 1", "Win32 Keyboard 1", *this); keyboard_trans_table &table = keyboard_trans_table::instance(); @@ -133,8 +133,8 @@ public: mouse_state mouse; win32_mouse_state win32_mouse; - win32_mouse_device(running_machine& machine, const char *name, input_module &module) - : event_based_device(machine, name, DEVICE_CLASS_MOUSE, module), + win32_mouse_device(running_machine& machine, const char *name, const char *id, input_module &module) + : event_based_device(machine, name, id, DEVICE_CLASS_MOUSE, module), mouse({0}), win32_mouse({{0}}) { @@ -206,7 +206,7 @@ public: return; // allocate a device - devinfo = devicelist()->create_device<win32_mouse_device>(machine, "Win32 Mouse 1", *this); + devinfo = devicelist()->create_device<win32_mouse_device>(machine, "Win32 Mouse 1", "Win32 Mouse 1", *this); if (devinfo == nullptr) return; @@ -261,8 +261,8 @@ private: public: mouse_state mouse; - win32_lightgun_device(running_machine& machine, const char *name, input_module &module) - : event_based_device(machine, name, DEVICE_CLASS_LIGHTGUN, module), + win32_lightgun_device(running_machine& machine, const char *name, const char *id, input_module &module) + : event_based_device(machine, name, id, DEVICE_CLASS_LIGHTGUN, module), m_lightgun_shared_axis_mode(FALSE), m_gun_index(0), mouse({0}) @@ -393,7 +393,7 @@ public: int axisnum, butnum; // allocate a device - devinfo = devicelist()->create_device<win32_lightgun_device>(machine, gun_names[gunnum], *this); + devinfo = devicelist()->create_device<win32_lightgun_device>(machine, gun_names[gunnum], gun_names[gunnum], *this); if (devinfo == nullptr) break; diff --git a/src/osd/modules/input/input_x11.cpp b/src/osd/modules/input/input_x11.cpp index f13a94358ab..312f3c5f0c8 100644 --- a/src/osd/modules/input/input_x11.cpp +++ b/src/osd/modules/input/input_x11.cpp @@ -338,8 +338,8 @@ class x11_input_device : public event_based_device<XEvent> public: x11_api_state x11_state; - x11_input_device(running_machine &machine, const char* name, input_device_class devclass, input_module &module) - : event_based_device(machine, name, devclass, module), + x11_input_device(running_machine &machine, const char *name, const char *id, input_device_class devclass, input_module &module) + : event_based_device(machine, name, id, devclass, module), x11_state({0}) { } @@ -354,8 +354,8 @@ class x11_lightgun_device : public x11_input_device public: lightgun_state lightgun; - x11_lightgun_device(running_machine &machine, const char* name, input_module &module) - : x11_input_device(machine, name, DEVICE_CLASS_LIGHTGUN, module), + x11_lightgun_device(running_machine &machine, const char *name, const char *id, input_module &module) + : x11_input_device(machine, name, id, DEVICE_CLASS_LIGHTGUN, module), lightgun({0}) { } @@ -533,13 +533,13 @@ private: if (m_lightgun_map.initialized) { snprintf(tempname, ARRAY_LENGTH(tempname), "NC%d", index); - devicelist()->create_device<x11_lightgun_device>(machine, tempname, *this); + devicelist()->create_device<x11_lightgun_device>(machine, tempname, tempname, *this); } return nullptr; } - return devicelist()->create_device<x11_lightgun_device>(machine, m_lightgun_map.map[index].name.c_str(), *this); + return devicelist()->create_device<x11_lightgun_device>(machine, m_lightgun_map.map[index].name.c_str(), m_lightgun_map.map[index].name.c_str(), *this); } void add_lightgun_buttons(XAnyClassPtr first_info_class, int num_classes, x11_lightgun_device *devinfo) const diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp index ba25e4e1cd9..8baf1fd6cdd 100644 --- a/src/osd/modules/input/input_xinput.cpp +++ b/src/osd/modules/input/input_xinput.cpp @@ -74,7 +74,7 @@ xinput_joystick_device * xinput_api_helper::create_xinput_device(running_machine snprintf(device_name, sizeof(device_name), "XInput Player %u", index + 1); // allocate the device object - devinfo = module.devicelist()->create_device<xinput_joystick_device>(machine, device_name, module, shared_from_this()); + devinfo = module.devicelist()->create_device<xinput_joystick_device>(machine, device_name, device_name, module, shared_from_this()); // Set the player ID devinfo->xinput_state.player_index = index; @@ -89,8 +89,8 @@ xinput_joystick_device * xinput_api_helper::create_xinput_device(running_machine // xinput_joystick_device //============================================================ -xinput_joystick_device::xinput_joystick_device(running_machine &machine, const char *name, input_module &module, std::shared_ptr<xinput_api_helper> helper) - : device_info(machine, name, DEVICE_CLASS_JOYSTICK, module), +xinput_joystick_device::xinput_joystick_device(running_machine &machine, const char *name, char const *id, input_module &module, std::shared_ptr<xinput_api_helper> helper) + : device_info(machine, name, id, DEVICE_CLASS_JOYSTICK, module), gamepad({{0}}), xinput_state({0}), m_xinput_helper(helper), diff --git a/src/osd/modules/input/input_xinput.h b/src/osd/modules/input/input_xinput.h index 4dddc3069fd..68b5bbeca27 100644 --- a/src/osd/modules/input/input_xinput.h +++ b/src/osd/modules/input/input_xinput.h @@ -135,7 +135,7 @@ private: bool m_configured; public: - xinput_joystick_device(running_machine &machine, const char *name, input_module &module, std::shared_ptr<xinput_api_helper> helper); + xinput_joystick_device(running_machine &machine, const char *name, const char *id, input_module &module, std::shared_ptr<xinput_api_helper> helper); void poll() override; void reset() override; |