From c35acbc73b74c7e558beabc411ab6c5d2c7ac4e6 Mon Sep 17 00:00:00 2001
From: XargonWan <xargonwan@gmail.com>
Date: Fri, 29 Apr 2022 21:17:30 +0900
Subject: [PATCH] MELONDS: configured

---
 emu-configs/melonDS.ini     | 135 ++++++++++++++++++++++++++++++++++++
 net.retrodeck.retrodeck.yml |   3 +
 retrodeck.sh                |  12 ++--
 tools-gamelist.xml          |   7 ++
 tools/start-melonds.sh      |   7 ++
 tools/start-yuzu.sh         |   2 +-
 6 files changed, 161 insertions(+), 5 deletions(-)
 create mode 100644 emu-configs/melonDS.ini
 create mode 100644 tools/start-melonds.sh

diff --git a/emu-configs/melonDS.ini b/emu-configs/melonDS.ini
new file mode 100644
index 00000000..f32e452f
--- /dev/null
+++ b/emu-configs/melonDS.ini
@@ -0,0 +1,135 @@
+Key_A=-1
+Key_B=-1
+Key_Select=-1
+Key_Start=-1
+Key_Right=-1
+Key_Left=-1
+Key_Up=-1
+Key_Down=-1
+Key_R=-1
+Key_L=-1
+Key_X=-1
+Key_Y=-1
+Joy_A=0
+Joy_B=1
+Joy_Select=6
+Joy_Start=7
+Joy_Right=258
+Joy_Left=264
+Joy_Up=257
+Joy_Down=260
+Joy_R=5
+Joy_L=4
+Joy_X=2
+Joy_Y=3
+HKKey_Lid=-1
+HKKey_Mic=-1
+HKKey_Pause=-1
+HKKey_Reset=-1
+HKKey_FastForward=-1
+HKKey_FastForwardToggle=-1
+HKKey_FullscreenToggle=-1
+HKKey_SwapScreens=-1
+HKKey_SolarSensorDecrease=-1
+HKKey_SolarSensorIncrease=-1
+HKKey_FrameStep=-1
+HKJoy_Lid=-1
+HKJoy_Mic=-1
+HKJoy_Pause=10
+HKJoy_Reset=-1
+HKJoy_FastForward=85065727
+HKJoy_FastForwardToggle=-1
+HKJoy_FullscreenToggle=-1
+HKJoy_SwapScreens=9
+HKJoy_SolarSensorDecrease=-1
+HKJoy_SolarSensorIncrease=-1
+HKJoy_FrameStep=-1
+JoystickID=0
+WindowWidth=768
+WindowHeight=414
+WindowMax=0
+ScreenRotation=0
+ScreenGap=0
+ScreenLayout=3
+ScreenSwap=0
+ScreenSizing=3
+IntegerScaling=1
+ScreenAspectTop=0
+ScreenAspectBot=0
+ScreenFilter=1
+ScreenUseGL=0
+ScreenVSync=0
+ScreenVSyncInterval=1
+3DRenderer=1
+Threaded3D=1
+GL_ScaleFactor=1
+GL_BetterPolygons=0
+LimitFPS=1
+AudioSync=0
+ShowOSD=1
+ConsoleType=0
+DirectBoot=1
+JIT_Enable=0
+JIT_MaxBlockSize=32
+JIT_BranchOptimisations=1
+JIT_LiteralOptimisations=1
+JIT_FastMemory=1
+ExternalBIOSEnable=0
+BIOS9Path=
+BIOS7Path=
+FirmwarePath=
+DSiBIOS9Path=
+DSiBIOS7Path=
+DSiFirmwarePath=
+DSiNANDPath=
+DLDIEnable=0
+DLDISDPath=dldi.bin
+DLDISize=0
+DLDIReadOnly=0
+DLDIFolderSync=0
+DLDIFolderPath=
+DSiSDEnable=0
+DSiSDPath=dsisd.bin
+DSiSDSize=0
+DSiSDReadOnly=0
+DSiSDFolderSync=0
+DSiSDFolderPath=
+FirmwareOverrideSettings=0
+FirmwareUsername=RetroDECK
+FirmwareLanguage=1
+FirmwareBirthdayMonth=3
+FirmwareBirthdayDay=4
+FirmwareFavouriteColour=0
+FirmwareMessage=
+FirmwareMAC=
+RandomizeMAC=0
+SockBindAnyAddr=0
+LANDevice=
+DirectLAN=0
+SavStaRelocSRAM=0
+AudioInterp=0
+AudioBitrate=0
+AudioVolume=256
+MicInputType=1
+MicWavPath=
+LastROMFolder=
+RecentROM_0=
+RecentROM_1=
+RecentROM_2=
+RecentROM_3=
+RecentROM_4=
+RecentROM_5=
+RecentROM_6=
+RecentROM_7=
+RecentROM_8=
+RecentROM_9=
+SaveFilePath=~/retrodeck/saves
+SavestatePath=~/retrodeck/states
+CheatFilePath=
+EnableCheats=0
+MouseHide=0
+MouseHideSeconds=5
+PauseLostFocus=0
+DSBatteryLevelOkay=1
+DSiBatteryLevel=15
+DSiBatteryCharging=1
diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml
index d4c9eada..f355a790 100644
--- a/net.retrodeck.retrodeck.yml
+++ b/net.retrodeck.retrodeck.yml
@@ -941,6 +941,7 @@ modules:
         # Tools
         - mkdir -p ${FLATPAK_DEST}/retrodeck/tools/
         - cp start-retroarch.sh ${FLATPAK_DEST}/retrodeck/tools/
