ProjectArcade

Форк
0
738 строк · 21.4 Кб
1
@echo off
2

3
goto:rem
4
---------------------------------------
5
es-update.cmd
6
---------------------------------------
7
This Batch script is originally created for RetroBat and to be used by the Windows build of Batocera-EmulationStation.
8
It exists in conjunction with other scripts to form an integrated update system within the EmulationStation interface.
9
---------------------------------------
10
:rem
11

12
setlocal EnableDelayedExpansion
13
cls
14
echo preparing update... ^>^>^> 0%%
15

16
set script_type=updater
17

18
:: ---- DEBUG SWITCHES ----
19

20
set enable_download=1
21
set enable_extraction=1
22
set download_retry=3
23
set archive_format=zip
24
set log_file=es-update.log
25
set enable_log=1
26

27
:: ---- SCRIPT ARGUMENTS ----
28

29
set branch=stable
30

31
:loop_arg
32

33
if not "%1"=="" (
34

35
    if "%1"=="-branch" (
36
	
37
        set branch=%2
38
        shift
39
    )
40
	
41
	if "%1"=="-extract" (
42
	
43
        set extract_pkg=%2
44
        shift
45
    )
46
	
47
	shift	
48
    goto :loop_arg
49
)
50

51
:: ---- GET STARTED ----
52

53
set/A progress_percent=0
54

55
set folder_list=(bios cheats decorations emulators library records roms saves screenshots sounds system)
56
set file_list=(exe dat txt)
57
set modules_list=(7za wget)
58
set license_trusted_md5=91bd67de13479a57781336500d27541c
59

60
if "%extract_pkg%"=="es" (
61
	call :set_root
62
	call :set_modules
63
	call :set_install
64
	
65
	set package_file=!name!-v!version_remote!.!archive_format!
66
	
67
	call :extract_es
68
	call :exit_door
69
	goto :eof
70
)
71

72
set/A task_computing=1
73
if %task_computing% EQU 1 (
74

75
	if "%enable_download%" == "1" (call :download)
76
	call :check_hash
77
	if "%enable_extraction%" == "1" (call :extract)
78
	call :files_copy
79
)
80

81
if !task_total! GTR 0 ((set/A task_computing=0))
82

83
if %task_computing% EQU 0 (
84

85
	call :set_root
86
	call :check_license
87
	call :set_modules
88
	call :set_install
89

90
	set package_file=!name!-v!version_remote!.!archive_format!
91
	set download_url=!archive_url!
92

93
	if "%enable_download%" == "1" (call :download)
94
	call :check_hash
95
	if "%enable_extraction%" == "1" (call :extract)
96
	call :files_copy
97
	call :exit_door
98
	goto :eof
99
)
100

101
if %task_computing% GTR 0 (
102

103
	(set exit_msg=fatal error)
104
	(set/A exit_code=4)
105
	call :exit_door
106
	goto :eof
107

108
)
109

110
:: ---- LABELS ----
111

112
:: ---- DOWNLOAD ----
113

114
:download
115

116
if %task_computing% EQU 1 (
117
	(set/A task_total+=1)
118
	goto :eof
119
)
120

121
set task=download
122
if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
123

124
(set progress_text=downloading update)
125
cls
126
echo !progress_text!... ^>^>^> !progress_percent!%%
127

128
if 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

133
if not exist "!download_path!\!package_file!.sha256.txt" (
134

135
	(set/A exit_code=2)
136
	(set exit_msg=hash file not found)
137
	call :exit_door
138
	goto :eof	
139
)
140

141
if not exist "!download_path!\!package_file!" (
142

143
	(set/A exit_code=2)
144
	(set exit_msg=update archive not found)
145
	call :exit_door
146
	goto :eof	
147
)
148

149
(set/A task_count+=1)
150
call :progress
151

152
goto :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

160
if not exist "!root_path!\license.txt" (
161

162
	(set/A exit_code=2)
163
	(set exit_msg=license file is missing!)
164
	call :exit_door
165
	goto :eof
166

167
)
168

