--- deliantra/server/utils/cfutil.in 2007/12/17 08:50:15 1.64 +++ deliantra/server/utils/cfutil.in 2008/01/15 12:02:24 1.69 @@ -14,13 +14,13 @@ my $PNGNQ = "@PNGNQ@"; use Getopt::Long; -use Coro::Event; +use Coro::EV; use AnyEvent; -use YAML::Syck (); +use YAML (); use JSON::XS (); use IO::AIO (); use File::Temp; -use Crossfire; +use Deliantra; use Coro; use Coro::AIO; use Coro::Util; @@ -69,8 +69,8 @@ END { system "rm", "-rf", $TMPDIR } -Event->signal (signal => "INT", cb => sub { exit 1 }); -Event->signal (signal => "TERM", cb => sub { exit 1 }); +my $s_INT = EV::signal INT => sub { exit 1 }; +my $s_TERM = EV::signal TERM => sub { exit 1 }; mkdir $TMPDIR, 0700 or die "$TMPDIR: $!"; @@ -535,7 +535,12 @@ if (my $filter = $meta->{cfutil_filter}) { if ($filter eq "yaml2json") { - $data = JSON::XS::encode_json YAML::Syck::Load $data; + $data = JSON::XS::encode_json YAML::Load $data; + } elsif ($filter eq "json2json") { + $data = JSON::XS::encode_json JSON::XS->relaxed->utf8->decode ($data); + } elsif ($filter eq "perl2json") { + $data = eval $data; die if $@; + $data = JSON::XS::encode_json $data; } else { warn "$dir/$file: unknown filter $filter, skipping\n"; } @@ -576,7 +581,7 @@ if ($file =~ /\.(jpg|png)$/) { $c_res->put ([$path, $file, 0]) # FT_FACE } elsif ($file =~ /\.(res)$/) { - $c_res->put ([$path, $file, 7]) # FT_RSRC + $c_res->put ([$path, $file, 6]) # FT_RSRC } else { $c_res->put ([$path, $file, undef]); } @@ -637,8 +642,8 @@ print "end arc, start png processing...\n" if $VERBOSE; - # four png crunchers work fine for my 2x smp machine - my @a_png = map +(async \&process_png), 1..4; + # eight png crunchers work fine for my 4x smp machine + my @a_png = map +(async \&process_png), 1..8; $_->join for (@a_trs, @a_res, @a_png); @@ -687,7 +692,7 @@ print "writing archetypes...\n" if $VERBOSE; open my $fh, ">:utf8", "$DATADIR/archetypes~" or die "$DATADIR/archetypes~: $!"; - print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; + print $fh Deliantra::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; } {