@echo off
set "RKDEVELOPTOOL=tools\rkdeveloptool"
set "ROCKCHIP_TOOLS=tools\rockchip_tools"
set "SQUASHFS_TOOLS=tools\squashfs_tools-4.0-i686-cygwin"
set "SQUASHFS_TOOLS_NG=tools\squashfs-tools-ng-1.1.0-mingw32"
set "PATH=%ROCKCHIP_TOOLS%;%SQUASHFS_TOOLS%;%SQUASHFS_TOOLS_NG%;%RKDEVELOPTOOL%;%PATH%"


:MKDIRTEMP
Echo PROGRESS_1_18
rmdir /s /q temp 2> nul
mkdir temp 2> nul
IF %ERRORLEVEL% NEQ 0 GOTO ERMKDIRTEMP

:MKDIRIMAGE
Echo PROGRESS_2_18
mkdir temp\Image 2> nul
IF %ERRORLEVEL% NEQ 0 GOTO ERMKDIRIMAGE

:DUMPROOTFS
Echo PROGRESS_3_18
rkdeveloptool rl 0x00007800 0x00018000 temp\Image\rootfs.img
IF %ERRORLEVEL% NEQ 0 GOTO ERDUMPROOTFS

:PACKFILE
Echo PROGRESS_4_18
rmdir /s /q temp\rootfs 2> nul
rdsquashfs --unpack-path / --unpack-root temp/rootfs --describe temp\Image\rootfs.img > temp\packfile.txt
IF %ERRORLEVEL% NEQ 0 GOTO ERPACKFILE

:ADDPACKFILECHCK
Echo PROGRESS_5_18
findstr /C:"file usr/bin/retroarch2 0755 0 0 temp/rootfs/usr/bin/retroarch2" temp\packfile.txt
IF %ERRORLEVEL% EQU 0 (GOTO:ADDSUPLEGCHCK) ELSE (GOTO:ADDPACKFILE)

:ADDPACKFILE
Echo PROGRESS_6_18
echo file usr/bin/retroarch2 0755 0 0 temp/rootfs/usr/bin/retroarch2 >> temp\packfile.txt

:ADDSUPLEGCHCK
Echo PROGRESS_7_18
findstr /C:"file usr/bin/sup_legal.sh 0755 0 0 temp/rootfs/usr/bin/sup_legal.sh" temp\packfile.txt
IF %ERRORLEVEL% EQU 0 (GOTO:EXTRACTROOTFS) ELSE (GOTO:ADDSUPLEG)

:ADDSUPLEG
Echo PROGRESS_8_18
echo file usr/bin/sup_legal.sh 0755 0 0 temp/rootfs/usr/bin/sup_legal.sh >> temp\packfile.txt

:ADDTHEMECHCK
Echo PROGRESS_7_18
findstr /C:"dir opt/menu/menu2.0/themes/EverSD 0755 0 0" temp\packfile.txt
IF %ERRORLEVEL% EQU 0 (GOTO:EXTRACTROOTFS) ELSE (GOTO:ADDTHEME)

