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

Function open_device

src/blkdev_cdimage.cpp:2440–2468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2438
2439
2440static int open_device (int unitnum, const TCHAR *ident, int flags)
2441{
2442 struct cdunit *cdu = &cdunits[unitnum];
2443 int ret = 0;
2444
2445 if (!cdu->open) {
2446 uae_sem_init (&cdu->sub_sem, 0, 1);
2447 cdu->imgname_out[0] = 0;
2448 cdu->imgname_in[0] = 0;
2449 if (ident) {
2450 _tcscpy(cdu->imgname_in, ident);
2451 cfgfile_resolve_path_out_load(cdu->imgname_in, cdu->imgname_out, MAX_DPATH, PATH_CD);
2452 parse_image(cdu, cdu->imgname_out);
2453 }
2454 cdu->open = true;
2455 cdu->enabled = true;
2456 cdu->cdda_volume[0] = 0x7fff;
2457 cdu->cdda_volume[1] = 0x7fff;
2458 if (cdimage_unpack_thread == 0) {
2459 init_comm_pipe (&unpack_pipe, 10, 1);
2460 uae_start_thread (_T("cdimage_unpack"), cdda_unpack_func, NULL, NULL);
2461 while (cdimage_unpack_thread == 0)
2462 Sleep (10);
2463 }
2464 ret = 1;
2465 }
2466 blkdev_cd_change (unitnum, cdu->imgname_out);
2467 return ret;
2468}
2469
2470static void close_device (int unitnum)
2471{

Callers

nothing calls this directly

Calls 6

uae_sem_initFunction · 0.85
parse_imageFunction · 0.85
init_comm_pipeFunction · 0.85
uae_start_threadFunction · 0.85
blkdev_cd_changeFunction · 0.85

Tested by

no test coverage detected