2012-05-06 04:04:33 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 01:50:59 +01:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
|
|
|
* Copyright (C) 2012-2014 - Michael Lelli
|
2014-04-13 12:12:12 +02:00
|
|
|
*
|
2012-05-06 04:04:33 +02:00
|
|
|
* 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>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
|
|
|
|
2014-04-26 01:53:40 +02:00
|
|
|
#include "../backend/menu_common_backend.h"
|
2013-11-11 12:23:18 +01:00
|
|
|
#include "../menu_common.h"
|
|
|
|
#include "../../../general.h"
|
|
|
|
#include "../../../gfx/gfx_common.h"
|
|
|
|
#include "../../../config.def.h"
|
|
|
|
#include "../../../file.h"
|
|
|
|
#include "../../../dynamic.h"
|
|
|
|
#include "../../../compat/posix_string.h"
|
|
|
|
#include "../../../performance.h"
|
|
|
|
#include "../../../input/input_common.h"
|
2013-03-09 15:33:44 +01:00
|
|
|
|
2014-08-30 03:14:32 +02:00
|
|
|
#include "../../../settings_data.h"
|
2013-11-11 12:23:18 +01:00
|
|
|
#include "../../../screenshot.h"
|
|
|
|
#include "../../../gfx/fonts/bitmap.h"
|
2013-01-09 17:49:43 +01:00
|
|
|
|
2013-04-09 19:43:24 +02:00
|
|
|
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
|
|
|
#define HAVE_SHADER_MANAGER
|
|
|
|
#endif
|
|
|
|
|
2014-02-23 18:32:46 +01:00
|
|
|
#if defined(PSP)
|
|
|
|
static uint16_t __attribute((aligned(64))) menu_framebuf[400 * 240];
|
|
|
|
#else
|
2013-11-04 13:27:03 +01:00
|
|
|
static uint16_t menu_framebuf[400 * 240];
|
2014-02-23 18:32:46 +01:00
|
|
|
#endif
|
2013-04-07 16:45:05 +02:00
|
|
|
|
2014-02-28 01:34:10 +01:00
|
|
|
#define RGUI_TERM_START_X 15
|
|
|
|
#define RGUI_TERM_START_Y 27
|
2014-05-31 22:20:27 +02:00
|
|
|
#define RGUI_TERM_WIDTH (((driver.menu->width - RGUI_TERM_START_X - 15) / (FONT_WIDTH_STRIDE)))
|
|
|
|
#define RGUI_TERM_HEIGHT (((driver.menu->height - RGUI_TERM_START_Y - 15) / (FONT_HEIGHT_STRIDE)) - 1)
|
2013-05-04 16:56:02 +02:00
|
|
|
|
2013-11-04 13:27:03 +01:00
|
|
|
static void rgui_copy_glyph(uint8_t *glyph, const uint8_t *buf)
|
|
|
|
{
|
|
|
|
int y, x;
|
|
|
|
for (y = 0; y < FONT_HEIGHT; y++)
|
|
|
|
{
|
|
|
|
for (x = 0; x < FONT_WIDTH; x++)
|
|
|
|
{
|
|
|
|
uint32_t col =
|
|
|
|
((uint32_t)buf[3 * (-y * 256 + x) + 0] << 0) |
|
|
|
|
((uint32_t)buf[3 * (-y * 256 + x) + 1] << 8) |
|
|
|
|
((uint32_t)buf[3 * (-y * 256 + x) + 2] << 16);
|
|
|
|
|
|
|
|
uint8_t rem = 1 << ((x + y * FONT_WIDTH) & 7);
|
|
|
|
unsigned offset = (x + y * FONT_WIDTH) >> 3;
|
|
|
|
|
|
|
|
if (col != 0xff)
|
|
|
|
glyph[offset] |= rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint16_t gray_filler(unsigned x, unsigned y)
|
|
|
|
{
|
|
|
|
x >>= 1;
|
|
|
|
y >>= 1;
|
|
|
|
unsigned col = ((x + y) & 1) + 1;
|
2014-02-18 22:01:04 +01:00
|
|
|
#if defined(GEKKO) || defined(PSP)
|
2013-11-04 13:27:03 +01:00
|
|
|
return (6 << 12) | (col << 8) | (col << 4) | (col << 0);
|
|
|
|
#else
|
|
|
|
return (col << 13) | (col << 9) | (col << 5) | (12 << 0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint16_t green_filler(unsigned x, unsigned y)
|
|
|
|
{
|
|
|
|
x >>= 1;
|
|
|
|
y >>= 1;
|
|
|
|
unsigned col = ((x + y) & 1) + 1;
|
2014-02-18 22:01:04 +01:00
|
|
|
#if defined(GEKKO) || defined(PSP)
|
2013-11-04 13:27:03 +01:00
|
|
|
return (6 << 12) | (col << 8) | (col << 5) | (col << 0);
|
|
|
|
#else
|
|
|
|
return (col << 13) | (col << 10) | (col << 5) | (12 << 0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void fill_rect(uint16_t *buf, unsigned pitch,
|
|
|
|
unsigned x, unsigned y,
|
|
|
|
unsigned width, unsigned height,
|
|
|
|
uint16_t (*col)(unsigned x, unsigned y))
|
|
|
|
{
|
|
|
|
unsigned j, i;
|
|
|
|
for (j = y; j < y + height; j++)
|
|
|
|
for (i = x; i < x + width; i++)
|
|
|
|
buf[j * (pitch >> 1) + i] = col(i, j);
|
|
|
|
}
|
|
|
|
|
2014-05-30 21:51:12 +02:00
|
|
|
static void blit_line(int x, int y, const char *message, bool green)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
int j, i;
|
2014-05-30 21:51:12 +02:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
if (!driver.menu)
|
2014-05-30 21:51:12 +02:00
|
|
|
return;
|
|
|
|
|
2013-11-04 13:27:03 +01:00
|
|
|
while (*message)
|
|
|
|
{
|
|
|
|
for (j = 0; j < FONT_HEIGHT; j++)
|
|
|
|
{
|
|
|
|
for (i = 0; i < FONT_WIDTH; i++)
|
|
|
|
{
|
|
|
|
uint8_t rem = 1 << ((i + j * FONT_WIDTH) & 7);
|
|
|
|
int offset = (i + j * FONT_WIDTH) >> 3;
|
2014-05-31 22:20:27 +02:00
|
|
|
bool col = (driver.menu->font[FONT_OFFSET((unsigned char)*message) + offset] & rem);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
if (col)
|
|
|
|
{
|
2014-05-31 22:20:27 +02:00
|
|
|
driver.menu->frame_buf[(y + j) * (driver.menu->frame_buf_pitch >> 1) + (x + i)] = green ?
|
2014-02-18 22:01:04 +01:00
|
|
|
#if defined(GEKKO)|| defined(PSP)
|
2013-11-04 13:27:03 +01:00
|
|
|
(3 << 0) | (10 << 4) | (3 << 8) | (7 << 12) : 0x7FFF;
|
|
|
|
#else
|
|
|
|
(15 << 0) | (7 << 4) | (15 << 8) | (7 << 12) : 0xFFFF;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
x += FONT_WIDTH_STRIDE;
|
|
|
|
message++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
static void init_font(menu_handle_t *menu, const uint8_t *font_bmp_buf)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
uint8_t *font = (uint8_t *) calloc(1, FONT_OFFSET(256));
|
2014-06-10 02:06:10 +02:00
|
|
|
menu->alloc_font = true;
|
2013-11-04 13:27:03 +01:00
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
{
|
|
|
|
unsigned y = i / 16;
|
|
|
|
unsigned x = i % 16;
|
|
|
|
rgui_copy_glyph(&font[FONT_OFFSET(i)],
|
|
|
|
font_bmp_buf + 54 + 3 * (256 * (255 - 16 * y) + 16 * x));
|
|
|
|
}
|
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
menu->font = font;
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool rguidisp_init_font(void *data)
|
|
|
|
{
|
2014-06-10 02:06:10 +02:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
const uint8_t *font_bmp_buf = NULL;
|
|
|
|
const uint8_t *font_bin_buf = bitmap_bin;
|
|
|
|
|
|
|
|
if (font_bmp_buf)
|
2014-06-10 02:06:10 +02:00
|
|
|
init_font(menu, font_bmp_buf);
|
2013-11-04 13:27:03 +01:00
|
|
|
else if (font_bin_buf)
|
2014-06-10 02:06:10 +02:00
|
|
|
menu->font = font_bin_buf;
|
2013-11-04 13:27:03 +01:00
|
|
|
else
|
2014-08-27 04:02:32 +02:00
|
|
|
return false;
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-08-27 04:02:32 +02:00
|
|
|
return true;
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
|
2014-05-30 21:51:12 +02:00
|
|
|
static void rgui_render_background(void)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
2014-05-31 22:20:27 +02:00
|
|
|
if (!driver.menu)
|
2014-05-30 21:51:12 +02:00
|
|
|
return;
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
|
|
|
0, 0, driver.menu->width, driver.menu->height, gray_filler);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
|
|
|
5, 5, driver.menu->width - 10, 5, green_filler);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
|
|
|
5, driver.menu->height - 10, driver.menu->width - 10, 5, green_filler);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
|
|
|
5, 5, 5, driver.menu->height - 10, green_filler);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
|
|
|
driver.menu->width - 10, 5, 5, driver.menu->height - 10, green_filler);
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
|
2014-05-30 21:51:12 +02:00
|
|
|
static void rgui_render_messagebox(const char *message)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
if (!driver.menu || !message || !*message)
|
2013-11-04 13:27:03 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
struct string_list *list = string_split(message, "\n");
|
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
if (list->elems == 0)
|
|
|
|
{
|
|
|
|
string_list_free(list);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned width = 0;
|
|
|
|
unsigned glyphs_width = 0;
|
|
|
|
for (i = 0; i < list->size; i++)
|
|
|
|
{
|
|
|
|
char *msg = list->elems[i].data;
|
|
|
|
unsigned msglen = strlen(msg);
|
2014-02-28 01:34:10 +01:00
|
|
|
if (msglen > RGUI_TERM_WIDTH)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
2014-02-28 01:34:10 +01:00
|
|
|
msg[RGUI_TERM_WIDTH - 2] = '.';
|
|
|
|
msg[RGUI_TERM_WIDTH - 1] = '.';
|
|
|
|
msg[RGUI_TERM_WIDTH - 0] = '.';
|
|
|
|
msg[RGUI_TERM_WIDTH + 1] = '\0';
|
|
|
|
msglen = RGUI_TERM_WIDTH;
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned line_width = msglen * FONT_WIDTH_STRIDE - 1 + 6 + 10;
|
|
|
|
width = max(width, line_width);
|
|
|
|
glyphs_width = max(glyphs_width, msglen);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned height = FONT_HEIGHT_STRIDE * list->size + 6 + 10;
|
2014-05-31 22:20:27 +02:00
|
|
|
int x = (driver.menu->width - width) / 2;
|
|
|
|
int y = (driver.menu->height - height) / 2;
|
2014-04-13 12:12:12 +02:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
2013-11-04 13:27:03 +01:00
|
|
|
x + 5, y + 5, width - 10, height - 10, gray_filler);
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
2013-11-04 13:27:03 +01:00
|
|
|
x, y, width - 5, 5, green_filler);
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
2013-11-04 13:27:03 +01:00
|
|
|
x + width - 5, y, 5, height - 5, green_filler);
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
2013-11-04 13:27:03 +01:00
|
|
|
x + 5, y + height - 5, width - 5, 5, green_filler);
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch,
|
2013-11-04 13:27:03 +01:00
|
|
|
x, y + 5, 5, height - 5, green_filler);
|
|
|
|
|
|
|
|
for (i = 0; i < list->size; i++)
|
|
|
|
{
|
|
|
|
const char *msg = list->elems[i].data;
|
|
|
|
int offset_x = FONT_WIDTH_STRIDE * (glyphs_width - strlen(msg)) / 2;
|
|
|
|
int offset_y = FONT_HEIGHT_STRIDE * i;
|
2014-05-30 21:51:12 +02:00
|
|
|
blit_line(x + 8 + offset_x, y + 8 + offset_y, msg, false);
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
string_list_free(list);
|
|
|
|
}
|
|
|
|
|
2014-05-30 21:51:12 +02:00
|
|
|
static void rgui_render(void)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
2014-05-30 21:51:12 +02:00
|
|
|
size_t begin, end;
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
if (driver.menu->need_refresh &&
|
2013-11-07 21:44:44 +01:00
|
|
|
(g_extern.lifecycle_state & (1ULL << MODE_MENU))
|
2014-05-31 22:20:27 +02:00
|
|
|
&& !driver.menu->msg_force)
|
2013-11-04 13:27:03 +01:00
|
|
|
return;
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
begin = (driver.menu->selection_ptr >= RGUI_TERM_HEIGHT / 2) ? driver.menu->selection_ptr - RGUI_TERM_HEIGHT / 2 : 0;
|
|
|
|
end = (driver.menu->selection_ptr + RGUI_TERM_HEIGHT <= file_list_get_size(driver.menu->selection_buf)) ?
|
|
|
|
driver.menu->selection_ptr + RGUI_TERM_HEIGHT : file_list_get_size(driver.menu->selection_buf);
|
2014-04-13 12:12:12 +02:00
|
|
|
|
2013-11-04 13:27:03 +01:00
|
|
|
// Do not scroll if all items are visible.
|
2014-05-31 22:20:27 +02:00
|
|
|
if (file_list_get_size(driver.menu->selection_buf) <= RGUI_TERM_HEIGHT)
|
2013-11-04 13:27:03 +01:00
|
|
|
begin = 0;
|
|
|
|
|
2014-02-28 01:34:10 +01:00
|
|
|
if (end - begin > RGUI_TERM_HEIGHT)
|
|
|
|
end = begin + RGUI_TERM_HEIGHT;
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-05-30 21:51:12 +02:00
|
|
|
rgui_render_background();
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
char title[256];
|
|
|
|
const char *dir = NULL;
|
2014-08-30 15:50:42 +02:00
|
|
|
const char *label = NULL;
|
2013-11-04 13:27:03 +01:00
|
|
|
unsigned menu_type = 0;
|
2014-04-26 02:40:38 +02:00
|
|
|
unsigned menu_type_is = 0;
|
2014-08-30 15:50:42 +02:00
|
|
|
file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
2014-04-26 02:40:38 +02:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->type_is)
|
|
|
|
menu_type_is = driver.menu_ctx->backend->type_is(menu_type);
|
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
if (menu_type == MENU_SETTINGS_CORE)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "CORE SELECTION %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "DETECTED CORES %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_CONFIG)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "CONFIG %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_DISK_APPEND)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "DISK APPEND %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(title, "VIDEO OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS ||
|
|
|
|
menu_type == MENU_SETTINGS_CUSTOM_BIND ||
|
|
|
|
menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
|
2014-02-25 16:44:09 +01:00
|
|
|
strlcpy(title, "INPUT OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS)
|
2014-02-25 16:44:09 +01:00
|
|
|
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS)
|
2014-03-02 04:46:26 +01:00
|
|
|
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
|
2014-08-01 07:00:32 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_USER_OPTIONS)
|
|
|
|
strlcpy(title, "USER OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
|
2014-02-25 16:44:09 +01:00
|
|
|
strlcpy(title, "PATH OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_OPTIONS)
|
2014-02-25 16:44:09 +01:00
|
|
|
strlcpy(title, "SETTINGS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_DRIVERS)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
|
2014-06-01 18:44:30 +02:00
|
|
|
strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO)
|
2014-06-01 23:54:26 +02:00
|
|
|
strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND)
|
2014-06-01 23:54:26 +02:00
|
|
|
strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof(title));
|
2013-11-04 13:27:03 +01:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(title, "SHADER OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_SHADER_PARAMETERS)
|
2014-05-24 14:13:04 +02:00
|
|
|
strlcpy(title, "SHADER PARAMETERS (CURRENT)", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
|
2014-06-10 02:44:19 +02:00
|
|
|
strlcpy(title, "SHADER PARAMETERS (MENU PRESET)", sizeof(title));
|
2013-11-04 13:27:03 +01:00
|
|
|
#endif
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_FONT_OPTIONS)
|
2014-04-08 16:13:44 +02:00
|
|
|
strlcpy(title, "FONT OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_GENERAL_OPTIONS)
|
2014-02-25 18:09:29 +01:00
|
|
|
strlcpy(title, "GENERAL OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(title, "AUDIO OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_DISK_OPTIONS)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(title, "DISK OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_CORE_OPTIONS)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(title, "CORE OPTIONS", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_CORE_INFO)
|
2014-04-13 12:12:12 +02:00
|
|
|
strlcpy(title, "CORE INFO", sizeof(title));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS)
|
2014-04-13 12:12:12 +02:00
|
|
|
strlcpy(title, "PRIVACY OPTIONS", sizeof(title));
|
2013-11-04 13:27:03 +01:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "SHADER %s", dir);
|
|
|
|
#endif
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS ||
|
|
|
|
menu_type == MENU_SETTINGS_OPTIONS ||
|
|
|
|
menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
|
|
|
|
menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT_2 ||
|
2014-08-30 16:56:45 +02:00
|
|
|
!strcmp(label, "help") ||
|
2014-06-10 01:42:26 +02:00
|
|
|
menu_type == MENU_SETTINGS)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "MENU %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(title, "LOAD HISTORY", sizeof(title));
|
2014-08-30 16:56:45 +02:00
|
|
|
else if (!strcmp(label, "info_screen"))
|
2014-05-31 05:14:04 +02:00
|
|
|
strlcpy(title, "INFO", sizeof(title));
|
2013-11-04 13:27:03 +01:00
|
|
|
#ifdef HAVE_OVERLAY
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "OVERLAY %s", dir);
|
|
|
|
#endif
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
|
2014-04-15 12:32:56 +02:00
|
|
|
snprintf(title, sizeof(title), "FILTER %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
|
2014-04-27 18:15:41 +02:00
|
|
|
snprintf(title, sizeof(title), "DSP FILTER %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_BROWSER_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "BROWSER DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_CONTENT_DIR_PATH)
|
2014-05-27 07:58:41 +02:00
|
|
|
snprintf(title, sizeof(title), "CONTENT DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
|
2014-05-26 02:57:44 +02:00
|
|
|
snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SHADER_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_FILTER_DIR_PATH)
|
2014-04-15 06:19:24 +02:00
|
|
|
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
|
2014-04-27 18:15:41 +02:00
|
|
|
snprintf(title, sizeof(title), "DSP FILTER DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SAVESTATE_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
|
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_LIBRETRO_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
|
|
|
|
#endif
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_CONFIG_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SAVEFILE_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
|
|
|
|
#ifdef HAVE_OVERLAY
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_OVERLAY_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "OVERLAY DIR %s", dir);
|
|
|
|
#endif
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SYSTEM_DIR_PATH)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(title, sizeof(title), "SYSTEM DIR %s", dir);
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_ASSETS_DIR_PATH)
|
2014-05-10 05:12:31 +02:00
|
|
|
snprintf(title, sizeof(title), "ASSETS DIR %s", dir);
|
2013-11-04 13:27:03 +01:00
|
|
|
else
|
|
|
|
{
|
2014-05-31 22:20:27 +02:00
|
|
|
if (driver.menu->defer_core)
|
2013-11-26 21:41:27 +01:00
|
|
|
snprintf(title, sizeof(title), "CONTENT %s", dir);
|
2013-11-04 13:27:03 +01:00
|
|
|
else
|
|
|
|
{
|
2014-05-31 22:20:27 +02:00
|
|
|
const char *core_name = driver.menu->info.library_name;
|
2013-11-04 13:27:03 +01:00
|
|
|
if (!core_name)
|
|
|
|
core_name = g_extern.system.info.library_name;
|
|
|
|
if (!core_name)
|
|
|
|
core_name = "No Core";
|
2013-11-26 21:41:27 +01:00
|
|
|
snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir);
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char title_buf[256];
|
2014-02-28 01:34:10 +01:00
|
|
|
menu_ticker_line(title_buf, RGUI_TERM_WIDTH - 3, g_extern.frame_count / 15, title, true);
|
2014-05-30 21:51:12 +02:00
|
|
|
blit_line(RGUI_TERM_START_X + 15, 15, title_buf, true);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
char title_msg[64];
|
2014-05-31 22:20:27 +02:00
|
|
|
const char *core_name = driver.menu->info.library_name;
|
2013-11-04 13:27:03 +01:00
|
|
|
if (!core_name)
|
|
|
|
core_name = g_extern.system.info.library_name;
|
|
|
|
if (!core_name)
|
|
|
|
core_name = "No Core";
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
const char *core_version = driver.menu->info.library_version;
|
2013-11-04 13:27:03 +01:00
|
|
|
if (!core_version)
|
|
|
|
core_version = g_extern.system.info.library_version;
|
|
|
|
if (!core_version)
|
|
|
|
core_version = "";
|
|
|
|
|
|
|
|
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version);
|
2014-05-30 21:51:12 +02:00
|
|
|
blit_line(RGUI_TERM_START_X + 15, (RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RGUI_TERM_START_Y + 2, title_msg, true);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
unsigned x, y;
|
|
|
|
size_t i;
|
|
|
|
|
2014-02-28 01:34:10 +01:00
|
|
|
x = RGUI_TERM_START_X;
|
|
|
|
y = RGUI_TERM_START_Y;
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
for (i = begin; i < end; i++, y += FONT_HEIGHT_STRIDE)
|
|
|
|
{
|
2014-08-08 07:58:07 +02:00
|
|
|
char message[256], type_str[256];
|
2014-08-30 15:50:42 +02:00
|
|
|
const char *path = NULL;
|
|
|
|
const char *label = NULL;
|
2013-11-04 13:27:03 +01:00
|
|
|
unsigned type = 0;
|
2014-08-30 15:50:42 +02:00
|
|
|
file_list_get_at_offset(driver.menu->selection_buf, i, &path, &label, &type);
|
2014-08-30 01:56:12 +02:00
|
|
|
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data_get_list(), driver.menu->selection_buf->list[i].label);
|
2013-11-04 13:27:03 +01:00
|
|
|
unsigned w = 19;
|
2014-08-30 03:09:28 +02:00
|
|
|
(void)setting;
|
2014-06-10 01:42:26 +02:00
|
|
|
if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
|
2014-06-01 20:08:10 +02:00
|
|
|
w = 28;
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || menu_type == MENU_SETTINGS_CUSTOM_BIND || menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
|
2013-11-04 13:27:03 +01:00
|
|
|
w = 21;
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
|
2013-11-04 13:27:03 +01:00
|
|
|
w = 24;
|
|
|
|
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-06-10 01:42:26 +02:00
|
|
|
if (type >= MENU_SETTINGS_SHADER_FILTER &&
|
|
|
|
type <= MENU_SETTINGS_SHADER_LAST)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
// HACK. Work around that we're using the menu_type as dir type to propagate state correctly.
|
2014-06-10 01:42:26 +02:00
|
|
|
if ((menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
|
|
|
|
&& (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS))
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
2014-06-10 01:42:26 +02:00
|
|
|
type = MENU_FILE_DIRECTORY;
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(type_str, "(DIR)", sizeof(type_str));
|
|
|
|
w = 5;
|
|
|
|
}
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (type == MENU_SETTINGS_SHADER_OPTIONS || type == MENU_SETTINGS_SHADER_PRESET || type == MENU_SETTINGS_SHADER_PARAMETERS || type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(type_str, "...", sizeof(type_str));
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (type == MENU_SETTINGS_SHADER_FILTER)
|
2013-11-04 13:27:03 +01:00
|
|
|
snprintf(type_str, sizeof(type_str), "%s",
|
|
|
|
g_settings.video.smooth ? "Linear" : "Nearest");
|
2014-04-26 01:53:40 +02:00
|
|
|
else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str)
|
2014-05-24 14:13:04 +02:00
|
|
|
{
|
2014-06-10 01:42:26 +02:00
|
|
|
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
2014-05-31 22:20:27 +02:00
|
|
|
driver.menu_ctx->backend->shader_manager_get_str(driver.menu->parameter_shader, type_str, sizeof(type_str), type);
|
2014-05-24 14:13:04 +02:00
|
|
|
else
|
2014-05-31 22:20:27 +02:00
|
|
|
driver.menu_ctx->backend->shader_manager_get_str(driver.menu->shader, type_str, sizeof(type_str), type);
|
2014-05-24 14:13:04 +02:00
|
|
|
}
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
// Pretty-print libretro cores from menu.
|
2014-06-10 01:42:26 +02:00
|
|
|
if (menu_type == MENU_SETTINGS_CORE || menu_type == MENU_SETTINGS_DEFERRED_CORE)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
2014-06-10 01:42:26 +02:00
|
|
|
if (type == MENU_FILE_PLAIN)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
strlcpy(type_str, "(CORE)", sizeof(type_str));
|
2014-05-31 22:20:27 +02:00
|
|
|
file_list_get_alt_at_offset(driver.menu->selection_buf, i, &path);
|
2013-11-04 13:27:03 +01:00
|
|
|
w = 6;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strlcpy(type_str, "(DIR)", sizeof(type_str));
|
2014-06-10 01:42:26 +02:00
|
|
|
type = MENU_FILE_DIRECTORY;
|
2013-11-04 13:27:03 +01:00
|
|
|
w = 5;
|
|
|
|
}
|
|
|
|
}
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_CONFIG ||
|
2013-11-04 13:27:03 +01:00
|
|
|
#ifdef HAVE_OVERLAY
|
2014-06-10 01:42:26 +02:00
|
|
|
menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
|
2013-11-04 13:27:03 +01:00
|
|
|
#endif
|
2014-06-10 01:42:26 +02:00
|
|
|
menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
|
|
|
|
menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
|
|
|
|
menu_type == MENU_SETTINGS_DISK_APPEND ||
|
|
|
|
menu_type_is == MENU_FILE_DIRECTORY)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
2014-06-10 01:42:26 +02:00
|
|
|
if (type == MENU_FILE_PLAIN)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
strlcpy(type_str, "(FILE)", sizeof(type_str));
|
|
|
|
w = 6;
|
|
|
|
}
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (type == MENU_FILE_USE_DIRECTORY)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
*type_str = '\0';
|
|
|
|
w = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strlcpy(type_str, "(DIR)", sizeof(type_str));
|
2014-06-10 01:42:26 +02:00
|
|
|
type = MENU_FILE_DIRECTORY;
|
2013-11-04 13:27:03 +01:00
|
|
|
w = 5;
|
|
|
|
}
|
|
|
|
}
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
*type_str = '\0';
|
|
|
|
w = 0;
|
|
|
|
}
|
2014-06-10 01:42:26 +02:00
|
|
|
else if (type >= MENU_SETTINGS_CORE_OPTION_START)
|
2013-11-04 13:27:03 +01:00
|
|
|
strlcpy(type_str,
|
2014-06-10 01:42:26 +02:00
|
|
|
core_option_get_val(g_extern.system.core_options, type - MENU_SETTINGS_CORE_OPTION_START),
|
2013-11-04 13:27:03 +01:00
|
|
|
sizeof(type_str));
|
2014-04-26 02:40:38 +02:00
|
|
|
else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label)
|
2014-08-20 18:00:06 +02:00
|
|
|
driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type, i);
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
char entry_title_buf[256];
|
|
|
|
char type_str_buf[64];
|
2014-05-31 22:20:27 +02:00
|
|
|
bool selected = i == driver.menu->selection_ptr;
|
2013-11-04 13:27:03 +01:00
|
|
|
|
|
|
|
strlcpy(entry_title_buf, path, sizeof(entry_title_buf));
|
|
|
|
strlcpy(type_str_buf, type_str, sizeof(type_str_buf));
|
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
if (type == MENU_FILE_PLAIN || type == MENU_FILE_DIRECTORY || type == MENU_SETTINGS_CORE_INFO_NONE)
|
2014-02-28 01:34:10 +01:00
|
|
|
menu_ticker_line(entry_title_buf, RGUI_TERM_WIDTH - (w + 1 + 2), g_extern.frame_count / 15, path, selected);
|
2013-11-04 13:27:03 +01:00
|
|
|
else
|
|
|
|
menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, type_str, selected);
|
|
|
|
|
|
|
|
snprintf(message, sizeof(message), "%c %-*.*s %-*s",
|
|
|
|
selected ? '>' : ' ',
|
2014-02-28 01:34:10 +01:00
|
|
|
RGUI_TERM_WIDTH - (w + 1 + 2), RGUI_TERM_WIDTH - (w + 1 + 2),
|
2013-11-04 13:27:03 +01:00
|
|
|
entry_title_buf,
|
|
|
|
w,
|
|
|
|
type_str_buf);
|
|
|
|
|
2014-05-30 21:51:12 +02:00
|
|
|
blit_line(x, y, message, selected);
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GEKKO
|
|
|
|
const char *message_queue;
|
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
if (driver.menu->msg_force)
|
2013-11-04 13:27:03 +01:00
|
|
|
{
|
|
|
|
message_queue = msg_queue_pull(g_extern.msg_queue);
|
2014-05-31 22:20:27 +02:00
|
|
|
driver.menu->msg_force = false;
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
message_queue = driver.current_msg;
|
|
|
|
|
2014-05-30 21:51:12 +02:00
|
|
|
rgui_render_messagebox(message_queue);
|
2013-11-04 13:27:03 +01:00
|
|
|
#endif
|
2013-12-09 16:18:58 +01:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
if (driver.menu->keyboard.display)
|
2013-12-09 16:18:58 +01:00
|
|
|
{
|
|
|
|
char msg[1024];
|
2014-05-31 22:20:27 +02:00
|
|
|
const char *str = *driver.menu->keyboard.buffer;
|
2013-12-10 19:39:09 +01:00
|
|
|
if (!str)
|
|
|
|
str = "";
|
2014-05-31 22:20:27 +02:00
|
|
|
snprintf(msg, sizeof(msg), "%s\n%s", driver.menu->keyboard.label, str);
|
2014-05-30 21:51:12 +02:00
|
|
|
rgui_render_messagebox(msg);
|
2013-12-09 16:18:58 +01:00
|
|
|
}
|
2013-11-04 13:27:03 +01:00
|
|
|
}
|
2013-09-28 04:45:44 +02:00
|
|
|
|
2014-03-25 10:19:02 +01:00
|
|
|
static void *rgui_init(void)
|
2012-05-06 04:04:33 +02:00
|
|
|
{
|
2013-04-18 14:57:28 +02:00
|
|
|
uint16_t *framebuf = menu_framebuf;
|
2013-11-04 16:23:37 +01:00
|
|
|
size_t framebuf_pitch;
|
2013-04-18 14:57:28 +02:00
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
2012-05-06 04:04:33 +02:00
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
if (!menu)
|
2014-05-30 20:41:31 +02:00
|
|
|
return NULL;
|
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
menu->frame_buf = framebuf;
|
|
|
|
menu->width = 320;
|
|
|
|
menu->height = 240;
|
|
|
|
framebuf_pitch = menu->width * sizeof(uint16_t);
|
2013-11-04 16:23:37 +01:00
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
menu->frame_buf_pitch = framebuf_pitch;
|
2012-05-06 04:04:33 +02:00
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
bool ret = rguidisp_init_font(menu);
|
2013-09-28 04:45:44 +02:00
|
|
|
|
|
|
|
if (!ret)
|
2012-08-26 20:33:22 -04:00
|
|
|
{
|
2013-09-28 04:45:44 +02:00
|
|
|
RARCH_ERR("No font bitmap or binary, abort");
|
2013-04-18 18:33:03 +02:00
|
|
|
/* TODO - should be refactored - perhaps don't do rarch_fail but instead
|
|
|
|
* exit program */
|
2013-11-07 21:44:44 +01:00
|
|
|
g_extern.lifecycle_state &= ~((1ULL << MODE_MENU) | (1ULL << MODE_GAME));
|
2013-04-18 22:22:25 +02:00
|
|
|
return NULL;
|
2012-08-26 20:33:22 -04:00
|
|
|
}
|
2012-05-06 04:04:33 +02:00
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
return menu;
|
2012-05-06 04:04:33 +02:00
|
|
|
}
|
|
|
|
|
2013-09-19 15:01:17 +02:00
|
|
|
static void rgui_free(void *data)
|
2012-05-06 04:04:33 +02:00
|
|
|
{
|
2014-06-10 02:06:10 +02:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2014-05-30 20:41:31 +02:00
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
if (menu->alloc_font)
|
|
|
|
free((uint8_t*)menu->font);
|
2012-05-06 04:04:33 +02:00
|
|
|
}
|
|
|
|
|
2014-05-30 20:53:10 +02:00
|
|
|
static int rgui_input_postprocess(uint64_t old_state)
|
2013-03-09 15:33:44 +01:00
|
|
|
{
|
2014-05-17 22:16:25 +02:00
|
|
|
(void)old_state;
|
2013-04-17 21:11:13 +02:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
if ((driver.menu->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
|
2013-04-26 23:52:29 +02:00
|
|
|
g_extern.main_is_init &&
|
|
|
|
!g_extern.libretro_dummy)
|
2013-03-09 15:33:44 +01:00
|
|
|
{
|
2013-11-07 21:44:44 +01:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
2014-08-28 15:43:53 +02:00
|
|
|
return -1;
|
2013-03-09 15:33:44 +01:00
|
|
|
}
|
|
|
|
|
2014-08-28 15:43:53 +02:00
|
|
|
return 0;
|
2013-03-09 15:33:44 +01:00
|
|
|
}
|
2013-09-19 14:49:07 +02:00
|
|
|
|
2014-06-01 00:20:54 +02:00
|
|
|
void rgui_set_texture(void *data)
|
2013-11-04 16:23:37 +01:00
|
|
|
{
|
2014-06-10 02:06:10 +02:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2013-11-04 16:23:37 +01:00
|
|
|
|
2014-06-01 00:20:54 +02:00
|
|
|
if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_frame)
|
2014-03-25 10:19:02 +01:00
|
|
|
driver.video_poke->set_texture_frame(driver.video_data, menu_framebuf,
|
2014-06-10 02:06:10 +02:00
|
|
|
false, menu->width, menu->height, 1.0f);
|
2013-11-04 16:23:37 +01:00
|
|
|
}
|
|
|
|
|
2014-05-09 21:00:50 +02:00
|
|
|
static void rgui_init_core_info(void *data)
|
|
|
|
{
|
2014-06-10 02:06:10 +02:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2014-05-09 21:00:50 +02:00
|
|
|
|
2014-06-10 02:06:10 +02:00
|
|
|
core_info_list_free(menu->core_info);
|
|
|
|
menu->core_info = NULL;
|
2014-05-09 21:00:50 +02:00
|
|
|
if (*g_settings.libretro_directory)
|
2014-06-10 02:06:10 +02:00
|
|
|
menu->core_info = core_info_list_new(g_settings.libretro_directory);
|
2014-05-09 21:00:50 +02:00
|
|
|
}
|
|
|
|
|
2013-09-19 14:49:07 +02:00
|
|
|
const menu_ctx_driver_t menu_ctx_rgui = {
|
2013-11-04 16:23:37 +01:00
|
|
|
rgui_set_texture,
|
|
|
|
rgui_render_messagebox,
|
|
|
|
rgui_render,
|
2014-04-01 04:45:00 +02:00
|
|
|
NULL,
|
2013-09-19 14:49:07 +02:00
|
|
|
rgui_init,
|
|
|
|
rgui_free,
|
2013-11-08 15:13:14 +01:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2013-11-19 06:09:14 +01:00
|
|
|
NULL,
|
2013-11-19 06:35:11 +01:00
|
|
|
NULL,
|
2014-02-28 01:44:03 +01:00
|
|
|
rgui_input_postprocess,
|
2014-04-13 23:41:47 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2014-04-14 00:09:52 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2014-05-09 21:00:50 +02:00
|
|
|
rgui_init_core_info,
|
2014-04-14 02:32:54 +02:00
|
|
|
&menu_ctx_backend_common,
|
2013-09-19 14:49:07 +02:00
|
|
|
"rgui",
|
|
|
|
};
|