Adding ontrollers setting feature in UI

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
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!

Adding ontrollers setting feature in UI

Postby segaduck » Thu May 20, 2021 6:52 pm

Hi,
I am recently studying in adding more feature in Supermodel UI project which using AutoHotKey to implement.

I am thinking of implementing controllers setting in it, but I think it is better to ask here to save some try-and-error time.

I know there is a command prompt mode of controllers setting in supermodel, and what is the best method to get the key/controller press-down events and integrate it to AutoHotKey ?
Or which part of the source code I should I read first ? Is it any possible not to modify the main supermodel codes but only implement an add-on feature in Sueprmodel UI?

Sorry for so many questions because I am just start to study it and with not much experience but I want use my leisure time to have some contribution to supermodel, my favorite emu .
Thank you.
segaduck
 
Posts: 52
Joined: Thu Oct 01, 2020 9:23 am

Re: Adding ontrollers setting feature in UI

Postby Bart » Mon May 24, 2021 7:44 pm

What is Auto-Hot Key? I forget exactly where key events are surfaced but ultimately, they are placed into a data structure that is polled every frame in the main loop in Main.cpp. You can easily see it. I'm not sure how you want to pass these outside of Supermodel or whether that would even be a good idea. Does any other emulator do this?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Adding ontrollers setting feature in UI

Postby segaduck » Mon May 24, 2021 9:47 pm

Thank for your reply.
I am not familiar with AutoHotKey either. The reason I used it just because the author of Supermodel UI Nuexzz using it and I added some simple features such as "friend's IP list" and networking parameters update in the frontend UI project. Nuexzz has already done a great job, and I just want to add the controllers setting in his project instead of re-write a whole project from beginning.

I've written a testing program with AutoHotKey to get the inputs from keyboards and joysticks, and I found although I can get the inputs but it is very complicated to mapping the names of inputs to Supermodel's input naming system. After testing and googling, I found another major problem of AutoHotKey is that it does not support "Xbox One/S/X" Xinput but only Xbox360.

I am thinking of another way to implement the input configuration UI.
Following is the idea:

(1) Press a "button" in Supermodel UI which the user wants to set up. For example, the Fighting Games' "Punch" button.
(2) UI sent out the command "supermodel -config-inputs".
(3) UI sent out key_Down command several times to move to the cursor in command prompt corresponding to the correct Fighting Games' "Punch" position.
(4) UI send out key_Enter command and wait for the user's input.
(5) UI get the name of input in command prompt. For example, "JOY1_BUTTON5"
(6) UI send out "Esc" command and does not save to supermodel.ini (which will be done later in UI program)
(7) In the saving procedure of UI, save all inputs' configuration to supermodel.ini

To achieve that, what I need is a method to call "Inputs model" and get the feedback string of the name of user's input.
However, I am not familiar with the codes in supermodel. Can anyone help to give me some instructions or help.
Thank you.
segaduck
 
Posts: 52
Joined: Thu Oct 01, 2020 9:23 am

Re: Adding ontrollers setting feature in UI

Postby segaduck » Mon May 24, 2021 10:29 pm

I've checked the functions in AutoHotKey, and I found a method as following:

Result := DllCall("DllFile\Function" , Type1, Arg1, Type2, Arg2, "Cdecl ReturnType")

I can include a .dll file and use the function in it. I don't know if I can called the inputs related function in Supermodel.
If so, I can write the codes in AutoHotKey to achieve controller setup UI :)
segaduck
 
Posts: 52
Joined: Thu Oct 01, 2020 9:23 am


Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest