2015-01-12 23:38:39 +01:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2017-01-22 13:40:32 +01:00
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2015-01-12 23:38:39 +01: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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(SN_TARGET_PSP2)
|
|
|
|
#include <libdbgfont.h>
|
|
|
|
#define DbgFontPrint(x, y, scale, color, msg) sceDbgFontPrint(x, y, color, msg)
|
|
|
|
#define DbgFontConfig SceDbgFontConfig
|
|
|
|
#define DbgFontInit sceDbgFontInit
|
|
|
|
#define DbgFontExit sceDbgFontExit
|
|
|
|
#elif defined(__CELLOS_LV2__)
|
|
|
|
#include <cell/dbgfont.h>
|
|
|
|
#define SCE_DBGFONT_BUFSIZE_LARGE 2048
|
|
|
|
#define DbgFontPrint(x, y, scale, color, msg) cellDbgFontPrintf(x, y, scale, color, msg)
|
|
|
|
#define DbgFontConfig CellDbgFontConfig
|
|
|
|
#define DbgFontInit cellDbgFontInit
|
|
|
|
#define DbgFontExit cellDbgFontExit
|
|
|
|
#endif
|
|
|
|
|
2015-09-16 05:53:34 +02:00
|
|
|
#include "../font_driver.h"
|
|
|
|
|
2017-01-25 14:47:24 +01:00
|
|
|
static void *libdbg_font_init_font(void *gl_data, const char *font_path,
|
|
|
|
float font_size, bool is_threaded)
|
2015-01-12 23:38:39 +01:00
|
|
|
{
|
2015-05-20 01:48:51 +02:00
|
|
|
unsigned width, height;
|
|
|
|
|
|
|
|
video_driver_get_size(&width, &height);
|
2015-01-12 23:38:39 +01:00
|
|
|
|
|
|
|
(void)font_path;
|
|
|
|
(void)font_size;
|
2015-05-20 01:48:51 +02:00
|
|
|
(void)width;
|
|
|
|
(void)height;
|
2015-01-12 23:38:39 +01:00
|
|
|
|
|
|
|
DbgFontConfig cfg;
|
|
|
|
#if defined(SN_TARGET_PSP2)
|
|
|
|
cfg.fontSize = SCE_DBGFONT_FONTSIZE_LARGE;
|
|
|
|
#elif defined(__CELLOS_LV2__)
|
|
|
|
cfg.bufSize = SCE_DBGFONT_BUFSIZE_LARGE;
|
2015-05-20 01:48:51 +02:00
|
|
|
cfg.screenWidth = width;
|
|
|
|
cfg.screenHeight = height;
|
2015-01-12 23:38:39 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
DbgFontInit(&cfg);
|
|
|
|
|
|
|
|
/* Doesn't need any state. */
|
|
|
|
return (void*)-1;
|
|
|
|
}
|
|
|
|
|
2017-01-25 14:47:24 +01:00
|
|
|
static void libdbg_font_free_font(void *data, bool is_threaded)
|
2015-01-12 23:38:39 +01:00
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
DbgFontExit();
|
|
|
|
}
|
|
|
|
|
2017-01-19 16:30:40 +01:00
|
|
|
static void libdbg_font_render_msg(
|
|
|
|
video_frame_info_t *video_info,
|
|
|
|
void *data, const char *msg,
|
2015-04-03 03:23:02 +02:00
|
|
|
const void *userdata)
|
2015-01-12 23:38:39 +01:00
|
|
|
{
|
|
|
|
float x, y, scale;
|
|
|
|
unsigned color;
|
2015-03-29 21:59:01 +02:00
|
|
|
const struct font_params *params = (const struct font_params*)userdata;
|
2015-01-12 23:38:39 +01:00
|
|
|
|
|
|
|
(void)data;
|
|
|
|
|
|
|
|
if (params)
|
|
|
|
{
|
2015-03-20 22:08:36 +01:00
|
|
|
x = params->x;
|
|
|
|
y = params->y;
|
2015-01-12 23:38:39 +01:00
|
|
|
scale = params->scale;
|
|
|
|
color = params->color;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-19 16:30:40 +01:00
|
|
|
x = video_info->font_msg_pos_x;
|
2017-01-12 10:26:12 +01:00
|
|
|
y = 0.90f;
|
|
|
|
scale = 1.04f;
|
|
|
|
color = SILVER;
|
2015-01-12 23:38:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DbgFontPrint(x, y, scale, color, msg);
|
|
|
|
|
|
|
|
if (!params)
|
|
|
|
DbgFontPrint(x, y, scale - 0.01f, WHITE, msg);
|
|
|
|
|
|
|
|
#ifdef SN_TARGET_PSP2
|
|
|
|
/* FIXME - if we ever get around to this port,
|
|
|
|
* move this out to some better place */
|
|
|
|
sceDbgFontFlush();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-03-30 00:55:39 +02:00
|
|
|
font_renderer_t libdbg_font = {
|
2015-01-12 23:38:39 +01:00
|
|
|
libdbg_font_init_font,
|
2015-03-29 22:01:52 +02:00
|
|
|
libdbg_font_free_font,
|
2015-01-12 23:38:39 +01:00
|
|
|
libdbg_font_render_msg,
|
2015-04-21 17:17:44 +02:00
|
|
|
"libdbgfont",
|
2015-04-21 17:13:55 +02:00
|
|
|
NULL, /* get_glyph */
|
|
|
|
NULL, /* bind_block */
|
2015-05-21 04:43:50 +02:00
|
|
|
NULL, /* flush */
|
2015-05-16 16:32:16 +02:00
|
|
|
NULL, /* get_message_width */
|
2015-01-12 23:38:39 +01:00
|
|
|
};
|