How does Supermodel 3 determine mouse assignments?

Having technical difficulties with Supermodel? Last-minute wardrobe malfunction? Get help here.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

How does Supermodel 3 determine mouse assignments?

Postby hamburglin » Tue Jun 27, 2023 3:13 pm

I'm sure we're all aware of supermodel 3 reassigning mouses (light guns) after each reboot (not emulator start!). This of course requires the user to figure out what their light guns are set to every boot and reconfigure the bindings every time. I also understand that windows doesn't uphold any ordering either.

What I'm hoping for is that someone can help me determine HOW supermodel 3 determines its mouse assignments. I'd like to know this so that I can replicate it, and then programmatically update my config accordingly at startup.

This is important because friends and family who pick up my guns often find that the sm3 light gun games aren't working and it feels "bad", and it's unfeasible for me to be around and spend 5 minutes changing the config each time.
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm

Re: How does Supermodel 3 determine mouse assignments?

Postby hamburglin » Wed Jun 28, 2023 8:27 am

No one knows what function is being called so I can script or compile it to pull the same list of mouses, in the same order?

Is supermodel 3 open source?
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm

Re: How does Supermodel 3 determine mouse assignments?

Postby Bart » Wed Jun 28, 2023 11:23 am

This is not appropriate for Dark Room. Questions about how to use or configure Supermodel should be here unless you are planning to write code.

As for how it determines mouse numbering, this is provided by the underlying system (SDL or DirectInput). There is probably a way to establish a consistent mapping using some device identification string, if the APIs support it. I'm told that MAME does something like this. Haven't had time to look into it but would accept a PR if and only if it was applied consistently to all of the input systems we have.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: How does Supermodel 3 determine mouse assignments?

Postby hamburglin » Wed Jun 28, 2023 2:07 pm

Thanks for the response Bart.

What I'm looking to do is compile a simple executable that retrieves the mouses in the same exact manner that sm3 does. Once I have that list, I'll determine which hardware IDs my light guns are and update the sm3 config accordingly.

Otherwise and as far as mame, they allow you to use assign a hardware ID to "player/mouse 1" However, I don't know how that is handed off, mapped and then used exactly.

My question to you or any one familiar with the sm3 code base is: can you point me to the exact line in the source code that retrieves the mice and obtains/assigns their mouse index number?
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm

Re: How does Supermodel 3 determine mouse assignments?

Postby Bart » Wed Jun 28, 2023 5:54 pm

hamburglin wrote:Thanks for the response Bart.

What I'm looking to do is compile a simple executable that retrieves the mouses in the same exact manner that sm3 does. Once I have that list, I'll determine which hardware IDs my light guns are and update the sm3 config accordingly.


I didn't write the input code but I think it just receives a list of devices from DirectInput or SDL, in whatever order they provide, and enumerates them from 1 onwards. This may not be consistent, particularly, if you unplug devices or plug in new ones. You can pretty easily determine joystick numberings (and maybe mouse numberings, but I haven't checked) by typing: supermodel -print-inputs

For example, I get the following output in there:

Code: Select all
Input System Settings
---------------------

Input System: Xinput

Keyboards:
 System Keyboard
Mice:
 System Mouse
Joysticks:
 1: Xbox 360 Controller 1 (via XInput) [Force Feedback Available]
 2: Pro Controller


I have two game pads plugged in. Note that I initially only had the "Pro Controller" (a Sega 6-button USB pad) plugged in and it was therefore assigned #1. When I plug in my XBox controller, it was assigned #1 and the earlier controller became #2. To my knowledge, this is not something you can rely on.

Otherwise and as far as mame, they allow you to use assign a hardware ID to "player/mouse 1" However, I don't know how that is handed off, mapped and then used exactly.


Supermodel doesn't know about hardware IDs. Someone would have to code that up. I will accept a comprehensive solution but will reject solutions that only work for e.g. DirectInput but not XInput, RawInput, or SDL modes (assuming this is possible in each mode). It needs to be a complete solution that works across all possible input system modes that Supermodel supports.

My question to you or any one familiar with the sm3 code base is: can you point me to the exact line in the source code that retrieves the mice and obtains/assigns their mouse index number?


I don't know off-hand where that specific code is but the general input system is in Inputs/. The specific input system code is located in OSD/SDL/SDLInputSystem.cpp (SDL), OSD/Windows/DirectInputSystem.cpp (DirectInput, XInput, and RawInput). You could also follow along from OSD/SDL/Main.cpp examining how the -print-inputs option works and trace into the code from there.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: How does Supermodel 3 determine mouse assignments?

Postby hamburglin » Wed Jun 28, 2023 5:58 pm

Awesome. Thank you Bart!
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm

Re: How does Supermodel 3 determine mouse assignments?

Postby hamburglin » Wed Jun 28, 2023 6:48 pm

I had no idea I could pull the inputs with supermodel. It does list the mouses in their correct order.

All of the mouses are labeled "HID mouse device", but you can just edit their device descriptions under CurrentControllSet001 in the registry to give your guns unique identifiers, and they persist between boots!!!

Bazinga! Now I just need a startup script to run that, parse it and edit the conf file accordingly.
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm

Re: How does Supermodel 3 determine mouse assignments?

Postby Bart » Wed Jun 28, 2023 7:57 pm

hamburglin wrote:I had no idea I could pull the inputs with supermodel. It does list the mouses in their correct order.

All of the mouses are labeled "HID mouse device", but you can just edit their device descriptions under CurrentControllSet001 in the registry to give your guns unique identifiers, and they persist between boots!!!

Bazinga! Now I just need a startup script to run that, parse it and edit the conf file accordingly.


I did not know about this registry hack. That's a good one for advanced users. Consider writing it up and posting it here! Maybe we can create a sticky topic or something for it.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: How does Supermodel 3 determine mouse assignments?

Postby hamburglin » Wed Jun 28, 2023 9:27 pm

Just implemented it on my machine. Will do.
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm


Return to The Fitting Room

Who is online

Users browsing this forum: No registered users and 0 guests