This commit is contained in:
Alwin Garside 2016-03-13 15:30:41 +01:00
commit 36117750af
19 changed files with 173 additions and 115 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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];

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
ctr/assets/dosbox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -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)

View File

@ -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,

View File

@ -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();

View File

@ -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));

View File

@ -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 */

View File

@ -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,

View File

@ -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)