Skip to content
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

Simplify the preview of control mappings by removing the device path from controls #9700

Merged
merged 1 commit into from May 23, 2021

Conversation

Filoppi
Copy link
Contributor

@Filoppi Filoppi commented May 9, 2021

The picture should explain everything. Simply, if the mapping did not use a default device when it was made, its preview was completely "useless".
Splitting by "`" is 100% safe as special characters have a distinct and unique meaning in controls expressions, so there couldn't be any false positives from this code.
The only downside is not seeing what device a control corresponds to, but you can finally see the control at least, which is still better than only seeing (part of) the device name. We now add the prefix ":" if a control has got a device specifier in front of them.
We also remove white spaces and \n \t \r from the mapping preview.

image

Extras:
bugfix: fix EmulatedController::GetStateLock() not being acquired when reading the expression reference
bugfix: MappingButton::UpdateIndicator() calling State(0) on outputs, breaking ongoing rumbles if a game was running.
Improvement: make expressions previews appear in Italic if they failed to parse correctly (highlighted in yellow in the screenshot) (expressions are still evaluated and become bold if their state is "true")

@MayImilae
Copy link
Contributor

I honestly disagree with this PR. Knowing that it is not the default device is very important to the point that I'm ok with it being clunky. Plus if you are overriding the default device anyway you already have been in the advanced menu and know to look there. It's a feature for advanced users, so, it's ok.

The original idea is hella clunky, oh yea, but I think we need to find a decent alternative rather than strip it out entirely.

@Filoppi
Copy link
Contributor Author

Filoppi commented May 9, 2021

I honestly disagree with this PR. Knowing that it is not the default device is very important to the point that I'm ok with it being clunky. Plus if you are overriding the default device anyway you already have been in the advanced menu and know to look there. It's a feature for advanced users, so, it's ok.

The original idea is hella clunky, oh yea, but I think we need to find a decent alternative rather than strip it out entirely.

Unfortunately your argument is invalid, as whether the device path is in front of the control or not does not mean the device isn't the default one now, it just means that it wasn't the default one when you mapped it.

Also, even if the above was true, what's the value in knowing to what device the first control of the expression belongs to?
All you want to do from the mapping window is hack a quick overview of everything.
Plus you might have two controls mapped into one expression/mapping, like DInput/0/KeyboardMouse:A|DSU/0/DualShock4:X, so from the preview you'd only see the first control anyway.

A few people complained about this on IRC and it's something I had also thought about in the past, so I decided to do it. This isn't perfect, and yeah it would be nice to also both the control and the device linked to a mapping, but I'd say this design overall outweighs the downsides of the current one.

@jordan-woyak
Copy link
Member

I agree that trying to display the full "path" in the little button is silly but it should be made clear that it has an explicit device specification.
Maybe you should keep a leading backtick or something?

@Filoppi
Copy link
Contributor Author

Filoppi commented May 9, 2021

I agree that trying to display the full "path" in the little button is silly but it should be made clear that it has an explicit device specification.
Maybe you should keep a leading backtick or something?

That does sound like a good compromise. Will do.
I'm just thinking of leaving : in front, so instead than seeing A, you'd see :A if the control was bound to a specific device.

@MayImilae
Copy link
Contributor

Works for me 👍

@Filoppi
Copy link
Contributor Author

Filoppi commented May 9, 2021

@MayImilae @jordan-woyak Actually the best design would be to add a prefix number to the list of device [0], [1], ... and add that number to the preview of the mapping if that control has got a device path in front of it. Not sure I will do that, as the :A is already a decent solution.

@jordan-woyak
Copy link
Member

:A Sounds good to me too.

@MayImilae
Copy link
Contributor

I'm kind of more in favor of the :A option. Having the inputs numbered means it would be odd to not have the selected input numbered while having unselected numbered. Going with : as a simple notification of a device override is better, imo.

@iwubcode
Copy link
Contributor

Just personally, the ":" seems like it's really hard to see.

I was thinking what if we had some logic to ensure that the key was shown but then showed up to some maximum number of symbols. We could "..." the rest. Ex:

DInput/0/.../B

This could be used in other places in our GUI as well to denote longer strings than we have space for.

@MayImilae
Copy link
Contributor

MayImilae commented May 10, 2021

Just personally, the ":" seems like it's really hard to see.

