libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.08k stars 1.81k forks source link

Mouse index changes between boots #7638

Open roadriverrail opened 5 years ago

roadriverrail commented 5 years ago

I'm using RetroArch as part of a RetroPie settup. Everything works wonderfully with one small exception-- my machine includes both a trackball and a spinner. Both devices enumerate as mice over USB and appear as devices with /dev/input/eventXX numbers.

I can follow the steps for setting up my trackball as the player default in games, but that configuration will ultimately fail after enough reboots (often, just one reboot) because the /dev/input/eventXX numbers are assigned depending on what order these mice enumerate in. To make the trackball work, I basically have to change the input_player1_mouse_index every time it ends up with a different eventXX value.

As far as I can tell, there's no way for me to force the assignment of a particular eventXX value, but it looks like there are other ways to tell the trackball from the spinner. One is /dev/input/by-id, which symlinks to the event files. I think another would be using udev to make symlinks. In either case, though, it looks like RetroArch would need to be modified to accept a string rather than just an index number. I've only lightly skimmed your udev mouse code.

Is there a way of handling this that I've missed? If there isn't, is there any interest from the folks in working on this? I'm plenty handy at C but not as familiar with RetroArch, so I'd probably want a few conversations with someone to scope out the work and make sure I'm doing this the right way.

orbea commented 5 years ago

@roadriverrail Does this happen when only using RetroArch without RetroPie? I would suspect a general OS issue before RetroArch as the order of devices is determined by the OS and not RetroArch.

roadriverrail commented 5 years ago

@orbea, perhaps I didn't explain it fully. The order of USB device enumeration and driver initialization at boot time is not fully deterministic, so the current index system is not guaranteed to work from one boot to the next if you have, say, multiple mouse devices; my machine has both a trackball and a spinner, and so I have to fix up the mouse_index values after I boot up. It'd be more reliable to use something that identifies the device, like it's reported model name or it's VID/PID tuple.

orbea commented 5 years ago

Yes, I understood. I think the best solution would be to fix this race condition in the OS. Of course this is easier said than done.

There may be room to work around this in RetroArch, but it would not be easy and may have its own caveats.

Personally the devices are fully deterministic here, but my setup is pretty different than yours.

roadriverrail commented 5 years ago

I disagree that the "best" solution is to lock down the ordering of USB devices in Linux. It's not just easier said than done. My understanding, which may be wrong, is that doing so is fundamentally unsupported as a matter of architecture.

I've actually already started slinging together some code to add support for an "input_mouse_model" array in the configuration/settings and in adding a clause to udev_get_mouse() to match the "input_mouse_model" against the ID_MODEL udev property. It all looks okay and compiles, but I haven't moved it over to my game machine to test it yet. Is there some reason you'd not expect a scheme like this to work? You seem really hesitant on this front, and I suspect that's with cause.

orbea commented 5 years ago

By all means if you or someone else can come up with a good solution within RA that is great! I just think that there are probably other programs than RetroArch that would benefit from a broader fix in the OS.

roadriverrail commented 5 years ago

Ah. Understood. Again, I may be off-base on this, but I think that RA is a bit of an outlier in its entire reliance on the event input number to identify the peripheral. It's brittle against all sorts of changes on peripherals. For example, if you were to unplug and re-plug your USB devices, then the event device numbers will be different. From what little I've played with the input event device space, in my implementing Android firmware, it's more common to probe the devices, find some meaningful identifier (model, VID:PID, etc), and use that. That way, you know you're talking to the right device.

andres-asm commented 5 years ago

The solution should be bind devices on button press, not before, that's all.

roadriverrail commented 5 years ago

@fr500 I'm not following. Neither my trackball nor spinner have buttons, and as far as I know, the binding is governed by the playerX_mouse_index fields in the configuration files.

andres-asm commented 5 years ago

Well most mice do :P but in this case it would be on event..

Thing is this issue has existed forever with controllers.

We currently bind the devices on enumeration, so if you have 10 gamepads it assigns them a port id based on the enumeration order given by the underlying operating system.

That enumeration as you mentioned before is volatile. So a better strategy would be to enumerate devices and set them all as pending for binding, then when one of those devices has some input (gamepad button pressed, analog tilted, mouse moved) map them to the next available port.

roadriverrail commented 5 years ago

Ah, I'm understanding what you're suggesting, and it's a really neat low-touch idea. Does RA already open up a handle to all event devices and passively listen to all of them, filtering out only the ones with mapped ports?

popbee commented 3 years ago

I looked at this mouse index business two years ago as I was hitting the same problem with my retroarch cabinet. Trackball and spinner devices would switch randomly at each reboot. I suspect this code hasn't changed since. I'll dump my thinking about this anyways.

Even if I find a way to "fix" the number at the OS level (linux /dev numbers), retroarch completely disregards the OS's index and does its own "enumeration". As for Windows, the OS actually do attempt to detects where the device is connected and "knows" it's the same one (for the purpose of loading and initializing settings and drivers). Again, that won't guarantee the "ordering" Retroarch will receive the notifications about a device because, again, it has nothing to do with an "order based on time".

You are just lucky if you get them in the same order. It's not a OS problem at all. Rather a misinterpretation on how OSes behave and then wrongfully "shovels" the problem to the OS side.

It seems they (retroarch) don't really think it's a problem because they are under the assumption that in all cases the user will interactively "click a button" while performing a setup to "select a controller". Unfortunately, retroarch is used in other use cases and sometimes these are not controllers that you just connect "ad hoc" and perform a "setup" just before playing a game. These are bolted devices on a cabinet where other people (kids or guests) that are not even allowed to do any setup will attempt to power up the cabinet and play games. The player 1 spinner device is always going to be the same physical spinner connected to the same port. There is no reason that it suddenly gets assigned player 2.

Maybe we could look at MAME for inspiration? They have a fix for this that they coined mapdevice. https://docs.mamedev.org/advanced/devicemap.html
You can essentially map how the virtual devices are mapped to devices using a special "string" matching the raw identifier. We can keep the index numbers as is but then we could have an extra configuration on how these numbers gets mapped. Essentially it would "reserve" index numbers that are "configured" and as you get new devices if there is a match and the number if not already taken, we assign it the configured number else you assign a new sequential number like before.

Another enhancement would be to wait until there is no more device notifications at startup (with a configurable timeout) and then perform a full enumeration (with some fixed ordering/sorting). That might actually give a little more stable indexes with zero configuration (again, not always). After that, the same logic would apply with new devices coming in afterwards.

If we can get some sort of agreement on how to do this, maybe then we can get a green light to start working on a PR? Any combination of mouse-like devices (lightguns, spinners, trackballs and real mouse) are immediate candidate but also any other USB devices could also benefit this. As @fr500 pointed out: "this issue has existed forever with controllers." Well, maybe we could fix that at the same time, a "forever issue" doesn't make it less annoying...

