ProjectArcade
138 строк · 6.3 Кб
1goto:rem
2---------------------------------------
3shared-variables.cmd
4---------------------------------------
5This Batch script is originally created for RetroBat.
6It's not intended to run on its own but must be called by other scripts in order to share some common information required by them.
7---------------------------------------
8:rem
9
10:: ---- GENERAL INFOS ----
11set name=retrobat
12(echo name=%name%)>> "%tmp_infos_file%"
13
14:: ---- PROCESSOR ARCHITECTURE INFO ----
15
16Reg Query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" | find /i "AMD64" > nul && (set archx=x86_64) || (set archx=x86)
17
18if "%archx%"=="x86_64" (set arch=win64)
19if "%archx%"=="x86" (set arch=win32)
20(echo archx=%archx%)>> "%tmp_infos_file%"
21(echo arch=%arch%)>> "%tmp_infos_file%"
22
23:: ---- RETROBAT PATHS ----
24
25(set build_path=!root_path!\build)
26(echo build_path=!root_path!\build)>> "%tmp_infos_file%"
27if "%archx%"=="x86_64" (echo msys_path=%SystemDrive%\msys64)>> "%tmp_infos_file%"
28if "%archx%"=="x86" (echo msys_path=%SystemDrive%\msys)>> "%tmp_infos_file%"
29
30if not "%script_type%" == "builder" (
31
32(echo batgui_path=!root_path!)>> "%tmp_infos_file%"
33(echo batocera_ports_path=!root_path!\emulationstation)>> "%tmp_infos_file%"
34(echo bios_path=!root_path!\bios)>> "%tmp_infos_file%"
35(echo decorations_path=!root_path!\system\decorations)>> "%tmp_infos_file%"
36(echo default_theme_path=!root_path!\emulationstation\.emulationstation\themes)>> "%tmp_infos_file%"
37(echo download_path=!root_path!\system\download)>> "%tmp_infos_file%"
38(echo emulationstation_path=!root_path!\emulationstation)>> "%tmp_infos_file%"
39(echo emulators_path=!root_path!\emulators)>> "%tmp_infos_file%"
40(echo extraction_path=!root_path!\system\download\extract)>> "%tmp_infos_file%"
41(echo lrcores_path=!root_path!\emulators\retroarch\cores)>> "%tmp_infos_file%"
42(echo mega_bezels_path=!root_path!)>> "%tmp_infos_file%"
43(echo retroarch_path=!root_path!\emulators\retroarch)>> "%tmp_infos_file%"
44(echo retrobat_path=!root_path!)>> "%tmp_infos_file%"
45(echo retrobat_binaries_path=!root_path!)>> "%tmp_infos_file%"
46(echo roms_path=!root_path!\roms)>> "%tmp_infos_file%"
47(echo saves_path=!root_path!\saves)>> "%tmp_infos_file%"
48(echo shaders_path=!root_path!\system\shaders)>> "%tmp_infos_file%"
49(echo system_path=!root_path!\system)>> "%tmp_infos_file%"
50(echo wiimotegun_path=!root_path!\emulationstation)>> "%tmp_infos_file%"
51(echo modules_path=!root_path!\system\tools)>> "%tmp_infos_file%"
52
53) else (
54
55(echo batgui_path=!build_path!)>> "%tmp_infos_file%"
56(echo batocera_ports_path=!build_path!\emulationstation)>> "%tmp_infos_file%"
57(echo bios_path=!build_path!\bios)>> "%tmp_infos_file%"
58(echo decorations_path=!build_path!\system\decorations)>> "%tmp_infos_file%"
59(echo default_theme_path=!build_path!\emulationstation\.emulationstation\themes)>> "%tmp_infos_file%"
60(echo download_path=!build_path!\system\download)>> "%tmp_infos_file%"
61(echo emulationstation_path=!build_path!\emulationstation)>> "%tmp_infos_file%"
62(echo emulators_path=!build_path!\emulators)>> "%tmp_infos_file%"
63(echo extraction_path=!build_path!\system\download\extract)>> "%tmp_infos_file%"
64(echo lrcores_path=!build_path!\emulators\retroarch\cores)>> "%tmp_infos_file%"
65(echo mega_bezels_path=!build_path!)>> "%tmp_infos_file%"
66(echo retroarch_path=!build_path!\emulators\retroarch)>> "%tmp_infos_file%"
67(echo retrobat_path=!build_path!)>> "%tmp_infos_file%"
68(echo retrobat_binaries_path=!build_path!)>> "%tmp_infos_file%"
69(echo roms_path=!build_path!\roms)>> "%tmp_infos_file%"
70(echo saves_path=!build_path!\saves)>> "%tmp_infos_file%"
71(echo shaders_path=!build_path!\system\shaders)>> "%tmp_infos_file%"
72(echo system_path=!build_path!\system)>> "%tmp_infos_file%"
73(echo wiimotegun_path=!build_path!\emulationstation)>> "%tmp_infos_file%"
74(echo modules_path=!root_path!\system\tools)>> "%tmp_infos_file%"
75)
76
77:: ---- URLS ----
78
79set installroot_url=https://www.retrobat.ovh
80
81if not "%script_type%" == "builder" (
82
83(echo archive_url=%installroot_url%/repo/%arch%/%branch%/archives)>> "%tmp_infos_file%"
84
85) else (
86
87(echo batgui_url=%installroot_url%/repo/%arch%/%branch%)>> "%tmp_infos_file%"
88(echo batocera_ports_url=https://github.com/RetroBat-Official/emulatorlauncher/releases/download/continuous)>> "%tmp_infos_file%"
89(echo emulationstation_url=https://github.com/RetroBat-Official/emulationstation/releases/download/continuous-master)>> "%tmp_infos_file%"
90(echo emulators_url=%installroot_url%/repo/%arch%/%branch%/emulators)>> "%tmp_infos_file%"
91(echo lrcores_url=https://buildbot.libretro.com/nightly/windows/%archx%/latest)>> "%tmp_infos_file%"
92(echo mega_bezels_url=%installroot_url%/repo/medias)>> "%tmp_infos_file%"
93(echo retroarch_url=https://buildbot.libretro.com/stable/%retroarch_version%/windows/%archx%)>> "%tmp_infos_file%"
94(echo retrobat_binaries_url=%installroot_url%/repo/tools)>> "%tmp_infos_file%"
95(echo wiimotegun_url=https://github.com/fabricecaruso/WiimoteGun/releases/download/v1.0)>> "%tmp_infos_file%"
96(echo default_theme_url=https://github.com/fabricecaruso/es-theme-carbon/archive/refs/heads/)>> "%tmp_infos_file%"
97
98)
99
100:: ---- SET VERSIONS ----
101
102set version_file_local=version.info
103set version_file_remote=remote_version.info
104
105if exist "%root_path%\emulationstation\%version_file_local%" (
106
107set/P version_local=<"%root_path%\emulationstation\%version_file_local%"
108echo version_local=!version_local!>> "%tmp_infos_file%"
109)
110
111if not "%script_type%" == "builder" if not "%extract_pkg%" == "es" (
112
113if exist "%root_path%\system\tools\%version_file_remote%" del/Q "%root_path%\system\tools\%version_file_remote%" >nul
114if exist "%root_path%\system\tools\%version_file_remote%.*" del/Q "%root_path%\system\tools\%version_file_remote%.*" >nul
115"%root_path%\system\tools\wget" --no-check-certificate --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 3 -P "%root_path%\system\tools" %installroot_url%/repo/%arch%/%branch%/%version_local%/%version_file_remote% -q
116
117if not exist "%root_path%\system\tools\%version_file_remote%" (
118
119(set exit_msg=error: missing version file)
120(set/A exit_code=2)
121goto :eof
122
123) else (
124
125(set/A exit_code=0)
126)
127)
128
129if exist "%root_path%\system\tools\%version_file_remote%" (
130
131set/P version_remote=<"%root_path%\system\tools\%version_file_remote%"
132(echo version_remote=!version_remote!)>> "%tmp_infos_file%"
133
134)
135
136:: ---- GO BACK TO PARENT SCRIPT ----
137
138goto :eof
139