diff --git a/cheevos.c b/cheevos.c index f74c1dfddc..d13a0b13f0 100644 --- a/cheevos.c +++ b/cheevos.c @@ -1845,9 +1845,9 @@ static unsigned cheevos_find_game_id_nes( return 0; if (header.rom_size) - rom_size = cheevos_next_power_of_2(header.rom_size) * 16384; + rom_size = cheevos_next_power_of_2(header.rom_size); else - rom_size = 4194304; + rom_size = 256; if (info->data) { @@ -1862,33 +1862,51 @@ static unsigned cheevos_find_game_id_nes( else { RFILE *file = retro_fopen(info->path, RFILE_MODE_READ, 0); + uint8_t * data = (uint8_t *) malloc(rom_size << 14); - if (!file) + if (!file || !data) return 0; + + /* from fceu core - need it for a correctly md5 sum */ + memset(data, 0xFF, rom_size << 14); + + /* from fceu core - compute size using the cart mapper */ + int MapperNo = (header.rom_type >> 4); + MapperNo |= (header.rom_type2 & 0xF0); + + int not_power2[] = + { + 53, 198, 228 + }; + + bool round = true; + for (int i = 0; i != sizeof(not_power2) / sizeof(not_power2[0]); ++i) { + //for games not to the power of 2, so we just read enough + //prg rom from it, but we have to keep ROM_size to the power of 2 + //since PRGCartMapping wants ROM_size to be to the power of 2 + //so instead if not to power of 2, we just use head.ROM_size when + //we use FCEU_read + if (not_power2[i] == MapperNo) { + round = false; + break; + } + } MD5_Init(&ctx); retro_fseek(file, sizeof(header), SEEK_SET); - - for (;;) - { - uint8_t buffer[4096]; - ssize_t num_read = retro_fread(file, - (void*)buffer, sizeof(buffer)); - - if (num_read <= 0) - break; - - if (num_read >= (ssize_t)rom_size) - { - MD5_Update(&ctx, (void*)buffer, rom_size); - break; - } - - MD5_Update(&ctx, (void*)buffer, num_read); - rom_size -= num_read; - } - + /* from fceu core - check if Trainer included in ROM data */ + if (header.rom_type & 4) + retro_fseek(file, sizeof(header), SEEK_CUR); + + unsigned bytes = (round) ? rom_size : header.rom_size; + ssize_t num_read = retro_fread(file, (void*) data, 0x4000 * bytes ); retro_fclose(file); + + if (num_read <= 0) + return 0; + + MD5_Update(&ctx, (void*) data, rom_size << 14); + MD5_Final(hash, &ctx); } to = timeout; diff --git a/config.def.h b/config.def.h index 8195c17f48..c75cd1f59f 100644 --- a/config.def.h +++ b/config.def.h @@ -581,6 +581,9 @@ static const bool post_filter_record = false; /* Screenshots post-shaded GPU output if available. */ static const bool gpu_screenshot = true; +/* Screenshots named automatically. */ +static const bool auto_screenshot_filename = true; + /* Record post-shaded GPU output instead of raw game footage if available. */ static const bool gpu_record = false; diff --git a/configuration.c b/configuration.c index 5f75be3b67..7a2cdf8084 100644 --- a/configuration.c +++ b/configuration.c @@ -553,6 +553,7 @@ static void config_set_defaults(void) settings->video.post_filter_record = post_filter_record; settings->video.gpu_record = gpu_record; settings->video.gpu_screenshot = gpu_screenshot; + settings->auto_screenshot_filename = auto_screenshot_filename; settings->video.rotation = ORIENTATION_NORMAL; settings->audio.enable = audio_enable; @@ -905,7 +906,7 @@ static void config_set_defaults(void) rarch_ctl(RARCH_CTL_SET_BLOCK_CONFIG_READ, NULL); else rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL); - + first_initialized = false; } @@ -1569,6 +1570,7 @@ static bool config_load_file(const char *path, bool set_defaults) *settings->screenshot_directory = '\0'; } } + CONFIG_GET_BOOL_BASE(conf, settings, auto_screenshot_filename, "auto_screenshot_filename"); config_get_path(conf, "resampler_directory", settings->resampler_directory, sizeof(settings->resampler_directory)); @@ -1722,7 +1724,7 @@ static bool config_load_file(const char *path, bool set_defaults) config_get_bool(conf, tmp, &settings->network_remote_enable_user[i]); } CONFIG_GET_INT_BASE(conf, settings, network_remote_base_port, "network_remote_base_port"); - + #endif CONFIG_GET_BOOL_BASE(conf, settings, debug_panel_enable, "debug_panel_enable"); @@ -1944,7 +1946,7 @@ bool config_load_override(void) global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); rarch_system_info_t *system = NULL; - + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); if (system) @@ -2121,7 +2123,7 @@ bool config_load_remap(void) global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); rarch_system_info_t *system = NULL; - + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); if (system) @@ -2648,6 +2650,8 @@ bool config_save_file(const char *path) config_set_path(conf, "screenshot_directory", *settings->screenshot_directory ? settings->screenshot_directory : "default"); + config_set_bool(conf, "auto_screenshot_filename", + settings->auto_screenshot_filename); config_set_int(conf, "aspect_ratio_index", settings->video.aspect_ratio_idx); config_set_string(conf, "audio_device", settings->audio.device); config_set_string(conf, "video_filter", settings->video.softfilter_plugin); diff --git a/configuration.h b/configuration.h index a8f48a941e..bdf9b5b5c8 100644 --- a/configuration.h +++ b/configuration.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2016 - Daniel De Matteis - * + * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -336,6 +336,8 @@ typedef struct settings char screenshot_directory[PATH_MAX_LENGTH]; char system_directory[PATH_MAX_LENGTH]; + bool auto_screenshot_filename; + char cache_directory[PATH_MAX_LENGTH]; char playlist_directory[PATH_MAX_LENGTH]; diff --git a/ctr/Makefile.cores b/ctr/Makefile.cores index c8ead8fb16..fb820a6b72 100644 --- a/ctr/Makefile.cores +++ b/ctr/Makefile.cores @@ -67,7 +67,7 @@ else ifeq ($(LIBRETRO), catsfc) APP_PRODUCT_CODE = RARCH-CATSFC APP_UNIQUE_ID = 0xBAC07 APP_ICON = ctr/assets/catsfc.png - #APP_BANNER = ctr/assets/libretro_banner.png + APP_BANNER = ctr/assets/catsfc_banner.png #APP_AUDIO = ctr/assets/silent.wav else ifeq ($(LIBRETRO), mednafen_wswan) @@ -117,7 +117,7 @@ else ifeq ($(LIBRETRO), picodrive) APP_PRODUCT_CODE = RARCH-PICODRIVE APP_UNIQUE_ID = 0xBAC0C APP_ICON = ctr/assets/picodrive.png - #APP_BANNER = ctr/assets/libretro_banner.png + APP_BANNER = ctr/assets/picodrive_banner.png #APP_AUDIO = ctr/assets/silent.wav else ifeq ($(LIBRETRO), snes9x_next) @@ -262,6 +262,16 @@ else ifeq ($(LIBRETRO), pocketsnes) APP_PRODUCT_CODE = RARCH-POCKETSNES APP_UNIQUE_ID = 0xBAC1A APP_ICON = ctr/assets/pocketsnes.png + APP_BANNER = ctr/assets/pocketsnes_banner.png + #APP_AUDIO = ctr/assets/silent.wav + +else ifeq ($(LIBRETRO), dosbox) + APP_TITLE = DosBox + #APP_DESCRIPTION = Retroarch 3DS + APP_AUTHOR = various + APP_PRODUCT_CODE = RARCH-DOSBOX + APP_UNIQUE_ID = 0xBAC1B + APP_ICON = ctr/assets/dosbox.png #APP_BANNER = ctr/assets/libretro_banner.png #APP_AUDIO = ctr/assets/silent.wav diff --git a/ctr/assets/catsfc.png b/ctr/assets/catsfc.png index 071967f690..45ef0df5c5 100644 Binary files a/ctr/assets/catsfc.png and b/ctr/assets/catsfc.png differ diff --git a/ctr/assets/catsfc_banner.png b/ctr/assets/catsfc_banner.png new file mode 100644 index 0000000000..e401682d80 Binary files /dev/null and b/ctr/assets/catsfc_banner.png differ diff --git a/ctr/assets/dosbox.png b/ctr/assets/dosbox.png new file mode 100644 index 0000000000..32635ec6dc Binary files /dev/null and b/ctr/assets/dosbox.png differ diff --git a/ctr/assets/picodrive.png b/ctr/assets/picodrive.png index 80252b6224..7be942ce4c 100644 Binary files a/ctr/assets/picodrive.png and b/ctr/assets/picodrive.png differ diff --git a/ctr/assets/picodrive_banner.png b/ctr/assets/picodrive_banner.png new file mode 100644 index 0000000000..fcbf6ff79e Binary files /dev/null and b/ctr/assets/picodrive_banner.png differ diff --git a/ctr/assets/pocketsnes.png b/ctr/assets/pocketsnes.png index 6be406107c..49e30b079f 100644 Binary files a/ctr/assets/pocketsnes.png and b/ctr/assets/pocketsnes.png differ diff --git a/ctr/assets/pocketsnes_banner.png b/ctr/assets/pocketsnes_banner.png new file mode 100644 index 0000000000..d462953b78 Binary files /dev/null and b/ctr/assets/pocketsnes_banner.png differ diff --git a/gfx/drivers_context/android_ctx.c b/gfx/drivers_context/android_ctx.c index c0bf9cca0e..9c444b676d 100644 --- a/gfx/drivers_context/android_ctx.c +++ b/gfx/drivers_context/android_ctx.c @@ -414,8 +414,11 @@ static bool android_gfx_ctx_get_metrics(void *data, { dpi_get_density(density, sizeof(density)); if (string_is_empty(density)) - return false; + goto dpi_fallback; dpi = atoi(density); + + if (dpi <= 0) + goto dpi_fallback; } *value = (float)dpi; break; @@ -426,6 +429,13 @@ static bool android_gfx_ctx_get_metrics(void *data, } return true; + +dpi_fallback: + /* add a fallback in case the device doesn't report DPI. + * Hopefully fixes issues with the moto G2. */ + dpi = 90; + *value = (float)dpi; + return true; } static void android_gfx_ctx_swap_buffers(void *data) diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index 370a570e17..8e180bbdae 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -94,6 +94,16 @@ error: return NULL; } +static void gfx_ctx_vivante_get_video_size(void *data, + unsigned *width, unsigned *height) +{ + vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data; + +#ifdef HAVE_EGL + egl_get_video_size(&viv->egl, width, height); +#endif +} + static void gfx_ctx_vivante_check_window(void *data, bool *quit, bool *resize, unsigned *width, unsigned *height, unsigned frame_count) { @@ -251,16 +261,6 @@ static void gfx_ctx_vivante_swap_buffers(void *data) #endif } -static void gfx_ctx_vivante_get_video_size(void *data, - unsigned *width, unsigned *height) -{ - vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data; - -#ifdef HAVE_EGL - egl_get_video_size(&viv->egl, width, height); -#endif -} - const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = { gfx_ctx_vivante_init, gfx_ctx_vivante_destroy, diff --git a/libretro_version_1.c b/libretro_version_1.c index 8ad328f089..a82230757f 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -323,7 +323,8 @@ bool core_ctl(enum core_ctl_state state, void *data) core_input_polled = false; break; } - core.retro_run(); + if (core.retro_run) + core.retro_run(); if (core_poll_type == POLL_TYPE_LATE && !core_input_polled) { input_poll(); diff --git a/retroarch.c b/retroarch.c index 2a6b9747a2..4dec592c1c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -386,11 +386,18 @@ static void set_special_paths(char **argv, unsigned num_content) const char *rarch_get_current_savefile_dir(void) { + global_t *global = global_get_ptr(); + + char* ret = strdup(global->name.base); + if (!string_is_empty(current_savefile_dir)) + ret = current_savefile_dir; + else + path_basedir(ret); + RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n", - current_savefile_dir); - if (*current_savefile_dir) - return current_savefile_dir; - return NULL; + ret); + + return ret; } static void set_paths_redirect(const char *path) @@ -401,7 +408,7 @@ static void set_paths_redirect(const char *path) global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); rarch_system_info_t *info = NULL; - + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info); if (!global) { @@ -410,10 +417,10 @@ static void set_paths_redirect(const char *path) } if (info->info.library_name && !string_is_empty(info->info.library_name)) - global_library_name_hash = + global_library_name_hash = msg_hash_calculate(info->info.library_name); - /* Initialize current save directories + /* Initialize current save directories * with the values from the config. */ strlcpy(current_savefile_dir, global->dir.savefile, @@ -431,7 +438,7 @@ static void set_paths_redirect(const char *path) if (check_global_library_name_hash) { /* per-core saves: append the library_name to the save location */ - if (settings->sort_savefiles_enable + if (settings->sort_savefiles_enable && !string_is_empty(global->dir.savefile)) { fill_pathname_join( @@ -442,7 +449,7 @@ static void set_paths_redirect(const char *path) /* If path doesn't exist, try to create it, * if everything fails revert to the original path. */ - if(!path_is_directory(current_savefile_dir) + if(!path_is_directory(current_savefile_dir) && !string_is_empty(current_savefile_dir)) { path_mkdir(current_savefile_dir); @@ -459,7 +466,7 @@ static void set_paths_redirect(const char *path) } /* per-core states: append the library_name to the save location */ - if (settings->sort_savestates_enable + if (settings->sort_savestates_enable && !string_is_empty(global->dir.savestate)) { fill_pathname_join( @@ -470,7 +477,7 @@ static void set_paths_redirect(const char *path) /* If path doesn't exist, try to create it. * If everything fails, revert to the original path. */ - if(!path_is_directory(current_savestate_dir) && + if(!path_is_directory(current_savestate_dir) && !string_is_empty(current_savestate_dir)) { path_mkdir(current_savestate_dir); @@ -682,7 +689,7 @@ static void parse_input(int argc, char *argv[]) /* Make sure we can call parse_input several times ... */ optind = 0; - optstring = "hs:fvS:A:c:U:DN:d:" + optstring = "hs:fvS:A:c:U:DN:d:" BSV_MOVIE_ARG NETPLAY_ARG DYNAMIC_ARG FFMPEG_RECORD_ARG; for (;;) @@ -1018,7 +1025,7 @@ static void rarch_init_savefile_paths(void) { global_t *global = global_get_ptr(); rarch_system_info_t *system = NULL; - + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); event_cmd_ctl(EVENT_CMD_SAVEFILES_DEINIT, NULL); @@ -1418,7 +1425,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) } break; case RARCH_CTL_SET_SRAM_ENABLE: - global->sram.use = rarch_ctl(RARCH_CTL_IS_PLAIN_CORE, NULL) + global->sram.use = rarch_ctl(RARCH_CTL_IS_PLAIN_CORE, NULL) && !content_ctl(CONTENT_CTL_DOES_NOT_NEED_CONTENT, NULL); break; case RARCH_CTL_SET_ERROR_ON_INIT: @@ -1635,7 +1642,7 @@ int rarch_info_get_capabilities(enum rarch_capabilities type, void retro_fail(int error_code, const char *error) { /* We cannot longjmp unless we're in rarch_main_init(). - * If not, something went very wrong, and we should + * If not, something went very wrong, and we should * just exit right away. */ retro_assert(rarch_ctl(RARCH_CTL_IS_ERROR_ON_INIT, NULL)); diff --git a/runloop.c b/runloop.c index 63d9117fc9..d57dd49136 100644 --- a/runloop.c +++ b/runloop.c @@ -415,9 +415,10 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) static struct retro_frame_time_callback runloop_frame_time; static retro_keyboard_event_t runloop_key_event = NULL; static retro_keyboard_event_t runloop_frontend_key_event = NULL; + static retro_usec_t runloop_frame_time_last = 0; static unsigned runloop_max_frames = false; static bool runloop_force_nonblock = false; - static bool runloop_frame_time_last = false; + static bool runloop_frame_time_last_enable = false; static bool runloop_set_frame_limit = false; static bool runloop_paused = false; static bool runloop_idle = false; @@ -508,10 +509,13 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) return runloop_max_frames && (*frame_count >= runloop_max_frames); } case RUNLOOP_CTL_SET_FRAME_TIME_LAST: - runloop_frame_time_last = true; + runloop_frame_time_last_enable = true; break; case RUNLOOP_CTL_UNSET_FRAME_TIME_LAST: - runloop_frame_time_last = false; + if (!runloop_ctl(RUNLOOP_CTL_IS_FRAME_TIME_LAST, NULL)) + return false; + runloop_frame_time_last = 0; + runloop_frame_time_last_enable = false; break; case RUNLOOP_CTL_SET_OVERRIDES_ACTIVE: runloop_overrides_active = true; @@ -530,7 +534,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) case RUNLOOP_CTL_IS_GAME_OPTIONS_ACTIVE: return runloop_game_options_active; case RUNLOOP_CTL_IS_FRAME_TIME_LAST: - return runloop_frame_time_last; + return runloop_frame_time_last_enable; case RUNLOOP_CTL_SET_FRAME_LIMIT: runloop_set_frame_limit = true; break; @@ -578,13 +582,33 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) runloop_frame_time = *info; } break; - case RUNLOOP_CTL_GET_FRAME_TIME: + case RUNLOOP_CTL_FRAME_TIME: + if (!runloop_frame_time.callback) + return false; + { - struct retro_frame_time_callback **frame_time = - (struct retro_frame_time_callback**)data; - if (!frame_time) - return false; - *frame_time = (struct retro_frame_time_callback*)&runloop_frame_time; + /* Updates frame timing if frame timing callback is in use by the core. + * Limits frame time if fast forward ratio throttle is enabled. */ + + retro_time_t current = retro_get_time_usec(); + retro_time_t delta = current - runloop_frame_time_last; + bool is_locked_fps = (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || + input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)) | + !!recording_driver_get_data_ptr(); + + + if (!runloop_frame_time_last || is_locked_fps) + delta = runloop_frame_time.reference; + + if (!is_locked_fps && runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)) + delta /= settings->slowmotion_ratio; + + runloop_frame_time_last = current; + + if (is_locked_fps) + runloop_frame_time_last = 0; + + runloop_frame_time.callback(delta); } break; case RUNLOOP_CTL_GET_WINDOWED_SCALE: @@ -848,14 +872,15 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) bsv_movie_ctl(BSV_MOVIE_CTL_UNSET_PLAYBACK, NULL); break; case RUNLOOP_CTL_STATE_FREE: - runloop_perfcnt_enable = false; - runloop_idle = false; - runloop_paused = false; - runloop_slowmotion = false; - runloop_frame_time_last = false; - runloop_set_frame_limit = false; - runloop_overrides_active = false; - runloop_max_frames = 0; + runloop_perfcnt_enable = false; + runloop_idle = false; + runloop_paused = false; + runloop_slowmotion = false; + runloop_frame_time_last_enable = false; + runloop_set_frame_limit = false; + runloop_overrides_active = false; + runloop_frame_time_last = 0; + runloop_max_frames = 0; break; case RUNLOOP_CTL_GLOBAL_FREE: { @@ -995,6 +1020,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) } break; case RUNLOOP_CTL_PREPARE_DUMMY: + memset(&runloop_frame_time, 0, sizeof(struct retro_frame_time_callback)); #ifdef HAVE_MENU menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL); #endif @@ -1250,9 +1276,7 @@ int runloop_iterate(unsigned *sleep_ms) unsigned i; event_cmd_state_t cmd; retro_time_t current, target, to_sleep_ms; - struct retro_frame_time_callback *frame_time = NULL; event_cmd_state_t *cmd_ptr = &cmd; - static retro_usec_t frame_time_last = 0; static retro_time_t frame_limit_minimum_time = 0.0; static retro_time_t frame_limit_last_time = 0.0; static retro_input_t last_input = 0; @@ -1262,12 +1286,7 @@ int runloop_iterate(unsigned *sleep_ms) cmd.state[0] = input_keys_pressed(); last_input = cmd.state[0]; - - if (runloop_ctl(RUNLOOP_CTL_IS_FRAME_TIME_LAST, NULL)) - { - frame_time_last = 0; - runloop_ctl(RUNLOOP_CTL_UNSET_FRAME_TIME_LAST, NULL); - } + runloop_ctl(RUNLOOP_CTL_UNSET_FRAME_TIME_LAST, NULL); if (runloop_ctl(RUNLOOP_CTL_SHOULD_SET_FRAME_LIMIT, NULL)) { @@ -1299,33 +1318,7 @@ int runloop_iterate(unsigned *sleep_ms) } } - runloop_ctl(RUNLOOP_CTL_GET_FRAME_TIME, &frame_time); - - if (frame_time->callback) - { - /* Updates frame timing if frame timing callback is in use by the core. - * Limits frame time if fast forward ratio throttle is enabled. */ - - retro_time_t current = retro_get_time_usec(); - retro_time_t delta = current - frame_time_last; - bool is_locked_fps = (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || - input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)) | - !!recording_driver_get_data_ptr(); - - - if (!frame_time_last || is_locked_fps) - delta = frame_time->reference; - - if (!is_locked_fps && runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)) - delta /= settings->slowmotion_ratio; - - frame_time_last = current; - - if (is_locked_fps) - frame_time_last = 0; - - frame_time->callback(delta); - } + runloop_ctl(RUNLOOP_CTL_FRAME_TIME, NULL); cmd.state[2] = cmd.state[0] & ~cmd.state[1]; /* trigger */ diff --git a/runloop.h b/runloop.h index 57e74c06a2..90b6afcc86 100644 --- a/runloop.h +++ b/runloop.h @@ -40,7 +40,7 @@ enum runloop_ctl_state RUNLOOP_CTL_GET_WINDOWED_SCALE, RUNLOOP_CTL_SET_WINDOWED_SCALE, RUNLOOP_CTL_SET_IDLE, - RUNLOOP_CTL_GET_FRAME_TIME, + RUNLOOP_CTL_FRAME_TIME, RUNLOOP_CTL_SET_FRAME_TIME, RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, diff --git a/screenshot.c b/screenshot.c index 6c4b991400..58f9d0da40 100644 --- a/screenshot.c +++ b/screenshot.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2016 - Daniel De Matteis - * + * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -54,6 +54,8 @@ static bool screenshot_dump(const char *folder, const void *frame, unsigned width, unsigned height, int pitch, bool bgr24) { + settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); bool ret; char filename[PATH_MAX_LENGTH]; char shotname[256]; @@ -62,8 +64,16 @@ static bool screenshot_dump(const char *folder, const void *frame, struct scaler_ctx scaler = {0}; #endif - fill_dated_filename(shotname, IMG_EXT, sizeof(shotname)); - fill_pathname_join(filename, folder, shotname, sizeof(filename)); + if (settings->auto_screenshot_filename) + { + fill_dated_filename(shotname, IMG_EXT, sizeof(shotname)); + fill_pathname_join(filename, folder, shotname, sizeof(filename)); + } + else + { + snprintf(shotname, sizeof(shotname),"%s.png", path_basename(global->name.base)); + fill_pathname_join(filename, folder, shotname, sizeof(filename)); + } #ifdef _XBOX1 d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(true); @@ -172,7 +182,7 @@ static bool take_screenshot_raw(void) settings_t *settings = config_get_ptr(); video_driver_cached_frame_get(&data, &width, &height, &pitch); - + screenshot_dir = settings->screenshot_directory; if (!*settings->screenshot_directory)