thatman84 commented 2 years ago

@popbee did you gain any traction anywhere for this issue/enhancement?

popbee commented 2 years ago

No traction. Let's ask again these guys: @orbea @fr500

By all means if you or someone else can come up with a good solution within RA that is great! I just think that there are probably other programs than RetroArch that would benefit from a broader fix in the OS.

The OS enumeration order (appearance order) cannot be fixed at the OS level because it's by design. @roadriverrail was being very kind and tried to explain it but I think you guys don't get it and are still stuck on the "waiting on a button" solution. BTW, the RA code looks at the "appearance order" and NOT the OS enumeration order. There is a distinction! MAME definitely solved the problem with mapdevice. There are multiple solutions that can minimize the work and the risk. We can keep the index numbers as before but just influence how it gets mapped a little. That's all! Why can't we decide on something? You have people that are willing to help here.

"Waiting for an input event" is NOT a good solution for fixed cabinets. You are asking the players (i.e. kids/guests) to re-configure the cabinet manually each time it re-boots!

If I invest time to make a PR, I don't want you guys to plain reject it just because you don't like the approach.

How should we proceed?

drlucid commented 1 year ago

This apparently isn't in the top list of things to update for the retroarch developers. In a nutshell:

I created a fix that works for me, hopefully it helps someone else out there too. If it does, please kindly let me know! All of this assumes you are using Windows with Retroarch in raw mode to support multiple mice (and possibly joysticks too). Python 3.7.4 must be installed prior (might also work with 2.x but haven't tested). I am re-using ControllerRemap.exe (this was created back in the day when Mame had the same shortcoming?) to find which devices are out there and their order. The accompanying remapIdentifiers.py python script updates the mouse and/or joystick indices on a user supplied list of retroarch config files. If the device is not found, it will set it to '-1' which seems to disable it. I also have a separate (optional) customization option that I found handy to disable lightgun crosshairs when a particular player was not enabled. More detailed instructions are included in the accompanying remapIdentifiers.ini file. I left some example configuration in the .ini to help illlustrate--obviously these will need to be removed prior to usage.

1) Extract the zip files in a desired directory (typically within the retroarch folder) 2) Update the remapIdentifiers.ini file with instructions included in the remapIdentiers.ini file 3) Plug in desired equipment (mice, etc.), and use python to run the remapIdentiers.py script (many ways to accomplish this) prior to running retroarch.

That's it ! remapIdentifiers v0.0.zip

StarPlayrX commented 1 year ago

For those who want their trackball, mouse, spinner, etc configured automatically, I just released Multi-Mouse MM 1.0.2 for Batocera v35 and later https://github.com/StarPlayrX/Multi-Mouse

No editing, smart programming, just install and play!

Shinlowneogetter commented 1 year ago

@drlucid , you saved a lot of stuff with you python code thanks!!! i hope you read this message. for the mouses i fixed totally, but i have an issue with the joypads for example i have from the list: 'Gamecube Controller', ID=1" 'Gamecube Controller', ID=2"

now, i paste this in the right file ini for change, but the cfg file return "-1" so i tried few things: input_player1_joypad_index = ID=1 input_player2_joypad_index = ID=2 return = "-1"

input_player1_joypad_index = 'Gamecube Controller', ID=1" input_player2_joypad_index = 'Gamecube Controller', ID=2" return = "-1"

the only change that works is: input_player1_joypad_index = Gamecube Controller input_player2_joypad_index = Gamecube Controller

and here the problem in th cfg: input_player1_joypad_index = 9 input_player2_joypad_index = 9 in this way works but it have for all the players the same id in the cfg, and when i open retroarch gamecube controller is not set, other one is put on casually.

how i can specify in the remappingidentifier.ini the IDs? (ID=1 and ID=2)?

thanks!!

drlucid commented 1 year ago

when you type controllerremap.exe /list what do you see? for example

C:\Users\drlucid\eclipse-workspace\remap_tool>ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

No devices found.

Mouse Device List (Devices are in enumeration order) ...

  1. 'HID#VID_046D_PID_C52B_MI_01_Col01#8_532c6de_0_0000#'

End of list

On Fri, Aug 25, 2023 at 1:09 PM Shinlowneogetter @.***> wrote:

@drlucid https://github.com/drlucid , you saved a lot of stuff with you python code thanks!!! i hope you read this message. for the mouses i fixed totally, but i have an issue with the joypads for example i have from the list: 'Gamecube Controller', ID=1" 'Gamecube Controller', ID=2"

now, i paste this in the right file ini for change, but the cfg file return "-1" so i tried few things: input_player1_joypad_index = ID=1 input_player2_joypad_index = ID=2 return = "-1"

input_player1_joypad_index = 'Gamecube Controller', ID=1" input_player2_joypad_index = 'Gamecube Controller', ID=2" return = "-1"

the only change that works is: input_player1_joypad_index = Gamecube Controller input_player2_joypad_index = Gamecube Controller

and here the problem in th cfg: input_player1_joypad_index = 9 input_player2_joypad_index = 9 in this way works but it have for all the players the same id in the cfg, and when i open retroarch gamecube controller is not set, other one is put on casually.

how i can specify in the remappingidentifier.ini the IDs? (ID=1 and ID=2)?

thanks!!

— Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/7638#issuecomment-1693814173, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52OIULMLJTK6PAARTYD3E3XXDZ53ANCNFSM4GGETPGA . You are receiving this because you were mentioned.Message ID: @.***>

Shinlowneogetter commented 1 year ago

@drlucid Here is the problem, i have 4 gamecube controllers

from /list:

2023-08-26T09:00:43 ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

2023-08-26T09:00:43 2023-08-26T09:00:43 Joystick Device List (Devices are in enumeration order) ... 2023-08-26T09:00:43 2023-08-26T09:00:43 1. 'Controller (XBOX 360 For Windows)', ID=3 2023-08-26T09:00:43 2. 'Controller (XBOX 360 For Windows)', ID=2 2023-08-26T09:00:43 3. 'GameCube Controller Adapter', ID=12 2023-08-26T09:00:43 4. 'USB_Game12', ID=11 2023-08-26T09:00:43 5. 'GameCube Controller Adapter', ID=15 2023-08-26T09:00:43 6. 'GameCube Controller Adapter', ID=13 2023-08-26T09:00:43 7. 'GameCube Controller Adapter', ID=14 2023-08-26T09:00:43 8. 'JUYAO Dual Arcade', ID=0 2023-08-26T09:00:43 9. 'JUYAO Dual Arcade', ID=1 2023-08-26T09:00:43 2023-08-26T09:00:43 Mouse Device List (Devices are in enumeration order) ... 2023-08-26T09:00:43 2023-08-26T09:00:43 1. 'HID#VID_0461_PID_4D15#7_3a9bae7e_0_0000#' 2023-08-26T09:00:43 2. 'HID#VID_0079_PID_1802_MI_01_Col01#9_1f1dbd06_0_0000#' 2023-08-26T09:00:43 3. 'HID#VID_0079_PID_1802_MI_01_Col01#8_a4751fc_0_0000#' 2023-08-26T09:00:43 4. 'HID#VID_0000_PID_3825#8_30bac947_1_0000#' 2023-08-26T09:00:43 5. 'HID#VID_0461_PID_4E35#8_292af9fc_0_0000#' 2023-08-26T09:00:43 6. 'HID#VID_0000_PID_3825#8_15447cba_2_0000#' 2023-08-26T09:00:43 7. 'HID#VID_046D_PID_C062#7_219e267b_1_0000#' 2023-08-26T09:00:43 2023-08-26T09:00:43 End of list

