diff --git a/Source/Project64-video/3dmath.cpp b/Source/Project64-video/3dmath.cpp index 4e2e4c5a0..8a6dcd891 100644 --- a/Source/Project64-video/3dmath.cpp +++ b/Source/Project64-video/3dmath.cpp @@ -84,8 +84,8 @@ void calc_linear(VERTEX *v) if (rdp.cur_cache[0]) { // scale >> 6 is size to map to - v->ou = (acosf(-x) / 3.141592654f) * (rdp.tiles[rdp.cur_tile].org_s_scale >> 6); - v->ov = (acosf(-y) / 3.141592654f) * (rdp.tiles[rdp.cur_tile].org_t_scale >> 6); + v->ou = (acosf(-x) / 3.141592654f) * (rdp.tiles(rdp.cur_tile).org_s_scale >> 6); + v->ov = (acosf(-y) / 3.141592654f) * (rdp.tiles(rdp.cur_tile).org_t_scale >> 6); } v->uv_scaled = 1; WriteTrace(TraceRDP, TraceVerbose, "calc linear u: %f, v: %f", v->ou, v->ov); @@ -98,13 +98,13 @@ void calc_sphere(VERTEX *v) int s_scale, t_scale; if (g_settings->hacks(CSettings::hack_Chopper)) { - s_scale = minval(rdp.tiles[rdp.cur_tile].org_s_scale >> 6, rdp.tiles[rdp.cur_tile].lr_s); - t_scale = minval(rdp.tiles[rdp.cur_tile].org_t_scale >> 6, rdp.tiles[rdp.cur_tile].lr_t); + s_scale = minval(rdp.tiles(rdp.cur_tile).org_s_scale >> 6, rdp.tiles(rdp.cur_tile).lr_s); + t_scale = minval(rdp.tiles(rdp.cur_tile).org_t_scale >> 6, rdp.tiles(rdp.cur_tile).lr_t); } else { - s_scale = rdp.tiles[rdp.cur_tile].org_s_scale >> 6; - t_scale = rdp.tiles[rdp.cur_tile].org_t_scale >> 6; + s_scale = rdp.tiles(rdp.cur_tile).org_s_scale >> 6; + t_scale = rdp.tiles(rdp.cur_tile).org_t_scale >> 6; } TransformVector(v->vec, vec, rdp.model); // TransformVector (v->vec, vec, rdp.combined); @@ -215,7 +215,7 @@ void MulMatricesSSE(float m1[4][4], float m2[4][4], float r[4][4]) { #if defined(__GNUC__) && !defined(NO_ASM) && !defined(NOSSE) /* [row][col]*/ - typedef float v4sf __attribute__ ((vector_size (16))); + typedef float v4sf __attribute__((vector_size(16))); v4sf row0 = _mm_loadu_ps(m2[0]); v4sf row1 = _mm_loadu_ps(m2[1]); v4sf row2 = _mm_loadu_ps(m2[2]); @@ -227,23 +227,23 @@ void MulMatricesSSE(float m1[4][4], float m2[4][4], float r[4][4]) // Fill tmp with four copies of leftrow[0] v4sf tmp = leftrow; - tmp = _mm_shuffle_ps (tmp, tmp, 0); + tmp = _mm_shuffle_ps(tmp, tmp, 0); // Calculate the four first summands v4sf destrow = tmp * row0; // Fill tmp with four copies of leftrow[1] tmp = leftrow; - tmp = _mm_shuffle_ps (tmp, tmp, 1 + (1 << 2) + (1 << 4) + (1 << 6)); + tmp = _mm_shuffle_ps(tmp, tmp, 1 + (1 << 2) + (1 << 4) + (1 << 6)); destrow += tmp * row1; // Fill tmp with four copies of leftrow[2] tmp = leftrow; - tmp = _mm_shuffle_ps (tmp, tmp, 2 + (2 << 2) + (2 << 4) + (2 << 6)); + tmp = _mm_shuffle_ps(tmp, tmp, 2 + (2 << 2) + (2 << 4) + (2 << 6)); destrow += tmp * row2; // Fill tmp with four copies of leftrow[3] tmp = leftrow; - tmp = _mm_shuffle_ps (tmp, tmp, 3 + (3 << 2) + (3 << 4) + (3 << 6)); + tmp = _mm_shuffle_ps(tmp, tmp, 3 + (3 << 2) + (3 << 4) + (3 << 6)); destrow += tmp * row3; __builtin_ia32_storeups(r[i], destrow); @@ -252,105 +252,105 @@ void MulMatricesSSE(float m1[4][4], float m2[4][4], float r[4][4]) __asm { mov eax, dword ptr[r] - mov ecx, dword ptr[m1] - mov edx, dword ptr[m2] + mov ecx, dword ptr[m1] + mov edx, dword ptr[m2] - movaps xmm0, [edx] - movaps xmm1, [edx + 16] - movaps xmm2, [edx + 32] - movaps xmm3, [edx + 48] + movaps xmm0, [edx] + movaps xmm1, [edx + 16] + movaps xmm2, [edx + 32] + movaps xmm3, [edx + 48] - // r[0][0],r[0][1],r[0][2],r[0][3] + // r[0][0],r[0][1],r[0][2],r[0][3] - movaps xmm4, xmmword ptr[ecx] - movaps xmm5, xmm4 - movaps xmm6, xmm4 - movaps xmm7, xmm4 + movaps xmm4, xmmword ptr[ecx] + movaps xmm5, xmm4 + movaps xmm6, xmm4 + movaps xmm7, xmm4 - shufps xmm4, xmm4, 00000000b - shufps xmm5, xmm5, 01010101b - shufps xmm6, xmm6, 10101010b - shufps xmm7, xmm7, 11111111b + shufps xmm4, xmm4, 00000000b + shufps xmm5, xmm5, 01010101b + shufps xmm6, xmm6, 10101010b + shufps xmm7, xmm7, 11111111b - mulps xmm4, xmm0 - mulps xmm5, xmm1 - mulps xmm6, xmm2 - mulps xmm7, xmm3 + mulps xmm4, xmm0 + mulps xmm5, xmm1 + mulps xmm6, xmm2 + mulps xmm7, xmm3 - addps xmm4, xmm5 - addps xmm4, xmm6 - addps xmm4, xmm7 + addps xmm4, xmm5 + addps xmm4, xmm6 + addps xmm4, xmm7 - movaps xmmword ptr[eax], xmm4 + movaps xmmword ptr[eax], xmm4 - // r[1][0],r[1][1],r[1][2],r[1][3] + // r[1][0],r[1][1],r[1][2],r[1][3] - movaps xmm4, xmmword ptr[ecx + 16] - movaps xmm5, xmm4 - movaps xmm6, xmm4 - movaps xmm7, xmm4 + movaps xmm4, xmmword ptr[ecx + 16] + movaps xmm5, xmm4 + movaps xmm6, xmm4 + movaps xmm7, xmm4 - shufps xmm4, xmm4, 00000000b - shufps xmm5, xmm5, 01010101b - shufps xmm6, xmm6, 10101010b - shufps xmm7, xmm7, 11111111b + shufps xmm4, xmm4, 00000000b + shufps xmm5, xmm5, 01010101b + shufps xmm6, xmm6, 10101010b + shufps xmm7, xmm7, 11111111b - mulps xmm4, xmm0 - mulps xmm5, xmm1 - mulps xmm6, xmm2 - mulps xmm7, xmm3 + mulps xmm4, xmm0 + mulps xmm5, xmm1 + mulps xmm6, xmm2 + mulps xmm7, xmm3 - addps xmm4, xmm5 - addps xmm4, xmm6 - addps xmm4, xmm7 + addps xmm4, xmm5 + addps xmm4, xmm6 + addps xmm4, xmm7 - movaps xmmword ptr[eax + 16], xmm4 + movaps xmmword ptr[eax + 16], xmm4 - // r[2][0],r[2][1],r[2][2],r[2][3] + // r[2][0],r[2][1],r[2][2],r[2][3] - movaps xmm4, xmmword ptr[ecx + 32] - movaps xmm5, xmm4 - movaps xmm6, xmm4 - movaps xmm7, xmm4 + movaps xmm4, xmmword ptr[ecx + 32] + movaps xmm5, xmm4 + movaps xmm6, xmm4 + movaps xmm7, xmm4 - shufps xmm4, xmm4, 00000000b - shufps xmm5, xmm5, 01010101b - shufps xmm6, xmm6, 10101010b - shufps xmm7, xmm7, 11111111b + shufps xmm4, xmm4, 00000000b + shufps xmm5, xmm5, 01010101b + shufps xmm6, xmm6, 10101010b + shufps xmm7, xmm7, 11111111b - mulps xmm4, xmm0 - mulps xmm5, xmm1 - mulps xmm6, xmm2 - mulps xmm7, xmm3 + mulps xmm4, xmm0 + mulps xmm5, xmm1 + mulps xmm6, xmm2 + mulps xmm7, xmm3 - addps xmm4, xmm5 - addps xmm4, xmm6 - addps xmm4, xmm7 + addps xmm4, xmm5 + addps xmm4, xmm6 + addps xmm4, xmm7 - movaps xmmword ptr[eax + 32], xmm4 + movaps xmmword ptr[eax + 32], xmm4 - // r[3][0],r[3][1],r[3][2],r[3][3] + // r[3][0],r[3][1],r[3][2],r[3][3] - movaps xmm4, xmmword ptr[ecx + 48] - movaps xmm5, xmm4 - movaps xmm6, xmm4 - movaps xmm7, xmm4 + movaps xmm4, xmmword ptr[ecx + 48] + movaps xmm5, xmm4 + movaps xmm6, xmm4 + movaps xmm7, xmm4 - shufps xmm4, xmm4, 00000000b - shufps xmm5, xmm5, 01010101b - shufps xmm6, xmm6, 10101010b - shufps xmm7, xmm7, 11111111b + shufps xmm4, xmm4, 00000000b + shufps xmm5, xmm5, 01010101b + shufps xmm6, xmm6, 10101010b + shufps xmm7, xmm7, 11111111b - mulps xmm4, xmm0 - mulps xmm5, xmm1 - mulps xmm6, xmm2 - mulps xmm7, xmm3 + mulps xmm4, xmm0 + mulps xmm5, xmm1 + mulps xmm6, xmm2 + mulps xmm7, xmm3 - addps xmm4, xmm5 - addps xmm4, xmm6 - addps xmm4, xmm7 + addps xmm4, xmm5 + addps xmm4, xmm6 + addps xmm4, xmm7 - movaps xmmword ptr[eax + 48], xmm4 + movaps xmmword ptr[eax + 48], xmm4 } #endif // _WIN32 } @@ -383,9 +383,9 @@ void math_init() } GLIDE64_CATCH { return; } - // Check for SSE - if (edx & (1 << 25)) - IsSSE = TRUE; + // Check for SSE + if (edx & (1 << 25)) + IsSSE = TRUE; #elif !defined(NO_ASM) && !defined(NOSSE) DWORD dwEdx; __try @@ -393,8 +393,8 @@ void math_init() __asm { mov eax, 1 - cpuid - mov dwEdx, edx + cpuid + mov dwEdx, edx } } __except (EXCEPTION_EXECUTE_HANDLER) diff --git a/Source/Project64-video/Combine.cpp b/Source/Project64-video/Combine.cpp index e034c5cf2..0308a9ee7 100644 --- a/Source/Project64-video/Combine.cpp +++ b/Source/Project64-video/Combine.cpp @@ -4665,7 +4665,7 @@ static void cc__t0_sub_prim_mul_shade_add_env__mul_shadea() static void cc__t0_mul_shade__sub_env_mul_shadea_add_env() //Aded by Gonetz { - if (rdp.tiles[rdp.cur_tile].format == 4) + if (rdp.tiles(rdp.cur_tile).format == 4) { CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL, GR_COMBINE_FACTOR_OTHER_ALPHA, @@ -4673,7 +4673,7 @@ static void cc__t0_mul_shade__sub_env_mul_shadea_add_env() //Aded by Gonetz GR_COMBINE_OTHER_ITERATED); CC_ENV(); } - else if (rdp.tiles[rdp.cur_tile].format == 2) + else if (rdp.tiles(rdp.cur_tile).format == 2) { CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, @@ -5820,7 +5820,7 @@ static void cc_prim_sub_env_mul__t1_sub_prim_mul_enva_add_t0__add_env() SETSHADE_PRIM(); if (cmb.combine_ext) { - if (rdp.tiles[rdp.cur_tile].format > 2) + if (rdp.tiles(rdp.cur_tile).format > 2) { T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO, GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO, @@ -8769,7 +8769,7 @@ static void ac_t1() GR_COMBINE_FACTOR_ONE, GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_TEXTURE); - if (g_settings->hacks(CSettings::hack_BAR) && rdp.tiles[rdp.cur_tile].format == 3) + if (g_settings->hacks(CSettings::hack_BAR) && rdp.tiles(rdp.cur_tile).format == 3) A_USE_T0(); else A_USE_T1(); @@ -10038,7 +10038,7 @@ static void ac__t0_mul_t1__mul_prim() GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_TEXTURE); CA_PRIM(); - if (voodoo.sup_large_tex || rdp.tiles[1].lr_s < 256) //hack for RR64 pause screen + if (voodoo.sup_large_tex || rdp.tiles(1).lr_s < 256) //hack for RR64 pause screen { A_T0_MUL_T1(); } diff --git a/Source/Project64-video/TexCache.cpp b/Source/Project64-video/TexCache.cpp index 5b14ff40e..0064d53b8 100644 --- a/Source/Project64-video/TexCache.cpp +++ b/Source/Project64-video/TexCache.cpp @@ -170,11 +170,11 @@ void GetTexInfo(int id, int tile) int wid_64, line, bpl; // Get width and height - tile_width = rdp.tiles[tile].lr_s - rdp.tiles[tile].ul_s + 1; - tile_height = rdp.tiles[tile].lr_t - rdp.tiles[tile].ul_t + 1; + tile_width = rdp.tiles(tile).lr_s - rdp.tiles(tile).ul_s + 1; + tile_height = rdp.tiles(tile).lr_t - rdp.tiles(tile).ul_t + 1; - mask_width = (rdp.tiles[tile].mask_s == 0) ? (tile_width) : (1 << rdp.tiles[tile].mask_s); - mask_height = (rdp.tiles[tile].mask_t == 0) ? (tile_height) : (1 << rdp.tiles[tile].mask_t); + mask_width = (rdp.tiles(tile).mask_s == 0) ? (tile_width) : (1 << rdp.tiles(tile).mask_s); + mask_height = (rdp.tiles(tile).mask_t == 0) ? (tile_height) : (1 << rdp.tiles(tile).mask_t); if (g_settings->alt_tex_size()) { @@ -183,32 +183,32 @@ void GetTexInfo(int id, int tile) // textures. // Get the width/height to load - if ((rdp.tiles[tile].clamp_s && tile_width <= 256) || (mask_width > 256)) + if ((rdp.tiles(tile).clamp_s && tile_width <= 256) || (mask_width > 256)) { // loading width width = minval(mask_width, tile_width); // actual width - rdp.tiles[tile].width = tile_width; + rdp.tiles(tile).width = tile_width; } else { // wrap all the way width = minval(mask_width, tile_width); // changed from mask_width only - rdp.tiles[tile].width = width; + rdp.tiles(tile).width = width; } - if ((rdp.tiles[tile].clamp_t && tile_height <= 256) || (mask_height > 256)) + if ((rdp.tiles(tile).clamp_t && tile_height <= 256) || (mask_height > 256)) { // loading height height = minval(mask_height, tile_height); // actual height - rdp.tiles[tile].height = tile_height; + rdp.tiles(tile).height = tile_height; } else { // wrap all the way height = minval(mask_height, tile_height); - rdp.tiles[tile].height = height; + rdp.tiles(tile).height = height; } } else @@ -224,52 +224,52 @@ void GetTexInfo(int id, int tile) } // Get the width/height to load - if ((rdp.tiles[tile].clamp_s && tile_width <= 256))//|| (mask_width > 256)) + if ((rdp.tiles(tile).clamp_s && tile_width <= 256))//|| (mask_width > 256)) { // loading width width = minval(mask_width, tile_width); // actual width - rdp.tiles[tile].width = tile_width; + rdp.tiles(tile).width = tile_width; } else { // wrap all the way width = mask_width; - rdp.tiles[tile].width = mask_width; + rdp.tiles(tile).width = mask_width; } - if ((rdp.tiles[tile].clamp_t && tile_height <= 256) || (mask_height > 256)) + if ((rdp.tiles(tile).clamp_t && tile_height <= 256) || (mask_height > 256)) { // loading height height = minval(mask_height, tile_height); // actual height - rdp.tiles[tile].height = tile_height; + rdp.tiles(tile).height = tile_height; } else { // wrap all the way height = mask_height; - rdp.tiles[tile].height = mask_height; + rdp.tiles(tile).height = mask_height; } } // without any large texture fixing-up; for alignment - int real_image_width = rdp.tiles[tile].width; - int real_image_height = rdp.tiles[tile].height; + int real_image_width = rdp.tiles(tile).width; + int real_image_height = rdp.tiles(tile).height; int crc_height = height; if (rdp.timg.set_by == 1) crc_height = tile_height; - bpl = width << rdp.tiles[tile].size >> 1; + bpl = width << rdp.tiles(tile).size >> 1; // ** COMMENT THIS TO DISABLE LARGE TEXTURES #ifdef LARGE_TEXTURE_HANDLING if (!voodoo.sup_large_tex && width > 256) { info->splits = ((width - 1) >> 8) + 1; - info->splitheight = rdp.tiles[tile].height; - rdp.tiles[tile].height *= info->splits; - rdp.tiles[tile].width = 256; + info->splitheight = rdp.tiles(tile).height; + rdp.tiles(tile).height *= info->splits; + rdp.tiles(tile).width = 256; width = 256; } else @@ -280,19 +280,19 @@ void GetTexInfo(int id, int tile) } WriteTrace(TraceRDP, TraceDebug, " | | |-+ Texture approved:"); - WriteTrace(TraceRDP, TraceDebug, " | | | |- tmem: %08lx", rdp.tiles[tile].t_mem); + WriteTrace(TraceRDP, TraceDebug, " | | | |- tmem: %08lx", rdp.tiles(tile).t_mem); WriteTrace(TraceRDP, TraceDebug, " | | | |- load width: %d", width); WriteTrace(TraceRDP, TraceDebug, " | | | |- load height: %d", height); - WriteTrace(TraceRDP, TraceDebug, " | | | |- actual width: %d", rdp.tiles[tile].width); - WriteTrace(TraceRDP, TraceDebug, " | | | |- actual height: %d", rdp.tiles[tile].height); - WriteTrace(TraceRDP, TraceDebug, " | | | |- size: %d", rdp.tiles[tile].size); - WriteTrace(TraceRDP, TraceDebug, " | | | +- format: %d", rdp.tiles[tile].format); + WriteTrace(TraceRDP, TraceDebug, " | | | |- actual width: %d", rdp.tiles(tile).width); + WriteTrace(TraceRDP, TraceDebug, " | | | |- actual height: %d", rdp.tiles(tile).height); + WriteTrace(TraceRDP, TraceDebug, " | | | |- size: %d", rdp.tiles(tile).size); + WriteTrace(TraceRDP, TraceDebug, " | | | +- format: %d", rdp.tiles(tile).format); WriteTrace(TraceRDP, TraceDebug, " | | |- Calculating CRC... "); // ** CRC CHECK - wid_64 = width << (rdp.tiles[tile].size) >> 1; - if (rdp.tiles[tile].size == 3) + wid_64 = width << (rdp.tiles(tile).size) >> 1; + if (rdp.tiles(tile).size == 3) { if (wid_64 & 15) wid_64 += 16; wid_64 &= 0xFFFFFFF0; @@ -304,20 +304,20 @@ void GetTexInfo(int id, int tile) wid_64 = wid_64 >> 3; // Texture too big for tmem & needs to wrap? (trees in mm) - if (rdp.tiles[tile].t_mem + minval(height, tile_height) * (rdp.tiles[tile].line << 3) > 4096) + if (rdp.tiles(tile).t_mem + minval(height, tile_height) * (rdp.tiles(tile).line << 3) > 4096) { WriteTrace(TraceRDP, TraceDebug, "TEXTURE WRAPS TMEM!!! "); // calculate the y value that intersects at 4096 bytes - int y = (4096 - rdp.tiles[tile].t_mem) / (rdp.tiles[tile].line << 3); + int y = (4096 - rdp.tiles(tile).t_mem) / (rdp.tiles(tile).line << 3); - rdp.tiles[tile].clamp_t = 0; - rdp.tiles[tile].lr_t = rdp.tiles[tile].ul_t + y - 1; + rdp.tiles(tile).clamp_t = 0; + rdp.tiles(tile).lr_t = rdp.tiles(tile).ul_t + y - 1; // calc mask int shift; for (shift = 0; (1 << shift) < y; shift++); - rdp.tiles[tile].mask_t = shift; + rdp.tiles(tile).mask_t = shift; // restart the function WriteTrace(TraceRDP, TraceDebug, "restarting..."); @@ -325,18 +325,18 @@ void GetTexInfo(int id, int tile) return; } - line = rdp.tiles[tile].line; - if (rdp.tiles[tile].size == 3) + line = rdp.tiles(tile).line; + if (rdp.tiles(tile).size == 3) line <<= 1; uint32_t crc = 0; if (g_settings->fast_crc()) { line = (line - wid_64) << 3; if (wid_64 < 1) wid_64 = 1; - uint8_t * addr = (((uint8_t*)rdp.tmem) + (rdp.tiles[tile].t_mem << 3)); + uint8_t * addr = (((uint8_t*)rdp.tmem) + (rdp.tiles(tile).t_mem << 3)); if (crc_height > 0) // Check the CRC { - if (rdp.tiles[tile].size < 3) + if (rdp.tiles(tile).size < 3) crc = textureCRC(addr, wid_64, crc_height, line); else //32b texture { @@ -350,9 +350,9 @@ void GetTexInfo(int id, int tile) else { crc = 0xFFFFFFFF; - uintptr_t addr = uintptr_t(rdp.tmem) + (rdp.tiles[tile].t_mem << 3); + uintptr_t addr = uintptr_t(rdp.tmem) + (rdp.tiles(tile).t_mem << 3); uint32_t line2 = maxval(line, 1); - if (rdp.tiles[tile].size < 3) + if (rdp.tiles(tile).size < 3) { line2 <<= 3; for (int y = 0; y < crc_height; y++) @@ -377,19 +377,19 @@ void GetTexInfo(int id, int tile) line = (line - wid_64) << 3; if (wid_64 < 1) wid_64 = 1; } - if ((rdp.tiles[tile].size < 2) && (rdp.tlut_mode || rdp.tiles[tile].format == 2)) + if ((rdp.tiles(tile).size < 2) && (rdp.tlut_mode || rdp.tiles(tile).format == 2)) { - if (rdp.tiles[tile].size == 0) - crc += rdp.pal_8_crc[rdp.tiles[tile].palette]; + if (rdp.tiles(tile).size == 0) + crc += rdp.pal_8_crc[rdp.tiles(tile).palette]; else crc += rdp.pal_256_crc; } WriteTrace(TraceRDP, TraceDebug, "Done. CRC is: %08lx.", crc); - uint32_t flags = (rdp.tiles[tile].clamp_s << 23) | (rdp.tiles[tile].mirror_s << 22) | - (rdp.tiles[tile].mask_s << 18) | (rdp.tiles[tile].clamp_t << 17) | - (rdp.tiles[tile].mirror_t << 16) | (rdp.tiles[tile].mask_t << 12); + uint32_t flags = (rdp.tiles(tile).clamp_s << 23) | (rdp.tiles(tile).mirror_s << 22) | + (rdp.tiles(tile).mask_s << 18) | (rdp.tiles(tile).clamp_t << 17) | + (rdp.tiles(tile).mirror_t << 16) | (rdp.tiles(tile).mask_t << 12); info->real_image_width = real_image_width; info->real_image_height = real_image_height; @@ -431,18 +431,18 @@ void GetTexInfo(int id, int tile) } NODE *node = cachelut[crc >> 16]; - uint32_t mod_mask = (rdp.tiles[tile].format == 2) ? 0xFFFFFFFF : 0xF0F0F0F0; + uint32_t mod_mask = (rdp.tiles(tile).format == 2) ? 0xFFFFFFFF : 0xF0F0F0F0; while (node) { if (node->crc == crc) { cache = (CACHE_LUT*)node->data; if (/*tex_found[id][node->tmu] == -1 && - rdp.tiles[tile].palette == cache->palette && - rdp.tiles[tile].format == cache->format && - rdp.tiles[tile].size == cache->size &&*/ - rdp.tiles[tile].width == cache->width && - rdp.tiles[tile].height == cache->height && + rdp.tiles(tile).palette == cache->palette && + rdp.tiles(tile).format == cache->format && + rdp.tiles(tile).size == cache->size &&*/ + rdp.tiles(tile).width == cache->width && + rdp.tiles(tile).height == cache->height && flags == cache->flags) { if (!(mod + cache->mod) || (cache->mod == mod && @@ -862,15 +862,15 @@ void TexCache() int clamp_s, clamp_t; if (rdp.force_wrap && !rdp.texrecting) { - clamp_s = rdp.tiles[tile].clamp_s && rdp.tiles[tile].lr_s - rdp.tiles[tile].ul_s < 256; - clamp_t = rdp.tiles[tile].clamp_t && rdp.tiles[tile].lr_t - rdp.tiles[tile].ul_t < 256; + clamp_s = rdp.tiles(tile).clamp_s && rdp.tiles(tile).lr_s - rdp.tiles(tile).ul_s < 256; + clamp_t = rdp.tiles(tile).clamp_t && rdp.tiles(tile).lr_t - rdp.tiles(tile).ul_t < 256; } else { - clamp_s = (rdp.tiles[tile].clamp_s || rdp.tiles[tile].mask_s == 0) && - rdp.tiles[tile].lr_s - rdp.tiles[tile].ul_s < 256; - clamp_t = (rdp.tiles[tile].clamp_t || rdp.tiles[tile].mask_t == 0) && - rdp.tiles[tile].lr_t - rdp.tiles[tile].ul_t < 256; + clamp_s = (rdp.tiles(tile).clamp_s || rdp.tiles(tile).mask_s == 0) && + rdp.tiles(tile).lr_s - rdp.tiles(tile).ul_s < 256; + clamp_t = (rdp.tiles(tile).clamp_t || rdp.tiles(tile).mask_t == 0) && + rdp.tiles(tile).lr_t - rdp.tiles(tile).ul_t < 256; } if (rdp.cur_cache[i]->f_mirror_s) @@ -881,7 +881,7 @@ void TexCache() mode_s = GR_TEXTURECLAMP_CLAMP; else { - if (rdp.tiles[tile].mirror_s && voodoo.sup_mirroring) + if (rdp.tiles(tile).mirror_s && voodoo.sup_mirroring) mode_s = GR_TEXTURECLAMP_MIRROR_EXT; else mode_s = GR_TEXTURECLAMP_WRAP; @@ -895,7 +895,7 @@ void TexCache() mode_t = GR_TEXTURECLAMP_CLAMP; else { - if (rdp.tiles[tile].mirror_t && voodoo.sup_mirroring) + if (rdp.tiles(tile).mirror_t && voodoo.sup_mirroring) mode_t = GR_TEXTURECLAMP_MIRROR_EXT; else mode_t = GR_TEXTURECLAMP_WRAP; @@ -978,21 +978,21 @@ void LoadTex(int id, int tmu) //!Hackalert //GoldenEye water texture. It has CI format in fact, but the game set it to RGBA - if (g_settings->hacks(CSettings::hack_GoldenEye) && rdp.tiles[td].format == 0 && rdp.tlut_mode == 2 && rdp.tiles[td].size == 2) + if (g_settings->hacks(CSettings::hack_GoldenEye) && rdp.tiles(td).format == 0 && rdp.tlut_mode == 2 && rdp.tiles(td).size == 2) { - rdp.tiles[td].format = 2; - rdp.tiles[td].size = 1; + rdp.tiles(td).format = 2; + rdp.tiles(td).size = 1; } // Set the data - cache->line = rdp.tiles[td].line; - cache->addr = rdp.addr[rdp.tiles[td].t_mem]; + cache->line = rdp.tiles(td).line; + cache->addr = rdp.addr[rdp.tiles(td).t_mem]; cache->crc = texinfo[id].crc; - cache->palette = rdp.tiles[td].palette; - cache->width = rdp.tiles[td].width; - cache->height = rdp.tiles[td].height; - cache->format = rdp.tiles[td].format; - cache->size = rdp.tiles[td].size; + cache->palette = rdp.tiles(td).palette; + cache->width = rdp.tiles(td).width; + cache->height = rdp.tiles(td).height; + cache->format = rdp.tiles(td).format; + cache->size = rdp.tiles(td).size; cache->tmem_addr = voodoo.tmem_ptr[tmu]; cache->set_by = rdp.timg.set_by; cache->texrecting = rdp.texrecting; @@ -1013,8 +1013,8 @@ void LoadTex(int id, int tmu) cache->t_info.format = GFX_TEXFMT_ARGB_1555; // Calculate lod and aspect - uint32_t size_x = rdp.tiles[td].width; - uint32_t size_y = rdp.tiles[td].height; + uint32_t size_x = rdp.tiles(td).width; + uint32_t size_y = rdp.tiles(td).height; // make size_x and size_y both powers of two if (!voodoo.sup_large_tex) @@ -1032,9 +1032,9 @@ void LoadTex(int id, int tmu) // Voodoo 1 support is all here, it will automatically mirror to the full extent. if (!voodoo.sup_mirroring) { - if (rdp.tiles[td].mirror_s && !rdp.tiles[td].clamp_s && (voodoo.sup_large_tex || size_x <= 128)) + if (rdp.tiles(td).mirror_s && !rdp.tiles(td).clamp_s && (voodoo.sup_large_tex || size_x <= 128)) size_x <<= 1; - if (rdp.tiles[td].mirror_t && !rdp.tiles[td].clamp_t && (voodoo.sup_large_tex || size_y <= 128)) + if (rdp.tiles(td).mirror_t && !rdp.tiles(td).clamp_t && (voodoo.sup_large_tex || size_y <= 128)) size_y <<= 1; } @@ -1236,50 +1236,50 @@ void LoadTex(int id, int tmu) if (g_ghq_use) { int bpl; - uint8_t* addr = (uint8_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[td].t_mem]); + uint8_t* addr = (uint8_t*)(gfx.RDRAM + rdp.addr[rdp.tiles(td).t_mem]); int tile_width = texinfo[id].width; int tile_height = texinfo[id].height; - LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles[td].t_mem]; + LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles(td).t_mem]; if (rdp.timg.set_by == 1) { bpl = info.tex_width << info.tex_size >> 1; addr += (info.tile_ul_t * bpl) + (((info.tile_ul_s << info.tex_size) + 1) >> 1); tile_width = minval(info.tile_width, info.tex_width); - if (info.tex_size > rdp.tiles[td].size) - tile_width <<= info.tex_size - rdp.tiles[td].size; + if (info.tex_size > rdp.tiles(td).size) + tile_width <<= info.tex_size - rdp.tiles(td).size; - if (rdp.tiles[td].lr_t > rdp.bg_image_height) - tile_height = rdp.bg_image_height - rdp.tiles[td].ul_t; + if (rdp.tiles(td).lr_t > rdp.bg_image_height) + tile_height = rdp.bg_image_height - rdp.tiles(td).ul_t; else tile_height = info.tile_height; } else { - if (rdp.tiles[td].size == 3) - bpl = rdp.tiles[td].line << 4; + if (rdp.tiles(td).size == 3) + bpl = rdp.tiles(td).line << 4; else if (info.dxt == 0) - bpl = rdp.tiles[td].line << 3; + bpl = rdp.tiles(td).line << 3; else { uint32_t dxt = info.dxt; if (dxt > 1) - dxt = ReverseDXT(dxt, info.tile_width, texinfo[id].width, rdp.tiles[td].size); + dxt = ReverseDXT(dxt, info.tile_width, texinfo[id].width, rdp.tiles(td).size); bpl = dxt << 3; } } - // uint8_t* addr = (uint8_t*)(gfx.RDRAM+rdp.addr[rdp.tiles[td].t_mem] + (rdp.tiles[td].ul_t * bpl) + (((rdp.tiles[td].ul_s<>1)); + // uint8_t* addr = (uint8_t*)(gfx.RDRAM+rdp.addr[rdp.tiles(td).t_mem] + (rdp.tiles(td).ul_t * bpl) + (((rdp.tiles(td).ul_s<>1)); uint8_t * paladdr = 0; uint16_t * palette = 0; - if ((rdp.tiles[td].size < 2) && (rdp.tlut_mode || rdp.tiles[td].format == 2)) + if ((rdp.tiles(td).size < 2) && (rdp.tlut_mode || rdp.tiles(td).format == 2)) { - if (rdp.tiles[td].size == 1) + if (rdp.tiles(td).size == 1) paladdr = (uint8_t*)(rdp.pal_8_rice); else if (g_settings->ghq_hirs_altcrc()) - paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 5)); + paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles(td).palette << 5)); else - paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 4)); - palette = (rdp.pal_8 + (rdp.tiles[td].palette << 4)); + paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles(td).palette << 4)); + palette = (rdp.pal_8 + (rdp.tiles(td).palette << 4)); } // XXX: Special combiner modes are ignored for hires textures @@ -1291,8 +1291,8 @@ void LoadTex(int id, int tmu) //g64_crc = CRC32( g64_crc, &cache->mod_color2, 4 ); // not used? g64_crc = CRC32(g64_crc, &cache->mod_factor, 4); - cache->ricecrc = ext_ghq_checksum(addr, tile_width, tile_height, (unsigned short)(rdp.tiles[td].format << 8 | rdp.tiles[td].size), bpl, paladdr); - WriteTrace(TraceRDP, TraceDebug, "CI RICE CRC. format: %d, size: %d, CRC: %08lx, PalCRC: %08lx", rdp.tiles[td].format, rdp.tiles[td].size, (uint32_t)(cache->ricecrc & 0xFFFFFFFF), (uint32_t)(cache->ricecrc >> 32)); + cache->ricecrc = ext_ghq_checksum(addr, tile_width, tile_height, (unsigned short)(rdp.tiles(td).format << 8 | rdp.tiles(td).size), bpl, paladdr); + WriteTrace(TraceRDP, TraceDebug, "CI RICE CRC. format: %d, size: %d, CRC: %08lx, PalCRC: %08lx", rdp.tiles(td).format, rdp.tiles(td).size, (uint32_t)(cache->ricecrc & 0xFFFFFFFF), (uint32_t)(cache->ricecrc >> 32)); if (ext_ghq_hirestex((uint64)g64_crc, cache->ricecrc, palette, &ghqTexInfo)) { cache->is_hires_tex = ghqTexInfo.is_hires_tex; @@ -1316,12 +1316,12 @@ void LoadTex(int id, int tmu) start_dst <<= HIWORD(result); // 1st time, result is set to 0, but start_dst is 0 anyway so it doesn't matter int start_src = i * 256; // start 256 more to the right - start_src = start_src << (rdp.tiles[td].size) >> 1; - if (rdp.tiles[td].size == 3) + start_src = start_src << (rdp.tiles(td).size) >> 1; + if (rdp.tiles(td).size == 3) start_src >>= 1; - result = load_table[rdp.tiles[td].size][rdp.tiles[td].format] - (uintptr_t(texture) + start_dst, uintptr_t(rdp.tmem) + (rdp.tiles[td].t_mem << 3) + start_src, + result = load_table[rdp.tiles(td).size][rdp.tiles(td).format] + (uintptr_t(texture) + start_dst, uintptr_t(rdp.tmem) + (rdp.tiles(td).t_mem << 3) + start_src, texinfo[id].wid_64, texinfo[id].height, texinfo[id].line, real_x, td); uint32_t size = HIWORD(result); @@ -1337,19 +1337,19 @@ void LoadTex(int id, int tmu) // ** end texture splitting ** else { - result = load_table[rdp.tiles[td].size][rdp.tiles[td].format] - (uintptr_t(texture), uintptr_t(rdp.tmem) + (rdp.tiles[td].t_mem << 3), + result = load_table[rdp.tiles(td).size][rdp.tiles(td).format] + (uintptr_t(texture), uintptr_t(rdp.tmem) + (rdp.tiles(td).t_mem << 3), texinfo[id].wid_64, texinfo[id].height, texinfo[id].line, real_x, td); uint32_t size = HIWORD(result); int min_x, min_y; - if (rdp.tiles[td].mask_s != 0) - min_x = minval((int)real_x, 1 << rdp.tiles[td].mask_s); + if (rdp.tiles(td).mask_s != 0) + min_x = minval((int)real_x, 1 << rdp.tiles(td).mask_s); else min_x = real_x; - if (rdp.tiles[td].mask_t != 0) - min_y = minval((int)real_y, 1 << rdp.tiles[td].mask_t); + if (rdp.tiles(td).mask_t != 0) + min_y = minval((int)real_y, 1 << rdp.tiles(td).mask_t); else min_y = real_y; @@ -1366,28 +1366,28 @@ void LoadTex(int id, int tmu) if (texinfo[id].width < (int)real_x) { - if (rdp.tiles[td].mirror_s) + if (rdp.tiles(td).mirror_s) { if (size == 1) - Mirror16bS((texture), rdp.tiles[td].mask_s, + Mirror16bS((texture), rdp.tiles(td).mask_s, real_x, real_x, texinfo[id].height); else if (size != 2) - Mirror8bS((texture), rdp.tiles[td].mask_s, + Mirror8bS((texture), rdp.tiles(td).mask_s, real_x, real_x, texinfo[id].height); else - Mirror32bS((texture), rdp.tiles[td].mask_s, + Mirror32bS((texture), rdp.tiles(td).mask_s, real_x, real_x, texinfo[id].height); } else { if (size == 1) - Wrap16bS((texture), rdp.tiles[td].mask_s, + Wrap16bS((texture), rdp.tiles(td).mask_s, real_x, real_x, texinfo[id].height); else if (size != 2) - Wrap8bS((texture), rdp.tiles[td].mask_s, + Wrap8bS((texture), rdp.tiles(td).mask_s, real_x, real_x, texinfo[id].height); else - Wrap32bS((texture), rdp.tiles[td].mask_s, + Wrap32bS((texture), rdp.tiles(td).mask_s, real_x, real_x, texinfo[id].height); } } @@ -1404,28 +1404,28 @@ void LoadTex(int id, int tmu) if (texinfo[id].height < (int)real_y) { - if (rdp.tiles[td].mirror_t) + if (rdp.tiles(td).mirror_t) { if (size == 1) - Mirror16bT((texture), rdp.tiles[td].mask_t, + Mirror16bT((texture), rdp.tiles(td).mask_t, real_y, real_x); else if (size != 2) - Mirror8bT((texture), rdp.tiles[td].mask_t, + Mirror8bT((texture), rdp.tiles(td).mask_t, real_y, real_x); else - Mirror32bT((texture), rdp.tiles[td].mask_t, + Mirror32bT((texture), rdp.tiles(td).mask_t, real_y, real_x); } else { if (size == 1) - Wrap16bT((texture), rdp.tiles[td].mask_t, + Wrap16bT((texture), rdp.tiles(td).mask_t, real_y, real_x); else if (size != 2) - Wrap8bT((texture), rdp.tiles[td].mask_t, + Wrap8bT((texture), rdp.tiles(td).mask_t, real_y, real_x); else - Wrap32bT((texture), rdp.tiles[td].mask_t, + Wrap32bT((texture), rdp.tiles(td).mask_t, real_y, real_x); } } @@ -1597,9 +1597,9 @@ void LoadTex(int id, int tmu) } else { - int tile_width = rdp.tiles[td].width; + int tile_width = rdp.tiles(td).width; if (rdp.timg.set_by == 1) - tile_width = rdp.load_info[rdp.tiles[td].t_mem].tex_width; + tile_width = rdp.load_info[rdp.tiles(td).t_mem].tex_width; float mult = float(ghqTexInfo.untiled_width / tile_width); cache->c_scl_x *= mult; cache->c_scl_y *= mult; @@ -1637,11 +1637,11 @@ void LoadTex(int id, int tmu) } if (voodoo.sup_mirroring) { - if (rdp.tiles[td].mirror_s && texinfo[id].tile_width == 2 * texinfo[id].width) + if (rdp.tiles(td).mirror_s && texinfo[id].tile_width == 2 * texinfo[id].width) cache->f_mirror_s = TRUE; else if (texinfo[id].tile_width >= 2 * texinfo[id].width) cache->f_wrap_s = TRUE; - if (rdp.tiles[td].mirror_t && texinfo[id].tile_height == 2 * texinfo[id].height) + if (rdp.tiles(td).mirror_t && texinfo[id].tile_height == 2 * texinfo[id].height) cache->f_mirror_t = TRUE; else if (texinfo[id].tile_height >= 2 * texinfo[id].height) cache->f_wrap_t = TRUE; diff --git a/Source/Project64-video/TexLoad16b.h b/Source/Project64-video/TexLoad16b.h index 3945d41d6..560dbea7b 100644 --- a/Source/Project64-video/TexLoad16b.h +++ b/Source/Project64-video/TexLoad16b.h @@ -206,7 +206,7 @@ uint16_t yuv_to_rgb565(uint8_t y, uint8_t u, uint8_t v) uint32_t Load16bYUV(uintptr_t dst, uintptr_t /*src*/, int /*wid_64*/, int /*height*/, int /*line*/, int /*real_width*/, int tile) { - uint32_t * mb = (uint32_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[tile].t_mem]); //pointer to the macro block + uint32_t * mb = (uint32_t*)(gfx.RDRAM + rdp.addr[rdp.tiles(tile).t_mem]); //pointer to the macro block uint16_t * tex = (uint16_t*)dst; uint16_t i; for (i = 0; i < 128; i++) diff --git a/Source/Project64-video/TexLoad32b.h b/Source/Project64-video/TexLoad32b.h index 78470f753..7fcbdda0d 100644 --- a/Source/Project64-video/TexLoad32b.h +++ b/Source/Project64-video/TexLoad32b.h @@ -71,8 +71,8 @@ uint32_t Load32bRGBA(uintptr_t dst, uintptr_t src, int wid_64, int height, int l // void LoadTile32b(uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t width, uint32_t height) { - const uint32_t line = rdp.tiles[tile].line << 2; - const uint32_t tbase = rdp.tiles[tile].t_mem << 2; + const uint32_t line = rdp.tiles(tile).line << 2; + const uint32_t tbase = rdp.tiles(tile).t_mem << 2; const uint32_t addr = rdp.timg.addr >> 2; const uint32_t* src = (const uint32_t*)gfx.RDRAM; uint16_t *tmem16 = (uint16_t*)rdp.tmem; @@ -100,10 +100,10 @@ void LoadTile32b(uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t width, ui void LoadBlock32b(uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t lr_s, uint32_t dxt) { const uint32_t * src = (const uint32_t*)gfx.RDRAM; - const uint32_t tb = rdp.tiles[tile].t_mem << 2; + const uint32_t tb = rdp.tiles(tile).t_mem << 2; const uint32_t tiwindwords = rdp.timg.width; const uint32_t slindwords = ul_s; - const uint32_t line = rdp.tiles[tile].line << 2; + const uint32_t line = rdp.tiles(tile).line << 2; uint16_t *tmem16 = (uint16_t*)rdp.tmem; uint32_t addr = rdp.timg.addr >> 2; diff --git a/Source/Project64-video/TexLoad4b.h b/Source/Project64-video/TexLoad4b.h index 02d37b0f0..f62b8bcdc 100644 --- a/Source/Project64-video/TexLoad4b.h +++ b/Source/Project64-video/TexLoad4b.h @@ -567,7 +567,7 @@ uint32_t Load4bCI(uintptr_t dst, uintptr_t src, int wid_64, int height, int line return /*(0 << 16) | */GFX_TEXFMT_ALPHA_INTENSITY_44; } - uintptr_t pal = uintptr_t(rdp.pal_8 + (rdp.tiles[tile].palette << 4)); + uintptr_t pal = uintptr_t(rdp.pal_8 + (rdp.tiles(tile).palette << 4)); if (rdp.tlut_mode == 2) { ext <<= 1; diff --git a/Source/Project64-video/Util.cpp b/Source/Project64-video/Util.cpp index 9235397be..fd7c3d04b 100644 --- a/Source/Project64-video/Util.cpp +++ b/Source/Project64-video/Util.cpp @@ -336,8 +336,8 @@ void draw_tri(VERTEX **vtx, uint16_t linew) // Fix texture coordinates if (!v->uv_scaled) { - v->ou *= rdp.tiles[rdp.cur_tile].s_scale; - v->ov *= rdp.tiles[rdp.cur_tile].t_scale; + v->ou *= rdp.tiles(rdp.cur_tile).s_scale; + v->ov *= rdp.tiles(rdp.cur_tile).t_scale; v->uv_scaled = 1; if (!rdp.Persp_en) { @@ -357,35 +357,35 @@ void draw_tri(VERTEX **vtx, uint16_t linew) v->v0 += rdp.aTBuffTex[0]->v_shift + rdp.aTBuffTex[0]->tile_ult; } - if (rdp.tiles[rdp.cur_tile].shift_s) + if (rdp.tiles(rdp.cur_tile).shift_s) { - if (rdp.tiles[rdp.cur_tile].shift_s > 10) - v->u0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_s)); + if (rdp.tiles(rdp.cur_tile).shift_s > 10) + v->u0 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile).shift_s)); else - v->u0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_s); + v->u0 /= (float)(1 << rdp.tiles(rdp.cur_tile).shift_s); } - if (rdp.tiles[rdp.cur_tile].shift_t) + if (rdp.tiles(rdp.cur_tile).shift_t) { - if (rdp.tiles[rdp.cur_tile].shift_t > 10) - v->v0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_t)); + if (rdp.tiles(rdp.cur_tile).shift_t > 10) + v->v0 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile).shift_t)); else - v->v0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_t); + v->v0 /= (float)(1 << rdp.tiles(rdp.cur_tile).shift_t); } if (rdp.aTBuffTex[0]) { - if (rdp.aTBuffTex[0]->tile_uls != (int)rdp.tiles[rdp.cur_tile].f_ul_s) - v->u0 -= rdp.tiles[rdp.cur_tile].f_ul_s; - if (rdp.aTBuffTex[0]->tile_ult != (int)rdp.tiles[rdp.cur_tile].f_ul_t || g_settings->hacks(CSettings::hack_Megaman)) - v->v0 -= rdp.tiles[rdp.cur_tile].f_ul_t; //required for megaman (boss special attack) + if (rdp.aTBuffTex[0]->tile_uls != (int)rdp.tiles(rdp.cur_tile).f_ul_s) + v->u0 -= rdp.tiles(rdp.cur_tile).f_ul_s; + if (rdp.aTBuffTex[0]->tile_ult != (int)rdp.tiles(rdp.cur_tile).f_ul_t || g_settings->hacks(CSettings::hack_Megaman)) + v->v0 -= rdp.tiles(rdp.cur_tile).f_ul_t; //required for megaman (boss special attack) v->u0 *= rdp.aTBuffTex[0]->u_scale; v->v0 *= rdp.aTBuffTex[0]->v_scale; WriteTrace(TraceRDP, TraceVerbose, "tbuff_tex t0: (%f, %f)->(%f, %f)", v->ou, v->ov, v->u0, v->v0); } else { - v->u0 -= rdp.tiles[rdp.cur_tile].f_ul_s; - v->v0 -= rdp.tiles[rdp.cur_tile].f_ul_t; + v->u0 -= rdp.tiles(rdp.cur_tile).f_ul_s; + v->v0 -= rdp.tiles(rdp.cur_tile).f_ul_t; v->u0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_x * v->u0; v->v0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_y * v->v0; } @@ -400,33 +400,33 @@ void draw_tri(VERTEX **vtx, uint16_t linew) v->u1 += rdp.aTBuffTex[1]->u_shift + rdp.aTBuffTex[1]->tile_uls; v->v1 += rdp.aTBuffTex[1]->v_shift + rdp.aTBuffTex[1]->tile_ult; } - if (rdp.tiles[rdp.cur_tile + 1].shift_s) + if (rdp.tiles(rdp.cur_tile + 1).shift_s) { - if (rdp.tiles[rdp.cur_tile + 1].shift_s > 10) - v->u1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_s)); + if (rdp.tiles(rdp.cur_tile + 1).shift_s > 10) + v->u1 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile + 1).shift_s)); else - v->u1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_s); + v->u1 /= (float)(1 << rdp.tiles(rdp.cur_tile + 1).shift_s); } - if (rdp.tiles[rdp.cur_tile + 1].shift_t) + if (rdp.tiles(rdp.cur_tile + 1).shift_t) { - if (rdp.tiles[rdp.cur_tile + 1].shift_t > 10) - v->v1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_t)); + if (rdp.tiles(rdp.cur_tile + 1).shift_t > 10) + v->v1 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile + 1).shift_t)); else - v->v1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_t); + v->v1 /= (float)(1 << rdp.tiles(rdp.cur_tile + 1).shift_t); } if (rdp.aTBuffTex[1]) { - if (rdp.aTBuffTex[1]->tile_uls != (int)rdp.tiles[rdp.cur_tile].f_ul_s) - v->u1 -= rdp.tiles[rdp.cur_tile].f_ul_s; + if (rdp.aTBuffTex[1]->tile_uls != (int)rdp.tiles(rdp.cur_tile).f_ul_s) + v->u1 -= rdp.tiles(rdp.cur_tile).f_ul_s; v->u1 *= rdp.aTBuffTex[1]->u_scale; v->v1 *= rdp.aTBuffTex[1]->v_scale; WriteTrace(TraceRDP, TraceVerbose, "tbuff_tex t1: (%f, %f)->(%f, %f)", v->ou, v->ov, v->u1, v->v1); } else { - v->u1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_s; - v->v1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_t; + v->u1 -= rdp.tiles(rdp.cur_tile + 1).f_ul_s; + v->v1 -= rdp.tiles(rdp.cur_tile + 1).f_ul_t; v->u1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_x * v->u1; v->v1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_y * v->v1; } @@ -929,8 +929,8 @@ static void CalculateLOD(VERTEX *v, int n) float deltaX, deltaY; double deltaTexels, deltaPixels, lodFactor = 0; double intptr; - float s_scale = rdp.tiles[rdp.cur_tile].width / 255.0f; - float t_scale = rdp.tiles[rdp.cur_tile].height / 255.0f; + float s_scale = rdp.tiles(rdp.cur_tile).width / 255.0f; + float t_scale = rdp.tiles(rdp.cur_tile).height / 255.0f; if (g_settings->lodmode() == CSettings::LOD_Fast) { deltaS = (v[1].u0 / v[1].q - v[0].u0 / v[0].q) * s_scale; diff --git a/Source/Project64-video/rdp.cpp b/Source/Project64-video/rdp.cpp index 17e2f528c..38d2485b2 100644 --- a/Source/Project64-video/rdp.cpp +++ b/Source/Project64-video/rdp.cpp @@ -468,7 +468,7 @@ void CRDP::free() maincimg[0].addr = maincimg[1].addr = last_drawn_ci_addr = 0x7FFFFFFF; memset(&timg, 0, sizeof(timg)); - memset(tiles, 0, sizeof(tiles)); + memset(m_tiles, 0, sizeof(m_tiles)); memset(tmem, 0, sizeof(tmem)); memset(addr, 0, sizeof(addr)); memset(load_info, 0, sizeof(load_info)); @@ -864,7 +864,7 @@ EXPORT void CALL ProcessDList(void) if (g_settings->ucode() == CSettings::ucode_Turbo3d) { Turbo3D(); - } + } else { // MAIN PROCESSING LOOP @@ -946,7 +946,7 @@ EXPORT void CALL ProcessDList(void) CI_SET = FALSE; } WriteTrace(TraceRDP, TraceDebug, "ProcessDList end"); - } +} // undef - undefined instruction, always ignore void undef() @@ -992,8 +992,8 @@ void ys_memrect() WriteTrace(TraceRDP, TraceDebug, " off_y: %d", off_y); uint32_t y, width = lr_x - ul_x; - uint32_t tex_width = rdp.tiles[tile].line << 3; - uint8_t * texaddr = gfx.RDRAM + rdp.addr[rdp.tiles[tile].t_mem] + tex_width*off_y + off_x; + uint32_t tex_width = rdp.tiles(tile).line << 3; + uint8_t * texaddr = gfx.RDRAM + rdp.addr[rdp.tiles(tile).t_mem] + tex_width*off_y + off_x; uint8_t * fbaddr = gfx.RDRAM + rdp.cimg + ul_x; for (y = ul_y; y < lr_y; y++) { @@ -1326,7 +1326,7 @@ void rdp_texrect() { float sx = 1, sy = 1; int x_i = off_x_i, y_i = off_y_i; - TILE & tile = rdp.tiles[rdp.cur_tile + i]; + TILE & tile = rdp.tiles(rdp.cur_tile + i); //shifting if (tile.shift_s) { @@ -1752,7 +1752,7 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count) void rdp_loadtlut() { uint32_t tile = (rdp.cmd1 >> 24) & 0x07; - uint16_t start = rdp.tiles[tile].t_mem - 256; // starting location in the palettes + uint16_t start = rdp.tiles(tile).t_mem - 256; // starting location in the palettes // uint16_t start = ((uint16_t)(rdp.cmd1 >> 2) & 0x3FF) + 1; uint16_t count = ((uint16_t)(rdp.cmd1 >> 14) & 0x3FF) + 1; // number to copy @@ -1794,8 +1794,8 @@ void rdp_settilesize() uint32_t tile = (rdp.cmd1 >> 24) & 0x07; rdp.last_tile_size = tile; - rdp.tiles[tile].f_ul_s = (float)((rdp.cmd0 >> 12) & 0xFFF) / 4.0f; - rdp.tiles[tile].f_ul_t = (float)(rdp.cmd0 & 0xFFF) / 4.0f; + rdp.tiles(tile).f_ul_s = (float)((rdp.cmd0 >> 12) & 0xFFF) / 4.0f; + rdp.tiles(tile).f_ul_t = (float)(rdp.cmd0 & 0xFFF) / 4.0f; int ul_s = (rdp.cmd0 >> 14) & 0x03ff; int ul_t = (rdp.cmd0 >> 2) & 0x03ff; @@ -1816,32 +1816,32 @@ void rdp_settilesize() if (tile_set) { // coords in 10.2 format - rdp.tiles[tile].ul_s = ul_s; - rdp.tiles[tile].ul_t = ul_t; - rdp.tiles[tile].lr_s = lr_s; - rdp.tiles[tile].lr_t = lr_t; + rdp.tiles(tile).ul_s = ul_s; + rdp.tiles(tile).ul_t = ul_t; + rdp.tiles(tile).lr_s = lr_s; + rdp.tiles(tile).lr_t = lr_t; tile_set = 0; } } else { // coords in 10.2 format - rdp.tiles[tile].ul_s = ul_s; - rdp.tiles[tile].ul_t = ul_t; - rdp.tiles[tile].lr_s = lr_s; - rdp.tiles[tile].lr_t = lr_t; + rdp.tiles(tile).ul_s = ul_s; + rdp.tiles(tile).ul_t = ul_t; + rdp.tiles(tile).lr_s = lr_s; + rdp.tiles(tile).lr_t = lr_t; } // handle wrapping - if (rdp.tiles[tile].lr_s < rdp.tiles[tile].ul_s) rdp.tiles[tile].lr_s += 0x400; - if (rdp.tiles[tile].lr_t < rdp.tiles[tile].ul_t) rdp.tiles[tile].lr_t += 0x400; + if (rdp.tiles(tile).lr_s < rdp.tiles(tile).ul_s) rdp.tiles(tile).lr_s += 0x400; + if (rdp.tiles(tile).lr_t < rdp.tiles(tile).ul_t) rdp.tiles(tile).lr_t += 0x400; rdp.update |= UPDATE_TEXTURE; rdp.first = 1; WriteTrace(TraceRDP, TraceDebug, "settilesize: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, lr_t: %d, f_ul_s: %f, f_ul_t: %f", - tile, ul_s, ul_t, lr_s, lr_t, rdp.tiles[tile].f_ul_s, rdp.tiles[tile].f_ul_t); + tile, ul_s, ul_t, lr_s, lr_t, rdp.tiles(tile).f_ul_s, rdp.tiles(tile).f_ul_t); } void setTBufTex(uint16_t t_mem, uint32_t cnt) @@ -2019,7 +2019,7 @@ void rdp_loadblock() ucode5_texshiftcount++; } - rdp.addr[rdp.tiles[tile].t_mem] = rdp.timg.addr; + rdp.addr[rdp.tiles(tile).t_mem] = rdp.timg.addr; // ** DXT is used for swapping every other line /* double fdxt = (double)0x8000000F/(double)((uint32_t)(2047/(dxt-1))); // F for error @@ -2035,13 +2035,13 @@ void rdp_loadblock() uint16_t ul_s = (uint16_t)((rdp.cmd0 >> 14) & 0x3FF); uint16_t ul_t = (uint16_t)((rdp.cmd0 >> 2) & 0x3FF); - rdp.tiles[tile].ul_s = ul_s; - rdp.tiles[tile].ul_t = ul_t; - rdp.tiles[tile].lr_s = lr_s; + rdp.tiles(tile).ul_s = ul_s; + rdp.tiles(tile).ul_t = ul_t; + rdp.tiles(tile).lr_s = lr_s; rdp.timg.set_by = 0; // load block - LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles[tile].t_mem]; + LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles(tile).t_mem]; info.tile_width = lr_s; info.dxt = dxt; @@ -2058,14 +2058,14 @@ void rdp_loadblock() //angrylion's advice to use ul_s in texture image offset and cnt calculations. //Helps to fix Vigilante 8 jpeg backgrounds and logos - uint32_t off = rdp.timg.addr + (ul_s << rdp.tiles[tile].size >> 1); - unsigned char *dst = ((unsigned char *)rdp.tmem) + (rdp.tiles[tile].t_mem << 3); + uint32_t off = rdp.timg.addr + (ul_s << rdp.tiles(tile).size >> 1); + unsigned char *dst = ((unsigned char *)rdp.tmem) + (rdp.tiles(tile).t_mem << 3); uint32_t cnt = lr_s - ul_s + 1; - if (rdp.tiles[tile].size == 3) + if (rdp.tiles(tile).size == 3) cnt <<= 1; - if (((rdp.tiles[tile].t_mem + cnt) << 3) > sizeof(rdp.tmem)) { - cnt = (sizeof(rdp.tmem) >> 3) - (rdp.tiles[tile].t_mem); + if (((rdp.tiles(tile).t_mem + cnt) << 3) > sizeof(rdp.tmem)) { + cnt = (sizeof(rdp.tmem) >> 3) - (rdp.tiles(tile).t_mem); } if (rdp.timg.size == 3) @@ -2074,7 +2074,7 @@ void rdp_loadblock() loadBlock((uint32_t *)gfx.RDRAM, (uint32_t *)dst, off, _dxt, cnt); rdp.timg.addr += cnt << 3; - rdp.tiles[tile].lr_t = ul_t + ((dxt*cnt) >> 11); + rdp.tiles(tile).lr_t = ul_t + ((dxt*cnt) >> 11); rdp.update |= UPDATE_TEXTURE; @@ -2084,7 +2084,7 @@ void rdp_loadblock() if (g_settings->fb_hwfbe_enabled()) { - setTBufTex(rdp.tiles[tile].t_mem, cnt); + setTBufTex(rdp.tiles(tile).t_mem, cnt); } } @@ -2224,7 +2224,7 @@ void rdp_loadtile() uint32_t tile = (uint32_t)((rdp.cmd1 >> 24) & 0x07); - rdp.addr[rdp.tiles[tile].t_mem] = rdp.timg.addr; + rdp.addr[rdp.tiles(tile).t_mem] = rdp.timg.addr; uint16_t ul_s = (uint16_t)((rdp.cmd0 >> 14) & 0x03FF); uint16_t ul_t = (uint16_t)((rdp.cmd0 >> 2) & 0x03FF); @@ -2235,18 +2235,18 @@ void rdp_loadtile() if (wrong_tile >= 0) //there was a tile with zero length { - rdp.tiles[wrong_tile].lr_s = lr_s; + rdp.tiles(wrong_tile).lr_s = lr_s; - if (rdp.tiles[tile].size > rdp.tiles[wrong_tile].size) - rdp.tiles[wrong_tile].lr_s <<= (rdp.tiles[tile].size - rdp.tiles[wrong_tile].size); - else if (rdp.tiles[tile].size < rdp.tiles[wrong_tile].size) - rdp.tiles[wrong_tile].lr_s >>= (rdp.tiles[wrong_tile].size - rdp.tiles[tile].size); - rdp.tiles[wrong_tile].lr_t = lr_t; - rdp.tiles[wrong_tile].mask_s = rdp.tiles[wrong_tile].mask_t = 0; + if (rdp.tiles(tile).size > rdp.tiles(wrong_tile).size) + rdp.tiles(wrong_tile).lr_s <<= (rdp.tiles(tile).size - rdp.tiles(wrong_tile).size); + else if (rdp.tiles(tile).size < rdp.tiles(wrong_tile).size) + rdp.tiles(wrong_tile).lr_s >>= (rdp.tiles(wrong_tile).size - rdp.tiles(tile).size); + rdp.tiles(wrong_tile).lr_t = lr_t; + rdp.tiles(wrong_tile).mask_s = rdp.tiles(wrong_tile).mask_t = 0; // wrong_tile = -1; } - if (rdp.tbuff_tex)// && (rdp.tiles[tile].format == 0)) + if (rdp.tbuff_tex)// && (rdp.tiles(tile).format == 0)) { WriteTrace(TraceRDP, TraceDebug, "loadtile: tbuff_tex ul_s: %d, ul_t:%d", ul_s, ul_t); rdp.tbuff_tex->tile_uls = ul_s; @@ -2255,20 +2255,20 @@ void rdp_loadtile() if (g_settings->hacks(CSettings::hack_Tonic) && tile == 7) { - rdp.tiles[0].ul_s = ul_s; - rdp.tiles[0].ul_t = ul_t; - rdp.tiles[0].lr_s = lr_s; - rdp.tiles[0].lr_t = lr_t; + rdp.tiles(0).ul_s = ul_s; + rdp.tiles(0).ul_t = ul_t; + rdp.tiles(0).lr_s = lr_s; + rdp.tiles(0).lr_t = lr_t; } uint32_t height = lr_t - ul_t + 1; // get height uint32_t width = lr_s - ul_s + 1; - LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles[tile].t_mem]; + LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles(tile).t_mem]; info.tile_ul_s = ul_s; info.tile_ul_t = ul_t; - info.tile_width = (rdp.tiles[tile].mask_s ? minval((uint16_t)width, 1 << rdp.tiles[tile].mask_s) : (uint16_t)width); - info.tile_height = (rdp.tiles[tile].mask_t ? minval((uint16_t)height, 1 << rdp.tiles[tile].mask_t) : (uint16_t)height); + info.tile_width = (rdp.tiles(tile).mask_s ? minval((uint16_t)width, 1 << rdp.tiles(tile).mask_s) : (uint16_t)width); + info.tile_height = (rdp.tiles(tile).mask_t ? minval((uint16_t)height, 1 << rdp.tiles(tile).mask_t) : (uint16_t)height); if (g_settings->hacks(CSettings::hack_MK64)) { if (info.tile_width % 2) @@ -2283,9 +2283,9 @@ void rdp_loadtile() info.tex_width = rdp.timg.width; info.tex_size = rdp.timg.size; - int line_n = rdp.timg.width << rdp.tiles[tile].size >> 1; + int line_n = rdp.timg.width << rdp.tiles(tile).size >> 1; uint32_t offs = ul_t * line_n; - offs += ul_s << rdp.tiles[tile].size >> 1; + offs += ul_s << rdp.tiles(tile).size >> 1; offs += rdp.timg.addr; if (offs >= BMASK) return; @@ -2302,8 +2302,8 @@ void rdp_loadtile() if (height == 0) return; - uint32_t wid_64 = rdp.tiles[tile].line; - unsigned char *dst = ((unsigned char *)rdp.tmem) + (rdp.tiles[tile].t_mem << 3); + uint32_t wid_64 = rdp.tiles(tile).line; + unsigned char *dst = ((unsigned char *)rdp.tmem) + (rdp.tiles(tile).t_mem << 3); unsigned char *end = ((unsigned char *)rdp.tmem) + 4096 - (wid_64 << 3); loadTile((uint32_t *)gfx.RDRAM, (uint32_t *)dst, wid_64, height, line_n, offs, (uint32_t *)end); } @@ -2312,7 +2312,7 @@ void rdp_loadtile() if (g_settings->fb_hwfbe_enabled()) { - setTBufTex(rdp.tiles[tile].t_mem, rdp.tiles[tile].line*height); + setTBufTex(rdp.tiles(tile).t_mem, rdp.tiles(tile).line*height); } } @@ -2323,7 +2323,7 @@ void rdp_settile() rdp.first = 0; rdp.last_tile = (uint32_t)((rdp.cmd1 >> 24) & 0x07); - TILE *tile = &rdp.tiles[rdp.last_tile]; + TILE *tile = &rdp.tiles(rdp.last_tile); tile->format = (uint8_t)((rdp.cmd0 >> 21) & 0x07); tile->size = (uint8_t)((rdp.cmd0 >> 19) & 0x03); @@ -3915,23 +3915,23 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, v->v1 = v->v0 = v->ov; if (rdp.tex >= 1 && rdp.cur_cache[0]) { - if (rdp.tiles[rdp.cur_tile].shift_s) + if (rdp.tiles(rdp.cur_tile).shift_s) { - if (rdp.tiles[rdp.cur_tile].shift_s > 10) - v->u0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_s)); + if (rdp.tiles(rdp.cur_tile).shift_s > 10) + v->u0 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile).shift_s)); else - v->u0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_s); + v->u0 /= (float)(1 << rdp.tiles(rdp.cur_tile).shift_s); } - if (rdp.tiles[rdp.cur_tile].shift_t) + if (rdp.tiles(rdp.cur_tile).shift_t) { - if (rdp.tiles[rdp.cur_tile].shift_t > 10) - v->v0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_t)); + if (rdp.tiles(rdp.cur_tile).shift_t > 10) + v->v0 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile).shift_t)); else - v->v0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_t); + v->v0 /= (float)(1 << rdp.tiles(rdp.cur_tile).shift_t); } - v->u0 -= rdp.tiles[rdp.cur_tile].f_ul_s; - v->v0 -= rdp.tiles[rdp.cur_tile].f_ul_t; + v->u0 -= rdp.tiles(rdp.cur_tile).f_ul_s; + v->v0 -= rdp.tiles(rdp.cur_tile).f_ul_t; v->u0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_x * v->u0; v->v0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_y * v->v0; v->u0 /= v->w; @@ -3940,23 +3940,23 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, if (rdp.tex >= 2 && rdp.cur_cache[1]) { - if (rdp.tiles[rdp.cur_tile + 1].shift_s) + if (rdp.tiles(rdp.cur_tile + 1).shift_s) { - if (rdp.tiles[rdp.cur_tile + 1].shift_s > 10) - v->u1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_s)); + if (rdp.tiles(rdp.cur_tile + 1).shift_s > 10) + v->u1 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile + 1).shift_s)); else - v->u1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_s); + v->u1 /= (float)(1 << rdp.tiles(rdp.cur_tile + 1).shift_s); } - if (rdp.tiles[rdp.cur_tile + 1].shift_t) + if (rdp.tiles(rdp.cur_tile + 1).shift_t) { - if (rdp.tiles[rdp.cur_tile + 1].shift_t > 10) - v->v1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_t)); + if (rdp.tiles(rdp.cur_tile + 1).shift_t > 10) + v->v1 *= (float)(1 << (16 - rdp.tiles(rdp.cur_tile + 1).shift_t)); else - v->v1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_t); + v->v1 /= (float)(1 << rdp.tiles(rdp.cur_tile + 1).shift_t); } - v->u1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_s; - v->v1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_t; + v->u1 -= rdp.tiles(rdp.cur_tile + 1).f_ul_s; + v->v1 -= rdp.tiles(rdp.cur_tile + 1).f_ul_t; v->u1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_x * v->u1; v->v1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_y * v->v1; v->u1 /= v->w; diff --git a/Source/Project64-video/rdp.h b/Source/Project64-video/rdp.h index cc3487e43..61d53b9e7 100644 --- a/Source/Project64-video/rdp.h +++ b/Source/Project64-video/rdp.h @@ -359,6 +359,7 @@ public: bool init(); void free(); + inline TILE & tiles(int index) { return m_tiles[index]; } // Clipping int clip; // clipping flags VERTEX *vtx1; //[256] copy vertex buffer #1 (used for clipping) @@ -470,7 +471,9 @@ public: // Textures TEXTURE_IMAGE timg; // 1 for each tmem address - TILE tiles[8]; // 8 tile descriptors +private: + TILE m_tiles[8]; // 8 tile descriptors +public: uint8_t tmem[4096]; // 4k tmem uint32_t addr[512]; // 512 addresses (used to determine address loaded from) LOAD_TILE_INFO load_info[512]; // 512 addresses. inforamation about tile loading. diff --git a/Source/Project64-video/turbo3D.cpp b/Source/Project64-video/turbo3D.cpp index 07a1017d4..6bc141220 100644 --- a/Source/Project64-video/turbo3D.cpp +++ b/Source/Project64-video/turbo3D.cpp @@ -155,7 +155,7 @@ static void t3d_vertex(uint32_t addr, uint32_t v0, uint32_t n) if (v->y < -v->w) v->scr_off |= 4; if (v->y > v->w) v->scr_off |= 8; if (v->w < 0.1f) v->scr_off |= 16; - WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d", i >> 4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a); + WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d", i >> 4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles(rdp.cur_tile).s_scale, v->ov*rdp.tiles(rdp.cur_tile).t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a); } } @@ -165,10 +165,10 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri) t3dState *ostate = (t3dState*)&gfx.RDRAM[segoffset(pstate)]; rdp.cur_tile = (ostate->textureState) & 7; WriteTrace(TraceRDP, TraceDebug, "tile: %d", rdp.cur_tile); - if (rdp.tiles[rdp.cur_tile].s_scale < 0.001f) - rdp.tiles[rdp.cur_tile].s_scale = 0.015625; - if (rdp.tiles[rdp.cur_tile].t_scale < 0.001f) - rdp.tiles[rdp.cur_tile].t_scale = 0.015625; + if (rdp.tiles(rdp.cur_tile).s_scale < 0.001f) + rdp.tiles(rdp.cur_tile).s_scale = 0.015625; + if (rdp.tiles(rdp.cur_tile).t_scale < 0.001f) + rdp.tiles(rdp.cur_tile).t_scale = 0.015625; WriteTrace(TraceRDP, TraceVerbose, "renderState: %08lx, textureState: %08lx, othermode0: %08lx, othermode1: %08lx, rdpCmds: %08lx, triCount : %d, v0: %d, vn: %d", ostate->renderState, ostate->textureState, ostate->othermode0, ostate->othermode1, ostate->rdpCmds, ostate->triCount, ostate->vtxV0, ostate->vtxCount); diff --git a/Source/Project64-video/ucode00.cpp b/Source/Project64-video/ucode00.cpp index c0ccc9493..02af678a2 100644 --- a/Source/Project64-video/ucode00.cpp +++ b/Source/Project64-video/ucode00.cpp @@ -110,7 +110,7 @@ void rsp_vertex(int v0, int n) v->g = ((uint8_t*)gfx.RDRAM)[(addr + i + 13) ^ 3]; v->b = ((uint8_t*)gfx.RDRAM)[(addr + i + 14) ^ 3]; } - WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d", i >> 4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a); + WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d", i >> 4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles(rdp.cur_tile).s_scale, v->ov*rdp.tiles(rdp.cur_tile).t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a); } } @@ -758,7 +758,7 @@ void uc0_texture() uint16_t s = (uint16_t)((rdp.cmd1 >> 16) & 0xFFFF); uint16_t t = (uint16_t)(rdp.cmd1 & 0xFFFF); - TILE *tmp_tile = &rdp.tiles[tile]; + TILE *tmp_tile = &rdp.tiles(tile); tmp_tile->on = 1; tmp_tile->org_s_scale = s; tmp_tile->org_t_scale = t; @@ -775,7 +775,7 @@ void uc0_texture() else { WriteTrace(TraceRDP, TraceDebug, "uc0:texture skipped b/c of off"); - rdp.tiles[tile].on = 0; + rdp.tiles(tile).on = 0; } } diff --git a/Source/Project64-video/ucode02.cpp b/Source/Project64-video/ucode02.cpp index d1577d984..8c58efabf 100644 --- a/Source/Project64-video/ucode02.cpp +++ b/Source/Project64-video/ucode02.cpp @@ -185,7 +185,7 @@ void uc2_vertex() v->g = ((uint8_t*)gfx.RDRAM)[(addr + i + 13) ^ 3]; v->b = ((uint8_t*)gfx.RDRAM)[(addr + i + 14) ^ 3]; } - WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d", i >> 4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a); + WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d", i >> 4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles(rdp.cur_tile).s_scale, v->ov*rdp.tiles(rdp.cur_tile).t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a); } rdp.geom_mode = geom_mode; } diff --git a/Source/Project64-video/ucode06.cpp b/Source/Project64-video/ucode06.cpp index d3f5dbfcb..8eca0e07b 100644 --- a/Source/Project64-video/ucode06.cpp +++ b/Source/Project64-video/ucode06.cpp @@ -387,7 +387,7 @@ void DrawImage(DRAWIMAGE & d) rdp.timg.set_by = 0; // SetTile () - TILE *tile = &rdp.tiles[0]; + TILE *tile = &rdp.tiles(0); tile->format = d.imageFmt; // RGBA tile->size = d.imageSiz; // 16-bit tile->line = line; @@ -402,10 +402,10 @@ void DrawImage(DRAWIMAGE & d) tile->mask_s = 0; tile->shift_s = 0; - rdp.tiles[0].ul_s = 0; - rdp.tiles[0].ul_t = 0; - rdp.tiles[0].lr_s = x_size - 1; - rdp.tiles[0].lr_t = y_size - 1; + rdp.tiles(0).ul_s = 0; + rdp.tiles(0).ul_t = 0; + rdp.tiles(0).lr_s = x_size - 1; + rdp.tiles(0).lr_t = y_size - 1; const float Z = set_sprite_combine_mode(); if (rdp.cycle_mode == 2) @@ -472,14 +472,14 @@ void DrawImage(DRAWIMAGE & d) // ** Load the texture, constant portions have been set above // SetTileSize () - rdp.tiles[0].ul_s = tb_u; - rdp.tiles[0].ul_t = tb_v; - rdp.tiles[0].lr_s = tb_u + x_size - 1; - rdp.tiles[0].lr_t = tb_v + y_size - 1; + rdp.tiles(0).ul_s = tb_u; + rdp.tiles(0).ul_t = tb_v; + rdp.tiles(0).lr_s = tb_u + x_size - 1; + rdp.tiles(0).lr_t = tb_v + y_size - 1; // LoadTile () - rdp.cmd0 = ((int)rdp.tiles[0].ul_s << 14) | ((int)rdp.tiles[0].ul_t << 2); - rdp.cmd1 = ((int)rdp.tiles[0].lr_s << 14) | ((int)rdp.tiles[0].lr_t << 2); + rdp.cmd0 = ((int)rdp.tiles(0).ul_s << 14) | ((int)rdp.tiles(0).ul_t << 2); + rdp.cmd1 = ((int)rdp.tiles(0).lr_s << 14) | ((int)rdp.tiles(0).lr_t << 2); rdp_loadtile(); TexCache(); @@ -956,7 +956,7 @@ static void uc6_read_object_data(DRAWOBJECT & d) static void uc6_init_tile(const DRAWOBJECT & d) { // SetTile () - TILE *tile = &rdp.tiles[0]; + TILE *tile = &rdp.tiles(0); tile->format = d.imageFmt; // RGBA tile->size = d.imageSiz; // 16-bit tile->line = d.imageStride; @@ -972,10 +972,10 @@ static void uc6_init_tile(const DRAWOBJECT & d) tile->shift_s = 0; // SetTileSize () - rdp.tiles[0].ul_s = 0; - rdp.tiles[0].ul_t = 0; - rdp.tiles[0].lr_s = (d.imageW > 0) ? d.imageW - 1 : 0; - rdp.tiles[0].lr_t = (d.imageH > 0) ? d.imageH - 1 : 0; + rdp.tiles(0).ul_s = 0; + rdp.tiles(0).ul_t = 0; + rdp.tiles(0).lr_s = (d.imageW > 0) ? d.imageW - 1 : 0; + rdp.tiles(0).lr_t = (d.imageH > 0) ? d.imageH - 1 : 0; } void uc6_obj_rectangle() @@ -1307,8 +1307,8 @@ void uc6_obj_loadtxtr() rdp.timg.width = 1; rdp.timg.size = 1; - rdp.tiles[7].t_mem = tmem; - rdp.tiles[7].size = 1; + rdp.tiles(7).t_mem = tmem; + rdp.tiles(7).size = 1; rdp.cmd0 = 0; rdp.cmd1 = 0x07000000 | (tsize << 14) | tline; rdp_loadblock(); @@ -1328,9 +1328,9 @@ void uc6_obj_loadtxtr() rdp.timg.width = line << 3; rdp.timg.size = 1; - rdp.tiles[7].t_mem = tmem; - rdp.tiles[7].line = line; - rdp.tiles[7].size = 1; + rdp.tiles(7).t_mem = tmem; + rdp.tiles(7).line = line; + rdp.tiles(7).size = 1; rdp.cmd0 = 0; rdp.cmd1 = 0x07000000 | (twidth << 14) | (theight << 2); @@ -1507,15 +1507,15 @@ void uc6_sprite2d() rdp.timg.addr = d.imagePtr; rdp.timg.width = stride; - rdp.tiles[7].t_mem = 0; - rdp.tiles[7].line = line;//(d.imageW>>3); - rdp.tiles[7].size = d.imageSiz; + rdp.tiles(7).t_mem = 0; + rdp.tiles(7).line = line;//(d.imageW>>3); + rdp.tiles(7).size = d.imageSiz; rdp.cmd0 = (d.imageX << 14) | (d.imageY << 2); rdp.cmd1 = 0x07000000 | ((d.imageX + d.imageW - 1) << 14) | ((d.imageY + d.imageH - 1) << 2); rdp_loadtile(); // SetTile () - TILE *tile = &rdp.tiles[0]; + TILE *tile = &rdp.tiles(0); tile->format = d.imageFmt; tile->size = d.imageSiz; tile->line = line;//(d.imageW>>3); @@ -1531,10 +1531,10 @@ void uc6_sprite2d() tile->shift_s = 0; // SetTileSize () - rdp.tiles[0].ul_s = d.imageX; - rdp.tiles[0].ul_t = d.imageY; - rdp.tiles[0].lr_s = d.imageX + d.imageW - 1; - rdp.tiles[0].lr_t = d.imageY + d.imageH - 1; + rdp.tiles(0).ul_s = d.imageX; + rdp.tiles(0).ul_t = d.imageY; + rdp.tiles(0).lr_s = d.imageX + d.imageW - 1; + rdp.tiles(0).lr_t = d.imageY + d.imageH - 1; float Z = set_sprite_combine_mode(); diff --git a/Source/Project64-video/ucode09.cpp b/Source/Project64-video/ucode09.cpp index cbb6a25da..fe7581e14 100644 --- a/Source/Project64-video/ucode09.cpp +++ b/Source/Project64-video/ucode09.cpp @@ -132,7 +132,7 @@ static void uc9_draw_object(uint8_t * addr, uint32_t type) v.ov = ((short*)addr)[5 ^ 1]; v.w = Calc_invw(((int*)addr)[3]) / 31.0f; v.oow = 1.0f / v.w; - WriteTrace(TraceRDP, TraceDebug, "v%d - sx: %f, sy: %f ou: %f, ov: %f, w: %f, r=%d, g=%d, b=%d, a=%d", i, v.sx / rdp.scale_x, v.sy / rdp.scale_y, v.ou*rdp.tiles[rdp.cur_tile].s_scale, v.ov*rdp.tiles[rdp.cur_tile].t_scale, v.w, v.r, v.g, v.b, v.a); + WriteTrace(TraceRDP, TraceDebug, "v%d - sx: %f, sy: %f ou: %f, ov: %f, w: %f, r=%d, g=%d, b=%d, a=%d", i, v.sx / rdp.scale_x, v.sy / rdp.scale_y, v.ou*rdp.tiles(rdp.cur_tile).s_scale, v.ov*rdp.tiles(rdp.cur_tile).t_scale, v.w, v.r, v.g, v.b, v.a); } else { @@ -625,7 +625,7 @@ void uc9_movemem() rdp.mipmap_level = 0; rdp.cur_tile = 0; - TILE *tmp_tile = &rdp.tiles[0]; + TILE *tmp_tile = &rdp.tiles(0); tmp_tile->on = 1; tmp_tile->org_s_scale = 0xFFFF; tmp_tile->org_t_scale = 0xFFFF; @@ -667,7 +667,7 @@ void uc9_setscissor() rdp.mipmap_level = 0; rdp.cur_tile = 0; - TILE *tmp_tile = &rdp.tiles[0]; + TILE *tmp_tile = &rdp.tiles(0); tmp_tile->on = 1; tmp_tile->org_s_scale = 0xFFFF; tmp_tile->org_t_scale = 0xFFFF;