1272 lines
36 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
* Copyright (C) 2012-2014 - Michael Lelli
* Copyright (C) 2014 - Jean-André Santoni
*
* 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.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stddef.h>
2014-10-16 07:27:42 +02:00
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include "../menu_driver.h"
#include "../menu_common.h"
#include "menu_display.h"
#include "../../../general.h"
2014-10-22 00:23:06 +02:00
#include <file/file_path.h>
2014-10-22 01:13:05 +02:00
#include <file/dir_list.h>
#include "../../../gfx/gl_common.h"
#include "../../../gfx/video_thread_wrapper.h"
2014-10-21 07:58:58 +02:00
#include <compat/posix_string.h>
2014-09-09 00:08:25 +02:00
#include "../../../settings_data.h"
2014-05-08 01:12:51 +07:00
#include "lakka.h"
#include "../menu_animation.h"
2014-05-08 01:12:51 +07:00
static const GLfloat lakka_vertex[] = {
0, 0,
1, 0,
0, 1,
1, 1,
};
static const GLfloat lakka_tex_coord[] = {
0, 1,
1, 1,
0, 0,
1, 0,
};
2014-10-09 02:20:07 +02:00
static char *str_replace (const char *string,
const char *substr, const char *replacement)
2014-06-01 01:08:39 +02:00
{
char *tok, *newstr, *oldstr, *head;
2014-10-09 02:20:07 +02:00
/* if either substr or replacement is NULL,
* duplicate string a let caller handle it. */
2014-06-01 01:08:39 +02:00
if (!substr || !replacement)
return strdup (string);
newstr = strdup (string);
head = newstr;
while ( (tok = strstr ( head, substr )))
{
oldstr = newstr;
2014-10-09 02:20:07 +02:00
newstr = (char*)malloc(
strlen(oldstr) - strlen(substr) + strlen(replacement) + 1);
2014-06-01 01:08:39 +02:00
if (!newstr)
{
/*failed to alloc mem, free old string and return NULL */
free (oldstr);
return NULL;
}
memcpy(newstr, oldstr, tok - oldstr );
memcpy(newstr + (tok - oldstr), replacement, strlen ( replacement ) );
memcpy(newstr + (tok - oldstr) + strlen( replacement ), tok +
strlen ( substr ), strlen ( oldstr ) -
strlen ( substr ) - ( tok - oldstr ) );
memset(newstr + strlen ( oldstr ) - strlen ( substr ) +
strlen ( replacement ) , 0, 1 );
2014-06-01 01:08:39 +02:00
/* move back head right after the last replacement */
head = newstr + (tok - oldstr) + strlen( replacement );
free (oldstr);
}
return newstr;
}
2014-10-10 18:20:52 +02:00
static void lakka_draw_text(lakka_handle_t *lakka,
const char *str, float x,
2014-10-14 22:37:01 +02:00
float y, float scale_factor, float alpha)
{
if (alpha > lakka->global_alpha)
alpha = lakka->global_alpha;
uint8_t a8 = 255 * alpha;
2014-10-10 18:20:52 +02:00
if (!lakka)
return;
if (a8 == 0)
return;
gl_t *gl = (gl_t*)driver_video_resolve(NULL);
2014-06-09 12:44:48 +02:00
if (!gl)
return;
2014-10-10 18:20:52 +02:00
if (x < -lakka->icon_size || x > gl->win_width + lakka->icon_size
|| y < -lakka->icon_size || y > gl->win_height + lakka->icon_size)
return;
2014-06-09 12:44:48 +02:00
gl_set_viewport(gl, gl->win_width, gl->win_height, false, false);
2014-05-10 06:21:03 +02:00
2014-06-09 12:24:23 +02:00
struct font_params params = {0};
2014-06-14 14:24:54 +02:00
params.x = x / gl->win_width;
params.y = 1.0f - y / gl->win_height;
2014-06-09 12:24:23 +02:00
2014-10-14 22:37:01 +02:00
params.scale = scale_factor;
params.color = FONT_COLOR_RGBA(255, 255, 255, a8);
2014-06-14 14:24:54 +02:00
params.full_screen = true;
2014-05-08 01:12:51 +07:00
if (driver.video_data && driver.video_poke
&& driver.video_poke->set_osd_msg)
driver.video_poke->set_osd_msg(driver.video_data,
str, &params);
2014-05-08 01:12:51 +07:00
}
static void lakka_draw_background(bool force_transparency)
{
float alpha = 0.75f;
gl_t *gl = NULL;
lakka_handle_t *lakka = NULL;
if (!driver.menu)
return;
lakka = (lakka_handle_t*)driver.menu->userdata;
if (!lakka)
return;
2014-07-13 23:08:27 +02:00
GLfloat color[] = {
1.0f, 1.0f, 1.0f, lakka->global_alpha,
1.0f, 1.0f, 1.0f, lakka->global_alpha,
1.0f, 1.0f, 1.0f, lakka->global_alpha,
1.0f, 1.0f, 1.0f, lakka->global_alpha,
};
if (alpha > lakka->global_alpha)
alpha = lakka->global_alpha;
GLfloat black_color[] = {
0.0f, 0.0f, 0.0f, alpha,
0.0f, 0.0f, 0.0f, alpha,
0.0f, 0.0f, 0.0f, alpha,
0.0f, 0.0f, 0.0f, alpha,
};
gl = (gl_t*)driver_video_resolve(NULL);
2014-06-06 03:59:35 +02:00
if (!gl)
return;
glViewport(0, 0, gl->win_width, gl->win_height);
2014-09-30 16:19:22 +02:00
struct gl_coords coords;
coords.vertices = 4;
coords.vertex = lakka_vertex;
coords.tex_coord = lakka_tex_coord;
coords.lut_tex_coord = lakka_tex_coord;
if ((g_settings.menu.pause_libretro
|| !g_extern.main_is_init || g_extern.libretro_dummy)
&& !force_transparency
&& lakka->textures[TEXTURE_BG].id)
{
coords.color = color;
glBindTexture(GL_TEXTURE_2D, lakka->textures[TEXTURE_BG].id);
}
else
{
coords.color = black_color;
glBindTexture(GL_TEXTURE_2D, 0);
}
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
gl->shader->set_coords(&coords);
gl->shader->set_mvp(gl, &gl->mvp_no_rot);
2014-09-30 08:08:19 +02:00
glEnable(GL_BLEND);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_BLEND);
gl->coords.color = gl->white_color_ptr;
}
2014-10-10 18:20:52 +02:00
static void lakka_draw_icon(lakka_handle_t *lakka,
GLuint texture, float x, float y,
2014-10-14 22:37:01 +02:00
float alpha, float rotation,
float scale_factor)
{
2014-10-10 18:20:52 +02:00
struct gl_coords coords;
2014-10-14 22:37:01 +02:00
math_matrix mymat, mrot;
2014-10-10 18:20:52 +02:00
if (!lakka)
return;
if (alpha > lakka->global_alpha)
alpha = lakka->global_alpha;
2014-07-24 14:00:56 +02:00
if (alpha == 0)
return;
gl_t *gl = (gl_t*)driver_video_resolve(NULL);
if (!gl)
return;
2014-10-10 18:20:52 +02:00
if (x < -lakka->icon_size || x > gl->win_width + lakka->icon_size
|| y < -lakka->icon_size || y > gl->win_height + lakka->icon_size)
return;
GLfloat color[] = {
1.0f, 1.0f, 1.0f, alpha,
1.0f, 1.0f, 1.0f, alpha,
1.0f, 1.0f, 1.0f, alpha,
1.0f, 1.0f, 1.0f, alpha,
};
2014-09-30 19:01:16 +02:00
if (gl->shader && gl->shader->use)
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
2014-10-10 18:20:52 +02:00
glViewport(x, gl->win_height - y, lakka->icon_size, lakka->icon_size);
2014-05-09 16:46:35 +02:00
2014-09-30 16:19:22 +02:00
coords.vertices = 4;
coords.vertex = lakka_vertex;
coords.tex_coord = lakka_tex_coord;
coords.lut_tex_coord = lakka_tex_coord;
2014-09-30 16:19:22 +02:00
coords.color = color;
glBindTexture(GL_TEXTURE_2D, texture);
matrix_rotate_z(&mrot, rotation);
matrix_multiply(&mymat, &mrot, &gl->mvp_no_rot);
math_matrix mscal;
2014-10-14 22:37:01 +02:00
matrix_scale(&mscal, scale_factor, scale_factor, 1);
matrix_multiply(&mymat, &mscal, &mymat);
gl->shader->set_coords(&coords);
gl->shader->set_mvp(gl, &mymat);
2014-09-30 08:08:19 +02:00
glEnable(GL_BLEND);
2014-09-30 15:16:47 +02:00
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_BLEND);
}
static void lakka_draw_arrow(lakka_handle_t *lakka)
2014-09-30 08:08:19 +02:00
{
if (lakka)
2014-10-10 18:20:52 +02:00
lakka_draw_icon(lakka, lakka->textures[TEXTURE_ARROW].id,
lakka->margin_left + lakka->hspacing * (lakka->menu_active_category+1) +
lakka->all_categories_x + lakka->icon_size / 2.0,
2014-10-10 18:20:52 +02:00
lakka->margin_top + lakka->vspacing * lakka->active_item_factor +
lakka->icon_size / 2.0, lakka->arrow_alpha, 0, lakka->i_active_zoom);
2014-09-30 08:08:19 +02:00
}
static void lakka_draw_subitems(lakka_handle_t *lakka, int i, int j)
2014-05-08 01:12:51 +07:00
{
int k;
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
menu_item_t *item = (menu_item_t*)&category->items[j];
menu_category_t *active_category = (menu_category_t*)
&lakka->categories[lakka->menu_active_category];
menu_item_t *active_item = (menu_item_t*)
&active_category->items[active_category->active_item];
for(k = 0; k < item->num_subitems; k++)
{
menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];
2014-06-05 20:09:40 +02:00
if (!subitem)
continue;
2014-09-10 10:58:02 +02:00
if (i && k == 0 && g_extern.main_is_init
&& !g_extern.libretro_dummy
&& strcmp(g_extern.fullpath, active_item->rom) == 0)
{
2014-10-10 18:20:52 +02:00
lakka_draw_icon(lakka, lakka->textures[TEXTURE_RESUME].id,
lakka->margin_left + lakka->hspacing * (i+1) + lakka->icon_size * 2 +
lakka->all_categories_x - lakka->icon_size / 2.0,
2014-10-10 18:20:52 +02:00
lakka->margin_top + subitem->y + lakka->icon_size/2.0,
subitem->alpha,
0,
subitem->zoom);
2014-10-10 18:20:52 +02:00
lakka_draw_text(lakka, "Resume",
lakka->margin_left + lakka->hspacing * (i+2.25) +
lakka->all_categories_x + lakka->label_margin_left,
lakka->margin_top + subitem->y + lakka->label_margin_top,
1,
subitem->alpha);
}
2014-09-11 00:09:53 +02:00
else if (k == 0 ||
lakka->menu_active_category == 0 ||
(g_extern.main_is_init &&
!g_extern.libretro_dummy &&
strcmp(g_extern.fullpath, active_item->rom) == 0))
2014-06-06 03:59:35 +02:00
{
2014-10-10 18:20:52 +02:00
lakka_draw_icon(lakka, subitem->icon,
lakka->margin_left + lakka->hspacing * (i+1) + lakka->icon_size * 2 +
lakka->all_categories_x - lakka->icon_size/2.0,
2014-10-10 18:20:52 +02:00
lakka->margin_top + subitem->y + lakka->icon_size/2.0,
subitem->alpha,
0,
subitem->zoom);
2014-10-03 15:31:08 +02:00
2014-10-10 18:20:52 +02:00
lakka_draw_text(lakka, subitem->name,
lakka->margin_left + lakka->hspacing * (i+2.25) +
lakka->all_categories_x + lakka->label_margin_left,
lakka->margin_top + subitem->y + lakka->label_margin_top,
1,
subitem->alpha);
2014-09-11 00:09:53 +02:00
if (i && (k == 1 || k == 2))
{
2014-10-10 18:20:52 +02:00
char slot[PATH_MAX];
2014-09-11 00:09:53 +02:00
if (g_settings.state_slot == -1)
snprintf(slot, sizeof(slot), "%d (auto)", g_settings.state_slot);
else
snprintf(slot, sizeof(slot), "%d", g_settings.state_slot);
2014-10-10 18:20:52 +02:00
lakka_draw_text(lakka, slot,
lakka->margin_left + lakka->hspacing * (i+2.25) +
lakka->all_categories_x + lakka->label_margin_left + lakka->setting_margin_left,
lakka->margin_top + subitem->y + lakka->label_margin_top,
2014-09-11 00:09:53 +02:00
1,
subitem->alpha);
}
}
2014-06-06 05:35:05 +02:00
if (subitem->setting)
{
char val[PATH_MAX];
setting_data_get_string_representation(subitem->setting, val,
sizeof(val));
2014-10-10 18:20:52 +02:00
lakka_draw_text(lakka, val,
lakka->margin_left + lakka->hspacing * (i+2.25) +
lakka->all_categories_x + lakka->label_margin_left + lakka->setting_margin_left,
lakka->margin_top + subitem->y + lakka->label_margin_top,
1,
subitem->alpha);
}
}
}
static void lakka_draw_items(lakka_handle_t *lakka, int i)
{
int j;
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
menu_category_t *active_category = (menu_category_t*)
&lakka->categories[lakka->menu_active_category];
menu_item_t *active_item = (menu_item_t*)
&active_category->items[active_category->active_item];
2014-09-10 04:53:07 +02:00
(void)active_item;
if (!lakka)
return;
for(j = 0; j < category->num_items; j++)
{
menu_item_t *item = (menu_item_t*)&category->items[j];
2014-05-27 02:02:39 +02:00
2014-06-05 20:09:40 +02:00
if (!item)
continue;
if ((i >= (lakka->menu_active_category - 1)) &&
(i <= (lakka->menu_active_category + 1))) /* performance improvement */
{
2014-10-10 18:20:52 +02:00
lakka_draw_icon(lakka, category->item_icon,
lakka->margin_left + lakka->hspacing * (i+1) +
lakka->all_categories_x - lakka->icon_size / 2.0,
2014-10-10 18:20:52 +02:00
lakka->margin_top + item->y + lakka->icon_size / 2.0,
2014-05-27 03:06:58 +02:00
item->alpha,
2014-05-08 01:12:51 +07:00
0,
2014-05-27 03:06:58 +02:00
item->zoom);
2014-05-08 01:12:51 +07:00
if (lakka->depth == 0)
2014-10-10 18:20:52 +02:00
lakka_draw_text(lakka, item->name,
lakka->margin_left + lakka->hspacing * (i+1) +
lakka->all_categories_x + lakka->label_margin_left,
lakka->margin_top + item->y + lakka->label_margin_top,
1,
item->alpha);
}
2014-05-08 01:12:51 +07:00
/* performance improvement */
if (i == lakka->menu_active_category && j == category->active_item)
lakka_draw_subitems(lakka, i, j);
}
}
static void lakka_draw_categories(lakka_handle_t *lakka)
{
int i;
if (!lakka)
return;
for(i = 0; i < lakka->num_categories; i++)
{
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
2014-06-05 20:09:40 +02:00
if (!category)
continue;
/* draw items */
lakka_draw_items(lakka, i);
/* draw category icon */
2014-10-10 18:20:52 +02:00
lakka_draw_icon(lakka, category->icon,
lakka->margin_left + (lakka->hspacing * (i+1)) +
lakka->all_categories_x - lakka->icon_size/2.0,
2014-10-10 18:20:52 +02:00
lakka->margin_top + lakka->icon_size/2.0,
2014-05-27 02:02:39 +02:00
category->alpha,
2014-05-09 16:46:35 +02:00
0,
2014-05-27 02:02:39 +02:00
category->zoom);
}
}
#if defined(HAVE_FBO) && defined(LAKKA_EFFECTS)
2014-09-30 08:08:19 +02:00
2014-10-01 16:27:36 +02:00
static void lakka_check_fb_status(void)
2014-09-30 08:08:19 +02:00
{
GLenum status;
2014-09-30 18:12:37 +02:00
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
2014-09-30 08:08:19 +02:00
switch(status) {
case GL_FRAMEBUFFER_COMPLETE:
break;
case GL_FRAMEBUFFER_UNSUPPORTED:
break;
default:
fputs("Framebuffer Error\n", stderr);
exit(-1);
}
}
static void lakka_fbo_reset(lakka_handle_t *lakka)
2014-09-30 08:08:19 +02:00
{
gl_t *gl = (gl_t*)driver_video_resolve(NULL);
if (!gl)
return;
glGenFramebuffers(1, &lakka->fbo);
glGenTextures(1, &lakka->fbo_color);
2014-10-13 00:21:23 +02:00
glGenRenderbuffers(1, &lakka->fbo_depth);
2014-09-30 08:08:19 +02:00
glBindFramebuffer(GL_FRAMEBUFFER, lakka->fbo);
2014-09-30 08:08:19 +02:00
glBindTexture(GL_TEXTURE_2D, lakka->fbo_color);
2014-09-30 08:08:19 +02:00
glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA,
gl->win_width, gl->win_height,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, lakka->fbo_color, 0);
2014-09-30 08:08:19 +02:00
glBindRenderbuffer(GL_RENDERBUFFER, lakka->fbo_depth);
2014-09-30 18:12:37 +02:00
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, gl->win_width, gl->win_height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, lakka->fbo_depth);
2014-09-30 08:08:19 +02:00
lakka_check_fb_status();
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
2014-10-13 00:21:23 +02:00
static void lakka_draw_fbo(lakka_handle_t *lakka)
2014-09-30 08:08:19 +02:00
{
gl_t *gl = (gl_t*)driver_video_resolve(NULL);
if (!gl)
return;
2014-09-30 16:19:22 +02:00
struct gl_coords coords;
coords.vertices = 4;
coords.vertex = lakka_vertex;
coords.tex_coord = lakka_vertex;
2014-09-30 16:19:22 +02:00
coords.color = gl->white_color_ptr;
glBindTexture(GL_TEXTURE_2D, lakka->fbo_color);
2014-09-30 08:08:19 +02:00
math_matrix mymat;
math_matrix mrot;
matrix_rotate_z(&mrot, 0);
matrix_multiply(&mymat, &mrot, &gl->mvp_no_rot);
math_matrix mscal;
matrix_scale(&mscal, lakka->global_scale, lakka->global_scale, 1);
2014-09-30 08:08:19 +02:00
matrix_multiply(&mymat, &mscal, &mymat);
gl->shader->set_coords(&coords);
gl->shader->set_mvp(gl, &mymat);
2014-09-30 08:08:19 +02:00
glEnable(GL_BLEND);
// shadow
glViewport(2, -2, gl->win_width, gl->win_height);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glViewport(0, 0, gl->win_width, gl->win_height);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_BLEND);
}
#endif
static void lakka_frame(void)
{
menu_item_t *active_item = NULL;
menu_category_t *active_category = NULL;
lakka_handle_t *lakka = NULL;
gl_t *gl = (gl_t*)driver_video_resolve(NULL);
if (!gl)
return;
if (!driver.menu)
return;
lakka = (lakka_handle_t*)driver.menu->userdata;
if (!lakka)
return;
active_category = (menu_category_t*)
&lakka->categories[lakka->menu_active_category];
if (!active_category)
return;
active_item = (menu_item_t*)
&active_category->items[active_category->active_item];
2014-06-03 16:32:00 +02:00
update_tweens(0.002);
#if defined(HAVE_FBO) && defined(LAKKA_EFFECTS)
2014-10-13 00:21:23 +02:00
glBindFramebuffer(GL_FRAMEBUFFER, lakka->fbo);
2014-09-30 08:08:19 +02:00
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
lakka_draw_categories(lakka);
lakka_draw_arrow(lakka);
2014-09-30 08:08:19 +02:00
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, gl->win_width, gl->win_height);
lakka_draw_background(false);
2014-10-13 00:21:23 +02:00
lakka_draw_fbo(lakka);
2014-09-30 08:08:19 +02:00
#else
glViewport(0, 0, gl->win_width, gl->win_height);
lakka_draw_background(false);
lakka_draw_categories(lakka);
lakka_draw_arrow(lakka);
2014-09-30 08:08:19 +02:00
#endif
if (lakka->depth == 0)
2014-10-10 18:20:52 +02:00
lakka_draw_text(lakka, active_category->name,
lakka->title_margin_left, lakka->title_margin_top, 1, 1.0);
else if (active_item)
2014-10-10 18:20:52 +02:00
lakka_draw_text(lakka, active_item->name,
lakka->title_margin_left, lakka->title_margin_top, 1, 1.0);
2014-06-06 03:59:35 +02:00
2014-05-08 01:12:51 +07:00
gl_set_viewport(gl, gl->win_width, gl->win_height, false, false);
2014-09-30 08:08:19 +02:00
glDisable(GL_BLEND);
2014-05-08 01:12:51 +07:00
}
static GLuint lakka_png_texture_load_(const char * file_name)
{
if (! path_file_exists(file_name))
return 0;
2014-09-06 14:09:07 -03:00
struct texture_image ti = {0};
texture_image_load(&ti, file_name);
/* Generate the OpenGL texture object */
2014-09-12 17:26:15 -03:00
GLuint texture = 0;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ti.width, ti.height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, ti.pixels);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glGenerateMipmap(GL_TEXTURE_2D);
2014-09-06 14:28:53 -03:00
free(ti.pixels);
return texture;
}
2014-10-21 05:33:58 +02:00
static int lakka_png_texture_load_wrap(void *data)
{
2014-10-21 05:33:58 +02:00
const char *filename = (const char*)data;
return lakka_png_texture_load_(filename);
}
static GLuint lakka_png_texture_load(const char* file_name)
{
if (g_settings.video.threaded
&& !g_extern.system.hw_render_callback.context_type)
{
thread_video_t *thr = (thread_video_t*)driver.video_data;
thr->cmd_data.custom_command.method = lakka_png_texture_load_wrap;
thr->cmd_data.custom_command.data = (void*)file_name;
thr->send_cmd_func(thr, CMD_CUSTOM_COMMAND);
thr->wait_reply_func(thr, CMD_CUSTOM_COMMAND);
return thr->cmd_data.custom_command.return_value;
}
return lakka_png_texture_load_(file_name);
}
static void lakka_context_destroy(void *data)
{
int i, j, k;
menu_handle_t *menu = NULL;
lakka_handle_t *lakka = NULL;
menu = (menu_handle_t*)data;
if (!menu)
return;
lakka = (lakka_handle_t*)menu->userdata;
if (!lakka)
return;
2014-09-10 04:53:07 +02:00
#if defined(HAVE_FBO) && defined(LAKKA_EFFECTS)
2014-10-13 00:21:23 +02:00
glDeleteFramebuffers(1, &lakka->fbo);
glDeleteTextures(1, &lakka->fbo_color);
glDeleteTextures(1, &lakka->fbo_depth);
2014-09-30 08:08:19 +02:00
#endif
2014-06-06 06:22:16 +02:00
for (i = 0; i < TEXTURE_LAST; i++)
glDeleteTextures(1, &lakka->textures[i].id);
for (i = 1; i < lakka->num_categories; i++)
{
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
if (!category)
continue;
glDeleteTextures(1, &category->icon);
glDeleteTextures(1, &category->item_icon);
for (j = 0; j < category->num_items; j++)
{
menu_item_t *item;
menu_subitem_t *subitem;
item = (menu_item_t*)&category->items[j];
if (!item)
continue;
for (k = 0; k < item->num_subitems; k++ )
{
subitem = (menu_subitem_t*)&item->subitems[k];
if (subitem)
glDeleteTextures(1, &subitem->icon);
}
}
}
}
static bool lakka_init_settings(menu_handle_t *menu)
{
2014-10-21 00:23:25 +02:00
int k, jj = 0, kk;
lakka_handle_t *lakka = NULL;
menu_category_t *category = NULL;
rarch_setting_t *setting_data = (rarch_setting_t*)menu->list_settings;
lakka = (lakka_handle_t*)menu->userdata;
if (!lakka)
return false;
category = (menu_category_t*)&lakka->categories[0];
if (!setting_data || !category)
return false;
strlcpy(category->name, "Settings", sizeof(category->name));
2014-10-10 17:50:55 +02:00
category->alpha = lakka->c_active_alpha;
category->zoom = lakka->c_active_zoom;
category->active_item = 0;
category->num_items = 0;
category->items = (menu_item_t*)
calloc(category->num_items, sizeof(menu_item_t));
rarch_setting_t *group = (rarch_setting_t*)setting_data_find_setting(driver.menu->list_settings,
"Driver Options");
2014-06-02 16:34:17 +02:00
for (; group->type != ST_NONE; group++)
{
if (group->type != ST_GROUP)
continue;
category->num_items++;
category->items = (menu_item_t*)
realloc(category->items, category->num_items * sizeof(menu_item_t));
if (!category->items)
return false;
menu_item_t *item = (menu_item_t*)&category->items[jj];
if (!item)
return false;
strlcpy(item->name, group->name, sizeof(item->name));
2014-10-10 17:50:55 +02:00
item->alpha = jj ? lakka->i_passive_alpha : lakka->i_active_alpha;
item->zoom = jj ? lakka->i_passive_zoom : lakka->i_active_zoom;
item->y = jj ?
2014-10-10 18:20:52 +02:00
lakka->vspacing * (lakka->under_item_offset + jj)
: lakka->vspacing * lakka->active_item_factor;
item->active_subitem = 0;
item->num_subitems = 0;
item->subitems = NULL;
kk = 0;
for (k = 0; k <= 512; k++)
2014-09-09 00:08:25 +02:00
{
rarch_setting_t *setting = (rarch_setting_t*)&setting_data[k];
2014-06-02 16:34:17 +02:00
if (setting
&& setting->type != ST_SUB_GROUP
&& setting->group == group->name)
{
item->num_subitems++;
item->subitems = (menu_subitem_t*)
realloc(item->subitems,
item->num_subitems * sizeof(menu_subitem_t));
2014-06-02 16:34:17 +02:00
menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[kk];
2014-06-02 16:34:17 +02:00
strlcpy(subitem->name, setting->short_description,
sizeof(subitem->name));
subitem->alpha = 0.0;
2014-10-10 17:50:55 +02:00
subitem->zoom = kk ? lakka->i_passive_zoom : lakka->i_active_zoom;
2014-10-10 18:20:52 +02:00
subitem->y = kk ? lakka->vspacing * (kk + lakka->under_item_offset)
: lakka->vspacing * lakka->active_item_factor;
2014-06-02 16:34:17 +02:00
subitem->setting = (rarch_setting_t*)&setting_data[k];
kk++;
2014-09-09 00:08:25 +02:00
}
}
2014-10-09 01:32:56 +01:00
jj++;
2014-09-09 00:08:25 +02:00
}
2014-06-02 16:34:17 +02:00
category->num_items++;
category->items = (menu_item_t*)
realloc(category->items, category->num_items * sizeof(menu_item_t));
2014-06-02 16:34:17 +02:00
2014-09-09 00:08:25 +02:00
menu_item_t *itemq = (menu_item_t*)&category->items[jj];
2014-06-02 16:34:17 +02:00
if (!itemq)
return false;
2014-09-09 00:08:25 +02:00
strlcpy(itemq->name, "Quit RetroArch", sizeof(itemq->name));
2014-10-10 17:50:55 +02:00
itemq->alpha = jj ? lakka->i_passive_alpha : lakka->i_active_alpha;
itemq->zoom = jj ? lakka->i_passive_zoom : lakka->i_active_zoom;
2014-10-10 18:20:52 +02:00
itemq->y = jj ? lakka->vspacing * (lakka->under_item_offset + jj) :
lakka->vspacing * lakka->active_item_factor;
2014-09-09 00:08:25 +02:00
itemq->active_subitem = 0;
itemq->num_subitems = 0;
return true;
2014-06-02 16:34:17 +02:00
}
static void lakka_settings_context_reset(void)
2014-06-02 16:34:17 +02:00
{
2014-09-09 00:08:25 +02:00
int j, k;
lakka_handle_t *lakka = NULL;
menu_item_t *item = NULL;
menu_category_t *category = NULL;
if (!driver.menu)
return;
lakka = (lakka_handle_t*)driver.menu->userdata;
if (!lakka)
return;
category = (menu_category_t*)&lakka->categories[0];
2014-06-05 21:31:29 +02:00
if (!category)
return;
category->icon = lakka->textures[TEXTURE_SETTINGS].id;
category->item_icon = lakka->textures[TEXTURE_SETTING].id;
2014-06-02 16:34:17 +02:00
2014-09-09 00:08:25 +02:00
for (j = 0; j < category->num_items; j++)
2014-06-06 05:35:05 +02:00
{
2014-09-09 00:08:25 +02:00
item = (menu_item_t*)&category->items[j];
2014-06-02 16:34:17 +02:00
2014-09-09 00:08:25 +02:00
for (k = 0; k < item->num_subitems; k++)
{
menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];
subitem->icon = lakka->textures[TEXTURE_SUBSETTING].id;
2014-09-09 00:08:25 +02:00
}
}
}
static void lakka_context_reset(void *data)
2014-05-08 01:12:51 +07:00
{
int i, j, k;
char mediapath[PATH_MAX], themepath[PATH_MAX], iconpath[PATH_MAX];
lakka_handle_t *lakka = NULL;
menu_handle_t *menu = (menu_handle_t*)data;
if (!menu)
2014-05-08 01:12:51 +07:00
return;
lakka = (lakka_handle_t*)menu->userdata;
if (!lakka)
return;
#if defined(HAVE_FBO) && defined(LAKKA_EFFECTS)
lakka_fbo_reset(lakka);
2014-09-30 08:08:19 +02:00
#endif
driver.gfx_use_rgba = true;
fill_pathname_join(mediapath, g_settings.assets_directory,
"lakka", sizeof(mediapath));
2014-07-20 19:56:41 +02:00
fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath));
2014-10-10 18:20:52 +02:00
fill_pathname_join(iconpath, themepath, lakka->icon_dir, sizeof(iconpath));
2014-08-01 15:11:23 +02:00
fill_pathname_slash(iconpath, sizeof(iconpath));
2014-07-18 06:57:24 +02:00
fill_pathname_join(lakka->textures[TEXTURE_BG].path, iconpath,
"bg.png", sizeof(lakka->textures[TEXTURE_BG].path));
fill_pathname_join(lakka->textures[TEXTURE_SETTINGS].path, iconpath,
"settings.png", sizeof(lakka->textures[TEXTURE_SETTINGS].path));
fill_pathname_join(lakka->textures[TEXTURE_SETTING].path, iconpath,
"setting.png", sizeof(lakka->textures[TEXTURE_SETTING].path));
fill_pathname_join(lakka->textures[TEXTURE_SUBSETTING].path, iconpath,
"subsetting.png", sizeof(lakka->textures[TEXTURE_SUBSETTING].path));
fill_pathname_join(lakka->textures[TEXTURE_ARROW].path, iconpath,
"arrow.png", sizeof(lakka->textures[TEXTURE_ARROW].path));
fill_pathname_join(lakka->textures[TEXTURE_RUN].path, iconpath,
"run.png", sizeof(lakka->textures[TEXTURE_RUN].path));
fill_pathname_join(lakka->textures[TEXTURE_RESUME].path, iconpath,
"resume.png", sizeof(lakka->textures[TEXTURE_RESUME].path));
fill_pathname_join(lakka->textures[TEXTURE_SAVESTATE].path, iconpath,
"savestate.png", sizeof(lakka->textures[TEXTURE_SAVESTATE].path));
fill_pathname_join(lakka->textures[TEXTURE_LOADSTATE].path, iconpath,
"loadstate.png", sizeof(lakka->textures[TEXTURE_LOADSTATE].path));
fill_pathname_join(lakka->textures[TEXTURE_SCREENSHOT].path, iconpath,
"screenshot.png", sizeof(lakka->textures[TEXTURE_SCREENSHOT].path));
fill_pathname_join(lakka->textures[TEXTURE_RELOAD].path, iconpath,
"reload.png", sizeof(lakka->textures[TEXTURE_RELOAD].path));
for (k = 0; k < TEXTURE_LAST; k++)
lakka->textures[k].id = lakka_png_texture_load(lakka->textures[k].path);
2014-05-08 01:12:51 +07:00
2014-06-02 16:34:17 +02:00
lakka_settings_context_reset();
for (i = 1; i < lakka->num_categories; i++)
2014-06-01 01:08:39 +02:00
{
2014-10-14 19:43:29 +02:00
char core_id[PATH_MAX], texturepath[PATH_MAX], content_texturepath[PATH_MAX];
2014-10-10 17:50:55 +02:00
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
core_info_t *info = NULL;
core_info_list_t *info_list = NULL;
2014-06-01 01:08:39 +02:00
fill_pathname_join(mediapath, g_settings.assets_directory,
"lakka", sizeof(mediapath));
2014-07-20 19:56:41 +02:00
fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath));
2014-10-10 18:20:52 +02:00
fill_pathname_join(iconpath, themepath, lakka->icon_dir, sizeof(iconpath));
2014-08-01 15:11:23 +02:00
fill_pathname_slash(iconpath, sizeof(iconpath));
2014-06-01 01:08:39 +02:00
info_list = (core_info_list_t*)g_extern.core_info;
info = NULL;
2014-06-01 01:08:39 +02:00
if (info_list)
info = (core_info_t*)&info_list->list[i-1];
2014-06-01 01:08:39 +02:00
2014-10-10 17:50:55 +02:00
if (info && info->systemname)
{
2014-09-06 14:28:53 -03:00
char *tmp = str_replace(info->systemname, "/", " ");
strlcpy(core_id, tmp, sizeof(core_id));
free(tmp);
}
else
strlcpy(core_id, "default", sizeof(core_id));
2014-08-01 15:11:23 +02:00
strlcpy(texturepath, iconpath, sizeof(texturepath));
strlcat(texturepath, core_id, sizeof(texturepath));
strlcat(texturepath, ".png", sizeof(texturepath));
2014-08-01 15:11:23 +02:00
strlcpy(content_texturepath, iconpath, sizeof(content_texturepath));
strlcat(content_texturepath, core_id, sizeof(content_texturepath));
strlcat(content_texturepath, "-content.png", sizeof(content_texturepath));
2014-06-01 01:08:39 +02:00
category->icon = lakka_png_texture_load(texturepath);
category->item_icon = lakka_png_texture_load(content_texturepath);
for (j = 0; j < category->num_items; j++)
{
menu_item_t *item = (menu_item_t*)&category->items[j];
2014-06-01 01:08:39 +02:00
for (k = 0; k < item->num_subitems; k++)
2014-06-01 01:08:39 +02:00
{
menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];
switch (k)
{
2014-06-05 21:31:29 +02:00
case 0:
subitem->icon = lakka->textures[TEXTURE_RUN].id;
2014-06-05 21:31:29 +02:00
break;
case 1:
subitem->icon = lakka->textures[TEXTURE_SAVESTATE].id;
2014-06-05 21:31:29 +02:00
break;
case 2:
subitem->icon = lakka->textures[TEXTURE_LOADSTATE].id;
2014-06-05 21:31:29 +02:00
break;
case 3:
subitem->icon = lakka->textures[TEXTURE_SCREENSHOT].id;
2014-06-05 21:31:29 +02:00
break;
case 4:
subitem->icon = lakka->textures[TEXTURE_RELOAD].id;
2014-06-05 21:31:29 +02:00
break;
}
2014-06-01 01:08:39 +02:00
}
}
}
2014-05-08 01:12:51 +07:00
}
2014-10-10 17:50:55 +02:00
static void lakka_init_subitems(lakka_handle_t *lakka, menu_item_t *item)
{
int k;
for (k = 0; k < item->num_subitems; k++)
{
menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];
if (!subitem)
continue;
switch (k)
{
case 0:
strlcpy(subitem->name, "Run", sizeof(subitem->name));
break;
case 1:
strlcpy(subitem->name, "Save State", sizeof(subitem->name));
break;
case 2:
strlcpy(subitem->name, "Load State", sizeof(subitem->name));
break;
case 3:
strlcpy(subitem->name, "Take Screenshot", sizeof(subitem->name));
break;
case 4:
strlcpy(subitem->name, "Reset", sizeof(subitem->name));
break;
}
subitem->alpha = 0;
2014-10-10 17:50:55 +02:00
subitem->zoom = k ? lakka->i_passive_zoom : lakka->i_active_zoom;
2014-10-10 18:20:52 +02:00
subitem->y = k ? lakka->vspacing * (k + lakka->under_item_offset) :
lakka->vspacing * lakka->active_item_factor;
}
}
2014-10-10 17:50:55 +02:00
static void lakka_init_item(lakka_handle_t *lakka,
int i, int j, menu_category_t *category,
core_info_t *info, struct string_list *list, const char * name)
{
2014-10-10 17:50:55 +02:00
menu_item_t *item = NULL;
int n = category->num_items;
category->num_items++;
category->items = (menu_item_t*)realloc(category->items,
category->num_items * sizeof(menu_item_t));
item = (menu_item_t*)&category->items[n];
strlcpy(item->name, name, sizeof(item->name));
if (list != NULL)
strlcpy(item->rom, list->elems[j].data, sizeof(item->rom));
item->alpha = (i != lakka->menu_active_category) ? 0 :
2014-10-10 17:50:55 +02:00
n ? lakka->i_passive_alpha : lakka->i_active_alpha;
item->zoom = n ? lakka->i_passive_zoom : lakka->i_active_zoom;
2014-10-10 18:20:52 +02:00
item->y = n ? (lakka->vspacing * (lakka->under_item_offset + n)) :
(lakka->vspacing * lakka->active_item_factor);
item->active_subitem = 0;
item->num_subitems = 5;
item->subitems = (menu_subitem_t*)
calloc(item->num_subitems, sizeof(menu_subitem_t));
2014-10-10 17:50:55 +02:00
lakka_init_subitems(lakka, item);
}
2014-10-10 17:50:55 +02:00
static void lakka_init_items(lakka_handle_t *lakka,
int i, menu_category_t *category,
core_info_t *info, const char* path)
2014-05-08 01:12:51 +07:00
{
int num_items, j;
2014-10-10 17:50:55 +02:00
struct string_list *list = NULL;
if (category == NULL || info == NULL)
return;
list = (struct string_list*)dir_list_new(path, info->supported_extensions, true);
2014-05-08 01:12:51 +07:00
dir_list_sort(list, true);
2014-05-09 16:46:35 +02:00
num_items = list ? list->size : 0;
2014-05-09 16:46:35 +02:00
for (j = 0; j < num_items; j++)
{
if (list->elems[j].attr.i == RARCH_DIRECTORY) // is a directory
2014-10-10 17:50:55 +02:00
lakka_init_items(lakka, i, category, info, list->elems[j].data);
2014-05-08 01:12:51 +07:00
else
{
2014-10-10 17:50:55 +02:00
lakka_init_item(lakka, i, j, category, info, list,
path_basename(list->elems[j].data));
2014-05-08 01:12:51 +07:00
}
}
2014-09-06 22:56:30 -03:00
string_list_free(list);
}
2014-10-10 16:55:36 +02:00
static void lakka_free_userdata(void *data)
{
lakka_handle_t *lakka = (lakka_handle_t*)data;
if (!lakka)
return;
if (lakka->categories)
free(lakka->categories);
free(lakka);
}
2014-05-09 21:04:59 +02:00
static void lakka_free(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
2014-05-10 06:21:03 +02:00
if (menu->alloc_font)
free((uint8_t*)menu->font);
2014-09-06 14:28:53 -03:00
if (menu->userdata)
2014-10-10 16:55:36 +02:00
lakka_free_userdata(menu->userdata);
2014-09-06 14:28:53 -03:00
if (g_extern.core_info)
core_info_list_free(g_extern.core_info);
g_extern.core_info = NULL;
2014-05-09 21:04:59 +02:00
}
static int lakka_input_postprocess(retro_input_t state,
retro_input_t old_state)
2014-05-09 21:04:59 +02:00
{
lakka_handle_t *lakka = NULL;
if (!driver.menu)
return 0;
lakka = (lakka_handle_t*)driver.menu->userdata;
if (!lakka)
return 0;
2014-05-09 21:04:59 +02:00
if (lakka->global_alpha == 0.0f)
add_tween(LAKKA_DELAY, 1.0f, &lakka->global_alpha, &inOutQuad, NULL);
if (lakka->global_scale == 2.0f)
add_tween(LAKKA_DELAY, 1.0f, &lakka->global_scale, &inQuad, NULL);
return 0;
2014-05-09 21:04:59 +02:00
}
static void lakka_init_core_info(void *data)
{
(void)data;
2014-05-09 21:04:59 +02:00
2014-09-06 15:05:50 +02:00
core_info_list_free(g_extern.core_info);
g_extern.core_info = NULL;
if (*g_settings.libretro_directory)
2014-09-06 15:05:50 +02:00
g_extern.core_info = core_info_list_new(g_settings.libretro_directory);
2014-05-09 21:04:59 +02:00
}
2014-05-08 01:12:51 +07:00
static void *lakka_init(void)
{
menu_handle_t *menu = NULL;
lakka_handle_t *lakka = NULL;
const video_driver_t *video_driver = NULL;
gl_t *gl = (gl_t*)driver_video_resolve(&video_driver);
if (video_driver != &video_gl || !gl)
{
RARCH_ERR("Cannot initialize Lakka menu driver: gl video driver is not active.\n");
return NULL;
}
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu)
return NULL;
menu->userdata = (lakka_handle_t*)calloc(1, sizeof(lakka_handle_t));
if (!menu->userdata)
{
free(menu);
return NULL;
}
lakka_init_core_info(menu);
lakka = (lakka_handle_t*)menu->userdata;
lakka->num_categories = g_extern.core_info ? (g_extern.core_info->count + 1) : 1;
lakka->categories = (menu_category_t*)
calloc(lakka->num_categories, sizeof(menu_category_t));
if (!lakka->categories)
{
free(menu->userdata);
free(menu);
return NULL;
}
2014-10-10 17:50:55 +02:00
lakka->c_active_zoom = 1.0;
lakka->c_passive_zoom = 0.5;
lakka->i_active_zoom = 1.0;
lakka->i_passive_zoom = 0.5;
lakka->c_active_alpha = 1.0;
lakka->c_passive_alpha = 0.5;
lakka->i_active_alpha = 1.0;
lakka->i_passive_alpha = 0.5;
2014-10-10 18:10:13 +02:00
lakka->above_subitem_offset = 1.5;
lakka->above_item_offset = -1.0;
2014-10-18 14:51:50 +02:00
lakka->active_item_factor = 3.0;
lakka->under_item_offset = 5.0;
2014-10-10 17:50:55 +02:00
float scale_factor = 1;
if (gl->win_width >= 3840) scale_factor = 2.0;
else if (gl->win_width >= 2560) scale_factor = 1.5;
else if (gl->win_width >= 1920) scale_factor = 1.0;
else if (gl->win_width >= 1280) scale_factor = 0.75;
else if (gl->win_width >= 640) scale_factor = 0.5;
else if (gl->win_width >= 320) scale_factor = 0.25;
strlcpy(lakka->icon_dir, "256", sizeof(lakka->icon_dir));
2014-10-10 17:50:55 +02:00
lakka->icon_size = 128.0 * scale_factor;
lakka->hspacing = 200.0 * scale_factor;
lakka->vspacing = 64.0 * scale_factor;
lakka->margin_left = 336.0 * scale_factor;
2014-10-18 14:51:50 +02:00
lakka->margin_top = (256+32) * scale_factor;
lakka->title_margin_left = 60 * scale_factor;
lakka->title_margin_top = 60 * scale_factor + g_settings.video.font_size/3;
lakka->label_margin_left = 85.0 * scale_factor;
lakka->label_margin_top = g_settings.video.font_size/3.0;
lakka->setting_margin_left = 600.0 * scale_factor;
lakka->depth = 0;
lakka->menu_active_category = 0;
lakka->all_categories_x = 0;
lakka->global_alpha = 0.0f;
lakka->global_scale = 2.0f;
lakka->arrow_alpha = 0;
lakka->fbo_depth = 0;
return menu;
}
static bool lakka_init_lists(void *data)
{
int i;
menu_handle_t *menu = (menu_handle_t*)data;
lakka_handle_t *lakka = NULL;
if (!menu)
return false;
lakka = (lakka_handle_t*)menu->userdata;
if (!lakka)
return false;
if (!lakka_init_settings(menu))
return false;
2014-06-02 16:34:17 +02:00
for (i = 1; i < lakka->num_categories; i++)
2014-05-09 16:46:35 +02:00
{
core_info_t *info = NULL;
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
core_info_list_t *info_list = (core_info_list_t*)g_extern.core_info;
2014-05-31 21:17:08 +02:00
if (info_list)
info = (core_info_t*)&info_list->list[i-1];
if (!info)
return false;
2014-05-27 06:27:31 +02:00
strlcpy(category->name, info->display_name, sizeof(category->name));
strlcpy(category->libretro, info->path, sizeof(category->libretro));
2014-10-10 17:50:55 +02:00
category->alpha = lakka->i_passive_alpha;
category->zoom = lakka->c_passive_zoom;
2014-05-27 02:02:39 +02:00
category->active_item = 0;
category->num_items = 0;
category->items = (menu_item_t*)
2014-09-06 22:37:33 -03:00
calloc(category->num_items + 1, sizeof(menu_item_t));
2014-05-09 16:46:35 +02:00
if (! info->supports_no_game)
2014-10-10 17:50:55 +02:00
lakka_init_items(lakka, i, category, info, g_settings.content_directory);
else
2014-10-10 17:50:55 +02:00
lakka_init_item(lakka, i, 0, category, info, NULL,
info->display_name);
}
return true;
}
2014-09-11 07:06:20 +02:00
menu_ctx_driver_t menu_ctx_lakka = {
2014-05-10 06:21:03 +02:00
NULL,
2014-05-08 01:12:51 +07:00
NULL,
NULL,
lakka_frame,
lakka_init,
lakka_init_lists,
lakka_free,
lakka_context_reset,
lakka_context_destroy,
NULL,
NULL,
lakka_input_postprocess,
2014-04-13 23:41:47 +02:00
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
2014-04-14 00:09:52 +02:00
NULL,
NULL,
NULL,
lakka_init_core_info,
2014-05-08 01:12:51 +07:00
&menu_ctx_backend_lakka,
"lakka",
};