When i copy and paste in remappingcontrollers.ini , it don't works: input_player1_joypad_index = GameCube Controller Adapter, ID=12 input_player2_joypad_index = GameCube Controller Adapter, ID=15 input_player3_joypad_index = GameCube Controller Adapter, ID=13 input_player4_joypad_index = GameCube Controller Adapter, ID=14

in dolphin.cfg it return -1

if i copy and paste this in remappingcontrollers.ini: input_player1_joypad_index = GameCube Controller Adapter input_player2_joypad_index = GameCube Controller Adapter input_player3_joypad_index = GameCube Controller Adapter input_player4_joypad_index = GameCube Controller Adapter

it works for the file in dolphin-emu.cfg but in retroarch don't works input_player1_joypad_index = 9 input_player1_joypad_index = 9 input_player1_joypad_index = 9 input_player1_joypad_index = 9

cause in this way the problem is that all are positioned in 9

if i put manually in retroarch settings the 4 controllers temporary directly here the cfg: input_player1_joypad_index = 3 input_player2_joypad_index = 7 input_player3_joypad_index = 5 input_player4_joypad_index = 6

i need to specify the ID=12 for example and here i don't know how to do

drlucid commented 1 year ago

The problem is my original assumption was that the unique identifier would be encased in single quotes. For the HID devices it is, but for the game controllers just 'GameCube Controller Adapter' is what is encased in single quotes which is obviously not unique. It is a really simple fix.

Give this a try and tell me if it works, and I will update the zip file for future users.

On Sat, Aug 26, 2023 at 1:09 AM Shinlowneogetter @.***> wrote:

@drlucid https://github.com/drlucid Here is the problem, i have 4 gamecube controllers

2023-08-26T09:00:43 ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

2023-08-26T09:00:43 2023-08-26T09:00:43 Joystick Device List (Devices are in enumeration order) ... 2023-08-26T09:00:43 2023-08-26T09:00:43 1. 'Controller (XBOX 360 For Windows)', ID=3 2023-08-26T09:00:43 2. 'Controller (XBOX 360 For Windows)', ID=2 2023-08-26T09:00:43 3. 'GameCube Controller Adapter', ID=12 2023-08-26T09:00:43 4. 'USB_Game12', ID=11 2023-08-26T09:00:43 5. 'GameCube Controller Adapter', ID=15 2023-08-26T09:00:43 6. 'GameCube Controller Adapter', ID=13 2023-08-26T09:00:43 7. 'GameCube Controller Adapter', ID=14 2023-08-26T09:00:43 8. 'JUYAO Dual Arcade', ID=0 2023-08-26T09:00:43 9. 'JUYAO Dual Arcade', ID=1 2023-08-26T09:00:43 2023-08-26T09:00:43 Mouse Device List (Devices are in enumeration order) ... 2023-08-26T09:00:43 2023-08-26T09:00:43 1. 'HID#VID_0461_PID_4D15#7_3a9bae7e_0_0000#' 2023-08-26T09:00:43 2. 'HID#VID_0079_PID_1802_MI_01_Col01#9_1f1dbd06_0_0000#' 2023-08-26T09:00:43 3. 'HID#VID_0079_PID_1802_MI_01_Col01#8_a4751fc_0_0000#' 2023-08-26T09:00:43 4. 'HID#VID_0000_PID_3825#8_30bac947_1_0000#' 2023-08-26T09:00:43 5. 'HID#VID_0461_PID_4E35#8_292af9fc_0_0000#' 2023-08-26T09:00:43 6. 'HID#VID_0000_PID_3825#8_15447cba_2_0000#' 2023-08-26T09:00:43 7. 'HID#VID_046D_PID_C062#7_219e267b_1_0000#' 2023-08-26T09:00:43 2023-08-26T09:00:43 End of list

When i copy and paste , it don't works: input_player1_joypad_index = GameCube Controller Adapter, ID=12 input_player2_joypad_index = GameCube Controller Adapter, ID=15 input_player3_joypad_index = GameCube Controller Adapter, ID=13 input_player4_joypad_index = GameCube Controller Adapter, ID=14

in dolphin.cfg it return -1

if i copy and paste this: input_player1_joypad_index = GameCube Controller Adapter input_player2_joypad_index = GameCube Controller Adapter input_player3_joypad_index = GameCube Controller Adapter input_player4_joypad_index = GameCube Controller Adapter

in dolphin-emu.cfg input_player1_joypad_index = 9 input_player1_joypad_index = 9 input_player1_joypad_index = 9 input_player1_joypad_index = 9

the problem is that all are positioned in 9

if i put manually in retroarch settings the 4 controllers temporary directly here the cfg: input_player1_joypad_index = 3 input_player2_joypad_index = 7 input_player3_joypad_index = 5 input_player4_joypad_index = 6

— Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/7638#issuecomment-1694206114, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52OIULSKPBNBVAHHBNBHV3XXGOLJANCNFSM4GGETPGA . You are receiving this because you were mentioned.Message ID: @.***>

''' Created on Jan 28, 2023

@author: drlucid ''' import subprocess import re from re import match import os try: from configparser import ConfigParser except ImportError: from ConfigParser import ConfigParser # ver. < 3.0

if name == 'main':

ini_filepath = 'remapIdentifiers.ini'

config = ConfigParser(allow_no_value = True);
config['mouse_keys'] = {};
config['joy_keys'] = {};
config['remap_files'] = {};
config['files_to_change_keys'] = {};
config['mouse_player1_keys'] = {};
config['mouse_player1_disabled'] = {};
config['mouse_player2_keys'] = {};
config['mouse_player2_disabled'] = {};
config['mouse_player3_keys'] = {};
config['mouse_player3_disabled'] = {};
config['mouse_player4_keys'] = {};
config['mouse_player4_disabled'] = {};
config['joy_player1_keys'] = {};
config['joy_player1_disabled'] = {};
config['joy_player2_keys'] = {};
config['joy_player2_disabled'] = {};
config['joy_player3_keys'] = {};
config['joy_player3_disabled'] = {};
config['joy_player4_keys'] = {};
config['joy_player4_disabled'] = {};

