mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 03:10:14 +00:00
(3DS) Buildfix
This commit is contained in:
parent
46bae549ac
commit
7df38ac5db
@ -62,92 +62,100 @@ static void menu_display_ctr_viewport(void *data)
|
||||
|
||||
static void menu_display_ctr_draw(void *data)
|
||||
{
|
||||
struct ctr_texture *texture = NULL;
|
||||
const float *color = NULL;
|
||||
ctr_video_t *ctr = (ctr_video_t*)video_driver_get_ptr(false);
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
struct ctr_texture *texture = NULL;
|
||||
const float *color = NULL;
|
||||
ctr_video_t *ctr = (ctr_video_t*)video_driver_get_ptr(false);
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
|
||||
if (!ctr || !draw)
|
||||
return;
|
||||
|
||||
texture = (struct ctr_texture*)draw->texture;
|
||||
color = draw->coords->color;
|
||||
texture = (struct ctr_texture*)draw->texture;
|
||||
color = draw->coords->color;
|
||||
|
||||
if (!texture)
|
||||
return;
|
||||
if (!texture)
|
||||
return;
|
||||
|
||||
ctr_scale_vector_t scale_vector;
|
||||
ctr_set_scale_vector(&scale_vector,
|
||||
CTR_TOP_FRAMEBUFFER_WIDTH, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
||||
texture->width, texture->height);
|
||||
ctrGuSetVertexShaderFloatUniform(0, (float*)&scale_vector, 1);
|
||||
ctr_scale_vector_t scale_vector;
|
||||
ctr_set_scale_vector(&scale_vector,
|
||||
CTR_TOP_FRAMEBUFFER_WIDTH, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
||||
texture->width, texture->height);
|
||||
ctrGuSetVertexShaderFloatUniform(0, (float*)&scale_vector, 1);
|
||||
|
||||
if ((ctr->vertex_cache.size - (ctr->vertex_cache.current - ctr->vertex_cache.buffer)) < 1)
|
||||
ctr->vertex_cache.current = ctr->vertex_cache.buffer;
|
||||
if ((ctr->vertex_cache.size - (ctr->vertex_cache.current - ctr->vertex_cache.buffer)) < 1)
|
||||
ctr->vertex_cache.current = ctr->vertex_cache.buffer;
|
||||
|
||||
ctr_vertex_t* v = ctr->vertex_cache.current++;
|
||||
ctr_vertex_t* v = ctr->vertex_cache.current++;
|
||||
|
||||
v->x0 = draw->x;
|
||||
v->y0 = 240 - draw->height - draw->y;
|
||||
v->x1 = v->x0 + draw->width;
|
||||
v->y1 = v->y0 + draw->height;
|
||||
v->u0 = 0;
|
||||
v->v0 = 0;
|
||||
v->u1 = texture->active_width;
|
||||
v->v1 = texture->active_height;
|
||||
v->x0 = draw->x;
|
||||
v->y0 = 240 - draw->height - draw->y;
|
||||
v->x1 = v->x0 + draw->width;
|
||||
v->y1 = v->y0 + draw->height;
|
||||
v->u0 = 0;
|
||||
v->v0 = 0;
|
||||
v->u1 = texture->active_width;
|
||||
v->v1 = texture->active_height;
|
||||
|
||||
ctrGuSetAttributeBuffers(2,
|
||||
VIRT_TO_PHYS(v),
|
||||
CTRGU_ATTRIBFMT(GPU_SHORT, 4) << 0 |
|
||||
CTRGU_ATTRIBFMT(GPU_SHORT, 4) << 4,
|
||||
sizeof(ctr_vertex_t));
|
||||
ctrGuSetAttributeBuffers(2,
|
||||
VIRT_TO_PHYS(v),
|
||||
CTRGU_ATTRIBFMT(GPU_SHORT, 4) << 0 |
|
||||
CTRGU_ATTRIBFMT(GPU_SHORT, 4) << 4,
|
||||
sizeof(ctr_vertex_t));
|
||||
|
||||
color = draw->coords->color;
|
||||
int colorR = (int)((*color++)*255.f);
|
||||
int colorG = (int)((*color++)*255.f);
|
||||
int colorB = (int)((*color++)*255.f);
|
||||
int colorA = (int)((*color++)*255.f);
|
||||
color = draw->coords->color;
|
||||
int colorR = (int)((*color++)*255.f);
|
||||
int colorG = (int)((*color++)*255.f);
|
||||
int colorB = (int)((*color++)*255.f);
|
||||
int colorA = (int)((*color++)*255.f);
|
||||
|
||||
GPU_SetTexEnv(0,
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_CONSTANT, 0),
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_CONSTANT, 0),
|
||||
0,
|
||||
0,
|
||||
GPU_MODULATE, GPU_MODULATE,
|
||||
COLOR_ABGR(colorR,colorG,colorB,colorA)
|
||||
);
|
||||
// GPU_SetTexEnv(0,
|
||||
// GPU_TEVSOURCES(GPU_CONSTANT, GPU_CONSTANT, 0),
|
||||
// GPU_TEVSOURCES(GPU_CONSTANT, GPU_CONSTANT, 0),
|
||||
// 0,
|
||||
// GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_COLOR, GPU_TEVOP_RGB_SRC_COLOR, 0),
|
||||
// GPU_REPLACE, GPU_REPLACE,
|
||||
// 0x3FFFFFFF);
|
||||
GPU_SetTexEnv(0,
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_CONSTANT, 0),
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_CONSTANT, 0),
|
||||
0,
|
||||
0,
|
||||
GPU_MODULATE, GPU_MODULATE,
|
||||
COLOR_ABGR(colorR,colorG,colorB,colorA)
|
||||
);
|
||||
|
||||
ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(texture->data), texture->width, texture->height,
|
||||
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR) |
|
||||
GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
|
||||
GPU_RGBA8);
|
||||
#if 0
|
||||
GPU_SetTexEnv(0,
|
||||
GPU_TEVSOURCES(GPU_CONSTANT, GPU_CONSTANT, 0),
|
||||
GPU_TEVSOURCES(GPU_CONSTANT, GPU_CONSTANT, 0),
|
||||
0,
|
||||
GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_COLOR, GPU_TEVOP_RGB_SRC_COLOR, 0),
|
||||
GPU_REPLACE, GPU_REPLACE,
|
||||
0x3FFFFFFF);
|
||||
#endif
|
||||
|
||||
ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(texture->data), texture->width, texture->height,
|
||||
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR) |
|
||||
GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
|
||||
GPU_RGBA8);
|
||||
|
||||
|
||||
GPU_SetViewport(NULL,
|
||||
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
|
||||
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
||||
ctr->video_mode == CTR_VIDEO_MODE_800x240 ? CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH);
|
||||
GPU_SetViewport(NULL,
|
||||
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
|
||||
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
||||
ctr->video_mode == CTR_VIDEO_MODE_800x240 ?
|
||||
CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH);
|
||||
|
||||
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
|
||||
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
|
||||
|
||||
if (ctr->video_mode == CTR_VIDEO_MODE_3D)
|
||||
{
|
||||
GPU_SetViewport(NULL,
|
||||
VIRT_TO_PHYS(ctr->drawbuffers.top.right),
|
||||
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
||||
CTR_TOP_FRAMEBUFFER_WIDTH);
|
||||
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
|
||||
}
|
||||
if (ctr->video_mode == CTR_VIDEO_MODE_3D)
|
||||
{
|
||||
GPU_SetViewport(NULL,
|
||||
VIRT_TO_PHYS(ctr->drawbuffers.top.right),
|
||||
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
|
||||
CTR_TOP_FRAMEBUFFER_WIDTH);
|
||||
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
|
||||
}
|
||||
|
||||
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0);
|
||||
// printf("(%i,%i,%i,%i) , (%i,%i)\n", (int)draw->x, (int)draw->y, (int)draw->width, (int)draw->height, texture->width, texture->height);
|
||||
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0);
|
||||
#if 0
|
||||
printf("(%i,%i,%i,%i) , (%i,%i)\n", (int)draw->x,
|
||||
(int)draw->y, (int)draw->width, (int)draw->height,
|
||||
texture->width, texture->height);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_display_ctr_draw_pipeline(void *data)
|
||||
@ -156,27 +164,34 @@ static void menu_display_ctr_draw_pipeline(void *data)
|
||||
|
||||
static void menu_display_ctr_restore_clear_color(void)
|
||||
{
|
||||
// ctr_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF));
|
||||
#if 0
|
||||
ctr_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_display_ctr_clear_color(menu_display_ctx_clearcolor_t *clearcolor)
|
||||
{
|
||||
if (!clearcolor)
|
||||
return;
|
||||
// ctr_set_clear_color(RGBA8((int)(clearcolor->r*255.f),
|
||||
// (int)(clearcolor->g*255.f),
|
||||
// (int)(clearcolor->b*255.f),
|
||||
// (int)(clearcolor->a*255.f)));
|
||||
// ctr_clear_screen();
|
||||
#if 0
|
||||
ctr_set_clear_color(RGBA8((int)(clearcolor->r*255.f),
|
||||
(int)(clearcolor->g*255.f),
|
||||
(int)(clearcolor->b*255.f),
|
||||
(int)(clearcolor->a*255.f)));
|
||||
ctr_clear_screen();
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool menu_display_ctr_font_init_first(
|
||||
void **font_handle, void *video_data,
|
||||
const char *font_path, float font_size)
|
||||
const char *font_path, float font_size,
|
||||
bool is_threaded)
|
||||
{
|
||||
font_data_t **handle = (font_data_t**)font_handle;
|
||||
*handle = font_driver_init_first(video_data,
|
||||
font_path, font_size, true, FONT_DRIVER_RENDER_CTR);
|
||||
font_path, font_size, true,
|
||||
is_threaded,
|
||||
FONT_DRIVER_RENDER_CTR);
|
||||
return *handle;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user