(Xbox 1/360) XDK context file updated - fixes build

This commit is contained in:
twinaphex 2012-09-30 17:10:04 +02:00
parent 5e70581a5f
commit c1e3dcd00e
9 changed files with 125 additions and 80 deletions

View File

@ -96,6 +96,11 @@ static void rmenu_ctx_ps3_swap_buffers(void)
#endif
}
void rmenu_ctx_ps3_set_swap_interval(unsigned interval)
{
gfx_ctx_set_swap_interval(interval);
}
static void rmenu_ctx_ps3_set_default_pos(rmenu_default_positions_t *position)
{
position->x_position = POSITION_X;
@ -172,8 +177,14 @@ static const char * rmenu_ctx_ps3_drive_mapping_next(void)
return drive_mappings[drive_mapping_idx];
}
static void rmenu_ctx_ps3_set_filtering(unsigned index, bool set_smooth)
{
gfx_ctx_set_filtering(index, set_smooth);
}
const rmenu_context_t rmenu_ctx_ps3 = {
.clear = rmenu_ctx_ps3_clear,
.set_filtering = rmenu_ctx_ps3_set_filtering,
.blend = rmenu_ctx_ps3_blend,
.free_textures = rmenu_ctx_ps3_free_textures,
.init_textures = rmenu_ctx_ps3_init_textures,
@ -184,6 +195,7 @@ const rmenu_context_t rmenu_ctx_ps3 = {
.screenshot_enable = rmenu_ctx_ps3_screenshot_enable,
.screenshot_dump = rmenu_ctx_ps3_screenshot_dump,
.swap_buffers = rmenu_ctx_ps3_swap_buffers,
.set_swap_interval = rmenu_ctx_ps3_set_swap_interval,
.set_default_pos = rmenu_ctx_ps3_set_default_pos,
.drive_mapping_prev = rmenu_ctx_ps3_drive_mapping_previous,
.drive_mapping_next = rmenu_ctx_ps3_drive_mapping_next,

View File

@ -66,12 +66,12 @@ int m_menuMainRomListPos_y;
static void rmenu_ctx_xdk_clear(void)
{
gfx_ctx_clear();
gfx_ctx_xdk_clear();
}
static void rmenu_ctx_xdk_blend(bool enable)
{
gfx_ctx_set_blend(enable);
gfx_ctx_xdk_set_blend(enable);
}
static void rmenu_ctx_xdk_free_textures(void)
@ -127,7 +127,12 @@ static void rmenu_ctx_xdk_render_bg(rmenu_position_t *position)
static void rmenu_ctx_xdk_swap_buffers(void)
{
gfx_ctx_swap_buffers();
gfx_ctx_xdk_swap_buffers();
}
void rmenu_ctx_xdk_set_swap_interval(unsigned interval)
{
gfx_ctx_xdk_set_swap_interval(interval);
}
static void rmenu_ctx_xdk_set_default_pos(rmenu_default_positions_t *position)
@ -186,8 +191,14 @@ static const char * rmenu_ctx_xdk_drive_mapping_next(void)
return drive_mappings[drive_mapping_idx];
}
static void rmenu_ctx_xdk_set_filtering(unsigned index, bool set_smooth)
{
gfx_ctx_xdk_set_filtering(index, set_smooth);
}
const rmenu_context_t rmenu_ctx_xdk = {
rmenu_ctx_xdk_clear,
rmenu_ctx_xdk_set_filtering,
rmenu_ctx_xdk_blend,
rmenu_ctx_xdk_free_textures,
rmenu_ctx_xdk_init_textures,
@ -198,6 +209,7 @@ const rmenu_context_t rmenu_ctx_xdk = {
rmenu_ctx_xdk_screenshot_enable,
rmenu_ctx_xdk_screenshot_dump,
rmenu_ctx_xdk_swap_buffers,
rmenu_ctx_xdk_set_swap_interval,
rmenu_ctx_xdk_set_default_pos,
rmenu_ctx_xdk_drive_mapping_previous,
rmenu_ctx_xdk_drive_mapping_next,

View File

@ -1039,12 +1039,12 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B)))
{
rarch_settings_change(S_HW_TEXTURE_FILTER);
gfx_ctx_set_filtering(1, g_settings.video.smooth);
context->set_filtering(1, g_settings.video.smooth);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_change(S_DEF_HW_TEXTURE_FILTER);
gfx_ctx_set_filtering(1, g_settings.video.smooth);
context->set_filtering(1, g_settings.video.smooth);
}
break;
#ifdef HAVE_FBO
@ -1156,12 +1156,12 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B)))
{
rarch_settings_change(S_THROTTLE);
gfx_ctx_set_swap_interval(g_console.throttle_enable);
context->set_swap_interval(g_console.throttle_enable);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_default(S_DEF_THROTTLE);
gfx_ctx_set_swap_interval(g_console.throttle_enable);
context->set_swap_interval(g_console.throttle_enable);
}
break;
case SETTING_TRIPLE_BUFFERING:

