diff --git a/mkcontrollermappings.sh b/mkcontrollermappings.sh index a52f39e..9325e53 100755 --- a/mkcontrollermappings.sh +++ b/mkcontrollermappings.sh @@ -1,10 +1,12 @@ #!/bin/bash +rootdir=$1 + curl https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt | grep -v '^#' | grep -v '^$' | sed s/',$'//g > mappings.txt filelen=$(wc -l mappings.txt | cut -d ' ' -f 1) -cat > ../include/akgl/SDL_GameControllerDB.h < ${rootdir}/include/akgl/SDL_GameControllerDB.h <> ../include/akgl/SDL_GameControllerDB.h; + printf ",\n" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h; fi - printf " \"${LINE}\"" >> ../include/akgl/SDL_GameControllerDB.h; + printf " \"${LINE}\"" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h; counter=$((counter + 1)) done -printf "\n};\n" >> ../include/akgl/SDL_GameControllerDB.h -printf "#endif // _SDL_GAMECONTROLLERDB_H_\n" >> ../include/akgl/SDL_GameControllerDB.h +printf "\n};\n" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h +printf "#endif // _SDL_GAMECONTROLLERDB_H_\n" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h