config.read(ini_filepath)

mouseIniKeys = list(config['mouse_keys'].keys());
mouseIniIdentifiers = [config['mouse_keys'][key] for key in mouseIniKeys];

joyIniKeys = list(config['joy_keys'].keys());
joyIniIdentifiers = [config['joy_keys'][key] for key in joyIniKeys];

remappedMouseIndices =  [False for mouseIniKey in mouseIniKeys]
remappedJoyIndices = [False for joyIniKey in joyIniKeys];

mouseCurrIdentifiers = [];
joyCurrIdentifiers = [];

filesToChange = list(config['remap_files']);

coreFilesToChange = list(config['files_to_change_keys']);

coreFileChangeMouseKeys = [];
coreFileMouseDefaultValues  = [];
coreFileMouseDisabledValues = [];
mouse_player_sections          = ['mouse_player1_keys'    , 'mouse_player2_keys',     'mouse_player3_keys'    , 'mouse_player4_keys'];
mouse_player_disabled_sections = ['mouse_player1_disabled', 'mouse_player2_disabled', 'mouse_player3_disabled', 'mouse_player4_disabled'];
for index in range(len(mouse_player_sections)):
    coreFileChangeMouseKeys.append([]);
    coreFileMouseDefaultValues.append({});
    coreFileMouseDisabledValues.append({});
    for key in list(config[mouse_player_sections[index]].keys()):
        coreFileChangeMouseKeys[-1].append(key);
        coreFileMouseDefaultValues [-1][key] = config[mouse_player_sections[index]][key];
        coreFileMouseDisabledValues[-1][key] = config[mouse_player_disabled_sections[index]][key];

coreFileChangeJoyKeys = [];
coreFileJoyDefaultValues  = [];
coreFileJoyDisabledValues = [];
joy_player_sections          = ['joy_player1_keys'    , 'joy_player2_keys'    , 'joy_player3_keys'    , 'joy_player4_keys'];
joy_player_disabled_sections = ['joy_player1_disabled', 'joy_player2_disabled', 'joy_player3_disabled', 'joy_player4_disabled'];
for index in range(len(joy_player_sections)):
    coreFileChangeJoyKeys.append([]);
    coreFileJoyDefaultValues.append({});
    coreFileJoyDisabledValues.append({});
    for key in list(config[joy_player_sections[index]].keys()):
        coreFileChangeJoyKeys[-1].append(key);
        coreFileJoyDefaultValues [-1][key] = config[joy_player_sections[index]][key];
        coreFileJoyDisabledValues[-1][key] = config[joy_player_disabled_sections[index]][key];

