mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 13:43:32 +00:00
(RMenu) menu_loop renamed into rmenu_iterate - iterates menu code for one frame
This commit is contained in:
parent
a570493672
commit
dacab094f0
@ -1146,80 +1146,92 @@ static void ingame_menu_resize (void)
|
||||
g_extern.console.rmenu.input_loop = INPUT_LOOP_MENU;
|
||||
}
|
||||
|
||||
void menu_loop(void)
|
||||
bool rmenu_iterate(void)
|
||||
{
|
||||
static bool preinit = true;
|
||||
HRESULT hr;
|
||||
xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data;
|
||||
|
||||
g_extern.console.rmenu.state.rmenu.enable = true;
|
||||
|
||||
device_ptr->block_swap = true;
|
||||
|
||||
g_extern.console.rmenu.input_loop = INPUT_LOOP_MENU;
|
||||
|
||||
do
|
||||
if(preinit)
|
||||
{
|
||||
g_extern.frame_count++;
|
||||
device_ptr->block_swap = true;
|
||||
g_extern.console.rmenu.input_loop = INPUT_LOOP_MENU;
|
||||
g_extern.draw_menu = true;
|
||||
preinit = false;
|
||||
}
|
||||
|
||||
if(g_extern.console.emulator_initialized)
|
||||
rarch_render_cached_frame();
|
||||
else
|
||||
{
|
||||
device_ptr->ctx_driver->clear();
|
||||
g_extern.frame_count++;
|
||||
}
|
||||
g_extern.frame_count++;
|
||||
|
||||
XINPUT_STATE state;
|
||||
XInputGetState(0, &state);
|
||||
if(g_extern.console.emulator_initialized)
|
||||
rarch_render_cached_frame();
|
||||
else
|
||||
{
|
||||
device_ptr->ctx_driver->clear();
|
||||
g_extern.frame_count++;
|
||||
}
|
||||
|
||||
g_extern.console.rmenu.state.rmenu.enable = !((state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
|
||||
&& (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && (g_extern.console.emulator_initialized)
|
||||
&& IS_TIMER_EXPIRED(0));
|
||||
XINPUT_STATE state;
|
||||
XInputGetState(0, &state);
|
||||
|
||||
g_extern.console.rmenu.mode = g_extern.console.rmenu.state.rmenu.enable ? MODE_MENU : MODE_EMULATION;
|
||||
bool rmenu_enable = !((state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
|
||||
&& (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && (g_extern.console.emulator_initialized)
|
||||
&& IS_TIMER_EXPIRED(0));
|
||||
|
||||
switch(g_extern.console.rmenu.input_loop)
|
||||
{
|
||||
case INPUT_LOOP_FILEBROWSER:
|
||||
/*
|
||||
if(((state.Gamepad.wButtons & XINPUT_GAMEPAD_Y) && hCur != app.hMainScene))
|
||||
{
|
||||
uint64_t action = (1 << RMENU_DEVICE_NAV_A);
|
||||
browser_update(browser, action, rarch_console_get_rom_ext());
|
||||
SET_TIMER_EXPIRATION(d3d, 0, 15);
|
||||
}
|
||||
*/
|
||||
case INPUT_LOOP_MENU:
|
||||
app.RunFrame(); /* Update XUI */
|
||||
if((state.Gamepad.wButtons & XINPUT_GAMEPAD_B) && hCur != app.hMainScene)
|
||||
XuiSceneNavigateBack(hCur, app.hMainScene, XUSER_INDEX_ANY);
|
||||
break;
|
||||
case INPUT_LOOP_RESIZE_MODE:
|
||||
ingame_menu_resize();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
g_extern.console.rmenu.mode = rmenu_enable ? MODE_MENU : MODE_EMULATION;
|
||||
|
||||
hr = app.Render(); /* Render XUI */
|
||||
hr = XuiTimersRun(); /* Update XUI timers */
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION || g_extern.console.rmenu.mode == MODE_EXIT)
|
||||
goto deinit;
|
||||
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION && !(g_extern.lifecycle_state & (1ULL << RARCH_FRAMEADVANCE)))
|
||||
{
|
||||
SET_TIMER_EXPIRATION(0, 30);
|
||||
}
|
||||
switch(g_extern.console.rmenu.input_loop)
|
||||
{
|
||||
case INPUT_LOOP_FILEBROWSER:
|
||||
/*
|
||||
if(((state.Gamepad.wButtons & XINPUT_GAMEPAD_Y) && hCur != app.hMainScene))
|
||||
{
|
||||
uint64_t action = (1 << RMENU_DEVICE_NAV_A);
|
||||
browser_update(browser, action, rarch_console_get_rom_ext());
|
||||
SET_TIMER_EXPIRATION(d3d, 0, 15);
|
||||
}
|
||||
*/
|
||||
case INPUT_LOOP_MENU:
|
||||
app.RunFrame(); /* Update XUI */
|
||||
if((state.Gamepad.wButtons & XINPUT_GAMEPAD_B) && hCur != app.hMainScene)
|
||||
XuiSceneNavigateBack(hCur, app.hMainScene, XUSER_INDEX_ANY);
|
||||
break;
|
||||
case INPUT_LOOP_RESIZE_MODE:
|
||||
ingame_menu_resize();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const char *message = msg_queue_pull(g_extern.msg_queue);
|
||||
hr = app.Render(); /* Render XUI */
|
||||
hr = XuiTimersRun(); /* Update XUI timers */
|
||||
|
||||
if (message)
|
||||
{
|
||||
device_ptr->font_ctx->render_msg(device_ptr, message);
|
||||
}
|
||||
|
||||
device_ptr->ctx_driver->swap_buffers();
|
||||
}while(g_extern.console.rmenu.state.rmenu.enable);
|
||||
const char *message = msg_queue_pull(g_extern.msg_queue);
|
||||
|
||||
if (message)
|
||||
{
|
||||
device_ptr->font_ctx->render_msg(device_ptr, message);
|
||||
}
|
||||
|
||||
device_ptr->ctx_driver->swap_buffers();
|
||||
|
||||
return true;
|
||||
|
||||
deinit:
|
||||
if(!(g_extern.lifecycle_state & (1ULL << RARCH_FRAMEADVANCE)))
|
||||
{
|
||||
// set a timer delay so that we don't instantly switch back to the menu when
|
||||
// press and holding L3 + R3 in the emulation loop (lasts for 30 frame ticks)
|
||||
SET_TIMER_EXPIRATION(0, 30);
|
||||
}
|
||||
|
||||
device_ptr->block_swap = false;
|
||||
|
||||
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
||||
g_extern.draw_menu = false;
|
||||
preinit = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1943,7 +1943,6 @@ static void ingame_menu_screenshot(menu *current_menu, uint64_t input)
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_A))
|
||||
{
|
||||
menu_stack_pop();
|
||||
device_ptr->ctx_driver->rmenu_enable(true);
|
||||
}
|
||||
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_B))
|
||||
@ -2204,205 +2203,219 @@ void menu_free (void)
|
||||
rmenu_filebrowser_free();
|
||||
}
|
||||
|
||||
void menu_loop(void)
|
||||
bool rmenu_iterate(void)
|
||||
{
|
||||
static bool preinit = true;
|
||||
const char *msg;
|
||||
|
||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
||||
|
||||
g_extern.console.rmenu.state.rmenu.enable = true;
|
||||
device_ptr->block_swap = true;
|
||||
|
||||
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
||||
menu_stack_push(INGAME_MENU);
|
||||
|
||||
device_ptr->ctx_driver->rmenu_enable(true);
|
||||
|
||||
menu current_menu;
|
||||
menu_stack_force_refresh();
|
||||
|
||||
do
|
||||
if(preinit)
|
||||
{
|
||||
g_extern.frame_count++;
|
||||
device_ptr->block_swap = true;
|
||||
|
||||
//first button input frame
|
||||
uint64_t input_state_first_frame = 0;
|
||||
uint64_t input_state = 0;
|
||||
static bool first_held = false;
|
||||
rmenu_default_positions_t default_pos;
|
||||
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
||||
menu_stack_push(INGAME_MENU);
|
||||
|
||||
menu_stack_get_current_ptr(¤t_menu);
|
||||
menu_stack_force_refresh();
|
||||
g_extern.draw_menu = true;
|
||||
|
||||
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
|
||||
device_ptr->ctx_driver->rmenu_init();
|
||||
|
||||
input_ptr.poll(NULL);
|
||||
preinit = false;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < RMENU_DEVICE_NAV_LAST; i++)
|
||||
g_extern.frame_count++;
|
||||
|
||||
//first button input frame
|
||||
uint64_t input_state_first_frame = 0;
|
||||
uint64_t input_state = 0;
|
||||
static bool first_held = false;
|
||||
rmenu_default_positions_t default_pos;
|
||||
|
||||
menu_stack_get_current_ptr(¤t_menu);
|
||||
|
||||
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
|
||||
|
||||
input_ptr.poll(NULL);
|
||||
|
||||
for (unsigned i = 0; i < RMENU_DEVICE_NAV_LAST; i++)
|
||||
{
|
||||
input_state |= input_ptr.input_state(NULL, rmenu_nav_binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
||||
}
|
||||
|
||||
uint64_t trig_state = input_state & ~old_state; //set first button input frame as trigger
|
||||
input_state_first_frame = input_state; //hold onto first button input frame
|
||||
|
||||
//second button input frame
|
||||
input_state = 0;
|
||||
input_ptr.poll(NULL);
|
||||
|
||||
for (unsigned i = 0; i < RMENU_DEVICE_NAV_LAST; i++)
|
||||
{
|
||||
input_state |= input_ptr.input_state(NULL, rmenu_nav_binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
||||
}
|
||||
|
||||
bool analog_sticks_pressed = (input_state & (1ULL << RMENU_DEVICE_NAV_LEFT_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_RIGHT_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_UP_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_DOWN_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_LEFT_ANALOG_R)) || (input_state & (1ULL << RMENU_DEVICE_NAV_RIGHT_ANALOG_R)) || (input_state & (1ULL << RMENU_DEVICE_NAV_UP_ANALOG_R)) || (input_state & (1ULL << RMENU_DEVICE_NAV_DOWN_ANALOG_R));
|
||||
bool shoulder_buttons_pressed = ((input_state & (1ULL << RMENU_DEVICE_NAV_L2)) || (input_state & (1ULL << RMENU_DEVICE_NAV_R2))) && current_menu.category_id != CATEGORY_SETTINGS;
|
||||
bool do_held = analog_sticks_pressed || shoulder_buttons_pressed;
|
||||
|
||||
if(do_held)
|
||||
{
|
||||
if(!first_held)
|
||||
{
|
||||
input_state |= input_ptr.input_state(NULL, rmenu_nav_binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
||||
first_held = true;
|
||||
SET_TIMER_EXPIRATION(1, 7);
|
||||
}
|
||||
|
||||
uint64_t trig_state = input_state & ~old_state; //set first button input frame as trigger
|
||||
input_state_first_frame = input_state; //hold onto first button input frame
|
||||
|
||||
//second button input frame
|
||||
input_state = 0;
|
||||
input_ptr.poll(NULL);
|
||||
|
||||
for (unsigned i = 0; i < RMENU_DEVICE_NAV_LAST; i++)
|
||||
if(IS_TIMER_EXPIRED(1))
|
||||
{
|
||||
input_state |= input_ptr.input_state(NULL, rmenu_nav_binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
||||
first_held = false;
|
||||
trig_state = input_state; //second input frame set as current frame
|
||||
}
|
||||
}
|
||||
|
||||
bool analog_sticks_pressed = (input_state & (1ULL << RMENU_DEVICE_NAV_LEFT_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_RIGHT_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_UP_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_DOWN_ANALOG_L)) || (input_state & (1ULL << RMENU_DEVICE_NAV_LEFT_ANALOG_R)) || (input_state & (1ULL << RMENU_DEVICE_NAV_RIGHT_ANALOG_R)) || (input_state & (1ULL << RMENU_DEVICE_NAV_UP_ANALOG_R)) || (input_state & (1ULL << RMENU_DEVICE_NAV_DOWN_ANALOG_R));
|
||||
bool shoulder_buttons_pressed = ((input_state & (1ULL << RMENU_DEVICE_NAV_L2)) || (input_state & (1ULL << RMENU_DEVICE_NAV_R2))) && current_menu.category_id != CATEGORY_SETTINGS;
|
||||
bool do_held = analog_sticks_pressed || shoulder_buttons_pressed;
|
||||
device_ptr->ctx_driver->clear();
|
||||
|
||||
if(do_held)
|
||||
{
|
||||
if(!first_held)
|
||||
{
|
||||
first_held = true;
|
||||
SET_TIMER_EXPIRATION(1, 7);
|
||||
}
|
||||
if(!show_menu_screen || current_menu.enum_id == INGAME_MENU_SCREENSHOT)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
device_ptr->ctx_driver->set_blend(true);
|
||||
}
|
||||
|
||||
if(IS_TIMER_EXPIRED(1))
|
||||
{
|
||||
first_held = false;
|
||||
trig_state = input_state; //second input frame set as current frame
|
||||
}
|
||||
}
|
||||
rarch_render_cached_frame();
|
||||
|
||||
device_ptr->ctx_driver->clear();
|
||||
filebrowser_t * fb = &browser;
|
||||
|
||||
if(!show_menu_screen || current_menu.enum_id == INGAME_MENU_SCREENSHOT)
|
||||
{
|
||||
device_ptr->ctx_driver->rmenu_enable(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
device_ptr->ctx_driver->set_blend(true);
|
||||
device_ptr->ctx_driver->rmenu_enable(true);
|
||||
}
|
||||
|
||||
rarch_render_cached_frame();
|
||||
|
||||
filebrowser_t * fb = &browser;
|
||||
|
||||
switch(current_menu.enum_id)
|
||||
{
|
||||
case FILE_BROWSER_MENU:
|
||||
select_rom(¤t_menu, trig_state);
|
||||
fb = &browser;
|
||||
break;
|
||||
case GENERAL_VIDEO_MENU:
|
||||
case GENERAL_AUDIO_MENU:
|
||||
case EMU_GENERAL_MENU:
|
||||
case EMU_VIDEO_MENU:
|
||||
case EMU_AUDIO_MENU:
|
||||
case PATH_MENU:
|
||||
case CONTROLS_MENU:
|
||||
select_setting(¤t_menu, trig_state);
|
||||
break;
|
||||
case SHADER_CHOICE:
|
||||
case PRESET_CHOICE:
|
||||
case BORDER_CHOICE:
|
||||
case LIBRETRO_CHOICE:
|
||||
case INPUT_PRESET_CHOICE:
|
||||
select_file(¤t_menu, trig_state);
|
||||
fb = &tmpBrowser;
|
||||
break;
|
||||
case PATH_SAVESTATES_DIR_CHOICE:
|
||||
case PATH_DEFAULT_ROM_DIR_CHOICE:
|
||||
switch(current_menu.enum_id)
|
||||
{
|
||||
case FILE_BROWSER_MENU:
|
||||
select_rom(¤t_menu, trig_state);
|
||||
fb = &browser;
|
||||
break;
|
||||
case GENERAL_VIDEO_MENU:
|
||||
case GENERAL_AUDIO_MENU:
|
||||
case EMU_GENERAL_MENU:
|
||||
case EMU_VIDEO_MENU:
|
||||
case EMU_AUDIO_MENU:
|
||||
case PATH_MENU:
|
||||
case CONTROLS_MENU:
|
||||
select_setting(¤t_menu, trig_state);
|
||||
break;
|
||||
case SHADER_CHOICE:
|
||||
case PRESET_CHOICE:
|
||||
case BORDER_CHOICE:
|
||||
case LIBRETRO_CHOICE:
|
||||
case INPUT_PRESET_CHOICE:
|
||||
select_file(¤t_menu, trig_state);
|
||||
fb = &tmpBrowser;
|
||||
break;
|
||||
case PATH_SAVESTATES_DIR_CHOICE:
|
||||
case PATH_DEFAULT_ROM_DIR_CHOICE:
|
||||
#ifdef HAVE_XML
|
||||
case PATH_CHEATS_DIR_CHOICE:
|
||||
case PATH_CHEATS_DIR_CHOICE:
|
||||
#endif
|
||||
case PATH_SRAM_DIR_CHOICE:
|
||||
case PATH_SYSTEM_DIR_CHOICE:
|
||||
select_directory(¤t_menu, trig_state);
|
||||
fb = &tmpBrowser;
|
||||
break;
|
||||
case INGAME_MENU:
|
||||
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
||||
ingame_menu(¤t_menu, trig_state);
|
||||
break;
|
||||
case INGAME_MENU_RESIZE:
|
||||
ingame_menu_resize(¤t_menu, trig_state);
|
||||
break;
|
||||
case INGAME_MENU_SCREENSHOT:
|
||||
ingame_menu_screenshot(¤t_menu, trig_state);
|
||||
break;
|
||||
}
|
||||
case PATH_SRAM_DIR_CHOICE:
|
||||
case PATH_SYSTEM_DIR_CHOICE:
|
||||
select_directory(¤t_menu, trig_state);
|
||||
fb = &tmpBrowser;
|
||||
break;
|
||||
case INGAME_MENU:
|
||||
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
||||
ingame_menu(¤t_menu, trig_state);
|
||||
break;
|
||||
case INGAME_MENU_RESIZE:
|
||||
ingame_menu_resize(¤t_menu, trig_state);
|
||||
break;
|
||||
case INGAME_MENU_SCREENSHOT:
|
||||
ingame_menu_screenshot(¤t_menu, trig_state);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(current_menu.category_id)
|
||||
switch(current_menu.category_id)
|
||||
{
|
||||
case CATEGORY_FILEBROWSER:
|
||||
browser_render(fb);
|
||||
break;
|
||||
case CATEGORY_SETTINGS:
|
||||
case CATEGORY_INGAME_MENU:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
old_state = input_state_first_frame;
|
||||
|
||||
if(IS_TIMER_EXPIRED(0))
|
||||
{
|
||||
// if we want to force goto the emulation loop, skip this
|
||||
if(g_extern.console.rmenu.mode != MODE_EMULATION)
|
||||
{
|
||||
case CATEGORY_FILEBROWSER:
|
||||
browser_render(fb);
|
||||
break;
|
||||
case CATEGORY_SETTINGS:
|
||||
case CATEGORY_INGAME_MENU:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
old_state = input_state_first_frame;
|
||||
|
||||
if(IS_TIMER_EXPIRED(0))
|
||||
{
|
||||
// if we want to force goto the emulation loop, skip this
|
||||
if(g_extern.console.rmenu.mode != MODE_EMULATION)
|
||||
if(g_extern.console.rmenu.mode == MODE_EXIT)
|
||||
{
|
||||
if(g_extern.console.rmenu.mode == MODE_EXIT)
|
||||
{
|
||||
}
|
||||
// for ingame menu, we need a different precondition because menu_enable
|
||||
// can be set to false when going back from ingame menu to menu
|
||||
else if(g_extern.console.rmenu.state.ingame_menu.enable == true)
|
||||
{
|
||||
//we want to force exit when g_extern.console.mode is set to MODE_EXIT
|
||||
if(g_extern.console.rmenu.mode != MODE_EXIT)
|
||||
g_extern.console.rmenu.mode = (((old_state & (1ULL << RMENU_DEVICE_NAV_L3)) && (old_state & (1ULL << RMENU_DEVICE_NAV_R3)) && g_extern.console.emulator_initialized)) ? MODE_EMULATION : MODE_MENU;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_extern.console.rmenu.state.rmenu.enable = !(((old_state & (1ULL << RMENU_DEVICE_NAV_L3)) && (old_state & (1ULL << RMENU_DEVICE_NAV_R3)) && g_extern.console.emulator_initialized));
|
||||
g_extern.console.rmenu.mode = g_extern.console.rmenu.state.rmenu.enable ? MODE_MENU : MODE_EMULATION;
|
||||
}
|
||||
}
|
||||
// for ingame menu, we need a different precondition because menu_enable
|
||||
// can be set to false when going back from ingame menu to menu
|
||||
else if(g_extern.console.rmenu.state.ingame_menu.enable == true)
|
||||
{
|
||||
//we want to force exit when g_extern.console.mode is set to MODE_EXIT
|
||||
if(g_extern.console.rmenu.mode != MODE_EXIT)
|
||||
g_extern.console.rmenu.mode = (((old_state & (1ULL << RMENU_DEVICE_NAV_L3)) && (old_state & (1ULL << RMENU_DEVICE_NAV_R3)) && g_extern.console.emulator_initialized)) ? MODE_EMULATION : MODE_MENU;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool rmenu_enable = !(((old_state & (1ULL << RMENU_DEVICE_NAV_L3)) && (old_state & (1ULL << RMENU_DEVICE_NAV_R3)) && g_extern.console.emulator_initialized));
|
||||
g_extern.console.rmenu.mode = rmenu_enable ? MODE_MENU : MODE_EMULATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION || g_extern.console.rmenu.mode == MODE_EXIT)
|
||||
goto deinit;
|
||||
|
||||
msg = msg_queue_pull(g_extern.msg_queue);
|
||||
|
||||
if (msg && g_extern.console.rmenu.state.msg_info.enable)
|
||||
{
|
||||
device_ptr->font_ctx->render_msg_place(device_ptr,default_pos.msg_queue_x_position, default_pos.msg_queue_y_position, default_pos.msg_queue_font_size, WHITE, msg);
|
||||
}
|
||||
|
||||
device_ptr->ctx_driver->swap_buffers();
|
||||
bool quit, resize;
|
||||
unsigned width, height, frame_count;
|
||||
frame_count = 0;
|
||||
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
|
||||
|
||||
if(current_menu.enum_id == INGAME_MENU_RESIZE && (old_state & (1ULL << RMENU_DEVICE_NAV_Y)) || current_menu.enum_id == INGAME_MENU_SCREENSHOT)
|
||||
{ }
|
||||
else
|
||||
device_ptr->ctx_driver->set_blend(false);
|
||||
|
||||
return true;
|
||||
|
||||
deinit:
|
||||
if (!(g_extern.lifecycle_state & (1ULL << RARCH_FRAMEADVANCE)))
|
||||
{
|
||||
// set a timer delay so that we don't instantly switch back to the menu when
|
||||
// press and holding L3 + R3 in the emulation loop (lasts for 30 frame ticks)
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION && !(g_extern.lifecycle_state & (1ULL << RARCH_FRAMEADVANCE)))
|
||||
{
|
||||
SET_TIMER_EXPIRATION(0, 30);
|
||||
}
|
||||
|
||||
const char * message = msg_queue_pull(g_extern.msg_queue);
|
||||
|
||||
if (message && g_extern.console.rmenu.state.msg_info.enable)
|
||||
{
|
||||
device_ptr->font_ctx->render_msg_place(device_ptr,default_pos.msg_queue_x_position, default_pos.msg_queue_y_position, default_pos.msg_queue_font_size, WHITE, message);
|
||||
}
|
||||
|
||||
device_ptr->ctx_driver->swap_buffers();
|
||||
bool quit, resize;
|
||||
unsigned width, height, frame_count;
|
||||
frame_count = 0;
|
||||
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
|
||||
|
||||
if(current_menu.enum_id == INGAME_MENU_RESIZE && (old_state & (1ULL << RMENU_DEVICE_NAV_Y)) || current_menu.enum_id == INGAME_MENU_SCREENSHOT)
|
||||
{ }
|
||||
else
|
||||
device_ptr->ctx_driver->set_blend(false);
|
||||
}while(g_extern.console.rmenu.state.rmenu.enable);
|
||||
|
||||
device_ptr->ctx_driver->rmenu_enable(false);
|
||||
SET_TIMER_EXPIRATION(0, 30);
|
||||
}
|
||||
|
||||
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
||||
menu_stack_pop();
|
||||
|
||||
device_ptr->block_swap = false;
|
||||
|
||||
g_extern.draw_menu = false;
|
||||
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
||||
|
||||
device_ptr->ctx_driver->rmenu_free();
|
||||
|
||||
preinit = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ enum
|
||||
#define MAX_NO_OF_CONTROLS_SETTINGS SETTING_CONTROLS_DEFAULT_ALL+1
|
||||
|
||||
void menu_init (void);
|
||||
void menu_loop (void);
|
||||
bool rmenu_iterate(void);
|
||||
void menu_free (void);
|
||||
|
||||
#endif /* MENU_H_ */
|
||||
|
@ -572,6 +572,7 @@ struct global
|
||||
#endif
|
||||
} console;
|
||||
|
||||
bool draw_menu;
|
||||
uint64_t lifecycle_state;
|
||||
|
||||
struct
|
||||
|
@ -349,13 +349,13 @@ static void gfx_ctx_get_available_resolutions (void)
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
#define DRIVE_MAPPING_SIZE 3
|
||||
bool rmenu_inited = false;
|
||||
const char drive_mappings[DRIVE_MAPPING_SIZE][32] = {
|
||||
"/",
|
||||
"/mnt/",
|
||||
"/mnt/sdcard"
|
||||
};
|
||||
unsigned char drive_mapping_idx = 1;
|
||||
bool rmenu_inited = false;
|
||||
|
||||
static bool gfx_ctx_rmenu_init(void)
|
||||
{
|
||||
@ -364,6 +364,9 @@ static bool gfx_ctx_rmenu_init(void)
|
||||
if (!gl)
|
||||
return false;
|
||||
|
||||
if (rmenu_inited)
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
glGenTextures(1, &menu_texture_id);
|
||||
|
||||
@ -452,22 +455,6 @@ static const char * rmenu_ctx_drive_mapping_next(void)
|
||||
drive_mapping_idx++;
|
||||
return drive_mappings[drive_mapping_idx];
|
||||
}
|
||||
|
||||
static void gfx_ctx_menu_enable(bool enable)
|
||||
{
|
||||
gl_t *gl = driver.video_data;
|
||||
|
||||
if (enable)
|
||||
{
|
||||
if(!rmenu_inited)
|
||||
gfx_ctx_rmenu_init();
|
||||
gl->draw_rmenu = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_ctx_rmenu_free();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void rmenu_ctx_screenshot_enable(bool enable)
|
||||
|
@ -293,7 +293,7 @@ static void gfx_ctx_set_blend(bool enable)
|
||||
|
||||
static void gfx_ctx_set_resize(unsigned width, unsigned height) { }
|
||||
|
||||
bool rmenu_inited = false;
|
||||
static bool rmenu_inited = false;
|
||||
|
||||
static bool gfx_ctx_rmenu_init(void)
|
||||
{
|
||||
@ -302,6 +302,9 @@ static bool gfx_ctx_rmenu_init(void)
|
||||
if (!gl)
|
||||
return false;
|
||||
|
||||
if (rmenu_inited)
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
glGenTextures(1, &menu_texture_id);
|
||||
|
||||
@ -335,24 +338,6 @@ static bool gfx_ctx_rmenu_init(void)
|
||||
#if defined(HAVE_RMENU)
|
||||
static void gfx_ctx_rmenu_free(void)
|
||||
{
|
||||
gl_t *gl = driver.video_data;
|
||||
gl->draw_rmenu = false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_menu_enable(bool enable)
|
||||
{
|
||||
gl_t *gl = driver.video_data;
|
||||
|
||||
if (enable)
|
||||
{
|
||||
if(!rmenu_inited)
|
||||
gfx_ctx_rmenu_init();
|
||||
gl->draw_rmenu = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_ctx_rmenu_free();
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_ctx_rmenu_frame(void *data)
|
||||
@ -566,7 +551,6 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
|
||||
gfx_ctx_rmenu_init,
|
||||
gfx_ctx_rmenu_frame,
|
||||
gfx_ctx_rmenu_free,
|
||||
gfx_ctx_menu_enable,
|
||||
gfx_ctx_menu_draw_bg,
|
||||
gfx_ctx_menu_draw_panel,
|
||||
gfx_ctx_ps3_set_default_pos,
|
||||
|
@ -88,8 +88,6 @@ unsigned m_menuMainRomListPos_x;
|
||||
unsigned m_menuMainRomListPos_y;
|
||||
#endif
|
||||
|
||||
bool rmenu_inited = false;
|
||||
|
||||
static void gfx_ctx_xdk_set_blend(bool enable)
|
||||
{
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
@ -163,7 +161,6 @@ static bool gfx_ctx_xdk_menu_init(void)
|
||||
ypos = width == 640 ? 430 : 670;
|
||||
#endif
|
||||
|
||||
rmenu_inited = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -180,20 +177,6 @@ static void gfx_ctx_xdk_menu_free(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_menu_enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
if(!rmenu_inited)
|
||||
gfx_ctx_xdk_menu_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_ctx_xdk_menu_free();
|
||||
rmenu_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_ctx_xdk_swap_buffers(void)
|
||||
{
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
@ -538,7 +521,6 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
|
||||
gfx_ctx_xdk_menu_init,
|
||||
gfx_ctx_xdk_menu_frame,
|
||||
gfx_ctx_xdk_menu_free,
|
||||
gfx_ctx_menu_enable,
|
||||
gfx_ctx_xdk_menu_draw_bg,
|
||||
gfx_ctx_xdk_menu_draw_panel,
|
||||
gfx_ctx_xdk_menu_set_default_pos,
|
||||
|
@ -114,7 +114,6 @@ typedef struct gfx_ctx_driver
|
||||
bool (*rmenu_init)(void);
|
||||
void (*rmenu_frame)(void *data);
|
||||
void (*rmenu_free)(void);
|
||||
void (*rmenu_enable)(bool enable);
|
||||
void (*rmenu_draw_bg)(rarch_position_t *position);
|
||||
void (*rmenu_draw_panel)(rarch_position_t *position);
|
||||
void (*rmenu_set_default_pos)(rmenu_default_positions_t *position);
|
||||
|
4
gfx/gl.c
4
gfx/gl.c
@ -1194,7 +1194,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
||||
context_swap_buffers_func();
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
if (gl->draw_rmenu)
|
||||
if (g_extern.draw_menu)
|
||||
context_rmenu_frame_func(gl);
|
||||
#endif
|
||||
|
||||
@ -1747,7 +1747,6 @@ static void gl_restart(void)
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
bool should_block_swap = gl->block_swap;
|
||||
bool should_draw_rmenu = gl->draw_rmenu;
|
||||
#endif
|
||||
|
||||
gl_stop();
|
||||
@ -1757,7 +1756,6 @@ static void gl_restart(void)
|
||||
gl_start();
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
gl->draw_rmenu = should_draw_rmenu;
|
||||
gl->block_swap = should_block_swap;
|
||||
SET_TIMER_EXPIRATION(0, 30);
|
||||
#endif
|
||||
|
@ -279,7 +279,6 @@ typedef struct gl
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
bool block_swap;
|
||||
bool draw_rmenu;
|
||||
#endif
|
||||
|
||||
bool egl_images;
|
||||
|
@ -272,7 +272,7 @@ static bool folder_cb(const char *directory, rgui_file_enum_cb_t file_cb,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void menu_loop(void)
|
||||
static bool rmenu_iterate(void)
|
||||
{
|
||||
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
||||
|
||||
@ -390,6 +390,8 @@ static void menu_loop(void)
|
||||
gx->menu_render = false;
|
||||
|
||||
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void menu_init(void)
|
||||
@ -586,7 +588,7 @@ begin_loop:
|
||||
}
|
||||
else if(g_extern.console.rmenu.mode == MODE_MENU)
|
||||
{
|
||||
menu_loop();
|
||||
rmenu_iterate();
|
||||
|
||||
if (g_extern.console.rmenu.mode != MODE_EXIT)
|
||||
rarch_startup(default_paths.config_file);
|
||||
|
@ -98,9 +98,11 @@ void menu_init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void menu_loop (void)
|
||||
bool rmenu_iterate(void)
|
||||
{
|
||||
rarch_console_load_game_wrap("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes", 0, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void menu_free (void)
|
||||
@ -227,6 +229,8 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
bool repeat = false;
|
||||
|
||||
#ifdef HAVE_SYSUTILS
|
||||
RARCH_LOG("Registering system utility callback...\n");
|
||||
cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL);
|
||||
@ -344,8 +348,6 @@ int main(int argc, char *argv[])
|
||||
begin_loop:
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION)
|
||||
{
|
||||
bool repeat = false;
|
||||
|
||||
input_ps3.poll(NULL);
|
||||
|
||||
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
@ -356,7 +358,9 @@ begin_loop:
|
||||
}
|
||||
else if(g_extern.console.rmenu.mode == MODE_MENU)
|
||||
{
|
||||
menu_loop();
|
||||
do{
|
||||
repeat = rmenu_iterate();
|
||||
}while(repeat);
|
||||
|
||||
if (g_extern.console.rmenu.mode != MODE_EXIT)
|
||||
rarch_startup(default_paths.config_file);
|
||||
|
@ -93,13 +93,15 @@ void menu_init (void)
|
||||
g_extern.console.rmenu.mode = MODE_MENU;
|
||||
}
|
||||
|
||||
void menu_loop (void)
|
||||
bool rmenu_iterate(void)
|
||||
{
|
||||
char game_rom[256];
|
||||
snprintf(game_rom, sizeof(game_rom), "%s%s", default_paths.port_dir, "dkc.sfc");
|
||||
RARCH_LOG("game ROM: %s\n", game_rom);
|
||||
rarch_console_load_game_wrap(game_rom, 0, 0);
|
||||
g_extern.console.rmenu.mode = MODE_EMULATION;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void menu_free (void)
|
||||
@ -156,9 +158,9 @@ int main(int argc, char *argv[])
|
||||
menu_init();
|
||||
|
||||
begin_loop:
|
||||
bool repeat = false;
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION)
|
||||
{
|
||||
bool repeat = false;
|
||||
|
||||
RARCH_LOG("Gets to: #2.0\n");
|
||||
|
||||
@ -179,7 +181,9 @@ begin_loop:
|
||||
}
|
||||
else if(g_extern.console.rmenu.mode == MODE_MENU)
|
||||
{
|
||||
menu_loop();
|
||||
do{
|
||||
repeat = rmenu_iterate();
|
||||
}while(repeat);
|
||||
|
||||
if (g_extern.console.rmenu.mode != MODE_EXIT)
|
||||
rarch_startup(default_paths.config_file);
|
||||
|
@ -182,9 +182,9 @@ int main(int argc, char *argv[])
|
||||
menu_init();
|
||||
|
||||
begin_loop:
|
||||
bool repeat = false;
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION)
|
||||
{
|
||||
bool repeat = false;
|
||||
|
||||
input_xinput.poll(NULL);
|
||||
|
||||
@ -196,7 +196,9 @@ begin_loop:
|
||||
}
|
||||
else if(g_extern.console.rmenu.mode == MODE_MENU)
|
||||
{
|
||||
menu_loop();
|
||||
do{
|
||||
repeat = rmenu_iterate();
|
||||
}while(repeat);
|
||||
|
||||
if (g_extern.console.rmenu.mode != MODE_EXIT)
|
||||
rarch_startup(default_paths.config_file);
|
||||
|
@ -19,6 +19,6 @@
|
||||
|
||||
void menu_init (void);
|
||||
void menu_free (void);
|
||||
void menu_loop (void);
|
||||
bool rmenu_iterate(void);
|
||||
|
||||
#endif
|
||||
|
@ -610,7 +610,7 @@ static bool xdk_d3d_frame(void *data, const void *frame,
|
||||
#ifdef HAVE_FBO
|
||||
D3DSurface* pRenderTarget0;
|
||||
#endif
|
||||
bool menu_enabled = g_extern.console.rmenu.state.rmenu.enable;
|
||||
bool menu_enabled = g_extern.draw_menu;
|
||||
bool fps_enable = g_extern.console.rmenu.state.msg_fps.enable;
|
||||
#ifdef _XBOX1
|
||||
unsigned flicker_filter = g_extern.console.screen.state.flicker_filter.value;
|
||||
@ -817,7 +817,7 @@ static bool xdk_d3d_frame(void *data, const void *frame,
|
||||
&& !menu_enabled
|
||||
#endif
|
||||
)
|
||||
d3d->font_ctx->render_msg_place(d3d, msg_width, msg_height, 0.0f, 0, msg); //TODO: dehardcode x/y here for HD (720p) mode
|
||||
d3d->font_ctx->render_msg_place(d3d, msg_width, msg_height, 0.0f, 0, msg);
|
||||
|
||||
if(!d3d->block_swap)
|
||||
gfx_ctx_xdk_swap_buffers();
|
||||
|
Loading…
x
Reference in New Issue
Block a user