From ca7f578e2f2e0ca0da1a3df866dbb0fac4aa7a57 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 27 Apr 2017 19:50:02 +1000 Subject: [PATCH] [Video] remove scale_1024 from rdp structure --- Source/Project64-video/Debugger.cpp | 71 +++++++++++++++-------------- Source/Project64-video/Main.cpp | 3 -- Source/Project64-video/rdp.h | 4 +- 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/Source/Project64-video/Debugger.cpp b/Source/Project64-video/Debugger.cpp index 895a7bcbb..b750c5242 100644 --- a/Source/Project64-video/Debugger.cpp +++ b/Source/Project64-video/Debugger.cpp @@ -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> 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; - } } diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 92b5dc171..f83311112 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -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; diff --git a/Source/Project64-video/rdp.h b/Source/Project64-video/rdp.h index 58f087337..9d4d8b5c9 100644 --- a/Source/Project64-video/rdp.h +++ b/Source/Project64-video/rdp.h @@ -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];