Leave the SD slot empty when there is no SD image

Without --sd (and no sd.img in the working directory) the emulator still
presented a card: a blank one, which SDMMC1 initialised at SDR104 and
FatFs then found no volume on. A console with nothing in the slot shows
the payload no card at all.

Now the slot starts empty when there is no image: card detect (PZ1)
reads no card and every SDMMC1 command times out, which the existing
[sd] inserted = 0 path already modelled. The config window's SD toggle
can still insert a blank card at runtime.

hwtest, which CI runs without --sd, now reports sd_initialize failing
and the SD as not ready instead of an unformatted 32 GiB card; its
verdict goes from 35 to 34 passes with no failures, and every CI
expectation still holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YYewwDPujjo5B2xRyC5Grb
This commit is contained in:
Claude committed 2026-09-26 10:23:58 +00:00
1 parent 33d16976fe
commit f31175f19a
3 files changed
+16 -3

No files matched your search

+8
View File
@@ -412,6 +412,14 @@ int main(int argc, char *argv[]) {
if (state.sd_fd < 0) perror("[emu] Failed to open SD image");
else printf("[emu] SD image opened: %s\n", sd_path);
}
// No image, no card: the slot starts empty, so card detect (PZ1) reads
// empty and SDMMC1 commands time out, as on a console with no card in.
// This used to present a blank card that FatFs then found no volume on.
// The config window's SD toggle can still insert a blank card.
if (state.sd_fd < 0 && state.sd_inserted.load()) {
state.sd_inserted = false;
printf("[emu] No SD image: the SD slot is empty\n");
}
if (boot0_path) {
state.emmc_boot0_fd = open(boot0_path, O_RDWR | O_BINARY);
if (state.emmc_boot0_fd < 0) perror("[emu] Failed to open BOOT0 image");