Merge branch 'master' of github.com:libretro/RetroArch

This commit is contained in:
radius 2015-07-22 00:23:21 -05:00
commit 79f2a92202
5 changed files with 92 additions and 101 deletions

View File

@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis * Copyright (C) 2011-2015 - Daniel De Matteis
* Copyright (C) 2012-2015 - Michael Lelli * Copyright (C) 2012-2015 - Michael Lelli
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * 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- * 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. * ation, either version 3 of the License, or (at your option) any later version.
@ -53,6 +53,7 @@ extern void system_exec_wii(const char *path, bool should_load_game);
#endif #endif
#include <sdcard/gcsd.h> #include <sdcard/gcsd.h>
#include <fat.h> #include <fat.h>
#include <rthreads/rthreads.h>
#ifdef USBGECKO #ifdef USBGECKO
#include <debug.h> #include <debug.h>
@ -108,24 +109,27 @@ static struct {
static slock_t *gx_device_mutex; static slock_t *gx_device_mutex;
static slock_t *gx_device_cond_mutex; static slock_t *gx_device_cond_mutex;
static scond_t *gx_device_cond; static scond_t *gx_device_cond;
static sthread_t *gx_device_thread;
static volatile bool gx_stop_dev_thread;
static void *gx_devthread(void *a) static void gx_devthread(void *a)
{ {
while (1) while (!gx_stop_dev_thread)
{ {
unsigned i; unsigned i;
slock_lock(gx_device_mutex); slock_lock(gx_device_mutex);
for (i = 0; i < GX_DEVICE_END; i++) for (i = 0; i < GX_DEVICE_END; i++) {
{ if (gx_devices[i].mounted) {
if (gx_devices[i].mounted && if (!gx_devices[i].interface->isInserted()) {
!gx_devices[i].interface->isInserted()) gx_devices[i].mounted = false;
{ char n[8];
gx_devices[i].mounted = false; snprintf(n, sizeof(n), "%s:", gx_devices[i].name);
char n[8]; fatUnmount(n);
snprintf(n, sizeof(n), "%s:", gx_devices[i].name); }
fatUnmount(n); } else if (gx_devices[i].interface->startup() && gx_devices[i].interface->isInserted()) {
gx_devices[i].mounted = fatMountSimple(gx_devices[i].name, gx_devices[i].interface);
} }
} }
@ -135,17 +139,6 @@ static void *gx_devthread(void *a)
scond_wait_timeout(gx_device_cond, gx_device_cond_mutex, 1000000); scond_wait_timeout(gx_device_cond, gx_device_cond_mutex, 1000000);
slock_unlock(gx_device_cond_mutex); slock_unlock(gx_device_cond_mutex);
} }
return NULL;
}
static int gx_get_device_from_path(const char *path)
{
if (strstr(path, "sd:") == path)
return GX_DEVICE_SD;
if (strstr(path, "usb:") == path)
return GX_DEVICE_USB;
return -1;
} }
#endif #endif
@ -222,7 +215,7 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[],
gx_rom_path[0] = '\0'; gx_rom_path[0] = '\0';
#else #else
#ifdef HW_RVL #ifdef HW_RVL
/* needed on Wii; loaders follow a dumb standard where the path and /* needed on Wii; loaders follow a dumb standard where the path and
* filename are separate in the argument list */ * filename are separate in the argument list */
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL) if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
{ {
@ -297,7 +290,6 @@ static void frontend_gx_init(void *data)
#endif #endif
#if defined(HW_RVL) && !defined(IS_SALAMANDER) #if defined(HW_RVL) && !defined(IS_SALAMANDER)
OSThread gx_device_thread;
gx_devices[GX_DEVICE_SD].interface = &__io_wiisd; gx_devices[GX_DEVICE_SD].interface = &__io_wiisd;
gx_devices[GX_DEVICE_SD].name = "sd"; gx_devices[GX_DEVICE_SD].name = "sd";
gx_devices[GX_DEVICE_SD].mounted = fatMountSimple( gx_devices[GX_DEVICE_SD].mounted = fatMountSimple(
@ -312,7 +304,20 @@ static void frontend_gx_init(void *data)
gx_device_cond_mutex = slock_new(); gx_device_cond_mutex = slock_new();
gx_device_cond = scond_new(); gx_device_cond = scond_new();
gx_device_mutex = slock_new(); gx_device_mutex = slock_new();
OSCreateThread(&gx_device_thread, gx_devthread, 0, NULL, NULL, 0, 66, 0); gx_device_thread = sthread_create(gx_devthread, NULL);
#endif
}
static void frontend_gx_deinit(void *data)
{
(void)data;
#if defined(HW_RVL) && !defined(IS_SALAMANDER)
slock_lock(gx_device_cond_mutex);
gx_stop_dev_thread = true;
slock_unlock(gx_device_cond_mutex);
scond_signal(gx_device_cond);
sthread_join(gx_device_thread);
#endif #endif
} }
@ -346,7 +351,7 @@ static void frontend_gx_process_args(int *argc, char *argv[])
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
/* A big hack: sometimes Salamander doesn't save the new core /* A big hack: sometimes Salamander doesn't save the new core
* it loads on first boot, so we make sure * it loads on first boot, so we make sure
* settings->libretro is set here. */ * settings->libretro is set here. */
if (!settings->libretro[0] && *argc >= 1 && strrchr(argv[0], '/')) if (!settings->libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
@ -407,7 +412,7 @@ static int frontend_gx_parse_drive_list(void *data)
const frontend_ctx_driver_t frontend_ctx_gx = { const frontend_ctx_driver_t frontend_ctx_gx = {
frontend_gx_get_environment_settings, frontend_gx_get_environment_settings,
frontend_gx_init, frontend_gx_init,
NULL, /* deinit */ frontend_gx_deinit,
frontend_gx_exitspawn, frontend_gx_exitspawn,
frontend_gx_process_args, frontend_gx_process_args,
frontend_gx_exec, frontend_gx_exec,

View File

@ -106,8 +106,8 @@ static INLINE bool gl_query_extension(gl_t *gl, const char *ext)
if (gl->core_context) if (gl->core_context)
{ {
#ifdef GL_NUM_EXTENSIONS #ifdef GL_NUM_EXTENSIONS
GLint i, exts; GLint i;
exts = 0; GLint exts = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &exts); glGetIntegerv(GL_NUM_EXTENSIONS, &exts);
for (i = 0; i < exts; i++) for (i = 0; i < exts; i++)
{ {
@ -327,8 +327,10 @@ static INLINE GLenum min_filter_to_mag(GLenum type)
case GL_NEAREST_MIPMAP_NEAREST: case GL_NEAREST_MIPMAP_NEAREST:
return GL_NEAREST; return GL_NEAREST;
default: default:
return type; break;
} }
return type;
} }
#ifdef HAVE_FBO #ifdef HAVE_FBO

View File

@ -95,9 +95,7 @@ void gl_load_texture_data(GLuint id,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
#ifndef HAVE_PSGL
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
#endif
glTexImage2D(GL_TEXTURE_2D, glTexImage2D(GL_TEXTURE_2D,
0, 0,
(driver->gfx_use_rgba || !rgb32) ? GL_RGBA : RARCH_GL_INTERNAL_FORMAT32, (driver->gfx_use_rgba || !rgb32) ? GL_RGBA : RARCH_GL_INTERNAL_FORMAT32,

View File

@ -542,7 +542,7 @@ struct sunxi_video
unsigned int menu_height; unsigned int menu_height;
unsigned int menu_pitch; unsigned int menu_pitch;
bool aspect_changed; float aspect_ratio;
}; };
static void sunxi_blank_console(struct sunxi_video *_dispvars) static void sunxi_blank_console(struct sunxi_video *_dispvars)
@ -633,6 +633,11 @@ static void *sunxi_gfx_init(const video_info_t *video,
_dispvars->keep_vsync = true; _dispvars->keep_vsync = true;
_dispvars->menu_active = false; _dispvars->menu_active = false;
_dispvars->bytes_per_pixel = video->rgb32 ? 4 : 2; _dispvars->bytes_per_pixel = video->rgb32 ? 4 : 2;
/* It's very important that we set aspect here because the
* call seq when a core is loaded is gfx_init()->set_aspect()->gfx_frame()
* and we don't want the main surface to be setup in set_aspect()
* before we get to gfx_frame(). */
_dispvars->aspect_ratio = video_driver_get_aspect_ratio();
switch (_dispvars->bytes_per_pixel) switch (_dispvars->bytes_per_pixel)
{ {
@ -745,29 +750,7 @@ static void sunxi_setup_scale (void *data,
_dispvars->pages[i].address = ((uint32_t*) _dispvars->sunxi_disp->framebuffer_addr + (_dispvars->sunxi_disp->yres + i * _dispvars->src_height) * _dispvars->dst_pitch/4); _dispvars->pages[i].address = ((uint32_t*) _dispvars->sunxi_disp->framebuffer_addr + (_dispvars->sunxi_disp->yres + i * _dispvars->src_height) * _dispvars->dst_pitch/4);
} }
switch (settings->video.aspect_ratio_idx) visible_width = _dispvars->sunxi_disp->yres * _dispvars->aspect_ratio;
{
case ASPECT_RATIO_4_3:
aspect = (float)4 / (float)3;
break;
case ASPECT_RATIO_16_9:
aspect = (float)16 / (float)9;
break;
case ASPECT_RATIO_16_10:
aspect = (float)16 / (float)10;
break;
case ASPECT_RATIO_16_15:
aspect = (float)16 / (float)15;
break;
case ASPECT_RATIO_CORE:
aspect = (float)_dispvars->src_width / (float)_dispvars->src_height;
break;
default:
aspect = (float)_dispvars->src_width / (float)_dispvars->src_height;
break;
}
visible_width = _dispvars->sunxi_disp->yres * aspect;
xpos = (_dispvars->sunxi_disp->xres - visible_width) / 2; xpos = (_dispvars->sunxi_disp->xres - visible_width) / 2;
/* setup layer window */ /* setup layer window */
@ -898,40 +881,43 @@ static void sunxi_set_texture_enable(void *data, bool state, bool full_screen)
static void sunxi_set_texture_frame(void *data, const void *frame, bool rgb32, static void sunxi_set_texture_frame(void *data, const void *frame, bool rgb32,
unsigned width, unsigned height, float alpha) unsigned width, unsigned height, float alpha)
{ {
uint16_t src_pix;
uint32_t R, G, B, dst_pix;
unsigned int i, j;
struct sunxi_video *_dispvars = (struct sunxi_video*)data; struct sunxi_video *_dispvars = (struct sunxi_video*)data;
/* We have to go on a pixel format conversion adventure for now, until we can if (_dispvars->menu_active) {
* convince RGUI to output in an 8888 format. */ uint16_t src_pix;
unsigned int src_pitch = width * 2; uint32_t R, G, B, dst_pix;
unsigned int dst_pitch = _dispvars->sunxi_disp->xres * 4; unsigned int i, j;
unsigned int dst_width = _dispvars->sunxi_disp->xres;
uint32_t line[dst_width]; /* We have to go on a pixel format conversion adventure for now, until we can
* convince RGUI to output in an 8888 format. */
unsigned int src_pitch = width * 2;
unsigned int dst_pitch = _dispvars->sunxi_disp->xres * 4;
unsigned int dst_width = _dispvars->sunxi_disp->xres;
uint32_t line[dst_width];
/* Remember, memcpy() works with 8bits pointers for increments. */ /* Remember, memcpy() works with 8bits pointers for increments. */
char *dst_base_addr = (char*)(_dispvars->pages[0].address); char *dst_base_addr = (char*)(_dispvars->pages[0].address);
char *src_base_addr = (char*)frame; char *src_base_addr = (char*)frame;
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
{
for (j = 0; j < src_pitch / 2; j++)
{ {
src_pix = *((uint16_t*)frame + (src_pitch / 2 * i) + j); for (j = 0; j < src_pitch / 2; j++)
/* The hex AND is for keeping only the part we need for each component. */ {
R = (src_pix << 8) & 0x00FF0000; src_pix = *((uint16_t*)frame + (src_pitch / 2 * i) + j);
G = (src_pix << 4) & 0x0000FF00; /* The hex AND is for keeping only the part we need for each component. */
B = (src_pix << 0) & 0x000000FF; R = (src_pix << 8) & 0x00FF0000;
line[j] = (0 | R | G | B); G = (src_pix << 4) & 0x0000FF00;
B = (src_pix << 0) & 0x000000FF;
line[j] = (0 | R | G | B);
}
memcpy(dst_base_addr + (dst_pitch * i), (char*)line, dst_pitch);
} }
memcpy(dst_base_addr + (dst_pitch * i), (char*)line, dst_pitch);
}
/* Issue pageflip. Will flip on next vsync. */ /* Issue pageflip. Will flip on next vsync. */
sunxi_layer_set_rgb_input_buffer(_dispvars->sunxi_disp, sunxi_layer_set_rgb_input_buffer(_dispvars->sunxi_disp,
_dispvars->sunxi_disp->bits_per_pixel, _dispvars->sunxi_disp->bits_per_pixel,
_dispvars->pages[0].offset, width, height, _dispvars->sunxi_disp->xres); _dispvars->pages[0].offset, width, height, _dispvars->sunxi_disp->xres);
}
} }
static uint64_t sunxi_get_frame_count(void *data) static uint64_t sunxi_get_frame_count(void *data)
@ -942,6 +928,17 @@ static uint64_t sunxi_get_frame_count(void *data)
return _dispvars->frame_count; return _dispvars->frame_count;
} }
static void sunxi_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
{
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
/* Here we obtain the new aspect ratio. */
float new_aspect = aspectratio_lut[aspect_ratio_idx].value;
if (new_aspect != _dispvars->aspect_ratio) {
_dispvars->aspect_ratio = new_aspect;
sunxi_setup_scale(_dispvars, _dispvars->src_width, _dispvars->src_height, _dispvars->src_pitch);
}
}
static const video_poke_interface_t sunxi_poke_interface = { static const video_poke_interface_t sunxi_poke_interface = {
sunxi_get_frame_count, sunxi_get_frame_count,
NULL, /* set_video_mode */ NULL, /* set_video_mode */
@ -951,7 +948,7 @@ static const video_poke_interface_t sunxi_poke_interface = {
NULL, /* get_video_output_next */ NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */ NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */ NULL, /* get_proc_address */
NULL, /* sunxi_set_aspect_ratio */ sunxi_set_aspect_ratio,
NULL, /* sunxi_apply_state_changes */ NULL, /* sunxi_apply_state_changes */
#ifdef HAVE_MENU #ifdef HAVE_MENU
sunxi_set_texture_frame, sunxi_set_texture_frame,

View File

@ -89,7 +89,7 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
char *last = NULL; char *last = NULL;
fill_pathname_join(core_path, settings->libretro_info_path, fill_pathname_join(core_path, settings->libretro_info_path,
line_start, sizeof(core_path)); line_start, sizeof(core_path));
(void)last; (void)last;
path_remove_extension(core_path); path_remove_extension(core_path);
@ -814,7 +814,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
fill_short_pathname_representation(path_short, path, fill_short_pathname_representation(path_short, path,
sizeof(path_short)); sizeof(path_short));
strlcpy(fill_buf, strlcpy(fill_buf,
(label && label[0] != '\0') ? label : path_short, (label && label[0] != '\0') ? label : path_short,
sizeof(fill_buf)); sizeof(fill_buf));
@ -1936,17 +1936,6 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
return 0; return 0;
} }
#if defined(GEKKO) && defined(HW_RVL)
slock_lock(gx_device_mutex);
device = gx_get_device_from_path(info->path);
if (device != -1 && !gx_devices[device].mounted &&
gx_devices[device].interface->isInserted())
fatMountSimple(gx_devices[device].name, gx_devices[device].interface);
slock_unlock(gx_device_mutex);
#endif
path_is_compressed = path_is_compressed_file(info->path); path_is_compressed = path_is_compressed_file(info->path);
push_dir = (info->setting push_dir = (info->setting
&& info->setting->browser_selection_type == ST_DIR); && info->setting->browser_selection_type == ST_DIR);
@ -2314,7 +2303,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
(type == DISPLAYLIST_PERFCOUNTERS_CORE) ? (type == DISPLAYLIST_PERFCOUNTERS_CORE) ?
perf_ptr_libretro : perf_ptr_rarch , perf_ptr_libretro : perf_ptr_rarch ,
(type == DISPLAYLIST_PERFCOUNTERS_CORE) ? (type == DISPLAYLIST_PERFCOUNTERS_CORE) ?
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN : MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN :
MENU_SETTINGS_PERF_COUNTERS_BEGIN); MENU_SETTINGS_PERF_COUNTERS_BEGIN);
ret = 0; ret = 0;
@ -2464,7 +2453,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
menu_hash_to_str(MENU_LABEL_VALUE_DISK_INDEX), menu_hash_to_str(MENU_LABEL_VALUE_DISK_INDEX),
menu_hash_to_str(MENU_LABEL_DISK_INDEX), menu_hash_to_str(MENU_LABEL_DISK_INDEX),
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX, 0, 0); MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX, 0, 0);
menu_list_push(info->list, menu_list_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS), menu_hash_to_str(MENU_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS),
menu_hash_to_str(MENU_LABEL_DISK_CYCLE_TRAY_STATUS), menu_hash_to_str(MENU_LABEL_DISK_CYCLE_TRAY_STATUS),
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_CYCLE_TRAY_STATUS, 0, 0); MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_CYCLE_TRAY_STATUS, 0, 0);