+        - cp start-splore.sh ${FLATPAK_DEST}/retrodeck/tools/
         - cp move-roms.sh ${FLATPAK_DEST}/retrodeck/tools/
         - cp tools-gamelist.xml ${FLATPAK_DEST}/retrodeck/
         
@@ -966,6 +967,8 @@ modules:
         - cp qt-config.ini ${FLATPAK_DEST}/retrodeck/emu-configs/
         # Pcsx2
         - cp PCSX2_ui.ini ${FLATPAK_DEST}/retrodeck/emu-configs/
+        # MelonDS
+        - cp melonDS.ini ${FLATPAK_DEST}/retrodeck/emu-configs/
 
     #cleanup: ['*']
     sources:
diff --git a/retrodeck.sh b/retrodeck.sh
index 0479d931..30c1b71a 100755
--- a/retrodeck.sh
+++ b/retrodeck.sh
@@ -65,10 +65,10 @@ then
     cp /app/retrodeck/tools-gamelist.xml /var/config/retrodeck/tools/gamelist.xml
     # ES-DE scraped folder
     mv -f /var/config/emulationstation/.emulationstation/downloaded_media /var/config/emulationstation/.emulationstation/downloaded_media.old
-	mkdir ~/retrodeck/.downloaded_media
-	ln -s ~/retrodeck/.downloaded_media /var/config/emulationstation/.emulationstation/downloaded_media
-	mv -f /var/config/emulationstation/.emulationstation/downloaded_media.old/* ~/retrodeck/.downloaded_media
-	rm -rf /var/config/emulationstation/.emulationstation/downloaded_media.old
+    mkdir ~/retrodeck/.downloaded_media
+    ln -s ~/retrodeck/.downloaded_media /var/config/emulationstation/.emulationstation/downloaded_media
+    mv -f /var/config/emulationstation/.emulationstation/downloaded_media.old/* ~/retrodeck/.downloaded_media
+    rm -rf /var/config/emulationstation/.emulationstation/downloaded_media.old
 
     # Initializing emulators configs
     emuconfigs=/app/retrodeck/emu-configs/
@@ -97,6 +97,10 @@ then
     mkdir -p /var/config/PCSX2/inis/
     cp $emuconfigs/PCSX2_ui.ini /var/config/PCSX2/inis/
 
+    # MelonDS
+    mkdir -p /var/config/melonDS/
+    cp $emuconfigs/melonDS.ini /var/config/melonDS/
+
     # Locking RetroDECK
     touch ~/retrodeck/.lock
 
diff --git a/tools-gamelist.xml b/tools-gamelist.xml
index 4e6bdd02..c9395142 100644
--- a/tools-gamelist.xml
+++ b/tools-gamelist.xml
@@ -13,6 +13,13 @@
 		<desc>Start Yuzu to manually tweak your settings.</desc>
 		<nogamecount>true</nogamecount>
 		<nomultiscrape>true</nomultiscrape>
+	</game>
+		<game>
+		<path>./start-splore.sh</path>
+		<name>Start Splore</name>
+		<desc>Start PICO-8's splore</desc>
+		<nogamecount>true</nogamecount>
+		<nomultiscrape>true</nomultiscrape>
 	</game>
 	<game>
 		<path>./move-roms.sh</path>
diff --git a/tools/start-melonds.sh b/tools/start-melonds.sh
new file mode 100644
index 00000000..7cdd9990
--- /dev/null
+++ b/tools/start-melonds.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+kdialog --title "RetroDECK" --warningyesno "Doing some changes in the emulator's configuration may create serious issues, please continue only if you know what you're doing.\n\nDo you want to continue?"
+if [ $? == 0 ]
+then
+    melonDS
+fi
\ No newline at end of file
diff --git a/tools/start-yuzu.sh b/tools/start-yuzu.sh
index a618df62..fe4f4fba 100644
--- a/tools/start-yuzu.sh
+++ b/tools/start-yuzu.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-kdialog --title "RetroDECK" --warningyesno "Doing some changes in the Yuzu configuration may create serious issues, please continue only if you know what you're doing.\n\nDo you want to continue?"
+kdialog --title "RetroDECK" --warningyesno "Doing some changes in the emulator's configuration may create serious issues, please continue only if you know what you're doing.\n\nDo you want to continue?"
 if [ $? == 0 ]
 then
     yuzu