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

Fixed the way devices were previously indexed #14533

Merged
merged 4 commits into from
Oct 19, 2022
Merged

Fixed the way devices were previously indexed #14533

merged 4 commits into from
Oct 19, 2022

Conversation

dyllan500
Copy link

Description

Input devices were only being index in order and will stop at the first time an input has no device connected to it. The problem is when a device gets disconnected that input will have no devices connected to it, but the next input may still have a device connected. So, that makes changing the port of the currently connected devices impossible.

Related Issues

#14524

@GABO1423
Copy link
Contributor

This PR causes some build errors for UWP:
image

@dyllan500
Copy link
Author

Okay, I was able to build on Linux. I will try UWP tomorrow.

@dyllan500
Copy link
Author

My latest commit should fix the error. I realized I forgot to initialize the variable wish the Linux compiler would've reminded me of that.

@hizzlekizzle
Copy link
Contributor

As a general note, thanks for the contribution! It's always appreciated when someone recognizes a problem, reports it and then submits a fix for it. That's what keeps open source software alive.

@LibretroAdmin LibretroAdmin merged commit 6ade323 into libretro:master Oct 19, 2022
@LibretroAdmin
Copy link
Contributor

LibretroAdmin commented Oct 20, 2022

Make sure variables are always declared at the start of a code block or function right now. This PR broke C89 compliance which is an issue for older MSVC compilers. I will fix this manually but try to keep this in mind next time. There is also a file called CODING-GUIDELINES which goes over most of our coding rules/preferences.

@dyllan500
Copy link
Author

Sorry small mistake, I will be sure to be more careful next time. I never compiled a program for C89 before, forgot how strict older compilers can be.

@sonninnos
Copy link
Collaborator

I'm getting new harmless warnings after this PR:

menu/menu_displaylist.c: In function 'menu_displaylist_parse_input_device_index_list':
menu/menu_displaylist.c:5176:16: warning: variable 'val_na' set but not used [-Wunused-but-set-variable]
 5176 |    const char *val_na           = NULL;
      |                ^~~~~~
menu/menu_displaylist.c:5175:16: warning: variable 'val_port' set but not used [-Wunused-but-set-variable]
 5175 |    const char *val_port         = NULL;
      |                ^~~~~~~~

@LibretroAdmin
Copy link
Contributor

Fixed the unused variable warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants