NL
games/dmmotor / tools / split-wad.php · commit 9d248a4
<?php/* * dmmotor: copies a Freedoom IWAD into assets/wad/ as parts of at most 15 MB * (the JumPHP playground accepts 20 MB per file). The game joins them again (App\Dm\Wad). * *   php tools/split-wad.php /path/to/freedoom1.wad * * Freedoom: https://freedoom.github.io (BSD licence, see assets/wad/COPYING.txt). */$src = $argv[1] ?? '';if (!is_file($src)) {    fwrite(STDERR, "usage: php tools/split-wad.php <freedoom1.wad>\n");    exit(1);}$name = basename($src);$dir = __DIR__ . '/../assets/wads';foreach (glob("$dir/$name.*") ?: [] as $old) {    unlink($old);}$data = file_get_contents($src);foreach (str_split($data, 15 * 1024 * 1024) as $i => $part) {    file_put_contents("$dir/$name.$i", $part);    echo "$dir/$name.$i ", strlen($part), " bytes\n";}