p = subprocess.Popen(os.path.join(os.path.dirname(__file__), 'ControllerRemap.exe') + " /list", stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate();
p_status = p.wait();
bMouse = False;
bJoystick = False;
for line in output.splitlines():
    line = str(line, encoding='utf-8', errors='strict');
    if re.search('^Mouse Device List.*', line):
            bJoystick = False;
            bMouse = True;
            continue;
    elif re.search('^Joystick Device List.*', line):
            bJoystick = True;
            bMouse = False;
            continue;
    if bJoystick | bMouse:
        match = re.search("([0-9]+)\..*'(.*)", line);
        if bool(match) & bJoystick:
            joyCurrIdentifiers.append(match[2]);
        elif bool(match) & bMouse:
            mouseCurrIdentifiers.append(match[2]);

for [IniIdentifiers, iniKeys, currIdentifiers, remappedIndices] in zip([mouseIniIdentifiers, joyIniIdentifiers], [mouseIniKeys, joyIniKeys], [mouseCurrIdentifiers, joyCurrIdentifiers], [remappedMouseIndices, remappedJoyIndices]):
    currIndices = [];
    for index in range(len(currIdentifiers)-1, -1, -1):
        currIndices.append(index);

    index = 0;
    newIniIndices = [None]*len(iniKeys); #which indices will belong with iniKeys
    for index in range(len(iniKeys)):
        try:
            tempIndex = list.index(currIdentifiers, IniIdentifiers[index]); #see which current identifier matches up with ini identifier
            newIniIndices[index] = currIndices[tempIndex]; #update replacement index with associated index from currIndices
        except:
            newIniIndices[index] = None;

    for fileToChange in filesToChange:
        with open(fileToChange) as f:
            fileLines = f.readlines();
            f.close();
        with open(fileToChange, 'w') as f:
            for line in fileLines:
                bFoundOne = False;
                for index in range(len(iniKeys)):
                    if re.search('^' + iniKeys[index], line):
                        #need to remap this key
                        if newIniIndices[index] != None:
                            f.write(iniKeys[index] + " = " + str(newIniIndices[index]) + '\n');
                            remappedIndices[index] = True;
                        else:
                            f.write(iniKeys[index] + " = " + str(-1) + '\n');
                        bFoundOne = True;
                        break;
                if not bFoundOne:
                    f.write(line);
            f.close();

for [coreFileChangeKeys, coreFileDefaultValues, coreFileDisabledValues] in zip([coreFileChangeMouseKeys,     coreFileChangeJoyKeys],
                                                                               [coreFileMouseDefaultValues,  coreFileJoyDefaultValues],
                                                                               [coreFileMouseDisabledValues, coreFileJoyDisabledValues]):
    for coreFileToChange in coreFilesToChange:
        with open(coreFileToChange) as f:
            fileLines = f.readlines();
            f.close();
            with open(coreFileToChange, 'w') as f:
                for line in fileLines:
                    bFoundOne = False;
                    for index in range(len(coreFileChangeKeys)):
                        for keyToChange in coreFileChangeKeys[index]:
                            if re.search('^' + keyToChange, line):
                                #need to remap this key to default value if successful in finding the controller, otherwise disable
                                if remappedMouseIndices[index]:
                                    f.write(keyToChange + " = " + coreFileDefaultValues[index][keyToChange] + '\n');
                                else:
                                    f.write(keyToChange + " = " + coreFileDisabledValues[index][keyToChange] + '\n');
                                bFoundOne = True;
                                break;
                    if not bFoundOne:
                        f.write(line);
                f.close();
drlucid commented 1 year ago

Okay, there was an issue with my fix, it broke the mouse identifiers. So, now, the attached should work with both.

For the gamecube, or anything that is not fully encased by single quotes, include everything including the single quotes in the identifier and whatever is after the single quotes, e.g. 'GameCube Controller Adapter', ID=14 For the mouse devices, or anything that is fully encased by single quotes, e.g. HID#VID_046D_PID_C062#7_219e267b_1_0000#

This modified version appears to work as advertised above, let me know if it does and I will create a new version with some additional documentation to explain above.

On Sat, Aug 26, 2023 at 6:03 AM Russell Hofer @.***> wrote:

The problem is my original assumption was that the unique identifier would be encased in single quotes. For the HID devices it is, but for the game controllers just 'GameCube Controller Adapter' is what is encased in single quotes which is obviously not unique. It is a really simple fix.

Give this a try and tell me if it works, and I will update the zip file for future users.

On Sat, Aug 26, 2023 at 1:09 AM Shinlowneogetter @.***> wrote:

@drlucid https://github.com/drlucid Here is the problem, i have 4 gamecube controllers

2023-08-26T09:00:43 ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

2023-08-26T09:00:43 2023-08-26T09:00:43 Joystick Device List (Devices are in enumeration order) ... 2023-08-26T09:00:43 2023-08-26T09:00:43 1. 'Controller (XBOX 360 For Windows)', ID=3 2023-08-26T09:00:43 2. 'Controller (XBOX 360 For Windows)', ID=2 2023-08-26T09:00:43 3. 'GameCube Controller Adapter', ID=12 2023-08-26T09:00:43 4. 'USB_Game12', ID=11 2023-08-26T09:00:43 5. 'GameCube Controller Adapter', ID=15 2023-08-26T09:00:43 6. 'GameCube Controller Adapter', ID=13 2023-08-26T09:00:43 7. 'GameCube Controller Adapter', ID=14 2023-08-26T09:00:43 8. 'JUYAO Dual Arcade', ID=0 2023-08-26T09:00:43 9. 'JUYAO Dual Arcade', ID=1 2023-08-26T09:00:43 2023-08-26T09:00:43 Mouse Device List (Devices are in enumeration order) ... 2023-08-26T09:00:43 2023-08-26T09:00:43 1. 'HID#VID_0461_PID_4D15#7_3a9bae7e_0_0000#' 2023-08-26T09:00:43 2. 'HID#VID_0079_PID_1802_MI_01_Col01#9_1f1dbd06_0_0000#' 2023-08-26T09:00:43 3. 'HID#VID_0079_PID_1802_MI_01_Col01#8_a4751fc_0_0000#' 2023-08-26T09:00:43 4. 'HID#VID_0000_PID_3825#8_30bac947_1_0000#' 2023-08-26T09:00:43 5. 'HID#VID_0461_PID_4E35#8_292af9fc_0_0000#' 2023-08-26T09:00:43 6. 'HID#VID_0000_PID_3825#8_15447cba_2_0000#' 2023-08-26T09:00:43 7. 'HID#VID_046D_PID_C062#7_219e267b_1_0000#' 2023-08-26T09:00:43 2023-08-26T09:00:43 End of list

When i copy and paste , it don't works: input_player1_joypad_index = GameCube Controller Adapter, ID=12 input_player2_joypad_index = GameCube Controller Adapter, ID=15 input_player3_joypad_index = GameCube Controller Adapter, ID=13 input_player4_joypad_index = GameCube Controller Adapter, ID=14

in dolphin.cfg it return -1

if i copy and paste this: input_player1_joypad_index = GameCube Controller Adapter input_player2_joypad_index = GameCube Controller Adapter input_player3_joypad_index = GameCube Controller Adapter input_player4_joypad_index = GameCube Controller Adapter

in dolphin-emu.cfg input_player1_joypad_index = 9 input_player1_joypad_index = 9 input_player1_joypad_index = 9 input_player1_joypad_index = 9

the problem is that all are positioned in 9

if i put manually in retroarch settings the 4 controllers temporary directly here the cfg: input_player1_joypad_index = 3 input_player2_joypad_index = 7 input_player3_joypad_index = 5 input_player4_joypad_index = 6

— Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/7638#issuecomment-1694206114, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52OIULSKPBNBVAHHBNBHV3XXGOLJANCNFSM4GGETPGA . You are receiving this because you were mentioned.Message ID: @.***>

''' Created on Jan 28, 2023

@author: drlucid ''' import subprocess import re from re import match import os try: from configparser import ConfigParser except ImportError: from ConfigParser import ConfigParser # ver. < 3.0

if name == 'main':

ini_filepath = 'remapIdentifiers.ini'

config = ConfigParser(allow_no_value = True);
config['mouse_keys'] = {};
config['joy_keys'] = {};
config['remap_files'] = {};
config['files_to_change_keys'] = {};
config['mouse_player1_keys'] = {};
config['mouse_player1_disabled'] = {};
config['mouse_player2_keys'] = {};
config['mouse_player2_disabled'] = {};
config['mouse_player3_keys'] = {};
config['mouse_player3_disabled'] = {};
config['mouse_player4_keys'] = {};
config['mouse_player4_disabled'] = {};
config['joy_player1_keys'] = {};
config['joy_player1_disabled'] = {};
config['joy_player2_keys'] = {};
config['joy_player2_disabled'] = {};
config['joy_player3_keys'] = {};
config['joy_player3_disabled'] = {};
config['joy_player4_keys'] = {};
config['joy_player4_disabled'] = {};

config.read(ini_filepath)

mouseIniKeys = list(config['mouse_keys'].keys());
mouseIniIdentifiers = [config['mouse_keys'][key] for key in mouseIniKeys];

joyIniKeys = list(config['joy_keys'].keys());
joyIniIdentifiers = [config['joy_keys'][key] for key in joyIniKeys];

remappedMouseIndices =  [False for mouseIniKey in mouseIniKeys]
remappedJoyIndices = [False for joyIniKey in joyIniKeys];

mouseCurrIdentifiers = [];
joyCurrIdentifiers = [];

filesToChange = list(config['remap_files']);

coreFilesToChange = list(config['files_to_change_keys']);

coreFileChangeMouseKeys = [];
coreFileMouseDefaultValues  = [];
coreFileMouseDisabledValues = [];
mouse_player_sections          = ['mouse_player1_keys'    , 'mouse_player2_keys',     'mouse_player3_keys'    , 'mouse_player4_keys'];
mouse_player_disabled_sections = ['mouse_player1_disabled', 'mouse_player2_disabled', 'mouse_player3_disabled', 'mouse_player4_disabled'];
for index in range(len(mouse_player_sections)):
    coreFileChangeMouseKeys.append([]);
    coreFileMouseDefaultValues.append({});
    coreFileMouseDisabledValues.append({});
    for key in list(config[mouse_player_sections[index]].keys()):
        coreFileChangeMouseKeys[-1].append(key);
        coreFileMouseDefaultValues [-1][key] = config[mouse_player_sections[index]][key];
        coreFileMouseDisabledValues[-1][key] = config[mouse_player_disabled_sections[index]][key];

coreFileChangeJoyKeys = [];
coreFileJoyDefaultValues  = [];
coreFileJoyDisabledValues = [];
joy_player_sections          = ['joy_player1_keys'    , 'joy_player2_keys'    , 'joy_player3_keys'    , 'joy_player4_keys'];
joy_player_disabled_sections = ['joy_player1_disabled', 'joy_player2_disabled', 'joy_player3_disabled', 'joy_player4_disabled'];
for index in range(len(joy_player_sections)):
    coreFileChangeJoyKeys.append([]);
    coreFileJoyDefaultValues.append({});
    coreFileJoyDisabledValues.append({});
    for key in list(config[joy_player_sections[index]].keys()):
        coreFileChangeJoyKeys[-1].append(key);
        coreFileJoyDefaultValues [-1][key] = config[joy_player_sections[index]][key];
        coreFileJoyDisabledValues[-1][key] = config[joy_player_disabled_sections[index]][key];

p = subprocess.Popen(os.path.join(os.path.dirname(__file__), 'ControllerRemap.exe') + " /list", stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate();
p_status = p.wait();
bMouse = False;
bJoystick = False;
for line in output.splitlines():
    line = str(line, encoding='utf-8', errors='strict');
    if re.search('^Mouse Device List.*', line):
            bJoystick = False;
            bMouse = True;
            continue;
    elif re.search('^Joystick Device List.*', line):
            bJoystick = True;
            bMouse = False;
            continue;
    if bJoystick | bMouse:
        match = re.search("([0-9]+)\.[^']*(?:'(?=.*'$))?(.*?)'?$", line);
        if bool(match) & bJoystick:
            joyCurrIdentifiers.append(match[2]);
        elif bool(match) & bMouse:
            mouseCurrIdentifiers.append(match[2]);

for [IniIdentifiers, iniKeys, currIdentifiers, remappedIndices] in zip([mouseIniIdentifiers, joyIniIdentifiers], [mouseIniKeys, joyIniKeys], [mouseCurrIdentifiers, joyCurrIdentifiers], [remappedMouseIndices, remappedJoyIndices]):
    currIndices = [];
    for index in range(len(currIdentifiers)-1, -1, -1):
        currIndices.append(index);

    index = 0;
    newIniIndices = [None]*len(iniKeys); #which indices will belong with iniKeys
    for index in range(len(iniKeys)):
        try:
            tempIndex = list.index(currIdentifiers, IniIdentifiers[index]); #see which current identifier matches up with ini identifier
            newIniIndices[index] = currIndices[tempIndex]; #update replacement index with associated index from currIndices
        except:
            newIniIndices[index] = None;

    for fileToChange in filesToChange:
        with open(fileToChange) as f:
            fileLines = f.readlines();
            f.close();
        with open(fileToChange, 'w') as f:
            for line in fileLines:
                bFoundOne = False;
                for index in range(len(iniKeys)):
                    if re.search('^' + iniKeys[index], line):
                        #need to remap this key
                        if newIniIndices[index] != None:
                            f.write(iniKeys[index] + " = " + str(newIniIndices[index]) + '\n');
                            remappedIndices[index] = True;
                        else:
                            f.write(iniKeys[index] + " = " + str(-1) + '\n');
                        bFoundOne = True;
                        break;
                if not bFoundOne:
                    f.write(line);
            f.close();

for [coreFileChangeKeys, coreFileDefaultValues, coreFileDisabledValues] in zip([coreFileChangeMouseKeys,     coreFileChangeJoyKeys],
                                                                               [coreFileMouseDefaultValues,  coreFileJoyDefaultValues],
                                                                               [coreFileMouseDisabledValues, coreFileJoyDisabledValues]):
    for coreFileToChange in coreFilesToChange:
        with open(coreFileToChange) as f:
            fileLines = f.readlines();
            f.close();
            with open(coreFileToChange, 'w') as f:
                for line in fileLines:
                    bFoundOne = False;
                    for index in range(len(coreFileChangeKeys)):
                        for keyToChange in coreFileChangeKeys[index]:
                            if re.search('^' + keyToChange, line):
                                #need to remap this key to default value if successful in finding the controller, otherwise disable
                                if remappedMouseIndices[index]:
                                    f.write(keyToChange + " = " + coreFileDefaultValues[index][keyToChange] + '\n');
                                else:
                                    f.write(keyToChange + " = " + coreFileDisabledValues[index][keyToChange] + '\n');
                                bFoundOne = True;
                                break;
                    if not bFoundOne:
                        f.write(line);
                f.close();
Shinlowneogetter commented 1 year ago

hi dear it partial works, i try to explain: here the list

C:\Users\Games\Desktop>O:\LAUNCHBOX\Emulators\2023\RetroArch_1.15\ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

  1. 'Controller (XBOX 360 For Windows)', ID=3
  2. 'Controller (XBOX 360 For Windows)', ID=2
  3. 'GameCube Controller Adapter', ID=12
  4. 'USB_Game12', ID=11
  5. 'GameCube Controller Adapter', ID=15
  6. 'GameCube Controller Adapter', ID=13
  7. 'GameCube Controller Adapter', ID=14
  8. 'JUYAO Dual Arcade', ID=0
  9. 'JUYAO Dual Arcade', ID=1

Mouse Device List (Devices are in enumeration order) ...

  1. 'HID#VID_0461_PID_4D15#7_3a9bae7e_0_0000#'
  2. 'HID#VID_046D_PID_C062#7_219e267b_1_0000#'
  3. 'HID#VID_0079_PID_1802_MI_01_Col01#9_1f1dbd06_0_0000#'
  4. 'HID#VID_0079_PID_1802_MI_01_Col01#8_a4751fc_0_0000#'
  5. 'HID#VID_0000_PID_3825#8_30bac947_1_0000#'
  6. 'HID#VID_0461_PID_4E35#8_292af9fc_0_0000#'
  7. 'HID#VID_0000_PID_3825#8_15447cba_2_0000#'

in the file ini: ;same as mouse_keys but for joystick devices [joy_keys] input_player1_joypad_index = 'GameCube Controller Adapter', ID=14 input_player2_joypad_index = 'GameCube Controller Adapter', ID=13 input_player3_joypad_index = 'GameCube Controller Adapter', ID=15 input_player4_joypad_index = 'GameCube Controller Adapter', ID=12

in controller 1: is ok in controller 2: 'USB_Game12', ID=11 in controller 3: is ok in controller 4: is ok

the problem is the second controller cause, if you notice in the first list appears my other usb controller ('USBGame12', ID=11), it seems that if you have other usb plugged but in the middle, your file will take it, cause as you know, the position of the usb can change, it seems that start from the first gamecube controller and it will takes everything under it, not everything called "gamecube controller" , i hope to be clear, my english is not so good, i'm italian ^^

P.s. there is another thing you can notice. from the latest versions of retroarch, it seems that the .cfg file in the root \config , will not anymore named .cfg example: before i had: PSX_REARMED.CFG , now retroarch changed it in PSX_REARMED (without any extension) to make your file works i needed to create a core override, and retroarch creates in config\flycast\flycast.cfg (in this case the extesions remains, only in the subfolder). so your file not work with PSXREARMED (i tried anyway, to leave the .cfg extension from you ini file but not works) thank you so much! ^^

drlucid commented 1 year ago

Shinlowneogetter,

I cannot figure out what might be going wrong for you. I doublechecked the items in your list and they should parse just fine. Of course, if you remove and replug a controller in anytime after the script runs it will mess it up. If you can provide more specifics maybe I can help, but dont have enough information to go off of.

Regarding the ps, there is no constraint that says the file has to have a .cfg on the end. I don't understand the issue. Did they completely change the file format or something? Again, if you could provide more specifics

Shinlowneogetter commented 1 year ago

@drlucid

HI! ^^ Sunday evening when I get back I'll start testing again and I'll make you more in-depth screenshots :) Thanks so much for now! very kind and really useful your file! saved me on the lightguns!

Shinlowneogetter commented 11 months ago

@drlucid hi! sorry for disturb again, i fixed everything, but there is something is making me crazy there is no way to make run the you py file with a shortcut... i try to explain

1) if i make shortcut to the desktop of the remapidentifiers.py, it dont work, no id change 2) if i make a batch file to run the remapidentifiers.py , it dont work 3) if i make an ahk to run remapidentifiers.py , not work 4) if i make bat file with "c:\python\python.exe" "o:\games\retroarch\remapidentifiers.py it don't work 5) if i put the file directly on launchbox with option "open before start emulator" it dont work the only way to make it function is go in the folder manually, and start directly the file remapidentifiers.py , in this way the id changes correctly but i need absolutely to make a shortcut or batch to run it on startup windows or on launchbox that start before the game. any suggestion?

