Allow to download complete disk images (incl. custom config file) beside the pure custom config file. Is this kind of a hack as there are no disk image utilities used. Instead the offsets to the config file content in the current example-webserver disk image files is hardcoded into the PHP source code. As soon as the disk images change the offsets need to be adjusted.
This commit is contained in:
parent
a4d1c62d3a
commit
c7b63647a3
|
@ -11,7 +11,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<form action="download.php">
|
||||
<h4 align="center">Download your custom generated Contiki configuration</h4>
|
||||
<h4 align="center">Download your custom generated Contiki</h4>
|
||||
<table align="center" cellpadding="0" cellspacing="0">
|
||||
<tr class="p">
|
||||
<td>
|
||||
|
@ -103,6 +103,22 @@
|
|||
</td>
|
||||
</tr><tr class="bg">
|
||||
<td colspan="3" />
|
||||
</tr><tr class="p">
|
||||
<td colspan="3">
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="disk" id="disk" value="1" checked="checked" />
|
||||
<label for="disk">Complete Disk Image</label>
|
||||
</td><td align="right">
|
||||
<input type="radio" name="disk" id="conf" value="0" />
|
||||
<label for="conf">Configuration File Only</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr><tr class="bg">
|
||||
<td colspan="3" />
|
||||
</tr><tr class="p">
|
||||
<td colspan="3" align="center">
|
||||
<input type="submit" value="Download" />
|
||||
|
|
|
@ -9,14 +9,20 @@ switch ($_GET['machine']) {
|
|||
case "apple2":
|
||||
$hex = $_GET['apple2-addr'];
|
||||
$drv = $_GET['apple2-drv'];
|
||||
$ext = 'dsk';
|
||||
$ofs = 0x0B500;
|
||||
break;
|
||||
case "c64":
|
||||
$hex = strtok($_GET['c64-addr-drv'], '-');
|
||||
$drv = strtok('-');
|
||||
$ext = 'd64';
|
||||
$ofs = 0x17802;
|
||||
break;
|
||||
case "c128":
|
||||
$hex = strtok($_GET['c128-addr-drv'], '-');
|
||||
$drv = strtok('-');
|
||||
$ext = 'd71';
|
||||
$ofs = 0x17802;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -24,8 +30,15 @@ $addr = hexdec($hex);
|
|||
$cfg .= chr($addr % 0x100).chr($addr / 0x100);
|
||||
$cfg .= $drv;
|
||||
|
||||
if ($_GET['disk']) {
|
||||
$out = substr_replace(file_get_contents('contiki.' . $ext), $cfg, $ofs, strlen($cfg));
|
||||
} else {
|
||||
$ext = 'cfg';
|
||||
$out = $cfg;
|
||||
}
|
||||
|
||||
header('Content-Type: application/octetstream');
|
||||
header('Content-Disposition: attachment; filename=contiki.cfg');
|
||||
print($cfg);
|
||||
header('Content-Disposition: attachment; filename=contiki.' . $ext);
|
||||
print($out);
|
||||
|
||||
?>
|
Loading…
Reference in a new issue