<html>
<body>
  <div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream</tt></b></td></tr>
<tr><td><tt><a href="#file1">config.h.in</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+4</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt><a href="#file2">configure</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+7</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr><td><tt><a href="#file3">configure.in</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+3</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>src/<a href="#file4">Makefile.am</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+11</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-8</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr><td><tt>   /<a href="#file5">Makefile.in</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+259</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-216</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>src/drivers/<a href="#file6"><span id="removedalt" style="background-color:#f7cccc;" >cd_linux.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-174</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>           /<a href="#file7"><span id="removed" style="background-color:#ffdddd;" >cd_mmc.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-242</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>           /<a href="#file8"><span id="removedalt" style="background-color:#f7cccc;" >cd_none.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-47</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>           /<a href="#file9"><span id="removed" style="background-color:#ffdddd;" >cd_osx.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-232</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>src/drivers/cdrom/<a href="#file10"><span id="addedalt" style="background-color:#ccf7cc;" >README.LIBEDC</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+123</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file11"><span id="added" style="background-color:#ddffdd;" >cd_cdi.c</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+192</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file12"><span id="addedalt" style="background-color:#ccf7cc;" >cd_gdi.c</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+139</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file13"><span id="added" style="background-color:#ddffdd;" >cd_linux.c</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+179</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file14"><span id="addedalt" style="background-color:#ccf7cc;" >cd_mmc.c</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+238</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file15"><span id="added" style="background-color:#ddffdd;" >cd_none.c</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+23</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file16"><span id="addedalt" style="background-color:#ccf7cc;" >cd_nrg.c</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+331</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file17"><span id="added" style="background-color:#ddffdd;" >cd_osx.c</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+228</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file18"><span id="addedalt" style="background-color:#ccf7cc;" >cdimpl.h</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+199</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file19"><span id="added" style="background-color:#ddffdd;" >cdrom.c</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+386</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file20"><span id="addedalt" style="background-color:#ccf7cc;" >cdrom.h</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+153</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file21"><span id="added" style="background-color:#ddffdd;" >defs.h</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+141</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file22"><span id="addedalt" style="background-color:#ccf7cc;" >drive.c</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+148</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file23"><span id="added" style="background-color:#ddffdd;" >drive.h</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+97</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file24"><span id="addedalt" style="background-color:#ccf7cc;" >ecc.h</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+136</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file25"><span id="added" style="background-color:#ddffdd;" >edc_crctable.h</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+171</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file26"><span id="addedalt" style="background-color:#ccf7cc;" >edc_ecc.c</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+801</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file27"><span id="added" style="background-color:#ddffdd;" >edc_encoder.h</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+47</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file28"><span id="addedalt" style="background-color:#ccf7cc;" >edc_l2sq.h</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+1180</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file29"><span id="added" style="background-color:#ddffdd;" >edc_scramble.h</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+621</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>                 /<a href="#file30"><span id="addedalt" style="background-color:#ccf7cc;" >sector.c</span></a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+581</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr><td><tt>                 /<a href="#file31"><span id="added" style="background-color:#ddffdd;" >sector.h</span></a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+184</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" align="right" nowrap="nowrap">added d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>src/<a href="#file32">gdlist.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+9</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-7</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr><td><tt>src/gdrom/<a href="#file33"><span id="removed" style="background-color:#ffdddd;" >README.LIBEDC</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-123</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file34"><span id="removedalt" style="background-color:#f7cccc;" >cdi.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-208</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>         /<a href="#file35"><span id="removed" style="background-color:#ffdddd;" >ecc.h</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-136</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file36"><span id="removedalt" style="background-color:#f7cccc;" >edc_crctable.h</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-171</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>         /<a href="#file37"><span id="removed" style="background-color:#ffdddd;" >edc_ecc.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-801</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file38"><span id="removedalt" style="background-color:#f7cccc;" >edc_encoder.h</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-47</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>         /<a href="#file39"><span id="removed" style="background-color:#ffdddd;" >edc_l2sq.h</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1180</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file40"><span id="removedalt" style="background-color:#f7cccc;" >edc_scramble.h</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-621</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>         /<a href="#file41"><span id="removed" style="background-color:#ffdddd;" >gddriver.h</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-266</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file42"><span id="removedalt" style="background-color:#f7cccc;" >gdi.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-137</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>         /<a href="#file43"><span id="removed" style="background-color:#ffdddd;" >gdimage.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-460</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file44">gdrom.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+172</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-133</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr><td><tt>         /<a href="#file45">gdrom.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+32</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-53</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file46">ide.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+14</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-20</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr><td><tt>         /<a href="#file47">ide.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+4</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr class="alt" style=";" ><td><tt>         /<a href="#file48"><span id="removedalt" style="background-color:#f7cccc;" >nrg.c</span></a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-349</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 removed</td></tr>
<tr><td><tt>         /<a href="#file49">packet.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+1</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">3f8f4c5b9ef4 -> d4807997e450</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+6814</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-5632</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >22 added + 16 removed + 11 modified, total 49 files</small><br />
<div class="tasklist" style="padding:4px;border:1px dashed #000000;margin-top:1em;" ><ul>
<li><a href="#task1">FIXME */</a></li>
</ul></div>
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Refactor CDROM host support
  - Completely separate GDROM hardware (in gdrom/gdrom.c) from generic CDROM
    support (now in drivers/cdrom)
  - Add concept of 'sector sources' that can be mixed and matched to create
    cdrom discs (makes support of arbitrary disc types much simpler)
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>config.h.in</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/config.h.in
+++ lxdream/config.h.in
@@ -16,7 +16,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /* Enable SH4 statistics */
 #undef ENABLE_SH4STATS
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/* Enable shared library support */
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* Enable shared-library plugins */
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #undef ENABLE_SHARED
 
 /* Enable IO tracing */
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -85,6 +85,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /* Define to 1 if you have the `z' library (-lz). */
 #undef HAVE_LIBZ
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* Using the linux native CDROM driver */
+#undef HAVE_LINUX_CDROM
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /* Have linux joystick support */
 #undef HAVE_LINUX_JOYSTICK
 
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>configure</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/configure
+++ lxdream/configure
@@ -11237,6 +11237,13 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >   CDROM_NONE_FALSE=
 fi
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+if test "x$CDROM_DRIVER" = "xlinux"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LINUX_CDROM 1
+_ACEOF
+
+fi
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 if test "${ac_cv_header_linux_joystick_h+set}" = set; then
   { $as_echo "$as_me:$LINENO: checking for linux/joystick.h" >&5
</pre></div>
<hr /><a name="file3" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>configure.in</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/configure.in
+++ lxdream/configure.in
@@ -357,6 +357,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > AM_CONDITIONAL(CDROM_LINUX, [test "x$CDROM_DRIVER" = "xlinux"])
 AM_CONDITIONAL(CDROM_OSX, [test "x$CDROM_DRIVER" = "xosx"])
 AM_CONDITIONAL(CDROM_NONE, [test "x$CDROM_DRIVER" = "x"])
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+if test "x$CDROM_DRIVER" = "xlinux"; then
+   AC_DEFINE([HAVE_LINUX_CDROM],1,[Using the linux native CDROM driver])
+fi
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 AC_CHECK_HEADER([linux/joystick.h], [
     HAVE_LINUX_JOYSTICK_H=yes
</pre></div>
<hr /><a name="file4" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>Makefile.am</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/Makefile.am
+++ lxdream/src/Makefile.am
@@ -45,10 +45,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         asic.c asic.h clock.h serial.h \
         syscall.c syscall.h bios.c dcload.c gdbserver.c \
         ioutil.c ioutil.h lxpaths.c lxpaths.h \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdimage.c \
-       gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c \
-       gdrom/edc_ecc.c gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \
-       gdrom/edc_l2sq.h gdrom/edc_scramble.h gdrom/gddriver.h \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdrom.c gdrom/gdrom.h \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         dreamcast.c dreamcast.h eventq.c eventq.h \
         sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c \
         sh4/mmu.c sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -67,9 +64,15 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         loader.c loader.h elf.h bootstrap.c bootstrap.h util.c gdlist.c gdlist.h \
         vmu/vmuvol.c vmu/vmuvol.h vmu/vmulist.c vmu/vmulist.h \
        display.c display.h dckeysyms.h \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   drivers/audio_null.c drivers/video_null.c <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >drivers/cd_mmc.c </span>\
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     drivers/audio_null.c drivers/video_null.c \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \
        drivers/serial_unix.c \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     drivers/cdrom/cdrom.h drivers/cdrom/cdrom.c drivers/cdrom/drive.h \
+       drivers/cdrom/sector.h drivers/cdrom/sector.c drivers/cdrom/defs.h \
+        drivers/cdrom/cd_nrg.c drivers/cdrom/cd_cdi.c drivers/cdrom/cd_gdi.c \
+        drivers/cdrom/edc_ecc.c drivers/cdrom/ecc.h drivers/cdrom/drive.c \
+        drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \
+       drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h drivers/cdrom/cd_mmc.c \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in \
        hotkeys.c hotkeys.h
 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -213,15 +216,15 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > endif # end shared/static control
 
 if CDROM_LINUX
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream_SOURCES += drivers/cd_linux.c
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream_SOURCES += drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_linux.c
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > endif
 
 if CDROM_OSX
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream_SOURCES += drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream_SOURCES += drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_osx.c drivers/osx_iokit.m drivers/osx_iokit.h
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > endif
 
 if CDROM_NONE
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream_SOURCES += drivers/cd_none.c
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream_SOURCES += drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_none.c
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > endif
 
 if JOY_LINUX
</pre></div>
<hr /><a name="file5" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>Makefile.in</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/Makefile.in
+++ lxdream/src/Makefile.in
@@ -84,9 +84,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AUDIO_ALSA_TRUE@@BUILD_SHARED_FALSE@am__append_24 = @ALSA_LIBS@
 @BUILD_SHARED_FALSE@@INPUT_LIRC_TRUE@am__append_25 = drivers/input_lirc.c
 @BUILD_SHARED_FALSE@@INPUT_LIRC_TRUE@am__append_26 = -llirc_client
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@CDROM_LINUX_TRUE@am__append_27 = drivers/cd_linux.c
-@CDROM_OSX_TRUE@am__append_28 = drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h
-@CDROM_NONE_TRUE@am__append_29 = drivers/cd_none.c
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@CDROM_LINUX_TRUE@am__append_27 = drivers/cdrom/cd_linux.c
+@CDROM_OSX_TRUE@am__append_28 = drivers/cdrom/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h
+@CDROM_NONE_TRUE@am__append_29 = drivers/cdrom/cd_none.c
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @JOY_LINUX_TRUE@am__append_30 = drivers/joy_linux.c drivers/joy_linux.h
 subdir = src
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -143,51 +143,58 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      mem.h sdram.c mmio.h watch.c asic.c asic.h clock.h serial.h \
        syscall.c syscall.h bios.c dcload.c gdbserver.c ioutil.c \
        ioutil.h lxpaths.c lxpaths.h gdrom/ide.c gdrom/ide.h \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   gdrom/packet.h gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h \
-       gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c \
-       gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \
-       gdrom/edc_l2sq.h gdrom/edc_scramble.h gdrom/gddriver.h \
-       dreamcast.c dreamcast.h eventq.c eventq.h sh4/sh4.c sh4/intc.c \
-       sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c sh4/mmu.c \
-       sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \
-       sh4/sh4mmio.c sh4/sh4mmio.h sh4/scif.c sh4/sh4stat.c \
-       sh4/sh4stat.h xlat/xltcache.c xlat/xltcache.h sh4/sh4.h \
-       sh4/dmac.h sh4/pmm.c sh4/cache.c sh4/mmu.h aica/armcore.c \
-       aica/armcore.h aica/armdasm.c aica/armdasm.h aica/armmem.c \
-       aica/aica.c aica/aica.h aica/audio.c aica/audio.h pvr2/pvr2.c \
-       pvr2/pvr2.h pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c \
-       pvr2/rendsort.c pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c \
-       pvr2/scene.c pvr2/scene.h pvr2/gl_sl.c pvr2/gl_slsrc.c \
-       pvr2/glutil.c pvr2/glutil.h pvr2/glrender.c pvr2/vertex.glsl \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     gdrom/packet.h gdrom/gdrom.c gdrom/gdrom.h dreamcast.c \
+       dreamcast.h eventq.c eventq.h sh4/sh4.c sh4/intc.c sh4/intc.h \
+       sh4/sh4mem.c sh4/timer.c sh4/dmac.c sh4/mmu.c sh4/sh4core.c \
+       sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h sh4/sh4mmio.c \
+       sh4/sh4mmio.h sh4/scif.c sh4/sh4stat.c sh4/sh4stat.h \
+       xlat/xltcache.c xlat/xltcache.h sh4/sh4.h sh4/dmac.h sh4/pmm.c \
+       sh4/cache.c sh4/mmu.h aica/armcore.c aica/armcore.h \
+       aica/armdasm.c aica/armdasm.h aica/armmem.c aica/aica.c \
+       aica/aica.h aica/audio.c aica/audio.h pvr2/pvr2.c pvr2/pvr2.h \
+       pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c \
+       pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c \
+       pvr2/scene.h pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c \
+       pvr2/glutil.h pvr2/glrender.c pvr2/vertex.glsl \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    pvr2/fragment.glsl maple/maple.c maple/maple.h \
        maple/controller.c maple/kbd.c maple/mouse.c maple/lightgun.c \
        maple/vmu.c loader.c loader.h elf.h bootstrap.c bootstrap.h \
        util.c gdlist.c gdlist.h vmu/vmuvol.c vmu/vmuvol.h \
        vmu/vmulist.c vmu/vmulist.h display.c display.h dckeysyms.h \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \
-       drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \
-       drivers/serial_unix.c sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in \
-       sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c hotkeys.h plugin.c \
-       plugin.h sh4/sh4x86.c xlat/x86/x86op.h xlat/x86/ia32abi.h \
-       xlat/x86/amd64abi.h sh4/sh4trans.c sh4/sh4trans.h sh4/mmux86.c \
-       x86dasm/x86dasm.c x86dasm/x86dasm.h x86dasm/i386-dis.c \
-       x86dasm/dis-init.c x86dasm/dis-buf.c x86dasm/ansidecl.h \
-       x86dasm/bfd.h x86dasm/dis-asm.h x86dasm/symcat.h \
-       x86dasm/sysdep.h gtkui/gtkui.c gtkui/gtkui.h gtkui/gtk_win.c \
-       gtkui/gtkcb.c gtkui/gtk_cfg.c gtkui/gtk_mmio.c \
-       gtkui/gtk_debug.c gtkui/gtk_dump.c gtkui/gtk_ctrl.c \
-       gtkui/gtk_gd.c drivers/io_glib.c drivers/video_gtk.c \
-       cocoaui/cocoaui.m cocoaui/cocoaui.h cocoaui/cocoa_cfg.m \
-       cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \
-       cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m drivers/io_osx.m \
-       drivers/video_osx.m drivers/mac_keymap.h \
-       drivers/mac_keymap.txt paths_unix.c drivers/video_gdk.c \
-       drivers/video_glx.c drivers/video_glx.h drivers/video_nsgl.m \
-       drivers/video_nsgl.h drivers/audio_osx.m drivers/audio_sdl.c \
-       drivers/audio_pulse.c drivers/audio_esd.c drivers/audio_alsa.c \
-       drivers/input_lirc.c drivers/cd_linux.c drivers/cd_osx.c \
-       drivers/osx_iokit.m drivers/osx_iokit.h drivers/cd_none.c \
-       drivers/joy_linux.c drivers/joy_linux.h
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     drivers/audio_null.c drivers/video_null.c drivers/video_gl.c \
+       drivers/video_gl.h drivers/gl_fbo.c drivers/serial_unix.c \
+       drivers/cdrom/cdrom.h drivers/cdrom/cdrom.c \
+       drivers/cdrom/drive.h drivers/cdrom/sector.h \
+       drivers/cdrom/sector.c drivers/cdrom/defs.h \
+       drivers/cdrom/cd_nrg.c drivers/cdrom/cd_cdi.c \
+       drivers/cdrom/cd_gdi.c drivers/cdrom/edc_ecc.c \
+       drivers/cdrom/ecc.h drivers/cdrom/drive.c \
+       drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \
+       drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h \
+       drivers/cdrom/cd_mmc.c sh4/sh4.def sh4/sh4core.in \
+       sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c \
+       hotkeys.h plugin.c plugin.h sh4/sh4x86.c xlat/x86/x86op.h \
+       xlat/x86/ia32abi.h xlat/x86/amd64abi.h sh4/sh4trans.c \
+       sh4/sh4trans.h sh4/mmux86.c x86dasm/x86dasm.c \
+       x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \
+       x86dasm/dis-buf.c x86dasm/ansidecl.h x86dasm/bfd.h \
+       x86dasm/dis-asm.h x86dasm/symcat.h x86dasm/sysdep.h \
+       gtkui/gtkui.c gtkui/gtkui.h gtkui/gtk_win.c gtkui/gtkcb.c \
+       gtkui/gtk_cfg.c gtkui/gtk_mmio.c gtkui/gtk_debug.c \
+       gtkui/gtk_dump.c gtkui/gtk_ctrl.c gtkui/gtk_gd.c \
+       drivers/io_glib.c drivers/video_gtk.c cocoaui/cocoaui.m \
+       cocoaui/cocoaui.h cocoaui/cocoa_cfg.m cocoaui/cocoa_win.m \
+       cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m cocoaui/cocoa_ctrl.m \
+       cocoaui/paths_osx.m drivers/io_osx.m drivers/video_osx.m \
+       drivers/mac_keymap.h drivers/mac_keymap.txt paths_unix.c \
+       drivers/video_gdk.c drivers/video_glx.c drivers/video_glx.h \
+       drivers/video_nsgl.m drivers/video_nsgl.h drivers/audio_osx.m \
+       drivers/audio_sdl.c drivers/audio_pulse.c drivers/audio_esd.c \
+       drivers/audio_alsa.c drivers/input_lirc.c \
+       drivers/cdrom/cd_linux.c drivers/cdrom/cd_osx.c \
+       drivers/osx_iokit.m drivers/osx_iokit.h \
+       drivers/cdrom/cd_none.c drivers/joy_linux.c \
+       drivers/joy_linux.h
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @BUILD_SHARED_TRUE@am__objects_1 = lxdream-plugin.$(OBJEXT)
 @BUILD_SH4X86_TRUE@am__objects_2 = lxdream-sh4x86.$(OBJEXT) \
 @BUILD_SH4X86_TRUE@    lxdream-sh4trans.$(OBJEXT) \
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -238,36 +245,37 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      lxdream-syscall.$(OBJEXT) lxdream-bios.$(OBJEXT) \
        lxdream-dcload.$(OBJEXT) lxdream-gdbserver.$(OBJEXT) \
        lxdream-ioutil.$(OBJEXT) lxdream-lxpaths.$(OBJEXT) \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   lxdream-ide.$(OBJEXT) lxdream-gdimage.$(OBJEXT) \
-       lxdream-gdrom.$(OBJEXT) lxdream-nrg.$(OBJEXT) \
-       lxdream-cdi.$(OBJEXT) lxdream-gdi.$(OBJEXT) \
-       lxdream-edc_ecc.$(OBJEXT) lxdream-dreamcast.$(OBJEXT) \
-       lxdream-eventq.$(OBJEXT) lxdream-sh4.$(OBJEXT) \
-       lxdream-intc.$(OBJEXT) lxdream-sh4mem.$(OBJEXT) \
-       lxdream-timer.$(OBJEXT) lxdream-dmac.$(OBJEXT) \
-       lxdream-mmu.$(OBJEXT) lxdream-sh4core.$(OBJEXT) \
-       lxdream-sh4dasm.$(OBJEXT) lxdream-sh4mmio.$(OBJEXT) \
-       lxdream-scif.$(OBJEXT) lxdream-sh4stat.$(OBJEXT) \
-       lxdream-xltcache.$(OBJEXT) lxdream-pmm.$(OBJEXT) \
-       lxdream-cache.$(OBJEXT) lxdream-armcore.$(OBJEXT) \
-       lxdream-armdasm.$(OBJEXT) lxdream-armmem.$(OBJEXT) \
-       lxdream-aica.$(OBJEXT) lxdream-audio.$(OBJEXT) \
-       lxdream-pvr2.$(OBJEXT) lxdream-pvr2mem.$(OBJEXT) \
-       lxdream-tacore.$(OBJEXT) lxdream-rendsort.$(OBJEXT) \
-       lxdream-texcache.$(OBJEXT) lxdream-yuv.$(OBJEXT) \
-       lxdream-rendsave.$(OBJEXT) lxdream-scene.$(OBJEXT) \
-       lxdream-gl_sl.$(OBJEXT) lxdream-gl_slsrc.$(OBJEXT) \
-       lxdream-glutil.$(OBJEXT) lxdream-glrender.$(OBJEXT) \
-       lxdream-maple.$(OBJEXT) lxdream-controller.$(OBJEXT) \
-       lxdream-kbd.$(OBJEXT) lxdream-mouse.$(OBJEXT) \
-       lxdream-lightgun.$(OBJEXT) lxdream-vmu.$(OBJEXT) \
-       lxdream-loader.$(OBJEXT) lxdream-bootstrap.$(OBJEXT) \
-       lxdream-util.$(OBJEXT) lxdream-gdlist.$(OBJEXT) \
-       lxdream-vmuvol.$(OBJEXT) lxdream-vmulist.$(OBJEXT) \
-       lxdream-display.$(OBJEXT) lxdream-audio_null.$(OBJEXT) \
-       lxdream-video_null.$(OBJEXT) lxdream-cd_mmc.$(OBJEXT) \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     lxdream-ide.$(OBJEXT) lxdream-gdrom.$(OBJEXT) \
+       lxdream-dreamcast.$(OBJEXT) lxdream-eventq.$(OBJEXT) \
+       lxdream-sh4.$(OBJEXT) lxdream-intc.$(OBJEXT) \
+       lxdream-sh4mem.$(OBJEXT) lxdream-timer.$(OBJEXT) \
+       lxdream-dmac.$(OBJEXT) lxdream-mmu.$(OBJEXT) \
+       lxdream-sh4core.$(OBJEXT) lxdream-sh4dasm.$(OBJEXT) \
+       lxdream-sh4mmio.$(OBJEXT) lxdream-scif.$(OBJEXT) \
+       lxdream-sh4stat.$(OBJEXT) lxdream-xltcache.$(OBJEXT) \
+       lxdream-pmm.$(OBJEXT) lxdream-cache.$(OBJEXT) \
+       lxdream-armcore.$(OBJEXT) lxdream-armdasm.$(OBJEXT) \
+       lxdream-armmem.$(OBJEXT) lxdream-aica.$(OBJEXT) \
+       lxdream-audio.$(OBJEXT) lxdream-pvr2.$(OBJEXT) \
+       lxdream-pvr2mem.$(OBJEXT) lxdream-tacore.$(OBJEXT) \
+       lxdream-rendsort.$(OBJEXT) lxdream-texcache.$(OBJEXT) \
+       lxdream-yuv.$(OBJEXT) lxdream-rendsave.$(OBJEXT) \
+       lxdream-scene.$(OBJEXT) lxdream-gl_sl.$(OBJEXT) \
+       lxdream-gl_slsrc.$(OBJEXT) lxdream-glutil.$(OBJEXT) \
+       lxdream-glrender.$(OBJEXT) lxdream-maple.$(OBJEXT) \
+       lxdream-controller.$(OBJEXT) lxdream-kbd.$(OBJEXT) \
+       lxdream-mouse.$(OBJEXT) lxdream-lightgun.$(OBJEXT) \
+       lxdream-vmu.$(OBJEXT) lxdream-loader.$(OBJEXT) \
+       lxdream-bootstrap.$(OBJEXT) lxdream-util.$(OBJEXT) \
+       lxdream-gdlist.$(OBJEXT) lxdream-vmuvol.$(OBJEXT) \
+       lxdream-vmulist.$(OBJEXT) lxdream-display.$(OBJEXT) \
+       lxdream-audio_null.$(OBJEXT) lxdream-video_null.$(OBJEXT) \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    lxdream-video_gl.$(OBJEXT) lxdream-gl_fbo.$(OBJEXT) \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   lxdream-serial_unix.$(OBJEXT) lxdream-<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >hotkeys</span>.$(OBJEXT) \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     lxdream-serial_unix.$(OBJEXT) lxdream-<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >cdrom</span>.$(OBJEXT) \
+       lxdream-sector.$(OBJEXT) lxdream-cd_nrg.$(OBJEXT) \
+       lxdream-cd_cdi.$(OBJEXT) lxdream-cd_gdi.$(OBJEXT) \
+       lxdream-edc_ecc.$(OBJEXT) lxdream-drive.$(OBJEXT) \
+       lxdream-cd_mmc.$(OBJEXT) lxdream-hotkeys.$(OBJEXT) \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    $(am__objects_1) $(am__objects_2) $(am__objects_3) \
        $(am__objects_4) $(am__objects_5) $(am__objects_6) \
        $(am__objects_7) $(am__objects_8) $(am__objects_9) \
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -546,38 +554,43 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      gui.h cpu.c cpu.h hook.h gettext.h mem.c mem.h sdram.c mmio.h \
        watch.c asic.c asic.h clock.h serial.h syscall.c syscall.h \
        bios.c dcload.c gdbserver.c ioutil.c ioutil.h lxpaths.c \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   lxpaths.h gdrom/ide.c gdrom/ide.h gdrom/packet.h \
-       gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c \
-       gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c gdrom/ecc.h \
-       gdrom/edc_crctable.h gdrom/edc_encoder.h gdrom/edc_l2sq.h \
-       gdrom/edc_scramble.h gdrom/gddriver.h dreamcast.c dreamcast.h \
-       eventq.c eventq.h sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c \
-       sh4/timer.c sh4/dmac.c sh4/mmu.c sh4/sh4core.c sh4/sh4core.h \
-       sh4/sh4dasm.c sh4/sh4dasm.h sh4/sh4mmio.c sh4/sh4mmio.h \
-       sh4/scif.c sh4/sh4stat.c sh4/sh4stat.h xlat/xltcache.c \
-       xlat/xltcache.h sh4/sh4.h sh4/dmac.h sh4/pmm.c sh4/cache.c \
-       sh4/mmu.h aica/armcore.c aica/armcore.h aica/armdasm.c \
-       aica/armdasm.h aica/armmem.c aica/aica.c aica/aica.h \
-       aica/audio.c aica/audio.h pvr2/pvr2.c pvr2/pvr2.h \
-       pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c \
-       pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c \
-       pvr2/scene.h pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c \
-       pvr2/glutil.h pvr2/glrender.c pvr2/vertex.glsl \
-       pvr2/fragment.glsl maple/maple.c maple/maple.h \
-       maple/controller.c maple/kbd.c maple/mouse.c maple/lightgun.c \
-       maple/vmu.c loader.c loader.h elf.h bootstrap.c bootstrap.h \
-       util.c gdlist.c gdlist.h vmu/vmuvol.c vmu/vmuvol.h \
-       vmu/vmulist.c vmu/vmulist.h display.c display.h dckeysyms.h \
-       drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \
-       drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \
-       drivers/serial_unix.c sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in \
-       sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c hotkeys.h \
-       $(am__append_1) $(am__append_2) $(am__append_4) \
-       $(am__append_5) $(am__append_6) $(am__append_7) \
-       $(am__append_8) $(am__append_9) $(am__append_10) \
-       $(am__append_17) $(am__append_19) $(am__append_21) \
-       $(am__append_23) $(am__append_25) $(am__append_27) \
-       $(am__append_28) $(am__append_29) $(am__append_30)
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     lxpaths.h gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdrom.c \
+       gdrom/gdrom.h dreamcast.c dreamcast.h eventq.c eventq.h \
+       sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c \
+       sh4/dmac.c sh4/mmu.c sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c \
+       sh4/sh4dasm.h sh4/sh4mmio.c sh4/sh4mmio.h sh4/scif.c \
+       sh4/sh4stat.c sh4/sh4stat.h xlat/xltcache.c xlat/xltcache.h \
+       sh4/sh4.h sh4/dmac.h sh4/pmm.c sh4/cache.c sh4/mmu.h \
+       aica/armcore.c aica/armcore.h aica/armdasm.c aica/armdasm.h \
+       aica/armmem.c aica/aica.c aica/aica.h aica/audio.c \
+       aica/audio.h pvr2/pvr2.c pvr2/pvr2.h pvr2/pvr2mem.c \
+       pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c pvr2/texcache.c \
+       pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c pvr2/scene.h \
+       pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c pvr2/glutil.h \
+       pvr2/glrender.c pvr2/vertex.glsl pvr2/fragment.glsl \
+       maple/maple.c maple/maple.h maple/controller.c maple/kbd.c \
+       maple/mouse.c maple/lightgun.c maple/vmu.c loader.c loader.h \
+       elf.h bootstrap.c bootstrap.h util.c gdlist.c gdlist.h \
+       vmu/vmuvol.c vmu/vmuvol.h vmu/vmulist.c vmu/vmulist.h \
+       display.c display.h dckeysyms.h drivers/audio_null.c \
+       drivers/video_null.c drivers/video_gl.c drivers/video_gl.h \
+       drivers/gl_fbo.c drivers/serial_unix.c drivers/cdrom/cdrom.h \
+       drivers/cdrom/cdrom.c drivers/cdrom/drive.h \
+       drivers/cdrom/sector.h drivers/cdrom/sector.c \
+       drivers/cdrom/defs.h drivers/cdrom/cd_nrg.c \
+       drivers/cdrom/cd_cdi.c drivers/cdrom/cd_gdi.c \
+       drivers/cdrom/edc_ecc.c drivers/cdrom/ecc.h \
+       drivers/cdrom/drive.c drivers/cdrom/edc_crctable.h \
+       drivers/cdrom/edc_encoder.h drivers/cdrom/edc_l2sq.h \
+       drivers/cdrom/edc_scramble.h drivers/cdrom/cd_mmc.c \
+       sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in \
+       sh4/sh4stat.in hotkeys.c hotkeys.h $(am__append_1) \
+       $(am__append_2) $(am__append_4) $(am__append_5) \
+       $(am__append_6) $(am__append_7) $(am__append_8) \
+       $(am__append_9) $(am__append_10) $(am__append_17) \
+       $(am__append_19) $(am__append_21) $(am__append_23) \
+       $(am__append_25) $(am__append_27) $(am__append_28) \
+       $(am__append_29) $(am__append_30)
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@
 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @LXDREAM_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@
 @BUILD_SH4X86_TRUE@test_testsh4x86_CPPFLAGS = @LXDREAMCPPFLAGS@
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -756,11 +769,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-bios.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-bootstrap.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cache.Po@am__quote@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_cdi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_gdi.Po@am__quote@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_mmc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_none.Po@am__quote@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_nrg.Po@am__quote@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_osx.Po@am__quote@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >i</span>.Po@am__quote@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom</span>.Po@am__quote@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cocoa_cfg.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cocoa_ctrl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cocoa_gd.Po@am__quote@
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -776,11 +792,10 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-display.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-dmac.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-dreamcast.Po@am__quote@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-drive.Po@am__quote@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-edc_ecc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-eventq.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdbserver.Po@am__quote@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdi.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdimage.Po@am__quote@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdlist.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdrom.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gl_fbo.Po@am__quote@
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -816,7 +831,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mmu.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mmux86.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mouse.Po@am__quote@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-nrg.Po@am__quote@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-osx_iokit.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-paths_osx.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-paths_unix.Po@am__quote@
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -829,6 +843,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-scene.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-scif.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sdram.Po@am__quote@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sector.Po@am__quote@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-serial_unix.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sh4.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sh4core.Po@am__quote@
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1153,20 +1168,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-ide.obj `if test -f 'gdrom/ide.c'; then $(CYGPATH_W) 'gdrom/ide.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/ide.c'; fi`
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-gdimage.o: gdrom/gdimage.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdimage.o -MD -MP -MF "$(DEPDIR)/lxdream-gdimage.Tpo" -c -o lxdream-gdimage.o `test -f 'gdrom/gdimage.c' || echo '$(srcdir)/'`gdrom/gdimage.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-gdimage.Tpo" "$(DEPDIR)/lxdream-gdimage.Po"; else rm -f "$(DEPDIR)/lxdream-gdimage.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/gdimage.c' object='lxdream-gdimage.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdimage.o `test -f 'gdrom/gdimage.c' || echo '$(srcdir)/'`gdrom/gdimage.c
-
-lxdream-gdimage.obj: gdrom/gdimage.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdimage.obj -MD -MP -MF "$(DEPDIR)/lxdream-gdimage.Tpo" -c -o lxdream-gdimage.obj `if test -f 'gdrom/gdimage.c'; then $(CYGPATH_W) 'gdrom/gdimage.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdimage.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-gdimage.Tpo" "$(DEPDIR)/lxdream-gdimage.Po"; else rm -f "$(DEPDIR)/lxdream-gdimage.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/gdimage.c' object='lxdream-gdimage.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdimage.obj `if test -f 'gdrom/gdimage.c'; then $(CYGPATH_W) 'gdrom/gdimage.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdimage.c'; fi`
-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > lxdream-gdrom.o: gdrom/gdrom.c
 @am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdrom.o -MD -MP -MF "$(DEPDIR)/lxdream-gdrom.Tpo" -c -o lxdream-gdrom.o `test -f 'gdrom/gdrom.c' || echo '$(srcdir)/'`gdrom/gdrom.c; \
 @am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-gdrom.Tpo" "$(DEPDIR)/lxdream-gdrom.Po"; else rm -f "$(DEPDIR)/lxdream-gdrom.Tpo"; exit 1; fi
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1181,62 +1182,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdrom.obj `if test -f 'gdrom/gdrom.c'; then $(CYGPATH_W) 'gdrom/gdrom.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdrom.c'; fi`
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-nrg.o: gdrom/nrg.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-nrg.o -MD -MP -MF "$(DEPDIR)/lxdream-nrg.Tpo" -c -o lxdream-nrg.o `test -f 'gdrom/nrg.c' || echo '$(srcdir)/'`gdrom/nrg.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-nrg.Tpo" "$(DEPDIR)/lxdream-nrg.Po"; else rm -f "$(DEPDIR)/lxdream-nrg.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/nrg.c' object='lxdream-nrg.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-nrg.o `test -f 'gdrom/nrg.c' || echo '$(srcdir)/'`gdrom/nrg.c
-
-lxdream-nrg.obj: gdrom/nrg.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-nrg.obj -MD -MP -MF "$(DEPDIR)/lxdream-nrg.Tpo" -c -o lxdream-nrg.obj `if test -f 'gdrom/nrg.c'; then $(CYGPATH_W) 'gdrom/nrg.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/nrg.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-nrg.Tpo" "$(DEPDIR)/lxdream-nrg.Po"; else rm -f "$(DEPDIR)/lxdream-nrg.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/nrg.c' object='lxdream-nrg.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-nrg.obj `if test -f 'gdrom/nrg.c'; then $(CYGPATH_W) 'gdrom/nrg.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/nrg.c'; fi`
-
-lxdream-cdi.o: gdrom/cdi.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdi.o -MD -MP -MF "$(DEPDIR)/lxdream-cdi.Tpo" -c -o lxdream-cdi.o `test -f 'gdrom/cdi.c' || echo '$(srcdir)/'`gdrom/cdi.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cdi.Tpo" "$(DEPDIR)/lxdream-cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cdi.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/cdi.c' object='lxdream-cdi.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdi.o `test -f 'gdrom/cdi.c' || echo '$(srcdir)/'`gdrom/cdi.c
-
-lxdream-cdi.obj: gdrom/cdi.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-cdi.Tpo" -c -o lxdream-cdi.obj `if test -f 'gdrom/cdi.c'; then $(CYGPATH_W) 'gdrom/cdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/cdi.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cdi.Tpo" "$(DEPDIR)/lxdream-cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cdi.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/cdi.c' object='lxdream-cdi.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdi.obj `if test -f 'gdrom/cdi.c'; then $(CYGPATH_W) 'gdrom/cdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/cdi.c'; fi`
-
-lxdream-gdi.o: gdrom/gdi.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdi.o -MD -MP -MF "$(DEPDIR)/lxdream-gdi.Tpo" -c -o lxdream-gdi.o `test -f 'gdrom/gdi.c' || echo '$(srcdir)/'`gdrom/gdi.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-gdi.Tpo" "$(DEPDIR)/lxdream-gdi.Po"; else rm -f "$(DEPDIR)/lxdream-gdi.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/gdi.c' object='lxdream-gdi.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdi.o `test -f 'gdrom/gdi.c' || echo '$(srcdir)/'`gdrom/gdi.c
-
-lxdream-gdi.obj: gdrom/gdi.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-gdi.Tpo" -c -o lxdream-gdi.obj `if test -f 'gdrom/gdi.c'; then $(CYGPATH_W) 'gdrom/gdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdi.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-gdi.Tpo" "$(DEPDIR)/lxdream-gdi.Po"; else rm -f "$(DEPDIR)/lxdream-gdi.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/gdi.c' object='lxdream-gdi.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdi.obj `if test -f 'gdrom/gdi.c'; then $(CYGPATH_W) 'gdrom/gdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdi.c'; fi`
-
-lxdream-edc_ecc.o: gdrom/edc_ecc.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.o -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.o `test -f 'gdrom/edc_ecc.c' || echo '$(srcdir)/'`gdrom/edc_ecc.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/edc_ecc.c' object='lxdream-edc_ecc.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.o `test -f 'gdrom/edc_ecc.c' || echo '$(srcdir)/'`gdrom/edc_ecc.c
-
-lxdream-edc_ecc.obj: gdrom/edc_ecc.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.obj -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.obj `if test -f 'gdrom/edc_ecc.c'; then $(CYGPATH_W) 'gdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/edc_ecc.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gdrom/edc_ecc.c' object='lxdream-edc_ecc.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.obj `if test -f 'gdrom/edc_ecc.c'; then $(CYGPATH_W) 'gdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/edc_ecc.c'; fi`
-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > lxdream-dreamcast.o: dreamcast.c
 @am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-dreamcast.o -MD -MP -MF "$(DEPDIR)/lxdream-dreamcast.Tpo" -c -o lxdream-dreamcast.o `test -f 'dreamcast.c' || echo '$(srcdir)/'`dreamcast.c; \
 @am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-dreamcast.Tpo" "$(DEPDIR)/lxdream-dreamcast.Po"; else rm -f "$(DEPDIR)/lxdream-dreamcast.Tpo"; exit 1; fi
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1909,20 +1854,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-video_null.obj `if test -f 'drivers/video_null.c'; then $(CYGPATH_W) 'drivers/video_null.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_null.c'; fi`
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-cd_mmc.o: drivers/cd_mmc.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.o `test -f 'drivers/cd_mmc.c' || echo '$(srcdir)/'`drivers/cd_mmc.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cd_mmc.c' object='lxdream-cd_mmc.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.o `test -f 'drivers/cd_mmc.c' || echo '$(srcdir)/'`drivers/cd_mmc.c
-
-lxdream-cd_mmc.obj: drivers/cd_mmc.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_mmc.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cd_mmc.c' object='lxdream-cd_mmc.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_mmc.c'; fi`
-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > lxdream-video_gl.o: drivers/video_gl.c
 @am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-video_gl.o -MD -MP -MF "$(DEPDIR)/lxdream-video_gl.Tpo" -c -o lxdream-video_gl.o `test -f 'drivers/video_gl.c' || echo '$(srcdir)/'`drivers/video_gl.c; \
 @am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-video_gl.Tpo" "$(DEPDIR)/lxdream-video_gl.Po"; else rm -f "$(DEPDIR)/lxdream-video_gl.Tpo"; exit 1; fi
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1965,6 +1896,118 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-serial_unix.obj `if test -f 'drivers/serial_unix.c'; then $(CYGPATH_W) 'drivers/serial_unix.c'; else $(CYGPATH_W) '$(srcdir)/drivers/serial_unix.c'; fi`
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream-cdrom.o: drivers/cdrom/cdrom.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdrom.o -MD -MP -MF "$(DEPDIR)/lxdream-cdrom.Tpo" -c -o lxdream-cdrom.o `test -f 'drivers/cdrom/cdrom.c' || echo '$(srcdir)/'`drivers/cdrom/cdrom.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cdrom.Tpo" "$(DEPDIR)/lxdream-cdrom.Po"; else rm -f "$(DEPDIR)/lxdream-cdrom.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cdrom.c' object='lxdream-cdrom.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdrom.o `test -f 'drivers/cdrom/cdrom.c' || echo '$(srcdir)/'`drivers/cdrom/cdrom.c
+
+lxdream-cdrom.obj: drivers/cdrom/cdrom.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdrom.obj -MD -MP -MF "$(DEPDIR)/lxdream-cdrom.Tpo" -c -o lxdream-cdrom.obj `if test -f 'drivers/cdrom/cdrom.c'; then $(CYGPATH_W) 'drivers/cdrom/cdrom.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cdrom.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cdrom.Tpo" "$(DEPDIR)/lxdream-cdrom.Po"; else rm -f "$(DEPDIR)/lxdream-cdrom.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cdrom.c' object='lxdream-cdrom.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdrom.obj `if test -f 'drivers/cdrom/cdrom.c'; then $(CYGPATH_W) 'drivers/cdrom/cdrom.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cdrom.c'; fi`
+
+lxdream-sector.o: drivers/cdrom/sector.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-sector.o -MD -MP -MF "$(DEPDIR)/lxdream-sector.Tpo" -c -o lxdream-sector.o `test -f 'drivers/cdrom/sector.c' || echo '$(srcdir)/'`drivers/cdrom/sector.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-sector.Tpo" "$(DEPDIR)/lxdream-sector.Po"; else rm -f "$(DEPDIR)/lxdream-sector.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/sector.c' object='lxdream-sector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-sector.o `test -f 'drivers/cdrom/sector.c' || echo '$(srcdir)/'`drivers/cdrom/sector.c
+
+lxdream-sector.obj: drivers/cdrom/sector.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-sector.obj -MD -MP -MF "$(DEPDIR)/lxdream-sector.Tpo" -c -o lxdream-sector.obj `if test -f 'drivers/cdrom/sector.c'; then $(CYGPATH_W) 'drivers/cdrom/sector.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/sector.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-sector.Tpo" "$(DEPDIR)/lxdream-sector.Po"; else rm -f "$(DEPDIR)/lxdream-sector.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/sector.c' object='lxdream-sector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-sector.obj `if test -f 'drivers/cdrom/sector.c'; then $(CYGPATH_W) 'drivers/cdrom/sector.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/sector.c'; fi`
+
+lxdream-cd_nrg.o: drivers/cdrom/cd_nrg.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_nrg.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_nrg.Tpo" -c -o lxdream-cd_nrg.o `test -f 'drivers/cdrom/cd_nrg.c' || echo '$(srcdir)/'`drivers/cdrom/cd_nrg.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_nrg.Tpo" "$(DEPDIR)/lxdream-cd_nrg.Po"; else rm -f "$(DEPDIR)/lxdream-cd_nrg.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_nrg.c' object='lxdream-cd_nrg.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_nrg.o `test -f 'drivers/cdrom/cd_nrg.c' || echo '$(srcdir)/'`drivers/cdrom/cd_nrg.c
+
+lxdream-cd_nrg.obj: drivers/cdrom/cd_nrg.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_nrg.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_nrg.Tpo" -c -o lxdream-cd_nrg.obj `if test -f 'drivers/cdrom/cd_nrg.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_nrg.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_nrg.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_nrg.Tpo" "$(DEPDIR)/lxdream-cd_nrg.Po"; else rm -f "$(DEPDIR)/lxdream-cd_nrg.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_nrg.c' object='lxdream-cd_nrg.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_nrg.obj `if test -f 'drivers/cdrom/cd_nrg.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_nrg.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_nrg.c'; fi`
+
+lxdream-cd_cdi.o: drivers/cdrom/cd_cdi.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_cdi.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_cdi.Tpo" -c -o lxdream-cd_cdi.o `test -f 'drivers/cdrom/cd_cdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_cdi.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_cdi.Tpo" "$(DEPDIR)/lxdream-cd_cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_cdi.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_cdi.c' object='lxdream-cd_cdi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_cdi.o `test -f 'drivers/cdrom/cd_cdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_cdi.c
+
+lxdream-cd_cdi.obj: drivers/cdrom/cd_cdi.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_cdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_cdi.Tpo" -c -o lxdream-cd_cdi.obj `if test -f 'drivers/cdrom/cd_cdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_cdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_cdi.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_cdi.Tpo" "$(DEPDIR)/lxdream-cd_cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_cdi.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_cdi.c' object='lxdream-cd_cdi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_cdi.obj `if test -f 'drivers/cdrom/cd_cdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_cdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_cdi.c'; fi`
+
+lxdream-cd_gdi.o: drivers/cdrom/cd_gdi.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_gdi.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_gdi.Tpo" -c -o lxdream-cd_gdi.o `test -f 'drivers/cdrom/cd_gdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_gdi.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_gdi.Tpo" "$(DEPDIR)/lxdream-cd_gdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_gdi.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_gdi.c' object='lxdream-cd_gdi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_gdi.o `test -f 'drivers/cdrom/cd_gdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_gdi.c
+
+lxdream-cd_gdi.obj: drivers/cdrom/cd_gdi.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_gdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_gdi.Tpo" -c -o lxdream-cd_gdi.obj `if test -f 'drivers/cdrom/cd_gdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_gdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_gdi.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_gdi.Tpo" "$(DEPDIR)/lxdream-cd_gdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_gdi.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_gdi.c' object='lxdream-cd_gdi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_gdi.obj `if test -f 'drivers/cdrom/cd_gdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_gdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_gdi.c'; fi`
+
+lxdream-edc_ecc.o: drivers/cdrom/edc_ecc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.o -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.o `test -f 'drivers/cdrom/edc_ecc.c' || echo '$(srcdir)/'`drivers/cdrom/edc_ecc.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/edc_ecc.c' object='lxdream-edc_ecc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.o `test -f 'drivers/cdrom/edc_ecc.c' || echo '$(srcdir)/'`drivers/cdrom/edc_ecc.c
+
+lxdream-edc_ecc.obj: drivers/cdrom/edc_ecc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.obj -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.obj `if test -f 'drivers/cdrom/edc_ecc.c'; then $(CYGPATH_W) 'drivers/cdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/edc_ecc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/edc_ecc.c' object='lxdream-edc_ecc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.obj `if test -f 'drivers/cdrom/edc_ecc.c'; then $(CYGPATH_W) 'drivers/cdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/edc_ecc.c'; fi`
+
+lxdream-drive.o: drivers/cdrom/drive.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-drive.o -MD -MP -MF "$(DEPDIR)/lxdream-drive.Tpo" -c -o lxdream-drive.o `test -f 'drivers/cdrom/drive.c' || echo '$(srcdir)/'`drivers/cdrom/drive.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-drive.Tpo" "$(DEPDIR)/lxdream-drive.Po"; else rm -f "$(DEPDIR)/lxdream-drive.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/drive.c' object='lxdream-drive.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-drive.o `test -f 'drivers/cdrom/drive.c' || echo '$(srcdir)/'`drivers/cdrom/drive.c
+
+lxdream-drive.obj: drivers/cdrom/drive.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-drive.obj -MD -MP -MF "$(DEPDIR)/lxdream-drive.Tpo" -c -o lxdream-drive.obj `if test -f 'drivers/cdrom/drive.c'; then $(CYGPATH_W) 'drivers/cdrom/drive.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/drive.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-drive.Tpo" "$(DEPDIR)/lxdream-drive.Po"; else rm -f "$(DEPDIR)/lxdream-drive.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/drive.c' object='lxdream-drive.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-drive.obj `if test -f 'drivers/cdrom/drive.c'; then $(CYGPATH_W) 'drivers/cdrom/drive.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/drive.c'; fi`
+
+lxdream-cd_mmc.o: drivers/cdrom/cd_mmc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.o `test -f 'drivers/cdrom/cd_mmc.c' || echo '$(srcdir)/'`drivers/cdrom/cd_mmc.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_mmc.c' object='lxdream-cd_mmc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.o `test -f 'drivers/cdrom/cd_mmc.c' || echo '$(srcdir)/'`drivers/cdrom/cd_mmc.c
+
+lxdream-cd_mmc.obj: drivers/cdrom/cd_mmc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cdrom/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_mmc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='drivers/cdrom/cd_mmc.c' object='lxdream-cd_mmc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cdrom/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_mmc.c'; fi`
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > lxdream-hotkeys.o: hotkeys.c
 @am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-hotkeys.o -MD -MP -MF "$(DEPDIR)/lxdream-hotkeys.Tpo" -c -o lxdream-hotkeys.o `test -f 'hotkeys.c' || echo '$(srcdir)/'`hotkeys.c; \
 @am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/lxdream-hotkeys.Tpo" "$(DEPDIR)/lxdream-hotkeys.Po"; else rm -f "$(DEPDIR)/lxdream-hotkeys.Tpo"; exit 1; fi
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -2357,47 +2400,47 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-input_lirc.obj `if test -f 'drivers/input_lirc.c'; then $(CYGPATH_W) 'drivers/input_lirc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/input_lirc.c'; fi`
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-cd_linux.o: drivers/cd_linux.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.o `test -f 'drivers/cd_linux.c' || echo '$(srcdir)/'`drivers/cd_linux.c; \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream-cd_linux.o: drivers/cdrom/cd_linux.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.o `test -f 'drivers/cdrom/cd_linux.c' || echo '$(srcdir)/'`drivers/cdrom/cd_linux.c; \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @am__fastdepCC_TRUE@       then mv -f "$(DEPDIR)/lxdream-cd_linux.Tpo" "$(DEPDIR)/lxdream-cd_linux.Po"; else rm -f "$(DEPDIR)/lxdream-cd_linux.Tpo"; exit 1; fi
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__fastdepCC_FALSE@  source='drivers/cd_linux.c' object='lxdream-cd_linux.o' libtool=no @AMDEPBACKSLASH@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__fastdepCC_FALSE@    source='drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_linux.c' object='lxdream-cd_linux.o' libtool=no @AMDEPBACKSLASH@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@am__fastdepCC_FALSE@      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.o `test -f 'drivers/cd<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >_linux.c' || echo '$(srcdir)/'`drivers</span>/cd_linux.c
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@am__fastdepCC_FALSE@        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.o `test -f 'drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd_linux.c' || echo '$(srcdir)/'`drivers/cdrom</span>/cd_linux.c
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-cd_linux.obj: drivers/cd_linux.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.obj `if test -f 'drivers/cd_linux.c'; then $(CYGPATH_W) 'drivers/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_linux.c'; fi`; \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream-cd_linux.obj: drivers/cdrom/cd_linux.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.obj `if test -f 'drivers/cdrom/cd_linux.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_linux.c'; fi`; \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @am__fastdepCC_TRUE@       then mv -f "$(DEPDIR)/lxdream-cd_linux.Tpo" "$(DEPDIR)/lxdream-cd_linux.Po"; else rm -f "$(DEPDIR)/lxdream-cd_linux.Tpo"; exit 1; fi
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__fastdepCC_FALSE@  source='drivers/cd_linux.c' object='lxdream-cd_linux.obj' libtool=no @AMDEPBACKSLASH@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__fastdepCC_FALSE@    source='drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_linux.c' object='lxdream-cd_linux.obj' libtool=no @AMDEPBACKSLASH@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@am__fastdepCC_FALSE@      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.obj `if test -f 'drivers/cd_linux.c'; then $(CYGPATH_W) 'drivers/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_linux.c'; fi`
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@am__fastdepCC_FALSE@        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.obj `if test -f 'drivers/cdrom/cd_linux.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_linux.c'; fi`
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-cd_osx.o: drivers/cd_osx.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.o `test -f 'drivers/cd_osx.c' || echo '$(srcdir)/'`drivers/cd_osx.c; \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream-cd_osx.o: drivers/cdrom/cd_osx.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.o `test -f 'drivers/cdrom/cd_osx.c' || echo '$(srcdir)/'`drivers/cdrom/cd_osx.c; \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @am__fastdepCC_TRUE@       then mv -f "$(DEPDIR)/lxdream-cd_osx.Tpo" "$(DEPDIR)/lxdream-cd_osx.Po"; else rm -f "$(DEPDIR)/lxdream-cd_osx.Tpo"; exit 1; fi
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__fastdepCC_FALSE@  source='drivers/cd_osx.c' object='lxdream-cd_osx.o' libtool=no @AMDEPBACKSLASH@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__fastdepCC_FALSE@    source='drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_osx.c' object='lxdream-cd_osx.o' libtool=no @AMDEPBACKSLASH@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@am__fastdepCC_FALSE@      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.o `test -f 'drivers/cd<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >_osx.c' || echo '$(srcdir)/'`drivers</span>/cd_osx.c
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@am__fastdepCC_FALSE@        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.o `test -f 'drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd_osx.c' || echo '$(srcdir)/'`drivers/cdrom</span>/cd_osx.c
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-cd_osx.obj: drivers/cd_osx.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.obj `if test -f 'drivers/cd_osx.c'; then $(CYGPATH_W) 'drivers/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_osx.c'; fi`; \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream-cd_osx.obj: drivers/cdrom/cd_osx.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.obj `if test -f 'drivers/cdrom/cd_osx.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_osx.c'; fi`; \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @am__fastdepCC_TRUE@       then mv -f "$(DEPDIR)/lxdream-cd_osx.Tpo" "$(DEPDIR)/lxdream-cd_osx.Po"; else rm -f "$(DEPDIR)/lxdream-cd_osx.Tpo"; exit 1; fi
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__fastdepCC_FALSE@  source='drivers/cd_osx.c' object='lxdream-cd_osx.obj' libtool=no @AMDEPBACKSLASH@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__fastdepCC_FALSE@    source='drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_osx.c' object='lxdream-cd_osx.obj' libtool=no @AMDEPBACKSLASH@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@am__fastdepCC_FALSE@      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.obj `if test -f 'drivers/cd_osx.c'; then $(CYGPATH_W) 'drivers/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_osx.c'; fi`
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@am__fastdepCC_FALSE@        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.obj `if test -f 'drivers/cdrom/cd_osx.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_osx.c'; fi`
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-cd_none.o: drivers/cd_none.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.o `test -f 'drivers/cd_none.c' || echo '$(srcdir)/'`drivers/cd_none.c; \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream-cd_none.o: drivers/cdrom/cd_none.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.o `test -f 'drivers/cdrom/cd_none.c' || echo '$(srcdir)/'`drivers/cdrom/cd_none.c; \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @am__fastdepCC_TRUE@       then mv -f "$(DEPDIR)/lxdream-cd_none.Tpo" "$(DEPDIR)/lxdream-cd_none.Po"; else rm -f "$(DEPDIR)/lxdream-cd_none.Tpo"; exit 1; fi
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__fastdepCC_FALSE@  source='drivers/cd_none.c' object='lxdream-cd_none.o' libtool=no @AMDEPBACKSLASH@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__fastdepCC_FALSE@    source='drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_none.c' object='lxdream-cd_none.o' libtool=no @AMDEPBACKSLASH@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@am__fastdepCC_FALSE@      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.o `test -f 'drivers/cd<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >_none.c' || echo '$(srcdir)/'`drivers</span>/cd_none.c
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@am__fastdepCC_FALSE@        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.o `test -f 'drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd_none.c' || echo '$(srcdir)/'`drivers/cdrom</span>/cd_none.c
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-lxdream-cd_none.obj: drivers/cd_none.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.obj `if test -f 'drivers/cd_none.c'; then $(CYGPATH_W) 'drivers/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_none.c'; fi`; \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+lxdream-cd_none.obj: drivers/cdrom/cd_none.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.obj `if test -f 'drivers/cdrom/cd_none.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_none.c'; fi`; \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @am__fastdepCC_TRUE@       then mv -f "$(DEPDIR)/lxdream-cd_none.Tpo" "$(DEPDIR)/lxdream-cd_none.Po"; else rm -f "$(DEPDIR)/lxdream-cd_none.Tpo"; exit 1; fi
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@AMDEP_TRUE@@am__fastdepCC_FALSE@  source='drivers/cd_none.c' object='lxdream-cd_none.obj' libtool=no @AMDEPBACKSLASH@
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@AMDEP_TRUE@@am__fastdepCC_FALSE@    source='drivers/cd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom/cd</span>_none.c' object='lxdream-cd_none.obj' libtool=no @AMDEPBACKSLASH@
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-@am__fastdepCC_FALSE@      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.obj `if test -f 'drivers/cd_none.c'; then $(CYGPATH_W) 'drivers/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_none.c'; fi`
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+@am__fastdepCC_FALSE@        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.obj `if test -f 'drivers/cdrom/cd_none.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_none.c'; fi`
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 lxdream-joy_linux.o: drivers/joy_linux.c
 @am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-joy_linux.o -MD -MP -MF "$(DEPDIR)/lxdream-joy_linux.Tpo" -c -o lxdream-joy_linux.o `test -f 'drivers/joy_linux.c' || echo '$(srcdir)/'`drivers/joy_linux.c; \
</pre></div>
<hr /><a name="file6" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/drivers</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>cd_linux.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cd_linux.c
+++ lxdream/src/drivers/cd_linux.c
@@ -1,174 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * Linux cd-rom device driver. Implemented using the SCSI transport.
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <linux/cdrom.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fstab.h>
-#include <fcntl.h>
-
-#include "gdrom/gddriver.h"
-#include "gdrom/packet.h"
-#include "dream.h"
-
-static gboolean linux_is_cdrom_device( FILE *f );
-static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f );
-static gdrom_error_t linux_packet_read( gdrom_disc_t disc, char *cmd, 
-                                        unsigned char *buf, uint32_t *buflen );
-static gdrom_error_t linux_packet_cmd( gdrom_disc_t disc, char *cmd ); 
-static gboolean linux_media_changed( gdrom_disc_t disc );
-
-
-struct gdrom_image_class cdrom_device_class = { "Linux", NULL,
-        linux_is_cdrom_device, linux_open_device };
-        
-static struct gdrom_scsi_transport linux_scsi_transport = {
-       linux_packet_read, linux_packet_cmd, linux_media_changed };
-        
-static gboolean linux_is_cdrom_device( FILE *f )
-{
-    int caps = ioctl(fileno(f), CDROM_GET_CAPABILITY);
-    if( caps == -1 ) {
-        /* Quick check that this is really a CD device */
-        return FALSE;
-    } else {
-       return TRUE;
-    }
-}              
-
-GList *cdrom_get_native_devices(void)
-{
-    GList *list = NULL;
-    struct fstab *ent;
-    struct stat st;
-    setfsent();
-    while( (ent = getfsent()) != NULL ) {
-        if( (stat(ent->fs_spec, &st) != -1) && 
-                S_ISBLK(st.st_mode) ) {
-            /* Got a valid block device - is it a CDROM? */
-            int fd = open(ent->fs_spec, O_RDONLY|O_NONBLOCK);
-            if( fd == -1 )
-                continue;
-            int caps = ioctl(fd, CDROM_GET_CAPABILITY);
-            if( caps != -1 ) {
-                /* Appears to support CDROM functions */
-                FILE *f = fdopen(fd,"r");
-                gdrom_disc_t disc = gdrom_scsi_disc_new(ent->fs_spec, f, &linux_scsi_transport);
-                if( disc != NULL ) {
-                       list = g_list_append( list, gdrom_device_new(disc->name, disc->display_name) );
-                       disc->destroy(disc,TRUE);
-                }  else {
-                       close(fd);
-                }
-            } else {
-               close(fd);
-            }
-        }
-    }
-    return list;
-}
-
-gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *path )
-{
-    return NULL;
-}
-
-static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f ) 
-{
-       if( !linux_is_cdrom_device(f) ) {
-               return NULL;
-       }
-
-    return gdrom_scsi_disc_new(filename, f, &linux_scsi_transport);
-}
-
-static gboolean linux_media_changed( gdrom_disc_t disc )
-{
-    int fd = fileno(disc->file);
-    int status = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
-    if( status == CDS_DISC_OK ) {
-        status = ioctl(fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT);
-        return status == 0 ? FALSE : TRUE;
-    } else {
-       return disc->disc_type == IDE_DISC_NONE ? FALSE : TRUE;
-    }
-}
-
-/**
- * Send a packet command to the device and wait for a response. 
- * @return 0 on success, -1 on an operating system error, or a sense error
- * code on a device error.
- */
-static gdrom_error_t linux_packet_read( gdrom_disc_t disc, char *cmd, 
-                                        unsigned char *buffer, uint32_t *buflen )
-{
-    int fd = fileno(disc->file);
-    struct request_sense sense;
-    struct cdrom_generic_command cgc;
-
-    memset( &cgc, 0, sizeof(cgc) );
-    memset( &sense, 0, sizeof(sense) );
-    memcpy( cgc.cmd, cmd, 12 );
-    cgc.buffer = buffer;
-    cgc.buflen = *buflen;
-    cgc.sense = &sense;
-    cgc.data_direction = CGC_DATA_READ;
-
-    if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {
-        if( sense.sense_key == 0 ) {
-            return -1; 
-        } else {
-            /* TODO: Map newer codes back to the ones used by the gd-rom. */
-            return sense.sense_key | (sense.asc<<8);
-        }
-    } else {
-        *buflen = cgc.buflen;
-        return 0;
-    }
-}
-
-static gdrom_error_t linux_packet_cmd( gdrom_disc_t disc, char *cmd )
-{
-    int fd = fileno(disc->file);
-    struct request_sense sense;
-    struct cdrom_generic_command cgc;
-
-    memset( &cgc, 0, sizeof(cgc) );
-    memset( &sense, 0, sizeof(sense) );
-    memcpy( cgc.cmd, cmd, 12 );
-    cgc.buffer = 0;
-    cgc.buflen = 0;
-    cgc.sense = &sense;
-    cgc.data_direction = CGC_DATA_NONE;
-
-    if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {
-        if( sense.sense_key == 0 ) {
-            return -1; 
-        } else {
-            /* TODO: Map newer codes back to the ones used by the gd-rom. */
-            return sense.sense_key | (sense.asc<<8);
-        }
-    } else {
-        return 0;
-    }
-}
</pre></div>
<hr /><a name="file7" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/drivers</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>cd_mmc.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cd_mmc.c
+++ lxdream/src/drivers/cd_mmc.c
@@ -1,242 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * SCSI/MMC device interface (depends on lower-level SCSI transport)
- *
- * Copyright (c) 2009 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <string.h>
-#include "lxdream.h"
-#include "gettext.h"
-#include "gdrom/gddriver.h"
-#include "gdrom/packet.h"
-
-#define MAXTOCENTRIES 600  /* This is a fairly generous overestimate really */
-#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)
-#define MAX_SECTORS_PER_CALL 1
-
-#define MSFTOLBA( m,s,f ) (f + (s*CD_FRAMES_PER_SECOND) + (m*CD_FRAMES_PER_MINUTE))
-
-static void mmc_make_read_cd_cmd( char *cmd, uint32_t real_sector, int mode )
-{
-    cmd[0] = 0xBE;
-    cmd[1] = (mode & 0x0E) << 1;
-    cmd[2] = (real_sector >> 24) & 0xFF;
-    cmd[3] = (real_sector >> 16) & 0xFF;
-    cmd[4] = (real_sector >> 8) & 0xFF;
-    cmd[5] = real_sector & 0xFF;
-    cmd[6] = 0;
-    cmd[7] = 0;
-    cmd[8] = 1;
-    cmd[9] = 0;
-    cmd[10]= 0;
-    cmd[11]= 0;
-
-    if( READ_CD_RAW(mode) ) {
-        cmd[9] = 0xF0;
-    } else {
-        if( READ_CD_HEADER(mode) ) {
-            cmd[9] = 0xA0;
-        }
-        if( READ_CD_SUBHEAD(mode) ) {
-            cmd[9] |= 0x40;
-        }
-        if( READ_CD_DATA(mode) ) {
-            cmd[9] |= 0x10;
-        }
-    }
-}
-
-/**
- * Parse the TOC (format 2) into the gdrom_disc structure
- */
-void mmc_parse_toc2( gdrom_disc_t disc, unsigned char *buf )
-{
-    int max_track = 0;
-    int last_track = -1;
-    int leadout = -1;
-    int len = (buf[0] << 8) | buf[1];
-    int session_type = -1;
-    int i;
-    for( i = 4; i<len; i+=11 ) {
-        int session = buf[i];
-        int adr = buf[i+1] >> 4;
-        int point = buf[i+3];
-        if( adr == 0x01 && point > 0 && point < 100 ) {
-            /* Track info */
-            int trackno = point-1;
-            if( point > max_track ) {
-                max_track = point;
-            }
-            disc->track[trackno].flags = (buf[i+1] & 0x0F) << 4;
-            disc->track[trackno].session = session - 1;
-            disc->track[trackno].lba = MSFTOLBA(buf[i+8],buf[i+9],buf[i+10]);
-            if( disc->track[trackno].flags & TRACK_DATA ) {
-                disc->track[trackno].mode = GDROM_MODE1;
-            } else {
-                disc->track[trackno].mode = GDROM_CDDA;
-            }
-            if( last_track != -1 ) {
-                disc->track[last_track].sector_count = disc->track[trackno].lba -
-                disc->track[last_track].lba;
-            }
-            last_track = trackno;
-        } else switch( (adr << 8) | point ) {
-        case 0x1A0: /* session info */
-            if( buf[i+9] == 0x20 ) {
-                session_type = IDE_DISC_CDROMXA;
-            } else {
-                session_type = IDE_DISC_CDROM;
-            }
-            disc->disc_type = session_type;
-            break;
-        case 0x1A2: /* leadout */
-            leadout = MSFTOLBA(buf[i+8], buf[i+9], buf[i+10]);
-            break;
-        }
-    }
-    disc->track_count = max_track;
-
-    if( leadout != -1 && last_track != -1 ) {
-        disc->track[last_track].sector_count = leadout - disc->track[last_track].lba;
-    }
-}
-
-
-/**
- * Construct a drive indentification string based on the response to the
- * INQUIRY command. On success, the disc display_name is updated with the
- * drive name, otherwise the display_name is unchanged.
- * @return PKT_ERR_OK on success, otherwise the host failure code.
- */
-static gdrom_error_t gdrom_scsi_identify_drive( gdrom_disc_t disc )
-{
-    unsigned char ident[256];
-    uint32_t identlen = 256;
-    char cmd[12] = {0x12,0,0,0, 0xFF,0,0,0, 0,0,0,0};
-    gdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, ident, &identlen );
-    if( status == PKT_ERR_OK ) {
-        char vendorid[9];
-        char productid[17];
-        char productrev[5];
-        memcpy( vendorid, ident+8, 8 ); vendorid[8] = 0;
-        memcpy( productid, ident+16, 16 ); productid[16] = 0;
-        memcpy( productrev, ident+32, 4 ); productrev[4] = 0;
-               g_free( (char *)disc->display_name );
-        disc->display_name = g_strdup_printf( "%.8s %.16s %.4s", g_strstrip(vendorid), 
-                  g_strstrip(productid), g_strstrip(productrev) );
-    }
-    return status;
-}
-
-
-static gdrom_error_t gdrom_scsi_read_sector( gdrom_disc_t disc, uint32_t sector,
-                                        int mode, unsigned char *buf, uint32_t *length )
-{
-    uint32_t real_sector = sector - GDROM_PREGAP;
-    uint32_t sector_size = MAX_SECTOR_SIZE;
-    char cmd[12];
-
-    mmc_make_read_cd_cmd( cmd, real_sector, mode );
-
-    gdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, buf, &sector_size );
-    if( status != 0 ) {
-        return status;
-    }
-    /* FIXME */
-    *length = 2048;
-    return 0;
-}
-
-/**
- * Read the full table of contents into the disc from the device.
- */
-static gdrom_error_t gdrom_scsi_read_toc( gdrom_disc_t disc )
-{
-    unsigned char buf[MAXTOCSIZE];
-    uint32_t buflen = sizeof(buf);
-    char cmd[12] = { 0x43, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-    cmd[7] = (sizeof(buf))>>8;
-    cmd[8] = (sizeof(buf))&0xFF;
-    memset( buf, 0, sizeof(buf) );
-    gdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read(disc, cmd, buf, &buflen );
-    if( status == PKT_ERR_OK ) {
-           mmc_parse_toc2( disc, buf );        
-    } else {
-       if( (status & 0xFF) != 0x02 ) {
-           /* Sense key 2 == Not Ready (ie temporary failure). Just ignore and
-            * consider the drive empty for now, but warn about any other errors
-            * we get. */
-           WARN( _("Unable to read disc table of contents (error %04x)"), status );
-       }
-       disc->disc_type = IDE_DISC_NONE;
-    }
-    return status;
-}
-
-static gboolean gdrom_scsi_check_status( gdrom_disc_t disc )
-{
-       if( SCSI_TRANSPORT(disc)->media_changed(disc) ) {
-               gdrom_scsi_read_toc(disc);
-               return TRUE;
-       } else {
-               return FALSE;
-       }
-}
-
-static gdrom_error_t gdrom_scsi_play_audio( gdrom_disc_t disc, uint32_t lba, uint32_t endlba )
-{
-    uint32_t real_sector = lba - GDROM_PREGAP;
-    uint32_t length = endlba - lba;

-    char cmd[12] = { 0xA5, 0,0,0, 0,0,0,0, 0,0,0,0 };
-    cmd[2] = (real_sector >> 24) & 0xFF;
-    cmd[3] = (real_sector >> 16) & 0xFF;
-    cmd[4] = (real_sector >> 8) & 0xFF;
-    cmd[5] = real_sector & 0xFF;
-    cmd[6] = (length >> 24) & 0xFF;
-    cmd[7] = (length >> 16) & 0xFF;
-    cmd[8] = (length >> 8) & 0xFF;
-    cmd[9] = length & 0xFF;
-
-    return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );
-}
-
-
-gdrom_error_t gdrom_scsi_stop_audio( gdrom_disc_t disc )
-{
-    int fd = fileno(disc->file);
-    uint32_t buflen = 0;
-    char cmd[12] = {0x4E,0,0,0, 0,0,0,0, 0,0,0,0};
-    
-    return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );
-}
-
-
-gdrom_disc_t gdrom_scsi_disc_new( const gchar *filename, FILE *f, gdrom_scsi_transport_t scsi )
-{
-       gdrom_disc_t disc = gdrom_disc_new(filename,f);
-    if( disc != NULL ) {
-           /* Initialize */
-       disc->impl_data = scsi;
-       disc->check_status = gdrom_scsi_check_status;
-       disc->read_sector = gdrom_scsi_read_sector;
-       disc->play_audio = gdrom_scsi_play_audio;
-       disc->run_time_slice = NULL;
-       gdrom_scsi_identify_drive(disc);
-       gdrom_scsi_read_toc(disc);
-    }
-    return disc;
-} 
</pre></div>
<hr /><a name="file8" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/drivers</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>cd_none.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cd_none.c
+++ lxdream/src/drivers/cd_none.c
@@ -1,47 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * The "null" cdrom device driver. Just provides a couple of empty stubs.
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include "gdrom/gddriver.h"
-
-static gboolean cdnone_image_is_valid( FILE *f );
-static gdrom_disc_t cdnone_open_device( const gchar *filename, FILE *f );
-
-struct gdrom_image_class cdrom_device_class = { "None", NULL,
-        cdnone_image_is_valid, cdnone_open_device };
-
-GList *cdrom_get_native_devices(void)
-{
-    return NULL;
-}
-
-gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *path )
-{
-    return NULL;
-}
-
-
-
-static gboolean cdnone_image_is_valid( FILE *f )
-{
-    return FALSE;
-}
-
-static gdrom_disc_t cdnone_open_device( const gchar *filename, FILE *f )
-{
-    return NULL;
-}
</pre></div>
<hr /><a name="file9" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/drivers</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>cd_osx.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cd_osx.c
+++ lxdream/src/drivers/cd_osx.c
@@ -1,232 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * OSX native cd-rom driver.
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <IOKit/IOKitLib.h>
-#include <IOKit/IOBSD.h>
-#include <IOKit/storage/IOStorageDeviceCharacteristics.h>
-#include <IOKit/storage/IOCDMediaBSDClient.h>
-#include <IOKit/storage/IOCDTypes.h>
-#include <sys/param.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <paths.h>
-#include "gdrom/gddriver.h"
-#include "gdrom/packet.h"
-#include "drivers/osx_iokit.h"
-
-#define MAXTOCENTRIES 600  /* This is a fairly generous overestimate really */
-#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)
-
-static gboolean cdrom_osx_image_is_valid( FILE *f );
-static gdrom_disc_t cdrom_osx_open_device( const gchar *filename, FILE *f );
-static gdrom_error_t cdrom_osx_read_toc( gdrom_disc_t disc );
-static gdrom_error_t cdrom_osx_read_sector( gdrom_disc_t disc, uint32_t sector,
-                                            int mode, unsigned char *buf, uint32_t *length );
-
-struct gdrom_image_class cdrom_device_class = { "osx", NULL,
-        cdrom_osx_image_is_valid, cdrom_osx_open_device };
-
-#define OSX_DRIVE(disc) ( (osx_cdrom_drive_t)(((gdrom_disc_t)disc)->impl_data) )
-
-static void cdrom_osx_destroy( gdrom_disc_t disc, gboolean close_fh )
-{
-    if( close_fh ) {
-        osx_cdrom_close_drive( OSX_DRIVE(disc) );
-    }
-    gdrom_disc_destroy( disc, FALSE ); /* chain to the main destroy */
-}
-
-static void cdrom_osx_media_changed( osx_cdrom_drive_t drive, gboolean present,
-                                     void *user_data )
-{
-    gdrom_disc_t disc = (gdrom_disc_t)user_data;
-    if( present ) {
-        cdrom_osx_read_toc( disc );
-    } else {
-        disc->disc_type = IDE_DISC_NONE;
-        disc->track_count = 0;        
-    }
-}
-
-
-static gdrom_disc_t cdrom_osx_new( const char *name, osx_cdrom_drive_t drive )
-{
-    char tmp[strlen(name)+7];
-    sprintf( tmp, "dvd://%s", name );
-    gdrom_disc_t disc = gdrom_disc_new(tmp, NULL);
-    disc->impl_data = drive;
-
-    disc->read_sector = cdrom_osx_read_sector;
-    disc->destroy = cdrom_osx_destroy;
-    cdrom_osx_read_toc(disc);
-    osx_cdrom_set_media_changed_callback( drive, cdrom_osx_media_changed, disc );
-    return (gdrom_disc_t)disc;
-}
-
-gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *path )
-{
-    gdrom_disc_t result = NULL;
-
-    osx_cdrom_drive_t drive = osx_cdrom_open_drive(path);
-    if( drive == NULL ) {
-        return NULL;
-    } else {
-        return cdrom_osx_new( path, drive );
-    }
-}
-
-
-
-static gboolean cdrom_enum_callback( io_object_t object, char *vendor, char *product, char *iopath, void *ptr )
-{
-    GList **list = (GList **)ptr;
-    char tmp1[sizeof(io_string_t) + 6];
-    char tmp2[512];
-    snprintf( tmp1, sizeof(tmp1), "dvd://%s", iopath );
-    snprintf( tmp2, sizeof(tmp2), "%s %s", vendor, product );
-    *list = g_list_append( *list, gdrom_device_new( tmp1, tmp2 ) );
-    return FALSE;
-}
-
-GList *cdrom_get_native_devices(void)
-{
-    GList *list = NULL;
-    find_cdrom_drive(cdrom_enum_callback, &list);
-
-    osx_register_iokit_notifications();
-    return list;
-}
-
-
-
-static gboolean cdrom_osx_image_is_valid( FILE *f )
-{
-    return FALSE;
-}
-
-static gdrom_disc_t cdrom_osx_open_device( const gchar *filename, FILE *f )
-{
-    return NULL;
-}
-
-static gdrom_error_t cdrom_osx_read_toc( gdrom_disc_t disc )
-{
-    osx_cdrom_drive_t drive = OSX_DRIVE(disc);
-
-    int fh = osx_cdrom_get_media_handle(drive);
-    if( fh == -1 ) {
-        disc->disc_type = IDE_DISC_NONE;
-        disc->track_count = 0;
-        return -1;
-    } else {
-        unsigned char buf[MAXTOCSIZE];
-        dk_cd_read_toc_t readtoc;
-        memset( &readtoc, 0, sizeof(readtoc) );
-        readtoc.format = 2;
-        readtoc.formatAsTime = 0;
-        readtoc.address.session = 0;
-        readtoc.bufferLength = sizeof(buf);
-        readtoc.buffer = buf;
-
-        if( ioctl(fh, DKIOCCDREADTOC, &readtoc ) == -1 ) {
-            WARN( "Failed to read TOC (%s)", strerror(errno) );
-            disc->disc_type = IDE_DISC_NONE;
-            disc->track_count = 0;
-            return -1;
-        } else {
-            mmc_parse_toc2( disc, buf );
-        }
-    }
-    return 0;
-}
-
-static gdrom_error_t cdrom_osx_read_sector( gdrom_disc_t disc, uint32_t lba,
-                                            int mode, unsigned char *buf, uint32_t *length ) 
-{
-    int real_lba = lba - 150;
-    int sector_size = 2352;
-    int direct_read = 1;
-    char data[MAX_SECTOR_SIZE];
-    osx_cdrom_drive_t drive = OSX_DRIVE(disc);
-    
-    int fh = osx_cdrom_get_media_handle(drive);
-    if( fh == -1 ) {
-        return PKT_ERR_NODISC;
-    } else {
-        dk_cd_read_t readcd;
-        memset( &readcd, 0, sizeof(readcd) );
-        readcd.buffer = buf;
-
-        // This is complicated by needing to know the exact read size. Gah.
-        if( READ_CD_RAW(mode) ) {
-            sector_size = 2352;
-            readcd.sectorArea = 0xF8; 
-        } else if ( READ_CD_MODE(mode) == READ_CD_MODE_ANY ) {
-            /* Sector could be anything - need to do a raw read and then parse
-             * the requested data out ourselves
-             */
-            int track_no = gdrom_disc_get_track_by_lba( disc, lba );
-            struct gdrom_track *track = &disc->track[track_no-1];
-
-            sector_size = 2352;
-            if( track->mode == GDROM_CDDA ) {
-                readcd.sectorArea = kCDSectorAreaUser;
-            } else {
-                readcd.sectorArea = 0xF8;
-                readcd.buffer = data;
-                direct_read = 0;
-            }
-        } else {
-            // This is incomplete...
-            if( READ_CD_DATA(mode) ) {
-                readcd.sectorArea = kCDSectorAreaUser;
-                switch( READ_CD_MODE(mode) ) {
-                case READ_CD_MODE_CDDA:
-                    sector_size = 2352;
-                    break;
-                case READ_CD_MODE_1:
-                case READ_CD_MODE_2_FORM_1:
-                    sector_size = 2048;
-                    break;
-                case READ_CD_MODE_2:
-                    sector_size = 2336;
-                    break;
-                case READ_CD_MODE_2_FORM_2:
-                    sector_size = 2324;
-                    break;
-                }
-            }
-        }
-
-        readcd.offset = sector_size * real_lba;
-        readcd.sectorType = READ_CD_MODE(mode)>>1;
-        readcd.bufferLength = sector_size;
-        if( ioctl( fh, DKIOCCDREAD, &readcd ) == -1 ) {
-            return -1;
-        }
-        
-        if( direct_read ) {
-            *length = sector_size;
-        } else {
-            gdrom_extract_raw_data_sector( data, mode, buf, length );
-        }
-        return 0;
-    }
-}
-
</pre></div>
<hr /><a name="file10" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>README.LIBEDC</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/README.LIBEDC
+++ lxdream/src/drivers/cdrom/README.LIBEDC
@@ -0,0 +1,123 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+This describes the program as shipped with cdrkit, a spinoff from the
+cdrtools project. However, the cdrtools developers are no longer 
+involved in the development of this spinoff and therefore shall not
+be made responsible for any problem caused by it. Do not try to get 
+support for this program by contacting the original authors.
+
+This is a small description for the Reed-Solomon library intended for
+CD sector formatting.
+
+Basics:
+It is assumed that you have a basic knowledge of cd sector formats.
+
+The library can handle three types of sector data:
+  data sectors,
+  audio sectors, and
+  sub channel r-w sectors
+
+Currently only encoding is implemented. Decoding and optionally
+error correction is planned for later.
+
+Stages:
+
+The process of sector formatting has several stages. Beginning with
+a data sector (2048, 2324, or 2336 bytes) a sector of 2352 bytes is
+built. This format can be read raw by SCSI MMC-2 and ATAPI drives and
+is accepted by cd burners. The additions are an optionally 32 bit CRC
+checksum and two layers of Reed-Solomon codes (called Reed-Solomon
+Product Code RSPC).
+This sector is then scrambled (exor'ed with a bitstream).
+The result is called F1 frames. Afterwards even and odd bytes are
+swapped, this is called F2 frames. The result is equivalent to an
+audio sector and is treated as such by the cd burner.
+So, if we wrote a series of sectors (F2 frames) into a CDR file and
+later burned them as 'audio', they would turn up as perfect data sectors.
+
+So, now we are at the level of audio sectors. Audio sectors get their
+own error correction data (called CIRC). Sector size goes up to 
+3136 bytes (that is 4/3 times 2352 bytes). Furthermore different
+words get delayed differently and swap positions. The result is ready
+to be fed into the so-called EightFourteenModulator (when subchannels
+have been added).
+
+Now, only sub channels are missing. While the p and q sub
+channels have to be generated elsewhere, any supplied r-w subchannel
+user data is protected by two levels of error correction
+codes. This format is read by cd burners when burning cd+graphics.
+The cdimage is a sequence of sectors, each containing audio data and
+after that subchannel data.
+Similar to audio sectors delaying and permutation of words
+takes place. After that the cd burner would mix sub channel data with
+the formatted audio sectors to feed the EFModulator.
+
+NOTE: Most of the described stages need not to be done in order to
+prepare sectors for burning, since all cd burners do at least CIRC,
+delaying and swaps. For data sectors they also do scrambling and f2
+frame generation.
+
+Encoding routines:
+
+For data sectors
+ int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
+
+ encodes data sectors. The returned data is __unscrambled__ and not in
+ F2-frame format.
+
+Parameters are:
+  inout        pointer to an array of at least 2352 bytes.
+  sectortype   One of the MODE_* constants from ecc.h. This defines
+               how to format the sector.
+  address      The logical address to be used in the header 
+               (150 = 0:2.0 MSF).
+
+NOTE: the data portion has be to aligned properly for performance
+reasons (see ecc.h for details). So, no moves are necessary here.
+
+Generating f2 frames to be used like audio sectors
+ int scramble_L2(unsigned char *inout)
+
+ generates f2 frames in place from sectors generated by do_encode_L2().
+
+Parameters are:
+  inout        pointer to an array of at least 2352 bytes.
+
+
+
+For sub channels
+ int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
+               unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*
+                                       PACKETS_PER_SUBCHANNELFRAME],
+               int delay1, int permute);
+
+ repack user data and add error correction data. P and q subchannels
+should be added later, since all bytes are in place then.
+
+Parameters are:
+  in           pointer to an array of at least 72 bytes. It contains
+               the user data for one frame.
+  out          pointer to an array of at least 96 bytes. Here is
+               output frame is placed.
+  delay1       do low level delaying, when set to 1.
+  permute      do low level permutations, when set to 1.
+
+NOTE: Probably both options need either to be set on (1) or off (0) together.
+
+There is more, but that is seldomly used.
+
+Tests:
+The library is accompanied by small verify programs, that compare real
+raw sectors with the formatted results. They are also intended as demo
+applications (how to use the library). In order to be able to feed
+real raw sectors into them, the package read2448 is recommended/needed.
+You can only verify sector streams of one sector type, currently no mix.
+
+For more information have a look into ecc.h
+
+recommended Documents:
+Yellow Book or ISO 10149
+Appendix Red Book
+Red Book or IEC 908
+
+Source: libedc/README from cdrtools package
+Edited for cdrkit by Christian Fromme <kaner@strace.org>
+
</pre></div>
<hr /><a name="file11" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cd_cdi.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cd_cdi.c
+++ lxdream/src/drivers/cdrom/cd_cdi.c
@@ -0,0 +1,192 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * CDI CD-image file support
+ *
+ * Copyright (c) 2005 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include "drivers/cdrom/cdimpl.h"
+
+#define CDI_V2_ID 0x80000004
+#define CDI_V3_ID 0x80000005
+#define CDI_V35_ID 0x80000006
+
+
+static gboolean cdi_image_is_valid( FILE *f );
+static gboolean cdi_image_read_toc( cdrom_disc_t disc, ERROR *err );
+
+struct cdrom_disc_factory cdi_disc_factory = { "DiscJuggler", "cdi",
+        cdi_image_is_valid, NULL, cdi_image_read_toc };
+
+static const char TRACK_START_MARKER[20] = { 0,0,1,0,0,0,255,255,255,255,
+        0,0,1,0,0,0,255,255,255,255 };
+static const char EXT_MARKER[9] = {0,255,255,255,255,255,255,255,255 };
+
+struct cdi_trailer {
+    uint32_t cdi_version;
+    uint32_t header_offset;
+};
+
+struct cdi_track_data {
+    uint32_t pregap_length;
+    uint32_t length;
+    char unknown2[6];
+    uint32_t mode;
+    char unknown3[0x0c];
+    uint32_t start_lba;
+    uint32_t total_length;
+    char unknown4[0x10];
+    uint32_t sector_size;
+    char unknown5[0x1D];
+} __attribute__((packed));
+
+gboolean cdi_image_is_valid( FILE *f )
+{
+    int len;
+    struct cdi_trailer trail;
+
+    fseek( f, -8, SEEK_END );
+    len = ftell(f)+8;
+    fread( &trail, sizeof(trail), 1, f );
+    if( trail.header_offset >= len ||
+            trail.header_offset == 0 )
+        return FALSE;
+    return trail.cdi_version == CDI_V2_ID || trail.cdi_version == CDI_V3_ID ||
+    trail.cdi_version == CDI_V35_ID;
+}
+
+#define RETURN_PARSE_ERROR( ... ) do { SET_ERROR(err, EINVAL, __VA_ARGS__); return FALSE; } while(0)
+
+static gboolean cdi_image_read_toc( cdrom_disc_t disc, ERROR *err )
+{
+    int i,j;
+    uint16_t session_count;
+    uint16_t track_count;
+    int total_tracks = 0;
+    int posn = 0;
+    long len;
+    struct cdi_trailer trail;
+    char marker[20];
+
+    FILE *f = cdrom_disc_get_base_file(disc);
+    fseek( f, -8, SEEK_END );
+    len = ftell(f)+8;
+    fread( &trail, sizeof(trail), 1, f );
+    if( trail.header_offset >= len ||
+            trail.header_offset == 0 ) {
+        RETURN_PARSE_ERROR( "Invalid CDI image" );
+    }
+
+    if( trail.cdi_version != CDI_V2_ID && trail.cdi_version != CDI_V3_ID &&
+            trail.cdi_version != CDI_V35_ID ) {
+        RETURN_PARSE_ERROR( "Invalid CDI image" );
+    }
+
+    if( trail.cdi_version == CDI_V35_ID ) {
+        fseek( f, -(long)trail.header_offset, SEEK_END );
+    } else {
+        fseek( f, trail.header_offset, SEEK_SET );
+    }
+    fread( &session_count, sizeof(session_count), 1, f );
+
+    for( i=0; i< session_count; i++ ) {        
+        fread( &track_count, sizeof(track_count), 1, f );
+        if( track_count + total_tracks > 99 ) {
+            RETURN_PARSE_ERROR("Invalid number of tracks, bad cdi image" );
+        }
+        for( j=0; j<track_count; j++ ) {
+            struct cdi_track_data trk;
+            uint32_t new_fmt = 0;
+            uint8_t fnamelen = 0;
+            fread( &new_fmt, sizeof(new_fmt), 1, f );
+            if( new_fmt != 0 ) { /* Additional data 3.00.780+ ?? */
+                fseek( f, 8, SEEK_CUR ); /* Skip */
+            }
+            fread( marker, 20, 1, f );
+            if( memcmp( marker, TRACK_START_MARKER, 20) != 0 ) {
+                RETURN_PARSE_ERROR( "Track start marker not found, error reading cdi image" );
+            }
+            fseek( f, 4, SEEK_CUR );
+            fread( &fnamelen, 1, 1, f );
+            fseek( f, (int)fnamelen, SEEK_CUR ); /* skip over the filename */
+            fseek( f, 19, SEEK_CUR );
+            fread( &new_fmt, sizeof(new_fmt), 1, f );
+            if( new_fmt == 0x80000000 ) {
+                fseek( f, 10, SEEK_CUR );
+            } else {
+                fseek( f, 2, SEEK_CUR );
+            }
+            fread( &trk, sizeof(trk), 1, f );
+            disc->track[total_tracks].sessionno = i+1;
+            disc->track[total_tracks].lba = trk.start_lba;
+            cdrom_count_t sector_count = trk.length;
+            sector_mode_t mode;
+            switch( trk.mode ) {
+            case 0:
+                mode = SECTOR_CDDA;
+                disc->track[total_tracks].flags = 0x01;
+                if( trk.sector_size != 2 ) {
+                    RETURN_PARSE_ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );
+                }
+                break;
+            case 1:
+                mode = SECTOR_MODE1;
+                disc->track[total_tracks].flags = 0x41;
+                if( trk.sector_size != 0 ) {
+                    RETURN_PARSE_ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );
+                }
+                break;
+            case 2:
+                disc->track[total_tracks].flags = 0x41;
+                switch( trk.sector_size ) {
+                case 0:
+                    mode = SECTOR_MODE2_FORM1;
+                    break;
+                case 1:
+                    mode = SECTOR_SEMIRAW_MODE2;
+                    break;
+                case 2:
+                default:
+                    RETURN_PARSE_ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );
+                }
+                break;
+            default:
+                RETURN_PARSE_ERROR( "Unsupported track mode %d", trk.mode );
+            }
+            uint32_t offset = posn +
+                    trk.pregap_length * CDROM_SECTOR_SIZE(mode);
+            disc->track[total_tracks].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );
+            posn += trk.total_length * CDROM_SECTOR_SIZE(mode);
+            total_tracks++;
+            fread( marker, 1, 9, f );
+            if( memcmp( marker, EXT_MARKER, 9 ) == 0 ) {
+                fseek( f, 79, SEEK_CUR );
+            } else {
+                fseek( f, -9, SEEK_CUR );
+            }
+        }
+        fseek( f, 12, SEEK_CUR );
+    }
+
+    disc->track_count = total_tracks;
+    disc->session_count = session_count;
+    return TRUE;
+}
</pre></div>
<hr /><a name="file12" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cd_gdi.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cd_gdi.c
+++ lxdream/src/drivers/cdrom/cd_gdi.c
@@ -0,0 +1,139 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * NullDC GDI image format
+ *
+ * Copyright (c) 2005 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <glib/gutils.h>
+#include <glib/gstrfuncs.h>
+#include "drivers/cdrom/cdimpl.h"
+
+
+static gboolean gdi_image_is_valid( FILE *f );
+static gboolean gdi_image_read_toc( cdrom_disc_t disc, ERROR *err );
+
+struct cdrom_disc_factory gdi_disc_factory = { "NullDC GD-Rom Image", "gdi",
+        gdi_image_is_valid, NULL, gdi_image_read_toc };
+
+static gboolean gdi_image_is_valid( FILE *f )
+{
+    char line[512];
+    uint32_t track_count;
+
+    fseek(f, 0, SEEK_SET);
+    if( fgets( line, sizeof(line), f ) == NULL ) {
+        return FALSE;
+    }
+    track_count = strtoul(line, NULL, 0);
+    if( track_count == 0 || track_count > 99 ) {
+        return FALSE;
+    }
+    return TRUE;
+}
+
+static gboolean gdi_image_read_toc( cdrom_disc_t disc, ERROR *err )
+{
+    int i;
+    uint32_t track_count;
+    struct stat st;
+    char line[512];
+    int session = 1;
+    gchar *dirname;
+
+    FILE *f = cdrom_disc_get_base_file(disc);
+
+    fseek(f, 0, SEEK_SET);
+
+    if( fgets( line, sizeof(line), f ) == NULL ) {
+        SET_ERROR( err, EINVAL, "Invalid GDI image" );
+        return FALSE;
+    }
+    track_count = strtoul(line, NULL, 0);
+    if( track_count == 0 || track_count > 99 ) {
+        SET_ERROR( err, EINVAL, "Invalid GDI image" );
+        return FALSE;
+    }
+
+    dirname = g_path_get_dirname(disc->name);
+    disc->disc_type = CDROM_DISC_GDROM;
+    disc->track_count = track_count;
+    disc->session_count = 2;
+    for( i=0; i<track_count; i++ ) {
+        int track_no, start_lba, flags, size, offset;
+        char filename[256];
+
+        if( fgets( line, sizeof(line), f ) == NULL ) {
+            cdrom_disc_unref(disc);
+            SET_ERROR( err, EINVAL, "Invalid GDI image - unexpected end of file" );
+            return FALSE;
+        }
+        sscanf( line, "%d %d %d %d %s %d", &track_no, &start_lba, &flags, &size,
+                filename, &offset );
+        if( start_lba >= 45000 ) {
+            session = 2;
+        }
+        disc->track[i].sessionno = session;
+        disc->track[i].lba = start_lba;
+        disc->track[i].flags = (flags & 0x0F)<<4;
+
+        sector_mode_t mode;
+        if( disc->track[i].flags & TRACK_FLAG_DATA ) {
+            /* Data track */
+            switch(size) {
+            case 0:    mode = SECTOR_MODE2_FORM1; break; /* Default */
+            case 2048: mode = SECTOR_MODE2_FORM1; break;
+            case 2324: mode = SECTOR_MODE2_FORM2; break;
+            case 2336: mode = SECTOR_SEMIRAW_MODE2; break;
+            case 2352: mode = SECTOR_RAW_XA; break;
+            default:
+                SET_ERROR( err, EINVAL, "Invalid sector size '%d' in GDI track %d", size, (i+1) );
+                g_free(dirname);
+                return FALSE;
+            }
+        } else {
+            /* Audio track */
+            mode = SECTOR_CDDA;
+            if( size == 0 )
+                size = 2352;
+            else if( size != 2352 ) {
+                SET_ERROR( err, EINVAL, "Invalid sector size '%d' for audio track %d", size, (i+1) );
+                g_free(dirname);
+                return FALSE;
+            }
+        }
+        if( strcasecmp( filename, "none" ) == 0 ) {
+            disc->track[i].source = null_sector_source_new( mode, 0 );
+        } else {
+            gchar *pathname = g_strdup_printf( "%s%c%s", dirname, G_DIR_SEPARATOR, filename );
+            disc->track[i].source = file_sector_source_new_filename( pathname, mode,
+                    offset, FILE_SECTOR_FULL_FILE );
+            g_free(pathname);
+            if( disc->track[i].source == NULL ) {
+                SET_ERROR( err, ENOENT, "GDI track file '%s' could not be opened (%s)", filename, strerror(errno) );
+                g_free(dirname);
+                return FALSE;
+            }
+        }
+    }
+    g_free(dirname);
+    return TRUE;
+}
</pre></div>
<hr /><a name="file13" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cd_linux.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cd_linux.c
+++ lxdream/src/drivers/cdrom/cd_linux.c
@@ -0,0 +1,179 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Linux cd-rom device driver. Implemented using the SCSI transport.
+ *
+ * Copyright (c) 2005 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <linux/cdrom.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fstab.h>
+#include <fcntl.h>
+
+#include "drivers/cdrom/cdimpl.h"
+
+static gboolean linux_is_cdrom_device( FILE *f );
+static gboolean linux_cdrom_disc_init( cdrom_disc_t disc, ERROR *err );
+static cdrom_disc_t linux_cdrom_drive_open( cdrom_drive_t drive, ERROR *err );
+static cdrom_error_t linux_cdrom_do_cmd( int fd, char *cmd,
+        unsigned char *buf, unsigned int *buflen, unsigned char direction );
+static cdrom_error_t linux_packet_read( cdrom_disc_t disc, char *cmd,
+                                        unsigned char *buf, uint32_t *buflen );
+static cdrom_error_t linux_packet_cmd( cdrom_disc_t disc, char *cmd );
+static gboolean linux_media_changed( cdrom_disc_t disc );
+
+
+struct cdrom_disc_factory linux_cdrom_drive_factory = { "Linux", NULL,
+        linux_is_cdrom_device, linux_cdrom_disc_init, cdrom_disc_scsi_read_toc };
+        
+static struct cdrom_scsi_transport linux_scsi_transport = {
+       linux_packet_read, linux_packet_cmd, linux_media_changed };
+        
+static gboolean linux_is_cdrom_device( FILE *f )
+{
+    int caps = ioctl(fileno(f), CDROM_GET_CAPABILITY);
+    if( caps == -1 ) {
+        /* Quick check that this is really a CD device */
+        return FALSE;
+    } else {
+       return TRUE;
+    }
+}              
+
+void cdrom_drive_scan(void)
+{
+    unsigned char ident[256];
+    uint32_t identlen;
+    char cmd[12] = {0x12,0,0,0, 0xFF,0,0,0, 0,0,0,0};
+    
+    struct fstab *ent;
+    struct stat st;
+    setfsent();
+    while( (ent = getfsent()) != NULL ) {
+        if( (stat(ent->fs_spec, &st) != -1) && 
+                S_ISBLK(st.st_mode) ) {
+            /* Got a valid block device - is it a CDROM? */
+            int fd = open(ent->fs_spec, O_RDONLY|O_NONBLOCK);
+            if( fd == -1 )
+                continue;
+            int caps = ioctl(fd, CDROM_GET_CAPABILITY);
+            if( caps != -1 ) {
+                /* Appears to support CDROM functions */
+                identlen = sizeof(ident);
+                if( linux_cdrom_do_cmd( fd, cmd, ident, &identlen, CGC_DATA_READ ) ==
+                        CDROM_ERROR_OK ) {
+                    const char *drive_name = mmc_parse_inquiry( ident );
+                    cdrom_drive_add( ent->fs_spec, drive_name, linux_cdrom_drive_open );
+                }
+            }
+            close(fd);
+        }
+    }
+}
+
+gboolean linux_cdrom_disc_init( cdrom_disc_t disc, ERROR *err )
+{
+    if( linux_is_cdrom_device( cdrom_disc_get_base_file(disc) ) ) {
+        cdrom_disc_scsi_init(disc, &linux_scsi_transport);
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
+
+cdrom_disc_t linux_cdrom_drive_open( cdrom_drive_t drive, ERROR *err )
+{
+    
+    int fd = open(drive->name, O_RDONLY|O_NONBLOCK);
+    if( fd == -1 ) {
+        SET_ERROR(err, errno, "Unable to open device '%s': %s", drive->name, strerror(errno) );
+        return NULL;
+    } else {
+        FILE *f = fdopen(fd,"ro");
+        if( !linux_is_cdrom_device(f) ) {
+            SET_ERROR(err, EINVAL, "Device '%s' is not a CDROM drive", drive->name );
+            return NULL;
+        }
+        return cdrom_disc_scsi_new_file(f, drive->name, &linux_scsi_transport, err);
+    }
+}
+
+static gboolean linux_media_changed( cdrom_disc_t disc )
+{
+    int fd = cdrom_disc_get_base_fd(disc);
+    int status = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
+    if( status == CDS_DISC_OK ) {
+        status = ioctl(fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT);
+        return status == 0 ? FALSE : TRUE;
+    } else {
+       return disc->disc_type == CDROM_DISC_NONE ? FALSE : TRUE;
+    }
+}
+
+static cdrom_error_t linux_cdrom_do_cmd( int fd, char *cmd,
+        unsigned char *buffer, unsigned int *buflen, 
+        unsigned char direction )
+{
+    struct request_sense sense;
+    struct cdrom_generic_command cgc;
+
+    memset( &cgc, 0, sizeof(cgc) );
+    memset( &sense, 0, sizeof(sense) );
+    memcpy( cgc.cmd, cmd, 12 );
+    cgc.buffer = buffer;
+    if( buflen == NULL )
+        cgc.buflen = 0;
+    else
+        cgc.buflen = *buflen;
+    cgc.sense = &sense;
+    cgc.data_direction = direction;
+
+    if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {
+        if( sense.sense_key == 0 ) {
+            return -1; 
+        } else {
+            return sense.sense_key | (sense.asc<<8);
+        }
+    } else {
+        if( buflen != NULL )
+            *buflen = cgc.buflen;
+        return CDROM_ERROR_OK;
+    }
+    
+}
+
+/**
+ * Send a packet command to the device and wait for a response. 
+ * @return 0 on success, -1 on an operating system error, or a sense error
+ * code on a device error.
+ */
+static cdrom_error_t linux_packet_read( cdrom_disc_t disc, char *cmd,
+                                        unsigned char *buffer, unsigned int *buflen )
+{
+    int fd = cdrom_disc_get_base_fd(disc);
+    return linux_cdrom_do_cmd( fd, cmd, buffer, buflen, CGC_DATA_READ );
+}
+
+static cdrom_error_t linux_packet_cmd( cdrom_disc_t disc, char *cmd )
+{
+    int fd = cdrom_disc_get_base_fd(disc);
+    return linux_cdrom_do_cmd( fd, cmd, NULL, NULL, CGC_DATA_NONE );
+}
+
</pre></div>
<hr /><a name="file14" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cd_mmc.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cd_mmc.c
+++ lxdream/src/drivers/cdrom/cd_mmc.c
@@ -0,0 +1,238 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * SCSI/MMC device interface (depends on lower-level SCSI transport)
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <glib/gstrfuncs.h>
+#include "lxdream.h"
+#include "gettext.h"
+#include "drivers/cdrom/cdimpl.h"
+
+#define MAXTOCENTRIES 600  /* This is a fairly generous overestimate really */
+#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)
+#define MAX_SECTORS_PER_CALL 1
+
+/**
+ * Parse the TOC (format 2) into the cdrom_disc structure
+ */
+void mmc_parse_toc2( cdrom_disc_t disc, unsigned char *buf )
+{
+    int max_track = 0;
+    int max_session = 0;
+    int last_track = -1;
+    int leadout = -1;
+    int len = (buf[0] << 8) | buf[1];
+    int session_type = -1;
+    int i;
+    for( i = 4; i<len; i+=11 ) {
+        int session = buf[i];
+        int adr = buf[i+1] >> 4;
+        int point = buf[i+3];
+        if( adr == 0x01 && point > 0 && point < 100 ) {
+            /* Track info */
+            int trackno = point-1;
+            if( point > max_track ) {
+                max_track = point;
+            }
+            if( session > max_session ) {
+                max_session = session;
+            }
+            disc->track[trackno].trackno = point;
+            disc->track[trackno].flags = (buf[i+1] & 0x0F) << 4;
+            disc->track[trackno].sessionno = session;
+            disc->track[trackno].lba = MSFTOLBA(buf[i+8],buf[i+9],buf[i+10]);
+            last_track = trackno;
+        } else switch( (adr << 8) | point ) {
+        case 0x1A0: /* session info */
+            if( buf[i+9] == 0x20 ) {
+                session_type = CDROM_DISC_XA;
+            } else {
+                session_type = CDROM_DISC_NONXA;
+            }
+            disc->disc_type = session_type;
+            break;
+        case 0x1A2: /* leadout */
+            disc->leadout = MSFTOLBA(buf[i+8], buf[i+9], buf[i+10]);
+            break;
+        }
+    }
+    disc->track_count = max_track;
+    disc->session_count = max_session;
+}
+
+
+const char *mmc_parse_inquiry( unsigned char *buf )
+{
+    char vendorid[9];
+    char productid[17];
+    char productrev[5];
+    memcpy( vendorid, buf+8, 8 ); vendorid[8] = 0;
+    memcpy( productid, buf+16, 16 ); productid[16] = 0;
+    memcpy( productrev, buf+32, 4 ); productrev[4] = 0;
+    return g_strdup_printf( "%.8s %.16s %.4s", g_strstrip(vendorid),
+              g_strstrip(productid), g_strstrip(productrev) );
+}
+
+/**
+ * Construct a drive indentification string based on the response to the
+ * INQUIRY command. On success, returns the disc identification as a newly
+ * allocated string, otherwise NULL.
+ */
+const char *cdrom_disc_scsi_identify_drive( cdrom_disc_t disc )
+{
+    unsigned char ident[256];
+    uint32_t identlen = 256;
+    char cmd[12] = {0x12,0,0,0, 0xFF,0,0,0, 0,0,0,0};
+    cdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, ident, &identlen );
+    if( status == CDROM_ERROR_OK ) {
+        return mmc_parse_inquiry(ident);
+    }
+    return NULL;
+}
+
+
+static cdrom_error_t cdrom_disc_scsi_read_sectors( sector_source_t source, cdrom_lba_t lba,
+        cdrom_count_t count, cdrom_read_mode_t mode, unsigned char *buf, size_t *length )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(source,DISC_SECTOR_SOURCE) );
+    cdrom_disc_t disc = (cdrom_disc_t)source;
+    uint32_t sector_size = CDROM_MAX_SECTOR_SIZE;
+    char cmd[12];
+
+    cmd[0] = 0xBE;
+    cmd[1] = CDROM_READ_TYPE(mode);
+    cmd[2] = (lba >> 24) & 0xFF;
+    cmd[3] = (lba >> 16) & 0xFF;
+    cmd[4] = (lba >> 8) & 0xFF;
+    cmd[5] = lba & 0xFF;
+    cmd[6] = (count>>16) & 0xFF;
+    cmd[7] = (count>>8) & 0xFF;
+    cmd[8] = count & 0xFF;
+    cmd[9] = CDROM_READ_FIELDS(mode)>>8;
+    cmd[10]= 0;
+    cmd[11]= 0;
+
+    cdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, buf, &sector_size );
+    if( status != 0 ) {
+        return status;
+    }
<a name="task1" />+    /* <span class="task" style="background-color:#ffff00;" >FIXME</span> */
+    *length = 2048;
+    return 0;
+}
+
+/**
+ * Read the full table of contents into the disc from the device.
+ */
+gboolean cdrom_disc_scsi_read_toc( cdrom_disc_t disc, ERROR *err )
+{
+    unsigned char buf[MAXTOCSIZE];
+    uint32_t buflen = sizeof(buf);
+    char cmd[12] = { 0x43, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+    cmd[7] = (sizeof(buf))>>8;
+    cmd[8] = (sizeof(buf))&0xFF;
+    memset( buf, 0, sizeof(buf) );
+    cdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read(disc, cmd, buf, &buflen );
+    if( status == CDROM_ERROR_OK ) {
+           mmc_parse_toc2( disc, buf );
+           return TRUE;
+    } else {
+       if( (status & 0xFF) != 0x02 ) {
+           /* Sense key 2 == Not Ready (ie temporary failure). Just ignore and
+            * consider the drive empty for now, but warn about any other errors
+            * we get. */
+           WARN( _("Unable to read disc table of contents (error %04x)"), status );
+       }
+       cdrom_disc_clear_toc(disc);
+       return FALSE;
+    }
+}
+
+static gboolean cdrom_disc_scsi_check_media( cdrom_disc_t disc )
+{
+       if( SCSI_TRANSPORT(disc)->media_changed(disc) ) {
+               cdrom_disc_scsi_read_toc(disc, NULL);
+               return TRUE;
+       } else {
+               return FALSE;
+       }
+}
+
+static cdrom_error_t cdrom_disc_scsi_play_audio( cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t length )
+{
+    char cmd[12] = { 0xA5, 0,0,0, 0,0,0,0, 0,0,0,0 };
+    cmd[2] = (lba >> 24) & 0xFF;
+    cmd[3] = (lba >> 16) & 0xFF;
+    cmd[4] = (lba >> 8) & 0xFF;
+    cmd[5] = lba & 0xFF;
+    cmd[6] = (length >> 24) & 0xFF;
+    cmd[7] = (length >> 16) & 0xFF;
+    cmd[8] = (length >> 8) & 0xFF;
+    cmd[9] = length & 0xFF;
+
+    return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );
+}
+
+
+static cdrom_error_t cdrom_disc_scsi_stop_audio( cdrom_disc_t disc )
+{
+    uint32_t buflen = 0;
+    char cmd[12] = {0x4E,0,0,0, 0,0,0,0, 0,0,0,0};
+    
+    return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );
+}
+
+void cdrom_disc_scsi_init( cdrom_disc_t disc, cdrom_scsi_transport_t scsi )
+{
+    disc->impl_data = scsi;
+    disc->source.read_sectors = cdrom_disc_scsi_read_sectors;
+    disc->read_toc = cdrom_disc_scsi_read_toc;
+    disc->check_media = cdrom_disc_scsi_check_media;
+    disc->play_audio = cdrom_disc_scsi_play_audio;
+    disc->stop_audio = cdrom_disc_scsi_stop_audio;
+}
+
+cdrom_disc_t cdrom_disc_scsi_new( const char *filename, cdrom_scsi_transport_t scsi, ERROR *err )
+{
+    cdrom_disc_t disc = cdrom_disc_new(filename, err);
+    if( disc != NULL ) {
+        /* Initialize */
+        cdrom_disc_scsi_init( disc, scsi );
+        cdrom_disc_read_toc(disc, err);
+    }
+    return disc;
+} 
+
+cdrom_disc_t cdrom_disc_scsi_new_file( FILE *f, const char *filename, cdrom_scsi_transport_t scsi, ERROR *err )
+{
+    cdrom_disc_t disc = cdrom_disc_new(filename, err);
+    if( disc != NULL ) {
+        /* Initialize */
+        disc->base_source = file_sector_source_new( f, SECTOR_UNKNOWN, 0, 0, TRUE );
+        if( disc->base_source != NULL ) {
+            sector_source_ref( disc->base_source );
+            cdrom_disc_scsi_init( disc, scsi );
+            cdrom_disc_read_toc(disc, err);
+        } else {
+            cdrom_disc_unref(disc);
+            disc = NULL;
+        }
+    }
+    return disc;
+}
</pre></div>
<hr /><a name="file15" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cd_none.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cd_none.c
+++ lxdream/src/drivers/cdrom/cd_none.c
@@ -0,0 +1,23 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * The "null" cdrom device driver. Just provides a couple of empty stubs.
+ *
+ * Copyright (c) 2005 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "drivers/cdrom/cdimpl.h"
+
+void cdrom_drive_scan(void )
+{
+}
</pre></div>
<hr /><a name="file16" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cd_nrg.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cd_nrg.c
+++ lxdream/src/drivers/cdrom/cd_nrg.c
@@ -0,0 +1,331 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Nero (NRG) CD file format. File information stolen shamelessly from
+ * libcdio.
+ *
+ * Copyright (c) 2005 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <errno.h>
+#include "drivers/cdrom/cdimpl.h"
+#include "dream.h"
+
+static gboolean nrg_image_is_valid( FILE *f );
+static gboolean nrg_image_read_toc( cdrom_disc_t disc, ERROR *err );
+
+struct cdrom_disc_factory nrg_disc_factory = { "Nero", "nrg",
+        nrg_image_is_valid, NULL, nrg_image_read_toc };
+
+#define NERO_V55_ID  0x4e455235 
+#define NERO_V50_ID  0x4e45524f 
+
+/* Courtesy of libcdio */
+/* 5.0 or earlier */
+#define NERO_ID  0x4e45524f  /* Nero pre 5.5.x */
+#define CUES_ID  0x43554553  /* Nero pre version 5.5.x-6.x */
+#define DAOI_ID  0x44414f49
+#define ETNF_ID  0x45544e46
+#define SINF_ID  0x53494e46  /* Session information */
+#define END_ID  0x454e4421
+/* 5.5+ only */
+#define NER5_ID  0x4e455235  /* Nero version 5.5.x */
+#define CDTX_ID  0x43445458  /* CD TEXT */
+#define CUEX_ID  0x43554558  /* Nero version 5.5.x-6.x */
+#define DAOX_ID  0x44414f58  /* Nero version 5.5.x-6.x */
+#define ETN2_ID  0x45544e32
+#define MTYP_ID  0x4d545950  /* Disc Media type? */
+
+
+union nrg_footer {
+    struct nrg_footer_v50 {
+        uint32_t dummy;
+        uint32_t id;
+        uint32_t offset;
+    } v50;
+    struct nrg_footer_v55 {
+        uint32_t id;
+        uint64_t offset;
+    } v55;
+};
+
+struct nrg_chunk {
+    uint32_t id;
+    uint32_t length;
+};
+
+struct nrg_etnf {
+    uint32_t offset;
+    uint32_t length;
+    uint32_t mode;
+    uint32_t lba;
+    uint32_t padding;
+};
+
+struct nrg_etn2 {
+    uint64_t offset;
+    uint64_t length;
+    uint32_t mode;
+    uint32_t lba;
+    uint64_t padding;
+};
+
+struct nrg_cues {
+    uint8_t type;
+    uint8_t track;
+    uint8_t control;
+    uint8_t pad;
+    uint32_t addr;
+};
+
+struct nrg_daoi {
+    uint32_t length;
+    char mcn[14];
+    uint8_t disc_mode;
+    uint8_t unknown[2]; /* always 01 01? */
+    uint8_t track_count;
+    struct nrg_daoi_track {
+        char unknown[10];
+        uint32_t sector_size __attribute__((packed)); /* Always 0? */
+        uint8_t mode;
+        uint8_t unknown2[3]; /* Always 00 00 01? */
+        uint32_t pregap __attribute__((packed));
+        uint32_t offset __attribute__((packed));
+        uint32_t end __attribute__((packed));
+    } track[0];
+} __attribute__((packed));
+
+struct nrg_daox {
+    uint32_t length;
+    char mcn[14];
+    uint8_t disc_mode;
+    uint8_t unknown[2]; /* always 01 01? */
+    uint8_t track_count;
+    struct nrg_daox_track {
+        char unknown[10];
+        uint32_t sector_size __attribute__((packed)); /* Always 0? */
+        uint8_t mode;
+        uint8_t unknown2[3]; /* Always 00 00 01? */
+        uint64_t pregap __attribute__((packed));
+        uint64_t offset __attribute__((packed));
+        uint64_t end __attribute__((packed));
+    } track[0];
+} __attribute__((packed));
+
+
+sector_mode_t static nrg_track_mode( uint8_t mode )
+{
+    switch( mode ) {
+    case 0: return SECTOR_MODE1;
+    case 2: return SECTOR_MODE2_FORM1;
+    case 3: return SECTOR_SEMIRAW_MODE2;
+    case 7: return SECTOR_CDDA;
+    default: return -1;
+    }
+}
+
+static gboolean nrg_image_is_valid( FILE *f )
+{
+    union nrg_footer footer;
+
+    fseek( f, -12, SEEK_END );
+    fread( &footer, sizeof(footer), 1, f );
+    if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ||
+            GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
+
+#define RETURN_PARSE_ERROR( ... ) do { SET_ERROR(err, EINVAL, __VA_ARGS__); return FALSE; } while(0)
+
+static gboolean nrg_image_read_toc( cdrom_disc_t disc, ERROR *err )
+{
+    union nrg_footer footer;
+    struct nrg_chunk chunk;
+    struct nrg_daoi *dao;
+    struct nrg_daox *daox;
+    struct nrg_etnf *etnf;
+    struct nrg_etn2 *etn2;
+    gboolean end = FALSE;
+    uint32_t chunk_id;
+    int session_id = 1;
+    int session_track_id = 0;
+    int track_id = 0;
+    int cue_track_id = 0, cue_track_count = 0;
+    int i, count;
+
+    FILE *f = cdrom_disc_get_base_file(disc);
+
+    fseek( f, -12, SEEK_END );
+    fread( &footer, sizeof(footer), 1, f );
+    if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ) {
+        fseek( f, GUINT32_FROM_BE(footer.v50.offset), SEEK_SET );
+    } else if( GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {
+        fseek( f, (uint32_t)GUINT64_FROM_BE(footer.v55.offset), SEEK_SET );
+    } else {
+        /* Not a (recognized) Nero image (should never happen) */
+        RETURN_PARSE_ERROR("File is not an NRG image" );
+    }
+
+    do {
+        fread( &chunk, sizeof(chunk), 1, f );
+        chunk.length = GUINT32_FROM_BE(chunk.length);
+        char data[chunk.length];
+        fread( data, chunk.length, 1, f );
+        chunk_id = GUINT32_FROM_BE(chunk.id);
+        switch( chunk_id ) {
+        case CUES_ID:
+        case CUEX_ID:
+            cue_track_id = track_id;
+            cue_track_count = ((chunk.length / sizeof(struct nrg_cues)) >> 1) - 1;
+            track_id += cue_track_count;
+            for( i=0; i<chunk.length; i+= sizeof(struct nrg_cues) ) {
+                struct nrg_cues *cue = (struct nrg_cues *)(data+i);
+                int track = 0;
+                uint32_t lba;
+                if( chunk_id == CUEX_ID ) {
+                    lba = GUINT32_FROM_BE( cue->addr );
+                } else {
+                    lba = BCD_MSFTOLBA( cue->addr );
+                }
+                if( cue->track == 0 )
+                    continue; /* Track 0. Leadin? always 0? */
+                if( cue->track == 0xAA ) { /* end of disc */
+                    disc->leadout = lba;
+                } else {
+                    track = BCDTOU8(cue->track) - 1;
+                    if( (cue->control & 0x01) != 0 ) {
+                        /* Track-start address */
+                        disc->track[track].lba = lba;
+                        disc->track[track].flags = cue->type;
+                    }
+                }
+            }
+            break;
+        case DAOI_ID:
+            dao = (struct nrg_daoi *)data;
+            count = dao->track_count - cue_track_id;
+            memcpy( disc->mcn, dao->mcn, 13 );
+            disc->mcn[13] = '\0';
+            if( dao->track_count != track_id ||
+                count * 30 + 22 != chunk.length ) {
+                RETURN_PARSE_ERROR( "Invalid NRG image file (bad DAOI block)" );
+            }
+            for( i=0; i<count; i++ ) {
+                uint32_t offset = GUINT32_FROM_BE(dao->track[i].offset);
+                sector_mode_t mode = nrg_track_mode( dao->track[i].mode );
+                if( mode == -1 ) {
+                    RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", dao->track[i].mode);
+                }
+                if( CDROM_SECTOR_SIZE(mode) != GUINT32_FROM_BE(dao->track[i].sector_size) ) {
+                    /* Sector size mismatch */
+                    RETURN_PARSE_ERROR("Invalid NRG image file (Bad sector size in DAOI block)");
+                }
+                cdrom_count_t sector_count =
+                    (GUINT32_FROM_BE(dao->track[i].end) - GUINT32_FROM_BE(dao->track[i].offset))/
+                    CDROM_SECTOR_SIZE(mode);
+                disc->track[cue_track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );
+                cue_track_id++;
+            }
+            break;
+        case DAOX_ID:
+            daox = (struct nrg_daox *)data;
+            count = daox->track_count - cue_track_id;
+            memcpy( disc->mcn, daox->mcn, 13 );
+            disc->mcn[13] = '\0';
+            if( daox->track_count != track_id ||
+                count * 42 + 22 != chunk.length ) {
+                RETURN_PARSE_ERROR( "Invalid NRG image file (bad DAOX block)" );
+            }
+            for( i=0; i<count; i++ ) {
+                uint32_t offset = (uint32_t)GUINT64_FROM_BE(daox->track[i].offset);
+                sector_mode_t mode = nrg_track_mode( daox->track[i].mode );
+                if( mode == -1 ) {
+                    RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", daox->track[i].mode);
+                }
+                if( CDROM_SECTOR_SIZE(mode) != GUINT32_FROM_BE(daox->track[i].sector_size) ) {
+                    /* Sector size mismatch */
+                    RETURN_PARSE_ERROR("Invalid NRG image file (Bad sector size in DAOX block)");
+                }
+                cdrom_count_t sector_count = (cdrom_count_t)
+                    ((GUINT64_FROM_BE(daox->track[i].end) - GUINT64_FROM_BE(daox->track[i].offset))/
+                    CDROM_SECTOR_SIZE(mode));
+                disc->track[cue_track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );
+                cue_track_id++;
+            }
+            break;
+
+        case SINF_ID: 
+            /* Data is a single 32-bit number representing number of tracks in session */
+            i = GUINT32_FROM_BE( *(uint32_t *)data );
+            while( i-- > 0 )
+                disc->track[session_track_id++].sessionno = session_id;
+            session_id++;
+            break;
+        case ETNF_ID:
+            etnf = (struct nrg_etnf *)data;
+            count = chunk.length / sizeof(struct nrg_etnf);
+            for( i=0; i < count; i++, etnf++ ) {
+                uint32_t offset = GUINT32_FROM_BE(etnf->offset);
+                sector_mode_t mode = nrg_track_mode( GUINT32_FROM_BE(etnf->mode) );
+                if( mode == -1 ) {
+                    RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", etnf->mode);
+                }
+                cdrom_count_t sector_count = GUINT32_FROM_BE(etnf->length) /
+                        CDROM_SECTOR_SIZE(mode);
+
+                disc->track[track_id].lba = GUINT32_FROM_BE(etnf->lba) + i*CDROM_PREGAP;
+                if( mode == SECTOR_CDDA )
+                    disc->track[track_id].flags = 0x01;
+                else
+                    disc->track[track_id].flags = 0x01 | TRACK_FLAG_DATA;
+                disc->track[track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );
+                track_id++;
+            }
+            break;
+        case ETN2_ID:
+            etn2 = (struct nrg_etn2 *)data;
+            count = chunk.length / sizeof(struct nrg_etn2);
+            for( i=0; i < count; i++, etn2++ ) {
+                uint32_t offset = (uint32_t)GUINT64_FROM_BE(etn2->offset);
+                sector_mode_t mode = nrg_track_mode( GUINT32_FROM_BE(etn2->mode) );
+                if( mode == -1 ) {
+                    RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", etn2->mode);
+                }
+                cdrom_count_t sector_count = (uint32_t)(GUINT64_FROM_BE(etn2->length) /
+                        CDROM_SECTOR_SIZE(mode));
+
+                disc->track[track_id].lba = GUINT32_FROM_BE(etn2->lba) + i*CDROM_PREGAP;
+                if( mode == SECTOR_CDDA )
+                    disc->track[track_id].flags = 0x01;
+                else
+                    disc->track[track_id].flags = 0x01 | TRACK_FLAG_DATA;
+                disc->track[track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );
+                track_id++;
+            }
+            break;
+
+        case END_ID:
+            end = TRUE;
+            break;
+        }
+    } while( !end );
+
+    disc->track_count = track_id;
+    disc->session_count = session_id-1;
+    return TRUE;
+}
</pre></div>
<hr /><a name="file17" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cd_osx.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cd_osx.c
+++ lxdream/src/drivers/cdrom/cd_osx.c
@@ -0,0 +1,228 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * OSX native cd-rom driver.
+ *
+ * Copyright (c) 2005 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <IOKit/IOKitLib.h>
+#include <IOKit/IOBSD.h>
+#include <IOKit/storage/IOStorageDeviceCharacteristics.h>
+#include <IOKit/storage/IOCDMediaBSDClient.h>
+#include <IOKit/storage/IOCDTypes.h>
+#include <sys/param.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <paths.h>
+#include "drivers/osx_iokit.h"
+#include "drivers/cdrom/cdimpl.h"
+#include "drivers/cdrom/drive.h"
+
+#define MAXTOCENTRIES 600  /* This is a fairly generous overestimate really */
+#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)
+
+static gboolean cdrom_osx_image_is_valid( FILE *f );
+static cdrom_disc_t cdrom_osx_open_file( FILE *f, const gchar *filename, ERROR *err );
+static gboolean cdrom_osx_read_toc( cdrom_disc_t disc, ERROR *err );
+static cdrom_error_t cdrom_osx_read_sectors( sector_source_t disc, cdrom_lba_t sector, cdrom_count_t count,
+                                             cdrom_read_mode_t mode, unsigned char *buf, size_t *length );
+
+/* Note: We don't support opening OS X devices by filename, so no disc factory */
+
+#define OSX_DRIVE(disc) ( (osx_cdrom_drive_t)(((cdrom_disc_t)disc)->impl_data) )
+
+static void cdrom_osx_destroy( sector_source_t disc )
+{
+    osx_cdrom_close_drive( OSX_DRIVE(disc) );
+    default_cdrom_disc_destroy( disc );
+}
+
+static void cdrom_osx_media_changed( osx_cdrom_drive_t drive, gboolean present,
+                                     void *user_data )
+{
+    cdrom_disc_t disc = (cdrom_disc_t)user_data;
+    if( present ) {
+        cdrom_osx_read_toc( disc, NULL );
+    } else {
+        disc->disc_type = CDROM_DISC_NONE;
+        disc->track_count = 0;        
+    }
+}
+
+
+static cdrom_disc_t cdrom_osx_new( const char *name, osx_cdrom_drive_t drive, ERROR *err )
+{
+    cdrom_disc_t disc = cdrom_disc_new(name, err);
+    disc->impl_data = drive;
+
+    disc->source.read_sectors = cdrom_osx_read_sectors;
+    disc->source.destroy = cdrom_osx_destroy;
+    disc->read_toc = cdrom_osx_read_toc;
+    cdrom_disc_read_toc(disc, err);
+    osx_cdrom_set_media_changed_callback( drive, cdrom_osx_media_changed, disc );
+    return (cdrom_disc_t)disc;
+}
+
+static cdrom_disc_t cdrom_osx_open( cdrom_drive_t drive, ERROR *err )
+{
+    cdrom_disc_t result = NULL;
+
+    osx_cdrom_drive_t osx_drive = osx_cdrom_open_drive(drive->name);
+    if( osx_drive == NULL ) {
+        SET_ERROR( err, ENOENT, "Unable to open CDROM drive" );
+        return NULL;
+    } else {
+        return cdrom_osx_new( drive->name, osx_drive, err );
+    }
+}
+
+
+
+static gboolean cdrom_enum_callback( io_object_t object, char *vendor, char *product, char *iopath, void *ptr )
+{
+    char tmp1[sizeof(io_string_t) + 6];
+    char tmp2[512];
+    snprintf( tmp1, sizeof(tmp1), "dvd://%s", iopath );
+    snprintf( tmp2, sizeof(tmp2), "%s %s", vendor, product );
+    cdrom_drive_add( iopath, tmp2, cdrom_osx_open );
+    return FALSE;
+}
+
+void cdrom_drive_scan(void)
+{
+    find_cdrom_drive(cdrom_enum_callback, NULL);
+    osx_register_iokit_notifications();
+}
+
+static gboolean cdrom_osx_image_is_valid( FILE *f )
+{
+    return FALSE;
+}
+
+static cdrom_disc_t cdrom_osx_open_file( FILE *f, const gchar *filename, ERROR *err )
+{
+    return NULL; /* Not supported */
+}
+
+static gboolean cdrom_osx_read_toc( cdrom_disc_t disc, ERROR *err )
+{
+    osx_cdrom_drive_t drive = OSX_DRIVE(disc);
+
+    int fh = osx_cdrom_get_media_handle(drive);
+    if( fh == -1 ) {
+        disc->disc_type = CDROM_DISC_NONE;
+        disc->track_count = 0;
+        return FALSE;
+    } else {
+        unsigned char buf[MAXTOCSIZE];
+        dk_cd_read_toc_t readtoc;
+        memset( &readtoc, 0, sizeof(readtoc) );
+        readtoc.format = 2;
+        readtoc.formatAsTime = 0;
+        readtoc.address.session = 0;
+        readtoc.bufferLength = sizeof(buf);
+        readtoc.buffer = buf;
+
+        if( ioctl(fh, DKIOCCDREADTOC, &readtoc ) == -1 ) {
+            WARN( "Failed to read TOC (%s)", strerror(errno) );
+            disc->disc_type = CDROM_DISC_NONE;
+            disc->track_count = 0;
+            return FALSE;
+        } else {
+            mmc_parse_toc2( disc, buf );
+        }
+    }
+    return TRUE;
+}
+
+static cdrom_error_t cdrom_osx_read_sectors( sector_source_t source, cdrom_lba_t lba, cdrom_count_t count,
+                                            cdrom_read_mode_t mode, unsigned char *buf, size_t *length )
+{
+    cdrom_disc_t disc = (cdrom_disc_t)source;
+    int sector_size = 2352;
+    char data[CDROM_MAX_SECTOR_SIZE];
+    osx_cdrom_drive_t drive = OSX_DRIVE(disc);
+    
+    int fh = osx_cdrom_get_media_handle(drive);
+    if( fh == -1 ) {
+        return CDROM_ERROR_NODISC;
+    } else {
+        dk_cd_read_t readcd;
+        memset( &readcd, 0, sizeof(readcd) );
+        readcd.buffer = buf;
+        readcd.sectorType = CDROM_READ_TYPE(mode);
+
+        cdrom_track_t track = cdrom_disc_get_track_by_lba(disc,lba);
+        if( track == NULL ) {
+            return CDROM_ERROR_BADREAD;
+        }
+
+        /* This is complicated by needing to know the exact read size. Gah.
+         * For now, anything other than a data-only read of known size is
+         * executed by a raw read + extraction.
+         */
+        if( (CDROM_READ_FIELDS(mode) == CDROM_READ_DATA && CDROM_READ_TYPE(mode) != CDROM_READ_ANY) ||
+            ((track->flags & TRACK_FLAG_DATA) == 0 && CDROM_READ_FIELDS(mode) != CDROM_READ_NONE) ) {
+            switch( CDROM_READ_TYPE(mode) ) {
+            case CDROM_READ_ANY:
+            case CDROM_READ_CDDA:
+                sector_size = 2352;
+                break;
+            case CDROM_READ_MODE1:
+            case CDROM_READ_MODE2_FORM1:
+                sector_size = 2048;
+                break;
+            case CDROM_READ_MODE2:
+                sector_size = 2336;
+                break;
+            case CDROM_READ_MODE2_FORM2:
+                sector_size = 2324;
+                break;
+            }
+            readcd.sectorArea = kCDSectorAreaUser;
+            readcd.offset = sector_size * lba;
+            readcd.bufferLength = sector_size * count;
+            if( ioctl( fh, DKIOCCDREAD, &readcd ) == -1 ) {
+                return CDROM_ERROR_BADREAD;
+            }
+            *length = sector_size * count;
+        } else {
+            /* Sector could be anything - need to do a raw read and then parse
+             * the requested data out ourselves
+             */
+            sector_size = 2352;
+            size_t tmplen, len = 0;
+
+            readcd.offset = sector_size * lba;
+            readcd.sectorArea = 0xf8;
+            readcd.buffer = data;
+            readcd.bufferLength = sector_size;
+            while( count > 0 ) {
+                if( ioctl( fh, DKIOCCDREAD, &readcd ) == -1 ) {
+                    return CDROM_ERROR_BADREAD;
+                }
+                cdrom_error_t err = sector_extract_from_raw( data, mode, &buf[len], &tmplen );
+                if( err != CDROM_ERROR_OK )
+                    return err;
+                len += tmplen;
+                readcd.offset += sector_size;
+            }
+            *length = len;
+        }
+
+        return CDROM_ERROR_OK;
+    }
+}
+
</pre></div>
<hr /><a name="file18" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cdimpl.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cdimpl.h
+++ lxdream/src/drivers/cdrom/cdimpl.h
@@ -0,0 +1,199 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * Internal CD-ROM implementation header
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef cdrom_cdimpl_H
+#define cdrom_cdimpl_H 1
+
+#include "drivers/cdrom/cdrom.h"
+#include "drivers/cdrom/drive.h"
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Disc factory implementation, to construct cdrom_disc_t objects from a file
+ * (if possible).
+ */
+typedef struct cdrom_disc_factory {
+    /* Human-readable name for the discs constructed by the factory */
+    const char *display_name;
+    /* Default file extension for supported discs */
+    const char *extension;
+
+    /* Test if the given file is facially valid for the factory
+     * (that is, it passes all file magic etc checks)
+     */
+    gboolean (*is_valid_file)(FILE *f);
+
+    /* Perform any additional initialization needed for the disc type
+     * (run after the default initialization). May be NULL if no init
+     * is needed
+     * @return TRUE on success, FALSE on error.
+     */ 
+    gboolean (*init)(cdrom_disc_t disc, ERROR *err);
+    
+    /* Read the table of contents from the given file, and update the disc
+     * accordingly. On error, set the err message and return FALSE.
+     */
+    gboolean (*read_toc)(cdrom_disc_t disc, ERROR *err);
+
+} *cdrom_disc_factory_t;
+
+/**
+ * Low-level SCSI transport provided to the main SCSI/MMC driver. When used
+ * this will be set as the disc->impl_data field.
+ * Note: For symmetry there should be a packet_write variant, but we don't
+ * currently need it for anything. YAGNI, etc.
+ */
+typedef struct cdrom_scsi_transport {
+        /* Execute a read command (ie a command that returns a block of data in
+         * response, not necessarily a CD read).
+         * @param disc The disc to execute the command
+         * @param cmd  The 12-byte command packet
+         * @param buf  The buffer to receive the read results
+         * @param length On entry, the size of buf. Modified on exit to the number
+         *        of bytes actually read.
+         * @return PKT_ERR_OK on success, otherwise the host error code.
+         */
+        cdrom_error_t (*packet_read)( struct cdrom_disc *disc,
+                                      char *cmd, unsigned char *buf,
+                                      unsigned int *length );
+
+        /* Execute a generic command that does not write or return any data.
+         * (eg play audio).
+         * @param scsi The disc to execute the command
+         * @param cmd  The 12-byte command packet
+         * @return PKT_ERR_OK on success, otherwise the host error code.
+         */
+        cdrom_error_t (*packet_cmd)( struct cdrom_disc *disc,
+                                     char *cmd );
+
+        /* Return TRUE if the media has changed since the last call, otherwise
+         * FALSE. This method is used to implement the disc-level check_status
+         * and should have no side-effects.
+         */
+        gboolean (*media_changed)( struct cdrom_disc *disc );
+} *cdrom_scsi_transport_t;
+
+#define SCSI_TRANSPORT(disc)  ((cdrom_scsi_transport_t)disc->impl_data)
+
+/**
+ * Initialize a previously allocated cdrom_disc_t.
+ */
+cdrom_disc_t cdrom_disc_init( cdrom_disc_t disc, const char *filename );
+
+/**
+ * Allocate and initialize a new cdrom_disc_t with the defaults for image files
+ */
+cdrom_disc_t cdrom_disc_new( const char *name, ERROR *err );
+
+/**
+ * Read the table of contents from a scsi disc.
+ */
+gboolean cdrom_disc_scsi_read_toc( cdrom_disc_t disc, ERROR *err );
+
+/**
+ * Allocate and initialize a new cdrom_disc_t using a scsi transport.
+ */
+cdrom_disc_t cdrom_disc_scsi_new( const char *name, cdrom_scsi_transport_t transport, ERROR *err );
+
+/**
+ * Allocate and initialize a new cdrom_disc_t using a scsi transport and an
+ * open file
+ */
+cdrom_disc_t cdrom_disc_scsi_new_file( FILE *f, const char *filename, cdrom_scsi_transport_t transport, ERROR *err );
+
+
+void cdrom_disc_scsi_init( cdrom_disc_t disc, cdrom_scsi_transport_t scsi );
+
+/**
+ * Compute derived values for the TOC where they have not already been set
+ *   - Determine disc leadout from end of the last track
+ *   - Set the disc type to the based on the track types present.
+ */
+void cdrom_disc_finalize_toc( cdrom_disc_t disc );
+
+/**
+ * Clear all TOC values in preparation for replacing with a new TOC
+ */
+void cdrom_disc_clear_toc( cdrom_disc_t disc );
+
+/**
+ * Re-read the table of contents of the disc
+ */
+gboolean cdrom_disc_read_toc( cdrom_disc_t disc, ERROR *err );
+
+/**
+ * track source for a host CD-ROM device, for use by host implementations
+ */
+sector_source_t track_sector_source_new( cdrom_disc_t disc, sector_mode_t mode, cdrom_lba_t lba, cdrom_count_t count );
+
+/**
+ * Get the base file used by the cdrom, or NULL if there is no such file.
+ */
+FILE *cdrom_disc_get_base_file( cdrom_disc_t disc );
+
+#define cdrom_disc_get_base_fd(disc) fileno(cdrom_disc_get_base_file(disc))
+
+/**
+ * Default disc destructor method
+ */
+void default_cdrom_disc_destroy( sector_source_t device );
+
+/******************** Physical drive support *********************/
+
+/**
+ * Add a physical drive to the list.
+ * @return the new cdrom_drive_t entry. If the drive was already in the list,
+ * returns the existing entry instead and does not add a new one.
+ */
+cdrom_drive_t cdrom_drive_add( const char *name, const char *display_name, cdrom_drive_open_fn_t open_fn );
+
+/**
+ * Remove a physical drive from the list, specified by name.
+ * @return TRUE if the drive was removed, FALSE if the drive was not in the list.
+ */
+gboolean cdrom_drive_remove( const char *name );
+
+/**
+ * Clear the cdrom drive list.
+ */
+void cdrom_drive_remove_all();
+
+/************************* MMC support ***************************/
+
+/**
+ * Parse a standard MMC format-2 TOC into the disc structure.
+ */
+void mmc_parse_toc2( cdrom_disc_t disc, unsigned char *buf );
+
+/**
+ * Read a standard MMC inquiry response, returning a newly allocated string
+ * of the form "<vendor> <product> <revision>"
+ */
+const char *mmc_parse_inquiry( unsigned char *buf );
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !cdrom_cdimpl_H */
</pre></div>
<hr /><a name="file19" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cdrom.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cdrom.c
+++ lxdream/src/drivers/cdrom/cdrom.c
@@ -0,0 +1,386 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <glib/gmem.h>
+#include <glib/gstrfuncs.h>
+#include "lxdream.h"
+#include "drivers/cdrom/cdrom.h"
+#include "drivers/cdrom/cdimpl.h"
+
+extern struct cdrom_disc_factory linux_cdrom_drive_factory;
+extern struct cdrom_disc_factory nrg_disc_factory;
+extern struct cdrom_disc_factory cdi_disc_factory;
+extern struct cdrom_disc_factory gdi_disc_factory;
+
+cdrom_disc_factory_t cdrom_disc_factories[] = {
+#ifdef HAVE_LINUX_CDROM
+        &linux_cdrom_drive_factory,
+#endif
+        &nrg_disc_factory,
+        &cdi_disc_factory,
+        &gdi_disc_factory,
+        NULL };
+
+/********************* Implementation Support functions ************************/
+
+cdrom_error_t default_image_read_blocks( sector_source_t source, cdrom_lba_t lba, cdrom_count_t count,
+                                         unsigned char *buf )
+{
+    assert( 0 && "read_blocks called on a cdrom disc" );
+    return CDROM_ERROR_BADREAD;
+}
+
+cdrom_error_t default_image_read_sectors( sector_source_t source, cdrom_lba_t lba, cdrom_count_t count,
+                                          cdrom_read_mode_t mode, unsigned char *buf, size_t *length )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(source,DISC_SECTOR_SOURCE) );
+    cdrom_disc_t disc = (cdrom_disc_t)source;
+    size_t len = 0, tmplen;
+    cdrom_count_t current = 0;
+
+    while( current < count ) {
+        cdrom_track_t track = cdrom_disc_get_track_by_lba( disc, lba + current );
+        if( track == NULL )
+            return CDROM_ERROR_BADREAD;
+        uint32_t track_size = cdrom_disc_get_track_size( disc, track );
+        cdrom_lba_t track_offset = lba + current - track->lba;
+        cdrom_count_t sub_count = count - current;
+        if( track_size - track_offset < sub_count )
+            /* Read breaks across track boundaries. This will probably fail (due
+             * to inter-track gaps), but try it just in case
+             */
+            sub_count = track_size - track_offset;
+        cdrom_error_t err = track->source->read_sectors( track->source, track_offset, sub_count, mode, &buf[len], &tmplen );
+        if( err != CDROM_ERROR_OK )
+            return err;
+        len += tmplen;
+        current += sub_count;
+    }
+    *length = len;
+    return CDROM_ERROR_OK;
+}
+
+void default_cdrom_disc_destroy( sector_source_t source )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(source,DISC_SECTOR_SOURCE) );
+    cdrom_disc_t disc = (cdrom_disc_t)source;
+    int i;
+
+    for( i=0; i<disc->track_count; i++ ) {
+        sector_source_unref( disc->track[i].source );
+    }
+    sector_source_unref( disc->base_source );
+    g_free( (char *)disc->name );
+
+    default_sector_source_destroy( source );
+}
+
+cdrom_disc_t cdrom_disc_init( cdrom_disc_t disc, const char *filename )
+{
+    sector_source_init( &disc->source, DISC_SECTOR_SOURCE, SECTOR_UNKNOWN, 0, default_image_read_blocks,
+            default_cdrom_disc_destroy );
+    disc->source.read_sectors = default_image_read_sectors;
+    disc->disc_type = CDROM_DISC_NONE;
+    disc->track_count = disc->session_count = 0;
+    for( int i=0; i<99; i++ ) {
+        disc->track[i].trackno = i+1;
+    }
+    if( filename != NULL )
+        disc->name = g_strdup(filename);
+    return disc;
+}
+
+cdrom_disc_t cdrom_disc_new( const char *name, ERROR *err )
+{
+    cdrom_disc_t disc = g_malloc0( sizeof(struct cdrom_disc) );
+    if( disc != NULL ) {
+        cdrom_disc_init( disc, name );
+    } else {
+        SET_ERROR(err, ENOMEM, "Unable to allocate memory for cdrom disc");
+    }
+    return disc;
+}
+
+/**
+ * Construct a new image-based disc using the given filename as the base source.
+ * TOC is initialized to the empty values.
+ */
+static cdrom_disc_t cdrom_disc_image_new( const char *filename, ERROR *err )
+{
+    cdrom_disc_t disc = cdrom_disc_new( filename, err );
+    if( disc != NULL && filename != NULL ) {
+        disc->base_source = file_sector_source_new_filename( filename, SECTOR_UNKNOWN, 0, FILE_SECTOR_FULL_FILE );
+        if( disc->base_source == NULL ) {
+            SET_ERROR( err, errno, "Unable to open cdrom file '%s': %s", filename, strerror(errno) );
+            cdrom_disc_unref(disc);
+            disc = NULL;
+        } else {
+            sector_source_ref(disc->base_source);
+        }
+
+    }
+    return disc;
+}
+
+cdrom_lba_t cdrom_disc_compute_leadout( cdrom_disc_t disc )
+{
+    if( disc->track_count == 0 ) {
+        disc->leadout = 0;
+    } else {
+        cdrom_track_t last_track = &disc->track[disc->track_count-1];
+        if( last_track->source != NULL ) {
+            cdrom_lba_t leadout = last_track->lba + last_track->source->size;
+            if( leadout > disc->leadout )
+                disc->leadout = leadout;
+        }
+    }
+    return disc->leadout;
+}
+
+
+void cdrom_disc_set_default_disc_type( cdrom_disc_t disc )
+{
+    int type = CDROM_DISC_NONE, i;
+    for( i=0; i<disc->track_count; i++ ) {
+        if( (disc->track[i].flags & TRACK_FLAG_DATA == 0) ) {
+            if( type == CDROM_DISC_NONE )
+                type = CDROM_DISC_AUDIO;
+        } else if( disc->track[i].source != NULL &&
+                   (disc->track[i].source->mode == SECTOR_MODE1 ||
+                    disc->track[i].source->mode == SECTOR_RAW_NONXA) ) {
+            if( type != CDROM_DISC_XA )
+                type = CDROM_DISC_NONXA;
+        } else {
+            type = CDROM_DISC_XA;
+            break;
+        }
+    }
+    disc->disc_type = type;
+}
+
+void cdrom_disc_clear_toc( cdrom_disc_t disc )
+{
+    disc->disc_type = CDROM_DISC_NONE;
+    disc->leadout = 0;
+    disc->track_count = 0;
+    disc->session_count = 0;
+    for( unsigned i=0; i< CDROM_MAX_TRACKS; i++ ) {
+        if( disc->track[i].source != NULL ) {
+            sector_source_unref( disc->track[i].source );
+            disc->track[i].source = NULL;
+        }
+    }
+}
+
+gboolean cdrom_disc_read_toc( cdrom_disc_t disc, ERROR *err )
+{
+    /* First set the defaults for an empty disc */
+    cdrom_disc_clear_toc(disc);
+
+    if( disc->read_toc(disc, err ) ) {
+        /* Success - update disc type and leadout if the TOC read didn't set them */
+        if( disc->disc_type == CDROM_DISC_NONE )
+            cdrom_disc_set_default_disc_type(disc);
+        cdrom_disc_compute_leadout(disc);
+        return TRUE;
+    } else {
+        /* Reset to an empty disc in case the reader left things in an
+         * inconsistent state */
+        cdrom_disc_clear_toc(disc);
+        return FALSE;
+    }
+}
+
+FILE *cdrom_disc_get_base_file( cdrom_disc_t disc )
+{
+    return file_sector_source_get_file(disc->base_source);
+}
+
+/*************************** Public functions ***************************/
+
+cdrom_disc_t cdrom_disc_open( const char *inFilename, ERROR *err )
+{
+    const gchar *filename = inFilename;
+    const gchar *ext = strrchr(filename, '.');
+    int i;
+    cdrom_disc_factory_t extclz = NULL;
+
+    /* Ask the drive list if it recognizes the name first */
+    cdrom_drive_t drive = cdrom_drive_find(inFilename);
+    if( drive != NULL ) {
+        return cdrom_drive_open(drive, err);
+    }
+
+    cdrom_disc_t disc = cdrom_disc_image_new( filename, err );
+    if( disc == NULL )
+        return NULL;
+
+    /* check file extensions first */
+    FILE *f = file_sector_source_get_file(disc->base_source);
+    if( ext != NULL ) {
+        ext++; /* Skip the '.' */
+        for( i=0; cdrom_disc_factories[i] != NULL; i++ ) {
+            if( cdrom_disc_factories[i]->extension != NULL &&
+                    strcasecmp( cdrom_disc_factories[i]->extension, ext ) == 0 ) {
+                extclz = cdrom_disc_factories[i];
+                if( extclz->is_valid_file(f) ) {
+                    disc->read_toc = extclz->read_toc;
+                }
+                break;
+            }
+        }
+    }
+
+    if( disc->read_toc == NULL ) {
+        /* Okay, fall back to magic */
+        for( i=0; cdrom_disc_factories[i] != NULL; i++ ) {
+            if( cdrom_disc_factories[i] != extclz &&
+                cdrom_disc_factories[i]->is_valid_file(f) ) {
+                disc->read_toc = cdrom_disc_factories[i]->read_toc;
+                break;
+            }
+        }
+    }
+
+    if( disc->read_toc != NULL && cdrom_disc_read_toc( disc, err ) ) {
+        /* All good */
+        return disc;
+    } else {
+        /* No handler found for file */
+        cdrom_disc_unref( disc );
+        SET_ERROR( err, EINVAL, "File '%s' could not be recognized as any known image file or device type" );
+        return NULL;
+    }
+}
+
+/**
+ * Get the track information for the given track. If there is no such track,
+ * return NULL;
+ */
+cdrom_track_t cdrom_disc_get_track( cdrom_disc_t disc, cdrom_trackno_t track )
+{
+    if( track < 1 || track >= disc->track_count )
+        return NULL;
+    return &disc->track[track-1];
+}
+
+/**
+ * Get the track information for the first track of the given session. If there
+ * is no such session, return NULL;
+ */
+cdrom_track_t cdrom_disc_get_session( cdrom_disc_t disc, cdrom_sessionno_t session )
+{
+    for( unsigned i=0; i< disc->track_count; i++ ) {
+        if( disc->track[i].sessionno == session )
+            return &disc->track[i];
+    }
+    return NULL;
+}
+
+cdrom_count_t cdrom_disc_get_track_size( cdrom_disc_t disc, cdrom_track_t track )
+{
+    if( track->trackno == disc->track_count )
+        return disc->leadout - track->lba;
+    else
+        return disc->track[track->trackno].lba - track->lba;
+}
+
+cdrom_track_t cdrom_disc_get_last_track( cdrom_disc_t disc )
+{
+    if( disc->track_count == 0 )
+        return NULL;
+    return &disc->track[disc->track_count-1];
+}
+
+cdrom_track_t cdrom_disc_prev_track( cdrom_disc_t disc, cdrom_track_t track )
+{
+    if( track->trackno <= 1 )
+        return NULL;
+    return cdrom_disc_get_track( disc, track->trackno-1 );
+}
+
+cdrom_track_t cdrom_disc_next_track( cdrom_disc_t disc, cdrom_track_t track )
+{
+    if( track->trackno >= disc->track_count )
+        return NULL;
+    return cdrom_disc_get_track( disc, track->trackno+1 );
+}
+
+/**
+ * Find the track containing the sector specified by LBA.
+ * Note: this function does not check for media change.
+ * @return The track, or NULL if no track contains the sector.
+ */
+cdrom_track_t cdrom_disc_get_track_by_lba( cdrom_disc_t disc, cdrom_lba_t lba )
+{
+    if( disc->track_count == 0 || disc->track[0].lba > lba || lba >= disc->leadout )
+        return NULL; /* LBA outside disc bounds */
+
+    for( unsigned i=1; i< disc->track_count; i++ ) {
+        if( lba < disc->track[i].lba )
+            return &disc->track[i-1];
+    }
+    return &disc->track[disc->track_count-1];
+}
+
+cdrom_error_t cdrom_disc_read_sectors( cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t count,
+                                       cdrom_read_mode_t mode, unsigned char *buf, size_t *length )
+{
+    return disc->source.read_sectors( &disc->source, lba, count, mode, buf, length );
+}
+
+/**
+ * Check if the disc contains valid media.
+ * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC
+ */
+cdrom_error_t cdrom_disc_check_media( cdrom_disc_t disc )
+{
+    if( disc == NULL )
+        return CDROM_ERROR_NODISC;
+    if( disc->check_media != NULL )
+        disc->check_media(disc);
+    return disc->disc_type == CDROM_DISC_NONE ? CDROM_ERROR_NODISC : CDROM_ERROR_OK;
+}
+
+void cdrom_disc_print_toc( FILE *f, cdrom_disc_t disc )
+{
+    int i;
+    int session = 0;
+
+    if( disc == NULL || disc->track_count == 0 ) {
+        fprintf( f, "No disc\n" );
+        return;
+    }
+    for( i=0; i<disc->track_count; i++ ) {
+        cdrom_track_t track = &disc->track[i];
+        if( track->sessionno != session ) {
+            session = disc->track[i].sessionno;
+            fprintf( f, "Session %d:\n", session );
+        }
+        fprintf( f, "  %02d. %6d %02x\n", track->trackno, track->lba, track->flags );
+    }
+}
+
+void cdrom_disc_dump_toc( cdrom_disc_t disc )
+{
+    cdrom_disc_print_toc( stderr, disc );
+}
+
</pre></div>
<hr /><a name="file20" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>cdrom.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/cdrom.h
+++ lxdream/src/drivers/cdrom/cdrom.h
@@ -0,0 +1,153 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Copyright (c) 2005-2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef cdrom_cdrom_H
+#define cdrom_cdrom_H 1
+
+#include <stdio.h>
+#include <glib/glist.h>
+#include "drivers/cdrom/defs.h"
+#include "drivers/cdrom/sector.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+    CDROM_DISC_NONE =  0x06,
+    CDROM_DISC_AUDIO = 0x00,
+    CDROM_DISC_NONXA = 0x10,
+    CDROM_DISC_XA    = 0x20,
+    CDROM_DISC_GDROM = 0x80
+} cdrom_disc_type_t;
+
+#define TRACK_FLAG_PREEMPH   0x10 /* Pre-emphasis (audio only) */
+#define TRACK_FLAG_COPYPERM  0x20 /* Copy permitted */
+#define TRACK_FLAG_DATA      0x40 /* Data track */
+#define TRACK_FLAG_FOURCHAN  0x80 /* 4-channel audio */
+
+struct cdrom_track {
+    cdrom_trackno_t trackno;
+    cdrom_sessionno_t sessionno;  /* session # containing this track */
+    cdrom_lba_t lba;            /* start sector address */
+    uint8_t flags;              /* Track flags */
+    sector_source_t source;
+};
+
+/**
+ * A CDROM disc, either an image file, or an open physical host device.
+ */
+struct cdrom_disc {
+    struct sector_source source;
+    const char *name; /* Filename or identifier used to open the disc */
+    cdrom_disc_type_t disc_type;
+    gchar mcn[14]; /* Media catalogue number, null terminated. */
+    cdrom_trackno_t track_count;
+    cdrom_sessionno_t session_count;
+    cdrom_lba_t leadout; /* LBA of the disc leadout */
+    struct cdrom_track track[99];
+
+    /* Reference to an underlying source, if any. */
+    sector_source_t base_source;
+
+    /* Private implementation-specific data */
+    void *impl_data;
+
+    /** Check for media change. If the media cannot change (ie image file)
+     * or is notified asynchonously, this should be a no-op. In the event of
+     * a change, this function should update the structure according to the
+     * new media (including TOC), and return TRUE.
+     * @return TRUE if the media has changed since the last check, otherwise
+     * FALSE.
+     */
+    gboolean (*check_media)(cdrom_disc_t disc);
+
+    /**
+     * Read the table of contents from the given file
+     */
+    gboolean (*read_toc)(cdrom_disc_t disc, ERROR *err);
+
+    /**
+     * Begin playing audio from the given lba address on the disc.
+     */
+    cdrom_error_t (*play_audio)(cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t length);
+
+    cdrom_error_t (*scan_audio)(cdrom_disc_t disc, cdrom_lba_t lba, gboolean direction);
+
+    cdrom_error_t (*stop_audio)(cdrom_disc_t disc);
+
+};
+
+/**
+ * Open an image file or device
+ */
+cdrom_disc_t cdrom_disc_open( const char *filename, ERROR *err );
+
+/**
+ * Get the track information for the given track. If there is no such track,
+ * return NULL;
+ */
+cdrom_track_t cdrom_disc_get_track( cdrom_disc_t disc, cdrom_trackno_t track );
+
+/**
+ * Get the track information for the first track of the given session. If there
+ * is no such session, return NULL;
+ */
+cdrom_track_t cdrom_disc_get_session( cdrom_disc_t disc, cdrom_sessionno_t session );
+
+cdrom_track_t cdrom_disc_get_last_track( cdrom_disc_t disc );
+
+cdrom_track_t cdrom_disc_prev_track( cdrom_disc_t disc, cdrom_track_t track );
+cdrom_track_t cdrom_disc_next_track( cdrom_disc_t disc, cdrom_track_t track );
+
+/**
+ * Return the size of the track in sectors, including inter-track gap
+ */
+cdrom_count_t cdrom_disc_get_track_size( cdrom_disc_t disc, cdrom_track_t track );
+
+/**
+ * Find the track containing the sector specified by LBA.
+ * Note: this function does not check for media change.
+ * @return The track, or NULL if no track contains the sector.
+ */
+cdrom_track_t cdrom_disc_get_track_by_lba( cdrom_disc_t disc, cdrom_lba_t lba );
+
+/** 
+ * Check if the disc contains valid media.
+ * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC
+ */
+cdrom_error_t cdrom_disc_check_media( cdrom_disc_t disc );
+
+/**
+ * Read sectors from the disc.
+ * @return status code
+ */
+cdrom_error_t cdrom_disc_read_sectors( cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t count, cdrom_read_mode_t mode,
+                                       unsigned char *buf, size_t *length );
+
+/**
+ * Print the disc's table of contents to the given output stream.
+ */
+void cdrom_disc_print_toc( FILE *f, cdrom_disc_t disc );
+
+#define cdrom_disc_ref(disc) sector_source_ref((sector_source_t)disc)
+#define cdrom_disc_unref(disc) sector_source_unref((sector_source_t)disc)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !cdrom_cdrom_H */
</pre></div>
<hr /><a name="file21" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>defs.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/defs.h
+++ lxdream/src/drivers/cdrom/defs.h
@@ -0,0 +1,141 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Global cdrom definitions.
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef cdrom_defs_H
+#define cdrom_defs_H 1
+
+#include "lxdream.h"
+#include <stdint.h>
+#include <glib/gtypes.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef uint32_t cdrom_lba_t;
+typedef uint32_t cdrom_count_t;
+
+/** Tracks are numbered 1..99, with 0 reserved for errors */
+typedef uint8_t  cdrom_trackno_t;
+
+typedef uint8_t  cdrom_sessionno_t;
+
+typedef const struct cdrom_track *cdrom_track_t;
+typedef struct cdrom_disc *cdrom_disc_t;
+
+/** sector read mode - values are based on the MMC READ CD command. */
+typedef uint16_t cdrom_read_mode_t;
+#define CDROM_READ_ANY         (0<<2)
+#define CDROM_READ_CDDA        (1<<2)
+#define CDROM_READ_MODE1       (2<<2)
+#define CDROM_READ_MODE2       (3<<2)
+#define CDROM_READ_MODE2_FORM1 (4<<2)
+#define CDROM_READ_MODE2_FORM2 (5<<2)
+
+#define CDROM_READ_NONE      0x0000
+#define CDROM_READ_SYNC      0x8000
+#define CDROM_READ_DATA      0x1000
+#define CDROM_READ_ECC       0x0800
+#define CDROM_READ_HEADER    0x2000
+#define CDROM_READ_SUBHEADER 0x4000
+#define CDROM_READ_RAW       0xF800 /* Read full sector */
+#define CDROM_READ_TYPE(x)   ((x) & 0x1C)
+#define CDROM_READ_FIELDS(x) ((x) & 0xF800)
+
+/** Actual sector mode */
+typedef enum {
+    SECTOR_UNKNOWN,        // Unknown sector mode
+    SECTOR_CDDA,           // Standard audio track
+    /* Data-only modes */
+    SECTOR_MODE1,          // Standard CD-Rom Mode 1 data track
+    SECTOR_MODE2_FORMLESS, // Mode 2 data track with no sub-structure (rare)
+    SECTOR_MODE2_FORM1,    // Mode 2/Form 1 data track (standard for multisession)
+    SECTOR_MODE2_FORM2,    // Mode 2/Form 2 data track (also fairly uncommon).
+
+    /* 2336-byte Mode 2 XA sector with subheader and ecc data */
+    SECTOR_SEMIRAW_MODE2,
+    /* 2352-byte raw data sector in an XA session */
+    SECTOR_RAW_XA,
+    /* 2352-byte raw data sector in a non-XA session */
+    SECTOR_RAW_NONXA,
+} sector_mode_t;
+
+
+extern const uint32_t cdrom_sector_size[];
+extern const uint32_t cdrom_sector_read_mode[];
+#define CDROM_MAX_SECTOR_SIZE    2352
+#define CDROM_MAX_TRACKS         99
+#define CDROM_MSF_START          150 /* MSF numbering starts after the initial pregap */
+#define CDROM_FRAMES_PER_SECOND  75
+#define CDROM_SECONDS_PER_MINUTE 60
+#define CDROM_FRAMES_PER_MINUTE  (CDROM_FRAMES_PER_SECOND*CDROM_SECONDS_PER_MINUTE)
+#define CDROM_PREGAP             150  /* Standard pregap, in frames */
+#define CDROM_SECTOR_SIZE(x)     cdrom_sector_size[x]
+#define CDROM_SECTOR_READ_MODE(x) cdrom_sector_read_mode[x]
+#define MSFTOLBA( m,s,f ) ((f) + ((s)*CDROM_FRAMES_PER_SECOND) + ((m)*CDROM_FRAMES_PER_MINUTE) - CDROM_MSF_START)
+
+/**
+ * Convert an 8-bit BCD number to integer form.
+ * Eg, 0x79 => 79
+ */
+uint8_t static inline BCDTOU8( uint8_t bcd )
+{
+    return (bcd & 0x0F) + (((bcd & 0xF0)>>4)*10);
+}
+
+/**
+ * Convert a 32 bit BCD-encoded MSF address to the
+ * equivalent LBA form.
+ * Eg, 0x
+ */
+cdrom_lba_t static inline BCD_MSFTOLBA( uint32_t msf )
+{
+    msf = GUINT32_FROM_BE(msf);
+    int f = BCDTOU8(msf);
+    int s = BCDTOU8(msf>>8);
+    int m = BCDTOU8(msf>>16);
+    return MSFTOLBA(m,s,f);
+}
+
+/* Disc types */
+typedef uint8_t cdrom_type_t;
+#define CDROM_TYPE_NONXA 0x00  /* Audio or straight mode-1 data */
+#define CDROM_TYPE_CDI   0x10
+#define CDROM_TYPE_XA    0x20
+#define CDROM_TYPE_GD    0x80  /* SEGA only */
+
+
+/* Error codes are defined as MMC sense data - low byte is the sense key,
+ * next byte, is the ASC code, and third byte is the ASCQ (not currently used)
+ */
+typedef uint32_t cdrom_error_t;
+#define CDROM_ERROR_OK        0x0000
+#define CDROM_ERROR_NODISC    0x3A02
+#define CDROM_ERROR_BADCMD    0x2005
+#define CDROM_ERROR_BADFIELD  0x2405
+#define CDROM_ERROR_BADREAD   0x3002
+#define CDROM_ERROR_BADREADMODE 0x6405  /* Illegal mode for this track */
+#define CDROM_ERROR_READERROR 0x1103    /* Read failed due to uncorrectable error */
+#define CDROM_ERROR_RESET     0x2906
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !cdrom_defs_H */
</pre></div>
<hr /><a name="file22" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>drive.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/drive.c
+++ lxdream/src/drivers/cdrom/drive.c
@@ -0,0 +1,148 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Host CD/DVD drive support.
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdlib.h>
+#include <glib/gstrfuncs.h>
+#include <glib/gmem.h>
+#include "drivers/cdrom/drive.h"
+#include "drivers/cdrom/cdimpl.h"
+
+static GList *cdrom_drive_list;
+
+static cdrom_drive_t cdrom_drive_new( const char *name, const char *display_name, cdrom_drive_open_fn_t open_fn )
+{
+    cdrom_drive_t drive = g_malloc0( sizeof(struct cdrom_drive) );
+    drive->name = g_strdup(name);
+    drive->display_name = g_strdup(display_name);
+    drive->open = open_fn;
+    return drive;
+}
+
+static void cdrom_drive_destroy( cdrom_drive_t drive )
+{
+    g_free( (char *)drive->name );
+    drive->name = NULL;
+    g_free( (char *)drive->display_name );
+    drive->display_name = NULL;
+    g_free( drive );
+}
+
+GList *cdrom_drive_get_list()
+{
+    return cdrom_drive_list;
+}
+
+cdrom_drive_t cdrom_drive_add( const char *name, const char *display_name, cdrom_drive_open_fn_t open_fn )
+{
+    for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {
+        cdrom_drive_t it = (cdrom_drive_t)ptr->data;
+        if( strcmp(it->name, name) == 0 ) {
+            return it;
+        }
+    }
+
+    cdrom_drive_t new_drive = cdrom_drive_new(name,display_name,open_fn);
+    cdrom_drive_list = g_list_append( cdrom_drive_list, new_drive );
+    return new_drive;
+}
+
+gboolean cdrom_drive_remove( const char *name )
+{
+    for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {
+        cdrom_drive_t it = (cdrom_drive_t)ptr->data;
+        if( strcmp(it->name, name) == 0 ) {
+            cdrom_drive_list = g_list_delete_link( cdrom_drive_list, ptr );
+            cdrom_drive_destroy(it);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+void cdrom_drive_remove_all()
+{
+    for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {
+        cdrom_drive_destroy( (cdrom_drive_t)ptr->data );
+    }
+    g_list_free(cdrom_drive_list);
+    cdrom_drive_list = NULL;
+}
+
+cdrom_drive_t cdrom_drive_get_index( unsigned int index )
+{
+    return (cdrom_drive_t)g_list_nth_data(cdrom_drive_list, index);
+}
+
+cdrom_disc_t cdrom_drive_open( cdrom_drive_t drive, ERROR *err )
+{
+    return drive->open(drive, err);
+}
+
+cdrom_drive_t cdrom_drive_find( const char *name )
+{
+    const char *id = name;
+
+    /* If we have no drives, just return NULL without looking, to save time */
+    if( cdrom_drive_list == NULL )
+        return NULL;
+
+    /* Check for a url-style name */
+    const char *lizard_lips = strstr( name, "://" );
+    if( lizard_lips != NULL ) {
+        id = lizard_lips + 3;
+        int method_len = (lizard_lips-name);
+        if( method_len > 8 )
+            return NULL;
+
+        char method[method_len + 1];
+        memcpy( method, name, method_len );
+        method[method_len] = '\0';
+
+        if( strcasecmp( method, "file" ) != 0 &&
+            strcasecmp( method, "dvd" ) != 0 &&
+            strcasecmp( method, "cd" ) != 0 &&
+            strcasecmp( method, "cdrom" ) ) {
+            /* Anything else we don't try to recognize */
+            return NULL;
+        }
+
+        if( *id == '\0' ) {
+            /* Accept eg  'dvd://' as meaning 'the first cd/dvd device */
+            return cdrom_drive_list->data;
+        }
+
+        char *endp = NULL;
+        unsigned long index = strtoul( id, &endp, 10 );
+        if( endp != NULL && *endp == '\0' ) {
+            /* Accept eg 'dvd://2' as meaning 'the second cd/dvd device */
+            return cdrom_drive_get_index(index);
+        }
+
+        /* Otherwise it must be a drive identifier, so treat it as if it didn't
+         * have the url prefix. (fallthrough)
+         */
+    }
+
+    for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {
+        cdrom_drive_t drive = (cdrom_drive_t)ptr->data;
+        if( strcmp(drive->name, id) == 0 )
+            return drive;
+    }
+
+    return NULL;
+}
</pre></div>
<hr /><a name="file23" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>drive.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/drive.h
+++ lxdream/src/drivers/cdrom/drive.h
@@ -0,0 +1,97 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * Host CD/DVD drive support.
+ *
+ * This module supplies functions to enumerate the physical drives in the
+ * host system, and open them as a cdrom disc.
+ *
+ * Note that cdrom_disc_t objects bound to a physical drive may update their
+ * TOC at any time, including setting disc_type to CDROM_DISC_NONE (to indicate
+ * no media present).
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef cdrom_drive_H
+#define cdrom_drive_H 1
+
+#include <glib/glist.h>
+#include "hook.h"
+#include "drivers/cdrom/defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct cdrom_drive *cdrom_drive_t;
+
+typedef cdrom_disc_t (*cdrom_drive_open_fn_t)(cdrom_drive_t, ERROR *);
+
+/**
+ * A cdrom_device is a placeholder for a physical CD/DVD drive in the host
+ * system.
+ */
+struct cdrom_drive {
+    /**
+     * System name for the device
+     */
+    const char *name;
+    /**
+     * Human-readable name of the device - normally the device's vendor
+     * and product name as returned by an Inquiry request.
+     */
+    const char *display_name;
+
+    /**
+     * Implementation specific function to open the drive, returning a new
+     * cdrom_disc_t.
+     */
+    cdrom_drive_open_fn_t open;
+};
+
+typedef gboolean (*cdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );
+DECLARE_HOOK(cdrom_drive_list_change_hook, cdrom_drive_list_change_hook_t);
+
+
+/**
+ * Native CD-ROM API - provided by drivers/cd_*.c
+ *
+ * A device name is either a system special file (most unixes) or a url of the
+ * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system
+ * defined string that uniquely identifies a particular device.
+ */
+
+/**
+ * Return a list of cdrom_drive_t defining all CD/DVD drives in the host system.
+ */
+GList *cdrom_drive_get_list();
+
+/**
+ *
+ */
+cdrom_drive_t cdrom_drive_find( const char *name );
+
+/**
+ * Open a cdrom_drive_t previously obtained from the system.
+ *
+ * @return NULL on failure, otherwise a valid cdrom_disc_t that can be mounted.
+ */
+cdrom_disc_t cdrom_drive_open( cdrom_drive_t drive, ERROR *err );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !cdrom_drive_H */
</pre></div>
<hr /><a name="file24" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>ecc.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/ecc.h
+++ lxdream/src/drivers/cdrom/ecc.h
@@ -0,0 +1,136 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/*
+ * This file has been modified for the cdrkit suite.
+ *
+ * The behaviour and appearence of the program code below can differ to a major
+ * extent from the version distributed by the original author(s).
+ *
+ * For details, see Changelog file distributed with the cdrkit package. If you
+ * received this file from another source then ask the distributing person for
+ * a log of modifications.
+ *
+ */
+
+/* @(#)ecc.h   1.4 02/10/19 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */
+
+/*
+ * compact disc reed-solomon routines
+ *
+ * (c) 1998-2002 by Heiko Eissfeldt, heiko@colossus.escape.de
+ * (c) 2002 by Joerg Schilling
+ */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; see the file COPYING.  If not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#define RS_L12_BITS 8
+
+/* audio sector definitions for CIRC */
+#define FRAMES_PER_SECTOR 98
+/* user data bytes per frame */
+#define L1_RAW 24
+/* parity bytes with 8 bit */
+#define L1_Q   4
+#define L1_P   4
+
+int cd_build_address(unsigned char inout[], int sectortype, unsigned address);
+
+/* audio sector Cross Interleaved Reed-Solomon Code (CIRC) encoder (layer 1) */
+/* adds P- and Q- parity information to audio (f2) frames. Also
+   optionally handles the various delays and permutations. The output with all
+   stages enabled can be fed into the Eight-Fourteen-Modulator.
+   On input: 2352 bytes of audio data is given.
+   On output: 3136 bytes of CIRC enriched audio data are returned.
+ */
+int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],
+                                         unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
+                                         int delay1, int delay2, int delay3, int scramble);
+
+/* data sector definitions for RSPC */
+/* user data bytes per frame */
+#define L2_RAW (1024*2)
+/* parity bytes for 16 bit units */
+#define L2_Q   (26*2*2)
+#define L2_P   (43*2*2)
+
+/* known sector types */
+#define MODE_0 SECTOR_UNKNOWN
+#define MODE_1 SECTOR_MODE1
+#define MODE_2 SECTOR_MODE2_FORMLESS
+#define MODE_2_FORM_1  SECTOR_MODE2_FORM1
+#define MODE_2_FORM_2  SECTOR_MODE2_FORM2
+
+/* set one of the MODE_* constants for subsequent data sector formatting */
+int set_sector_type(int st);
+/* get the current sector type setting for data sector formatting */
+int get_sector_type(void);
+
+/* data sector layer 2 Reed-Solomon Product Code encoder */
+/* encode the given data portion depending on sector type (see
+   get/set_sector_type() functions). Use the given address for the header.
+   The returned data is __unscrambled__ and not in F2-frame format (for that
+   see function scramble_L2()).
+   Supported sector types:
+     MODE_0: a 12-byte sync field, a header and 2336 zeros are returned.
+     MODE_1: the user data portion (2048 bytes) has to be given
+             at offset 16 in the inout array.
+             Sync-, header-, edc-, spare-, p- and q- fields will be added.
+     MODE_2: the user data portion (2336 bytes) has to be given
+             at offset 16 in the inout array.
+             Sync- and header- fields will be added.
+     MODE_2_FORM_1: the user data portion (8 bytes subheader followed
+                    by 2048 bytes data) has to be given at offset 16
+                    in the inout array.
+                    Sync-, header-, edc-, p- and q- fields will be added.
+     MODE_2_FORM_2: the user data portion (8 bytes subheader followed
+                    by 2324 bytes data) has to be given at offset 16
+                    in the inout array.
+                    Sync-, header- and edc- fields will be added.
+*/
+int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
+int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);
+int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);
+unsigned int build_edc(unsigned char inout[], int from, int upto);
+
+/* generates f2 frames from otherwise fully formatted sectors (generated by
+   do_encode_L2()). */
+#define        EDC_SCRAMBLE_NOSWAP     1       /* Do not swap bytes while scrambling */
+int scramble_L2(unsigned char *inout);
+
+/* r-w sub channel definitions */
+#define RS_SUB_RW_BITS 6
+
+#define PACKETS_PER_SUBCHANNELFRAME 4
+#define LSUB_RAW 18
+#define LSUB_QRAW 2
+/* 6 bit */
+#define LSUB_Q 2
+#define LSUB_P 4
+
+/* R-W subchannel encoder */
+/* On input: 72 bytes packed user data, four frames with each 18 bytes.
+   On output: per frame: 2 bytes user data, 2 bytes Q parity, 
+                         16 bytes user data, 4 bytes P parity.
+   Options:
+     delay1: use low level delay line
+     scramble: perform low level permutations
+ */
+int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
+               unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
+               int delay1, int scramble);
+int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
+                                               unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
+                                               int delay1, int scramble);
+
+int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);
+int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
</pre></div>
<hr /><a name="file25" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>edc_crctable.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/edc_crctable.h
+++ lxdream/src/drivers/cdrom/edc_crctable.h
@@ -0,0 +1,171 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* @(#)crctable.out    1.2 02/10/17 joerg */
+
+/*****************************************************************/
+/*                                                               */
+/* CRC LOOKUP TABLE                                              */
+/* ================                                              */
+/* The following CRC lookup table was generated automagically    */
+/* by the Rocksoft^tm Model CRC Algorithm Table Generation       */
+/* Program V1.0 using the following model parameters:            */
+/*                                                               */
+/*    Width   : 4 bytes.                                         */
+/*    Poly    : 0x8001801BL                                      */
+/*    Reverse : TRUE.                                            */
+/*                                                               */
+/* For more information on the Rocksoft^tm Model CRC Algorithm,  */
+/* see the document titled "A Painless Guide to CRC Error        */
+/* Detection Algorithms" by Ross Williams                        */
+/* (ross@guest.adelaide.edu.au.). This document is likely to be  */
+/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft".        */
+/*                                                               */
+/*****************************************************************/
+
+#ifdef PROTOTYPES
+
+static unsigned int EDC_crctable[256] =
+{
+ 0x00000000U, 0x90910101U, 0x91210201U, 0x01B00300U,
+ 0x92410401U, 0x02D00500U, 0x03600600U, 0x93F10701U,
+ 0x94810801U, 0x04100900U, 0x05A00A00U, 0x95310B01U,
+ 0x06C00C00U, 0x96510D01U, 0x97E10E01U, 0x07700F00U,
+ 0x99011001U, 0x09901100U, 0x08201200U, 0x98B11301U,
+ 0x0B401400U, 0x9BD11501U, 0x9A611601U, 0x0AF01700U,
+ 0x0D801800U, 0x9D111901U, 0x9CA11A01U, 0x0C301B00U,
+ 0x9FC11C01U, 0x0F501D00U, 0x0EE01E00U, 0x9E711F01U,
+ 0x82012001U, 0x12902100U, 0x13202200U, 0x83B12301U,
+ 0x10402400U, 0x80D12501U, 0x81612601U, 0x11F02700U,
+ 0x16802800U, 0x86112901U, 0x87A12A01U, 0x17302B00U,
+ 0x84C12C01U, 0x14502D00U, 0x15E02E00U, 0x85712F01U,
+ 0x1B003000U, 0x8B913101U, 0x8A213201U, 0x1AB03300U,
+ 0x89413401U, 0x19D03500U, 0x18603600U, 0x88F13701U,
+ 0x8F813801U, 0x1F103900U, 0x1EA03A00U, 0x8E313B01U,
+ 0x1DC03C00U, 0x8D513D01U, 0x8CE13E01U, 0x1C703F00U,
+ 0xB4014001U, 0x24904100U, 0x25204200U, 0xB5B14301U,
+ 0x26404400U, 0xB6D14501U, 0xB7614601U, 0x27F04700U,
+ 0x20804800U, 0xB0114901U, 0xB1A14A01U, 0x21304B00U,
+ 0xB2C14C01U, 0x22504D00U, 0x23E04E00U, 0xB3714F01U,
+ 0x2D005000U, 0xBD915101U, 0xBC215201U, 0x2CB05300U,
+ 0xBF415401U, 0x2FD05500U, 0x2E605600U, 0xBEF15701U,
+ 0xB9815801U, 0x29105900U, 0x28A05A00U, 0xB8315B01U,
+ 0x2BC05C00U, 0xBB515D01U, 0xBAE15E01U, 0x2A705F00U,
+ 0x36006000U, 0xA6916101U, 0xA7216201U, 0x37B06300U,
+ 0xA4416401U, 0x34D06500U, 0x35606600U, 0xA5F16701U,
+ 0xA2816801U, 0x32106900U, 0x33A06A00U, 0xA3316B01U,
+ 0x30C06C00U, 0xA0516D01U, 0xA1E16E01U, 0x31706F00U,
+ 0xAF017001U, 0x3F907100U, 0x3E207200U, 0xAEB17301U,
+ 0x3D407400U, 0xADD17501U, 0xAC617601U, 0x3CF07700U,
+ 0x3B807800U, 0xAB117901U, 0xAAA17A01U, 0x3A307B00U,
+ 0xA9C17C01U, 0x39507D00U, 0x38E07E00U, 0xA8717F01U,
+ 0xD8018001U, 0x48908100U, 0x49208200U, 0xD9B18301U,
+ 0x4A408400U, 0xDAD18501U, 0xDB618601U, 0x4BF08700U,
+ 0x4C808800U, 0xDC118901U, 0xDDA18A01U, 0x4D308B00U,
+ 0xDEC18C01U, 0x4E508D00U, 0x4FE08E00U, 0xDF718F01U,
+ 0x41009000U, 0xD1919101U, 0xD0219201U, 0x40B09300U,
+ 0xD3419401U, 0x43D09500U, 0x42609600U, 0xD2F19701U,
+ 0xD5819801U, 0x45109900U, 0x44A09A00U, 0xD4319B01U,
+ 0x47C09C00U, 0xD7519D01U, 0xD6E19E01U, 0x46709F00U,
+ 0x5A00A000U, 0xCA91A101U, 0xCB21A201U, 0x5BB0A300U,
+ 0xC841A401U, 0x58D0A500U, 0x5960A600U, 0xC9F1A701U,
+ 0xCE81A801U, 0x5E10A900U, 0x5FA0AA00U, 0xCF31AB01U,
+ 0x5CC0AC00U, 0xCC51AD01U, 0xCDE1AE01U, 0x5D70AF00U,
+ 0xC301B001U, 0x5390B100U, 0x5220B200U, 0xC2B1B301U,
+ 0x5140B400U, 0xC1D1B501U, 0xC061B601U, 0x50F0B700U,
+ 0x5780B800U, 0xC711B901U, 0xC6A1BA01U, 0x5630BB00U,
+ 0xC5C1BC01U, 0x5550BD00U, 0x54E0BE00U, 0xC471BF01U,
+ 0x6C00C000U, 0xFC91C101U, 0xFD21C201U, 0x6DB0C300U,
+ 0xFE41C401U, 0x6ED0C500U, 0x6F60C600U, 0xFFF1C701U,
+ 0xF881C801U, 0x6810C900U, 0x69A0CA00U, 0xF931CB01U,
+ 0x6AC0CC00U, 0xFA51CD01U, 0xFBE1CE01U, 0x6B70CF00U,
+ 0xF501D001U, 0x6590D100U, 0x6420D200U, 0xF4B1D301U,
+ 0x6740D400U, 0xF7D1D501U, 0xF661D601U, 0x66F0D700U,
+ 0x6180D800U, 0xF111D901U, 0xF0A1DA01U, 0x6030DB00U,
+ 0xF3C1DC01U, 0x6350DD00U, 0x62E0DE00U, 0xF271DF01U,
+ 0xEE01E001U, 0x7E90E100U, 0x7F20E200U, 0xEFB1E301U,
+ 0x7C40E400U, 0xECD1E501U, 0xED61E601U, 0x7DF0E700U,
+ 0x7A80E800U, 0xEA11E901U, 0xEBA1EA01U, 0x7B30EB00U,
+ 0xE8C1EC01U, 0x7850ED00U, 0x79E0EE00U, 0xE971EF01U,
+ 0x7700F000U, 0xE791F101U, 0xE621F201U, 0x76B0F300U,
+ 0xE541F401U, 0x75D0F500U, 0x7460F600U, 0xE4F1F701U,
+ 0xE381F801U, 0x7310F900U, 0x72A0FA00U, 0xE231FB01U,
+ 0x71C0FC00U, 0xE151FD01U, 0xE0E1FE01U, 0x7070FF00U,
+};
+
+/*****************************************************************/
+/*                   End of CRC Lookup Table                     */
+/*****************************************************************/
+
+#else  /* PROTOTYPES */
+
+static unsigned int EDC_crctable[256] =
+{
+ 0x00000000, 0x90910101, 0x91210201, 0x01B00300,
+ 0x92410401, 0x02D00500, 0x03600600, 0x93F10701,
+ 0x94810801, 0x04100900, 0x05A00A00, 0x95310B01,
+ 0x06C00C00, 0x96510D01, 0x97E10E01, 0x07700F00,
+ 0x99011001, 0x09901100, 0x08201200, 0x98B11301,
+ 0x0B401400, 0x9BD11501, 0x9A611601, 0x0AF01700,
+ 0x0D801800, 0x9D111901, 0x9CA11A01, 0x0C301B00,
+ 0x9FC11C01, 0x0F501D00, 0x0EE01E00, 0x9E711F01,
+ 0x82012001, 0x12902100, 0x13202200, 0x83B12301,
+ 0x10402400, 0x80D12501, 0x81612601, 0x11F02700,
+ 0x16802800, 0x86112901, 0x87A12A01, 0x17302B00,
+ 0x84C12C01, 0x14502D00, 0x15E02E00, 0x85712F01,
+ 0x1B003000, 0x8B913101, 0x8A213201, 0x1AB03300,
+ 0x89413401, 0x19D03500, 0x18603600, 0x88F13701,
+ 0x8F813801, 0x1F103900, 0x1EA03A00, 0x8E313B01,
+ 0x1DC03C00, 0x8D513D01, 0x8CE13E01, 0x1C703F00,
+ 0xB4014001, 0x24904100, 0x25204200, 0xB5B14301,
+ 0x26404400, 0xB6D14501, 0xB7614601, 0x27F04700,
+ 0x20804800, 0xB0114901, 0xB1A14A01, 0x21304B00,
+ 0xB2C14C01, 0x22504D00, 0x23E04E00, 0xB3714F01,
+ 0x2D005000, 0xBD915101, 0xBC215201, 0x2CB05300,
+ 0xBF415401, 0x2FD05500, 0x2E605600, 0xBEF15701,
+ 0xB9815801, 0x29105900, 0x28A05A00, 0xB8315B01,
+ 0x2BC05C00, 0xBB515D01, 0xBAE15E01, 0x2A705F00,
+ 0x36006000, 0xA6916101, 0xA7216201, 0x37B06300,
+ 0xA4416401, 0x34D06500, 0x35606600, 0xA5F16701,
+ 0xA2816801, 0x32106900, 0x33A06A00, 0xA3316B01,
+ 0x30C06C00, 0xA0516D01, 0xA1E16E01, 0x31706F00,
+ 0xAF017001, 0x3F907100, 0x3E207200, 0xAEB17301,
+ 0x3D407400, 0xADD17501, 0xAC617601, 0x3CF07700,
+ 0x3B807800, 0xAB117901, 0xAAA17A01, 0x3A307B00,
+ 0xA9C17C01, 0x39507D00, 0x38E07E00, 0xA8717F01,
+ 0xD8018001, 0x48908100, 0x49208200, 0xD9B18301,
+ 0x4A408400, 0xDAD18501, 0xDB618601, 0x4BF08700,
+ 0x4C808800, 0xDC118901, 0xDDA18A01, 0x4D308B00,
+ 0xDEC18C01, 0x4E508D00, 0x4FE08E00, 0xDF718F01,
+ 0x41009000, 0xD1919101, 0xD0219201, 0x40B09300,
+ 0xD3419401, 0x43D09500, 0x42609600, 0xD2F19701,
+ 0xD5819801, 0x45109900, 0x44A09A00, 0xD4319B01,
+ 0x47C09C00, 0xD7519D01, 0xD6E19E01, 0x46709F00,
+ 0x5A00A000, 0xCA91A101, 0xCB21A201, 0x5BB0A300,
+ 0xC841A401, 0x58D0A500, 0x5960A600, 0xC9F1A701,
+ 0xCE81A801, 0x5E10A900, 0x5FA0AA00, 0xCF31AB01,
+ 0x5CC0AC00, 0xCC51AD01, 0xCDE1AE01, 0x5D70AF00,
+ 0xC301B001, 0x5390B100, 0x5220B200, 0xC2B1B301,
+ 0x5140B400, 0xC1D1B501, 0xC061B601, 0x50F0B700,
+ 0x5780B800, 0xC711B901, 0xC6A1BA01, 0x5630BB00,
+ 0xC5C1BC01, 0x5550BD00, 0x54E0BE00, 0xC471BF01,
+ 0x6C00C000, 0xFC91C101, 0xFD21C201, 0x6DB0C300,
+ 0xFE41C401, 0x6ED0C500, 0x6F60C600, 0xFFF1C701,
+ 0xF881C801, 0x6810C900, 0x69A0CA00, 0xF931CB01,
+ 0x6AC0CC00, 0xFA51CD01, 0xFBE1CE01, 0x6B70CF00,
+ 0xF501D001, 0x6590D100, 0x6420D200, 0xF4B1D301,
+ 0x6740D400, 0xF7D1D501, 0xF661D601, 0x66F0D700,
+ 0x6180D800, 0xF111D901, 0xF0A1DA01, 0x6030DB00,
+ 0xF3C1DC01, 0x6350DD00, 0x62E0DE00, 0xF271DF01,
+ 0xEE01E001, 0x7E90E100, 0x7F20E200, 0xEFB1E301,
+ 0x7C40E400, 0xECD1E501, 0xED61E601, 0x7DF0E700,
+ 0x7A80E800, 0xEA11E901, 0xEBA1EA01, 0x7B30EB00,
+ 0xE8C1EC01, 0x7850ED00, 0x79E0EE00, 0xE971EF01,
+ 0x7700F000, 0xE791F101, 0xE621F201, 0x76B0F300,
+ 0xE541F401, 0x75D0F500, 0x7460F600, 0xE4F1F701,
+ 0xE381F801, 0x7310F900, 0x72A0FA00, 0xE231FB01,
+ 0x71C0FC00, 0xE151FD01, 0xE0E1FE01, 0x7070FF00,
+};
+
+#endif /* PROTOTYPES */
+
+/*****************************************************************/
+/*                   End of CRC Lookup Table                     */
+/*****************************************************************/
</pre></div>
<hr /><a name="file26" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>edc_ecc.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/edc_ecc.c
+++ lxdream/src/drivers/cdrom/edc_ecc.c
@@ -0,0 +1,801 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/*
+ * Note: This file has been extracted from crkit 1.1.6 and modified to work within
+ * lxdream. 
+ */
+/*
+ * This file has been modified for the cdrkit suite.
+ *
+ * The behaviour and appearence of the program code below can differ to a major
+ * extent from the version distributed by the original author(s).
+ *
+ * For details, see Changelog file distributed with the cdrkit package. If you
+ * received this file from another source then ask the distributing person for
+ * a log of modifications.
+ *
+ */
+
+/* @(#)edc_ecc.c       1.21 03/04/04 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */
+
+/*
+ * Copyright 1998-2002 by Heiko Eissfeldt
+ * Copyright 2002 by Joerg Schilling
+ *
+ * This file contains protected intellectual property.
+ *
+ * reed-solomon encoder / decoder for compact discs.
+ *
+ */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; see the file COPYING.  If not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include "drivers/cdrom/defs.h"
+#include "drivers/cdrom/ecc.h"
+
+#define xaligned(a, s)          ((((uintptr_t)(a)) & (s)) == 0 )
+
+int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)], 
+                                         int sectortype, unsigned address);
+
+int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],
+                unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
+                int delay1, int delay2, int delay3, int permute);
+
+int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
+               unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
+               int delay1, int permute);
+
+int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)], 
+                       unsigned char out[L2_RAW]);
+
+int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
+                       unsigned char out[L1_RAW*FRAMES_PER_SECTOR],
+                       int delay1, int delay2, int delay3, int permute);
+
+int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
+                 unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
+                 int delay1, int permute);
+
+
+
+/* ------------- tables generated by gen_encodes --------------*/
+
+#include "edc_scramble.h"
+
+#define        DO4(a)  a;a;a;a;
+#define        DO13(a) a;a;a;a;a;a;a;a;a;a;a;a;a;
+
+/*
+ * Scrambles 2352 - 12 = 2340 bytes
+ */
+int scramble_L2(unsigned char *inout);
+
+int scramble_L2(unsigned char *inout)
+{
+#ifndef        EDC_SCRAMBLE_NOSWAP
+       unsigned int *f = (unsigned int *)inout;
+#endif
+
+       if (!xaligned(inout + 12, sizeof(uint32_t)-1)) {
+
+               uint8_t         *r = inout + 12;
+               const uint8_t   *s = yellowbook_scrambler;
+               register int    i;
+
+               for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(unsigned char)/4; --i >= 0;) {
+                       DO4(*r++ ^= *s++);
+               }
+
+       } else {
+               uint32_t        *r = (uint32_t *) (inout + 12);
+               const uint32_t  *s = yellowbook_scrambler_uint32;
+               register int    i;
+
+               for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(uint32_t)/13; --i >= 0;) {
+                       DO13(*r++ ^= *s++);
+               }
+       }
+
+#ifndef        EDC_SCRAMBLE_NOSWAP
+
+       /* generate F1 frames */
+       for (i = 2352/sizeof(unsigned int); i; i--) {
+               *f++ = ((*f & 0xff00ff00UL) >> 8) | ((*f & 0x00ff00ffUL) << 8);
+       }
+#endif
+
+       return (0);
+}
+
+#include "edc_l2sq.h"
+
+static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q]);
+
+static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q])
+{
+       unsigned char *dps;
+       unsigned char *dp;
+       unsigned char *Q;
+       register int i;
+       int j;
+
+       Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;
+
+       dps = inout;
+       for (j = 0; j < 26; j++) {
+               register unsigned short a;
+               register unsigned short b;
+               a = b = 0;
+
+               dp = dps;
+               for (i = 0; i < 43; i++) {
+
+                       /* LSB */
+                       a ^= L2sq[i][*dp++];
+
+                       /* MSB */
+                       b ^= L2sq[i][*dp];
+
+                       dp += 2*44-1;
+                       if (dp >= &inout[(4 + L2_RAW + 4 + 8 + L2_P)]) {
+                               dp -= (4 + L2_RAW + 4 + 8 + L2_P);
+                       } 
+               }
+               Q[0]      = a >> 8;
+               Q[26*2]   = a;
+               Q[1]      = b >> 8;
+               Q[26*2+1] = b;
+
+               Q += 2;
+               dps += 2*43;
+       }
+       return (0);
+}
+
+static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P]);
+
+static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P])
+{
+       unsigned char *dp;
+       unsigned char *P;
+       register int i;
+       int j;
+
+       P = inout + 4 + L2_RAW + 4 + 8;
+
+       for (j = 0; j < 43; j++) {
+               register unsigned short a;
+               register unsigned short b;
+
+               a = b = 0;
+               dp = inout;
+               for (i = 19; i < 43; i++) {
+
+                       /* LSB */
+                       a ^= L2sq[i][*dp++];
+
+                       /* MSB */
+                       b ^= L2sq[i][*dp];
+
+                       dp += 2*43 -1;
+               }
+               P[0]      = a >> 8;
+               P[43*2]   = a;
+               P[1]      = b >> 8;
+               P[43*2+1] = b;
+
+               P += 2;
+               inout += 2;
+       }
+       return (0);
+}
+
+static unsigned char bin2bcd(unsigned p);
+
+static unsigned char bin2bcd(unsigned p)
+{
+       return ((p/10)<<4)|(p%10);
+}
+
+int cd_build_address(unsigned char inout[], int sectortype, unsigned address)
+{
+       inout[12] = bin2bcd(address / (60*75));
+       inout[13] = bin2bcd((address / 75) % 60);
+       inout[14] = bin2bcd(address % 75);
+       if (sectortype == MODE_0)
+               inout[15] = 0;
+       else if (sectortype == MODE_1)
+               inout[15] = 1;
+       else if (sectortype == MODE_2)
+               inout[15] = 2;
+       else if (sectortype == MODE_2_FORM_1)
+               inout[15] = 2;
+       else if (sectortype == MODE_2_FORM_2)
+               inout[15] = 2;
+       else
+               return (-1);
+       return (0);
+}
+
+#include "edc_crctable.h"
+
+/*
+ * Called with 2064, 2056 or 2332 byte difference - all dividable by 4.
+ */
+unsigned int build_edc(unsigned char inout[], int from, int upto);
+
+unsigned int build_edc(unsigned char inout[], int from, int upto)
+{
+       unsigned char *p = inout+from;
+       unsigned int result = 0;
+
+       upto -= from-1;
+       upto /= 4;
+       while (--upto >= 0) {
+               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
+               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
+               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
+               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
+       }
+       return (result);
+}
+
+/* Layer 2 Product code en/decoder */
+
+int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)], 
+                int sectortype, unsigned address)
+{
+       unsigned int result;
+
+/*     SYNCPATTERN "\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" */
+#define SYNCPATTERN "\000\377\377\377\377\377\377\377\377\377\377"
+
+       /* supply initial sync pattern */
+       memcpy(inout, SYNCPATTERN, sizeof(SYNCPATTERN));
+
+       if (sectortype == MODE_0) {
+               memset(inout + sizeof(SYNCPATTERN), 0, 4 + L2_RAW + 12 + L2_P + L2_Q);
+               cd_build_address(inout, sectortype, address);
+               return (0);
+       }
+
+       switch (sectortype) {
+
+       case MODE_1:
+               cd_build_address(inout, sectortype, address);
+               result = build_edc(inout, 0, 16+2048-1);
+               inout[2064+0] = result >> 0L;
+               inout[2064+1] = result >> 8L;
+               inout[2064+2] = result >> 16L;
+               inout[2064+3] = result >> 24L;
+               memset(inout+2064+4, 0, 8);
+               encode_L2_P(inout+12);
+               encode_L2_Q(inout+12);
+               break;
+       case MODE_2:
+               cd_build_address(inout, sectortype, address);
+               break;
+       case MODE_2_FORM_1:
+               result = build_edc(inout, 16, 16+8+2048-1);
+               inout[2072+0] = result >> 0L;
+               inout[2072+1] = result >> 8L;
+               inout[2072+2] = result >> 16L;
+               inout[2072+3] = result >> 24L;
+
+               /* clear header for P/Q parity calculation */
+               inout[12] = 0;
+               inout[12+1] = 0;
+               inout[12+2] = 0;
+               inout[12+3] = 0;
+               encode_L2_P(inout+12);
+               encode_L2_Q(inout+12);
+               cd_build_address(inout, sectortype, address);
+               break;
+       case MODE_2_FORM_2:
+               cd_build_address(inout, sectortype, address);
+               result = build_edc(inout, 16, 16+8+2324-1);
+               inout[2348+0] = result >> 0L;
+               inout[2348+1] = result >> 8L;
+               inout[2348+2] = result >> 16L;
+               inout[2348+3] = result >> 24L;
+               break;
+       default:
+               return (-1);
+       }
+
+       return (0);
+}
+
+
+/*--------------------------------------------------------------------------*/
+#include "edc_encoder.h"
+
+static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);
+
+static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q])
+{
+       unsigned char *Q;
+       int     i;
+
+       memmove(inout+L1_RAW/2+L1_Q, inout+L1_RAW/2, L1_RAW/2);
+       Q = inout + L1_RAW/2;
+
+       memset(Q, 0, L1_Q);
+       for (i = 0; i < L1_RAW + L1_Q; i++) {
+               unsigned char data;
+
+               if (i == L1_RAW/2) i += L1_Q;
+               data = inout[i];
+               if (data != 0) {
+                       unsigned char base = rs_l12_log[data];
+
+                       Q[0] ^= rs_l12_alog[(base+AQ[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+                       Q[1] ^= rs_l12_alog[(base+AQ[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+                       Q[2] ^= rs_l12_alog[(base+AQ[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+                       Q[3] ^= rs_l12_alog[(base+AQ[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+               }
+       }
+       return (0);
+}
+
+static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P]);
+
+static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P])
+{
+       unsigned char *P;
+       int     i;
+
+       P = inout + L1_RAW + L1_Q;
+
+       memset(P, 0, L1_P);
+       for (i = 0; i < L2_RAW + L2_Q + L2_P; i++) {
+               unsigned char data;
+
+               data = inout[i];
+               if (data != 0) {
+                       unsigned char base = rs_l12_log[data];
+
+                       P[0] ^= rs_l12_alog[(base+AP[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+                       P[1] ^= rs_l12_alog[(base+AP[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+                       P[2] ^= rs_l12_alog[(base+AP[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+                       P[3] ^= rs_l12_alog[(base+AP[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
+               }
+       }
+       return (0);
+}
+
+static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);
+
+static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q])
+{
+       return (0);
+}
+
+static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P]);
+
+static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P])
+{
+       return (0);
+}
+
+int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);
+
+int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q])
+{
+       return (0);
+}
+
+int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);
+
+int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P])
+{
+       return (0);
+}
+
+static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q]);
+
+static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q])
+{
+       unsigned char *Q;
+       int i;
+
+       memmove(inout+LSUB_QRAW+LSUB_Q, inout+LSUB_QRAW, LSUB_RAW-LSUB_QRAW);
+       Q = inout + LSUB_QRAW;
+
+       memset(Q, 0, LSUB_Q);
+
+       for (i = 0; i < LSUB_QRAW; i++) {
+               unsigned char data;
+
+               data = inout[i] & 0x3f;
+               if (data != 0) {
+                       unsigned char base = rs_sub_rw_log[data];
+
+                       Q[0] ^= rs_sub_rw_alog[(base+SQ[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       Q[1] ^= rs_sub_rw_alog[(base+SQ[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+               }
+       }
+       return (0);
+}
+
+
+static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
+
+static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])
+{
+       unsigned char *P;
+       int i;
+
+       P = inout + LSUB_RAW + LSUB_Q;
+
+       memset(P, 0, LSUB_P);
+       for (i = 0; i < LSUB_RAW + LSUB_Q; i++) {
+               unsigned char data;
+
+               data = inout[i] & 0x3f;
+               if (data != 0) {
+                       unsigned char base = rs_sub_rw_log[data];
+
+                       P[0] ^= rs_sub_rw_alog[(base+SP[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       P[1] ^= rs_sub_rw_alog[(base+SP[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       P[2] ^= rs_sub_rw_alog[(base+SP[2][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       P[3] ^= rs_sub_rw_alog[(base+SP[3][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+               }
+       }
+       return (0);
+}
+
+int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);
+
+int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q])
+{
+       unsigned char Q[LSUB_Q];
+       int i;
+
+       memset(Q, 0, LSUB_Q);
+       for (i = LSUB_QRAW + LSUB_Q -1; i>=0; i--) {
+               unsigned char data;
+
+               data = inout[LSUB_QRAW + LSUB_Q -1 -i] & 0x3f;
+               if (data != 0) {
+                       unsigned char base = rs_sub_rw_log[data];
+
+                       Q[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       Q[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+               }
+       }
+       return (Q[0] != 0 || Q[1] != 0);
+}
+
+int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
+
+int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])
+{
+       unsigned char P[LSUB_P];
+       int i;
+
+       memset(P, 0, LSUB_P);
+       for (i = LSUB_RAW + LSUB_Q + LSUB_P-1; i>=0; i--) {
+               unsigned char data;
+
+               data = inout[LSUB_RAW + LSUB_Q + LSUB_P -1 -i] & 0x3f;
+               if (data != 0) {
+                       unsigned char base = rs_sub_rw_log[data];
+
+                       P[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       P[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       P[2] ^= rs_sub_rw_alog[(base+2*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+                       P[3] ^= rs_sub_rw_alog[(base+3*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
+               }
+       }
+       return (P[0] != 0 || P[1] != 0 || P[2] != 0 || P[3] != 0);
+}
+
+/* Layer 1 CIRC en/decoder */
+#define MAX_L1_DEL1 2
+static unsigned char l1_delay_line1[MAX_L1_DEL1][L1_RAW];
+#define MAX_L1_DEL2 108
+static unsigned char l1_delay_line2[MAX_L1_DEL2][L1_RAW+L1_Q];
+#define MAX_L1_DEL3 1
+static unsigned char l1_delay_line3[MAX_L1_DEL3][L1_RAW+L1_Q+L1_P];
+static unsigned l1_del_index;
+
+int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR], 
+                 unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR], 
+                 int delay1, int delay2, int delay3, int permute)
+{
+       int i;
+
+       for (i = 0; i < FRAMES_PER_SECTOR; i++) {
+               int j;
+               unsigned char t;
+
+               if (in != out)
+                       memcpy(out, in, L1_RAW);
+
+               if (delay1) {
+                       /* shift through delay line 1 */
+                       for (j = 0; j < L1_RAW; j++) {
+                               if (((j/4) % MAX_L1_DEL1) == 0) {
+                                       t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];
+                                       l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = out[j];
+                                       out[j] = t;
+                               }
+                       }
+               }
+
+               if (permute) {
+                       /* permute */
+                       t = out[2]; out[2] = out[8]; out[8] = out[10]; out[10] = out[18];
+                       out[18] = out[6]; out [6] = t;
+                       t = out[3]; out[3] = out[9]; out[9] = out[11]; out[11] = out[19];
+                       out[19] = out[7]; out [7] = t;
+                       t = out[4]; out[4] = out[16]; out[16] = out[20]; out[20] = out[14];
+                       out[14] = out[12]; out [12] = t;
+                       t = out[5]; out[5] = out[17]; out[17] = out[21]; out[21] = out[15];
+                       out[15] = out[13]; out [13] = t;
+               }
+
+               /* build Q parity */
+               encode_L1_Q(out);
+
+               if (delay2) {
+                       /* shift through delay line 2 */
+                       for (j = 0; j < L1_RAW+L1_Q; j++) {
+                               if (j != 0) {
+                                       t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];
+                                       l1_delay_line2[(l1_del_index + j*4) % MAX_L1_DEL2][j] = out[j];
+                                       out[j] = t;
+                               }
+                       }
+               }
+
+               /* build P parity */
+               encode_L1_P(out);
+
+               if (delay3) {
+                       /* shift through delay line 3 */
+                       for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {
+                               if (((j) & MAX_L1_DEL3) == 0) {
+                                       t = l1_delay_line3[0][j];
+                                       l1_delay_line3[0][j] = out[j];
+                                       out[j] = t;
+                               }
+                       }
+               }
+
+               /* invert Q and P parity */
+               for (j = 0; j < L1_Q; j++)
+                       out[j+12] = ~out[j+12];
+               for (j = 0; j < L1_P; j++)
+                       out[j+28] = ~out[j+28];
+
+               l1_del_index++;
+               out += L1_RAW+L1_Q+L1_P;
+               in += L1_RAW;
+       }
+       return (0);
+}
+
+int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR], 
+                       unsigned char out[L1_RAW*FRAMES_PER_SECTOR], 
+                       int delay1, int delay2, int delay3, int permute)
+{
+       int i;
+
+       for (i = 0; i < FRAMES_PER_SECTOR; i++) {
+               int j;
+               unsigned char t;
+
+               if (delay3) {
+                       /* shift through delay line 3 */
+                       for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {
+                               if (((j) & MAX_L1_DEL3) != 0) {
+                                       t = l1_delay_line3[0][j];
+                                       l1_delay_line3[0][j] = in[j];
+                                       in[j] = t;
+                               }
+                       }
+               }
+
+               /* invert Q and P parity */
+               for (j = 0; j < L1_Q; j++)
+                       in[j+12] = ~in[j+12];
+               for (j = 0; j < L1_P; j++)
+                       in[j+28] = ~in[j+28];
+
+               /* build P parity */
+               decode_L1_P(in);
+
+               if (delay2) {
+                       /* shift through delay line 2 */
+                       for (j = 0; j < L1_RAW+L1_Q; j++) {
+                               if (j != L1_RAW+L1_Q-1) {
+                                       t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];
+                                       l1_delay_line2[(l1_del_index + (MAX_L1_DEL2 - j*4)) % MAX_L1_DEL2][j] = in[j];
+                                       in[j] = t;
+                               }
+                       }
+               }
+
+               /* build Q parity */
+               decode_L1_Q(in);
+
+               if (permute) {
+                       /* permute */
+                       t = in[2]; in[2] = in[6]; in[6] = in[18]; in[18] = in[10];
+                       in[10] = in[8]; in [8] = t;
+                       t = in[3]; in[3] = in[7]; in[7] = in[19]; in[19] = in[11];
+                       in[11] = in[9]; in [9] = t;
+                       t = in[4]; in[4] = in[12]; in[12] = in[14]; in[14] = in[20];
+                       in[20] = in[16]; in [16] = t;
+                       t = in[5]; in[5] = in[13]; in[13] = in[15]; in[15] = in[21];
+                       in[21] = in[17]; in [17] = t;
+               }
+
+               if (delay1) {
+                       /* shift through delay line 1 */
+                       for (j = 0; j < L1_RAW; j++) {
+                               if (((j/4) % MAX_L1_DEL1) != 0) {
+                                       t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];
+                                       l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = in[j];
+                                       in[j] = t;
+                               }
+                       }
+               }
+
+               if (in != out)
+                       memcpy(out, in, (L1_RAW));
+
+               l1_del_index++;
+               in += L1_RAW+L1_Q+L1_P;
+               out += L1_RAW;
+       }
+       return (0);
+}
+
+int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)], 
+                        unsigned char out[L2_RAW])
+{
+       return (0);
+}
+
+
+
+#define MAX_SUB_DEL 8
+static unsigned char sub_delay_line[MAX_SUB_DEL][LSUB_RAW+LSUB_Q+LSUB_P];
+static unsigned sub_del_index;
+
+/* R-W Subchannel en/decoder */
+
+int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME], 
+                  unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME], 
+                  int delay1, int permute)
+{
+       int i;
+
+       if (in == out) return -1;
+
+       for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {
+               int j;
+               unsigned char t;
+
+               memcpy(out, in, (LSUB_RAW));
+
+               /* build Q parity */
+               encode_LSUB_Q(out);
+
+               /* build P parity */
+               encode_LSUB_P(out);
+
+               if (permute) {
+                       /* permute */
+                       t = out[1]; out[1] = out[18]; out[18] = t;
+                       t = out[2]; out[2] = out[ 5]; out[ 5] = t;
+                       t = out[3]; out[3] = out[23]; out[23] = t;
+               }
+
+               if (delay1) {
+                       /* shift through delay_line */
+                       for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {
+                               if ((j % MAX_SUB_DEL) != 0) {
+                                       t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];
+                                       sub_delay_line[(sub_del_index + j) % MAX_SUB_DEL][j] = out[j];
+                                       out[j] = t;
+                               }
+                       }
+               }
+               sub_del_index++;
+               out += LSUB_RAW+LSUB_Q+LSUB_P;
+               in += LSUB_RAW;
+       }
+       return (0);
+}
+
+int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME], 
+                 unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME], 
+                 int delay1, int permute)
+{
+       int i;
+
+       if (in == out) return -1;
+
+       for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {
+               int j;
+               unsigned char t;
+
+               if (delay1) {
+                       /* shift through delay_line */
+                       for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {
+                               if ((j % MAX_SUB_DEL) != MAX_SUB_DEL-1) {
+                                       t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];
+                                       sub_delay_line[(sub_del_index + (MAX_SUB_DEL - j)) % MAX_SUB_DEL][j] = in[j];
+                                       in[j] = t;
+                               }
+                       }
+               }
+
+               if (permute) {
+                       /* permute */
+                       t = in[1]; in[1] = in[18]; in[18] = t;
+                       t = in[2]; in[2] = in[ 5]; in[ 5] = t;
+                       t = in[3]; in[3] = in[23]; in[23] = t;
+               }
+
+               /* build P parity */
+               decode_LSUB_P(in);
+
+               /* build Q parity */
+               decode_LSUB_Q(in);
+
+               memcpy(out, in, LSUB_QRAW);
+               memcpy(out+LSUB_QRAW, in+LSUB_QRAW+LSUB_Q, LSUB_RAW-LSUB_QRAW);
+
+               sub_del_index++;
+               in += LSUB_RAW+LSUB_Q+LSUB_P;
+               out += LSUB_RAW;
+       }
+       return (0);
+}
+
+static int sectortype = MODE_0;
+
+int get_sector_type(void);
+
+int get_sector_type()
+{
+       return (sectortype);
+}
+
+int set_sector_type(int st);
+
+int set_sector_type(int st)
+{
+       switch(st) {
+
+       case MODE_0:
+       case MODE_1:
+       case MODE_2:
+       case MODE_2_FORM_1:
+       case MODE_2_FORM_2:
+               sectortype = st;
+               return 0;
+       default:
+               return -1;
+       }
+}
+
</pre></div>
<hr /><a name="file27" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>edc_encoder.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/edc_encoder.h
+++ lxdream/src/drivers/cdrom/edc_encoder.h
@@ -0,0 +1,47 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* @(#)encoder_tables  1.4 02/10/19 */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; see the file COPYING.  If not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+static const unsigned char rs_l12_alog[255] = {
+ 1, 2, 4, 8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143, 3, 6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140, 5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141, 7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138, 9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,};
+static const unsigned char rs_l12_log[256] = {
+ 0, 0, 1,25, 2,50,26,198, 3,223,51,238,27,104,199,75, 4,100,224,14,52,141,239,129,28,193,105,248,200, 8,76,113, 5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154, 9,120,77,228,114,166, 6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87, 7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175,};
+static const unsigned char rs_sub_rw_alog[63] = {
+ 1, 2, 4, 8,16,32, 3, 6,12,24,48,35, 5,10,20,40,19,38,15,30,60,59,53,41,17,34, 7,14,28,56,51,37, 9,18,36,11,22,44,27,54,47,29,58,55,45,25,50,39,13,26,52,43,21,42,23,46,31,62,63,61,57,49,33,};
+static const unsigned char rs_sub_rw_log[63] = {
+ 0, 0, 1, 6, 2,12, 7,26, 3,32,13,35, 8,48,27,18, 4,24,33,16,14,52,36,54, 9,45,49,38,28,41,19,56, 5,62,25,11,34,31,17,47,15,23,53,51,37,44,55,40,10,61,46,30,50,22,39,43,29,60,42,21,20,59,57,};
+static const unsigned char SQ[2][2] = {
+{26,6,},
+{7,1,},
+};
+static const unsigned char SP[4][20] = {
+{57,38,44,29,17,57,53,58,60,39,12,38,18,41,6,25,39,37,5,18,},
+{38,62,42,13,30,11,46,5,54,26,12,49,48,46,8,50,28,9,12,39,},
+{32,18,41,49,52,62,38,36,39,58,37,24,34,51,51,27,28,36,22,21,},
+{44,50,35,23,0,59,1,3,45,18,44,24,47,12,31,45,43,11,24,6,},
+};
+static const unsigned char AQ[4][24] = {
+{58,152,173,95,88,43,134,205,143,131,163,75,37,109,194,159,168,227,153,59,101,},
+{30,214,148,138,112,154,157,96,49,198,189,249,83,23,70,237,70,41,47,52,125,247,},
+{162,244,13,171,213,236,71,177,253,162,59,78,46,68,238,112,147,197,115,200,117,15,236,},
+{158,179,101,94,49,140,211,149,137,169,81,6,33,30,27,24,21,18,15,12,9,6,3,0,},
+};
+static const unsigned char AP[4][32] = {
+{140,143,52,103,249,142,180,197,5,155,153,132,143,244,101,76,102,155,203,104,58,152,173,95,88,43,134,205,143,131,163,75,},
+{104,97,17,162,205,252,218,199,202,41,136,106,119,238,193,103,123,242,83,178,30,214,148,138,112,154,157,96,49,198,189,249,},
+{240,119,29,185,67,11,131,40,7,41,80,147,151,17,245,253,208,66,228,116,162,244,13,171,213,236,71,177,253,162,59,78,},
+{149,58,109,0,148,186,203,11,161,159,138,149,250,107,82,108,161,209,110,64,158,179,101,94,49,140,211,149,137,169,81,6,},
+};
</pre></div>
<hr /><a name="file28" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>edc_l2sq.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/edc_l2sq.h
+++ lxdream/src/drivers/cdrom/edc_l2sq.h
@@ -0,0 +1,1180 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* @(#)l2sq_table      1.2 02/10/19 Copyright 2002 J. Schilling */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; see the file COPYING.  If not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+static const unsigned short L2sq[43][256] = {
+{0,44719,16707,61420,33414,11305,50117,28010,6417,47038,
+   22610,63229,39831,13624,56020,29819,12834,40077,29537,56782,
+   45220,7691,61927,24392,11059,34204,27248,50399,43445,1818,
+   59638,18009,25668,51947,9479,35752,59074,18541,42881,2350,
+   32085,54266,15382,37561,65491,20860,48784,4159,22118,63689,
+   5925,47498,54496,31311,38307,15116,20343,57816,3636,41115,
+   52721,25438,36018,8733,51336,26151,35275,10084,18958,58529,
+   2893,42466,53657,32566,37082,15989,21279,64944,4700,48371,
+   64170,21509,48105,5446,30764,54915,14703,38848,58299,19732,
+   41720,3159,24893,53138,8318,36561,44236,611,60815,17184,
+   11850,32997,28425,49574,46557,7026,62622,23089,14171,39412,
+   30232,55479,40686,12353,57261,28930,7272,45767,23851,62340,
+   34815,10576,50876,26643,1401,43990,17466,60053,36109,9122,
+   52302,25313,3979,41252,20168,57447,37916,15027,54623,31728,
+   5786,47157,22489,63862,48943,4480,65132,20675,15785,37638,
+   31978,53829,42558,2193,59261,18898,9400,35351,26107,52052,
+   59721,18406,43018,1701,27599,50528,10892,33827,61528,24311,
+   45339,8116,29406,56433,13213,40242,56171,30148,39464,13447,
+   23021,63298,6318,46593,49786,27861,33593,11670,16636,61011,
+   447,44816,17797,60202,1222,43625,50947,27052,34368,10479,
+   23700,62011,7639,45944,56850,28861,40785,12798,30631,55560,
+   14052,38987,62753,23438,46178,6861,28342,49177,12277,33114,
+   60464,17055,44403,988,8641,36718,24706,52781,41799,3560,
+   57860,19627,14544,38527,31123,55100,47702,5369,64277,21946,
+   5091,48460,21152,64527,37221,16330,53286,32393,2802,42077,
+   19377,58654,34932,9947,51511,26520,
+},
+{0,55768,44973,30325,17223,39583,60650,13618,34446,24406,
+   10531,61691,50633,7185,27236,46012,4353,51417,48812,26484,
+   21062,35742,65003,9267,38799,20055,14370,57850,54472,3344,
+   31589,41661,8706,64474,36271,21623,24901,47261,52968,5936,
+   42124,32084,2849,54009,59339,15891,18534,37310,13059,60123,
+   40110,17782,28740,43420,57321,1585,46477,27733,6688,50168,
+   63178,12050,22887,32959,17412,40412,60329,12913,1859,56987,
+   43246,28982,49802,6994,27943,46335,33229,22549,11872,63416,
+   21765,36061,64168,9072,5698,53146,47599,24631,54155,2643,
+   31782,42494,37068,18708,16225,59065,26118,49118,51627,4211,
+   9537,64665,35564,21300,57480,14672,20261,38653,41935,31255,
+   3170,54714,30471,44767,55466,370,13376,60824,39917,16949,
+   61833,10321,24100,34812,45774,27414,7523,50363,34824,20944,
+   10149,65149,52047,4759,25826,48442,3718,55134,41259,30963,
+   19905,37913,57964,15284,39177,16593,13988,61308,55886,918,
+   30179,44091,8071,50783,45098,27122,23744,34072,62317,10933,
+   43530,29650,1447,56447,59725,12437,18144,40760,11396,62812,
+   33577,23281,28611,46619,49262,6582,47883,25299,5286,52606,
+   63564,8596,22497,36409,15749,58461,37416,19440,32450,42778,
+   53615,2231,52236,5588,25505,47737,36683,22163,8422,63806,
+   19074,37722,58671,15607,2501,53277,42600,32688,56589,1237,
+   29344,43896,40522,18322,12775,59455,23427,33371,62510,11766,
+   6340,49436,46953,28337,60942,14294,16803,39035,44361,29841,
+   740,56124,26752,45400,50989,7925,11207,61983,33898,23986,
+   65295,9943,20642,35194,48200,26000,5093,51773,31105,41049,
+   54828,4084,15046,58142,38251,19635,
+},
+{0,27757,55514,46263,44457,49604,30067,6430,18255,11042,
+   40853,62456,60134,34443,12860,24145,36510,58099,22084,14889,
+   9015,20314,64493,38784,51665,42428,4363,32102,25720,2069,
+   48290,53455,289,27980,55803,46486,44168,49381,29778,6207,
+   18030,10755,40628,62169,60359,34730,13085,24432,36799,58322,
+   22373,15112,8726,20091,64204,38561,51440,42141,4138,31815,
+   25945,2356,48515,53742,578,28207,55960,46837,45035,50054,
+   30513,7004,17677,10592,40407,61882,59556,33993,12414,23571,
+   36060,57521,21510,14443,8565,19736,63919,38338,52115,43006,
+   4937,32548,26170,2647,48864,53901,867,28430,56249,47060,
+   44746,49831,30224,6781,17452,10305,40182,61595,59781,34280,
+   12639,23858,36349,57744,21799,14666,8276,19513,63630,38115,
+   51890,42719,4712,32261,26395,2934,49089,54188,1156,26857,
+   56414,45107,43309,50496,29175,7578,17355,12198,39697,63356,
+   61026,33295,14008,23253,35354,58999,21184,16045,10163,19422,
+   65385,37636,52565,41272,5519,31202,24828,3217,47142,54347,
+   1445,27080,56703,45330,43020,50273,28886,7355,17130,11911,
+   39472,63069,61251,33582,14233,23540,35643,59222,21473,16268,
+   9874,19199,65096,37413,52340,40985,5294,30915,25053,3504,
+   47367,54634,1734,27307,56860,45681,43887,50946,29621,8152,
+   16777,11748,39251,62782,60448,32845,13562,22679,34904,58421,
+   20610,15599,9713,18844,64811,37190,53015,41850,6093,31648,
+   25278,3795,47716,54793,2023,27530,57149,45904,43598,50723,
+   29332,7929,16552,11461,39026,62495,60673,33132,13787,22966,
+   35193,58644,20899,15822,9424,18621,64522,36967,52790,41563,
+   5868,31361,25503,4082,47941,55080,
+},
+{0,47289,28015,54742,56030,25191,47025,3848,43425,4376,
+   50382,31863,29567,52166,7696,42665,20319,63462,8752,39561,
+   38273,11576,63726,16471,59134,24135,35729,13096,15392,33945,
+   20815,59894,40638,9735,62417,19304,17504,64729,10511,37302,
+   14111,36774,23152,58057,60865,21880,32942,14359,53729,26968,
+   48270,1079,2879,45958,26192,57065,30784,49401,5423,44438,
+   41630,6695,53233,30536,8545,39384,19470,62647,64447,17158,
+   38608,11881,35008,12409,58799,23830,21022,60071,16241,34760,
+   28222,54919,849,48104,46304,3161,55695,24886,51103,32550,
+   43760,4681,7489,42488,28718,51351,49119,1894,53936,27145,
+   25857,56760,2158,45271,5758,44743,31505,50088,52384,29721,
+   41423,6518,61568,18489,40431,9558,10846,37607,18225,65416,
+   22817,57752,13390,36087,33791,15174,61072,22057,17090,64123,
+   12205,38676,38940,8357,62835,19914,60259,21466,34316,16053,
+   12733,35076,23762,58475,3485,46372,24818,55371,55107,28666,
+   47660,661,42044,7301,51539,29162,32482,50779,5005,43828,
+   56444,25797,45331,2474,1698,48667,27597,54132,30173,52580,
+   6322,40971,44803,6074,49772,31445,37667,11162,65100,18165,
+   18941,61764,9362,39979,14978,33339,22509,61268,57436,22757,
+   36147,13706,25507,56090,3788,46709,47485,452,54290,27819,
+   51714,29371,42861,8148,4316,43109,32179,50442,11516,37957,
+   16787,63786,63010,20123,39757,9204,34141,15844,59442,20619,
+   24451,59194,13036,35413,64797,17828,36978,10443,10179,40826,
+   19116,61973,21692,60421,14803,33130,36450,14043,58125,23476,
+   45634,2811,57133,26516,26780,53285,1523,48458,7139,41818,
+   30348,52789,49469,31108,44114,5355,
+},
+{0,53971,47547,27496,28523,48568,54992,1027,57046,3077,
+   26477,46526,45501,25454,2054,56021,41393,29538,6154,51929,
+   52954,7177,30561,42418,32615,44468,50908,5135,4108,49887,
+   43447,31588,24447,36268,59076,13335,12308,58055,35247,23420,
+   33193,21370,14354,60097,61122,15377,22393,34218,65230,11293,
+   18293,38310,37285,17270,10270,64205,8216,62155,39331,19312,
+   20339,40352,63176,9243,48894,27693,1861,54678,53653,838,
+   26670,47869,24616,45819,55699,2880,3907,56720,46840,25643,
+   8015,52636,42740,29735,28708,41719,51615,6988,49561,4938,
+   30754,43761,44786,31777,5961,50586,57729,13138,22586,35561,
+   36586,23609,14161,58754,16215,60804,34540,21567,20540,33519,
+   59783,15188,16432,37603,63883,11096,12123,64904,38624,17459,
+   40678,19509,10077,62862,61837,9054,18486,39653,25057,45874,
+   55386,2697,3722,56409,46897,26082,48951,28132,1676,54367,
+   53340,655,27111,47924,49232,4739,31211,43832,44859,32232,
+   5760,50259,7814,52309,42813,30190,29165,41790,51286,6789,
+   16030,60493,34597,22006,20981,33574,59470,15005,57416,12955,
+   23027,35616,36643,24048,13976,58443,40751,19964,9876,62535,
+   61508,8855,18943,39724,16889,37674,63554,10897,11922,64577,
+   38697,17914,57119,3532,26276,46199,45172,25255,2511,56092,
+   457,54042,47218,27297,28322,48241,55065,1482,32430,44157,
+   50965,5574,4549,49942,43134,31405,41080,29355,6595,51984,
+   53011,7616,30376,42107,32864,21171,14811,60168,61195,15832,
+   22192,33891,24246,35941,59149,13790,12765,58126,34918,23221,
+   8657,62210,39018,19129,20154,40041,63233,9682,65287,11732,
+   18108,37999,36972,17087,10711,64260,
+},
+{0,59366,54225,13367,48063,23641,26734,36744,27491,35973,
+   47282,24404,53468,14138,781,58603,54982,12576,1303,58097,
+   28025,35487,48808,22862,48549,23107,28276,35218,1562,57852,
+   54731,12845,45457,22135,25152,34214,2606,60872,55807,15897,
+   56050,15636,2339,61125,24909,34475,45724,21882,26455,32945,
+   46214,21344,56552,15118,3897,59615,3124,60370,57317,14339,
+   46987,20589,25690,33724,32575,39129,44270,19208,50304,9062,
+   5969,61623,5212,62394,51085,8299,45027,18437,31794,39892,
+   43513,19999,31272,40398,4678,62880,49559,9841,49818,9596,
+   4427,63149,31013,40643,43764,19730,52910,10568,7551,64153,
+   29969,37623,42688,16678,42445,16939,30236,37370,7794,63892,
+   52643,10821,6248,65422,52153,11359,41943,17457,28678,38880,
+   29451,38125,41178,18236,51380,12114,7013,64643,65150,6552,
+   11695,51785,17857,41511,38416,29174,38173,29435,18124,41258,
+   11938,51524,64883,6805,10424,53086,64361,7311,37639,29921,
+   16598,42800,17371,42045,36874,30700,63588,8066,11189,52307,
+   20463,43017,39998,31704,62544,5046,10113,49255,9356,50026,
+   63325,4283,40755,30933,19682,43780,39209,32463,19192,44318,
+   8854,50544,61767,5793,62026,5548,8603,50813,18933,44563,
+   39460,32194,33089,26279,21136,46454,15102,56600,59695,3785,
+   59938,3524,14835,56853,20893,46715,33356,26026,22407,45153,
+   33878,25520,60472,3038,16361,55311,15588,56066,61237,2259,
+   34651,24765,21642,45932,12496,55094,58113,1255,35695,27785,
+   22718,48984,23475,48213,34914,28548,57356,2026,13277,54331,
+   58902,496,13767,53793,23977,47695,36472,27038,36213,27283,
+   24228,47426,14026,53548,58651,765,
+},
+{0,29554,59108,38294,53717,41639,14129,17475,49079,52421,
+   22867,10785,28258,7440,34950,64500,25459,4097,34199,63205,
+   45734,49620,21570,10032,56516,44982,14880,18770,3345,32355,
+   60405,39047,50918,46484,8194,21360,5939,25665,61911,33445,
+   31057,2595,40885,60615,43140,56310,20064,15634,42389,55015,
+   17265,12291,29760,1842,37540,57814,6690,26960,64710,36788,
+   52215,47237,11539,24161,37329,58019,30517,1095,16388,13174,
+   42720,54674,11878,23828,51330,48112,65459,36033,6487,27173,
+   62114,33232,5190,26420,9079,20485,50579,46817,19733,15975,
+   44017,55427,40128,61362,31268,2390,22327,9285,45523,49825,
+   34530,62864,24582,4980,59520,39922,3684,32022,14677,18983,
+   57265,44227,13380,18230,53920,41426,58769,38627,885,28679,
+   35827,63617,27927,7781,23078,10580,48322,53168,16319,19661,
+   55643,43561,61034,40216,2190,31740,32776,62330,26348,5534,
+   20957,8879,46905,50251,23756,12222,47656,51546,36121,65131,
+   27645,6287,58235,36873,1439,30445,12974,16860,54346,42808,
+   63833,35371,8125,27855,10380,23550,52840,48410,18158,13724,
+   40970,54136,38715,58441,29151,685,39466,59736,31950,4028,
+   19455,14477,44315,56937,9629,22255,50041,45067,62536,34618,
+   4780,25054,44654,56604,18570,15352,32699,3273,39263,59949,
+   4569,25259,63293,33871,49164,45950,9960,21914,52509,48751,
+   11257,22667,7368,28602,64044,35166,29354,472,37966,59196,
+   41855,53261,17819,14057,26760,7162,36460,64798,47453,51759,
+   24505,11467,55103,42061,12763,17065,1770,30104,57358,37756,
+   3067,30857,60703,40557,55854,43356,15562,20408,46156,51006,
+   21160,8666,26009,5867,33661,61455,
+},
+{0,14648,29296,19272,58592,56792,38544,44968,54749,60645,
+   42925,40597,12605,2053,17229,31349,47015,36511,50647,64751,
+   21319,27263,8503,6159,25210,23362,4106,10546,34458,49058,
+   62698,52690,29523,19051,291,14363,38835,44683,58819,56571,
+   42638,40886,54526,60870,17006,31574,12318,2342,50420,64972,
+   46724,36796,8212,6444,21092,27484,4393,10257,25433,23137,
+   62921,52465,34745,48769,59046,57246,38102,44526,582,15230,
+   28726,18702,13179,2627,16651,30771,55195,61091,42475,40147,
+   20737,26681,9073,6729,46561,36057,51089,65193,34012,48612,
+   63148,53140,24636,22788,4684,11124,38389,44237,59269,57021,
+   28949,18477,869,14941,16424,30992,12888,2912,42184,40432,
+   54968,61312,8786,7018,20514,26906,50866,65418,46274,36346,
+   63375,52919,34303,48327,4975,10839,24863,22567,53585,59497,
+   41761,39449,13745,3209,18369,32505,1164,15796,30460,20420,
+   57452,55636,37404,43812,26358,24526,5254,11710,33302,47918,
+   61542,51550,45867,35347,49499,63587,22475,28403,9659,7299,
+   41474,39738,53362,59722,18146,32730,13458,3498,30687,20199,
+   1455,15511,37695,43527,57679,55415,5541,11421,26581,24301,
+   61765,51325,33589,47629,49272,63808,45576,35632,9368,7584,
+   22248,28624,14327,3791,17799,31935,54039,59951,41319,39007,
+   57898,56082,36954,43362,1738,16370,29882,19842,32848,47464,
+   61984,51992,25776,23944,5824,12280,21901,27829,10237,7877,
+   45421,34901,49949,64037,17572,32156,14036,4076,41028,39292,
+   53812,60172,37241,43073,58121,55857,30105,19617,2025,16081,
+   62211,51771,33139,47179,6115,11995,26003,23723,9950,8166,
+   21678,28054,49726,64262,45134,35190,
+},
+{0,7197,14394,9255,28788,27753,18510,21587,57576,64757,
+   55506,50383,37020,35969,43174,46267,56781,49616,58871,63978,
+   44473,45476,38275,35230,15653,8504,1311,6402,19793,20812,
+   30059,26998,42887,48026,40893,33696,55283,52206,61385,62420,
+   18287,23410,32597,25416,14107,11014,3873,4924,31306,26199,
+   17008,24173,2622,5667,12804,11801,39586,34495,41624,48773,
+   60118,63179,53996,52977,21267,20238,27433,30516,9063,16250,
+   7005,1856,46075,45030,35777,38876,50063,57234,64437,59304,
+   36574,37571,46820,43769,65194,58039,50832,55949,28214,29227,
+   22028,18961,7746,607,9848,14949,62612,59529,52398,53427,
+   34016,39165,48346,41159,5244,2145,11334,12379,25608,30741,
+   23602,16431,10585,13636,4451,3454,22829,17712,24855,32010,
+   51633,54700,61835,60822,47557,42456,33279,40418,42534,47675,
+   40476,33281,54866,51791,61032,62069,18126,23251,32500,25321,
+   14010,10919,3712,4765,31723,26614,17361,24524,2975,6018,
+   13221,12216,39683,34590,41785,48932,60279,63338,54093,53072,
+   417,7612,14747,9606,29141,28104,18927,22002,57673,64852,
+   55667,50542,37181,36128,43271,46362,56428,49265,58454,63563,
+   44056,45061,37922,34879,15492,8345,1214,6307,19696,20717,
+   29898,26839,62773,59688,52495,53522,34113,39260,48507,41318,
+   5597,2496,11751,12794,26025,31156,23955,16782,10488,13541,
+   4290,3295,22668,17553,24758,31915,51216,54285,61482,60471,
+   47204,42105,32862,40003,21170,20143,27272,30357,8902,16091,
+   6908,1761,45658,44615,35424,38525,49710,56883,64020,58889,
+   36735,37730,46917,43864,65291,58134,50993,56108,28567,29578,
+   22445,19376,8163,1022,10201,15300,
+},
+{0,32897,7455,40350,14910,47807,10017,42912,29820,62717,
+   26979,59874,20034,52931,21341,54236,59640,26745,62951,30054,
+   53958,21063,53209,20312,40068,7173,33179,282,42682,9787,
+   48037,15140,52717,19820,53490,20595,63443,30546,60108,27213,
+   47505,14608,42126,9231,33711,814,40624,7729,9493,42388,
+   14346,47243,7979,40874,564,33461,20841,53736,19574,52471,
+   27479,60374,30280,63177,34759,1862,39640,6745,48633,15736,
+   41190,8295,62395,29498,61092,28197,51589,18692,54426,21531,
+   28479,61374,29216,62113,21761,54656,18462,51359,6979,39874,
+   1628,34525,8573,41468,15458,48355,18986,51883,22325,55220,
+   28692,61589,27915,60810,15958,48855,9033,41928,1128,34025,
+   6519,39414,41682,8787,49101,16204,39148,6253,34291,1394,
+   54958,22063,52145,19248,60560,27665,61839,28942,5011,37650,
+   3724,36365,10669,43308,13490,46131,26607,59246,31472,64113,
+   24017,56656,16590,49231,64363,31722,58996,26357,49493,16852,
+   56394,23755,36631,3990,37384,4745,46377,13736,43062,10423,
+   56958,24319,50017,17376,58432,25793,63839,31198,43522,10883,
+   46877,14236,36924,4285,36131,3490,13958,46599,11161,43800,
+   3256,35897,4519,37158,17146,49787,24549,57188,30916,63557,
+   26075,58714,37972,5333,35147,2506,44650,12011,45941,13300,
+   57384,24745,64823,32182,55830,23191,50953,18312,31916,64557,
+   25011,57650,18066,50707,23437,56076,2256,34897,5583,38222,
+   13038,45679,12273,44912,22969,55608,17574,50215,25479,58118,
+   32408,65049,11717,44356,12506,45147,6139,38778,2788,35429,
+   45377,12736,44126,11487,35711,3070,38496,5857,50493,17852,
+   55330,22691,65283,32642,57884,25245,
+},
+{0,52943,33155,20300,7963,53716,40600,20567,15926,61689,
+   49077,29050,8493,61410,41134,28257,31852,45731,65007,13088,
+   25463,44472,58100,11323,16986,35989,50137,3350,23873,37774,
+   56514,4621,63704,13847,31067,46996,59331,10508,26176,43151,
+   50926,2081,18285,35234,55797,5946,22646,38585,33972,19067,
+   1335,52216,39855,21856,6700,54499,47746,29773,15105,62926,
+   42393,27478,9242,60117,60845,9058,27694,41697,62134,15481,
+   29493,48634,54171,7508,21016,40151,52352,591,19715,33740,
+   37313,24334,4162,56973,36570,16405,3929,49558,45047,24888,
+   11892,57531,45292,32291,12655,65440,5493,56250,38134,23097,
+   2670,50337,35821,17698,11075,58764,43712,25615,13400,64151,
+   46555,31508,26905,42966,59546,9813,30210,47309,63361,14670,
+   22319,39392,54956,6243,18484,34555,51639,1912,51015,2440,
+   18116,34827,55388,5779,23007,38672,63857,14270,30962,46653,
+   58986,10405,26601,43302,47915,30180,15016,62567,42032,27391,
+   9651,60284,34077,19410,1182,51793,39430,21705,7045,54602,
+   16287,61776,48668,28883,8324,61003,41223,28616,425,53094,
+   32810,20197,7858,53373,40753,20990,17395,36156,49776,3263,
+   23784,37415,56683,5028,32197,45834,64582,12937,25310,44049,
+   58205,11666,10986,58405,43881,26022,13809,64318,46194,31421,
+   5340,55827,38239,23440,3015,50440,35396,17547,22150,38985,
+   55045,6602,18845,34642,51230,1745,26800,42623,59699,10236,
+   30635,47460,63016,14567,53810,7421,21425,40318,52521,998,
+   19626,33381,60420,8907,28039,41800,62239,15824,29340,48211,
+   44638,24721,12253,57618,45381,32650,12486,65033,36968,24231,
+   4587,57124,36723,16828,3824,49215,
+},
+{0,59880,53197,9765,33671,27247,19530,42402,6931,62203,
+   54494,15670,39060,29052,22361,48817,13862,57294,63979,4099,
+   46497,23625,31340,37764,11573,50397,58104,2832,44722,18266,
+   24959,34967,27724,34212,41857,19049,61387,1571,8198,51694,
+   30559,40631,47250,20858,62680,7472,15125,54013,23146,45954,
+   38311,31823,55789,12293,5664,65480,16761,43153,36532,26460,
+   49918,11030,3379,58587,55448,12656,5973,65213,23327,45815,
+   38098,32058,50059,10851,3142,58798,16396,43492,36801,26153,
+   61118,1878,8563,51355,27961,34001,41716,19228,62893,7237,
+   14944,54152,30250,40898,47591,20495,46292,23868,31513,37617,
+   14163,57019,63646,4470,44999,17967,24586,35298,11328,50600,
+   58253,2661,33522,27418,19775,42199,373,59549,52920,10064,
+   39393,28681,22060,49092,6758,62350,54699,15427,44333,17605,
+   25312,35592,11946,51010,57703,2191,46654,24534,31219,36891,
+   13753,56401,64116,5020,39691,29411,21702,48430,6284,61796,
+   55105,16041,32792,27120,20437,42557,927,60023,52306,9658,
+   49505,10377,3756,59204,17126,43790,36139,25795,55922,13210,
+   5567,64599,23029,45085,38456,32720,63303,7855,14474,53602,
+   29888,40232,47885,21221,60500,1468,9113,51825,28627,34363,
+   40990,18934,30133,40029,47736,21392,63026,8154,14847,53271,
+   28326,34638,41323,18563,60705,1225,8940,51972,17299,43643,
+   35934,26038,49172,10748,4057,58929,22656,45416,38733,32421,
+   56071,13039,5322,64802,6649,61457,54836,16348,39550,29590,
+   21939,48219,746,60162,52519,9423,33133,26757,20128,42824,
+   12255,50743,57362,2554,44120,17840,25493,35453,13516,56612,
+   64257,4841,46923,24227,30854,37230,
+},
+{0,29813,59626,40095,52681,47548,9507,20822,34703,62458,
+   28517,6928,19014,15923,41644,55001,4867,26486,64489,36764,
+   57034,43711,13856,16981,38028,57593,31846,2067,22853,11568,
+   45487,50650,9734,21107,52972,47769,60367,40890,805,30544,
+   41353,54780,18787,15638,27712,6197,33962,61663,13573,16752,
+   56815,43418,63692,36025,4134,25683,45706,50943,23136,11797,
+   32579,2870,38825,58332,19468,14457,42214,53395,33221,62896,
+   26927,7514,52099,49142,9065,22300,1610,29247,61088,39637,
+   24335,11130,47077,50064,37574,59059,31276,3673,55424,44277,
+   12394,17439,5449,24892,64931,35286,27146,7807,33504,63125,
+   42947,54198,20265,15196,60805,39408,1391,28954,8268,21561,
+   51366,48339,30985,3452,37347,58774,46272,49333,23594,10335,
+   65158,35571,5740,25113,13135,18234,56229,45008,38936,60525,
+   28914,1159,21969,8612,48443,51534,8087,27618,63357,33544,
+   53854,42539,15028,20161,35611,65390,25585,6020,18130,12967,
+   44600,55885,3220,30945,58494,36875,49501,46376,10679,24002,
+   48670,51819,22260,8833,29655,1954,39741,61256,14737,19940,
+   53627,42254,62552,32813,7346,26823,44317,55656,17911,12674,
+   24788,5281,34878,64587,10898,24295,49784,46605,59227,37678,
+   4017,31684,54292,41057,15614,18571,6621,28072,61751,34114,
+   21403,10222,47985,52996,40530,59943,30392,717,50967,45922,
+   12285,23432,2782,32427,57908,38465,16536,13549,43122,56327,
+   36177,63780,26043,4558,61970,34407,6904,28301,16347,19374,
+   55089,41796,30109,488,40311,59650,47188,52257,20670,9419,
+   57617,38244,2555,32142,11480,22701,50226,45127,26270,4843,
+   36468,64001,43863,57122,17341,14280,
+},
+{0,46261,30071,49602,60142,24155,40857,11052,51649,32116,
+   48310,2051,9007,38810,22104,58093,36767,15146,64232,20061,
+   25969,53700,4102,42163,18014,62187,13097,34716,44208,6149,
+   55751,28018,803,46998,30292,49889,59853,23928,40122,10255,
+   51938,32343,49045,2848,8204,38073,21883,57806,36028,14345,
+   63947,19838,26194,53991,4901,42896,17789,61896,12298,33983,
+   44947,6950,56036,28241,1606,45811,29489,51076,60584,22557,
+   39391,11626,53127,31538,47856,3653,9577,37340,20510,58539,
+   35289,15724,64686,18459,25399,55170,5696,41717,16408,62637,
+   13679,33242,43766,7747,57217,27444,1381,45520,28690,50343,
+   61323,23358,39676,11849,52388,30737,47571,3430,9802,37631,
+   21309,59272,35578,15951,65421,19256,24596,54433,5475,41430,
+   17211,63374,13900,33529,43477,7520,56482,26647,3212,47161,
+   31227,52558,58978,21207,37653,10144,50509,29176,45114,1167,
+   12195,39702,23252,61025,33555,14246,63076,17105,27133,56648,
+   7306,43071,19154,65127,16293,35600,41020,5257,54603,25086,
+   4015,47898,31448,52845,58689,20980,36918,9347,50798,29403,
+   45849,1964,11392,38965,23031,60738,32816,13445,62791,16882,
+   27358,56939,8105,43804,18929,64836,15494,34867,41759,6058,
+   54888,25309,2762,48767,32701,51976,57380,21649,38227,8678,
+   49931,30654,46716,713,10725,40272,23698,59431,34133,12768,
+   61474,17559,28603,56078,6860,44665,19604,63521,14819,36182,
+   42618,4815,54029,26552,2537,48476,31902,51243,58119,22450,
+   38512,8901,49192,29853,46431,490,10950,40563,24497,60164,
+   34422,12995,62209,18356,27800,55341,6639,44378,20407,64258,
+   15040,36469,42329,4588,53294,25755,
+},
+{0,54485,46519,24930,30579,41894,49860,5649,61158,14899,
+   23377,36740,39317,19776,11298,63735,49617,5380,29798,41139,
+   46754,25207,789,55232,12087,64482,39552,20053,22596,35985,
+   60915,14630,40895,19306,10760,65245,59596,15385,23931,35246,
+   29017,42380,50414,4155,1578,54015,45981,26440,24174,35515,
+   60377,16140,10525,64968,40106,18559,45192,25693,1343,53738,
+   51195,4910,29260,42649,9059,63414,38612,16897,21520,32965,
+   57767,13682,52613,6480,30770,44263,47862,28195,3905,56212,
+   58034,13927,22277,33744,38337,16660,8310,62627,3156,55425,
+   47587,27958,31527,45042,52880,6725,48348,26633,2411,56766,
+   52143,8058,32280,43725,21050,34543,59277,13144,9545,61852,
+   37118,17451,32013,43480,51386,7279,2686,57003,49097,27420,
+   37867,18238,9820,62089,58520,12365,20783,34298,18118,37395,
+   62321,10148,12725,58720,33794,20695,43040,31989,7575,51522,
+   57171,2950,27364,48689,34583,21442,12960,58997,61540,9393,
+   17875,37126,27121,48420,56390,2195,7810,51799,43829,32736,
+   55673,3500,27854,47131,44554,31455,7101,53096,14239,58186,
+   33320,22269,16620,37945,62811,8590,6312,52349,44319,31178,
+   28635,47886,55916,3769,63054,8859,17401,38700,33085,21992,
+   13450,57439,26021,45424,53266,1223,4822,50691,42849,29620,
+   35651,24470,16116,59937,64560,10469,18823,40274,42100,28833,
+   4547,50454,54023,2002,26288,45669,19090,40519,65317,11248,
+   15841,59700,34902,23683,64026,11983,20397,39800,36201,22972,
+   14558,60427,5372,49193,41291,30110,25487,46938,54840,749,
+   15307,61214,36476,23209,19640,39021,63759,11738,54573,504,
+   24730,46159,41566,30347,6121,49980,
+},
+{0,58597,54743,12594,47027,21334,25188,34433,29563,38814,
+   42668,16969,50376,8237,4383,62970,59126,531,13089,55236,
+   20805,46496,33938,24695,38285,29032,16474,42175,8766,50907,
+   63465,4876,53745,13588,1062,57539,26178,33447,45973,22384,
+   41610,18031,30557,37816,5433,61916,49390,9227,14087,54242,
+   58064,1589,32948,25681,21859,45446,17532,41113,37291,30030,
+   62415,5930,9752,49917,49151,23322,27176,36557,2124,60585,
+   56731,14718,52356,10337,6483,64950,31543,40914,44768,18949,
+   22793,48620,36062,26683,61114,2655,15213,57224,10866,52887,
+   65445,6976,40385,31012,18454,44275,28174,35563,48089,24380,
+   55741,15704,3178,59535,7541,63888,51362,11335,43718,20003,
+   32529,39924,35064,27677,23855,47562,16203,56238,60060,3705,
+   64387,8038,11860,51889,19504,43221,39399,32002,25571,34566,
+   46644,21201,54352,12469,391,58722,4248,62589,50511,8618,
+   42795,17358,29436,38425,34069,25072,20674,46119,12966,54851,
+   59249,916,63086,4747,9145,51036,16861,42296,37898,28911,
+   45586,22263,26565,33568,1441,57668,53366,13459,49513,9612,
+   5310,61531,30426,37439,41741,18408,21732,45057,33075,26070,
+   58199,1970,13952,53861,10143,50042,62024,5805,36908,29897,
+   17915,41246,56348,14585,2507,60718,27567,36682,48760,23197,
+   44903,19330,31408,40533,6356,64561,52483,10726,15082,56847,
+   61245,3032,36185,27068,22670,48235,18833,44404,40006,30883,
+   65058,6855,11253,53008,3565,59656,55354,15583,47710,24251,
+   28553,35692,32406,39539,43841,20388,51493,11712,7410,63511,
+   60187,4094,16076,55849,23720,47181,35199,28058,39008,31877,
+   19895,43346,12243,52022,64004,7905,
+},
+{0,64765,58855,6426,55251,11054,12852,52937,46011,20294,
+   22108,43681,25704,39061,33167,32114,31595,34710,40588,25201,
+   44216,20549,18783,46498,51408,13357,11575,53706,7939,58366,
+   64228,1561,63190,2603,4913,61388,8453,56824,50402,14367,
+   17773,47504,41098,23671,37566,28227,30553,35748,36285,28992,
+   26714,38055,23150,42643,49033,17268,15878,49915,56289,10012,
+   59861,5416,3122,61647,61873,3404,5206,59563,9826,55967,
+   50053,16248,16906,48887,42989,23312,38361,26916,28734,36035,
+   35546,30247,28477,37824,23817,41460,47342,17427,14689,50588,
+   56454,8315,61106,4687,2901,63400,1895,64410,57984,7805,
+   53428,11337,13651,51630,46300,18465,20795,44486,25359,40946,
+   34536,31253,31756,33009,39403,25878,43999,22306,20024,45765,
+   53175,13130,10832,54957,6244,58521,64899,382,65407,898,
+   6808,58981,10412,54353,52555,12726,19652,45113,43299,21982,
+   39703,26602,32496,33293,33812,30953,25075,40206,21447,44858,
+   46624,19165,14255,52050,53832,11957,57468,7297,1435,63846,
+   2473,62804,60494,4275,56954,8839,15261,51040,47634,18159,
+   24565,41736,28097,37180,34854,29915,29378,36415,38693,27608,
+   42257,23020,16630,48139,49529,15748,9374,55395,5802,59991,
+   62285,4016,3790,62003,60201,6100,55581,9696,15610,49159,
+   48501,16776,22674,42095,27302,38491,36673,29628,30117,35160,
+   36930,27839,41590,24203,18321,47980,50718,15075,9209,57092,
+   4557,60720,62506,2263,63512,1253,7679,57602,12235,54070,
+   51756,14033,19363,46942,44612,21177,40048,24717,31127,34154,
+   33651,32654,26260,39529,21664,43101,45383,19898,12488,52277,
+   54575,10706,59163,7142,764,65025,
+},
+{0,61681,65023,3342,59363,5906,6684,60141,54235,9002,
+   11812,57045,13368,50377,51655,14646,48043,19290,18004,46757,
+   23624,44217,41399,20806,26736,39041,38287,25982,36755,32610,
+   29292,33437,27467,39866,38580,26181,36008,31833,29015,33190,
+   47248,18529,17775,46494,24435,44930,41612,21117,53472,8209,
+   11551,56814,14083,51186,51964,14861,827,62410,65220,3637,
+   58584,5161,6439,59862,54934,9831,11113,56216,12661,49540,
+   52362,15483,1357,62908,63666,2115,58030,4703,8017,61344,
+   27965,40396,37058,24627,35550,31279,30497,34768,48870,19991,
+   17177,46056,22789,43508,42234,21515,48605,19756,16418,45267,
+   23102,43727,42945,22320,28166,40695,37881,25352,35301,30996,
+   29722,34027,1654,63111,64393,2936,57749,4452,7274,60571,
+   54701,9564,10322,55459,12878,49855,53169,16192,45361,16832,
+   19662,48191,22226,42531,43821,23516,25322,37403,40725,28644,
+   34057,30200,30966,34823,2714,64107,63333,1940,60793,7560,
+   4230,57463,55617,10672,9406,54351,16034,52819,50013,13228,
+   55930,10891,10117,55156,15769,52584,49254,12439,2465,63824,
+   62558,1199,60994,7859,5053,58188,25041,37152,39982,27871,
+   34354,30403,31693,35644,45578,17147,20469,48900,21993,42264,
+   43030,22759,26535,38742,39512,27305,32836,28853,32187,36170,
+   46204,17549,18819,47474,21407,41838,44640,24209,56332,11517,
+   8691,53506,15343,51998,50704,14049,4055,65318,61992,729,
+   59444,6341,5579,58682,3308,64541,61715,482,60175,7166,
+   5872,58881,57143,12230,8904,53817,14548,51237,50475,13786,
+   46919,18358,19128,47689,20644,41045,44379,23978,25756,37997,
+   39267,27026,33663,29582,32384,36465,
+},
+{0,63223,61939,1796,65531,2316,3592,63743,58347,5404,
+   4632,58607,7184,60135,60899,6932,56267,11580,10808,56527,
+   9264,53959,54723,9012,14368,52951,51667,16164,51163,12588,
+   13864,49375,43915,23932,23160,44175,21616,41607,42371,21364,
+   18528,48791,47507,20324,47003,16748,18024,45215,28736,34487,
+   33203,30532,36795,31052,32328,35007,37803,25948,25176,38063,
+   27728,39591,40355,27476,19211,48636,47864,19471,46320,16903,
+   17667,46068,43232,24087,22803,45028,22299,41452,42728,20511,
+   37056,26167,24883,38852,28475,39372,40648,26687,29483,34268,
+   33496,29743,36048,31271,32035,35796,57472,5751,4467,59268,
+   8059,59788,61064,6271,875,62876,62104,1135,64656,2663,
+   3427,64404,15179,52668,51896,15439,50352,12871,13635,50100,
+   55456,11863,10579,57252,10075,53676,54952,8287,38422,24801,
+   26597,37138,27117,40730,38942,28393,30205,33546,33806,29433,
+   35334,31985,31733,36098,19933,47914,48174,19161,45606,17617,
+   17365,46370,44598,22721,24517,43314,20941,42810,41022,22217,
+   15773,52074,52334,15001,49766,13457,13205,50530,56950,10369,
+   12165,55666,8589,55162,53374,9865,58966,4257,6053,57682,
+   6573,61274,59486,7849,1469,62282,62542,697,64070,3249,
+   2997,64834,56605,11242,11502,55833,8934,54289,54037,9698,
+   16118,51201,52997,14834,49421,14330,12542,50697,1750,61473,
+   63269,466,63789,4058,2270,65065,58685,5066,5326,57913,
+   6854,60465,60213,7618,30358,32865,34661,29074,35181,32666,
+   30878,36457,38269,25482,25742,37497,27270,40049,39797,28034,
+   44381,23466,23726,43609,21158,42065,41813,21922,20150,47169,
+   48965,18866,45389,18362,16574,46665,
+},
+{0,62964,63477,513,62455,1539,1026,61942,64499,3591,
+   3078,63986,2052,65008,65521,2565,60411,7695,7182,59898,
+   6156,60920,61433,6669,4104,58876,59389,4617,58367,5643,
+   5130,57854,52203,15903,15390,51690,14364,52712,53225,14877,
+   12312,50668,51181,12825,50159,13851,13338,49646,8208,54756,
+   55269,8721,54247,9747,9234,53734,56291,11799,11286,55778,
+   10260,56800,57313,10773,35787,32319,31806,35274,30780,36296,
+   36809,31293,28728,34252,34765,29241,33743,30267,29754,33230,
+   24624,38340,38853,25137,37831,26163,25650,37318,39875,28215,
+   27702,39362,26676,40384,40897,27189,16416,46548,47061,16929,
+   46039,17955,17442,45526,48083,20007,19494,47570,18468,48592,
+   49105,18981,43995,24111,23598,43482,22572,44504,45017,23085,
+   20520,42460,42973,21033,41951,22059,21546,41438,2955,65151,
+   64638,2442,63612,3464,3977,64125,61560,1420,1933,62073,
+   911,63099,62586,398,57456,5508,6021,57969,4999,58995,
+   58482,4486,7043,61047,60534,6530,59508,7552,8065,60021,
+   49248,13716,14229,49761,13207,50787,50274,12694,15251,52839,
+   52326,14738,51300,15760,16273,51813,11163,56943,56430,10650,
+   55404,11672,12185,55917,53352,9628,10141,53865,9119,54891,
+   54378,8606,32832,30132,30645,33345,29623,34371,33858,29110,
+   31667,36423,35910,31154,34884,32176,32689,35397,27579,40527,
+   40014,27066,38988,28088,28601,39501,36936,26044,26557,37449,
+   25535,38475,37962,25022,19371,48735,48222,18858,47196,19880,
+   20393,47709,45144,17836,18349,45657,17327,46683,46170,16814,
+   41040,21924,22437,41553,21415,42579,42066,20902,23459,44631,
+   44118,22946,43092,23968,24481,43605,
+},
+{0,31355,62710,36493,62961,36746,263,31612,63487,36228,
+   777,31090,526,30837,63224,35971,62435,35224,1813,32110,
+   1554,31849,62180,34975,1052,32359,61674,35473,61933,35734,
+   1307,32608,64475,33184,3885,30038,3626,29777,64220,32935,
+   3108,30303,63698,33449,63957,33710,3363,30552,2104,29251,
+   64718,34485,64969,34738,2367,29508,65479,34236,2865,29002,
+   2614,28749,65216,33979,60331,37328,8029,25894,7770,25633,
+   60076,37079,7252,26159,59554,37593,59813,37854,7507,26408,
+   6216,25139,60606,38597,60857,38850,6479,25396,61367,38348,
+   6977,24890,6726,24637,61104,38091,4208,27147,58502,40701,
+   58753,40954,4471,27404,59279,40436,4985,26882,4734,26629,
+   59016,40179,58259,39400,5989,27934,5730,27673,58004,39151,
+   5228,28183,57498,39649,57757,39910,5483,28432,52043,45360,
+   16317,17862,16058,17601,51788,45111,15540,18127,51266,45625,
+   51525,45886,15795,18376,14504,17107,52318,46629,52569,46882,
+   14767,17364,53079,46380,15265,16858,15014,16605,52816,46123,
+   12432,19179,50278,48669,50529,48922,12695,19436,51055,48404,
+   13209,18914,12958,18661,50792,48147,50035,47368,14213,19966,
+   13954,19705,49780,47119,13452,20215,49274,47617,49533,47878,
+   13707,20464,8416,23195,54294,44653,54545,44906,8679,23452,
+   55071,44388,9193,22930,8942,22677,54808,44131,54019,43384,
+   10229,23950,9970,23689,53764,43135,9468,24199,53258,43633,
+   53517,43894,9723,24448,56123,41280,12237,21942,11978,21681,
+   55868,41031,11460,22207,55346,41545,55605,41806,11715,22456,
+   10456,21155,56366,42581,56617,42834,10719,21412,57127,42332,
+   11217,20906,10966,20653,56864,42075,
+},
+{0,46002,31609,51403,63218,17728,36235,15929,61945,16971,
+   35456,14642,1803,46265,31858,53184,65519,19549,33942,14116,
+   2333,47791,29284,49622,3606,48548,30063,50909,63716,19286,
+   33693,12335,58307,20593,39098,11016,5425,42627,28232,56826,
+   4666,41352,26947,56049,58568,22394,40881,11267,7212,44958,
+   26453,54503,60126,22892,37287,8725,60885,24167,38572,9502,
+   6951,43157,24670,54252,56219,26665,41186,4944,11625,40667,
+   22032,58786,10850,39376,20763,58025,56464,28450,42985,5211,
+   9332,38854,24333,60607,53894,24884,43519,6733,54669,26175,
+   44788,7494,9087,37069,22534,60340,14424,35818,17185,61587,
+   52906,32024,46547,1633,51617,31251,45784,362,16211,36065,
+   17450,63384,51127,29701,48334,3964,12613,33527,19004,63886,
+   13902,34300,19767,65157,49340,29454,48069,2167,43819,6297,
+   53330,25568,24025,61035,9888,38162,23250,59744,8619,37401,
+   44064,8082,55129,25835,21700,59254,12221,39951,41526,4484,
+   55631,27389,42301,5775,56900,28150,21455,57469,10422,39684,
+   18664,64346,13201,32803,48666,3496,50531,30417,47377,2723,
+   49768,29146,20451,64593,13466,34600,46855,1205,52350,32716,
+   16885,62023,14988,35134,18174,62796,15751,36405,45068,958,
+   52085,30919,28848,49922,3017,47227,34370,13808,64827,20105,
+   33097,13051,64048,18818,30651,50185,3266,49008,36703,15597,
+   62502,18324,31149,51743,724,45414,32422,52500,1503,46701,
+   34900,15334,62253,16543,37747,8385,59402,23480,25985,54835,
+   7928,44362,25226,53560,6643,43585,38008,10186,61185,23731,
+   27804,57134,6117,42071,39534,10716,57623,21157,40293,11991,
+   58908,21934,27543,55333,4334,41820,
+},
+{0,22872,45744,60392,31101,8229,52173,37525,62202,43938,
+   16458,6418,35719,53983,14647,24687,63977,41137,19289,4609,
+   32916,55756,12836,27516,2835,21067,47523,57595,29294,11062,
+   49374,39302,61391,46743,23935,1063,38578,53226,9218,32090,
+   7477,17517,44933,63197,25672,15632,55032,36768,5670,20350,
+   42134,64974,28507,13827,56811,33971,58588,48516,22124,3892,
+   40353,50425,12049,30281,50051,39643,28979,10347,47870,58278,
+   2126,20758,12665,26657,33737,55953,18436,4444,64180,41964,
+   14954,25394,35034,53634,17175,6735,61863,43263,51344,37320,
+   31264,9080,45549,59573,861,23045,11340,29972,40700,51108,
+   21809,3177,59265,48857,57014,34798,27654,13662,42955,65171,
+   5499,19491,54693,36093,26389,15949,44248,62848,7784,18224,
+   10079,32263,38383,52407,24098,1914,60562,46538,39707,49731,
+   10667,28915,57958,47934,20694,2446,27105,12473,56145,33289,
+   4252,18884,41516,64372,25330,15274,53314,35098,7055,17111,
+   43327,61543,36872,51536,8888,31712,59765,45101,23493,669,
+   29908,11660,50788,40764,3497,21745,48921,58945,34350,57206,
+   13470,28102,65363,42507,19939,5307,36157,54373,16269,26325,
+   62528,44312,18160,8104,32711,9887,52599,37935,1722,24546,
+   46090,60754,22680,448,59944,45936,8677,30909,37717,51725,
+   43618,62266,6354,16778,54047,35399,25007,14583,41329,63529,
+   5057,19097,55308,33108,27324,13284,21387,2771,57659,47203,
+   10998,29614,38982,49438,46935,60943,1511,23743,52778,38770,
+   31898,9666,17837,7413,63261,44613,15568,25992,36448,55096,
+   20158,6118,64526,42326,14275,28315,34163,56363,48196,58652,
+   3828,22444,50489,40033,30601,11985,
+},
+{0,11309,22618,29815,45236,40089,59630,50371,32117,20824,
+   9519,2306,52673,57836,38299,47542,64234,54983,41648,36509,
+   19038,26227,4612,15913,34719,43954,57285,62440,14123,6918,
+   28529,17244,59849,50660,45459,40382,22909,30032,295,11530,
+   38076,47249,52454,57547,9224,2085,31826,20607,4899,16142,
+   19321,26452,41879,36794,64461,55264,28246,17019,13836,6689,
+   57058,62159,34488,43669,53135,58274,38869,48120,32571,21270,
+   10081,2892,45818,40663,60064,50829,590,11875,23060,30265,
+   13669,6472,27967,16658,34257,43516,56715,61862,18448,25661,
+   4170,15463,63652,54409,41214,36051,9798,2667,32284,21041,
+   38642,47839,52904,57989,23347,30494,873,12100,60295,51114,
+   46045,40944,56492,61569,34038,43227,27672,16437,13378,6255,
+   41433,36340,63875,54702,4461,15680,18743,25882,33539,44846,
+   56153,63348,13239,8090,27629,18368,65142,53851,42540,35329,
+   20162,25327,5784,15029,31209,21956,8627,3486,51549,58736,
+   37127,48426,1180,10417,23750,28907,46120,38917,60530,49247,
+   27338,18151,12944,7869,55934,63059,33316,44553,6079,15250,
+   20453,25544,42763,35622,65361,54140,36896,48141,51322,58455,
+   8340,3257,30926,21731,60757,49528,46351,39202,24033,29132,
+   1467,10646,19596,24737,5334,14587,64568,53269,42082,34895,
+   12793,7636,27043,17806,33101,44384,55575,62778,46694,39499,
+   60988,49681,1746,11007,24200,29349,51987,59198,37705,48996,
+   31655,22410,9213,4048,42309,35176,64799,53554,5617,14812,
+   19883,24966,55344,62493,32874,44103,26756,17577,12510,7411,
+   24495,29570,2037,11224,61211,49974,46913,39788,8922,3831,
+   31360,22189,37486,48707,51764,58905,
+},
+{0,39065,11567,46518,23134,49863,30577,61416,46268,11301,
+   39315,266,61154,30331,50125,23380,30053,60924,22602,49363,
+   12091,47010,532,39565,49625,22848,60662,29807,39815,798,
+   46760,11825,60106,29267,51173,24444,45204,10253,40379,1314,
+   24182,50927,29529,60352,1064,40113,10503,45470,40879,1846,
+   45696,10777,50673,23912,59614,28743,11027,45962,1596,40613,
+   29005,59860,23650,50427,51593,20752,58534,31807,37847,2894,
+   48888,9825,32053,58796,20506,51331,10091,49138,2628,37597,
+   48364,9333,37315,2394,59058,32299,52125,21252,2128,37065,
+   9599,48614,21006,51863,32545,59320,9027,48090,3692,38645,
+   31005,57732,21554,52395,38911,3942,47824,8777,52641,21816,
+   57486,30743,22054,52927,31497,58256,3192,38113,8535,47566,
+   58010,31235,53173,22316,47300,8285,38379,3442,36623,6038,
+   41504,15033,54609,19912,63614,24807,15283,41770,5788,36357,
+   25069,63860,19650,54363,64106,25331,55109,20444,41012,14509,
+   36123,5506,20182,54863,25593,64352,5256,35857,14759,41278,
+   26053,64860,18666,53363,16283,42754,4788,35373,53625,18912,
+   64598,25807,35623,5054,42504,16017,4256,34873,15759,42262,
+   19198,53863,26577,65352,42012,15493,35123,4522,65090,26331,
+   54125,19444,18054,56863,27561,62256,7384,33857,12791,43374,
+   62010,27299,57109,18316,43108,12541,34123,7634,13283,43898,
+   7884,34389,27069,61732,17554,56331,34655,8134,43632,13033,
+   56577,17816,61486,26807,44108,13525,33123,6650,62994,28299,
+   56125,17316,6384,32873,13791,44358,17070,55863,28545,63256,
+   55593,16816,62470,27807,33655,7150,44632,14017,28053,62732,
+   16570,55331,14283,44882,6884,33405,
+},
+{0,49859,39323,23384,12075,60904,46768,29811,24150,40085,
+   51149,1294,29053,46014,59622,10789,48300,32367,9527,59380,
+   37767,20804,2588,51423,58106,8249,31585,47522,52689,3858,
+   21578,38537,25925,42886,64734,15901,19054,34989,54261,4406,
+   15123,63952,41608,24651,5176,55035,36259,20320,55785,6954,
+   16498,33457,63170,13313,28505,44442,34751,17788,7716,56551,
+   43156,27223,12559,62412,51850,2121,21265,37330,58785,10082,
+   31802,48889,38108,22047,3399,53124,48119,31028,8812,57519,
+   30246,46309,61373,11646,22797,39886,49302,597,10352,60083,
+   45547,29480,1883,50584,40640,23555,45007,27916,13908,62615,
+   32996,16935,6527,56252,61849,13146,26626,43713,57010,7281,
+   18217,34282,4963,53664,35576,18491,15432,65163,42451,26384,
+   19765,36854,54446,5741,25118,41181,64389,14662,35081,19402,
+   4242,53841,42530,25825,16313,64890,55135,5532,20164,35847,
+   63604,15031,25071,41772,13733,63334,44094,28413,6798,55373,
+   33557,16854,27635,43312,62056,12459,17624,34331,56643,8064,
+   60492,11919,30167,46868,50023,420,23292,38975,45594,28889,
+   11137,59714,40241,24562,1194,50793,20704,37411,51579,3000,
+   32715,48392,58960,9363,3766,52341,38701,21998,8605,58206,
+   47110,31429,17283,33088,55832,6363,27816,44651,62771,14320,
+   7637,57110,33870,18061,13054,61501,43877,27046,65327,15852,
+   26292,42103,53252,4807,18847,35676,41337,25530,14562,64033,
+   36434,19601,6089,54538,9926,58373,48989,32158,2541,52014,
+   36982,21173,30864,47699,57611,9160,22459,38264,52768,3299,
+   39530,22697,1009,49458,46401,30594,11482,60953,50236,1791,
+   23975,40804,60183,10708,29324,45135,
+},
+{0,61422,50113,11311,39839,29809,22622,47024,11043,50381,
+   59618,1804,45244,24402,29565,40083,22086,47528,38279,31337,
+   52697,8759,3608,57846,32101,37515,48804,20810,59130,2324,
+   9531,51925,44172,17250,28493,32931,14099,55549,62674,6972,
+   34735,26689,17518,43904,7216,62430,57329,12319,64202,5412,
+   14603,55013,24917,36539,41620,19834,53737,15879,4648,64966,
+   19062,42392,35255,26201,17669,43755,34500,26922,56986,12660,
+   7515,62133,28198,33224,44519,16905,62905,6743,13944,55702,
+   4931,64685,53378,16236,35036,26418,19229,42227,14432,55182,
+   64417,5199,41983,19473,24638,36816,59785,1639,10824,50598,
+   29206,40440,45527,24121,49834,11588,363,61061,22837,46811,
+   39668,29978,49103,20513,31758,37856,9296,52158,59281,2175,
+   38124,31490,22317,47299,3955,57501,52402,9052,35338,26084,
+   18891,42533,4501,65147,53844,15802,41257,20167,25320,36102,
+   15030,54616,63863,5785,56396,13218,8077,61539,18387,43069,
+   33810,27644,63343,6273,13486,56128,27888,33566,44849,16607,
+   9862,51560,58695,2729,48409,21239,32472,37174,3493,57931,
+   52836,8586,38458,31188,22011,47637,28864,40750,45825,23791,
+   60255,1201,10398,51056,23523,46093,38946,30668,49276,12178,
+   957,60499,53007,8417,3278,58144,21648,47998,38737,30911,
+   58412,3010,10221,51203,32691,36957,48242,21404,39241,30375,
+   23176,46438,726,60728,49431,12025,45674,23940,29099,40517,
+   10741,50715,59956,1498,25475,35949,41026,20396,63516,6130,
+   15325,54323,18592,42830,35681,25743,54079,15569,4350,65296,
+   13765,55851,62980,6634,44634,16820,28059,33397,7910,61704,
+   56615,13001,34169,27287,18104,43350,
+},
+{0,30582,61164,39322,49605,46771,12073,22623,40855,59617,
+   29051,1549,24146,10532,45246,51144,9011,21573,52703,47785,
+   58102,38272,3098,31596,48292,52178,21064,9534,32097,2583,
+   37773,58619,18022,12560,43146,57340,34723,61653,26959,7737,
+   55793,44679,14109,16491,6196,28482,63192,33198,25941,4643,
+   35769,64719,42128,54246,19068,15626,64194,36276,5166,25432,
+   15111,19569,54763,41629,36044,64442,25120,5462,19721,14975,
+   41957,54419,4955,25645,64951,35521,53918,42472,15474,19204,
+   45055,55433,16659,13925,28218,6476,32982,63392,12392,18206,
+   56964,43506,61869,34523,8001,26679,51882,48604,9286,21296,
+   2927,31769,58755,37621,21821,8779,48081,52391,38136,58254,
+   31252,3426,59801,40687,1909,28675,10332,24362,50864,45510,
+   30222,376,39138,61332,47051,49341,22823,11857,1413,29427,
+   60265,39967,50240,45878,10924,24026,39442,60772,29950,904,
+   23511,11425,46395,49741,9910,20928,51290,48940,59251,36869,
+   2463,32489,47393,52823,22477,8379,30948,3986,38408,57726,
+   17379,13461,44303,55929,33318,62800,27850,7100,56436,43778,
+   12952,17902,7601,27335,62301,33835,24784,6054,36412,63818,
+   41237,54883,20473,14479,65351,34865,4523,26333,16002,18932,
+   53358,42776,35145,65087,26533,4307,18572,16378,42592,53526,
+   5854,25000,63538,36676,55067,41069,14839,20097,43642,56588,
+   17558,13280,27583,7369,34131,61989,13805,17051,56065,44151,
+   62504,33630,6852,28082,53039,47193,8643,22197,3818,31132,
+   57350,38768,20664,10190,48724,51490,37245,58891,32657,2279,
+   60444,39786,752,30086,11737,23215,49973,46147,29579,1277,
+   40295,59921,45646,50488,23714,11220,
+},
+{0,15162,30324,19790,60648,55250,39580,41382,50637,65271,
+   46009,34947,10533,4639,24401,25707,38791,44221,57843,56009,
+   31599,16469,3355,13857,21066,26992,9278,7940,48802,34200,
+   51414,62444,13075,2089,17767,32349,57339,58561,43407,37557,
+   63198,52708,32938,48016,6710,8460,27714,22392,42132,40878,
+   53984,59866,18556,29510,15880,1330,24921,23139,5933,11287,
+   36273,46731,64453,49407,26150,23836,4178,11112,35534,45556,
+   64698,51072,41963,39121,54687,61093,20227,29753,14711,589,
+   61857,51867,34773,48367,7497,9843,27453,20487,13420,3926,
+   16920,31010,55428,58302,44784,38346,21813,28175,9025,6267,
+   47581,33511,53161,62611,37112,43970,59020,56758,31760,18218,
+   2660,12638,49842,63880,46278,36860,11866,5472,22574,25364,
+   1919,15429,28939,18993,60311,53421,40419,42713,52300,63350,
+   47672,33026,8356,7070,22224,28138,2433,12987,32757,17615,
+   58729,56915,37661,43047,23499,24817,11711,5765,46883,35865,
+   49495,64109,40454,42300,59506,54088,29422,18900,1178,16288,
+   65375,50277,35115,45585,5047,10381,26051,24313,14994,424,
+   19686,30684,54906,60736,40974,39732,26840,21474,7852,9622,
+   33840,48906,62020,51582,44309,38447,56161,57435,16893,31431,
+   14217,3251,43626,37200,56350,59172,18050,32184,12534,3020,
+   28583,21661,6611,8937,33615,47221,62779,52737,15853,1751,
+   19353,28835,53509,59967,42865,40011,63520,49946,36436,46446,
+   5320,12274,25276,22918,39289,41539,61197,54327,30097,20139,
+   997,14559,23732,26510,10944,4602,45148,35686,50728,64786,
+   3838,13764,30858,17328,57878,55596,37986,44888,52019,61449,
+   48455,34429,10203,7393,20911,27285,
+},
+{0,7452,14904,10020,29808,26988,20040,21332,59616,62972,
+   53976,53188,40080,33164,42664,48052,52701,53441,63461,60153,
+   47533,42161,33685,40585,9533,14369,7941,537,20813,19537,
+   27509,30313,34727,39611,48543,41091,62423,61131,51695,54515,
+   28487,29275,21887,18531,6967,1579,8463,15379,19066,22374,
+   28738,27998,15882,8982,1074,6446,41626,49030,39074,34238,
+   55018,52214,60626,61902,4947,3663,10603,13431,26403,31295,
+   23835,16391,64435,59055,49547,56471,36803,37599,46587,43239,
+   56974,50066,58550,63914,43774,47074,37062,36314,13934,11122,
+   3158,4426,16926,24322,30758,25914,38132,35304,44748,46032,
+   57476,64920,55996,51104,31764,24840,17964,23344,2148,5496,
+   12892,12096,22825,17461,25361,32269,11609,12357,5985,2685,
+   45513,44245,35825,38637,50617,55461,65409,58013,9894,15290,
+   7326,386,21206,20426,26862,30194,52806,54106,62590,59746,
+   47670,42794,32782,40210,60283,63079,53571,52319,40715,33303,
+   42291,47151,923,7815,14755,9407,30699,27383,19923,20687,
+   41217,48157,39737,34341,54641,51309,61257,62037,18913,21757,
+   29657,28357,15761,8333,1961,6837,27868,29120,22244,19448,
+   6316,1456,8852,16264,33852,39200,48644,41752,61516,60752,
+   51828,55144,13813,10473,4045,4817,16773,23705,31677,26273,
+   56597,49161,59181,64049,43365,46201,37725,36417,63528,58676,
+   49680,57100,35928,37188,46688,43900,4296,3540,10992,14316,
+   25784,31140,24192,17308,45650,44878,34922,38262,50722,56126,
+   64538,57606,23218,18350,24714,32150,11970,13278,5370,2534,
+   32655,25235,17847,22699,3071,5859,12743,11483,38767,35443,
+   44375,45131,58143,65027,55591,50235,
+},
+{0,3599,7198,4625,14396,13875,9250,10797,28792,32375,
+   27750,25193,18500,17995,21594,23125,57584,61183,64750,62177,
+   55500,54979,50386,51933,37000,40583,35990,33433,43188,42683,
+   46250,47781,56829,54258,49635,53228,58817,60366,63967,63440,
+   44421,41866,45467,49044,38329,39862,35239,34728,15629,13058,
+   8467,12060,1329,2878,6447,5920,19829,17274,20843,24420,
+   30025,31558,26967,26456,42983,43496,48121,46582,40923,37332,
+   33733,36298,55199,55696,52097,50574,61347,57772,62397,64946,
+   18199,18712,23305,21766,32555,28964,25397,27962,14191,14688,
+   11121,9598,3923,348,4941,7490,31258,29717,26116,26635,
+   16934,19497,24120,20535,2658,1133,5756,6259,12894,15441,
+   11840,8271,39658,38117,34548,35067,41686,44249,48840,45255,
+   60050,58525,63116,63619,53934,56481,52912,49343,21459,24028,
+   20429,16834,27631,26080,30705,31230,9131,11684,16309,12730,
+   7063,5528,1929,2438,45859,48428,44861,41266,35615,34064,
+   38657,39182,50011,52564,57157,53578,64359,62824,59257,59766,
+   36398,32801,37424,39999,46610,47133,43532,41987,65110,61529,
+   57928,60487,50794,51301,55924,54395,28382,24785,29376,31951,
+   22242,22765,19196,17651,7846,4265,696,3255,9882,10389,
+   14980,13451,62516,64059,59434,58917,52232,49671,53270,56857,
+   33868,35395,38994,38493,48240,45695,41070,44641,5316,6859,
+   2266,1749,11512,8951,12518,16105,25788,27315,30882,30381,
+   23680,21135,16542,20113,10697,10182,13783,15320,4597,8186,
+   3563,996,22961,22462,17839,19360,24973,28546,32147,29596,
+   51513,50998,54567,56104,61701,65290,60699,58132,47425,46926,
+   42335,43856,33149,36722,40291,37740,
+},
+{0,35208,3853,34437,7706,38802,4375,39071,15412,46524,
+   13113,47793,8750,43942,11555,42155,30824,61920,30565,65261,
+   26226,61434,27007,57591,17500,52692,19281,49881,23110,54222,
+   21835,56515,61648,31064,65501,30293,61130,26434,57799,26703,
+   52452,17772,50153,19041,54014,23414,56819,21627,35000,304,
+   34741,3645,38562,7978,39343,4135,46220,15620,48001,12809,
+   43670,8990,42395,11283,64957,29749,62128,31544,58279,27183,
+   60586,25890,49545,18433,52868,18188,57235,22043,53406,22806,
+   34261,3165,35544,848,39887,4679,38082,7498,47585,12393,
+   46828,16228,43003,11891,43254,8574,3437,34021,608,35816,
+   4983,39679,7290,38386,12633,47313,15956,47068,12099,42699,
+   8270,43462,29957,64653,31240,62336,27423,58007,25618,60826,
+   18737,49337,17980,53172,22315,56995,22566,53678,59239,28399,
+   59498,25058,63869,28917,63088,32760,56147,21211,54366,24022,
+   50505,19649,51780,17356,40719,5767,36866,6538,33045,2205,
+   36376,1936,41787,10931,44086,9662,48417,13481,45612,15268,
+   6071,40511,6330,37170,2477,32805,1696,36648,11139,41483,
+   9358,44294,13721,48145,14996,45852,28639,58967,24786,59738,
+   29125,63565,32456,63296,21483,55907,23782,54638,19953,50297,
+   17148,52084,6874,37714,5591,40031,1216,36168,3021,33349,
+   9966,44902,10723,41067,14580,45436,14329,48753,25266,60218,
+   28095,58423,31912,62752,29605,64045,24198,55054,20875,55299,
+   16540,51476,20369,50713,59914,25474,58631,27791,62480,32152,
+   64285,29333,54846,24502,55603,20667,51236,16812,50985,20129,
+   37474,7146,40303,5351,35960,1520,33653,2813,44630,10206,
+   41307,10451,45132,14788,48961,14025,
+},
+{0,17477,34954,52431,3337,18764,34179,49606,6674,24151,
+   37528,55005,5915,21342,40849,56276,13348,28769,48302,63723,
+   14637,32104,45479,62946,11830,27251,42684,58105,9023,26490,
+   43957,61424,26696,11277,57538,42119,25921,8452,60875,43406,
+   29274,13855,64208,48789,32595,15126,63449,45980,23660,6185,
+   54502,37027,20837,5408,55791,40362,18046,571,52980,35505,
+   19319,3890,50173,34744,53392,38101,22554,7263,56729,39388,
+   21779,4438,51842,36551,16904,1613,51083,33742,20225,2884,
+   58548,41201,27710,10363,59837,44536,24887,9586,65190,47843,
+   30252,12905,62383,47082,31525,16224,47320,64669,12370,29719,
+   46545,61844,15707,31006,41674,59023,10816,28165,44995,60294,
+   10057,25356,36092,51385,1142,16435,33269,50608,2431,19770,
+   38638,53931,7780,23073,39911,57250,4973,22312,48445,63864,
+   13751,29170,45108,62577,14526,31995,42799,58218,12197,27616,
+   43558,61027,8876,26345,35097,52572,403,17878,33808,49237,
+   3226,18655,37643,55118,7041,24516,40450,55879,5768,21197,
+   54645,37168,24063,6586,55420,39993,20726,5299,53095,35618,
+   18413,936,49774,34347,19172,3745,57681,42260,27099,11678,
+   60504,43037,25810,8343,64323,48902,29641,14220,63050,45583,
+   32448,14981,28077,10728,58663,41314,24740,9441,59438,44139,
+   30655,13306,65333,47984,31414,16115,62012,46713,22921,7628,
+   53507,38214,21632,4293,56330,38991,17307,2014,51985,36692,
+   20114,2775,50712,33373,1509,16800,36207,51498,2284,19625,
+   32870,50211,8183,23474,38781,54072,4862,22203,39540,56881,
+   12737,30084,47435,64782,15560,30861,46146,61447,11219,28566,
+   41817,59164,9946,25247,44624,59925,
+},
+{0,44205,17735,59882,35470,9763,53193,25444,2305,42412,
+   19526,57579,33679,12066,50888,27237,4610,48815,22341,64488,
+   39052,13345,56779,29030,6915,47022,24132,62185,37261,15648,
+   54474,30823,9220,34985,24899,52718,44682,551,60365,18272,
+   11525,33192,26690,50415,42891,2854,58060,20065,13830,39595,
+   29505,57324,48264,4133,63951,21858,16135,37802,31296,55021,
+   46473,6436,61646,23651,18440,58533,3407,41442,49798,28203,
+   34753,11116,16649,60836,1102,43235,52103,26410,36544,8813,
+   23050,63143,8013,46048,53380,31785,38339,14702,21259,65446,
+   5708,47841,55685,29992,40130,12399,27660,49313,10571,34278,
+   59010,18991,41925,3944,25869,51616,8266,36071,61315,17198,
+   43716,1641,32270,53923,15177,38884,62592,22573,45511,7530,
+   30479,56226,12872,40677,64897,20780,47302,5227,36880,15549,
+   54615,31226,6814,46643,24537,62324,39185,13756,56406,28923,
+   5023,48946,22232,64117,33298,11967,51029,27640,2204,42033,
+   19931,57718,35603,10174,52820,25337,413,44336,17626,59511,
+   46100,6329,61779,24062,16026,37431,31709,55152,48405,4536,
+   63570,21759,14235,39734,29404,56945,42518,2747,58193,20476,
+   11416,32821,27103,50546,44823,954,59984,18173,9625,35124,
+   24798,52339,55320,29877,40287,12786,21142,65083,6097,47996,
+   53529,32180,37982,14579,23447,63290,7888,45693,51738,26295,
+   36701,9200,16532,60473,1491,43390,49947,28598,34396,10993,
+   18837,58680,3282,41087,64540,20657,47451,5622,30354,55871,
+   13269,40824,62749,22960,45146,7415,32659,54078,15060,38521,
+   60958,17075,43865,2036,25744,51261,8663,36218,59167,19378,
+   41560,3829,28049,49468,10454,33915,
+},
+{0,55513,44463,30070,18243,40858,60140,12853,36486,22111,
+   9001,64496,51653,4380,25706,48307,273,55752,44222,29799,
+   18002,40587,60413,13092,36759,22350,8760,64225,51412,4109,
+   25979,48546,546,56059,44941,30548,17761,40376,59598,12311,
+   36004,21629,8459,63954,52199,4926,26184,48785,819,56298,
+   44700,30277,17520,40105,59871,12550,36277,21868,8218,63683,
+   51958,4655,26457,49024,1092,56477,43499,28978,17159,39902,
+   61096,13937,35522,21019,10093,65460,52609,5464,24622,47351,
+   1365,56716,43258,28707,16918,39631,61369,14176,35795,21258,
+   9852,65189,52368,5193,24895,47590,1638,57023,43977,29456,
+   16677,39420,60554,13395,35040,20537,9551,64918,53155,6010,
+   25100,47829,1911,57262,43736,29185,16436,39149,60827,13634,
+   35313,20776,9310,64647,52914,5739,25373,48068,2184,53329,
+   42279,32254,20427,38674,57956,15037,34318,24279,11169,62328,
+   49485,6548,27874,46139,2457,53568,42038,31983,20186,38403,
+   58229,15276,34591,24518,10928,62057,49244,6277,28147,46378,
+   2730,53875,42757,32732,19945,38192,57414,14495,33836,23797,
+   10627,61786,50031,7094,28352,46617,3003,54114,42516,32461,
+   19704,37921,57687,14734,34109,24036,10386,61515,49790,6823,
+   28625,46856,3276,54293,41315,31162,19343,37718,58912,16121,
+   33354,23187,12261,63292,50441,7632,26790,45183,3549,54532,
+   41074,30891,19102,37447,59185,16360,33627,23426,12020,63021,
+   50200,7361,27063,45422,3822,54839,41793,31640,18861,37236,
+   58370,15579,32872,22705,11719,62750,50987,8178,27268,45661,
+   4095,55078,41552,31369,18620,36965,58643,15818,33145,22944,
+   11478,62479,50746,7907,27541,45900,
+},
+{0,58083,55771,15160,44971,19784,30320,38035,17227,41384,
+   39568,30835,60640,3587,13627,55256,34454,25717,24397,48558,
+   10557,52190,61670,4613,50653,10046,7174,65253,27254,34965,
+   45997,20814,4401,62418,51434,10761,48794,23673,26433,34210,
+   21114,45209,35745,26946,64977,7986,9226,50921,38823,30020,
+   20092,44191,14348,56047,57815,820,54508,13839,3383,61396,
+   31559,39332,41628,16511,8802,49281,64441,6490,36297,28458,
+   21522,46833,24873,33738,47346,23057,52866,11361,5977,62906,
+   42228,17943,32047,40908,2911,59836,53892,12391,59327,1372,
+   15972,56455,18452,43767,37327,29484,13139,53680,60040,2155,
+   40184,32283,17699,42944,28696,37627,43459,19232,57267,15696,
+   1640,58507,46533,22310,27678,36605,6766,63629,50101,8534,
+   63118,5229,12117,52662,22821,48070,33022,25117,17604,42535,
+   40223,32764,60271,2444,12980,53335,1935,58732,56916,15543,
+   43044,19143,29183,37660,49746,8369,7049,63850,28153,36634,
+   46114,22209,33049,25594,22722,47649,11954,52305,63337,5514,
+   22005,46870,35886,28365,64094,6333,9093,49510,5822,62557,
+   53093,11654,47381,23542,24782,33325,54115,12672,2744,59483,
+   31944,40491,42259,18416,36904,29387,18931,43792,16259,56672,
+   58968,1211,26278,33861,49021,23966,51469,11246,4310,62005,
+   9709,50958,64566,7893,35398,26789,21405,45438,57392,723,
+   14827,56072,20379,44408,38464,29859,41851,16792,31392,38979,
+   3280,60979,54539,14312,30615,38260,44620,19631,55356,15071,
+   487,58116,13532,54847,60679,4068,39799,31124,17068,41039,
+   61697,5090,10458,51769,24234,48201,34673,26002,45642,20649,
+   27537,35186,7649,65282,50234,9945,
+},
+{0,65534,58337,7199,56287,9249,14398,51136,43939,21597,
+   18498,47036,28796,36738,37789,27747,19291,46245,43194,22340,
+   36996,28538,29541,35995,57592,7942,793,64743,15143,50393,
+   55494,10040,38582,26952,30039,35497,19817,45719,44680,20854,
+   15637,49899,57076,8458,59082,6452,1323,64213,56813,8723,
+   15884,49650,1586,63948,58835,6701,30286,35248,38319,27217,
+   44433,21103,20080,45454,12657,52879,53904,11630,60078,5456,
</pre></pre>
<strong class="error" style="color:red;" >[truncated at 1000 lines; 183 more skipped]</strong>
</div>
<hr /><a name="file29" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>edc_scramble.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/edc_scramble.h
+++ lxdream/src/drivers/cdrom/edc_scramble.h
@@ -0,0 +1,621 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* @(#)scramble_table  1.2 02/10/19 */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; see the file COPYING.  If not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+static const unsigned char yellowbook_scrambler[2340] = {
+  1,128,0,96,0,40,0,30,128,8,96,6,168,2,254,129,128,96,96,40,40,30,158,
+  136,104,102,174,170,252,127,1,224,0,72,0,54,128,22,224,14,200,4,86,131,126,225,
+  224,72,72,54,182,150,246,238,198,204,82,213,253,159,1,168,0,126,128,32,96,24,40,
+  10,158,135,40,98,158,169,168,126,254,160,64,120,48,34,148,25,175,74,252,55,1,214,
+  128,94,224,56,72,18,182,141,182,229,182,203,54,215,86,222,190,216,112,90,164,59,59,
+  83,83,125,253,225,129,136,96,102,168,42,254,159,0,104,0,46,128,28,96,9,232,6,
+  206,130,212,97,159,104,104,46,174,156,124,105,225,238,200,76,86,181,254,247,0,70,128,
+  50,224,21,136,15,38,132,26,227,75,9,247,70,198,178,210,245,157,135,41,162,158,249,
+  168,66,254,177,128,116,96,39,104,26,174,139,60,103,81,234,188,79,49,244,20,71,79,
+  114,180,37,183,91,54,187,86,243,126,197,224,83,8,61,198,145,146,236,109,141,237,165,
+  141,187,37,179,91,53,251,87,3,126,129,224,96,72,40,54,158,150,232,110,206,172,84,
+  125,255,97,128,40,96,30,168,8,126,134,160,98,248,41,130,158,225,168,72,126,182,160,
+  118,248,38,194,154,209,171,28,127,73,224,54,200,22,214,142,222,228,88,75,122,183,99,
+  54,169,214,254,222,192,88,80,58,188,19,49,205,212,85,159,127,40,32,30,152,8,106,
+  134,175,34,252,25,129,202,224,87,8,62,134,144,98,236,41,141,222,229,152,75,42,183,
+  95,54,184,22,242,142,197,164,83,59,125,211,97,157,232,105,142,174,228,124,75,97,247,
+  104,70,174,178,252,117,129,231,32,74,152,55,42,150,159,46,232,28,78,137,244,102,199,
+  106,210,175,29,188,9,177,198,244,82,199,125,146,161,173,184,125,178,161,181,184,119,50,
+  166,149,186,239,51,12,21,197,207,19,20,13,207,69,148,51,47,85,220,63,25,208,10,
+  220,7,25,194,138,209,167,28,122,137,227,38,201,218,214,219,30,219,72,91,118,187,102,
+  243,106,197,239,19,12,13,197,197,147,19,45,205,221,149,153,175,42,252,31,1,200,0,
+  86,128,62,224,16,72,12,54,133,214,227,30,201,200,86,214,190,222,240,88,68,58,179,
+  83,53,253,215,1,158,128,104,96,46,168,28,126,137,224,102,200,42,214,159,30,232,8,
+  78,134,180,98,247,105,134,174,226,252,73,129,246,224,70,200,50,214,149,158,239,40,76,
+  30,181,200,119,22,166,142,250,228,67,11,113,199,100,82,171,125,191,97,176,40,116,30,
+  167,72,122,182,163,54,249,214,194,222,209,152,92,106,185,239,50,204,21,149,207,47,20,
+  28,15,73,196,54,211,86,221,254,217,128,90,224,59,8,19,70,141,242,229,133,139,35,
+  39,89,218,186,219,51,27,85,203,127,23,96,14,168,4,126,131,96,97,232,40,78,158,
+  180,104,119,110,166,172,122,253,227,1,137,192,102,208,42,220,31,25,200,10,214,135,30,
+  226,136,73,166,182,250,246,195,6,209,194,220,81,153,252,106,193,239,16,76,12,53,197,
+  215,19,30,141,200,101,150,171,46,255,92,64,57,240,18,196,13,147,69,173,243,61,133,
+  209,163,28,121,201,226,214,201,158,214,232,94,206,184,84,114,191,101,176,43,52,31,87,
+  72,62,182,144,118,236,38,205,218,213,155,31,43,72,31,118,136,38,230,154,202,235,23,
+  15,78,132,52,99,87,105,254,174,192,124,80,33,252,24,65,202,176,87,52,62,151,80,
+  110,188,44,113,221,228,89,139,122,231,99,10,169,199,62,210,144,93,172,57,189,210,241,
+  157,132,105,163,110,249,236,66,205,241,149,132,111,35,108,25,237,202,205,151,21,174,143,
+  60,100,17,235,76,79,117,244,39,7,90,130,187,33,179,88,117,250,167,3,58,129,211,
+  32,93,216,57,154,146,235,45,143,93,164,57,187,82,243,125,133,225,163,8,121,198,162,
+  210,249,157,130,233,161,142,248,100,66,171,113,191,100,112,43,100,31,107,72,47,118,156,
+  38,233,218,206,219,20,91,79,123,116,35,103,89,234,186,207,51,20,21,207,79,20,52,
+  15,87,68,62,179,80,117,252,39,1,218,128,91,32,59,88,19,122,141,227,37,137,219,
+  38,219,90,219,123,27,99,75,105,247,110,198,172,82,253,253,129,129,160,96,120,40,34,
+  158,153,168,106,254,175,0,124,0,33,192,24,80,10,188,7,49,194,148,81,175,124,124,
+  33,225,216,72,90,182,187,54,243,86,197,254,211,0,93,192,57,144,18,236,13,141,197,
+  165,147,59,45,211,93,157,249,169,130,254,225,128,72,96,54,168,22,254,142,192,100,80,
+  43,124,31,97,200,40,86,158,190,232,112,78,164,52,123,87,99,126,169,224,126,200,32,
+  86,152,62,234,144,79,44,52,29,215,73,158,182,232,118,206,166,212,122,223,99,24,41,
+  202,158,215,40,94,158,184,104,114,174,165,188,123,49,227,84,73,255,118,192,38,208,26,
+  220,11,25,199,74,210,183,29,182,137,182,230,246,202,198,215,18,222,141,152,101,170,171,
+  63,63,80,16,60,12,17,197,204,83,21,253,207,1,148,0,111,64,44,48,29,212,9,
+  159,70,232,50,206,149,148,111,47,108,28,45,201,221,150,217,174,218,252,91,1,251,64,
+  67,112,49,228,20,75,79,119,116,38,167,90,250,187,3,51,65,213,240,95,4,56,3,
+  82,129,253,160,65,184,48,114,148,37,175,91,60,59,81,211,124,93,225,249,136,66,230,
+  177,138,244,103,7,106,130,175,33,188,24,113,202,164,87,59,126,147,96,109,232,45,142,
+  157,164,105,187,110,243,108,69,237,243,13,133,197,163,19,57,205,210,213,157,159,41,168,
+  30,254,136,64,102,176,42,244,31,7,72,2,182,129,182,224,118,200,38,214,154,222,235,
+  24,79,74,180,55,55,86,150,190,238,240,76,68,53,243,87,5,254,131,0,97,192,40,
+  80,30,188,8,113,198,164,82,251,125,131,97,161,232,120,78,162,180,121,183,98,246,169,
+  134,254,226,192,73,144,54,236,22,205,206,213,148,95,47,120,28,34,137,217,166,218,250,
+  219,3,27,65,203,112,87,100,62,171,80,127,124,32,33,216,24,90,138,187,39,51,90,
+  149,251,47,3,92,1,249,192,66,208,49,156,20,105,207,110,212,44,95,93,248,57,130,
+  146,225,173,136,125,166,161,186,248,115,2,165,193,187,16,115,76,37,245,219,7,27,66,
+  139,113,167,100,122,171,99,63,105,208,46,220,28,89,201,250,214,195,30,209,200,92,86,
+  185,254,242,192,69,144,51,44,21,221,207,25,148,10,239,71,12,50,133,213,163,31,57,
+  200,18,214,141,158,229,168,75,62,183,80,118,188,38,241,218,196,91,19,123,77,227,117,
+  137,231,38,202,154,215,43,30,159,72,104,54,174,150,252,110,193,236,80,77,252,53,129,
+  215,32,94,152,56,106,146,175,45,188,29,177,201,180,86,247,126,198,160,82,248,61,130,
+  145,161,172,120,125,226,161,137,184,102,242,170,197,191,19,48,13,212,5,159,67,40,49,
+  222,148,88,111,122,172,35,61,217,209,154,220,107,25,239,74,204,55,21,214,143,30,228,
+  8,75,70,183,114,246,165,134,251,34,195,89,145,250,236,67,13,241,197,132,83,35,125,
+  217,225,154,200,107,22,175,78,252,52,65,215,112,94,164,56,123,82,163,125,185,225,178,
+  200,117,150,167,46,250,156,67,41,241,222,196,88,83,122,189,227,49,137,212,102,223,106,
+  216,47,26,156,11,41,199,94,210,184,93,178,185,181,178,247,53,134,151,34,238,153,140,
+  106,229,239,11,12,7,69,194,179,17,181,204,119,21,230,143,10,228,7,11,66,135,113,
+  162,164,121,187,98,243,105,133,238,227,12,73,197,246,211,6,221,194,217,145,154,236,107,
+  13,239,69,140,51,37,213,219,31,27,72,11,118,135,102,226,170,201,191,22,240,14,196,
+  4,83,67,125,241,225,132,72,99,118,169,230,254,202,192,87,16,62,140,16,101,204,43,
+  21,223,79,24,52,10,151,71,46,178,156,117,169,231,62,202,144,87,44,62,157,208,105,
+  156,46,233,220,78,217,244,90,199,123,18,163,77,185,245,178,199,53,146,151,45,174,157,
+  188,105,177,238,244,76,71,117,242,167,5,186,131,51,33,213,216,95,26,184,11,50,135,
+  85,162,191,57,176,18,244,13,135,69,162,179,57,181,210,247,29,134,137,162,230,249,138,
+  194,231,17,138,140,103,37,234,155,15,43,68,31,115,72,37,246,155,6,235,66,207,113,
+  148,36,111,91,108,59,109,211,109,157,237,169,141,190,229,176,75,52,55,87,86,190,190,
+  240,112,68,36,51,91,85,251,127,3,96,1,232,0,78,128,52,96,23,104,14,174,132,
+  124,99,97,233,232,78,206,180,84,119,127,102,160,42,248,31,2,136,1,166,128,122,224,
+  35,8,25,198,138,210,231,29,138,137,167,38,250,154,195,43,17,223,76,88,53,250,151,
+  3,46,129,220,96,89,232,58,206,147,20,109,207,109,148,45,175,93,188,57,177,210,244,
+  93,135,121,162,162,249,185,130,242,225,133,136,99,38,169,218,254,219,0,91,64,59,112,
+  19,100,13,235,69,143,115,36,37,219,91,27,123,75,99,119,105,230,174,202,252,87,1,
+  254,128,64,96,48,40,20,30,143,72,100,54,171,86,255,126,192,32,80,24,60,10,145,
+  199,44,82,157,253,169,129,190,224,112,72,36,54,155,86,235,126,207,96,84,40,63,94,
+  144,56,108,18,173,205,189,149,177,175,52,124,23,97,206,168,84,126,191,96,112,40,36,
+  30,155,72,107,118,175,102,252,42,193,223,16,88,12,58,133,211,35,29,217,201,154,214,
+  235,30,207,72,84,54,191,86,240,62,196,16,83,76,61,245,209,135,28,98,137,233,166,
+  206,250,212,67,31,113,200,36,86,155,126,235,96,79,104,52,46,151,92,110,185,236,114,
+  205,229,149,139,47,39,92,26,185,203,50,215,85,158,191,40,112,30,164,8,123,70,163,
+  114,249,229,130,203,33,151,88,110,186,172,115,61,229,209,139,28,103,73,234,182,207,54,
+  212,22,223,78,216,52,90,151,123,46,163,92,121,249,226,194,201,145,150,236,110,205,236,
+  85,141,255,37,128,27,32,11,88,7,122,130,163,33,185,216,114,218,165,155,59,43,83,
+  95,125,248,33,130,152,97,170,168,127,62,160,16,120,12,34,133,217,163,26,249,203,2,
+  215,65,158,176,104,116,46,167,92,122,185,227,50,201,213,150,223,46,216,28,90,137,251,
+  38,195,90,209,251,28,67,73,241,246,196,70,211,114,221,229,153,
+};
+
+#ifdef PROTOTYPES
+
+#   if !defined        WORDS_BIGENDIAN
+/* little endian */
+static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
+  0x60008001UL,0x1E002800UL,0x06600880UL,0x81FE02A8UL,0x28606080UL,
+  0x889E1E28UL,0xAAAE6668UL,0xE0017FFCUL,0x36004800UL,0x0EE01680UL,
+  0x835604C8UL,0x48E0E17EUL,0x96B63648UL,0xCCC6EEF6UL,0x9FFDD552UL,
+  0x7E00A801UL,0x18602080UL,0x879E0A28UL,0xA99E6228UL,0xA0FE7EA8UL,
+  0x22307840UL,0x4AAF1994UL,0xD60137FCUL,0x38E05E80UL,0x8DB61248UL,
+  0xCBB6E5B6UL,0xDE56D736UL,0x5A70D8BEUL,0x533B3BA4UL,0xE1FD7D53UL,
+  0x66608881UL,0x9FFE2AA8UL,0x2E006800UL,0x09601C80UL,0x82CE06E8UL,
+  0x689F61D4UL,0x9CAE2E68UL,0xEEE1697CUL,0xB5564CC8UL,0x4600F7FEUL,
+  0x15E03280UL,0x84260F88UL,0x094BE31AUL,0xB2C646F7UL,0x879DF5D2UL,
+  0xF99EA229UL,0xB1FE42A8UL,0x27607480UL,0x8BAE1A68UL,0xEA51673CUL,
+  0xF4314FBCUL,0x724F4714UL,0x5BB725B4UL,0xF356BB36UL,0x53E0C57EUL,
+  0x91C63D08UL,0x8D6DEC92UL,0xBB8DA5EDUL,0x355BB325UL,0x7E0357FBUL,
+  0x4860E081UL,0x969E3628UL,0xACCE6EE8UL,0x61FF7D54UL,0x1E602880UL,
+  0x867E08A8UL,0x29F862A0UL,0xA8E19E82UL,0xA0B67E48UL,0xC226F876UL,
+  0x1CABD19AUL,0x36E0497FUL,0x8ED616C8UL,0x4B58E4DEUL,0x3663B77AUL,
+  0xDEFED6A9UL,0x3A5058C0UL,0xCD3113BCUL,0x7F9F55D4UL,0x981E2028UL,
+  0xAF866A08UL,0x8119FC22UL,0x0857E0CAUL,0x6290863EUL,0xDE8D29ECUL,
+  0x2A4B98E5UL,0xB8365FB7UL,0xC58EF216UL,0x7D3B53A4UL,0xE89D61D3UL,
+  0xE4AE8E69UL,0xF7614B7CUL,0xB2AE4668UL,0xE78175FCUL,0x37984A20UL,
+  0x2E9F962AUL,0x894E1CE8UL,0x6AC766F4UL,0xBC1DAFD2UL,0xF4C6B109UL,
+  0x927DC752UL,0x7DB8ADA1UL,0xB8B5A1B2UL,0x95A63277UL,0x0C33EFBAUL,
+  0x13CFC515UL,0x45CF0D14UL,0x552F3394UL,0xD0193FDCUL,0x1907DC0AUL,
+  0xA7D18AC2UL,0xE3897A1CUL,0xD6DAC926UL,0x48DB1EDBUL,0x66BB765BUL,
+  0xEFC56AF3UL,0xC50D0C13UL,0x2D1393C5UL,0x9995DDCDUL,0x1FFC2AAFUL,
+  0x5600C801UL,0x10E03E80UL,0x85360C48UL,0xC91EE3D6UL,0xBED656C8UL,
+  0x4458F0DEUL,0x3553B33AUL,0x9E01D7FDUL,0x2E606880UL,0x897E1CA8UL,
+  0x2AC866E0UL,0xE81E9FD6UL,0xB4864E08UL,0x8669F762UL,0x49FCE2AEUL,
+  0x46E0F681UL,0x95D632C8UL,0x4C28EF9EUL,0x77C8B51EUL,0xFA8EA616UL,
+  0x710B43E4UL,0xAB5264C7UL,0xB061BF7DUL,0xA71E7428UL,0xA3B67A48UL,
+  0xC2D6F936UL,0x5C98D1DEUL,0x32EFB96AUL,0xCF9515CCUL,0x0F1C142FUL,
+  0xD336C449UL,0xD9FEDD56UL,0x3BE05A80UL,0x8D461308UL,0x8B85E5F2UL,
+  0xDA592723UL,0x1B33DBBAUL,0x177FCB55UL,0x04A80E60UL,0x6160837EUL,
+  0x9E4E28E8UL,0x6E7768B4UL,0xFD7AACA6UL,0xC08901E3UL,0xDC2AD066UL,
+  0x0AC8191FUL,0xE21E87D6UL,0xB6A64988UL,0x06C3F6FAUL,0x51DCC2D1UL,
+  0xC16AFC99UL,0x0C4C10EFUL,0x13D7C535UL,0x65C88D1EUL,0xFF2EAB96UL,
+  0xF039405CUL,0x930DC412UL,0x3DF3AD45UL,0x1CA3D185UL,0xD6E2C979UL,
+  0xE8D69EC9UL,0x54B8CE5EUL,0xB065BF72UL,0x571F342BUL,0x90B63E48UL,
+  0xCD26EC76UL,0x1F9BD5DAUL,0x761F482BUL,0x9AE62688UL,0x0F17EBCAUL,
+  0x6334844EUL,0xAEFE6957UL,0x21507CC0UL,0xCA4118FCUL,0x3E3457B0UL,
+  0xBC6E5097UL,0xE4DD712CUL,0xE77A8B59UL,0xC7A90A63UL,0x5D90D23EUL,
+  0xD2BD39ACUL,0x69849DF1UL,0xECF96EA3UL,0x95F1CD42UL,0x6C236F84UL,
+  0xCDCAED19UL,0x8FAE1597UL,0xEB11643CUL,0xF4754F4CUL,0x825A0727UL,
+  0x58B321BBUL,0x03A7FA75UL,0x20D3813AUL,0x9A39D85DUL,0x8F2DEB92UL,
+  0xBB39A45DUL,0x857DF352UL,0x7908A3E1UL,0xF9D2A2C6UL,0xA1E9829DUL,
+  0x4264F88EUL,0x64BF71ABUL,0x1F642B70UL,0x762F486BUL,0xDAE9269CUL,
+  0x5B14DBCEUL,0x23747B4FUL,0xBAEA5967UL,0x151433CFUL,0x34144FCFUL,
+  0x3E44570FUL,0xFC7550B3UL,0x80DA0127UL,0x583B205BUL,0xE38D7A13UL,
+  0x26DB8925UL,0x7BDB5ADBUL,0x694B631BUL,0xACC66EF7UL,0x81FDFD52UL,
+  0x7860A081UL,0x999E2228UL,0xAFFE6AA8UL,0x21007C00UL,0x0A5018C0UL,
+  0xC23107BCUL,0x7CAF5194UL,0xD8E1217CUL,0xBBB65A48UL,0xC556F336UL,
+  0x5D00D3FEUL,0x129039C0UL,0xC58D0DECUL,0x2D3B93A5UL,0xF99D5DD3UL,
+  0xE1FE82A9UL,0x36604880UL,0x8EFE16A8UL,0x2B5064C0UL,0xC8611F7CUL,
+  0xBE9E5628UL,0xA44E70E8UL,0x63577B34UL,0x7EE0A97EUL,0x985620C8UL,
+  0x4F90EA3EUL,0xD71D342CUL,0xE8B69E49UL,0xD4A6CE76UL,0x1863DF7AUL,
+  0xD79ECA29UL,0xB89E5E28UL,0xA5AE7268UL,0xE3317BBCUL,0x76FF4954UL,
+  0x1AD026C0UL,0xC7190BDCUL,0x1DB7D24AUL,0xE6B689B6UL,0xD7C6CAF6UL,
+  0x988DDE12UL,0x3FABAA65UL,0x3C10503FUL,0xCCC5110CUL,0xCFFD1553UL,
+  0x6F009401UL,0x1D302C40UL,0x469F09D4UL,0x95CE32E8UL,0x6C2F6F94UL,
+  0xDDC92D1CUL,0xDAAED996UL,0xFB015BFCUL,0x31704340UL,0x4F4B14E4UL,
+  0xA7267477UL,0x03BBFA5AUL,0xF0D54133UL,0x0338045FUL,0xA0FD8152UL,
+  0x7230B841UL,0x5BAF2594UL,0xD3513B3CUL,0xF9E15D7CUL,0xB1E64288UL,
+  0x0767F48AUL,0x21AF826AUL,0xCA7118BCUL,0x7E3B57A4UL,0xE86D6093UL,
+  0xA49D8E2DUL,0xF36EBB69UL,0xF3ED456CUL,0xA3C5850DUL,0xD2CD3913UL,
+  0x299F9DD5UL,0x88FE1EA8UL,0x2AB06640UL,0x48071FF4UL,0xB681B602UL,
+  0x26C876E0UL,0xEBDE9AD6UL,0xB44A4F18UL,0x96563737UL,0x4CF0EEBEUL,
+  0x57F33544UL,0x0083FE05UL,0x5028C061UL,0x7108BC1EUL,0xFB52A4C6UL,
+  0xA161837DUL,0xA24E78E8UL,0x62B779B4UL,0xFE86A9F6UL,0x9049C0E2UL,
+  0xCD16EC36UL,0x5F94D5CEUL,0x221C782FUL,0xDAA6D989UL,0x1B03DBFAUL,
+  0x5770CB41UL,0x50AB3E64UL,0x21207C7FUL,0x8A5A18D8UL,0x5A3327BBUL,
+  0x032FFB95UL,0xC0F9015CUL,0x9C31D042UL,0x6ECF6914UL,0x5D5F2CD4UL,
+  0x928239F8UL,0x7D88ADE1UL,0xF8BAA1A6UL,0xC1A50273UL,0x4C7310BBUL,
+  0x07DBF525UL,0x718B421BUL,0xAB7A64A7UL,0xD0693F63UL,0x591CDC2EUL,
+  0xC3D6FAC9UL,0x5CC8D11EUL,0xF2FEB956UL,0x339045C0UL,0xCFDD152CUL,
+  0xEF0A9419UL,0x85320C47UL,0x391FA3D5UL,0x8DD612C8UL,0x4BA8E59EUL,
+  0x7650B73EUL,0xDAF126BCUL,0x7B135BC4UL,0x8975E34DUL,0x9ACA26E7UL,
+  0x9F1E2BD7UL,0xAE366848UL,0xC16EFC96UL,0xFC4D50ECUL,0x20D78135UL,
+  0x6A38985EUL,0xBC2DAF92UL,0xB4C9B11DUL,0xC67EF756UL,0x3DF852A0UL,
+  0xACA19182UL,0xA1E27D78UL,0xF266B889UL,0x13BFC5AAUL,0x05D40D30UL,
+  0x3128439FUL,0x6F5894DEUL,0x3D23AC7AUL,0xDC9AD1D9UL,0x4AEF196BUL,
+  0xD61537CCUL,0x08E41E8FUL,0x72B7464BUL,0xFB86A5F6UL,0x9159C322UL,
+  0x0D43ECFAUL,0x5384C5F1UL,0xE1D97D23UL,0x166BC89AUL,0x34FC4EAFUL,
+  0x5E70D741UL,0x527B38A4UL,0xE1B97DA3UL,0x9675C8B2UL,0x9CFA2EA7UL,
+  0xDEF12943UL,0x7A5358C4UL,0x8931E3BDUL,0x6ADF66D4UL,0x9C1A2FD8UL,
+  0x5EC7290BUL,0xB25DB8D2UL,0xF7B2B5B9UL,0x22978635UL,0x6A8C99EEUL,
+  0x0C0BEFE5UL,0xB3C24507UL,0x77CCB511UL,0x0A8FE615UL,0x420B07E4UL,
+  0xA4A27187UL,0xF362BB79UL,0xE3EE8569UL,0xF6C5490CUL,0xC2DD06D3UL,
+  0xEC9A91D9UL,0x45EF0D6BUL,0xD525338CUL,0x481B1FDBUL,0x6687760BUL,
+  0xBFC9AAE2UL,0xC40EF016UL,0x7D435304UL,0x4884E1F1UL,0xE6A97663UL,
+  0x57C0CAFEUL,0x108C3E10UL,0x152BCC65UL,0x34184FDFUL,0x2E47970AUL,
+  0xA9759CB2UL,0x90CA3EE7UL,0x9D3E2C57UL,0x2E9C69D0UL,0xD94EDCE9UL,
+  0x7BC75AF4UL,0xB94DA312UL,0x35C7B2F5UL,0xAE2D9792UL,0xB169BC9DUL,
+  0x474CF4EEUL,0x05A7F275UL,0x213383BAUL,0x1A5FD8D5UL,0x87320BB8UL,
+  0x39BFA255UL,0x0DF412B0UL,0xB3A24587UL,0xF7D2B539UL,0xA289861DUL,
+  0xC28AF9E6UL,0x8C8A11E7UL,0x9BEA2567UL,0x1F442B0FUL,0xF6254873UL,
+  0x42EB069BUL,0x249471CFUL,0x3B6C5B6FUL,0x9D6DD36DUL,0xBE8DA9EDUL,
+  0x344BB0E5UL,0xBE565737UL,0x4470F0BEUL,0x555B3324UL,0x60037FFBUL,
+  0x4E00E801UL,0x17603480UL,0x84AE0E68UL,0xE961637CUL,0xB4CE4EE8UL,
+  0x667F7754UL,0x1FF82AA0UL,0xA6018802UL,0x23E07A80UL,0x8AC61908UL,
+  0x8A1DE7D2UL,0xFA26A789UL,0x112BC39AUL,0x35584CDFUL,0x2E0397FAUL,
+  0x5960DC81UL,0x93CE3AE8UL,0x6DCF6D14UL,0x5DAF2D94UL,0xD2B139BCUL,
+  0x79875DF4UL,0xB9F9A2A2UL,0x85E1F282UL,0xA9266388UL,0x00DBFEDAUL,
+  0x703B405BUL,0xEB0D6413UL,0x24738F45UL,0x1B5BDB25UL,0x77634B7BUL,
+  0xCAAEE669UL,0xFE0157FCUL,0x30604080UL,0x8F1E1428UL,0xAB366448UL,
+  0xC07EFF56UL,0x3C185020UL,0x2CC7910AUL,0xA9FD9D52UL,0x70E0BE81UL,
+  0x9B362448UL,0xCF7EEB56UL,0x3F285460UL,0x6C38905EUL,0xBDCDAD12UL,
+  0x34AFB195UL,0xCE61177CUL,0xBF7E54A8UL,0x24287060UL,0x6B489B1EUL,
+  0xFC66AF76UL,0x10DFC12AUL,0x853A0C58UL,0xD91D23D3UL,0xEBD69AC9UL,
+  0x5448CF1EUL,0xF056BF36UL,0x5310C43EUL,0xD1F53D4CUL,0x89621C87UL,
+  0xFACEA6E9UL,0x711F43D4UL,0x9B5624C8UL,0x4F60EB7EUL,0x972E3468UL,
+  0xECB96E5CUL,0x95E5CD72UL,0x5C272F8BUL,0x32CBB91AUL,0xBF9E55D7UL,
+  0xA41E7028UL,0xA3467B08UL,0x82E5F972UL,0x589721CBUL,0x73ACBA6EUL,
+  0x8BD1E53DUL,0xEA49671CUL,0xD436CFB6UL,0xD84EDF16UL,0x7B975A34UL,
+  0x795CA32EUL,0xC9C2E2F9UL,0x6EEC9691UL,0x8D55ECCDUL,0x1B8025FFUL,
+  0x07580B20UL,0x21A3827AUL,0xDA72D8B9UL,0x2B3B9BA5UL,0xF87D5F53UL,
+  0x61988221UL,0x3E7FA8AAUL,0x0C7810A0UL,0xA3D98522UL,0x02CBF91AUL,
+  0xB09E41D7UL,0xA72E7468UL,0xE3B97A5CUL,0x96D5C932UL,0x1CD82EDFUL,
+  0x26FB895AUL,0xFBD15AC3UL,0xF149431CUL,0xD346C4F6UL,0x99E5DD72UL,
+  
+};
+#   endif
+#   if defined WORDS_BIGENDIAN
+/* big endian */
+static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
+  0x01800060UL,0x0028001EUL,0x80086006UL,0xA802FE81UL,0x80606028UL,
+  0x281E9E88UL,0x6866AEAAUL,0xFC7F01E0UL,0x00480036UL,0x8016E00EUL,
+  0xC8045683UL,0x7EE1E048UL,0x4836B696UL,0xF6EEC6CCUL,0x52D5FD9FUL,
+  0x01A8007EUL,0x80206018UL,0x280A9E87UL,0x28629EA9UL,0xA87EFEA0UL,
+  0x40783022UL,0x9419AF4AUL,0xFC3701D6UL,0x805EE038UL,0x4812B68DUL,
+  0xB6E5B6CBUL,0x36D756DEUL,0xBED8705AUL,0xA43B3B53UL,0x537DFDE1UL,
+  0x81886066UL,0xA82AFE9FUL,0x0068002EUL,0x801C6009UL,0xE806CE82UL,
+  0xD4619F68UL,0x682EAE9CUL,0x7C69E1EEUL,0xC84C56B5UL,0xFEF70046UL,
+  0x8032E015UL,0x880F2684UL,0x1AE34B09UL,0xF746C6B2UL,0xD2F59D87UL,
+  0x29A29EF9UL,0xA842FEB1UL,0x80746027UL,0x681AAE8BUL,0x3C6751EAUL,
+  0xBC4F31F4UL,0x14474F72UL,0xB425B75BUL,0x36BB56F3UL,0x7EC5E053UL,
+  0x083DC691UL,0x92EC6D8DUL,0xEDA58DBBUL,0x25B35B35UL,0xFB57037EUL,
+  0x81E06048UL,0x28369E96UL,0xE86ECEACUL,0x547DFF61UL,0x8028601EUL,
+  0xA8087E86UL,0xA062F829UL,0x829EE1A8UL,0x487EB6A0UL,0x76F826C2UL,
+  0x9AD1AB1CUL,0x7F49E036UL,0xC816D68EUL,0xDEE4584BUL,0x7AB76336UL,
+  0xA9D6FEDEUL,0xC058503AUL,0xBC1331CDUL,0xD4559F7FUL,0x28201E98UL,
+  0x086A86AFUL,0x22FC1981UL,0xCAE05708UL,0x3E869062UL,0xEC298DDEUL,
+  0xE5984B2AUL,0xB75F36B8UL,0x16F28EC5UL,0xA4533B7DUL,0xD3619DE8UL,
+  0x698EAEE4UL,0x7C4B61F7UL,0x6846AEB2UL,0xFC7581E7UL,0x204A9837UL,
+  0x2A969F2EUL,0xE81C4E89UL,0xF466C76AUL,0xD2AF1DBCUL,0x09B1C6F4UL,
+  0x52C77D92UL,0xA1ADB87DUL,0xB2A1B5B8UL,0x7732A695UL,0xBAEF330CUL,
+  0x15C5CF13UL,0x140DCF45UL,0x94332F55UL,0xDC3F19D0UL,0x0ADC0719UL,
+  0xC28AD1A7UL,0x1C7A89E3UL,0x26C9DAD6UL,0xDB1EDB48UL,0x5B76BB66UL,
+  0xF36AC5EFUL,0x130C0DC5UL,0xC593132DUL,0xCDDD9599UL,0xAF2AFC1FUL,
+  0x01C80056UL,0x803EE010UL,0x480C3685UL,0xD6E31EC9UL,0xC856D6BEUL,
+  0xDEF05844UL,0x3AB35335UL,0xFDD7019EUL,0x8068602EUL,0xA81C7E89UL,
+  0xE066C82AUL,0xD69F1EE8UL,0x084E86B4UL,0x62F76986UL,0xAEE2FC49UL,
+  0x81F6E046UL,0xC832D695UL,0x9EEF284CUL,0x1EB5C877UL,0x16A68EFAUL,
+  0xE4430B71UL,0xC76452ABUL,0x7DBF61B0UL,0x28741EA7UL,0x487AB6A3UL,
+  0x36F9D6C2UL,0xDED1985CUL,0x6AB9EF32UL,0xCC1595CFUL,0x2F141C0FUL,
+  0x49C436D3UL,0x56DDFED9UL,0x805AE03BUL,0x0813468DUL,0xF2E5858BUL,
+  0x232759DAUL,0xBADB331BUL,0x55CB7F17UL,0x600EA804UL,0x7E836061UL,
+  0xE8284E9EUL,0xB468776EUL,0xA6AC7AFDUL,0xE30189C0UL,0x66D02ADCUL,
+  0x1F19C80AUL,0xD6871EE2UL,0x8849A6B6UL,0xFAF6C306UL,0xD1C2DC51UL,
+  0x99FC6AC1UL,0xEF104C0CUL,0x35C5D713UL,0x1E8DC865UL,0x96AB2EFFUL,
+  0x5C4039F0UL,0x12C40D93UL,0x45ADF33DUL,0x85D1A31CUL,0x79C9E2D6UL,
+  0xC99ED6E8UL,0x5ECEB854UL,0x72BF65B0UL,0x2B341F57UL,0x483EB690UL,
+  0x76EC26CDUL,0xDAD59B1FUL,0x2B481F76UL,0x8826E69AUL,0xCAEB170FUL,
+  0x4E843463UL,0x5769FEAEUL,0xC07C5021UL,0xFC1841CAUL,0xB057343EUL,
+  0x97506EBCUL,0x2C71DDE4UL,0x598B7AE7UL,0x630AA9C7UL,0x3ED2905DUL,
+  0xAC39BDD2UL,0xF19D8469UL,0xA36EF9ECUL,0x42CDF195UL,0x846F236CUL,
+  0x19EDCACDUL,0x9715AE8FUL,0x3C6411EBUL,0x4C4F75F4UL,0x27075A82UL,
+  0xBB21B358UL,0x75FAA703UL,0x3A81D320UL,0x5DD8399AUL,0x92EB2D8FUL,
+  0x5DA439BBUL,0x52F37D85UL,0xE1A30879UL,0xC6A2D2F9UL,0x9D82E9A1UL,
+  0x8EF86442UL,0xAB71BF64UL,0x702B641FUL,0x6B482F76UL,0x9C26E9DAUL,
+  0xCEDB145BUL,0x4F7B7423UL,0x6759EABAUL,0xCF331415UL,0xCF4F1434UL,
+  0x0F57443EUL,0xB35075FCUL,0x2701DA80UL,0x5B203B58UL,0x137A8DE3UL,
+  0x2589DB26UL,0xDB5ADB7BUL,0x1B634B69UL,0xF76EC6ACUL,0x52FDFD81UL,
+  0x81A06078UL,0x28229E99UL,0xA86AFEAFUL,0x007C0021UL,0xC018500AUL,
+  0xBC0731C2UL,0x9451AF7CUL,0x7C21E1D8UL,0x485AB6BBUL,0x36F356C5UL,
+  0xFED3005DUL,0xC0399012UL,0xEC0D8DC5UL,0xA5933B2DUL,0xD35D9DF9UL,
+  0xA982FEE1UL,0x80486036UL,0xA816FE8EUL,0xC064502BUL,0x7C1F61C8UL,
+  0x28569EBEUL,0xE8704EA4UL,0x347B5763UL,0x7EA9E07EUL,0xC8205698UL,
+  0x3EEA904FUL,0x2C341DD7UL,0x499EB6E8UL,0x76CEA6D4UL,0x7ADF6318UL,
+  0x29CA9ED7UL,0x285E9EB8UL,0x6872AEA5UL,0xBC7B31E3UL,0x5449FF76UL,
+  0xC026D01AUL,0xDC0B19C7UL,0x4AD2B71DUL,0xB689B6E6UL,0xF6CAC6D7UL,
+  0x12DE8D98UL,0x65AAAB3FUL,0x3F50103CUL,0x0C11C5CCUL,0x5315FDCFUL,
+  0x0194006FUL,0x402C301DUL,0xD4099F46UL,0xE832CE95UL,0x946F2F6CUL,
+  0x1C2DC9DDUL,0x96D9AEDAUL,0xFC5B01FBUL,0x40437031UL,0xE4144B4FUL,
+  0x777426A7UL,0x5AFABB03UL,0x3341D5F0UL,0x5F043803UL,0x5281FDA0UL,
+  0x41B83072UL,0x9425AF5BUL,0x3C3B51D3UL,0x7C5DE1F9UL,0x8842E6B1UL,
+  0x8AF46707UL,0x6A82AF21UL,0xBC1871CAUL,0xA4573B7EUL,0x93606DE8UL,
+  0x2D8E9DA4UL,0x69BB6EF3UL,0x6C45EDF3UL,0x0D85C5A3UL,0x1339CDD2UL,
+  0xD59D9F29UL,0xA81EFE88UL,0x4066B02AUL,0xF41F0748UL,0x02B681B6UL,
+  0xE076C826UL,0xD69ADEEBUL,0x184F4AB4UL,0x37375696UL,0xBEEEF04CUL,
+  0x4435F357UL,0x05FE8300UL,0x61C02850UL,0x1EBC0871UL,0xC6A452FBUL,
+  0x7D8361A1UL,0xE8784EA2UL,0xB479B762UL,0xF6A986FEUL,0xE2C04990UL,
+  0x36EC16CDUL,0xCED5945FUL,0x2F781C22UL,0x89D9A6DAUL,0xFADB031BUL,
+  0x41CB7057UL,0x643EAB50UL,0x7F7C2021UL,0xD8185A8AUL,0xBB27335AUL,
+  0x95FB2F03UL,0x5C01F9C0UL,0x42D0319CUL,0x1469CF6EUL,0xD42C5F5DUL,
+  0xF8398292UL,0xE1AD887DUL,0xA6A1BAF8UL,0x7302A5C1UL,0xBB10734CUL,
+  0x25F5DB07UL,0x1B428B71UL,0xA7647AABUL,0x633F69D0UL,0x2EDC1C59UL,
+  0xC9FAD6C3UL,0x1ED1C85CUL,0x56B9FEF2UL,0xC0459033UL,0x2C15DDCFUL,
+  0x19940AEFUL,0x470C3285UL,0xD5A31F39UL,0xC812D68DUL,0x9EE5A84BUL,
+  0x3EB75076UL,0xBC26F1DAUL,0xC45B137BUL,0x4DE37589UL,0xE726CA9AUL,
+  0xD72B1E9FUL,0x486836AEUL,0x96FC6EC1UL,0xEC504DFCUL,0x3581D720UL,
+  0x5E98386AUL,0x92AF2DBCUL,0x1DB1C9B4UL,0x56F77EC6UL,0xA052F83DUL,
+  0x8291A1ACUL,0x787DE2A1UL,0x89B866F2UL,0xAAC5BF13UL,0x300DD405UL,
+  0x9F432831UL,0xDE94586FUL,0x7AAC233DUL,0xD9D19ADCUL,0x6B19EF4AUL,
+  0xCC3715D6UL,0x8F1EE408UL,0x4B46B772UL,0xF6A586FBUL,0x22C35991UL,
+  0xFAEC430DUL,0xF1C58453UL,0x237DD9E1UL,0x9AC86B16UL,0xAF4EFC34UL,
+  0x41D7705EUL,0xA4387B52UL,0xA37DB9E1UL,0xB2C87596UL,0xA72EFA9CUL,
+  0x4329F1DEUL,0xC458537AUL,0xBDE33189UL,0xD466DF6AUL,0xD82F1A9CUL,
+  0x0B29C75EUL,0xD2B85DB2UL,0xB9B5B2F7UL,0x35869722UL,0xEE998C6AUL,
+  0xE5EF0B0CUL,0x0745C2B3UL,0x11B5CC77UL,0x15E68F0AUL,0xE4070B42UL,
+  0x8771A2A4UL,0x79BB62F3UL,0x6985EEE3UL,0x0C49C5F6UL,0xD306DDC2UL,
+  0xD9919AECUL,0x6B0DEF45UL,0x8C3325D5UL,0xDB1F1B48UL,0x0B768766UL,
+  0xE2AAC9BFUL,0x16F00EC4UL,0x0453437DUL,0xF1E18448UL,0x6376A9E6UL,
+  0xFECAC057UL,0x103E8C10UL,0x65CC2B15UL,0xDF4F1834UL,0x0A97472EUL,
+  0xB29C75A9UL,0xE73ECA90UL,0x572C3E9DUL,0xD0699C2EUL,0xE9DC4ED9UL,
+  0xF45AC77BUL,0x12A34DB9UL,0xF5B2C735UL,0x92972DAEUL,0x9DBC69B1UL,
+  0xEEF44C47UL,0x75F2A705UL,0xBA833321UL,0xD5D85F1AUL,0xB80B3287UL,
+  0x55A2BF39UL,0xB012F40DUL,0x8745A2B3UL,0x39B5D2F7UL,0x1D8689A2UL,
+  0xE6F98AC2UL,0xE7118A8CUL,0x6725EA9BUL,0x0F2B441FUL,0x734825F6UL,
+  0x9B06EB42UL,0xCF719424UL,0x6F5B6C3BUL,0x6DD36D9DUL,0xEDA98DBEUL,
+  0xE5B04B34UL,0x375756BEUL,0xBEF07044UL,0x24335B55UL,0xFB7F0360UL,
+  0x01E8004EUL,0x80346017UL,0x680EAE84UL,0x7C6361E9UL,0xE84ECEB4UL,
+  0x54777F66UL,0xA02AF81FUL,0x028801A6UL,0x807AE023UL,0x0819C68AUL,
+  0xD2E71D8AUL,0x89A726FAUL,0x9AC32B11UL,0xDF4C5835UL,0xFA97032EUL,
+  0x81DC6059UL,0xE83ACE93UL,0x146DCF6DUL,0x942DAF5DUL,0xBC39B1D2UL,
+  0xF45D8779UL,0xA2A2F9B9UL,0x82F2E185UL,0x886326A9UL,0xDAFEDB00UL,
+  0x5B403B70UL,0x13640DEBUL,0x458F7324UL,0x25DB5B1BUL,0x7B4B6377UL,
+  0x69E6AECAUL,0xFC5701FEUL,0x80406030UL,0x28141E8FUL,0x486436ABUL,
+  0x56FF7EC0UL,0x2050183CUL,0x0A91C72CUL,0x529DFDA9UL,0x81BEE070UL,
+  0x4824369BUL,0x56EB7ECFUL,0x6054283FUL,0x5E90386CUL,0x12ADCDBDUL,
+  0x95B1AF34UL,0x7C1761CEUL,0xA8547EBFUL,0x60702824UL,0x1E9B486BUL,
+  0x76AF66FCUL,0x2AC1DF10UL,0x580C3A85UL,0xD3231DD9UL,0xC99AD6EBUL,
+  0x1ECF4854UL,0x36BF56F0UL,0x3EC41053UL,0x4C3DF5D1UL,0x871C6289UL,
+  0xE9A6CEFAUL,0xD4431F71UL,0xC824569BUL,0x7EEB604FUL,0x68342E97UL,
+  0x5C6EB9ECUL,0x72CDE595UL,0x8B2F275CUL,0x1AB9CB32UL,0xD7559EBFUL,
+  0x28701EA4UL,0x087B46A3UL,0x72F9E582UL,0xCB219758UL,0x6EBAAC73UL,
+  0x3DE5D18BUL,0x1C6749EAUL,0xB6CF36D4UL,0x16DF4ED8UL,0x345A977BUL,
+  0x2EA35C79UL,0xF9E2C2C9UL,0x9196EC6EUL,0xCDEC558DUL,0xFF25801BUL,
+  0x200B5807UL,0x7A82A321UL,0xB9D872DAUL,0xA59B3B2BUL,0x535F7DF8UL,
+  0x21829861UL,0xAAA87F3EUL,0xA010780CUL,0x2285D9A3UL,0x1AF9CB02UL,
+  0xD7419EB0UL,0x68742EA7UL,0x5C7AB9E3UL,0x32C9D596UL,0xDF2ED81CUL,
+  0x5A89FB26UL,0xC35AD1FBUL,0x1C4349F1UL,0xF6C446D3UL,0x72DDE599UL,
+  
+};
+#   endif
+
+#else  /* PROTOTYPES */
+
+#   if !defined        WORDS_BIGENDIAN
+/* little endian */
+static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
+  0x60008001,0x1E002800,0x06600880,0x81FE02A8,0x28606080,
+  0x889E1E28,0xAAAE6668,0xE0017FFC,0x36004800,0x0EE01680,
+  0x835604C8,0x48E0E17E,0x96B63648,0xCCC6EEF6,0x9FFDD552,
+  0x7E00A801,0x18602080,0x879E0A28,0xA99E6228,0xA0FE7EA8,
+  0x22307840,0x4AAF1994,0xD60137FC,0x38E05E80,0x8DB61248,
+  0xCBB6E5B6,0xDE56D736,0x5A70D8BE,0x533B3BA4,0xE1FD7D53,
+  0x66608881,0x9FFE2AA8,0x2E006800,0x09601C80,0x82CE06E8,
+  0x689F61D4,0x9CAE2E68,0xEEE1697C,0xB5564CC8,0x4600F7FE,
+  0x15E03280,0x84260F88,0x094BE31A,0xB2C646F7,0x879DF5D2,
+  0xF99EA229,0xB1FE42A8,0x27607480,0x8BAE1A68,0xEA51673C,
+  0xF4314FBC,0x724F4714,0x5BB725B4,0xF356BB36,0x53E0C57E,
+  0x91C63D08,0x8D6DEC92,0xBB8DA5ED,0x355BB325,0x7E0357FB,
+  0x4860E081,0x969E3628,0xACCE6EE8,0x61FF7D54,0x1E602880,
+  0x867E08A8,0x29F862A0,0xA8E19E82,0xA0B67E48,0xC226F876,
+  0x1CABD19A,0x36E0497F,0x8ED616C8,0x4B58E4DE,0x3663B77A,
+  0xDEFED6A9,0x3A5058C0,0xCD3113BC,0x7F9F55D4,0x981E2028,
+  0xAF866A08,0x8119FC22,0x0857E0CA,0x6290863E,0xDE8D29EC,
+  0x2A4B98E5,0xB8365FB7,0xC58EF216,0x7D3B53A4,0xE89D61D3,
+  0xE4AE8E69,0xF7614B7C,0xB2AE4668,0xE78175FC,0x37984A20,
+  0x2E9F962A,0x894E1CE8,0x6AC766F4,0xBC1DAFD2,0xF4C6B109,
+  0x927DC752,0x7DB8ADA1,0xB8B5A1B2,0x95A63277,0x0C33EFBA,
+  0x13CFC515,0x45CF0D14,0x552F3394,0xD0193FDC,0x1907DC0A,
+  0xA7D18AC2,0xE3897A1C,0xD6DAC926,0x48DB1EDB,0x66BB765B,
+  0xEFC56AF3,0xC50D0C13,0x2D1393C5,0x9995DDCD,0x1FFC2AAF,
+  0x5600C801,0x10E03E80,0x85360C48,0xC91EE3D6,0xBED656C8,
+  0x4458F0DE,0x3553B33A,0x9E01D7FD,0x2E606880,0x897E1CA8,
+  0x2AC866E0,0xE81E9FD6,0xB4864E08,0x8669F762,0x49FCE2AE,
+  0x46E0F681,0x95D632C8,0x4C28EF9E,0x77C8B51E,0xFA8EA616,
+  0x710B43E4,0xAB5264C7,0xB061BF7D,0xA71E7428,0xA3B67A48,
+  0xC2D6F936,0x5C98D1DE,0x32EFB96A,0xCF9515CC,0x0F1C142F,
+  0xD336C449,0xD9FEDD56,0x3BE05A80,0x8D461308,0x8B85E5F2,
+  0xDA592723,0x1B33DBBA,0x177FCB55,0x04A80E60,0x6160837E,
+  0x9E4E28E8,0x6E7768B4,0xFD7AACA6,0xC08901E3,0xDC2AD066,
+  0x0AC8191F,0xE21E87D6,0xB6A64988,0x06C3F6FA,0x51DCC2D1,
+  0xC16AFC99,0x0C4C10EF,0x13D7C535,0x65C88D1E,0xFF2EAB96,
+  0xF039405C,0x930DC412,0x3DF3AD45,0x1CA3D185,0xD6E2C979,
+  0xE8D69EC9,0x54B8CE5E,0xB065BF72,0x571F342B,0x90B63E48,
+  0xCD26EC76,0x1F9BD5DA,0x761F482B,0x9AE62688,0x0F17EBCA,
+  0x6334844E,0xAEFE6957,0x21507CC0,0xCA4118FC,0x3E3457B0,
+  0xBC6E5097,0xE4DD712C,0xE77A8B59,0xC7A90A63,0x5D90D23E,
+  0xD2BD39AC,0x69849DF1,0xECF96EA3,0x95F1CD42,0x6C236F84,
+  0xCDCAED19,0x8FAE1597,0xEB11643C,0xF4754F4C,0x825A0727,
+  0x58B321BB,0x03A7FA75,0x20D3813A,0x9A39D85D,0x8F2DEB92,
+  0xBB39A45D,0x857DF352,0x7908A3E1,0xF9D2A2C6,0xA1E9829D,
+  0x4264F88E,0x64BF71AB,0x1F642B70,0x762F486B,0xDAE9269C,
+  0x5B14DBCE,0x23747B4F,0xBAEA5967,0x151433CF,0x34144FCF,
+  0x3E44570F,0xFC7550B3,0x80DA0127,0x583B205B,0xE38D7A13,
+  0x26DB8925,0x7BDB5ADB,0x694B631B,0xACC66EF7,0x81FDFD52,
+  0x7860A081,0x999E2228,0xAFFE6AA8,0x21007C00,0x0A5018C0,
+  0xC23107BC,0x7CAF5194,0xD8E1217C,0xBBB65A48,0xC556F336,
+  0x5D00D3FE,0x129039C0,0xC58D0DEC,0x2D3B93A5,0xF99D5DD3,
+  0xE1FE82A9,0x36604880,0x8EFE16A8,0x2B5064C0,0xC8611F7C,
+  0xBE9E5628,0xA44E70E8,0x63577B34,0x7EE0A97E,0x985620C8,
+  0x4F90EA3E,0xD71D342C,0xE8B69E49,0xD4A6CE76,0x1863DF7A,
+  0xD79ECA29,0xB89E5E28,0xA5AE7268,0xE3317BBC,0x76FF4954,
+  0x1AD026C0,0xC7190BDC,0x1DB7D24A,0xE6B689B6,0xD7C6CAF6,
+  0x988DDE12,0x3FABAA65,0x3C10503F,0xCCC5110C,0xCFFD1553,
+  0x6F009401,0x1D302C40,0x469F09D4,0x95CE32E8,0x6C2F6F94,
+  0xDDC92D1C,0xDAAED996,0xFB015BFC,0x31704340,0x4F4B14E4,
+  0xA7267477,0x03BBFA5A,0xF0D54133,0x0338045F,0xA0FD8152,
+  0x7230B841,0x5BAF2594,0xD3513B3C,0xF9E15D7C,0xB1E64288,
+  0x0767F48A,0x21AF826A,0xCA7118BC,0x7E3B57A4,0xE86D6093,
+  0xA49D8E2D,0xF36EBB69,0xF3ED456C,0xA3C5850D,0xD2CD3913,
+  0x299F9DD5,0x88FE1EA8,0x2AB06640,0x48071FF4,0xB681B602,
+  0x26C876E0,0xEBDE9AD6,0xB44A4F18,0x96563737,0x4CF0EEBE,
+  0x57F33544,0x0083FE05,0x5028C061,0x7108BC1E,0xFB52A4C6,
+  0xA161837D,0xA24E78E8,0x62B779B4,0xFE86A9F6,0x9049C0E2,
+  0xCD16EC36,0x5F94D5CE,0x221C782F,0xDAA6D989,0x1B03DBFA,
+  0x5770CB41,0x50AB3E64,0x21207C7F,0x8A5A18D8,0x5A3327BB,
+  0x032FFB95,0xC0F9015C,0x9C31D042,0x6ECF6914,0x5D5F2CD4,
+  0x928239F8,0x7D88ADE1,0xF8BAA1A6,0xC1A50273,0x4C7310BB,
+  0x07DBF525,0x718B421B,0xAB7A64A7,0xD0693F63,0x591CDC2E,
+  0xC3D6FAC9,0x5CC8D11E,0xF2FEB956,0x339045C0,0xCFDD152C,
+  0xEF0A9419,0x85320C47,0x391FA3D5,0x8DD612C8,0x4BA8E59E,
+  0x7650B73E,0xDAF126BC,0x7B135BC4,0x8975E34D,0x9ACA26E7,
+  0x9F1E2BD7,0xAE366848,0xC16EFC96,0xFC4D50EC,0x20D78135,
+  0x6A38985E,0xBC2DAF92,0xB4C9B11D,0xC67EF756,0x3DF852A0,
+  0xACA19182,0xA1E27D78,0xF266B889,0x13BFC5AA,0x05D40D30,
+  0x3128439F,0x6F5894DE,0x3D23AC7A,0xDC9AD1D9,0x4AEF196B,
+  0xD61537CC,0x08E41E8F,0x72B7464B,0xFB86A5F6,0x9159C322,
+  0x0D43ECFA,0x5384C5F1,0xE1D97D23,0x166BC89A,0x34FC4EAF,
+  0x5E70D741,0x527B38A4,0xE1B97DA3,0x9675C8B2,0x9CFA2EA7,
+  0xDEF12943,0x7A5358C4,0x8931E3BD,0x6ADF66D4,0x9C1A2FD8,
+  0x5EC7290B,0xB25DB8D2,0xF7B2B5B9,0x22978635,0x6A8C99EE,
+  0x0C0BEFE5,0xB3C24507,0x77CCB511,0x0A8FE615,0x420B07E4,
+  0xA4A27187,0xF362BB79,0xE3EE8569,0xF6C5490C,0xC2DD06D3,
+  0xEC9A91D9,0x45EF0D6B,0xD525338C,0x481B1FDB,0x6687760B,
+  0xBFC9AAE2,0xC40EF016,0x7D435304,0x4884E1F1,0xE6A97663,
+  0x57C0CAFE,0x108C3E10,0x152BCC65,0x34184FDF,0x2E47970A,
+  0xA9759CB2,0x90CA3EE7,0x9D3E2C57,0x2E9C69D0,0xD94EDCE9,
+  0x7BC75AF4,0xB94DA312,0x35C7B2F5,0xAE2D9792,0xB169BC9D,
+  0x474CF4EE,0x05A7F275,0x213383BA,0x1A5FD8D5,0x87320BB8,
+  0x39BFA255,0x0DF412B0,0xB3A24587,0xF7D2B539,0xA289861D,
+  0xC28AF9E6,0x8C8A11E7,0x9BEA2567,0x1F442B0F,0xF6254873,
+  0x42EB069B,0x249471CF,0x3B6C5B6F,0x9D6DD36D,0xBE8DA9ED,
+  0x344BB0E5,0xBE565737,0x4470F0BE,0x555B3324,0x60037FFB,
+  0x4E00E801,0x17603480,0x84AE0E68,0xE961637C,0xB4CE4EE8,
+  0x667F7754,0x1FF82AA0,0xA6018802,0x23E07A80,0x8AC61908,
+  0x8A1DE7D2,0xFA26A789,0x112BC39A,0x35584CDF,0x2E0397FA,
+  0x5960DC81,0x93CE3AE8,0x6DCF6D14,0x5DAF2D94,0xD2B139BC,
+  0x79875DF4,0xB9F9A2A2,0x85E1F282,0xA9266388,0x00DBFEDA,
+  0x703B405B,0xEB0D6413,0x24738F45,0x1B5BDB25,0x77634B7B,
+  0xCAAEE669,0xFE0157FC,0x30604080,0x8F1E1428,0xAB366448,
+  0xC07EFF56,0x3C185020,0x2CC7910A,0xA9FD9D52,0x70E0BE81,
+  0x9B362448,0xCF7EEB56,0x3F285460,0x6C38905E,0xBDCDAD12,
+  0x34AFB195,0xCE61177C,0xBF7E54A8,0x24287060,0x6B489B1E,
+  0xFC66AF76,0x10DFC12A,0x853A0C58,0xD91D23D3,0xEBD69AC9,
+  0x5448CF1E,0xF056BF36,0x5310C43E,0xD1F53D4C,0x89621C87,
+  0xFACEA6E9,0x711F43D4,0x9B5624C8,0x4F60EB7E,0x972E3468,
+  0xECB96E5C,0x95E5CD72,0x5C272F8B,0x32CBB91A,0xBF9E55D7,
+  0xA41E7028,0xA3467B08,0x82E5F972,0x589721CB,0x73ACBA6E,
+  0x8BD1E53D,0xEA49671C,0xD436CFB6,0xD84EDF16,0x7B975A34,
+  0x795CA32E,0xC9C2E2F9,0x6EEC9691,0x8D55ECCD,0x1B8025FF,
+  0x07580B20,0x21A3827A,0xDA72D8B9,0x2B3B9BA5,0xF87D5F53,
+  0x61988221,0x3E7FA8AA,0x0C7810A0,0xA3D98522,0x02CBF91A,
+  0xB09E41D7,0xA72E7468,0xE3B97A5C,0x96D5C932,0x1CD82EDF,
+  0x26FB895A,0xFBD15AC3,0xF149431C,0xD346C4F6,0x99E5DD72,
+  
+};
+#   endif
+#   if defined WORDS_BIGENDIAN
+/* big endian */
+static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
+  0x01800060,0x0028001E,0x80086006,0xA802FE81,0x80606028,
+  0x281E9E88,0x6866AEAA,0xFC7F01E0,0x00480036,0x8016E00E,
+  0xC8045683,0x7EE1E048,0x4836B696,0xF6EEC6CC,0x52D5FD9F,
+  0x01A8007E,0x80206018,0x280A9E87,0x28629EA9,0xA87EFEA0,
+  0x40783022,0x9419AF4A,0xFC3701D6,0x805EE038,0x4812B68D,
+  0xB6E5B6CB,0x36D756DE,0xBED8705A,0xA43B3B53,0x537DFDE1,
+  0x81886066,0xA82AFE9F,0x0068002E,0x801C6009,0xE806CE82,
+  0xD4619F68,0x682EAE9C,0x7C69E1EE,0xC84C56B5,0xFEF70046,
+  0x8032E015,0x880F2684,0x1AE34B09,0xF746C6B2,0xD2F59D87,
+  0x29A29EF9,0xA842FEB1,0x80746027,0x681AAE8B,0x3C6751EA,
+  0xBC4F31F4,0x14474F72,0xB425B75B,0x36BB56F3,0x7EC5E053,
+  0x083DC691,0x92EC6D8D,0xEDA58DBB,0x25B35B35,0xFB57037E,
+  0x81E06048,0x28369E96,0xE86ECEAC,0x547DFF61,0x8028601E,
+  0xA8087E86,0xA062F829,0x829EE1A8,0x487EB6A0,0x76F826C2,
+  0x9AD1AB1C,0x7F49E036,0xC816D68E,0xDEE4584B,0x7AB76336,
+  0xA9D6FEDE,0xC058503A,0xBC1331CD,0xD4559F7F,0x28201E98,
+  0x086A86AF,0x22FC1981,0xCAE05708,0x3E869062,0xEC298DDE,
+  0xE5984B2A,0xB75F36B8,0x16F28EC5,0xA4533B7D,0xD3619DE8,
+  0x698EAEE4,0x7C4B61F7,0x6846AEB2,0xFC7581E7,0x204A9837,
+  0x2A969F2E,0xE81C4E89,0xF466C76A,0xD2AF1DBC,0x09B1C6F4,
+  0x52C77D92,0xA1ADB87D,0xB2A1B5B8,0x7732A695,0xBAEF330C,
+  0x15C5CF13,0x140DCF45,0x94332F55,0xDC3F19D0,0x0ADC0719,
+  0xC28AD1A7,0x1C7A89E3,0x26C9DAD6,0xDB1EDB48,0x5B76BB66,
+  0xF36AC5EF,0x130C0DC5,0xC593132D,0xCDDD9599,0xAF2AFC1F,
+  0x01C80056,0x803EE010,0x480C3685,0xD6E31EC9,0xC856D6BE,
+  0xDEF05844,0x3AB35335,0xFDD7019E,0x8068602E,0xA81C7E89,
+  0xE066C82A,0xD69F1EE8,0x084E86B4,0x62F76986,0xAEE2FC49,
+  0x81F6E046,0xC832D695,0x9EEF284C,0x1EB5C877,0x16A68EFA,
+  0xE4430B71,0xC76452AB,0x7DBF61B0,0x28741EA7,0x487AB6A3,
+  0x36F9D6C2,0xDED1985C,0x6AB9EF32,0xCC1595CF,0x2F141C0F,
+  0x49C436D3,0x56DDFED9,0x805AE03B,0x0813468D,0xF2E5858B,
+  0x232759DA,0xBADB331B,0x55CB7F17,0x600EA804,0x7E836061,
+  0xE8284E9E,0xB468776E,0xA6AC7AFD,0xE30189C0,0x66D02ADC,
+  0x1F19C80A,0xD6871EE2,0x8849A6B6,0xFAF6C306,0xD1C2DC51,
+  0x99FC6AC1,0xEF104C0C,0x35C5D713,0x1E8DC865,0x96AB2EFF,
+  0x5C4039F0,0x12C40D93,0x45ADF33D,0x85D1A31C,0x79C9E2D6,
+  0xC99ED6E8,0x5ECEB854,0x72BF65B0,0x2B341F57,0x483EB690,
+  0x76EC26CD,0xDAD59B1F,0x2B481F76,0x8826E69A,0xCAEB170F,
+  0x4E843463,0x5769FEAE,0xC07C5021,0xFC1841CA,0xB057343E,
+  0x97506EBC,0x2C71DDE4,0x598B7AE7,0x630AA9C7,0x3ED2905D,
+  0xAC39BDD2,0xF19D8469,0xA36EF9EC,0x42CDF195,0x846F236C,
+  0x19EDCACD,0x9715AE8F,0x3C6411EB,0x4C4F75F4,0x27075A82,
+  0xBB21B358,0x75FAA703,0x3A81D320,0x5DD8399A,0x92EB2D8F,
+  0x5DA439BB,0x52F37D85,0xE1A30879,0xC6A2D2F9,0x9D82E9A1,
+  0x8EF86442,0xAB71BF64,0x702B641F,0x6B482F76,0x9C26E9DA,
+  0xCEDB145B,0x4F7B7423,0x6759EABA,0xCF331415,0xCF4F1434,
+  0x0F57443E,0xB35075FC,0x2701DA80,0x5B203B58,0x137A8DE3,
+  0x2589DB26,0xDB5ADB7B,0x1B634B69,0xF76EC6AC,0x52FDFD81,
+  0x81A06078,0x28229E99,0xA86AFEAF,0x007C0021,0xC018500A,
+  0xBC0731C2,0x9451AF7C,0x7C21E1D8,0x485AB6BB,0x36F356C5,
+  0xFED3005D,0xC0399012,0xEC0D8DC5,0xA5933B2D,0xD35D9DF9,
+  0xA982FEE1,0x80486036,0xA816FE8E,0xC064502B,0x7C1F61C8,
+  0x28569EBE,0xE8704EA4,0x347B5763,0x7EA9E07E,0xC8205698,
+  0x3EEA904F,0x2C341DD7,0x499EB6E8,0x76CEA6D4,0x7ADF6318,
+  0x29CA9ED7,0x285E9EB8,0x6872AEA5,0xBC7B31E3,0x5449FF76,
+  0xC026D01A,0xDC0B19C7,0x4AD2B71D,0xB689B6E6,0xF6CAC6D7,
+  0x12DE8D98,0x65AAAB3F,0x3F50103C,0x0C11C5CC,0x5315FDCF,
+  0x0194006F,0x402C301D,0xD4099F46,0xE832CE95,0x946F2F6C,
+  0x1C2DC9DD,0x96D9AEDA,0xFC5B01FB,0x40437031,0xE4144B4F,
+  0x777426A7,0x5AFABB03,0x3341D5F0,0x5F043803,0x5281FDA0,
+  0x41B83072,0x9425AF5B,0x3C3B51D3,0x7C5DE1F9,0x8842E6B1,
+  0x8AF46707,0x6A82AF21,0xBC1871CA,0xA4573B7E,0x93606DE8,
+  0x2D8E9DA4,0x69BB6EF3,0x6C45EDF3,0x0D85C5A3,0x1339CDD2,
+  0xD59D9F29,0xA81EFE88,0x4066B02A,0xF41F0748,0x02B681B6,
+  0xE076C826,0xD69ADEEB,0x184F4AB4,0x37375696,0xBEEEF04C,
+  0x4435F357,0x05FE8300,0x61C02850,0x1EBC0871,0xC6A452FB,
+  0x7D8361A1,0xE8784EA2,0xB479B762,0xF6A986FE,0xE2C04990,
+  0x36EC16CD,0xCED5945F,0x2F781C22,0x89D9A6DA,0xFADB031B,
+  0x41CB7057,0x643EAB50,0x7F7C2021,0xD8185A8A,0xBB27335A,
+  0x95FB2F03,0x5C01F9C0,0x42D0319C,0x1469CF6E,0xD42C5F5D,
+  0xF8398292,0xE1AD887D,0xA6A1BAF8,0x7302A5C1,0xBB10734C,
+  0x25F5DB07,0x1B428B71,0xA7647AAB,0x633F69D0,0x2EDC1C59,
+  0xC9FAD6C3,0x1ED1C85C,0x56B9FEF2,0xC0459033,0x2C15DDCF,
+  0x19940AEF,0x470C3285,0xD5A31F39,0xC812D68D,0x9EE5A84B,
+  0x3EB75076,0xBC26F1DA,0xC45B137B,0x4DE37589,0xE726CA9A,
+  0xD72B1E9F,0x486836AE,0x96FC6EC1,0xEC504DFC,0x3581D720,
+  0x5E98386A,0x92AF2DBC,0x1DB1C9B4,0x56F77EC6,0xA052F83D,
+  0x8291A1AC,0x787DE2A1,0x89B866F2,0xAAC5BF13,0x300DD405,
+  0x9F432831,0xDE94586F,0x7AAC233D,0xD9D19ADC,0x6B19EF4A,
+  0xCC3715D6,0x8F1EE408,0x4B46B772,0xF6A586FB,0x22C35991,
+  0xFAEC430D,0xF1C58453,0x237DD9E1,0x9AC86B16,0xAF4EFC34,
+  0x41D7705E,0xA4387B52,0xA37DB9E1,0xB2C87596,0xA72EFA9C,
+  0x4329F1DE,0xC458537A,0xBDE33189,0xD466DF6A,0xD82F1A9C,
+  0x0B29C75E,0xD2B85DB2,0xB9B5B2F7,0x35869722,0xEE998C6A,
+  0xE5EF0B0C,0x0745C2B3,0x11B5CC77,0x15E68F0A,0xE4070B42,
+  0x8771A2A4,0x79BB62F3,0x6985EEE3,0x0C49C5F6,0xD306DDC2,
+  0xD9919AEC,0x6B0DEF45,0x8C3325D5,0xDB1F1B48,0x0B768766,
+  0xE2AAC9BF,0x16F00EC4,0x0453437D,0xF1E18448,0x6376A9E6,
+  0xFECAC057,0x103E8C10,0x65CC2B15,0xDF4F1834,0x0A97472E,
+  0xB29C75A9,0xE73ECA90,0x572C3E9D,0xD0699C2E,0xE9DC4ED9,
+  0xF45AC77B,0x12A34DB9,0xF5B2C735,0x92972DAE,0x9DBC69B1,
+  0xEEF44C47,0x75F2A705,0xBA833321,0xD5D85F1A,0xB80B3287,
+  0x55A2BF39,0xB012F40D,0x8745A2B3,0x39B5D2F7,0x1D8689A2,
+  0xE6F98AC2,0xE7118A8C,0x6725EA9B,0x0F2B441F,0x734825F6,
+  0x9B06EB42,0xCF719424,0x6F5B6C3B,0x6DD36D9D,0xEDA98DBE,
+  0xE5B04B34,0x375756BE,0xBEF07044,0x24335B55,0xFB7F0360,
+  0x01E8004E,0x80346017,0x680EAE84,0x7C6361E9,0xE84ECEB4,
+  0x54777F66,0xA02AF81F,0x028801A6,0x807AE023,0x0819C68A,
+  0xD2E71D8A,0x89A726FA,0x9AC32B11,0xDF4C5835,0xFA97032E,
+  0x81DC6059,0xE83ACE93,0x146DCF6D,0x942DAF5D,0xBC39B1D2,
+  0xF45D8779,0xA2A2F9B9,0x82F2E185,0x886326A9,0xDAFEDB00,
+  0x5B403B70,0x13640DEB,0x458F7324,0x25DB5B1B,0x7B4B6377,
+  0x69E6AECA,0xFC5701FE,0x80406030,0x28141E8F,0x486436AB,
+  0x56FF7EC0,0x2050183C,0x0A91C72C,0x529DFDA9,0x81BEE070,
+  0x4824369B,0x56EB7ECF,0x6054283F,0x5E90386C,0x12ADCDBD,
+  0x95B1AF34,0x7C1761CE,0xA8547EBF,0x60702824,0x1E9B486B,
+  0x76AF66FC,0x2AC1DF10,0x580C3A85,0xD3231DD9,0xC99AD6EB,
+  0x1ECF4854,0x36BF56F0,0x3EC41053,0x4C3DF5D1,0x871C6289,
+  0xE9A6CEFA,0xD4431F71,0xC824569B,0x7EEB604F,0x68342E97,
+  0x5C6EB9EC,0x72CDE595,0x8B2F275C,0x1AB9CB32,0xD7559EBF,
+  0x28701EA4,0x087B46A3,0x72F9E582,0xCB219758,0x6EBAAC73,
+  0x3DE5D18B,0x1C6749EA,0xB6CF36D4,0x16DF4ED8,0x345A977B,
+  0x2EA35C79,0xF9E2C2C9,0x9196EC6E,0xCDEC558D,0xFF25801B,
+  0x200B5807,0x7A82A321,0xB9D872DA,0xA59B3B2B,0x535F7DF8,
+  0x21829861,0xAAA87F3E,0xA010780C,0x2285D9A3,0x1AF9CB02,
+  0xD7419EB0,0x68742EA7,0x5C7AB9E3,0x32C9D596,0xDF2ED81C,
+  0x5A89FB26,0xC35AD1FB,0x1C4349F1,0xF6C446D3,0x72DDE599,
+  
+};
+#   endif
+
+#endif /* PROTOTYPES */
</pre></div>
<hr /><a name="file30" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>sector.c</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/sector.c
+++ lxdream/src/drivers/cdrom/sector.c
@@ -0,0 +1,581 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * low-level 'block device' for input to gdrom discs.
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <sys/stat.h>
+#include <glib/gmem.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "drivers/cdrom/sector.h"
+#include "drivers/cdrom/cdrom.h"
+#include "drivers/cdrom/ecc.h"
+
+#define CHECK_READ(dev,lba,count) \
+    if( !IS_SECTOR_SOURCE(dev) ) { \
+        return CDROM_ERROR_NODISC; \
+    } else if( (lba) >= (dev)->size || (lba+block_count) > (dev)->size ) { \
+        return CDROM_ERROR_BADREAD; \
+    }
+
+/* Default read mode for each sector mode */
+const uint32_t cdrom_sector_read_mode[] = { 0,
+        CDROM_READ_CDDA|CDROM_READ_DATA, CDROM_READ_MODE1|CDROM_READ_DATA,
+        CDROM_READ_MODE2|CDROM_READ_DATA, CDROM_READ_MODE2_FORM1|CDROM_READ_DATA,
+        CDROM_READ_MODE2_FORM1|CDROM_READ_DATA,
+        CDROM_READ_MODE2|CDROM_READ_DATA|CDROM_READ_SUBHEADER|CDROM_READ_ECC,
+        CDROM_READ_RAW, CDROM_READ_RAW };
+
+/* Block size for each sector mode */
+const uint32_t cdrom_sector_size[] = { 0, 2352, 2048, 2336, 2048, 2324, 2336, 2352, 2352 };
+
+const char *cdrom_sector_mode_names[] = { "Unknown", "Audio", "Mode 1", "Mode 2", "Mode 2 Form 1", "Mode 2 Form 2",
+        "Mode 2 semiraw", "XA Raw", "Non-XA Raw" };
+
+
+/********************* Public functions *************************/
+cdrom_error_t sector_source_read( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf )
+{
+    CHECK_READ(device,lba,block_count);
+    return device->read_blocks(device, lba, block_count, buf);
+}
+
+cdrom_error_t sector_source_read_sectors( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, cdrom_read_mode_t mode,
+                                          unsigned char *buf, size_t *length )
+{
+    CHECK_READ(device,lba,block_count);
+    return device->read_sectors(device, lba, block_count, mode, buf, length);
+}
+
+void sector_source_ref( sector_source_t device )
+{
+    assert( IS_SECTOR_SOURCE(device) );
+    device->ref_count++;
+}
+
+void sector_source_unref( sector_source_t device )
+{
+    if( device == NULL )
+        return;
+    assert( IS_SECTOR_SOURCE(device) );
+    if( device->ref_count > 0 )
+        device->ref_count--;
+    if( device->ref_count == 0 )
+        device->destroy(device);
+}
+
+void sector_source_release( sector_source_t device )
+{
+    assert( IS_SECTOR_SOURCE(device) );
+    if( device->ref_count == 0 )
+        device->destroy(device);
+}
+
+/************************** Sector mangling ***************************/
+/*
+ * Private functions used to pack/unpack sectors, determine mode, and
+ * evaluate sector reads.
+ */
+
+/** Basic data sector header structure */
+struct cdrom_sector_header {
+    uint8_t sync[12];
+    uint8_t msf[3];
+    uint8_t mode;
+    uint8_t subhead[8]; // Mode-2 XA sectors only
+};
+
+static const uint8_t cdrom_sync_data[12] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0 };
+
+/* Field combinations that are legal for mode 1 or mode 2 (formless) reads */
+static const uint8_t legal_nonxa_fields[] =
+{ TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE,
+  TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE,
+  TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE,
+  FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE };
+
+/* Field combinations that are legal for mode 2 form 1 or form 2 reads */
+static const uint8_t legal_xa_fields[] =
+{ TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE,
+  TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE,
+  TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE,
+  FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE };
+
+/**
+ * Position per sector mode of each of the fields
+ *   sync, header, subheader, data, ecc.
+ *
+ */
+static const uint32_t sector_field_positions[][6] = {
+        { 0, 0, 0, 0, 0, 0 },    /* Unknown */
+        { 0, 0, 0, 0, 2352, 2352 }, /* CDDA */
+        { 0, 12, 16, 16, 2064, 2352 }, /* Mode 1 */
+        { 0, 12, 16, 16, 2352, 2352 }, /* Mode 2 formless */
+        { 0, 12, 16, 24, 2072, 2352 }, /* Mode 2 form 1 */
+        { 0, 12, 16, 24, 2352, 2352 }}; /* Mode 2 form 2 */
+
+
+
+/**
+ * Return CDROM_ERROR_OK if the given read mode + sector modes are compatible,
+ * otherwise either CDROM_ERROR_BADREADMODE or CDROM_ERROR_BADFIELD. Raw sector modes
+ * will return BADREADMODE, as it's impossible to tell.
+ *
+ * @param track_mode one of the CDROM_MODE* constants
+ * @param read_mode the full read mode
+ */
+static cdrom_error_t is_legal_read( sector_mode_t sector_mode, cdrom_read_mode_t read_mode )
+{
+    int read_sector_type = CDROM_READ_TYPE(read_mode);
+    int read_sector_fields = CDROM_READ_FIELDS(read_mode);
+
+    /* Check the sector type is consistent */
+    switch( read_sector_type ) {
+    case CDROM_READ_ANY: break;
+    case CDROM_READ_CDDA:
+        if( sector_mode != SECTOR_CDDA )
+            return CDROM_ERROR_BADREADMODE;
+        break;
+    case CDROM_READ_MODE1:
+    case CDROM_READ_MODE2_FORM1:
+        if( sector_mode != SECTOR_MODE1 && sector_mode != SECTOR_MODE2_FORM1 )
+            return CDROM_ERROR_BADREADMODE;
+        break;
+    case CDROM_READ_MODE2_FORM2:
+        if( sector_mode != SECTOR_MODE2_FORM2 )
+            return CDROM_ERROR_BADREADMODE;
+        break;
+    case CDROM_READ_MODE2:
+        if( sector_mode != SECTOR_MODE2_FORMLESS )
+            return CDROM_ERROR_BADREADMODE;
+        break;
+    default: /* Illegal read mode */
+        return CDROM_ERROR_BADFIELD;
+    }
+
+    /* Check the fields requested are sane per MMC (non-contiguous regions prohibited) */
+    switch( sector_mode ) {
+    case SECTOR_CDDA:
+        return CDROM_ERROR_OK; /* Everything is OK */
+    case SECTOR_MODE2_FORM1:
+    case SECTOR_MODE2_FORM2:
+        if( !legal_xa_fields[read_sector_fields>>11] )
+            return CDROM_ERROR_BADFIELD;
+        else
+            return CDROM_ERROR_OK;
+    case SECTOR_MODE1:
+    case SECTOR_MODE2_FORMLESS:
+        if( !legal_nonxa_fields[read_sector_fields>>11] )
+            return CDROM_ERROR_BADFIELD;
+        else
+            return CDROM_ERROR_OK;
+    default:
+        return CDROM_ERROR_BADFIELD;
+    }
+}
+
+static sector_mode_t identify_sector( sector_mode_t raw_mode, unsigned char *buf )
+{
+    struct cdrom_sector_header *header = (struct cdrom_sector_header *)buf;
+
+    switch( raw_mode ) {
+    case SECTOR_SEMIRAW_MODE2: /* XA sectors */
+    case SECTOR_RAW_XA:
+        switch( header->mode ) {
+        case 1: return SECTOR_MODE1;
+        case 2: return ((header->subhead[2] & 0x20) == 0 ) ? SECTOR_MODE2_FORM1 : SECTOR_MODE2_FORM2;
+        default: return SECTOR_UNKNOWN;
+        }
+    case SECTOR_RAW_NONXA:
+        switch( header->mode ) {
+        case 1: return SECTOR_MODE1;
+        case 2: return SECTOR_MODE2_FORMLESS;
+        default: return SECTOR_UNKNOWN;
+        }
+    default:
+        return raw_mode;
+    }
+}
+
+/**
+ * Read a single raw sector from the device. Generate sync, ECC/EDC data etc where
+ * necessary.
+ */
+static cdrom_error_t read_raw_sector( sector_source_t device, cdrom_lba_t lba, unsigned char *buf )
+{
+    cdrom_error_t err;
+
+    switch( device->mode ) {
+    case SECTOR_RAW_XA:
+    case SECTOR_RAW_NONXA:
+        return device->read_blocks(device, lba, 1, buf);
+    case SECTOR_SEMIRAW_MODE2:
+        memcpy( buf, cdrom_sync_data, 12 );
+        cd_build_address(buf, SECTOR_MODE2_FORMLESS, lba);
+        return device->read_blocks(device, lba, 1, &buf[16]);
+    case SECTOR_MODE1:
+    case SECTOR_MODE2_FORMLESS:
+        err = device->read_blocks(device, lba, 1, &buf[16]);
+        if( err == CDROM_ERROR_OK ) {
+            do_encode_L2( buf, device->mode, lba );
+        }
+        return err;
+    case SECTOR_MODE2_FORM1:
+        *((uint32_t *)(buf+16)) = *((uint32_t *)(buf+20)) = 0;
+        err = device->read_blocks(device, lba, 1, &buf[24]);
+        if( err == CDROM_ERROR_OK ) {
+            do_encode_L2( buf, device->mode, lba );
+        }
+        return err;
+    case SECTOR_MODE2_FORM2:
+        *((uint32_t *)(buf+16)) = *((uint32_t *)(buf+20)) = 0x00200000;
+        err = device->read_blocks(device, lba, 1, &buf[24]);
+        if( err == CDROM_ERROR_OK ) {
+            do_encode_L2( buf, device->mode, lba );
+        }
+        return err;
+    default:
+        abort();
+    }
+}
+
+static cdrom_error_t extract_sector_fields( unsigned char *raw_sector, sector_mode_t mode, int fields, unsigned char *buf, size_t *length )
+{
+    int start=-1,end=0;
+    int i;
+
+    for( i=0; i<5; i++ ) {
+        if( fields & (0x8000>>i) ) {
+            if( start == -1 )
+                start = sector_field_positions[mode][i];
+            else if( end != sector_field_positions[mode][i] )
+                return CDROM_ERROR_BADFIELD;
+            end = sector_field_positions[mode][i+1];
+        }
+    }
+    if( start == -1 ) {
+        *length = 0;
+    } else {
+        memcpy( buf, &raw_sector[start], end-start );
+        *length = end-start;
+    }
+    return CDROM_ERROR_OK;
+}
+
+cdrom_error_t sector_extract_from_raw( unsigned char *raw_sector, cdrom_read_mode_t mode, unsigned char *buf, size_t *length )
+{
+    sector_mode_t sector_mode = identify_sector( SECTOR_RAW_XA, raw_sector );
+    if( sector_mode == SECTOR_UNKNOWN )
+        return CDROM_ERROR_BADREAD;
+    cdrom_error_t status = is_legal_read( sector_mode, mode );
+    if( status != CDROM_ERROR_OK )
+        return status;
+    return extract_sector_fields( raw_sector, sector_mode, CDROM_READ_FIELDS(mode), buf, length );
+}
+
+/**
+ * This is horribly complicated by the need to handle mapping between all possible
+ * sector modes + read modes, but fortunately most sources can just supply
+ * a single block type and not care about the details here.
+ */
+cdrom_error_t default_sector_source_read_sectors( sector_source_t device,
+        cdrom_lba_t lba, cdrom_count_t block_count, cdrom_read_mode_t mode,
+        unsigned char *buf, size_t *length )
+{
+    unsigned char tmp[CDROM_MAX_SECTOR_SIZE];
+    int read_sector_type = CDROM_READ_TYPE(mode);
+    int read_sector_fields = CDROM_READ_FIELDS(mode);
+    int i;
+    size_t len = 0;
+    cdrom_error_t err;
+
+    CHECK_READ(device, lba, count);
+
+    switch(device->mode) {
+    case SECTOR_CDDA:
+        if( read_sector_type != CDROM_READ_ANY && read_sector_type != CDROM_READ_CDDA )
+            return CDROM_ERROR_BADREADMODE;
+        if( read_sector_fields != 0 ) {
+            len = block_count * CDROM_MAX_SECTOR_SIZE;
+            device->read_blocks( device, lba, block_count, buf );
+        }
+        break;
+    case SECTOR_RAW_XA:
+    case SECTOR_RAW_NONXA:
+    case SECTOR_SEMIRAW_MODE2:
+        /* We (may) have to break the raw sector up into requested fields.
+         * Process sectors one at a time
+         */
+        for( i=0; i<block_count; i++ ) {
+            size_t tmplen;
+            err = read_raw_sector( device, lba+i, tmp );
+            if( err != CDROM_ERROR_OK )
+                return err;
+            err = sector_extract_from_raw( tmp, mode, &buf[len], &tmplen );
+            if( err != CDROM_ERROR_OK )
+                return err;
+            len += tmplen;
+        }
+        break;
+    default: /* Data-only blocks */
+        err = is_legal_read( device->mode, mode );
+        if( err != CDROM_ERROR_OK )
+            return err;
+        if( read_sector_fields == 0 ) { /* Read nothing */
+            *length = 0;
+            return CDROM_ERROR_OK;
+        } else if( read_sector_fields == CDROM_READ_DATA ) {
+            /* Data-only */
+            *length = block_count * CDROM_SECTOR_SIZE(device->mode);
+            return device->read_blocks( device, lba, block_count, buf );
+        } else if( read_sector_fields == CDROM_READ_RAW ) {
+            for( i=0; i<block_count; i++ ) {
+                err = read_raw_sector( device, lba+i, &buf[2352*i] );
+                if( err != CDROM_ERROR_OK )
+                    return err;
+            }
+            len = block_count * CDROM_MAX_SECTOR_SIZE;
+        } else {
+            for( i=0; i<block_count; i++ ) {
+                size_t tmplen;
+                err = read_raw_sector( device, lba+i, tmp );
+                if( err != CDROM_ERROR_OK )
+                    return err;
+                err = extract_sector_fields( tmp, device->mode, read_sector_fields, &buf[len], &tmplen );
+                if( err != CDROM_ERROR_OK )
+                    return err;
+                len += tmplen;
+            }
+        }
+    }
+    *length = len;
+    return CDROM_ERROR_OK;
+
+}
+
+/************************ Base implementation *************************/
+
+/**
+ * Default destroy implementation - clears the tag and frees memory.
+ */
+void default_sector_source_destroy( sector_source_t device )
+{
+    assert( device != NULL && device->ref_count == 0 );
+    device->tag = 0;
+    g_free( device );
+}
+
+sector_source_t sector_source_init( sector_source_t device, sector_source_type_t type, sector_mode_t mode, cdrom_count_t size,
+                        sector_source_read_fn_t readfn, sector_source_destroy_fn_t destroyfn )
+{
+    device->tag = SECTOR_SOURCE_TAG;
+    device->ref_count = 0;
+    device->type = type;
+    device->mode = mode;
+    device->size = size;
+    device->read_blocks = readfn;
+    device->read_sectors = default_sector_source_read_sectors;
+    if( destroyfn == NULL )
+        device->destroy = default_sector_source_destroy;
+    else
+        device->destroy = destroyfn;
+    return device;
+}
+
+/************************ Null device implementation *************************/
+cdrom_error_t null_sector_source_read( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf )
+{
+    memset( buf, 0,  block_count*CDROM_SECTOR_SIZE(device->mode) );
+    return CDROM_ERROR_OK;
+}
+
+sector_source_t null_sector_source_new( sector_mode_t mode, cdrom_count_t size )
+{
+    return sector_source_init( g_malloc(sizeof(struct sector_source)), NULL_SECTOR_SOURCE, mode, size,
+            null_sector_source_read, default_sector_source_destroy );
+}
+
+/************************ File device implementation *************************/
+typedef struct file_sector_source {
+    struct sector_source dev;
+    FILE *file;
+    uint32_t offset; /* offset in file where source begins */
+    sector_source_t ref; /* Parent source reference */
+    gboolean closeOnDestroy;
+} *file_sector_source_t;
+
+void file_sector_source_destroy( sector_source_t dev )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(dev,FILE_SECTOR_SOURCE) );
+    file_sector_source_t fdev = (file_sector_source_t)dev;
+
+    if( fdev->closeOnDestroy && fdev->file != NULL ) {
+        fclose( fdev->file );
+    }
+    sector_source_unref( fdev->ref );
+    fdev->file = NULL;
+    default_sector_source_destroy(dev);
+}
+
+cdrom_error_t file_sector_source_read( sector_source_t dev, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(dev,FILE_SECTOR_SOURCE) );
+    file_sector_source_t fdev = (file_sector_source_t)dev;
+
+    uint32_t off = fdev->offset + lba * CDROM_SECTOR_SIZE(dev->mode);
+    uint32_t size = block_count * CDROM_SECTOR_SIZE(dev->mode);
+    fseek( fdev->file, off, SEEK_SET );
+
+    size_t len = fread( buf, 1, size, fdev->file );
+    if( len == -1 ) {
+        return CDROM_ERROR_READERROR;
+    } else if( len < size ) {
+        /* zero-fill */
+        memset( buf + len, 0, size-len );
+    }
+    return CDROM_ERROR_OK;
+}
+
+sector_source_t file_sector_source_new( FILE *f, sector_mode_t mode, uint32_t offset,
+                                        cdrom_count_t sector_count, gboolean closeOnDestroy )
+{
+    if( sector_count == FILE_SECTOR_FULL_FILE ) {
+        unsigned int sector_size = CDROM_SECTOR_SIZE(mode);
+        if( sector_size == 0 )
+            sector_size = 2048;
+        struct stat st;
+
+        if( f == NULL || fstat( fileno(f), &st ) != 0 ) {
+            /* can't stat file? */
+            return NULL;
+        }
+
+        sector_count = (st.st_size + sector_size-1) / sector_size;
+    }
+
+    file_sector_source_t dev = g_malloc(sizeof(struct file_sector_source));
+    dev->file = f;
+    dev->offset = offset;
+    dev->closeOnDestroy = closeOnDestroy;
+    dev->ref = NULL;
+    return sector_source_init( &dev->dev, FILE_SECTOR_SOURCE, mode,  sector_count, file_sector_source_read, file_sector_source_destroy );
+}
+
+sector_source_t file_sector_source_new_full( FILE *f, sector_mode_t mode, gboolean closeOnDestroy )
+{
+    return file_sector_source_new( f, mode, 0, FILE_SECTOR_FULL_FILE, closeOnDestroy );
+}
+
+sector_source_t file_sector_source_new_filename( const gchar *filename, sector_mode_t mode, uint32_t offset,
+                                                 cdrom_count_t sector_count )
+{
+    int fd = open( filename, O_RDONLY|O_NONBLOCK );
+    if( fd == -1 ) {
+        return NULL;
+    }
+    FILE *f = fdopen( fd , "ro" );
+    if( f == NULL ) {
+        close(fd);
+        return NULL;
+    } else {
+        return file_sector_source_new( f, mode, offset, sector_count, TRUE );
+    }
+}
+
+sector_source_t file_sector_source_new_source( sector_source_t ref, sector_mode_t mode, uint32_t offset,
+                                               cdrom_count_t sector_count )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(ref,FILE_SECTOR_SOURCE) );
+    file_sector_source_t fref = (file_sector_source_t)ref;
+
+    sector_source_t source = file_sector_source_new( fref->file, mode, offset, sector_count, FALSE );
+    ((file_sector_source_t)source)->ref = ref;
+    sector_source_ref(ref);
+    return source;
+}
+
+FILE *file_sector_source_get_file( sector_source_t ref )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(ref,FILE_SECTOR_SOURCE) );
+    file_sector_source_t fref = (file_sector_source_t)ref;
+    return fref->file;
+}
+
+int file_sector_source_get_fd( sector_source_t ref )
+{
+    return fileno(file_sector_source_get_file(ref));
+}
+
+void file_sector_source_set_close_on_destroy( sector_source_t ref, gboolean closeOnDestroy )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(ref,FILE_SECTOR_SOURCE) );
+    file_sector_source_t fref = (file_sector_source_t)ref;
+    fref->closeOnDestroy = closeOnDestroy;
+}
+
+/************************ Track device implementation *************************/
+typedef struct track_sector_source {
+    struct sector_source dev;
+    cdrom_disc_t disc;
+    uint32_t start_lba;
+} *track_sector_source_t;
+
+cdrom_error_t track_sector_source_read_blocks( sector_source_t dev, cdrom_lba_t lba, cdrom_count_t count,
+                                               unsigned char *out )
+{
+    size_t length;
+    assert( IS_SECTOR_SOURCE_TYPE(dev,TRACK_SECTOR_SOURCE) );
+    assert( dev->mode != SECTOR_UNKNOWN );
+    track_sector_source_t tdev = (track_sector_source_t)dev;
+    return cdrom_disc_read_sectors( tdev->disc, lba + tdev->start_lba, count, CDROM_SECTOR_READ_MODE(dev->mode), out, &length );
+}
+
+cdrom_error_t track_sector_source_read_sectors( sector_source_t dev, cdrom_lba_t lba, cdrom_count_t count,
+                                                cdrom_read_mode_t mode, unsigned char *out, size_t *length )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(dev,TRACK_SECTOR_SOURCE) );
+    track_sector_source_t tdev = (track_sector_source_t)dev;
+
+    return cdrom_disc_read_sectors( tdev->disc, lba + tdev->start_lba, count, mode, out, length );
+}
+
+void track_sector_source_destroy( sector_source_t dev )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(dev,TRACK_SECTOR_SOURCE) );
+    track_sector_source_t tdev = (track_sector_source_t)dev;
+    sector_source_unref( &tdev->disc->source );
+    default_sector_source_destroy(dev);
+}
+
+sector_source_t track_sector_source_new( cdrom_disc_t disc, sector_mode_t mode, cdrom_lba_t lba, cdrom_count_t count )
+{
+    if( disc == NULL ) {
+        return NULL;
+    }
+    track_sector_source_t dev = g_malloc(sizeof(struct track_sector_source));
+    dev->disc = disc;
+    dev->start_lba = lba;
+    sector_source_init( &dev->dev, TRACK_SECTOR_SOURCE, mode, count,
+                        track_sector_source_read_blocks, track_sector_source_destroy );
+    dev->dev.read_sectors = track_sector_source_read_sectors;
+    sector_source_ref( &disc->source );
+    return &dev->dev;
+}
</pre></div>
<hr /><a name="file31" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="added" class="pathname" style="font-family:monospace; float:right; background-color:#ddffdd;" >lxdream/src/drivers/cdrom</span><br />
<div id="added" class="fileheader" style="margin-bottom:.5em; background-color:#ddffdd;" ><big><b>sector.h</b></big> <small id="info" style="color: #888888;" >added at d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/sector.h
+++ lxdream/src/drivers/cdrom/sector.h
@@ -0,0 +1,184 @@
</small></pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * $Id$
+ *
+ * low-level 'block device' for input to cdrom discs.
+ *
+ * Copyright (c) 2009 Nathan Keynes.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef cdrom_sector_H
+#define cdrom_sector_H 1
+
+#include <stdio.h>
+#include <glib/gtypes.h>
+#include "drivers/cdrom/defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************** Sector Source ******************************/
+#define SECTOR_SOURCE_TAG 0x42444556
+typedef struct sector_source *sector_source_t;
+typedef enum {
+    NULL_SECTOR_SOURCE,
+    FILE_SECTOR_SOURCE,
+    DISC_SECTOR_SOURCE,
+    TRACK_SECTOR_SOURCE
+} sector_source_type_t;
+
+typedef cdrom_error_t (*sector_source_read_fn_t)(sector_source_t, cdrom_lba_t, cdrom_count_t, unsigned char *outbuf);
+typedef cdrom_error_t (*sector_source_read_sectors_fn_t)(sector_source_t, cdrom_lba_t, cdrom_count_t, cdrom_read_mode_t mode,
+        unsigned char *outbuf, size_t *length);
+typedef void (*sector_source_destroy_fn_t)(sector_source_t);
+
+/**
+ * A 'sector source' is a read-only random-access data source that supports
+ * reads of arbitrary blocks within their capacity. A block device has a
+ * defined mode, block size, and block count.
+ *
+ * Source are ref-counted, and automatically destroyed when the reference
+ * count reaches 0.
+ */
+struct sector_source {
+    uint32_t tag;       /* sector source tag */
+    uint32_t ref_count; /* Reference count. Initialized to 0 */
+    sector_source_type_t type;
+
+    sector_mode_t mode; /* Implies sector size. */
+    uint32_t size; /* Block count */
+
+    /**
+     * Read blocks from the device using the native block size.
+     * @param buf Buffer to receive the blocks
+     * @param block First block to transfer (numbered from 0)
+     * @param block_count number of blocks to transfer.
+     * @return 0 on success, otherwise an error code.
+     */
+    sector_source_read_fn_t read_blocks;
+
+    /**
+     * Read sectors from the device using the specified read mode, performing any
+     * necessary conversions.
+     */
+    sector_source_read_sectors_fn_t read_sectors;
+
+    /**
+     * Release all resources and memory used by the device (note should never
+     * be called directly
+     */
+    sector_source_destroy_fn_t destroy;
+
+};
+
+/**
+ * Block device that always returns zeros.
+ */
+sector_source_t null_sector_source_new( sector_mode_t mode, cdrom_count_t size );
+
+#define FILE_SECTOR_FULL_FILE ((cdrom_count_t)-1)
+
+/**
+ * File reader. Last block is 0-padded.
+ */
+sector_source_t file_sector_source_new_filename( const gchar *filename, sector_mode_t mode,
+                                                 uint32_t offset, cdrom_count_t sector_count );
+sector_source_t file_sector_source_new( FILE *f, sector_mode_t mode, uint32_t offset, cdrom_count_t sector_count,
+                                                gboolean closeOnDestroy );
+sector_source_t file_sector_source_new_full( FILE *f, sector_mode_t mode, gboolean closeOnDestroy );
+
+/**
+ * Construct a file source that shares its file descriptor with another
+ * file source.
+ */
+sector_source_t file_sector_source_new_source( sector_source_t ref, sector_mode_t mode, uint32_t offset,
+                                               cdrom_count_t sector_count );
+
+/**
+ * Change the value of the source's closeOnDestroy flag
+ */
+void file_sector_source_set_close_on_destroy( sector_source_t ref, gboolean closeOnDestroy );
+
+/**
+ * Retrieve the source's underlying FILE
+ */
+FILE *file_sector_source_get_file( sector_source_t ref );
+
+/**
+ * Retrieve the source's underlying file descriptor
+ */
+int file_sector_source_get_fd( sector_source_t ref );
+
+/**
+ * Increment the reference count for a block device.
+ */
+void sector_source_ref( sector_source_t device );
+
+/**
+ * Unreference a block device. If decremented to 0, the device will be
+ * destroyed.
+ */
+void sector_source_unref( sector_source_t device );
+
+/**
+ * Release an unbound block device. If the ref count is 0, the device is
+ * destroyed. Otherwise the function has no effect.
+ */
+void sector_source_release( sector_source_t device );
+
+cdrom_error_t sector_source_read( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf );
+
+cdrom_error_t sector_source_read_sectors( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count,
+                                          cdrom_read_mode_t mode, unsigned char *buf, size_t *length );
+
+/***** Internals for sector source implementations *****/
+
+/**
+ * Initialize a new (pre-allocated) sector source
+ */
+sector_source_t sector_source_init( sector_source_t device, sector_source_type_t type, sector_mode_t mode, cdrom_count_t size,
+                        sector_source_read_fn_t readfn, sector_source_destroy_fn_t destroyfn );
+
+/**
+ * Default sector source destructor method
+ */
+void default_sector_source_destroy( sector_source_t device );
+
+
+/**
+ * Extract the necessary fields from a single raw sector for the given read mode.
+ * @param raw_sector input raw 2352 byte sector
+ * @param mode sector mode and field specification flags
+ * @param buf output buffer for sector data
+ * @param length output length of sector written to buf
+ * @return CDROM_ERROR_OK on success, otherwise an appropriate error code.
+ */
+cdrom_error_t sector_extract_from_raw( unsigned char *raw_sector, cdrom_read_mode_t mode, unsigned char *buf, size_t *length );
+
+/**
+ * Test if the given pointer is a valid sector source
+ */
+#define IS_SECTOR_SOURCE(dev) ((dev) != NULL && ((sector_source_t)(dev))->tag == SECTOR_SOURCE_TAG)
+
+ /**
+  * Test if the given pointer is a valid sector source of the given type
+  */
+#define IS_SECTOR_SOURCE_TYPE(dev,id) (IS_SECTOR_SOURCE(dev) && ((sector_source_t)(dev))->type == id)
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !cdrom_sector_H */
</pre></div>
<hr /><a name="file32" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>gdlist.c</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdlist.c
+++ lxdream/src/gdlist.c
@@ -23,6 +23,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include <libgen.h>
 #include "gettext.h"
 #include "gdrom/gdrom.h"
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include "drivers/cdrom/drive.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include "gdlist.h"
 #include "lxdream.h"
 #include "config.h"
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -43,7 +44,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     GList *ptr;
 
     for( ptr = gdrom_device_list; ptr != NULL; ptr = g_list_next(ptr) ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        gdrom_device_t device = (gdrom_device_t)ptr->data;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        cdrom_drive_t device = (cdrom_drive_t)ptr->data;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         posn++;
         if( strcmp(device->name, name) == 0 ) {
             return posn;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -99,7 +100,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
  * Disc-changed callback from the GD-Rom driver. Updates the list accordingly.
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gboolean gdrom_list_disc_changed( <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >g</span>drom_disc_t disc, const gchar *disc_name, void *user_data )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+gboolean gdrom_list_disc_changed( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >c</span>drom_disc_t disc, const gchar *disc_name, void *user_data )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
     gboolean list_changed = FALSE;
     int posn = 0;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -137,7 +138,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
     gdrom_recent_list = lxdream_get_global_config_list_value( CONFIG_RECENT );
     register_gdrom_disc_change_hook( gdrom_list_disc_changed, NULL );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    gdrom_device_list = cdrom_get_native_devices();
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    cdrom_drive_scan();
+    gdrom_device_list = cdrom_drive_get_list();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     gdrom_device_count = g_list_length(gdrom_device_list);
     gdrom_recent_count = g_list_length(gdrom_recent_list);
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -153,7 +155,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 
     if( posn <= gdrom_device_count ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >gdrom_devic</span>e_t device = g_list_nth_data(gdrom_device_list, posn-1);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >cdrom_driv</span>e_t device = g_list_nth_data(gdrom_device_list, posn-1);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         return gdrom_mount_image(device->name);
     }
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -188,8 +190,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 
     if( posn <= gdrom_device_count ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        gdrom_device_t device = g_list_nth_data(gdrom_device_list, posn-1);
-        return device->device_name;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        cdrom_drive_t device = g_list_nth_data(gdrom_device_list, posn-1);
+        return device->display_name;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 
     if( posn == gdrom_device_count + 1) {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -211,7 +213,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 
     if( posn <= gdrom_device_count ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >gdrom_devic</span>e_t device = g_list_nth_data(gdrom_device_list, posn-1);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >cdrom_driv</span>e_t device = g_list_nth_data(gdrom_device_list, posn-1);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         return device->name;
     }
 
</pre></div>
<hr /><a name="file33" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>README.LIBEDC</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/README.LIBEDC
+++ lxdream/src/gdrom/README.LIBEDC
@@ -1,123 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-This describes the program as shipped with cdrkit, a spinoff from the
-cdrtools project. However, the cdrtools developers are no longer 
-involved in the development of this spinoff and therefore shall not
-be made responsible for any problem caused by it. Do not try to get 
-support for this program by contacting the original authors.
-
-This is a small description for the Reed-Solomon library intended for
-CD sector formatting.
-
-Basics:
-It is assumed that you have a basic knowledge of cd sector formats.
-
-The library can handle three types of sector data:
-  data sectors,
-  audio sectors, and
-  sub channel r-w sectors
-
-Currently only encoding is implemented. Decoding and optionally
-error correction is planned for later.
-
-Stages:
-
-The process of sector formatting has several stages. Beginning with
-a data sector (2048, 2324, or 2336 bytes) a sector of 2352 bytes is
-built. This format can be read raw by SCSI MMC-2 and ATAPI drives and
-is accepted by cd burners. The additions are an optionally 32 bit CRC
-checksum and two layers of Reed-Solomon codes (called Reed-Solomon
-Product Code RSPC).
-This sector is then scrambled (exor'ed with a bitstream).
-The result is called F1 frames. Afterwards even and odd bytes are
-swapped, this is called F2 frames. The result is equivalent to an
-audio sector and is treated as such by the cd burner.
-So, if we wrote a series of sectors (F2 frames) into a CDR file and
-later burned them as 'audio', they would turn up as perfect data sectors.
-
-So, now we are at the level of audio sectors. Audio sectors get their
-own error correction data (called CIRC). Sector size goes up to 
-3136 bytes (that is 4/3 times 2352 bytes). Furthermore different
-words get delayed differently and swap positions. The result is ready
-to be fed into the so-called EightFourteenModulator (when subchannels
-have been added).
-
-Now, only sub channels are missing. While the p and q sub
-channels have to be generated elsewhere, any supplied r-w subchannel
-user data is protected by two levels of error correction
-codes. This format is read by cd burners when burning cd+graphics.
-The cdimage is a sequence of sectors, each containing audio data and
-after that subchannel data.
-Similar to audio sectors delaying and permutation of words
-takes place. After that the cd burner would mix sub channel data with
-the formatted audio sectors to feed the EFModulator.
-
-NOTE: Most of the described stages need not to be done in order to
-prepare sectors for burning, since all cd burners do at least CIRC,
-delaying and swaps. For data sectors they also do scrambling and f2
-frame generation.
-
-Encoding routines:
-
-For data sectors
- int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
-
- encodes data sectors. The returned data is __unscrambled__ and not in
- F2-frame format.
-
-Parameters are:
-  inout        pointer to an array of at least 2352 bytes.
-  sectortype   One of the MODE_* constants from ecc.h. This defines
-               how to format the sector.
-  address      The logical address to be used in the header 
-               (150 = 0:2.0 MSF).
-
-NOTE: the data portion has be to aligned properly for performance
-reasons (see ecc.h for details). So, no moves are necessary here.
-
-Generating f2 frames to be used like audio sectors
- int scramble_L2(unsigned char *inout)
-
- generates f2 frames in place from sectors generated by do_encode_L2().
-
-Parameters are:
-  inout        pointer to an array of at least 2352 bytes.
-
-
-
-For sub channels
- int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
-               unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*
-                                       PACKETS_PER_SUBCHANNELFRAME],
-               int delay1, int permute);
-
- repack user data and add error correction data. P and q subchannels
-should be added later, since all bytes are in place then.
-
-Parameters are:
-  in           pointer to an array of at least 72 bytes. It contains
-               the user data for one frame.
-  out          pointer to an array of at least 96 bytes. Here is
-               output frame is placed.
-  delay1       do low level delaying, when set to 1.
-  permute      do low level permutations, when set to 1.
-
-NOTE: Probably both options need either to be set on (1) or off (0) together.
-
-There is more, but that is seldomly used.
-
-Tests:
-The library is accompanied by small verify programs, that compare real
-raw sectors with the formatted results. They are also intended as demo
-applications (how to use the library). In order to be able to feed
-real raw sectors into them, the package read2448 is recommended/needed.
-You can only verify sector streams of one sector type, currently no mix.
-
-For more information have a look into ecc.h
-
-recommended Documents:
-Yellow Book or ISO 10149
-Appendix Red Book
-Red Book or IEC 908
-
-Source: libedc/README from cdrtools package
-Edited for cdrkit by Christian Fromme <kaner@strace.org>
-
</pre></div>
<hr /><a name="file34" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>cdi.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/cdi.c
+++ lxdream/src/gdrom/cdi.c
@@ -1,208 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * CDI CD-image file support
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include "gdrom/gddriver.h"
-
-#define CDI_V2_ID 0x80000004
-#define CDI_V3_ID 0x80000005
-#define CDI_V35_ID 0x80000006
-
-
-static gboolean cdi_image_is_valid( FILE *f );
-static gdrom_disc_t cdi_image_open( const gchar *filename, FILE *f );
-
-struct gdrom_image_class cdi_image_class = { "DiscJuggler", "cdi", 
-        cdi_image_is_valid, cdi_image_open };
-
-static const char TRACK_START_MARKER[20] = { 0,0,1,0,0,0,255,255,255,255,
-        0,0,1,0,0,0,255,255,255,255 };
-static const char EXT_MARKER[9] = {0,255,255,255,255,255,255,255,255 };
-
-struct cdi_trailer {
-    uint32_t cdi_version;
-    uint32_t header_offset;
-};
-
-struct cdi_track_data {
-    uint32_t pregap_length;
-    uint32_t length;
-    char unknown2[6];
-    uint32_t mode;
-    char unknown3[0x0c];
-    uint32_t start_lba;
-    uint32_t total_length;
-    char unknown4[0x10];
-    uint32_t sector_size;
-    char unknown5[0x1D];
-} __attribute__((packed));
-
-gboolean cdi_image_is_valid( FILE *f )
-{
-    int len;
-    struct cdi_trailer trail;
-
-    fseek( f, -8, SEEK_END );
-    len = ftell(f)+8;
-    fread( &trail, sizeof(trail), 1, f );
-    if( trail.header_offset >= len ||
-            trail.header_offset == 0 )
-        return FALSE;
-    return trail.cdi_version == CDI_V2_ID || trail.cdi_version == CDI_V3_ID ||
-    trail.cdi_version == CDI_V35_ID;
-}
-
-gdrom_disc_t cdi_image_open( const gchar *filename, FILE *f )
-{
-    gdrom_disc_t disc = NULL;
-    int i,j;
-    uint16_t session_count;
-    uint16_t track_count;
-    int total_tracks = 0;
-    int posn = 0;
-    long len;
-    struct cdi_trailer trail;
-    char marker[20];
-
-    fseek( f, -8, SEEK_END );
-    len = ftell(f)+8;
-    fread( &trail, sizeof(trail), 1, f );
-    if( trail.header_offset >= len ||
-            trail.header_offset == 0 )
-        return NULL;
-
-    if( trail.cdi_version != CDI_V2_ID && trail.cdi_version != CDI_V3_ID &&
-            trail.cdi_version != CDI_V35_ID ) {
-        return NULL;
-    }
-
-    if( trail.cdi_version == CDI_V35_ID ) {
-        fseek( f, -(long)trail.header_offset, SEEK_END );
-    } else {
-        fseek( f, trail.header_offset, SEEK_SET );
-    }
-    fread( &session_count, sizeof(session_count), 1, f );
-
-    disc = gdrom_image_new(filename, f);
-    if( disc == NULL ) {
-        ERROR("Unable to allocate memory!");
-        return NULL;
-    }
-
-    for( i=0; i< session_count; i++ ) {        
-        fread( &track_count, sizeof(track_count), 1, f );
-        if( track_count + total_tracks > 99 ) {
-            ERROR( "Invalid number of tracks, bad cdi image\n" );
-            disc->destroy(disc,FALSE);
-            return NULL;
-        }
-        for( j=0; j<track_count; j++ ) {
-            struct cdi_track_data trk;
-            uint32_t new_fmt = 0;
-            uint8_t fnamelen = 0;
-            fread( &new_fmt, sizeof(new_fmt), 1, f );
-            if( new_fmt != 0 ) { /* Additional data 3.00.780+ ?? */
-                fseek( f, 8, SEEK_CUR ); /* Skip */
-            }
-            fread( marker, 20, 1, f );
-            if( memcmp( marker, TRACK_START_MARKER, 20) != 0 ) {
-                ERROR( "Track start marker not found, error reading cdi image\n" );
-                disc->destroy(disc,FALSE);
-                return NULL;
-            }
-            fseek( f, 4, SEEK_CUR );
-            fread( &fnamelen, 1, 1, f );
-            fseek( f, (int)fnamelen, SEEK_CUR ); /* skip over the filename */
-            fseek( f, 19, SEEK_CUR );
-            fread( &new_fmt, sizeof(new_fmt), 1, f );
-            if( new_fmt == 0x80000000 ) {
-                fseek( f, 10, SEEK_CUR );
-            } else {
-                fseek( f, 2, SEEK_CUR );
-            }
-            fread( &trk, sizeof(trk), 1, f );
-            disc->track[total_tracks].session = i;
-            disc->track[total_tracks].lba = trk.start_lba + 150;
-            disc->track[total_tracks].sector_count = trk.length;
-            switch( trk.mode ) {
-            case 0:
-                disc->track[total_tracks].mode = GDROM_CDDA;
-                disc->track[total_tracks].sector_size = 2352;
-                disc->track[total_tracks].flags = 0x01;
-                if( trk.sector_size != 2 ) {
-                    ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );
-                    disc->destroy(disc,FALSE);
-                    return NULL;
-                }
-                break;
-            case 1:
-                disc->track[total_tracks].mode = GDROM_MODE1;
-                disc->track[total_tracks].sector_size = 2048;
-                disc->track[total_tracks].flags = 0x41;
-                if( trk.sector_size != 0 ) {
-                    ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );
-                    disc->destroy(disc,FALSE);
-                    return NULL;
-                }
-                break;
-            case 2:
-                disc->track[total_tracks].flags = 0x41;
-                switch( trk.sector_size ) {
-                case 0:
-                    disc->track[total_tracks].mode = GDROM_MODE2_FORM1;
-                    disc->track[total_tracks].sector_size = 2048;
-                    break;
-                case 1:
-                    disc->track[total_tracks].mode = GDROM_SEMIRAW_MODE2;
-                    disc->track[total_tracks].sector_size = 2336;
-                    break;
-                case 2:
-                default:
-                    ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );
-                    disc->destroy(disc,FALSE);
-                    return NULL;
-                }
-                break;
-                default:
-                    ERROR( "Unsupported track mode %d", trk.mode );
-                    disc->destroy(disc,FALSE);
-                    return NULL;
-            }
-            disc->track[total_tracks].offset = posn + 
-            trk.pregap_length * disc->track[total_tracks].sector_size ;
-            posn += trk.total_length * disc->track[total_tracks].sector_size;
-            total_tracks++;
-            fread( marker, 1, 9, f );
-            if( memcmp( marker, EXT_MARKER, 9 ) == 0 ) {
-                fseek( f, 79, SEEK_CUR );
-            } else {
-                fseek( f, -9, SEEK_CUR );
-            }
-        }
-        fseek( f, 12, SEEK_CUR );
-    }
-    disc->track_count = total_tracks;
-    gdrom_set_disc_type(disc);
-    return disc;
-}
</pre></div>
<hr /><a name="file35" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>ecc.h</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/ecc.h
+++ lxdream/src/gdrom/ecc.h
@@ -1,136 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)ecc.h   1.4 02/10/19 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */
-
-/*
- * compact disc reed-solomon routines
- *
- * (c) 1998-2002 by Heiko Eissfeldt, heiko@colossus.escape.de
- * (c) 2002 by Joerg Schilling
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#define RS_L12_BITS 8
-
-/* audio sector definitions for CIRC */
-#define FRAMES_PER_SECTOR 98
-/* user data bytes per frame */
-#define L1_RAW 24
-/* parity bytes with 8 bit */
-#define L1_Q   4
-#define L1_P   4
-
-int cd_build_address(unsigned char inout[], int sectortype, unsigned address);
-
-/* audio sector Cross Interleaved Reed-Solomon Code (CIRC) encoder (layer 1) */
-/* adds P- and Q- parity information to audio (f2) frames. Also
-   optionally handles the various delays and permutations. The output with all
-   stages enabled can be fed into the Eight-Fourteen-Modulator.
-   On input: 2352 bytes of audio data is given.
-   On output: 3136 bytes of CIRC enriched audio data are returned.
- */
-int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],
-                                         unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
-                                         int delay1, int delay2, int delay3, int scramble);
-
-/* data sector definitions for RSPC */
-/* user data bytes per frame */
-#define L2_RAW (1024*2)
-/* parity bytes for 16 bit units */
-#define L2_Q   (26*2*2)
-#define L2_P   (43*2*2)
-
-/* known sector types */
-#define MODE_0 GDROM_MODE0
-#define MODE_1 GDROM_MODE1
-#define MODE_2 GDROM_MODE2_FORMLESS
-#define MODE_2_FORM_1  GDROM_MODE2_FORM1
-#define MODE_2_FORM_2  GDROM_MODE2_FORM2
-
-/* set one of the MODE_* constants for subsequent data sector formatting */
-int set_sector_type(int st);
-/* get the current sector type setting for data sector formatting */
-int get_sector_type(void);
-
-/* data sector layer 2 Reed-Solomon Product Code encoder */
-/* encode the given data portion depending on sector type (see
-   get/set_sector_type() functions). Use the given address for the header.
-   The returned data is __unscrambled__ and not in F2-frame format (for that
-   see function scramble_L2()).
-   Supported sector types:
-     MODE_0: a 12-byte sync field, a header and 2336 zeros are returned.
-     MODE_1: the user data portion (2048 bytes) has to be given
-             at offset 16 in the inout array.
-             Sync-, header-, edc-, spare-, p- and q- fields will be added.
-     MODE_2: the user data portion (2336 bytes) has to be given
-             at offset 16 in the inout array.
-             Sync- and header- fields will be added.
-     MODE_2_FORM_1: the user data portion (8 bytes subheader followed
-                    by 2048 bytes data) has to be given at offset 16
-                    in the inout array.
-                    Sync-, header-, edc-, p- and q- fields will be added.
-     MODE_2_FORM_2: the user data portion (8 bytes subheader followed
-                    by 2324 bytes data) has to be given at offset 16
-                    in the inout array.
-                    Sync-, header- and edc- fields will be added.
-*/
-int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
-int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);
-int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);
-unsigned int build_edc(unsigned char inout[], int from, int upto);
-
-/* generates f2 frames from otherwise fully formatted sectors (generated by
-   do_encode_L2()). */
-#define        EDC_SCRAMBLE_NOSWAP     1       /* Do not swap bytes while scrambling */
-int scramble_L2(unsigned char *inout);
-
-/* r-w sub channel definitions */
-#define RS_SUB_RW_BITS 6
-
-#define PACKETS_PER_SUBCHANNELFRAME 4
-#define LSUB_RAW 18
-#define LSUB_QRAW 2
-/* 6 bit */
-#define LSUB_Q 2
-#define LSUB_P 4
-
-/* R-W subchannel encoder */
-/* On input: 72 bytes packed user data, four frames with each 18 bytes.
-   On output: per frame: 2 bytes user data, 2 bytes Q parity, 
-                         16 bytes user data, 4 bytes P parity.
-   Options:
-     delay1: use low level delay line
-     scramble: perform low level permutations
- */
-int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
-               unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
-               int delay1, int scramble);
-int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
-                                               unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
-                                               int delay1, int scramble);
-
-int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);
-int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
</pre></div>
<hr /><a name="file36" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>edc_crctable.h</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/edc_crctable.h
+++ lxdream/src/gdrom/edc_crctable.h
@@ -1,171 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/* @(#)crctable.out  1.2 02/10/17 joerg */
-
-/*****************************************************************/
-/*                                                               */
-/* CRC LOOKUP TABLE                                              */
-/* ================                                              */
-/* The following CRC lookup table was generated automagically    */
-/* by the Rocksoft^tm Model CRC Algorithm Table Generation       */
-/* Program V1.0 using the following model parameters:            */
-/*                                                               */
-/*    Width   : 4 bytes.                                         */
-/*    Poly    : 0x8001801BL                                      */
-/*    Reverse : TRUE.                                            */
-/*                                                               */
-/* For more information on the Rocksoft^tm Model CRC Algorithm,  */
-/* see the document titled "A Painless Guide to CRC Error        */
-/* Detection Algorithms" by Ross Williams                        */
-/* (ross@guest.adelaide.edu.au.). This document is likely to be  */
-/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft".        */
-/*                                                               */
-/*****************************************************************/
-
-#ifdef PROTOTYPES
-
-static unsigned int EDC_crctable[256] =
-{
- 0x00000000U, 0x90910101U, 0x91210201U, 0x01B00300U,
- 0x92410401U, 0x02D00500U, 0x03600600U, 0x93F10701U,
- 0x94810801U, 0x04100900U, 0x05A00A00U, 0x95310B01U,
- 0x06C00C00U, 0x96510D01U, 0x97E10E01U, 0x07700F00U,
- 0x99011001U, 0x09901100U, 0x08201200U, 0x98B11301U,
- 0x0B401400U, 0x9BD11501U, 0x9A611601U, 0x0AF01700U,
- 0x0D801800U, 0x9D111901U, 0x9CA11A01U, 0x0C301B00U,
- 0x9FC11C01U, 0x0F501D00U, 0x0EE01E00U, 0x9E711F01U,
- 0x82012001U, 0x12902100U, 0x13202200U, 0x83B12301U,
- 0x10402400U, 0x80D12501U, 0x81612601U, 0x11F02700U,
- 0x16802800U, 0x86112901U, 0x87A12A01U, 0x17302B00U,
- 0x84C12C01U, 0x14502D00U, 0x15E02E00U, 0x85712F01U,
- 0x1B003000U, 0x8B913101U, 0x8A213201U, 0x1AB03300U,
- 0x89413401U, 0x19D03500U, 0x18603600U, 0x88F13701U,
- 0x8F813801U, 0x1F103900U, 0x1EA03A00U, 0x8E313B01U,
- 0x1DC03C00U, 0x8D513D01U, 0x8CE13E01U, 0x1C703F00U,
- 0xB4014001U, 0x24904100U, 0x25204200U, 0xB5B14301U,
- 0x26404400U, 0xB6D14501U, 0xB7614601U, 0x27F04700U,
- 0x20804800U, 0xB0114901U, 0xB1A14A01U, 0x21304B00U,
- 0xB2C14C01U, 0x22504D00U, 0x23E04E00U, 0xB3714F01U,
- 0x2D005000U, 0xBD915101U, 0xBC215201U, 0x2CB05300U,
- 0xBF415401U, 0x2FD05500U, 0x2E605600U, 0xBEF15701U,
- 0xB9815801U, 0x29105900U, 0x28A05A00U, 0xB8315B01U,
- 0x2BC05C00U, 0xBB515D01U, 0xBAE15E01U, 0x2A705F00U,
- 0x36006000U, 0xA6916101U, 0xA7216201U, 0x37B06300U,
- 0xA4416401U, 0x34D06500U, 0x35606600U, 0xA5F16701U,
- 0xA2816801U, 0x32106900U, 0x33A06A00U, 0xA3316B01U,
- 0x30C06C00U, 0xA0516D01U, 0xA1E16E01U, 0x31706F00U,
- 0xAF017001U, 0x3F907100U, 0x3E207200U, 0xAEB17301U,
- 0x3D407400U, 0xADD17501U, 0xAC617601U, 0x3CF07700U,
- 0x3B807800U, 0xAB117901U, 0xAAA17A01U, 0x3A307B00U,
- 0xA9C17C01U, 0x39507D00U, 0x38E07E00U, 0xA8717F01U,
- 0xD8018001U, 0x48908100U, 0x49208200U, 0xD9B18301U,
- 0x4A408400U, 0xDAD18501U, 0xDB618601U, 0x4BF08700U,
- 0x4C808800U, 0xDC118901U, 0xDDA18A01U, 0x4D308B00U,
- 0xDEC18C01U, 0x4E508D00U, 0x4FE08E00U, 0xDF718F01U,
- 0x41009000U, 0xD1919101U, 0xD0219201U, 0x40B09300U,
- 0xD3419401U, 0x43D09500U, 0x42609600U, 0xD2F19701U,
- 0xD5819801U, 0x45109900U, 0x44A09A00U, 0xD4319B01U,
- 0x47C09C00U, 0xD7519D01U, 0xD6E19E01U, 0x46709F00U,
- 0x5A00A000U, 0xCA91A101U, 0xCB21A201U, 0x5BB0A300U,
- 0xC841A401U, 0x58D0A500U, 0x5960A600U, 0xC9F1A701U,
- 0xCE81A801U, 0x5E10A900U, 0x5FA0AA00U, 0xCF31AB01U,
- 0x5CC0AC00U, 0xCC51AD01U, 0xCDE1AE01U, 0x5D70AF00U,
- 0xC301B001U, 0x5390B100U, 0x5220B200U, 0xC2B1B301U,
- 0x5140B400U, 0xC1D1B501U, 0xC061B601U, 0x50F0B700U,
- 0x5780B800U, 0xC711B901U, 0xC6A1BA01U, 0x5630BB00U,
- 0xC5C1BC01U, 0x5550BD00U, 0x54E0BE00U, 0xC471BF01U,
- 0x6C00C000U, 0xFC91C101U, 0xFD21C201U, 0x6DB0C300U,
- 0xFE41C401U, 0x6ED0C500U, 0x6F60C600U, 0xFFF1C701U,
- 0xF881C801U, 0x6810C900U, 0x69A0CA00U, 0xF931CB01U,
- 0x6AC0CC00U, 0xFA51CD01U, 0xFBE1CE01U, 0x6B70CF00U,
- 0xF501D001U, 0x6590D100U, 0x6420D200U, 0xF4B1D301U,
- 0x6740D400U, 0xF7D1D501U, 0xF661D601U, 0x66F0D700U,
- 0x6180D800U, 0xF111D901U, 0xF0A1DA01U, 0x6030DB00U,
- 0xF3C1DC01U, 0x6350DD00U, 0x62E0DE00U, 0xF271DF01U,
- 0xEE01E001U, 0x7E90E100U, 0x7F20E200U, 0xEFB1E301U,
- 0x7C40E400U, 0xECD1E501U, 0xED61E601U, 0x7DF0E700U,
- 0x7A80E800U, 0xEA11E901U, 0xEBA1EA01U, 0x7B30EB00U,
- 0xE8C1EC01U, 0x7850ED00U, 0x79E0EE00U, 0xE971EF01U,
- 0x7700F000U, 0xE791F101U, 0xE621F201U, 0x76B0F300U,
- 0xE541F401U, 0x75D0F500U, 0x7460F600U, 0xE4F1F701U,
- 0xE381F801U, 0x7310F900U, 0x72A0FA00U, 0xE231FB01U,
- 0x71C0FC00U, 0xE151FD01U, 0xE0E1FE01U, 0x7070FF00U,
-};
-
-/*****************************************************************/
-/*                   End of CRC Lookup Table                     */
-/*****************************************************************/
-
-#else  /* PROTOTYPES */
-
-static unsigned int EDC_crctable[256] =
-{
- 0x00000000, 0x90910101, 0x91210201, 0x01B00300,
- 0x92410401, 0x02D00500, 0x03600600, 0x93F10701,
- 0x94810801, 0x04100900, 0x05A00A00, 0x95310B01,
- 0x06C00C00, 0x96510D01, 0x97E10E01, 0x07700F00,
- 0x99011001, 0x09901100, 0x08201200, 0x98B11301,
- 0x0B401400, 0x9BD11501, 0x9A611601, 0x0AF01700,
- 0x0D801800, 0x9D111901, 0x9CA11A01, 0x0C301B00,
- 0x9FC11C01, 0x0F501D00, 0x0EE01E00, 0x9E711F01,
- 0x82012001, 0x12902100, 0x13202200, 0x83B12301,
- 0x10402400, 0x80D12501, 0x81612601, 0x11F02700,
- 0x16802800, 0x86112901, 0x87A12A01, 0x17302B00,
- 0x84C12C01, 0x14502D00, 0x15E02E00, 0x85712F01,
- 0x1B003000, 0x8B913101, 0x8A213201, 0x1AB03300,
- 0x89413401, 0x19D03500, 0x18603600, 0x88F13701,
- 0x8F813801, 0x1F103900, 0x1EA03A00, 0x8E313B01,
- 0x1DC03C00, 0x8D513D01, 0x8CE13E01, 0x1C703F00,
- 0xB4014001, 0x24904100, 0x25204200, 0xB5B14301,
- 0x26404400, 0xB6D14501, 0xB7614601, 0x27F04700,
- 0x20804800, 0xB0114901, 0xB1A14A01, 0x21304B00,
- 0xB2C14C01, 0x22504D00, 0x23E04E00, 0xB3714F01,
- 0x2D005000, 0xBD915101, 0xBC215201, 0x2CB05300,
- 0xBF415401, 0x2FD05500, 0x2E605600, 0xBEF15701,
- 0xB9815801, 0x29105900, 0x28A05A00, 0xB8315B01,
- 0x2BC05C00, 0xBB515D01, 0xBAE15E01, 0x2A705F00,
- 0x36006000, 0xA6916101, 0xA7216201, 0x37B06300,
- 0xA4416401, 0x34D06500, 0x35606600, 0xA5F16701,
- 0xA2816801, 0x32106900, 0x33A06A00, 0xA3316B01,
- 0x30C06C00, 0xA0516D01, 0xA1E16E01, 0x31706F00,
- 0xAF017001, 0x3F907100, 0x3E207200, 0xAEB17301,
- 0x3D407400, 0xADD17501, 0xAC617601, 0x3CF07700,
- 0x3B807800, 0xAB117901, 0xAAA17A01, 0x3A307B00,
- 0xA9C17C01, 0x39507D00, 0x38E07E00, 0xA8717F01,
- 0xD8018001, 0x48908100, 0x49208200, 0xD9B18301,
- 0x4A408400, 0xDAD18501, 0xDB618601, 0x4BF08700,
- 0x4C808800, 0xDC118901, 0xDDA18A01, 0x4D308B00,
- 0xDEC18C01, 0x4E508D00, 0x4FE08E00, 0xDF718F01,
- 0x41009000, 0xD1919101, 0xD0219201, 0x40B09300,
- 0xD3419401, 0x43D09500, 0x42609600, 0xD2F19701,
- 0xD5819801, 0x45109900, 0x44A09A00, 0xD4319B01,
- 0x47C09C00, 0xD7519D01, 0xD6E19E01, 0x46709F00,
- 0x5A00A000, 0xCA91A101, 0xCB21A201, 0x5BB0A300,
- 0xC841A401, 0x58D0A500, 0x5960A600, 0xC9F1A701,
- 0xCE81A801, 0x5E10A900, 0x5FA0AA00, 0xCF31AB01,
- 0x5CC0AC00, 0xCC51AD01, 0xCDE1AE01, 0x5D70AF00,
- 0xC301B001, 0x5390B100, 0x5220B200, 0xC2B1B301,
- 0x5140B400, 0xC1D1B501, 0xC061B601, 0x50F0B700,
- 0x5780B800, 0xC711B901, 0xC6A1BA01, 0x5630BB00,
- 0xC5C1BC01, 0x5550BD00, 0x54E0BE00, 0xC471BF01,
- 0x6C00C000, 0xFC91C101, 0xFD21C201, 0x6DB0C300,
- 0xFE41C401, 0x6ED0C500, 0x6F60C600, 0xFFF1C701,
- 0xF881C801, 0x6810C900, 0x69A0CA00, 0xF931CB01,
- 0x6AC0CC00, 0xFA51CD01, 0xFBE1CE01, 0x6B70CF00,
- 0xF501D001, 0x6590D100, 0x6420D200, 0xF4B1D301,
- 0x6740D400, 0xF7D1D501, 0xF661D601, 0x66F0D700,
- 0x6180D800, 0xF111D901, 0xF0A1DA01, 0x6030DB00,
- 0xF3C1DC01, 0x6350DD00, 0x62E0DE00, 0xF271DF01,
- 0xEE01E001, 0x7E90E100, 0x7F20E200, 0xEFB1E301,
- 0x7C40E400, 0xECD1E501, 0xED61E601, 0x7DF0E700,
- 0x7A80E800, 0xEA11E901, 0xEBA1EA01, 0x7B30EB00,
- 0xE8C1EC01, 0x7850ED00, 0x79E0EE00, 0xE971EF01,
- 0x7700F000, 0xE791F101, 0xE621F201, 0x76B0F300,
- 0xE541F401, 0x75D0F500, 0x7460F600, 0xE4F1F701,
- 0xE381F801, 0x7310F900, 0x72A0FA00, 0xE231FB01,
- 0x71C0FC00, 0xE151FD01, 0xE0E1FE01, 0x7070FF00,
-};
-
-#endif /* PROTOTYPES */
-
-/*****************************************************************/
-/*                   End of CRC Lookup Table                     */
-/*****************************************************************/
</pre></div>
<hr /><a name="file37" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>edc_ecc.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/edc_ecc.c
+++ lxdream/src/gdrom/edc_ecc.c
@@ -1,801 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/*
- * Note: This file has been extracted from crkit 1.1.6 and modified to work within
- * lxdream. 
- */
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)edc_ecc.c       1.21 03/04/04 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */
-
-/*
- * Copyright 1998-2002 by Heiko Eissfeldt
- * Copyright 2002 by Joerg Schilling
- *
- * This file contains protected intellectual property.
- *
- * reed-solomon encoder / decoder for compact discs.
- *
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include "gdrom/gddriver.h"
-#include "ecc.h"
-
-#define xaligned(a, s)          ((((uintptr_t)(a)) & (s)) == 0 )
-
-int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)], 
-                                         int sectortype, unsigned address);
-
-int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],
-                unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
-                int delay1, int delay2, int delay3, int permute);
-
-int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
-               unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
-               int delay1, int permute);
-
-int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)], 
-                       unsigned char out[L2_RAW]);
-
-int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
-                       unsigned char out[L1_RAW*FRAMES_PER_SECTOR],
-                       int delay1, int delay2, int delay3, int permute);
-
-int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
-                 unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
-                 int delay1, int permute);
-
-
-
-/* ------------- tables generated by gen_encodes --------------*/
-
-#include "edc_scramble.h"
-
-#define        DO4(a)  a;a;a;a;
-#define        DO13(a) a;a;a;a;a;a;a;a;a;a;a;a;a;
-
-/*
- * Scrambles 2352 - 12 = 2340 bytes
- */
-int scramble_L2(unsigned char *inout);
-
-int scramble_L2(unsigned char *inout)
-{
-#ifndef        EDC_SCRAMBLE_NOSWAP
-       unsigned int *f = (unsigned int *)inout;
-#endif
-
-       if (!xaligned(inout + 12, sizeof(uint32_t)-1)) {
-
-               uint8_t         *r = inout + 12;
-               const uint8_t   *s = yellowbook_scrambler;
-               register int    i;
-
-               for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(unsigned char)/4; --i >= 0;) {
-                       DO4(*r++ ^= *s++);
-               }
-
-       } else {
-               uint32_t        *r = (uint32_t *) (inout + 12);
-               const uint32_t  *s = yellowbook_scrambler_uint32;
-               register int    i;
-
-               for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(uint32_t)/13; --i >= 0;) {
-                       DO13(*r++ ^= *s++);
-               }
-       }
-
-#ifndef        EDC_SCRAMBLE_NOSWAP
-
-       /* generate F1 frames */
-       for (i = 2352/sizeof(unsigned int); i; i--) {
-               *f++ = ((*f & 0xff00ff00UL) >> 8) | ((*f & 0x00ff00ffUL) << 8);
-       }
-#endif
-
-       return (0);
-}
-
-#include "edc_l2sq.h"
-
-static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q]);
-
-static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q])
-{
-       unsigned char *dps;
-       unsigned char *dp;
-       unsigned char *Q;
-       register int i;
-       int j;
-
-       Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;
-
-       dps = inout;
-       for (j = 0; j < 26; j++) {
-               register unsigned short a;
-               register unsigned short b;
-               a = b = 0;
-
-               dp = dps;
-               for (i = 0; i < 43; i++) {
-
-                       /* LSB */
-                       a ^= L2sq[i][*dp++];
-
-                       /* MSB */
-                       b ^= L2sq[i][*dp];
-
-                       dp += 2*44-1;
-                       if (dp >= &inout[(4 + L2_RAW + 4 + 8 + L2_P)]) {
-                               dp -= (4 + L2_RAW + 4 + 8 + L2_P);
-                       } 
-               }
-               Q[0]      = a >> 8;
-               Q[26*2]   = a;
-               Q[1]      = b >> 8;
-               Q[26*2+1] = b;
-
-               Q += 2;
-               dps += 2*43;
-       }
-       return (0);
-}
-
-static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P]);
-
-static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P])
-{
-       unsigned char *dp;
-       unsigned char *P;
-       register int i;
-       int j;
-
-       P = inout + 4 + L2_RAW + 4 + 8;
-
-       for (j = 0; j < 43; j++) {
-               register unsigned short a;
-               register unsigned short b;
-
-               a = b = 0;
-               dp = inout;
-               for (i = 19; i < 43; i++) {
-
-                       /* LSB */
-                       a ^= L2sq[i][*dp++];
-
-                       /* MSB */
-                       b ^= L2sq[i][*dp];
-
-                       dp += 2*43 -1;
-               }
-               P[0]      = a >> 8;
-               P[43*2]   = a;
-               P[1]      = b >> 8;
-               P[43*2+1] = b;
-
-               P += 2;
-               inout += 2;
-       }
-       return (0);
-}
-
-static unsigned char bin2bcd(unsigned p);
-
-static unsigned char bin2bcd(unsigned p)
-{
-       return ((p/10)<<4)|(p%10);
-}
-
-int cd_build_address(unsigned char inout[], int sectortype, unsigned address)
-{
-       inout[12] = bin2bcd(address / (60*75));
-       inout[13] = bin2bcd((address / 75) % 60);
-       inout[14] = bin2bcd(address % 75);
-       if (sectortype == MODE_0)
-               inout[15] = 0;
-       else if (sectortype == MODE_1)
-               inout[15] = 1;
-       else if (sectortype == MODE_2)
-               inout[15] = 2;
-       else if (sectortype == MODE_2_FORM_1)
-               inout[15] = 2;
-       else if (sectortype == MODE_2_FORM_2)
-               inout[15] = 2;
-       else
-               return (-1);
-       return (0);
-}
-
-#include "edc_crctable.h"
-
-/*
- * Called with 2064, 2056 or 2332 byte difference - all dividable by 4.
- */
-unsigned int build_edc(unsigned char inout[], int from, int upto);
-
-unsigned int build_edc(unsigned char inout[], int from, int upto)
-{
-       unsigned char *p = inout+from;
-       unsigned int result = 0;
-
-       upto -= from-1;
-       upto /= 4;
-       while (--upto >= 0) {
-               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
-               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
-               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
-               result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
-       }
-       return (result);
-}
-
-/* Layer 2 Product code en/decoder */
-
-int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)], 
-                int sectortype, unsigned address)
-{
-       unsigned int result;
-
-/*     SYNCPATTERN "\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" */
-#define SYNCPATTERN "\000\377\377\377\377\377\377\377\377\377\377"
-
-       /* supply initial sync pattern */
-       memcpy(inout, SYNCPATTERN, sizeof(SYNCPATTERN));
-
-       if (sectortype == MODE_0) {
-               memset(inout + sizeof(SYNCPATTERN), 0, 4 + L2_RAW + 12 + L2_P + L2_Q);
-               cd_build_address(inout, sectortype, address);
-               return (0);
-       }
-
-       switch (sectortype) {
-
-       case MODE_1:
-               cd_build_address(inout, sectortype, address);
-               result = build_edc(inout, 0, 16+2048-1);
-               inout[2064+0] = result >> 0L;
-               inout[2064+1] = result >> 8L;
-               inout[2064+2] = result >> 16L;
-               inout[2064+3] = result >> 24L;
-               memset(inout+2064+4, 0, 8);
-               encode_L2_P(inout+12);
-               encode_L2_Q(inout+12);
-               break;
-       case MODE_2:
-               cd_build_address(inout, sectortype, address);
-               break;
-       case MODE_2_FORM_1:
-               result = build_edc(inout, 16, 16+8+2048-1);
-               inout[2072+0] = result >> 0L;
-               inout[2072+1] = result >> 8L;
-               inout[2072+2] = result >> 16L;
-               inout[2072+3] = result >> 24L;
-
-               /* clear header for P/Q parity calculation */
-               inout[12] = 0;
-               inout[12+1] = 0;
-               inout[12+2] = 0;
-               inout[12+3] = 0;
-               encode_L2_P(inout+12);
-               encode_L2_Q(inout+12);
-               cd_build_address(inout, sectortype, address);
-               break;
-       case MODE_2_FORM_2:
-               cd_build_address(inout, sectortype, address);
-               result = build_edc(inout, 16, 16+8+2324-1);
-               inout[2348+0] = result >> 0L;
-               inout[2348+1] = result >> 8L;
-               inout[2348+2] = result >> 16L;
-               inout[2348+3] = result >> 24L;
-               break;
-       default:
-               return (-1);
-       }
-
-       return (0);
-}
-
-
-/*--------------------------------------------------------------------------*/
-#include "edc_encoder.h"
-
-static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);
-
-static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q])
-{
-       unsigned char *Q;
-       int     i;
-
-       memmove(inout+L1_RAW/2+L1_Q, inout+L1_RAW/2, L1_RAW/2);
-       Q = inout + L1_RAW/2;
-
-       memset(Q, 0, L1_Q);
-       for (i = 0; i < L1_RAW + L1_Q; i++) {
-               unsigned char data;
-
-               if (i == L1_RAW/2) i += L1_Q;
-               data = inout[i];
-               if (data != 0) {
-                       unsigned char base = rs_l12_log[data];
-
-                       Q[0] ^= rs_l12_alog[(base+AQ[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-                       Q[1] ^= rs_l12_alog[(base+AQ[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-                       Q[2] ^= rs_l12_alog[(base+AQ[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-                       Q[3] ^= rs_l12_alog[(base+AQ[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-               }
-       }
-       return (0);
-}
-
-static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P]);
-
-static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P])
-{
-       unsigned char *P;
-       int     i;
-
-       P = inout + L1_RAW + L1_Q;
-
-       memset(P, 0, L1_P);
-       for (i = 0; i < L2_RAW + L2_Q + L2_P; i++) {
-               unsigned char data;
-
-               data = inout[i];
-               if (data != 0) {
-                       unsigned char base = rs_l12_log[data];
-
-                       P[0] ^= rs_l12_alog[(base+AP[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-                       P[1] ^= rs_l12_alog[(base+AP[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-                       P[2] ^= rs_l12_alog[(base+AP[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-                       P[3] ^= rs_l12_alog[(base+AP[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
-               }
-       }
-       return (0);
-}
-
-static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);
-
-static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q])
-{
-       return (0);
-}
-
-static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P]);
-
-static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P])
-{
-       return (0);
-}
-
-int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);
-
-int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q])
-{
-       return (0);
-}
-
-int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);
-
-int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P])
-{
-       return (0);
-}
-
-static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q]);
-
-static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q])
-{
-       unsigned char *Q;
-       int i;
-
-       memmove(inout+LSUB_QRAW+LSUB_Q, inout+LSUB_QRAW, LSUB_RAW-LSUB_QRAW);
-       Q = inout + LSUB_QRAW;
-
-       memset(Q, 0, LSUB_Q);
-
-       for (i = 0; i < LSUB_QRAW; i++) {
-               unsigned char data;
-
-               data = inout[i] & 0x3f;
-               if (data != 0) {
-                       unsigned char base = rs_sub_rw_log[data];
-
-                       Q[0] ^= rs_sub_rw_alog[(base+SQ[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       Q[1] ^= rs_sub_rw_alog[(base+SQ[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-               }
-       }
-       return (0);
-}
-
-
-static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
-
-static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])
-{
-       unsigned char *P;
-       int i;
-
-       P = inout + LSUB_RAW + LSUB_Q;
-
-       memset(P, 0, LSUB_P);
-       for (i = 0; i < LSUB_RAW + LSUB_Q; i++) {
-               unsigned char data;
-
-               data = inout[i] & 0x3f;
-               if (data != 0) {
-                       unsigned char base = rs_sub_rw_log[data];
-
-                       P[0] ^= rs_sub_rw_alog[(base+SP[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       P[1] ^= rs_sub_rw_alog[(base+SP[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       P[2] ^= rs_sub_rw_alog[(base+SP[2][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       P[3] ^= rs_sub_rw_alog[(base+SP[3][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-               }
-       }
-       return (0);
-}
-
-int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);
-
-int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q])
-{
-       unsigned char Q[LSUB_Q];
-       int i;
-
-       memset(Q, 0, LSUB_Q);
-       for (i = LSUB_QRAW + LSUB_Q -1; i>=0; i--) {
-               unsigned char data;
-
-               data = inout[LSUB_QRAW + LSUB_Q -1 -i] & 0x3f;
-               if (data != 0) {
-                       unsigned char base = rs_sub_rw_log[data];
-
-                       Q[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       Q[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-               }
-       }
-       return (Q[0] != 0 || Q[1] != 0);
-}
-
-int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
-
-int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])
-{
-       unsigned char P[LSUB_P];
-       int i;
-
-       memset(P, 0, LSUB_P);
-       for (i = LSUB_RAW + LSUB_Q + LSUB_P-1; i>=0; i--) {
-               unsigned char data;
-
-               data = inout[LSUB_RAW + LSUB_Q + LSUB_P -1 -i] & 0x3f;
-               if (data != 0) {
-                       unsigned char base = rs_sub_rw_log[data];
-
-                       P[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       P[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       P[2] ^= rs_sub_rw_alog[(base+2*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-                       P[3] ^= rs_sub_rw_alog[(base+3*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
-               }
-       }
-       return (P[0] != 0 || P[1] != 0 || P[2] != 0 || P[3] != 0);
-}
-
-/* Layer 1 CIRC en/decoder */
-#define MAX_L1_DEL1 2
-static unsigned char l1_delay_line1[MAX_L1_DEL1][L1_RAW];
-#define MAX_L1_DEL2 108
-static unsigned char l1_delay_line2[MAX_L1_DEL2][L1_RAW+L1_Q];
-#define MAX_L1_DEL3 1
-static unsigned char l1_delay_line3[MAX_L1_DEL3][L1_RAW+L1_Q+L1_P];
-static unsigned l1_del_index;
-
-int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR], 
-                 unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR], 
-                 int delay1, int delay2, int delay3, int permute)
-{
-       int i;
-
-       for (i = 0; i < FRAMES_PER_SECTOR; i++) {
-               int j;
-               unsigned char t;
-
-               if (in != out)
-                       memcpy(out, in, L1_RAW);
-
-               if (delay1) {
-                       /* shift through delay line 1 */
-                       for (j = 0; j < L1_RAW; j++) {
-                               if (((j/4) % MAX_L1_DEL1) == 0) {
-                                       t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];
-                                       l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = out[j];
-                                       out[j] = t;
-                               }
-                       }
-               }
-
-               if (permute) {
-                       /* permute */
-                       t = out[2]; out[2] = out[8]; out[8] = out[10]; out[10] = out[18];
-                       out[18] = out[6]; out [6] = t;
-                       t = out[3]; out[3] = out[9]; out[9] = out[11]; out[11] = out[19];
-                       out[19] = out[7]; out [7] = t;
-                       t = out[4]; out[4] = out[16]; out[16] = out[20]; out[20] = out[14];
-                       out[14] = out[12]; out [12] = t;
-                       t = out[5]; out[5] = out[17]; out[17] = out[21]; out[21] = out[15];
-                       out[15] = out[13]; out [13] = t;
-               }
-
-               /* build Q parity */
-               encode_L1_Q(out);
-
-               if (delay2) {
-                       /* shift through delay line 2 */
-                       for (j = 0; j < L1_RAW+L1_Q; j++) {
-                               if (j != 0) {
-                                       t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];
-                                       l1_delay_line2[(l1_del_index + j*4) % MAX_L1_DEL2][j] = out[j];
-                                       out[j] = t;
-                               }
-                       }
-               }
-
-               /* build P parity */
-               encode_L1_P(out);
-
-               if (delay3) {
-                       /* shift through delay line 3 */
-                       for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {
-                               if (((j) & MAX_L1_DEL3) == 0) {
-                                       t = l1_delay_line3[0][j];
-                                       l1_delay_line3[0][j] = out[j];
-                                       out[j] = t;
-                               }
-                       }
-               }
-
-               /* invert Q and P parity */
-               for (j = 0; j < L1_Q; j++)
-                       out[j+12] = ~out[j+12];
-               for (j = 0; j < L1_P; j++)
-                       out[j+28] = ~out[j+28];
-
-               l1_del_index++;
-               out += L1_RAW+L1_Q+L1_P;
-               in += L1_RAW;
-       }
-       return (0);
-}
-
-int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR], 
-                       unsigned char out[L1_RAW*FRAMES_PER_SECTOR], 
-                       int delay1, int delay2, int delay3, int permute)
-{
-       int i;
-
-       for (i = 0; i < FRAMES_PER_SECTOR; i++) {
-               int j;
-               unsigned char t;
-
-               if (delay3) {
-                       /* shift through delay line 3 */
-                       for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {
-                               if (((j) & MAX_L1_DEL3) != 0) {
-                                       t = l1_delay_line3[0][j];
-                                       l1_delay_line3[0][j] = in[j];
-                                       in[j] = t;
-                               }
-                       }
-               }
-
-               /* invert Q and P parity */
-               for (j = 0; j < L1_Q; j++)
-                       in[j+12] = ~in[j+12];
-               for (j = 0; j < L1_P; j++)
-                       in[j+28] = ~in[j+28];
-
-               /* build P parity */
-               decode_L1_P(in);
-
-               if (delay2) {
-                       /* shift through delay line 2 */
-                       for (j = 0; j < L1_RAW+L1_Q; j++) {
-                               if (j != L1_RAW+L1_Q-1) {
-                                       t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];
-                                       l1_delay_line2[(l1_del_index + (MAX_L1_DEL2 - j*4)) % MAX_L1_DEL2][j] = in[j];
-                                       in[j] = t;
-                               }
-                       }
-               }
-
-               /* build Q parity */
-               decode_L1_Q(in);
-
-               if (permute) {
-                       /* permute */
-                       t = in[2]; in[2] = in[6]; in[6] = in[18]; in[18] = in[10];
-                       in[10] = in[8]; in [8] = t;
-                       t = in[3]; in[3] = in[7]; in[7] = in[19]; in[19] = in[11];
-                       in[11] = in[9]; in [9] = t;
-                       t = in[4]; in[4] = in[12]; in[12] = in[14]; in[14] = in[20];
-                       in[20] = in[16]; in [16] = t;
-                       t = in[5]; in[5] = in[13]; in[13] = in[15]; in[15] = in[21];
-                       in[21] = in[17]; in [17] = t;
-               }
-
-               if (delay1) {
-                       /* shift through delay line 1 */
-                       for (j = 0; j < L1_RAW; j++) {
-                               if (((j/4) % MAX_L1_DEL1) != 0) {
-                                       t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];
-                                       l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = in[j];
-                                       in[j] = t;
-                               }
-                       }
-               }
-
-               if (in != out)
-                       memcpy(out, in, (L1_RAW));
-
-               l1_del_index++;
-               in += L1_RAW+L1_Q+L1_P;
-               out += L1_RAW;
-       }
-       return (0);
-}
-
-int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)], 
-                        unsigned char out[L2_RAW])
-{
-       return (0);
-}
-
-
-
-#define MAX_SUB_DEL 8
-static unsigned char sub_delay_line[MAX_SUB_DEL][LSUB_RAW+LSUB_Q+LSUB_P];
-static unsigned sub_del_index;
-
-/* R-W Subchannel en/decoder */
-
-int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME], 
-                  unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME], 
-                  int delay1, int permute)
-{
-       int i;
-
-       if (in == out) return -1;
-
-       for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {
-               int j;
-               unsigned char t;
-
-               memcpy(out, in, (LSUB_RAW));
-
-               /* build Q parity */
-               encode_LSUB_Q(out);
-
-               /* build P parity */
-               encode_LSUB_P(out);
-
-               if (permute) {
-                       /* permute */
-                       t = out[1]; out[1] = out[18]; out[18] = t;
-                       t = out[2]; out[2] = out[ 5]; out[ 5] = t;
-                       t = out[3]; out[3] = out[23]; out[23] = t;
-               }
-
-               if (delay1) {
-                       /* shift through delay_line */
-                       for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {
-                               if ((j % MAX_SUB_DEL) != 0) {
-                                       t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];
-                                       sub_delay_line[(sub_del_index + j) % MAX_SUB_DEL][j] = out[j];
-                                       out[j] = t;
-                               }
-                       }
-               }
-               sub_del_index++;
-               out += LSUB_RAW+LSUB_Q+LSUB_P;
-               in += LSUB_RAW;
-       }
-       return (0);
-}
-
-int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME], 
-                 unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME], 
-                 int delay1, int permute)
-{
-       int i;
-
-       if (in == out) return -1;
-
-       for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {
-               int j;
-               unsigned char t;
-
-               if (delay1) {
-                       /* shift through delay_line */
-                       for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {
-                               if ((j % MAX_SUB_DEL) != MAX_SUB_DEL-1) {
-                                       t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];
-                                       sub_delay_line[(sub_del_index + (MAX_SUB_DEL - j)) % MAX_SUB_DEL][j] = in[j];
-                                       in[j] = t;
-                               }
-                       }
-               }
-
-               if (permute) {
-                       /* permute */
-                       t = in[1]; in[1] = in[18]; in[18] = t;
-                       t = in[2]; in[2] = in[ 5]; in[ 5] = t;
-                       t = in[3]; in[3] = in[23]; in[23] = t;
-               }
-
-               /* build P parity */
-               decode_LSUB_P(in);
-
-               /* build Q parity */
-               decode_LSUB_Q(in);
-
-               memcpy(out, in, LSUB_QRAW);
-               memcpy(out+LSUB_QRAW, in+LSUB_QRAW+LSUB_Q, LSUB_RAW-LSUB_QRAW);
-
-               sub_del_index++;
-               in += LSUB_RAW+LSUB_Q+LSUB_P;
-               out += LSUB_RAW;
-       }
-       return (0);
-}
-
-static int sectortype = MODE_0;
-
-int get_sector_type(void);
-
-int get_sector_type()
-{
-       return (sectortype);
-}
-
-int set_sector_type(int st);
-
-int set_sector_type(int st)
-{
-       switch(st) {
-
-       case MODE_0:
-       case MODE_1:
-       case MODE_2:
-       case MODE_2_FORM_1:
-       case MODE_2_FORM_2:
-               sectortype = st;
-               return 0;
-       default:
-               return -1;
-       }
-}
-
</pre></div>
<hr /><a name="file38" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>edc_encoder.h</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/edc_encoder.h
+++ lxdream/src/gdrom/edc_encoder.h
@@ -1,47 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/* @(#)encoder_tables        1.4 02/10/19 */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-static const unsigned char rs_l12_alog[255] = {
- 1, 2, 4, 8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143, 3, 6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140, 5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141, 7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138, 9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,};
-static const unsigned char rs_l12_log[256] = {
- 0, 0, 1,25, 2,50,26,198, 3,223,51,238,27,104,199,75, 4,100,224,14,52,141,239,129,28,193,105,248,200, 8,76,113, 5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154, 9,120,77,228,114,166, 6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87, 7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175,};
-static const unsigned char rs_sub_rw_alog[63] = {
- 1, 2, 4, 8,16,32, 3, 6,12,24,48,35, 5,10,20,40,19,38,15,30,60,59,53,41,17,34, 7,14,28,56,51,37, 9,18,36,11,22,44,27,54,47,29,58,55,45,25,50,39,13,26,52,43,21,42,23,46,31,62,63,61,57,49,33,};
-static const unsigned char rs_sub_rw_log[63] = {
- 0, 0, 1, 6, 2,12, 7,26, 3,32,13,35, 8,48,27,18, 4,24,33,16,14,52,36,54, 9,45,49,38,28,41,19,56, 5,62,25,11,34,31,17,47,15,23,53,51,37,44,55,40,10,61,46,30,50,22,39,43,29,60,42,21,20,59,57,};
-static const unsigned char SQ[2][2] = {
-{26,6,},
-{7,1,},
-};
-static const unsigned char SP[4][20] = {
-{57,38,44,29,17,57,53,58,60,39,12,38,18,41,6,25,39,37,5,18,},
-{38,62,42,13,30,11,46,5,54,26,12,49,48,46,8,50,28,9,12,39,},
-{32,18,41,49,52,62,38,36,39,58,37,24,34,51,51,27,28,36,22,21,},
-{44,50,35,23,0,59,1,3,45,18,44,24,47,12,31,45,43,11,24,6,},
-};
-static const unsigned char AQ[4][24] = {
-{58,152,173,95,88,43,134,205,143,131,163,75,37,109,194,159,168,227,153,59,101,},
-{30,214,148,138,112,154,157,96,49,198,189,249,83,23,70,237,70,41,47,52,125,247,},
-{162,244,13,171,213,236,71,177,253,162,59,78,46,68,238,112,147,197,115,200,117,15,236,},
-{158,179,101,94,49,140,211,149,137,169,81,6,33,30,27,24,21,18,15,12,9,6,3,0,},
-};
-static const unsigned char AP[4][32] = {
-{140,143,52,103,249,142,180,197,5,155,153,132,143,244,101,76,102,155,203,104,58,152,173,95,88,43,134,205,143,131,163,75,},
-{104,97,17,162,205,252,218,199,202,41,136,106,119,238,193,103,123,242,83,178,30,214,148,138,112,154,157,96,49,198,189,249,},
-{240,119,29,185,67,11,131,40,7,41,80,147,151,17,245,253,208,66,228,116,162,244,13,171,213,236,71,177,253,162,59,78,},
-{149,58,109,0,148,186,203,11,161,159,138,149,250,107,82,108,161,209,110,64,158,179,101,94,49,140,211,149,137,169,81,6,},
-};
</pre></div>
<hr /><a name="file39" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>edc_l2sq.h</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/edc_l2sq.h
+++ lxdream/src/gdrom/edc_l2sq.h
@@ -1,1180 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/* @(#)l2sq_table    1.2 02/10/19 Copyright 2002 J. Schilling */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-static const unsigned short L2sq[43][256] = {
-{0,44719,16707,61420,33414,11305,50117,28010,6417,47038,
-   22610,63229,39831,13624,56020,29819,12834,40077,29537,56782,
-   45220,7691,61927,24392,11059,34204,27248,50399,43445,1818,
-   59638,18009,25668,51947,9479,35752,59074,18541,42881,2350,
-   32085,54266,15382,37561,65491,20860,48784,4159,22118,63689,
-   5925,47498,54496,31311,38307,15116,20343,57816,3636,41115,
-   52721,25438,36018,8733,51336,26151,35275,10084,18958,58529,
-   2893,42466,53657,32566,37082,15989,21279,64944,4700,48371,
-   64170,21509,48105,5446,30764,54915,14703,38848,58299,19732,
-   41720,3159,24893,53138,8318,36561,44236,611,60815,17184,
-   11850,32997,28425,49574,46557,7026,62622,23089,14171,39412,
-   30232,55479,40686,12353,57261,28930,7272,45767,23851,62340,
-   34815,10576,50876,26643,1401,43990,17466,60053,36109,9122,
-   52302,25313,3979,41252,20168,57447,37916,15027,54623,31728,
-   5786,47157,22489,63862,48943,4480,65132,20675,15785,37638,
-   31978,53829,42558,2193,59261,18898,9400,35351,26107,52052,
-   59721,18406,43018,1701,27599,50528,10892,33827,61528,24311,
-   45339,8116,29406,56433,13213,40242,56171,30148,39464,13447,
-   23021,63298,6318,46593,49786,27861,33593,11670,16636,61011,
-   447,44816,17797,60202,1222,43625,50947,27052,34368,10479,
-   23700,62011,7639,45944,56850,28861,40785,12798,30631,55560,
-   14052,38987,62753,23438,46178,6861,28342,49177,12277,33114,
-   60464,17055,44403,988,8641,36718,24706,52781,41799,3560,
-   57860,19627,14544,38527,31123,55100,47702,5369,64277,21946,
-   5091,48460,21152,64527,37221,16330,53286,32393,2802,42077,
-   19377,58654,34932,9947,51511,26520,
-},
-{0,55768,44973,30325,17223,39583,60650,13618,34446,24406,
-   10531,61691,50633,7185,27236,46012,4353,51417,48812,26484,
-   21062,35742,65003,9267,38799,20055,14370,57850,54472,3344,
-   31589,41661,8706,64474,36271,21623,24901,47261,52968,5936,
-   42124,32084,2849,54009,59339,15891,18534,37310,13059,60123,
-   40110,17782,28740,43420,57321,1585,46477,27733,6688,50168,
-   63178,12050,22887,32959,17412,40412,60329,12913,1859,56987,
-   43246,28982,49802,6994,27943,46335,33229,22549,11872,63416,
-   21765,36061,64168,9072,5698,53146,47599,24631,54155,2643,
-   31782,42494,37068,18708,16225,59065,26118,49118,51627,4211,
-   9537,64665,35564,21300,57480,14672,20261,38653,41935,31255,
-   3170,54714,30471,44767,55466,370,13376,60824,39917,16949,
-   61833,10321,24100,34812,45774,27414,7523,50363,34824,20944,
-   10149,65149,52047,4759,25826,48442,3718,55134,41259,30963,
-   19905,37913,57964,15284,39177,16593,13988,61308,55886,918,
-   30179,44091,8071,50783,45098,27122,23744,34072,62317,10933,
-   43530,29650,1447,56447,59725,12437,18144,40760,11396,62812,
-   33577,23281,28611,46619,49262,6582,47883,25299,5286,52606,
-   63564,8596,22497,36409,15749,58461,37416,19440,32450,42778,
-   53615,2231,52236,5588,25505,47737,36683,22163,8422,63806,
-   19074,37722,58671,15607,2501,53277,42600,32688,56589,1237,
-   29344,43896,40522,18322,12775,59455,23427,33371,62510,11766,
-   6340,49436,46953,28337,60942,14294,16803,39035,44361,29841,
-   740,56124,26752,45400,50989,7925,11207,61983,33898,23986,
-   65295,9943,20642,35194,48200,26000,5093,51773,31105,41049,
-   54828,4084,15046,58142,38251,19635,
-},
-{0,27757,55514,46263,44457,49604,30067,6430,18255,11042,
-   40853,62456,60134,34443,12860,24145,36510,58099,22084,14889,
-   9015,20314,64493,38784,51665,42428,4363,32102,25720,2069,
-   48290,53455,289,27980,55803,46486,44168,49381,29778,6207,
-   18030,10755,40628,62169,60359,34730,13085,24432,36799,58322,
-   22373,15112,8726,20091,64204,38561,51440,42141,4138,31815,
-   25945,2356,48515,53742,578,28207,55960,46837,45035,50054,
-   30513,7004,17677,10592,40407,61882,59556,33993,12414,23571,
-   36060,57521,21510,14443,8565,19736,63919,38338,52115,43006,
-   4937,32548,26170,2647,48864,53901,867,28430,56249,47060,
-   44746,49831,30224,6781,17452,10305,40182,61595,59781,34280,
-   12639,23858,36349,57744,21799,14666,8276,19513,63630,38115,
-   51890,42719,4712,32261,26395,2934,49089,54188,1156,26857,
-   56414,45107,43309,50496,29175,7578,17355,12198,39697,63356,
-   61026,33295,14008,23253,35354,58999,21184,16045,10163,19422,
-   65385,37636,52565,41272,5519,31202,24828,3217,47142,54347,
-   1445,27080,56703,45330,43020,50273,28886,7355,17130,11911,
-   39472,63069,61251,33582,14233,23540,35643,59222,21473,16268,
-   9874,19199,65096,37413,52340,40985,5294,30915,25053,3504,
-   47367,54634,1734,27307,56860,45681,43887,50946,29621,8152,
-   16777,11748,39251,62782,60448,32845,13562,22679,34904,58421,
-   20610,15599,9713,18844,64811,37190,53015,41850,6093,31648,
-   25278,3795,47716,54793,2023,27530,57149,45904,43598,50723,
-   29332,7929,16552,11461,39026,62495,60673,33132,13787,22966,
-   35193,58644,20899,15822,9424,18621,64522,36967,52790,41563,
-   5868,31361,25503,4082,47941,55080,
-},
-{0,47289,28015,54742,56030,25191,47025,3848,43425,4376,
-   50382,31863,29567,52166,7696,42665,20319,63462,8752,39561,
-   38273,11576,63726,16471,59134,24135,35729,13096,15392,33945,
-   20815,59894,40638,9735,62417,19304,17504,64729,10511,37302,
-   14111,36774,23152,58057,60865,21880,32942,14359,53729,26968,
-   48270,1079,2879,45958,26192,57065,30784,49401,5423,44438,
-   41630,6695,53233,30536,8545,39384,19470,62647,64447,17158,
-   38608,11881,35008,12409,58799,23830,21022,60071,16241,34760,
-   28222,54919,849,48104,46304,3161,55695,24886,51103,32550,
-   43760,4681,7489,42488,28718,51351,49119,1894,53936,27145,
-   25857,56760,2158,45271,5758,44743,31505,50088,52384,29721,
-   41423,6518,61568,18489,40431,9558,10846,37607,18225,65416,
-   22817,57752,13390,36087,33791,15174,61072,22057,17090,64123,
-   12205,38676,38940,8357,62835,19914,60259,21466,34316,16053,
-   12733,35076,23762,58475,3485,46372,24818,55371,55107,28666,
-   47660,661,42044,7301,51539,29162,32482,50779,5005,43828,
-   56444,25797,45331,2474,1698,48667,27597,54132,30173,52580,
-   6322,40971,44803,6074,49772,31445,37667,11162,65100,18165,
-   18941,61764,9362,39979,14978,33339,22509,61268,57436,22757,
-   36147,13706,25507,56090,3788,46709,47485,452,54290,27819,
-   51714,29371,42861,8148,4316,43109,32179,50442,11516,37957,
-   16787,63786,63010,20123,39757,9204,34141,15844,59442,20619,
-   24451,59194,13036,35413,64797,17828,36978,10443,10179,40826,
-   19116,61973,21692,60421,14803,33130,36450,14043,58125,23476,
-   45634,2811,57133,26516,26780,53285,1523,48458,7139,41818,
-   30348,52789,49469,31108,44114,5355,
-},
-{0,53971,47547,27496,28523,48568,54992,1027,57046,3077,
-   26477,46526,45501,25454,2054,56021,41393,29538,6154,51929,
-   52954,7177,30561,42418,32615,44468,50908,5135,4108,49887,
-   43447,31588,24447,36268,59076,13335,12308,58055,35247,23420,
-   33193,21370,14354,60097,61122,15377,22393,34218,65230,11293,
-   18293,38310,37285,17270,10270,64205,8216,62155,39331,19312,
-   20339,40352,63176,9243,48894,27693,1861,54678,53653,838,
-   26670,47869,24616,45819,55699,2880,3907,56720,46840,25643,
-   8015,52636,42740,29735,28708,41719,51615,6988,49561,4938,
-   30754,43761,44786,31777,5961,50586,57729,13138,22586,35561,
-   36586,23609,14161,58754,16215,60804,34540,21567,20540,33519,
-   59783,15188,16432,37603,63883,11096,12123,64904,38624,17459,
-   40678,19509,10077,62862,61837,9054,18486,39653,25057,45874,
-   55386,2697,3722,56409,46897,26082,48951,28132,1676,54367,
-   53340,655,27111,47924,49232,4739,31211,43832,44859,32232,
-   5760,50259,7814,52309,42813,30190,29165,41790,51286,6789,
-   16030,60493,34597,22006,20981,33574,59470,15005,57416,12955,
-   23027,35616,36643,24048,13976,58443,40751,19964,9876,62535,
-   61508,8855,18943,39724,16889,37674,63554,10897,11922,64577,
-   38697,17914,57119,3532,26276,46199,45172,25255,2511,56092,
-   457,54042,47218,27297,28322,48241,55065,1482,32430,44157,
-   50965,5574,4549,49942,43134,31405,41080,29355,6595,51984,
-   53011,7616,30376,42107,32864,21171,14811,60168,61195,15832,
-   22192,33891,24246,35941,59149,13790,12765,58126,34918,23221,
-   8657,62210,39018,19129,20154,40041,63233,9682,65287,11732,
-   18108,37999,36972,17087,10711,64260,
-},
-{0,59366,54225,13367,48063,23641,26734,36744,27491,35973,
-   47282,24404,53468,14138,781,58603,54982,12576,1303,58097,
-   28025,35487,48808,22862,48549,23107,28276,35218,1562,57852,
-   54731,12845,45457,22135,25152,34214,2606,60872,55807,15897,
-   56050,15636,2339,61125,24909,34475,45724,21882,26455,32945,
-   46214,21344,56552,15118,3897,59615,3124,60370,57317,14339,
-   46987,20589,25690,33724,32575,39129,44270,19208,50304,9062,
-   5969,61623,5212,62394,51085,8299,45027,18437,31794,39892,
-   43513,19999,31272,40398,4678,62880,49559,9841,49818,9596,
-   4427,63149,31013,40643,43764,19730,52910,10568,7551,64153,
-   29969,37623,42688,16678,42445,16939,30236,37370,7794,63892,
-   52643,10821,6248,65422,52153,11359,41943,17457,28678,38880,
-   29451,38125,41178,18236,51380,12114,7013,64643,65150,6552,
-   11695,51785,17857,41511,38416,29174,38173,29435,18124,41258,
-   11938,51524,64883,6805,10424,53086,64361,7311,37639,29921,
-   16598,42800,17371,42045,36874,30700,63588,8066,11189,52307,
-   20463,43017,39998,31704,62544,5046,10113,49255,9356,50026,
-   63325,4283,40755,30933,19682,43780,39209,32463,19192,44318,
-   8854,50544,61767,5793,62026,5548,8603,50813,18933,44563,
-   39460,32194,33089,26279,21136,46454,15102,56600,59695,3785,
-   59938,3524,14835,56853,20893,46715,33356,26026,22407,45153,
-   33878,25520,60472,3038,16361,55311,15588,56066,61237,2259,
-   34651,24765,21642,45932,12496,55094,58113,1255,35695,27785,
-   22718,48984,23475,48213,34914,28548,57356,2026,13277,54331,
-   58902,496,13767,53793,23977,47695,36472,27038,36213,27283,
-   24228,47426,14026,53548,58651,765,
-},
-{0,29554,59108,38294,53717,41639,14129,17475,49079,52421,
-   22867,10785,28258,7440,34950,64500,25459,4097,34199,63205,
-   45734,49620,21570,10032,56516,44982,14880,18770,3345,32355,
-   60405,39047,50918,46484,8194,21360,5939,25665,61911,33445,
-   31057,2595,40885,60615,43140,56310,20064,15634,42389,55015,
-   17265,12291,29760,1842,37540,57814,6690,26960,64710,36788,
-   52215,47237,11539,24161,37329,58019,30517,1095,16388,13174,
-   42720,54674,11878,23828,51330,48112,65459,36033,6487,27173,
-   62114,33232,5190,26420,9079,20485,50579,46817,19733,15975,
-   44017,55427,40128,61362,31268,2390,22327,9285,45523,49825,
-   34530,62864,24582,4980,59520,39922,3684,32022,14677,18983,
-   57265,44227,13380,18230,53920,41426,58769,38627,885,28679,
-   35827,63617,27927,7781,23078,10580,48322,53168,16319,19661,
-   55643,43561,61034,40216,2190,31740,32776,62330,26348,5534,
-   20957,8879,46905,50251,23756,12222,47656,51546,36121,65131,
-   27645,6287,58235,36873,1439,30445,12974,16860,54346,42808,
-   63833,35371,8125,27855,10380,23550,52840,48410,18158,13724,
-   40970,54136,38715,58441,29151,685,39466,59736,31950,4028,
-   19455,14477,44315,56937,9629,22255,50041,45067,62536,34618,
-   4780,25054,44654,56604,18570,15352,32699,3273,39263,59949,
-   4569,25259,63293,33871,49164,45950,9960,21914,52509,48751,
-   11257,22667,7368,28602,64044,35166,29354,472,37966,59196,
-   41855,53261,17819,14057,26760,7162,36460,64798,47453,51759,
-   24505,11467,55103,42061,12763,17065,1770,30104,57358,37756,
-   3067,30857,60703,40557,55854,43356,15562,20408,46156,51006,
-   21160,8666,26009,5867,33661,61455,
-},
-{0,14648,29296,19272,58592,56792,38544,44968,54749,60645,
-   42925,40597,12605,2053,17229,31349,47015,36511,50647,64751,
-   21319,27263,8503,6159,25210,23362,4106,10546,34458,49058,
-   62698,52690,29523,19051,291,14363,38835,44683,58819,56571,
-   42638,40886,54526,60870,17006,31574,12318,2342,50420,64972,
-   46724,36796,8212,6444,21092,27484,4393,10257,25433,23137,
-   62921,52465,34745,48769,59046,57246,38102,44526,582,15230,
-   28726,18702,13179,2627,16651,30771,55195,61091,42475,40147,
-   20737,26681,9073,6729,46561,36057,51089,65193,34012,48612,
-   63148,53140,24636,22788,4684,11124,38389,44237,59269,57021,
-   28949,18477,869,14941,16424,30992,12888,2912,42184,40432,
-   54968,61312,8786,7018,20514,26906,50866,65418,46274,36346,
-   63375,52919,34303,48327,4975,10839,24863,22567,53585,59497,
-   41761,39449,13745,3209,18369,32505,1164,15796,30460,20420,
-   57452,55636,37404,43812,26358,24526,5254,11710,33302,47918,
-   61542,51550,45867,35347,49499,63587,22475,28403,9659,7299,
-   41474,39738,53362,59722,18146,32730,13458,3498,30687,20199,
-   1455,15511,37695,43527,57679,55415,5541,11421,26581,24301,
-   61765,51325,33589,47629,49272,63808,45576,35632,9368,7584,
-   22248,28624,14327,3791,17799,31935,54039,59951,41319,39007,
-   57898,56082,36954,43362,1738,16370,29882,19842,32848,47464,
-   61984,51992,25776,23944,5824,12280,21901,27829,10237,7877,
-   45421,34901,49949,64037,17572,32156,14036,4076,41028,39292,
-   53812,60172,37241,43073,58121,55857,30105,19617,2025,16081,
-   62211,51771,33139,47179,6115,11995,26003,23723,9950,8166,
-   21678,28054,49726,64262,45134,35190,
-},
-{0,7197,14394,9255,28788,27753,18510,21587,57576,64757,
-   55506,50383,37020,35969,43174,46267,56781,49616,58871,63978,
-   44473,45476,38275,35230,15653,8504,1311,6402,19793,20812,
-   30059,26998,42887,48026,40893,33696,55283,52206,61385,62420,
-   18287,23410,32597,25416,14107,11014,3873,4924,31306,26199,
-   17008,24173,2622,5667,12804,11801,39586,34495,41624,48773,
-   60118,63179,53996,52977,21267,20238,27433,30516,9063,16250,
-   7005,1856,46075,45030,35777,38876,50063,57234,64437,59304,
-   36574,37571,46820,43769,65194,58039,50832,55949,28214,29227,
-   22028,18961,7746,607,9848,14949,62612,59529,52398,53427,
-   34016,39165,48346,41159,5244,2145,11334,12379,25608,30741,
-   23602,16431,10585,13636,4451,3454,22829,17712,24855,32010,
-   51633,54700,61835,60822,47557,42456,33279,40418,42534,47675,
-   40476,33281,54866,51791,61032,62069,18126,23251,32500,25321,
-   14010,10919,3712,4765,31723,26614,17361,24524,2975,6018,
-   13221,12216,39683,34590,41785,48932,60279,63338,54093,53072,
-   417,7612,14747,9606,29141,28104,18927,22002,57673,64852,
-   55667,50542,37181,36128,43271,46362,56428,49265,58454,63563,
-   44056,45061,37922,34879,15492,8345,1214,6307,19696,20717,
-   29898,26839,62773,59688,52495,53522,34113,39260,48507,41318,
-   5597,2496,11751,12794,26025,31156,23955,16782,10488,13541,
-   4290,3295,22668,17553,24758,31915,51216,54285,61482,60471,
-   47204,42105,32862,40003,21170,20143,27272,30357,8902,16091,
-   6908,1761,45658,44615,35424,38525,49710,56883,64020,58889,
-   36735,37730,46917,43864,65291,58134,50993,56108,28567,29578,
-   22445,19376,8163,1022,10201,15300,
-},
-{0,32897,7455,40350,14910,47807,10017,42912,29820,62717,
-   26979,59874,20034,52931,21341,54236,59640,26745,62951,30054,
-   53958,21063,53209,20312,40068,7173,33179,282,42682,9787,
-   48037,15140,52717,19820,53490,20595,63443,30546,60108,27213,
-   47505,14608,42126,9231,33711,814,40624,7729,9493,42388,
-   14346,47243,7979,40874,564,33461,20841,53736,19574,52471,
-   27479,60374,30280,63177,34759,1862,39640,6745,48633,15736,
-   41190,8295,62395,29498,61092,28197,51589,18692,54426,21531,
-   28479,61374,29216,62113,21761,54656,18462,51359,6979,39874,
-   1628,34525,8573,41468,15458,48355,18986,51883,22325,55220,
-   28692,61589,27915,60810,15958,48855,9033,41928,1128,34025,
-   6519,39414,41682,8787,49101,16204,39148,6253,34291,1394,
-   54958,22063,52145,19248,60560,27665,61839,28942,5011,37650,
-   3724,36365,10669,43308,13490,46131,26607,59246,31472,64113,
-   24017,56656,16590,49231,64363,31722,58996,26357,49493,16852,
-   56394,23755,36631,3990,37384,4745,46377,13736,43062,10423,
-   56958,24319,50017,17376,58432,25793,63839,31198,43522,10883,
-   46877,14236,36924,4285,36131,3490,13958,46599,11161,43800,
-   3256,35897,4519,37158,17146,49787,24549,57188,30916,63557,
-   26075,58714,37972,5333,35147,2506,44650,12011,45941,13300,
-   57384,24745,64823,32182,55830,23191,50953,18312,31916,64557,
-   25011,57650,18066,50707,23437,56076,2256,34897,5583,38222,
-   13038,45679,12273,44912,22969,55608,17574,50215,25479,58118,
-   32408,65049,11717,44356,12506,45147,6139,38778,2788,35429,
-   45377,12736,44126,11487,35711,3070,38496,5857,50493,17852,
-   55330,22691,65283,32642,57884,25245,
-},
-{0,52943,33155,20300,7963,53716,40600,20567,15926,61689,
-   49077,29050,8493,61410,41134,28257,31852,45731,65007,13088,
-   25463,44472,58100,11323,16986,35989,50137,3350,23873,37774,
-   56514,4621,63704,13847,31067,46996,59331,10508,26176,43151,
-   50926,2081,18285,35234,55797,5946,22646,38585,33972,19067,
-   1335,52216,39855,21856,6700,54499,47746,29773,15105,62926,
-   42393,27478,9242,60117,60845,9058,27694,41697,62134,15481,
-   29493,48634,54171,7508,21016,40151,52352,591,19715,33740,
-   37313,24334,4162,56973,36570,16405,3929,49558,45047,24888,
-   11892,57531,45292,32291,12655,65440,5493,56250,38134,23097,
-   2670,50337,35821,17698,11075,58764,43712,25615,13400,64151,
-   46555,31508,26905,42966,59546,9813,30210,47309,63361,14670,
-   22319,39392,54956,6243,18484,34555,51639,1912,51015,2440,
-   18116,34827,55388,5779,23007,38672,63857,14270,30962,46653,
-   58986,10405,26601,43302,47915,30180,15016,62567,42032,27391,
-   9651,60284,34077,19410,1182,51793,39430,21705,7045,54602,
-   16287,61776,48668,28883,8324,61003,41223,28616,425,53094,
-   32810,20197,7858,53373,40753,20990,17395,36156,49776,3263,
-   23784,37415,56683,5028,32197,45834,64582,12937,25310,44049,
-   58205,11666,10986,58405,43881,26022,13809,64318,46194,31421,
-   5340,55827,38239,23440,3015,50440,35396,17547,22150,38985,
-   55045,6602,18845,34642,51230,1745,26800,42623,59699,10236,
-   30635,47460,63016,14567,53810,7421,21425,40318,52521,998,
-   19626,33381,60420,8907,28039,41800,62239,15824,29340,48211,
-   44638,24721,12253,57618,45381,32650,12486,65033,36968,24231,
-   4587,57124,36723,16828,3824,49215,
-},
-{0,59880,53197,9765,33671,27247,19530,42402,6931,62203,
-   54494,15670,39060,29052,22361,48817,13862,57294,63979,4099,
-   46497,23625,31340,37764,11573,50397,58104,2832,44722,18266,
-   24959,34967,27724,34212,41857,19049,61387,1571,8198,51694,
-   30559,40631,47250,20858,62680,7472,15125,54013,23146,45954,
-   38311,31823,55789,12293,5664,65480,16761,43153,36532,26460,
-   49918,11030,3379,58587,55448,12656,5973,65213,23327,45815,
-   38098,32058,50059,10851,3142,58798,16396,43492,36801,26153,
-   61118,1878,8563,51355,27961,34001,41716,19228,62893,7237,
-   14944,54152,30250,40898,47591,20495,46292,23868,31513,37617,
-   14163,57019,63646,4470,44999,17967,24586,35298,11328,50600,
-   58253,2661,33522,27418,19775,42199,373,59549,52920,10064,
-   39393,28681,22060,49092,6758,62350,54699,15427,44333,17605,
-   25312,35592,11946,51010,57703,2191,46654,24534,31219,36891,
-   13753,56401,64116,5020,39691,29411,21702,48430,6284,61796,
-   55105,16041,32792,27120,20437,42557,927,60023,52306,9658,
-   49505,10377,3756,59204,17126,43790,36139,25795,55922,13210,
-   5567,64599,23029,45085,38456,32720,63303,7855,14474,53602,
-   29888,40232,47885,21221,60500,1468,9113,51825,28627,34363,
-   40990,18934,30133,40029,47736,21392,63026,8154,14847,53271,
-   28326,34638,41323,18563,60705,1225,8940,51972,17299,43643,
-   35934,26038,49172,10748,4057,58929,22656,45416,38733,32421,
-   56071,13039,5322,64802,6649,61457,54836,16348,39550,29590,
-   21939,48219,746,60162,52519,9423,33133,26757,20128,42824,
-   12255,50743,57362,2554,44120,17840,25493,35453,13516,56612,
-   64257,4841,46923,24227,30854,37230,
-},
-{0,29813,59626,40095,52681,47548,9507,20822,34703,62458,
-   28517,6928,19014,15923,41644,55001,4867,26486,64489,36764,
-   57034,43711,13856,16981,38028,57593,31846,2067,22853,11568,
-   45487,50650,9734,21107,52972,47769,60367,40890,805,30544,
-   41353,54780,18787,15638,27712,6197,33962,61663,13573,16752,
-   56815,43418,63692,36025,4134,25683,45706,50943,23136,11797,
-   32579,2870,38825,58332,19468,14457,42214,53395,33221,62896,
-   26927,7514,52099,49142,9065,22300,1610,29247,61088,39637,
-   24335,11130,47077,50064,37574,59059,31276,3673,55424,44277,
-   12394,17439,5449,24892,64931,35286,27146,7807,33504,63125,
-   42947,54198,20265,15196,60805,39408,1391,28954,8268,21561,
-   51366,48339,30985,3452,37347,58774,46272,49333,23594,10335,
-   65158,35571,5740,25113,13135,18234,56229,45008,38936,60525,
-   28914,1159,21969,8612,48443,51534,8087,27618,63357,33544,
-   53854,42539,15028,20161,35611,65390,25585,6020,18130,12967,
-   44600,55885,3220,30945,58494,36875,49501,46376,10679,24002,
-   48670,51819,22260,8833,29655,1954,39741,61256,14737,19940,
-   53627,42254,62552,32813,7346,26823,44317,55656,17911,12674,
-   24788,5281,34878,64587,10898,24295,49784,46605,59227,37678,
-   4017,31684,54292,41057,15614,18571,6621,28072,61751,34114,
-   21403,10222,47985,52996,40530,59943,30392,717,50967,45922,
-   12285,23432,2782,32427,57908,38465,16536,13549,43122,56327,
-   36177,63780,26043,4558,61970,34407,6904,28301,16347,19374,
-   55089,41796,30109,488,40311,59650,47188,52257,20670,9419,
-   57617,38244,2555,32142,11480,22701,50226,45127,26270,4843,
-   36468,64001,43863,57122,17341,14280,
-},
-{0,46261,30071,49602,60142,24155,40857,11052,51649,32116,
-   48310,2051,9007,38810,22104,58093,36767,15146,64232,20061,
-   25969,53700,4102,42163,18014,62187,13097,34716,44208,6149,
-   55751,28018,803,46998,30292,49889,59853,23928,40122,10255,
-   51938,32343,49045,2848,8204,38073,21883,57806,36028,14345,
-   63947,19838,26194,53991,4901,42896,17789,61896,12298,33983,
-   44947,6950,56036,28241,1606,45811,29489,51076,60584,22557,
-   39391,11626,53127,31538,47856,3653,9577,37340,20510,58539,
-   35289,15724,64686,18459,25399,55170,5696,41717,16408,62637,
-   13679,33242,43766,7747,57217,27444,1381,45520,28690,50343,
-   61323,23358,39676,11849,52388,30737,47571,3430,9802,37631,
-   21309,59272,35578,15951,65421,19256,24596,54433,5475,41430,
-   17211,63374,13900,33529,43477,7520,56482,26647,3212,47161,
-   31227,52558,58978,21207,37653,10144,50509,29176,45114,1167,
-   12195,39702,23252,61025,33555,14246,63076,17105,27133,56648,
-   7306,43071,19154,65127,16293,35600,41020,5257,54603,25086,
-   4015,47898,31448,52845,58689,20980,36918,9347,50798,29403,
-   45849,1964,11392,38965,23031,60738,32816,13445,62791,16882,
-   27358,56939,8105,43804,18929,64836,15494,34867,41759,6058,
-   54888,25309,2762,48767,32701,51976,57380,21649,38227,8678,
-   49931,30654,46716,713,10725,40272,23698,59431,34133,12768,
-   61474,17559,28603,56078,6860,44665,19604,63521,14819,36182,
-   42618,4815,54029,26552,2537,48476,31902,51243,58119,22450,
-   38512,8901,49192,29853,46431,490,10950,40563,24497,60164,
-   34422,12995,62209,18356,27800,55341,6639,44378,20407,64258,
-   15040,36469,42329,4588,53294,25755,
-},
-{0,54485,46519,24930,30579,41894,49860,5649,61158,14899,
-   23377,36740,39317,19776,11298,63735,49617,5380,29798,41139,
-   46754,25207,789,55232,12087,64482,39552,20053,22596,35985,
-   60915,14630,40895,19306,10760,65245,59596,15385,23931,35246,
-   29017,42380,50414,4155,1578,54015,45981,26440,24174,35515,
-   60377,16140,10525,64968,40106,18559,45192,25693,1343,53738,
-   51195,4910,29260,42649,9059,63414,38612,16897,21520,32965,
-   57767,13682,52613,6480,30770,44263,47862,28195,3905,56212,
-   58034,13927,22277,33744,38337,16660,8310,62627,3156,55425,
-   47587,27958,31527,45042,52880,6725,48348,26633,2411,56766,
-   52143,8058,32280,43725,21050,34543,59277,13144,9545,61852,
-   37118,17451,32013,43480,51386,7279,2686,57003,49097,27420,
-   37867,18238,9820,62089,58520,12365,20783,34298,18118,37395,
-   62321,10148,12725,58720,33794,20695,43040,31989,7575,51522,
-   57171,2950,27364,48689,34583,21442,12960,58997,61540,9393,
-   17875,37126,27121,48420,56390,2195,7810,51799,43829,32736,
-   55673,3500,27854,47131,44554,31455,7101,53096,14239,58186,
-   33320,22269,16620,37945,62811,8590,6312,52349,44319,31178,
-   28635,47886,55916,3769,63054,8859,17401,38700,33085,21992,
-   13450,57439,26021,45424,53266,1223,4822,50691,42849,29620,
-   35651,24470,16116,59937,64560,10469,18823,40274,42100,28833,
-   4547,50454,54023,2002,26288,45669,19090,40519,65317,11248,
-   15841,59700,34902,23683,64026,11983,20397,39800,36201,22972,
-   14558,60427,5372,49193,41291,30110,25487,46938,54840,749,
-   15307,61214,36476,23209,19640,39021,63759,11738,54573,504,
-   24730,46159,41566,30347,6121,49980,
-},
-{0,58597,54743,12594,47027,21334,25188,34433,29563,38814,
-   42668,16969,50376,8237,4383,62970,59126,531,13089,55236,
-   20805,46496,33938,24695,38285,29032,16474,42175,8766,50907,
-   63465,4876,53745,13588,1062,57539,26178,33447,45973,22384,
-   41610,18031,30557,37816,5433,61916,49390,9227,14087,54242,
-   58064,1589,32948,25681,21859,45446,17532,41113,37291,30030,
-   62415,5930,9752,49917,49151,23322,27176,36557,2124,60585,
-   56731,14718,52356,10337,6483,64950,31543,40914,44768,18949,
-   22793,48620,36062,26683,61114,2655,15213,57224,10866,52887,
-   65445,6976,40385,31012,18454,44275,28174,35563,48089,24380,
-   55741,15704,3178,59535,7541,63888,51362,11335,43718,20003,
-   32529,39924,35064,27677,23855,47562,16203,56238,60060,3705,
-   64387,8038,11860,51889,19504,43221,39399,32002,25571,34566,
-   46644,21201,54352,12469,391,58722,4248,62589,50511,8618,
-   42795,17358,29436,38425,34069,25072,20674,46119,12966,54851,
-   59249,916,63086,4747,9145,51036,16861,42296,37898,28911,
-   45586,22263,26565,33568,1441,57668,53366,13459,49513,9612,
-   5310,61531,30426,37439,41741,18408,21732,45057,33075,26070,
-   58199,1970,13952,53861,10143,50042,62024,5805,36908,29897,
-   17915,41246,56348,14585,2507,60718,27567,36682,48760,23197,
-   44903,19330,31408,40533,6356,64561,52483,10726,15082,56847,
-   61245,3032,36185,27068,22670,48235,18833,44404,40006,30883,
-   65058,6855,11253,53008,3565,59656,55354,15583,47710,24251,
-   28553,35692,32406,39539,43841,20388,51493,11712,7410,63511,
-   60187,4094,16076,55849,23720,47181,35199,28058,39008,31877,
-   19895,43346,12243,52022,64004,7905,
-},
-{0,64765,58855,6426,55251,11054,12852,52937,46011,20294,
-   22108,43681,25704,39061,33167,32114,31595,34710,40588,25201,
-   44216,20549,18783,46498,51408,13357,11575,53706,7939,58366,
-   64228,1561,63190,2603,4913,61388,8453,56824,50402,14367,
-   17773,47504,41098,23671,37566,28227,30553,35748,36285,28992,
-   26714,38055,23150,42643,49033,17268,15878,49915,56289,10012,
-   59861,5416,3122,61647,61873,3404,5206,59563,9826,55967,
-   50053,16248,16906,48887,42989,23312,38361,26916,28734,36035,
-   35546,30247,28477,37824,23817,41460,47342,17427,14689,50588,
-   56454,8315,61106,4687,2901,63400,1895,64410,57984,7805,
-   53428,11337,13651,51630,46300,18465,20795,44486,25359,40946,
-   34536,31253,31756,33009,39403,25878,43999,22306,20024,45765,
-   53175,13130,10832,54957,6244,58521,64899,382,65407,898,
-   6808,58981,10412,54353,52555,12726,19652,45113,43299,21982,
-   39703,26602,32496,33293,33812,30953,25075,40206,21447,44858,
-   46624,19165,14255,52050,53832,11957,57468,7297,1435,63846,
-   2473,62804,60494,4275,56954,8839,15261,51040,47634,18159,
-   24565,41736,28097,37180,34854,29915,29378,36415,38693,27608,
-   42257,23020,16630,48139,49529,15748,9374,55395,5802,59991,
-   62285,4016,3790,62003,60201,6100,55581,9696,15610,49159,
-   48501,16776,22674,42095,27302,38491,36673,29628,30117,35160,
-   36930,27839,41590,24203,18321,47980,50718,15075,9209,57092,
-   4557,60720,62506,2263,63512,1253,7679,57602,12235,54070,
-   51756,14033,19363,46942,44612,21177,40048,24717,31127,34154,
-   33651,32654,26260,39529,21664,43101,45383,19898,12488,52277,
-   54575,10706,59163,7142,764,65025,
-},
-{0,61681,65023,3342,59363,5906,6684,60141,54235,9002,
-   11812,57045,13368,50377,51655,14646,48043,19290,18004,46757,
-   23624,44217,41399,20806,26736,39041,38287,25982,36755,32610,
-   29292,33437,27467,39866,38580,26181,36008,31833,29015,33190,
-   47248,18529,17775,46494,24435,44930,41612,21117,53472,8209,
-   11551,56814,14083,51186,51964,14861,827,62410,65220,3637,
-   58584,5161,6439,59862,54934,9831,11113,56216,12661,49540,
-   52362,15483,1357,62908,63666,2115,58030,4703,8017,61344,
-   27965,40396,37058,24627,35550,31279,30497,34768,48870,19991,
-   17177,46056,22789,43508,42234,21515,48605,19756,16418,45267,
-   23102,43727,42945,22320,28166,40695,37881,25352,35301,30996,
-   29722,34027,1654,63111,64393,2936,57749,4452,7274,60571,
-   54701,9564,10322,55459,12878,49855,53169,16192,45361,16832,
-   19662,48191,22226,42531,43821,23516,25322,37403,40725,28644,
-   34057,30200,30966,34823,2714,64107,63333,1940,60793,7560,
-   4230,57463,55617,10672,9406,54351,16034,52819,50013,13228,
-   55930,10891,10117,55156,15769,52584,49254,12439,2465,63824,
-   62558,1199,60994,7859,5053,58188,25041,37152,39982,27871,
-   34354,30403,31693,35644,45578,17147,20469,48900,21993,42264,
-   43030,22759,26535,38742,39512,27305,32836,28853,32187,36170,
-   46204,17549,18819,47474,21407,41838,44640,24209,56332,11517,
-   8691,53506,15343,51998,50704,14049,4055,65318,61992,729,
-   59444,6341,5579,58682,3308,64541,61715,482,60175,7166,
-   5872,58881,57143,12230,8904,53817,14548,51237,50475,13786,
-   46919,18358,19128,47689,20644,41045,44379,23978,25756,37997,
-   39267,27026,33663,29582,32384,36465,
-},
-{0,63223,61939,1796,65531,2316,3592,63743,58347,5404,
-   4632,58607,7184,60135,60899,6932,56267,11580,10808,56527,
-   9264,53959,54723,9012,14368,52951,51667,16164,51163,12588,
-   13864,49375,43915,23932,23160,44175,21616,41607,42371,21364,
-   18528,48791,47507,20324,47003,16748,18024,45215,28736,34487,
-   33203,30532,36795,31052,32328,35007,37803,25948,25176,38063,
-   27728,39591,40355,27476,19211,48636,47864,19471,46320,16903,
-   17667,46068,43232,24087,22803,45028,22299,41452,42728,20511,
-   37056,26167,24883,38852,28475,39372,40648,26687,29483,34268,
-   33496,29743,36048,31271,32035,35796,57472,5751,4467,59268,
-   8059,59788,61064,6271,875,62876,62104,1135,64656,2663,
-   3427,64404,15179,52668,51896,15439,50352,12871,13635,50100,
-   55456,11863,10579,57252,10075,53676,54952,8287,38422,24801,
-   26597,37138,27117,40730,38942,28393,30205,33546,33806,29433,
-   35334,31985,31733,36098,19933,47914,48174,19161,45606,17617,
-   17365,46370,44598,22721,24517,43314,20941,42810,41022,22217,
-   15773,52074,52334,15001,49766,13457,13205,50530,56950,10369,
-   12165,55666,8589,55162,53374,9865,58966,4257,6053,57682,
-   6573,61274,59486,7849,1469,62282,62542,697,64070,3249,
-   2997,64834,56605,11242,11502,55833,8934,54289,54037,9698,
-   16118,51201,52997,14834,49421,14330,12542,50697,1750,61473,
-   63269,466,63789,4058,2270,65065,58685,5066,5326,57913,
-   6854,60465,60213,7618,30358,32865,34661,29074,35181,32666,
-   30878,36457,38269,25482,25742,37497,27270,40049,39797,28034,
-   44381,23466,23726,43609,21158,42065,41813,21922,20150,47169,
-   48965,18866,45389,18362,16574,46665,
-},
-{0,62964,63477,513,62455,1539,1026,61942,64499,3591,
-   3078,63986,2052,65008,65521,2565,60411,7695,7182,59898,
-   6156,60920,61433,6669,4104,58876,59389,4617,58367,5643,
-   5130,57854,52203,15903,15390,51690,14364,52712,53225,14877,
-   12312,50668,51181,12825,50159,13851,13338,49646,8208,54756,
-   55269,8721,54247,9747,9234,53734,56291,11799,11286,55778,
-   10260,56800,57313,10773,35787,32319,31806,35274,30780,36296,
-   36809,31293,28728,34252,34765,29241,33743,30267,29754,33230,
-   24624,38340,38853,25137,37831,26163,25650,37318,39875,28215,
-   27702,39362,26676,40384,40897,27189,16416,46548,47061,16929,
-   46039,17955,17442,45526,48083,20007,19494,47570,18468,48592,
-   49105,18981,43995,24111,23598,43482,22572,44504,45017,23085,
-   20520,42460,42973,21033,41951,22059,21546,41438,2955,65151,
-   64638,2442,63612,3464,3977,64125,61560,1420,1933,62073,
-   911,63099,62586,398,57456,5508,6021,57969,4999,58995,
-   58482,4486,7043,61047,60534,6530,59508,7552,8065,60021,
-   49248,13716,14229,49761,13207,50787,50274,12694,15251,52839,
-   52326,14738,51300,15760,16273,51813,11163,56943,56430,10650,
-   55404,11672,12185,55917,53352,9628,10141,53865,9119,54891,
-   54378,8606,32832,30132,30645,33345,29623,34371,33858,29110,
-   31667,36423,35910,31154,34884,32176,32689,35397,27579,40527,
-   40014,27066,38988,28088,28601,39501,36936,26044,26557,37449,
-   25535,38475,37962,25022,19371,48735,48222,18858,47196,19880,
-   20393,47709,45144,17836,18349,45657,17327,46683,46170,16814,
-   41040,21924,22437,41553,21415,42579,42066,20902,23459,44631,
-   44118,22946,43092,23968,24481,43605,
-},
-{0,31355,62710,36493,62961,36746,263,31612,63487,36228,
-   777,31090,526,30837,63224,35971,62435,35224,1813,32110,
-   1554,31849,62180,34975,1052,32359,61674,35473,61933,35734,
-   1307,32608,64475,33184,3885,30038,3626,29777,64220,32935,
-   3108,30303,63698,33449,63957,33710,3363,30552,2104,29251,
-   64718,34485,64969,34738,2367,29508,65479,34236,2865,29002,
-   2614,28749,65216,33979,60331,37328,8029,25894,7770,25633,
-   60076,37079,7252,26159,59554,37593,59813,37854,7507,26408,
-   6216,25139,60606,38597,60857,38850,6479,25396,61367,38348,
-   6977,24890,6726,24637,61104,38091,4208,27147,58502,40701,
-   58753,40954,4471,27404,59279,40436,4985,26882,4734,26629,
-   59016,40179,58259,39400,5989,27934,5730,27673,58004,39151,
-   5228,28183,57498,39649,57757,39910,5483,28432,52043,45360,
-   16317,17862,16058,17601,51788,45111,15540,18127,51266,45625,
-   51525,45886,15795,18376,14504,17107,52318,46629,52569,46882,
-   14767,17364,53079,46380,15265,16858,15014,16605,52816,46123,
-   12432,19179,50278,48669,50529,48922,12695,19436,51055,48404,
-   13209,18914,12958,18661,50792,48147,50035,47368,14213,19966,
-   13954,19705,49780,47119,13452,20215,49274,47617,49533,47878,
-   13707,20464,8416,23195,54294,44653,54545,44906,8679,23452,
-   55071,44388,9193,22930,8942,22677,54808,44131,54019,43384,
-   10229,23950,9970,23689,53764,43135,9468,24199,53258,43633,
-   53517,43894,9723,24448,56123,41280,12237,21942,11978,21681,
-   55868,41031,11460,22207,55346,41545,55605,41806,11715,22456,
-   10456,21155,56366,42581,56617,42834,10719,21412,57127,42332,
-   11217,20906,10966,20653,56864,42075,
-},
-{0,46002,31609,51403,63218,17728,36235,15929,61945,16971,
-   35456,14642,1803,46265,31858,53184,65519,19549,33942,14116,
-   2333,47791,29284,49622,3606,48548,30063,50909,63716,19286,
-   33693,12335,58307,20593,39098,11016,5425,42627,28232,56826,
-   4666,41352,26947,56049,58568,22394,40881,11267,7212,44958,
-   26453,54503,60126,22892,37287,8725,60885,24167,38572,9502,
-   6951,43157,24670,54252,56219,26665,41186,4944,11625,40667,
-   22032,58786,10850,39376,20763,58025,56464,28450,42985,5211,
-   9332,38854,24333,60607,53894,24884,43519,6733,54669,26175,
-   44788,7494,9087,37069,22534,60340,14424,35818,17185,61587,
-   52906,32024,46547,1633,51617,31251,45784,362,16211,36065,
-   17450,63384,51127,29701,48334,3964,12613,33527,19004,63886,
-   13902,34300,19767,65157,49340,29454,48069,2167,43819,6297,
-   53330,25568,24025,61035,9888,38162,23250,59744,8619,37401,
-   44064,8082,55129,25835,21700,59254,12221,39951,41526,4484,
-   55631,27389,42301,5775,56900,28150,21455,57469,10422,39684,
-   18664,64346,13201,32803,48666,3496,50531,30417,47377,2723,
-   49768,29146,20451,64593,13466,34600,46855,1205,52350,32716,
-   16885,62023,14988,35134,18174,62796,15751,36405,45068,958,
-   52085,30919,28848,49922,3017,47227,34370,13808,64827,20105,
-   33097,13051,64048,18818,30651,50185,3266,49008,36703,15597,
-   62502,18324,31149,51743,724,45414,32422,52500,1503,46701,
-   34900,15334,62253,16543,37747,8385,59402,23480,25985,54835,
-   7928,44362,25226,53560,6643,43585,38008,10186,61185,23731,
-   27804,57134,6117,42071,39534,10716,57623,21157,40293,11991,
-   58908,21934,27543,55333,4334,41820,
-},
-{0,22872,45744,60392,31101,8229,52173,37525,62202,43938,
-   16458,6418,35719,53983,14647,24687,63977,41137,19289,4609,
-   32916,55756,12836,27516,2835,21067,47523,57595,29294,11062,
-   49374,39302,61391,46743,23935,1063,38578,53226,9218,32090,
-   7477,17517,44933,63197,25672,15632,55032,36768,5670,20350,
-   42134,64974,28507,13827,56811,33971,58588,48516,22124,3892,
-   40353,50425,12049,30281,50051,39643,28979,10347,47870,58278,
-   2126,20758,12665,26657,33737,55953,18436,4444,64180,41964,
-   14954,25394,35034,53634,17175,6735,61863,43263,51344,37320,
-   31264,9080,45549,59573,861,23045,11340,29972,40700,51108,
-   21809,3177,59265,48857,57014,34798,27654,13662,42955,65171,
-   5499,19491,54693,36093,26389,15949,44248,62848,7784,18224,
-   10079,32263,38383,52407,24098,1914,60562,46538,39707,49731,
-   10667,28915,57958,47934,20694,2446,27105,12473,56145,33289,
-   4252,18884,41516,64372,25330,15274,53314,35098,7055,17111,
-   43327,61543,36872,51536,8888,31712,59765,45101,23493,669,
-   29908,11660,50788,40764,3497,21745,48921,58945,34350,57206,
-   13470,28102,65363,42507,19939,5307,36157,54373,16269,26325,
-   62528,44312,18160,8104,32711,9887,52599,37935,1722,24546,
-   46090,60754,22680,448,59944,45936,8677,30909,37717,51725,
-   43618,62266,6354,16778,54047,35399,25007,14583,41329,63529,
-   5057,19097,55308,33108,27324,13284,21387,2771,57659,47203,
-   10998,29614,38982,49438,46935,60943,1511,23743,52778,38770,
-   31898,9666,17837,7413,63261,44613,15568,25992,36448,55096,
-   20158,6118,64526,42326,14275,28315,34163,56363,48196,58652,
-   3828,22444,50489,40033,30601,11985,
-},
-{0,11309,22618,29815,45236,40089,59630,50371,32117,20824,
-   9519,2306,52673,57836,38299,47542,64234,54983,41648,36509,
-   19038,26227,4612,15913,34719,43954,57285,62440,14123,6918,
-   28529,17244,59849,50660,45459,40382,22909,30032,295,11530,
-   38076,47249,52454,57547,9224,2085,31826,20607,4899,16142,
-   19321,26452,41879,36794,64461,55264,28246,17019,13836,6689,
-   57058,62159,34488,43669,53135,58274,38869,48120,32571,21270,
-   10081,2892,45818,40663,60064,50829,590,11875,23060,30265,
-   13669,6472,27967,16658,34257,43516,56715,61862,18448,25661,
-   4170,15463,63652,54409,41214,36051,9798,2667,32284,21041,
-   38642,47839,52904,57989,23347,30494,873,12100,60295,51114,
-   46045,40944,56492,61569,34038,43227,27672,16437,13378,6255,
-   41433,36340,63875,54702,4461,15680,18743,25882,33539,44846,
-   56153,63348,13239,8090,27629,18368,65142,53851,42540,35329,
-   20162,25327,5784,15029,31209,21956,8627,3486,51549,58736,
-   37127,48426,1180,10417,23750,28907,46120,38917,60530,49247,
-   27338,18151,12944,7869,55934,63059,33316,44553,6079,15250,
-   20453,25544,42763,35622,65361,54140,36896,48141,51322,58455,
-   8340,3257,30926,21731,60757,49528,46351,39202,24033,29132,
-   1467,10646,19596,24737,5334,14587,64568,53269,42082,34895,
-   12793,7636,27043,17806,33101,44384,55575,62778,46694,39499,
-   60988,49681,1746,11007,24200,29349,51987,59198,37705,48996,
-   31655,22410,9213,4048,42309,35176,64799,53554,5617,14812,
-   19883,24966,55344,62493,32874,44103,26756,17577,12510,7411,
-   24495,29570,2037,11224,61211,49974,46913,39788,8922,3831,
-   31360,22189,37486,48707,51764,58905,
-},
-{0,39065,11567,46518,23134,49863,30577,61416,46268,11301,
-   39315,266,61154,30331,50125,23380,30053,60924,22602,49363,
-   12091,47010,532,39565,49625,22848,60662,29807,39815,798,
-   46760,11825,60106,29267,51173,24444,45204,10253,40379,1314,
-   24182,50927,29529,60352,1064,40113,10503,45470,40879,1846,
-   45696,10777,50673,23912,59614,28743,11027,45962,1596,40613,
-   29005,59860,23650,50427,51593,20752,58534,31807,37847,2894,
-   48888,9825,32053,58796,20506,51331,10091,49138,2628,37597,
-   48364,9333,37315,2394,59058,32299,52125,21252,2128,37065,
-   9599,48614,21006,51863,32545,59320,9027,48090,3692,38645,
-   31005,57732,21554,52395,38911,3942,47824,8777,52641,21816,
-   57486,30743,22054,52927,31497,58256,3192,38113,8535,47566,
-   58010,31235,53173,22316,47300,8285,38379,3442,36623,6038,
-   41504,15033,54609,19912,63614,24807,15283,41770,5788,36357,
-   25069,63860,19650,54363,64106,25331,55109,20444,41012,14509,
-   36123,5506,20182,54863,25593,64352,5256,35857,14759,41278,
-   26053,64860,18666,53363,16283,42754,4788,35373,53625,18912,
-   64598,25807,35623,5054,42504,16017,4256,34873,15759,42262,
-   19198,53863,26577,65352,42012,15493,35123,4522,65090,26331,
-   54125,19444,18054,56863,27561,62256,7384,33857,12791,43374,
-   62010,27299,57109,18316,43108,12541,34123,7634,13283,43898,
-   7884,34389,27069,61732,17554,56331,34655,8134,43632,13033,
-   56577,17816,61486,26807,44108,13525,33123,6650,62994,28299,
-   56125,17316,6384,32873,13791,44358,17070,55863,28545,63256,
-   55593,16816,62470,27807,33655,7150,44632,14017,28053,62732,
-   16570,55331,14283,44882,6884,33405,
-},
-{0,49859,39323,23384,12075,60904,46768,29811,24150,40085,
-   51149,1294,29053,46014,59622,10789,48300,32367,9527,59380,
-   37767,20804,2588,51423,58106,8249,31585,47522,52689,3858,
-   21578,38537,25925,42886,64734,15901,19054,34989,54261,4406,
-   15123,63952,41608,24651,5176,55035,36259,20320,55785,6954,
-   16498,33457,63170,13313,28505,44442,34751,17788,7716,56551,
-   43156,27223,12559,62412,51850,2121,21265,37330,58785,10082,
-   31802,48889,38108,22047,3399,53124,48119,31028,8812,57519,
-   30246,46309,61373,11646,22797,39886,49302,597,10352,60083,
-   45547,29480,1883,50584,40640,23555,45007,27916,13908,62615,
-   32996,16935,6527,56252,61849,13146,26626,43713,57010,7281,
-   18217,34282,4963,53664,35576,18491,15432,65163,42451,26384,
-   19765,36854,54446,5741,25118,41181,64389,14662,35081,19402,
-   4242,53841,42530,25825,16313,64890,55135,5532,20164,35847,
-   63604,15031,25071,41772,13733,63334,44094,28413,6798,55373,
-   33557,16854,27635,43312,62056,12459,17624,34331,56643,8064,
-   60492,11919,30167,46868,50023,420,23292,38975,45594,28889,
-   11137,59714,40241,24562,1194,50793,20704,37411,51579,3000,
-   32715,48392,58960,9363,3766,52341,38701,21998,8605,58206,
-   47110,31429,17283,33088,55832,6363,27816,44651,62771,14320,
-   7637,57110,33870,18061,13054,61501,43877,27046,65327,15852,
-   26292,42103,53252,4807,18847,35676,41337,25530,14562,64033,
-   36434,19601,6089,54538,9926,58373,48989,32158,2541,52014,
-   36982,21173,30864,47699,57611,9160,22459,38264,52768,3299,
-   39530,22697,1009,49458,46401,30594,11482,60953,50236,1791,
-   23975,40804,60183,10708,29324,45135,
-},
-{0,61422,50113,11311,39839,29809,22622,47024,11043,50381,
-   59618,1804,45244,24402,29565,40083,22086,47528,38279,31337,
-   52697,8759,3608,57846,32101,37515,48804,20810,59130,2324,
-   9531,51925,44172,17250,28493,32931,14099,55549,62674,6972,
-   34735,26689,17518,43904,7216,62430,57329,12319,64202,5412,
-   14603,55013,24917,36539,41620,19834,53737,15879,4648,64966,
-   19062,42392,35255,26201,17669,43755,34500,26922,56986,12660,
-   7515,62133,28198,33224,44519,16905,62905,6743,13944,55702,
-   4931,64685,53378,16236,35036,26418,19229,42227,14432,55182,
-   64417,5199,41983,19473,24638,36816,59785,1639,10824,50598,
-   29206,40440,45527,24121,49834,11588,363,61061,22837,46811,
-   39668,29978,49103,20513,31758,37856,9296,52158,59281,2175,
-   38124,31490,22317,47299,3955,57501,52402,9052,35338,26084,
-   18891,42533,4501,65147,53844,15802,41257,20167,25320,36102,
-   15030,54616,63863,5785,56396,13218,8077,61539,18387,43069,
-   33810,27644,63343,6273,13486,56128,27888,33566,44849,16607,
-   9862,51560,58695,2729,48409,21239,32472,37174,3493,57931,
-   52836,8586,38458,31188,22011,47637,28864,40750,45825,23791,
-   60255,1201,10398,51056,23523,46093,38946,30668,49276,12178,
-   957,60499,53007,8417,3278,58144,21648,47998,38737,30911,
-   58412,3010,10221,51203,32691,36957,48242,21404,39241,30375,
-   23176,46438,726,60728,49431,12025,45674,23940,29099,40517,
-   10741,50715,59956,1498,25475,35949,41026,20396,63516,6130,
-   15325,54323,18592,42830,35681,25743,54079,15569,4350,65296,
-   13765,55851,62980,6634,44634,16820,28059,33397,7910,61704,
-   56615,13001,34169,27287,18104,43350,
-},
-{0,30582,61164,39322,49605,46771,12073,22623,40855,59617,
-   29051,1549,24146,10532,45246,51144,9011,21573,52703,47785,
-   58102,38272,3098,31596,48292,52178,21064,9534,32097,2583,
-   37773,58619,18022,12560,43146,57340,34723,61653,26959,7737,
-   55793,44679,14109,16491,6196,28482,63192,33198,25941,4643,
-   35769,64719,42128,54246,19068,15626,64194,36276,5166,25432,
-   15111,19569,54763,41629,36044,64442,25120,5462,19721,14975,
-   41957,54419,4955,25645,64951,35521,53918,42472,15474,19204,
-   45055,55433,16659,13925,28218,6476,32982,63392,12392,18206,
-   56964,43506,61869,34523,8001,26679,51882,48604,9286,21296,
-   2927,31769,58755,37621,21821,8779,48081,52391,38136,58254,
-   31252,3426,59801,40687,1909,28675,10332,24362,50864,45510,
-   30222,376,39138,61332,47051,49341,22823,11857,1413,29427,
-   60265,39967,50240,45878,10924,24026,39442,60772,29950,904,
-   23511,11425,46395,49741,9910,20928,51290,48940,59251,36869,
-   2463,32489,47393,52823,22477,8379,30948,3986,38408,57726,
-   17379,13461,44303,55929,33318,62800,27850,7100,56436,43778,
-   12952,17902,7601,27335,62301,33835,24784,6054,36412,63818,
-   41237,54883,20473,14479,65351,34865,4523,26333,16002,18932,
-   53358,42776,35145,65087,26533,4307,18572,16378,42592,53526,
-   5854,25000,63538,36676,55067,41069,14839,20097,43642,56588,
-   17558,13280,27583,7369,34131,61989,13805,17051,56065,44151,
-   62504,33630,6852,28082,53039,47193,8643,22197,3818,31132,
-   57350,38768,20664,10190,48724,51490,37245,58891,32657,2279,
-   60444,39786,752,30086,11737,23215,49973,46147,29579,1277,
-   40295,59921,45646,50488,23714,11220,
-},
-{0,15162,30324,19790,60648,55250,39580,41382,50637,65271,
-   46009,34947,10533,4639,24401,25707,38791,44221,57843,56009,
-   31599,16469,3355,13857,21066,26992,9278,7940,48802,34200,
-   51414,62444,13075,2089,17767,32349,57339,58561,43407,37557,
-   63198,52708,32938,48016,6710,8460,27714,22392,42132,40878,
-   53984,59866,18556,29510,15880,1330,24921,23139,5933,11287,
-   36273,46731,64453,49407,26150,23836,4178,11112,35534,45556,
-   64698,51072,41963,39121,54687,61093,20227,29753,14711,589,
-   61857,51867,34773,48367,7497,9843,27453,20487,13420,3926,
-   16920,31010,55428,58302,44784,38346,21813,28175,9025,6267,
-   47581,33511,53161,62611,37112,43970,59020,56758,31760,18218,
-   2660,12638,49842,63880,46278,36860,11866,5472,22574,25364,
-   1919,15429,28939,18993,60311,53421,40419,42713,52300,63350,
-   47672,33026,8356,7070,22224,28138,2433,12987,32757,17615,
-   58729,56915,37661,43047,23499,24817,11711,5765,46883,35865,
-   49495,64109,40454,42300,59506,54088,29422,18900,1178,16288,
-   65375,50277,35115,45585,5047,10381,26051,24313,14994,424,
-   19686,30684,54906,60736,40974,39732,26840,21474,7852,9622,
-   33840,48906,62020,51582,44309,38447,56161,57435,16893,31431,
-   14217,3251,43626,37200,56350,59172,18050,32184,12534,3020,
-   28583,21661,6611,8937,33615,47221,62779,52737,15853,1751,
-   19353,28835,53509,59967,42865,40011,63520,49946,36436,46446,
-   5320,12274,25276,22918,39289,41539,61197,54327,30097,20139,
-   997,14559,23732,26510,10944,4602,45148,35686,50728,64786,
-   3838,13764,30858,17328,57878,55596,37986,44888,52019,61449,
-   48455,34429,10203,7393,20911,27285,
-},
-{0,7452,14904,10020,29808,26988,20040,21332,59616,62972,
-   53976,53188,40080,33164,42664,48052,52701,53441,63461,60153,
-   47533,42161,33685,40585,9533,14369,7941,537,20813,19537,
-   27509,30313,34727,39611,48543,41091,62423,61131,51695,54515,
-   28487,29275,21887,18531,6967,1579,8463,15379,19066,22374,
-   28738,27998,15882,8982,1074,6446,41626,49030,39074,34238,
-   55018,52214,60626,61902,4947,3663,10603,13431,26403,31295,
-   23835,16391,64435,59055,49547,56471,36803,37599,46587,43239,
-   56974,50066,58550,63914,43774,47074,37062,36314,13934,11122,
-   3158,4426,16926,24322,30758,25914,38132,35304,44748,46032,
-   57476,64920,55996,51104,31764,24840,17964,23344,2148,5496,
-   12892,12096,22825,17461,25361,32269,11609,12357,5985,2685,
-   45513,44245,35825,38637,50617,55461,65409,58013,9894,15290,
-   7326,386,21206,20426,26862,30194,52806,54106,62590,59746,
-   47670,42794,32782,40210,60283,63079,53571,52319,40715,33303,
-   42291,47151,923,7815,14755,9407,30699,27383,19923,20687,
-   41217,48157,39737,34341,54641,51309,61257,62037,18913,21757,
-   29657,28357,15761,8333,1961,6837,27868,29120,22244,19448,
-   6316,1456,8852,16264,33852,39200,48644,41752,61516,60752,
-   51828,55144,13813,10473,4045,4817,16773,23705,31677,26273,
-   56597,49161,59181,64049,43365,46201,37725,36417,63528,58676,
-   49680,57100,35928,37188,46688,43900,4296,3540,10992,14316,
-   25784,31140,24192,17308,45650,44878,34922,38262,50722,56126,
-   64538,57606,23218,18350,24714,32150,11970,13278,5370,2534,
-   32655,25235,17847,22699,3071,5859,12743,11483,38767,35443,
-   44375,45131,58143,65027,55591,50235,
-},
-{0,3599,7198,4625,14396,13875,9250,10797,28792,32375,
-   27750,25193,18500,17995,21594,23125,57584,61183,64750,62177,
-   55500,54979,50386,51933,37000,40583,35990,33433,43188,42683,
-   46250,47781,56829,54258,49635,53228,58817,60366,63967,63440,
-   44421,41866,45467,49044,38329,39862,35239,34728,15629,13058,
-   8467,12060,1329,2878,6447,5920,19829,17274,20843,24420,
-   30025,31558,26967,26456,42983,43496,48121,46582,40923,37332,
-   33733,36298,55199,55696,52097,50574,61347,57772,62397,64946,
-   18199,18712,23305,21766,32555,28964,25397,27962,14191,14688,
-   11121,9598,3923,348,4941,7490,31258,29717,26116,26635,
-   16934,19497,24120,20535,2658,1133,5756,6259,12894,15441,
-   11840,8271,39658,38117,34548,35067,41686,44249,48840,45255,
-   60050,58525,63116,63619,53934,56481,52912,49343,21459,24028,
-   20429,16834,27631,26080,30705,31230,9131,11684,16309,12730,
-   7063,5528,1929,2438,45859,48428,44861,41266,35615,34064,
-   38657,39182,50011,52564,57157,53578,64359,62824,59257,59766,
-   36398,32801,37424,39999,46610,47133,43532,41987,65110,61529,
-   57928,60487,50794,51301,55924,54395,28382,24785,29376,31951,
-   22242,22765,19196,17651,7846,4265,696,3255,9882,10389,
-   14980,13451,62516,64059,59434,58917,52232,49671,53270,56857,
-   33868,35395,38994,38493,48240,45695,41070,44641,5316,6859,
-   2266,1749,11512,8951,12518,16105,25788,27315,30882,30381,
-   23680,21135,16542,20113,10697,10182,13783,15320,4597,8186,
-   3563,996,22961,22462,17839,19360,24973,28546,32147,29596,
-   51513,50998,54567,56104,61701,65290,60699,58132,47425,46926,
-   42335,43856,33149,36722,40291,37740,
-},
-{0,35208,3853,34437,7706,38802,4375,39071,15412,46524,
-   13113,47793,8750,43942,11555,42155,30824,61920,30565,65261,
-   26226,61434,27007,57591,17500,52692,19281,49881,23110,54222,
-   21835,56515,61648,31064,65501,30293,61130,26434,57799,26703,
-   52452,17772,50153,19041,54014,23414,56819,21627,35000,304,
-   34741,3645,38562,7978,39343,4135,46220,15620,48001,12809,
-   43670,8990,42395,11283,64957,29749,62128,31544,58279,27183,
-   60586,25890,49545,18433,52868,18188,57235,22043,53406,22806,
-   34261,3165,35544,848,39887,4679,38082,7498,47585,12393,
-   46828,16228,43003,11891,43254,8574,3437,34021,608,35816,
-   4983,39679,7290,38386,12633,47313,15956,47068,12099,42699,
-   8270,43462,29957,64653,31240,62336,27423,58007,25618,60826,
-   18737,49337,17980,53172,22315,56995,22566,53678,59239,28399,
-   59498,25058,63869,28917,63088,32760,56147,21211,54366,24022,
-   50505,19649,51780,17356,40719,5767,36866,6538,33045,2205,
-   36376,1936,41787,10931,44086,9662,48417,13481,45612,15268,
-   6071,40511,6330,37170,2477,32805,1696,36648,11139,41483,
-   9358,44294,13721,48145,14996,45852,28639,58967,24786,59738,
-   29125,63565,32456,63296,21483,55907,23782,54638,19953,50297,
-   17148,52084,6874,37714,5591,40031,1216,36168,3021,33349,
-   9966,44902,10723,41067,14580,45436,14329,48753,25266,60218,
-   28095,58423,31912,62752,29605,64045,24198,55054,20875,55299,
-   16540,51476,20369,50713,59914,25474,58631,27791,62480,32152,
-   64285,29333,54846,24502,55603,20667,51236,16812,50985,20129,
-   37474,7146,40303,5351,35960,1520,33653,2813,44630,10206,
-   41307,10451,45132,14788,48961,14025,
-},
-{0,17477,34954,52431,3337,18764,34179,49606,6674,24151,
-   37528,55005,5915,21342,40849,56276,13348,28769,48302,63723,
-   14637,32104,45479,62946,11830,27251,42684,58105,9023,26490,
-   43957,61424,26696,11277,57538,42119,25921,8452,60875,43406,
-   29274,13855,64208,48789,32595,15126,63449,45980,23660,6185,
-   54502,37027,20837,5408,55791,40362,18046,571,52980,35505,
-   19319,3890,50173,34744,53392,38101,22554,7263,56729,39388,
-   21779,4438,51842,36551,16904,1613,51083,33742,20225,2884,
-   58548,41201,27710,10363,59837,44536,24887,9586,65190,47843,
-   30252,12905,62383,47082,31525,16224,47320,64669,12370,29719,
-   46545,61844,15707,31006,41674,59023,10816,28165,44995,60294,
-   10057,25356,36092,51385,1142,16435,33269,50608,2431,19770,
-   38638,53931,7780,23073,39911,57250,4973,22312,48445,63864,
-   13751,29170,45108,62577,14526,31995,42799,58218,12197,27616,
-   43558,61027,8876,26345,35097,52572,403,17878,33808,49237,
-   3226,18655,37643,55118,7041,24516,40450,55879,5768,21197,
-   54645,37168,24063,6586,55420,39993,20726,5299,53095,35618,
-   18413,936,49774,34347,19172,3745,57681,42260,27099,11678,
-   60504,43037,25810,8343,64323,48902,29641,14220,63050,45583,
-   32448,14981,28077,10728,58663,41314,24740,9441,59438,44139,
-   30655,13306,65333,47984,31414,16115,62012,46713,22921,7628,
-   53507,38214,21632,4293,56330,38991,17307,2014,51985,36692,
-   20114,2775,50712,33373,1509,16800,36207,51498,2284,19625,
-   32870,50211,8183,23474,38781,54072,4862,22203,39540,56881,
-   12737,30084,47435,64782,15560,30861,46146,61447,11219,28566,
-   41817,59164,9946,25247,44624,59925,
-},
-{0,44205,17735,59882,35470,9763,53193,25444,2305,42412,
-   19526,57579,33679,12066,50888,27237,4610,48815,22341,64488,
-   39052,13345,56779,29030,6915,47022,24132,62185,37261,15648,
-   54474,30823,9220,34985,24899,52718,44682,551,60365,18272,
-   11525,33192,26690,50415,42891,2854,58060,20065,13830,39595,
-   29505,57324,48264,4133,63951,21858,16135,37802,31296,55021,
-   46473,6436,61646,23651,18440,58533,3407,41442,49798,28203,
-   34753,11116,16649,60836,1102,43235,52103,26410,36544,8813,
-   23050,63143,8013,46048,53380,31785,38339,14702,21259,65446,
-   5708,47841,55685,29992,40130,12399,27660,49313,10571,34278,
-   59010,18991,41925,3944,25869,51616,8266,36071,61315,17198,
-   43716,1641,32270,53923,15177,38884,62592,22573,45511,7530,
-   30479,56226,12872,40677,64897,20780,47302,5227,36880,15549,
-   54615,31226,6814,46643,24537,62324,39185,13756,56406,28923,
-   5023,48946,22232,64117,33298,11967,51029,27640,2204,42033,
-   19931,57718,35603,10174,52820,25337,413,44336,17626,59511,
-   46100,6329,61779,24062,16026,37431,31709,55152,48405,4536,
-   63570,21759,14235,39734,29404,56945,42518,2747,58193,20476,
-   11416,32821,27103,50546,44823,954,59984,18173,9625,35124,
-   24798,52339,55320,29877,40287,12786,21142,65083,6097,47996,
-   53529,32180,37982,14579,23447,63290,7888,45693,51738,26295,
-   36701,9200,16532,60473,1491,43390,49947,28598,34396,10993,
-   18837,58680,3282,41087,64540,20657,47451,5622,30354,55871,
-   13269,40824,62749,22960,45146,7415,32659,54078,15060,38521,
-   60958,17075,43865,2036,25744,51261,8663,36218,59167,19378,
-   41560,3829,28049,49468,10454,33915,
-},
-{0,55513,44463,30070,18243,40858,60140,12853,36486,22111,
-   9001,64496,51653,4380,25706,48307,273,55752,44222,29799,
-   18002,40587,60413,13092,36759,22350,8760,64225,51412,4109,
-   25979,48546,546,56059,44941,30548,17761,40376,59598,12311,
-   36004,21629,8459,63954,52199,4926,26184,48785,819,56298,
-   44700,30277,17520,40105,59871,12550,36277,21868,8218,63683,
-   51958,4655,26457,49024,1092,56477,43499,28978,17159,39902,
-   61096,13937,35522,21019,10093,65460,52609,5464,24622,47351,
-   1365,56716,43258,28707,16918,39631,61369,14176,35795,21258,
-   9852,65189,52368,5193,24895,47590,1638,57023,43977,29456,
-   16677,39420,60554,13395,35040,20537,9551,64918,53155,6010,
-   25100,47829,1911,57262,43736,29185,16436,39149,60827,13634,
-   35313,20776,9310,64647,52914,5739,25373,48068,2184,53329,
-   42279,32254,20427,38674,57956,15037,34318,24279,11169,62328,
-   49485,6548,27874,46139,2457,53568,42038,31983,20186,38403,
-   58229,15276,34591,24518,10928,62057,49244,6277,28147,46378,
-   2730,53875,42757,32732,19945,38192,57414,14495,33836,23797,
-   10627,61786,50031,7094,28352,46617,3003,54114,42516,32461,
-   19704,37921,57687,14734,34109,24036,10386,61515,49790,6823,
-   28625,46856,3276,54293,41315,31162,19343,37718,58912,16121,
-   33354,23187,12261,63292,50441,7632,26790,45183,3549,54532,
-   41074,30891,19102,37447,59185,16360,33627,23426,12020,63021,
-   50200,7361,27063,45422,3822,54839,41793,31640,18861,37236,
-   58370,15579,32872,22705,11719,62750,50987,8178,27268,45661,
-   4095,55078,41552,31369,18620,36965,58643,15818,33145,22944,
-   11478,62479,50746,7907,27541,45900,
-},
-{0,58083,55771,15160,44971,19784,30320,38035,17227,41384,
-   39568,30835,60640,3587,13627,55256,34454,25717,24397,48558,
-   10557,52190,61670,4613,50653,10046,7174,65253,27254,34965,
-   45997,20814,4401,62418,51434,10761,48794,23673,26433,34210,
-   21114,45209,35745,26946,64977,7986,9226,50921,38823,30020,
-   20092,44191,14348,56047,57815,820,54508,13839,3383,61396,
-   31559,39332,41628,16511,8802,49281,64441,6490,36297,28458,
-   21522,46833,24873,33738,47346,23057,52866,11361,5977,62906,
-   42228,17943,32047,40908,2911,59836,53892,12391,59327,1372,
-   15972,56455,18452,43767,37327,29484,13139,53680,60040,2155,
-   40184,32283,17699,42944,28696,37627,43459,19232,57267,15696,
-   1640,58507,46533,22310,27678,36605,6766,63629,50101,8534,
-   63118,5229,12117,52662,22821,48070,33022,25117,17604,42535,
-   40223,32764,60271,2444,12980,53335,1935,58732,56916,15543,
-   43044,19143,29183,37660,49746,8369,7049,63850,28153,36634,
-   46114,22209,33049,25594,22722,47649,11954,52305,63337,5514,
-   22005,46870,35886,28365,64094,6333,9093,49510,5822,62557,
-   53093,11654,47381,23542,24782,33325,54115,12672,2744,59483,
-   31944,40491,42259,18416,36904,29387,18931,43792,16259,56672,
-   58968,1211,26278,33861,49021,23966,51469,11246,4310,62005,
-   9709,50958,64566,7893,35398,26789,21405,45438,57392,723,
-   14827,56072,20379,44408,38464,29859,41851,16792,31392,38979,
-   3280,60979,54539,14312,30615,38260,44620,19631,55356,15071,
-   487,58116,13532,54847,60679,4068,39799,31124,17068,41039,
-   61697,5090,10458,51769,24234,48201,34673,26002,45642,20649,
-   27537,35186,7649,65282,50234,9945,
-},
-{0,65534,58337,7199,56287,9249,14398,51136,43939,21597,
-   18498,47036,28796,36738,37789,27747,19291,46245,43194,22340,
-   36996,28538,29541,35995,57592,7942,793,64743,15143,50393,
-   55494,10040,38582,26952,30039,35497,19817,45719,44680,20854,
-   15637,49899,57076,8458,59082,6452,1323,64213,56813,8723,
-   15884,49650,1586,63948,58835,6701,30286,35248,38319,27217,
-   44433,21103,20080,45454,12657,52879,53904,11630,60078,5456,
</pre></pre>
<strong class="error" style="color:red;" >[truncated at 1000 lines; 183 more skipped]</strong>
</div>
<hr /><a name="file40" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>edc_scramble.h</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/edc_scramble.h
+++ lxdream/src/gdrom/edc_scramble.h
@@ -1,621 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/* @(#)scramble_table        1.2 02/10/19 */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-static const unsigned char yellowbook_scrambler[2340] = {
-  1,128,0,96,0,40,0,30,128,8,96,6,168,2,254,129,128,96,96,40,40,30,158,
-  136,104,102,174,170,252,127,1,224,0,72,0,54,128,22,224,14,200,4,86,131,126,225,
-  224,72,72,54,182,150,246,238,198,204,82,213,253,159,1,168,0,126,128,32,96,24,40,
-  10,158,135,40,98,158,169,168,126,254,160,64,120,48,34,148,25,175,74,252,55,1,214,
-  128,94,224,56,72,18,182,141,182,229,182,203,54,215,86,222,190,216,112,90,164,59,59,
-  83,83,125,253,225,129,136,96,102,168,42,254,159,0,104,0,46,128,28,96,9,232,6,
-  206,130,212,97,159,104,104,46,174,156,124,105,225,238,200,76,86,181,254,247,0,70,128,
-  50,224,21,136,15,38,132,26,227,75,9,247,70,198,178,210,245,157,135,41,162,158,249,
-  168,66,254,177,128,116,96,39,104,26,174,139,60,103,81,234,188,79,49,244,20,71,79,
-  114,180,37,183,91,54,187,86,243,126,197,224,83,8,61,198,145,146,236,109,141,237,165,
-  141,187,37,179,91,53,251,87,3,126,129,224,96,72,40,54,158,150,232,110,206,172,84,
-  125,255,97,128,40,96,30,168,8,126,134,160,98,248,41,130,158,225,168,72,126,182,160,
-  118,248,38,194,154,209,171,28,127,73,224,54,200,22,214,142,222,228,88,75,122,183,99,
-  54,169,214,254,222,192,88,80,58,188,19,49,205,212,85,159,127,40,32,30,152,8,106,
-  134,175,34,252,25,129,202,224,87,8,62,134,144,98,236,41,141,222,229,152,75,42,183,
-  95,54,184,22,242,142,197,164,83,59,125,211,97,157,232,105,142,174,228,124,75,97,247,
-  104,70,174,178,252,117,129,231,32,74,152,55,42,150,159,46,232,28,78,137,244,102,199,
-  106,210,175,29,188,9,177,198,244,82,199,125,146,161,173,184,125,178,161,181,184,119,50,
-  166,149,186,239,51,12,21,197,207,19,20,13,207,69,148,51,47,85,220,63,25,208,10,
-  220,7,25,194,138,209,167,28,122,137,227,38,201,218,214,219,30,219,72,91,118,187,102,
-  243,106,197,239,19,12,13,197,197,147,19,45,205,221,149,153,175,42,252,31,1,200,0,
-  86,128,62,224,16,72,12,54,133,214,227,30,201,200,86,214,190,222,240,88,68,58,179,
-  83,53,253,215,1,158,128,104,96,46,168,28,126,137,224,102,200,42,214,159,30,232,8,
-  78,134,180,98,247,105,134,174,226,252,73,129,246,224,70,200,50,214,149,158,239,40,76,
-  30,181,200,119,22,166,142,250,228,67,11,113,199,100,82,171,125,191,97,176,40,116,30,
-  167,72,122,182,163,54,249,214,194,222,209,152,92,106,185,239,50,204,21,149,207,47,20,
-  28,15,73,196,54,211,86,221,254,217,128,90,224,59,8,19,70,141,242,229,133,139,35,
-  39,89,218,186,219,51,27,85,203,127,23,96,14,168,4,126,131,96,97,232,40,78,158,
-  180,104,119,110,166,172,122,253,227,1,137,192,102,208,42,220,31,25,200,10,214,135,30,
-  226,136,73,166,182,250,246,195,6,209,194,220,81,153,252,106,193,239,16,76,12,53,197,
-  215,19,30,141,200,101,150,171,46,255,92,64,57,240,18,196,13,147,69,173,243,61,133,
-  209,163,28,121,201,226,214,201,158,214,232,94,206,184,84,114,191,101,176,43,52,31,87,
-  72,62,182,144,118,236,38,205,218,213,155,31,43,72,31,118,136,38,230,154,202,235,23,
-  15,78,132,52,99,87,105,254,174,192,124,80,33,252,24,65,202,176,87,52,62,151,80,
-  110,188,44,113,221,228,89,139,122,231,99,10,169,199,62,210,144,93,172,57,189,210,241,
-  157,132,105,163,110,249,236,66,205,241,149,132,111,35,108,25,237,202,205,151,21,174,143,
-  60,100,17,235,76,79,117,244,39,7,90,130,187,33,179,88,117,250,167,3,58,129,211,
-  32,93,216,57,154,146,235,45,143,93,164,57,187,82,243,125,133,225,163,8,121,198,162,
-  210,249,157,130,233,161,142,248,100,66,171,113,191,100,112,43,100,31,107,72,47,118,156,
-  38,233,218,206,219,20,91,79,123,116,35,103,89,234,186,207,51,20,21,207,79,20,52,
-  15,87,68,62,179,80,117,252,39,1,218,128,91,32,59,88,19,122,141,227,37,137,219,
-  38,219,90,219,123,27,99,75,105,247,110,198,172,82,253,253,129,129,160,96,120,40,34,
-  158,153,168,106,254,175,0,124,0,33,192,24,80,10,188,7,49,194,148,81,175,124,124,
-  33,225,216,72,90,182,187,54,243,86,197,254,211,0,93,192,57,144,18,236,13,141,197,
-  165,147,59,45,211,93,157,249,169,130,254,225,128,72,96,54,168,22,254,142,192,100,80,
-  43,124,31,97,200,40,86,158,190,232,112,78,164,52,123,87,99,126,169,224,126,200,32,
-  86,152,62,234,144,79,44,52,29,215,73,158,182,232,118,206,166,212,122,223,99,24,41,
-  202,158,215,40,94,158,184,104,114,174,165,188,123,49,227,84,73,255,118,192,38,208,26,
-  220,11,25,199,74,210,183,29,182,137,182,230,246,202,198,215,18,222,141,152,101,170,171,
-  63,63,80,16,60,12,17,197,204,83,21,253,207,1,148,0,111,64,44,48,29,212,9,
-  159,70,232,50,206,149,148,111,47,108,28,45,201,221,150,217,174,218,252,91,1,251,64,
-  67,112,49,228,20,75,79,119,116,38,167,90,250,187,3,51,65,213,240,95,4,56,3,
-  82,129,253,160,65,184,48,114,148,37,175,91,60,59,81,211,124,93,225,249,136,66,230,
-  177,138,244,103,7,106,130,175,33,188,24,113,202,164,87,59,126,147,96,109,232,45,142,
-  157,164,105,187,110,243,108,69,237,243,13,133,197,163,19,57,205,210,213,157,159,41,168,
-  30,254,136,64,102,176,42,244,31,7,72,2,182,129,182,224,118,200,38,214,154,222,235,
-  24,79,74,180,55,55,86,150,190,238,240,76,68,53,243,87,5,254,131,0,97,192,40,
-  80,30,188,8,113,198,164,82,251,125,131,97,161,232,120,78,162,180,121,183,98,246,169,
-  134,254,226,192,73,144,54,236,22,205,206,213,148,95,47,120,28,34,137,217,166,218,250,
-  219,3,27,65,203,112,87,100,62,171,80,127,124,32,33,216,24,90,138,187,39,51,90,
-  149,251,47,3,92,1,249,192,66,208,49,156,20,105,207,110,212,44,95,93,248,57,130,
-  146,225,173,136,125,166,161,186,248,115,2,165,193,187,16,115,76,37,245,219,7,27,66,
-  139,113,167,100,122,171,99,63,105,208,46,220,28,89,201,250,214,195,30,209,200,92,86,
-  185,254,242,192,69,144,51,44,21,221,207,25,148,10,239,71,12,50,133,213,163,31,57,
-  200,18,214,141,158,229,168,75,62,183,80,118,188,38,241,218,196,91,19,123,77,227,117,
-  137,231,38,202,154,215,43,30,159,72,104,54,174,150,252,110,193,236,80,77,252,53,129,
-  215,32,94,152,56,106,146,175,45,188,29,177,201,180,86,247,126,198,160,82,248,61,130,
-  145,161,172,120,125,226,161,137,184,102,242,170,197,191,19,48,13,212,5,159,67,40,49,
-  222,148,88,111,122,172,35,61,217,209,154,220,107,25,239,74,204,55,21,214,143,30,228,
-  8,75,70,183,114,246,165,134,251,34,195,89,145,250,236,67,13,241,197,132,83,35,125,
-  217,225,154,200,107,22,175,78,252,52,65,215,112,94,164,56,123,82,163,125,185,225,178,
-  200,117,150,167,46,250,156,67,41,241,222,196,88,83,122,189,227,49,137,212,102,223,106,
-  216,47,26,156,11,41,199,94,210,184,93,178,185,181,178,247,53,134,151,34,238,153,140,
-  106,229,239,11,12,7,69,194,179,17,181,204,119,21,230,143,10,228,7,11,66,135,113,
-  162,164,121,187,98,243,105,133,238,227,12,73,197,246,211,6,221,194,217,145,154,236,107,
-  13,239,69,140,51,37,213,219,31,27,72,11,118,135,102,226,170,201,191,22,240,14,196,
-  4,83,67,125,241,225,132,72,99,118,169,230,254,202,192,87,16,62,140,16,101,204,43,
-  21,223,79,24,52,10,151,71,46,178,156,117,169,231,62,202,144,87,44,62,157,208,105,
-  156,46,233,220,78,217,244,90,199,123,18,163,77,185,245,178,199,53,146,151,45,174,157,
-  188,105,177,238,244,76,71,117,242,167,5,186,131,51,33,213,216,95,26,184,11,50,135,
-  85,162,191,57,176,18,244,13,135,69,162,179,57,181,210,247,29,134,137,162,230,249,138,
-  194,231,17,138,140,103,37,234,155,15,43,68,31,115,72,37,246,155,6,235,66,207,113,
-  148,36,111,91,108,59,109,211,109,157,237,169,141,190,229,176,75,52,55,87,86,190,190,
-  240,112,68,36,51,91,85,251,127,3,96,1,232,0,78,128,52,96,23,104,14,174,132,
-  124,99,97,233,232,78,206,180,84,119,127,102,160,42,248,31,2,136,1,166,128,122,224,
-  35,8,25,198,138,210,231,29,138,137,167,38,250,154,195,43,17,223,76,88,53,250,151,
-  3,46,129,220,96,89,232,58,206,147,20,109,207,109,148,45,175,93,188,57,177,210,244,
-  93,135,121,162,162,249,185,130,242,225,133,136,99,38,169,218,254,219,0,91,64,59,112,
-  19,100,13,235,69,143,115,36,37,219,91,27,123,75,99,119,105,230,174,202,252,87,1,
-  254,128,64,96,48,40,20,30,143,72,100,54,171,86,255,126,192,32,80,24,60,10,145,
-  199,44,82,157,253,169,129,190,224,112,72,36,54,155,86,235,126,207,96,84,40,63,94,
-  144,56,108,18,173,205,189,149,177,175,52,124,23,97,206,168,84,126,191,96,112,40,36,
-  30,155,72,107,118,175,102,252,42,193,223,16,88,12,58,133,211,35,29,217,201,154,214,
-  235,30,207,72,84,54,191,86,240,62,196,16,83,76,61,245,209,135,28,98,137,233,166,
-  206,250,212,67,31,113,200,36,86,155,126,235,96,79,104,52,46,151,92,110,185,236,114,
-  205,229,149,139,47,39,92,26,185,203,50,215,85,158,191,40,112,30,164,8,123,70,163,
-  114,249,229,130,203,33,151,88,110,186,172,115,61,229,209,139,28,103,73,234,182,207,54,
-  212,22,223,78,216,52,90,151,123,46,163,92,121,249,226,194,201,145,150,236,110,205,236,
-  85,141,255,37,128,27,32,11,88,7,122,130,163,33,185,216,114,218,165,155,59,43,83,
-  95,125,248,33,130,152,97,170,168,127,62,160,16,120,12,34,133,217,163,26,249,203,2,
-  215,65,158,176,104,116,46,167,92,122,185,227,50,201,213,150,223,46,216,28,90,137,251,
-  38,195,90,209,251,28,67,73,241,246,196,70,211,114,221,229,153,
-};
-
-#ifdef PROTOTYPES
-
-#   if !defined        WORDS_BIGENDIAN
-/* little endian */
-static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
-  0x60008001UL,0x1E002800UL,0x06600880UL,0x81FE02A8UL,0x28606080UL,
-  0x889E1E28UL,0xAAAE6668UL,0xE0017FFCUL,0x36004800UL,0x0EE01680UL,
-  0x835604C8UL,0x48E0E17EUL,0x96B63648UL,0xCCC6EEF6UL,0x9FFDD552UL,
-  0x7E00A801UL,0x18602080UL,0x879E0A28UL,0xA99E6228UL,0xA0FE7EA8UL,
-  0x22307840UL,0x4AAF1994UL,0xD60137FCUL,0x38E05E80UL,0x8DB61248UL,
-  0xCBB6E5B6UL,0xDE56D736UL,0x5A70D8BEUL,0x533B3BA4UL,0xE1FD7D53UL,
-  0x66608881UL,0x9FFE2AA8UL,0x2E006800UL,0x09601C80UL,0x82CE06E8UL,
-  0x689F61D4UL,0x9CAE2E68UL,0xEEE1697CUL,0xB5564CC8UL,0x4600F7FEUL,
-  0x15E03280UL,0x84260F88UL,0x094BE31AUL,0xB2C646F7UL,0x879DF5D2UL,
-  0xF99EA229UL,0xB1FE42A8UL,0x27607480UL,0x8BAE1A68UL,0xEA51673CUL,
-  0xF4314FBCUL,0x724F4714UL,0x5BB725B4UL,0xF356BB36UL,0x53E0C57EUL,
-  0x91C63D08UL,0x8D6DEC92UL,0xBB8DA5EDUL,0x355BB325UL,0x7E0357FBUL,
-  0x4860E081UL,0x969E3628UL,0xACCE6EE8UL,0x61FF7D54UL,0x1E602880UL,
-  0x867E08A8UL,0x29F862A0UL,0xA8E19E82UL,0xA0B67E48UL,0xC226F876UL,
-  0x1CABD19AUL,0x36E0497FUL,0x8ED616C8UL,0x4B58E4DEUL,0x3663B77AUL,
-  0xDEFED6A9UL,0x3A5058C0UL,0xCD3113BCUL,0x7F9F55D4UL,0x981E2028UL,
-  0xAF866A08UL,0x8119FC22UL,0x0857E0CAUL,0x6290863EUL,0xDE8D29ECUL,
-  0x2A4B98E5UL,0xB8365FB7UL,0xC58EF216UL,0x7D3B53A4UL,0xE89D61D3UL,
-  0xE4AE8E69UL,0xF7614B7CUL,0xB2AE4668UL,0xE78175FCUL,0x37984A20UL,
-  0x2E9F962AUL,0x894E1CE8UL,0x6AC766F4UL,0xBC1DAFD2UL,0xF4C6B109UL,
-  0x927DC752UL,0x7DB8ADA1UL,0xB8B5A1B2UL,0x95A63277UL,0x0C33EFBAUL,
-  0x13CFC515UL,0x45CF0D14UL,0x552F3394UL,0xD0193FDCUL,0x1907DC0AUL,
-  0xA7D18AC2UL,0xE3897A1CUL,0xD6DAC926UL,0x48DB1EDBUL,0x66BB765BUL,
-  0xEFC56AF3UL,0xC50D0C13UL,0x2D1393C5UL,0x9995DDCDUL,0x1FFC2AAFUL,
-  0x5600C801UL,0x10E03E80UL,0x85360C48UL,0xC91EE3D6UL,0xBED656C8UL,
-  0x4458F0DEUL,0x3553B33AUL,0x9E01D7FDUL,0x2E606880UL,0x897E1CA8UL,
-  0x2AC866E0UL,0xE81E9FD6UL,0xB4864E08UL,0x8669F762UL,0x49FCE2AEUL,
-  0x46E0F681UL,0x95D632C8UL,0x4C28EF9EUL,0x77C8B51EUL,0xFA8EA616UL,
-  0x710B43E4UL,0xAB5264C7UL,0xB061BF7DUL,0xA71E7428UL,0xA3B67A48UL,
-  0xC2D6F936UL,0x5C98D1DEUL,0x32EFB96AUL,0xCF9515CCUL,0x0F1C142FUL,
-  0xD336C449UL,0xD9FEDD56UL,0x3BE05A80UL,0x8D461308UL,0x8B85E5F2UL,
-  0xDA592723UL,0x1B33DBBAUL,0x177FCB55UL,0x04A80E60UL,0x6160837EUL,
-  0x9E4E28E8UL,0x6E7768B4UL,0xFD7AACA6UL,0xC08901E3UL,0xDC2AD066UL,
-  0x0AC8191FUL,0xE21E87D6UL,0xB6A64988UL,0x06C3F6FAUL,0x51DCC2D1UL,
-  0xC16AFC99UL,0x0C4C10EFUL,0x13D7C535UL,0x65C88D1EUL,0xFF2EAB96UL,
-  0xF039405CUL,0x930DC412UL,0x3DF3AD45UL,0x1CA3D185UL,0xD6E2C979UL,
-  0xE8D69EC9UL,0x54B8CE5EUL,0xB065BF72UL,0x571F342BUL,0x90B63E48UL,
-  0xCD26EC76UL,0x1F9BD5DAUL,0x761F482BUL,0x9AE62688UL,0x0F17EBCAUL,
-  0x6334844EUL,0xAEFE6957UL,0x21507CC0UL,0xCA4118FCUL,0x3E3457B0UL,
-  0xBC6E5097UL,0xE4DD712CUL,0xE77A8B59UL,0xC7A90A63UL,0x5D90D23EUL,
-  0xD2BD39ACUL,0x69849DF1UL,0xECF96EA3UL,0x95F1CD42UL,0x6C236F84UL,
-  0xCDCAED19UL,0x8FAE1597UL,0xEB11643CUL,0xF4754F4CUL,0x825A0727UL,
-  0x58B321BBUL,0x03A7FA75UL,0x20D3813AUL,0x9A39D85DUL,0x8F2DEB92UL,
-  0xBB39A45DUL,0x857DF352UL,0x7908A3E1UL,0xF9D2A2C6UL,0xA1E9829DUL,
-  0x4264F88EUL,0x64BF71ABUL,0x1F642B70UL,0x762F486BUL,0xDAE9269CUL,
-  0x5B14DBCEUL,0x23747B4FUL,0xBAEA5967UL,0x151433CFUL,0x34144FCFUL,
-  0x3E44570FUL,0xFC7550B3UL,0x80DA0127UL,0x583B205BUL,0xE38D7A13UL,
-  0x26DB8925UL,0x7BDB5ADBUL,0x694B631BUL,0xACC66EF7UL,0x81FDFD52UL,
-  0x7860A081UL,0x999E2228UL,0xAFFE6AA8UL,0x21007C00UL,0x0A5018C0UL,
-  0xC23107BCUL,0x7CAF5194UL,0xD8E1217CUL,0xBBB65A48UL,0xC556F336UL,
-  0x5D00D3FEUL,0x129039C0UL,0xC58D0DECUL,0x2D3B93A5UL,0xF99D5DD3UL,
-  0xE1FE82A9UL,0x36604880UL,0x8EFE16A8UL,0x2B5064C0UL,0xC8611F7CUL,
-  0xBE9E5628UL,0xA44E70E8UL,0x63577B34UL,0x7EE0A97EUL,0x985620C8UL,
-  0x4F90EA3EUL,0xD71D342CUL,0xE8B69E49UL,0xD4A6CE76UL,0x1863DF7AUL,
-  0xD79ECA29UL,0xB89E5E28UL,0xA5AE7268UL,0xE3317BBCUL,0x76FF4954UL,
-  0x1AD026C0UL,0xC7190BDCUL,0x1DB7D24AUL,0xE6B689B6UL,0xD7C6CAF6UL,
-  0x988DDE12UL,0x3FABAA65UL,0x3C10503FUL,0xCCC5110CUL,0xCFFD1553UL,
-  0x6F009401UL,0x1D302C40UL,0x469F09D4UL,0x95CE32E8UL,0x6C2F6F94UL,
-  0xDDC92D1CUL,0xDAAED996UL,0xFB015BFCUL,0x31704340UL,0x4F4B14E4UL,
-  0xA7267477UL,0x03BBFA5AUL,0xF0D54133UL,0x0338045FUL,0xA0FD8152UL,
-  0x7230B841UL,0x5BAF2594UL,0xD3513B3CUL,0xF9E15D7CUL,0xB1E64288UL,
-  0x0767F48AUL,0x21AF826AUL,0xCA7118BCUL,0x7E3B57A4UL,0xE86D6093UL,
-  0xA49D8E2DUL,0xF36EBB69UL,0xF3ED456CUL,0xA3C5850DUL,0xD2CD3913UL,
-  0x299F9DD5UL,0x88FE1EA8UL,0x2AB06640UL,0x48071FF4UL,0xB681B602UL,
-  0x26C876E0UL,0xEBDE9AD6UL,0xB44A4F18UL,0x96563737UL,0x4CF0EEBEUL,
-  0x57F33544UL,0x0083FE05UL,0x5028C061UL,0x7108BC1EUL,0xFB52A4C6UL,
-  0xA161837DUL,0xA24E78E8UL,0x62B779B4UL,0xFE86A9F6UL,0x9049C0E2UL,
-  0xCD16EC36UL,0x5F94D5CEUL,0x221C782FUL,0xDAA6D989UL,0x1B03DBFAUL,
-  0x5770CB41UL,0x50AB3E64UL,0x21207C7FUL,0x8A5A18D8UL,0x5A3327BBUL,
-  0x032FFB95UL,0xC0F9015CUL,0x9C31D042UL,0x6ECF6914UL,0x5D5F2CD4UL,
-  0x928239F8UL,0x7D88ADE1UL,0xF8BAA1A6UL,0xC1A50273UL,0x4C7310BBUL,
-  0x07DBF525UL,0x718B421BUL,0xAB7A64A7UL,0xD0693F63UL,0x591CDC2EUL,
-  0xC3D6FAC9UL,0x5CC8D11EUL,0xF2FEB956UL,0x339045C0UL,0xCFDD152CUL,
-  0xEF0A9419UL,0x85320C47UL,0x391FA3D5UL,0x8DD612C8UL,0x4BA8E59EUL,
-  0x7650B73EUL,0xDAF126BCUL,0x7B135BC4UL,0x8975E34DUL,0x9ACA26E7UL,
-  0x9F1E2BD7UL,0xAE366848UL,0xC16EFC96UL,0xFC4D50ECUL,0x20D78135UL,
-  0x6A38985EUL,0xBC2DAF92UL,0xB4C9B11DUL,0xC67EF756UL,0x3DF852A0UL,
-  0xACA19182UL,0xA1E27D78UL,0xF266B889UL,0x13BFC5AAUL,0x05D40D30UL,
-  0x3128439FUL,0x6F5894DEUL,0x3D23AC7AUL,0xDC9AD1D9UL,0x4AEF196BUL,
-  0xD61537CCUL,0x08E41E8FUL,0x72B7464BUL,0xFB86A5F6UL,0x9159C322UL,
-  0x0D43ECFAUL,0x5384C5F1UL,0xE1D97D23UL,0x166BC89AUL,0x34FC4EAFUL,
-  0x5E70D741UL,0x527B38A4UL,0xE1B97DA3UL,0x9675C8B2UL,0x9CFA2EA7UL,
-  0xDEF12943UL,0x7A5358C4UL,0x8931E3BDUL,0x6ADF66D4UL,0x9C1A2FD8UL,
-  0x5EC7290BUL,0xB25DB8D2UL,0xF7B2B5B9UL,0x22978635UL,0x6A8C99EEUL,
-  0x0C0BEFE5UL,0xB3C24507UL,0x77CCB511UL,0x0A8FE615UL,0x420B07E4UL,
-  0xA4A27187UL,0xF362BB79UL,0xE3EE8569UL,0xF6C5490CUL,0xC2DD06D3UL,
-  0xEC9A91D9UL,0x45EF0D6BUL,0xD525338CUL,0x481B1FDBUL,0x6687760BUL,
-  0xBFC9AAE2UL,0xC40EF016UL,0x7D435304UL,0x4884E1F1UL,0xE6A97663UL,
-  0x57C0CAFEUL,0x108C3E10UL,0x152BCC65UL,0x34184FDFUL,0x2E47970AUL,
-  0xA9759CB2UL,0x90CA3EE7UL,0x9D3E2C57UL,0x2E9C69D0UL,0xD94EDCE9UL,
-  0x7BC75AF4UL,0xB94DA312UL,0x35C7B2F5UL,0xAE2D9792UL,0xB169BC9DUL,
-  0x474CF4EEUL,0x05A7F275UL,0x213383BAUL,0x1A5FD8D5UL,0x87320BB8UL,
-  0x39BFA255UL,0x0DF412B0UL,0xB3A24587UL,0xF7D2B539UL,0xA289861DUL,
-  0xC28AF9E6UL,0x8C8A11E7UL,0x9BEA2567UL,0x1F442B0FUL,0xF6254873UL,
-  0x42EB069BUL,0x249471CFUL,0x3B6C5B6FUL,0x9D6DD36DUL,0xBE8DA9EDUL,
-  0x344BB0E5UL,0xBE565737UL,0x4470F0BEUL,0x555B3324UL,0x60037FFBUL,
-  0x4E00E801UL,0x17603480UL,0x84AE0E68UL,0xE961637CUL,0xB4CE4EE8UL,
-  0x667F7754UL,0x1FF82AA0UL,0xA6018802UL,0x23E07A80UL,0x8AC61908UL,
-  0x8A1DE7D2UL,0xFA26A789UL,0x112BC39AUL,0x35584CDFUL,0x2E0397FAUL,
-  0x5960DC81UL,0x93CE3AE8UL,0x6DCF6D14UL,0x5DAF2D94UL,0xD2B139BCUL,
-  0x79875DF4UL,0xB9F9A2A2UL,0x85E1F282UL,0xA9266388UL,0x00DBFEDAUL,
-  0x703B405BUL,0xEB0D6413UL,0x24738F45UL,0x1B5BDB25UL,0x77634B7BUL,
-  0xCAAEE669UL,0xFE0157FCUL,0x30604080UL,0x8F1E1428UL,0xAB366448UL,
-  0xC07EFF56UL,0x3C185020UL,0x2CC7910AUL,0xA9FD9D52UL,0x70E0BE81UL,
-  0x9B362448UL,0xCF7EEB56UL,0x3F285460UL,0x6C38905EUL,0xBDCDAD12UL,
-  0x34AFB195UL,0xCE61177CUL,0xBF7E54A8UL,0x24287060UL,0x6B489B1EUL,
-  0xFC66AF76UL,0x10DFC12AUL,0x853A0C58UL,0xD91D23D3UL,0xEBD69AC9UL,
-  0x5448CF1EUL,0xF056BF36UL,0x5310C43EUL,0xD1F53D4CUL,0x89621C87UL,
-  0xFACEA6E9UL,0x711F43D4UL,0x9B5624C8UL,0x4F60EB7EUL,0x972E3468UL,
-  0xECB96E5CUL,0x95E5CD72UL,0x5C272F8BUL,0x32CBB91AUL,0xBF9E55D7UL,
-  0xA41E7028UL,0xA3467B08UL,0x82E5F972UL,0x589721CBUL,0x73ACBA6EUL,
-  0x8BD1E53DUL,0xEA49671CUL,0xD436CFB6UL,0xD84EDF16UL,0x7B975A34UL,
-  0x795CA32EUL,0xC9C2E2F9UL,0x6EEC9691UL,0x8D55ECCDUL,0x1B8025FFUL,
-  0x07580B20UL,0x21A3827AUL,0xDA72D8B9UL,0x2B3B9BA5UL,0xF87D5F53UL,
-  0x61988221UL,0x3E7FA8AAUL,0x0C7810A0UL,0xA3D98522UL,0x02CBF91AUL,
-  0xB09E41D7UL,0xA72E7468UL,0xE3B97A5CUL,0x96D5C932UL,0x1CD82EDFUL,
-  0x26FB895AUL,0xFBD15AC3UL,0xF149431CUL,0xD346C4F6UL,0x99E5DD72UL,
-  
-};
-#   endif
-#   if defined WORDS_BIGENDIAN
-/* big endian */
-static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
-  0x01800060UL,0x0028001EUL,0x80086006UL,0xA802FE81UL,0x80606028UL,
-  0x281E9E88UL,0x6866AEAAUL,0xFC7F01E0UL,0x00480036UL,0x8016E00EUL,
-  0xC8045683UL,0x7EE1E048UL,0x4836B696UL,0xF6EEC6CCUL,0x52D5FD9FUL,
-  0x01A8007EUL,0x80206018UL,0x280A9E87UL,0x28629EA9UL,0xA87EFEA0UL,
-  0x40783022UL,0x9419AF4AUL,0xFC3701D6UL,0x805EE038UL,0x4812B68DUL,
-  0xB6E5B6CBUL,0x36D756DEUL,0xBED8705AUL,0xA43B3B53UL,0x537DFDE1UL,
-  0x81886066UL,0xA82AFE9FUL,0x0068002EUL,0x801C6009UL,0xE806CE82UL,
-  0xD4619F68UL,0x682EAE9CUL,0x7C69E1EEUL,0xC84C56B5UL,0xFEF70046UL,
-  0x8032E015UL,0x880F2684UL,0x1AE34B09UL,0xF746C6B2UL,0xD2F59D87UL,
-  0x29A29EF9UL,0xA842FEB1UL,0x80746027UL,0x681AAE8BUL,0x3C6751EAUL,
-  0xBC4F31F4UL,0x14474F72UL,0xB425B75BUL,0x36BB56F3UL,0x7EC5E053UL,
-  0x083DC691UL,0x92EC6D8DUL,0xEDA58DBBUL,0x25B35B35UL,0xFB57037EUL,
-  0x81E06048UL,0x28369E96UL,0xE86ECEACUL,0x547DFF61UL,0x8028601EUL,
-  0xA8087E86UL,0xA062F829UL,0x829EE1A8UL,0x487EB6A0UL,0x76F826C2UL,
-  0x9AD1AB1CUL,0x7F49E036UL,0xC816D68EUL,0xDEE4584BUL,0x7AB76336UL,
-  0xA9D6FEDEUL,0xC058503AUL,0xBC1331CDUL,0xD4559F7FUL,0x28201E98UL,
-  0x086A86AFUL,0x22FC1981UL,0xCAE05708UL,0x3E869062UL,0xEC298DDEUL,
-  0xE5984B2AUL,0xB75F36B8UL,0x16F28EC5UL,0xA4533B7DUL,0xD3619DE8UL,
-  0x698EAEE4UL,0x7C4B61F7UL,0x6846AEB2UL,0xFC7581E7UL,0x204A9837UL,
-  0x2A969F2EUL,0xE81C4E89UL,0xF466C76AUL,0xD2AF1DBCUL,0x09B1C6F4UL,
-  0x52C77D92UL,0xA1ADB87DUL,0xB2A1B5B8UL,0x7732A695UL,0xBAEF330CUL,
-  0x15C5CF13UL,0x140DCF45UL,0x94332F55UL,0xDC3F19D0UL,0x0ADC0719UL,
-  0xC28AD1A7UL,0x1C7A89E3UL,0x26C9DAD6UL,0xDB1EDB48UL,0x5B76BB66UL,
-  0xF36AC5EFUL,0x130C0DC5UL,0xC593132DUL,0xCDDD9599UL,0xAF2AFC1FUL,
-  0x01C80056UL,0x803EE010UL,0x480C3685UL,0xD6E31EC9UL,0xC856D6BEUL,
-  0xDEF05844UL,0x3AB35335UL,0xFDD7019EUL,0x8068602EUL,0xA81C7E89UL,
-  0xE066C82AUL,0xD69F1EE8UL,0x084E86B4UL,0x62F76986UL,0xAEE2FC49UL,
-  0x81F6E046UL,0xC832D695UL,0x9EEF284CUL,0x1EB5C877UL,0x16A68EFAUL,
-  0xE4430B71UL,0xC76452ABUL,0x7DBF61B0UL,0x28741EA7UL,0x487AB6A3UL,
-  0x36F9D6C2UL,0xDED1985CUL,0x6AB9EF32UL,0xCC1595CFUL,0x2F141C0FUL,
-  0x49C436D3UL,0x56DDFED9UL,0x805AE03BUL,0x0813468DUL,0xF2E5858BUL,
-  0x232759DAUL,0xBADB331BUL,0x55CB7F17UL,0x600EA804UL,0x7E836061UL,
-  0xE8284E9EUL,0xB468776EUL,0xA6AC7AFDUL,0xE30189C0UL,0x66D02ADCUL,
-  0x1F19C80AUL,0xD6871EE2UL,0x8849A6B6UL,0xFAF6C306UL,0xD1C2DC51UL,
-  0x99FC6AC1UL,0xEF104C0CUL,0x35C5D713UL,0x1E8DC865UL,0x96AB2EFFUL,
-  0x5C4039F0UL,0x12C40D93UL,0x45ADF33DUL,0x85D1A31CUL,0x79C9E2D6UL,
-  0xC99ED6E8UL,0x5ECEB854UL,0x72BF65B0UL,0x2B341F57UL,0x483EB690UL,
-  0x76EC26CDUL,0xDAD59B1FUL,0x2B481F76UL,0x8826E69AUL,0xCAEB170FUL,
-  0x4E843463UL,0x5769FEAEUL,0xC07C5021UL,0xFC1841CAUL,0xB057343EUL,
-  0x97506EBCUL,0x2C71DDE4UL,0x598B7AE7UL,0x630AA9C7UL,0x3ED2905DUL,
-  0xAC39BDD2UL,0xF19D8469UL,0xA36EF9ECUL,0x42CDF195UL,0x846F236CUL,
-  0x19EDCACDUL,0x9715AE8FUL,0x3C6411EBUL,0x4C4F75F4UL,0x27075A82UL,
-  0xBB21B358UL,0x75FAA703UL,0x3A81D320UL,0x5DD8399AUL,0x92EB2D8FUL,
-  0x5DA439BBUL,0x52F37D85UL,0xE1A30879UL,0xC6A2D2F9UL,0x9D82E9A1UL,
-  0x8EF86442UL,0xAB71BF64UL,0x702B641FUL,0x6B482F76UL,0x9C26E9DAUL,
-  0xCEDB145BUL,0x4F7B7423UL,0x6759EABAUL,0xCF331415UL,0xCF4F1434UL,
-  0x0F57443EUL,0xB35075FCUL,0x2701DA80UL,0x5B203B58UL,0x137A8DE3UL,
-  0x2589DB26UL,0xDB5ADB7BUL,0x1B634B69UL,0xF76EC6ACUL,0x52FDFD81UL,
-  0x81A06078UL,0x28229E99UL,0xA86AFEAFUL,0x007C0021UL,0xC018500AUL,
-  0xBC0731C2UL,0x9451AF7CUL,0x7C21E1D8UL,0x485AB6BBUL,0x36F356C5UL,
-  0xFED3005DUL,0xC0399012UL,0xEC0D8DC5UL,0xA5933B2DUL,0xD35D9DF9UL,
-  0xA982FEE1UL,0x80486036UL,0xA816FE8EUL,0xC064502BUL,0x7C1F61C8UL,
-  0x28569EBEUL,0xE8704EA4UL,0x347B5763UL,0x7EA9E07EUL,0xC8205698UL,
-  0x3EEA904FUL,0x2C341DD7UL,0x499EB6E8UL,0x76CEA6D4UL,0x7ADF6318UL,
-  0x29CA9ED7UL,0x285E9EB8UL,0x6872AEA5UL,0xBC7B31E3UL,0x5449FF76UL,
-  0xC026D01AUL,0xDC0B19C7UL,0x4AD2B71DUL,0xB689B6E6UL,0xF6CAC6D7UL,
-  0x12DE8D98UL,0x65AAAB3FUL,0x3F50103CUL,0x0C11C5CCUL,0x5315FDCFUL,
-  0x0194006FUL,0x402C301DUL,0xD4099F46UL,0xE832CE95UL,0x946F2F6CUL,
-  0x1C2DC9DDUL,0x96D9AEDAUL,0xFC5B01FBUL,0x40437031UL,0xE4144B4FUL,
-  0x777426A7UL,0x5AFABB03UL,0x3341D5F0UL,0x5F043803UL,0x5281FDA0UL,
-  0x41B83072UL,0x9425AF5BUL,0x3C3B51D3UL,0x7C5DE1F9UL,0x8842E6B1UL,
-  0x8AF46707UL,0x6A82AF21UL,0xBC1871CAUL,0xA4573B7EUL,0x93606DE8UL,
-  0x2D8E9DA4UL,0x69BB6EF3UL,0x6C45EDF3UL,0x0D85C5A3UL,0x1339CDD2UL,
-  0xD59D9F29UL,0xA81EFE88UL,0x4066B02AUL,0xF41F0748UL,0x02B681B6UL,
-  0xE076C826UL,0xD69ADEEBUL,0x184F4AB4UL,0x37375696UL,0xBEEEF04CUL,
-  0x4435F357UL,0x05FE8300UL,0x61C02850UL,0x1EBC0871UL,0xC6A452FBUL,
-  0x7D8361A1UL,0xE8784EA2UL,0xB479B762UL,0xF6A986FEUL,0xE2C04990UL,
-  0x36EC16CDUL,0xCED5945FUL,0x2F781C22UL,0x89D9A6DAUL,0xFADB031BUL,
-  0x41CB7057UL,0x643EAB50UL,0x7F7C2021UL,0xD8185A8AUL,0xBB27335AUL,
-  0x95FB2F03UL,0x5C01F9C0UL,0x42D0319CUL,0x1469CF6EUL,0xD42C5F5DUL,
-  0xF8398292UL,0xE1AD887DUL,0xA6A1BAF8UL,0x7302A5C1UL,0xBB10734CUL,
-  0x25F5DB07UL,0x1B428B71UL,0xA7647AABUL,0x633F69D0UL,0x2EDC1C59UL,
-  0xC9FAD6C3UL,0x1ED1C85CUL,0x56B9FEF2UL,0xC0459033UL,0x2C15DDCFUL,
-  0x19940AEFUL,0x470C3285UL,0xD5A31F39UL,0xC812D68DUL,0x9EE5A84BUL,
-  0x3EB75076UL,0xBC26F1DAUL,0xC45B137BUL,0x4DE37589UL,0xE726CA9AUL,
-  0xD72B1E9FUL,0x486836AEUL,0x96FC6EC1UL,0xEC504DFCUL,0x3581D720UL,
-  0x5E98386AUL,0x92AF2DBCUL,0x1DB1C9B4UL,0x56F77EC6UL,0xA052F83DUL,
-  0x8291A1ACUL,0x787DE2A1UL,0x89B866F2UL,0xAAC5BF13UL,0x300DD405UL,
-  0x9F432831UL,0xDE94586FUL,0x7AAC233DUL,0xD9D19ADCUL,0x6B19EF4AUL,
-  0xCC3715D6UL,0x8F1EE408UL,0x4B46B772UL,0xF6A586FBUL,0x22C35991UL,
-  0xFAEC430DUL,0xF1C58453UL,0x237DD9E1UL,0x9AC86B16UL,0xAF4EFC34UL,
-  0x41D7705EUL,0xA4387B52UL,0xA37DB9E1UL,0xB2C87596UL,0xA72EFA9CUL,
-  0x4329F1DEUL,0xC458537AUL,0xBDE33189UL,0xD466DF6AUL,0xD82F1A9CUL,
-  0x0B29C75EUL,0xD2B85DB2UL,0xB9B5B2F7UL,0x35869722UL,0xEE998C6AUL,
-  0xE5EF0B0CUL,0x0745C2B3UL,0x11B5CC77UL,0x15E68F0AUL,0xE4070B42UL,
-  0x8771A2A4UL,0x79BB62F3UL,0x6985EEE3UL,0x0C49C5F6UL,0xD306DDC2UL,
-  0xD9919AECUL,0x6B0DEF45UL,0x8C3325D5UL,0xDB1F1B48UL,0x0B768766UL,
-  0xE2AAC9BFUL,0x16F00EC4UL,0x0453437DUL,0xF1E18448UL,0x6376A9E6UL,
-  0xFECAC057UL,0x103E8C10UL,0x65CC2B15UL,0xDF4F1834UL,0x0A97472EUL,
-  0xB29C75A9UL,0xE73ECA90UL,0x572C3E9DUL,0xD0699C2EUL,0xE9DC4ED9UL,
-  0xF45AC77BUL,0x12A34DB9UL,0xF5B2C735UL,0x92972DAEUL,0x9DBC69B1UL,
-  0xEEF44C47UL,0x75F2A705UL,0xBA833321UL,0xD5D85F1AUL,0xB80B3287UL,
-  0x55A2BF39UL,0xB012F40DUL,0x8745A2B3UL,0x39B5D2F7UL,0x1D8689A2UL,
-  0xE6F98AC2UL,0xE7118A8CUL,0x6725EA9BUL,0x0F2B441FUL,0x734825F6UL,
-  0x9B06EB42UL,0xCF719424UL,0x6F5B6C3BUL,0x6DD36D9DUL,0xEDA98DBEUL,
-  0xE5B04B34UL,0x375756BEUL,0xBEF07044UL,0x24335B55UL,0xFB7F0360UL,
-  0x01E8004EUL,0x80346017UL,0x680EAE84UL,0x7C6361E9UL,0xE84ECEB4UL,
-  0x54777F66UL,0xA02AF81FUL,0x028801A6UL,0x807AE023UL,0x0819C68AUL,
-  0xD2E71D8AUL,0x89A726FAUL,0x9AC32B11UL,0xDF4C5835UL,0xFA97032EUL,
-  0x81DC6059UL,0xE83ACE93UL,0x146DCF6DUL,0x942DAF5DUL,0xBC39B1D2UL,
-  0xF45D8779UL,0xA2A2F9B9UL,0x82F2E185UL,0x886326A9UL,0xDAFEDB00UL,
-  0x5B403B70UL,0x13640DEBUL,0x458F7324UL,0x25DB5B1BUL,0x7B4B6377UL,
-  0x69E6AECAUL,0xFC5701FEUL,0x80406030UL,0x28141E8FUL,0x486436ABUL,
-  0x56FF7EC0UL,0x2050183CUL,0x0A91C72CUL,0x529DFDA9UL,0x81BEE070UL,
-  0x4824369BUL,0x56EB7ECFUL,0x6054283FUL,0x5E90386CUL,0x12ADCDBDUL,
-  0x95B1AF34UL,0x7C1761CEUL,0xA8547EBFUL,0x60702824UL,0x1E9B486BUL,
-  0x76AF66FCUL,0x2AC1DF10UL,0x580C3A85UL,0xD3231DD9UL,0xC99AD6EBUL,
-  0x1ECF4854UL,0x36BF56F0UL,0x3EC41053UL,0x4C3DF5D1UL,0x871C6289UL,
-  0xE9A6CEFAUL,0xD4431F71UL,0xC824569BUL,0x7EEB604FUL,0x68342E97UL,
-  0x5C6EB9ECUL,0x72CDE595UL,0x8B2F275CUL,0x1AB9CB32UL,0xD7559EBFUL,
-  0x28701EA4UL,0x087B46A3UL,0x72F9E582UL,0xCB219758UL,0x6EBAAC73UL,
-  0x3DE5D18BUL,0x1C6749EAUL,0xB6CF36D4UL,0x16DF4ED8UL,0x345A977BUL,
-  0x2EA35C79UL,0xF9E2C2C9UL,0x9196EC6EUL,0xCDEC558DUL,0xFF25801BUL,
-  0x200B5807UL,0x7A82A321UL,0xB9D872DAUL,0xA59B3B2BUL,0x535F7DF8UL,
-  0x21829861UL,0xAAA87F3EUL,0xA010780CUL,0x2285D9A3UL,0x1AF9CB02UL,
-  0xD7419EB0UL,0x68742EA7UL,0x5C7AB9E3UL,0x32C9D596UL,0xDF2ED81CUL,
-  0x5A89FB26UL,0xC35AD1FBUL,0x1C4349F1UL,0xF6C446D3UL,0x72DDE599UL,
-  
-};
-#   endif
-
-#else  /* PROTOTYPES */
-
-#   if !defined        WORDS_BIGENDIAN
-/* little endian */
-static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
-  0x60008001,0x1E002800,0x06600880,0x81FE02A8,0x28606080,
-  0x889E1E28,0xAAAE6668,0xE0017FFC,0x36004800,0x0EE01680,
-  0x835604C8,0x48E0E17E,0x96B63648,0xCCC6EEF6,0x9FFDD552,
-  0x7E00A801,0x18602080,0x879E0A28,0xA99E6228,0xA0FE7EA8,
-  0x22307840,0x4AAF1994,0xD60137FC,0x38E05E80,0x8DB61248,
-  0xCBB6E5B6,0xDE56D736,0x5A70D8BE,0x533B3BA4,0xE1FD7D53,
-  0x66608881,0x9FFE2AA8,0x2E006800,0x09601C80,0x82CE06E8,
-  0x689F61D4,0x9CAE2E68,0xEEE1697C,0xB5564CC8,0x4600F7FE,
-  0x15E03280,0x84260F88,0x094BE31A,0xB2C646F7,0x879DF5D2,
-  0xF99EA229,0xB1FE42A8,0x27607480,0x8BAE1A68,0xEA51673C,
-  0xF4314FBC,0x724F4714,0x5BB725B4,0xF356BB36,0x53E0C57E,
-  0x91C63D08,0x8D6DEC92,0xBB8DA5ED,0x355BB325,0x7E0357FB,
-  0x4860E081,0x969E3628,0xACCE6EE8,0x61FF7D54,0x1E602880,
-  0x867E08A8,0x29F862A0,0xA8E19E82,0xA0B67E48,0xC226F876,
-  0x1CABD19A,0x36E0497F,0x8ED616C8,0x4B58E4DE,0x3663B77A,
-  0xDEFED6A9,0x3A5058C0,0xCD3113BC,0x7F9F55D4,0x981E2028,
-  0xAF866A08,0x8119FC22,0x0857E0CA,0x6290863E,0xDE8D29EC,
-  0x2A4B98E5,0xB8365FB7,0xC58EF216,0x7D3B53A4,0xE89D61D3,
-  0xE4AE8E69,0xF7614B7C,0xB2AE4668,0xE78175FC,0x37984A20,
-  0x2E9F962A,0x894E1CE8,0x6AC766F4,0xBC1DAFD2,0xF4C6B109,
-  0x927DC752,0x7DB8ADA1,0xB8B5A1B2,0x95A63277,0x0C33EFBA,
-  0x13CFC515,0x45CF0D14,0x552F3394,0xD0193FDC,0x1907DC0A,
-  0xA7D18AC2,0xE3897A1C,0xD6DAC926,0x48DB1EDB,0x66BB765B,
-  0xEFC56AF3,0xC50D0C13,0x2D1393C5,0x9995DDCD,0x1FFC2AAF,
-  0x5600C801,0x10E03E80,0x85360C48,0xC91EE3D6,0xBED656C8,
-  0x4458F0DE,0x3553B33A,0x9E01D7FD,0x2E606880,0x897E1CA8,
-  0x2AC866E0,0xE81E9FD6,0xB4864E08,0x8669F762,0x49FCE2AE,
-  0x46E0F681,0x95D632C8,0x4C28EF9E,0x77C8B51E,0xFA8EA616,
-  0x710B43E4,0xAB5264C7,0xB061BF7D,0xA71E7428,0xA3B67A48,
-  0xC2D6F936,0x5C98D1DE,0x32EFB96A,0xCF9515CC,0x0F1C142F,
-  0xD336C449,0xD9FEDD56,0x3BE05A80,0x8D461308,0x8B85E5F2,
-  0xDA592723,0x1B33DBBA,0x177FCB55,0x04A80E60,0x6160837E,
-  0x9E4E28E8,0x6E7768B4,0xFD7AACA6,0xC08901E3,0xDC2AD066,
-  0x0AC8191F,0xE21E87D6,0xB6A64988,0x06C3F6FA,0x51DCC2D1,
-  0xC16AFC99,0x0C4C10EF,0x13D7C535,0x65C88D1E,0xFF2EAB96,
-  0xF039405C,0x930DC412,0x3DF3AD45,0x1CA3D185,0xD6E2C979,
-  0xE8D69EC9,0x54B8CE5E,0xB065BF72,0x571F342B,0x90B63E48,
-  0xCD26EC76,0x1F9BD5DA,0x761F482B,0x9AE62688,0x0F17EBCA,
-  0x6334844E,0xAEFE6957,0x21507CC0,0xCA4118FC,0x3E3457B0,
-  0xBC6E5097,0xE4DD712C,0xE77A8B59,0xC7A90A63,0x5D90D23E,
-  0xD2BD39AC,0x69849DF1,0xECF96EA3,0x95F1CD42,0x6C236F84,
-  0xCDCAED19,0x8FAE1597,0xEB11643C,0xF4754F4C,0x825A0727,
-  0x58B321BB,0x03A7FA75,0x20D3813A,0x9A39D85D,0x8F2DEB92,
-  0xBB39A45D,0x857DF352,0x7908A3E1,0xF9D2A2C6,0xA1E9829D,
-  0x4264F88E,0x64BF71AB,0x1F642B70,0x762F486B,0xDAE9269C,
-  0x5B14DBCE,0x23747B4F,0xBAEA5967,0x151433CF,0x34144FCF,
-  0x3E44570F,0xFC7550B3,0x80DA0127,0x583B205B,0xE38D7A13,
-  0x26DB8925,0x7BDB5ADB,0x694B631B,0xACC66EF7,0x81FDFD52,
-  0x7860A081,0x999E2228,0xAFFE6AA8,0x21007C00,0x0A5018C0,
-  0xC23107BC,0x7CAF5194,0xD8E1217C,0xBBB65A48,0xC556F336,
-  0x5D00D3FE,0x129039C0,0xC58D0DEC,0x2D3B93A5,0xF99D5DD3,
-  0xE1FE82A9,0x36604880,0x8EFE16A8,0x2B5064C0,0xC8611F7C,
-  0xBE9E5628,0xA44E70E8,0x63577B34,0x7EE0A97E,0x985620C8,
-  0x4F90EA3E,0xD71D342C,0xE8B69E49,0xD4A6CE76,0x1863DF7A,
-  0xD79ECA29,0xB89E5E28,0xA5AE7268,0xE3317BBC,0x76FF4954,
-  0x1AD026C0,0xC7190BDC,0x1DB7D24A,0xE6B689B6,0xD7C6CAF6,
-  0x988DDE12,0x3FABAA65,0x3C10503F,0xCCC5110C,0xCFFD1553,
-  0x6F009401,0x1D302C40,0x469F09D4,0x95CE32E8,0x6C2F6F94,
-  0xDDC92D1C,0xDAAED996,0xFB015BFC,0x31704340,0x4F4B14E4,
-  0xA7267477,0x03BBFA5A,0xF0D54133,0x0338045F,0xA0FD8152,
-  0x7230B841,0x5BAF2594,0xD3513B3C,0xF9E15D7C,0xB1E64288,
-  0x0767F48A,0x21AF826A,0xCA7118BC,0x7E3B57A4,0xE86D6093,
-  0xA49D8E2D,0xF36EBB69,0xF3ED456C,0xA3C5850D,0xD2CD3913,
-  0x299F9DD5,0x88FE1EA8,0x2AB06640,0x48071FF4,0xB681B602,
-  0x26C876E0,0xEBDE9AD6,0xB44A4F18,0x96563737,0x4CF0EEBE,
-  0x57F33544,0x0083FE05,0x5028C061,0x7108BC1E,0xFB52A4C6,
-  0xA161837D,0xA24E78E8,0x62B779B4,0xFE86A9F6,0x9049C0E2,
-  0xCD16EC36,0x5F94D5CE,0x221C782F,0xDAA6D989,0x1B03DBFA,
-  0x5770CB41,0x50AB3E64,0x21207C7F,0x8A5A18D8,0x5A3327BB,
-  0x032FFB95,0xC0F9015C,0x9C31D042,0x6ECF6914,0x5D5F2CD4,
-  0x928239F8,0x7D88ADE1,0xF8BAA1A6,0xC1A50273,0x4C7310BB,
-  0x07DBF525,0x718B421B,0xAB7A64A7,0xD0693F63,0x591CDC2E,
-  0xC3D6FAC9,0x5CC8D11E,0xF2FEB956,0x339045C0,0xCFDD152C,
-  0xEF0A9419,0x85320C47,0x391FA3D5,0x8DD612C8,0x4BA8E59E,
-  0x7650B73E,0xDAF126BC,0x7B135BC4,0x8975E34D,0x9ACA26E7,
-  0x9F1E2BD7,0xAE366848,0xC16EFC96,0xFC4D50EC,0x20D78135,
-  0x6A38985E,0xBC2DAF92,0xB4C9B11D,0xC67EF756,0x3DF852A0,
-  0xACA19182,0xA1E27D78,0xF266B889,0x13BFC5AA,0x05D40D30,
-  0x3128439F,0x6F5894DE,0x3D23AC7A,0xDC9AD1D9,0x4AEF196B,
-  0xD61537CC,0x08E41E8F,0x72B7464B,0xFB86A5F6,0x9159C322,
-  0x0D43ECFA,0x5384C5F1,0xE1D97D23,0x166BC89A,0x34FC4EAF,
-  0x5E70D741,0x527B38A4,0xE1B97DA3,0x9675C8B2,0x9CFA2EA7,
-  0xDEF12943,0x7A5358C4,0x8931E3BD,0x6ADF66D4,0x9C1A2FD8,
-  0x5EC7290B,0xB25DB8D2,0xF7B2B5B9,0x22978635,0x6A8C99EE,
-  0x0C0BEFE5,0xB3C24507,0x77CCB511,0x0A8FE615,0x420B07E4,
-  0xA4A27187,0xF362BB79,0xE3EE8569,0xF6C5490C,0xC2DD06D3,
-  0xEC9A91D9,0x45EF0D6B,0xD525338C,0x481B1FDB,0x6687760B,
-  0xBFC9AAE2,0xC40EF016,0x7D435304,0x4884E1F1,0xE6A97663,
-  0x57C0CAFE,0x108C3E10,0x152BCC65,0x34184FDF,0x2E47970A,
-  0xA9759CB2,0x90CA3EE7,0x9D3E2C57,0x2E9C69D0,0xD94EDCE9,
-  0x7BC75AF4,0xB94DA312,0x35C7B2F5,0xAE2D9792,0xB169BC9D,
-  0x474CF4EE,0x05A7F275,0x213383BA,0x1A5FD8D5,0x87320BB8,
-  0x39BFA255,0x0DF412B0,0xB3A24587,0xF7D2B539,0xA289861D,
-  0xC28AF9E6,0x8C8A11E7,0x9BEA2567,0x1F442B0F,0xF6254873,
-  0x42EB069B,0x249471CF,0x3B6C5B6F,0x9D6DD36D,0xBE8DA9ED,
-  0x344BB0E5,0xBE565737,0x4470F0BE,0x555B3324,0x60037FFB,
-  0x4E00E801,0x17603480,0x84AE0E68,0xE961637C,0xB4CE4EE8,
-  0x667F7754,0x1FF82AA0,0xA6018802,0x23E07A80,0x8AC61908,
-  0x8A1DE7D2,0xFA26A789,0x112BC39A,0x35584CDF,0x2E0397FA,
-  0x5960DC81,0x93CE3AE8,0x6DCF6D14,0x5DAF2D94,0xD2B139BC,
-  0x79875DF4,0xB9F9A2A2,0x85E1F282,0xA9266388,0x00DBFEDA,
-  0x703B405B,0xEB0D6413,0x24738F45,0x1B5BDB25,0x77634B7B,
-  0xCAAEE669,0xFE0157FC,0x30604080,0x8F1E1428,0xAB366448,
-  0xC07EFF56,0x3C185020,0x2CC7910A,0xA9FD9D52,0x70E0BE81,
-  0x9B362448,0xCF7EEB56,0x3F285460,0x6C38905E,0xBDCDAD12,
-  0x34AFB195,0xCE61177C,0xBF7E54A8,0x24287060,0x6B489B1E,
-  0xFC66AF76,0x10DFC12A,0x853A0C58,0xD91D23D3,0xEBD69AC9,
-  0x5448CF1E,0xF056BF36,0x5310C43E,0xD1F53D4C,0x89621C87,
-  0xFACEA6E9,0x711F43D4,0x9B5624C8,0x4F60EB7E,0x972E3468,
-  0xECB96E5C,0x95E5CD72,0x5C272F8B,0x32CBB91A,0xBF9E55D7,
-  0xA41E7028,0xA3467B08,0x82E5F972,0x589721CB,0x73ACBA6E,
-  0x8BD1E53D,0xEA49671C,0xD436CFB6,0xD84EDF16,0x7B975A34,
-  0x795CA32E,0xC9C2E2F9,0x6EEC9691,0x8D55ECCD,0x1B8025FF,
-  0x07580B20,0x21A3827A,0xDA72D8B9,0x2B3B9BA5,0xF87D5F53,
-  0x61988221,0x3E7FA8AA,0x0C7810A0,0xA3D98522,0x02CBF91A,
-  0xB09E41D7,0xA72E7468,0xE3B97A5C,0x96D5C932,0x1CD82EDF,
-  0x26FB895A,0xFBD15AC3,0xF149431C,0xD346C4F6,0x99E5DD72,
-  
-};
-#   endif
-#   if defined WORDS_BIGENDIAN
-/* big endian */
-static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
-  0x01800060,0x0028001E,0x80086006,0xA802FE81,0x80606028,
-  0x281E9E88,0x6866AEAA,0xFC7F01E0,0x00480036,0x8016E00E,
-  0xC8045683,0x7EE1E048,0x4836B696,0xF6EEC6CC,0x52D5FD9F,
-  0x01A8007E,0x80206018,0x280A9E87,0x28629EA9,0xA87EFEA0,
-  0x40783022,0x9419AF4A,0xFC3701D6,0x805EE038,0x4812B68D,
-  0xB6E5B6CB,0x36D756DE,0xBED8705A,0xA43B3B53,0x537DFDE1,
-  0x81886066,0xA82AFE9F,0x0068002E,0x801C6009,0xE806CE82,
-  0xD4619F68,0x682EAE9C,0x7C69E1EE,0xC84C56B5,0xFEF70046,
-  0x8032E015,0x880F2684,0x1AE34B09,0xF746C6B2,0xD2F59D87,
-  0x29A29EF9,0xA842FEB1,0x80746027,0x681AAE8B,0x3C6751EA,
-  0xBC4F31F4,0x14474F72,0xB425B75B,0x36BB56F3,0x7EC5E053,
-  0x083DC691,0x92EC6D8D,0xEDA58DBB,0x25B35B35,0xFB57037E,
-  0x81E06048,0x28369E96,0xE86ECEAC,0x547DFF61,0x8028601E,
-  0xA8087E86,0xA062F829,0x829EE1A8,0x487EB6A0,0x76F826C2,
-  0x9AD1AB1C,0x7F49E036,0xC816D68E,0xDEE4584B,0x7AB76336,
-  0xA9D6FEDE,0xC058503A,0xBC1331CD,0xD4559F7F,0x28201E98,
-  0x086A86AF,0x22FC1981,0xCAE05708,0x3E869062,0xEC298DDE,
-  0xE5984B2A,0xB75F36B8,0x16F28EC5,0xA4533B7D,0xD3619DE8,
-  0x698EAEE4,0x7C4B61F7,0x6846AEB2,0xFC7581E7,0x204A9837,
-  0x2A969F2E,0xE81C4E89,0xF466C76A,0xD2AF1DBC,0x09B1C6F4,
-  0x52C77D92,0xA1ADB87D,0xB2A1B5B8,0x7732A695,0xBAEF330C,
-  0x15C5CF13,0x140DCF45,0x94332F55,0xDC3F19D0,0x0ADC0719,
-  0xC28AD1A7,0x1C7A89E3,0x26C9DAD6,0xDB1EDB48,0x5B76BB66,
-  0xF36AC5EF,0x130C0DC5,0xC593132D,0xCDDD9599,0xAF2AFC1F,
-  0x01C80056,0x803EE010,0x480C3685,0xD6E31EC9,0xC856D6BE,
-  0xDEF05844,0x3AB35335,0xFDD7019E,0x8068602E,0xA81C7E89,
-  0xE066C82A,0xD69F1EE8,0x084E86B4,0x62F76986,0xAEE2FC49,
-  0x81F6E046,0xC832D695,0x9EEF284C,0x1EB5C877,0x16A68EFA,
-  0xE4430B71,0xC76452AB,0x7DBF61B0,0x28741EA7,0x487AB6A3,
-  0x36F9D6C2,0xDED1985C,0x6AB9EF32,0xCC1595CF,0x2F141C0F,
-  0x49C436D3,0x56DDFED9,0x805AE03B,0x0813468D,0xF2E5858B,
-  0x232759DA,0xBADB331B,0x55CB7F17,0x600EA804,0x7E836061,
-  0xE8284E9E,0xB468776E,0xA6AC7AFD,0xE30189C0,0x66D02ADC,
-  0x1F19C80A,0xD6871EE2,0x8849A6B6,0xFAF6C306,0xD1C2DC51,
-  0x99FC6AC1,0xEF104C0C,0x35C5D713,0x1E8DC865,0x96AB2EFF,
-  0x5C4039F0,0x12C40D93,0x45ADF33D,0x85D1A31C,0x79C9E2D6,
-  0xC99ED6E8,0x5ECEB854,0x72BF65B0,0x2B341F57,0x483EB690,
-  0x76EC26CD,0xDAD59B1F,0x2B481F76,0x8826E69A,0xCAEB170F,
-  0x4E843463,0x5769FEAE,0xC07C5021,0xFC1841CA,0xB057343E,
-  0x97506EBC,0x2C71DDE4,0x598B7AE7,0x630AA9C7,0x3ED2905D,
-  0xAC39BDD2,0xF19D8469,0xA36EF9EC,0x42CDF195,0x846F236C,
-  0x19EDCACD,0x9715AE8F,0x3C6411EB,0x4C4F75F4,0x27075A82,
-  0xBB21B358,0x75FAA703,0x3A81D320,0x5DD8399A,0x92EB2D8F,
-  0x5DA439BB,0x52F37D85,0xE1A30879,0xC6A2D2F9,0x9D82E9A1,
-  0x8EF86442,0xAB71BF64,0x702B641F,0x6B482F76,0x9C26E9DA,
-  0xCEDB145B,0x4F7B7423,0x6759EABA,0xCF331415,0xCF4F1434,
-  0x0F57443E,0xB35075FC,0x2701DA80,0x5B203B58,0x137A8DE3,
-  0x2589DB26,0xDB5ADB7B,0x1B634B69,0xF76EC6AC,0x52FDFD81,
-  0x81A06078,0x28229E99,0xA86AFEAF,0x007C0021,0xC018500A,
-  0xBC0731C2,0x9451AF7C,0x7C21E1D8,0x485AB6BB,0x36F356C5,
-  0xFED3005D,0xC0399012,0xEC0D8DC5,0xA5933B2D,0xD35D9DF9,
-  0xA982FEE1,0x80486036,0xA816FE8E,0xC064502B,0x7C1F61C8,
-  0x28569EBE,0xE8704EA4,0x347B5763,0x7EA9E07E,0xC8205698,
-  0x3EEA904F,0x2C341DD7,0x499EB6E8,0x76CEA6D4,0x7ADF6318,
-  0x29CA9ED7,0x285E9EB8,0x6872AEA5,0xBC7B31E3,0x5449FF76,
-  0xC026D01A,0xDC0B19C7,0x4AD2B71D,0xB689B6E6,0xF6CAC6D7,
-  0x12DE8D98,0x65AAAB3F,0x3F50103C,0x0C11C5CC,0x5315FDCF,
-  0x0194006F,0x402C301D,0xD4099F46,0xE832CE95,0x946F2F6C,
-  0x1C2DC9DD,0x96D9AEDA,0xFC5B01FB,0x40437031,0xE4144B4F,
-  0x777426A7,0x5AFABB03,0x3341D5F0,0x5F043803,0x5281FDA0,
-  0x41B83072,0x9425AF5B,0x3C3B51D3,0x7C5DE1F9,0x8842E6B1,
-  0x8AF46707,0x6A82AF21,0xBC1871CA,0xA4573B7E,0x93606DE8,
-  0x2D8E9DA4,0x69BB6EF3,0x6C45EDF3,0x0D85C5A3,0x1339CDD2,
-  0xD59D9F29,0xA81EFE88,0x4066B02A,0xF41F0748,0x02B681B6,
-  0xE076C826,0xD69ADEEB,0x184F4AB4,0x37375696,0xBEEEF04C,
-  0x4435F357,0x05FE8300,0x61C02850,0x1EBC0871,0xC6A452FB,
-  0x7D8361A1,0xE8784EA2,0xB479B762,0xF6A986FE,0xE2C04990,
-  0x36EC16CD,0xCED5945F,0x2F781C22,0x89D9A6DA,0xFADB031B,
-  0x41CB7057,0x643EAB50,0x7F7C2021,0xD8185A8A,0xBB27335A,
-  0x95FB2F03,0x5C01F9C0,0x42D0319C,0x1469CF6E,0xD42C5F5D,
-  0xF8398292,0xE1AD887D,0xA6A1BAF8,0x7302A5C1,0xBB10734C,
-  0x25F5DB07,0x1B428B71,0xA7647AAB,0x633F69D0,0x2EDC1C59,
-  0xC9FAD6C3,0x1ED1C85C,0x56B9FEF2,0xC0459033,0x2C15DDCF,
-  0x19940AEF,0x470C3285,0xD5A31F39,0xC812D68D,0x9EE5A84B,
-  0x3EB75076,0xBC26F1DA,0xC45B137B,0x4DE37589,0xE726CA9A,
-  0xD72B1E9F,0x486836AE,0x96FC6EC1,0xEC504DFC,0x3581D720,
-  0x5E98386A,0x92AF2DBC,0x1DB1C9B4,0x56F77EC6,0xA052F83D,
-  0x8291A1AC,0x787DE2A1,0x89B866F2,0xAAC5BF13,0x300DD405,
-  0x9F432831,0xDE94586F,0x7AAC233D,0xD9D19ADC,0x6B19EF4A,
-  0xCC3715D6,0x8F1EE408,0x4B46B772,0xF6A586FB,0x22C35991,
-  0xFAEC430D,0xF1C58453,0x237DD9E1,0x9AC86B16,0xAF4EFC34,
-  0x41D7705E,0xA4387B52,0xA37DB9E1,0xB2C87596,0xA72EFA9C,
-  0x4329F1DE,0xC458537A,0xBDE33189,0xD466DF6A,0xD82F1A9C,
-  0x0B29C75E,0xD2B85DB2,0xB9B5B2F7,0x35869722,0xEE998C6A,
-  0xE5EF0B0C,0x0745C2B3,0x11B5CC77,0x15E68F0A,0xE4070B42,
-  0x8771A2A4,0x79BB62F3,0x6985EEE3,0x0C49C5F6,0xD306DDC2,
-  0xD9919AEC,0x6B0DEF45,0x8C3325D5,0xDB1F1B48,0x0B768766,
-  0xE2AAC9BF,0x16F00EC4,0x0453437D,0xF1E18448,0x6376A9E6,
-  0xFECAC057,0x103E8C10,0x65CC2B15,0xDF4F1834,0x0A97472E,
-  0xB29C75A9,0xE73ECA90,0x572C3E9D,0xD0699C2E,0xE9DC4ED9,
-  0xF45AC77B,0x12A34DB9,0xF5B2C735,0x92972DAE,0x9DBC69B1,
-  0xEEF44C47,0x75F2A705,0xBA833321,0xD5D85F1A,0xB80B3287,
-  0x55A2BF39,0xB012F40D,0x8745A2B3,0x39B5D2F7,0x1D8689A2,
-  0xE6F98AC2,0xE7118A8C,0x6725EA9B,0x0F2B441F,0x734825F6,
-  0x9B06EB42,0xCF719424,0x6F5B6C3B,0x6DD36D9D,0xEDA98DBE,
-  0xE5B04B34,0x375756BE,0xBEF07044,0x24335B55,0xFB7F0360,
-  0x01E8004E,0x80346017,0x680EAE84,0x7C6361E9,0xE84ECEB4,
-  0x54777F66,0xA02AF81F,0x028801A6,0x807AE023,0x0819C68A,
-  0xD2E71D8A,0x89A726FA,0x9AC32B11,0xDF4C5835,0xFA97032E,
-  0x81DC6059,0xE83ACE93,0x146DCF6D,0x942DAF5D,0xBC39B1D2,
-  0xF45D8779,0xA2A2F9B9,0x82F2E185,0x886326A9,0xDAFEDB00,
-  0x5B403B70,0x13640DEB,0x458F7324,0x25DB5B1B,0x7B4B6377,
-  0x69E6AECA,0xFC5701FE,0x80406030,0x28141E8F,0x486436AB,
-  0x56FF7EC0,0x2050183C,0x0A91C72C,0x529DFDA9,0x81BEE070,
-  0x4824369B,0x56EB7ECF,0x6054283F,0x5E90386C,0x12ADCDBD,
-  0x95B1AF34,0x7C1761CE,0xA8547EBF,0x60702824,0x1E9B486B,
-  0x76AF66FC,0x2AC1DF10,0x580C3A85,0xD3231DD9,0xC99AD6EB,
-  0x1ECF4854,0x36BF56F0,0x3EC41053,0x4C3DF5D1,0x871C6289,
-  0xE9A6CEFA,0xD4431F71,0xC824569B,0x7EEB604F,0x68342E97,
-  0x5C6EB9EC,0x72CDE595,0x8B2F275C,0x1AB9CB32,0xD7559EBF,
-  0x28701EA4,0x087B46A3,0x72F9E582,0xCB219758,0x6EBAAC73,
-  0x3DE5D18B,0x1C6749EA,0xB6CF36D4,0x16DF4ED8,0x345A977B,
-  0x2EA35C79,0xF9E2C2C9,0x9196EC6E,0xCDEC558D,0xFF25801B,
-  0x200B5807,0x7A82A321,0xB9D872DA,0xA59B3B2B,0x535F7DF8,
-  0x21829861,0xAAA87F3E,0xA010780C,0x2285D9A3,0x1AF9CB02,
-  0xD7419EB0,0x68742EA7,0x5C7AB9E3,0x32C9D596,0xDF2ED81C,
-  0x5A89FB26,0xC35AD1FB,0x1C4349F1,0xF6C446D3,0x72DDE599,
-  
-};
-#   endif
-
-#endif /* PROTOTYPES */
</pre></div>
<hr /><a name="file41" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>gddriver.h</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/gddriver.h
+++ lxdream/src/gdrom/gddriver.h
@@ -1,266 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * This file defines the structures and functions used by the GD-Rom
- * disc drivers. (ie, the modules that supply a CD image to be used by the
- * system).
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef lxdream_gddriver_H
-#define lxdream_gddriver_H 1
-
-#include <stdio.h>
-#include "lxdream.h"
-#include "gdrom/gdrom.h"
-#include <glib/gstrfuncs.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_SECTOR_SIZE 2352
-
-#define CD_MSF_START 150 /* MSF numbering starts after the initial pregap */
-#define CD_FRAMES_PER_SECOND 75
-#define CD_SECONDS_PER_MINUTE 60
-#define CD_FRAMES_PER_MINUTE (CD_FRAMES_PER_SECOND*CD_SECONDS_PER_MINUTE)
-
-#define GDROM_PREGAP 150  /* Sectors */
-
-extern uint32_t gdrom_sector_size[];
-#define GDROM_SECTOR_SIZE(x) gdrom_sector_size[x]
-/**
- * Track data type enumeration for cd images and devices. This somewhat
- * conflates the real track mode with the format of the image file, but
- * it manages to make sense so far.
- */
-typedef enum {
-    GDROM_MODE0,          // Mode 0 - should never actually see this
-    /* Data-only modes (image file contains only the user data) */
-    GDROM_MODE1,          // Standard CD-Rom Mode 1 data track
-    GDROM_MODE2_FORMLESS, // Mode 2 data track with no sub-structure (rare)
-    GDROM_MODE2_FORM1,    // Mode 2/Form 1 data track (standard for multisession)
-    GDROM_MODE2_FORM2,    // Mode 2/Form 2 data track (also fairly uncommon).
-    GDROM_CDDA,           // Standard audio track
-
-    /* This one is somewhat special - the image file contains the 2336 bytes of
-     * "extended user data", which in turn contains either a form 1 or form 2
-     * sector. In other words it's a raw mode2 XA sector without the 16-byte header.
-     */
-    GDROM_SEMIRAW_MODE2,
-    /* Raw modes (image contains the full 2352-byte sector). Split into XA/Non-XA
-     * here for convenience, although it's really a session level flag. */
-    GDROM_RAW_XA,
-    GDROM_RAW_NONXA,
-} gdrom_track_mode_t;
-
-/* The disc register indicates the current contents of the drive. When open
- * contains 0x06.
- */
-#define IDE_DISC_READY 0x01 /* ored with above */
-#define IDE_DISC_IDLE  0x02 /* ie spun-down */
-
-#define IDE_DISC_NONE    0x06
-#define IDE_DISC_AUDIO   0x00
-#define IDE_DISC_CDROM   0x10
-#define IDE_DISC_CDROMXA 0x20
-#define IDE_DISC_GDROM   0x80
-
-#define TRACK_PRE_EMPHASIS   0x10
-#define TRACK_COPY_PERMITTED 0x20
-#define TRACK_DATA           0x40
-#define TRACK_FOUR_CHANNEL   0x80
-
-typedef struct gdrom_track {
-    gdrom_track_mode_t mode;
-    uint8_t flags;        /* Track flags */
-    int      session;     /* session # containing this track */
-    uint32_t lba;         /* start sector address */
-    uint32_t sector_size; /* For convenience, determined by mode */
-    uint32_t sector_count;
-    uint32_t offset;      /* File offset of start of track (image files only) */
-    FILE *file;           /* Per-track file handle (if any) */
-} *gdrom_track_t;
-
-struct gdrom_disc {
-    int disc_type;     /* One of the IDE_DISC_* flags */
-    const gchar *name; /* Device name / Image filename (owned) */
-    const gchar *display_name; /* User-friendly device name, if any (owned) */
-    gchar mcn[14]; /* Media catalogue number */
-    char title[129]; /* Disc title (if any) from bootstrap */
-    int track_count;
-    struct gdrom_track track[99];
-    FILE *file;       /* Image file / device handle */
-    void *impl_data; /* Implementation private data */
-
-       /* Check for media change. If the media cannot change (ie image file)
-        * or is notified asynchonously, this should be a no-op. In the event of
-        * a change, this function should update the structure according to the
-        * new media (including TOC), and return TRUE.
-        * @return TRUE if the media has changed since the last check, otherwise
-        * FALSE.
-        */
-       gboolean (*check_status)( struct gdrom_disc *disc );
-
-    /**
-     * Read a single sector from the disc at the specified logical address.
-     * @param disc pointer to the disc structure
-     * @param lba logical address to read from
-     * @param mode mode field from the read command
-     * @param buf buffer to receive data (at least MAX_SECTOR_SIZE bytes)
-     * @param length unsigned int to receive the number of bytes actually read.
-     * @return PKT_ERR_OK on success, or another PKT_ERR_* code on failure.
-     */
-    gdrom_error_t (*read_sector)( struct gdrom_disc *disc,
-            uint32_t lba, int mode, 
-            unsigned char *buf, uint32_t *length );
-
-    /**
-     * Begin playing audio from the given lba address on the disc.
-     */
-    gdrom_error_t (*play_audio)(struct gdrom_disc *disc, uint32_t lba, uint32_t endlba);
-
-       /**
-        * Stop audio playback
-        */
-       gdrom_error_t (*stop_audio)(struct gdrom_disc *disc);
-
-    /**
-     * Executed once per time slice to perform house-keeping operations 
-     * (checking disc status, media changed, etc).
-     */
-    uint32_t (*run_time_slice)( struct gdrom_disc *disc, uint32_t nanosecs );
-
-       /**
-        * Release all memory and system resources, including the gdrom_disc itself.
-        * (implicitly calls close() if not already closed. 
-        * @param disc The disc to destroy
-        * @param close_fh if TRUE, close the main file/device, otherwise leave open.
-        * This is mainly used when the handle will be immediately reused.
-        */
-    void (*destroy)( struct gdrom_disc *disc, gboolean close_fh );
-};
-
-/**
- * Low-level SCSI transport provided to the main SCSI/MMC driver. When used
- * this will be set as the disc->impl_data field.
- * Note: For symmetry there should be a packet_write variant, but we don't
- * currently need it for anything. YAGNI, etc.
- */
-typedef struct gdrom_scsi_transport {
-       /* Execute a read command (ie a command that returns a block of data in
-        * response, not necessarily a CD read). 
-        * @param scsi The disc to execute the command
-        * @param cmd  The 12-byte command packet
-        * @param buf  The buffer to receive the read results
-        * @param length On entry, the size of buf. Modified on exit to the number
-        *        of bytes actually read.
-        * @return PKT_ERR_OK on success, otherwise the host error code.
-        */
-       gdrom_error_t (*packet_read)( struct gdrom_disc *disc,
-                                     char *cmd, unsigned char *buf,
-                                     unsigned int *length );
-                                     
-       /* Execute a generic command that does not write or return any data.
-        * (eg play audio).
-        * @param scsi The disc to execute the command
-        * @param cmd  The 12-byte command packet
-        * @return PKT_ERR_OK on success, otherwise the host error code.
-        */
-       gdrom_error_t (*packet_cmd)( struct gdrom_disc *disc,
-                                    char *cmd );
-       
-       /* Return TRUE if the media has changed since the last call, otherwise
-        * FALSE. This method is used to implement the disc-level check_status
-        * and should have no side-effects.
-        */
-       gboolean (*media_changed)( struct gdrom_disc *disc );
-} *gdrom_scsi_transport_t;
-
-/**
- * Allocate a new gdrom_disc_t and initialize the filename and file fields.
- * The disc is otherwise uninitialized - this is an internal method for use 
- * by the concrete implementations.
- */
-gdrom_disc_t gdrom_disc_new(const gchar *filename, FILE *f);
-
-/**
- * Construct a new SCSI/MMC disc using the supplied transport implementation.
- */
-gdrom_disc_t gdrom_scsi_disc_new(const gchar *filename, FILE *f, gdrom_scsi_transport_t transport);
-
-/**
- * Construct a new image file using the default methods.
- */
-gdrom_disc_t gdrom_image_new( const gchar *filename, FILE *f );
-
-#define SCSI_TRANSPORT(disc)  ((gdrom_scsi_transport_t)disc->impl_data)
-
-/**
- *
- */
-typedef struct gdrom_image_class {
-    const gchar *name;
-    const gchar *extension;
-    gboolean (*is_valid_file)(FILE *f);
-    gdrom_disc_t (*open_image_file)(const gchar *filename, FILE *f);
-} *gdrom_image_class_t;
-
-extern struct gdrom_image_class nrg_image_class;
-extern struct gdrom_image_class cdi_image_class;
-extern struct gdrom_image_class gdi_image_class;
-extern struct gdrom_image_class cdrom_device_class;
-
-/**
- * Determine the track number containing the specified sector by lba.
- */
-int gdrom_disc_get_track_by_lba( gdrom_disc_t image, uint32_t lba );
-
-/**
- * Default disc destroy method, for chaining from subclasses
- */
-void gdrom_disc_destroy( gdrom_disc_t disc, gboolean close_fh );
-
-gdrom_device_t gdrom_device_new( const gchar *name, const gchar *dev_name );
-
-void gdrom_device_destroy( gdrom_device_t dev );
-
-/************* Host-native support functions ***************/
-
-/**
- * Given a raw (2352 byte) data sector, extract the requested components into the 
- * target buffer. length will also be updated with the length of the copied
- * data
- */
-void gdrom_extract_raw_data_sector( char *sector_data, int mode, unsigned char *buf, uint32_t *length );
-
-/**
- * Check the disc for a useable DC bootstrap, and update the disc
- * with the title accordingly.
- * @return TRUE if we found a bootstrap, otherwise FALSE.
- */
-gboolean gdrom_disc_read_title( gdrom_disc_t disc ); 
-
-/** 
- * Parse a TOC mode-2 result buffer into the gdrom_disc_t data structure
- */
-void mmc_parse_toc2( gdrom_disc_t disc, unsigned char *buf );
-
-/**
- * Set the disc type flag based on the track contents
- */
-void gdrom_set_disc_type( gdrom_disc_t disc );
-
-#endif /* !lxdream_gddriver_H */
</pre></div>
<hr /><a name="file42" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>gdi.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/gdi.c
+++ lxdream/src/gdrom/gdi.c
@@ -1,137 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * NullDC GDI image format
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <glib/gutils.h>
-#include "gdrom/gddriver.h"
-
-
-static gboolean gdi_image_is_valid( FILE *f );
-static gdrom_disc_t gdi_image_open( const gchar *filename, FILE *f );
-
-struct gdrom_image_class gdi_image_class = { "NullDC GD-Rom Image", "gdi", 
-        gdi_image_is_valid, gdi_image_open };
-
-static gboolean gdi_image_is_valid( FILE *f )
-{
-    char line[512];
-    uint32_t track_count;
-
-    fseek(f, 0, SEEK_SET);
-    if( fgets( line, sizeof(line), f ) == NULL ) {
-        return FALSE;
-    }
-    track_count = strtoul(line, NULL, 0);
-    if( track_count == 0 || track_count > 99 ) {
-        return FALSE;
-    }
-    return TRUE;
-}
-
-static gdrom_disc_t gdi_image_open( const gchar *filename, FILE *f )
-{
-    int i;
-    uint32_t track_count;
-    gdrom_disc_t disc;
-    struct stat st;
-    char line[512];
-    int session = 0;
-    gchar *dirname;
-
-    fseek(f, 0, SEEK_SET);
-
-    if( fgets( line, sizeof(line), f ) == NULL ) {
-        return FALSE;
-    }
-    track_count = strtoul(line, NULL, 0);
-    if( track_count == 0 || track_count > 99 ) {
-        return NULL;
-    }
-
-    disc = gdrom_image_new(filename, f);
-    if( disc == NULL ) {
-        ERROR("Unable to allocate memory!");
-        return NULL;
-    }
-    dirname = g_path_get_dirname(filename);
-    disc->disc_type = IDE_DISC_GDROM;
-    disc->track_count = track_count;
-    for( i=0; i<track_count; i++ ) {
-        int track_no, start_lba, flags, size, offset;
-        char filename[256];
-
-        if( fgets( line, sizeof(line), f ) == NULL ) {
-            disc->destroy(disc,FALSE);
-            return NULL;
-        }
-        sscanf( line, "%d %d %d %d %s %d", &track_no, &start_lba, &flags, &size,
-                filename, &offset );
-        if( start_lba >= 45000 ) {
-            session = 1;
-        }
-        disc->track[i].session = session;
-        disc->track[i].lba = start_lba + 150; // 2-second offset
-        disc->track[i].flags = (flags & 0x0F)<<4;
-        disc->track[i].sector_size = size;
-        if( strcasecmp( filename, "none" ) == 0 ) {
-            disc->track[i].file = NULL;
-            disc->track[i].sector_count = 0;
-            disc->track[i].mode = GDROM_MODE1;
-        } else {
-            gchar *pathname = g_strdup_printf( "%s%c%s", dirname, G_DIR_SEPARATOR, filename );
-            disc->track[i].file = fopen( pathname, "ro" );
-            g_free(pathname);
-            if( disc->track[i].file == NULL ) {
-                disc->destroy(disc,FALSE);
-                g_free(dirname);
-                return NULL;
-            }
-            fstat( fileno(disc->track[i].file), &st );
-            disc->track[i].sector_count = st.st_size / size;
-            if( disc->track[i].flags & TRACK_DATA ) {
-                /* Data track */
-                switch(size) {
-                case 2048: disc->track[i].mode = GDROM_MODE1; break;
-                case 2336: disc->track[i].mode = GDROM_SEMIRAW_MODE2; break;
-                case 2352: disc->track[i].mode = GDROM_RAW_XA; break;
-                default:
-                    disc->destroy(disc,FALSE);
-                    g_free(dirname);
-                    return NULL;
-                }
-            } else {
-                /* Audio track */
-                disc->track[i].mode = GDROM_CDDA;
-                if( size != 2352 ) {
-                    disc->destroy(disc,FALSE);
-                    g_free(dirname);
-                    return NULL;
-                }
-            }
-        }
-        disc->track[i].offset = offset;
-    }
-    g_free(dirname);
-    return disc;
-}
</pre></div>
<hr /><a name="file43" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>gdimage.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/gdimage.c
+++ lxdream/src/gdrom/gdimage.c
@@ -1,460 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * GD-Rom image-file common functions. 
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-
-#include "gdrom/gddriver.h"
-#include "gdrom/packet.h"
-#include "ecc.h"
-
-static gboolean gdrom_null_check_status( gdrom_disc_t disc );
-static gdrom_error_t gdrom_image_read_sector( gdrom_disc_t disc, uint32_t lba, int mode, 
-                                              unsigned char *buf, uint32_t *readlength );
-
-static uint8_t gdrom_default_sync[12] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0 };
-
-#define SECTOR_HEADER_SIZE 16
-#define SECTOR_SUBHEADER_SIZE 8
-
-/* Data offset (from start of raw sector) by sector mode */
-static int gdrom_data_offset[] = { 16, 16, 16, 24, 24, 0, 8, 0, 0 };
-
-gdrom_image_class_t gdrom_image_classes[] = { &cdrom_device_class, 
-        &nrg_image_class, 
-        &cdi_image_class, 
-        &gdi_image_class, 
-        NULL };
-
-struct cdrom_sector_header {
-    uint8_t sync[12];
-    uint8_t msf[3];
-    uint8_t mode;
-    uint8_t subhead[8]; // Mode-2 XA sectors only
-};
-
-gdrom_disc_t gdrom_disc_new( const gchar *filename, FILE *f )
-{
-    gdrom_disc_t disc = (gdrom_disc_t)g_malloc0(sizeof(struct gdrom_disc));
-    if( disc == NULL ) {
-        return NULL;
-    }
-    disc->disc_type = IDE_DISC_NONE;
-    disc->file = f;
-    if( filename == NULL ) {
-        disc->name = NULL;
-    } else {
-        disc->name = g_strdup(filename);
-    }
-
-       disc->check_status = gdrom_null_check_status;
-       disc->destroy = gdrom_disc_destroy;
-    return disc;
-}
-
-void gdrom_disc_destroy( gdrom_disc_t disc, gboolean close_fh )
-{
-    int i;
-    FILE *lastfile = NULL;
-    if( disc->file != NULL ) {
-       if( close_fh ) {
-               fclose(disc->file);
-       }
-        disc->file = NULL;
-    }
-    for( i=0; i<disc->track_count; i++ ) {
-        if( disc->track[i].file != NULL && disc->track[i].file != lastfile ) {
-            lastfile = disc->track[i].file;
-            /* Track files (if any) are closed regardless of the value of close_fh */
-            fclose(lastfile);
-            disc->track[i].file = NULL;
-        }
-    }
-    if( disc->name != NULL ) {
-        g_free( (gpointer)disc->name );
-        disc->name = NULL;
-    }
-    if( disc->display_name != NULL ) {
-       g_free( (gpointer)disc->name );
-       disc->display_name = NULL;
-    }
-    free( disc );
-}
-
-/**
- * Construct a new gdrom_disc_t and initalize the vtable to the gdrom image
- * default functions.
- */
-gdrom_disc_t gdrom_image_new( const gchar *filename, FILE *f )
-{
-       gdrom_disc_t disc = gdrom_disc_new( filename, f );
-       if( disc != NULL ) {
-           disc->read_sector = gdrom_image_read_sector;
-           disc->play_audio = NULL; /* not supported yet */
-           disc->run_time_slice = NULL; /* not needed */
-       }
-       return disc;
-}
-
-
-gdrom_disc_t gdrom_image_open( const gchar *inFilename )
-{
-    const gchar *filename = inFilename;
-    const gchar *ext = strrchr(filename, '.');
-    gdrom_disc_t disc = NULL;
-    int fd;
-    FILE *f;
-    int i;
-    gdrom_image_class_t extclz = NULL;
-
-    // Check for a url-style filename.
-    char *lizard_lips = strstr( filename, "://" );
-    if( lizard_lips != NULL ) {
-        gchar *path = lizard_lips + 3;
-        int method_len = (lizard_lips-filename);
-        gchar method[method_len + 1];
-        memcpy( method, filename, method_len );
-        method[method_len] = '\0';
-
-        if( strcasecmp( method, "file" ) == 0 ) {
-            filename = path;
-        } else if( strcasecmp( method, "dvd" ) == 0 ||
-                strcasecmp( method, "cd" ) == 0 ||
-                strcasecmp( method, "cdrom" ) ) {
-            return cdrom_open_device( method, path );
-        } else {
-            ERROR( "Unrecognized URL method '%s' in filename '%s'", method, filename );
-            return NULL;
-        }
-    }
-
-    fd = open( filename, O_RDONLY | O_NONBLOCK );
-    if( fd == -1 ) {
-        return NULL;
-    }
-
-    f = fdopen(fd, "ro");
-
-
-    /* try extensions */
-    if( ext != NULL ) {
-        ext++; /* Skip the '.' */
-        for( i=0; gdrom_image_classes[i] != NULL; i++ ) {
-            if( gdrom_image_classes[i]->extension != NULL &&
-                    strcasecmp( gdrom_image_classes[i]->extension, ext ) == 0 ) {
-                extclz = gdrom_image_classes[i];
-                if( extclz->is_valid_file(f) ) {
-                    disc = extclz->open_image_file(filename, f);
-                    if( disc != NULL )
-                        return disc;
-                }
-                break;
-            }
-        }
-    }
-
-    /* Okay, fall back to magic */
-    gboolean recognized = FALSE;
-    for( i=0; gdrom_image_classes[i] != NULL; i++ ) {
-        if( gdrom_image_classes[i] != extclz &&
-                gdrom_image_classes[i]->is_valid_file(f) ) {
-            recognized = TRUE;
-            disc = gdrom_image_classes[i]->open_image_file(filename, f);
-            if( disc != NULL )
-                return disc;
-        }
-    }
-
-    fclose(f);
-    return NULL;
-}
-
-/**
- * Read a block from an image file, handling negative file offsets
- * with 0-fill.
- */
-static gboolean gdrom_read_block( unsigned char *buf, int file_offset, int length, FILE *f )
-{
-    if( file_offset < 0 ) {
-        int size = -file_offset;
-        if( size >= length ) {
-            memset( buf, 0, length );
-            return TRUE;
-        } else {
-            memset( buf, 0, size );
-            file_offset = 0;
-            length -= size;
-        }
-    }
-    fseek( f, file_offset, SEEK_SET );
-    return fread( buf, length, 1, f ) == 1;
-}
-
-static void gdrom_build_sector_header( unsigned char *buf, uint32_t lba, 
-                                       gdrom_track_mode_t sector_mode )
-{
-    memcpy( buf, gdrom_default_sync, 12 );
-    cd_build_address( buf, sector_mode, lba );
-}
-
-/**
- * Return TRUE if the given read mode + track modes are compatible,
- * otherwise FALSE.
- * @param track_mode one of the GDROM_MODE* constants
- * @param read_mode the READ_CD_MODE from the read request
- */
-static gboolean gdrom_is_compatible_read_mode( int track_mode, int read_mode )
-{
-    switch( read_mode ) {
-    case READ_CD_MODE_ANY:
-        return TRUE;
-    case READ_CD_MODE_CDDA:
-        return track_mode == GDROM_CDDA;
-    case READ_CD_MODE_1:
-        return track_mode == GDROM_MODE1 || track_mode == GDROM_MODE2_FORM1;
-    case READ_CD_MODE_2_FORM_1:
-        return track_mode == GDROM_MODE1 || track_mode == GDROM_MODE2_FORM1;
-    case READ_CD_MODE_2_FORM_2:
-        return track_mode == GDROM_MODE2_FORM2;
-    case READ_CD_MODE_2:
-        return track_mode == GDROM_MODE2_FORMLESS;
-    default:
-        return FALSE;
-    }
-}
-
-void gdrom_set_disc_type( gdrom_disc_t disc ) 
-{
-    int type = IDE_DISC_NONE, i;
-    for( i=0; i<disc->track_count; i++ ) {
-        if( disc->track[i].mode == GDROM_CDDA ) {
-            if( type == IDE_DISC_NONE )
-                type = IDE_DISC_AUDIO;
-        } else if( disc->track[i].mode == GDROM_MODE1 || disc->track[i].mode == GDROM_RAW_NONXA ) {
-            if( type != IDE_DISC_CDROMXA )
-                type = IDE_DISC_CDROM;
-        } else {
-            type = IDE_DISC_CDROMXA;
-            break;
-        }
-    }
-    disc->disc_type = type;
-}
-
-/**
- * Determine the start position in a raw sector, and the amount of data to read
- * in bytes, for a given combination of sector mode and read mode.
- */ 
-static void gdrom_get_read_bounds( int sector_mode, int read_mode, int *start, int *size )
-{
-    if( READ_CD_RAW(read_mode) ) {
-        // whole sector
-        *start = 0;
-        *size = 2352;
-    } else {
-        *size = 0;
-        if( READ_CD_DATA(read_mode) ) {
-            *start = gdrom_data_offset[sector_mode];
-            *size = gdrom_sector_size[sector_mode];
-        }
-
-        if( READ_CD_SUBHEAD(read_mode) && 
-                (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2) ) {
-            *start = SECTOR_HEADER_SIZE;
-            *size += SECTOR_SUBHEADER_SIZE;
-        }
-
-        if( READ_CD_HEADER(read_mode) ) {
-            *size += SECTOR_HEADER_SIZE;
-            *start = 0;
-        }
-
-    }
-}
-
-void gdrom_extract_raw_data_sector( char *sector_data, int channels, unsigned char *buf, uint32_t *length )
-{
-    int sector_mode;
-    int start, size;
-    struct cdrom_sector_header *secthead = (struct cdrom_sector_header *)sector_data;
-    if( secthead->mode == 1 ) {
-        sector_mode = GDROM_MODE1;
-    } else {
-        sector_mode = ((secthead->subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;
-    }
-    gdrom_get_read_bounds( sector_mode, channels, &start, &size );
-    
-    memcpy( buf, sector_data+start, size );
-    *length = size;
-}
-
-/**
- * Default check media status that does nothing and always returns
- * false (unchanged).
- */
-static gboolean gdrom_null_check_status( gdrom_disc_t disc )
-{
-       return FALSE;
-}
-
-/**
- * Read a single sector from a disc image. If you thought this would be simple, 
- * I have just one thing to say to you: Bwahahahahahahahah.
- *
- * Once we've decided that there's a real sector at the requested lba, there's 
- * really two things we need to care about:
- *   1. Is the sector mode compatible with the requested read mode
- *   2. Which parts of the sector do we need to return? 
- *      (header/subhead/data/raw sector)
- *
- * Also note that the disc image may supply us with just the data (most common 
- * case), or may have the full raw sector. In the former case we may need to 
- * generate the missing data on the fly, for which we use libedc to compute the
- * data correction codes.
- */
-static gdrom_error_t gdrom_image_read_sector( gdrom_disc_t disc, uint32_t lba,
-                                              int mode, unsigned char *buf, uint32_t *length )
-{
-    struct cdrom_sector_header secthead;
-    int file_offset, read_len, track_no;
-
-    FILE *f;
-
-    track_no = gdrom_disc_get_track_by_lba( disc, lba );
-    if( track_no == -1 ) {
-        return PKT_ERR_BADREAD;
-    }
-    struct gdrom_track *track = &disc->track[track_no-1];
-    file_offset = track->offset + track->sector_size * (lba - track->lba);
-    read_len = track->sector_size;
-    if( track->file != NULL ) {
-        f = track->file;
-    } else {
-        f = disc->file;
-    }
-
-    /* First figure out what the real sector mode is for raw/semiraw sectors */
-    int sector_mode;
-    switch( track->mode ) {
-    case GDROM_RAW_NONXA:
-        gdrom_read_block( (unsigned char *)(&secthead), file_offset, sizeof(secthead), f );
-        sector_mode = (secthead.mode == 1) ? GDROM_MODE1 : GDROM_MODE2_FORMLESS;
-        break;
-    case GDROM_RAW_XA:
-        gdrom_read_block( (unsigned char *)(&secthead), file_offset, sizeof(secthead), f );
-        if( secthead.mode == 1 ) {
-            sector_mode = GDROM_MODE1;
-        } else {
-            sector_mode = ((secthead.subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;
-        }
-        break;
-    case GDROM_SEMIRAW_MODE2:
-        gdrom_read_block( secthead.subhead, file_offset, 8, f );
-        sector_mode = ((secthead.subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;
-        break;
-    default:
-        /* In the other cases, the track mode completely defines the sector mode */
-        sector_mode = track->mode;
-        break;
-    }
-
-    if( !gdrom_is_compatible_read_mode(sector_mode, READ_CD_MODE(mode)) ) {
-        return PKT_ERR_BADREADMODE;
-    }
-
-    /* Ok, we've got a valid sector, check what parts of the sector we need to
-     * return - header | subhead | data | everything
-     */
-    int channels = READ_CD_CHANNELS(mode);
-
-    if( channels == 0 ) {
-        // legal, if weird
-        *length = 0;
-        return PKT_ERR_OK;
-    } else if( channels == 0xA0 && 
-            (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2 )) {
-        // caller requested a non-contiguous region
-        return PKT_ERR_BADFIELD;
-    } else if( READ_CD_RAW(channels) ) {
-        channels = 0xF0; // implies everything
-    }
-
-    read_len = 0;
-    int start, size;
-    switch( track->mode ) {
-    case GDROM_CDDA:
-        // audio is nice and simple (assume perfect reads for now)
-        *length = 2352;
-        gdrom_read_block( buf, file_offset, track->sector_size, f );
-        return PKT_ERR_OK;
-    case GDROM_RAW_XA:
-    case GDROM_RAW_NONXA:
-        gdrom_get_read_bounds( sector_mode, channels, &start, &size );
-        gdrom_read_block( buf, file_offset+start, size, f );
-        read_len = size;
-        break;
-    case GDROM_SEMIRAW_MODE2:
-        gdrom_get_read_bounds( sector_mode, channels, &start, &size );
-        if( READ_CD_HEADER(channels) ) {
-            gdrom_build_sector_header( buf, lba, sector_mode );
-            read_len += SECTOR_HEADER_SIZE;
-            size -= SECTOR_HEADER_SIZE;
-        } else {
-            start -= SECTOR_HEADER_SIZE;
-        }
-        gdrom_read_block( buf + read_len, file_offset+start, size, f );
-        read_len += size;
-        break;
-    default: // Data track w/ data only in file
-        if( READ_CD_RAW(channels) ) {
-            gdrom_read_block( buf + gdrom_data_offset[track->mode], file_offset, 
-                    track->sector_size, f );
-            do_encode_L2( buf, sector_mode, lba );
-            read_len = 2352;
-        } else {
-            if( READ_CD_HEADER(channels) ) {
-                gdrom_build_sector_header( buf, lba, sector_mode );
-                read_len += SECTOR_HEADER_SIZE;
-            }
-            if( READ_CD_SUBHEAD(channels) && 
-                    (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2) ) {
-                if( sector_mode == GDROM_MODE2_FORM1 ) {
-                    *((uint32_t *)(buf+read_len)) = 0;
-                    *((uint32_t *)(buf+read_len+4)) = 0;
-                } else {
-                    *((uint32_t *)(buf+read_len)) = 0x00200000;
-                    *((uint32_t *)(buf+read_len+4)) = 0x00200000;
-                }
-                read_len += 8;
-            }
-            if( READ_CD_DATA(channels) ) {
-                gdrom_read_block( buf+read_len, file_offset, track->sector_size, f );
-                read_len += track->sector_size;
-            }
-        }
-    }
-    *length = read_len;
-    return PKT_ERR_OK;
-}
-
</pre></div>
<hr /><a name="file44" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/gdrom</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>gdrom.c</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/gdrom.c
+++ lxdream/src/gdrom/gdrom.c
@@ -17,6 +17,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  */
 
 #include <stdio.h>
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include <stdlib.h>
+#include <string.h>
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -24,61 +26,41 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include <netinet/in.h>
 #include "gdrom/ide.h"
 #include "gdrom/gdrom.h"
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#include "gdrom/gddriver.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include "gdrom/packet.h"
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#include "dream.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include "bootstrap.h"
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include "drivers/cdrom/cdrom.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-extern gdrom_disc_t gdrom_disc;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define GDROM_LBA_OFFSET 150
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 DEFINE_HOOK( gdrom_disc_change_hook, gdrom_disc_change_hook_t )
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-static void gdrom_fire_disc_changed( <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >g</span>drom_disc_t disc )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static void gdrom_fire_disc_changed( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >c</span>drom_disc_t disc )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
     CALL_HOOKS( gdrom_disc_change_hook, disc, disc == NULL ? NULL : disc->name );
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-char *gdrom_mode_names[] = { "Mode 0", "Mode 1", "Mode 2", "Mode 2 Form 1", "Mode 2 Form 2", "Audio", 
-        "Mode 2 semiraw", "XA Raw", "Non-XA Raw" };
-uint32_t gdrom_sector_size[] = { 0, 2048, 2336, 2048, 2324, 2352, 2336, 2352, 2352 };
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+gboolean gdrom_disc_read_title( cdrom_disc_t disc, char *title, size_t titlelen );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+struct gdrom_drive {
+    cdrom_disc_t disc;
+    int boot_track;
+    char title[129];
+} gdrom_drive;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_device_t gdrom_device_new( const gchar *name, const gchar *dev_name )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void gdrom_mount_disc( cdrom_disc_t disc )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    struct gdrom_device *dev = g_malloc0( sizeof(struct gdrom_device) );
-    dev->name = g_strdup(name);
-    dev->device_name = g_strdup(dev_name);
-    return dev;
-}
-
-void gdrom_device_destroy( gdrom_device_t dev )
-{
-    if( dev->name != NULL ) {
-        g_free( dev->name );
-        dev->name = NULL;
-    }
-    if( dev->device_name != NULL ) {
-        g_free( dev->device_name );
-        dev->device_name = NULL;
-    }
-    g_free( dev );
-}
-
-void gdrom_mount_disc( gdrom_disc_t disc ) 
-{
-    if( disc != gdrom_disc ) {
-        if( gdrom_disc != NULL ) {
-            gdrom_disc->destroy(gdrom_disc,TRUE);
-        }
-        gdrom_disc = disc;
-        gdrom_disc_read_title( disc );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( disc != gdrom_drive.disc ) {
+        cdrom_disc_unref(gdrom_drive.disc);
+        gdrom_drive.disc = disc;
+        cdrom_disc_ref(disc);
+        gdrom_disc_read_title( disc, gdrom_drive.title, sizeof(gdrom_drive.title) );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         gdrom_fire_disc_changed( disc );
     }
 }
 
 gboolean gdrom_mount_image( const gchar *filename )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    gdrom_disc_t disc = gdrom_image_open(filename);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    cdrom_disc_t disc = cdrom_disc_open(filename, NULL);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( disc != NULL ) {         
         gdrom_mount_disc( disc );
         return TRUE;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -88,61 +70,47 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 void gdrom_unmount_disc( ) 
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    if( gdrom_disc != NULL ) {
-        gdrom_disc->destroy(gdrom_disc, TRUE);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( gdrom_drive.disc != NULL ) {
+        cdrom_disc_unref(gdrom_drive.disc);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         gdrom_fire_disc_changed(NULL);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        gdrom_disc = NULL;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        gdrom_d<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rive.d</span>isc = NULL;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >g</span>drom_disc_t gdrom_get_current_disc()
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >c</span>drom_disc_t gdrom_get_current_disc()
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    return gdrom_disc;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    return gdrom_d<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rive.d</span>isc;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
 const gchar *gdrom_get_current_disc_name()
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    if( gdrom_disc == NULL ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( gdrom_d<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rive.d</span>isc == NULL ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         return NULL;
     } else {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        return gdrom_disc->name;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        return gdrom_d<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rive.d</span>isc->name;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 }
 
 const gchar *gdrom_get_current_disc_title()
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    if( gdrom_disc == NULL || gdrom_disc->title[0] == '\0' ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( gdrom_drive.disc == NULL || gdrom_drive.title[0] == '\0' ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         return NULL;
     } else {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        return gdrom_d<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >isc-></span>title;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        return gdrom_d<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rive.</span>title;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-int gdrom_disc_get_track_by_lba( gdrom_disc_t disc, uint32_t lba )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define CHECK_DISC() do { \
+           if( gdrom_drive.disc == NULL || gdrom_drive.disc->disc_type == CDROM_DISC_NONE ) { return CDROM_ERROR_NODISC; } \
+    } while(0)
+
+cdrom_error_t gdrom_check_media( )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    int i; 
-    for( i=0; i<disc->track_count; i++ ) {
-        if( disc->track[i].lba <= lba && 
-                lba < (disc->track[i].lba + disc->track[i].sector_count) ) {
-            return i+1;
-        }
-    }
-    return -1;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     CHECK_DISC();
+       return CDROM_ERROR_OK;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#define CHECK_DISC(disc) do { \
-           if( disc == NULL ) { return PKT_ERR_NODISC; } \
-           disc->check_status(disc); \
-           if( disc->disc_type == IDE_DISC_NONE ) { return PKT_ERR_NODISC; } \
-    } while(0)
-
-gdrom_error_t gdrom_disc_check_media( gdrom_disc_t disc )
-{
-       CHECK_DISC(disc);
-       return PKT_ERR_OK;
-}
-
-gdrom_error_t gdrom_disc_get_toc( gdrom_disc_t disc, unsigned char *buf ) 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_read_toc( unsigned char *buf )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
        struct gdrom_toc {
            uint32_t track[99];
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -152,68 +120,66 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     struct gdrom_toc *toc = (struct gdrom_toc *)buf;
     int i;
     
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    CHECK_DISC(<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >disc</span>);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    CHECK_DISC();
+    cdrom_disc_t disc = gdrom_drive.disc;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
     for( i=0; i<disc->track_count; i++ ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        toc->track[i] = htonl( disc->track[i].lba ) | disc->track[i].flags;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        toc->track[i] = htonl( disc->track[i].lba<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >+GDROM_LBA_OFFSET</span> ) | disc->track[i].flags;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
     toc->first = 0x0100 | disc->track[0].flags;
     toc->last = (disc->track_count<<8) | disc->track[i-1].flags;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    toc->leadout = htonl(disc->track[i-1].lba + disc->track[i-1].sector_count) |
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    toc->leadout = htonl(disc->leadout+GDROM_LBA_OFFSET) |
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     disc->track[i-1].flags;
     for( ;i<99; i++ )
         toc->track[i] = 0xFFFFFFFF;
     return PKT_ERR_OK;
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_error_t gdrom_disc_get_session_info( gdrom_disc_t disc, int session, unsigned char *buf )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_read_session( int session, unsigned char *buf )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   CHECK_DISC(disc);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    cdrom_lba_t lba;
+       CHECK_DISC();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    struct gdrom_track *last_track = &disc->track[disc->track_count-1];
-    unsigned int end_of_disc = last_track->lba + last_track->sector_count;
-    int i;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     buf[0] = 0x01; /* Disc status? */
     buf[1] = 0;
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( session == 0 ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        buf[2] = last_track->session+1; /* last session */
-        buf[3] = (end_of_disc >> 16) & 0xFF;
-        buf[4] = (end_of_disc >> 8) & 0xFF;
-        buf[5] = end_of_disc & 0xFF;
-        return PKT_ERR_OK;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        buf[2] = gdrom_drive.disc->session_count;
+        lba = gdrom_drive.disc->leadout + GDROM_LBA_OFFSET;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     } else {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        session--;
-        for( i=0; i<disc->track_count; i++ ) {
-            if( disc->track[i].session == session ) {
-                buf[2] = i+1; /* first track of session */
-                buf[3] = (disc->track[i].lba >> 16) & 0xFF;
-                buf[4] = (disc->track[i].lba >> 8) & 0xFF;
-                buf[5] = disc->track[i].lba & 0xFF;
-                return PKT_ERR_OK;
-            }
-        }
-        return PKT_ERR_BADFIELD; /* No such session */
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        cdrom_track_t track = cdrom_disc_get_session( gdrom_drive.disc, session );
+        if( track == NULL )
+            return CDROM_ERROR_BADFIELD;
+
+        buf[2] = track->trackno;
+        lba = track->lba + GDROM_LBA_OFFSET;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    buf[3] = (lba >> 16) & 0xFF;
+    buf[4] = (lba >> 8) & 0xFF;
+    buf[5] = lba & 0xFF;
+    return CDROM_ERROR_OK;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_error_t gdrom_disc_get_short_status( gdrom_disc_t disc, uint32_t lba, unsigned char *buf )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_read_short_status( cdrom_lba_t lba, unsigned char *buf )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   CHECK_DISC(disc);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    cdrom_lba_t real_lba = lba - GDROM_LBA_OFFSET;
+       CHECK_DISC();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    int track_no = gdrom_disc_get_track_by_lba( disc, lba );
-    if( track_no == -1 ) {
-        track_no = 1;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    cdrom_track_t track = cdrom_disc_get_track_by_lba( gdrom_drive.disc, real_lba );
+    if( track == NULL ) {
+        track = cdrom_disc_get_track( gdrom_drive.disc, 1 );
+        if( track == NULL )
+            return CDROM_ERROR_NODISC;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         lba = 150;
     }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    struct gdrom_track *track = &disc->track[track_no-1];
-    uint32_t offset = lba - track->lba;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    uint32_t offset = real_lba - track->lba;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    buf[0] = 0x00;
        buf[1] = 0x15; /* audio status ? */
     buf[2] = 0x00;
     buf[3] = 0x0E;
     buf[4] = track->flags;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    buf[5] = track<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >_</span>no;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    buf[5] = track<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >->track</span>no;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     buf[6] = 0x01; /* ?? */
     buf[7] = (offset >> 16) & 0xFF;
     buf[8] = (offset >> 8) & 0xFF;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -225,53 +191,126 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return PKT_ERR_OK;
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-int gdrom_disc_get_drive_status( gdrom_disc_t disc ) 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+int gdrom_get_drive_status( )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   if( disc == NULL ) {
-               return IDE_DISC_NONE;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     if( gdrom_drive.disc == NULL ) {
+               return CDROM_DISC_NONE;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    }
        
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   disc->check_status(disc);
-    if( disc->disc_type == IDE_DISC_NONE ) {
-        return IDE_DISC_NONE;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( cdrom_disc_check_media(gdrom_drive.disc) == CDROM_DISC_NONE ) {
+        return CDROM_DISC_NONE;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     } else {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        return disc->disc_type | IDE_DISC_READY;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        return <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >gdrom_drive.</span>disc->disc_type | IDE_DISC_READY;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 }
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_play_audio( cdrom_lba_t lba, cdrom_count_t count )
+{
+    CHECK_DISC();
+    if( gdrom_drive.disc->play_audio ) {
+        return gdrom_drive.disc->play_audio( gdrom_drive.disc, lba - GDROM_LBA_OFFSET, count );
+    }
+    return CDROM_ERROR_BADFIELD;
+}
+
+/* Parse CD read */
+#define READ_CD_MODE(x)    ((x)&0x0E)
+#define READ_CD_MODE_ANY   0x00
+#define READ_CD_MODE_CDDA  0x02
+#define READ_CD_MODE_1     0x04
+#define READ_CD_MODE_2     0x06
+#define READ_CD_MODE_2_FORM_1 0x08
+#define READ_CD_MODE_2_FORM_2 0x0A
+
+#define READ_CD_CHANNELS(x) ((x)&0xF0)
+#define READ_CD_HEADER(x)  ((x)&0x80)
+#define READ_CD_SUBHEAD(x) ((x)&0x40)
+#define READ_CD_DATA(x)    ((x)&0x20)
+#define READ_CD_RAW(x)     ((x)&0x10)
+
+
+cdrom_error_t gdrom_read_cd( cdrom_lba_t lba, cdrom_count_t count,
+                             unsigned mode, unsigned char *buf, size_t *length )
+{
+    cdrom_lba_t real_lba = lba - 150;
+    cdrom_read_mode_t real_mode = 0;
+
+    CHECK_DISC();
+
+    /* Translate GDROM read mode into standard MMC read mode */
+    if( READ_CD_RAW(mode) ) {
+        real_mode = CDROM_READ_RAW;
+    } else {
+        if( READ_CD_HEADER(mode) ) {
+            real_mode = CDROM_READ_HEADER|CDROM_READ_SYNC;
+        }
+        if( READ_CD_SUBHEAD(mode) ) {
+            real_mode |= CDROM_READ_SUBHEADER;
+        }
+        if( READ_CD_DATA(mode) ) {
+            real_mode |= CDROM_READ_DATA;
+        }
+    }
+
+    if( READ_CD_MODE(mode) == 0x0C )
+        real_mode |= CDROM_READ_MODE2;
+    else
+        real_mode |= (READ_CD_MODE(mode)<<1);
+
+    return cdrom_disc_read_sectors( gdrom_drive.disc, real_lba, count, real_mode, buf, length );
+}
+
+void gdrom_run_slice( uint32_t nanosecs )
+{
+
+}
+
+
+cdrom_track_t gdrom_disc_get_boot_track( cdrom_disc_t disc ) {
+    int i, boot_track = -1;
+    if( disc != NULL && disc->track_count > 0 ) {
+        int last_session = disc->track[disc->track_count-1].sessionno;
+        if( last_session == 1 )
+            return NULL;
+        for( i=disc->track_count-1; i>=0 && disc->track[i].sessionno == last_session; i-- ) {
+            if( disc->track[i].flags & TRACK_FLAG_DATA ) {
+                boot_track = i;
+            }
+        }
+    }
+    return &disc->track[boot_track];
+}
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
  * Check the disc for a useable DC bootstrap, and update the disc
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * with the title accordingly.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * with the title accordingly. Otherwise set the title to the empty string.
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  * @return TRUE if we found a bootstrap, otherwise FALSE.
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gboolean gdrom_disc_read_title( gdrom_disc_t disc ) {
-    if( disc->track_count > 0 ) {
-        /* Find the first data track of the last session */
-        int last_session = disc->track[disc->track_count-1].session;
-        int i, boot_track = -1;
-        for( i=disc->track_count-1; i>=0 && disc->track[i].session == last_session; i-- ) {
-            if( disc->track[i].flags & TRACK_DATA ) {
-                boot_track = i;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+gboolean gdrom_disc_read_title( cdrom_disc_t disc, char *title, size_t titlelen ) {
+    cdrom_track_t boot_track = gdrom_disc_get_boot_track(disc);
+    int i;
+    if( boot_track != NULL ) {
+        unsigned char boot_sector[CDROM_MAX_SECTOR_SIZE];
+        size_t length = sizeof(boot_sector);
+        if( cdrom_disc_read_sectors( disc, boot_track->lba, 1, CDROM_READ_DATA|CDROM_READ_MODE2_FORM1,
+                boot_sector, &length ) == CDROM_ERROR_OK ) {
+            if( memcmp( boot_sector, "SEGA SEGAKATANA SEGA ENTERPRISES", 32) == 0 ) {
+                /* Got magic */
+                dc_bootstrap_head_t bootstrap = (dc_bootstrap_head_t)boot_sector;
+                for( i=128; i>0; i-- ) {
+                    if( !isspace(bootstrap->product_name[i-1]) )
+                        break;
+                }
+                if( i >= titlelen )
+                    i = (titlelen-1);
+                memcpy( title, bootstrap->product_name, i );
+                title[i] = '\0';
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        }
-        if( boot_track != -1 ) {
-            unsigned char boot_sector[MAX_SECTOR_SIZE];
-            uint32_t length = sizeof(boot_sector);
-            if( disc->read_sector( disc, disc->track[boot_track].lba, 0x28,
-                    boot_sector, &length ) == PKT_ERR_OK ) {
-                if( memcmp( boot_sector, "SEGA SEGAKATANA SEGA ENTERPRISES", 32) == 0 ) {
-                    /* Got magic */
-                    memcpy( disc->title, boot_sector+128, 128 );
-                    for( i=127; i>=0; i-- ) {
-                        if( !isspace(disc->title[i]) ) 
-                            break;
-                    }
-                    disc->title[i+1] = '\0';
-                }
-                bootstrap_dump(boot_sector, FALSE);
-                return TRUE;
-            }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            bootstrap_dump(boot_sector, FALSE);
+            return TRUE;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
     }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    title[0] = '\0';
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return FALSE;
 }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
</pre></div>
<hr /><a name="file45" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/gdrom</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>gdrom.h</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/gdrom.h
+++ lxdream/src/gdrom/gdrom.h
@@ -22,6 +22,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #include "lxdream.h"
 #include "hook.h"
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include "drivers/cdrom/defs.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include <glib/glist.h>
 
 #ifdef __cplusplus
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -32,19 +33,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define GDROM_SESSION_INFO_SIZE 6 /* Size of GDROM session info structure */
 #define GDROM_SHORT_STATUS_SIZE 14 /* Size of GDROM short status structure */
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-typedef uint16_t gdrom_error_t;
-
-
-struct gdrom_device {
-    char *name;  // internal name
-    char *device_name; // Human-readable device name
-};
-
-typedef struct gdrom_device *gdrom_device_t;
-
-typedef struct gdrom_disc *gdrom_disc_t;
-
-typedef gboolean (*gdrom_disc_change_hook_t)( gdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+typedef gboolean (*gdrom_disc_change_hook_t)( cdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > DECLARE_HOOK(gdrom_disc_change_hook, gdrom_disc_change_hook_t);
 
 typedef gboolean (*gdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -53,13 +42,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
  * Open an image file
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_disc_t gdrom_image_open( const gchar *filename );
-
-/**
- * Read image bootstrap info
- */
-gboolean gdrom_image_read_info( gdrom_disc_t d );
-
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_disc_t gdrom_image_open( const gchar *filename );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
  * Shortcut to open and mount an image file
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -67,51 +50,49 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  */
 gboolean gdrom_mount_image( const gchar *filename );
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void gdrom_mount_disc( <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >g</span>drom_disc_t disc );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void gdrom_mount_disc( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >c</span>drom_disc_t disc );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 void gdrom_unmount_disc( void );
 
 gboolean gdrom_is_mounted( void );
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >g</span>drom_disc_t gdrom_get_current_disc();
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >c</span>drom_disc_t gdrom_get_current_disc();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 const gchar *gdrom_get_current_disc_name();
 
 const gchar *gdrom_get_current_disc_title();
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * Find the track (numbered from 1) containing the sector specified by LBA.
- * Note: this function does not check for media change.
- * @return The track number, or -1 if no track contains the sector.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * Find the track which should be checked for the
+ * dreamcast bootstrap - this is the first data track on the last
+ * session (where there are at least 2 sessions). If a boot track
+ * cannot be found, returns NULL.
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-int gdrom_disc_get_track_by_lba( gdrom_disc_t disc, uint32_t lba );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_track_t gdrom_disc_get_boot_track( cdrom_disc_t disc );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /** 
  * Check if the disc contains valid media.
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * @return PKT_ERR_OK if disc is present, otherwise PKT_ERR_NODISC
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_error_t gdrom_disc_check_media( gdrom_disc_t disc ); 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_check_media( );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
  * Retrieve the disc table of contents, and write it into the buffer in the 
  * format expected by the DC.
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * @param disc The disc to read
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  * @param buf Buffer to receive the TOC data, which must be at least
  * GDROM_TOC_SIZE bytes long.
  * @return 0 on success, error code on failure (eg no disc)
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_error_t gdrom_disc_get_toc( gdrom_disc_t disc, unsigned char *buf );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_read_toc( unsigned char *buf );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
  * Retrieve the short (6-byte) session info, and write it into the buffer.
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * @param disc The disc to read
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  * @param session The session to read (numbered from 1), or 0 
  * @param buf Buffer to receive the session data, which must be at least
  * GDROM_SESSION_INFO_SIZE bytes long.
  * @return 0 on success, error code on failure.
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_error_t gdrom_disc_get_session_info( gdrom_disc_t disc, int session, unsigned char *buf );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_read_session( int session, unsigned char *buf );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
  * Generate the position data as returned from a STATUS(1) packet. 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -121,33 +102,31 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  * GDROM_SHORT_STATUS_SIZE bytes long.
  * @return 0 on success, error code on failure.
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_error_t gdrom_disc_get_short_status( gdrom_disc_t disc, uint32_t lba, unsigned char *buf );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+cdrom_error_t gdrom_read_short_status( uint32_t lba, unsigned char *buf );
+
+/**
+ * Read sectors from the current disc.
+ * @param lba Address of first sector to read
+ * @param count Number of sectors to read
+ * @param read_mode GDROM format read-mode
+ * @param buf Buffer to receive read sectors
+ * @param length If not null, will be written with the number of bytes read.
+ * @return 0 on success, otherwise error code.
+ */
+cdrom_error_t gdrom_read_cd( cdrom_lba_t lba, cdrom_count_t count,
+                             unsigned read_mode, unsigned char *buf, size_t *length );
+
+cdrom_error_t gdrom_play_audio( cdrom_lba_t lba, cdrom_count_t count );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
  * Return the 1-byte status code for the disc (combination of IDE_DISC_* flags)
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-int gdrom_disc_get_drive_status( gdrom_disc_t disc );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+int gdrom_get_drive_status( );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * Native CD-ROM API - provided by drivers/cd_*.c
- *
- * A device name is either a system special file (most unixes) or a url of the
- * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system
- * defined string that uniquely identifies a particular device.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * Run GDROM time slice (if any)
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-
-/**
- * Return a list of gdrom_device_t defining all CD/DVD drives in the host system.
- */
-GList *cdrom_get_native_devices();
-
-/**
- * Open a native device given a device name and url method. Eg, for the url dvd://1
- * this function will be invoked with method = "dvd" and name = "1"
- * 
- * @return NULL on failure, otherwise a valid gdrom_disc_t that can be mounted.
- */
-gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *name );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void gdrom_run_slice( uint32_t nanosecs );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #ifdef __cplusplus
 }
</pre></div>
<hr /><a name="file46" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/gdrom</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>ide.c</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/ide.c
+++ lxdream/src/gdrom/ide.c
@@ -28,7 +28,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include "mem.h"
 #include "asic.h"
 #include "gdrom/ide.h"
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#include "gdrom/gd<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >driver</span>.h"
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include "gdrom/gd<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >rom</span>.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include "gdrom/packet.h"
 
 #define MAX_WRITE_BUF 4096
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -49,7 +49,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         NULL, ide_save_state, ide_load_state };
 
 struct ide_registers idereg;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-gdrom_disc_t gdrom_disc = NULL;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 unsigned char data_buffer[MAX_SECTOR_SIZE];
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -160,9 +159,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 static uint32_t ide_run_slice( uint32_t nanosecs )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    if( gdrom_disc != NULL && gdrom_disc->run_time_slice != NULL ) {
-        gdrom_disc->run_time_slice(gdrom_disc, nanosecs);
-    }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    gdrom_run_slice(nanosecs);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return nanosecs;
 }
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -443,21 +440,18 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 uint8_t ide_get_drive_status( void )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    return gdrom_disc_get_drive_status(gdrom_disc);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    return gdrom_get_drive_status();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#define REQUIRE_DISC() if( gdrom_disc == NULL || gdrom_disc->disc_type == IDE_DISC_NONE  ) { ide_set_packet_result( PKT_ERR_NODISC ); return; }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define REQUIRE_DISC() if( gdrom_get_drive_status() == IDE_DISC_NONE ) { ide_set_packet_result( PKT_ERR_NODISC ); return; }
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
  * Read the next sector from the active read, if any
  */
 static void ide_read_next_sector( void )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    uint32_t sector_size;
-    REQUIRE_DISC();
-    gdrom_error_t status = 
-        gdrom_disc->read_sector( gdrom_disc, idereg.current_lba, idereg.current_mode, 
-                data_buffer, &sector_size );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    size_t sector_size;
+    cdrom_error_t status = gdrom_read_cd( idereg.current_lba, 1, idereg.current_mode, data_buffer, &sector_size );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( status != PKT_ERR_OK ) {
         ide_set_packet_result( status );
         idereg.gdrom_sense[5] = (idereg.current_lba >> 16) & 0xFF;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -507,7 +501,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             uint8_t status = ide_get_drive_status();
             /* FIXME: Refactor read_position to avoid this kind of crud */
             unsigned char tmp[16];
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            gdrom_disc_get_short_status( gdrom_disc, idereg.current_lba, tmp );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            gdrom_read_short_status( idereg.current_lba, tmp );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             
             length = cmd[4];
             if( lba+length > GDROM_DRIVE_STATUS_LENGTH )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -559,12 +553,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         ide_start_packet_read( length, 0 );
         break;
     case PKT_CMD_READ_TOC:
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        REQUIRE_DISC();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         length = (cmd[3]<<8) | cmd[4];
         if( length > GDROM_TOC_SIZE )
             length = GDROM_TOC_SIZE;
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        status = gdrom_disc_get_toc( gdrom_disc, data_buffer );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        status = gdrom_read_toc( data_buffer );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         if( status != PKT_ERR_OK ) {
             ide_set_packet_result( status );
         } else {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -572,11 +565,10 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
         break;
     case PKT_CMD_SESSION_INFO:
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        REQUIRE_DISC();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         length = cmd[4];
         if( length > 6 )
             length = 6;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        status = gdrom_disc_get_session_info( gdrom_disc, cmd[2], data_buffer );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        status = gdrom_read_session( cmd[2], data_buffer );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         if( status != PKT_ERR_OK ) {
             ide_set_packet_result( status );
         } else {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -584,8 +576,10 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
         break;
     case PKT_CMD_PLAY_AUDIO:
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        REQUIRE_DISC();
-        ide_set_packet_result( 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        lba = (cmd[2] << 16) | (cmd[3]<<8) | cmd[4];
+        length = ((cmd[8]<<16) | (cmd[9]<<8) | cmd[10]) - lba;
+        status = gdrom_play_audio( lba, length );
+        ide_set_packet_result( status );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         ide_raise_interrupt();
         idereg.status = 0x50;
         break;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -617,7 +611,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             if( length > 14 ) {
                 length = 14;
             }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            gdrom_disc_get_short_status( gdrom_disc, idereg.current_lba, data_buffer );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            gdrom_read_short_status( idereg.current_lba, data_buffer );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             ide_start_packet_read( length, 0 );
             break;
         }
</pre></div>
<hr /><a name="file47" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/gdrom</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>ide.h</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/ide.h
+++ lxdream/src/gdrom/ide.h
@@ -33,6 +33,10 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define GDROM_SENSE_LENGTH 10
 #define GDROM_MODE_LENGTH 32
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define IDE_DISC_READY 0x01 /* ored with above */
+#define IDE_DISC_IDLE  0x02 /* ie spun-down */
+#define IDE_DISC_NONE  0x06 /* No media in drive */
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > struct ide_registers {
     /* IDE interface registers */
     uint8_t status;  /* A05F709C + A05F7018 Read-only */
</pre></div>
<hr /><a name="file48" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span id="removed" class="pathname" style="font-family:monospace; float:right; background-color:#ffdddd;" >lxdream/src/gdrom</span><br />
<div id="removed" class="fileheader" style="margin-bottom:.5em; background-color:#ffdddd;" ><big><b>nrg.c</b></big> <small id="info" style="color: #888888;" >removed after 3f8f4c5b9ef4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/nrg.c
+++ lxdream/src/gdrom/nrg.c
@@ -1,349 +0,0 @@
</small></pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * $Id$
- *
- * Nero (NRG) CD file format. File information stolen shamelessly from
- * libcdio.
- *
- * Copyright (c) 2005 Nathan Keynes.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <glib/gtypes.h>
-#include "gdrom/gddriver.h"
-#include "dream.h"
-
-static gboolean nrg_image_is_valid( FILE *f );
-static gdrom_disc_t nrg_image_open( const gchar *filename, FILE *f );
-
-struct gdrom_image_class nrg_image_class = { "Nero", "nrg", 
-        nrg_image_is_valid, nrg_image_open };
-
-#define NERO_V55_ID  0x4e455235 
-#define NERO_V50_ID  0x4e45524f 
-
-/* Courtesy of libcdio */
-/* 5.0 or earlier */
-#define NERO_ID  0x4e45524f  /* Nero pre 5.5.x */
-#define CUES_ID  0x43554553  /* Nero pre version 5.5.x-6.x */
-#define DAOI_ID  0x44414f49
-#define ETNF_ID  0x45544e46
-#define SINF_ID  0x53494e46  /* Session information */
-#define END_ID  0x454e4421
-/* 5.5+ only */
-#define NER5_ID  0x4e455235  /* Nero version 5.5.x */
-#define CDTX_ID  0x43445458  /* CD TEXT */
-#define CUEX_ID  0x43554558  /* Nero version 5.5.x-6.x */
-#define DAOX_ID  0x44414f58  /* Nero version 5.5.x-6.x */
-#define ETN2_ID  0x45544e32
-#define MTYP_ID  0x4d545950  /* Disc Media type? */
-
-
-union nrg_footer {
-    struct nrg_footer_v50 {
-        uint32_t dummy;
-        uint32_t id;
-        uint32_t offset;
-    } v50;
-    struct nrg_footer_v55 {
-        uint32_t id;
-        uint64_t offset;
-    } v55;
-};
-
-struct nrg_chunk {
-    uint32_t id;
-    uint32_t length;
-};
-
-struct nrg_etnf {
-    uint32_t offset;
-    uint32_t length;
-    uint32_t mode;
-    uint32_t lba;
-    uint32_t padding;
-};
-
-struct nrg_etn2 {
-    uint64_t offset;
-    uint64_t length;
-    uint32_t mode;
-    uint32_t lba;
-    uint64_t padding;
-};
-
-struct nrg_cues {
-    uint8_t type;
-    uint8_t track;
-    uint8_t control;
-    uint8_t pad;
-    uint32_t addr;
-};
-
-struct nrg_daoi {
-    uint32_t length;
-    char mcn[14];
-    uint8_t disc_mode;
-    uint8_t unknown[2]; /* always 01 01? */
-    uint8_t track_count;
-    struct nrg_daoi_track {
-        char unknown[10];
-        uint32_t sector_size __attribute__((packed)); /* Always 0? */
-        uint8_t mode;
-        uint8_t unknown2[3]; /* Always 00 00 01? */
-        uint32_t pregap __attribute__((packed));
-        uint32_t offset __attribute__((packed));
-        uint32_t end __attribute__((packed));
-    } track[0];
-} __attribute__((packed));
-
-struct nrg_daox {
-    uint32_t length;
-    char mcn[14];
-    uint8_t disc_mode;
-    uint8_t unknown[2]; /* always 01 01? */
-    uint8_t track_count;
-    struct nrg_daox_track {
-        char unknown[10];
-        uint32_t sector_size __attribute__((packed)); /* Always 0? */
-        uint8_t mode;
-        uint8_t unknown2[3]; /* Always 00 00 01? */
-        uint64_t pregap __attribute__((packed));
-        uint64_t offset __attribute__((packed));
-        uint64_t end __attribute__((packed));
-    } track[0];
-} __attribute__((packed));
-
-/**
- * Convert an 8-bit BCD number to normal integer form. 
- * Eg, 0x79 => 79
- */
-uint8_t static bcd_to_uint8( uint8_t bcd )
-{
-    return (bcd & 0x0F) + (((bcd & 0xF0)>>4)*10);
-}
-
-
-/**
- * Convert a 32 bit MSF address (BCD coded) to the
- * equivalent LBA form. 
- * Eg, 0x
- */
-uint32_t static msf_to_lba( uint32_t msf )
-{
-    msf = GUINT32_FROM_BE(msf);
-    int f = bcd_to_uint8(msf);
-    int s = bcd_to_uint8(msf>>8);
-    int m = bcd_to_uint8(msf>>16);
-    return (m * 60 + s) * 75 + f;
-
-}
-
-uint32_t static nrg_track_mode( uint8_t mode )
-{
-    switch( mode ) {
-    case 0: return GDROM_MODE1;
-    case 2: return GDROM_MODE2_FORM1;
-    case 3: return GDROM_SEMIRAW_MODE2;
-    case 7: return GDROM_CDDA;
-    default: 
-        ERROR( "Unrecognized track mode %d in Nero image", mode );
-        return -1;
-    }
-}
-
-static gboolean nrg_image_is_valid( FILE *f )
-{
-    union nrg_footer footer;
-
-    fseek( f, -12, SEEK_END );
-    fread( &footer, sizeof(footer), 1, f );
-    if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ||
-            GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {
-        return TRUE;
-    } else {
-        return FALSE;
-    }
-}
-
-static gdrom_disc_t nrg_image_open( const gchar *filename, FILE *f )
-{
-    union nrg_footer footer;
-    struct nrg_chunk chunk;
-    struct nrg_daoi *dao;
-    struct nrg_daox *daox;
-    struct nrg_etnf *etnf;
-    struct nrg_etn2 *etn2;
-    gdrom_disc_t disc;
-    gboolean end = FALSE;
-    uint32_t chunk_id;
-    int session_id = 0;
-    int session_track_id = 0;
-    int track_id = 0;
-    int cue_track_id = 0, cue_track_count = 0;
-    int i, count;
-
-    fseek( f, -12, SEEK_END );
-    fread( &footer, sizeof(footer), 1, f );
-    if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ) {
-        fseek( f, GUINT32_FROM_BE(footer.v50.offset), SEEK_SET );
-    } else if( GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {
-        fseek( f, (uint32_t)GUINT64_FROM_BE(footer.v55.offset), SEEK_SET );
-    } else {
-        /* Not a (recognized) Nero image */
-        return NULL;
-    }
-
-    disc = gdrom_image_new(filename, f);
-    if( disc == NULL ) {
-        ERROR("Unable to allocate memory!");
-        return NULL;
-    }
-
-    do {
-        fread( &chunk, sizeof(chunk), 1, f );
-        chunk.length = GUINT32_FROM_BE(chunk.length);
-        char data[chunk.length];
-        fread( data, chunk.length, 1, f );
-        chunk_id = GUINT32_FROM_BE(chunk.id);
-        switch( chunk_id ) {
-        case CUES_ID:
-        case CUEX_ID:
-            cue_track_id = track_id;
-            cue_track_count = ((chunk.length / sizeof(struct nrg_cues)) >> 1) - 1;
-            track_id += cue_track_count;
-            for( i=0; i<chunk.length; i+= sizeof(struct nrg_cues) ) {
-                struct nrg_cues *cue = (struct nrg_cues *)(data+i);
-                int track = 0;
-                uint32_t lba;
-                if( chunk_id == CUEX_ID ) {
-                    lba = GUINT32_FROM_BE( cue->addr ) + GDROM_PREGAP;
-                } else {
-                    lba = msf_to_lba( cue->addr );
-                }
-                if( cue->track == 0 )
-                    continue; /* Track 0. Leadin? always 0? */
-                if( cue->track == 0xAA ) { /* end of disc */
-                    disc->track[track_id-1].sector_count =
-                        lba - disc->track[track_id-1].lba;
-                } else {
-                    track = bcd_to_uint8(cue->track) - 1;
-                    if( (cue->control & 0x01) == 0 ) { 
-                        /* Pre-gap address. */
-                        if( track != 0 ) {
-                            disc->track[track-1].sector_count = 
-                                lba - disc->track[track-1].lba;
-                        }
-                    } else { /* Track-start address */
-                        disc->track[track].lba = lba;
-                        disc->track[track].flags = cue->type;
-                    }
-                }
-            }
-            break;
-        case DAOI_ID:
-            dao = (struct nrg_daoi *)data;
-            memcpy( disc->mcn, dao->mcn, 13 );
-            disc->mcn[13] = '\0';
-            assert( (dao->track_count - cue_track_id) * 30 + 22 == chunk.length );
-            assert( dao->track_count == track_id );
-            for( i=0; i<(dao->track_count-cue_track_id); i++ ) {
-                disc->track[cue_track_id].sector_size = GUINT32_FROM_BE(dao->track[i].sector_size);
-                disc->track[cue_track_id].offset = GUINT32_FROM_BE(dao->track[i].offset);
-                disc->track[cue_track_id].mode = nrg_track_mode( dao->track[i].mode );
-                disc->track[cue_track_id].sector_count =
-                    (GUINT32_FROM_BE(dao->track[i].end) - GUINT32_FROM_BE(dao->track[i].offset))/
-                    GUINT32_FROM_BE(dao->track[i].sector_size);
-                cue_track_id++;
-            }
-            break;
-        case DAOX_ID:
-            daox = (struct nrg_daox *)data;
-            memcpy( disc->mcn, daox->mcn, 13 );
-            disc->mcn[13] = '\0';
-            assert( (daox->track_count - cue_track_id) * 42 + 22 == chunk.length );
-            assert( daox->track_count == track_id );
-            for( i=0; i<(daox->track_count-cue_track_id); i++ ) {
-                disc->track[cue_track_id].sector_size = GUINT32_FROM_BE(daox->track[i].sector_size);
-                disc->track[cue_track_id].offset = GUINT64_FROM_BE(daox->track[i].offset);
-                disc->track[cue_track_id].mode = nrg_track_mode( daox->track[i].mode );
-                disc->track[cue_track_id].sector_count =
-                    (GUINT64_FROM_BE(daox->track[i].end) - GUINT64_FROM_BE(daox->track[i].offset))/
-                    GUINT32_FROM_BE(daox->track[i].sector_size);
-                cue_track_id++;
-            }
-            break;
-
-        case SINF_ID: 
-            /* Data is a single 32-bit number representing number of tracks in session */
-            i = GUINT32_FROM_BE( *(uint32_t *)data );
-            while( i-- > 0 )
-                disc->track[session_track_id++].session = session_id;
-            session_id++;
-            break;
-        case ETNF_ID:
-            etnf = (struct nrg_etnf *)data;
-            count = chunk.length / sizeof(struct nrg_etnf);
-            for( i=0; i < count; i++, etnf++ ) {
-                disc->track[track_id].offset = GUINT32_FROM_BE(etnf->offset);
-                disc->track[track_id].lba = GUINT32_FROM_BE(etnf->lba) + (i+1)*GDROM_PREGAP;
-                disc->track[track_id].mode = nrg_track_mode( GUINT32_FROM_BE(etnf->mode) );
-                if( disc->track[track_id].mode == -1 ) {
-                    disc->destroy(disc,FALSE);
-                    return NULL;
-                }
-                if( disc->track[track_id].mode == GDROM_CDDA )
-                    disc->track[track_id].flags = 0x01;
-                else
-                    disc->track[track_id].flags = 0x01 | TRACK_DATA;
-                disc->track[track_id].sector_size = GDROM_SECTOR_SIZE(disc->track[track_id].mode);
-                disc->track[track_id].sector_count = GUINT32_FROM_BE(etnf->length) / 
-                disc->track[track_id].sector_size;
-                track_id++;
-            }
-            break;
-        case ETN2_ID:
-            etn2 = (struct nrg_etn2 *)data;
-            count = chunk.length / sizeof(struct nrg_etn2);
-            for( i=0; i < count; i++, etn2++ ) {
-                disc->track[track_id].offset = (uint32_t)GUINT64_FROM_BE(etn2->offset);
-                disc->track[track_id].lba = GUINT32_FROM_BE(etn2->lba) + (i+1)*GDROM_PREGAP;
-                disc->track[track_id].mode = nrg_track_mode( GUINT32_FROM_BE(etn2->mode) );
-                if( disc->track[track_id].mode == -1 ) {
-                    disc->destroy(disc,FALSE);
-                    return NULL;
-                }
-                if( disc->track[track_id].mode == GDROM_CDDA )
-                    disc->track[track_id].flags = 0x01;
-                else
-                    disc->track[track_id].flags = 0x01 | TRACK_DATA;
-                disc->track[track_id].sector_size = GDROM_SECTOR_SIZE(disc->track[track_id].mode);
-                disc->track[track_id].sector_count = (uint32_t)(GUINT64_FROM_BE(etn2->length) / 
-                        disc->track[track_id].sector_size);
-                track_id++;
-            }
-            break;
-
-        case END_ID:
-            end = TRUE;
-            break;
-        }
-    } while( !end );
-    disc->track_count = track_id;
-    gdrom_set_disc_type(disc);
-    return disc;
-}
-
-
-
</pre></div>
<hr /><a name="file49" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/gdrom</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>packet.h</b></big> <small id="info" style="color: #888888;" >3f8f4c5b9ef4 -> d4807997e450</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/gdrom/packet.h
+++ lxdream/src/gdrom/packet.h
@@ -68,6 +68,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define PKT_ERR_BADFIELD  0x2405
 #define PKT_ERR_BADREAD   0x3002
 #define PKT_ERR_BADREADMODE 0x6405  /* Illegal mode for this track */
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define PKT_ERR_READERROR 0x1103    /* Read failed due to uncorrectable error */
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define PKT_ERR_RESET     0x2906
 
 /* Parse CD read */
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>