engine: platform: sdl: read gamecontrollerdb.txt from extras.pk3
This commit is contained in:
parent
578a77518f
commit
feb80e5997
2 changed files with 20 additions and 2 deletions
2
3rdparty/extras/xash-extras
vendored
2
3rdparty/extras/xash-extras
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 1bdeab2d8f25a920cef68860e709f3ad6805e3c3
|
||||
Subproject commit 4982e5edb0a50ca99b2927b12b91c54968733b55
|
|
@ -224,6 +224,23 @@ static int SDLash_JoyInit_Old( int numjoy )
|
|||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
static void SDLash_GameControllerAddMappings( const char *name )
|
||||
{
|
||||
fs_offset_t len = 0;
|
||||
byte *p = FS_LoadFile( name, &len, false );
|
||||
|
||||
if( !p )
|
||||
return;
|
||||
|
||||
if( len > 0 && len < INT32_MAX ) // function accepts int, SDL3 fixes this
|
||||
{
|
||||
SDL_RWops *rwops = SDL_RWFromConstMem( p, len );
|
||||
SDL_GameControllerAddMappingsFromRW( rwops, true );
|
||||
}
|
||||
|
||||
Mem_Free( p );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SDLash_JoyInit_New
|
||||
|
@ -242,7 +259,8 @@ static int SDLash_JoyInit_New( int numjoy )
|
|||
return 0;
|
||||
}
|
||||
|
||||
SDL_GameControllerAddMappingsFromFile( "controllermappings.txt" );
|
||||
SDLash_GameControllerAddMappings( "gamecontrollerdb.txt" ); // shipped in extras.pk3
|
||||
SDLash_GameControllerAddMappings( "controllermappings.txt" );
|
||||
|
||||
count = 0;
|
||||
numJoysticks = SDL_NumJoysticks();
|
||||
|
|
Loading…
Add table
Reference in a new issue