-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Mapping #4
Comments
Thanks for bringing this up. I've had this feature in mind for a while - leaving this issue open to track it. |
For developers, there actually is a way of creating a custom mapping already. However, it is not particularly well-documented and is likely more cumbersome than it needs to be. I will try to address this in a future version. |
can you describe how to do custom mapping in current version? |
Right now it is necessary to create a subclass of Mapper::Base. |
This is addressed in v2.0.0. Have a look at the file |
Well, by custom mapping we all mean mapping that does not require source code editing and compilation, please add same mapping structure support into INI file or separate CustomMapping.cfg so we can just remap whatever we want and however we want. This compicated code: [Mapper] [Mapper:CustomTypeName]
... ALsdo i suggest to add half of axes remapping (could be usefull for some rare games) for axes, to allow, for example map each of stick direction to any pov direction or even button, to let, for example, any stick to act ad dpad in game, or even as face buttons LU = A:Y+ these should override LX, LY and RX and RY, in case if just one half of axis remaped , rest of axis should be defined by LX, LY, RX, RY. Another thing which i strongly suggest to add, is multi mapping per single button or axis or dpad. For example LT and RT could be mapped like this:
which means that LT and RT reports to game that both Z+- axis and B11 and B12 pressed. Why we may need it? Also to override this behavior we can add extra parameter into formula which will define delay, because some games are smart enought to prioritzed axis over buttons in case both are pressed at same time. for example it could be done line this:
which means both has no delay but default should be equal to
This technique could be expanded even further, to make a different types of button presses as different binds. For example you can bind one X button to a several dinput buttons like this:
this will bind very quick tap of 100ms to 1, average tap of 250ms on B2, and hold of 500+ to B3 and release (no matter how long you press it it will always trigger once you release, while first 3 cases will trigger only if time or release was equal or lesser than set delay, but higher than any delay smaller than this. So you hold button 0-100 ms and release it at any delay up to 100 you get B1 pressed, you hold it 101-250 ms and release it in set window - you press B2, you hold it 250-500 you press B3 ) to B4. its pretty much equal to things like onTAP onPRESS onHOLD onRELEASE in many game engines. There are also things like double and tripple taps and even shifts (when you press one button and it changes button of one or many other buttons). Double taps could be done by expanding previous format to this:
this means that if same button was released at 100 ms, and immediately pressed again and released at 100ms time frame, we consider it as double tapping. and this X(100,100,100) = B:1 //TAP would be a tripple tap! and we actually may have a 4 and 5 taps, as long as we dont limit array of delays between () separated by , As for shift, i suggest to do it like this, use same multibind as i suggested above with Sh:ShiftName as yet another bind to allow same button to work as usually while acting like shift: [Mapper:CustomTypeName:Shift1] In this case everything will act as in CustomTypeName, except RT, it will be remapped as B13 while LT is held, and once it released it will became Z- and B12 again. You can add any number of shifts wiht any name without space, for example you can add special shifts for menus, for onfoot invehicle controls. In addition to Shift we also need as Switch, it should use same subtype names as shift (actually it would be good if you can use one submapper from both switch and shift), like this: [Mapper:CustomTypeName] [Mapper:CustomTypeName:Shift1] Difference between Shift and Switch is that shift works while keep holding button, while Switch keeps same button rebind even after release on button. To get out of switch mode to default one you can bind Sw:Default (which will rebind everything according to CustomTypeName) or Sw:Previous (Which will return to previously used shift mode, which could be default or could be not) or any other custom name like Sw:Something. [Mapper:CustomTypeName:Shift1] This is similar to how button macroses worked in unreal 1 and 2 games, but more advaced and flexible. This could help with games that has some separate binds in menues that you cant rebind or have not enought free buttons for them and temporary need to unbind other buttons to avoid problems. You may ask why we would need all of those, and here is the reason: This happens even in games that has console versions with multi binds on same button. This is where all of this stuff would be useful. Some of games with such behavior like GTA3, Vice City and San Andreas fixed gamepad support with memory hacking, but other games are not so lucky to be fixed like this, which is why we need some universal solution for this problem. There is ofcource Xinput Plus which partially solves this problem and actually has shift secondary bindings, but its not enough, it lacks configurable delays, multibinds, and other things i suggested. Another thing which i suggest to add after you implement all of this is ability to bind keyboard and mouse buttons instead of gamepad buttons and axes. You may argue that many programs exist that does that, and yes they are, but they are all external and does not allow to fix gamepad controls in games natively in games that does not allow gamepad input in some cases, like menues, inventories, and few other places where you can only use keyboard and mouse. All of universal rules from above should apply as well. For example we have game that has full gamepad support in gameplay, but dont allow to bind menu or pause to gamepad and has hardcode ESC button for that, which is common mistake in many old games, but actually allows to bind "back" function to gamepad. And menu only allows to input with keyboard or mouse, so with all the stuff i suggested we can fix it like this: [Mapper:CustomTypeName] [Mapper:CustomTypeName:PCmenu] This could be done with Shift as well, more error free, but less comfortable because you have to hold some button to fix game in mouse input mode. Another case where it can be used is games like splinter cell 1 you can actually bind Weapon selection mode to gamepad, but once mode if on, it only accept keyboard and mouse inputs, so you have to bind shift mode to same button which is bind to weapon selection, and temporary rebind axis to mouse, and dpad to keyboard arrows, and triggers to mouse buttons to confirm selection. Main menu would need a switch to a same sub binds. One more game that could benefit from its Deus Ex, which is pretty much configurable to be controlled with gamepad natively, until any menu or inventory will popup, so such temporary switch to mouse emulation mode will allow game to have fully native gamepad support without need for external tools. One more game that could be solved with all of these features if classic Mafia 1. Some games also has bad aiming with gamepad axis and good with mouse, so emulation could be helpful to improve this. There is a game Omicron that actually has dinput remapper that does exactly this - allows to use mouse aim while keeping native gamepad controls, actually this tool is like missing part of Xidi (i asked for sources and was actually going to do something like xidi based on it, but author lost sources, yet compiled wrapper could be used as reference to see and mimic how it works). And to make mouse emulation better we need sensitivity, acceleration and deadzone settings with negative value support (to reduce existing acceleration and sensitivity just in case). Preferably added to axis bind like this: RY = MA:Y(0)[SEN:100, ACC:0,DZ:10] // i used [] to keep () for delays, but it can be reformed to more universal array like (DEL,SEN,ACC,DZ) which will differ depending on input type we dealing with, so if its not axis or analogue button - anything but delay should be ignored). I think this will allow to fully control most of games natively with gamepad, but there could be few cases i did not witness or forgot about which would need something more than this (probably old games with wheels and some extra controllers support). |
The original requestor linked to a project that appears to need source code editing to change the layout of the controller. That said, custom mappers in a configuration file is a very reasonable request and a natural extension of all the code changes in v2.0.0. I am reopening this issue with text file-based mapping as the deliverable. @v00d00m4n I appreciate all of the input in your previous comment, especially that you took the time to explain the "why" rather than just the "what" behind these requests. I will need to spend some more time thinking about which of these I can and want to do, along with how to do it, but if I understand correctly here is a summary of the suggestions:
To keep discussions organized, I want this issue to be confined just to the custom mapper via configuration file. Could you please create separate issues to track the discussions for each of these other suggestions? |
Hey, Sam. GitHub allows you to change the title of the issue if you'd like. You could add a checklist to the first post that would show in the Issues list. Example of a Checklist |
As of v3.0.0 custom mappers can be defined in the configuration file. |
@samuelgr finally got around to try this, wanted to say great job! |
Have you considered adding a custom mapping option? For example, this project fixes mapping in scarface game:
https://github.com/aap/XDinput/blob/master/dinput8/IDirectInputDevice8A.cpp#L115
I was thinking, maybe Xidi should offer additional functionality to achieve the same result?
The text was updated successfully, but these errors were encountered: