Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
90b8a972
Commit
90b8a972
authored
Aug 13, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Move SDL function loading to a separate helper.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5d6419a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
52 deletions
+64
-52
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+64
-52
No files found.
dlls/winebus.sys/bus_sdl.c
View file @
90b8a972
...
...
@@ -968,6 +968,69 @@ void sdl_driver_unload( void )
dlclose
(
sdl_handle
);
}
static
BOOL
sdl_initialize
(
void
)
{
if
(
!
(
sdl_handle
=
dlopen
(
SONAME_LIBSDL2
,
RTLD_NOW
)))
{
WARN
(
"could not load %s
\n
"
,
SONAME_LIBSDL2
);
return
FALSE
;
}
#define LOAD_FUNCPTR(f) \
if ((p##f = dlsym(sdl_handle, #f)) == NULL) \
{ \
WARN("could not find symbol %s\n", #f); \
goto failed; \
}
LOAD_FUNCPTR
(
SDL_GetError
);
LOAD_FUNCPTR
(
SDL_Init
);
LOAD_FUNCPTR
(
SDL_JoystickClose
);
LOAD_FUNCPTR
(
SDL_JoystickEventState
);
LOAD_FUNCPTR
(
SDL_JoystickGetGUID
);
LOAD_FUNCPTR
(
SDL_JoystickGetGUIDString
);
LOAD_FUNCPTR
(
SDL_JoystickInstanceID
);
LOAD_FUNCPTR
(
SDL_JoystickName
);
LOAD_FUNCPTR
(
SDL_JoystickNumAxes
);
LOAD_FUNCPTR
(
SDL_JoystickOpen
);
LOAD_FUNCPTR
(
SDL_WaitEvent
);
LOAD_FUNCPTR
(
SDL_JoystickNumButtons
);
LOAD_FUNCPTR
(
SDL_JoystickNumBalls
);
LOAD_FUNCPTR
(
SDL_JoystickNumHats
);
LOAD_FUNCPTR
(
SDL_JoystickGetAxis
);
LOAD_FUNCPTR
(
SDL_JoystickGetHat
);
LOAD_FUNCPTR
(
SDL_IsGameController
);
LOAD_FUNCPTR
(
SDL_GameControllerClose
);
LOAD_FUNCPTR
(
SDL_GameControllerGetAxis
);
LOAD_FUNCPTR
(
SDL_GameControllerGetButton
);
LOAD_FUNCPTR
(
SDL_GameControllerName
);
LOAD_FUNCPTR
(
SDL_GameControllerOpen
);
LOAD_FUNCPTR
(
SDL_GameControllerEventState
);
LOAD_FUNCPTR
(
SDL_HapticClose
);
LOAD_FUNCPTR
(
SDL_HapticDestroyEffect
);
LOAD_FUNCPTR
(
SDL_HapticNewEffect
);
LOAD_FUNCPTR
(
SDL_HapticOpenFromJoystick
);
LOAD_FUNCPTR
(
SDL_HapticQuery
);
LOAD_FUNCPTR
(
SDL_HapticRumbleInit
);
LOAD_FUNCPTR
(
SDL_HapticRumblePlay
);
LOAD_FUNCPTR
(
SDL_HapticRumbleSupported
);
LOAD_FUNCPTR
(
SDL_HapticRunEffect
);
LOAD_FUNCPTR
(
SDL_HapticStopAll
);
LOAD_FUNCPTR
(
SDL_JoystickIsHaptic
);
LOAD_FUNCPTR
(
SDL_memset
);
LOAD_FUNCPTR
(
SDL_GameControllerAddMapping
);
LOAD_FUNCPTR
(
SDL_RegisterEvents
);
LOAD_FUNCPTR
(
SDL_PushEvent
);
#undef LOAD_FUNCPTR
pSDL_JoystickGetProduct
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetProduct"
);
pSDL_JoystickGetProductVersion
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetProductVersion"
);
pSDL_JoystickGetVendor
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetVendor"
);
return
TRUE
;
failed:
dlclose
(
sdl_handle
);
sdl_handle
=
NULL
;
return
FALSE
;
}
NTSTATUS
sdl_driver_init
(
void
)
{
static
const
WCHAR
controller_modeW
[]
=
{
'M'
,
'a'
,
'p'
,
' '
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'l'
,
'e'
,
'r'
,
's'
,
0
};
...
...
@@ -976,57 +1039,7 @@ NTSTATUS sdl_driver_init(void)
HANDLE
events
[
2
];
DWORD
result
;
if
(
sdl_handle
==
NULL
)
{
sdl_handle
=
dlopen
(
SONAME_LIBSDL2
,
RTLD_NOW
);
if
(
!
sdl_handle
)
{
WARN
(
"could not load %s
\n
"
,
SONAME_LIBSDL2
);
return
STATUS_UNSUCCESSFUL
;
}
#define LOAD_FUNCPTR(f) if((p##f = dlsym(sdl_handle, #f)) == NULL){WARN("Can't find symbol %s\n", #f); goto sym_not_found;}
LOAD_FUNCPTR
(
SDL_GetError
);
LOAD_FUNCPTR
(
SDL_Init
);
LOAD_FUNCPTR
(
SDL_JoystickClose
);
LOAD_FUNCPTR
(
SDL_JoystickEventState
);
LOAD_FUNCPTR
(
SDL_JoystickGetGUID
);
LOAD_FUNCPTR
(
SDL_JoystickGetGUIDString
);
LOAD_FUNCPTR
(
SDL_JoystickInstanceID
);
LOAD_FUNCPTR
(
SDL_JoystickName
);
LOAD_FUNCPTR
(
SDL_JoystickNumAxes
);
LOAD_FUNCPTR
(
SDL_JoystickOpen
);
LOAD_FUNCPTR
(
SDL_WaitEvent
);
LOAD_FUNCPTR
(
SDL_JoystickNumButtons
);
LOAD_FUNCPTR
(
SDL_JoystickNumBalls
);
LOAD_FUNCPTR
(
SDL_JoystickNumHats
);
LOAD_FUNCPTR
(
SDL_JoystickGetAxis
);
LOAD_FUNCPTR
(
SDL_JoystickGetHat
);
LOAD_FUNCPTR
(
SDL_IsGameController
);
LOAD_FUNCPTR
(
SDL_GameControllerClose
);
LOAD_FUNCPTR
(
SDL_GameControllerGetAxis
);
LOAD_FUNCPTR
(
SDL_GameControllerGetButton
);
LOAD_FUNCPTR
(
SDL_GameControllerName
);
LOAD_FUNCPTR
(
SDL_GameControllerOpen
);
LOAD_FUNCPTR
(
SDL_GameControllerEventState
);
LOAD_FUNCPTR
(
SDL_HapticClose
);
LOAD_FUNCPTR
(
SDL_HapticDestroyEffect
);
LOAD_FUNCPTR
(
SDL_HapticNewEffect
);
LOAD_FUNCPTR
(
SDL_HapticOpenFromJoystick
);
LOAD_FUNCPTR
(
SDL_HapticQuery
);
LOAD_FUNCPTR
(
SDL_HapticRumbleInit
);
LOAD_FUNCPTR
(
SDL_HapticRumblePlay
);
LOAD_FUNCPTR
(
SDL_HapticRumbleSupported
);
LOAD_FUNCPTR
(
SDL_HapticRunEffect
);
LOAD_FUNCPTR
(
SDL_HapticStopAll
);
LOAD_FUNCPTR
(
SDL_JoystickIsHaptic
);
LOAD_FUNCPTR
(
SDL_memset
);
LOAD_FUNCPTR
(
SDL_GameControllerAddMapping
);
LOAD_FUNCPTR
(
SDL_RegisterEvents
);
LOAD_FUNCPTR
(
SDL_PushEvent
);
#undef LOAD_FUNCPTR
pSDL_JoystickGetProduct
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetProduct"
);
pSDL_JoystickGetProductVersion
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetProductVersion"
);
pSDL_JoystickGetVendor
=
dlsym
(
sdl_handle
,
"SDL_JoystickGetVendor"
);
}
if
(
!
sdl_handle
&&
!
sdl_initialize
())
return
STATUS_UNSUCCESSFUL
;
map_controllers
=
check_bus_option
(
&
controller_mode
,
1
);
...
...
@@ -1052,7 +1065,6 @@ NTSTATUS sdl_driver_init(void)
}
CloseHandle
(
events
[
1
]);
sym_not_found:
dlclose
(
sdl_handle
);
sdl_handle
=
NULL
;
return
STATUS_UNSUCCESSFUL
;
...
...
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