169
set "firstline=1"
170
for /f "skip=1 delims=" %%i in ('certutil -hashfile "!root_path!\license.txt" md5') do (
171
	if [!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

179
if not "%license_current_md5%" == "%license_trusted_md5%" (
180

181
	(set/A exit_code=2)
182
	(set exit_msg=license file is corrupted!)
183
	call :exit_door
184
	goto :eof
185

186
)
187

188
goto :eof
189

190
:: ---- CHECK HASH ----
191

192
:check_hash
193

194
if %task_computing% EQU 1 (
195
	(set/A task_total+=1)
196
	goto :eof
197
)
198

199
set task=check_hash
200
if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
201

202
set trusted_hash=0
203
set file_hash=0
204
(set progress_text=verifying update)
205
cls
206
echo !progress_text!... ^>^>^> !progress_percent!%%
207

208
if exist "!download_path!\!package_file!.sha256.txt" (
209
	(set/P trusted_hash=<"!download_path!\!package_file!.sha256.txt")
210
	if %enable_log% EQU 1 ((echo %date% %time% [INFO] trusted_hash: !trusted_hash!)>> "!root_path!\emulationstation\%log_file%")
211
)
212

213
if not "%trusted_hash%" == "0" (
214

215
	if exist "!download_path!\!package_file!" (
216

217
		set "firstline=1"
218
		for /f "skip=1 delims=" %%i in ('certutil -hashfile "!download_path!\!package_file!" SHA256') do (
219
			if [!firstline!]==[1] (
220
				(set file_hash=%%i)
221
				if %enable_log% EQU 1 ((echo %date% %time% [INFO] file_hash: !file_hash!)>> "!root_path!\emulationstation\%log_file%")
222
				set "firstline=0"
223
			)
224
		)
225
	)
226
)
227

228
if not "%trusted_hash%" == "%file_hash%" (
229

230
	(set/A exit_code=2)
231
	(set exit_msg=corrupted update archive)
232
	call :exit_door
233
	goto :eof
234
)
235

236
(set/A task_count+=1)
237
call :progress
238

239
goto :eof
240

241
:: ---- EXTRACTION ----
242

243
:extract
244

245
if %task_computing% EQU 1 (
246
	for %%i in %folder_list% do (
247
	
248
		(set/A task_total+=1)
249
	)
250
	
251
	for %%i in %file_list% do (
252
	
253
		(set/A task_total+=1)
254
	)
255
	
256
	goto :eof
257
)
258

259
set task=extract
260
if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
261

262
if exist "!download_path!\!package_file!" (
263

264
	(set progress_text=extracting update)
265
	cls
266
	echo !progress_text!... ^>^>^> !progress_percent!%%
267
	set destination_path=!root_path!
268
	if not exist "!extraction_path!\." md "!extraction_path!"
269
	
270
	if "!version_local!" == "5.0.0-stable-win64" (
271
	
272
		if exist "%emulators_path%\pcsx2\pcsx2x64.exe" ren "%emulators_path%\pcsx2" pcsx2-wxwidget-obsolete >nul
273
		
274
		if exist "%system_path%\configgen\*.list" del/Q "%system_path%\configgen\*.list"
275
		
276
		for %%i in (DEV9Hosts.ini GS.ini PAD.ini PCSX2_ui.ini PCSX2_vm.ini SPU2.ini) do (
277
	
278
		if exist "%system_path%\templates\pcsx2\inis\%%i" del/Q "%system_path%\templates\pcsx2\inis\%%i" >nul
279
		
280
		if exist "%emulationstation_path%\.emulationstation\es_input.cfg" (
281
			copy "%emulationstation_path%\.emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg.old" /Y >nul
282
			del/Q "%emulationstation_path%\.emulationstation\es_input.cfg" >nul
283
			copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
284
		)
285
		
286
		if exist "%emulators_path%\duckstation\duckstation-*.exe" ren "%emulators_path%\duckstation" duckstation-old >nul
287
		
288
		)
289
	)
290
	
291
	if "!version_local!" == "5.1.1-stable-win64" (
292
		
293
		if exist "%emulationstation_path%\.emulationstation\es_input.cfg" (
294
			copy "%emulationstation_path%\.emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg.old" /Y >nul
295
			del/Q "%emulationstation_path%\.emulationstation\es_input.cfg" >nul
296
			copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
297
		)
298
		
299
		if exist "%emulators_path%\duckstation\duckstation-*.exe" ren "%emulators_path%\duckstation" duckstation-old >nul
300
	)
301
	
302
	if "!version_local!" == "5.2.0-stable-win64" (
303
		
304
		if exist "%emulationstation_path%\.emulationstation\es_input.cfg" (
305
			copy "%emulationstation_path%\.emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg.old" /Y >nul
306
			del/Q "%emulationstation_path%\.emulationstation\es_input.cfg" >nul
307
			copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
308
		)
309
		
310
		if exist "%emulators_path%\duckstation\duckstation-*.exe" ren "%emulators_path%\duckstation" duckstation-old >nul
311
	)
312
	
313
	if "!version_local!" == "5.3.0-stable-win64" (
314
	
315
		if exist "%emulators_path%\retroarch\core\4do_libretro.dll" del/Q "%emulators_path%\retroarch\core\4do_libretro.dll" >nul
316
		if exist "%emulators_path%\retroarch\platforms\*.dll" del/Q "%emulators_path%\retroarch\platforms\*.dll" >nul
317
		if exist "%system_path%\modules\rb_launcher\*.dll" del/Q "%system_path%\modules\rb_launcher\*.dll"
318
		if exist "%system_path%\modules\rb_launcher\*.ift" del/Q "%system_path%\modules\rb_launcher\*.ift"
319
		if exist "%system_path%\modules\rb_launcher\*.mfx" del/Q "%system_path%\modules\rb_launcher\*.mfx"
320
	)
321
	
322
	if "!version_local!" == "6.0.0-20231001-beta-win64" (
323
	
324
		if exist "%emulators_path%\retroarch\core\4do_libretro.dll" del/Q "%emulators_path%\retroarch\core\4do_libretro.dll" >nul
325
		if exist "%emulators_path%\retroarch\platforms\*.dll" del/Q "%emulators_path%\retroarch\platforms\*.dll" >nul
326
		if exist "%system_path%\modules\rb_launcher\*.dll" del/Q "%system_path%\modules\rb_launcher\*.dll"
327
		if exist "%system_path%\modules\rb_launcher\*.ift" del/Q "%system_path%\modules\rb_launcher\*.ift"
328
		if exist "%system_path%\modules\rb_launcher\*.mfx" del/Q "%system_path%\modules\rb_launcher\*.mfx"
329
	)
330
	
331
	for %%i in %folder_list% do (
332
	
333
		"%modules_path%\7za.exe" -y x "!download_path!\!package_file!" -aoa -o"!extraction_path!" "%%i\*" >nul
334
		if %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)
336
		call :progress
337
	)
338
	
339
	for %%i in %file_list% do (
340
	
341
		"%modules_path%\7za.exe" -y x "!download_path!\!package_file!" -aoa -o"!extraction_path!" "*.%%i" >nul
342
		if %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)
344
		call :progress
345
	)
346
)
347

