Skip to content

Commit

Permalink
Fix lockups entering apps or games (#1369)
Browse files Browse the repository at this point in the history
# TODO: check anywhere else we may need to now set the TZ... 

We've found this is caused by a weird config combination... where if a
certain TZ is set in runtime, MainUI inherits it and it causes some
loops/threads within MainUI to not break out (it gets stuck in a
threaded loop which will never exit), so you get stuck at a "Loading"
screen when entering Roms, or a complete freeze when entering Apps.

It could be a mismatch of TZ between MainUI and everything that runs
"before" it.. IE: updater, customer/main etc. & The kernel will never
know about the TZ as we can't insert it so early. This is speculation,
the root cause i haven't found.

This is obvious when files are removed from the SD and the time/date of
creation checked on a windows PC, the TZ metadata is sometimes bad.

This pr will:
- Remove runtime.sh environments knowledge of the timezone, therefore
MainUI no longer knows about the TZ either.
- Pass cmd_to_run.sh the timezone for apps and games to be aware it's
potentially changed, and to set theirs correctly
- Tell BLF script about the TZ manually, as keymon now no longer knows
the TZ.

TZ is already set in update_networking.sh main function so no changes
needed there for anything called as they will inherit this TZ from their
parent.

Games and apps will inherit this from pushing it through cmd_to_run.sh

To verify this PR:

- Rename your .tmp_update/config directoy
- Drop in the attached tainted config dir:
[config.zip](https://github.com/OnionUI/Onion/files/13928317/config.zip)
- Open the search app with something in the search field
- Hard power down with the power button
- Power on & try and load an app or game -> freeze.

Add in the new runtime.sh from this PR and re-run the above steps,
observe no freeze.

The TZ is still correctly passed to retroarch:

![image](https://github.com/OnionUI/Onion/assets/47260768/546f5398-acfd-42ae-819a-4bbf3cf0b791)

And any apps:

![image](https://github.com/OnionUI/Onion/assets/47260768/5044e025-7cd6-4782-bebb-11d75021c0e0)

Aslong as they're a child of either update_networking or cmd_to_run.sh

---------

Co-authored-by: Aemiii91 <[email protected]>
Co-authored-by: Totofaki <[email protected]>
Co-authored-by: Schmurtz <[email protected]>
Co-authored-by: tGecko <[email protected]>
  • Loading branch information
5 people authored Jan 23, 2024
1 parent d236839 commit 9c5dbcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 4 additions & 12 deletions static/build/.tmp_update/runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ change_resolution() {
launch_game() {
log "\n:: Launch game"
cmd=$(cat $sysdir/cmd_to_run.sh)
TZ_VALUE=$(cat "$sysdir/config/.tz")

is_game=0
rompath=""
Expand Down Expand Up @@ -384,7 +385,9 @@ launch_game() {

# GAME LAUNCH
cd /mnt/SDCARD/RetroArch/
$sysdir/cmd_to_run.sh

# make the cmd_to_run shell env aware of the new timezone
TZ="$TZ_VALUE" $sysdir/cmd_to_run.sh
retval=$?

if [ -f /tmp/new_res_available ]; then
Expand Down Expand Up @@ -796,23 +799,12 @@ start_networking() {
}

check_networking() {
if [ $DEVICE_ID -ne $MODEL_MMP ] || [ ! -f /tmp/network_changed ] && [ -f /tmp/ntp_synced ]; then
check_timezone
return
fi

if pgrep -f update_networking.sh; then
log "update_networking already running"
else
rm /tmp/network_changed
$sysdir/script/network/update_networking.sh check
fi

check_timezone
}

check_timezone() {
export TZ=$(cat "$sysdir/config/.tz")
}

check_installer() {
Expand Down
2 changes: 2 additions & 0 deletions static/build/.tmp_update/script/blue_light.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if [ -f "$lockfile" ]; then
exit 1
fi

export TZ=$(cat "$sysdir/config/.tz")

touch "$lockfile"
trap 'rm -f "$lockfile"; exit' INT TERM EXIT

Expand Down

0 comments on commit 9c5dbcf

Please sign in to comment.