2016-01-23 00:51:09 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
DAT_dir=dat
|
|
|
|
lua_RDB_outdir=rdb_lua
|
|
|
|
c_RDB_outdir=rdb_c
|
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
echo
|
|
|
|
echo "==========================================================="
|
|
|
|
echo "================== running LUA converter =================="
|
|
|
|
echo "==========================================================="
|
|
|
|
echo
|
2016-01-23 00:51:09 +00:00
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
rm -rf $lua_RDB_outdir
|
|
|
|
mkdir -p $lua_RDB_outdir
|
2016-01-23 00:51:09 +00:00
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
for dat_file in $DAT_dir/*.dat ; do
|
|
|
|
name=`echo "$dat_file" | sed "s/${DAT_dir}\/*//"`
|
|
|
|
name=`echo "$name" | sed "s/\.dat//"`
|
|
|
|
./lua_converter "$lua_RDB_outdir/$name.rdb" dat_converter.lua "$dat_file"
|
|
|
|
done
|
2016-01-24 02:16:25 +00:00
|
|
|
./lua_converter "$lua_RDB_outdir/merged.rdb" dat_converter.lua rom.sha1 $DAT_dir/N*.dat
|
2016-01-23 00:51:09 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "==========================================================="
|
|
|
|
echo "=================== running C converter ==================="
|
|
|
|
echo "==========================================================="
|
|
|
|
echo
|
|
|
|
|
|
|
|
rm -rf $c_RDB_outdir
|
|
|
|
mkdir -p $c_RDB_outdir
|
|
|
|
|
|
|
|
for dat_file in $DAT_dir/*.dat ; do
|
|
|
|
name=`echo "$dat_file" | sed "s/${DAT_dir}\/*//"`
|
|
|
|
name=`echo "$name" | sed "s/\.dat//"`
|
2016-01-23 05:21:52 +00:00
|
|
|
./c_converter "$c_RDB_outdir/$name.rdb" "$dat_file"
|
2016-01-23 00:51:09 +00:00
|
|
|
done
|
2016-01-24 02:16:25 +00:00
|
|
|
./c_converter "$c_RDB_outdir/merged.rdb" rom.sha1 $DAT_dir/N*.dat
|
2016-01-23 00:51:09 +00:00
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
echo
|
|
|
|
echo "==========================================================="
|
|
|
|
echo "==================== comparing files ====================="
|
|
|
|
echo "==========================================================="
|
|
|
|
echo
|
2016-01-23 00:51:09 +00:00
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
matches=0
|
|
|
|
failed=0
|
2016-01-23 00:51:09 +00:00
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
for lua_rdb_file in $lua_RDB_outdir/*.rdb ; do
|
|
|
|
name=`echo "$lua_rdb_file" | sed "s/${lua_RDB_outdir}\/*//"`
|
|
|
|
name=`echo "$name" | sed "s/\.rdb//"`
|
2016-01-23 00:51:09 +00:00
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
files_differ=0
|
|
|
|
diff "$c_RDB_outdir/$name.rdb" "$lua_RDB_outdir/$name.rdb" && files_differ=1
|
|
|
|
if [ $files_differ = 0 ]; then
|
|
|
|
failed=$(( $failed + 1 ))
|
|
|
|
ls -la "$c_RDB_outdir/$name.rdb"
|
|
|
|
ls -la "$lua_RDB_outdir/$name.rdb"
|
|
|
|
else
|
|
|
|
matches=$(( $matches + 1 ))
|
|
|
|
fi
|
|
|
|
done
|
2016-01-23 00:51:09 +00:00
|
|
|
|
2016-01-23 05:42:40 +00:00
|
|
|
echo
|
|
|
|
echo "==========================================================="
|
|
|
|
echo
|
|
|
|
echo "tested $(( $matches + $failed )) files: $matches match and $failed differ"
|
|
|
|
echo
|
|
|
|
if [ $failed = 0 ]; then
|
|
|
|
echo "test successful !!"
|
|
|
|
else
|
|
|
|
echo "test failed !!"
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
echo "==========================================================="
|
|
|
|
echo
|