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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="download.php">
|
<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">
|
<table align="center" cellpadding="0" cellspacing="0">
|
||||||
<tr class="p">
|
<tr class="p">
|
||||||
<td>
|
<td>
|
||||||
|
@ -103,6 +103,22 @@
|
||||||
</td>
|
</td>
|
||||||
</tr><tr class="bg">
|
</tr><tr class="bg">
|
||||||
<td colspan="3" />
|
<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">
|
</tr><tr class="p">
|
||||||
<td colspan="3" align="center">
|
<td colspan="3" align="center">
|
||||||
<input type="submit" value="Download" />
|
<input type="submit" value="Download" />
|
||||||
|
|
|
@ -9,14 +9,20 @@ switch ($_GET['machine']) {
|
||||||
case "apple2":
|
case "apple2":
|
||||||
$hex = $_GET['apple2-addr'];
|
$hex = $_GET['apple2-addr'];
|
||||||
$drv = $_GET['apple2-drv'];
|
$drv = $_GET['apple2-drv'];
|
||||||
|
$ext = 'dsk';
|
||||||
|
$ofs = 0x0B500;
|
||||||
break;
|
break;
|
||||||
case "c64":
|
case "c64":
|
||||||
$hex = strtok($_GET['c64-addr-drv'], '-');
|
$hex = strtok($_GET['c64-addr-drv'], '-');
|
||||||
$drv = strtok('-');
|
$drv = strtok('-');
|
||||||
|
$ext = 'd64';
|
||||||
|
$ofs = 0x17802;
|
||||||
break;
|
break;
|
||||||
case "c128":
|
case "c128":
|
||||||
$hex = strtok($_GET['c128-addr-drv'], '-');
|
$hex = strtok($_GET['c128-addr-drv'], '-');
|
||||||
$drv = strtok('-');
|
$drv = strtok('-');
|
||||||
|
$ext = 'd71';
|
||||||
|
$ofs = 0x17802;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +30,15 @@ $addr = hexdec($hex);
|
||||||
$cfg .= chr($addr % 0x100).chr($addr / 0x100);
|
$cfg .= chr($addr % 0x100).chr($addr / 0x100);
|
||||||
$cfg .= $drv;
|
$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-Type: application/octetstream');
|
||||||
header('Content-Disposition: attachment; filename=contiki.cfg');
|
header('Content-Disposition: attachment; filename=contiki.' . $ext);
|
||||||
print($cfg);
|
print($out);
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in a new issue