trunk/src/emu/machine/stvcd.c
| r21153 | r21154 | |
| 2223 | 2223 | |
| 2224 | 2224 | saturn_state::partitionT *saturn_state::cd_filterdata(filterT *flt, int trktype, UINT8 *p_ok) |
| 2225 | 2225 | { |
| 2226 | | int match = 1, keepgoing = 2; |
| 2226 | int match, keepgoing; |
| 2227 | 2227 | partitionT *filterprt = (partitionT *)NULL; |
| 2228 | 2228 | |
| 2229 | 2229 | CDROM_LOG(("cd_filterdata, trktype %d\n", trktype)) |
| 2230 | match = 1; |
| 2231 | keepgoing = 2; |
| 2232 | lastbuf = flt->condtrue; |
| 2230 | 2233 | |
| 2231 | 2234 | // loop on the filters |
| 2232 | 2235 | do |
| r21153 | r21154 | |
| 2238 | 2241 | if ((cd_curfad < flt->fad) || (cd_curfad > (flt->fad + flt->range))) |
| 2239 | 2242 | { |
| 2240 | 2243 | printf("curfad reject %08x %08x %08x %08x\n",cd_curfad,fadstoplay,flt->fad,flt->fad+flt->range); |
| 2241 | | //match = 0; |
| 2242 | | lastbuf = flt->condfalse; |
| 2243 | | flt = &filters[lastbuf]; |
| 2244 | | |
| 2245 | | keepgoing--; |
| 2244 | match = 0; |
| 2245 | //lastbuf = flt->condfalse; |
| 2246 | //flt = &filters[lastbuf]; |
| 2246 | 2247 | } |
| 2247 | 2248 | } |
| 2248 | 2249 | |
| r21153 | r21154 | |
| 2252 | 2253 | { |
| 2253 | 2254 | if (curblock.fnum != flt->fid) |
| 2254 | 2255 | { |
| 2255 | | logerror("fnum reject\n"); |
| 2256 | printf("fnum reject\n"); |
| 2256 | 2257 | match = 0; |
| 2257 | 2258 | } |
| 2258 | 2259 | } |
| r21153 | r21154 | |
| 2261 | 2262 | { |
| 2262 | 2263 | if (curblock.chan != flt->chan) |
| 2263 | 2264 | { |
| 2264 | | logerror("channel number reject\n"); |
| 2265 | printf("channel number reject\n"); |
| 2265 | 2266 | match = 0; |
| 2266 | 2267 | } |
| 2267 | 2268 | } |
| r21153 | r21154 | |
| 2270 | 2271 | { |
| 2271 | 2272 | if((curblock.subm & flt->smmask) != flt->smval) |
| 2272 | 2273 | { |
| 2273 | | logerror("sub mode reject\n"); |
| 2274 | printf("sub mode reject\n"); |
| 2274 | 2275 | match = 0; |
| 2275 | 2276 | } |
| 2276 | 2277 | } |
| r21153 | r21154 | |
| 2279 | 2280 | { |
| 2280 | 2281 | if((curblock.cinf & flt->cimask) != flt->cival) |
| 2281 | 2282 | { |
| 2282 | | logerror("coding information reject\n"); |
| 2283 | printf("coding information reject\n"); |
| 2283 | 2284 | match = 0; |
| 2284 | 2285 | } |
| 2285 | 2286 | } |
| r21153 | r21154 | |
| 2292 | 2293 | |
| 2293 | 2294 | if (match) |
| 2294 | 2295 | { |
| 2295 | | lastbuf = flt->condtrue; |
| 2296 | | filterprt = &partitions[lastbuf]; |
| 2296 | //lastbuf = flt->condtrue; |
| 2297 | //filterprt = &partitions[lastbuf]; |
| 2297 | 2298 | // we're done |
| 2298 | 2299 | keepgoing = 0; |
| 2299 | 2300 | } |
| r21153 | r21154 | |
| 2302 | 2303 | lastbuf = flt->condfalse; |
| 2303 | 2304 | |
| 2304 | 2305 | // reject sector if no match on either connector |
| 2305 | | if ((lastbuf == 0xff) || (keepgoing < 2)) |
| 2306 | if ((lastbuf == 0xff) || (keepgoing == 0)) |
| 2306 | 2307 | { |
| 2307 | 2308 | *p_ok = 0; |
| 2308 | 2309 | return (partitionT *)NULL; |
| r21153 | r21154 | |
| 2310 | 2311 | |
| 2311 | 2312 | // try again using the filter that was on the "false" connector |
| 2312 | 2313 | flt = &filters[lastbuf]; |
| 2314 | match = 1; |
| 2313 | 2315 | |
| 2314 | 2316 | // and exit if we fail |
| 2315 | 2317 | keepgoing--; |
| 2316 | 2318 | } |
| 2317 | 2319 | } while (keepgoing); |
| 2318 | 2320 | |
| 2321 | filterprt = &partitions[lastbuf]; |
| 2322 | |
| 2319 | 2323 | // try to allocate a block |
| 2320 | 2324 | filterprt->blocks[filterprt->numblks] = cd_alloc_block(&filterprt->bnum[filterprt->numblks]); |
| 2321 | 2325 | |