2008-05-16 00:39:30 +02:00
|
|
|
<?php
|
|
|
|
|
2010-08-06 00:50:19 +02:00
|
|
|
error_reporting(0);
|
|
|
|
|
2008-05-16 00:39:30 +02:00
|
|
|
$cfg = chr($_GET['addr-a']).chr($_GET['addr-b']).chr($_GET['addr-c']).chr($_GET['addr-d']);
|
|
|
|
$cfg .= chr($_GET['mask-a']).chr($_GET['mask-b']).chr($_GET['mask-c']).chr($_GET['mask-d']);
|
|
|
|
$cfg .= chr($_GET['dgw-a']). chr($_GET['dgw-b']). chr($_GET['dgw-c']). chr($_GET['dgw-d']);
|
|
|
|
$cfg .= chr($_GET['dns-a']). chr($_GET['dns-b']). chr($_GET['dns-c']). chr($_GET['dns-d']);
|
|
|
|
|
2010-02-14 18:41:05 +01:00
|
|
|
$dsk = $_GET['disk'];
|
|
|
|
|
2008-05-16 00:39:30 +02:00
|
|
|
switch ($_GET['machine']) {
|
2010-08-06 00:50:19 +02:00
|
|
|
case 'apple2':
|
2008-05-16 00:39:30 +02:00
|
|
|
$hex = $_GET['apple2-addr'];
|
|
|
|
$drv = $_GET['apple2-drv'];
|
2010-02-14 18:41:05 +01:00
|
|
|
$ext = '-' . $dsk . '.dsk';
|
2010-02-04 01:01:59 +01:00
|
|
|
$ofs = 0x05B00;
|
2008-05-16 00:39:30 +02:00
|
|
|
break;
|
2010-08-06 00:50:19 +02:00
|
|
|
case 'c64':
|
2008-05-16 00:39:30 +02:00
|
|
|
$hex = strtok($_GET['c64-addr-drv'], '-');
|
|
|
|
$drv = strtok('-');
|
2010-02-14 18:41:05 +01:00
|
|
|
$ext = '-' . $dsk . '.d64';
|
2010-02-04 01:01:59 +01:00
|
|
|
$ofs = 0x15002;
|
2008-05-16 00:39:30 +02:00
|
|
|
break;
|
2010-08-06 00:50:19 +02:00
|
|
|
case 'c128':
|
2008-05-16 00:39:30 +02:00
|
|
|
$hex = strtok($_GET['c128-addr-drv'], '-');
|
|
|
|
$drv = strtok('-');
|
2010-08-06 00:50:19 +02:00
|
|
|
$ext = '-' . $dsk . '.d71';
|
2010-02-04 01:01:59 +01:00
|
|
|
$ofs = 0x15002;
|
2008-05-16 00:39:30 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$addr = hexdec($hex);
|
|
|
|
$cfg .= chr($addr % 0x100).chr($addr / 0x100);
|
|
|
|
$cfg .= $drv;
|
|
|
|
|
2010-02-14 18:41:05 +01:00
|
|
|
if ($dsk) {
|
2010-08-06 00:50:19 +02:00
|
|
|
$img = file_get_contents('contiki'. $ext);
|
|
|
|
if ($img)
|
|
|
|
$out = substr_replace($img, $cfg, $ofs, strlen($cfg));
|
|
|
|
else
|
|
|
|
$out = '';
|
2008-06-07 02:26:44 +02:00
|
|
|
} else {
|
2010-02-14 18:41:05 +01:00
|
|
|
$ext = '.cfg';
|
2008-06-07 02:26:44 +02:00
|
|
|
$out = $cfg;
|
|
|
|
}
|
|
|
|
|
2008-05-16 00:39:30 +02:00
|
|
|
header('Content-Type: application/octetstream');
|
2010-02-14 18:41:05 +01:00
|
|
|
header('Content-Disposition: attachment; filename=contiki' . $ext);
|
2008-06-07 02:26:44 +02:00
|
|
|
print($out);
|
2008-05-16 00:39:30 +02:00
|
|
|
|
2008-06-07 02:26:44 +02:00
|
|
|
?>
|