(RARCH_CONSOLE) Refactor some console-specific things

This commit is contained in:
Twinaphex 2012-08-18 21:50:19 +02:00
parent 9f75454391
commit c14b560255
5 changed files with 33 additions and 44 deletions

View File

@ -39,6 +39,8 @@
#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_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)
@ -66,6 +68,8 @@
#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_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)
@ -92,6 +96,8 @@
#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_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_poll_func() gx_input_poll(driver.input_data)
@ -117,6 +123,8 @@
#define video_free_func() null_gfx_free(driver.video_data)
#define video_set_rotation_func(orientation) (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_poll_func() null_input_poll(driver.input_data)

View File

@ -54,7 +54,7 @@ struct rgui_handle
uint32_t font_green[256][FONT_HEIGHT][FONT_WIDTH];
};
static const char *rgui_device_lables[] = {
static const char *rgui_device_labels[] = {
"GameCube Controller",
"Wiimote",
"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);
}
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],
uint32_t glyph_green[FONT_HEIGHT][FONT_WIDTH],
const uint8_t *buf)
@ -277,18 +272,14 @@ static void render_text(rgui_handle_t *rgui)
const char *dir = 0;
rgui_file_type_t menu_type = 0;
rgui_list_back(rgui->path_stack, &dir, &menu_type, NULL);
if (menu_type == RGUI_SETTINGS_CORE)
{
snprintf(title, sizeof(title), "CORE SELECTION");
}
else if (rgui_is_controller_menu(menu_type) || menu_type == RGUI_SETTINGS)
{
snprintf(title, sizeof(title), "SETTINGS: %s", dir);
}
else
{
snprintf(title, sizeof(title), "FILE BROWSER: %s", dir);
}
blit_line(rgui, TERM_START_X + 15, 15, title, true);
struct retro_system_info info;
@ -360,7 +351,7 @@ static void render_text(rgui_handle_t *rgui)
snprintf(type_str, sizeof(type_str), "...");
break;
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;
case RGUI_SETTINGS_BIND_UP:
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)
{
unsigned port = menu_type - RGUI_SETTINGS_CONTROLLER_1;
#ifdef GEKKO
gx_video_t *gx = (gx_video_t*)driver.video_data;
#endif
void *data = (gx_video_t*)driver.video_data;
switch (setting)
{
@ -440,8 +429,11 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
break;
#ifdef HW_RVL
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;
#endif
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;
#ifdef GEKKO
gx_video_t *gx = (gx_video_t*)data;
gx->should_resize = true;
#endif
}
@ -458,6 +451,7 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
{
g_console.gamma_correction--;
#ifdef GEKKO
gx_video_t *gx = (gx_video_t*)data;
gx->should_resize = true;
#endif
}
@ -468,6 +462,7 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
{
g_console.gamma_correction++;
#ifdef GEKKO
gx_video_t *gx = (gx_video_t*)data;
gx->should_resize = true;
#endif
}
@ -486,23 +481,17 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
if (action == RGUI_ACTION_START)
{
rarch_settings_default(S_DEF_AUDIO_CONTROL_RATE);
#ifdef GEKKO
video_gx.set_rotation(NULL, g_console.screen_orientation);
#endif
video_set_rotation_func(g_console.screen_orientation);
}
else if (action == RGUI_ACTION_LEFT)
{
rarch_settings_change(S_ROTATION_DECREMENT);
#ifdef GEKKO
video_gx.set_rotation(NULL, g_console.screen_orientation);
#endif
video_set_rotation_func(g_console.screen_orientation);
}
else if (action == RGUI_ACTION_RIGHT)
{
rarch_settings_change(S_ROTATION_INCREMENT);
#ifdef GEKKO
video_gx.set_rotation(NULL, g_console.screen_orientation);
#endif
video_set_rotation_func(g_console.screen_orientation);
}
break;
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);
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;
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
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_list_clear(rgui->folder_buf);

View File

@ -362,7 +362,7 @@ int main(void)
config_set_defaults();
input_gx.init();
video_gx.start();
video_start_func();
gx_video_t *gx = (gx_video_t*)driver.video_data;
gx->menu_data = menu_framebuf;
@ -419,7 +419,8 @@ begin_shutdown:
rarch_main_deinit();
input_gx.free(NULL);
video_gx.stop();
video_stop_func();
menu_free();
#ifdef HAVE_FILE_LOGGER

View File

@ -284,8 +284,7 @@ int main(int argc, char *argv[])
#endif
#endif
video_gl.start();
video_start_func();
#ifdef HAVE_OSKUTIL
oskutil_init(&g_console.oskutil_handle, 0);
@ -343,7 +342,7 @@ begin_shutdown:
rarch_main_deinit();
input_ps3.free(NULL);
video_gl.stop();
video_stop_func();
menu_free();
#ifdef HAVE_OSKUTIL

View File

@ -170,11 +170,7 @@ int main(int argc, char *argv[])
input_xinput.post_init();
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
video_xdk_d3d.start();
#else
video_null.start();
#endif
video_start_func();
system_init();
@ -210,11 +206,7 @@ begin_shutdown:
rarch_config_save(default_paths.config_file);
menu_free();
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
video_xdk_d3d.stop();
#else
video_null.stop();
#endif
video_stop_func();
input_xinput.free(NULL);
if(g_console.return_to_launcher)