Add downloading and sourcing game controller db

This commit is contained in:
dcvz 2024-06-15 19:35:28 +02:00
parent 5e046b1775
commit 590a9e7106
5 changed files with 24 additions and 3 deletions

View file

@ -20,6 +20,7 @@ chmod a+x linuxdeploy*
mkdir -p AppDir/usr/bin
cp Zelda64Recompiled AppDir/usr/bin/
cp -r assets/ AppDir/usr/bin/
cp gamecontrollerdb.txt AppDir/usr/bin/
cp icons/512.png AppDir/Zelda64Recompiled.png
cp .github/linux/Zelda64Recompiled.desktop AppDir/

View file

@ -85,7 +85,7 @@ jobs:
run: |
mv cmake-build/Zelda64Recompiled Zelda64Recompiled
rm -rf assets/scss
tar -czf Zelda64Recompiled.tar.gz Zelda64Recompiled assets/
tar -czf Zelda64Recompiled.tar.gz Zelda64Recompiled assets/ gamecontrollerdb.txt
- name: Archive Zelda64Recomp
uses: actions/upload-artifact@v3
with:
@ -174,7 +174,7 @@ jobs:
run: |
mv cmake-build/Zelda64Recompiled Zelda64Recompiled
rm -rf assets/scss
tar -czf Zelda64Recompiled.tar.gz Zelda64Recompiled assets/
tar -czf Zelda64Recompiled.tar.gz Zelda64Recompiled assets/ gamecontrollerdb.txt
- name: Archive Zelda64Recomp
uses: actions/upload-artifact@v4
with:
@ -267,3 +267,4 @@ jobs:
dxil.dll
SDL2.dll
assets/
gamecontrollerdb.txt

3
.gitignore vendored
View file

@ -58,3 +58,6 @@ node_modules/
# Recompiler Linux binary
N64Recomp
.DS_Store
# Controller mappings file
gamecontrollerdb.txt

View file

@ -115,8 +115,19 @@ add_custom_command(OUTPUT
DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.bin
)
# Download controller db file for controller support via SDL2
set(GAMECONTROLLERDB_COMMIT "b1e4090b3d4266e55feb0793efa35792e05faf66")
set(GAMECONTROLLERDB_URL "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/${GAMECONTROLLERDB_COMMIT}/gamecontrollerdb.txt")
file(DOWNLOAD ${GAMECONTROLLERDB_URL} ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt
TLS_VERIFY ON)
add_custom_target(DownloadGameControllerDB
DEPENDS ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt)
# Main executable
add_executable(Zelda64Recompiled)
add_dependencies(Zelda64Recompiled DownloadGameControllerDB)
# Generate mm_shader_cache.c from the MM shader cache if it exists
if (EXISTS ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin)
@ -312,7 +323,7 @@ else()
endif()
build_vertex_shader(Zelda64Recompiled "shaders/InterfaceVS.hlsl" "shaders/InterfaceVS.hlsl")
build_pixel_shader (Zelda64Recompiled "shaders/InterfacePS.hlsl" "shaders/InterfacePS.hlsl")
build_pixel_shader(Zelda64Recompiled "shaders/InterfacePS.hlsl" "shaders/InterfacePS.hlsl")
target_sources(Zelda64Recompiled PRIVATE ${SOURCES})

View file

@ -375,6 +375,11 @@ int main(int argc, char** argv) {
SDL_InitSubSystem(SDL_INIT_AUDIO);
reset_audio(48000);
// Source controller mappings file
if (SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt") < 0) {
fprintf(stderr, "Failed to load controller mappings: %s\n", SDL_GetError());
}
// Register supported games and patches
for (const auto& game : supported_games) {
recomp::register_game(game);