Improve error handling in Pi setup
Some checks failed
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Has been cancelled
CD / Create Pi Mono Setup (push) Has been cancelled
CD / Publishing (push) Has been cancelled

This commit is contained in:
Lorenzooone 2025-11-12 04:04:06 +01:00
parent 02314548aa
commit 79116a27fd
9 changed files with 80 additions and 5 deletions

View File

@ -4,4 +4,7 @@ TARGET_SCRIPT=cc3dsfs_script_tv_kit_2.sh
BASE_DIR=${HOME}/Desktop/premade_scripts
ENV_SCRIPT=cc3dsfs_envs.sh
. ${BASE_DIR}/${ENV_SCRIPT}
${BASE_DIR}/${TARGET_SCRIPT}

View File

@ -0,0 +1,4 @@
#!/bin/sh
export TO_TOUCH_FILE=${HOME}/tmp_cc3dsfs_file
export TOUCH_COMMAND="--touch_file ${TO_TOUCH_FILE}"

View File

@ -0,0 +1,12 @@
#!/bin/sh
error=$1
if [ -e ${TO_TOUCH_FILE} ]; then
if [ $error -ne 0 ]; then
rm -f ${TO_TOUCH_FILE}
echo "Shutting down!"
shutdown now
fi
rm -f ${TO_TOUCH_FILE}
fi

View File

@ -1,3 +1,3 @@
#!/bin/sh
wpctl set-volume @DEFAULT_AUDIO_SINK@ 1.0 ; xset s noblank ; xset s off ; xset -dpms ; xrandr --output HDMI-1 --auto ; sleep 5
wpctl set-volume @DEFAULT_AUDIO_SINK@ 1.0 ; xset s noblank ; xset s off ; xset -dpms ; xrandr --output HDMI-1 --auto ; rm -f ${TO_TOUCH_FILE} ; sleep 5

View File

@ -1,3 +1,4 @@
#!/bin/sh
${HOME}/Desktop/premade_scripts/cc3dsfs_prepare_script.sh ; ${HOME}/Desktop/cc3dsfs --mono_app --pi_enter 27 --pi_select 9 --pi_menu 19 || shutdown now
${HOME}/Desktop/premade_scripts/cc3dsfs_prepare_script.sh ; ${HOME}/Desktop/cc3dsfs ${TOUCH_COMMAND} --mono_app --pi_enter 27 --pi_select 9 --pi_menu 19
${HOME}/Desktop/premade_scripts/cc3dsfs_post_script.sh $?

View File

@ -1,3 +1,4 @@
#!/bin/sh
${HOME}/Desktop/premade_scripts/cc3dsfs_prepare_script.sh ; ${HOME}/Desktop/cc3dsfs --mono_app --pi_power 3 --pi_select 6 --pi_enter 9 --pi_menu 19 || shutdown now
${HOME}/Desktop/premade_scripts/cc3dsfs_prepare_script.sh ; ${HOME}/Desktop/cc3dsfs ${TOUCH_COMMAND} --mono_app --pi_power 3 --pi_select 6 --pi_enter 9 --pi_menu 19
${HOME}/Desktop/premade_scripts/cc3dsfs_post_script.sh $?

View File

@ -1,3 +1,4 @@
#!/bin/sh
${HOME}/Desktop/premade_scripts/cc3dsfs_prepare_script.sh ; ${HOME}/Desktop/cc3dsfs --mono_app || shutdown now
${HOME}/Desktop/premade_scripts/cc3dsfs_prepare_script.sh ; ${HOME}/Desktop/cc3dsfs ${TOUCH_COMMAND} --mono_app
${HOME}/Desktop/premade_scripts/cc3dsfs_post_script.sh $?

View File

@ -9,8 +9,29 @@ PROGRAM_NAME=cc3dsfs
BASE_SOURCE_DIR="."
BASE_TARGET_DIR=${HOME}
sudo apt update
sudo apt -y install xterm xserver-xorg xinit libxcursor1 x11-xserver-utils pipewire pipewire-alsa libharfbuzz-icu0 libgpiod3
sudo apt -y install xterm xserver-xorg xinit libxcursor1 x11-xserver-utils pipewire pipewire-alsa libharfbuzz-icu0 lsb-release
if [ $? -ne 0 ]; then
echo "Error while installing required packages! Exiting early!"
exit 1
fi
codename=$(lsb_release -sc)
echo "Types: deb deb-src
URIs: http://deb.debian.org/debian
Suites: ${codename}-backports
Components: main
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg" > backports
sudo mv backports /etc/apt/sources.list.d/debian-backports.sources
sudo apt update
sudo apt -y install libgpiod3 || sudo apt -y install -t ${codename}-backports libgpiod3
if [ $? -ne 0 ]; then
echo "Error while installing required package libgpiod3! Exiting early!"
exit 1
fi
sudo raspi-config nonint do_boot_behaviour B2

View File

@ -359,6 +359,17 @@ static void save_layout_file(int save_index, FrontendData *frontend_data, AudioD
bool shared_op_success = save_shared(shared_layout_path, shared_layout_name, &frontend_data->shared_data, out_text_data, op_success);
}
static void touch_file_at_path(const std::string path) {
std::ofstream file(path);
if(!file.good())
return;
file << NAME << std::endl;
file.close();
}
static void executeSoundRestart(Audio &audio, AudioData* audio_data, bool do_restart) {
if(do_restart) {
audio.stop();
@ -825,6 +836,20 @@ static bool parse_double_arg(int &index, int argc, char **argv, double &target,
return true;
}
static bool parse_string_arg(int &index, int argc, char **argv, std::string &target, std::string to_check) {
if(argv[index] != to_check)
return false;
if((++index) >= argc)
return true;
try {
target = std::string(argv[index]);
}
catch(...) {
ActualConsoleOutTextError("Error with input for: " + to_check);
}
return true;
}
int main(int argc, char **argv) {
init_threads();
init_start_time();
@ -835,6 +860,7 @@ int main(int argc, char **argv) {
bool use_pud_up = true;
volatile bool can_do_output = true;
bool mono_app_default_value = false;
std::string touch_file_path = "";
#ifdef ANDROID_COMPILATION
mono_app_default_value = true;
#endif
@ -889,6 +915,8 @@ int main(int argc, char **argv) {
continue;
if(parse_existence_arg(i, argv, override_data.print_controller_list, true, "--list_joysticks"))
continue;
if(parse_string_arg(i, argc, argv, touch_file_path, "--touch_file"))
continue;
#ifdef RASPI
if(parse_int_arg(i, argc, argv, page_up_id, "--pi_select"))
continue;
@ -941,6 +969,7 @@ int main(int argc, char **argv) {
ActualConsoleOutText(" the data is also saved to the specified profile.");
ActualConsoleOutText(" --no_auto_save Disables automatic save when closing the software.");
ActualConsoleOutText(" --list_joysticks Prints a list of all the detected joysticks.");
ActualConsoleOutText(" --touch_file Path of a file that the program should create before closing.");
#ifdef RASPI
ActualConsoleOutText(" --pi_select ID Specifies ID for the select GPIO button.");
ActualConsoleOutText(" --pi_menu ID Specifies ID for the menu GPIO button.");
@ -971,5 +1000,8 @@ int main(int argc, char **argv) {
capture_close();
complete_threads();
if(touch_file_path != "")
touch_file_at_path(touch_file_path);
return ret_val;
}