Skip to content

Commit

Permalink
Merge branch 'main' into fix-gallery-not-finding-screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemiii91 authored Feb 24, 2024
2 parents fb844c6 + 9459f80 commit e8f0b75
Show file tree
Hide file tree
Showing 74 changed files with 144 additions and 29 deletions.
Binary file modified static/build/.tmp_update/bin/disp_init
Binary file not shown.
65 changes: 65 additions & 0 deletions static/build/.tmp_update/script/disp_csc_reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh
export sysdir="/mnt/SDCARD/.tmp_update"
export miyoodir="/mnt/SDCARD/miyoo"
export LD_LIBRARY_PATH="/lib:/config/lib:$miyoodir/lib:$sysdir/lib:$sysdir/lib/parasyte:/sbin:/usr/sbin:/bin:/usr/bin"
export PATH="$sysdir/bin:$PATH"

# to push the default display values into mi_disp when a soft reset of mi_disp is done (if /dev/l doesn't exist for some reason)
# this script is called by `disp_init` but can be called standalone
# it will read system.json, process the values to what mi_disp expects and push them in

# mi_disp doesn't accept the values raw from system.json, they're manipulated before handing off to mi_disp
LUMINATION_FACTOR=17
SATURATION_FACTOR=5
CONTRAST_OFFSET=40

# grab the values from system.json
filename="/appconfigs/system.json"

readout=$(jq -r '.lumination, .hue, .saturation, .contrast' "$filename")

while IFS= read -r line; do
[ -z "$lumination" ] && lumination="$line" && continue
[ -z "$hue" ] && hue="$line" && continue
[ -z "$saturation" ] && saturation="$line" && continue
[ -z "$contrast" ] && contrast="$line" && continue
done <<EOF
$readout
EOF

# check if they're within bounds, if not force defaults of 7/10/10/10 like miyoo do.
if ! echo "$lumination" | grep -qE '^[0-9]+$' || [ "$lumination" -lt 0 ] || [ "$lumination" -gt 20 ]; then lumination=7; fi
if ! echo "$hue" | grep -qE '^[0-9]+$' || [ "$hue" -lt 0 ] || [ "$hue" -gt 20 ]; then hue=10; fi
if ! echo "$saturation" | grep -qE '^[0-9]+$' || [ "$saturation" -lt 0 ] || [ "$saturation" -gt 20 ]; then saturation=10; fi
if ! echo "$contrast" | grep -qE '^[0-9]+$' || [ "$contrast" -lt 0 ] || [ "$contrast" -gt 20 ]; then contrast=10; fi

# process ready for mi_disp to accept
lumaProcessed=$((lumination + LUMINATION_FACTOR * 2))
satProcessed=$((saturation * SATURATION_FACTOR))
contProcessed=$((contrast + CONTRAST_OFFSET))
hueProcessed=$((hue * SATURATION_FACTOR))

devid=0 # the mi_disp ID
cscMatrix=3 # dont change this, it's the type of csc (E_MI_DISP_CSC_MATRIX_RGB_TO_BT709_PC)
sharpness=0 # set by default to 0
gain=0 # no effect but required by the below

# check if /proc/mi_modules/mi_disp/mi_disp0 exists before trying to push in values,
# if it doesn't, fully respawn /dev/l (causes screen to reinitialise fully, which causes visual artifacts like at startup)
sync

if [ -e "/proc/mi_modules/mi_disp/mi_disp0" ]; then
echo "csc $devid $cscMatrix $contProcessed $hueProcessed $lumaProcessed $satProcessed $sharpness $gain" > /proc/mi_modules/mi_disp/mi_disp0
else
echo "mi_disp0 does not exist. Cannot push values."
cat /proc/ls
/dev/l &
fi

# echo "SetCsc command executed with the following parameters:"
# echo "Contrast: $contProcessed"
# echo "Hue: $hueProcessed"
# echo "Luma: $lumaProcessed"
# echo "Saturation: $satProcessed"
# echo "Sharpness: $sharpness"
# echo "Gain: $gain"
32 changes: 32 additions & 0 deletions static/build/.tmp_update/script/drastic_migration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

