mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-09-11 10:05:27 -05:00
Change Raspberry Pi Kiosk setup so it can be edited from Windows
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
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}
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
${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 $?
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
${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 $?
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
${HOME}/Desktop/premade_scripts/cc3dsfs_prepare_script.sh ; ${HOME}/Desktop/cc3dsfs ${TOUCH_COMMAND} --mono_app
|
||||
${HOME}/Desktop/premade_scripts/cc3dsfs_post_script.sh $?
|
||||
@@ -1,3 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
premade_scripts/update_script.sh https://github.com/Lorenzooone/cc3dsfs/releases/latest/download cc3dsfs_rpi_kiosk_setup.zip setup.sh
|
||||
if [ -e /boot/firmware/config.txt ]; then
|
||||
FIRMWARE=/firmware
|
||||
else
|
||||
FIRMWARE=
|
||||
fi
|
||||
|
||||
PROGRAM_NAME=cc3dsfs
|
||||
BASE_TARGET_DIR=/boot${FIRMWARE}/${PROGRAM_NAME}
|
||||
|
||||
${BASE_TARGET_DIR}/premade_scripts/update_script.sh https://github.com/Lorenzooone/cc3dsfs/releases/latest/download cc3dsfs_rpi_kiosk_setup.zip setup.sh
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
premade_scripts/update_script.sh https://github.com/Lorenzooone/cc3dsfs/releases/download/nightly-latest cc3dsfs_rpi_kiosk_setup.zip setup.sh
|
||||
if [ -e /boot/firmware/config.txt ]; then
|
||||
FIRMWARE=/firmware
|
||||
else
|
||||
FIRMWARE=
|
||||
fi
|
||||
|
||||
PROGRAM_NAME=cc3dsfs
|
||||
BASE_TARGET_DIR=/boot${FIRMWARE}/${PROGRAM_NAME}
|
||||
|
||||
${BASE_TARGET_DIR}/premade_scripts/update_script.sh https://github.com/Lorenzooone/cc3dsfs/releases/download/nightly-latest cc3dsfs_rpi_kiosk_setup.zip setup.sh
|
||||
|
||||
@@ -17,4 +17,17 @@ if [ ! -e /expanded_rootfs ]; then
|
||||
reboot
|
||||
fi
|
||||
|
||||
if [ -e /boot/firmware/config.txt ]; then
|
||||
FIRMWARE=/firmware
|
||||
else
|
||||
FIRMWARE=
|
||||
fi
|
||||
|
||||
# Make it so the files can be edited by cc3dsfs...
|
||||
GROUP_NAME=boot_files
|
||||
GID_GROUP=$(getent group ${GROUP_NAME} | cut -d: -f3)
|
||||
|
||||
umount /boot${FIRMWARE}
|
||||
mount -o umask=002,gid=${GID_GROUP} /boot${FIRMWARE}
|
||||
|
||||
exit 0
|
||||
|
||||
10
rpi_setup/files/kiosk_single_execution_script.sh
Normal file
10
rpi_setup/files/kiosk_single_execution_script.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
KIOSK_LAUNCHER=startx
|
||||
|
||||
TARGET_EXIST_FILE=/tmp/executed_once
|
||||
|
||||
if [ ! -e ${TARGET_EXIST_FILE} ]; then
|
||||
touch ${TARGET_EXIST_FILE}
|
||||
${KIOSK_LAUNCHER} ${HOME}/command_to_execute_once.sh
|
||||
fi
|
||||
28
rpi_setup/files/main_files/cc3dsfs_script.sh
Normal file
28
rpi_setup/files/main_files/cc3dsfs_script.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# You can change the contents of this file to specify a different script
|
||||
# Do not change the path unless you know what you are doing
|
||||
FILE_WITH_TARGET_SCRIPT=cc3dsfs_script_name.txt
|
||||
|
||||
# Do not change the following unless you know what you are doing
|
||||
if [ -e /boot/firmware/config.txt ]; then
|
||||
FIRMWARE=/firmware
|
||||
else
|
||||
FIRMWARE=
|
||||
fi
|
||||
|
||||
export PROGRAM_NAME=cc3dsfs
|
||||
export BASE_TARGET_DIR=/boot${FIRMWARE}/${PROGRAM_NAME}
|
||||
export PREMADE_DIR=${BASE_TARGET_DIR}/premade_scripts
|
||||
export CC3DSFS_CFG_DIR=${BASE_TARGET_DIR}/.config
|
||||
export MAIN_KIOSK_PROGRAM=${HOME}/${PROGRAM_NAME}_link
|
||||
|
||||
mkdir -p ${CC3DSFS_CFG_DIR}
|
||||
|
||||
ENV_SCRIPT=${PROGRAM_NAME}_envs.sh
|
||||
|
||||
. ${PREMADE_DIR}/${ENV_SCRIPT}
|
||||
|
||||
TARGET_SCRIPT=$(cat ${BASE_TARGET_DIR}/${FILE_WITH_TARGET_SCRIPT})
|
||||
|
||||
${PREMADE_DIR}/${TARGET_SCRIPT}
|
||||
1
rpi_setup/files/main_files/cc3dsfs_script_name.txt
Normal file
1
rpi_setup/files/main_files/cc3dsfs_script_name.txt
Normal file
@@ -0,0 +1 @@
|
||||
cc3dsfs_script_tv_kit_2.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
export TO_TOUCH_FILE=${HOME}/tmp_cc3dsfs_file
|
||||
export TO_TOUCH_FILE=${HOME}/tmp_${PROGRAM_NAME}_file
|
||||
export TOUCH_COMMAND="--touch_file ${TO_TOUCH_FILE}"
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
${PREMADE_DIR}/${PROGRAM_NAME}_prepare_script.sh
|
||||
|
||||
${MAIN_KIOSK_PROGRAM} ${TOUCH_COMMAND} --mono_app --pi_enter 27 --pi_select 9 --pi_menu 19
|
||||
|
||||
${PREMADE_DIR}/${PROGRAM_NAME}_post_script.sh $?
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
${PREMADE_DIR}/${PROGRAM_NAME}_prepare_script.sh
|
||||
|
||||
${MAIN_KIOSK_PROGRAM} ${TOUCH_COMMAND} --mono_app --pi_power 3 --pi_select 6 --pi_enter 9 --pi_menu 19
|
||||
|
||||
${PREMADE_DIR}/${PROGRAM_NAME}_post_script.sh $?
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
${PREMADE_DIR}/${PROGRAM_NAME}_prepare_script.sh
|
||||
|
||||
${MAIN_KIOSK_PROGRAM} ${TOUCH_COMMAND} --mono_app
|
||||
|
||||
${PREMADE_DIR}/${PROGRAM_NAME}_post_script.sh $?
|
||||
@@ -4,7 +4,7 @@ If you want to save space, use the Lite version of the OS. The setup is compatib
|
||||
|
||||
Turn on the Pi with the SD card and complete the first setup (if any).
|
||||
|
||||
Place the cc3dsfs_rpi_mono_setup.zip file in the Pi (either by downloading it, or by using an USB stick).
|
||||
Place the cc3dsfs_rpi_kiosk_setup.zip file in the Pi (either by downloading it, by using an USB stick or by placing it inside the bootfs partition).
|
||||
|
||||
You will need an active internet connection to complete the setup.
|
||||
Decompress all the files of the .zip into a folder.
|
||||
|
||||
@@ -5,13 +5,19 @@ if [ "$(id -u)" -eq "0" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ -e /boot/firmware/config.txt ]; then
|
||||
FIRMWARE=/firmware
|
||||
else
|
||||
FIRMWARE=
|
||||
fi
|
||||
|
||||
PROGRAM_NAME=cc3dsfs
|
||||
BASE_SOURCE_DIR="."
|
||||
BASE_TARGET_DIR=${HOME}
|
||||
BASE_TARGET_DIR=/boot${FIRMWARE}/${PROGRAM_NAME}
|
||||
|
||||
|
||||
sudo apt update
|
||||
sudo apt -y install xterm xserver-xorg xinit libxcursor1 x11-xserver-utils pipewire pipewire-alsa libharfbuzz-icu0 lsb-release
|
||||
sudo apt -y install xterm xserver-xorg xinit libxcursor1 x11-xserver-utils pipewire pipewire-alsa libharfbuzz-icu0 lsb-release cage
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error while installing required packages! Exiting early!"
|
||||
exit 1
|
||||
@@ -41,38 +47,86 @@ sudo systemctl disable hciuart.service
|
||||
sudo systemctl disable bluetooth.service
|
||||
#sudo systemctl disable wpa_supplicant.service
|
||||
|
||||
sudo mkdir -p ${BASE_TARGET_DIR}
|
||||
# This won't work in /boot/firmware, but whatever...
|
||||
# Keep it here if the folder ever changes again.
|
||||
#sudo chown -R ${USER}:${USER} ${BASE_TARGET_DIR}
|
||||
|
||||
KIOSK_SINGLE_EXECUTION_SCRIPT=kiosk_single_execution_script.sh
|
||||
cp -f ${BASE_SOURCE_DIR}/files/${KIOSK_SINGLE_EXECUTION_SCRIPT} ${HOME}/${KIOSK_SINGLE_EXECUTION_SCRIPT}
|
||||
# Do this indirection so the name is not hardcoded...
|
||||
echo "${BASE_TARGET_DIR}/${PROGRAM_NAME}_script.sh" > ${HOME}/command_to_execute_once.sh
|
||||
chmod +x ${HOME}/${KIOSK_SINGLE_EXECUTION_SCRIPT}
|
||||
chmod +x ${HOME}/command_to_execute_once.sh
|
||||
|
||||
# Backup bashrc, to be sure...
|
||||
BACKUP_BASE_NAME=${HOME}/.bashrc_bak
|
||||
BACKUP_AVAILABLE_NUMBER=0
|
||||
BACKUP_FILE_NAME=$BACKUP_BASE_NAME
|
||||
|
||||
while [ -e "$BACKUP_FILE_NAME" ]; do
|
||||
BACKUP_FILE_NAME="${BACKUP_BASE_NAME}_${BACKUP_AVAILABLE_NUMBER}"
|
||||
BACKUP_AVAILABLE_NUMBER=$(($BACKUP_AVAILABLE_NUMBER+1))
|
||||
done
|
||||
|
||||
cp ${HOME}/.bashrc ${BACKUP_FILE_NAME}
|
||||
|
||||
# I know this isn't how you SHOULD do it, however I tried
|
||||
# various other things (crontab @reboot and rc.local) and they didn't work...
|
||||
echo "" >> ${BASE_TARGET_DIR}/.bashrc
|
||||
echo 'if [ -z "${EXECUTED_ONCE}" ]; then' >> ${BASE_TARGET_DIR}/.bashrc
|
||||
echo " export EXECUTED_ONCE=1 ; startx ${BASE_TARGET_DIR}/Desktop/${PROGRAM_NAME}_script.sh" >> ${BASE_TARGET_DIR}/.bashrc
|
||||
echo 'fi' >> ${BASE_TARGET_DIR}/.bashrc
|
||||
cp -f /etc/skel/.bashrc ${HOME}/.bashrc
|
||||
echo "" >> ${HOME}/.bashrc
|
||||
echo "${HOME}/${KIOSK_SINGLE_EXECUTION_SCRIPT}" >> ${HOME}/.bashrc
|
||||
|
||||
rm -f ${BASE_TARGET_DIR}/Desktop/${PROGRAM_NAME}_script.sh
|
||||
cp -Rf ${BASE_SOURCE_DIR}/files/Desktop/ ${BASE_TARGET_DIR}/
|
||||
# Copy the real program...
|
||||
sudo rm -f ${BASE_TARGET_DIR}/${PROGRAM_NAME}_script.sh
|
||||
sudo cp -Rf ${BASE_SOURCE_DIR}/files/main_files/* ${BASE_TARGET_DIR}/
|
||||
if [ $(getconf LONG_BIT) -eq 32 ]; then
|
||||
$(cd ${BASE_TARGET_DIR}/Desktop ; rm -f ${PROGRAM_NAME} ; ln -s ${PROGRAM_NAME}_versions/${PROGRAM_NAME}_32 ${PROGRAM_NAME})
|
||||
$(cd ${HOME} ; rm -f ${PROGRAM_NAME}_link ; ln -s ${BASE_TARGET_DIR}/${PROGRAM_NAME}_versions/${PROGRAM_NAME}_32 ${PROGRAM_NAME}_link)
|
||||
else
|
||||
$(cd ${BASE_TARGET_DIR}/Desktop ; rm -f ${PROGRAM_NAME} ; ln -s ${PROGRAM_NAME}_versions/${PROGRAM_NAME}_64 ${PROGRAM_NAME})
|
||||
$(cd ${HOME} ; rm -f ${PROGRAM_NAME}_link ; ln -s ${BASE_TARGET_DIR}/${PROGRAM_NAME}_versions/${PROGRAM_NAME}_64 ${PROGRAM_NAME}_link)
|
||||
fi
|
||||
chmod +x -R ${BASE_TARGET_DIR}/Desktop/premade_scripts/
|
||||
chmod +x -R ${BASE_TARGET_DIR}/Desktop/${PROGRAM_NAME}_versions/
|
||||
chmod +x ${BASE_TARGET_DIR}/Desktop/${PROGRAM_NAME}
|
||||
chmod +x ${BASE_TARGET_DIR}/Desktop/${PROGRAM_NAME}_script.sh
|
||||
chmod +x ${BASE_TARGET_DIR}/Desktop/update_to_unstable.sh
|
||||
chmod +x ${BASE_TARGET_DIR}/Desktop/update_to_stable.sh
|
||||
# This won't work in /boot/firmware, but whatever...
|
||||
# Keep it here if the folder ever changes again.
|
||||
#sudo chmod +x -R ${BASE_TARGET_DIR}/premade_scripts/
|
||||
#sudo chmod +x -R ${BASE_TARGET_DIR}/${PROGRAM_NAME}_versions/
|
||||
#sudo chmod +x ${BASE_TARGET_DIR}/${PROGRAM_NAME}
|
||||
#sudo chmod +x ${BASE_TARGET_DIR}/${PROGRAM_NAME}_script.sh
|
||||
sudo chmod +x ${HOME}/${PROGRAM_NAME}_link
|
||||
|
||||
if [ -e /boot/firmware/config.txt ]; then
|
||||
FIRMWARE=/firmware
|
||||
else
|
||||
FIRMWARE=
|
||||
fi
|
||||
cp -Rf ${BASE_SOURCE_DIR}/files/Desktop/ ${HOME}/
|
||||
chmod +x ${HOME}/Desktop/update_to_unstable.sh
|
||||
chmod +x ${HOME}/Desktop/update_to_stable.sh
|
||||
|
||||
# Add symbolic link if user boots wants to use the terminal
|
||||
rm -f ${HOME}/update_to_unstable.sh
|
||||
rm -f ${HOME}/update_to_stable.sh
|
||||
ln -s ${HOME}/Desktop/update_to_unstable.sh ${HOME}/update_to_unstable.sh
|
||||
ln -s ${HOME}/Desktop/update_to_stable.sh ${HOME}/update_to_stable.sh
|
||||
|
||||
# Add symbolic link if user boots Desktop
|
||||
rm -f ${HOME}/Desktop/${PROGRAM_NAME}
|
||||
rm -rf ${HOME}/Desktop/${PROGRAM_NAME}
|
||||
ln -s ${BASE_TARGET_DIR} ${HOME}/Desktop/${PROGRAM_NAME}
|
||||
|
||||
# Add symbolic link if user wants to use the terminal
|
||||
rm -f ${HOME}/${PROGRAM_NAME}
|
||||
rm -rf ${HOME}/${PROGRAM_NAME}
|
||||
ln -s ${BASE_TARGET_DIR} ${HOME}/${PROGRAM_NAME}
|
||||
|
||||
sudo cp -f ${BASE_SOURCE_DIR}/files/config.txt /boot${FIRMWARE}/config.txt
|
||||
|
||||
GROUP_NAME=boot_files
|
||||
sudo groupadd -U ${USER} ${GROUP_NAME}
|
||||
|
||||
sudo cp -Rf ${BASE_SOURCE_DIR}/files/usr/ /
|
||||
sudo cp -Rf ${BASE_SOURCE_DIR}/files/etc/ /
|
||||
sudo chmod +x /etc/rc.local
|
||||
|
||||
# Add ability to increase priority... May not use it...
|
||||
echo ${USER} nice hard -20 > /tmp/niceness
|
||||
echo ${USER} nice soft -20 > /tmp/niceness
|
||||
sudo mv /tmp/niceness /etc/security/limits.d/35-${PROGRAM_NAME}-nice-limits.conf
|
||||
|
||||
# Raspberry Pi OS comes with this now by default?! Why?!
|
||||
sudo mkdir -p /etc/cloud/
|
||||
sudo touch /etc/cloud/cloud-init.disabled
|
||||
|
||||
@@ -3,13 +3,14 @@ unzip -o cc3dsfs_linux_pi64.zip
|
||||
EXTRACTION_FOLDER="cc3dsfs_linux_pi"
|
||||
RPI_SETUP_FOLDER="rpi_setup"
|
||||
RPI_FINAL_ZIP_NAME="cc3dsfs_rpi_kiosk_setup.zip"
|
||||
mkdir -p ${RPI_SETUP_FOLDER}/files/Desktop/cc3dsfs_versions
|
||||
BASE_LOCATION=$(pwd)
|
||||
MAIN_FILES_RPI_SETUP=${RPI_SETUP_FOLDER}/files/main_files
|
||||
mkdir -p ${MAIN_FILES_RPI_SETUP}/cc3dsfs_versions
|
||||
mkdir -p ${RPI_SETUP_FOLDER}/files/usr/lib/udev/rules.d
|
||||
cp ${EXTRACTION_FOLDER}32/cc3dsfs ${RPI_SETUP_FOLDER}/files/Desktop/cc3dsfs_versions/cc3dsfs_32
|
||||
cp ${EXTRACTION_FOLDER}64/cc3dsfs ${RPI_SETUP_FOLDER}/files/Desktop/cc3dsfs_versions/cc3dsfs_64
|
||||
cp -r "${EXTRACTION_FOLDER}32/other licenses" "${RPI_SETUP_FOLDER}/files/Desktop/other licenses"
|
||||
cp ${EXTRACTION_FOLDER}32/cc3dsfs ${MAIN_FILES_RPI_SETUP}/cc3dsfs_versions/cc3dsfs_32
|
||||
cp ${EXTRACTION_FOLDER}64/cc3dsfs ${MAIN_FILES_RPI_SETUP}/cc3dsfs_versions/cc3dsfs_64
|
||||
cp -r "${EXTRACTION_FOLDER}32/other licenses" "${MAIN_FILES_RPI_SETUP}/other licenses"
|
||||
cp ${EXTRACTION_FOLDER}32/*.rules ${RPI_SETUP_FOLDER}/files/usr/lib/udev/rules.d
|
||||
cp ${EXTRACTION_FOLDER}32/LICENSE ${RPI_SETUP_FOLDER}/files/Desktop
|
||||
cp ${EXTRACTION_FOLDER}32/README.md ${RPI_SETUP_FOLDER}/files/Desktop
|
||||
$(cd ${RPI_SETUP_FOLDER} ; zip -ry ${RPI_FINAL_ZIP_NAME} ./*)
|
||||
cp ${RPI_SETUP_FOLDER}/${RPI_FINAL_ZIP_NAME} .
|
||||
cp ${EXTRACTION_FOLDER}32/LICENSE ${MAIN_FILES_RPI_SETUP}
|
||||
cp ${EXTRACTION_FOLDER}32/README.md ${MAIN_FILES_RPI_SETUP}
|
||||
$(cd ${RPI_SETUP_FOLDER} ; zip -qry ${BASE_LOCATION}/${RPI_FINAL_ZIP_NAME} ./*)
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
|
||||
#define SYNCH_VALUE_OPTIMIZE 0xCC33
|
||||
|
||||
#define SINGLE_RING_BUFFER_SLICE_SIZE 0x10000
|
||||
#define NUM_OPTIMIZE_3DS_CYPRESS_CONCURRENTLY_RUNNING_BUFFERS 16
|
||||
#define TOTAL_WANTED_CONCURRENTLY_RUNNING_BUFFER_SIZE 0x100000
|
||||
#define SINGLE_RING_BUFFER_SLICE_SIZE 0x4000
|
||||
#define NUM_OPTIMIZE_3DS_CYPRESS_CONCURRENTLY_RUNNING_BUFFERS (TOTAL_WANTED_CONCURRENTLY_RUNNING_BUFFER_SIZE / SINGLE_RING_BUFFER_SLICE_SIZE)
|
||||
|
||||
#define NUM_TOTAL_OPTIMIZE_3DS_CYPRESS_BUFFERS (3 * NUM_OPTIMIZE_3DS_CYPRESS_CONCURRENTLY_RUNNING_BUFFERS)
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ void WindowScreen::after_thread_join() {
|
||||
}
|
||||
|
||||
void WindowScreen::draw(double frame_time, VideoOutputData* out_buf, InputVideoDataType video_data_type) {
|
||||
FPSArrayInsertElement(&in_fps, frame_time);
|
||||
FPSArrayInsertElement(&this->in_fps, frame_time);
|
||||
if(!this->done_display)
|
||||
return;
|
||||
|
||||
@@ -320,7 +320,7 @@ void WindowScreen::draw(double frame_time, VideoOutputData* out_buf, InputVideoD
|
||||
this->curr_frame_texture_pos = (this->curr_frame_texture_pos + 1) % this->num_frames_to_blend;
|
||||
auto curr_time = std::chrono::high_resolution_clock::now();
|
||||
const std::chrono::duration<double> diff = curr_time - this->last_draw_time;
|
||||
FPSArrayInsertElement(&draw_fps, diff.count());
|
||||
FPSArrayInsertElement(&this->draw_fps, diff.count());
|
||||
this->last_draw_time = curr_time;
|
||||
WindowScreen::reset_operations(future_operations);
|
||||
if(out_buf != NULL)
|
||||
|
||||
Reference in New Issue
Block a user