Fix an SDL crash, minor tweak to BESS SGB

This commit is contained in:
Lior Halphon 2021-04-17 16:37:55 +03:00
parent 87a2d48675
commit 9fcdc082d2
3 changed files with 13 additions and 4 deletions

View File

@ -1117,6 +1117,9 @@ done:
read_bess_buffer(&sgb.attribute_map, file, (void *)gb->sgb->attribute_map, sizeof(gb->sgb->attribute_map));
read_bess_buffer(&sgb.attribute_files, file, (void *)gb->sgb->attribute_files, sizeof(gb->sgb->attribute_files));
gb->sgb->effective_palettes[12] = gb->sgb->effective_palettes[8] =
gb->sgb->effective_palettes[4] = gb->sgb->effective_palettes[0];
gb->sgb->player_count = sgb.multiplayer_state >> 4;
gb->sgb->current_player = sgb.multiplayer_state & 0xF;
if (gb->sgb->player_count > 4 || gb->sgb->player_count == 3 || gb->sgb->player_count == 0) {

View File

@ -1302,9 +1302,15 @@ void run_gui(bool is_running)
}
case SDL_DROPFILE: {
if (GB_is_stave_state(event.drop.file)) {
if (GB_is_inited(&gb)) {
dropped_state_file = event.drop.file;
pending_command = GB_SDL_LOAD_STATE_FROM_FILE_COMMAND;
}
else {
SDL_free(event.drop.file);
}
break;
}
else {
set_filename(event.drop.file, SDL_free);
pending_command = GB_SDL_NEW_FILE_COMMAND;