# HG changeset patch # User Michael Pavone # Date 1653442272 25200 # Node ID 3f09312685e343bb53d5a06ea8b9d3c141a7b319 # Parent 2ed402b4c1fbaa2f50e84dd90c74bed2702e5a36 Fix loading CD bios from absolute path diff -r 2ed402b4c1fb -r 3f09312685e3 segacd.c --- a/segacd.c Tue May 24 09:11:12 2022 -0700 +++ b/segacd.c Tue May 24 18:31:12 2022 -0700 @@ -1426,7 +1426,21 @@ key = "system\0scd_bios_us\0"; } char *bios_path = tern_find_path_default(config, key, (tern_val){.ptrval = "cdbios.bin"}, TVAL_PTR).ptrval; - cd->rom = (uint16_t *)read_bundled_file(bios_path, &firmware_size); + if (is_absolute_path(bios_path)) { + FILE *f = fopen(bios_path, "rb"); + if (f) { + long to_read = file_size(f); + cd->rom = malloc(to_read); + firmware_size = fread(cd->rom, 1, to_read, f); + if (!firmware_size) { + free(cd->rom); + cd->rom = NULL; + } + fclose(f); + } + } else { + cd->rom = (uint16_t *)read_bundled_file(bios_path, &firmware_size); + } if (!cd->rom) { fatal_error("Failed to load Sega CD BIOS from %s\n", bios_path); }