348
(set/A exit_code=2)
349
goto :eof
350

351
:: ---- FILES COPY ----
352

353
:files_copy
354

355
if %task_computing% EQU 1 (
356
	for %%i in %folder_list% do (
357
	
358
		(set/A task_total+=1)
359
	)
360
	
361
	for %%i in %file_list% do (
362
	
363
		(set/A task_total+=1)
364
	)
365
	
366
	goto :eof	
367
)
368

369
set task=files_copy
370
if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
371

372
if not exist "!system_path!\configgen\exclude_emulators_files.lst" (
373
	(set/A exit_code=2)
374
	(set exit_msg=updater script is missing)
375
	call :exit_door
376
	goto :eof
377
)
378

379
(set progress_text=updating files)
380
cls
381
echo !progress_text!... ^>^>^> !progress_percent!%%
382

383
if exist "%CD%\exclude.txt" del/Q "%CD%\exclude.txt" >nul
384

385
copy "%system_path%\configgen\exclude_emulators_files.lst" "%CD%\exclude.txt" /Y >nul
386

387
for %%i in %folder_list% do (
388
	
389
	if not exist "%extraction_path%\%%i\." md "%extraction_path%\%%i" >nul
390
	if exist "%extraction_path%\%%i\." (
391
	
392
		if "%%i" == "emulators" (
393
		
394
			xcopy "%extraction_path%\%%i" "!root_path!\%%i" /e /v /y /I /exclude:exclude.txt >nul
395
			if %ERRORLEVEL% NEQ 0 (
396
				set/A exit_code=%ERRORLEVEL%
397
				call :exit_door
398
				goto :eof
399
			)
400
			if %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
		
404
			xcopy "%extraction_path%\%%i" "!root_path!\%%i" /e /v /y /I >nul
405
			if %ERRORLEVEL% NEQ 0 (
406
				set/A exit_code=%ERRORLEVEL%
407
				call :exit_door
408
				goto :eof
409
			)
410
			if %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
	
414
	for /f "usebackq delims=" %%x in ("%system_path%\configgen\exclude_emulators_files.lst") do (
415
	
416
		if not exist "%emulators_path%\%%x" copy "%extraction_path%\emulators\%%x" "%emulators_path%\%%x" /Y >nul
417
	)
418
	
419
	(set/A task_count+=1)
420
	call :progress
421
)
422

423
for %%i in %file_list% do (
424

425
	if exist "%extraction_path%\*.%%i" (
426
	
427
		xcopy "%extraction_path%\*.%%i" "!root_path!" /y >nul
428
		if %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)
433
	call :progress
434
)
435

436
goto :eof
437

438
:: ---- SET ROOT PATH ----
439

440
:set_root
441

442
set task=set_root
443

444
set current_file=%~nx0
445
set current_drive="%cd:~0,2%"
446
set current_dir="%cd:~3%"
447
set current_drive=%current_drive:"=%
448
set current_dir=%current_dir:"=%
449
set current_path=!current_drive!\!current_dir!
450
set root_path=!current_path!
451

452
set "reg_path=HKCU\Software\RetroBat"
453
set "reg_key=LatestKnownInstallPath"
454

455
reg query "HKCU\Software\RetroBat" /v "%reg_key%" >nul 2>&1
456

457
if %ERRORLEVEL% EQU 0 (
458

459
	for /f "tokens=2* skip=2" %%a in ('reg query %reg_path% /v %reg_key%') do (
460
		
461
		set install_path=%%b
462
		set 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)
469
	call :exit_door
470
	goto :eof
471
)
472

473
if %enable_log% EQU 1 (
474

475
	if 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

482
if not "!root_path!" == "!install_path!\emulationstation" (
483

484
	(set/A exit_code=3)
485
	(set exit_msg=install path mismatch)
486
	call :exit_door
487
	goto :eof
488

489
) else (
490

491
	(set root_path=!install_path!)
492
	if %enable_log% EQU 1 ((echo %date% %time% [INFO] Root Path: "!root_path!")>> "!root_path!\emulationstation\%log_file%")
493
	
494
)
495

496
goto :eof
497

498
:: ---- SET MODULES ----
499

500
:set_modules
501

502
set task=set_modules
503
if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
504

505
(set/A found_total=0)
506

507
for %%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
	
514
	if 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

520
if !found_total! NEQ 0 (
521
	
522
	(set/A exit_code=2)
523
	(set exit_msg=updater modules are missing)
524
	call :exit_door
525
	goto :eof
526
)
527

528
goto :eof
529

530
:: ---- SET INSTALL INFOS ----
531

532
:set_install
533

534
set task=set_install
535
if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
536

537
:: ---- SET TMP FILE ----
538

539
set "tmp_infos_file=!root_path!\emulationstation\rb_infos.tmp"
540
if not "%tmp_infos_file%" == "" if exist "%tmp_infos_file%" del/Q "%tmp_infos_file%" >nul
541

542
:: ---- CALL SHARED VARIABLES SCRIPT ----
543

544
if exist "!root_path!\system\scripts\shared-variables.cmd" (
545

546
	cd "!root_path!\system\scripts"
547
	call shared-variables.cmd
548
	
549
) else (
550

551
	(set/A exit_code=2)
552
	(set exit_msg=updater script is missing)
553
	call :exit_door
554
	goto :eof
555

556
)
557

558
:: ---- GET INFOS STORED IN TMP FILE ----
559

560
if exist "%tmp_infos_file%" (
561

562
	for /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)
568
	call :exit_door
569
	goto :eof
570
)
571

572
if %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

580
title %name% updater script
581

582
:: ---- KILL PROCESS ----
583

584
:: Kill the process listed in kill_process.list if they are running
585

586
if exist "!root_path!\retrobat.exe" "!root_path!\retrobat.exe" #killProcess
587

588
goto :eof
589

590
:: ---- CALCULATE PERCENTAGE TO OUTPUT ----
591

592
:progress
593

594
cls
595
set/A progress_percent=100*!task_count!/task_total
596
echo !progress_text!... ^>^>^> !progress_percent!%%
597

598
goto :eof
599

600
:: ---- EXTRACT ES ----
601

602
:extract_es
603

604
set task=extract_es
605
if %enable_log% EQU 1 ((echo %date% %time% [LABEL] :!task!)>> "!root_path!\emulationstation\%log_file%")
606

607
if exist "%system_path%\scripts\exclude.txt" del/Q "%system_path%\scripts\exclude.txt" >nul
608

609
if not exist "%system_path%\configgen\exclude_emulationstation_files.lst" (
610
	(set/A exit_code=2)
611
	(set exit_msg=updater script is missing)
612
	call :exit_door
613
	goto :eof
614
)
615

616
copy "%system_path%\configgen\exclude_emulationstation_files.lst" "%system_path%\scripts\exclude.txt" /Y >nul
617

618
if exist "%download_path%\%package_file%" (
619

620
	if 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
622
	set/A exit_code=%ERRORLEVEL%
623
	if !exit_code! NEQ 0 (
624
		(set exit_msg=failed to extract files)
625
		call :exit_door
626
		goto :eof
627
	)
628
	if %enable_log% EQU 1 ((echo %date% %time% [INFO] !task! from "%download_path%\%package_file%" to "!extraction_path!\emulationstation")>> "%root_path%\emulationstation\%log_file%")
629

630
	xcopy "%extraction_path%\emulationstation" "!root_path!\emulationstation" /e /v /y /I /exclude:exclude.txt >nul
631
	set/A exit_code=%ERRORLEVEL%
632
	if !exit_code! NEQ 0 (
633
		(set exit_msg=failed to copy files)
634
		call :exit_door
635
		goto :eof
636
	)
637
	
638
	if "!version_local!" == "5.0.0-stable-win64" (
639
	
640
		copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
641
	)
642
	
643
	if "!version_local!" == "5.1.1-stable-win64" (
644
	
645
		copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
646
	)
647
	
648
	if "!version_local!" == "5.2.0-stable-win64" (
649
	
650
		copy "%system_path%\templates\emulationstation\es_input.cfg" "%emulationstation_path%\.emulationstation\es_input.cfg" /Y >nul
651
	)
652
	
653
	if "!version_local!" == "5.3.0-stable-win64" (
654
	
655
		if exist "%system_path%\modules\rb_updater\." rmdir /s /q "%system_path%\modules\rb_updater" >nul
656
		if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon" "es-theme-carbon-old" >nul"
657
		if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master" "es-theme-carbon" >nul"
658
	)
659
	
660
	if "!version_local!" == "6.0.0-20231001-beta-win64" (
661
	
662
		if exist "%system_path%\modules\rb_updater\." rmdir /s /q "%system_path%\modules\rb_updater" >nul
663
		if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon" "es-theme-carbon-old" >nul"
664
		if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master" "es-theme-carbon" >nul"
665
	)
666

667
	if "!version_local!" == "6.0.0-20231030-beta-win64" (
668
	
669
		if exist "%system_path%\modules\rb_updater\." rmdir /s /q "%system_path%\modules\rb_updater" >nul
670
		if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon" "es-theme-carbon-old" >nul"
671
		if exist "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master\." ren "%emulationstation_path%\.emulationstation\themes\es-theme-carbon-master" "es-theme-carbon" >nul"
672
	)
673
	
674
	if %enable_log% EQU 1 ((echo %date% %time% [INFO] !task! from "%extraction_path%\emulationstation" to "%root_path%\emulationstation")>> "%root_path%\emulationstation\%log_file%")
675

676
	if !exit_code! EQU 0 (
677
	
678
		(set exit_msg=update complete!)
679
		if exist "!download_path!\!package_file!" (
680
			del/Q "!download_path!\!package_file!" >nul
681
			((echo %date% %time% [INFO] deleted "!download_path!\!package_file!")>> "%root_path%\emulationstation\%log_file%")
682
		)
683
		if exist "!download_path!\!package_file!.sha256.txt" (
684
			del/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
		)
687
		if exist "!extraction_path!\" rd /S /Q "!extraction_path!" >nul
688
		if exist "!system_path!\scripts\exclude.txt" del/Q "!system_path!\scripts\exclude.txt" >nul
689
		
690
		for %%i in (es-checkversion-test.exe es-update-test.exe) do (
691
		
692
			if exist "%emulationstation_path%\%%i" del/Q "%emulationstation_path%\%%i"
693
		)
694
	)
695
)
696

697
goto :eof
698

699
:: ---- EXIT ----
700

701
:exit_door
702

703
(echo %exit_msg%)
704

705
if %progress_percent% EQU 100 (
706

707
	if exist "%system_path%\scripts\exclude.txt" del/Q "%system_path%\scripts\exclude.txt" >nul
708
	if exist "%system_path%\scripts\exclude.txt" del/Q "%system_path%\scripts\exclude.txt" >nul
709
	
710
	if exist "%system_path%\templates\emulationstation\es_features.cfg" del/Q "%system_path%\templates\emulationstation\es_features.cfg" >nul
711
	if exist "%emulationstation_path%\.emulationstation\es_features.cfg" copy/Y "%emulationstation_path%\.emulationstation\es_features.cfg" "%system_path%\templates\emulationstation\es_features.cfg.default" >nul
712
	if exist "%emulationstation_path%\*.1" del/Q "%emulationstation_path%\*.1"
713
	
714
	curl -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!)
718
	cls
719
	(echo !exit_msg!)
720
)
721

722
if %enable_log% EQU 1 (
723

724
	if "!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
	
731
	if 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

738
exit !exit_code!

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.