:ADDTHEME
Echo PROGRESS_8_18
echo dir opt/menu/menu2.0/themes/EverSD 0755 0 0 >> temp\packfile.txt
echo dir opt/menu/menu2.0/themes/EverSD/images 0755 0 0 >> temp\packfile.txt
echo dir opt/menu/menu2.0/themes/EverSD/images/neon 0755 0 0 >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_Settings_display_ScanlinesMenu_Off.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_Settings_display_ScanlinesMenu_Off.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_Settings_display_ScanlinesMenu_On.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_Settings_display_ScanlinesMenu_On.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_boxart_artworkNotFound.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_boxart_artworkNotFound.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_controllertest_controllerdiagram.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_controllertest_controllerdiagram.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_PLAYbutton_offFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_PLAYbutton_offFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_PLAYbutton_onFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_PLAYbutton_onFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_SAVESbutton_offFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_SAVESbutton_offFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_SAVESbutton_onFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_SAVESbutton_onFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_cursorFrame_PLAYandSAVEbuttons.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_cursorFrame_PLAYandSAVEbuttons.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_darkVignette.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_gameDetails_darkVignette.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_handheldMappingDiagram.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_handheldMappingDiagram.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_A.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_A.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_B.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_B.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_L1.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_L1.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_R1.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_R1.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_X.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_X.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_Y.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_Y.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_dpad.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_dpad.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_select.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_select.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_start.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_handheldDiagram_redLine_start.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_Cursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_Cursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR1_PixelPerfect.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR1_PixelPerfect.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_BoxArt.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_BoxArt.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_EvercadeOrigin.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_EvercadeOrigin.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_LogoLegeneds.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_LogoLegeneds.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_RachidLotf.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_RachidLotf.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_VS.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_VS.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_wireframe.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_bezel_wireframe.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_scanlines_none.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_scanlines_none.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_scanlines_strong.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_scanlines_strong.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_scanlines_subtle.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR2_4_3_scanlines_subtle.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR3_Fullscreen.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_DisplaySettings_ScreenVisual_AR3_Fullscreen.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_LeftNavBox_Cursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_inGameMenu_LeftNavBox_Cursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Background.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Background.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_0bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_0bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_1bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_1bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_2bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_2bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_3bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_3bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_4bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_4bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_Charge.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Battery_Charge.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonA.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonA.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonB.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonB.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonX.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonX.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonY.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_ButtonY.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_GradientFade.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_GradientFade.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_GradientFade_space.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_BottomBar_GradientFade_space.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_CartText_CartText_separatingwhiteline_1cart.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_CartText_CartText_separatingwhiteline_1cart.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_CartText_CartText_separatingwhiteline_2carts.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_CartText_CartText_separatingwhiteline_2carts.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnGame.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnGame.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnGameBig.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnGameBig.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnGameMed.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnGameMed.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnLeftNav.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Cursor_OnLeftNav.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_0CartIcon_OffPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_0CartIcon_OffPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_0CartIcon_OnPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_0CartIcon_OnPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_2CartIcon_OffPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_2CartIcon_OffPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_2CartIcon_OnPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_2CartIcon_OnPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_CartIcon_OffPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_CartIcon_OffPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_CartIcon_OnPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_CartIcon_OnPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_SettingsIcon_OffPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_SettingsIcon_OffPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_SettingsIcon_OnPage.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_LeftNav_SettingsIcon_OnPage.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Scanlines.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Scanlines.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Spinner.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_Spinner.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_TopBar_EvercadeLogo.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_main_TopBar_EvercadeLogo.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_modalWindow_fade.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_modalWindow_fade.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_display_brightness_brightnessIcon.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_display_brightness_brightnessIcon.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_display_previewSelect_headerLine.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_display_previewSelect_headerLine.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_display_previewSelect_previewWindow.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_display_previewSelect_previewWindow.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_network_cursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_network_cursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_bottomBar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_bottomBar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_circleSlider.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_circleSlider.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_circleSliderCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_circleSliderCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_topBarEnd.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_topBarEnd.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_topBarLine.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_slider_topBarLine.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_volumeIcon.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_sound_volumeIcon.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_theme_Modern.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_theme_Modern.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_theme_screenBorder.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neon720_settings_theme_screenBorder.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_Settings_display_ScanlinesMenu_Off.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_Settings_display_ScanlinesMenu_Off.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_Settings_display_ScanlinesMenu_On.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_Settings_display_ScanlinesMenu_On.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_controllertest_controllerdiagram.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_controllertest_controllerdiagram.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_controllertest_spotCircle.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_controllertest_spotCircle.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_controlsMappingTable.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_controlsMappingTable.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_playAndSavesButtonCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_playAndSavesButtonCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_playButton_offFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_playButton_offFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_playButton_onFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_playButton_onFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_savesButton_offFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_savesButton_offFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_savesButton_onFocus.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_gameDetails_savesButton_onFocus.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettingsCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettingsCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_1_PixelPerfect.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_1_PixelPerfect.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_BoxArt.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_BoxArt.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_EvercadeOrigin.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_EvercadeOrigin.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_VS.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_VS.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_logoLegends.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_logoLegends.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_rachidLotf.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_rachidLotf.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_wireframe.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_bezel_wireframe.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_scanlines_none.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_scanlines_none.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_scanlines_strong.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_scanlines_strong.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_scanlines_subtle.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_2_4_3_scanlines_subtle.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_3_Fullscreen.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_DisplaySettings_AspectRatio_ScreenVisual_3_Fullscreen.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_LeftNavCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_inGameMenu_LeftNavCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_ASortButton.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_ASortButton.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_BSortButton.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_BSortButton.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Background.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Background.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_0bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_0bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_1bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_1bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_2bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_2bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_3bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_3bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_4bar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_4bar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_Charge.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Battery_Charge.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_BottomBar_GradientFade.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_BottomBar_GradientFade.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_BottomFade.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_BottomFade.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_CartHeaderSeparatingWhiteLine.jpg 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_CartHeaderSeparatingWhiteLine.jpg >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_CartHeaderSeparatingWhiteLine.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_CartHeaderSeparatingWhiteLine.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Error_BackButton.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Error_BackButton.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Error_BackButton_Cursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Error_BackButton_Cursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_EvercadeLogo.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_EvercadeLogo.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Scanlines.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Scanlines.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Spinner.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_Spinner.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_XSortButton.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_XSortButton.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_YSortButton.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_YSortButton.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_gamebox_onfocusCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_main_gamebox_onfocusCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_modalWindow_fade.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_modalWindow_fade.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_boxMain.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_boxMain.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_displayOptionsCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_displayOptionsCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_display_brightness_brightnessIcon.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_display_brightness_brightnessIcon.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_extraLongCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_extraLongCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_leftNavCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_leftNavCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_bottomBar.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_bottomBar.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_circleSlider.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_circleSlider.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_circleSliderCursor.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_circleSliderCursor.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_topBarLine.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_topBarLine.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_topBarEnd.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_slider_topBarEnd.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_sound_volumeIcon.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_sound_volumeIcon.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_theme_Modern.png 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/images/neon/neonHandheld_settings_theme_Modern.png >> temp\packfile.txt
echo file opt/menu/menu2.0/themes/EverSD/style.json 0644 0 0 temp/rootfs/opt/menu/menu2.0/themes/EverSD/style.json >> temp\packfile.txt
echo file opt/menu/menu2.0/fonts/RealityHyperRegular.ttf 0644 0 0 temp/rootfs/opt/menu/menu2.0/fonts/RealityHyperRegular.ttf >> temp\packfile.txt


