mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-22 23:15:31 +00:00
Fixed bug 3478 - Patch Haiku to use dlopen instead of load_add_on
Kai Sterker SDL2 on Haiku so far uses Haiku-specific APIs for loading dynamic objects as add-ons, instead of using dlopen to load them as libraries. This, for example, leads to SDL_mixer not being able to load its audio backends, when compiled with standard settings. As discussed at https://www.freelists.org/post/haikuports/SDL2-mixer-ogg-music-not-playing-and-other-stuff,2 , the best way to deal with this would be using dlopen instead of load_add_on. The following patch implements this change by dropping the Haiku-specific bits and using dlopen instead.
This commit is contained in:
parent
98d188f5de
commit
9a8642bd6a
9
configure
vendored
9
configure
vendored
|
@ -23490,6 +23490,7 @@ fi
|
||||||
CheckDummyVideo
|
CheckDummyVideo
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
|
CheckDLOPEN
|
||||||
CheckHaikuVideo
|
CheckHaikuVideo
|
||||||
CheckHaikuGL
|
CheckHaikuGL
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
@ -23518,14 +23519,6 @@ $as_echo "#define SDL_TIMER_HAIKU 1" >>confdefs.h
|
||||||
SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
|
SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
|
||||||
have_timers=yes
|
have_timers=yes
|
||||||
fi
|
fi
|
||||||
# Set up files for the shared object loading library
|
|
||||||
if test x$enable_loadso = xyes; then
|
|
||||||
|
|
||||||
$as_echo "#define SDL_LOADSO_HAIKU 1" >>confdefs.h
|
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c"
|
|
||||||
have_loadso=yes
|
|
||||||
fi
|
|
||||||
# Set up files for the system power library
|
# Set up files for the system power library
|
||||||
if test x$enable_power = xyes; then
|
if test x$enable_power = xyes; then
|
||||||
|
|
||||||
|
|
|
@ -3229,6 +3229,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
CheckDummyVideo
|
CheckDummyVideo
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
|
CheckDLOPEN
|
||||||
CheckHaikuVideo
|
CheckHaikuVideo
|
||||||
CheckHaikuGL
|
CheckHaikuGL
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
@ -3251,12 +3252,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
|
SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
|
||||||
have_timers=yes
|
have_timers=yes
|
||||||
fi
|
fi
|
||||||
# Set up files for the shared object loading library
|
|
||||||
if test x$enable_loadso = xyes; then
|
|
||||||
AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ])
|
|
||||||
SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c"
|
|
||||||
have_loadso=yes
|
|
||||||
fi
|
|
||||||
# Set up files for the system power library
|
# Set up files for the system power library
|
||||||
if test x$enable_power = xyes; then
|
if test x$enable_power = xyes; then
|
||||||
AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
|
AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
|
||||||
|
|
|
@ -252,7 +252,6 @@
|
||||||
#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
|
#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@
|
|
||||||
#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
|
#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
|
||||||
#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
|
#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
|
||||||
#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@
|
#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@
|
||||||
|
|
|
@ -253,7 +253,6 @@
|
||||||
#undef SDL_HAPTIC_XINPUT
|
#undef SDL_HAPTIC_XINPUT
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#undef SDL_LOADSO_HAIKU
|
|
||||||
#undef SDL_LOADSO_DLOPEN
|
#undef SDL_LOADSO_DLOPEN
|
||||||
#undef SDL_LOADSO_DUMMY
|
#undef SDL_LOADSO_DUMMY
|
||||||
#undef SDL_LOADSO_LDG
|
#undef SDL_LOADSO_LDG
|
||||||
|
|
|
@ -216,21 +216,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__HAIKU__)
|
#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
|
||||||
#include <os/kernel/image.h>
|
|
||||||
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
|
|
||||||
{
|
|
||||||
image_id lib = load_add_on(fname);
|
|
||||||
void *retval = NULL;
|
|
||||||
if (lib >= 0) {
|
|
||||||
if (get_image_symbol(lib, sym, B_SYMBOL_TYPE_TEXT, &retval) != B_NO_ERROR) {
|
|
||||||
unload_add_on(lib);
|
|
||||||
retval = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
#elif defined(unix) || defined(__unix__) || defined(__APPLE__)
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
|
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
#include "../../SDL_internal.h"
|
|
||||||
|
|
||||||
#ifdef SDL_LOADSO_HAIKU
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* System dependent library loading routines */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <os/kernel/image.h>
|
|
||||||
|
|
||||||
#include "SDL_loadso.h"
|
|
||||||
|
|
||||||
void *
|
|
||||||
SDL_LoadObject(const char *sofile)
|
|
||||||
{
|
|
||||||
void *handle = NULL;
|
|
||||||
image_id library_id = load_add_on(sofile);
|
|
||||||
if (library_id < 0) {
|
|
||||||
SDL_SetError(strerror((int) library_id));
|
|
||||||
} else {
|
|
||||||
handle = (void *) (library_id);
|
|
||||||
}
|
|
||||||
return (handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
|
||||||
SDL_LoadFunction(void *handle, const char *name)
|
|
||||||
{
|
|
||||||
void *sym = NULL;
|
|
||||||
image_id library_id = (image_id) handle;
|
|
||||||
status_t rc =
|
|
||||||
get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
|
|
||||||
if (rc != B_NO_ERROR) {
|
|
||||||
SDL_SetError(strerror(rc));
|
|
||||||
}
|
|
||||||
return (sym);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SDL_UnloadObject(void *handle)
|
|
||||||
{
|
|
||||||
image_id library_id;
|
|
||||||
if (handle != NULL) {
|
|
||||||
library_id = (image_id) handle;
|
|
||||||
unload_add_on(library_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SDL_LOADSO_HAIKU */
|
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
Loading…
Reference in a new issue