181 lines
4.4 KiB
Plaintext
181 lines
4.4 KiB
Plaintext
|
#!/bin/awk -f
|
||
|
|
||
|
BEGIN {
|
||
|
reg_tab[0] = "E"; # Europe
|
||
|
reg_tab[1] = "U"; # USA
|
||
|
reg_tab[2] = "G"; # Germany
|
||
|
reg_tab[3] = "C"; # China
|
||
|
reg_tab[4] = "S"; # Spain
|
||
|
reg_tab[5] = "F"; # France
|
||
|
reg_tab[6] = "I"; # Italy
|
||
|
reg_tab[7] = "J"; # Japan
|
||
|
reg_tab[8] = "Nl"; # Nederland
|
||
|
reg_tab[9] = "En"; # England
|
||
|
reg_tab[10] = "Dn"; # Denmark
|
||
|
reg_tab[11] = "Fi"; # Finland
|
||
|
reg_tab[12] = "No"; # Norway
|
||
|
reg_tab[13] = "Pl"; # Poland
|
||
|
reg_tab[14] = "Pr"; # Portugal
|
||
|
reg_tab[15] = "Sw"; # Sweden
|
||
|
reg_tab[16] = "UE"; # USA and Europe
|
||
|
reg_tab[17] = "JUE"; # Japan, USA and Europe
|
||
|
reg_tab[18] = "JU"; # Japan and USA
|
||
|
reg_tab[19] = "Au"; # Australia
|
||
|
reg_tab[20] = "nK"; # North Korea
|
||
|
reg_tab[21] = "Br"; # Brazil
|
||
|
reg_tab[22] = "K"; # South Korea
|
||
|
reg_tab[23] = "EB"; # Europe and Brazil
|
||
|
reg_tab[24] = "EUB"; # Europe, USA and Brazil
|
||
|
reg_tab[25] = "UB"; # USA and Brazil
|
||
|
reg_tab[26] = "R"; # Russia
|
||
|
reg_tab[27] = "R"; # Russia
|
||
|
reg_tab[28] = "Gr"; # Greece
|
||
|
|
||
|
lang_tab[1] = "Fr"; # French
|
||
|
lang_tab[2] = "En"; # English
|
||
|
lang_tab[4] = "Zh"; # Chinese
|
||
|
lang_tab[8] = "da"; # Danish
|
||
|
lang_tab[16] = "Nl"; # Dutch
|
||
|
lang_tab[32] = "Fi"; # Finnish
|
||
|
lang_tab[64] = "De"; # German
|
||
|
lang_tab[128] = "It"; # Italian
|
||
|
lang_tab[256] = "Ja"; # Japanese
|
||
|
lang_tab[512] = "Nn"; # Norwegian
|
||
|
lang_tab[1024] = "Pl"; # Polish
|
||
|
lang_tab[2048] = "Pt"; # Portuguese
|
||
|
lang_tab[4096] = "Es"; # Spanish
|
||
|
lang_tab[8192] = "Sv"; # Swedish
|
||
|
lang_tab[16384] = "En"; # English
|
||
|
lang_tab[32768] = "Pt"; # Portuguese
|
||
|
lang_tab[65536] = "Ko"; # Korean
|
||
|
lang_tab[131072] = "Ru"; # Russian
|
||
|
lang_tab[262144] = "El"; # Greek
|
||
|
|
||
|
mask["None"] = "000000000";
|
||
|
mask["Eeprom - 4 kbit"] = "100000000";
|
||
|
mask["Eeprom - 64 kbit"] = "200000000";
|
||
|
mask["Eeprom - 512 kbit"] = "500000000";
|
||
|
mask["Flash - 2 Mbit"] = "300000000";
|
||
|
mask["Flash - 4 Mbit"] = "400000000";
|
||
|
mask["Flash - 64 Mbit"] = "600000000";
|
||
|
mask["TBC"] = "F00000000";
|
||
|
|
||
|
nb = 0;
|
||
|
}
|
||
|
|
||
|
/<releaseNumber>/ {
|
||
|
rn = $0;
|
||
|
|
||
|
gsub( ".*<releaseNumber>", "", rn);
|
||
|
gsub( "</releaseNumber>.*", "", rn);
|
||
|
}
|
||
|
|
||
|
/<title>/ {
|
||
|
title = $0;
|
||
|
|
||
|
gsub( ".*<title>", "", title);
|
||
|
gsub( "</title>.*", "", title);
|
||
|
gsub( "&", "\\&", title);
|
||
|
gsub( "<", "<", title);
|
||
|
gsub( ">", ">", title);
|
||
|
}
|
||
|
|
||
|
/<saveType>/ {
|
||
|
save_type = $0;
|
||
|
|
||
|
gsub( ".*<saveType>", "", save_type);
|
||
|
gsub( "</saveType>.*", "", save_type);
|
||
|
}
|
||
|
|
||
|
/<location>/ {
|
||
|
location = $0;
|
||
|
|
||
|
gsub( ".*<location>", "", location);
|
||
|
gsub( "</location>.*", "", location);
|
||
|
}
|
||
|
|
||
|
/<language>/ {
|
||
|
language = $0;
|
||
|
|
||
|
gsub( ".*<language>", "", language);
|
||
|
gsub( "</language>.*", "", language);
|
||
|
}
|
||
|
|
||
|
/<romCRC extension=\".nds\">/ {
|
||
|
crc = $0;
|
||
|
|
||
|
gsub( ".*<romCRC extension=\".nds\">", "", crc);
|
||
|
gsub( "</romCRC>.*", "", crc);
|
||
|
}
|
||
|
|
||
|
/<comment>/ {
|
||
|
id = $0;
|
||
|
|
||
|
gsub( ".*<comment>", "", id);
|
||
|
gsub( "</comment>.*", "", id);
|
||
|
}
|
||
|
|
||
|
/<\/game>/ {
|
||
|
tab[nb, "rn"] = rn;
|
||
|
tab[nb, "title"] = title;
|
||
|
tab[nb, "save_type"] = save_type;
|
||
|
tab[nb, "location"] = location;
|
||
|
tab[nb, "language"] = language;
|
||
|
tab[nb, "crc"] = crc;
|
||
|
tab[nb, "id"] = id;
|
||
|
|
||
|
nb++;
|
||
|
printf( "Reading: %s...\r", id) > "/dev/stderr";
|
||
|
|
||
|
rn = "";
|
||
|
id = "";
|
||
|
title = "";
|
||
|
save_type = "";
|
||
|
crc = "";
|
||
|
}
|
||
|
|
||
|
END {
|
||
|
if( mode == "dsrom.lst")
|
||
|
{
|
||
|
printf( "%4d\n", tab[ (nb - 1), "id"]);
|
||
|
}
|
||
|
|
||
|
for( i = 0; i < nb; i++)
|
||
|
{
|
||
|
reg = reg_tab[tab[i, "location"]];
|
||
|
lang = "";
|
||
|
|
||
|
for( j = 0; j < 20; j++)
|
||
|
{
|
||
|
if( and( tab[i, "language"], ( 2 ^ j)) != 0)
|
||
|
{
|
||
|
if( lang != "")
|
||
|
{
|
||
|
lang = lang "-"
|
||
|
}
|
||
|
|
||
|
lang = lang lang_tab[2 ^ j];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if( mode == "dsrom.dat")
|
||
|
{
|
||
|
printf( "%s;%s;%s;%s;%s;%s;%s\n", tab[i, "rn"], tab[i, "id"], tab[i, "title"], reg, lang, tab[i, "save_type"], tab[i, "crc"]);
|
||
|
}
|
||
|
else if( mode == "dsrom.lst")
|
||
|
{
|
||
|
if( tab[i, "id"] != "xxxx")
|
||
|
{
|
||
|
id = tab[i, "id"];
|
||
|
printf( "Writing: %s...\r", id) > "/dev/stderr";
|
||
|
cmd = "unzip -p /opt/public/nds/roms/"id"* | dd skip=12 count=4 bs=1 2>/dev/null";
|
||
|
|
||
|
cmd | getline fp;
|
||
|
close( cmd);
|
||
|
|
||
|
printf( "%s %s-0 %s %s (%s) [%s] {%s}\n", id, fp, mask[tab[i, "save_type"]], tab[i, "title"], reg, lang, tab[i, "crc"]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|