View File

@ -72,6 +72,7 @@ typedef struct rmenu_default_positions
typedef struct rmenu_context
{
void (*clear)(void);
void (*set_filtering)(unsigned index, bool set_smooth);
void (*blend)(bool enable);
void (*free_textures)(void);
void (*init_textures)(void);
@ -82,6 +83,7 @@ typedef struct rmenu_context
void (*screenshot_enable)(bool enable);
void (*screenshot_dump)(void *data);
void (*swap_buffers)(void);
void (*set_swap_interval)(unsigned interval);
void (*set_default_pos)(rmenu_default_positions_t *position);
const char * (*drive_mapping_prev)(void);
const char * (*drive_mapping_next)(void);

View File

@ -30,11 +30,7 @@
#include "../gl_common.h"
#include "../image.h"
#include "ps3_ctx.h"
#ifdef HAVE_OPENGLES11
#define glOrtho glOrthof
#endif
#include "../gfx_context.h"
#ifdef HAVE_CG_MENU
static struct texture_image menu_texture;

View File

@ -35,7 +35,7 @@
#define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTINTERVAL
#endif
void gfx_ctx_set_blend(bool enable)
static void gfx_ctx_xdk_set_blend(bool enable)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
@ -47,9 +47,8 @@ void gfx_ctx_set_blend(bool enable)
d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, enable);
}
void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
static void gfx_ctx_xdk_set_swap_interval(unsigned interval)
{
(void)inited;
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
if (interval)
@ -58,7 +57,12 @@ void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
d3d->d3d_render_device->SetRenderState(XBOX_PRESENTATIONINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
}
void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_xdk_get_available_resolutions (void)
{
}
static void gfx_ctx_xdk_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
@ -72,9 +76,9 @@ void gfx_ctx_check_window(bool *quit,
*resize = true;
}
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
static void gfx_ctx_xdk_set_resize(unsigned width, unsigned height) { }
void gfx_ctx_swap_buffers(void)
static void gfx_ctx_xdk_swap_buffers(void)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
#ifdef _XBOX1
@ -83,7 +87,7 @@ void gfx_ctx_swap_buffers(void)
d3d->d3d_render_device->Present(NULL, NULL, NULL, NULL);
}
void gfx_ctx_clear(void)
static void gfx_ctx_xdk_clear(void)
{
xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data;
#ifdef _XBOX1
@ -100,53 +104,63 @@ void gfx_ctx_clear(void)
#endif
}
#ifndef HAVE_GRIFFIN
bool gfx_ctx_window_has_focus(void)
{
return true;
}
#endif
bool gfx_ctx_menu_init(void)
static bool gfx_ctx_xdk_window_has_focus(void)
{
return true;
}
void gfx_ctx_update_window_title(bool reset) { }
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
static bool gfx_ctx_xdk_menu_init(void)
{
return true;
}
static void gfx_ctx_xdk_update_window_title(bool reset) { }
static void gfx_ctx_xdk_get_video_size(unsigned *width, unsigned *height)
{
/* TODO: implement */
(void)width;
(void)height;
}
bool gfx_ctx_init(void)
static bool gfx_ctx_xdk_init(void)
{
/* TODO: implement */
return true;
}
bool gfx_ctx_set_video_mode(
static bool gfx_ctx_xdk_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen)
{
/* TODO: implement */
return true;
}
void gfx_ctx_destroy(void)
static void gfx_ctx_xdk_destroy(void)
{
/* TODO: implement */
}
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) { }
static void gfx_ctx_xdk_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)
static void gfx_ctx_xdk_set_filtering(unsigned index, bool set_smooth)
{
/* TODO: implement */
}
static void gfx_ctx_xdk_set_fbo(bool enable)
{
/* TODO: implement properly */
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
d3d->fbo_enabled = enable;
}
void gfx_ctx_xdk_apply_fbo_state_changes(unsigned mode)
{
}
void gfx_ctx_xdk_screenshot_dump(void *data)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
@ -198,6 +212,7 @@ void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
void gfx_ctx_set_overscan(void)
{
/* TODO: implement */
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
if (!d3d)
return;
@ -205,7 +220,46 @@ void gfx_ctx_set_overscan(void)
d3d->should_resize = true;
}
int gfx_ctx_check_resolution(unsigned resolution_id)
int gfx_ctx_xdk_check_resolution(unsigned resolution_id)
{
/* TODO: implement */
return 0;
}
static bool gfx_ctx_xdk_bind_api(enum gfx_ctx_api api)
{
#if defined(_XBOX1)
return api == GFX_CTX_DIRECT3D8_API;
#elif defined(_XBOX360)
return api == GFX_CTX_DIRECT3D9_API;
#endif
}
const gfx_ctx_driver_t gfx_ctx_xdk = {
gfx_ctx_xdk_init,
gfx_ctx_xdk_destroy,
gfx_ctx_xdk_bind_api,
gfx_ctx_xdk_set_swap_interval,
gfx_ctx_xdk_set_video_mode,
gfx_ctx_xdk_get_video_size,
NULL,
gfx_ctx_xdk_update_window_title,
gfx_ctx_xdk_check_window,
gfx_ctx_xdk_set_resize,
gfx_ctx_xdk_window_has_focus,
gfx_ctx_xdk_swap_buffers,
gfx_ctx_xdk_input_driver,
NULL,
"xdk",
// RARCH_CONSOLE stuff.
gfx_ctx_xdk_set_filtering,
gfx_ctx_xdk_get_available_resolutions,
gfx_ctx_xdk_check_resolution,
gfx_ctx_xdk_menu_init,
gfx_ctx_xdk_set_fbo,
gfx_ctx_xdk_apply_fbo_state_changes,
};