:EXTRACTROOTFS
Echo PROGRESS_9_18
unsquashfs -n -d temp\rootfs temp\Image\rootfs.img
IF %ERRORLEVEL% NEQ 0 GOTO EREXTRACTROOTFS

:PATCHCREDITS
xcopy /y /H .patches\rootfs_patches\endcredits.txt temp\rootfs\opt\menu\menu2.0\files\ > nul
xcopy /y /H .patches\rootfs_patches\endcredits272.txt temp\rootfs\opt\menu\menu2.0\files\ > nul

:PATCHTHEME
xcopy /y /H .patches\rootfs_patches\RealityHyperRegular.ttf temp\rootfs\opt\menu\menu2.0\fonts\> nul
xcopy /y /H /E .patches\rootfs_patches\theme\ temp\rootfs\opt\menu\menu2.0\themes\ > nul

:PATCHBGM
xcopy /y /H .patches\rootfs_patches\bgm.ogg temp\rootfs\opt\menu\menu2.0\sounds\> nul

:PATCHSUPLEG
Echo PROGRESS_10_18
xcopy /y /H .patches\rootfs_patches\sup_legal.sh temp\rootfs\usr\bin\ > nul

IF %ERRORLEVEL% NEQ 0 GOTO ERPATCHSUPLEG

:PATCHROOTFS
Echo PROGRESS_11_18
xcopy /y /H .patches\rootfs_patches\61-usbdevice.rules temp\rootfs\lib\udev\rules.d\ > nul
IF %ERRORLEVEL% NEQ 0 GOTO ERPATCHROOTFS

