- Fix two minor bugs,

- Improve slightly xml loading speed,
- Improve RegEx definition (more strict !).
This commit is contained in:
agibert 2009-03-30 23:24:15 +00:00
parent 43dc7297d4
commit ba8277c6c9

30
nds2rm
View File

@ -5,9 +5,9 @@
# (C) 2009 Arnaud G. Gibert
#-----------------------------------------------------------------------------------------------------------------------------------
# $RCSfile: nds2rm,v $
# $Revision: 1.9 $
# $Revision: 1.10 $
# $Name: $
# $Date: 2009/03/30 22:57:13 $
# $Date: 2009/03/30 23:24:15 $
# $Author: agibert $
#-----------------------------------------------------------------------------------------------------------------------------------
@ -58,7 +58,7 @@ JOB_NB=8
NDS_VERSION="$Name: $"
RNFH_REGEX=".... - .* \(.*:.*\) \[..\] \{.*\} <.*>[-]*[0-9]*\.zip$"
RNFH_REGEX=".... - .* \(.*:.*\) \[..\] \{........} <....>[-]*[0-9]*\.zip$"
reg_tab[0]="E"; # Europe
reg_tab[1]="U"; # USA
@ -225,29 +225,30 @@ function count_print
function lang_conv
{
language=${1}
lang_ptr=${1}
language=${2}
i=0
lang=""
i=0
langue=""
while [[ ${i} -le 20 ]]
do
bit=$(( 2 ** i ))
if [[ $(( ${language} & ${bit} )) != 0 ]]
then
if [[ "${lang}" != "" ]]
if [[ "${langue}" != "" ]]
then
lang="${lang}-"
langue="${langue}-"
fi
lang="${lang}${lang_tab[${bit}]}"
langue="${langue}${lang_tab[${bit}]}"
fi
i=$(( ${i} + 1 ))
done
echo "${lang}"
eval ${lang_ptr}=${langue}
}
@ -295,6 +296,7 @@ function xml_load()
("language")
language=${value}
lang_conv "lang" "${language}"
;;
("romCRC extension=\".nds\"")
@ -318,7 +320,7 @@ function xml_load()
dat_id[${idx}]="${id}"
dat_title[${idx}]="${title}"
dat_region[${idx}]="${reg_tab[${location}]}"
dat_lang[${idx}]=$(lang_conv "${language}")
dat_lang[${idx}]="${lang}"
dat_save_type[${idx}]="${save_type}"
dat_crc[${idx}]="${crc}"
@ -632,7 +634,7 @@ function arc_build()
print_verbose "zipping ${rom} into ${file_name}"
zip -m9 "${NDS_ROMS_OUT}/${file_name}" "${rom}" >/dev/null 1>&2
zip -m9 "${NDS_ROMS_OUT}/${file_name}" "${rom}" >/dev/null 2>&1
else
print_verbose "removing ${rom}"
@ -1384,9 +1386,9 @@ else
in_place=no
fi
if [[ ! -f ${NDS_DAT} ]]
if [[ ! -f ${NDS_XML} ]]
then
echo "error: dsrom.dat not found !" 1>&2
echo "error: dsrom.xml not found !" 1>&2
exit 1
fi