From 6e090318f1554ff15776e928c04f1ef2da374f0b Mon Sep 17 00:00:00 2001 From: Toni Riikonen Date: Sun, 14 Dec 2025 13:43:42 +0200 Subject: [PATCH] Setting default seek time (10ms) for fdd seeks, as 0ms seek time causes issues on some OS'ses. Also enabled to use seek-times defined for fdd audio profile "None". --- src/floppy/fdd.c | 6 +++++- src/floppy/fdd_audio.c | 4 ++-- src/include/86box/fdd.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 164c0b037..30be0979a 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -365,7 +365,7 @@ void fdd_seek(int drive, int track_diff) { fdd_log("fdd_seek(drive=%d, track_diff=%d)\n", drive, track_diff); - if (!track_diff) + if (track_diff == 0) return; if (fdd_seek_in_progress[drive]) { @@ -411,6 +411,10 @@ fdd_seek(int drive, int track_diff) /* Get seek timings from audio profile configuration with direction awareness */ double seek_time_us = fdd_audio_get_seek_time(drive, actual_track_diff, is_seek_down); + if (seek_time_us < 1) { + seek_time_us = DEFAULT_SEEK_TIME_MS * 1000; + } + fdd_log("Seek timing for drive %d: %.2f µs (%s)\n", drive, seek_time_us, is_seek_down ? "DOWN" : "UP"); uint64_t seek_delay_us = seek_time_us * TIMER_USEC; diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index 5fe5e6358..9bd9aeea6 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -291,7 +291,7 @@ fdd_audio_load_profiles(void) void load_profile_samples(int profile_id) { - if (profile_id <= 0 || profile_id >= audio_profile_count) + if (profile_id < 0 || profile_id >= audio_profile_count) return; fdd_audio_profile_config_t *config = &audio_profiles[profile_id]; @@ -444,7 +444,7 @@ double fdd_audio_get_seek_time(int drive, int track_count, int is_seek_down) { int profile_id = fdd_get_audio_profile(drive); - if (profile_id <= 0 || profile_id >= audio_profile_count) { + if (profile_id < 0 || profile_id >= audio_profile_count) { return 0; } diff --git a/src/include/86box/fdd.h b/src/include/86box/fdd.h index b10c34854..a173279a4 100644 --- a/src/include/86box/fdd.h +++ b/src/include/86box/fdd.h @@ -24,6 +24,7 @@ #define FDD_NUM 4 #define FLOPPY_IMAGE_HISTORY 10 #define SEEK_RECALIBRATE -999 +#define DEFAULT_SEEK_TIME_MS 10.0 #ifdef __cplusplus extern "C" {