diff options
| author | 2024-12-27 11:02:38 -0500 | |
|---|---|---|
| committer | 2024-12-27 11:02:38 -0500 | |
| commit | 4af2d16c06a8a67ab225caa61ccd94df3c572bdc (patch) | |
| tree | 6f5b364ea409c93aa9f0b795f252ac78c7d833f9 /src/cache | |
| parent | 9026e7f49f11e920eac666bd4159ec459b979623 (diff) | |
| download | camu-4af2d16c06a8a67ab225caa61ccd94df3c572bdc.tar.gz camu-4af2d16c06a8a67ab225caa61ccd94df3c572bdc.tar.bz2 camu-4af2d16c06a8a67ab225caa61ccd94df3c572bdc.zip | |
Fix some configurations, add sink loop mode
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/cache')
| -rw-r--r-- | src/cache/handlers/cdio.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cache/handlers/cdio.c b/src/cache/handlers/cdio.c index b10bbf1..ffaaa62 100644 --- a/src/cache/handlers/cdio.c +++ b/src/cache/handlers/cdio.c @@ -14,11 +14,12 @@ static void cdio_log_messages(struct cch_handler_cdio *cdio) { char *error_messages = cdio_cddap_errors(cdio->drive); - char *messages = cdio_cddap_messages(cdio->drive); if (error_messages) { al_log_error("cdio", "\n%s", error_messages); cdio_cddap_free_messages(error_messages); } + + char *messages = cdio_cddap_messages(cdio->drive); if (messages) { al_log_info("cdio", "\n%s", messages); cdio_cddap_free_messages(messages); @@ -34,7 +35,8 @@ static bool handler_cdio_can_seek(struct cch_handler *handler) static nn_thread_result NNWT_THREADCALL cd_read_thread(void *userdata) { struct cch_handler_cdio *cdio = (struct cch_handler_cdio *)userdata; - while (1) { + + for (;;) { if (!al_atomic_load(s32)(&cdio->running, AL_ATOMIC_RELAXED)) { // We don't care about how complete the disc read was. return 0; @@ -72,11 +74,13 @@ static nn_thread_result NNWT_THREADCALL cd_read_thread(void *userdata) break; } } + if (cdio->sector <= cdio->end) { al_log_warn("cdio", "Disc read cut short (sectors: %zd, end: %zd).", cdio->sector, cdio->end); // We didn't read the full disc, disable waiters. cch_threaded_waits_disable_all(&cdio->handler); } + return 0; } @@ -148,9 +152,10 @@ static bool open_cd_drive(struct cch_handler_cdio *cdio) al_log_warn("cdio", "Failed to set drive speed (%d).", ret); } - // Not sure what this is based on, but it can seemingly just be wrong. track_t tracks = cdio_cddap_tracks(drive); - al_log_info("cdio", "CD with %d tracks loaded.", tracks); + track_t first_track = cdio_get_first_track_num(drive->p_cdio); + track_t last_track = cdio_get_last_track_num(drive->p_cdio); + al_log_info("cdio", "CD with %d tracks loaded (%d-%d).", tracks, first_track, last_track); al_array_reserve(cdio->handler.entry->chapters, tracks); lsn_t start = cdio_cddap_disc_firstsector(drive); @@ -196,7 +201,9 @@ struct cch_entry *cch_handler_cdio_create(void) entry->handler->free = handler_cdio_free; entry->handler->entry = entry; al_str_from(&entry->handler->liana, "cdio"); - if (!open_cd_drive(cdio)) return NULL; + if (!open_cd_drive(cdio)) { + return NULL; + } al_atomic_store(s32)(&cdio->running, 0, AL_ATOMIC_RELAXED); nn_buffer_init(&cdio->buffer); nn_buffer_ensure_space(&cdio->buffer, BYTES_PER_STEP); |