From c7b63647a302ea48e1cce6c4107a06ba8989d8dd Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Sat, 7 Jun 2008 00:26:44 +0000 Subject: [PATCH] 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. --- tools/6502/contiki.html | 20 ++++++++++++++++++-- tools/6502/download.php | 21 +++++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/tools/6502/contiki.html b/tools/6502/contiki.html index 66920a377..4e6185866 100644 --- a/tools/6502/contiki.html +++ b/tools/6502/contiki.html @@ -11,7 +11,7 @@
-

Download your custom generated Contiki configuration

+

Download your custom generated Contiki

+ + +
@@ -103,6 +103,22 @@
+
+ + + + +
+ + + + + +
+
@@ -111,4 +127,4 @@
- + diff --git a/tools/6502/download.php b/tools/6502/download.php index c62b9577a..f83614b97 100644 --- a/tools/6502/download.php +++ b/tools/6502/download.php @@ -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; -header('Content-Type: application/octetstream'); -header('Content-Disposition: attachment; filename=contiki.cfg'); -print($cfg); +if ($_GET['disk']) { + $out = substr_replace(file_get_contents('contiki.' . $ext), $cfg, $ofs, strlen($cfg)); +} else { + $ext = 'cfg'; + $out = $cfg; +} -?> \ No newline at end of file +header('Content-Type: application/octetstream'); +header('Content-Disposition: attachment; filename=contiki.' . $ext); +print($out); + +?>