:BOOTVIDSD
Echo PROGRESS_12_18
xcopy /y /H .patches\rootfs_patches\bootvideo\480x272\intro.mp4 temp\rootfs\opt\menu\ > nul
IF %ERRORLEVEL% NEQ 0 GOTO ERBOOTVIDSD

:BOOTVIDHD
Echo PROGRESS_13_18
xcopy /y /H .patches\rootfs_patches\bootvideo\1280x720\intro720.mp4 temp\rootfs\opt\menu\ > nul
IF %ERRORLEVEL% NEQ 0 GOTO ERBOOTVIDHD

:RETROARCH
Echo PROGRESS_14_18
xcopy /y /H .patches\rootfs_patches\retroarch2 temp\rootfs\usr\bin\ > nul
IF %ERRORLEVEL% NEQ 0 GOTO ERRETROARCH

:RETROARCHCONFIG
Echo PROGRESS_15_18
xcopy /y /H .patches\rootfs_patches\retroarch.cfg temp\rootfs\etc\ > nul
IF %ERRORLEVEL% NEQ 0 GOTO ERRETROARCHCONFIG

:PACKROOTFS
Echo PROGRESS_16_18
del /s /q temp\Image\rootfs.patched.img 2> nul
gensquashfs --quiet --pack-file temp\packfile.txt --compressor gzip temp\Image\rootfs.patched.img
IF %ERRORLEVEL% NEQ 0 GOTO ERPACKROOTFS

# :FLASHBOOT
# Echo PROGRESS_17_18
# echo Flashing boot
# rkdeveloptool wlx boot .patches\zboot.img
# IF %ERRORLEVEL% NEQ 0 GOTO ERFLASHBOOT

:FLASHROOTFS
Echo PROGRESS_18_18
rkdeveloptool wlx rootfs temp\Image\rootfs.patched.img
IF %ERRORLEVEL% NEQ 0 GOTO ERFLASHROOTFS
rkdeveloptool rd

:DONE
echo Deleting temporary files
rmdir /s /q temp 2> nul
CLS
Echo ----------------------------------------------------------
Echo ---------------------- Done, Enjoy! ----------------------
Echo ----------------------------------------------------------
Exit /B 0

rem ERRORLEVELS

:ERMKDIRTEMP
	Echo Could not create temp directory
	rmdir /s /q temp 2> nul
	Exit /B 1

:ERMKDIRIMAGE
	Echo Could not create temp/Image directory
	rmdir /s /q temp 2> nul
	Exit /B 2

:ERDUMPROOTFS
	Echo Error! Could not dump rootfs
	rmdir /s /q temp 2> nul
	Exit /B 3

:ERPACKFILE
	Echo Error! Could not create packfile
	rmdir /s /q temp 2> nul
	Exit /B 4

:ERPATCHSUPLEG
	Echo Error! Could not patch supleg
	rmdir /s /q temp 2> nul
	Exit /B 5

:EREXTRACTROOTFS
	Echo Error! Could not extract rootfs
	rmdir /s /q temp 2> nul
	Exit /B 6

:ERPATCHROOTFS
	Echo Error! Could not patch rootfs
	rmdir /s /q temp 2> nul
	Exit /B 7

:ERBOOTVIDSD
	Echo Error! Could not copy bootvideo_SD
	rmdir /s /q temp 2> nul
	Exit /B 8

:ERBOOTVIDHD
	Echo Error! Could not copy bootvideo_HD
	rmdir /s /q temp 2> nul
	Exit /B 9

:ERRETROARCH
	Echo Error! Could not copy retroarch to rootfs
	rmdir /s /q temp 2> nul
	Exit /B 10

:ERRETROARCHCONFIG
	Echo Error! Could not copy retroarch.cfg to rootfs
	rmdir /s /q temp 2> nul
	Exit /B 11

:ERPACKROOTFS
	Echo Error! Could not pack rootfs
	rmdir /s /q temp 2> nul
	Exit /B 12

:ERFLASHBOOT
	Echo Error! Could not flash kernel to Evercade
	rmdir /s /q temp 2> nul
	Exit /B 13

:ERFLASHROOTFS
	Echo Error! Could not flash rootfs to Evercade
	rmdir /s /q temp 2> nul
	Exit /B 14