mirror of
https://github.com/libretro/RetroArch
synced 2025-02-05 06:40:07 +00:00
(Wii) Add changes to Rmenu code
This commit is contained in:
parent
c869e3f32c
commit
28566bd3e1
@ -363,7 +363,7 @@ static void render_messagebox(rgui_handle_t *rgui, const char *message)
|
|||||||
static void render_text(rgui_handle_t *rgui)
|
static void render_text(rgui_handle_t *rgui)
|
||||||
{
|
{
|
||||||
if (rgui->need_refresh &&
|
if (rgui->need_refresh &&
|
||||||
(g_extern.console.rmenu.mode & (1ULL << MODE_MENU))
|
(g_extern.lifecycle_menu_state & (1ULL << MODE_MENU))
|
||||||
&& !rgui->msg_force)
|
&& !rgui->msg_force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ static void render_text(rgui_handle_t *rgui)
|
|||||||
#define MAX_GAMMA_SETTING 1
|
#define MAX_GAMMA_SETTING 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t action, rgui_file_type_t menu_type)
|
static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t action, rgui_file_type_t menu_type)
|
||||||
{
|
{
|
||||||
unsigned port = menu_type - RGUI_SETTINGS_CONTROLLER_1;
|
unsigned port = menu_type - RGUI_SETTINGS_CONTROLLER_1;
|
||||||
|
|
||||||
@ -581,7 +581,8 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
rarch_save_state();
|
rarch_save_state();
|
||||||
else
|
else
|
||||||
rarch_load_state();
|
rarch_load_state();
|
||||||
g_extern.lifecycle_menu_state = (1 << MODE_EMULATION);
|
g_extern.lifecycle_menu_state |= (1 << MODE_EMULATION);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else if (action == RGUI_ACTION_START)
|
else if (action == RGUI_ACTION_START)
|
||||||
rarch_settings_default(S_DEF_SAVE_STATE);
|
rarch_settings_default(S_DEF_SAVE_STATE);
|
||||||
@ -610,8 +611,9 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
case RGUI_SETTINGS_RESTART_GAME:
|
case RGUI_SETTINGS_RESTART_GAME:
|
||||||
if (action == RGUI_ACTION_OK)
|
if (action == RGUI_ACTION_OK)
|
||||||
{
|
{
|
||||||
g_extern.lifecycle_menu_state = (1 << MODE_EMULATION);
|
|
||||||
rarch_game_reset();
|
rarch_game_reset();
|
||||||
|
g_extern.lifecycle_menu_state |= (1 << MODE_EMULATION);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGUI_SETTINGS_VIDEO_FILTER:
|
case RGUI_SETTINGS_VIDEO_FILTER:
|
||||||
@ -761,14 +763,17 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s/boot.dol", default_paths.core_dir);
|
snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s/boot.dol", default_paths.core_dir);
|
||||||
#endif
|
#endif
|
||||||
g_extern.console.external_launch.enable = true;
|
g_extern.console.external_launch.enable = true;
|
||||||
g_extern.lifecycle_menu_state = (1 << MODE_EXIT);
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_EMULATION);
|
||||||
|
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGUI_SETTINGS_QUIT_EMULATOR:
|
case RGUI_SETTINGS_QUIT_EMULATOR:
|
||||||
if (action == RGUI_ACTION_OK)
|
if (action == RGUI_ACTION_OK)
|
||||||
{
|
{
|
||||||
g_extern.lifecycle_menu_state &= ~((1 << MODE_MENU) | (1 << MODE_MENU_INGAME) | (1 << MODE_EMULATION));
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_EMULATION);
|
||||||
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
|
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// controllers
|
// controllers
|
||||||
@ -829,6 +834,8 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RGUI_MENU_ITEM(x, y) rgui_list_push(rgui->folder_buf, x, y, 0)
|
#define RGUI_MENU_ITEM(x, y) rgui_list_push(rgui->folder_buf, x, y, 0)
|
||||||
@ -896,7 +903,7 @@ static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
||||||
{
|
{
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
||||||
@ -1012,9 +1019,11 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||||||
render_messagebox(rgui, "Set Upper-Left Corner");
|
render_messagebox(rgui, "Set Upper-Left Corner");
|
||||||
else if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2)
|
else if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2)
|
||||||
render_messagebox(rgui, "Set Bottom-Right Corner");
|
render_messagebox(rgui, "Set Bottom-Right Corner");
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
int rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
||||||
{
|
{
|
||||||
rgui->frame_buf_pitch = RGUI_WIDTH * 2;
|
rgui->frame_buf_pitch = RGUI_WIDTH * 2;
|
||||||
rgui_file_type_t type = 0;
|
rgui_file_type_t type = 0;
|
||||||
@ -1070,7 +1079,12 @@ void rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||||||
video_set_aspect_ratio_func(g_settings.video.aspect_ratio_idx);
|
video_set_aspect_ratio_func(g_settings.video.aspect_ratio_idx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rgui_settings_toggle_setting(type, action, menu_type);
|
{
|
||||||
|
int ret = rgui_settings_toggle_setting(type, action, menu_type);
|
||||||
|
|
||||||
|
if (ret != 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RGUI_ACTION_REFRESH:
|
case RGUI_ACTION_REFRESH:
|
||||||
@ -1099,10 +1113,10 @@ void rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||||||
|
|
||||||
render_text(rgui);
|
render_text(rgui);
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
int rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
||||||
{
|
{
|
||||||
const char *dir = 0;
|
const char *dir = 0;
|
||||||
rgui_file_type_t menu_type = 0;
|
rgui_file_type_t menu_type = 0;
|
||||||
@ -1158,7 +1172,7 @@ void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||||||
case RGUI_ACTION_OK:
|
case RGUI_ACTION_OK:
|
||||||
{
|
{
|
||||||
if (rgui_list_size(rgui->folder_buf) == 0)
|
if (rgui_list_size(rgui->folder_buf) == 0)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
const char *path = 0;
|
const char *path = 0;
|
||||||
rgui_file_type_t type = 0;
|
rgui_file_type_t type = 0;
|
||||||
@ -1203,6 +1217,7 @@ void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||||||
rarch_console_load_game_wrap(rgui->path_buf, g_extern.file_state.zip_extract_mode);
|
rarch_console_load_game_wrap(rgui->path_buf, g_extern.file_state.zip_extract_mode);
|
||||||
rgui->need_refresh = true; // in case of zip extract
|
rgui->need_refresh = true; // in case of zip extract
|
||||||
rgui->msg_force = true;
|
rgui->msg_force = true;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1238,7 +1253,7 @@ void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||||||
// refresh values in case the stack changed
|
// refresh values in case the stack changed
|
||||||
rgui_list_back(rgui->path_stack, &dir, &menu_type, &directory_ptr);
|
rgui_list_back(rgui->path_stack, &dir, &menu_type, &directory_ptr);
|
||||||
|
|
||||||
if (rgui->need_refresh && (menu_type == RGUI_FILE_DIRECTORY || menu_type == RGUI_FILE_DEVICE || menu_type == RGUI_SETTINGS_CORE) && (g_extern.console.rmenu.mode & (1ULL << MODE_MENU)))
|
if (rgui->need_refresh && (menu_type == RGUI_FILE_DIRECTORY || menu_type == RGUI_FILE_DEVICE || menu_type == RGUI_SETTINGS_CORE))
|
||||||
{
|
{
|
||||||
rgui->need_refresh = false;
|
rgui->need_refresh = false;
|
||||||
rgui_list_clear(rgui->folder_buf);
|
rgui_list_clear(rgui->folder_buf);
|
||||||
@ -1251,4 +1266,6 @@ void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_text(rgui);
|
render_text(rgui);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ rgui_handle_t *rgui_init(const char *base_path,
|
|||||||
const uint8_t *font_bmp_buf, const uint8_t *font_bin_buf,
|
const uint8_t *font_bmp_buf, const uint8_t *font_bin_buf,
|
||||||
rgui_folder_enum_cb_t folder_cb, void *userdata);
|
rgui_folder_enum_cb_t folder_cb, void *userdata);
|
||||||
|
|
||||||
void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action);
|
int rgui_iterate(rgui_handle_t *rgui, rgui_action_t action);
|
||||||
|
|
||||||
void rgui_free(rgui_handle_t *rgui);
|
void rgui_free(rgui_handle_t *rgui);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
uint16_t menu_framebuf[400 * 240];
|
uint16_t menu_framebuf[400 * 240];
|
||||||
|
|
||||||
static const struct retro_keybind _gx_nav_binds[] = {
|
static const struct retro_keybind _rmenu_nav_binds[] = {
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
{ 0, 0, 0, GX_GC_UP | GX_GC_LSTICK_UP | GX_GC_RSTICK_UP | GX_CLASSIC_UP | GX_CLASSIC_LSTICK_UP | GX_CLASSIC_RSTICK_UP | GX_WIIMOTE_UP | GX_NUNCHUK_UP, 0 },
|
{ 0, 0, 0, GX_GC_UP | GX_GC_LSTICK_UP | GX_GC_RSTICK_UP | GX_CLASSIC_UP | GX_CLASSIC_LSTICK_UP | GX_CLASSIC_RSTICK_UP | GX_WIIMOTE_UP | GX_NUNCHUK_UP, 0 },
|
||||||
{ 0, 0, 0, GX_GC_DOWN | GX_GC_LSTICK_DOWN | GX_GC_RSTICK_DOWN | GX_CLASSIC_DOWN | GX_CLASSIC_LSTICK_DOWN | GX_CLASSIC_RSTICK_DOWN | GX_WIIMOTE_DOWN | GX_NUNCHUK_DOWN, 0 },
|
{ 0, 0, 0, GX_GC_DOWN | GX_GC_LSTICK_DOWN | GX_GC_RSTICK_DOWN | GX_CLASSIC_DOWN | GX_CLASSIC_LSTICK_DOWN | GX_CLASSIC_RSTICK_DOWN | GX_WIIMOTE_DOWN | GX_NUNCHUK_DOWN, 0 },
|
||||||
@ -46,8 +46,8 @@ static const struct retro_keybind _gx_nav_binds[] = {
|
|||||||
{ 0, 0, 0, GX_QUIT_KEY, 0 },
|
{ 0, 0, 0, GX_QUIT_KEY, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct retro_keybind *gx_nav_binds[] = {
|
static const struct retro_keybind *rmenu_nav_binds[] = {
|
||||||
_gx_nav_binds
|
_rmenu_nav_binds
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -62,7 +62,7 @@ enum
|
|||||||
GX_DEVICE_NAV_SELECT,
|
GX_DEVICE_NAV_SELECT,
|
||||||
GX_DEVICE_NAV_MENU,
|
GX_DEVICE_NAV_MENU,
|
||||||
GX_DEVICE_NAV_QUIT,
|
GX_DEVICE_NAV_QUIT,
|
||||||
GX_DEVICE_NAV_LAST
|
RMENU_DEVICE_NAV_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool folder_cb(const char *directory, rgui_file_enum_cb_t file_cb,
|
static bool folder_cb(const char *directory, rgui_file_enum_cb_t file_cb,
|
||||||
@ -165,6 +165,45 @@ void menu_free(void)
|
|||||||
rgui_free(rgui);
|
rgui_free(rgui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint16_t trigger_state = 0;
|
||||||
|
|
||||||
|
int rmenu_input_process(void *data, void *state)
|
||||||
|
{
|
||||||
|
if (g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME))
|
||||||
|
{
|
||||||
|
if(g_extern.console.rmenu.state.msg_info.enable)
|
||||||
|
rarch_settings_msg(S_MSG_LOADING_ROM, 100);
|
||||||
|
|
||||||
|
if (g_extern.fullpath)
|
||||||
|
g_extern.lifecycle_menu_state = (1 << MODE_INIT);
|
||||||
|
|
||||||
|
g_extern.lifecycle_menu_state |= (1 << MODE_INIT);
|
||||||
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_LOAD_GAME);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(g_extern.frame_count < g_extern.delay_timer[0]))
|
||||||
|
{
|
||||||
|
bool return_to_game_enable = ((trigger_state & (1ULL << GX_DEVICE_NAV_MENU)) && g_extern.main_is_init);
|
||||||
|
bool quit_key_pressed = (trigger_state & (1ULL << GX_DEVICE_NAV_QUIT));
|
||||||
|
|
||||||
|
if (return_to_game_enable)
|
||||||
|
{
|
||||||
|
g_extern.lifecycle_menu_state |= (1 << MODE_EMULATION);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quit_key_pressed)
|
||||||
|
{
|
||||||
|
g_extern.lifecycle_menu_state &= ~((1 << MODE_EMULATION));
|
||||||
|
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool rmenu_iterate(void)
|
bool rmenu_iterate(void)
|
||||||
{
|
{
|
||||||
static uint16_t old_input_state = 0;
|
static uint16_t old_input_state = 0;
|
||||||
@ -176,15 +215,17 @@ bool rmenu_iterate(void)
|
|||||||
|
|
||||||
g_extern.frame_count++;
|
g_extern.frame_count++;
|
||||||
|
|
||||||
|
rarch_render_cached_frame();
|
||||||
|
|
||||||
uint16_t input_state = 0;
|
uint16_t input_state = 0;
|
||||||
|
|
||||||
driver.input->poll(NULL);
|
driver.input->poll(NULL);
|
||||||
|
|
||||||
for (unsigned i = 0; i < GX_DEVICE_NAV_LAST; i++)
|
for (unsigned i = 0; i < RMENU_DEVICE_NAV_LAST; i++)
|
||||||
input_state |= driver.input->input_state(NULL, gx_nav_binds, 0,
|
input_state |= driver.input->input_state(NULL, rmenu_nav_binds, 0,
|
||||||
RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
||||||
|
|
||||||
uint16_t trigger_state = input_state & ~old_input_state;
|
trigger_state = input_state & ~old_input_state;
|
||||||
bool do_held = (input_state & ((1ULL << GX_DEVICE_NAV_UP) | (1ULL << GX_DEVICE_NAV_DOWN) | (1ULL << GX_DEVICE_NAV_LEFT) | (1ULL << GX_DEVICE_NAV_RIGHT))) && !(input_state & ((1ULL << GX_DEVICE_NAV_MENU) | (1ULL << GX_DEVICE_NAV_QUIT)));
|
bool do_held = (input_state & ((1ULL << GX_DEVICE_NAV_UP) | (1ULL << GX_DEVICE_NAV_DOWN) | (1ULL << GX_DEVICE_NAV_LEFT) | (1ULL << GX_DEVICE_NAV_RIGHT))) && !(input_state & ((1ULL << GX_DEVICE_NAV_MENU) | (1ULL << GX_DEVICE_NAV_QUIT)));
|
||||||
|
|
||||||
if(do_held)
|
if(do_held)
|
||||||
@ -209,6 +250,8 @@ bool rmenu_iterate(void)
|
|||||||
initial_held = true;
|
initial_held = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
old_input_state = input_state;
|
||||||
|
|
||||||
rgui_action_t action = RGUI_ACTION_NOOP;
|
rgui_action_t action = RGUI_ACTION_NOOP;
|
||||||
|
|
||||||
// don't run anything first frame, only capture held inputs for old_input_state
|
// don't run anything first frame, only capture held inputs for old_input_state
|
||||||
@ -229,32 +272,14 @@ bool rmenu_iterate(void)
|
|||||||
else if (trigger_state & (1ULL << GX_DEVICE_NAV_SELECT))
|
else if (trigger_state & (1ULL << GX_DEVICE_NAV_SELECT))
|
||||||
action = RGUI_ACTION_SETTINGS;
|
action = RGUI_ACTION_SETTINGS;
|
||||||
|
|
||||||
rgui_iterate(rgui, action);
|
int input_entry_ret = 0;
|
||||||
|
int input_process_ret = 0;
|
||||||
|
|
||||||
rarch_render_cached_frame();
|
input_entry_ret = rgui_iterate(rgui, action);
|
||||||
|
|
||||||
old_input_state = input_state;
|
input_process_ret = rmenu_input_process(NULL, NULL);
|
||||||
|
|
||||||
if (g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME))
|
if (input_entry_ret != 0 || input_process_ret != 0)
|
||||||
{
|
|
||||||
if(g_extern.console.rmenu.state.msg_info.enable)
|
|
||||||
rarch_settings_msg(S_MSG_LOADING_ROM, 100);
|
|
||||||
|
|
||||||
if (g_extern.fullpath)
|
|
||||||
g_extern.lifecycle_menu_state = (1 << MODE_INIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(g_extern.frame_count < g_extern.delay_timer[0]))
|
|
||||||
{
|
|
||||||
bool rmenu_enable = ((trigger_state & (1ULL << GX_DEVICE_NAV_MENU)) && g_extern.main_is_init);
|
|
||||||
bool quit_key_pressed = (trigger_state & (1ULL << GX_DEVICE_NAV_QUIT));
|
|
||||||
|
|
||||||
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU))
|
|
||||||
g_extern.lifecycle_menu_state = quit_key_pressed ? (1 << MODE_EXIT) : rmenu_enable ? (1 << MODE_EMULATION) : (1 << MODE_MENU);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(g_extern.lifecycle_menu_state & (1 << MODE_MENU))
|
|
||||||
&& !(g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME)))
|
|
||||||
goto deinit;
|
goto deinit;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user