(Xbox 1) Fix build

This commit is contained in:
twinaphex 2012-12-15 03:59:31 +01:00
parent 4864adc7b1
commit 566296068a
7 changed files with 30 additions and 39 deletions

View File

@ -209,6 +209,10 @@ FONTS
#include "../../gfx/fonts/gl_font.c" #include "../../gfx/fonts/gl_font.c"
#endif #endif
#ifdef _XBOX
#include "../../gfx/fonts/d3d_font.c"
#endif
#if defined(HAVE_LIBDBGFONT) #if defined(HAVE_LIBDBGFONT)
#include "../../gfx/fonts/ps_libdbgfont.c" #include "../../gfx/fonts/ps_libdbgfont.c"
#elif defined(HAVE_OPENGL) #elif defined(HAVE_OPENGL)

View File

@ -32,7 +32,7 @@
#include "../../screenshot.h" #include "../../screenshot.h"
#include "../fonts/d3d_fonts.h" #include "../fonts/d3d_font.h"
#if defined(_XBOX1) #if defined(_XBOX1)
#define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTATIONINTERVAL #define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTATIONINTERVAL
@ -270,14 +270,6 @@ static void gfx_ctx_xdk_menu_set_default_pos(rmenu_default_positions_t *position
#endif #endif
} }
static void gfx_ctx_xdk_menu_render_msg(float xpos, float ypos, float scale, unsigned color, const char *msg, ...)
{
#ifdef _XBOX1
xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data;
xfonts_render_msg_place(device_ptr, xpos, ypos, scale, msg);
#endif
}
static void gfx_ctx_xdk_menu_screenshot_enable(bool enable) static void gfx_ctx_xdk_menu_screenshot_enable(bool enable)
{ {
} }
@ -550,7 +542,6 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
gfx_ctx_xdk_menu_draw_bg, gfx_ctx_xdk_menu_draw_bg,
gfx_ctx_xdk_menu_draw_panel, gfx_ctx_xdk_menu_draw_panel,
gfx_ctx_xdk_menu_set_default_pos, gfx_ctx_xdk_menu_set_default_pos,
gfx_ctx_xdk_menu_render_msg,
gfx_ctx_xdk_menu_screenshot_enable, gfx_ctx_xdk_menu_screenshot_enable,
gfx_ctx_xdk_menu_screenshot_dump, gfx_ctx_xdk_menu_screenshot_dump,
gfx_ctx_xdk_menu_drive_mapping_previous, gfx_ctx_xdk_menu_drive_mapping_previous,

View File

