mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-09 05:07:00 +00:00
(Menu) Add populate_entries to menu_ctx_driver - will be needed for RMenu XUI
This commit is contained in:
parent
1372df61de
commit
8fe6a04b56
@ -581,5 +581,6 @@ const menu_ctx_driver_t menu_ctx_rgui = {
|
|||||||
rgui_free,
|
rgui_free,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
"rgui",
|
"rgui",
|
||||||
};
|
};
|
||||||
|
@ -476,5 +476,6 @@ const menu_ctx_driver_t menu_ctx_rmenu = {
|
|||||||
rmenu_free,
|
rmenu_free,
|
||||||
rmenu_init_assets,
|
rmenu_init_assets,
|
||||||
rmenu_free_assets,
|
rmenu_free_assets,
|
||||||
|
NULL,
|
||||||
"rmenu",
|
"rmenu",
|
||||||
};
|
};
|
||||||
|
@ -2014,6 +2014,9 @@ void menu_populate_entries(void *data, unsigned menu_type)
|
|||||||
file_list_push(rgui->selection_buf, "Quit RetroArch", RGUI_SETTINGS_QUIT_RARCH, 0);
|
file_list_push(rgui->selection_buf, "Quit RetroArch", RGUI_SETTINGS_QUIT_RARCH, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (menu_ctx && menu_ctx->populate_entries)
|
||||||
|
menu_ctx->populate_entries(rgui, menu_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_parse_and_resolve(void *data, unsigned menu_type)
|
void menu_parse_and_resolve(void *data, unsigned menu_type)
|
||||||
|
@ -33,6 +33,7 @@ typedef struct menu_ctx_driver
|
|||||||
void (*free)(void*);
|
void (*free)(void*);
|
||||||
void (*init_assets)(void*);
|
void (*init_assets)(void*);
|
||||||
void (*free_assets)(void*);
|
void (*free_assets)(void*);
|
||||||
|
void (*populate_entries)(void*, unsigned);
|
||||||
|
|
||||||
// Human readable string.
|
// Human readable string.
|
||||||
const char *ident;
|
const char *ident;
|
||||||
|
@ -295,34 +295,34 @@ static void set_dpad_emulation_label(unsigned port, char *str, size_t sizeof_str
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_menulist(unsigned menu_id)
|
static void rmenu_xui_populate_entries(void *data, unsigned menu_type)
|
||||||
{
|
{
|
||||||
XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist));
|
XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist));
|
||||||
|
|
||||||
switch (menu_id)
|
switch (menu_id)
|
||||||
{
|
{
|
||||||
case INGAME_MENU_CORE_OPTIONS_MODE:
|
case INGAME_MENU_CORE_OPTIONS_MODE:
|
||||||
if (g_extern.system.core_options)
|
if (g_extern.system.core_options)
|
||||||
{
|
{
|
||||||
size_t opts = core_option_size(g_extern.system.core_options);
|
size_t opts = core_option_size(g_extern.system.core_options);
|
||||||
for (size_t i = 0; i < opts; i++)
|
for (size_t i = 0; i < opts; i++)
|
||||||
{
|
{
|
||||||
char label[256];
|
char label[256];
|
||||||
strlcpy(label, core_option_get_desc(g_extern.system.core_options, i),
|
strlcpy(label, core_option_get_desc(g_extern.system.core_options, i),
|
||||||
sizeof(label));
|
sizeof(label));
|
||||||
snprintf(label, sizeof(label), "%s : %s", label,
|
snprintf(label, sizeof(label), "%s : %s", label,
|
||||||
core_option_get_val(g_extern.system.core_options, i));
|
core_option_get_val(g_extern.system.core_options, i));
|
||||||
mbstowcs(strw_buffer, label,
|
mbstowcs(strw_buffer, label,
|
||||||
sizeof(strw_buffer) / sizeof(wchar_t));
|
sizeof(strw_buffer) / sizeof(wchar_t));
|
||||||
XuiListInsertItems(m_menulist, i, 1);
|
XuiListInsertItems(m_menulist, i, 1);
|
||||||
XuiListSetText(m_menulist, i, strw_buffer);
|
XuiListSetText(m_menulist, i, strw_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XuiListInsertItems(m_menulist, 0, 1);
|
XuiListInsertItems(m_menulist, 0, 1);
|
||||||
XuiListSetText(m_menulist, 0, L"No options available.");
|
XuiListSetText(m_menulist, 0, L"No options available.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INGAME_MENU_LOAD_GAME_HISTORY_MODE:
|
case INGAME_MENU_LOAD_GAME_HISTORY_MODE:
|
||||||
{
|
{
|
||||||
@ -453,7 +453,7 @@ static void init_menulist(unsigned menu_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned xui_input_to_rgui_action(unsigned input)
|
static unsigned xui_input_to_rmenu_xui_action(unsigned input)
|
||||||
{
|
{
|
||||||
switch (input)
|
switch (input)
|
||||||
{
|
{
|
||||||
@ -478,7 +478,7 @@ HRESULT CRetroArchLoadGameHistory::OnControlNavigate(
|
|||||||
|
|
||||||
unsigned current_index = XuiListGetCurSel(m_menulist, NULL);
|
unsigned current_index = XuiListGetCurSel(m_menulist, NULL);
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
if (action == RGUI_ACTION_OK)
|
if (action == RGUI_ACTION_OK)
|
||||||
{
|
{
|
||||||
@ -512,7 +512,7 @@ HRESULT CRetroArchControls::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
|||||||
|
|
||||||
XuiTextElementSetText(m_menutitle, L"Input options");
|
XuiTextElementSetText(m_menutitle, L"Input options");
|
||||||
|
|
||||||
init_menulist(INGAME_MENU_INPUT_OPTIONS_MODE);
|
rmenu_xui_populate_entries(NULL, INGAME_MENU_INPUT_OPTIONS_MODE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -522,7 +522,7 @@ HRESULT CRetroArchFileBrowser::OnControlNavigate(
|
|||||||
{
|
{
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
{
|
{
|
||||||
@ -543,7 +543,7 @@ HRESULT CRetroArchShaderBrowser::OnControlNavigate(
|
|||||||
XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
@ -565,7 +565,7 @@ HRESULT CRetroArchCoreBrowser::OnControlNavigate(
|
|||||||
XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
@ -610,7 +610,7 @@ HRESULT CRetroArchControls::OnControlNavigate(
|
|||||||
|
|
||||||
current_index = XuiListGetCurSel(m_menulist, NULL);
|
current_index = XuiListGetCurSel(m_menulist, NULL);
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
switch(current_index)
|
switch(current_index)
|
||||||
{
|
{
|
||||||
@ -666,7 +666,7 @@ HRESULT CRetroArchLoadGameHistory::OnInit(XUIMessageInit * pInitData, BOOL& bHan
|
|||||||
|
|
||||||
XuiTextElementSetText(m_menutitle, L"Load History");
|
XuiTextElementSetText(m_menutitle, L"Load History");
|
||||||
|
|
||||||
init_menulist(INGAME_MENU_LOAD_GAME_HISTORY_MODE);
|
rmenu_xui_populate_entries(NULL, INGAME_MENU_LOAD_GAME_HISTORY_MODE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -679,7 +679,7 @@ HRESULT CRetroArchSettings::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
|||||||
|
|
||||||
XuiTextElementSetText(m_menutitle, L"Settings");
|
XuiTextElementSetText(m_menutitle, L"Settings");
|
||||||
|
|
||||||
init_menulist(INGAME_MENU_SETTINGS_MODE);
|
rmenu_xui_populate_entries(NULL, INGAME_MENU_SETTINGS_MODE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -692,7 +692,7 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
|||||||
current_index = XuiListGetCurSel(m_menulist, NULL);
|
current_index = XuiListGetCurSel(m_menulist, NULL);
|
||||||
|
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
switch(current_index)
|
switch(current_index)
|
||||||
{
|
{
|
||||||
@ -756,7 +756,7 @@ HRESULT CRetroArchCoreOptions::OnInit(XUIMessageInit * pInitData, BOOL& bHandled
|
|||||||
|
|
||||||
XuiTextElementSetText(m_menutitle, L"Core Options");
|
XuiTextElementSetText(m_menutitle, L"Core Options");
|
||||||
|
|
||||||
init_menulist(INGAME_MENU_CORE_OPTIONS_MODE);
|
rmenu_xui_populate_entries(NULL, INGAME_MENU_CORE_OPTIONS_MODE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -781,7 +781,7 @@ HRESULT CRetroArchCoreOptions::OnControlNavigate(XUIMessageControlNavigate *pCon
|
|||||||
{
|
{
|
||||||
unsigned current_index = XuiListGetCurSel(m_menulist, NULL);
|
unsigned current_index = XuiListGetCurSel(m_menulist, NULL);
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
if (g_extern.system.core_options)
|
if (g_extern.system.core_options)
|
||||||
{
|
{
|
||||||
@ -849,7 +849,7 @@ HRESULT CRetroArchAudioOptions::OnControlNavigate(XUIMessageControlNavigate *pCo
|
|||||||
{
|
{
|
||||||
int current_index = XuiListGetCurSel(m_menulist, NULL);
|
int current_index = XuiListGetCurSel(m_menulist, NULL);
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
switch (current_index)
|
switch (current_index)
|
||||||
{
|
{
|
||||||
@ -934,7 +934,7 @@ HRESULT CRetroArchVideoOptions::OnControlNavigate(XUIMessageControlNavigate *pCo
|
|||||||
current_index = XuiListGetCurSel(m_menulist, NULL);
|
current_index = XuiListGetCurSel(m_menulist, NULL);
|
||||||
|
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
switch (current_index)
|
switch (current_index)
|
||||||
{
|
{
|
||||||
@ -1090,7 +1090,7 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
|||||||
GetChildById(L"XuiTxtTitle", &m_menutitle);
|
GetChildById(L"XuiTxtTitle", &m_menutitle);
|
||||||
GetChildById(L"XuiTxtBottom", &m_menutitlebottom);
|
GetChildById(L"XuiTxtBottom", &m_menutitlebottom);
|
||||||
|
|
||||||
init_menulist(INGAME_MENU_MAIN_MODE);
|
rmenu_xui_populate_entries(NULL, INGAME_MENU_MAIN_MODE);
|
||||||
|
|
||||||
mbstowcs(strw_buffer, g_extern.title_buf, sizeof(strw_buffer) / sizeof(wchar_t));
|
mbstowcs(strw_buffer, g_extern.title_buf, sizeof(strw_buffer) / sizeof(wchar_t));
|
||||||
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
||||||
@ -1110,7 +1110,7 @@ HRESULT CRetroArchMain::OnControlNavigate(XUIMessageControlNavigate *pControlNav
|
|||||||
current_index= XuiListGetCurSel(m_menulist, NULL);
|
current_index= XuiListGetCurSel(m_menulist, NULL);
|
||||||
|
|
||||||
unsigned input = pControlNavigateData->nControlNavigate;
|
unsigned input = pControlNavigateData->nControlNavigate;
|
||||||
unsigned action = xui_input_to_rgui_action(input);
|
unsigned action = xui_input_to_rmenu_xui_action(input);
|
||||||
|
|
||||||
HXUIOBJ current_obj = current_menu;
|
HXUIOBJ current_obj = current_menu;
|
||||||
|
|
||||||
@ -1263,7 +1263,7 @@ HRESULT CRetroArchMain::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* rgui_init (void)
|
static void* rmenu_xui_init (void)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
@ -1348,7 +1348,7 @@ static void* rgui_init (void)
|
|||||||
return rgui;
|
return rgui;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgui_free(void *data)
|
static void rmenu_xui_free(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
app.Uninit();
|
app.Uninit();
|
||||||
@ -1367,7 +1367,7 @@ int rmenu_xui_iterate(void *data, unsigned action)
|
|||||||
XuiSceneNavigateBack(current_menu, root_menu, XUSER_INDEX_ANY);
|
XuiSceneNavigateBack(current_menu, root_menu, XUSER_INDEX_ANY);
|
||||||
current_menu = root_menu;
|
current_menu = root_menu;
|
||||||
XuiElementGetChildById(current_menu, L"XuiMenuList", &m_menulist);
|
XuiElementGetChildById(current_menu, L"XuiMenuList", &m_menulist);
|
||||||
init_menulist(INGAME_MENU_MAIN_MODE);
|
rmenu_xui_populate_entries(NULL, INGAME_MENU_MAIN_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1397,7 +1397,7 @@ bool menu_iterate_xui(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rgui_input_postprocess(void *data, uint64_t old_state)
|
int rmenu_xui_input_postprocess(void *data, uint64_t old_state)
|
||||||
{
|
{
|
||||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
@ -1426,7 +1426,10 @@ const menu_ctx_driver_t menu_ctx_rmenu_xui = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
rgui_init,
|
rmenu_xui_init,
|
||||||
rgui_free,
|
rmenu_xui_free,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
rmenu_xui_populate_entries,
|
||||||
"rmenu_xui",
|
"rmenu_xui",
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user