From 901f28fe01427158faa0994f6542901c0bf3024d Mon Sep 17 00:00:00 2001 From: rocknix Date: Mon, 1 Sep 2025 14:02:10 +0000 Subject: [PATCH] More MelonDS cleanup --- .../melonds-sa/config/RK3399/melonDS.ini | 10 ++-- .../melonds-sa/config/SM8250/melonDS.ini | 4 +- .../melonds-sa/config/SM8550/melonDS.ini | 6 +-- .../patches/000-hotkey-savestates.patch | 8 +-- .../patches/001-default-config.patch | 11 ++++- .../melonds-sa/scripts/start_melonds.sh | 49 ++++++++++--------- 6 files changed, 50 insertions(+), 38 deletions(-) diff --git a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/RK3399/melonDS.ini b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/RK3399/melonDS.ini index 11f8c35646..2dbc9ffcbd 100644 --- a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/RK3399/melonDS.ini +++ b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/RK3399/melonDS.ini @@ -27,7 +27,7 @@ HKKey_Mic=-1 HKKey_Pause=-1 HKKey_Reset=-1 HKKey_FastForward=-1 -HKKey_FastForwardToggle=-1 +HKKey_FastForwardToggle=70 HKKey_FullscreenToggle=-1 HKKey_SwapScreens=-1 HKKey_SwapScreenEmphasis=-1 @@ -37,8 +37,8 @@ HKKey_FrameStep=-1 HKKey_PowerButton=-1 HKKey_VolumeUp=-1 HKKey_VolumeDown=-1 -HKKey_SaveState=-1 -HKKey_LoadState=-1 +HKKey_SaveState=83 +HKKey_LoadState=76 HKJoy_Lid=-1 HKJoy_Mic=-1 HKJoy_Pause=-1 @@ -54,8 +54,8 @@ HKJoy_FrameStep=-1 HKJoy_PowerButton=-1 HKJoy_VolumeUp=-1 HKJoy_VolumeDown=-1 -HKJoy_SaveState=7 -HKJoy_LoadState=6 +HKJoy_SaveState=-1 +HKJoy_LoadState=-1 JoystickID=0 WindowWidth=1920 WindowHeight=1152 diff --git a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8250/melonDS.ini b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8250/melonDS.ini index 1edb7d034f..1e522db636 100644 --- a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8250/melonDS.ini +++ b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8250/melonDS.ini @@ -27,8 +27,8 @@ HKKey_Mic=-1 HKKey_Pause=-1 HKKey_Reset=-1 HKKey_FastForward=-1 -HKKey_FastForwardToggle=-1 -HKKey_FullscreenToggle=70 +HKKey_FastForwardToggle=70 +HKKey_FullscreenToggle=-1 HKKey_SwapScreens=-1 HKKey_SwapScreenEmphasis=-1 HKKey_SolarSensorDecrease=-1 diff --git a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8550/melonDS.ini b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8550/melonDS.ini index 1edb7d034f..bcdf697411 100644 --- a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8550/melonDS.ini +++ b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/config/SM8550/melonDS.ini @@ -27,8 +27,8 @@ HKKey_Mic=-1 HKKey_Pause=-1 HKKey_Reset=-1 HKKey_FastForward=-1 -HKKey_FastForwardToggle=-1 -HKKey_FullscreenToggle=70 +HKKey_FastForwardToggle=70 +HKKey_FullscreenToggle=-1 HKKey_SwapScreens=-1 HKKey_SwapScreenEmphasis=-1 HKKey_SolarSensorDecrease=-1 @@ -58,7 +58,7 @@ HKJoy_SaveState=-1 HKJoy_LoadState=-1 JoystickID=0 WindowWidth=1920 -WindowHeight=1152 +WindowHeight=1080 WindowMax=0 ScreenRotation=0 ScreenGap=0 diff --git a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/000-hotkey-savestates.patch b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/000-hotkey-savestates.patch index f5ecf2bacb..32f085c2ef 100644 --- a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/000-hotkey-savestates.patch +++ b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/000-hotkey-savestates.patch @@ -6,8 +6,8 @@ index f767fcc9..ba3e18a8 100644 {"HKKey_GuitarGripRed", 0, "Keyboard.HK_GuitarGripRed", true}, {"HKKey_GuitarGripYellow", 0, "Keyboard.HK_GuitarGripYellow", true}, {"HKKey_GuitarGripBlue", 0, "Keyboard.HK_GuitarGripBlue", true}, -+ {"HKKey_SaveState", 0, "HKKeyMapping.HK_SaveState", true}, -+ {"HKKey_LoadState", 0, "HKKeyMapping.HK_LoadState", true}, ++ {"HKKey_SaveState", 0, "Keyboard.HK_SaveState", true}, ++ {"HKKey_LoadState", 0, "Keyboard.HK_LoadState", true}, {"HKJoy_Lid", 0, "Joystick.HK_Lid", true}, {"HKJoy_Mic", 0, "Joystick.HK_Mic", true}, @@ -15,8 +15,8 @@ index f767fcc9..ba3e18a8 100644 {"HKJoy_GuitarGripRed", 0, "Joystick.HK_GuitarGripRed", true}, {"HKJoy_GuitarGripYellow", 0, "Joystick.HK_GuitarGripYellow", true}, {"HKJoy_GuitarGripBlue", 0, "Joystick.HK_GuitarGripBlue", true}, -+ {"HKJoy_SaveState", 0, "HKJoyMapping.HK_SaveState", true}, -+ {"HKJoy_LoadState", 0, "HKJoyMapping.HK_LoadState", true}, ++ {"HKJoy_SaveState", 0, "Joystick.HK_SaveState", true}, ++ {"HKJoy_LoadState", 0, "Joystick.HK_LoadState", true}, {"JoystickID", 0, "JoystickID", true}, diff --git a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/001-default-config.patch b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/001-default-config.patch index cac13a8743..0ac79d4a6c 100644 --- a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/001-default-config.patch +++ b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/patches/001-default-config.patch @@ -1,5 +1,5 @@ diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp -index f767fcc9..e54b0ae9 100644 +index f767fcc9..86981f1f 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -39,10 +39,9 @@ namespace Config @@ -33,3 +33,12 @@ index f767fcc9..e54b0ae9 100644 if (!f) return true; +@@ -717,8 +707,6 @@ bool LoadLegacyFile(int inst) + { + if (!strncmp(entry->Name, entryname, 32)) + { +- if (!(entry->InstanceUnique ^ (inst == -1))) +- break; + + std::string path = entry->TOMLPath; + toml::value* table = root; diff --git a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/scripts/start_melonds.sh b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/scripts/start_melonds.sh index 1925e42472..5ae8a70901 100644 --- a/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/scripts/start_melonds.sh +++ b/projects/ROCKNIX/packages/emulators/standalone/melonds-sa/scripts/start_melonds.sh @@ -12,8 +12,10 @@ control-gen_init.sh source /storage/.config/gptokeyb/control.ini get_controls -if [ ! -d "/storage/.config/melonDS" ]; then - mkdir -p "/storage/.config/melonDS" +CONF_DIR="/storage/.config/melonDS" +MELONDS_INI="melonDS.ini" + +if [ ! -d "${CONF_DIR}" ]; then cp -r "/usr/config/melonDS" "/storage/.config/" fi @@ -22,8 +24,8 @@ if [ ! -d "/storage/roms/savestates/nds" ]; then fi #Make sure melonDS gptk config exists -if [ ! -f "/storage/.config/melonDS/melonDS.gptk" ]; then - cp -r "/usr/config/melonDS/melonDS.gptk" "/storage/.config/melonDS/melonDS.gptk" +if [ ! -f "${CONF_DIR}/melonDS.gptk" ]; then + cp -r "/usr/config/melonDS/melonDS.gptk" "${CONF_DIR}/melonDS.gptk" fi #Emulation Station Features @@ -44,47 +46,45 @@ unset EMUPERF [ "${CORES}" = "big" ] && EMUPERF="${FAST_CORES}" #Graphics Backend -if [ "$GRENDERER" = "0" ]; then - sed -i '/^ScreenUseGL=/c\ScreenUseGL=0' /storage/.config/melonDS/melonDS.ini -fi if [ "$GRENDERER" = "1" ]; then - sed -i '/^ScreenUseGL=/c\ScreenUseGL=1' /storage/.config/melonDS/melonDS.ini + sed -i '/^ScreenUseGL=/c\ScreenUseGL=1' "${CONF_DIR}/${MELONDS_INI}" +else + sed -i '/^ScreenUseGL=/c\ScreenUseGL=0' "${CONF_DIR}/${MELONDS_INI}" fi #Screen Orientation -if [ "$SORIENTATION" ] >"0"; then - sed -i "/^ScreenLayout=/c\ScreenLayout=$SORIENTATION" /storage/.config/melonDS/melonDS.ini +if [ "$SORIENTATION" ] > "0"; then + sed -i "/^ScreenLayout=/c\ScreenLayout=$SORIENTATION" "${CONF_DIR}/${MELONDS_INI}" else - sed -i '/^ScreenLayout=/c\ScreenLayout=2' /storage/.config/melonDS/melonDS.ini + sed -i '/^ScreenLayout=/c\ScreenLayout=2' "${CONF_DIR}/${MELONDS_INI}" fi #Screen Layout -if [ "$SLAYOUT" ] >"0"; then - sed -i "/^ScreenSizing=/c\ScreenSizing=$SLAYOUT" /storage/.config/melonDS/melonDS.ini +if [ "$SLAYOUT" ] > "0"; then + sed -i "/^ScreenSizing=/c\ScreenSizing=$SLAYOUT" "${CONF_DIR}/${MELONDS_INI}" else - sed -i '/^ScreenSizing=/c\ScreenSizing=0' /storage/.config/melonDS/melonDS.ini + sed -i '/^ScreenSizing=/c\ScreenSizing=0' "${CONF_DIR}/${MELONDS_INI}" fi #Screen Swap if [ "$SWAP" = "1" ]; then - sed -i '/^ScreenSwap=/c\ScreenSwap=1' /storage/.config/melonDS/melonDS.ini + sed -i '/^ScreenSwap=/c\ScreenSwap=1' "${CONF_DIR}/${MELONDS_INI}" else - sed -i '/^ScreenSwap=/c\ScreenSwap=0' /storage/.config/melonDS/melonDS.ini + sed -i '/^ScreenSwap=/c\ScreenSwap=0' "${CONF_DIR}/${MELONDS_INI}" fi #Screen Rotation if [ "$SROTATION" ] >"0"; then - sed -i "/^ScreenRotation=/c\ScreenRotation=$SROTATION" /storage/.config/melonDS/melonDS.ini + sed -i "/^ScreenRotation=/c\ScreenRotation=$SROTATION" "${CONF_DIR}/${MELONDS_INI}" else - sed -i '/^ScreenRotation=/c\ScreenRotation=0' /storage/.config/melonDS/melonDS.ini + sed -i '/^ScreenRotation=/c\ScreenRotation=0' "${CONF_DIR}/${MELONDS_INI}" fi #Vsync -if [ "$VSYNC" = "0" ]; then - sed -i '/^ScreenVSync=/c\ScreenVSync=0' /storage/.config/melonDS/melonDS.ini -fi if [ "$VSYNC" = "1" ]; then - sed -i '/^ScreenVSync=/c\ScreenVSync=1' /storage/.config/melonDS/melonDS.ini + sed -i '/^ScreenVSync=/c\ScreenVSync=1' "${CONF_DIR}/${MELONDS_INI}" +else + sed -i '/^ScreenVSync=/c\ScreenVSync=1' "${CONF_DIR}/${MELONDS_INI}" fi #Show FPS @@ -112,7 +112,10 @@ export QT_QPA_PLATFORM=wayland @HOTKEY@ @LIBMALI@ +#Generate a new MelonDS.toml each run (temporary hack) +rm -rf "${CONF_DIR}/melonDS.toml" + #Run MelonDS emulator -$GPTOKEYB "melonDS" -c "/storage/.config/melonDS/melonDS.gptk" & +$GPTOKEYB "melonDS" -c "${CONF_DIR}/melonDS.gptk" & ${EMUPERF} /usr/bin/melonDS -f "${ROM}" kill -9 "$(pidof gptokeyb)"