Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b57f635f
Commit
b57f635f
authored
Nov 22, 2022
by
Evan Tang
Committed by
Alexandre Julliard
Nov 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Report unique serial numbers for SDL devices.
parent
90149034
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+16
-5
No files found.
dlls/winebus.sys/bus_sdl.c
View file @
b57f635f
...
@@ -120,6 +120,7 @@ static Uint16 (*pSDL_JoystickGetProduct)(SDL_Joystick * joystick);
...
@@ -120,6 +120,7 @@ static Uint16 (*pSDL_JoystickGetProduct)(SDL_Joystick * joystick);
static
Uint16
(
*
pSDL_JoystickGetProductVersion
)(
SDL_Joystick
*
joystick
);
static
Uint16
(
*
pSDL_JoystickGetProductVersion
)(
SDL_Joystick
*
joystick
);
static
Uint16
(
*
pSDL_JoystickGetVendor
)(
SDL_Joystick
*
joystick
);
static
Uint16
(
*
pSDL_JoystickGetVendor
)(
SDL_Joystick
*
joystick
);
static
SDL_JoystickType
(
*
pSDL_JoystickGetType
)(
SDL_Joystick
*
joystick
);
static
SDL_JoystickType
(
*
pSDL_JoystickGetType
)(
SDL_Joystick
*
joystick
);
static
const
char
*
(
*
pSDL_JoystickGetSerial
)(
SDL_Joystick
*
joystick
);
/* internal bits for extended rumble support, SDL_Haptic types are 16-bits */
/* internal bits for extended rumble support, SDL_Haptic types are 16-bits */
#define WINE_SDL_JOYSTICK_RUMBLE 0x40000000
/* using SDL_JoystickRumble API */
#define WINE_SDL_JOYSTICK_RUMBLE 0x40000000
/* using SDL_JoystickRumble API */
...
@@ -936,9 +937,8 @@ static void sdl_add_device(unsigned int index)
...
@@ -936,9 +937,8 @@ static void sdl_add_device(unsigned int index)
SDL_Joystick
*
joystick
;
SDL_Joystick
*
joystick
;
SDL_JoystickID
id
;
SDL_JoystickID
id
;
SDL_JoystickGUID
guid
;
SDL_GameController
*
controller
=
NULL
;
SDL_GameController
*
controller
=
NULL
;
const
char
*
product
;
const
char
*
product
,
*
sdl_serial
;
char
guid_str
[
33
],
buffer
[
ARRAY_SIZE
(
desc
.
product
)];
char
guid_str
[
33
],
buffer
[
ARRAY_SIZE
(
desc
.
product
)];
int
axis_count
,
axis_offset
;
int
axis_count
,
axis_offset
;
...
@@ -969,9 +969,19 @@ static void sdl_add_device(unsigned int index)
...
@@ -969,9 +969,19 @@ static void sdl_add_device(unsigned int index)
desc
.
version
=
0
;
desc
.
version
=
0
;
}
}
guid
=
pSDL_JoystickGetGUID
(
joystick
);
if
(
pSDL_JoystickGetSerial
&&
(
sdl_serial
=
pSDL_JoystickGetSerial
(
joystick
)))
pSDL_JoystickGetGUIDString
(
guid
,
guid_str
,
sizeof
(
guid_str
));
{
ntdll_umbstowcs
(
guid_str
,
strlen
(
guid_str
)
+
1
,
desc
.
serialnumber
,
ARRAY_SIZE
(
desc
.
serialnumber
));
ntdll_umbstowcs
(
sdl_serial
,
strlen
(
sdl_serial
)
+
1
,
desc
.
serialnumber
,
ARRAY_SIZE
(
desc
.
serialnumber
));
}
else
{
/* Overcooked! All You Can Eat only adds controllers with unique serial numbers
* Prefer keeping serial numbers unique over keeping them consistent across runs */
pSDL_JoystickGetGUIDString
(
pSDL_JoystickGetGUID
(
joystick
),
guid_str
,
sizeof
(
guid_str
));
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s.%d"
,
guid_str
,
index
);
TRACE
(
"Making up serial number for %s: %s
\n
"
,
product
,
buffer
);
ntdll_umbstowcs
(
buffer
,
strlen
(
buffer
)
+
1
,
desc
.
serialnumber
,
ARRAY_SIZE
(
desc
.
serialnumber
));
}
if
(
controller
)
if
(
controller
)
{
{
...
@@ -1126,6 +1136,7 @@ NTSTATUS sdl_bus_init(void *args)
...
@@ -1126,6 +1136,7 @@ NTSTATUS sdl_bus_init(void *args)
pSDL_JoystickGetProductVersion
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetProductVersion"
);
pSDL_JoystickGetProductVersion
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetProductVersion"
);
pSDL_JoystickGetVendor
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetVendor"
);
pSDL_JoystickGetVendor
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetVendor"
);
pSDL_JoystickGetType
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetType"
);
pSDL_JoystickGetType
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetType"
);
pSDL_JoystickGetSerial
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetSerial"
);
if
(
pSDL_Init
(
SDL_INIT_GAMECONTROLLER
|
SDL_INIT_HAPTIC
)
<
0
)
if
(
pSDL_Init
(
SDL_INIT_GAMECONTROLLER
|
SDL_INIT_HAPTIC
)
<
0
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment