mirror of
https://github.com/libretro/RetroArch
synced 2025-04-15 23:42:30 +00:00
(RARCH_CONSOLE) Refactor some console-specific things
This commit is contained in:
parent
9f75454391
commit
c14b560255
@ -39,6 +39,8 @@
|
|||||||
#define video_free_func() gl_free(driver.video_data)
|
#define video_free_func() gl_free(driver.video_data)
|
||||||
#define video_set_rotation_func(rotation) gl_set_rotation(driver.video_data, rotation)
|
#define video_set_rotation_func(rotation) gl_set_rotation(driver.video_data, rotation)
|
||||||
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
||||||
|
#define video_stop_func() gl_stop()
|
||||||
|
#define video_start_func() gl_start()
|
||||||
|
|
||||||
#define gfx_ctx_window_has_focus() (true)
|
#define gfx_ctx_window_has_focus() (true)
|
||||||
|
|
||||||
@ -66,6 +68,8 @@
|
|||||||
#define video_free_func() xdk_d3d_free(driver.video_data)
|
#define video_free_func() xdk_d3d_free(driver.video_data)
|
||||||
#define video_set_rotation_func(rotation) xdk_d3d_set_rotation(driver.video_data, rotation)
|
#define video_set_rotation_func(rotation) xdk_d3d_set_rotation(driver.video_data, rotation)
|
||||||
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
||||||
|
#define video_stop_func() xdk_d3d_stop()
|
||||||
|
#define video_start_func() xdk_d3d_start()
|
||||||
|
|
||||||
#define gfx_ctx_window_has_focus() (true)
|
#define gfx_ctx_window_has_focus() (true)
|
||||||
|
|
||||||
@ -92,6 +96,8 @@
|
|||||||
#define video_free_func() gx_free(driver.video_data)
|
#define video_free_func() gx_free(driver.video_data)
|
||||||
#define video_set_rotation_func(orientation) gx_set_rotation(driver.video_data, orientation)
|
#define video_set_rotation_func(orientation) gx_set_rotation(driver.video_data, orientation)
|
||||||
#define video_set_aspect_ratio_func(aspectratio_idx) gx_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
#define video_set_aspect_ratio_func(aspectratio_idx) gx_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
||||||
|
#define video_stop_func() gx_stop()
|
||||||
|
#define video_start_func() gx_start()
|
||||||
|
|
||||||
#define input_init_func() gx_input_initialize()
|
#define input_init_func() gx_input_initialize()
|
||||||
#define input_poll_func() gx_input_poll(driver.input_data)
|
#define input_poll_func() gx_input_poll(driver.input_data)
|
||||||
@ -117,6 +123,8 @@
|
|||||||
#define video_free_func() null_gfx_free(driver.video_data)
|
#define video_free_func() null_gfx_free(driver.video_data)
|
||||||
#define video_set_rotation_func(orientation) (true)
|
#define video_set_rotation_func(orientation) (true)
|
||||||
#define video_set_aspect_ratio_func(aspectratio_idx) (true)
|
#define video_set_aspect_ratio_func(aspectratio_idx) (true)
|
||||||
|
#define video_stop_func() null_gfx_stop()
|
||||||
|
#define video_start_func() null_gfx_start()
|
||||||
|
|
||||||
#define input_init_func() null_input_init()
|
#define input_init_func() null_input_init()
|
||||||
#define input_poll_func() null_input_poll(driver.input_data)
|
#define input_poll_func() null_input_poll(driver.input_data)
|
||||||
|
@ -54,7 +54,7 @@ struct rgui_handle
|
|||||||
uint32_t font_green[256][FONT_HEIGHT][FONT_WIDTH];
|
uint32_t font_green[256][FONT_HEIGHT][FONT_WIDTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *rgui_device_lables[] = {
|
static const char *rgui_device_labels[] = {
|
||||||
"GameCube Controller",
|
"GameCube Controller",
|
||||||
"Wiimote",
|
"Wiimote",
|
||||||
"Wiimote + Nunchuk",
|
"Wiimote + Nunchuk",
|
||||||
@ -85,11 +85,6 @@ static inline bool rgui_is_controller_menu(rgui_file_type_t menu_type)
|
|||||||
return (menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4);
|
return (menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool rgui_is_filebrowser_menu(rgui_file_type_t menu_type)
|
|
||||||
{
|
|
||||||
return (menu_type == RGUI_FILE_DIRECTORY || menu_type == RGUI_FILE_DEVICE || menu_type == RGUI_SETTINGS_CORE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void copy_glyph(uint32_t glyph_white[FONT_HEIGHT][FONT_WIDTH],
|
static void copy_glyph(uint32_t glyph_white[FONT_HEIGHT][FONT_WIDTH],
|
||||||
uint32_t glyph_green[FONT_HEIGHT][FONT_WIDTH],
|
uint32_t glyph_green[FONT_HEIGHT][FONT_WIDTH],
|
||||||
const uint8_t *buf)
|
const uint8_t *buf)
|
||||||
@ -277,18 +272,14 @@ static void render_text(rgui_handle_t *rgui)
|
|||||||
const char *dir = 0;
|
const char *dir = 0;
|
||||||
rgui_file_type_t menu_type = 0;
|
rgui_file_type_t menu_type = 0;
|
||||||
rgui_list_back(rgui->path_stack, &dir, &menu_type, NULL);
|
rgui_list_back(rgui->path_stack, &dir, &menu_type, NULL);
|
||||||
|
|
||||||
if (menu_type == RGUI_SETTINGS_CORE)
|
if (menu_type == RGUI_SETTINGS_CORE)
|
||||||
{
|
|
||||||
snprintf(title, sizeof(title), "CORE SELECTION");
|
snprintf(title, sizeof(title), "CORE SELECTION");
|
||||||
}
|
|
||||||
else if (rgui_is_controller_menu(menu_type) || menu_type == RGUI_SETTINGS)
|
else if (rgui_is_controller_menu(menu_type) || menu_type == RGUI_SETTINGS)
|
||||||
{
|
|
||||||
snprintf(title, sizeof(title), "SETTINGS: %s", dir);
|
snprintf(title, sizeof(title), "SETTINGS: %s", dir);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
snprintf(title, sizeof(title), "FILE BROWSER: %s", dir);
|
snprintf(title, sizeof(title), "FILE BROWSER: %s", dir);
|
||||||
}
|
|
||||||
blit_line(rgui, TERM_START_X + 15, 15, title, true);
|
blit_line(rgui, TERM_START_X + 15, 15, title, true);
|
||||||
|
|
||||||
struct retro_system_info info;
|
struct retro_system_info info;
|
||||||
@ -360,7 +351,7 @@ static void render_text(rgui_handle_t *rgui)
|
|||||||
snprintf(type_str, sizeof(type_str), "...");
|
snprintf(type_str, sizeof(type_str), "...");
|
||||||
break;
|
break;
|
||||||
case RGUI_SETTINGS_BIND_DEVICE:
|
case RGUI_SETTINGS_BIND_DEVICE:
|
||||||
snprintf(type_str, sizeof(type_str), "%s", rgui_device_lables[g_settings.input.device[port]]);
|
snprintf(type_str, sizeof(type_str), "%s", rgui_device_labels[g_settings.input.device[port]]);
|
||||||
break;
|
break;
|
||||||
case RGUI_SETTINGS_BIND_UP:
|
case RGUI_SETTINGS_BIND_UP:
|
||||||
case RGUI_SETTINGS_BIND_DOWN:
|
case RGUI_SETTINGS_BIND_DOWN:
|
||||||
@ -407,9 +398,7 @@ static void render_text(rgui_handle_t *rgui)
|
|||||||
static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t action, rgui_file_type_t menu_type)
|
static void 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;
|
||||||
#ifdef GEKKO
|
void *data = (gx_video_t*)driver.video_data;
|
||||||
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (setting)
|
switch (setting)
|
||||||
{
|
{
|
||||||
@ -440,8 +429,11 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
break;
|
break;
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
case RGUI_SETTINGS_VIDEO_SOFT_FILTER:
|
case RGUI_SETTINGS_VIDEO_SOFT_FILTER:
|
||||||
g_console.soft_display_filter_enable = !g_console.soft_display_filter_enable;
|
{
|
||||||
gx->should_resize = true;
|
gx_video_t *gx = (gx_video_t*)data;
|
||||||
|
g_console.soft_display_filter_enable = !g_console.soft_display_filter_enable;
|
||||||
|
gx->should_resize = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case RGUI_SETTINGS_VIDEO_GAMMA:
|
case RGUI_SETTINGS_VIDEO_GAMMA:
|
||||||
@ -449,6 +441,7 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
{
|
{
|
||||||
g_console.gamma_correction = 0;
|
g_console.gamma_correction = 0;
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
|
gx_video_t *gx = (gx_video_t*)data;
|
||||||
gx->should_resize = true;
|
gx->should_resize = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -458,6 +451,7 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
{
|
{
|
||||||
g_console.gamma_correction--;
|
g_console.gamma_correction--;
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
|
gx_video_t *gx = (gx_video_t*)data;
|
||||||
gx->should_resize = true;
|
gx->should_resize = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -468,6 +462,7 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
{
|
{
|
||||||
g_console.gamma_correction++;
|
g_console.gamma_correction++;
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
|
gx_video_t *gx = (gx_video_t*)data;
|
||||||
gx->should_resize = true;
|
gx->should_resize = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -486,23 +481,17 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||||||
if (action == RGUI_ACTION_START)
|
if (action == RGUI_ACTION_START)
|
||||||
{
|
{
|
||||||
rarch_settings_default(S_DEF_AUDIO_CONTROL_RATE);
|
rarch_settings_default(S_DEF_AUDIO_CONTROL_RATE);
|
||||||
#ifdef GEKKO
|
video_set_rotation_func(g_console.screen_orientation);
|
||||||
video_gx.set_rotation(NULL, g_console.screen_orientation);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (action == RGUI_ACTION_LEFT)
|
else if (action == RGUI_ACTION_LEFT)
|
||||||
{
|
{
|
||||||
rarch_settings_change(S_ROTATION_DECREMENT);
|
rarch_settings_change(S_ROTATION_DECREMENT);
|
||||||
#ifdef GEKKO
|
video_set_rotation_func(g_console.screen_orientation);
|
||||||
video_gx.set_rotation(NULL, g_console.screen_orientation);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (action == RGUI_ACTION_RIGHT)
|
else if (action == RGUI_ACTION_RIGHT)
|
||||||
{
|
{
|
||||||
rarch_settings_change(S_ROTATION_INCREMENT);
|
rarch_settings_change(S_ROTATION_INCREMENT);
|
||||||
#ifdef GEKKO
|
video_set_rotation_func(g_console.screen_orientation);
|
||||||
video_gx.set_rotation(NULL, g_console.screen_orientation);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGUI_SETTINGS_AUDIO_MUTE:
|
case RGUI_SETTINGS_AUDIO_MUTE:
|
||||||
@ -696,7 +685,7 @@ static const char *rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t acti
|
|||||||
|
|
||||||
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 && !rgui_is_filebrowser_menu(menu_type))
|
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;
|
||||||
if (rgui_is_controller_menu(menu_type))
|
if (rgui_is_controller_menu(menu_type))
|
||||||
@ -841,7 +830,7 @@ const char *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 && rgui_is_filebrowser_menu(menu_type))
|
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);
|
||||||
|
@ -362,7 +362,7 @@ int main(void)
|
|||||||
config_set_defaults();
|
config_set_defaults();
|
||||||
input_gx.init();
|
input_gx.init();
|
||||||
|
|
||||||
video_gx.start();
|
video_start_func();
|
||||||
|
|
||||||
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
||||||
gx->menu_data = menu_framebuf;
|
gx->menu_data = menu_framebuf;
|
||||||
@ -419,7 +419,8 @@ begin_shutdown:
|
|||||||
rarch_main_deinit();
|
rarch_main_deinit();
|
||||||
|
|
||||||
input_gx.free(NULL);
|
input_gx.free(NULL);
|
||||||
video_gx.stop();
|
|
||||||
|
video_stop_func();
|
||||||
menu_free();
|
menu_free();
|
||||||
|
|
||||||
#ifdef HAVE_FILE_LOGGER
|
#ifdef HAVE_FILE_LOGGER
|
||||||
|
@ -284,8 +284,7 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
video_gl.start();
|
video_start_func();
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_OSKUTIL
|
#ifdef HAVE_OSKUTIL
|
||||||
oskutil_init(&g_console.oskutil_handle, 0);
|
oskutil_init(&g_console.oskutil_handle, 0);
|
||||||
@ -343,7 +342,7 @@ begin_shutdown:
|
|||||||
rarch_main_deinit();
|
rarch_main_deinit();
|
||||||
|
|
||||||
input_ps3.free(NULL);
|
input_ps3.free(NULL);
|
||||||
video_gl.stop();
|
video_stop_func();
|
||||||
menu_free();
|
menu_free();
|
||||||
|
|
||||||
#ifdef HAVE_OSKUTIL
|
#ifdef HAVE_OSKUTIL
|
||||||
|
@ -170,11 +170,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
input_xinput.post_init();
|
input_xinput.post_init();
|
||||||
|
|
||||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
video_start_func();
|
||||||
video_xdk_d3d.start();
|
|
||||||
#else
|
|
||||||
video_null.start();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
system_init();
|
system_init();
|
||||||
|
|
||||||
@ -210,11 +206,7 @@ begin_shutdown:
|
|||||||
rarch_config_save(default_paths.config_file);
|
rarch_config_save(default_paths.config_file);
|
||||||
|
|
||||||
menu_free();
|
menu_free();
|
||||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
video_stop_func();
|
||||||
video_xdk_d3d.stop();
|
|
||||||
#else
|
|
||||||
video_null.stop();
|
|
||||||
#endif
|
|
||||||
input_xinput.free(NULL);
|
input_xinput.free(NULL);
|
||||||
|
|
||||||
if(g_console.return_to_launcher)
|
if(g_console.return_to_launcher)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user