mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 20:30:36 +08:00
engine: platform: sdl: read gamecontrollerdb.txt from extras.pk3
This commit is contained in:
2
3rdparty/extras/xash-extras
vendored
2
3rdparty/extras/xash-extras
vendored
Submodule 3rdparty/extras/xash-extras updated: 1bdeab2d8f...4982e5edb0
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user