BIOS message when missing for SegaCD, searching bios in rom folder

This commit is contained in:
Vincent-FK 2021-04-05 19:27:39 +02:00
parent 6f368f2b09
commit fed75fc8f6
2 changed files with 66 additions and 2 deletions

View File

@ -206,9 +206,11 @@ static const char *find_bios(int *region, const char *cd_fname)
return 0;
}
/** Check Bios files in home directory */
for (i = 0; i < count; i++)
{
emu_make_path(static_buff, files[i], sizeof(static_buff) - 4);
printf("static_buff: %s\n", static_buff);
strcat(static_buff, ".bin");
f = fopen(static_buff, "rb");
if (f) break;
@ -219,14 +221,74 @@ static const char *find_bios(int *region, const char *cd_fname)
if (f) break;
}
if(!f){
/** Check Bios files in rom path */
for (i = 0; i < count; i++)
{
sprintf(static_buff, "%s/%s", mRomPath, files[i]);
printf("static_buff: %s\n", static_buff);
strcat(static_buff, ".bin");
f = fopen(static_buff, "rb");
if (f) break;
static_buff[strlen(static_buff) - 4] = 0;
strcat(static_buff, ".zip");
f = fopen(static_buff, "rb");
if (f) break;
}
}
if (f) {
lprintf("using bios: %s\n", static_buff);
fclose(f);
return static_buff;
} else {
sprintf(static_buff, "no %s BIOS files found, read docs",
*region != 4 ? (*region == 8 ? "EU" : "JAP") : "USA");
char* country;
char** bios_names;
if(*region == 4){ //USA
country = "USA";
bios_names = biosfiles_us;
}
else if(*region == 8){ //EU
country = "EU";
bios_names = biosfiles_eu;
}
else{ //JAP
country = "JAP";
bios_names = biosfiles_jp;
}
sprintf(static_buff, "no %s BIOS files found, read docs", country);
menu_update_msg(static_buff);
/** Set notif for BIOS */
char shell_cmd[400];
sprintf(shell_cmd, "%s 0 \" %s BIOS FILE MISSING^^Connect your FunKey S to ^your computer and copy the^BIOS file to the game folder^^The file can be called:^ - %s.bin^ - %s.bin^ - %s.bin^ - %s.bin^^For more instructions:^www.funkey-project.com^^Press any button to exit...\"",
SHELL_CMD_NOTIF, country, bios_names[0], bios_names[1], bios_names[2], bios_names[3]);
FILE *fp = popen(shell_cmd, "r");
if (fp == NULL) {
printf("In %s, Failed to run command %s\n", __func__, shell_cmd);
}
/** Wait for key press */
SDL_Event event;
while(event.type != SDL_KEYUP && event.type != SDL_QUIT){
while (SDL_PollEvent(&event))
SDL_Delay(60);
}
/** Clear notif for BIOS */
fp = popen(SHELL_CMD_NOTIF_CLEAR, "r");
if (fp == NULL) {
printf("In %s, Failed to run command %s\n", __func__, SHELL_CMD_NOTIF_CLEAR);
}
/** Force clean exit */
//engineState = PGS_Quit;
emu_finish();
plat_finish();
plat_target_finish();
exit(0);
return NULL;
}
}

View File

@ -37,6 +37,7 @@ typedef enum {RESUME_OPTIONS} ENUM_RESUME_OPTIONS;
#define SHELL_CMD_BRIGHTNESS_GET "brightness_get"
#define SHELL_CMD_BRIGHTNESS_SET "brightness_set"
#define SHELL_CMD_NOTIF "notif_set"
#define SHELL_CMD_NOTIF_CLEAR "notif_clear"
#define SHELL_CMD_WRITE_QUICK_LOAD_CMD "write_args_quick_load_file"
#define SHELL_CMD_TURN_AMPLI_ON "start_audio_amp 1"
#define SHELL_CMD_TURN_AMPLI_OFF "start_audio_amp 0"
@ -44,6 +45,7 @@ typedef enum {RESUME_OPTIONS} ENUM_RESUME_OPTIONS;
#define SHELL_CMD_INSTANT_PLAY "instant_play"
#define SHELL_CMD_SHUTDOWN_FUNKEY "shutdown_funkey"
#define MAXPATHLEN 512
extern void SDL_Rotate_270(SDL_Surface * hw_surface, SDL_Surface * virtual_hw_surface);