gharb0129 commented 8 months ago

@drlucid

Hello! I'm attempting to use your Python script, which constantly changes my mouse indexes to -1 in my retroarch.cfg file (indicating my light guns aren't detected). My ControllerRemap output shows that both light guns are available and match the HIDs I placed into the remapidentifiers.ini. Here's a snippet of everything:

image

I ran this from the shell too and didn't see any errors:

image

Any thoughts?

drlucid commented 8 months ago

@drlucid hi! sorry for disturb again, i fixed everything, but there is something is making me crazy there is no way to make run the you py file with a shortcut... i try to explain

  1. if i make shortcut to the desktop of the remapidentifiers.py, it dont work, no id change
  2. if i make a batch file to run the remapidentifiers.py , it dont work
  3. if i make an ahk to run remapidentifiers.py , not work
  4. if i make bat file with "c:\python\python.exe" "o:\games\retroarch\remapidentifiers.py it don't work
  5. if i put the file directly on launchbox with option "open before start emulator" it dont work the only way to make it function is go in the folder manually, and start directly the file remapidentifiers.py , in this way the id changes correctly but i need absolutely to make a shortcut or batch to run it on startup windows or on launchbox that start before the game. any suggestion?

I run it through a short retroarch.bat file that I pass the name of the rom:

remapIdentifiers.py retroach %*