migrate_drastic() {
if [ -z "$1" ]; then
echo "Error: Empty argument provided." >&2
exit 1
fi
local old_drastic_folder="/mnt/SDCARD/Emu/$1"
local backup_zip_file="/mnt/SDCARD/Emu/$1_old.7z"
local old_save_folder="/mnt/SDCARD/Emu/$1/backup"
local old_savestate_folder="/mnt/SDCARD/Emu/$1/savestates"
local new_save_folder="/mnt/SDCARD/Saves/CurrentProfile/states/Drastic"
local drastic_package_location="/mnt/SDCARD/App/PackageManager/data/Emu/Nintendo - DS (Drastic)"
local game_list_cache="/mnt/SDCARD/Roms/NDS/NDS_cache6.db"

if [ -d "$old_drastic_folder" ]; then
echo "Migrating Drastic from $1 folder..." >>/tmp/.update_msg

mkdir -p "$new_save_folder"
cp "$old_save_folder"/*.* "$new_save_folder"/
cp "$old_savestate_folder"/*.* "$new_save_folder"/

7z a -r -mx0 "$backup_zip_file" "$old_drastic_folder"/
rm -rf "$old_drastic_folder"/

cp -r "$drastic_package_location"/* "/mnt/SDCARD/"
rm "$game_list_cache"
fi
}

# Migrate Drastic from Emu/drastic
migrate_drastic "drastic"
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gambatte_gb_palette_twb64_2 = "TWB64 200 - TOKYO SKYTREE CLOUDY BLUE"
gambatte_gbc_color_correction = "disabled"
gambatte_gbc_color_correction_mode = "accurate"
gambatte_gbc_frontlight_position = "central"
gambatte_mix_frames = "mix"
gambatte_mix_frames = "disabled"
gambatte_rumble_level = "10"
gambatte_show_gb_link_settings = "disabled"
gambatte_turbo_period = "4"
Expand Down
2 changes: 1 addition & 1 deletion static/configs/Saves/CurrentProfile/config/gpSP/gpSP.opt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ gpsp_bios = "auto"
gpsp_boot_mode = "game"
gpsp_color_correction = "disabled"
gpsp_drc = "enabled"
gpsp_frame_mixing = "enabled"
gpsp_frame_mixing = "disabled"
gpsp_frameskip = "disabled"
gpsp_frameskip_interval = "1"
gpsp_frameskip_threshold = "33"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ show_fps 0 // Draw frames per second in the corner
windowed 0 // 1 to start up in windowed mode
window_position -1 -1 // x and y position of window (-1, -1 to let the window manager decide)
frameless 1 // 1 to use a window with no frame
fullscreen_method 0 // 0 maximized window (linux) 1 borderless desktop-sized window 2 hardware fullscreen (warning: erratic behaviour under some drivers)
blit_method 2 // 0 auto 1 software (slower but sometimes more reliable) 2 hardware (can do filtered scaling)

fullscreen_method 2 // 0 maximized window (linux) 1 borderless desktop-sized window 2 hardware fullscreen (warning: erratic behaviour under some drivers)
blit_method 0 // 0 auto 1 software (slower but sometimes more reliable) 2 hardware (can do filtered scaling)


// :: System Settings

foreground_sleep_ms 10 // number of milliseconds to sleep each frame. Try 10 to conserve battery power
foreground_sleep_ms 5 // number of milliseconds to sleep each frame. Try 10 to conserve battery power

background_sleep_ms 10 // number of milliseconds to sleep each frame when running in the background

Expand Down Expand Up @@ -93,16 +92,16 @@ gui_theme 0

// scale of screenshots and gifs // 2 means 256x256
screenshot_scale 3
gif_scale 2
gif_scale 3

// maximum gif length in seconds (0..120; 0 means no gif recording)
gif_len 8
gif_len 16

// when 1, reset the recording when pressing ctrl-9 (useful for creating a non-overlapping sequence)
gif_reset_mode 0

// 0 for off. 1 for auto. 2 to allow control of a cart's framerate due to host machine's cpu capacity
host_framerate_control 1
host_framerate_control 0

// filter splore cartridges
// 0 off 1 on (exclude cartridge tagged as 'mature' by community)
Expand All @@ -124,7 +123,7 @@ allow_function_keys 1
check_for_cart_updates 1

// 0 off 1 on: allow access to hardware GPIO at 0x5f80..0x5fff (might need to sudo pico8)
enable_gpio 0
enable_gpio 1

// hide mouse cursor for n seconds when typing.
auto_hide_mouse_cursor 5
Expand All @@ -145,5 +144,5 @@ periodic_backups 20
transform_screen 134

// 0 off > 1: colour to draw pixel grid in the gfx editor at zoom:8 and zoom:4 (16 for black)
gfx_grid_lines 0
gfx_grid_lines 16

6 changes: 6 additions & 0 deletions static/dist/miyoo/app/.tmp_update/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ run_installation() {
install_configs $reset_configs

run_migration_scripts

if [ -d "/mnt/SDCARD/Emu/drastic" ]; then
echo "Migrating drastic ..."
cd /mnt/SDCARD/.tmp_update/script
./drastic_migration.sh
fi

echo "Finishing up - Get ready!" >> /tmp/.update_msg

Expand Down
Binary file not shown.
Empty file.
10 changes: 0 additions & 10 deletions static/packages/Emu/Nintendo - DS (Drastic)/Emu/NDS/launch.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
#!/bin/sh
mydir=$(dirname "$0")

purge_devil() {
if pgrep -f "/dev/l" > /dev/null; then
echo "Process /dev/l is running. Killing it now..."
killall -9 l
else
echo "Process /dev/l is not running."
fi
}

cd $mydir

export HOME=$mydir
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ fixconfig() {
set_windowed="windowed 0"
set_window_position="window_position -1 -1"
set_frameless="frameless 1"
set_fullscreen_method="fullscreen_method 0"
set_blit_method="blit_method 2"
set_fullscreen_method="fullscreen_method 2"
set_blit_method="blit_method 0"
set_transform_screen="transform_screen 134"
set_host_framerate_control="host_framerate_control 0"

for setting in window_size screen_size windowed window_position frameless fullscreen_method blit_method transform_screen; do
for setting in window_size screen_size windowed window_position frameless fullscreen_method blit_method transform_screen host_framerate_control; do
case $setting in
window_size) new_value="$set_window_size" ;;
screen_size) new_value="$set_screen_size" ;;
Expand All @@ -45,6 +46,7 @@ fixconfig() {
fullscreen_method) new_value="$set_fullscreen_method" ;;
blit_method) new_value="$set_blit_method" ;;
transform_screen) new_value="$set_transform_screen" ;;
host_framerate_control) new_value="$set_host_framerate_control" ;;
esac

if grep -q "^$setting" "$config_file"; then
Expand All @@ -57,17 +59,34 @@ fixconfig() {
done

echo "Updated settings:"
grep -E "window_size|screen_size|windowed|window_position|frameless|fullscreen_method|blit_method|transform_screen" "$config_file"
grep -E "window_size|screen_size|windowed|window_position|frameless|fullscreen_method|blit_method|transform_screen|host_framerate_control" "$config_file"
}

start_pico() {
purge_devil() {
if pgrep -f "/dev/l" >/dev/null; then
echo "Process /dev/l is running. Killing it now..."
killall -2 l
else
echo "Process /dev/l is not running."
fi

# this handles a second startup of pico-8, if /dev/l has already been replaced by disp_init
if pgrep -f "disp_init" >/dev/null; then
echo "Process disp_init is running. Killing it now..."
killall -9 disp_init
else
echo "Process disp_init is not running."
fi
}

start_pico() {
if [ ! -e "$picodir/bin/pico8_dyn" ]; then
infoPanel --title "PICO-8 binaries not found" --message "Native PICO-8 engine requires to purchase official \nbinaries which are not provided in Onion. \nGo to Lexaloffle's website, get Raspberry Pi version\n and copy \"pico8_dyn\" and \"pico8.dat\"\n to your SD card in \"/RApp/PICO-8/bin\"."
cd /mnt/SDCARD/.tmp_update/script
./remove_last_recent_entry.sh
exit
fi
purge_devil

export LD_LIBRARY_PATH="$picodir/lib:$LD_LIBRARY_PATH"
export SDL_VIDEODRIVER=mmiyoo
Expand All @@ -80,20 +99,24 @@ start_pico() {

if [ "$filename" = "~Run PICO-8 with Splore.png" ]; then
num_files_before=$(ls -1 "$BBS_DIR" | wc -l)
LD_PRELOAD="$picodir/lib/libcpt_hook.so" pico8_dyn -splore -preblit_scale 3 -pixel_perfect 0
LD_PRELOAD="$picodir/lib/libcpt_hook.so" pico8_dyn -splore -preblit_scale 3
num_files_after=$(ls -1 "$BBS_DIR" | wc -l)
if [ "$num_files_before" -ne "$num_files_after" ]; then
rm -f /mnt/SDCARD/Roms/PICO/PICO_cache6.db
fi

else
LD_PRELOAD="$picodir/lib/libcpt_hook.so" pico8_dyn -preblit_scale 3 -pixel_perfect 0 -run "$rompath"
LD_PRELOAD="$picodir/lib/libcpt_hook.so" pico8_dyn -preblit_scale 3 -run "$rompath"
fi
}

main() {
echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
sv=$(cat /proc/sys/vm/swappiness)
echo 10 >/proc/sys/vm/swappiness
start_pico
disp_init & # re-init mi_disp and push csc in
echo $sv >/proc/sys/vm/swappiness
}

main
main
Binary file not shown.

0 comments on commit e8f0b75

Please sign in to comment.