#!/bin/sh

# This test actually tests that yuzu is able to launch homebrew games
# using the GPU. It uses the "null" renderer, and should hence pass even
# on testbeds without GPUs.
#
# The tested homebrew game, "gpu_console.nro", has been built on
# 2025-04-26 using the devkitpro/devkita64 Docker container from the
# public-domain source code located in the
# /opt/devkitpro/examples/switch/graphics/opengl/gpu_console directory,
# which is also stored in the
# https://github.com/switchbrew/switch-examples Git repository.

set -eu

cd "$AUTOPKGTEST_TMP"

xz --decompress --stdout "$OLDPWD/debian/tests/gpu_console.nro.xz" > gpu_console.nro

# Enable the "null" renderer
printf '[Renderer]\nbackend\\default=false\nbackend=2\n' > config.ini

mkdir "$AUTOPKGTEST_TMP/run"
XDG_RUNTIME_DIR="$AUTOPKGTEST_TMP/run" yuzu-cmd --config config.ini gpu_console.nro
