Updates pt. 4

This commit is contained in:
twinaphex 2015-03-20 22:22:06 +01:00
parent f130b00596
commit 5d8ce54a9f
10 changed files with 104 additions and 80 deletions

View File

@ -32,10 +32,12 @@ static void emscripten_mainloop(void)
int main(int argc, char *argv[])
{
settings_t *settings = config_get_ptr();
emscripten_set_canvas_size(800, 600);
rarch_main(argc, argv);
emscripten_set_main_loop(emscripten_mainloop,
g_settings.video.vsync ? 0 : INT_MAX, 1);
settings->video.vsync ? 0 : INT_MAX, 1);
return 0;
}

View File

@ -337,10 +337,12 @@ static void frontend_gx_exitspawn(char *core_path, size_t sizeof_core_path)
static void frontend_gx_process_args(int *argc, char *argv[])
{
#ifndef IS_SALAMANDER
settings_t *settings = config_get_ptr();
/* A big hack: sometimes Salamander doesn't save the new core
* it loads on first boot, so we make sure
* g_settings.libretro is set here. */
if (!g_settings.libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
* settings->libretro is set here. */
if (!settings->libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
{
char path[PATH_MAX_LENGTH];
strlcpy(path, strrchr(argv[0], '/') + 1, sizeof(path));

View File

@ -39,8 +39,10 @@ struct input_keyboard_line
static void input_keyboard_line_toggle_osk(bool enable)
{
driver_t *driver = driver_get_ptr();
if (!g_settings.osk.enable)
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
if (!settings->osk.enable)
return;
driver->keyboard_linefeed_enable = enable;

View File

@ -92,7 +92,8 @@ static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint
message, &params, NULL);
}
static void glui_render_background(gl_t *gl, glui_handle_t *glui,
static void glui_render_background(settings_t *settings,
gl_t *gl, glui_handle_t *glui,
bool force_transparency)
{
static const GLfloat vertex[] = {
@ -131,7 +132,7 @@ static void glui_render_background(gl_t *gl, glui_handle_t *glui,
coords.tex_coord = tex_coord;
coords.lut_tex_coord = tex_coord;
if ((g_settings.menu.pause_libretro
if ((settings->menu.pause_libretro
|| !g_extern.main_is_init || g_extern.libretro_dummy)
&& !force_transparency
&& glui->textures.bg.id)
@ -225,7 +226,8 @@ static void glui_render_messagebox(const char *message)
struct string_list *list = NULL;
glui_handle_t *glui = NULL;
gl_t *gl = NULL;
menu_handle_t *menu = menu_driver_resolve();
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
if (!menu)
return;
@ -251,7 +253,7 @@ static void glui_render_messagebox(const char *message)
x = gl->win_width / 2 - strlen(list->elems[0].data) * glui->glyph_width / 2;
y = gl->win_height / 2 - list->size * glui->line_height / 2;
normal_color = FONT_COLOR_ARGB_TO_RGBA(g_settings.menu.entry_normal_color);
normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
for (i = 0; i < list->size; i++)
{
@ -268,8 +270,9 @@ static void glui_render(void)
{
glui_handle_t *glui = NULL;
gl_t *gl = NULL;
menu_handle_t *menu = menu_driver_resolve();
runloop_t *runloop = rarch_main_get_ptr();
menu_handle_t *menu = menu_driver_resolve();
runloop_t *runloop = rarch_main_get_ptr();
settings_t *settings = config_get_ptr();
if (!menu)
return;
@ -284,7 +287,7 @@ static void glui_render(void)
if (!gl)
return;
glui->line_height = g_settings.video.font_size * 4 / 3;
glui->line_height = settings->video.font_size * 4 / 3;
glui->glyph_width = glui->line_height / 2;
glui->margin = gl->win_width / 20 ;
glui->term_width = (gl->win_width - glui->margin * 2) / glui->glyph_width;
@ -327,9 +330,10 @@ static void glui_frame(void)
glui_handle_t *glui = NULL;
const char *core_name = NULL;
const char *core_version = NULL;
menu_handle_t *menu = menu_driver_resolve();
const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(g_settings.menu.entry_normal_color);
const uint32_t hover_color = FONT_COLOR_ARGB_TO_RGBA(g_settings.menu.entry_hover_color);
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
const uint32_t hover_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_hover_color);
runloop_t *runloop = rarch_main_get_ptr();
if (!menu)
@ -357,7 +361,7 @@ static void glui_frame(void)
menu->begin + glui->term_height :
menu_list_get_size(menu->menu_list);
glui_render_background(gl, glui, false);
glui_render_background(settings, gl, glui, false);
menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);
@ -366,7 +370,7 @@ static void glui_frame(void)
menu_animation_ticker_line(title_buf, glui->term_width - 3,
runloop->frames.video.count / glui->margin, title, true);
glui_blit_line(gl, glui->margin * 2, glui->margin + glui->line_height,
title_buf, FONT_COLOR_ARGB_TO_RGBA(g_settings.menu.title_color));
title_buf, FONT_COLOR_ARGB_TO_RGBA(settings->menu.title_color));
core_name = g_extern.menu.info.library_name;
if (!core_name)
@ -374,7 +378,7 @@ static void glui_frame(void)
if (!core_name)
core_name = "No Core";
if (g_settings.menu.core_enable)
if (settings->menu.core_enable)
{
core_version = g_extern.menu.info.library_version;
if (!core_version)
@ -388,11 +392,11 @@ static void glui_frame(void)
glui_blit_line(gl,
glui->margin * 2,
glui->margin + glui->term_height * glui->line_height
+ glui->line_height * 2, title_msg, FONT_COLOR_ARGB_TO_RGBA(g_settings.menu.title_color));
+ glui->line_height * 2, title_msg, FONT_COLOR_ARGB_TO_RGBA(settings->menu.title_color));
}
if (g_settings.menu.timedate_enable)
if (settings->menu.timedate_enable)
{
disp_timedate_set_label(timedate, sizeof(timedate), 0);
glui_blit_line(gl,
@ -449,19 +453,19 @@ static void glui_frame(void)
const char *str = *menu->keyboard.buffer;
if (!str)
str = "";
glui_render_background(gl, glui, true);
glui_render_background(settings, gl, glui, true);
snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);
glui_render_messagebox(msg);
}
if (glui->box_message[0] != '\0')
{
glui_render_background(gl, glui, true);
glui_render_background(settings, gl, glui, true);
glui_render_messagebox(glui->box_message);
glui->box_message[0] = '\0';
}
if (g_settings.menu.mouse.enable)
if (settings->menu.mouse.enable)
glui_draw_cursor(gl, menu->mouse.x, menu->mouse.y);
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
@ -556,7 +560,8 @@ static void glui_context_reset(void)
{
const char *path = NULL;
glui_handle_t *glui = NULL;
menu_handle_t *menu = menu_driver_resolve();
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
if (!menu)
return;
@ -566,12 +571,12 @@ static void glui_context_reset(void)
if (!glui)
return;
fill_pathname_join(glui->textures.bg.path, g_settings.assets_directory,
fill_pathname_join(glui->textures.bg.path, settings->assets_directory,
"glui", sizeof(glui->textures.bg.path));
if (*g_settings.menu.wallpaper)
if (*settings->menu.wallpaper)
strlcpy(glui->textures.bg.path,
g_settings.menu.wallpaper, sizeof(glui->textures.bg.path));
settings->menu.wallpaper, sizeof(glui->textures.bg.path));
else
fill_pathname_join(glui->textures.bg.path,
glui->textures.bg.path, "bg.png",

View File

@ -35,13 +35,13 @@
#define RGUI_TERM_HEIGHT (((menu->frame_buf.height - RGUI_TERM_START_Y - RGUI_TERM_START_X) / (FONT_HEIGHT_STRIDE)) - 1)
#if defined(GEKKO)|| defined(PSP)
#define HOVER_COLOR ((3 << 0) | (10 << 4) | (3 << 8) | (7 << 12))
#define NORMAL_COLOR 0x7FFF
#define TITLE_COLOR HOVER_COLOR
#define HOVER_COLOR(settings) ((3 << 0) | (10 << 4) | (3 << 8) | (7 << 12))
#define NORMAL_COLOR(settings) 0x7FFF
#define TITLE_COLOR(settings) HOVER_COLOR(settings)
#else
#define HOVER_COLOR (argb32_to_rgba4444(g_settings.menu.entry_hover_color))
#define NORMAL_COLOR (argb32_to_rgba4444(g_settings.menu.entry_normal_color))
#define TITLE_COLOR (argb32_to_rgba4444(g_settings.menu.title_color))
#define HOVER_COLOR(settings) (argb32_to_rgba4444(settings->menu.entry_hover_color))
#define NORMAL_COLOR(settings) (argb32_to_rgba4444(settings->menu.entry_normal_color))
#define TITLE_COLOR(settings) (argb32_to_rgba4444(settings->menu.title_color))
#endif
static inline uint16_t argb32_to_rgba4444(uint32_t col)
@ -273,7 +273,8 @@ static void rgui_render_messagebox(const char *message)
unsigned width, glyphs_width, height;
uint16_t color;
struct string_list *list = NULL;
menu_handle_t *menu = menu_driver_resolve();
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
if (!menu)
return;
@ -319,7 +320,7 @@ static void rgui_render_messagebox(const char *message)
fill_rect(&menu->frame_buf, x + 5, y + height - 5, width - 5, 5, green_filler);
fill_rect(&menu->frame_buf, x, y + 5, 5, height - 5, green_filler);
color = NORMAL_COLOR;
color = NORMAL_COLOR(settings);
for (i = 0; i < list->size; i++)
{
@ -349,13 +350,14 @@ static void rgui_render(void)
char timedate[PATH_MAX_LENGTH];
unsigned x, y, menu_type = 0;
uint16_t hover_color, normal_color;
const char *dir = NULL;
const char *label = NULL;
const char *core_name = NULL;
const char *dir = NULL;
const char *label = NULL;
const char *core_name = NULL;
const char *core_version = NULL;
menu_handle_t *menu = menu_driver_resolve();
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
menu_handle_t *menu = menu_driver_resolve();
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
(void)driver;
@ -409,10 +411,10 @@ static void rgui_render(void)
menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 3,
runloop->frames.video.count / RGUI_TERM_START_X, title, true);
hover_color = HOVER_COLOR;
normal_color = NORMAL_COLOR;
hover_color = HOVER_COLOR(settings);
normal_color = NORMAL_COLOR(settings);
blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, RGUI_TERM_START_X, title_buf, TITLE_COLOR);
blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, RGUI_TERM_START_X, title_buf, TITLE_COLOR(settings));
core_name = g_extern.menu.info.library_name;
if (!core_name)
@ -420,7 +422,7 @@ static void rgui_render(void)
if (!core_name)
core_name = "No Core";
if (g_settings.menu.core_enable)
if (settings->menu.core_enable)
{
core_version = g_extern.menu.info.library_version;
if (!core_version)
@ -437,7 +439,7 @@ static void rgui_render(void)
RGUI_TERM_START_Y + 2, title_msg, hover_color);
}
if (g_settings.menu.timedate_enable)
if (settings->menu.timedate_enable)
{
disp_timedate_set_label(timedate, sizeof(timedate), 3);
@ -520,7 +522,7 @@ static void rgui_render(void)
rgui_render_messagebox(msg);
}
if (g_settings.menu.mouse.enable)
if (settings->menu.mouse.enable)
rgui_blit_cursor(menu);
}

View File

@ -320,7 +320,9 @@ static void rmenu_set_texture(void)
static void rmenu_wallpaper_set_defaults(char *menu_bg, size_t sizeof_menu_bg)
{
fill_pathname_join(menu_bg, g_settings.assets_directory,
settings_t *settings = config_get_ptr();
fill_pathname_join(menu_bg, settings->assets_directory,
"rmenu", sizeof_menu_bg);
#ifdef _XBOX1
fill_pathname_join(menu_bg, menu_bg, "sd", sizeof_menu_bg);
@ -333,13 +335,14 @@ static void rmenu_wallpaper_set_defaults(char *menu_bg, size_t sizeof_menu_bg)
static void rmenu_context_reset(void)
{
char menu_bg[PATH_MAX_LENGTH];
menu_handle_t *menu = menu_driver_resolve();
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
if (!menu)
return;
if (*g_settings.menu.wallpaper)
strlcpy(menu_bg, g_settings.menu.wallpaper, sizeof(menu_bg));
if (*settings->menu.wallpaper)
strlcpy(menu_bg, settings->menu.wallpaper, sizeof(menu_bg));
else
rmenu_wallpaper_set_defaults(menu_bg, sizeof(menu_bg));

View File

@ -282,7 +282,8 @@ static void* rmenu_xui_init(void)
d3d_video_t *d3d;
video_info_t video_info = {0};
TypefaceDescriptor typeface = {0};
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
settings_t *settings = config_get_ptr();
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu)
return NULL;
@ -292,13 +293,12 @@ static void* rmenu_xui_init(void)
if (d3d->resolution_hd_enable)
RARCH_LOG("HD menus enabled.\n");
video_info.vsync = g_settings.video.vsync;
video_info.vsync = settings->video.vsync;
video_info.force_aspect = false;
video_info.smooth = g_settings.video.smooth;
video_info.input_scale = 2;
video_info.fullscreen = true;
video_info.rgb32 = false;
video_info.smooth = settings->video.smooth;
video_info.input_scale = 2;
video_info.fullscreen = true;
video_info.rgb32 = false;
d3d_make_d3dpp(d3d, &video_info, &d3dpp);

View File

@ -414,7 +414,8 @@ static void xmb_draw_text(gl_t *gl, xmb_handle_t *xmb, const char *str, float x,
str, &params, xmb->font.buf);
}
static void xmb_frame_background(gl_t *gl, xmb_handle_t *xmb,
static void xmb_frame_background(settings_t *settings,
gl_t *gl, xmb_handle_t *xmb,
bool force_transparency)
{
struct gl_coords coords;
@ -458,7 +459,7 @@ static void xmb_frame_background(gl_t *gl, xmb_handle_t *xmb,
coords.tex_coord = tex_coord;
coords.lut_tex_coord = tex_coord;
if ((g_settings.menu.pause_libretro
if ((settings->menu.pause_libretro
|| !g_extern.main_is_init || g_extern.libretro_dummy)
&& !force_transparency
&& xmb->textures.bg.id)
@ -1245,7 +1246,8 @@ static void xmb_frame(void)
const char *core_version = NULL;
xmb_handle_t *xmb = NULL;
gl_t *gl = NULL;
menu_handle_t *menu = menu_driver_resolve();
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
if (!menu)
return;
@ -1260,12 +1262,12 @@ static void xmb_frame(void)
if (!gl)
return;
xmb_frame_background(gl, xmb, false);
xmb_frame_background(settings, gl, xmb, false);
xmb_draw_text(gl, xmb,
xmb->title_name, xmb->margins.title.left, xmb->margins.title.top, 1, 1, 0);
if (g_settings.menu.timedate_enable)
if (settings->menu.timedate_enable)
{
disp_timedate_set_label(timedate, sizeof(timedate), 0);
@ -1274,7 +1276,7 @@ static void xmb_frame(void)
xmb->margins.title.top, 1, 1, 1);
}
if (g_settings.menu.core_enable)
if (settings->menu.core_enable)
{
core_name = g_extern.menu.info.library_name;
@ -1319,7 +1321,7 @@ static void xmb_frame(void)
xmb_draw_icon_begin(gl, xmb);
if (g_settings.menu.timedate_enable)
if (settings->menu.timedate_enable)
xmb_draw_icon_predone(gl, xmb, &mymat, xmb->textures.list[XMB_TEXTURE_CLOCK].id,
gl->win_width - xmb->icon.size, xmb->icon.size, 1, 0, 1);
@ -1370,11 +1372,11 @@ static void xmb_frame(void)
if (render_background)
{
xmb_frame_background(gl, xmb, true);
xmb_frame_background(settings, gl, xmb, true);
xmb_frame_messagebox(msg);
}
if (g_settings.menu.mouse.enable)
if (settings->menu.mouse.enable)
xmb_draw_cursor(gl, xmb, menu->mouse.x, menu->mouse.y);
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
@ -1502,7 +1504,9 @@ static bool xmb_font_init_first(const gl_font_renderer_t **font_driver,
void **font_handle, void *video_data, const char *font_path,
float xmb_font_size)
{
if (g_settings.video.threaded
settings_t *settings = config_get_ptr();
if (settings->video.threaded
&& !g_extern.system.hw_render_callback.context_type)
{
driver_t *driver = driver_get_ptr();
@ -1565,7 +1569,8 @@ static void xmb_context_reset(void)
gl_t *gl = NULL;
xmb_handle_t *xmb = NULL;
xmb_node_t *node = NULL;
menu_handle_t *menu = menu_driver_resolve();
menu_handle_t *menu = menu_driver_resolve();
settings_t *settings = config_get_ptr();
if (!menu)
return;
@ -1578,12 +1583,12 @@ static void xmb_context_reset(void)
if (!xmb)
return;
fill_pathname_join(bgpath, g_settings.assets_directory,
fill_pathname_join(bgpath, settings->assets_directory,
"xmb", sizeof(bgpath));
fill_pathname_join(bgpath, bgpath, "bg.png", sizeof(bgpath));
fill_pathname_join(mediapath, g_settings.assets_directory,
fill_pathname_join(mediapath, settings->assets_directory,
"lakka", sizeof(mediapath));
fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath));
fill_pathname_join(iconpath, themepath, xmb->icon.dir, sizeof(iconpath));
@ -1665,8 +1670,8 @@ static void xmb_context_reset(void)
fill_pathname_join(path, iconpath,
"bg.png", sizeof(path));
if (*g_settings.menu.wallpaper)
strlcpy(path, g_settings.menu.wallpaper,
if (*settings->menu.wallpaper)
strlcpy(path, settings->menu.wallpaper,
sizeof(path));
if ( path_file_exists(path))
@ -1701,7 +1706,7 @@ static void xmb_context_reset(void)
continue;
}
fill_pathname_join(mediapath, g_settings.assets_directory,
fill_pathname_join(mediapath, settings->assets_directory,
"lakka", sizeof(mediapath));
fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath));
fill_pathname_join(iconpath, themepath, xmb->icon.dir, sizeof(iconpath));

View File

@ -271,6 +271,7 @@ static void ffmpeg_audio_resolve_sample_rate(ffmpeg_t *handle,
static bool ffmpeg_init_audio(ffmpeg_t *handle)
{
settings_t *settings = config_get_ptr();
struct ff_config_param *params = &handle->config;
struct ff_audio_info *audio = &handle->audio;
struct ff_video_info *video = &handle->video;
@ -304,7 +305,7 @@ static bool ffmpeg_init_audio(ffmpeg_t *handle)
rarch_resampler_realloc(&audio->resampler_data,
&audio->resampler,
g_settings.audio.resampler,
settings->audio.resampler,
audio->ratio);
}
else

View File

@ -22,6 +22,12 @@
bool screenshot_dump(const char *folder, const void *frame,
unsigned width, unsigned height, int pitch, bool bgr24)
{
char filename[PATH_MAX_LENGTH];
char shotname[PATH_MAX_LENGTH];
HRESULT ret = S_OK;
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
settings_t *settings = config_get_ptr();
(void)folder;
(void)frame;
(void)width;
@ -29,13 +35,9 @@ bool screenshot_dump(const char *folder, const void *frame,
(void)pitch;
(void)bgr24;
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
HRESULT ret = S_OK;
char filename[PATH_MAX_LENGTH];
char shotname[PATH_MAX_LENGTH];
fill_dated_filename(shotname, "bmp", sizeof(shotname));
snprintf(filename, sizeof(filename), "%s\\%s", g_settings.screenshot_directory, shotname);
snprintf(filename, sizeof(filename), "%s\\%s", settings->screenshot_directory, shotname);
D3DSurface *surf = NULL;
d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &surf);