View File

@ -24,6 +24,9 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
#if defined(__CELLOS_LV2__)
&gfx_ctx_ps3,
#endif
#if defined(_XBOX)
&gfx_ctx_xdk,
#endif
#if defined(HAVE_VIDEOCORE)
&gfx_ctx_videocore,
#endif

View File

@ -27,13 +27,13 @@ enum gfx_ctx_api
{
GFX_CTX_OPENGL_API,
GFX_CTX_OPENGL_ES_API,
GFX_CTX_DIRECT3D8_API,
GFX_CTX_DIRECT3D9_API,
GFX_CTX_OPENVG_API
};
typedef void (*gfx_ctx_proc_t)(void);
// Avoid breakage on XBox. TODO: Migrate to new context abstraction if it makes sense.
#if !defined(HAVE_D3D9) && !defined(HAVE_D3D8)
typedef struct gfx_ctx_driver
{
bool (*init)(void);
@ -90,6 +90,7 @@ typedef struct gfx_ctx_driver
bool (*menu_init)(void);
void (*set_fbo)(bool);
void (*apply_fbo_state_changes)(unsigned);
void (*gfx_ctx_set_projection)(void*, const struct gl_ortho *, bool);
#endif
} gfx_ctx_driver_t;
@ -98,47 +99,12 @@ extern const gfx_ctx_driver_t gfx_ctx_x_egl;
extern const gfx_ctx_driver_t gfx_ctx_glx;
extern const gfx_ctx_driver_t gfx_ctx_drm_egl;
extern const gfx_ctx_driver_t gfx_ctx_ps3;
extern const gfx_ctx_driver_t gfx_ctx_xdk;
extern const gfx_ctx_driver_t gfx_ctx_wgl;
extern const gfx_ctx_driver_t gfx_ctx_videocore;
const gfx_ctx_driver_t *gfx_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
const gfx_ctx_driver_t *gfx_ctx_init_first(enum gfx_ctx_api api); // Finds first suitable driver and initializes.
#else
void gfx_ctx_set_swap_interval(unsigned interval, bool inited);
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen);
bool gfx_ctx_init(void);
void gfx_ctx_destroy(void);
void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
void gfx_ctx_update_window_title(bool reset);
void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count);
void gfx_ctx_set_resize(unsigned width, unsigned height);
#ifndef HAVE_GRIFFIN
bool gfx_ctx_window_has_focus(void);
#endif
void gfx_ctx_swap_buffers(void);
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data);
#ifdef HAVE_CG_MENU
bool gfx_ctx_menu_init(void);
#endif
void gfx_ctx_set_filtering(unsigned index, bool set_smooth);
void gfx_ctx_get_available_resolutions(void);
int gfx_ctx_check_resolution(unsigned resolution_id);
void gfx_ctx_set_projection(xdk_d3d_video_t *vid, const struct gl_ortho *ortho, bool allow_rotate);
#endif
#endif

View File

@ -39,7 +39,7 @@ static void check_window(xdk_d3d_video_t *d3d)
{
bool quit, resize;
gfx_ctx_check_window(&quit,
gfx_ctx_xdk_check_window(&quit,
&resize, NULL, NULL,
d3d->frame_count);
@ -471,7 +471,7 @@ static bool xdk_d3d_frame(void *data, const void *frame,
xfonts_render_msg_place(d3d, 60, 365, 0, msg); //TODO: dehardcode x/y here for HD (720p) mode
if(!d3d->block_swap)
gfx_ctx_swap_buffers();
gfx_ctx_xdk_swap_buffers();
return true;
}
@ -483,7 +483,7 @@ static void xdk_d3d_set_nonblock_state(void *data, bool state)
if(d3d->vsync)
{
RARCH_LOG("D3D8: Vsync => %s\n", state ? "off" : "on");
gfx_ctx_set_swap_interval(state ? 0 : 1, TRUE);
gfx_ctx_xdk_set_swap_interval(state ? 0 : 1);
}
}
@ -514,7 +514,7 @@ static void xdk_d3d_start(void)
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
gfx_ctx_set_swap_interval(d3d->vsync ? 1 : 0, false);
gfx_ctx_xdk_set_swap_interval(d3d->vsync ? 1 : 0);
}
static void xdk_d3d_restart(void)