MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / blkdev_fix_prefs

Function blkdev_fix_prefs

src/blkdev.cpp:242–2524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242void blkdev_fix_prefs (struct uae_prefs *p)
243{
244 for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
245 cdscsidevicetype[i] = p->cdslots[i].type;
246 if (p->cdslots[i].inuse == false && p->cdslots[i].name[0] && p->cdslots[i].type != SCSI_UNIT_DISABLED)
247 p->cdslots[i].inuse = true;
248 }
249
250 for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
251 if (cdscsidevicetype[i] != SCSI_UNIT_DEFAULT && (currprefs.scsi == 0 || currprefs.uaescsimode < UAESCSI_SPTI))
252 continue;
253 if (p->cdslots[i].inuse || p->cdslots[i].name[0]) {
254 TCHAR *name = p->cdslots[i].name;
255#ifdef _WIN32
256 if (_tcslen (name) == 3 && name[1] == ':' && name[2] == '\\') {
257#else
258 if (name[0] == '/' && name[1] == 'd' && name[2] == 'e' && name[3] == 'v' && name[4] == '/') {
259#endif
260 if (currprefs.scsi && (currprefs.uaescsimode == UAESCSI_SPTI || currprefs.uaescsimode == UAESCSI_SPTISCAN))
261 cdscsidevicetype[i] = SCSI_UNIT_SPTI;
262 else
263 cdscsidevicetype[i] = SCSI_UNIT_IOCTL;
264 } else {
265 cdscsidevicetype[i] = SCSI_UNIT_IMAGE;
266 }
267 } else if (currprefs.scsi) {
268 if (currprefs.uaescsimode == UAESCSI_CDEMU)
269 cdscsidevicetype[i] = SCSI_UNIT_IOCTL;
270 else
271 cdscsidevicetype[i] = SCSI_UNIT_SPTI;
272 } else {
273 cdscsidevicetype[i] = SCSI_UNIT_IOCTL;
274 }
275 }
276
277}
278
279static bool getsem (int unitnum, bool dowait)
280{
281 struct blkdevstate *st = &state[unitnum];
282 if (st->sema == NULL)
283 uae_sem_init (&st->sema, 0, 1);
284 bool gotit = false;
285 if (dowait) {
286 uae_sem_wait (&st->sema);
287 gotit = true;
288 } else {
289 gotit = uae_sem_trywait (&st->sema) == 0;
290 }
291 if (gotit)
292 st->sema_cnt++;
293 if (st->sema_cnt > 1)
294 write_log (_T("CD: unitsem%d acquire mismatch! cnt=%d\n"), unitnum, st->sema_cnt);
295 return gotit;
296}
297static bool getsem (int unitnum)
298{
299 return getsem (unitnum, false);

Callers 4

sys_command_openFunction · 0.85
device_func_initFunction · 0.85
blkdev_get_infoFunction · 0.85
fixup_prefsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected