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