… | |
… | |
390 | } |
390 | } |
391 | } |
391 | } |
392 | |
392 | |
393 | sub process_res { |
393 | sub process_res { |
394 | while (@res) { |
394 | while (@res) { |
395 | my ($dir, $file) = @{pop @res}; |
395 | my ($dir, $file, $type) = @{pop @res}; |
396 | |
396 | |
397 | my $data; |
397 | my $data; |
398 | aio_load "$dir/$file", $data; |
398 | aio_load "$dir/$file", $data; |
399 | |
399 | |
400 | my $copyright; |
400 | my $copyright; |
… | |
… | |
402 | |
402 | |
403 | $file =~ s/\.res$//; |
403 | $file =~ s/\.res$//; |
404 | $file =~ /\.([^.]+)$/ |
404 | $file =~ /\.([^.]+)$/ |
405 | or next; |
405 | or next; |
406 | |
406 | |
407 | my $type = $1; |
|
|
408 | |
|
|
409 | substr $dir, 0, 1 + length $PATH, ""; |
407 | substr $dir, 0, 1 + length $PATH, ""; |
410 | |
408 | |
411 | $RESOURCE{"$dir/$file"} = { |
409 | $RESOURCE{"$dir/$file"} = { |
412 | type => $1, |
410 | type => $type, |
413 | copyright => $copyright, |
411 | copyright => $copyright, |
414 | data => $data, |
412 | data => $data, |
415 | chksum => Digest::MD5::md5 $data, |
413 | chksum => Digest::MD5::md5 $data, |
416 | }; |
414 | }; |
417 | } |
415 | } |
… | |
… | |
426 | my ($dirs, $nondirs) = @_; |
424 | my ($dirs, $nondirs) = @_; |
427 | |
425 | |
428 | find_files "$path/$_" |
426 | find_files "$path/$_" |
429 | for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; |
427 | for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; |
430 | |
428 | |
|
|
429 | my $dir = $path; |
|
|
430 | substr $dir, 0, 1 + length $PATH, ""; |
|
|
431 | |
431 | for my $file (@$nondirs) { |
432 | for my $file (@$nondirs) { |
|
|
433 | if ($dir =~ /^music(?:\/|$)/) { |
|
|
434 | push @res, [$path, $file, 3] # FT_MUSIC |
|
|
435 | if $file =~ /\.(ogg)$/; |
|
|
436 | |
|
|
437 | } elsif ($dir =~ /^sounds(?:\/|$)/) { |
|
|
438 | push @res, [$path, $file, 5] # FT_SOUND |
|
|
439 | if $file =~ /\.(wav|ogg)$/; |
|
|
440 | |
|
|
441 | } elsif ($dir =~ /^res(?:\/|$)/) { |
|
|
442 | push @res, [$path, $file, 0] # FT_FACE |
|
|
443 | if $file =~ /\.(jpg|png)$/; |
|
|
444 | push @res, [$path, $file, 7] # FT_RSRC |
|
|
445 | if $file =~ /\.(res)$/; |
|
|
446 | |
432 | if ($file =~ /\.png$/) { |
447 | } elsif ($file =~ /\.png$/) { |
433 | push @png, ["$path/$file", 0]; |
448 | push @png, ["$path/$file", 0]; |
|
|
449 | |
434 | } elsif ($file =~ /\.trs$/) { |
450 | } elsif ($file =~ /\.trs$/) { |
435 | push @trs, [$path, $file]; |
451 | push @trs, [$path, $file]; |
|
|
452 | |
436 | } elsif ($file =~ /\.arc$/) { |
453 | } elsif ($file =~ /\.arc$/) { |
437 | push @arc, [$path, $file]; |
454 | push @arc, [$path, $file]; |
438 | } elsif ($file =~ /\.(ogg|jpg|res)$/) { |
455 | |
439 | push @res, [$path, $file]; |
|
|
440 | } else { |
456 | } else { |
441 | warn "ignoring $path/$file\n" if $VERBOSE >= 3; |
457 | warn "ignoring $path/$file\n" if $VERBOSE >= 3; |
442 | } |
458 | } |
443 | } |
459 | } |
444 | }; |
460 | }; |