mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 18:35:22 +00:00
(XDK) Start to implement video_poke interface
This commit is contained in:
parent
52ef22bfa9
commit
79a27e34ed
@ -687,10 +687,13 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
||||
g_settings.video.render_to_texture = !g_settings.video.render_to_texture;
|
||||
m_settingslist.SetText(SETTING_SCALE_ENABLED, g_settings.video.render_to_texture ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF");
|
||||
|
||||
if(g_settings.video.render_to_texture)
|
||||
device_ptr->ctx_driver->set_fbo(FBO_INIT);
|
||||
else
|
||||
device_ptr->ctx_driver->set_fbo(FBO_DEINIT);
|
||||
if (driver.video_poke->set_fbo_state)
|
||||
{
|
||||
if(g_settings.video.render_to_texture)
|
||||
driver.video_poke->set_fbo_state(driver.video_data, FBO_INIT);
|
||||
else
|
||||
driver.video_poke->set_fbo_state(driver.video_data, FBO_DEINIT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -783,7 +786,13 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
||||
if((g_settings.video.fbo.scale_x > MIN_SCALING_FACTOR))
|
||||
{
|
||||
menu_settings_set(S_SCALE_FACTOR_DECREMENT);
|
||||
device_ptr->ctx_driver->set_fbo(FBO_REINIT);
|
||||
|
||||
if (driver.video_poke->set_fbo_state)
|
||||
{
|
||||
if(g_settings.video.render_to_texture)
|
||||
driver.video_poke->set_fbo_state(driver.video_data, FBO_REINIT);
|
||||
}
|
||||
|
||||
menu_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer);
|
||||
}
|
||||
@ -800,10 +809,13 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
||||
case SETTING_SCALE_ENABLED:
|
||||
g_settings.video.render_to_texture = !g_settings.video.render_to_texture;
|
||||
m_settingslist.SetText(SETTING_SCALE_ENABLED, g_settings.video.render_to_texture ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF");
|
||||
if(g_settings.video.render_to_texture)
|
||||
device_ptr->ctx_driver->set_fbo(FBO_INIT);
|
||||
else
|
||||
device_ptr->ctx_driver->set_fbo(FBO_DEINIT);
|
||||
if (driver.video_poke->set_fbo_state)
|
||||
{
|
||||
if(g_settings.video.render_to_texture)
|
||||
driver.video_poke->set_fbo_state(driver.video_data, FBO_INIT);
|
||||
else
|
||||
driver.video_poke->set_fbo_state(driver.video_data, FBO_DEINIT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -883,7 +895,9 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
||||
if((g_settings.video.fbo.scale_x < MAX_SCALING_FACTOR))
|
||||
{
|
||||
menu_settings_set(S_SCALE_FACTOR_INCREMENT);
|
||||
device_ptr->ctx_driver->set_fbo(FBO_REINIT);
|
||||
|
||||
if (driver.video_poke->set_fbo_state)
|
||||
driver.video_poke->set_fbo_state(driver.video_data, FBO_REINIT);
|
||||
menu_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer);
|
||||
}
|
||||
@ -901,10 +915,13 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
||||
g_settings.video.render_to_texture = !g_settings.video.render_to_texture;
|
||||
m_settingslist.SetText(SETTING_SCALE_ENABLED, g_settings.video.render_to_texture ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF");
|
||||
|
||||
if(g_settings.video.render_to_texture)
|
||||
device_ptr->ctx_driver->set_fbo(FBO_INIT);
|
||||
else
|
||||
device_ptr->ctx_driver->set_fbo(FBO_DEINIT);
|
||||
if (driver.video_poke->set_fbo_state)
|
||||
{
|
||||
if(g_settings.video.render_to_texture)
|
||||
driver.video_poke->set_fbo_state(FBO_INIT);
|
||||
else
|
||||
driver.video_poke->set_fbo_state(FBO_DEINIT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1018,7 +1035,8 @@ HRESULT CRetroArchQuickMenu::OnControlNavigate(XUIMessageControlNavigate *pContr
|
||||
|
||||
if(aspectratio_changed)
|
||||
{
|
||||
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
if (driver.video_poke->set_aspect_ratio)
|
||||
driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
menu_settings_create_menu_item_label_w(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
|
||||
m_quickmenulist.SetText(MENU_XUI_ITEM_ASPECT_RATIO, strw_buffer);
|
||||
}
|
||||
@ -1070,7 +1088,8 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
||||
break;
|
||||
case MENU_XUI_ITEM_ASPECT_RATIO:
|
||||
menu_settings_set_default(S_DEF_ASPECT_RATIO);
|
||||
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
if (driver.video_poke->set_aspect_ratio)
|
||||
driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
menu_settings_create_menu_item_label_w(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
|
||||
m_quickmenulist.SetText(MENU_XUI_ITEM_ASPECT_RATIO, strw_buffer);
|
||||
break;
|
||||
@ -1537,4 +1556,4 @@ bool menu_iterate_xui(void)
|
||||
app.Render();
|
||||
XuiTimersRun();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -429,26 +429,7 @@ static void gfx_ctx_xdk_destroy(void)
|
||||
|
||||
static void gfx_ctx_xdk_input_driver(const input_driver_t **input, void **input_data) { }
|
||||
|
||||
static void gfx_ctx_xdk_set_filtering(unsigned index, bool set_smooth) { }
|
||||
|
||||
static void gfx_ctx_xdk_set_fbo(unsigned mode)
|
||||
{
|
||||
#ifdef HAVE_FBO
|
||||
/* TODO: implement properly */
|
||||
xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case FBO_DEINIT:
|
||||
xdk_d3d_deinit_fbo(device_ptr);
|
||||
break;
|
||||
case FBO_REINIT:
|
||||
case FBO_INIT:
|
||||
xdk_d3d_init_fbo(device_ptr);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool gfx_ctx_xdk_bind_api(enum gfx_ctx_api api)
|
||||
{
|
||||
@ -512,10 +493,10 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
|
||||
|
||||
// RARCH_CONSOLE stuff.
|
||||
gfx_ctx_xdk_set_blend,
|
||||
gfx_ctx_xdk_set_filtering,
|
||||
NULL,
|
||||
gfx_ctx_xdk_get_available_resolutions,
|
||||
gfx_ctx_xdk_check_resolution,
|
||||
gfx_ctx_xdk_set_fbo,
|
||||
NULL,
|
||||
|
||||
#if defined(HAVE_RMENU)
|
||||
gfx_ctx_xdk_menu_init,
|
||||
|
@ -924,6 +924,53 @@ static bool xdk_d3d_focus(void *data)
|
||||
return gfx_ctx_window_has_focus();
|
||||
}
|
||||
|
||||
static void xdk_d3d_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||
{
|
||||
(void)data;
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
|
||||
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_AUTO)
|
||||
gfx_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
|
||||
else if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CORE)
|
||||
gfx_set_core_viewport();
|
||||
|
||||
g_settings.video.aspect_ratio = aspectratio_lut[g_settings.video.aspect_ratio_idx].value;
|
||||
g_settings.video.force_aspect = false;
|
||||
d3d->should_resize = true;
|
||||
}
|
||||
|
||||
static void xdk_d3d_set_fbo_state(void *data, unsigned mode)
|
||||
{
|
||||
#ifdef HAVE_FBO
|
||||
xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)data;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case FBO_DEINIT:
|
||||
xdk_d3d_deinit_fbo(device_ptr);
|
||||
break;
|
||||
case FBO_REINIT:
|
||||
case FBO_INIT:
|
||||
xdk_d3d_init_fbo(device_ptr);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void xdk_d3d_set_filtering(unsigned index, bool set_smooth) { }
|
||||
|
||||
static const video_poke_interface_t d3d_poke_interface = {
|
||||
xdk_d3d_set_filtering,
|
||||
xdk_d3d_set_fbo_state,
|
||||
xdk_d3d_set_aspect_ratio,
|
||||
};
|
||||
|
||||
static void d3d_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
||||
{
|
||||
(void)data;
|
||||
*iface = &d3d_poke_interface;
|
||||
}
|
||||
|
||||
static void xdk_d3d_start(void)
|
||||
{
|
||||
video_info_t video_info = {0};
|
||||
@ -938,6 +985,7 @@ static void xdk_d3d_start(void)
|
||||
driver.video_data = xdk_d3d_init(&video_info, NULL, NULL);
|
||||
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
d3d_get_poke_interface(d3d, &driver.video_poke);
|
||||
|
||||
#if defined(_XBOX1)
|
||||
font_x = 0;
|
||||
@ -979,21 +1027,6 @@ static void xdk_d3d_restart(void)
|
||||
d3dr->Reset(&d3dpp);
|
||||
}
|
||||
|
||||
static void xdk_d3d_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||
{
|
||||
(void)data;
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
|
||||
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_AUTO)
|
||||
gfx_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
|
||||
else if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CORE)
|
||||
gfx_set_core_viewport();
|
||||
|
||||
g_settings.video.aspect_ratio = aspectratio_lut[g_settings.video.aspect_ratio_idx].value;
|
||||
g_settings.video.force_aspect = false;
|
||||
d3d->should_resize = true;
|
||||
}
|
||||
|
||||
const video_driver_t video_xdk_d3d = {
|
||||
xdk_d3d_init,
|
||||
xdk_d3d_frame,
|
||||
@ -1006,6 +1039,11 @@ const video_driver_t video_xdk_d3d = {
|
||||
xdk_d3d_start,
|
||||
xdk_d3d_stop,
|
||||
xdk_d3d_restart,
|
||||
xdk_d3d_set_aspect_ratio,
|
||||
xdk_d3d_set_rotation,
|
||||
NULL, /* viewport_info */
|
||||
NULL, /* read_viewport */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
d3d_get_poke_interface,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user