mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-19 16:59:50 +00:00
Bliss-Box: Work around Windows sharing violation bug by trying to open device as read/write if read-only fails. Show OSD message if it still fails.
This commit is contained in:
parent
55b738a07a
commit
b0445e1e21
@ -60,6 +60,7 @@ const GUID GUID_NULL = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
#include "../file_path_special.h"
|
||||
#include "../list_special.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
#include "tasks_internal.h"
|
||||
|
||||
@ -591,8 +592,27 @@ found:
|
||||
|
||||
if (hDeviceHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
RARCH_ERR("[Autoconf]: Can't open device: %d.", GetLastError());
|
||||
goto done;
|
||||
/* Windows sometimes erroneously fails to open with a sharing violation:
|
||||
* https://github.com/signal11/hidapi/issues/231
|
||||
* If this happens, trying again with read + write usually works for some reason.
|
||||
*/
|
||||
|
||||
/* Open the device */
|
||||
hDeviceHandle = CreateFileA(
|
||||
devicePath,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0, /*FILE_FLAG_OVERLAPPED,*/
|
||||
NULL);
|
||||
|
||||
if (hDeviceHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
RARCH_ERR("[Autoconf]: Can't open device for reading and writing: %d.", GetLastError());
|
||||
runloop_msg_queue_push("Bliss-Box already in use. Please make sure other programs are not using it.", 2, 300, false);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
Loading…
Reference in New Issue
Block a user