| 133 | |
| 134 | |
| 135 | static struct cdtoc *findtoc (struct cdunit *cdu, int *sectorp, bool data) |
| 136 | { |
| 137 | int i; |
| 138 | int sector; |
| 139 | |
| 140 | if (*sectorp < 0) |
| 141 | return NULL; |
| 142 | sector = *sectorp; |
| 143 | for (i = 0; i <= cdu->tracks; i++) { |
| 144 | struct cdtoc *t = &cdu->toc[i]; |
| 145 | if (t->address - t->index1 > sector) { |
| 146 | if (i == 0) { |
| 147 | *sectorp = 0; |
| 148 | return t; |
| 149 | } |
| 150 | t--; |
| 151 | sector -= t->address - t->index1; |
| 152 | if (!data && sector < t->pregap) |
| 153 | return NULL; // pregap silence |
| 154 | *sectorp = sector; |
| 155 | return t; |
| 156 | } |
| 157 | } |
| 158 | return NULL; |
| 159 | } |
| 160 | |
| 161 | static int do_read (struct cdunit *cdu, struct cdtoc *t, uae_u8 *data, int sector, int offset, int size, bool audio) |
| 162 | { |
no outgoing calls
no test coverage detected