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

WiimoteReal/IOWin: Don't try to print error message for non-errors. #11978

Merged
merged 1 commit into from Jun 30, 2023

Conversation

AdmiralCurtiss
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss commented Jun 19, 2023

I'm getting an S_FALSE here every couple seconds on Windows, which is not an error and thus triggers an assert in winrt::hresult_error. I have no idea what this means -- I can't find any documentation on what S_FALSE from WriteFile() means -- but it seems to not actually cause problems...?

e: Further debugging this, this is actually caused by my keyboard of all things. I guess it tries to figure out if my keyboard is a bluetooth device...? I'm surprised there isn't a better way for that.

@AdmiralCurtiss AdmiralCurtiss merged commit 82c9868 into dolphin-emu:master Jun 30, 2023
14 checks passed
@AdmiralCurtiss AdmiralCurtiss deleted the wiimote-S_FALSE branch June 30, 2023 22:58
@mzji
Copy link

mzji commented Jul 4, 2023

GetLastError() always returns Win32 error codes, so that 0x00000001 actually is an ERROR_INVALID_FUNCTION but not a S_FALSE. Then google will tell us that when using ReadFile/WriteFile functions to access devices sometime we could get an ERROR_INVALID_FUNCTION because of the OS (compatibility?) or the device driver (not implement the read function on the device object).

@AdmiralCurtiss
Copy link
Contributor Author

AdmiralCurtiss commented Jul 4, 2023

Hm, does that mean the Common::HRWrap() is wrong in general here, did we mix up enums here?

e: Should this use https://learn.microsoft.com/en-us/windows/win32/api/winerror/nf-winerror-hresult_from_win32 ?

@mzji
Copy link

mzji commented Jul 5, 2023

Don't use FAILED() and Common::HRWrap here - in this case the value GetLastError() returns is a Win32 error, not an HResult. If the explanation text is needed, you could use FormatMessageA/W() to convert the error code to the human-readable localized text.
P.S. HRESULT_FROM_WIN32() is for converting/wrapping a Win32 error to/in an HResult value, not suitable to use in this case.

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