2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
2012-01-22 00:43:54 +00:00
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2012-01-22 00:43:54 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2012-01-22 00:43:54 +00:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2012-01-22 00:43:54 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2012-01-23 21:22:54 +00:00
|
|
|
#include <stdint.h>
|
2012-01-22 00:43:54 +00:00
|
|
|
#include <xtl.h>
|
2013-03-09 21:30:35 +00:00
|
|
|
#include <xui.h>
|
|
|
|
#include <xuiapp.h>
|
2013-01-09 16:49:43 +00:00
|
|
|
|
2014-04-25 23:53:40 +00:00
|
|
|
#include "../backend/menu_common_backend.h"
|
2013-12-29 03:26:34 +00:00
|
|
|
#include "../menu_common.h"
|
2012-07-28 14:10:31 +00:00
|
|
|
|
2013-12-29 03:26:34 +00:00
|
|
|
#include "../../../gfx/gfx_common.h"
|
|
|
|
#include "../../../gfx/gfx_context.h"
|
2012-09-30 16:29:32 +00:00
|
|
|
|
2013-12-29 03:26:34 +00:00
|
|
|
#include "../../../message_queue.h"
|
|
|
|
#include "../../../general.h"
|
2012-01-24 00:06:12 +00:00
|
|
|
|
2013-11-19 05:42:27 +00:00
|
|
|
#define XUI_CONTROL_NAVIGATE_OK (XUI_CONTROL_NAVIGATE_RIGHT + 1)
|
|
|
|
|
2014-02-28 20:24:39 +00:00
|
|
|
#define FONT_WIDTH 5
|
|
|
|
#define FONT_HEIGHT 10
|
|
|
|
#define FONT_WIDTH_STRIDE (FONT_WIDTH + 1)
|
|
|
|
#define FONT_HEIGHT_STRIDE (FONT_HEIGHT + 1)
|
2014-02-28 20:15:16 +00:00
|
|
|
#define RXUI_TERM_START_X 15
|
|
|
|
#define RXUI_TERM_START_Y 27
|
|
|
|
#define RXUI_TERM_WIDTH (((rgui->width - RXUI_TERM_START_X - 15) / (FONT_WIDTH_STRIDE)))
|
|
|
|
#define RXUI_TERM_HEIGHT (((rgui->height - RXUI_TERM_START_Y - 15) / (FONT_HEIGHT_STRIDE)) - 1)
|
2013-03-30 07:16:58 +00:00
|
|
|
|
2013-05-09 13:12:22 +00:00
|
|
|
HXUIOBJ m_menulist;
|
|
|
|
HXUIOBJ m_menutitle;
|
2013-05-09 16:12:54 +00:00
|
|
|
HXUIOBJ m_menutitlebottom;
|
2013-05-06 01:05:21 +00:00
|
|
|
HXUIOBJ m_back;
|
2013-05-10 15:14:22 +00:00
|
|
|
HXUIOBJ root_menu;
|
|
|
|
HXUIOBJ current_menu;
|
2014-03-09 17:25:52 +00:00
|
|
|
static msg_queue_t *xui_msg_queue;
|
2013-05-06 00:44:13 +00:00
|
|
|
|
2013-03-09 21:30:35 +00:00
|
|
|
class CRetroArch : public CXuiModule
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
virtual HRESULT RegisterXuiClasses();
|
|
|
|
virtual HRESULT UnregisterXuiClasses();
|
|
|
|
};
|
|
|
|
|
2013-05-10 01:54:20 +00:00
|
|
|
#define CREATE_CLASS(class_type, class_name) \
|
|
|
|
class class_type: public CXuiSceneImpl \
|
|
|
|
{ \
|
|
|
|
public: \
|
|
|
|
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled ); \
|
|
|
|
HRESULT DispatchMessageMap(XUIMessage *pMessage) \
|
|
|
|
{ \
|
|
|
|
if (pMessage->dwMessage == XM_INIT) \
|
|
|
|
{ \
|
|
|
|
XUIMessageInit *pData = (XUIMessageInit *) pMessage->pvData; \
|
|
|
|
return OnInit(pData, pMessage->bHandled); \
|
|
|
|
} \
|
|
|
|
return __super::DispatchMessageMap(pMessage); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
static HRESULT Register() \
|
|
|
|
{ \
|
|
|
|
HXUICLASS hClass; \
|
|
|
|
XUIClass cls; \
|
|
|
|
memset(&cls, 0x00, sizeof(cls)); \
|
|
|
|
cls.szClassName = class_name; \
|
|
|
|
cls.szBaseClassName = XUI_CLASS_SCENE; \
|
|
|
|
cls.Methods.CreateInstance = (PFN_CREATEINST) (CreateInstance); \
|
|
|
|
cls.Methods.DestroyInstance = (PFN_DESTROYINST) DestroyInstance; \
|
|
|
|
cls.Methods.ObjectProc = (PFN_OBJECT_PROC) _ObjectProc; \
|
|
|
|
cls.pPropDefs = _GetPropDef(&cls.dwPropDefCount); \
|
|
|
|
HRESULT hr = XuiRegisterClass(&cls, &hClass); \
|
|
|
|
if (FAILED(hr)) \
|
|
|
|
return hr; \
|
|
|
|
return S_OK; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
static HRESULT APIENTRY CreateInstance(HXUIOBJ hObj, void **ppvObj) \
|
|
|
|
{ \
|
|
|
|
*ppvObj = NULL; \
|
|
|
|
class_type *pThis = new class_type(); \
|
|
|
|
if (!pThis) \
|
|
|
|
return E_OUTOFMEMORY; \
|
|
|
|
pThis->m_hObj = hObj; \
|
|
|
|
HRESULT hr = pThis->OnCreate(); \
|
|
|
|
if (FAILED(hr)) \
|
|
|
|
{ \
|
|
|
|
DestroyInstance(pThis); \
|
|
|
|
return hr; \
|
|
|
|
} \
|
|
|
|
*ppvObj = pThis; \
|
|
|
|
return S_OK; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
static HRESULT APIENTRY DestroyInstance(void *pvObj) \
|
|
|
|
{ \
|
|
|
|
class_type *pThis = (class_type *) pvObj; \
|
|
|
|
delete pThis; \
|
|
|
|
return S_OK; \
|
|
|
|
} \
|
|
|
|
}
|
2013-05-09 16:44:35 +00:00
|
|
|
|
2013-05-10 01:54:20 +00:00
|
|
|
CREATE_CLASS(CRetroArchMain, L"RetroArchMain");
|
2013-03-09 21:30:35 +00:00
|
|
|
|
2012-05-29 13:25:39 +00:00
|
|
|
CRetroArch app;
|
2012-07-28 20:36:49 +00:00
|
|
|
|
2012-05-29 17:51:35 +00:00
|
|
|
wchar_t strw_buffer[PATH_MAX];
|
2012-07-28 20:51:33 +00:00
|
|
|
char str_buffer[PATH_MAX];
|
2012-01-22 20:47:34 +00:00
|
|
|
|
2013-01-11 05:10:21 +00:00
|
|
|
static int process_input_ret = 0;
|
|
|
|
|
2012-01-22 00:43:54 +00:00
|
|
|
/* Register custom classes */
|
2012-04-21 21:48:05 +00:00
|
|
|
HRESULT CRetroArch::RegisterXuiClasses (void)
|
2012-01-22 00:43:54 +00:00
|
|
|
{
|
2012-04-21 22:11:48 +00:00
|
|
|
CRetroArchMain::Register();
|
2012-04-10 19:23:42 +00:00
|
|
|
|
2012-05-29 02:39:54 +00:00
|
|
|
return 0;
|
2012-01-22 00:43:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Unregister custom classes */
|
2012-04-21 21:48:05 +00:00
|
|
|
HRESULT CRetroArch::UnregisterXuiClasses (void)
|
2012-01-22 00:43:54 +00:00
|
|
|
{
|
2013-05-08 00:11:06 +00:00
|
|
|
XuiUnregisterClass(L"RetroArchMain");
|
2012-04-10 19:23:42 +00:00
|
|
|
|
2012-05-29 02:39:54 +00:00
|
|
|
return 0;
|
2012-01-22 00:43:54 +00:00
|
|
|
}
|
|
|
|
|
2012-08-22 01:56:57 +00:00
|
|
|
HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
2012-01-24 05:55:27 +00:00
|
|
|
{
|
2013-05-09 16:12:54 +00:00
|
|
|
GetChildById(L"XuiMenuList", &m_menulist);
|
2013-05-09 13:12:22 +00:00
|
|
|
GetChildById(L"XuiTxtTitle", &m_menutitle);
|
2013-05-09 16:12:54 +00:00
|
|
|
GetChildById(L"XuiTxtBottom", &m_menutitlebottom);
|
|
|
|
|
2014-02-28 20:15:16 +00:00
|
|
|
char str[PATH_MAX];
|
2014-03-02 21:52:48 +00:00
|
|
|
snprintf(str, sizeof(str), "%s - %s", PACKAGE_VERSION, g_extern.title_buf);
|
2014-02-28 20:15:16 +00:00
|
|
|
mbstowcs(strw_buffer, str, sizeof(strw_buffer) / sizeof(wchar_t));
|
2014-03-02 21:52:48 +00:00
|
|
|
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
2012-06-30 11:37:18 +00:00
|
|
|
|
2012-05-29 02:39:54 +00:00
|
|
|
return 0;
|
2012-01-24 05:55:27 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 09:19:02 +00:00
|
|
|
static void* rmenu_xui_init(void)
|
2012-01-22 20:47:34 +00:00
|
|
|
{
|
2012-04-10 19:23:42 +00:00
|
|
|
HRESULT hr;
|
2012-01-22 20:47:34 +00:00
|
|
|
|
2013-04-18 13:04:09 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui));
|
2014-05-27 15:13:53 +00:00
|
|
|
|
|
|
|
if (!rgui)
|
2013-10-17 18:16:07 +00:00
|
|
|
return NULL;
|
2013-04-18 13:04:09 +00:00
|
|
|
|
2014-03-25 09:19:02 +00:00
|
|
|
d3d_video_t *d3d= (d3d_video_t*)driver.video_data;
|
2012-04-10 19:23:42 +00:00
|
|
|
|
2013-11-07 20:44:44 +00:00
|
|
|
bool hdmenus_allowed = (g_extern.lifecycle_state & (1ULL << MODE_MENU_HD));
|
2012-06-05 19:01:25 +00:00
|
|
|
|
2013-01-08 16:15:43 +00:00
|
|
|
if (hdmenus_allowed)
|
|
|
|
RARCH_LOG("HD menus enabled.\n");
|
|
|
|
|
2012-11-20 00:40:52 +00:00
|
|
|
D3DPRESENT_PARAMETERS d3dpp;
|
2012-11-20 01:51:00 +00:00
|
|
|
video_info_t video_info = {0};
|
|
|
|
|
|
|
|
video_info.vsync = g_settings.video.vsync;
|
|
|
|
video_info.force_aspect = false;
|
|
|
|
video_info.smooth = g_settings.video.smooth;
|
|
|
|
video_info.input_scale = 2;
|
|
|
|
video_info.fullscreen = true;
|
2012-11-20 22:54:35 +00:00
|
|
|
video_info.rgb32 = false;
|
2012-11-20 01:51:00 +00:00
|
|
|
|
2014-03-05 21:10:36 +00:00
|
|
|
d3d_make_d3dpp(d3d, &video_info, &d3dpp);
|
2012-11-20 00:40:52 +00:00
|
|
|
|
2014-03-05 21:10:36 +00:00
|
|
|
hr = app.InitShared(d3d->dev, &d3dpp, XuiPNGTextureLoader);
|
2012-04-10 19:23:42 +00:00
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
if (FAILED(hr))
|
2012-04-10 19:23:42 +00:00
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("Failed initializing XUI application.\n");
|
2014-05-30 19:51:12 +00:00
|
|
|
goto error;
|
2012-04-10 19:23:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Register font */
|
2013-04-18 13:33:25 +00:00
|
|
|
TypefaceDescriptor typeface = {0};
|
|
|
|
typeface.szTypeface = L"Arial Unicode MS";
|
|
|
|
typeface.szLocator = L"file://game:/media/rarch.ttf";
|
|
|
|
typeface.szReserved1 = NULL;
|
2013-05-09 16:44:35 +00:00
|
|
|
|
2013-04-18 13:33:25 +00:00
|
|
|
hr = XuiRegisterTypeface( &typeface, TRUE );
|
2014-05-30 19:51:12 +00:00
|
|
|
if (FAILED(hr))
|
2012-04-10 19:23:42 +00:00
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("Failed to register default typeface.\n");
|
2014-05-30 19:51:12 +00:00
|
|
|
goto error;
|
2012-04-10 19:23:42 +00:00
|
|
|
}
|
|
|
|
|
2013-04-18 13:33:25 +00:00
|
|
|
hr = XuiLoadVisualFromBinary( L"file://game:/media/rarch_scene_skin.xur", NULL);
|
2014-05-30 19:51:12 +00:00
|
|
|
if (FAILED(hr))
|
2012-04-10 19:23:42 +00:00
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("Failed to load skin.\n");
|
2014-05-30 19:51:12 +00:00
|
|
|
goto error;
|
2012-04-10 19:23:42 +00:00
|
|
|
}
|
|
|
|
|
2013-05-10 15:14:22 +00:00
|
|
|
hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_main.xur", NULL, &root_menu);
|
2014-05-30 19:51:12 +00:00
|
|
|
if (FAILED(hr))
|
2012-04-10 19:23:42 +00:00
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n");
|
2014-05-30 19:51:12 +00:00
|
|
|
goto error;
|
2012-04-10 19:23:42 +00:00
|
|
|
}
|
|
|
|
|
2013-05-10 15:14:22 +00:00
|
|
|
current_menu = root_menu;
|
|
|
|
hr = XuiSceneNavigateFirst(app.GetRootObj(), current_menu, XUSER_INDEX_FOCUS);
|
2014-05-30 19:51:12 +00:00
|
|
|
if (FAILED(hr))
|
2013-01-08 16:15:43 +00:00
|
|
|
{
|
|
|
|
RARCH_ERR("XuiSceneNavigateFirst failed.\n");
|
2014-05-30 19:51:12 +00:00
|
|
|
goto error;
|
2013-01-08 16:15:43 +00:00
|
|
|
}
|
2012-04-10 19:23:42 +00:00
|
|
|
|
2014-03-25 09:19:02 +00:00
|
|
|
if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable)
|
|
|
|
driver.video_poke->set_texture_frame(driver.video_data, NULL,
|
2013-04-13 20:38:57 +00:00
|
|
|
true, 0, 0, 1.0f);
|
2013-04-18 13:04:09 +00:00
|
|
|
|
2014-03-09 17:25:52 +00:00
|
|
|
xui_msg_queue = msg_queue_new(16);
|
|
|
|
|
2013-04-18 13:04:09 +00:00
|
|
|
return rgui;
|
2014-05-30 19:51:12 +00:00
|
|
|
|
|
|
|
error:
|
|
|
|
free(rgui);
|
|
|
|
return NULL;
|
2012-01-22 21:45:32 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 05:09:14 +00:00
|
|
|
static void rmenu_xui_free(void *data)
|
2012-04-17 03:35:25 +00:00
|
|
|
{
|
2013-11-03 05:34:49 +00:00
|
|
|
(void)data;
|
2012-05-29 13:25:39 +00:00
|
|
|
app.Uninit();
|
2014-03-09 17:25:52 +00:00
|
|
|
|
|
|
|
if (xui_msg_queue)
|
|
|
|
msg_queue_free(xui_msg_queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xui_render_message(const char *msg)
|
|
|
|
{
|
|
|
|
font_params_t font_parms;
|
|
|
|
size_t i, j;
|
|
|
|
|
|
|
|
struct string_list *list = string_split(msg, "\n");
|
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (list->elems == 0)
|
|
|
|
{
|
|
|
|
string_list_free(list);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
for (i = 0; i < list->size; i++, j++)
|
|
|
|
{
|
|
|
|
char *msg = list->elems[i].data;
|
|
|
|
unsigned msglen = strlen(msg);
|
|
|
|
#if 0
|
|
|
|
if (msglen > RMENU_TERM_WIDTH)
|
|
|
|
{
|
|
|
|
msg[RMENU_TERM_WIDTH - 2] = '.';
|
|
|
|
msg[RMENU_TERM_WIDTH - 1] = '.';
|
|
|
|
msg[RMENU_TERM_WIDTH - 0] = '.';
|
|
|
|
msg[RMENU_TERM_WIDTH + 1] = '\0';
|
|
|
|
msglen = RMENU_TERM_WIDTH;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
float msg_width = (g_extern.lifecycle_state & (1ULL << MODE_MENU_HD)) ? 160 : 100;
|
|
|
|
float msg_height = 120;
|
|
|
|
float msg_offset = 32;
|
|
|
|
|
|
|
|
font_parms.x = msg_width;
|
|
|
|
font_parms.y = msg_height + (msg_offset * j);
|
|
|
|
font_parms.scale = 21;
|
|
|
|
|
|
|
|
if (driver.video_poke && driver.video_poke->set_osd_msg)
|
|
|
|
driver.video_poke->set_osd_msg(driver.video_data, msg, &font_parms);
|
|
|
|
}
|
2012-04-17 03:35:25 +00:00
|
|
|
}
|
|
|
|
|
2014-04-14 09:34:28 +00:00
|
|
|
static void rmenu_xui_frame(void *data)
|
2013-03-09 21:30:35 +00:00
|
|
|
{
|
2014-04-01 02:45:00 +00:00
|
|
|
d3d_video_t *d3d = (d3d_video_t*)data;
|
2014-03-07 19:17:25 +00:00
|
|
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
2013-04-19 21:22:58 +00:00
|
|
|
|
2014-03-05 18:03:25 +00:00
|
|
|
D3DVIEWPORT vp_full;
|
|
|
|
vp_full.X = 0;
|
|
|
|
vp_full.Y = 0;
|
|
|
|
vp_full.Width = d3d->screen_width;
|
|
|
|
vp_full.Height = d3d->screen_height;
|
|
|
|
vp_full.MinZ = 0.0f;
|
|
|
|
vp_full.MaxZ = 1.0f;
|
|
|
|
d3dr->SetViewport(&vp_full);
|
|
|
|
|
2014-03-05 02:55:16 +00:00
|
|
|
app.RunFrame();
|
|
|
|
XuiTimersRun();
|
2013-05-09 16:44:35 +00:00
|
|
|
XuiRenderBegin( app.GetDC(), D3DCOLOR_ARGB( 255, 0, 0, 0 ) );
|
2013-04-19 19:04:08 +00:00
|
|
|
|
2013-05-09 16:44:35 +00:00
|
|
|
D3DXMATRIX matOrigView;
|
|
|
|
XuiRenderGetViewTransform( app.GetDC(), &matOrigView );
|
2013-04-19 19:04:08 +00:00
|
|
|
|
2013-05-09 16:44:35 +00:00
|
|
|
XUIMessage msg;
|
|
|
|
XUIMessageRender msgRender;
|
|
|
|
XuiMessageRender( &msg, &msgRender, app.GetDC(), 0xffffffff, XUI_BLEND_NORMAL );
|
|
|
|
XuiSendMessage( app.GetRootObj(), &msg );
|
2013-04-19 19:04:08 +00:00
|
|
|
|
2013-05-09 16:44:35 +00:00
|
|
|
XuiRenderSetViewTransform( app.GetDC(), &matOrigView );
|
2013-04-19 19:04:08 +00:00
|
|
|
|
2014-03-09 17:25:52 +00:00
|
|
|
const char *message = msg_queue_pull(xui_msg_queue);
|
|
|
|
|
|
|
|
if (message)
|
|
|
|
xui_render_message(message);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *message = msg_queue_pull(g_extern.msg_queue);
|
|
|
|
if (message)
|
|
|
|
xui_render_message(message);
|
|
|
|
}
|
|
|
|
|
2013-05-09 16:44:35 +00:00
|
|
|
XuiRenderEnd( app.GetDC() );
|
2014-03-05 18:03:25 +00:00
|
|
|
|
|
|
|
d3dr->SetViewport(&d3d->final_viewport);
|
2013-03-10 02:34:37 +00:00
|
|
|
}
|
2013-09-19 13:01:17 +00:00
|
|
|
|
2014-05-30 18:53:10 +00:00
|
|
|
static int rmenu_xui_input_postprocess(uint64_t old_state)
|
2013-09-29 22:54:35 +00:00
|
|
|
{
|
2014-05-30 18:53:10 +00:00
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)driver.menu;
|
2013-09-29 22:54:35 +00:00
|
|
|
bool quit = false;
|
|
|
|
bool resize = false;
|
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
|
|
|
unsigned frame_count;
|
|
|
|
|
2014-01-10 20:21:49 +00:00
|
|
|
(void)width;
|
|
|
|
(void)height;
|
|
|
|
(void)frame_count;
|
|
|
|
|
2013-09-29 22:54:35 +00:00
|
|
|
if ((rgui->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
|
|
|
|
g_extern.main_is_init)
|
|
|
|
{
|
2013-11-07 20:44:44 +00:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
2013-09-29 22:54:35 +00:00
|
|
|
process_input_ret = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (quit)
|
|
|
|
process_input_ret = -1;
|
|
|
|
|
|
|
|
int process_input_ret_old = process_input_ret;
|
|
|
|
process_input_ret = 0;
|
|
|
|
|
|
|
|
return process_input_ret_old;
|
|
|
|
}
|
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
static void blit_line(int x, int y, const char *message, bool green)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
static void rmenu_xui_render_background(void)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
static void rmenu_xui_render_messagebox(const char *message)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
2014-03-09 17:25:52 +00:00
|
|
|
msg_queue_clear(xui_msg_queue);
|
|
|
|
msg_queue_push(xui_msg_queue, message, 2, 1);
|
2014-02-28 16:50:55 +00:00
|
|
|
}
|
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
static void rmenu_xui_render(void)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
2014-05-30 19:51:12 +00:00
|
|
|
size_t begin, end;
|
|
|
|
char title[256];
|
|
|
|
const char *dir = NULL;
|
|
|
|
unsigned menu_type = 0;
|
|
|
|
unsigned menu_type_is = 0;
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)driver.menu;
|
2014-02-28 16:50:55 +00:00
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
if (!rgui || rgui->need_refresh &&
|
2014-02-28 16:50:55 +00:00
|
|
|
(g_extern.lifecycle_state & (1ULL << MODE_MENU))
|
|
|
|
&& !rgui->msg_force)
|
|
|
|
return;
|
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
begin = rgui->selection_ptr;
|
|
|
|
end = rgui->selection_buf->size;
|
2014-02-28 16:50:55 +00:00
|
|
|
|
2014-05-30 19:51:12 +00:00
|
|
|
rmenu_xui_render_background();
|
2014-02-28 16:50:55 +00:00
|
|
|
|
|
|
|
file_list_get_last(rgui->menu_stack, &dir, &menu_type);
|
|
|
|
|
2014-04-26 00:40:38 +00: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-02-28 20:24:39 +00:00
|
|
|
if (menu_type == RGUI_SETTINGS_CORE)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "CORE SELECTION %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_DEFERRED_CORE)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "DETECTED CORES %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_CONFIG)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "CONFIG %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_DISK_APPEND)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "DISK APPEND %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_VIDEO_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "VIDEO OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_INPUT_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "INPUT OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_OVERLAY_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
|
2014-03-02 03:46:26 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS)
|
|
|
|
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "PATH OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "SETTINGS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_DRIVERS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_SHADER_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "SHADER OPTIONS", sizeof(title));
|
|
|
|
#endif
|
2014-04-08 14:23:28 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_FONT_OPTIONS)
|
|
|
|
strlcpy(title, "FONT OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_GENERAL_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "GENERAL OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_AUDIO_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "AUDIO OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_DISK_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "DISK OPTIONS", sizeof(title));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_CORE_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "CORE OPTIONS", sizeof(title));
|
2014-03-03 05:48:09 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_CORE_INFO)
|
|
|
|
strlcpy(title, "CORE INFO", sizeof(title));
|
2014-04-06 20:59:16 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_PRIVACY_OPTIONS)
|
|
|
|
strlcpy(title, "PRIVACY OPTIONS", sizeof(title));
|
2014-02-28 16:50:55 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-04-26 00:40:38 +00:00
|
|
|
else if (menu_type_is == RGUI_SETTINGS_SHADER_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "SHADER %s", dir);
|
|
|
|
#endif
|
2014-02-28 20:24:39 +00:00
|
|
|
else if ((menu_type == RGUI_SETTINGS_INPUT_OPTIONS) ||
|
|
|
|
(menu_type == RGUI_SETTINGS_PATH_OPTIONS) ||
|
|
|
|
(menu_type == RGUI_SETTINGS_OPTIONS) ||
|
|
|
|
(menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT || menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2) ||
|
|
|
|
menu_type == RGUI_SETTINGS_CUSTOM_BIND ||
|
|
|
|
menu_type == RGUI_START_SCREEN ||
|
|
|
|
menu_type == RGUI_SETTINGS)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "MENU %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_OPEN_HISTORY)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(title, "LOAD HISTORY", sizeof(title));
|
|
|
|
#ifdef HAVE_OVERLAY
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_OVERLAY_PRESET)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "OVERLAY %s", dir);
|
|
|
|
#endif
|
2014-04-27 16:15:41 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER)
|
|
|
|
snprintf(title, sizeof(title), "FILTER %s", dir);
|
|
|
|
else if (menu_type == RGUI_SETTINGS_AUDIO_DSP_FILTER)
|
|
|
|
snprintf(title, sizeof(title), "DSP FILTER %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_BROWSER_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "BROWSER DIR %s", dir);
|
2014-05-27 05:58:41 +00:00
|
|
|
else if (menu_type == RGUI_CONTENT_DIR_PATH)
|
|
|
|
snprintf(title, sizeof(title), "CONTENT DIR %s", dir);
|
2014-02-28 16:50:55 +00:00
|
|
|
#ifdef HAVE_SCREENSHOTS
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SCREENSHOT_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir);
|
|
|
|
#endif
|
2014-05-26 00:57:44 +00:00
|
|
|
else if (menu_type == RGUI_AUTOCONFIG_DIR_PATH)
|
|
|
|
snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SHADER_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
|
2014-04-15 04:19:24 +00:00
|
|
|
else if (menu_type == RGUI_FILTER_DIR_PATH)
|
|
|
|
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
|
2014-04-27 16:15:41 +00:00
|
|
|
else if (menu_type == RGUI_DSP_FILTER_DIR_PATH)
|
|
|
|
snprintf(title, sizeof(title), "DSP_FILTER DIR %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SAVESTATE_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
|
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_LIBRETRO_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
|
|
|
|
#endif
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_CONFIG_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SAVEFILE_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
|
|
|
|
#ifdef HAVE_OVERLAY
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_OVERLAY_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "OVERLAY DIR %s", dir);
|
|
|
|
#endif
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SYSTEM_DIR_PATH)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(title, sizeof(title), "SYSTEM DIR %s", dir);
|
2014-05-10 03:12:31 +00:00
|
|
|
else if (menu_type == RGUI_ASSETS_DIR_PATH)
|
|
|
|
snprintf(title, sizeof(title), "ASSETS DIR %s", dir);
|
2014-02-28 16:50:55 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rgui->defer_core)
|
|
|
|
snprintf(title, sizeof(title), "CONTENT %s", dir);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *core_name = rgui->info.library_name;
|
|
|
|
if (!core_name)
|
|
|
|
core_name = g_extern.system.info.library_name;
|
|
|
|
if (!core_name)
|
|
|
|
core_name = "No Core";
|
|
|
|
snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-02 21:52:48 +00:00
|
|
|
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
|
|
|
|
XuiTextElementSetText(m_menutitle, strw_buffer);
|
|
|
|
|
2014-02-28 16:50:55 +00:00
|
|
|
char title_buf[256];
|
2014-02-28 20:15:16 +00:00
|
|
|
menu_ticker_line(title_buf, RXUI_TERM_WIDTH - 3, g_extern.frame_count / 15, title, true);
|
2014-05-30 19:51:12 +00:00
|
|
|
blit_line(RXUI_TERM_START_X + 15, 15, title_buf, true);
|
2014-02-28 16:50:55 +00:00
|
|
|
|
|
|
|
char title_msg[64];
|
|
|
|
const char *core_name = rgui->info.library_name;
|
|
|
|
if (!core_name)
|
|
|
|
core_name = g_extern.system.info.library_name;
|
|
|
|
if (!core_name)
|
|
|
|
core_name = "No Core";
|
|
|
|
|
|
|
|
const char *core_version = rgui->info.library_version;
|
|
|
|
if (!core_version)
|
|
|
|
core_version = g_extern.system.info.library_version;
|
|
|
|
if (!core_version)
|
|
|
|
core_version = "";
|
|
|
|
|
2014-02-28 20:15:16 +00:00
|
|
|
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version);
|
2014-05-30 19:51:12 +00:00
|
|
|
blit_line(RXUI_TERM_START_X + 15, (RXUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RXUI_TERM_START_Y + 2, title_msg, true);
|
2014-02-28 16:50:55 +00:00
|
|
|
|
|
|
|
unsigned x, y;
|
|
|
|
size_t i;
|
|
|
|
|
2014-02-28 20:15:16 +00:00
|
|
|
x = RXUI_TERM_START_X;
|
|
|
|
y = RXUI_TERM_START_Y;
|
2014-02-28 16:50:55 +00:00
|
|
|
|
|
|
|
for (i = begin; i < end; i++/*, y += FONT_HEIGHT_STRIDE */)
|
|
|
|
{
|
|
|
|
const char *path = 0;
|
|
|
|
unsigned type = 0;
|
|
|
|
file_list_get_at_offset(rgui->selection_buf, i, &path, &type);
|
|
|
|
char message[256];
|
|
|
|
char type_str[256];
|
|
|
|
|
|
|
|
unsigned w = 19;
|
2014-02-28 20:24:39 +00:00
|
|
|
if (menu_type == RGUI_SETTINGS_INPUT_OPTIONS || menu_type == RGUI_SETTINGS_CUSTOM_BIND)
|
2014-02-28 16:50:55 +00:00
|
|
|
w = 21;
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS)
|
2014-02-28 16:50:55 +00:00
|
|
|
w = 24;
|
|
|
|
|
2014-02-28 20:24:39 +00:00
|
|
|
if (type >= RGUI_SETTINGS_SHADER_FILTER &&
|
|
|
|
type <= RGUI_SETTINGS_SHADER_LAST)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
|
|
|
// HACK. Work around that we're using the menu_type as dir type to propagate state correctly.
|
2014-04-26 00:40:38 +00:00
|
|
|
if ((menu_type_is == RGUI_SETTINGS_SHADER_OPTIONS)
|
|
|
|
&& (menu_type_is == RGUI_SETTINGS_SHADER_OPTIONS))
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
2014-02-28 20:24:39 +00:00
|
|
|
type = RGUI_FILE_DIRECTORY;
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(type_str, "(DIR)", sizeof(type_str));
|
|
|
|
w = 5;
|
|
|
|
}
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (type == RGUI_SETTINGS_SHADER_OPTIONS || type == RGUI_SETTINGS_SHADER_PRESET)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(type_str, "...", sizeof(type_str));
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (type == RGUI_SETTINGS_SHADER_FILTER)
|
2014-02-28 16:50:55 +00:00
|
|
|
snprintf(type_str, sizeof(type_str), "%s",
|
|
|
|
g_settings.video.smooth ? "Linear" : "Nearest");
|
2014-04-25 23:53:40 +00:00
|
|
|
else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str)
|
|
|
|
driver.menu_ctx->backend->shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type);
|
2014-02-28 16:50:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
// Pretty-print libretro cores from menu.
|
2014-02-28 20:24:39 +00:00
|
|
|
if (menu_type == RGUI_SETTINGS_CORE || menu_type == RGUI_SETTINGS_DEFERRED_CORE)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
2014-02-28 20:24:39 +00:00
|
|
|
if (type == RGUI_FILE_PLAIN)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
|
|
|
strlcpy(type_str, "(CORE)", sizeof(type_str));
|
|
|
|
file_list_get_alt_at_offset(rgui->selection_buf, i, &path);
|
|
|
|
w = 6;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strlcpy(type_str, "(DIR)", sizeof(type_str));
|
2014-02-28 20:24:39 +00:00
|
|
|
type = RGUI_FILE_DIRECTORY;
|
2014-02-28 16:50:55 +00:00
|
|
|
w = 5;
|
|
|
|
}
|
|
|
|
}
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_CONFIG ||
|
2014-02-28 16:50:55 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2014-02-28 20:24:39 +00:00
|
|
|
menu_type == RGUI_SETTINGS_OVERLAY_PRESET ||
|
2014-02-28 16:50:55 +00:00
|
|
|
#endif
|
2014-04-27 16:15:41 +00:00
|
|
|
menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER ||
|
|
|
|
menu_type == RGUI_SETTINGS_AUDIO_DSP_FILTER ||
|
2014-02-28 20:24:39 +00:00
|
|
|
menu_type == RGUI_SETTINGS_DISK_APPEND ||
|
2014-04-26 00:40:38 +00:00
|
|
|
menu_type_is == RGUI_FILE_DIRECTORY)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
2014-02-28 20:24:39 +00:00
|
|
|
if (type == RGUI_FILE_PLAIN)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
|
|
|
strlcpy(type_str, "(FILE)", sizeof(type_str));
|
|
|
|
w = 6;
|
|
|
|
}
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (type == RGUI_FILE_USE_DIRECTORY)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
|
|
|
*type_str = '\0';
|
|
|
|
w = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strlcpy(type_str, "(DIR)", sizeof(type_str));
|
2014-02-28 20:24:39 +00:00
|
|
|
type = RGUI_FILE_DIRECTORY;
|
2014-02-28 16:50:55 +00:00
|
|
|
w = 5;
|
|
|
|
}
|
|
|
|
}
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (menu_type == RGUI_SETTINGS_OPEN_HISTORY)
|
2014-02-28 16:50:55 +00:00
|
|
|
{
|
|
|
|
*type_str = '\0';
|
|
|
|
w = 0;
|
|
|
|
}
|
2014-02-28 20:24:39 +00:00
|
|
|
else if (type >= RGUI_SETTINGS_CORE_OPTION_START)
|
2014-02-28 16:50:55 +00:00
|
|
|
strlcpy(type_str,
|
2014-02-28 20:24:39 +00:00
|
|
|
core_option_get_val(g_extern.system.core_options, type - RGUI_SETTINGS_CORE_OPTION_START),
|
2014-02-28 16:50:55 +00:00
|
|
|
sizeof(type_str));
|
2014-04-26 00:40:38 +00:00
|
|
|
else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label)
|
|
|
|
driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type);
|
2014-02-28 16:50:55 +00:00
|
|
|
|
|
|
|
char entry_title_buf[256];
|
|
|
|
char type_str_buf[64];
|
|
|
|
bool selected = i == rgui->selection_ptr;
|
|
|
|
|
|
|
|
strlcpy(entry_title_buf, path, sizeof(entry_title_buf));
|
|
|
|
strlcpy(type_str_buf, type_str, sizeof(type_str_buf));
|
|
|
|
|
2014-02-28 23:01:11 +00:00
|
|
|
#if 0
|
2014-02-28 20:24:39 +00:00
|
|
|
if ((type == RGUI_FILE_PLAIN || type == RGUI_FILE_DIRECTORY))
|
2014-02-28 20:15:16 +00:00
|
|
|
menu_ticker_line(entry_title_buf, RXUI_TERM_WIDTH - (w + 1 + 2), g_extern.frame_count / 15, path, selected);
|
2014-02-28 16:50:55 +00:00
|
|
|
else
|
|
|
|
menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, type_str, selected);
|
2014-02-28 23:01:11 +00:00
|
|
|
#endif
|
2014-02-28 16:50:55 +00:00
|
|
|
|
2014-02-28 23:01:11 +00:00
|
|
|
snprintf(message, sizeof(message), "%s : %s",
|
2014-02-28 16:50:55 +00:00
|
|
|
entry_title_buf,
|
|
|
|
type_str_buf);
|
|
|
|
|
2014-02-28 22:40:37 +00:00
|
|
|
wchar_t msg_w[256];
|
|
|
|
mbstowcs(msg_w, message, sizeof(msg_w) / sizeof(wchar_t));
|
2014-02-28 23:01:11 +00:00
|
|
|
XuiListSetText(m_menulist, i, msg_w);
|
2014-05-30 19:51:12 +00:00
|
|
|
blit_line(x, y, message, i);
|
2014-02-28 16:50:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rgui->keyboard.display)
|
|
|
|
{
|
|
|
|
char msg[1024];
|
|
|
|
const char *str = *rgui->keyboard.buffer;
|
|
|
|
if (!str)
|
|
|
|
str = "";
|
|
|
|
snprintf(msg, sizeof(msg), "%s\n%s", rgui->keyboard.label, str);
|
2014-03-25 09:19:02 +00:00
|
|
|
rmenu_xui_render_messagebox(rgui, msg);
|
2014-02-28 16:50:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-08 05:15:52 +00:00
|
|
|
static void rmenu_xui_populate_entries(void *data, unsigned i)
|
|
|
|
{
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
XuiListSetCurSelVisible(m_menulist, rgui->selection_ptr);
|
|
|
|
}
|
2014-02-28 16:50:55 +00:00
|
|
|
|
2014-04-13 21:41:47 +00:00
|
|
|
static void rmenu_xui_navigation_clear(void *data)
|
|
|
|
{
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
XuiListSetCurSelVisible(m_menulist, rgui->selection_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rmenu_xui_navigation_set_visible(void *data)
|
|
|
|
{
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
XuiListSetCurSelVisible(m_menulist, rgui->selection_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rmenu_xui_navigation_alphabet(void *data, size_t *ptr_out)
|
|
|
|
{
|
|
|
|
XuiListSetCurSelVisible(m_menulist, *ptr_out);
|
|
|
|
}
|
|
|
|
|
2014-04-13 22:09:52 +00:00
|
|
|
static void rmenu_xui_list_insert(void *data, const char *path, size_t list_size)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
wchar_t buf[PATH_MAX];
|
|
|
|
|
|
|
|
XuiListInsertItems(m_menulist, list_size, 1);
|
|
|
|
mbstowcs(buf, path, sizeof(buf) / sizeof(wchar_t));
|
|
|
|
XuiListSetText(m_menulist, list_size, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rmenu_xui_list_delete(void *data, size_t list_size)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
XuiListDeleteItems(m_menulist, 0, list_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rmenu_xui_list_clear(void *data)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rmenu_xui_list_set_selection(void *data)
|
|
|
|
{
|
|
|
|
file_list_t *list = (file_list_t*)data;
|
|
|
|
XuiListSetCurSel(m_menulist, list->list[list->size].directory_ptr);
|
|
|
|
}
|
|
|
|
|
2014-05-09 19:00:50 +00:00
|
|
|
static void rmenu_xui_init_core_info(void *data)
|
|
|
|
{
|
|
|
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
|
|
|
|
|
|
|
core_info_list_free(rgui->core_info);
|
|
|
|
rgui->core_info = NULL;
|
|
|
|
if (*g_settings.libretro_directory)
|
|
|
|
rgui->core_info = core_info_list_new(g_settings.libretro_directory);
|
|
|
|
}
|
|
|
|
|
2013-09-19 13:01:17 +00:00
|
|
|
const menu_ctx_driver_t menu_ctx_rmenu_xui = {
|
2013-11-04 15:23:37 +00:00
|
|
|
NULL,
|
2014-03-09 17:25:52 +00:00
|
|
|
rmenu_xui_render_messagebox,
|
2014-02-28 16:50:55 +00:00
|
|
|
rmenu_xui_render,
|
2014-04-01 02:45:00 +00:00
|
|
|
rmenu_xui_frame,
|
2013-11-19 05:09:14 +00:00
|
|
|
rmenu_xui_init,
|
|
|
|
rmenu_xui_free,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2014-03-08 05:15:52 +00:00
|
|
|
rmenu_xui_populate_entries,
|
2014-02-28 20:15:16 +00:00
|
|
|
NULL,
|
2014-02-28 00:44:03 +00:00
|
|
|
rmenu_xui_input_postprocess,
|
2014-04-13 21:41:47 +00:00
|
|
|
rmenu_xui_navigation_clear,
|
|
|
|
rmenu_xui_navigation_set_visible,
|
|
|
|
rmenu_xui_navigation_set_visible,
|
|
|
|
rmenu_xui_navigation_set_visible,
|
|
|
|
rmenu_xui_navigation_set_visible,
|
|
|
|
rmenu_xui_navigation_alphabet,
|
|
|
|
rmenu_xui_navigation_alphabet,
|
2014-04-13 22:09:52 +00:00
|
|
|
rmenu_xui_list_insert,
|
|
|
|
rmenu_xui_list_delete,
|
|
|
|
rmenu_xui_list_clear,
|
|
|
|
rmenu_xui_list_set_selection,
|
2014-05-09 19:00:50 +00:00
|
|
|
rmenu_xui_init_core_info,
|
2014-04-14 00:32:54 +00:00
|
|
|
&menu_ctx_backend_common,
|
2013-09-19 13:01:17 +00:00
|
|
|
"rmenu_xui",
|
2014-02-28 18:22:32 +00:00
|
|
|
};
|