-
Notifications
You must be signed in to change notification settings - Fork 284
/
libretro-build-database.sh
executable file
·387 lines (343 loc) · 15.4 KB
/
libretro-build-database.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
#! /usr/bin/env bash
# vim: set ts=3 sw=3 noet ft=sh : bash
# BSDs don't have readlink -f
read_link()
{
TARGET_FILE="$1"
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=$(readlink "$TARGET_FILE")
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
done
PHYS_DIR=$(pwd -P)
RESULT="$PHYS_DIR/$TARGET_FILE"
echo $RESULT
}
SCRIPT=$(read_link "$0")
echo "Script: $SCRIPT"
BASE_DIR=$(dirname "$SCRIPT")
LIBRETRODATABASE_BASE_DIR="$BASE_DIR/retroarch/media/libretrodb"
RDB_DIR="${LIBRETRODATABASE_BASE_DIR}/rdb"
LIBRETRODB_BASE_DIR=retroarch/libretro-db
LIBRETRODATABASE_DAT_DIR=${LIBRETRODATABASE_BASE_DIR}/dat
LIBRETRODATABASE_META_DAT_DIR=${LIBRETRODATABASE_BASE_DIR}/metadat
die()
{
echo $1
#exit 1
}
echo $LIBRETRODB_BASE
build_libretrodb() {
cd "$BASE_DIR"
if [ -d "$LIBRETRODB_BASE_DIR" ]; then
echo "=== Building libretrodb ==="
cd "${LIBRETRODB_BASE_DIR}"
if [ -z "${NOCLEAN}" ]; then
make -j$JOBS clean || die "Failed to clean ${2}"
fi
make -j$JOBS || die "Failed to build ${2}"
fi
}
# $1 is name
# $2 is match key
build_libretro_database() {
cd "$BASE_DIR"
if [ -d "$LIBRETRODB_BASE_DIR" ]; then
DBFILE=${BASE_DIR}/${LIBRETRODB_BASE_DIR}/db.rdb
cd "${LIBRETRODB_BASE_DIR}"
echo "${1}.rdb"
COMMAND='${BASE_DIR}/${LIBRETRODB_BASE_DIR}/c_converter ${DBFILE} "${2}"'
#Check if meta DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/${1}.dat"'
fi
#Check if meta goodtools is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/goodtools/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/goodtools/${1}.dat"'
fi
#Check if meta analog DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/analog/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/analog/${1}.dat"'
fi
#Check if meta barcode DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/barcode/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/barcode/${1}.dat"'
fi
#Check if meta BBFC DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/bbfc/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/bbfc/${1}.dat"'
fi
#Check if meta developer DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/developer/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/developer/${1}.dat"'
fi
#Check if meta ELSPA DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/elspa/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/elspa/${1}.dat"'
fi
#Check if meta ESRB DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/esrb/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/esrb/${1}.dat"'
fi
#Check if meta franchise DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/franchise/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/franchise/${1}.dat"'
fi
#Check if meta Famitsu magazine DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/magazine/famitsu/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/magazine/famitsu/${1}.dat"'
fi
#Check if meta Edge magazine DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/magazine/edge/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/magazine/edge/${1}.dat"'
fi
#Check if meta Edge magazine review DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/magazine/edge_review/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/magazine/edge_review/${1}.dat"'
fi
#Check if meta maxusers DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/maxusers/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/maxusers/${1}.dat"'
fi
#Check if meta origin DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/origin/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/origin/${1}.dat"'
fi
#Check if meta publisher DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/publisher/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/publisher/${1}.dat"'
fi
#Check if meta releasemonth DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/releasemonth/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/releasemonth/${1}.dat"'
fi
#Check if meta releaseyear DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/releaseyear/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/releaseyear/${1}.dat"'
fi
#Check if meta genre DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/genre/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/genre/${1}.dat"'
fi
#Check if meta rumble DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/rumble/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/rumble/${1}.dat"'
fi
#Check if meta serial DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/serial/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/serial/${1}.dat"'
fi
#Check if meta enhancement HW DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/enhancement_hw/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/enhancement_hw/${1}.dat"'
fi
#Check if meta TGDB DAT is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/tgdb/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/tgdb/${1}.dat"'
fi
#Check if meta headered is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/headered/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/headered/${1}.dat"'
fi
#Check if meta hacks is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/hacks/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/hacks/${1}.dat"'
fi
#Check if meta homebrew is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/homebrew/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/homebrew/${1}.dat"'
fi
#Check for the MAME folders
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/mame-nonmerged/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/mame-nonmerged/${1}.dat"'
fi
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/mame-split/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/mame-split/${1}.dat"'
fi
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/mame-member/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/mame-member/${1}.dat"'
fi
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/mame/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/mame/${1}.dat"'
fi
#Check for Final Burn Neo folders
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/fbneo-merged/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/fbneo-merged/${1}.dat"'
fi
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/fbneo-split/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/fbneo-split/${1}.dat"'
fi
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/fbneo-member/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/fbneo-member/${1}.dat"'
fi
#Check if meta tosec is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/tosec/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/tosec/${1}.dat"'
fi
#Check if meta libretro-dats folder is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/libretro-dats/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/libretro-dats/${1}.dat"'
fi
#Check if meta redump is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/redump/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/redump/${1}.dat"'
fi
#Check if meta no-intro is there
if [ -f "${LIBRETRODATABASE_META_DAT_DIR}/no-intro/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_META_DAT_DIR}/no-intro/${1}.dat"'
fi
#Check if main DAT is there
if [ -f "${LIBRETRODATABASE_DAT_DIR}/${1}.dat" ]; then
COMMAND+=' "${LIBRETRODATABASE_DAT_DIR}/${1}.dat"'
fi
eval ${COMMAND}
if [ -f ${DBFILE} ]; then
mv ${DBFILE} "${RDB_DIR}/${1}.rdb"
fi
fi
}
build_libretro_databases() {
build_libretro_database "Amstrad - CPC" "rom.crc"
build_libretro_database "Amstrad - GX4000" "rom.crc"
build_libretro_database "Mattel - Intellivision" "rom.crc"
build_libretro_database "ScummVM" "rom.crc"
build_libretro_database "DOS" "rom.crc"
build_libretro_database "Jump 'n Bump" "rom.crc"
build_libretro_database "LowRes NX" "rom.crc"
build_libretro_database "Lutro" "rom.name"
build_libretro_database "ChaiLove" "rom.crc"
build_libretro_database "TIC-80" "rom.crc"
build_libretro_database "MrBoom" "rom.crc"
build_libretro_database "Cannonball" "rom.crc"
build_libretro_database "Nintendo - Super Nintendo Entertainment System" "rom.crc"
build_libretro_database "Sony - PlayStation" "rom.serial"
build_libretro_database "Sony - PlayStation 3" "rom.serial"
build_libretro_database "Arduboy Inc - Arduboy" "rom.crc"
build_libretro_database "Atari - Jaguar" "rom.crc"
build_libretro_database "Nintendo - Nintendo 64" "rom.crc"
build_libretro_database "Nintendo - Nintendo 64DD" "rom.crc"
build_libretro_database "Nintendo - Virtual Boy" "rom.crc"
build_libretro_database "Atari - 2600" "rom.crc"
build_libretro_database "Atari - 5200" "rom.crc"
build_libretro_database "Atari - 7800" "rom.crc"
build_libretro_database "Atari - 8-bit" "rom.crc"
build_libretro_database "Atari - Lynx" "rom.crc"
build_libretro_database "Atari - ST" "rom.crc"
build_libretro_database "Bandai - WonderSwan" "rom.crc"
build_libretro_database "Bandai - WonderSwan Color" "rom.crc"
build_libretro_database "Casio - Loopy" "rom.crc"
build_libretro_database "Casio - PV-1000" "rom.crc"
build_libretro_database "CHIP-8" "rom.crc"
build_libretro_database "Coleco - ColecoVision" "rom.crc"
build_libretro_database "Commodore - 64" "rom.crc"
build_libretro_database "Commodore - Amiga" "rom.crc"
build_libretro_database "Commodore - PET" "rom.crc"
build_libretro_database "Commodore - CD32" "rom.crc"
build_libretro_database "Commodore - CDTV" "rom.crc"
build_libretro_database "Commodore - Plus-4" "rom.crc"
build_libretro_database "Commodore - VIC-20" "rom.crc"
build_libretro_database "Dinothawr" "rom.crc"
build_libretro_database "Emerson - Arcadia 2001" "rom.crc"
build_libretro_database "Entex - Adventure Vision" "rom.crc"
build_libretro_database "Enterprise - 128" "rom.crc"
build_libretro_database "Epoch - Super Cassette Vision" "rom.crc"
build_libretro_database "Fairchild - Channel F" "rom.crc"
build_libretro_database "Funtech - Super Acan" "rom.crc"
build_libretro_database "Handheld Electronic Game" "rom.crc"
build_libretro_database "GamePark - GP32" "rom.crc"
build_libretro_database "GCE - Vectrex" "rom.crc"
build_libretro_database "Hartung - Game Master" "rom.crc"
build_libretro_database "Infocom - Z-Machine" "rom.crc"
build_libretro_database "LeapFrog - Leapster Learning Game System" "rom.crc"
build_libretro_database "Magnavox - Odyssey2" "rom.crc"
build_libretro_database "Microsoft - MSX" "rom.crc"
build_libretro_database "Microsoft - MSX2" "rom.crc"
build_libretro_database "Microsoft - Xbox" "rom.crc"
build_libretro_database "NEC - PC Engine CD - TurboGrafx-CD" "rom.crc"
build_libretro_database "NEC - PC Engine - TurboGrafx 16" "rom.crc"
build_libretro_database "NEC - PC Engine SuperGrafx" "rom.crc"
build_libretro_database "NEC - PC-FX" "rom.crc"
build_libretro_database "NEC - PC-98" "rom.crc"
build_libretro_database "NEC - PC-8001 - PC-8801" "rom.crc"
build_libretro_database "Nintendo - Family Computer Disk System" "rom.crc"
build_libretro_database "Nintendo - Game Boy" "rom.crc"
build_libretro_database "Nintendo - Game Boy Advance" "rom.crc"
build_libretro_database "Nintendo - e-Reader" "rom.crc"
build_libretro_database "Nintendo - Game Boy Color" "rom.crc"
build_libretro_database "Nintendo - GameCube" "rom.serial"
build_libretro_database "Nintendo - Nintendo 3DS" "rom.crc"
build_libretro_database "Nintendo - Nintendo DS" "rom.crc"
build_libretro_database "Nintendo - Nintendo DSi" "rom.crc"
build_libretro_database "Nintendo - Nintendo Entertainment System" "rom.crc"
build_libretro_database "Nintendo - Pokemon Mini" "rom.crc"
build_libretro_database "Nintendo - Satellaview" "rom.crc"
build_libretro_database "Nintendo - Sufami Turbo" "rom.crc"
build_libretro_database "Nintendo - Wii" "rom.serial"
build_libretro_database "Nintendo - Wii (Digital)" "rom.crc"
build_libretro_database "The 3DO Company - 3DO" "rom.crc"
build_libretro_database "Philips - Videopac+" "rom.crc"
build_libretro_database "Philips - CD-i" "rom.serial"
build_libretro_database "RCA - Studio II" "rom.crc"
build_libretro_database "Rick Dangerous" "rom.crc"
build_libretro_database "Sega - 32X" "rom.crc"
build_libretro_database "Sega - Dreamcast" "rom.serial"
build_libretro_database "Sega - Game Gear" "rom.crc"
build_libretro_database "Sega - Naomi" "rom.serial"
build_libretro_database "Sega - Naomi 2" "rom.serial"
build_libretro_database "Sega - Master System - Mark III" "rom.crc"
build_libretro_database "Sega - Mega-CD - Sega CD" "rom.serial"
build_libretro_database "Sega - Mega Drive - Genesis" "rom.crc"
build_libretro_database "Sega - PICO" "rom.crc"
build_libretro_database "Sega - Saturn" "rom.serial"
build_libretro_database "Sega - SG-1000" "rom.crc"
build_libretro_database "Sharp - X68000" "rom.crc"
build_libretro_database "Sharp - X1" "rom.crc"
build_libretro_database "Sinclair - ZX Spectrum" "rom.crc"
build_libretro_database "Sinclair - ZX Spectrum +3" "rom.crc"
build_libretro_database "Sinclair - ZX 81" "rom.crc"
build_libretro_database "SNK - Neo Geo" "rom.crc"
build_libretro_database "SNK - Neo Geo CD" "rom.crc"
build_libretro_database "SNK - Neo Geo Pocket" "rom.crc"
build_libretro_database "SNK - Neo Geo Pocket Color" "rom.crc"
build_libretro_database "Sony - PlayStation 2" "rom.serial"
build_libretro_database "Sony - PlayStation 3 (PSN)" "rom.crc"
build_libretro_database "Sony - PlayStation Portable" "rom.serial"
build_libretro_database "Sony - PlayStation Portable (PSN)" "rom.crc"
build_libretro_database "Sony - PlayStation Vita" "rom.serial"
build_libretro_database "Thomson - MOTO" "rom.crc"
build_libretro_database "Tiger - Game.com" "rom.crc"
build_libretro_database "Tomb Raider" "rom.crc"
build_libretro_database "Uzebox" "rom.crc"
build_libretro_database "VTech - CreatiVision" "rom.crc"
build_libretro_database "VTech - V.Smile" "rom.crc"
build_libretro_database "Watara - Supervision" "rom.crc"
build_libretro_database "MAME" "rom.crc"
build_libretro_database "MAME 2000" "rom.crc"
build_libretro_database "MAME 2003" "rom.crc"
build_libretro_database "MAME 2003-Plus" "rom.crc"
build_libretro_database "MAME 2010" "rom.crc"
build_libretro_database "MAME 2015" "rom.crc"
build_libretro_database "MAME 2016" "rom.crc"
build_libretro_database "HBMAME" "rom.crc"
build_libretro_database "FBNeo - Arcade Games" "rom.crc"
build_libretro_database "DOOM" "rom.crc"
build_libretro_database "Cave Story" "rom.crc"
build_libretro_database "Quake" "rom.crc"
build_libretro_database "Quake II" "rom.crc"
build_libretro_database "Quake III" "rom.crc"
build_libretro_database "RPG Maker" "rom.crc"
build_libretro_database "Flashback" "rom.crc"
build_libretro_database "WASM-4" "rom.crc"
build_libretro_database "Wolfenstein 3D" "rom.crc"
build_libretro_database "Atomiswave" "rom.crc"
build_libretro_database "PuzzleScript" "rom.crc"
build_libretro_database "Vircon32" "rom.crc"
build_libretro_database "MicroW8" "rom.crc"
build_libretro_database "Spectravideo - SVI-318 - SVI-328" "rom.crc"
build_libretro_database "PICO-8" "rom.crc"
}
build_libretrodb
build_libretro_databases