RetroArch/gfx/context/xdk360_ctx.c
2012-05-28 02:29:51 +02:00

136 lines
3.4 KiB
C

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../driver.h"
#include <stdint.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "xdk360_ctx.h"
#include "../../360/xdk360_video.h"
void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
{
(void)inited;
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
if (interval)
d3d9->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_ONE);
else
d3d9->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
}
void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
*quit = false;
*resize = false;
if (d3d9->quitting)
*quit = true;
if (d3d9->should_resize)
*resize = true;
}
bool gfx_ctx_window_has_focus(void)
{
return true;
}
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
void gfx_ctx_swap_buffers(void)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL);
}
bool gfx_ctx_menu_init(void)
{
return true;
}
void gfx_ctx_update_window_title(bool reset) { }
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
(void)width;
(void)height;
}
bool gfx_ctx_init(void)
{
return true;
}
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen)
{
return true;
}
void gfx_ctx_destroy(void)
{
}
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) { }
void gfx_ctx_set_filtering(unsigned index, bool set_smooth) { }
void gfx_ctx_set_fbo(bool enable)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
d3d9->fbo_enabled = enable;
}
/*============================================================
MISC
TODO: Refactor
============================================================ */
void gfx_ctx_set_projection(xdk360_video_t *d3d9, const struct gl_ortho *ortho, bool allow_rotate) { }
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
{
(void)data;
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;
d3d9->should_resize = true;
}
void gfx_ctx_set_overscan(void)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
if (!d3d9)
return;
d3d9->should_resize = true;
}