drlucid commented 8 months ago

@drlucid

Hello! I'm attempting to use your Python script, which constantly changes my mouse indexes to -1 in my retroarch.cfg file (indicating my light guns aren't detected). My ControllerRemap output shows that both light guns are available and match the HIDs I placed into the remapidentifiers.ini. Here's a snippet of everything:

image

I ran this from the shell too and didn't see any errors:

image

Any thoughts?

don't see anything obvious. I am attaching the current version - just adding the updates in this email chain to the zip file.
remapIdentifierx.v0.1.zip

could you exactly quote the output from ControllerRemap.exe ? for example

C:\Users\drlucid\eclipse-workspace\remap_tool>ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

No devices found.

Mouse Device List (Devices are in enumeration order) ...

  1. 'HID#VID_046D_PID_C52B_MI_01_Col01#8_532c6de_0_0000#'

End of list

gharb0129 commented 8 months ago

@drlucid Hello! I'm attempting to use your Python script, which constantly changes my mouse indexes to -1 in my retroarch.cfg file (indicating my light guns aren't detected). My ControllerRemap output shows that both light guns are available and match the HIDs I placed into the remapidentifiers.ini. Here's a snippet of everything: image I ran this from the shell too and didn't see any errors: image Any thoughts?

don't see anything obvious. I am attaching the current version - just adding the updates in this email chain to the zip file. remapIdentifierx.v0.1.zip

could you exactly quote the output from ControllerRemap.exe ? for example

C:\Users\drlucid\eclipse-workspace\remap_tool>ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

No devices found.

Mouse Device List (Devices are in enumeration order) ...

  1. 'HID#VID_046D_PID_C52B_MI_01_Col01#8_532c6de_0_0000#'

End of list

@drlucid Sure thing, see below. I tried again using the files you attached and the values in my .cfg still change to -1:

E:\Launchbox\Emulators\Retroarch (Lightgun Only)\config\Test2>ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

  1. 'SindenLightgun', ID=3
  2. 'SindenLightgun', ID=1

Mouse Device List (Devices are in enumeration order) ...

  1. 'HID#VID_25B1_PID_0003_Col02#2_24d1a99c_2_0001#'
  2. 'HID#VID_046D_PID_C539_MI_01_Col01#8_204fde1d_0_0000#'
  3. 'HID#VID_046D_PID_C33F_MI_01_Col02#7_2f1a73e0_0_0001#'
  4. 'HID#VID_046D_PID_C08D_MI_00#8_320ad564_0_0000#'
  5. 'HID#VID_16C0_PID_0F02_MI_02_Col02#8_68c3320_0_0001#'
  6. 'HID#VID_16C0_PID_0F01_MI_02_Col02#8_31e89dc4_0_0001#'

End of list

drlucid commented 8 months ago

I see no issue with the regular expression portion, which is the most fragile part.

Can you try using this version of python ?

C:\Users\drlucid>python --version Python 3.7.4

On Sat, Jan 6, 2024 at 1:49 PM gharb0129 @.***> wrote:

@drlucid https://github.com/drlucid Hello! I'm attempting to use your Python script, which constantly changes my mouse indexes to -1 in my retroarch.cfg file (indicating my light guns aren't detected). My ControllerRemap output shows that both light guns are available and match the HIDs I placed into the remapidentifiers.ini. Here's a snippet of everything: [image: image] https://private-user-images.githubusercontent.com/67556798/294059289-b1dca603-3eb3-4263-905f-b72100f08741.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQzMzk1ODUsIm5iZiI6MTcwNDMzOTI4NSwicGF0aCI6Ii82NzU1Njc5OC8yOTQwNTkyODktYjFkY2E2MDMtM2ViMy00MjYzLTkwNWYtYjcyMTAwZjA4NzQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTA0VDAzMzQ0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3OWNhNTdjYWFmYWNjZTViZTQwN2M3M2RhODM0YWYwZDY5MTM4MGUzYTJhNjk0NjBmMGVjN2E1ZmIzY2M2ZGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0r_u4dPNNPSfCi5QNyVISmEQTjT4NKR6vOUzXlxs3uQ I ran this from the shell too and didn't see any errors: [image: image] https://private-user-images.githubusercontent.com/67556798/294059454-5c06c21b-ab4f-4ce2-91aa-dcdbcb650fc2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQzMzk1ODUsIm5iZiI6MTcwNDMzOTI4NSwicGF0aCI6Ii82NzU1Njc5OC8yOTQwNTk0NTQtNWMwNmMyMWItYWI0Zi00Y2UyLTkxYWEtZGNkYmNiNjUwZmMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTA0VDAzMzQ0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM5NjIwZDU2YzllZDE3ZGI0OTM2NGUzODhjMTE5NTVkMGJlOTY5ODMyOTYzNTU2OTgzNmM0NTc2OGYzNGY0OTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zeRYbGEA8CbCvSCXJeVI7M-5qW3nffK923H8Bqnzdak Any thoughts?

don't see anything obvious. I am attaching the current version - just adding the updates in this email chain to the zip file. remapIdentifierx.v0.1.zip https://github.com/libretro/RetroArch/files/13825400/remapIdentifierx.v0.1.zip

could you exactly quote the output from ControllerRemap.exe ? for example

C:\Users\drlucid\eclipse-workspace\remap_tool>ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

No devices found.

Mouse Device List (Devices are in enumeration order) ...

  1. 'HID#VID_046D_PID_C52B_MI_01_Col01#8_532c6de_0_0000#'

End of list

@drlucid https://github.com/drlucid Sure thing, see below. I tried again using the files you attached and the values in my .cfg still change to -1:

E:\Launchbox\Emulators\Retroarch (Lightgun Only)\config\Test2>ControllerRemap.exe /list

ControllerRemap Utility v0.0.11.0 - For Mame (c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

  1. 'SindenLightgun', ID=3
  2. 'SindenLightgun', ID=1

Mouse Device List (Devices are in enumeration order) ...

  1. 'HID#VID_25B1_PID_0003_Col02#2_24d1a99c_2_0001#'
  2. 'HID#VID_046D_PID_C539_MI_01_Col01#8_204fde1d_0_0000#'
  3. 'HID#VID_046D_PID_C33F_MI_01_Col02#7_2f1a73e0_0_0001#'
  4. 'HID#VID_046D_PID_C08D_MI_00#8_320ad564_0_0000#'
  5. 'HID#VID_16C0_PID_0F02_MI_02_Col02#8_68c3320_0_0001#'
  6. 'HID#VID_16C0_PID_0F01_MI_02_Col02#8_31e89dc4_0_0001#'

End of list

— Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/7638#issuecomment-1879824737, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52OIULHLOWRPRHTAH7SFVLYNG2FFAVCNFSM4GGETPGKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXHE4DENBXGM3Q . You are receiving this because you were mentioned.Message ID: @.***>

gharb0129 commented 8 months ago

Tried w/ 3.7.4 and didn't see any difference (see below). Sorry, I'm not much help but I can test something else if you have any ideas.

image

drlucid commented 8 months ago

send me a copy of your configuration and I will try it here

On Sat, Jan 6, 2024 at 3:23 PM gharb0129 @.***> wrote:

Tried w/ 3.7.4 (see below). Sorry, I'm not much help but I can test something else if you have any ideas.

image.png (view on web) https://github.com/libretro/RetroArch/assets/67556798/63c949a5-8c87-47b0-bf7a-6acb11b5524e

— Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/7638#issuecomment-1879847983, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52OIUIKWSWDERTNJCY7VE3YNHFE7AVCNFSM4GGETPGKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXHE4DINZZHAZQ . You are receiving this because you were mentioned.Message ID: @.***>

drlucid commented 8 months ago

i can fake it out with regard to what hardware i have

On Sat, Jan 6, 2024 at 5:42 PM Russell Hofer @.***> wrote:

send me a copy of your configuration and I will try it here

On Sat, Jan 6, 2024 at 3:23 PM gharb0129 @.***> wrote:

Tried w/ 3.7.4 (see below). Sorry, I'm not much help but I can test something else if you have any ideas.

image.png (view on web) https://github.com/libretro/RetroArch/assets/67556798/63c949a5-8c87-47b0-bf7a-6acb11b5524e

— Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/7638#issuecomment-1879847983, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52OIUIKWSWDERTNJCY7VE3YNHFE7AVCNFSM4GGETPGKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXHE4DINZZHAZQ . You are receiving this because you were mentioned.Message ID: @.***>

gharb0129 commented 8 months ago

@drlucid Had to change the file extension to .txt to attach it a github comment:

retroarch.txt

Here's the exact contents of the .cfg: input_player1_mouse_index = -1 input_player2_mouse_index = -1

drlucid commented 8 months ago

also, i need the .ini file

gharb0129 commented 8 months ago

@drlucid - here's the ini:

remapIdentifiers.txt

drlucid commented 8 months ago

I just did a simulation and it worked. So, can you do this

ControllerRemap.exe /list >> test.txt

and then send me test.txt. also, just to verify, for testing purposes you are running 'python remapIdentifiers.py' from a command prompt that is cd into the directory that contains: ControllerRemap.exe Microsoft.DirectX.DirectInput.dll Microsoft.DirectX.dll remapIdentifiers.py remapIdentifiers.ini retroarch.cfg

and, when you are in that dir, you can type 'python --version and it says 3.7.4 ; sometimes it is easy to accidentally run the wrong version of python if multiple are installed on the system.

image

gharb0129 commented 8 months ago

@drlucid - Well that did it! For some reason my lightgun HIDs are different when I run ControllerRemap.exe from command prompt and exported the IDs to test.txt. This would explain why I was seeing -1 in my .cfg file (the HIDs were not correct for some reason).

Thank you for the support!

@Shinlowneogetter - Not sure if this will help but I made a batch file to run drlucid's python script. Seems to work every time. Change the file path below to wherever you have remapidentifiers.py stored and place the contents into a batch file:

cd "E:\Launchbox\Emulators\Retroarch (Lightgun Only)\config\FCEUmm" py remapidentifiers.py