I was thinking what if we had some logic to ensure that the key was shown but then showed up to some maximum number of symbols. We could "..." the rest. Ex:

DInput/0/.../B

This could be used in other places in our GUI as well to denote longer strings than we have space for.

Unfortunately I don't think that is any better than the current situation. So you can just enter anything into a controller slot and it'll just appear. It won't work, but you can see it. And when I put Quartz/0/.../Up I get this.

Screen Shot 2021-05-09 at 18 26 30

It's the same for Dinput.

Screen Shot 2021-05-09 at 18 26 57

It would be exactly the same as configuring an alternate device in current master. It's just a very small space. This wouldn't achieve the desired goal of showing the input and not just the device.

It may vary depending on the device and the text size, but fortunately we can all just try it. Just type in Xinput/.../A or whatever and ignore the errors, and it will appear in the slot. It's good enough to see how it fits!

@iwubcode
Copy link
Contributor

iwubcode commented May 10, 2021

Unfortunately I don't think that is any better than the current situation. So you can just enter anything into a controller slot and it'll just appear. It won't work, but you can see it. And when I put Quartz/0/.../Up I get this.

Hmm. Just to clarify my point. I was thinking we would dynamically determine how much text was viewable (or hardcode it) and then based on that remove from the device name as much as necessary. We'd always fit the key in.

So if we had Gamepad B as the key and had 15 total characters available, we'd only have 6 characters left. Subtract the 3 for "..." and that means the device name would show 3 characters:

XIn...Gamepad B

(you could tweak the algorithm if you always wanted a slash at the end)

But this would at least show that we're not binding a simple key to the current device. It would also be more obvious than ":".

@MayImilae
Copy link
Contributor

Unfortunately the length isn't character based. Filling with a allows 10 characters, the 11th causes truncating. Using A allows 8 characters and the 9th triggers truncation. It's not a lot of characters to work with. :/

@iwubcode
Copy link
Contributor

Well, outside of a design overhaul, the only other thought would be some custom icon. But eh, I guess a ":" is fine. Certainly less work!

@Filoppi Filoppi force-pushed the simplify_mappings_preview branch from 4c8c4d4 to f2d7ef9 Compare May 10, 2021 14:35
@Filoppi
Copy link
Contributor Author

Filoppi commented May 10, 2021

@MayImilae done

…their device path

and replacing it with a ":" prefix. Also remove white spaces and \n \t \r.

bugfix: fix EmulatedController::GetStateLock() not being aquired when reading the
expression reference
bugfix: MappingButton::UpdateIndicator() calling State(0) on outputs, breaking ongoing
rumbles if a game was running
Improvement: make expressions previews appear in Italic if they failed to parse correctly
@Filoppi Filoppi force-pushed the simplify_mappings_preview branch from f2d7ef9 to 0d23acc Compare May 11, 2021 09:21
@JMC47
Copy link
Contributor

JMC47 commented May 17, 2021

Will this affect currently made controller profiles or configs? If it makes people have to reconfigure things it'd be annoying to them.

Edit: I tested my profiles and they all seem to work so I guess not?

@Filoppi
Copy link
Contributor Author

Filoppi commented May 17, 2021

Will this affect currently made controller profiles or configs? If it makes people have to reconfigure things it'd be annoying to them.

No, this just affects the way Qt prints some text on screen, serialization isn't affected.

Copy link
Contributor

@JMC47 JMC47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JMC47
Copy link
Contributor

JMC47 commented May 23, 2021

I've asked a couple of times in IRC if anyone else has any qualms with this and haven't gotten any responses. This is an incredibly small change where I can mostly understand what the code is doing at a glance.

@JMC47 JMC47 merged commit 975f8e2 into dolphin-emu:master May 23, 2021
10 checks passed
Filoppi added a commit to Filoppi/dolphin that referenced this pull request Aug 2, 2021
PR dolphin-emu#9700 removed spaces from within control names, which some user complained about, and their point of view is kind of understandable:
https://bugs.dolphin-emu.org/issues/12605
with this change, only spaces outside (between) control names are trimmed, which are the ones we wanted to trim in the first place.
This will still retain the major advantages from 9700.

Basically, "`Button 1`   +  `Button 2`" was showing as "`Button1`+`Button2`", while it will now show as "`Button 1`+`Button 2`".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants