distribution/packages/emulators/standalone/citrasa/scripts/start_citra.sh

113 lines
4.4 KiB
Bash
Raw Normal View History

2023-01-02 16:49:21 +00:00
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022-present BrooksyTech (https://github.com/brooksytech)
. /etc/profile
if [ ! -d "/storage/.config/citra-emu" ]; then
mkdir -p "/storage/.config/citra-emu"
cp -r "/usr/config/citra-emu" "/storage/.config/"
fi
2023-01-03 14:37:08 +00:00
#Move sdmc & nand to 3ds roms folder
if [ ! -d "/storage/roms/3ds/citrasa/sdmc" ]; then
mkdir -p "/storage/roms/3ds/citrasa/sdmc"
fi
rm -rf /storage/.config/citra-emu/sdmc
ln -sf /storage/roms/3ds/citrasa/sdmc /storage/.config/citra-emu/sdmc
if [ ! -d "/storage/roms/3ds/citrasa/nand" ]; then
mkdir -p "/storage/roms/3ds/citrasa/nand"
fi
rm -rf /storage/.config/citra-emu/nand
ln -sf /storage/roms/3ds/citrasa/nand /storage/.config/citra-emu/nand
#Emulation Station Features
GAME=$(echo "${1}"| sed "s#^/.*/##")
2023-02-22 16:04:45 +00:00
RENDERER=$(get_setting graphics_backend 3ds "${GAME}")
2023-01-03 14:37:08 +00:00
RES=$(get_setting resolution_scale 3ds "${GAME}")
2023-01-06 15:15:47 +00:00
ROTATE=$(get_setting rotate_screen 3ds "${GAME}")
2023-01-03 14:37:08 +00:00
SLAYOUT=$(get_setting screen_layout 3ds "${GAME}")
#Resolution Scale
if [ "$RES" = "0" ]
then
sed -i '/resolution_factor =/c\resolution_factor = 0' /storage/.config/citra-emu/sdl2-config.ini
fi
if [ "$RES" = "1" ]
then
sed -i '/resolution_factor =/c\resolution_factor = 1' /storage/.config/citra-emu/sdl2-config.ini
fi
if [ "$RES" = "2" ]
then
sed -i '/resolution_factor =/c\resolution_factor = 2' /storage/.config/citra-emu/sdl2-config.ini
fi
2023-01-06 15:15:47 +00:00
#Rotate Screen
if [ "$ROTATE" = "0" ]
then
sed -i '/upright_screen =/c\upright_screen = 0' /storage/.config/citra-emu/sdl2-config.ini
fi
if [ "$ROTATE" = "1" ]
then
sed -i '/upright_screen =/c\upright_screen = 1' /storage/.config/citra-emu/sdl2-config.ini
fi
2023-01-03 14:37:08 +00:00
#Screen Layout
if [ "$SLAYOUT" = "0" ]
then
sed -i '/layout_option =/c\layout_option = 0' /storage/.config/citra-emu/sdl2-config.ini
sed -i '/swap_screen =/c\swap_screen = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-06 15:15:47 +00:00
sed -i '/custom_layout =/c\custom_layout = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-03 14:37:08 +00:00
fi
if [ "$SLAYOUT" = "1a" ]
then
sed -i '/layout_option =/c\layout_option = 1' /storage/.config/citra-emu/sdl2-config.ini
sed -i '/swap_screen =/c\swap_screen = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-06 15:15:47 +00:00
sed -i '/custom_layout =/c\custom_layout = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-03 14:37:08 +00:00
fi
if [ "$SLAYOUT" = "1b" ]
then
sed -i '/layout_option =/c\layout_option = 1' /storage/.config/citra-emu/sdl2-config.ini
sed -i '/swap_screen =/c\swap_screen = 1' /storage/.config/citra-emu/sdl2-config.ini
2023-01-06 15:15:47 +00:00
sed -i '/custom_layout =/c\custom_layout = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-03 14:37:08 +00:00
fi
if [ "$SLAYOUT" = "2" ]
then
sed -i '/layout_option =/c\layout_option = 2' /storage/.config/citra-emu/sdl2-config.ini
sed -i '/swap_screen =/c\swap_screen = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-06 15:15:47 +00:00
sed -i '/custom_layout =/c\custom_layout = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-03 14:37:08 +00:00
fi
if [ "$SLAYOUT" = "3" ]
then
sed -i '/layout_option =/c\layout_option = 3' /storage/.config/citra-emu/sdl2-config.ini
sed -i '/swap_screen =/c\swap_screen = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-06 15:15:47 +00:00
sed -i '/custom_layout =/c\custom_layout = 0' /storage/.config/citra-emu/sdl2-config.ini
2023-01-03 14:37:08 +00:00
fi
2023-01-06 15:15:47 +00:00
if [ "$SLAYOUT" = "4" ]
then
sed -i '/layout_option =/c\layout_option = 0' /storage/.config/citra-emu/sdl2-config.ini
sed -i '/swap_screen =/c\swap_screen = 0' /storage/.config/citra-emu/sdl2-config.ini
sed -i '/custom_layout =/c\custom_layout = 1' /storage/.config/citra-emu/sdl2-config.ini
fi
2023-01-03 14:37:08 +00:00
2023-02-22 16:04:45 +00:00
#Video Backend
if [ "$RENDERER" = "1" ]
then
cp -r /usr/bin/citra-vulkan /storage/.config/citra-emu/citra
else
cp -r /usr/bin/citra-gl /storage/.config/citra-emu/citra
fi
chmod +x /storage/.config/citra-emu/citra
2023-01-03 14:37:08 +00:00
2023-01-02 16:49:21 +00:00
rm -rf /storage/.local/share/citra-emu
ln -sfv /storage/.config/citra-emu /storage/.local/share/citra-emu
2023-02-22 16:04:45 +00:00
#Run Citra Emulator
/storage/.config/citra-emu/citra "${1}"