diff --git a/libretro/libretro.c b/libretro/libretro.c index 5817399..d6b7494 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -812,50 +812,47 @@ bool retro_load_game(const struct retro_game_info *info) const char *dir; extract_directory(g_rom_dir, info->path, sizeof(g_rom_dir)); - if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) - { -#if defined(_WIN32) && !defined(_XBOX360) - const char slash[] = "\\"; -#elif defined(_WIN32) && defined(_XBOX360) - const char slash[] = "\0"; -#else - const char slash[] = "/"; -#endif - - snprintf(CD_BRAM_EU, sizeof(CD_BRAM_EU), "%s%sscd_E.brm", dir, slash); - snprintf(CD_BRAM_US, sizeof(CD_BRAM_US), "%s%sscd_U.brm", dir, slash); - snprintf(CD_BRAM_JP, sizeof(CD_BRAM_JP), "%s%sscd_J.brm", dir, slash); - snprintf(CD_BIOS_EU, sizeof(CD_BIOS_EU), "%s%sbios_CD_E.bin", dir, slash); - snprintf(CD_BIOS_US, sizeof(CD_BIOS_US), "%s%sbios_CD_U.bin", dir, slash); - snprintf(CD_BIOS_JP, sizeof(CD_BIOS_JP), "%s%sbios_CD_J.bin", dir, slash); - snprintf(MS_BIOS_EU, sizeof(MS_BIOS_EU), "%s%sbios_E.sms", dir, slash); - snprintf(MS_BIOS_US, sizeof(MS_BIOS_US), "%s%sbios_U.sms", dir, slash); - snprintf(MS_BIOS_JP, sizeof(MS_BIOS_JP), "%s%sbios_J.sms", dir, slash); - snprintf(GG_BIOS, sizeof(GG_BIOS), "%s%sbios.gg", dir, slash); - snprintf(SK_ROM, sizeof(SK_ROM), "%s%ssk.bin", dir, slash); - snprintf(SK_UPMEM, sizeof(SK_UPMEM), "%s%ssk2chip.bin", dir, slash); - snprintf(GG_ROM, sizeof(GG_ROM), "%s%sggenie.bin", dir, slash); - snprintf(AR_ROM, sizeof(AR_ROM), "%s%sareplay.bin", dir, slash); - fprintf(stderr, "Sega CD EU BRAM should be located at: %s\n", CD_BRAM_EU); - fprintf(stderr, "Sega CD US BRAM should be located at: %s\n", CD_BRAM_US); - fprintf(stderr, "Sega CD JP BRAM should be located at: %s\n", CD_BRAM_JP); - fprintf(stderr, "Sega CD EU BIOS should be located at: %s\n", CD_BIOS_EU); - fprintf(stderr, "Sega CD US BIOS should be located at: %s\n", CD_BIOS_US); - fprintf(stderr, "Sega CD JP BIOS should be located at: %s\n", CD_BIOS_JP); - fprintf(stderr, "Master System EU BIOS should be located at: %s\n", MS_BIOS_EU); - fprintf(stderr, "Master System US BIOS should be located at: %s\n", MS_BIOS_US); - fprintf(stderr, "Master System JP BIOS should be located at: %s\n", MS_BIOS_JP); - fprintf(stderr, "Game Gear BIOS should be located at: %s\n", GG_BIOS); - fprintf(stderr, "S&K upmem ROM should be located at: %s\n", SK_UPMEM); - fprintf(stderr, "S&K ROM should be located at: %s\n", SK_ROM); - fprintf(stderr, "Game Genie ROM should be located at: %s\n", GG_ROM); - fprintf(stderr, "Action Replay ROM should be located at: %s\n", AR_ROM); - } - else + if (!environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) || !dir) { fprintf(stderr, "[genplus]: Defaulting system directory to %s.\n", g_rom_dir); dir = g_rom_dir; } +#if defined(_WIN32) && !defined(_XBOX360) + const char slash[] = "\\"; +#elif defined(_WIN32) && defined(_XBOX360) + const char slash[] = ""; +#else + const char slash[] = "/"; +#endif + + snprintf(CD_BRAM_EU, sizeof(CD_BRAM_EU), "%s%sscd_E.brm", dir, slash); + snprintf(CD_BRAM_US, sizeof(CD_BRAM_US), "%s%sscd_U.brm", dir, slash); + snprintf(CD_BRAM_JP, sizeof(CD_BRAM_JP), "%s%sscd_J.brm", dir, slash); + snprintf(CD_BIOS_EU, sizeof(CD_BIOS_EU), "%s%sbios_CD_E.bin", dir, slash); + snprintf(CD_BIOS_US, sizeof(CD_BIOS_US), "%s%sbios_CD_U.bin", dir, slash); + snprintf(CD_BIOS_JP, sizeof(CD_BIOS_JP), "%s%sbios_CD_J.bin", dir, slash); + snprintf(MS_BIOS_EU, sizeof(MS_BIOS_EU), "%s%sbios_E.sms", dir, slash); + snprintf(MS_BIOS_US, sizeof(MS_BIOS_US), "%s%sbios_U.sms", dir, slash); + snprintf(MS_BIOS_JP, sizeof(MS_BIOS_JP), "%s%sbios_J.sms", dir, slash); + snprintf(GG_BIOS, sizeof(GG_BIOS), "%s%sbios.gg", dir, slash); + snprintf(SK_ROM, sizeof(SK_ROM), "%s%ssk.bin", dir, slash); + snprintf(SK_UPMEM, sizeof(SK_UPMEM), "%s%ssk2chip.bin", dir, slash); + snprintf(GG_ROM, sizeof(GG_ROM), "%s%sggenie.bin", dir, slash); + snprintf(AR_ROM, sizeof(AR_ROM), "%s%sareplay.bin", dir, slash); + fprintf(stderr, "Sega CD EU BRAM should be located at: %s\n", CD_BRAM_EU); + fprintf(stderr, "Sega CD US BRAM should be located at: %s\n", CD_BRAM_US); + fprintf(stderr, "Sega CD JP BRAM should be located at: %s\n", CD_BRAM_JP); + fprintf(stderr, "Sega CD EU BIOS should be located at: %s\n", CD_BIOS_EU); + fprintf(stderr, "Sega CD US BIOS should be located at: %s\n", CD_BIOS_US); + fprintf(stderr, "Sega CD JP BIOS should be located at: %s\n", CD_BIOS_JP); + fprintf(stderr, "Master System EU BIOS should be located at: %s\n", MS_BIOS_EU); + fprintf(stderr, "Master System US BIOS should be located at: %s\n", MS_BIOS_US); + fprintf(stderr, "Master System JP BIOS should be located at: %s\n", MS_BIOS_JP); + fprintf(stderr, "Game Gear BIOS should be located at: %s\n", GG_BIOS); + fprintf(stderr, "S&K upmem ROM should be located at: %s\n", SK_UPMEM); + fprintf(stderr, "S&K ROM should be located at: %s\n", SK_ROM); + fprintf(stderr, "Game Genie ROM should be located at: %s\n", GG_ROM); + fprintf(stderr, "Action Replay ROM should be located at: %s\n", AR_ROM); snprintf(DEFAULT_PATH, sizeof(DEFAULT_PATH), g_rom_dir); #ifdef _XBOX