[Video] remove scale_1024 from rdp structure

This commit is contained in:
zilmar 2017-04-27 19:50:02 +10:00
parent 115f9f48b6
commit ca7f578e2f
3 changed files with 38 additions and 40 deletions

View File

@ -18,47 +18,48 @@
#include "Util.h"
#include "Debugger.h"
#define SX(x) ((x)*rdp.scale_1024)
#define SY(x) ((x)*rdp.scale_768)
//
// output - output debugger text
//
extern int g_scr_res_x, g_scr_res_y;
void output (float x, float y, int scale, const char *fmt, ...)
void output(float x, float y, int scale, const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
vsprintf(out_buf, fmt, ap);
va_end(ap);
float scale_1024 = g_scr_res_x / 1024.0f;
float scale_768 = g_scr_res_y / 768.0f;
uint8_t c,r;
for (uint32_t i=0; i<strlen(out_buf); i++)
{
c = ((out_buf[i]-32) & 0x1F) * 8;//<< 3;
r = (((out_buf[i]-32) & 0xE0) >> 5) * 16;//<< 4;
VERTEX v[4] = { { SX(x), SY(768-y), 1, 1, (float)c, r+16.0f, 0, 0, {0, 0, 0, 0} },
{ SX(x+8), SY(768-y), 1, 1, c+8.0f, r+16.0f, 0, 0, {0, 0, 0, 0} },
{ SX(x), SY(768-y-16), 1, 1, (float)c, (float)r, 0, 0, {0, 0, 0, 0} },
{ SX(x+8), SY(768-y-16), 1, 1, c+8.0f, (float)r, 0, 0, {0, 0, 0, 0} }
};
if (!scale)
va_list ap;
va_start(ap, fmt);
vsprintf(out_buf, fmt, ap);
va_end(ap);
uint8_t c, r;
for (uint32_t i = 0; i < strlen(out_buf); i++)
{
v[0].x = x;
v[0].y = y;
v[1].x = x+8;
v[1].y = y;
v[2].x = x;
v[2].y = y-16;
v[3].x = x+8;
v[3].y = y-16;
c = ((out_buf[i] - 32) & 0x1F) * 8;//<< 3;
r = (((out_buf[i] - 32) & 0xE0) >> 5) * 16;//<< 4;
VERTEX v[4] = { { x * scale_1024, (768 - y) * scale_768, 1, 1, (float)c, r + 16.0f, 0, 0,{ 0, 0, 0, 0 } },
{ (x + 8) * scale_1024, (768 - y) * scale_768, 1, 1, c + 8.0f, r + 16.0f, 0, 0,{ 0, 0, 0, 0 } },
{ x * scale_1024, (768 - y - 16) * scale_768, 1, 1, (float)c, (float)r, 0, 0,{ 0, 0, 0, 0 } },
{ (x + 8) * scale_1024, (768 - y - 16) * scale_768, 1, 1, c + 8.0f, (float)r, 0, 0,{ 0, 0, 0, 0 } }
};
if (!scale)
{
v[0].x = x;
v[0].y = y;
v[1].x = x + 8;
v[1].y = y;
v[2].x = x;
v[2].y = y - 16;
v[3].x = x + 8;
v[3].y = y - 16;
}
ConvertCoordsKeep(v, 4);
grDrawTriangle(&v[0], &v[1], &v[2]);
grDrawTriangle(&v[1], &v[3], &v[2]);
x += 8;
}
ConvertCoordsKeep (v, 4);
grDrawTriangle (&v[0], &v[1], &v[2]);
grDrawTriangle (&v[1], &v[3], &v[2]);
x+=8;
}
}

View File

@ -146,9 +146,6 @@ void ChangeSize()
g_res_y = g_scr_res_y;
}
rdp.scale_1024 = g_scr_res_x / 1024.0f;
rdp.scale_768 = g_scr_res_y / 768.0f;
float res_scl_y = (float)g_res_y / 240.0f;
uint32_t scale_x = *gfx.VI_X_SCALE_REG & 0xFFF;

View File

@ -355,8 +355,8 @@ struct RDP_Base{
float offset_x, offset_y, offset_x_bak, offset_y_bak;
float scale_x, scale_1024, scale_x_bak;
float scale_y, scale_768, scale_y_bak;
float scale_x, scale_x_bak;
float scale_y, scale_y_bak;
float view_scale[3];
float view_trans[3];