ProjectArcade
738 строк · 21.4 Кб
1@echo off
2
3goto:rem
4---------------------------------------
5es-update.cmd
6---------------------------------------
7This Batch script is originally created for RetroBat and to be used by the Windows build of Batocera-EmulationStation.
8It exists in conjunction with other scripts to form an integrated update system within the EmulationStation interface.
9---------------------------------------
10:rem
11
12setlocal EnableDelayedExpansion
13cls
14echo preparing update... ^>^>^> 0%%
15
16set script_type=updater
17
18:: ---- DEBUG SWITCHES ----
19
20set enable_download=1
21set enable_extraction=1
22set download_retry=3
23set archive_format=zip
24set log_file=es-update.log
25set enable_log=1
26
27:: ---- SCRIPT ARGUMENTS ----
28
29set branch=stable
30
31:loop_arg
32
33if not "%1"=="" (
34
35if "%1"=="-branch" (
36
37set branch=%2
38shift
39)
40
41if "%1"=="-extract" (
42
43set extract_pkg=%2
44shift
45)
46
47shift
48goto :loop_arg
49)
50
51:: ---- GET STARTED ----
52
53set/A progress_percent=0
54
55set folder_list=(bios cheats decorations emulators library records roms saves screenshots sounds system)
56set file_list=(exe dat txt)
57set modules_list=(7za wget)
58set license_trusted_md5=91bd67de13479a57781336500d27541c
59
60if "%extract_pkg%"=="es" (
61call :set_root
62call :set_modules
63call :set_install
64
65set package_file=!name!-v!version_remote!.!archive_format!
66
67call :extract_es
68call :exit_door
69goto :eof
70)
71
72set/A task_computing=1
73if %task_computing% EQU 1 (
74
75if "%enable_download%" == "1" (call :download)
76call :check_hash
77if "%enable_extraction%" == "1" (call :extract)
78call :files_copy
79)
80
81if !task_total! GTR 0 ((set/A task_computing=0))
82
83if %task_computing% EQU 0 (
84
85call :set_root
86call :check_license
87call :set_modules
88call :set_install
89
90set package_file=!name!-v!version_remote!.!archive_format!
91set download_url=!archive_url!
92
93if "%enable_download%" == "1" (call :download)
94call :check_hash
95if "%enable_extraction%" == "1" (call :extract)
96call :files_copy
97call :exit_door
98goto :eof
99)
100
101if %task_computing% GTR 0 (
102
103(set exit_msg=fatal error)
104(set/A exit_code=4)
105call :exit_door
106goto :eof
107
108)
109
110:: ---- LABELS ----
111
112:: ---- DOWNLOAD ----
113
114:download
115
116if %task_computing% EQU 1 (
117(set/A task_total+=1)
118goto :eof
119)
120
121set task=download
122if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
123
124(set progress_text=downloading update)
125cls
126echo !progress_text!... ^>^>^> !progress_percent!%%
127
128if not exist "!download_path!\." md "!download_path!"
129
130"%modules_path%\wget" --continue --no-check-certificate --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t %download_retry% -P "%download_path%" %download_url%/%package_file% -q >nul
131"%modules_path%\wget" --continue --no-check-certificate --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t %download_retry% -P "!download_path!" %download_url%/%package_file%.sha256.txt -q >nul
132
133if not exist "!download_path!\!package_file!.sha256.txt" (
134
135(set/A exit_code=2)
136(set exit_msg=hash file not found)
137call :exit_door
138goto :eof
139)
140
141if not exist "!download_path!\!package_file!" (
142
143(set/A exit_code=2)
144(set exit_msg=update archive not found)
145call :exit_door
146goto :eof
147)
148
149(set/A task_count+=1)
150call :progress
151
152goto :eof
153
154:: ---- CHECK LICENSE ----
155
156:check_license
157
158((echo %date% %time% [INFO] License trusted MD5: %license_trusted_md5%)>> "!root_path!\emulationstation\%log_file%")
159
160if not exist "!root_path!\license.txt" (
161
162(set/A exit_code=2)
163(set exit_msg=license file is missing!)
164call :exit_door
165goto :eof
166
167)
168
169set "firstline=1"
170for /f "skip=1 delims=" %%i in ('certutil -hashfile "!root_path!\license.txt" md5') do (
171if [!firstline!]==[1] (
172(set license_current_md5=%%i)
173(set "firstline=0")
174)
175)
176
177((echo %date% %time% [INFO] License current MD5: %license_current_md5%)>> "!root_path!\emulationstation\%log_file%")
178
179if not "%license_current_md5%" == "%license_trusted_md5%" (
180
181(set/A exit_code=2)
182(set exit_msg=license file is corrupted!)
183call :exit_door
184goto :eof
185
186)
187
188goto :eof
189
190:: ---- CHECK HASH ----
191
192:check_hash
193
194if %task_computing% EQU 1 (
195(set/A task_total+=1)
196goto :eof
197)
198
199set task=check_hash
200if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
201
202set trusted_hash=0
203set file_hash=0
204(set progress_text=verifying update)
205cls
206echo !progress_text!... ^>^>^> !progress_percent!%%
207
208if exist "!download_path!\!package_file!.sha256.txt" (
209(set/P trusted_hash=<"!download_path!\!package_file!.sha256.txt")
210if %enable_log% EQU 1 ((echo %date% %time% [INFO] trusted_hash: !trusted_hash!)>> "!root_path!\emulationstation\%log_file%")
211)
212
213if not "%trusted_hash%" == "0" (
214
215if exist "!download_path!\!package_file!" (
216
217set "firstline=1"
218for /f "skip=1 delims=" %%i in ('certutil -hashfile "!download_path!\!package_file!" SHA256') do (
219if [!firstline!]==[1] (
220(set file_hash=%%i)
221if %enable_log% EQU 1 ((echo %date% %time% [INFO] file_hash: !file_hash!)>> "!root_path!\emulationstation\%log_file%")
222set "firstline=0"
223)
224)
225)
226)
227
228if not "%trusted_hash%" == "%file_hash%" (
229
230(set/A exit_code=2)
231(set exit_msg=corrupted update archive)
232call :exit_door
233goto :eof
234)
235
236(set/A task_count+=1)
237call :progress
238
239goto :eof
240
241:: ---- EXTRACTION ----
242
243:extract
244
245if %task_computing% EQU 1 (
246for %%i in %folder_list% do (
247
248(set/A task_total+=1)
249)
250
251for %%i in %file_list% do (
252
253(set/A task_total+=1)
254)
255
256goto :eof
257)
258
259set task=extract
260if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
261
262if exist "!download_path!\!package_file!" (
263
264(set progress_text=extracting update)
265cls
266echo !progress_text!... ^>^>^> !progress_percent!%%
267set destination_path=!root_path!
268if not exist "!extraction_path!\." md "!extraction_path!"
269
270if "!version_local!" == "5.0.0-stable-win64" (
271
272if exist "%emulators_path%\pcsx2\pcsx2x64.exe" ren "%emulators_path%\pcsx2" pcsx2-wxwidget-obsolete >nul
273
274if exist "%system_path%\configgen\*.list" del/Q "%system_path%\configgen\*.list"
275
276for %%i in (DEV9Hosts.ini GS.ini PAD.ini PCSX2_ui.ini PCSX2_vm.ini SPU2.ini) do (
277
278if exist "%system_path%\templates\pcsx2\inis\%%i" del/Q "%system_path%\templates\pcsx2\inis\%%i" >nul
279
280if exist "%emulationstation_path%\.emulationstation\es_input.cfg" (
281copy "%emulationstation_path%\.emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg.old" /Y >nul
282del/Q "%emulationstation_path%\.emulationstation\es_input.cfg" >nul
283copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
284)
285
286if exist "%emulators_path%\duckstation\duckstation-*.exe" ren "%emulators_path%\duckstation" duckstation-old >nul
287
288)
289)
290
291if "!version_local!" == "5.1.1-stable-win64" (
292
293if exist "%emulationstation_path%\.emulationstation\es_input.cfg" (
294copy "%emulationstation_path%\.emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg.old" /Y >nul
295del/Q "%emulationstation_path%\.emulationstation\es_input.cfg" >nul
296copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
297)
298
299if exist "%emulators_path%\duckstation\duckstation-*.exe" ren "%emulators_path%\duckstation" duckstation-old >nul
300)
301
302if "!version_local!" == "5.2.0-stable-win64" (
303
304if exist "%emulationstation_path%\.emulationstation\es_input.cfg" (
305copy "%emulationstation_path%\.emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg.old" /Y >nul
306del/Q "%emulationstation_path%\.emulationstation\es_input.cfg" >nul
307copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
308)
309
310if exist "%emulators_path%\duckstation\duckstation-*.exe" ren "%emulators_path%\duckstation" duckstation-old >nul
311)
312
313if "!version_local!" == "5.3.0-stable-win64" (
314
315if exist "%emulators_path%\retroarch\core\4do_libretro.dll" del/Q "%emulators_path%\retroarch\core\4do_libretro.dll" >nul
316if exist "%emulators_path%\retroarch\platforms\*.dll" del/Q "%emulators_path%\retroarch\platforms\*.dll" >nul
317if exist "%system_path%\modules\rb_launcher\*.dll" del/Q "%system_path%\modules\rb_launcher\*.dll"
318if exist "%system_path%\modules\rb_launcher\*.ift" del/Q "%system_path%\modules\rb_launcher\*.ift"
319if exist "%system_path%\modules\rb_launcher\*.mfx" del/Q "%system_path%\modules\rb_launcher\*.mfx"
320)
321
322if "!version_local!" == "6.0.0-20231001-beta-win64" (
323
324if exist "%emulators_path%\retroarch\core\4do_libretro.dll" del/Q "%emulators_path%\retroarch\core\4do_libretro.dll" >nul
325if exist "%emulators_path%\retroarch\platforms\*.dll" del/Q "%emulators_path%\retroarch\platforms\*.dll" >nul
326if exist "%system_path%\modules\rb_launcher\*.dll" del/Q "%system_path%\modules\rb_launcher\*.dll"
327if exist "%system_path%\modules\rb_launcher\*.ift" del/Q "%system_path%\modules\rb_launcher\*.ift"
328if exist "%system_path%\modules\rb_launcher\*.mfx" del/Q "%system_path%\modules\rb_launcher\*.mfx"
329)
330
331for %%i in %folder_list% do (
332
333"%modules_path%\7za.exe" -y x "!download_path!\!package_file!" -aoa -o"!extraction_path!" "%%i\*" >nul
334if %enable_log% EQU 1 ((echo %date% %time% [INFO] !label! "%%i" from "!download_path!\!package_file!" to "!extraction_path!")>> "!root_path!\emulationstation\%log_file%")
335(set/A task_count+=1)
336call :progress
337)
338
339for %%i in %file_list% do (
340
341"%modules_path%\7za.exe" -y x "!download_path!\!package_file!" -aoa -o"!extraction_path!" "*.%%i" >nul
342if %enable_log% EQU 1 ((echo %date% %time% [INFO] !label! "*.%%i" from "!download_path!\!package_file!" to "!extraction_path!")>> "!root_path!\emulationstation\%log_file%")
343(set/A task_count+=1)
344call :progress
345)
346)
347
348(set/A exit_code=2)
349goto :eof
350
351:: ---- FILES COPY ----
352
353:files_copy
354
355if %task_computing% EQU 1 (
356for %%i in %folder_list% do (
357
358(set/A task_total+=1)
359)
360
361for %%i in %file_list% do (
362
363(set/A task_total+=1)
364)
365
366goto :eof
367)
368
369set task=files_copy
370if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
371
372if not exist "!system_path!\configgen\exclude_emulators_files.lst" (
373(set/A exit_code=2)
374(set exit_msg=updater script is missing)
375call :exit_door
376goto :eof
377)
378
379(set progress_text=updating files)
380cls
381echo !progress_text!... ^>^>^> !progress_percent!%%
382
383if exist "%CD%\exclude.txt" del/Q "%CD%\exclude.txt" >nul
384
385copy "%system_path%\configgen\exclude_emulators_files.lst" "%CD%\exclude.txt" /Y >nul
386
387for %%i in %folder_list% do (
388
389if not exist "%extraction_path%\%%i\." md "%extraction_path%\%%i" >nul
390if exist "%extraction_path%\%%i\." (
391
392if "%%i" == "emulators" (
393
394xcopy "%extraction_path%\%%i" "!root_path!\%%i" /e /v /y /I /exclude:exclude.txt >nul
395if %ERRORLEVEL% NEQ 0 (
396set/A exit_code=%ERRORLEVEL%
397call :exit_door
398goto :eof
399)
400if %enable_log% EQU 1 ((echo %date% %time% [INFO] !task! from "%extraction_path%\%%i" to "!root_path!\%%i")>> "!root_path!\emulationstation\%log_file%")
401
402) else (
403
404xcopy "%extraction_path%\%%i" "!root_path!\%%i" /e /v /y /I >nul
405if %ERRORLEVEL% NEQ 0 (
406set/A exit_code=%ERRORLEVEL%
407call :exit_door
408goto :eof
409)
410if %enable_log% EQU 1 ((echo %date% %time% [INFO] !task! from "%extraction_path%\%%i" to "!root_path!\%%i")>> "!root_path!\emulationstation\%log_file%")
411)
412)
413
414for /f "usebackq delims=" %%x in ("%system_path%\configgen\exclude_emulators_files.lst") do (
415
416if not exist "%emulators_path%\%%x" copy "%extraction_path%\emulators\%%x" "%emulators_path%\%%x" /Y >nul
417)
418
419(set/A task_count+=1)
420call :progress
421)
422
423for %%i in %file_list% do (
424
425if exist "%extraction_path%\*.%%i" (
426
427xcopy "%extraction_path%\*.%%i" "!root_path!" /y >nul
428if %enable_log% EQU 1 ((echo %date% %time% [INFO] !task! "%extraction_path%\*.%%i" to "!root_path!")>> "!root_path!\emulationstation\%log_file%")
429
430)
431
432(set/A task_count+=1)
433call :progress
434)
435
436goto :eof
437
438:: ---- SET ROOT PATH ----
439
440:set_root
441
442set task=set_root
443
444set current_file=%~nx0
445set current_drive="%cd:~0,2%"
446set current_dir="%cd:~3%"
447set current_drive=%current_drive:"=%
448set current_dir=%current_dir:"=%
449set current_path=!current_drive!\!current_dir!
450set root_path=!current_path!
451
452set "reg_path=HKCU\Software\RetroBat"
453set "reg_key=LatestKnownInstallPath"
454
455reg query "HKCU\Software\RetroBat" /v "%reg_key%" >nul 2>&1
456
457if %ERRORLEVEL% EQU 0 (
458
459for /f "tokens=2* skip=2" %%a in ('reg query %reg_path% /v %reg_key%') do (
460
461set install_path=%%b
462set install_path=!install_path:~0,-1!
463)
464
465) else (
466
467(set/A exit_code=3)
468(set exit_msg=can't found install path)
469call :exit_door
470goto :eof
471)
472
473if %enable_log% EQU 1 (
474
475if not "%extract_pkg%" == "es" if not "%log_file%" == "" if exist "%CD%\%log_file%" del/Q "%CD%\%log_file%" >nul
476(echo %date% %time% [START] Run: !current_file!)>> "%CD%\%log_file%"
477(echo %date% %time% [LABEL] :!task!)>> "%CD%\%log_file%"
478(echo %date% %time% [INFO] Current Path: "!current_path!")>> "%CD%\%log_file%"
479(echo %date% %time% [INFO] Install Path: "!install_path!")>> "%CD%\%log_file%"
480)
481
482if not "!root_path!" == "!install_path!\emulationstation" (
483
484(set/A exit_code=3)
485(set exit_msg=install path mismatch)
486call :exit_door
487goto :eof
488
489) else (
490
491(set root_path=!install_path!)
492if %enable_log% EQU 1 ((echo %date% %time% [INFO] Root Path: "!root_path!")>> "!root_path!\emulationstation\%log_file%")
493
494)
495
496goto :eof
497
498:: ---- SET MODULES ----
499
500:set_modules
501
502set task=set_modules
503if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
504
505(set/A found_total=0)
506
507for %%i in %modules_list% do (
508
509(set/A found_%%i=0)
510(set/A found_total=!found_total!+1)
511(set package_name=%%i)
512(set modules_path=!root_path!\system\tools)
513
514if exist "!modules_path!\!package_name!.exe" ((set/A found_%%i=!found_%%i!+1))
515
516(set/A found_total=!found_total!-!found_%%i!)
517((echo %date% %time% [INFO] !package_name! Path: "!modules_path!\!package_name!.exe")>> "!root_path!\emulationstation\%log_file%")
518)
519
520if !found_total! NEQ 0 (
521
522(set/A exit_code=2)
523(set exit_msg=updater modules are missing)
524call :exit_door
525goto :eof
526)
527
528goto :eof
529
530:: ---- SET INSTALL INFOS ----
531
532:set_install
533
534set task=set_install
535if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
536
537:: ---- SET TMP FILE ----
538
539set "tmp_infos_file=!root_path!\emulationstation\rb_infos.tmp"
540if not "%tmp_infos_file%" == "" if exist "%tmp_infos_file%" del/Q "%tmp_infos_file%" >nul
541
542:: ---- CALL SHARED VARIABLES SCRIPT ----
543
544if exist "!root_path!\system\scripts\shared-variables.cmd" (
545
546cd "!root_path!\system\scripts"
547call shared-variables.cmd
548
549) else (
550
551(set/A exit_code=2)
552(set exit_msg=updater script is missing)
553call :exit_door
554goto :eof
555
556)
557
558:: ---- GET INFOS STORED IN TMP FILE ----
559
560if exist "%tmp_infos_file%" (
561
562for /f "delims=" %%x in ('type "%tmp_infos_file%"') do (set "%%x")
563
564) else (
565
566(set/A exit_code=2)
567(set exit_msg=updater script is missing)
568call :exit_door
569goto :eof
570)
571
572if %enable_log% EQU 1 (
573(echo %date% %time% [INFO] Current Version: %name%-%version_local%)>> "!root_path!\emulationstation\%log_file%"
574(echo %date% %time% [INFO] Available Version: %name%-%version_remote%)>> "!root_path!\emulationstation\%log_file%"
575(echo %date% %time% [INFO] Download Path: "!download_path!")>> "!root_path!\emulationstation\%log_file%"
576)
577
578:: ---- WINDOW TITLE ----
579
580title %name% updater script
581
582:: ---- KILL PROCESS ----
583
584:: Kill the process listed in kill_process.list if they are running
585
586if exist "!root_path!\retrobat.exe" "!root_path!\retrobat.exe" #killProcess
587
588goto :eof
589
590:: ---- CALCULATE PERCENTAGE TO OUTPUT ----
591
592:progress
593
594cls
595set/A progress_percent=100*!task_count!/task_total
596echo !progress_text!... ^>^>^> !progress_percent!%%
597
598goto :eof
599
600:: ---- EXTRACT ES ----
601
602:extract_es
603
604set task=extract_es
605if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
606
607if exist "%system_path%\scripts\exclude.txt" del/Q "%system_path%\scripts\exclude.txt" >nul
608
609if not exist "%system_path%\configgen\exclude_emulationstation_files.lst" (
610(set/A exit_code=2)
611(set exit_msg=updater script is missing)
612call :exit_door
613goto :eof
614)
615
616copy "%system_path%\configgen\exclude_emulationstation_files.lst" "%system_path%\scripts\exclude.txt" /Y >nul
617
618if exist "%download_path%\%package_file%" (
619
620if not exist "!extraction_path!\emulationstation\." md "!extraction_path!\emulationstation" >nul
621"%modules_path%\7za.exe" -y x "!download_path!\!package_file!" -aoa -o"!extraction_path!" "emulationstation\*" >nul
622set/A exit_code=%ERRORLEVEL%
623if !exit_code! NEQ 0 (
624(set exit_msg=failed to extract files)
625call :exit_door
626goto :eof
627)
628if %enable_log% EQU 1 ((echo %date% %time% [INFO] !task! from "%download_path%\%package_file%" to "!extraction_path!\emulationstation")>> "%root_path%\emulationstation\%log_file%")
629
630xcopy "%extraction_path%\emulationstation" "!root_path!\emulationstation" /e /v /y /I /exclude:exclude.txt >nul
631set/A exit_code=%ERRORLEVEL%
632if !exit_code! NEQ 0 (
633(set exit_msg=failed to copy files)
634call :exit_door
635goto :eof
636)
637
638if "!version_local!" == "5.0.0-stable-win64" (
639
640copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
641)
642
643if "!version_local!" == "5.1.1-stable-win64" (
644
645copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
646)
647
648if "!version_local!" == "5.2.0-stable-win64" (
649
650copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
651)
652
653if "!version_local!" == "5.3.0-stable-win64" (
654
655if exist "%system_path%\modules\rb_updater\." rmdir /s /q "%system_path%\modules\rb_updater" >nul
656if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon" "es-theme-carbon-old" >nul"
657if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master" "es-theme-carbon" >nul"
658)
659
660if "!version_local!" == "6.0.0-20231001-beta-win64" (
661
662if exist "%system_path%\modules\rb_updater\." rmdir /s /q "%system_path%\modules\rb_updater" >nul
663if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon" "es-theme-carbon-old" >nul"
664if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master" "es-theme-carbon" >nul"
665)
666
667if "!version_local!" == "6.0.0-20231030-beta-win64" (
668
669if exist "%system_path%\modules\rb_updater\." rmdir /s /q "%system_path%\modules\rb_updater" >nul
670if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon" "es-theme-carbon-old" >nul"
671if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master" "es-theme-carbon" >nul"
672)
673
674if %enable_log% EQU 1 ((echo %date% %time% [INFO] !task! from "%extraction_path%\emulationstation" to "%root_path%\emulationstation")>> "%root_path%\emulationstation\%log_file%")
675
676if !exit_code! EQU 0 (
677
678(set exit_msg=update complete!)
679if exist "!download_path!\!package_file!" (
680del/Q "!download_path!\!package_file!" >nul
681((echo %date% %time% [INFO] deleted "!download_path!\!package_file!")>> "%root_path%\emulationstation\%log_file%")
682)
683if exist "!download_path!\!package_file!.sha256.txt" (
684del/Q "!download_path!\!package_file!.sha256.txt" >nul
685((echo %date% %time% [INFO] deleted "!download_path!\!package_file!.sha256.txt")>> "%root_path%\emulationstation\%log_file%")
686)
687if exist "!extraction_path!\" rd /S /Q "!extraction_path!" >nul
688if exist "!system_path!\scripts\exclude.txt" del/Q "!system_path!\scripts\exclude.txt" >nul
689
690for %%i in (es-checkversion-test.exe es-update-test.exe) do (
691
692if exist "%emulationstation_path%\%%i" del/Q "%emulationstation_path%\%%i"
693)
694)
695)
696
697goto :eof
698
699:: ---- EXIT ----
700
701:exit_door
702
703(echo %exit_msg%)
704
705if %progress_percent% EQU 100 (
706
707if exist "%system_path%\scripts\exclude.txt" del/Q "%system_path%\scripts\exclude.txt" >nul
708if exist "%system_path%\scripts\exclude.txt" del/Q "%system_path%\scripts\exclude.txt" >nul
709
710if exist "%system_path%\templates\emulationstation\es_features.cfg" del/Q "%system_path%\templates\emulationstation\es_features.cfg" >nul
711if exist "%emulationstation_path%\.emulationstation\es_features.cfg" copy/Y "%emulationstation_path%\.emulationstation\es_features.cfg" "%system_path%\templates\emulationstation\es_features.cfg.default" >nul
712if exist "%emulationstation_path%\*.1" del/Q "%emulationstation_path%\*.1"
713
714curl -X POST http://127.0.0.1:1234/messagebox -H "Content-Type: text/plain" -d "Please close EmulationStation now and restart RetroBat to finish the update process. Open main menu and select 'QUIT' or press ALT+F4, then run retrobat.exe."
715
716(set/A exit_code=0)
717(set exit_msg=update done!)
718cls
719(echo !exit_msg!)
720)
721
722if %enable_log% EQU 1 (
723
724if "!task!" == "set_root" if !exit_code! EQU 1 (
725
726(echo %date% %time% [INFO] !exit_msg!)>> "%CD%\%log_file%"
727(echo %date% %time% [END] !exit_code!)>> "%CD%\%log_file%"
728
729)
730
731if not "!task!" == "set_root" (
732
733(echo %date% %time% [INFO] !exit_msg!)>> "!root_path!\emulationstation\%log_file%"
734(echo %date% %time% [END] !exit_code!)>> "!root_path!\emulationstation\%log_file%"
735)
736)
737
738exit !exit_code!