@ -17,7 +17,7 @@
#include "bitmap.h" #include "bitmap.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include "../../boolean.h"
struct font_renderer struct font_renderer
{ {
@ -55,7 +55,7 @@ static void *font_renderer_init(const char *font_path, unsigned font_size)
if (!handle->scale_factor) if (!handle->scale_factor)
handle->scale_factor = 1; handle->scale_factor = 1;
handle->bitmap_alloc = malloc(FONT_WIDTH * FONT_HEIGHT * handle->scale_factor * handle->scale_factor * 256); handle->bitmap_alloc = (uint8_t*)malloc(FONT_WIDTH * FONT_HEIGHT * handle->scale_factor * handle->scale_factor * 256);
if (!handle->bitmap_alloc) if (!handle->bitmap_alloc)
{ {

View File

@ -20,10 +20,17 @@
static bool xfonts_init_font(void *data, const char *font_path, unsigned font_size) static bool xfonts_init_font(void *data, const char *font_path, unsigned font_size)
{ {
(void)data;
(void)font_path; (void)font_path;
(void)font_size; (void)font_size;
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
XFONT_OpenDefaultFont(&d3d->debug_font);
d3d->debug_font->SetBkMode(XFONT_TRANSPARENT);
d3d->debug_font->SetBkColor(D3DCOLOR_ARGB(100,0,0,0));
d3d->debug_font->SetTextHeight(14);
d3d->debug_font->SetTextAntialiasLevel(d3d->debug_font->GetTextAntialiasLevel());
return true; return true;
} }
@ -32,12 +39,7 @@ static void xfonts_deinit_font(void *data)
(void)data; (void)data;
} }
static void xfonts_render_msg(void *data, const char *msg) static void xfonts_render_msg_place(void *data, float x, float y, float scale, uint32_t color, const char *msg)
{
xfonts_render_msg_place(data, g_settings.video.msg_pos_x, g_settings.video.msg_pos_y, 0, msg);
}
static void xfonts_render_msg_place(void *data, float x, float y, float scale, const char *msg)
{ {
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data; xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
@ -50,6 +52,11 @@ static void xfonts_render_msg_place(void *data, float x, float y, float scale, c
d3d->pFrontBuffer->Release(); d3d->pFrontBuffer->Release();
} }
static void xfonts_render_msg(void *data, const char *msg)
{
xfonts_render_msg_place(data, g_settings.video.msg_pos_x, g_settings.video.msg_pos_y, 0, 0, msg);
}
const d3d_font_renderer_t d3d_xdk1_font = { const d3d_font_renderer_t d3d_xdk1_font = {
xfonts_init_font, xfonts_init_font,
xfonts_deinit_font, xfonts_deinit_font,

View File

@ -428,9 +428,9 @@ static void xdk_video_font_draw_text(xdk360_video_font_t *font,
pd3dDevice->EndVertices(); pd3dDevice->EndVertices();
} }
static void xdk_render_msg_place(void *driver, float x, float y, const char *str_msg) static void xdk_render_msg_place(void *data, float x, float y, float scale, uint32_t color, const char *str_msg)
{ {
xdk_d3d_video_t *vid = (xdk_d3d_video_t*)driver; xdk_d3d_video_t *vid = (xdk_d3d_video_t*)data;
wchar_t msg[PATH_MAX]; wchar_t msg[PATH_MAX];
convert_char_to_wchar(msg, str_msg, sizeof(msg)); convert_char_to_wchar(msg, str_msg, sizeof(msg));

View File

@ -34,8 +34,6 @@
#include "config.h" #include "config.h"
#endif #endif
#include "../gfx/fonts/d3d_fonts.h"
#include "../xdk/xdk_resources.h" #include "../xdk/xdk_resources.h"
#if defined(_XBOX1) #if defined(_XBOX1)
@ -789,13 +787,11 @@ static bool xdk_d3d_frame(void *data, const void *frame,
#endif #endif
#if defined(_XBOX1) #if defined(_XBOX1)
#define fonts_render_msg_place_func(device, x, y, scale, msg) xfonts_render_msg_place(device, x, y, scale, msg)
float mem_width = font_x + 30; float mem_width = font_x + 30;
float mem_height = font_y + 50; float mem_height = font_y + 50;
float msg_width = 60; float msg_width = 60;
float msg_height = 365; float msg_height = 365;
#elif defined(_XBOX360) #elif defined(_XBOX360)
#define fonts_render_msg_place_func(device, x, y, scale, msg) xdk_render_msg_place(device, x, y, msg)
float mem_width = g_extern.console.rmenu.state.rmenu_hd.enable ? 160 : 100; float mem_width = g_extern.console.rmenu.state.rmenu_hd.enable ? 160 : 100;
float mem_height = 70; float mem_height = 70;
float msg_width = mem_width; float msg_width = mem_width;
@ -811,10 +807,10 @@ static bool xdk_d3d_frame(void *data, const void *frame,
char buf[128]; char buf[128];
snprintf(buf, sizeof(buf), "%.2f MB free / %.2f MB total", stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f)); snprintf(buf, sizeof(buf), "%.2f MB free / %.2f MB total", stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
fonts_render_msg_place_func(d3d, mem_width, mem_height, 0, buf); d3d->font_ctx->render_msg_place(d3d, mem_width, mem_height, 0, 0, buf);
gfx_fps_title(fps_txt, sizeof(fps_txt)); gfx_fps_title(fps_txt, sizeof(fps_txt));
fonts_render_msg_place_func(d3d, mem_width, mem_height + 30, 0, fps_txt); d3d->font_ctx->render_msg_place(d3d, mem_width, mem_height + 30, 0, 0, fps_txt);
} }
if (msg if (msg
@ -822,7 +818,7 @@ static bool xdk_d3d_frame(void *data, const void *frame,
&& !menu_enabled && !menu_enabled
#endif #endif
) )
fonts_render_msg_place_func(d3d, msg_width, msg_height, 0, msg); //TODO: dehardcode x/y here for HD (720p) mode d3d->font_ctx->render_msg_place(d3d, msg_width, msg_height, 0, 0, msg); //TODO: dehardcode x/y here for HD (720p) mode
if(!d3d->block_swap) if(!d3d->block_swap)
gfx_ctx_xdk_swap_buffers(); gfx_ctx_xdk_swap_buffers();
@ -870,21 +866,12 @@ static void xdk_d3d_start(void)
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data; xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
#if defined(_XBOX1) #if defined(_XBOX1)
/* load debug fonts */
XFONT_OpenDefaultFont(&d3d->debug_font);
d3d->debug_font->SetBkMode(XFONT_TRANSPARENT);
d3d->debug_font->SetBkColor(D3DCOLOR_ARGB(100,0,0,0));
d3d->debug_font->SetTextHeight(14);
d3d->debug_font->SetTextAntialiasLevel(d3d->debug_font->GetTextAntialiasLevel());
font_x = 0; font_x = 0;
font_y = 0; font_y = 0;
#elif defined(_XBOX360) #elif defined(_XBOX360)
HRESULT hr = d3d9_init_font("game:\\media\\Arial_12.xpr"); snprintf(g_settings.video.font_path, sizeof(g_settings.video.font_path), "game:\\media\\Arial_12.xpr");
if(hr < 0)
RARCH_ERR("Couldn't initialize HLSL shader fonts.\n");
#endif #endif
d3d->font_ctx = d3d_font_init_first(d3d, g_settings.video.font_path, g_settings.video.font_size);
} }
static void xdk_d3d_restart(void) static void xdk_d3d_restart(void)

View File

@ -21,6 +21,7 @@
#ifdef _XBOX1 #ifdef _XBOX1
#include <xfont.h> #include <xfont.h>
#endif #endif
#include "../gfx/fonts/d3d_font.h"
#include "../gfx/gfx_context.h" #include "../gfx/gfx_context.h"
#include "../xdk/xdk_defines.h" #include "../xdk/xdk_defines.h"
@ -73,6 +74,7 @@ typedef struct xdk_d3d_video
LPDIRECT3DTEXTURE lpTexture_ot; LPDIRECT3DTEXTURE lpTexture_ot;
IDirect3DVertexDeclaration9* v_decl; IDirect3DVertexDeclaration9* v_decl;
#endif #endif
const d3d_font_renderer_t *font_ctx;
#if defined(_XBOX1) #if defined(_XBOX1)
XFONT *debug_font; XFONT *debug_font;
D3DSurface *pBackBuffer, *pFrontBuffer; D3DSurface *pBackBuffer, *pFrontBuffer;