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