Add new cmd enums to rarch_main_command

This commit is contained in:
twinaphex 2014-08-16 18:39:18 +02:00
parent bb2f2eb239
commit 2d4cd0a56e
4 changed files with 24 additions and 16 deletions

View File

@ -821,7 +821,7 @@ static void adjust_system_rates(void)
if (driver.video_data) if (driver.video_data)
{ {
if (g_extern.system.force_nonblock) if (g_extern.system.force_nonblock)
driver.video->set_nonblock_state(driver.video_data, true); rarch_main_command(RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE);
else else
driver_set_nonblock_state(driver.nonblock_state); driver_set_nonblock_state(driver.nonblock_state);
} }

View File

@ -1381,8 +1381,7 @@ static int menu_viewport_iterate(unsigned action, rarch_setting_t *setting)
else if (custom->height >= (unsigned)stride_y) else if (custom->height >= (unsigned)stride_y)
custom->height -= stride_y; custom->height -= stride_y;
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
driver.video_poke->apply_state_changes(driver.video_data);
break; break;
case MENU_ACTION_DOWN: case MENU_ACTION_DOWN:
@ -1395,8 +1394,7 @@ static int menu_viewport_iterate(unsigned action, rarch_setting_t *setting)
else else
custom->height += stride_y; custom->height += stride_y;
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
driver.video_poke->apply_state_changes(driver.video_data);
break; break;
case MENU_ACTION_LEFT: case MENU_ACTION_LEFT:
@ -1408,8 +1406,7 @@ static int menu_viewport_iterate(unsigned action, rarch_setting_t *setting)
else if (custom->width >= (unsigned)stride_x) else if (custom->width >= (unsigned)stride_x)
custom->width -= stride_x; custom->width -= stride_x;
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
driver.video_poke->apply_state_changes(driver.video_data);
break; break;
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
@ -1422,8 +1419,7 @@ static int menu_viewport_iterate(unsigned action, rarch_setting_t *setting)
else else
custom->width += stride_x; custom->width += stride_x;
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
driver.video_poke->apply_state_changes(driver.video_data);
break; break;
case MENU_ACTION_CANCEL: case MENU_ACTION_CANCEL:
@ -1468,8 +1464,7 @@ static int menu_viewport_iterate(unsigned action, rarch_setting_t *setting)
custom->height = vp.full_height - custom->y; custom->height = vp.full_height - custom->y;
} }
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
driver.video_poke->apply_state_changes(driver.video_data);
} }
break; break;
@ -1522,8 +1517,7 @@ static int menu_viewport_iterate(unsigned action, rarch_setting_t *setting)
aspectratio_lut[ASPECT_RATIO_CUSTOM].value = aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
(float)custom->width / custom->height; (float)custom->width / custom->height;
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
driver.video_poke->apply_state_changes(driver.video_data);
return 0; return 0;
} }
@ -3655,8 +3649,7 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
else else
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE); g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
driver.video_poke->apply_state_changes(driver.video_data);
break; break;
#endif #endif
@ -3677,7 +3670,7 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
driver_set_monitor_refresh_rate(refresh_rate); driver_set_monitor_refresh_rate(refresh_rate);
// Incase refresh rate update forced non-block video. // Incase refresh rate update forced non-block video.
driver.video->set_nonblock_state(driver.video_data, false); rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
} }
break; break;
} }

View File

@ -115,6 +115,9 @@ enum basic_event
RARCH_CMD_HISTORY_DEINIT, RARCH_CMD_HISTORY_DEINIT,
RARCH_CMD_HISTORY_INIT, RARCH_CMD_HISTORY_INIT,
RARCH_CMD_CORE_INFO_INIT, RARCH_CMD_CORE_INFO_INIT,
RARCH_CMD_VIDEO_APPLY_STATE_CHANGES,
RARCH_CMD_VIDEO_SET_BLOCKING_STATE,
RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE,
}; };
enum menu_enums enum menu_enums

View File

@ -3096,6 +3096,8 @@ static inline void limit_frame_time(void)
void rarch_main_command(unsigned action) void rarch_main_command(unsigned action)
{ {
bool boolean = false;
switch (action) switch (action)
{ {
case RARCH_CMD_LOAD_CONTENT: case RARCH_CMD_LOAD_CONTENT:
@ -3230,6 +3232,16 @@ void rarch_main_command(unsigned action)
driver.menu_ctx->init_core_info(driver.menu); driver.menu_ctx->init_core_info(driver.menu);
#endif #endif
break; break;
case RARCH_CMD_VIDEO_APPLY_STATE_CHANGES:
if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes)
driver.video_poke->apply_state_changes(driver.video_data);
break;
case RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE:
boolean = true; //fall-through
case RARCH_CMD_VIDEO_SET_BLOCKING_STATE:
if (driver.video && driver.video->set_nonblock_state)
driver.video->set_nonblock_state(driver.video_data, boolean);
break;
} }
} }