[Glide64] Get Settings to be a class instead of a struct

This commit is contained in:
zilmar 2016-02-01 19:56:25 +11:00
parent 2b6fdc000e
commit dba3b94dfb
27 changed files with 1324 additions and 1108 deletions

View File

@ -47,125 +47,125 @@ extern "C" {
#include <math.h>
#include "3dmath.h"
void calc_light (VERTEX *v)
void calc_light(VERTEX *v)
{
float light_intensity = 0.0f;
register float color[3] = {rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b};
for (uint32_t l=0; l<rdp.num_lights; l++)
{
light_intensity = DotProduct (rdp.light_vector[l], v->vec);
if (light_intensity > 0.0f)
float light_intensity = 0.0f;
register float color[3] = { rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b };
for (uint32_t l = 0; l < rdp.num_lights; l++)
{
color[0] += rdp.light[l].r * light_intensity;
color[1] += rdp.light[l].g * light_intensity;
color[2] += rdp.light[l].b * light_intensity;
light_intensity = DotProduct(rdp.light_vector[l], v->vec);
if (light_intensity > 0.0f)
{
color[0] += rdp.light[l].r * light_intensity;
color[1] += rdp.light[l].g * light_intensity;
color[2] += rdp.light[l].b * light_intensity;
}
}
}
if (color[0] > 1.0f) color[0] = 1.0f;
if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (uint8_t)(color[0]*255.0f);
v->g = (uint8_t)(color[1]*255.0f);
v->b = (uint8_t)(color[2]*255.0f);
if (color[0] > 1.0f) color[0] = 1.0f;
if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (uint8_t)(color[0] * 255.0f);
v->g = (uint8_t)(color[1] * 255.0f);
v->b = (uint8_t)(color[2] * 255.0f);
}
//*
void calc_linear (VERTEX *v)
void calc_linear(VERTEX *v)
{
if (settings.force_calc_sphere)
{
calc_sphere(v);
return;
}
DECLAREALIGN16VAR(vec[3]);
TransformVector (v->vec, vec, rdp.model);
// TransformVector (v->vec, vec, rdp.combined);
NormalizeVector (vec);
float x, y;
if (!rdp.use_lookat)
{
x = vec[0];
y = vec[1];
}
else
{
x = DotProduct (rdp.lookat[0], vec);
y = DotProduct (rdp.lookat[1], vec);
}
if (x > 1.0f)
x = 1.0f;
else if (x < -1.0f)
x = -1.0f;
if (y > 1.0f)
y = 1.0f;
else if (y < -1.0f)
y = -1.0f;
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->uv_scaled = 1;
if (g_settings->force_calc_sphere)
{
calc_sphere(v);
return;
}
DECLAREALIGN16VAR(vec[3]);
TransformVector(v->vec, vec, rdp.model);
// TransformVector (v->vec, vec, rdp.combined);
NormalizeVector(vec);
float x, y;
if (!rdp.use_lookat)
{
x = vec[0];
y = vec[1];
}
else
{
x = DotProduct(rdp.lookat[0], vec);
y = DotProduct(rdp.lookat[1], vec);
}
if (x > 1.0f)
x = 1.0f;
else if (x < -1.0f)
x = -1.0f;
if (y > 1.0f)
y = 1.0f;
else if (y < -1.0f)
y = -1.0f;
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->uv_scaled = 1;
#ifdef EXTREME_LOGGING
FRDP ("calc linear u: %f, v: %f\n", v->ou, v->ov);
FRDP ("calc linear u: %f, v: %f\n", v->ou, v->ov);
#endif
}
void calc_sphere (VERTEX *v)
void calc_sphere(VERTEX *v)
{
// LRDP("calc_sphere\n");
DECLAREALIGN16VAR(vec[3]);
int s_scale, t_scale;
if (settings.hacks&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);
}
else
{
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);
NormalizeVector (vec);
float x, y;
if (!rdp.use_lookat)
{
x = vec[0];
y = vec[1];
}
else
{
x = DotProduct (rdp.lookat[0], vec);
y = DotProduct (rdp.lookat[1], vec);
}
v->ou = (x * 0.5f + 0.5f) * s_scale;
v->ov = (y * 0.5f + 0.5f) * t_scale;
v->uv_scaled = 1;
// LRDP("calc_sphere\n");
DECLAREALIGN16VAR(vec[3]);
int s_scale, t_scale;
if (g_settings->hacks&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);
}
else
{
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);
NormalizeVector(vec);
float x, y;
if (!rdp.use_lookat)
{
x = vec[0];
y = vec[1];
}
else
{
x = DotProduct(rdp.lookat[0], vec);
y = DotProduct(rdp.lookat[1], vec);
}
v->ou = (x * 0.5f + 0.5f) * s_scale;
v->ov = (y * 0.5f + 0.5f) * t_scale;
v->uv_scaled = 1;
#ifdef EXTREME_LOGGING
FRDP ("calc sphere u: %f, v: %f\n", v->ou, v->ov);
FRDP ("calc sphere u: %f, v: %f\n", v->ou, v->ov);
#endif
}
float DotProductC(register float *v1, register float *v2)
{
register float result;
result = v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
result = v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
return(result);
}
void NormalizeVectorC(float *v)
{
register float len;
len = sqrtf(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
len = sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
if (len > 0.0f)
{
v[0] /= len;
@ -176,19 +176,19 @@ void NormalizeVectorC(float *v)
void TransformVectorC(float *src, float *dst, float mat[4][4])
{
dst[0] = mat[0][0]*src[0] + mat[1][0]*src[1] + mat[2][0]*src[2];
dst[1] = mat[0][1]*src[0] + mat[1][1]*src[1] + mat[2][1]*src[2];
dst[2] = mat[0][2]*src[0] + mat[1][2]*src[1] + mat[2][2]*src[2];
dst[0] = mat[0][0] * src[0] + mat[1][0] * src[1] + mat[2][0] * src[2];
dst[1] = mat[0][1] * src[0] + mat[1][1] * src[1] + mat[2][1] * src[2];
dst[2] = mat[0][2] * src[0] + mat[1][2] * src[1] + mat[2][2] * src[2];
}
void InverseTransformVectorC (float *src, float *dst, float mat[4][4])
void InverseTransformVectorC(float *src, float *dst, float mat[4][4])
{
dst[0] = mat[0][0]*src[0] + mat[0][1]*src[1] + mat[0][2]*src[2];
dst[1] = mat[1][0]*src[0] + mat[1][1]*src[1] + mat[1][2]*src[2];
dst[2] = mat[2][0]*src[0] + mat[2][1]*src[1] + mat[2][2]*src[2];
dst[0] = mat[0][0] * src[0] + mat[0][1] * src[1] + mat[0][2] * src[2];
dst[1] = mat[1][0] * src[0] + mat[1][1] * src[1] + mat[1][2] * src[2];
dst[2] = mat[2][0] * src[0] + mat[2][1] * src[1] + mat[2][2] * src[2];
}
void MulMatricesC(float m1[4][4],float m2[4][4],float r[4][4])
void MulMatricesC(float m1[4][4], float m2[4][4], float r[4][4])
{
float row[4][4];
register unsigned int i, j;
@ -218,11 +218,11 @@ void MulMatricesC(float m1[4][4],float m2[4][4],float r[4][4])
for (j = 0; j < 4; j++)
r[i][j] =
summand[0][j]
+ summand[1][j]
+ summand[2][j]
+ summand[3][j]
;
summand[0][j]
+ summand[1][j]
+ summand[2][j]
+ summand[3][j]
;
}
}
@ -236,169 +236,166 @@ TRANSFORMVECTOR InverseTransformVector = InverseTransformVectorC;
DOTPRODUCT DotProduct = DotProductC;
NORMALIZEVECTOR NormalizeVector = NormalizeVectorC;
void MulMatricesSSE(float m1[4][4],float m2[4][4],float r[4][4])
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)));
v4sf row0 = _mm_loadu_ps(m2[0]);
v4sf row1 = _mm_loadu_ps(m2[1]);
v4sf row2 = _mm_loadu_ps(m2[2]);
v4sf row3 = _mm_loadu_ps(m2[3]);
/* [row][col]*/
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]);
v4sf row3 = _mm_loadu_ps(m2[3]);
for (int i = 0; i < 4; ++i)
{
v4sf leftrow = _mm_loadu_ps(m1[i]);
for (int i = 0; i < 4; ++i)
{
v4sf leftrow = _mm_loadu_ps(m1[i]);
// Fill tmp with four copies of leftrow[0]
v4sf tmp = leftrow;
tmp = _mm_shuffle_ps (tmp, tmp, 0);
// Calculate the four first summands
v4sf destrow = tmp * row0;
// Fill tmp with four copies of leftrow[0]
v4sf tmp = leftrow;
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));
destrow += tmp * row1;
// Fill tmp with four copies of leftrow[1]
tmp = leftrow;
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));
destrow += tmp * row2;
// Fill tmp with four copies of leftrow[2]
tmp = leftrow;
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));
destrow += tmp * row3;
// Fill tmp with four copies of leftrow[3]
tmp = leftrow;
tmp = _mm_shuffle_ps (tmp, tmp, 3 + (3 << 2) + (3 << 4) + (3 << 6));
destrow += tmp * row3;
__builtin_ia32_storeups(r[i], destrow);
}
#elif !defined(NO_ASM) && !defined(NOSSE)
__asm
{
mov eax, dword ptr [r]
mov ecx, dword ptr [m1]
mov edx, dword ptr [m2]
__builtin_ia32_storeups(r[i], destrow);
}
#elif !defined(NO_ASM) && !defined(NOSSE)
__asm
{
mov eax, dword ptr[r]
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
}
}
void math_init()
{
void math_init()
{
#ifndef _DEBUG
int IsSSE = FALSE;
#if defined(__GNUC__) && !defined(NO_ASM) && !defined(NOSSE)
int edx, eax;
GLIDE64_TRY
{
#if defined(__x86_64__)
asm volatile(" cpuid; "
#if defined(__x86_64__)
asm volatile(" cpuid; "
: "=a"(eax), "=d"(edx)
: "0"(1)
: "rbx", "rcx"
);
#else
asm volatile(" push %%ebx; "
#else
asm volatile(" push %%ebx; "
" push %%ecx; "
" cpuid; "
" pop %%ecx; "
@ -406,51 +403,51 @@ void MulMatricesSSE(float m1[4][4],float m2[4][4],float r[4][4])
: "=a"(eax), "=d"(edx)
: "0"(1)
:
);
#endif
);
#endif
}
GLIDE64_CATCH
{ return; }
GLIDE64_CATCH
{ return; }
// Check for SSE
if (edx & (1 << 25))
IsSSE = TRUE;
IsSSE = TRUE;
#elif !defined(NO_ASM) && !defined(NOSSE)
DWORD dwEdx;
__try
{
__asm
{
mov eax,1
cpuid
mov dwEdx,edx
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
return;
}
if (dwEdx & (1<<25))
{
if (dwEdx & (1<<24))
{
__try
{
__asm xorps xmm0, xmm0
IsSSE = TRUE;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
return;
}
__asm
{
mov eax,1
cpuid
mov dwEdx,edx
}
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
return;
}
if (dwEdx & (1<<25))
{
if (dwEdx & (1<<24))
{
__try
{
__asm xorps xmm0, xmm0
IsSSE = TRUE;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
return;
}
}
}
#endif // _WIN32
if (IsSSE)
{
if (IsSSE)
{
MulMatrices = MulMatricesSSE;
LOG("3DNOW! detected.\n");
}
}
#endif //_DEBUG
}
}

View File

@ -1021,7 +1021,7 @@ static void cc_shade()
static void cc_one_mul_shade()
{
if ((settings.hacks&hack_Knockout) && (rdp.aTBuffTex[0] || rdp.aTBuffTex[1] || rdp.cur_image)) //hack for boxer shadow
if ((g_settings->hacks&hack_Knockout) && (rdp.aTBuffTex[0] || rdp.aTBuffTex[1] || rdp.cur_image)) //hack for boxer shadow
{
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
@ -6000,7 +6000,7 @@ static void cc_prim_sub_env_mul_t1_add_env()
GR_COMBINE_OTHER_CONSTANT);
CC_PRIM();
SETSHADE_ENV();
if (rdp.cycle_mode == 0 || ((settings.hacks&hack_KI) && (rdp.cycle2 & 0x0FFFFFFF) == 0x01FF1FFF))
if (rdp.cycle_mode == 0 || ((g_settings->hacks&hack_KI) && (rdp.cycle2 & 0x0FFFFFFF) == 0x01FF1FFF))
{
USE_T0();
}
@ -8154,13 +8154,13 @@ static void cc__t1_inter_t0_using_prim__mul_shade()
static void cc__t0_inter_t1_using_primlod__mul_shade()
{
//*
if (rdp.LOD_en && (rdp.mipmap_level == 0) && !(settings.hacks&hack_Fifa98))
if (rdp.LOD_en && (rdp.mipmap_level == 0) && !(g_settings->hacks&hack_Fifa98))
{
cc_t0_mul_shade();
return;
}
//*/
if (settings.ucode == 7)
if (g_settings->ucode == 7)
lod_frac = rdp.prim_lodfrac;
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
@ -8436,7 +8436,7 @@ static void cc__one_inter_prim_using_t1__mul_shade()
{
if (cmb.combine_ext)
{
if ((settings.hacks&hack_BAR) && rdp.cur_tile == 1)
if ((g_settings->hacks&hack_BAR) && rdp.cur_tile == 1)
{
T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
@ -8468,7 +8468,7 @@ static void cc__one_inter_prim_using_t1__mul_shade()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
if ((settings.hacks&hack_BAR) && rdp.cur_tile == 1)
if ((g_settings->hacks&hack_BAR) && rdp.cur_tile == 1)
{
MOD_0(TMOD_COL_INTER_COL1_USING_TEX);
MOD_0_COL(0xFFFFFF00);
@ -8837,7 +8837,7 @@ static void ac_t1()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
if ((settings.hacks&hack_BAR) && rdp.tiles[rdp.cur_tile].format == 3)
if ((g_settings->hacks&hack_BAR) && rdp.tiles[rdp.cur_tile].format == 3)
A_USE_T0();
else
A_USE_T1();
@ -9417,7 +9417,7 @@ static void ac_t1_mul_env() //Added by Gonetz
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CA_ENV();
// if ((settings.hacks&hack_Powerpuff) && (rdp.last_tile == 0))
// if ((g_settings->hacks&hack_Powerpuff) && (rdp.last_tile == 0))
if (rdp.cycle_mode == 0)
A_USE_T0();
else
@ -11226,7 +11226,7 @@ static void ac__t1_mul_primlod_add_t0__mul_env()
static void ac__t0_inter_t1_using_primlod__mul_shade()
{
if (settings.hacks & hack_Makers)
if (g_settings->hacks & hack_Makers)
{
//rolling rock issue - it has zero shade alpha and thus rejected by alpha compare
ac_t0_inter_t1_using_primlod();
@ -15546,7 +15546,7 @@ void Combine()
Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]);
if (!rdp.LOD_en || rdp.cur_tile == rdp.mipmap_level)
lod_frac = rdp.prim_lodfrac;
else if (settings.lodmode == 0)
else if (g_settings->lodmode == 0)
lod_frac = 0;
else
lod_frac = 10;
@ -15627,7 +15627,7 @@ void Combine()
{
rdp.uncombined |= 1;
#ifdef UNIMP_LOG
if (settings.log_unk)
if (g_settings->log_unk)
{
sprintf (out_buf, "COLOR combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
actual_combine,
@ -15682,7 +15682,7 @@ void Combine()
{
rdp.uncombined |= 2;
#ifdef UNIMP_LOG
if (settings.log_unk)
if (g_settings->log_unk)
{
sprintf (out_buf, "ALPHA combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
actual_combine,
@ -15692,7 +15692,7 @@ void Combine()
}
#endif
}
if (settings.unk_as_red)
if (g_settings->unk_as_red)
{
BrightRed();
}
@ -15715,7 +15715,7 @@ void Combine()
cc_t0();
ac_t1();
}
else if (color_combine == 0x613522f0 && (settings.hacks&hack_PMario)) //Paper Mario fortune teller spheres
else if (color_combine == 0x613522f0 && (g_settings->hacks&hack_PMario)) //Paper Mario fortune teller spheres
{
ac_t0();
}
@ -15743,9 +15743,9 @@ void Combine()
aTBuff[rdp.aTBuffTex[1]->tile] = rdp.aTBuffTex[1];
if (cmb.tex && (aTBuff[0] || aTBuff[1]))
{
if (aTBuff[0] && (settings.frame_buffer&fb_read_alpha))
if (aTBuff[0] && (g_settings->frame_buffer&fb_read_alpha))
{
if ((settings.hacks&hack_PMario) && aTBuff[0]->width == rdp.ci_width)
if ((g_settings->hacks&hack_PMario) && aTBuff[0]->width == rdp.ci_width)
;
else
{
@ -15925,7 +15925,7 @@ void CombineBlender()
*/
else if (blendmode == 0x0040) // Mia Soccer Lights
A_BLEND(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
else if ((settings.hacks&hack_Pilotwings) && (rdp.othermode_l & 0x80)) //CLR_ON_CVG without FORCE_BL
else if ((g_settings->hacks&hack_Pilotwings) && (rdp.othermode_l & 0x80)) //CLR_ON_CVG without FORCE_BL
A_BLEND(GR_BLEND_ZERO, GR_BLEND_ONE);
else
A_BLEND(GR_BLEND_ONE, GR_BLEND_ZERO);
@ -15935,7 +15935,7 @@ void CombineBlender()
// if (rdp.othermode_l & 0x2000)
if ((rdp.othermode_l & 0x2000) && ((rdp.othermode_l & 0x7000) != 0x7000))
{
if ((settings.hacks&hack_PMario) && (blendmode == 0x5055))
if ((g_settings->hacks&hack_PMario) && (blendmode == 0x5055))
{
A_BLEND(GR_BLEND_ZERO, GR_BLEND_ONE);
}
@ -15951,7 +15951,7 @@ void CombineBlender()
//hack
//*
if (settings.hacks&hack_ISS64)
if (g_settings->hacks&hack_ISS64)
{
if (rdp.othermode_l == 0xff5a6379)
{
@ -15962,7 +15962,7 @@ void CombineBlender()
A_BLEND(GR_BLEND_ZERO, GR_BLEND_ONE);
}
}
else if (settings.hacks&hack_TGR)
else if (g_settings->hacks&hack_TGR)
{
if (rdp.othermode_l == 0x0f0a0235)
{

View File

@ -55,7 +55,7 @@
// begin wxGlade: ::extracode
// end wxGlade
short Set_basic_mode = 0, Set_texture_dir = 0;
short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0;
extern CriticalSection * g_ProcessDListCS;
ConfigNotebook::ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long /*style*/) :
@ -121,13 +121,13 @@ wxNotebook(parent, id, pos, size, 0)
cbxFBO = new wxCheckBox(BasicSettingsPanel, wxID_ANY, "Use frame buffer objects");
//emulation settings panel
if (settings.advanced_options)
if (g_settings->advanced_options)
{
EmuSettingsPanel = new wxPanel(this, wxID_ANY);
if (romopen)
EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Current game emulation settings. Change with care!");
EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Current game emulation g_settings-> Change with care!");
else
EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Default emulation settings. Not recommended to change!");
EmuSettingsBoxSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Default emulation g_settings-> Not recommended to change!");
EmuSettingsLeftSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "General options");
FrameBufferSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Frame buffer emulation");
DepthBufferSizer_staticbox = new wxStaticBox(EmuSettingsPanel, -1, "Depth buffer emulation");
@ -172,12 +172,12 @@ wxNotebook(parent, id, pos, size, 0)
}
#ifdef TEXTURE_FILTER
if (settings.texenh_options)
if (g_settings->texenh_options)
{
if (!GfxInitDone)
{
grGlideInit();
grSstSelect(settings.card_id);
grSstSelect(g_settings->card_id);
}
const char *extensions = grGetString(GR_EXTENSION);
if (strstr(extensions, "EVOODOO"))
@ -313,7 +313,7 @@ void ConfigNotebook::OnClickVRAM(wxCommandEvent &event)
{
bool enable = !cbxVRAM->GetValue();
if (enable)
spinVRAM->SetValue(settings.wrpVRAM);
spinVRAM->SetValue(g_settings->wrpVRAM);
else
spinVRAM->SetValue(" auto");
spinVRAM->Enable(enable);
@ -389,7 +389,7 @@ void ConfigNotebook::OnClickTexEdit(wxCommandEvent &event)
bool val = !cbxHrsTexEdit->GetValue();
cbxHrsAltCRC->Enable(val);
if (val)
cbxHrsAltCRC->SetValue(settings.ghq_hirs_altcrc > 0);
cbxHrsAltCRC->SetValue(g_settings->ghq_hirs_altcrc > 0);
else
cbxHrsAltCRC->SetValue(false);
}
@ -422,29 +422,29 @@ void ConfigNotebook::set_properties()
wxString tooltip = "Resolution\nThis option selects the fullscreen resolution for 3dfx cards and windowed resolution for other cards\n(note again that for 3dfx cards the plugin must be in fullscreen mode to see anything).\n[Recommended: 640x480, 800x600, 1024x768]";
lblResolution->SetToolTip(tooltip);
cmbResolution->SetToolTip(tooltip);
cmbResolution->SetSelection(settings.res_data);
cmbResolution->SetSelection(g_settings->res_data);
cbxVSync->SetToolTip("Vertical sync\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\".\n");
cbxVSync->SetValue(settings.vsync > 0);
cbxVSync->SetValue(g_settings->vsync > 0);
tooltip = "Select a format, in which screen shots will be saved";
lblScreenShotFormat->SetToolTip(tooltip);
cmbScreenShotFormat->SetToolTip(tooltip);
for (int f = 0; f < NumOfFormats; f++) {
cmbScreenShotFormat->Append(ScreenShotFormats[f].format);
}
cmbScreenShotFormat->SetSelection(settings.ssformat);
cmbScreenShotFormat->SetSelection(g_settings->ssformat);
cbxFPS->SetToolTip("FPS counter\nWhen this option is checked, a FPS (frames per second) counter will be shown\nin the lower left corner of the screen.\n[Recommended: your preference]");
cbxFPS->SetValue((settings.show_fps & 1) > 0);
cbxFPS->SetValue((g_settings->show_fps & 1) > 0);
cbxVIS->SetToolTip("VI/s counter\nWhen this option is checked, a VI/s (vertical interrupts per second) counter\nwill be shown in the lower left corner of the screen. This is like the FPS\ncounter but will be consistent at 60 VI/s for full speed on NTSC (U) games and\n50 VI/s for full speed on PAL (E) ones.\n[Recommended: your preference]");
cbxVIS->SetValue((settings.show_fps & 2) > 0);
cbxVIS->SetValue((g_settings->show_fps & 2) > 0);
cbxPercent->SetToolTip("% speed\nThis displays a percentage of the actual N64 speed in the lower\nleft corner of the screen.\n[Recommended: your preference]");
cbxPercent->SetValue((settings.show_fps & 4) > 0);
cbxPercent->SetValue((g_settings->show_fps & 4) > 0);
cbxClockEnabled->SetToolTip("Clock enabled\nThis option will put a clock in the lower right corner of the screen, showing the current time.\n[Recommended: your preference]");
cbxClockEnabled->SetValue(settings.clock > 0);
cbxClock24->SetValue(settings.clock_24_hr > 0);
cbxClockEnabled->SetValue(g_settings->clock > 0);
cbxClock24->SetValue(g_settings->clock_24_hr > 0);
cbxClock24->SetToolTip("Display hours as 24-hour clock.\n[Recommended: your preference]");
cbxTextTransparent->SetToolTip("Transparent text background\nIf this is checked, all on-screen messages will have a transparent background. Otherwise, it will have a solid black background.\n[Recommended: your preference]");
cbxTextTransparent->SetValue((settings.show_fps & 8) > 0);
cbxTextureSettings->SetValue(settings.texenh_options > 0);
cbxTextTransparent->SetValue((g_settings->show_fps & 8) > 0);
cbxTextureSettings->SetValue(g_settings->texenh_options > 0);
cbxTextureSettings->SetToolTip("Enable \"Texture enhancement\" panel.\nIt shows various enhancement options for original textures as well as options for hi-resolution textures.");
tooltip = "Full screen resolution:\nThis sets the full screen resolution for non-3dfx video cards.\nAll the resolutions that your video card/monitor support should be displayed.\n[Recommended: native (max) resolution of your monitor - unless performance becomes an issue]";
lblFSResolution->SetToolTip(tooltip);
@ -461,122 +461,122 @@ void ConfigNotebook::set_properties()
wxString res(aRes[r], wxConvUTF8);
cmbFSResolution->Append(res);
}
cmbFSResolution->SetSelection(settings.wrpResolution < size ? settings.wrpResolution : 0);
cmbFSResolution->SetSelection(g_settings->wrpResolution < size ? g_settings->wrpResolution : 0);
}
#ifdef __WINDOWS__
cbxVRAM->SetValue(settings.wrpVRAM == 0);
cbxVRAM->SetValue(g_settings->wrpVRAM == 0);
if (cbxVRAM->GetValue())
spinVRAM->SetValue(" auto");
else
spinVRAM->SetValue(settings.wrpVRAM);
spinVRAM->SetValue(g_settings->wrpVRAM);
spinVRAM->Enable(!cbxVRAM->GetValue());
lblMb->Enable(!cbxVRAM->GetValue());
#else
cbxVRAM->SetValue(false);
cbxVRAM->Disable();
spinVRAM->SetValue(settings.wrpVRAM ? settings.wrpVRAM : 32);
spinVRAM->SetValue(g_settings->wrpVRAM ? g_settings->wrpVRAM : 32);
spinVRAM->Enable(true);
lblMb->Enable(true);
#endif
cbxFBO->SetValue(settings.wrpFBO > 0);
cbxAnisotropic->SetValue(settings.wrpAnisotropic > 0);
cbxFBO->SetValue(g_settings->wrpFBO > 0);
cbxAnisotropic->SetValue(g_settings->wrpAnisotropic > 0);
//emulation settings panel
if (settings.advanced_options)
if (g_settings->advanced_options)
{
AddPage(EmuSettingsPanel, "Emulation settings");
tooltip = "Filtering mode\nThere are three filtering modes possible:\n* Automatic filtering - filter exactly how the N64 specifies.\n* Point-sampled filtering - causes texels to appear square and sharp.\n* Bilinear filtering - interpolates the texture to make it appear more smooth.\n[Recommended: Automatic]";
lbFiltering->SetToolTip(tooltip);
cmbFiltering->SetToolTip(tooltip);
cmbFiltering->SetSelection(settings.filtering);
cmbFiltering->SetSelection(g_settings->filtering);
tooltip = "Buffer swapping method\nThere are 3 buffer swapping methods:\n* old - swap buffers when vertical interrupt has occurred.\n* new - swap buffers when set of conditions is satisfied. Prevents flicker on some games.\n* hybrid - mix of first two methods.\nCan prevent even more flickering then previous method, but also can cause artefacts.\nIf you have flickering problems in a game (or graphics that don't show),\ntry to change swapping method.\n[Recommended: new (hybrid for Paper Mario)]";
lbBufferSwap->SetToolTip(tooltip);
cmbBufferSwap->SetToolTip(tooltip);
cmbBufferSwap->SetSelection(settings.swapmode);
cmbBufferSwap->SetSelection(g_settings->swapmode);
tooltip = "Per-pixel level-of-detail calculation\nN64 uses special mechanism for mip-mapping, which nearly impossible to reproduce\ncorrectly on PC hardware. This option enables approximate emulation of this feature.\nFor example, it is required for the Peach/Bowser portrait's transition in Super Mario 64.\nThere are 3 modes:\n* off - LOD is not calculated\n* fast - fast imprecise LOD calculation.\n* precise - most precise LOD calculation possible, but more slow.\n[Recommended: your preference]";
lblLOD->SetToolTip(tooltip);
cmbLOD->SetToolTip(tooltip);
cmbLOD->SetSelection(settings.lodmode);
cmbAspect->SetSelection(settings.aspectmode);
tooltip = "Aspect ratio of the output.\nMost N64 games use 4:3 aspect ratio, but some support widescreen too.\nYou may select appropriate aspect here and set widescreen mode in game settings.\nIn \"Stretch\" mode the output will be stretched to the entire screen,\nother modes may add black borders if necessary";
cmbLOD->SetSelection(g_settings->lodmode);
cmbAspect->SetSelection(g_settings->aspectmode);
tooltip = "Aspect ratio of the output.\nMost N64 games use 4:3 aspect ratio, but some support widescreen too.\nYou may select appropriate aspect here and set widescreen mode in game g_settings->\nIn \"Stretch\" mode the output will be stretched to the entire screen,\nother modes may add black borders if necessary";
cmbAspect->SetToolTip(tooltip);
lblAspect->SetToolTip(tooltip);
cbxFog->SetToolTip("Fog enabled\nSets fog emulation on//off.\n[Recommended: on]");
cbxFog->SetValue(settings.fog > 0);
cbxFog->SetValue(g_settings->fog > 0);
cbxBuffer->SetToolTip("Buffer clear on every frame\nForces the frame buffer to be cleared every frame drawn.\nUsually frame buffer clear is controlled by the game.\nHowever, in some cases it is not well emulated,\nand some garbage may be left on the screen.\nIn such cases, this option must be set on.\n[Recommended: on]");
cbxBuffer->SetValue(settings.buff_clear > 0);
cbxBuffer->SetValue(g_settings->buff_clear > 0);
cbxFBEnable->SetToolTip("Enable frame buffer emulation\nIf on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation.\n[Recommended: on for games which use frame buffer effects]");
cbxFBEnable->SetValue(fb_emulation_enabled);
cbxFBHWFBE->SetToolTip("Enable hardware frame buffer emulation\nIf this option is on, plugin will create auxiliary frame buffers in video memory instead of copying\nframe buffer content into main memory. This allows plugin to run frame buffer effects without slowdown\nand without scaling image down to N64's native resolution. This feature is fully supported by\nVoodoo 4/5 cards and partially by Voodoo3 and Banshee. Modern cards also fully support it.\n[Recommended: on, if supported by your hardware]");
cbxFBHWFBE->SetValue(((settings.frame_buffer&fb_hwfbe) > 0));
cbxFBHWFBE->SetValue(((g_settings->frame_buffer&fb_hwfbe) > 0));
cbxFBHWFBE->Enable(fb_emulation_enabled);
cbxFBGetFBI->SetToolTip("Get information about frame buffers\nThis is compatibility option. It must be set on for Mupen64 and off for 1964");
cbxFBGetFBI->SetValue((settings.frame_buffer&fb_get_info) > 0);
cbxFBGetFBI->SetValue((g_settings->frame_buffer&fb_get_info) > 0);
cbxFBReadEveryFrame->SetToolTip("Read every frame\nIn some games plugin can't detect frame buffer usage.\nIn such cases you need to enable this option to see frame buffer effects.\nEvery drawn frame will be read from video card -> it works very slow.\n[Recommended: mostly off (needed only for a few games)]");
cbxFBReadEveryFrame->SetValue((settings.frame_buffer&fb_ref) > 0);
cbxFBReadEveryFrame->SetValue((g_settings->frame_buffer&fb_ref) > 0);
cbxFBasTex->SetToolTip("Render N64 frame buffer as texture\nWhen this option is enabled, content of each N64 frame buffer is rendered\nas texture over the frame, rendered by the plugin. This prevents graphics lost,\nbut may cause slowdowns and various glitches in some games.\n[Recommended: mostly off]");
cbxFBasTex->SetValue((settings.frame_buffer&fb_read_back_to_screen) > 0);
cbxFBasTex->SetValue((g_settings->frame_buffer&fb_read_back_to_screen) > 0);
cbxDetect->SetToolTip("Detect CPU write to the N64 frame buffer\nThis option works as the previous options, but the plugin is trying to detect,\nwhen game uses CPU writes to N64 frame buffer. The N64 frame buffer is rendered\nonly when CPU writes is detected. Use this option for those games, in which you\nsee still image or no image at all for some time with no reason.\n[Recommended: mostly off]");
cbxDetect->SetValue((settings.frame_buffer&fb_cpu_write_hack) > 0);
cbxDetect->SetValue((g_settings->frame_buffer&fb_cpu_write_hack) > 0);
cbxFBDepthBuffer->SetToolTip("Enable depth buffer rendering\nThis option is used to fully emulate N64 depth buffer.\nIt is required for correct emulation of depth buffer based effects.\nHowever, it requires fast (>1GHz) CPU to work full speed.\n[Recommended: on for fast PC]");
cbxFBDepthBuffer->SetValue((settings.frame_buffer&fb_depth_render) > 0);
cbxFBDepthBuffer->SetValue((g_settings->frame_buffer&fb_depth_render) > 0);
}
#ifdef TEXTURE_FILTER
if (settings.texenh_options)
if (g_settings->texenh_options)
{
AddPage(TexturePanel, "Texture enhancement");
tooltip = "Filters:\nApply a filter to either smooth or sharpen textures.\nThere are 4 different smoothing filters and 2 different sharpening filters.\nThe higher the number, the stronger the effect,\ni.e. \"Smoothing filter 4\" will have a much more noticeable effect than \"Smoothing filter 1\".\nBe aware that performance may have an impact depending on the game and/or the PC.\n[Recommended: your preference]";
lblFilter->SetToolTip(tooltip);
cmbEnhFilter->SetToolTip(tooltip);
cmbEnhFilter->SetSelection(settings.ghq_fltr);
cmbEnhFilter->SetSelection(g_settings->ghq_fltr);
tooltip = "Texture enhancement:\n7 different filters are selectable here, each one with a distinctive look.\nBe aware of possible performance impacts.\n\nIMPORTANT: 'Store' mode - saves textures in cache 'as is'. It can improve performance in games, which load many textures.\nDisable 'Ignore backgrounds' option for better result.\n\n[Recommended: your preference]";
lblEnhancement->SetToolTip(tooltip);
cmbEnhEnhancement->SetToolTip(tooltip);
cmbEnhEnhancement->SetSelection(settings.ghq_enht);
cmbEnhEnhancement->SetSelection(g_settings->ghq_enht);
tooltip = "Texture cache size:\nEnhanced and filtered textures can be cached to aid performance.\nThis setting will adjust how much PC memory will be dedicated for texture cache.\nThis helps boost performance if there are subsequent requests for the same texture (usually the case).\nNormally, 128MB should be more than enough but there is a sweet spot for each game.\nSuper Mario may not need more than 32megs, but Conker streams a lot of textures,\nso setting 256+ megs can boost performance. Adjust accordingly if you are encountering speed issues.\n'0' disables cache.\n[Recommended: PC and game dependant]";
lblTexCache->SetToolTip(tooltip);
lblTexCacheMB->SetToolTip(tooltip);
spinEnhCacheSize->SetToolTip(tooltip);
spinEnhCacheSize->SetMinSize(wxSize(55, 21));
spinEnhCacheSize->SetValue(settings.ghq_cache_size);
spinEnhCacheSize->SetValue(g_settings->ghq_cache_size);
cbxEnhIgnoreBG->SetToolTip("Ignore Backgrounds:\nIt is used to skip enhancement for long narrow textures, usually used for backgrounds.\nThis may save texture memory greatly and increase performance.\n[Recommended: on (off for 'Store' mode)]");
cbxEnhIgnoreBG->SetValue(settings.ghq_enht_nobg > 0);
cbxEnhIgnoreBG->SetValue(g_settings->ghq_enht_nobg > 0);
tooltip = "Texture compression:\nTextures will be compressed using selected texture compression method.\nThe overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC.\nIn addition to saving space on the texture cache,\nthe space occupied on the GFX hardware's texture RAM,\nby the enhanced textures, will be greatly reduced.\nThis minimizes texture RAM usage,\ndecreasing the number of texture swaps to the GFX hardware leading to performance gains.\nHowever, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradation of small size textures and color banding of gradient colored textures.\n[Recommended: off]";
cbxEnhTexCompression->SetToolTip(tooltip);
cbxHrsTexCompression->SetToolTip(tooltip);
cbxEnhTexCompression->SetValue(settings.ghq_enht_cmpr > 0);
cbxEnhTexCompression->SetValue(g_settings->ghq_enht_cmpr > 0);
cbxEnhCompressCache->SetToolTip("Compress texture cache:\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture,\nbut 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n[Recommended: on]");
cbxEnhCompressCache->SetValue(settings.ghq_enht_gz > 0);
cbxEnhCompressCache->SetValue(g_settings->ghq_enht_gz > 0);
tooltip = "Hi-res pack format:\nChoose which method is to be used for loading Hi-res texture packs.\nOnly Rice's format is available currently.\nLeave on \"None\" if you will not be needing to load hi-res packs.\n[Recommended: Rice's format. Default: \"None\"]";
lblHrsFormat->SetToolTip(tooltip);
cmbHrsFormat->SetToolTip(tooltip);
cmbHrsFormat->SetSelection(settings.ghq_hirs);
cmbHrsFormat->SetSelection(g_settings->ghq_hirs);
cbxHrsTile->SetToolTip("Tile textures:\nWhen on, wide texture will be split on several tiles to fit in one 256-width texture.\nThis tiled texture takes much less video memory space and thus overall performance will increase.\nHowever, corresponding polygons must be split too, and this is not polished yet\n- various issues are possible, including black lines and polygons distortions.\n[Recommended: off]");
cbxHrsTile->SetValue(settings.ghq_hirs_tile > 0);
cbxHrsTile->SetValue(g_settings->ghq_hirs_tile > 0);
cbxHrsForce16->SetToolTip("Force 16bpp textures:\nThe color of the textures will be reduced to 16bpp.\nThis is another space saver and performance enhancer.\nThis halves the space used on the texture cache and the GFX hardware's texture RAM.\nColor reduction is done so that the original quality is preserved as much as possible.\nDepending on the texture, this usually is hardly noticeable.\nSometimes though, it can be: skies are a good example.\n[Recommended: off]");
cbxHrsForce16->SetValue(settings.ghq_hirs_f16bpp > 0);
cbxHrsForce16->SetValue(g_settings->ghq_hirs_f16bpp > 0);
cbxHrsTexEdit->SetToolTip("Texture dumping mode:\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys: \"R\" reloads hires textures from the texture pack - \"D\" toggles texture dumps on/off.");
cbxHrsTexEdit->SetValue(settings.ghq_hirs_dump > 0);
cbxHrsTexEdit->SetValue(g_settings->ghq_hirs_dump > 0);
cbxHrsAltCRC->SetToolTip("Alternative CRC calculation:\nThis option enables emulation of a palette CRC calculation bug in RiceVideo.\nIf some textures are not loaded, try to set this option on/off.\n[Recommended: texture pack dependant, mostly on]");
cbxHrsAltCRC->SetValue(settings.ghq_hirs_altcrc > 0 && settings.ghq_hirs_dump == 0);
if (settings.ghq_hirs_dump)
cbxHrsAltCRC->SetValue(g_settings->ghq_hirs_altcrc > 0 && g_settings->ghq_hirs_dump == 0);
if (g_settings->ghq_hirs_dump)
cbxHrsAltCRC->Disable();
cbxHrsTexCompression->SetValue(settings.ghq_hirs_cmpr > 0);
cbxHrsTexCompression->SetValue(g_settings->ghq_hirs_cmpr > 0);
cbxHrsCompressCache->SetToolTip("Compress texture cache:\nWhen game started, plugin loads all its hi-resolution textures into PC memory.\nSince hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory.\nCache compression allows save memory space greatly.\nTextures will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n[Recommended: on]");
cbxHrsCompressCache->SetValue(settings.ghq_hirs_gz > 0);
cbxHrsCompressCache->SetValue(g_settings->ghq_hirs_gz > 0);
cbxHrsLetFly->SetToolTip("Use Alpha channel fully:\nWhen this option is off, 16bit rgba textures will be loaded using RiceVideo style\n- with 1bit for alpha channel.\nWhen it is on, GlideHQ will check, how alpha channel is used by the hires texture,\nand select most appropriate format for it.\nThis gives texture designers freedom to play with alpha, as they need,\nregardless of format of original N64 texture.\nFor older and badly designed texture packs it can cause unwanted black borders.\n[Recommended: texture pack dependant]");
cbxHrsLetFly->SetValue(settings.ghq_hirs_let_texartists_fly > 0);
cmbTextureCompression->SetSelection(settings.ghq_cmpr);
cbxHrsLetFly->SetValue(g_settings->ghq_hirs_let_texartists_fly > 0);
cmbTextureCompression->SetSelection(g_settings->ghq_cmpr);
cbxSaveTexCache->SetToolTip("Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch,\nas opposed to the 5 -60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Plugins folder.\n\n[Highly Recommended: on]");
cbxSaveTexCache->SetValue(settings.ghq_cache_save > 0);
cbxSaveTexCache->SetValue(g_settings->ghq_cache_save > 0);
TexturePanel->SetMinSize(wxSize(526, 494));
if (!voodoo.sup_32bit_tex)
{
settings.ghq_cmpr = 0;
settings.ghq_enht_cmpr = settings.ghq_hirs_cmpr = FALSE;
settings.ghq_enht_f16bpp = settings.ghq_hirs_f16bpp = TRUE;
g_settings->ghq_cmpr = 0;
g_settings->ghq_enht_cmpr = g_settings->ghq_hirs_cmpr = FALSE;
g_settings->ghq_enht_f16bpp = g_settings->ghq_hirs_f16bpp = TRUE;
lblTexCompression->Disable();
cmbTextureCompression->SetSelection(0);
cmbTextureCompression->Disable();
@ -593,30 +593,30 @@ void ConfigNotebook::set_properties()
#ifndef _ENDUSER_RELEASE_
AddPage(DebugPanel, "Debug");
cbxAutoUcode->SetToolTip("Autodetect Microcode\nIf this option is checked, the microcode of the game\nwill be detected automatically from the INI, and\ntherefore it will not need to be set in this\nconfiguration dialog.\n[Recommended: on]");
cbxAutoUcode->SetValue(settings.autodetect_ucode > 0);
cbxAutoUcode->SetValue(g_settings->autodetect_ucode > 0);
tooltip = "Force Microcode\nThis option ONLY has an effect if Autodetect Microcode\nis unchecked, the crc from the game could not be\nfound in the INI, OR after the game has already started\nrunning. In any of those three cases, this will\nselect the microcode to use\n[Recommended: any, turn on Autodetect Microcode]";
lblForceUcode->SetToolTip(tooltip);
cmbForceUcode->SetToolTip(tooltip);
cmbForceUcode->SetSelection(settings.ucode);
cmbForceUcode->SetSelection(g_settings->ucode);
cbxWireframe->SetToolTip("Wireframe\nThis option, when checked, makes it so that the plugin will draw only the\noutlines of objects. The colors specified in the combo box to the right\ndetermines the color that the wireframes show up as.\n[Recommended: off]");
cbxWireframe->SetValue(settings.wireframe>0);
cbxWireframe->SetValue(g_settings->wireframe>0);
cmbWireframe->SetToolTip("Wireframe Colors\nThis selects the colors to use for the wireframes (if wireframe mode is enabled).\nThere are 3 modes:\n* Original colors - draw exactly as it would normally, textures and all, only in wireframes.\n* Vertex colors - use the colors specified in the vertices to draw the wireframes with.\n* Red only - use a constant red color to draw the wireframes.\n[Recommended: Vertex colors]");
cmbWireframe->SetSelection(settings.wfmode);
cmbWireframe->SetSelection(g_settings->wfmode);
cbxLog->SetToolTip("Log to RDP.txt\nRECOMMENDED FOR DEBUGGING ONLY - this option, when checked, will log EVERY SINGLE\nCOMMAND the plugin processes to a file called RDP.txt in the current directory.\nThis is incredibly slow, so I recommend keeping it disabled.\n[Recommended: off]");
cbxLog->SetValue(settings.logging>0);
cbxLog->SetValue(g_settings->logging>0);
cbxCombRed->SetToolTip("Unknown combiners as red\nObjects that use an unimplemented combine mode will show up as red instead of\nassuming texture with full alpha. Disable this option to remove the red stuff\nand at least have a guess at the correct combine mode.\n[Recommended: off]");
cbxCombRed->SetValue(settings.unk_as_red>0);
cbxCombRed->SetValue(g_settings->unk_as_red>0);
cbxLogClear->SetToolTip("Log clear every frame\nRECOMMENDED FOR DEBUGGING ONLY - this option has no effect unless 'Log to RDP.txt'\nis checked. This will make it so that the log, RDP.txt, will be cleared at the\nbeginning of every frame.\n[Recommended: off]");
cbxLogClear->SetValue(settings.log_clear>0);
cbxLogClear->SetValue(g_settings->log_clear>0);
cbxCmbLog->SetToolTip("Log unknown combiners\nRECOMMENDED FOR DEBUGGING ONLY - when checked, this option will cause every\nunimplemented combiner drawn to be logged to a file called Unimp.txt in the\ncurrent directory. This becomes slow when there are unimplemented combiners\non the screen, so I recommend keeping it disabled.\n[Recommended: off]");
cbxCmbLog->SetValue(settings.log_unk>0);
cbxCmbLog->SetValue(g_settings->log_unk>0);
cbxWindowLog->SetToolTip("Run and log in window\nRECOMMENDED FOR DEBUGGING ONLY - this option will make it so that the plugin will\nstill process dlists in windowed mode. This allows for logging to occur while not\nin fullscreen, possibly allowing you to debug a crash.\n[Recommended: off]");
cbxWindowLog->SetValue(settings.run_in_window>0);
cbxWindowLog->SetValue(g_settings->run_in_window>0);
cbxCmbLogClear->SetToolTip("Clear unknown combiner log every frame\nRECOMMENDED FOR DEBUGGING ONLY - this option works much like 'Log clear every frame'\nexcept it clears the combiner log (Unimp.txt) instead of RDP.txt at the\nbeginning of each frame. Again, this option has no effect if 'combiner logging' is disabled.\n[Recommended: off]");
cbxCmbLogClear->SetValue(settings.unk_clear>0);
cbxErrLog->SetValue(settings.elogging>0);
cbxCmbLogClear->SetValue(g_settings->unk_clear>0);
cbxErrLog->SetValue(g_settings->elogging>0);
cbxBilinearTexCache->SetToolTip("Bilinear filter texture cache\nRECOMMENDED FOR DEBUGGING ONLY - when checked, this option will make the graphical\ndebugger texture cache use bilinear filtering as opposed to point-sampled filtering,\nwhich it will use otherwise. See 'Filtering mode' for descriptions of bilinear and\npoint-sampled filtering.\n[Recommended: off]");
cbxBilinearTexCache->SetValue(settings.filter_cache>0);
cbxBilinearTexCache->SetValue(g_settings->filter_cache>0);
#endif //_ENDUSER_RELEASE_
// end wxGlade
}
@ -685,7 +685,7 @@ void ConfigNotebook::do_layout()
BasicSettingsPanel->SetSizer(ConfigMainSizer);
//emulation settings panel
if (settings.advanced_options)
if (g_settings->advanced_options)
{
wxStaticBoxSizer* EmuSettingsBoxSizer = new wxStaticBoxSizer(EmuSettingsBoxSizer_staticbox, wxHORIZONTAL);
wxBoxSizer* EmuSettingsMainSizer = new wxBoxSizer(wxHORIZONTAL);
@ -734,7 +734,7 @@ void ConfigNotebook::do_layout()
}
#ifdef TEXTURE_FILTER
if (settings.texenh_options)
if (g_settings->texenh_options)
{
wxBoxSizer* TextureMainSizer = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer* PresetsSizer = new wxStaticBoxSizer(PresetsSizer_staticbox, wxHORIZONTAL);
@ -829,93 +829,93 @@ void ConfigNotebook::do_layout()
void ConfigNotebook::SaveSettings()
{
SETTINGS oldsettings = settings;
CSettings oldsettings = *g_settings;
int is_advanced_changed = 0;
if (settings.advanced_options)
if (g_settings->advanced_options)
{
settings.filtering = cmbFiltering->GetSelection();
settings.aspectmode = cmbAspect->GetSelection();
settings.swapmode = cmbBufferSwap->GetSelection();
settings.fog = (int)cbxFog->GetValue();
settings.buff_clear = cbxBuffer->GetValue();
settings.lodmode = cmbLOD->GetSelection();
g_settings->filtering = cmbFiltering->GetSelection();
g_settings->aspectmode = cmbAspect->GetSelection();
g_settings->swapmode = cmbBufferSwap->GetSelection();
g_settings->fog = (int)cbxFog->GetValue();
g_settings->buff_clear = cbxBuffer->GetValue();
g_settings->lodmode = cmbLOD->GetSelection();
if (cbxFBEnable->GetValue()) settings.frame_buffer |= fb_emulation;
else settings.frame_buffer &= ~fb_emulation;
if (cbxFBHWFBE->GetValue()) settings.frame_buffer |= fb_hwfbe;
else settings.frame_buffer &= ~fb_hwfbe;
if (cbxFBReadEveryFrame->GetValue()) settings.frame_buffer |= fb_ref;
else settings.frame_buffer &= ~fb_ref;
if (cbxFBasTex->GetValue()) settings.frame_buffer |= fb_read_back_to_screen;
else settings.frame_buffer &= ~fb_read_back_to_screen;
if (cbxDetect->GetValue()) settings.frame_buffer |= fb_cpu_write_hack;
else settings.frame_buffer &= ~fb_cpu_write_hack;
if (cbxFBGetFBI->GetValue()) settings.frame_buffer |= fb_get_info;
else settings.frame_buffer &= ~fb_get_info;
if (cbxFBDepthBuffer->GetValue()) settings.frame_buffer |= fb_depth_render;
else settings.frame_buffer &= ~fb_depth_render;
is_advanced_changed = memcmp(&oldsettings, &settings, sizeof(SETTINGS));
if (cbxFBEnable->GetValue()) g_settings->frame_buffer |= fb_emulation;
else g_settings->frame_buffer &= ~fb_emulation;
if (cbxFBHWFBE->GetValue()) g_settings->frame_buffer |= fb_hwfbe;
else g_settings->frame_buffer &= ~fb_hwfbe;
if (cbxFBReadEveryFrame->GetValue()) g_settings->frame_buffer |= fb_ref;
else g_settings->frame_buffer &= ~fb_ref;
if (cbxFBasTex->GetValue()) g_settings->frame_buffer |= fb_read_back_to_screen;
else g_settings->frame_buffer &= ~fb_read_back_to_screen;
if (cbxDetect->GetValue()) g_settings->frame_buffer |= fb_cpu_write_hack;
else g_settings->frame_buffer &= ~fb_cpu_write_hack;
if (cbxFBGetFBI->GetValue()) g_settings->frame_buffer |= fb_get_info;
else g_settings->frame_buffer &= ~fb_get_info;
if (cbxFBDepthBuffer->GetValue()) g_settings->frame_buffer |= fb_depth_render;
else g_settings->frame_buffer &= ~fb_depth_render;
is_advanced_changed = memcmp(&oldsettings, g_settings, sizeof(CSettings));
}
settings.res_data = cmbResolution->GetSelection();
settings.res_data_org = settings.res_data;
settings.scr_res_x = settings.res_x = resolutions[settings.res_data][0];
settings.scr_res_y = settings.res_y = resolutions[settings.res_data][1];
settings.vsync = (int)cbxVSync->GetValue();
settings.ssformat = cmbScreenShotFormat->GetSelection();
settings.show_fps =
g_settings->res_data = cmbResolution->GetSelection();
g_settings->res_data_org = g_settings->res_data;
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
g_settings->vsync = (int)cbxVSync->GetValue();
g_settings->ssformat = cmbScreenShotFormat->GetSelection();
g_settings->show_fps =
(cbxFPS->GetValue() ? 1 : 0) |
(cbxVIS->GetValue() ? 2 : 0) |
(cbxPercent->GetValue() ? 4 : 0) |
(cbxTextTransparent->GetValue() ? 8 : 0);
settings.clock = (int)cbxClockEnabled->GetValue();
settings.clock_24_hr = (int)cbxClock24->GetValue();
g_settings->clock = (int)cbxClockEnabled->GetValue();
g_settings->clock_24_hr = (int)cbxClock24->GetValue();
settings.wrpResolution = cmbFSResolution->GetSelection();
settings.wrpVRAM = cbxVRAM->GetValue() ? 0 : spinVRAM->GetValue();
settings.wrpFBO = cbxFBO->GetValue();
settings.wrpAnisotropic = cbxAnisotropic->GetValue();
g_settings->wrpResolution = cmbFSResolution->GetSelection();
g_settings->wrpVRAM = cbxVRAM->GetValue() ? 0 : spinVRAM->GetValue();
g_settings->wrpFBO = cbxFBO->GetValue();
g_settings->wrpAnisotropic = cbxAnisotropic->GetValue();
#ifdef TEXTURE_FILTER
if (settings.texenh_options)
if (g_settings->texenh_options)
{
settings.ghq_fltr = cmbEnhFilter->GetSelection();
settings.ghq_enht = cmbEnhEnhancement->GetSelection();
settings.ghq_cache_size = spinEnhCacheSize->GetValue();
settings.ghq_enht_nobg = (int)cbxEnhIgnoreBG->GetValue();
settings.ghq_enht_cmpr = (int)cbxEnhTexCompression->GetValue();
settings.ghq_enht_gz = (int)cbxEnhCompressCache->GetValue();
settings.ghq_hirs = cmbHrsFormat->GetSelection();
settings.ghq_hirs_tile = (int)cbxHrsTile->GetValue();
settings.ghq_hirs_f16bpp = (int)cbxHrsForce16->GetValue();
settings.ghq_hirs_dump = (int)cbxHrsTexEdit->GetValue();
settings.ghq_hirs_altcrc = (int)cbxHrsAltCRC->GetValue();
settings.ghq_hirs_cmpr = (int)cbxHrsTexCompression->GetValue();
settings.ghq_hirs_gz = (int)cbxHrsCompressCache->GetValue();
settings.ghq_hirs_let_texartists_fly = (int)cbxHrsLetFly->GetValue();
settings.ghq_cmpr = (int)cmbTextureCompression->GetSelection();
settings.ghq_cache_save = (int)cbxSaveTexCache->GetValue();
g_settings->ghq_fltr = cmbEnhFilter->GetSelection();
g_settings->ghq_enht = cmbEnhEnhancement->GetSelection();
g_settings->ghq_cache_size = spinEnhCacheSize->GetValue();
g_settings->ghq_enht_nobg = (int)cbxEnhIgnoreBG->GetValue();
g_settings->ghq_enht_cmpr = (int)cbxEnhTexCompression->GetValue();
g_settings->ghq_enht_gz = (int)cbxEnhCompressCache->GetValue();
g_settings->ghq_hirs = cmbHrsFormat->GetSelection();
g_settings->ghq_hirs_tile = (int)cbxHrsTile->GetValue();
g_settings->ghq_hirs_f16bpp = (int)cbxHrsForce16->GetValue();
g_settings->ghq_hirs_dump = (int)cbxHrsTexEdit->GetValue();
g_settings->ghq_hirs_altcrc = (int)cbxHrsAltCRC->GetValue();
g_settings->ghq_hirs_cmpr = (int)cbxHrsTexCompression->GetValue();
g_settings->ghq_hirs_gz = (int)cbxHrsCompressCache->GetValue();
g_settings->ghq_hirs_let_texartists_fly = (int)cbxHrsLetFly->GetValue();
g_settings->ghq_cmpr = (int)cmbTextureCompression->GetSelection();
g_settings->ghq_cache_save = (int)cbxSaveTexCache->GetValue();
}
#endif //TEXTURE_FILTER
settings.texenh_options = (int)cbxTextureSettings->GetValue();
g_settings->texenh_options = (int)cbxTextureSettings->GetValue();
#ifndef _ENDUSER_RELEASE_
settings.autodetect_ucode = (int)cbxAutoUcode->GetValue();
settings.ucode = cmbForceUcode->GetSelection();
settings.wireframe = (int)cbxWireframe->GetValue();
settings.wfmode = cmbWireframe->GetSelection();
settings.logging = (int)cbxLog->GetValue();
settings.unk_as_red = (int)cbxCombRed->GetValue();
settings.log_clear = (int)cbxLogClear->GetValue();
settings.log_unk = (int)cbxCmbLog->GetValue();
settings.run_in_window = (int)cbxWindowLog->GetValue();
settings.unk_clear = (int)cbxCmbLogClear->GetValue();
settings.elogging = (int)cbxErrLog->GetValue();
settings.filter_cache = (int)cbxBilinearTexCache->GetValue();
g_settings->autodetect_ucode = (int)cbxAutoUcode->GetValue();
g_settings->ucode = cmbForceUcode->GetSelection();
g_settings->wireframe = (int)cbxWireframe->GetValue();
g_settings->wfmode = cmbWireframe->GetSelection();
g_settings->logging = (int)cbxLog->GetValue();
g_settings->unk_as_red = (int)cbxCombRed->GetValue();
g_settings->log_clear = (int)cbxLogClear->GetValue();
g_settings->log_unk = (int)cbxCmbLog->GetValue();
g_settings->run_in_window = (int)cbxWindowLog->GetValue();
g_settings->unk_clear = (int)cbxCmbLogClear->GetValue();
g_settings->elogging = (int)cbxErrLog->GetValue();
g_settings->filter_cache = (int)cbxBilinearTexCache->GetValue();
#endif //_ENDUSER_RELEASE_
if (memcmp(&oldsettings, &settings, sizeof(SETTINGS))) //check that settings were changed
if (memcmp(&oldsettings, g_settings, sizeof(CSettings))) //check that settings were changed
{
if (romopen)
{
@ -1087,10 +1087,10 @@ void CALL DllConfig(HWND hParent)
rdp_reset();
}
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
if (settings.ghq_use)
if (g_settings->ghq_use)
{
ext_ghq_shutdown();
settings.ghq_use = 0;
g_settings->ghq_use = 0;
}
#endif
}

View File

@ -282,7 +282,7 @@ enum {
Set_ucodeLookup,
};
extern short Set_basic_mode, Set_texture_dir;
extern short Set_basic_mode, Set_texture_dir, Set_log_dir, Set_log_flush;
extern void general_setting(short setting_ID, const char * name, unsigned int value);
extern void game_setting(short setting_ID, const char * name, unsigned int value);

View File

@ -116,8 +116,8 @@ void debug_cacheviewer ()
for (i=0; i<2; i++)
{
grTexFilterMode (i,
(settings.filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED,
(settings.filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED);
(g_settings->filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED,
(g_settings->filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED);
grTexClampMode (i,
GR_TEXTURECLAMP_CLAMP,
GR_TEXTURECLAMP_CLAMP);
@ -257,12 +257,12 @@ void debug_capture ()
POINT pt;
DbgCursorPos(&pt);
//int diff = settings.scr_res_y-settings.res_y;
//int diff = g_settings->scr_res_y-g_settings->res_y;
if (pt.y <= (int)settings.res_y)
if (pt.y <= (int)g_settings->res_y)
{
int x = pt.x;
int y = pt.y;//settings.res_y - (pt.y - diff);
int y = pt.y;//g_settings->res_y - (pt.y - diff);
TRI_INFO *start;
TRI_INFO *tri;
@ -330,10 +330,10 @@ void debug_capture ()
(uint32_t)rdp.offset_x,
(uint32_t)rdp.offset_y,
GR_LFB_SRC_FMT_565,
settings.res_x,
settings.res_y,
g_settings->res_x,
g_settings->res_y,
FXFALSE,
settings.res_x<<1,
g_settings->res_x<<1,
_debugger.screen);
// Do the cacheviewer
@ -784,10 +784,10 @@ void debug_capture ()
for (i=0; i<_debugger.tri_sel->nv; i++)
{
grConstantColorValue (0x000000FF);
output (_debugger.tri_sel->v[i].x+1, settings.scr_res_y-_debugger.tri_sel->v[i].y+1, 1,
output (_debugger.tri_sel->v[i].x+1, g_settings->scr_res_y-_debugger.tri_sel->v[i].y+1, 1,
"%d", i);
grConstantColorValue (0xFFFFFFFF);
output (_debugger.tri_sel->v[i].x, settings.scr_res_y-_debugger.tri_sel->v[i].y, 1,
output (_debugger.tri_sel->v[i].x, g_settings->scr_res_y-_debugger.tri_sel->v[i].y, 1,
"%d", i);
}
}

View File

@ -130,11 +130,11 @@ static int SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaque)
static void DrawRE2Video(FB_TO_SCREEN_INFO & fb_info, float scale)
{
float scale_y = (float)fb_info.width/rdp.vi_height;
float height = settings.scr_res_x/scale_y;
float height = g_settings->scr_res_x/scale_y;
float ul_x = 0.5f;
float ul_y = (settings.scr_res_y - height)/2.0f;
float lr_y = settings.scr_res_y - ul_y - 1.0f;
float lr_x = settings.scr_res_x - 1.0f;
float ul_y = (g_settings->scr_res_y - height)/2.0f;
float lr_y = g_settings->scr_res_y - ul_y - 1.0f;
float lr_x = g_settings->scr_res_x - 1.0f;
float lr_u = (fb_info.width - 1)*scale;
float lr_v = (fb_info.height - 1)*scale;
VERTEX v[4] = {
@ -191,7 +191,7 @@ static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
{
if (settings.hacks&hack_RE2)
if (g_settings->hacks&hack_RE2)
{
DrawRE2Video256(fb_info);
return;
@ -403,7 +403,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
if (settings.hacks&hack_RE2)
if (g_settings->hacks&hack_RE2)
{
DrawRE2Video(fb_info, scale);
}
@ -506,7 +506,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
GrTexInfo t_info;
float scale = 0.25f;
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (settings.scr_res_x > 1024)
if (g_settings->scr_res_x > 1024)
{
scale = 0.125f;
LOD = GR_LOD_LOG2_2048;

View File

@ -74,7 +74,8 @@ the plugin
#include "GlideExtensions.h"
#include "rdp.h"
#include "Keys.h"
#include "Config.h"
#include "config.h"
#include "Settings.h"
#if defined __VISUALC__
typedef unsigned char boolean;
@ -201,13 +202,13 @@ extern "C" {
#ifdef RDP_LOGGING
extern int log_open;
extern std::ofstream rdp_log;
#define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (settings.logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; }
#define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.logging && log_open) { rdp_log.close (); log_open=FALSE; }
#define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (g_settings->logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; }
#define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (g_settings->logging && log_open) { rdp_log.close (); log_open=FALSE; }
#ifdef LOGNOTKEY
#define LRDP(x) EXT("RDP (...)\n"); if (settings.logging && log_open) { if (!CheckKeyPressed(LOGKEY,0x8000)) { rdp_log << x; rdp_log.flush(); } }
#define LRDP(x) EXT("RDP (...)\n"); if (g_settings->logging && log_open) { if (!CheckKeyPressed(LOGKEY,0x8000)) { rdp_log << x; rdp_log.flush(); } }
#else
#define LRDP(x) EXT("RDP (...)\n"); if (settings.logging && log_open) { rdp_log << x; rdp_log.flush(); }
#define LRDP(x) EXT("RDP (...)\n"); if (g_settings->logging && log_open) { rdp_log << x; rdp_log.flush(); }
#endif
#else
@ -219,9 +220,9 @@ extern "C" {
#ifdef RDP_ERROR_LOG
extern int elog_open;
extern std::ofstream rdp_err;
#define OPEN_RDP_E_LOG() EXT("OPEN_RDP_E_LOG ()\n"); if (settings.elogging && !elog_open) { rdp_err.open ("rdp_e.txt"); elog_open=TRUE; }
#define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.elogging && elog_open) { rdp_err.close (); elog_open=FALSE; }
#define RDP_E(x) if (settings.elogging) { FRDP_E (x); }
#define OPEN_RDP_E_LOG() EXT("OPEN_RDP_E_LOG ()\n"); if (g_settings->elogging && !elog_open) { rdp_err.open ("rdp_e.txt"); elog_open=TRUE; }
#define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (g_settings->elogging && elog_open) { rdp_err.close (); elog_open=FALSE; }
#define RDP_E(x) if (g_settings->elogging) { FRDP_E (x); }
#else
#define OPEN_RDP_E_LOG()
#define CLOSE_RDP_E_LOG()
@ -231,7 +232,7 @@ extern "C" {
#ifdef RDP_LOGGING
__inline void FRDP(const char *fmt, ...)
{
if (!settings.logging || !log_open) return;
if (!g_settings->logging || !log_open) return;
#ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY, 0x8000)) return;
@ -250,7 +251,7 @@ extern "C" {
#ifdef RDP_ERROR_LOG
__inline void FRDP_E(const char *fmt, ...)
{
if (!settings.elogging || !elog_open) return;
if (!g_settings->elogging || !elog_open) return;
#ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY, 0x8000)) return;

View File

@ -51,6 +51,8 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Gfx_1.3.h" />
<ClInclude Include="Settings.h" />
<ClInclude Include="trace.h" />
<ClInclude Include="turbo3D.h" />
<ClInclude Include="ucode.h" />
<ClInclude Include="ucode00.h" />
@ -97,6 +99,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="CRC.cpp" />
<ClCompile Include="Settings.cpp" />
<ClCompile Include="TexCache.cpp" />
<ClCompile Include="Config.cpp" />
<ClCompile Include="3dmath.cpp" />
@ -109,6 +112,7 @@
<ClCompile Include="Main.cpp" />
<ClCompile Include="rdp.cpp" />
<ClCompile Include="TexBuffer.cpp" />
<ClCompile Include="trace.cpp" />
<ClCompile Include="Util.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -128,6 +128,8 @@
<ClInclude Include="Util.h" />
<ClInclude Include="Version.h" />
<ClInclude Include="Gfx_1.3.h" />
<ClInclude Include="trace.h" />
<ClInclude Include="Settings.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CRC.cpp">
@ -150,6 +152,8 @@
<ClCompile Include="rdp.cpp" />
<ClCompile Include="TexBuffer.cpp" />
<ClCompile Include="Util.cpp" />
<ClCompile Include="trace.cpp" />
<ClCompile Include="Settings.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="gpl.txt">

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
#include "Gfx_1.3.h"
CSettings::CSettings() :
card_id(0),
res_x(640),
scr_res_x(640),
res_y(480),
scr_res_y(480),
res_data(GR_RESOLUTION_640x480),
res_data_org(GR_RESOLUTION_640x480),
advanced_options(0),
texenh_options(0),
ssformat(0),
vsync(0),
show_fps(0),
clock(0),
clock_24_hr(0),
filtering(0),
fog(0),
buff_clear(0),
swapmode(0),
lodmode(0),
aspectmode(0),
use_hotkeys(0),
#ifdef TEXTURE_FILTER
//Texture filtering options
texture_dir(""),
ghq_fltr(0),
ghq_enht(0),
ghq_cmpr(0),
ghq_hirs(0),
ghq_use(0),
ghq_enht_cmpr(0),
ghq_enht_tile(0),
ghq_enht_f16bpp(0),
ghq_enht_gz(0),
ghq_enht_nobg(0),
ghq_hirs_cmpr(0),
ghq_hirs_tile(0),
ghq_hirs_f16bpp(0),
ghq_hirs_gz(0),
ghq_hirs_altcrc(0),
ghq_cache_save(0),
ghq_cache_size(0),
ghq_hirs_let_texartists_fly(0),
ghq_hirs_dump(0),
#endif
autodetect_ucode(0),
ucode(0),
logging(0),
elogging(0),
log_clear(0),
run_in_window(0),
filter_cache(0),
unk_as_red(0),
log_unk(0),
unk_clear(0),
wireframe(0),
wfmode(0),
// Special fixes
offset_x(0),
offset_y(0),
scale_x(0),
scale_y(0),
fast_crc(0),
alt_tex_size(0),
use_sts1_only(0),
flame_corona(0), //hack for zeldas flame's corona
increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect
decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect
texture_correction(0), // enable perspective texture correction emulation. is on by default
stipple_mode(0), //used for dithered alpha emulation
stipple_pattern(0), //used for dithered alpha emulation
force_microcheck(0), //check microcode each frame, for mixed F3DEX-S2DEX games
force_quad3d(0), //force 0xb5 command to be quad, not line 3d
clip_zmin(0), //enable near z clipping
clip_zmax(0), //enable far plane clipping;
adjust_aspect(0), //adjust screen aspect for wide screen mode
force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64
pal230(0), //set special scale for PAL games
correct_viewport(0), //correct viewport values
zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode
n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does.
hacks(0),
//wrapper settings
wrpResolution(0),
wrpVRAM(0),
wrpFBO(0),
wrpAnisotropic(0)
{
}

161
Source/Glide64/Settings.h Normal file
View File

@ -0,0 +1,161 @@
#pragma once
class CSettings
{
public:
CSettings();
int card_id;
uint32_t res_x, scr_res_x;
uint32_t res_y, scr_res_y;
uint32_t res_data, res_data_org;
int advanced_options;
int texenh_options;
int ssformat;
int vsync;
int show_fps;
int clock;
int clock_24_hr;
int filtering;
int fog;
int buff_clear;
int swapmode;
int lodmode;
int aspectmode;
int use_hotkeys;
//Frame buffer emulation options
#define fb_emulation (1<<0) //frame buffer emulation
#define fb_hwfbe (1<<1) //hardware frame buffer emualtion
#define fb_motionblur (1<<2) //emulate motion blur
#define fb_ref (1<<3) //read every frame
#define fb_read_alpha (1<<4) //read alpha
#define fb_hwfbe_buf_clear (1<<5) //clear auxiliary texture frame buffers
#define fb_depth_render (1<<6) //enable software depth render
#define fb_optimize_texrect (1<<7) //fast texrect rendering with hwfbe
#define fb_ignore_aux_copy (1<<8) //do not copy auxiliary frame buffers
#define fb_useless_is_useless (1<<10) //
#define fb_get_info (1<<11) //get frame buffer info
#define fb_read_back_to_screen (1<<12) //render N64 frame buffer to screen
#define fb_read_back_to_screen2 (1<<13) //render N64 frame buffer to screen
#define fb_cpu_write_hack (1<<14) //show images writed directly by CPU
#define fb_emulation_enabled ((g_settings->frame_buffer&fb_emulation)>0)
#define fb_hwfbe_enabled ((g_settings->frame_buffer&(fb_emulation|fb_hwfbe))==(fb_emulation|fb_hwfbe))
#define fb_depth_render_enabled ((g_settings->frame_buffer&fb_depth_render)>0)
uint32_t frame_buffer;
enum FBCRCMODE
{
fbcrcNone = 0,
fbcrcFast = 1,
fbcrcSafe = 2
} fb_crc_mode;
#ifdef TEXTURE_FILTER
//Texture filtering options
std::string texture_dir;
int ghq_fltr;
int ghq_enht;
int ghq_cmpr;
int ghq_hirs;
int ghq_use;
int ghq_enht_cmpr;
int ghq_enht_tile;
int ghq_enht_f16bpp;
int ghq_enht_gz;
int ghq_enht_nobg;
int ghq_hirs_cmpr;
int ghq_hirs_tile;
int ghq_hirs_f16bpp;
int ghq_hirs_gz;
int ghq_hirs_altcrc;
int ghq_cache_save;
int ghq_cache_size;
int ghq_hirs_let_texartists_fly;
int ghq_hirs_dump;
#endif
//Debug
int autodetect_ucode;
int ucode;
int logging;
int elogging;
int log_clear;
int run_in_window;
int filter_cache;
int unk_as_red;
int log_unk;
int unk_clear;
int wireframe;
int wfmode;
// Special fixes
int offset_x, offset_y;
int scale_x, scale_y;
int fast_crc;
int alt_tex_size;
int use_sts1_only;
int flame_corona; //hack for zeldas flame's corona
int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect
int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect
int texture_correction; // enable perspective texture correction emulation. is on by default
int stipple_mode; //used for dithered alpha emulation
uint32_t stipple_pattern; //used for dithered alpha emulation
int force_microcheck; //check microcode each frame, for mixed F3DEX-S2DEX games
int force_quad3d; //force 0xb5 command to be quad, not line 3d
int clip_zmin; //enable near z clipping
int clip_zmax; //enable far plane clipping;
int adjust_aspect; //adjust screen aspect for wide screen mode
int force_calc_sphere; //use spheric mapping only, Ridge Racer 64
int pal230; //set special scale for PAL games
int correct_viewport; //correct viewport values
int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
int old_style_adither; //apply alpha dither regardless of alpha_dither_mode
int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does.
//Special game hacks
#define hack_ASB (1<<0) //All-Star Baseball games
#define hack_Banjo2 (1<<1) //Banjo Tooie
#define hack_BAR (1<<2) //Beetle Adventure Racing
#define hack_Chopper (1<<3) //Chopper Attack
#define hack_Diddy (1<<4) //diddy kong racing
#define hack_Fifa98 (1<<5) //FIFA - Road to World Cup 98
#define hack_Fzero (1<<6) //F-Zero
#define hack_GoldenEye (1<<7) //Golden Eye
#define hack_Hyperbike (1<<8) //Top Gear Hyper Bike
#define hack_ISS64 (1<<9) //International Superstar Soccer 64
#define hack_KI (1<<10) //Killer Instinct
#define hack_Knockout (1<<11) //Knockout Kings 2000
#define hack_Lego (1<<12) //LEGO Racers
#define hack_MK64 (1<<13) //Mario Kart
#define hack_Megaman (1<<14) //Megaman64
#define hack_Makers (1<<15) //Mischief-makers
#define hack_WCWnitro (1<<16) //WCW Nitro
#define hack_Ogre64 (1<<17) //Ogre Battle 64
#define hack_Pilotwings (1<<18) //Pilotwings
#define hack_PMario (1<<19) //Paper Mario
#define hack_PPL (1<<20) //pokemon puzzle league requires many special fixes
#define hack_RE2 (1<<21) //Resident Evil 2
#define hack_Starcraft (1<<22) //StarCraft64
#define hack_Supercross (1<<23) //Supercross 2000
#define hack_TGR (1<<24) //Top Gear Rally
#define hack_TGR2 (1<<25) //Top Gear Rally 2
#define hack_Tonic (1<<26) //tonic trouble
#define hack_Yoshi (1<<27) //Yoshi Story
#define hack_Zelda (1<<28) //zeldas hacks
#define hack_OoT (1<<29) //zelda OoT hacks
uint32_t hacks;
//wrapper settings
int wrpResolution;
int wrpVRAM;
int wrpFBO;
int wrpAnisotropic;
};
extern CSettings * g_settings;

View File

@ -56,7 +56,7 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
texbuf.height = cimage.height;
texbuf.format = cimage.format;
texbuf.size = cimage.size;
texbuf.scr_width = minval(cimage.width * rdp.scale_x, settings.scr_res_x);
texbuf.scr_width = minval(cimage.width * rdp.scale_x, g_settings->scr_res_x);
float height = minval(rdp.vi_height, cimage.height);
if (cimage.status == ci_copy_self || (cimage.status == ci_copy && cimage.width == rdp.frame_buffers[rdp.main_ci_index].width))
height = rdp.vi_height;
@ -215,7 +215,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
int found = FALSE, search = TRUE;
TBUFF_COLOR_IMAGE *texbuf = 0;
uint32_t addr = cimage.addr;
if ((settings.hacks&hack_Banjo2) && cimage.status == ci_copy_self)
if ((g_settings->hacks&hack_Banjo2) && cimage.status == ci_copy_self)
addr = rdp.frame_buffers[rdp.copy_ci_index].addr;
uint32_t end_addr = addr + ((cimage.width*cimage.height) << cimage.size >> 1);
if (rdp.motionblur)
@ -226,7 +226,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
}
if (rdp.read_whole_frame)
{
if (settings.hacks&hack_PMario) //motion blur effects in Paper Mario
if (g_settings->hacks&hack_PMario) //motion blur effects in Paper Mario
{
rdp.cur_tex_buf = rdp.acc_tex_buf;
FRDP("\nread_whole_frame. last allocated bank: %d\n", rdp.acc_tex_buf);
@ -326,7 +326,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
grTextureBufferExt(rdp.cur_image->tmu, rdp.cur_image->tex_addr, rdp.cur_image->info.smallLodLog2, rdp.cur_image->info.largeLodLog2,
rdp.cur_image->info.aspectRatioLog2, rdp.cur_image->info.format, GR_MIPMAPLEVELMASK_BOTH);
///*
if (rdp.cur_image->clear && (settings.frame_buffer&fb_hwfbe_buf_clear) && cimage.changed)
if (rdp.cur_image->clear && (g_settings->frame_buffer&fb_hwfbe_buf_clear) && cimage.changed)
{
rdp.cur_image->clear = FALSE;
grDepthMask(FXFALSE);
@ -368,7 +368,7 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
GR_BLEND_ZERO,
GR_BLEND_ONE,
GR_BLEND_ZERO);
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
grClipWindow(0, 0, g_settings->scr_res_x, g_settings->scr_res_y);
grDepthBufferFunction(GR_CMP_ALWAYS);
grDepthMask(FXFALSE);
grCullMode(GR_CULL_DISABLE);
@ -456,11 +456,11 @@ int CloseTextureBuffer(int draw)
};
grTexSource(rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info));
grClipWindow(0, 0, settings.res_x, settings.res_y);
grClipWindow(0, 0, g_settings->res_x, g_settings->res_y);
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (settings.fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -518,14 +518,14 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
rdp.offset_y = rdp.offset_y_bak;
rdp.offset_x_bak = rdp.offset_y_bak = 0;
AddOffset(v, 4);
grClipWindow(0, 0, settings.res_x, settings.res_y);
grClipWindow(0, 0, g_settings->res_x, g_settings->res_y);
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
rdp.tbuff_tex->info.format = buf_format;
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
if (settings.fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
LRDP("CopyTextureBuffer draw, OK\n");
rdp.tbuff_tex = 0;
@ -538,7 +538,7 @@ int CopyDepthBuffer()
LRDP("CopyDepthBuffer. ");
float bound = 1024.0f;
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (settings.scr_res_x > 1024)
if (g_settings->scr_res_x > 1024)
{
bound = 2048.0f;
LOD = GR_LOD_LOG2_2048;
@ -579,7 +579,7 @@ int CopyDepthBuffer()
grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (settings.fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
LRDP("CopyDepthBuffer draw, OK\n");
rdp.tbuff_tex = 0;
@ -653,7 +653,7 @@ int SwapTextureBuffer()
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (settings.fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -664,11 +664,11 @@ int SwapTextureBuffer()
static uint32_t CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
{
uint32_t result = 0;
if ((settings.frame_buffer&fb_ref) > 0)
if ((g_settings->frame_buffer&fb_ref) > 0)
pTCI->crc = 0; //Since fb content changes each frame, crc check is meaningless.
else if (settings.fb_crc_mode == SETTINGS::fbcrcFast)
else if (g_settings->fb_crc_mode == CSettings::fbcrcFast)
result = *((uint32_t*)(gfx.RDRAM + pTCI->addr + (pTCI->end_addr - pTCI->addr) / 2));
else if (settings.fb_crc_mode == SETTINGS::fbcrcSafe)
else if (g_settings->fb_crc_mode == CSettings::fbcrcSafe)
{
uint8_t * pSrc = gfx.RDRAM + pTCI->addr;
const uint32_t nSize = pTCI->end_addr - pTCI->addr;

View File

@ -205,7 +205,7 @@ void GetTexInfo(int id, int tile)
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 (settings.alt_tex_size)
if (g_settings->alt_tex_size)
{
// ** ALTERNATE TEXTURE SIZE METHOD **
// Helps speed in some games that loaded weird-sized textures, but could break other
@ -358,7 +358,7 @@ void GetTexInfo(int id, int tile)
if (rdp.tiles[tile].size == 3)
line <<= 1;
uint32_t crc = 0;
if (settings.fast_crc)
if (g_settings->fast_crc)
{
line = (line - wid_64) << 3;
if (wid_64 < 1) wid_64 = 1;
@ -530,7 +530,7 @@ void TexCache()
LRDP(" |-+ TexCache called\n");
#ifdef TEXTURE_FILTER /* Hiroshi Morii <koolsmoky@users.sourceforge.net> */ // POSTNAPALM
if (settings.ghq_use && settings.ghq_hirs_dump) {
if (g_settings->ghq_use && g_settings->ghq_hirs_dump) {
/* Force reload hi-res textures. Useful for texture artists */
if (CheckKeyPressed(G64_VK_R, 0x0001)) {
if (ext_ghq_reloadhirestex()) ClearCache();
@ -900,14 +900,14 @@ void TexCache()
int tile = rdp.cur_tile + i;
if (settings.filtering == 0)
if (g_settings->filtering == 0)
{
int filter = (rdp.filter_mode != 2) ? GR_TEXTUREFILTER_POINT_SAMPLED : GR_TEXTUREFILTER_BILINEAR;
grTexFilterMode(tmu, filter, filter);
}
else
{
int filter = (settings.filtering == 1) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
int filter = (g_settings->filtering == 1) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
grTexFilterMode(tmu, filter, filter);
}
@ -1035,7 +1035,7 @@ void LoadTex(int id, int tmu)
//!Hackalert
//GoldenEye water texture. It has CI format in fact, but the game set it to RGBA
if ((settings.hacks&hack_GoldenEye) && rdp.tiles[td].format == 0 && rdp.tlut_mode == 2 && rdp.tiles[td].size == 2)
if ((g_settings->hacks&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;
@ -1293,7 +1293,7 @@ void LoadTex(int id, int tmu)
GHQTexInfo ghqTexInfo;
memset(&ghqTexInfo, 0, sizeof(GHQTexInfo));
uint32_t g64_crc = cache->crc;
if (settings.ghq_use)
if (g_settings->ghq_use)
{
int bpl;
uint8_t* addr = (uint8_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[td].t_mem]);
@ -1335,7 +1335,7 @@ void LoadTex(int id, int tmu)
{
if (rdp.tiles[td].size == 1)
paladdr = (uint8_t*)(rdp.pal_8_rice);
else if (settings.ghq_hirs_altcrc)
else if (g_settings->ghq_hirs_altcrc)
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));
@ -1623,7 +1623,7 @@ void LoadTex(int id, int tmu)
if (GfxInitDone)
{
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
if (settings.ghq_use)
if (g_settings->ghq_use)
{
if (!ghqTexInfo.data && ghq_dmptex_toggle_key) {
unsigned char *tmpbuf = (unsigned char*)texture;
@ -1661,7 +1661,7 @@ void LoadTex(int id, int tmu)
}
if (!ghqTexInfo.data)
if (!settings.ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
if (!g_settings->ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo);
if (ghqTexInfo.data)

View File

View File

@ -311,7 +311,7 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
// Calculate deltaZ per polygon for Decal z-mode
double fdzdy = (diffz_02 * diffx_12 - diffz_12 * diffx_02) / denom;
double fdz = fabs(fdzdx) + fabs(fdzdy);
if ((settings.hacks & hack_Zelda) && (rdp.rm & 0x800))
if ((g_settings->hacks & hack_Zelda) && (rdp.rm & 0x800))
fdz *= 4.0; // Decal mode in Zelda sometimes needs mutiplied deltaZ to work correct, e.g. roads
deltaZ = maxval(8, (int)fdz);
}
@ -403,7 +403,7 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
{
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 || (settings.hacks&hack_Megaman))
if (rdp.aTBuffTex[0]->tile_ult != (int)rdp.tiles[rdp.cur_tile].f_ul_t || (g_settings->hacks&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;
@ -814,9 +814,9 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th
rdp.clip = 0;
else
{
if (!settings.clip_zmin)
if (!g_settings->clip_zmin)
rdp.clip &= ~CLIP_ZMIN;
if (!settings.clip_zmax)
if (!g_settings->clip_zmax)
rdp.clip &= ~CLIP_ZMAX;
}
render_tri(linew, old_interpolate);
@ -979,7 +979,7 @@ static void CalculateLOD(VERTEX *v, int n)
double intptr;
float s_scale = rdp.tiles[rdp.cur_tile].width / 255.0f;
float t_scale = rdp.tiles[rdp.cur_tile].height / 255.0f;
if (settings.lodmode == 1)
if (g_settings->lodmode == 1)
{
deltaS = (v[1].u0 / v[1].q - v[0].u0 / v[0].q) * s_scale;
deltaT = (v[1].v0 / v[1].q - v[0].v0 / v[0].q) * t_scale;
@ -1033,7 +1033,7 @@ static void CalculateLOD(VERTEX *v, int n)
float ScaleZ(float z)
{
if (settings.n64_z_scale)
if (g_settings->n64_z_scale)
{
int iz = (int)(z*8.0f + 0.5f);
if (iz < 0) iz = 0;
@ -1048,7 +1048,7 @@ float ScaleZ(float z)
static void DepthBuffer(VERTEX * vtx, int n)
{
if (fb_depth_render_enabled && !(settings.hacks&hack_RE2) && dzdx && (rdp.flags & ZBUF_UPDATE))
if (fb_depth_render_enabled && !(g_settings->hacks&hack_RE2) && dzdx && (rdp.flags & ZBUF_UPDATE))
{
vertexi v[12];
if (u_cull_mode == 1) //cull front
@ -1608,7 +1608,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
}
}
if (settings.lodmode > 0 && rdp.cur_tile < rdp.mipmap_level)
if (g_settings->lodmode > 0 && rdp.cur_tile < rdp.mipmap_level)
CalculateLOD(rdp.vtxbuf, n);
cmb.cmb_ext_use = cmb.tex_cmb_ext_use = 0;
@ -1622,7 +1622,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
}
}
*/
if (settings.wireframe)
if (g_settings->wireframe)
{
SetWireframeCol();
for (i = 0; i < n; i++)
@ -1637,7 +1637,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
// VERTEX ** pv = rdp.vtx_buffer?(vtx_list2):(vtx_list1);
// for (int k = 0; k < n; k ++)
// FRDP ("DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f\n", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
// pv[k]->y = settings.res_y - pv[k]->y;
// pv[k]->y = g_settings->res_y - pv[k]->y;
if (linew > 0)
{
@ -1784,10 +1784,10 @@ void update_scissor()
rdp.update ^= UPDATE_SCISSOR;
// KILL the floating point error with 0.01f
rdp.scissor.ul_x = (uint32_t)maxval(minval((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f), settings.res_x), 0);
rdp.scissor.lr_x = (uint32_t)maxval(minval((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), settings.res_x), 0);
rdp.scissor.ul_y = (uint32_t)maxval(minval((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), settings.res_y), 0);
rdp.scissor.lr_y = (uint32_t)maxval(minval((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), settings.res_y), 0);
rdp.scissor.ul_x = (uint32_t)maxval(minval((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x), 0);
rdp.scissor.lr_x = (uint32_t)maxval(minval((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x), 0);
rdp.scissor.ul_y = (uint32_t)maxval(minval((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y), 0);
rdp.scissor.lr_y = (uint32_t)maxval(minval((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y), 0);
//grClipWindow specifies the hardware clipping window. Any pixels outside the clipping window are rejected.
//Values are inclusive for minimum x and y values and exclusive for maximum x and y values.
// grClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y);
@ -1920,14 +1920,14 @@ void update()
switch ((rdp.rm & 0xC00) >> 10) {
case 0:
grDepthBiasLevel(0);
grDepthBufferFunction(settings.zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
break;
case 1:
grDepthBiasLevel(-4);
grDepthBufferFunction(settings.zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
break;
case 2:
grDepthBiasLevel(settings.ucode == 7 ? -4 : 0);
grDepthBiasLevel(g_settings->ucode == 7 ? -4 : 0);
grDepthBufferFunction(GR_CMP_LESS);
break;
case 3:
@ -2006,9 +2006,9 @@ void update()
{
if (grStippleModeExt != 0)
{
if (settings.old_style_adither || rdp.alpha_dither_mode != 3) {
if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) {
LRDP(" |- alpha compare: dither\n");
grStippleModeExt(settings.stipple_mode);
grStippleModeExt(g_settings->stipple_mode);
}
else
grStippleModeExt(GR_STIPPLE_DISABLE);
@ -2047,7 +2047,7 @@ void update()
}
//Added by Gonetz.
if (settings.fog && (rdp.update & UPDATE_FOG_ENABLED))
if (g_settings->fog && (rdp.update & UPDATE_FOG_ENABLED))
{
rdp.update ^= UPDATE_FOG_ENABLED;
@ -2099,8 +2099,8 @@ void update()
rdp.clip_min_x = maxval((rdp.view_trans[0] - scale_x + rdp.offset_x) / rdp.clip_ratio, 0.0f);
rdp.clip_min_y = maxval((rdp.view_trans[1] - scale_y + rdp.offset_y) / rdp.clip_ratio, 0.0f);
rdp.clip_max_x = minval((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, settings.res_x);
rdp.clip_max_y = minval((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, settings.res_y);
rdp.clip_max_x = minval((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, g_settings->res_x);
rdp.clip_max_y = minval((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, g_settings->res_y);
FRDP(" |- viewport - (%d, %d, %d, %d)\n", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
if (!rdp.scissor_set)
@ -2133,7 +2133,7 @@ void set_message_combiner()
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
if (settings.buff_clear && (settings.show_fps & 0x08))
if (g_settings->buff_clear && (g_settings->show_fps & 0x08))
grAlphaBlendFunction(GR_BLEND_SRC_ALPHA,
GR_BLEND_ONE_MINUS_SRC_ALPHA,
GR_BLEND_ZERO,

View File

@ -254,7 +254,7 @@ void RDP::Reset()
maincimg[0].addr = maincimg[1].addr = last_drawn_ci_addr = 0x7FFFFFFF;
hotkey_info.hk_ref = 90;
hotkey_info.hk_motionblur = (settings.buff_clear == 0) ? 0 : 90;
hotkey_info.hk_motionblur = (g_settings->buff_clear == 0) ? 0 : 90;
hotkey_info.hk_filtering = hotkey_info.hk_motionblur;
CheckKeyPressed(G64_VK_BACK, 1); //BACK
@ -334,7 +334,7 @@ void microcheck()
if (uc == -2 && ucode_error_report)
{
settings.ucode = GetSetting(Set_ucode);
g_settings->ucode = GetSetting(Set_ucode);
ReleaseGfx();
#ifdef _WIN32
@ -345,7 +345,7 @@ void microcheck()
}
else if (uc == -1 && ucode_error_report)
{
settings.ucode = GetSetting(Set_ucode);
g_settings->ucode = GetSetting(Set_ucode);
ReleaseGfx();
#ifdef _WIN32
@ -356,15 +356,15 @@ void microcheck()
}
else
{
old_ucode = settings.ucode;
settings.ucode = uc;
old_ucode = g_settings->ucode;
g_settings->ucode = uc;
FRDP("microcheck: old ucode: %d, new ucode: %d\n", old_ucode, uc);
if (uc_crc == 0x8d5735b2 || uc_crc == 0xb1821ed3 || uc_crc == 0x1118b3e0) //F3DLP.Rej ucode. perspective texture correction is not implemented
{
rdp.Persp_en = 1;
rdp.persp_supported = FALSE;
}
else if (settings.texture_correction)
else if (g_settings->texture_correction)
{
rdp.persp_supported = TRUE;
}
@ -424,7 +424,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
uint32_t width = rdp.ci_width;//*gfx.VI_WIDTH_REG;
uint32_t height;
if (fb_emulation_enabled && !(settings.hacks&hack_PPL))
if (fb_emulation_enabled && !(g_settings->hacks&hack_PPL))
{
int ind = (rdp.ci_count > 0) ? rdp.ci_count - 1 : 0;
height = rdp.frame_buffers[ind].height;
@ -432,7 +432,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
else
{
height = rdp.ci_lower_bound;
if (settings.hacks&hack_PPL)
if (g_settings->hacks&hack_PPL)
height -= rdp.ci_upper_bound;
}
FRDP("width: %d, height: %d... ", width, height);
@ -457,7 +457,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
for (uint32_t x = 0; x < width; x++)
{
c = ptr_src[x + y * width];
if (settings.frame_buffer&fb_read_alpha)
if (g_settings->frame_buffer&fb_read_alpha)
{
if (c > 0)
c = (c & 0xFFC0) | ((c & 0x001F) << 1) | 1;
@ -488,8 +488,8 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
}
else
{
float scale_x = (settings.scr_res_x - rdp.offset_x*2.0f) / maxval(width, rdp.vi_width);
float scale_y = (settings.scr_res_y - rdp.offset_y*2.0f) / maxval(height, rdp.vi_height);
float scale_x = (g_settings->scr_res_x - rdp.offset_x*2.0f) / maxval(width, rdp.vi_width);
float scale_y = (g_settings->scr_res_y - rdp.offset_y*2.0f) / maxval(height, rdp.vi_height);
FRDP("width: %d, height: %d, ul_y: %d, lr_y: %d, scale_x: %f, scale_y: %f, ci_width: %d, ci_height: %d\n", width, height, rdp.ci_upper_bound, rdp.ci_lower_bound, scale_x, scale_y, rdp.ci_width, rdp.ci_height);
GrLfbInfo_t info;
@ -508,11 +508,11 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
uint16_t c;
uint32_t stride = info.strideInBytes >> 1;
int read_alpha = settings.frame_buffer & fb_read_alpha;
if ((settings.hacks&hack_PMario) && rdp.frame_buffers[rdp.ci_count - 1].status != ci_aux)
int read_alpha = g_settings->frame_buffer & fb_read_alpha;
if ((g_settings->hacks&hack_PMario) && rdp.frame_buffers[rdp.ci_count - 1].status != ci_aux)
read_alpha = FALSE;
int x_start = 0, y_start = 0, x_end = width, y_end = height;
if (settings.hacks&hack_BAR)
if (g_settings->hacks&hack_BAR)
{
x_start = 80, y_start = 24, x_end = 240, y_end = 86;
}
@ -599,7 +599,7 @@ EXPORT void CALL ProcessDList(void)
if (reset)
{
reset = 0;
if (settings.autodetect_ucode)
if (g_settings->autodetect_ucode)
{
// Thanks to ZeZu for ucode autodetection!!!
uint32_t startUcode = *(uint32_t*)(gfx.DMEM + 0xFD0);
@ -609,7 +609,7 @@ EXPORT void CALL ProcessDList(void)
else
memset(microcode, 0, 4096);
}
else if (((old_ucode == ucode_S2DEX) && (settings.ucode == ucode_F3DEX)) || settings.force_microcheck)
else if (((old_ucode == ucode_S2DEX) && (g_settings->ucode == ucode_F3DEX)) || g_settings->force_microcheck)
{
uint32_t startUcode = *(uint32_t*)(gfx.DMEM + 0xFD0);
memcpy(microcode, gfx.RDRAM + startUcode, 4096);
@ -625,7 +625,7 @@ EXPORT void CALL ProcessDList(void)
// Clear out the RDP log
#ifdef RDP_LOGGING
if (settings.logging && settings.log_clear)
if (g_settings->logging && g_settings->log_clear)
{
CLOSE_RDP_LOG();
OPEN_RDP_LOG();
@ -633,7 +633,7 @@ EXPORT void CALL ProcessDList(void)
#endif
#ifdef UNIMP_LOG
if (settings.log_unk && settings.unk_clear)
if (g_settings->log_unk && g_settings->unk_clear)
{
std::ofstream unimp;
unimp.open("unimp.txt");
@ -642,7 +642,7 @@ EXPORT void CALL ProcessDList(void)
#endif
//* Set states *//
if (settings.swapmode > 0)
if (g_settings->swapmode > 0)
SwapOK = TRUE;
rdp.updatescreen = 1;
@ -683,15 +683,15 @@ EXPORT void CALL ProcessDList(void)
//analize possible frame buffer usage
if (fb_emulation_enabled)
DetectFrameBufferUsage();
if (!(settings.hacks&hack_Lego) || rdp.num_of_ci > 1)
if (!(g_settings->hacks&hack_Lego) || rdp.num_of_ci > 1)
rdp.last_bg = 0;
//* End of set states *//
// Get the start of the display list and the length of it
uint32_t dlist_start = *(uint32_t*)(gfx.DMEM + 0xFF0);
uint32_t dlist_length = *(uint32_t*)(gfx.DMEM + 0xFF4);
FRDP("--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx, fbuf_width: %d, dlist start: %08lx, dlist_length: %d, x_scale: %f, y_scale: %f\n", uc_crc, settings.ucode, *gfx.VI_ORIGIN_REG, *gfx.VI_WIDTH_REG, dlist_start, dlist_length, (*gfx.VI_X_SCALE_REG & 0xFFF) / 1024.0f, (*gfx.VI_Y_SCALE_REG & 0xFFF) / 1024.0f);
FRDP_E("--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx\n", uc_crc, settings.ucode, *gfx.VI_ORIGIN_REG);
FRDP("--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx, fbuf_width: %d, dlist start: %08lx, dlist_length: %d, x_scale: %f, y_scale: %f\n", uc_crc, g_settings->ucode, *gfx.VI_ORIGIN_REG, *gfx.VI_WIDTH_REG, dlist_start, dlist_length, (*gfx.VI_X_SCALE_REG & 0xFFF) / 1024.0f, (*gfx.VI_Y_SCALE_REG & 0xFFF) / 1024.0f);
FRDP_E("--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx\n", uc_crc, g_settings->ucode, *gfx.VI_ORIGIN_REG);
// Do nothing if dlist is empty
if (dlist_start == 0)
@ -699,7 +699,7 @@ EXPORT void CALL ProcessDList(void)
if (cpu_fb_write == TRUE)
DrawPartFrameBufferToScreen();
if ((settings.hacks&hack_Tonic) && dlist_length < 16)
if ((g_settings->hacks&hack_Tonic) && dlist_length < 16)
{
rdp_fullsync();
FRDP_E("DLIST is too short!\n");
@ -717,7 +717,7 @@ EXPORT void CALL ProcessDList(void)
#ifdef CATCH_EXCEPTIONS
try {
#endif
if (settings.ucode == ucode_Turbo3d)
if (g_settings->ucode == ucode_Turbo3d)
{
Turbo3D();
}
@ -747,7 +747,7 @@ EXPORT void CALL ProcessDList(void)
perf_cur = wxDateTime::UNow();
#endif
// Process this instruction
gfx_instruction[settings.ucode][rdp.cmd0 >> 24]();
gfx_instruction[g_settings->ucode][rdp.cmd0 >> 24]();
// check DL counter
if (rdp.dl_count != -1)
@ -777,10 +777,10 @@ EXPORT void CALL ProcessDList(void)
ReleaseGfx ();
rdp_reset();
#ifdef TEXTURE_FILTER
if (settings.ghq_use)
if (g_settings->ghq_use)
{
ext_ghq_shutdown();
settings.ghq_use = 0;
g_settings->ghq_use = 0;
}
#endif
}
@ -802,15 +802,15 @@ EXPORT void CALL ProcessDList(void)
rdp.scale_y = rdp.scale_y_bak;
}
if (settings.hacks & hack_OoT)
if (g_settings->hacks & hack_OoT)
copyWhiteToRDRAM(); //Subscreen delay fix
else if (settings.frame_buffer & fb_ref)
else if (g_settings->frame_buffer & fb_ref)
CopyFrameBuffer();
if (rdp.cur_image)
CloseTextureBuffer(rdp.read_whole_frame && ((settings.hacks&hack_PMario) || rdp.swap_ci_index >= 0));
CloseTextureBuffer(rdp.read_whole_frame && ((g_settings->hacks&hack_PMario) || rdp.swap_ci_index >= 0));
if ((settings.hacks&hack_TGR2) && rdp.vi_org_reg != *gfx.VI_ORIGIN_REG && CI_SET)
if ((g_settings->hacks&hack_TGR2) && rdp.vi_org_reg != *gfx.VI_ORIGIN_REG && CI_SET)
{
newSwapBuffers();
CI_SET = FALSE;
@ -946,7 +946,7 @@ static void rdp_texrect()
else
{
//gDPTextureRectangle
if (settings.hacks&hack_ASB)
if (g_settings->hacks&hack_ASB)
rdp.cmd2 = 0;
else
rdp.cmd2 = ((uint32_t*)gfx.RDRAM)[a + 0];
@ -954,7 +954,7 @@ static void rdp_texrect()
rdp.pc[rdp.pc_i] += 8;
}
}
if ((settings.hacks&hack_Yoshi) && settings.ucode == ucode_S2DEX)
if ((g_settings->hacks&hack_Yoshi) && g_settings->ucode == ucode_S2DEX)
{
ys_memrect();
return;
@ -962,7 +962,7 @@ static void rdp_texrect()
if (rdp.skip_drawing || (!fb_emulation_enabled && (rdp.cimg == rdp.zimg)))
{
if ((settings.hacks&hack_PMario) && rdp.ci_status == ci_useless)
if ((g_settings->hacks&hack_PMario) && rdp.ci_status == ci_useless)
{
pm_palette_mod();
}
@ -973,7 +973,7 @@ static void rdp_texrect()
return;
}
if ((settings.ucode == ucode_CBFD) && rdp.cur_image && rdp.cur_image->format)
if ((g_settings->ucode == ucode_CBFD) && rdp.cur_image && rdp.cur_image->format)
{
//FRDP("Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx\n", rdp.timg.addr, rdp.maincimg[1].addr, rdp.maincimg[1].addr+rdp.ci_width*rdp.ci_height*rdp.ci_size);
LRDP("Shadow texrect is skipped.\n");
@ -981,7 +981,7 @@ static void rdp_texrect()
return;
}
if ((settings.ucode == ucode_PerfectDark) && rdp.ci_count > 0 && (rdp.frame_buffers[rdp.ci_count - 1].status == ci_zcopy))
if ((g_settings->ucode == ucode_PerfectDark) && rdp.ci_count > 0 && (rdp.frame_buffers[rdp.ci_count - 1].status == ci_zcopy))
{
pd_zcopy();
LRDP("Depth buffer copied.\n");
@ -993,7 +993,7 @@ static void rdp_texrect()
{
if (!depth_buffer_fog)
return;
if (settings.fog)
if (g_settings->fog)
DrawDepthBufferFog();
depth_buffer_fog = FALSE;
return;
@ -1031,7 +1031,7 @@ static void rdp_texrect()
else if (lr_y - ul_y < 1.0f)
lr_y = ceil(lr_y);
if (settings.increase_texrect_edge)
if (g_settings->increase_texrect_edge)
{
if (floor(lr_x) != lr_x)
lr_x = ceil(lr_x);
@ -1040,7 +1040,7 @@ static void rdp_texrect()
}
//*
if (rdp.tbuff_tex && (settings.frame_buffer & fb_optimize_texrect))
if (rdp.tbuff_tex && (g_settings->frame_buffer & fb_optimize_texrect))
{
LRDP("Attempt to optimize texrect\n");
if (!rdp.tbuff_tex->drawn)
@ -1070,7 +1070,7 @@ static void rdp_texrect()
/*Gonetz*/
//hack for Zelda MM. it removes black texrects which cover all geometry in "Link meets Zelda" cut scene
if ((settings.hacks&hack_Zelda) && rdp.timg.addr >= rdp.cimg && rdp.timg.addr < rdp.ci_end)
if ((g_settings->hacks&hack_Zelda) && rdp.timg.addr >= rdp.cimg && rdp.timg.addr < rdp.ci_end)
{
FRDP("Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx\n", rdp.cur_cache[0]->addr, rdp.cimg, rdp.cimg + rdp.ci_width*rdp.ci_height * 2);
rdp.tri_n += 2;
@ -1086,7 +1086,7 @@ static void rdp_texrect()
//*/
//*
//remove motion blur in night vision
if ((settings.ucode == ucode_PerfectDark) && (rdp.maincimg[1].addr != rdp.maincimg[0].addr) && (rdp.timg.addr >= rdp.maincimg[1].addr) && (rdp.timg.addr < (rdp.maincimg[1].addr + rdp.ci_width*rdp.ci_height*rdp.ci_size)))
if ((g_settings->ucode == ucode_PerfectDark) && (rdp.maincimg[1].addr != rdp.maincimg[0].addr) && (rdp.timg.addr >= rdp.maincimg[1].addr) && (rdp.timg.addr < (rdp.maincimg[1].addr + rdp.ci_width*rdp.ci_height*rdp.ci_size)))
{
if (fb_emulation_enabled)
if (rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_copy_self)
@ -1441,7 +1441,7 @@ static void rdp_texrect()
ConvertCoordsConvert(vptr, n_vertices);
if (settings.wireframe)
if (g_settings->wireframe)
{
SetWireframeCol();
grDrawLine(&vstd[0], &vstd[2]);
@ -1577,17 +1577,17 @@ static void rdp_setothermode()
#define F3DEX2_SETOTHERMODE(cmd,sft,len,data) { \
rdp.cmd0 = (uint32_t)((cmd<<24) | ((32-(sft)-(len))<<8) | (((len)-1))); \
rdp.cmd1 = (uint32_t)(data); \
gfx_instruction[settings.ucode][cmd] (); \
gfx_instruction[g_settings->ucode][cmd] (); \
}
#define SETOTHERMODE(cmd,sft,len,data) { \
rdp.cmd0 = (uint32_t)((cmd<<24) | ((sft)<<8) | (len)); \
rdp.cmd1 = (uint32_t)data; \
gfx_instruction[settings.ucode][cmd] (); \
gfx_instruction[g_settings->ucode][cmd] (); \
}
LRDP("rdp_setothermode\n");
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_CBFD))
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
{
int cmd0 = rdp.cmd0;
F3DEX2_SETOTHERMODE(0xE2, 0, 32, rdp.cmd1); // SETOTHERMODE_L
@ -1620,7 +1620,7 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count)
#endif
}
#ifdef TEXTURE_FILTER
if (settings.ghq_hirs)
if (g_settings->ghq_hirs)
memcpy((uint8_t*)(rdp.pal_8_rice + start), spal, count << 1);
#endif
start >>= 4;
@ -1693,7 +1693,7 @@ static void rdp_settilesize()
else if (wrong_tile == (int)tile)
wrong_tile = -1;
if (settings.use_sts1_only)
if (g_settings->use_sts1_only)
{
// ** USE FIRST SETTILESIZE ONLY **
// This option helps certain textures while using the 'Alternate texture size method',
@ -2139,7 +2139,7 @@ static void rdp_loadtile()
rdp.tbuff_tex->tile_ult = ul_t;
}
if ((settings.hacks&hack_Tonic) && tile == 7)
if ((g_settings->hacks&hack_Tonic) && tile == 7)
{
rdp.tiles[0].ul_s = ul_s;
rdp.tiles[0].ul_t = ul_t;
@ -2156,7 +2156,7 @@ static void rdp_loadtile()
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);
if (settings.hacks&hack_MK64) {
if (g_settings->hacks&hack_MK64) {
if (info.tile_width % 2)
info.tile_width--;
if (info.tile_height % 2)
@ -2269,11 +2269,11 @@ static void rdp_fillrect()
LRDP("Fillrect. Wrong coordinates. Skipped\n");
return;
}
int pd_multiplayer = (settings.ucode == ucode_PerfectDark) && (rdp.cycle_mode == 3) && (rdp.fill_color == 0xFFFCFFFC);
int pd_multiplayer = (g_settings->ucode == ucode_PerfectDark) && (rdp.cycle_mode == 3) && (rdp.fill_color == 0xFFFCFFFC);
if ((rdp.cimg == rdp.zimg) || (fb_emulation_enabled && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_zimg) || pd_multiplayer)
{
LRDP("Fillrect - cleared the depth buffer\n");
if (!(settings.hacks&hack_Hyperbike) || rdp.ci_width > 64) //do not clear main depth buffer for aux depth buffers
if (!(g_settings->hacks&hack_Hyperbike) || rdp.ci_width > 64) //do not clear main depth buffer for aux depth buffers
{
update_scissor();
grDepthMask(FXTRUE);
@ -2282,7 +2282,7 @@ static void rdp_fillrect()
grColorMask(FXTRUE, FXTRUE);
rdp.update |= UPDATE_ZBUF_ENABLED;
}
//if (settings.frame_buffer&fb_depth_clear)
//if (g_settings->frame_buffer&fb_depth_clear)
{
ul_x = minval(maxval(ul_x, rdp.scissor_o.ul_x), rdp.scissor_o.lr_x);
lr_x = minval(maxval(lr_x, rdp.scissor_o.ul_x), rdp.scissor_o.lr_x);
@ -2332,7 +2332,7 @@ static void rdp_fillrect()
// Update scissor
update_scissor();
if (settings.decrease_fillrect_edge && rdp.cycle_mode == 0)
if (g_settings->decrease_fillrect_edge && rdp.cycle_mode == 0)
{
lr_x--; lr_y--;
}
@ -2350,8 +2350,8 @@ static void rdp_fillrect()
if (s_lr_x < 0) s_lr_x = 0;
if (s_lr_y < 0) s_lr_y = 0;
if ((uint32_t)s_ul_x > settings.res_x) s_ul_x = settings.res_x;
if ((uint32_t)s_ul_y > settings.res_y) s_ul_y = settings.res_y;
if ((uint32_t)s_ul_x > g_settings->res_x) s_ul_x = g_settings->res_x;
if ((uint32_t)s_ul_y > g_settings->res_y) s_ul_y = g_settings->res_y;
FRDP(" - %d, %d, %d, %d\n", s_ul_x, s_ul_y, s_lr_x, s_lr_y);
@ -2370,7 +2370,7 @@ static void rdp_fillrect()
{
uint32_t color = rdp.fill_color;
if ((settings.hacks&hack_PMario) && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_aux)
if ((g_settings->hacks&hack_PMario) && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_aux)
{
//background of auxiliary frame buffers must have zero alpha.
//make it black, set 0 alpha to plack pixels on frame buffer read
@ -2437,7 +2437,7 @@ static void rdp_fillrect()
}
}
if (settings.wireframe)
if (g_settings->wireframe)
{
SetWireframeCol();
grDrawLine(&v[0], &v[2]);
@ -2665,7 +2665,7 @@ static void rdp_setcolorimage()
rdp.scale_y = 1.0f;
}
}
else if (rdp.copy_ci_index && (settings.hacks&hack_PMario)) //tidal wave
else if (rdp.copy_ci_index && (g_settings->hacks&hack_PMario)) //tidal wave
OpenTextureBuffer(rdp.frame_buffers[rdp.main_ci_index]);
}
else if (!rdp.motionblur && fb_hwfbe_enabled && !SwapOK && (rdp.ci_count <= rdp.copy_ci_index))
@ -2697,7 +2697,7 @@ static void rdp_setcolorimage()
break;
case ci_copy:
{
if (!rdp.motionblur || (settings.frame_buffer&fb_motionblur))
if (!rdp.motionblur || (g_settings->frame_buffer&fb_motionblur))
{
if (cur_fb.width == rdp.ci_width)
{
@ -2705,7 +2705,7 @@ static void rdp_setcolorimage()
{
// if (CloseTextureBuffer(TRUE))
//*
if ((settings.hacks&hack_Zelda) && (rdp.frame_buffers[rdp.ci_count + 2].status == ci_aux) && !rdp.fb_drawn) //hack for photo camera in Zelda MM
if ((g_settings->hacks&hack_Zelda) && (rdp.frame_buffers[rdp.ci_count + 2].status == ci_aux) && !rdp.fb_drawn) //hack for photo camera in Zelda MM
{
CopyFrameBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
rdp.fb_drawn = TRUE;
@ -2751,7 +2751,7 @@ static void rdp_setcolorimage()
break;
case ci_old_copy:
{
if (!rdp.motionblur || (settings.frame_buffer&fb_motionblur))
if (!rdp.motionblur || (g_settings->frame_buffer&fb_motionblur))
{
if (cur_fb.width == rdp.ci_width)
{
@ -2804,12 +2804,12 @@ static void rdp_setcolorimage()
}
break;
case ci_zimg:
if (settings.ucode != ucode_PerfectDark)
if (g_settings->ucode != ucode_PerfectDark)
{
if (fb_hwfbe_enabled && !rdp.copy_ci_index && (rdp.copy_zi_index || (settings.hacks&hack_BAR)))
if (fb_hwfbe_enabled && !rdp.copy_ci_index && (rdp.copy_zi_index || (g_settings->hacks&hack_BAR)))
{
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (settings.scr_res_x > 1024)
if (g_settings->scr_res_x > 1024)
LOD = GR_LOD_LOG2_2048;
grTextureAuxBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD,
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
@ -2820,7 +2820,7 @@ static void rdp_setcolorimage()
rdp.skip_drawing = TRUE;
break;
case ci_zcopy:
if (settings.ucode != ucode_PerfectDark)
if (g_settings->ucode != ucode_PerfectDark)
{
if (fb_hwfbe_enabled && !rdp.copy_ci_index && rdp.copy_zi_index == rdp.ci_count)
{
@ -2833,7 +2833,7 @@ static void rdp_setcolorimage()
rdp.skip_drawing = TRUE;
break;
case ci_copy_self:
if (fb_hwfbe_enabled && (rdp.ci_count <= rdp.copy_ci_index) && (!SwapOK || settings.swapmode == 2))
if (fb_hwfbe_enabled && (rdp.ci_count <= rdp.copy_ci_index) && (!SwapOK || g_settings->swapmode == 2))
OpenTextureBuffer(cur_fb);
rdp.skip_drawing = FALSE;
break;
@ -2845,7 +2845,7 @@ static void rdp_setcolorimage()
{
if (!fb_hwfbe_enabled && prev_fb.format == 0)
CopyFrameBuffer();
else if ((settings.hacks&hack_Knockout) && prev_fb.width < 100)
else if ((g_settings->hacks&hack_Knockout) && prev_fb.width < 100)
CopyFrameBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
}
if (!fb_hwfbe_enabled && cur_fb.status == ci_copy)
@ -2859,7 +2859,7 @@ static void rdp_setcolorimage()
{
if (cur_fb.format == 0)
{
if ((settings.hacks&hack_PPL) && (rdp.scale_x < 1.1f)) //need to put current image back to frame buffer
if ((g_settings->hacks&hack_PPL) && (rdp.scale_x < 1.1f)) //need to put current image back to frame buffer
{
int width = cur_fb.width;
int height = cur_fb.height;
@ -2961,19 +2961,19 @@ static void rdp_setcolorimage()
}
CI_SET = TRUE;
if (settings.swapmode > 0)
if (g_settings->swapmode > 0)
{
if (rdp.zimg == rdp.cimg)
rdp.updatescreen = 1;
int viSwapOK = ((settings.swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
int viSwapOK = ((g_settings->swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
if ((rdp.zimg != rdp.cimg) && (rdp.ocimg != rdp.cimg) && SwapOK && viSwapOK && !rdp.cur_image)
{
if (fb_emulation_enabled)
rdp.maincimg[0] = rdp.frame_buffers[rdp.main_ci_index];
else
rdp.maincimg[0].addr = rdp.cimg;
rdp.last_drawn_ci_addr = (settings.swapmode == 2) ? swapped_addr : rdp.maincimg[0].addr;
rdp.last_drawn_ci_addr = (g_settings->swapmode == 2) ? swapped_addr : rdp.maincimg[0].addr;
swapped_addr = rdp.cimg;
newSwapBuffers();
rdp.vi_org_reg = *gfx.VI_ORIGIN_REG;
@ -2999,7 +2999,7 @@ static void rdp_setcolorimage()
static void rsp_reserved0()
{
if (settings.ucode == ucode_DiddyKong)
if (g_settings->ucode == ucode_DiddyKong)
{
ucode5_texshiftaddr = segoffset(rdp.cmd1);
ucode5_texshiftcount = 0;
@ -3029,7 +3029,7 @@ static void rsp_reserved3()
void SetWireframeCol()
{
switch (settings.wfmode)
switch (g_settings->wfmode)
{
//case 0: // normal colors, don't do anything
case 1: // vertex colors
@ -3251,7 +3251,7 @@ EXPORT void CALL FBGetFrameBufferInfo(void *p)
LOG("FBGetFrameBufferInfo ()\n");
FrameBufferInfo * pinfo = (FrameBufferInfo *)p;
memset(pinfo, 0, sizeof(FrameBufferInfo) * 6);
if (!(settings.frame_buffer&fb_get_info))
if (!(g_settings->frame_buffer&fb_get_info))
return;
LRDP("FBGetFrameBufferInfo ()\n");
//*
@ -3300,7 +3300,7 @@ void DetectFrameBufferUsage()
uint32_t a;
int tidal = FALSE;
if ((settings.hacks&hack_PMario) && (rdp.copy_ci_index || rdp.frame_buffers[rdp.copy_ci_index].status == ci_copy_self))
if ((g_settings->hacks&hack_PMario) && (rdp.copy_ci_index || rdp.frame_buffers[rdp.copy_ci_index].status == ci_copy_self))
tidal = TRUE;
uint32_t ci = rdp.cimg, zi = rdp.zimg;
uint32_t ci_height = rdp.frame_buffers[(rdp.ci_count > 0) ? rdp.ci_count - 1 : 0].height;
@ -3338,8 +3338,8 @@ void DetectFrameBufferUsage()
// Go to the next instruction
rdp.pc[rdp.pc_i] = (a + 8) & BMASK;
if (uintptr_t(reinterpret_cast<void*>(gfx_instruction_lite[settings.ucode][rdp.cmd0 >> 24])))
gfx_instruction_lite[settings.ucode][rdp.cmd0 >> 24]();
if (uintptr_t(reinterpret_cast<void*>(gfx_instruction_lite[g_settings->ucode][rdp.cmd0 >> 24])))
gfx_instruction_lite[g_settings->ucode][rdp.cmd0 >> 24]();
// check DL counter
if (rdp.dl_count != -1)
@ -3433,7 +3433,7 @@ void DetectFrameBufferUsage()
{
if (fb_hwfbe_enabled)
{
if (rdp.read_previous_ci && !previous_ci_was_read && (settings.swapmode != 2) && (settings.ucode != ucode_PerfectDark))
if (rdp.read_previous_ci && !previous_ci_was_read && (g_settings->swapmode != 2) && (g_settings->ucode != ucode_PerfectDark))
{
int ind = (rdp.ci_count > 0) ? rdp.ci_count - 1 : 0;
uint32_t height = rdp.frame_buffers[ind].height;
@ -3451,7 +3451,7 @@ void DetectFrameBufferUsage()
{
if (rdp.motionblur)
{
if (settings.frame_buffer&fb_motionblur)
if (g_settings->frame_buffer&fb_motionblur)
CopyFrameBuffer();
else
memset(gfx.RDRAM + rdp.cimg, 0, rdp.ci_width*rdp.ci_height*rdp.ci_size);
@ -3494,7 +3494,7 @@ void DetectFrameBufferUsage()
}
}
rdp.ci_count = 0;
if (settings.hacks&hack_Banjo2)
if (g_settings->hacks&hack_Banjo2)
rdp.cur_tex_buf = 0;
rdp.maincimg[0] = rdp.frame_buffers[rdp.main_ci_index];
// rdp.scale_x = rdp.scale_x_bak;

View File

@ -187,7 +187,8 @@ enum rdpBitmapType
rdpBITMAP_TYPE_PNG,
};
typedef struct {
typedef struct
{
const char * format;
const char * extension;
rdpBitmapType type;
@ -196,159 +197,6 @@ typedef struct {
extern const int NumOfFormats;
extern SCREEN_SHOT_FORMAT ScreenShotFormats[];
typedef struct {
int card_id;
uint32_t res_x, scr_res_x;
uint32_t res_y, scr_res_y;
uint32_t res_data, res_data_org;
int advanced_options;
int texenh_options;
int ssformat;
int vsync;
int show_fps;
int clock;
int clock_24_hr;
int filtering;
int fog;
int buff_clear;
int swapmode;
int lodmode;
int aspectmode;
int use_hotkeys;
//Frame buffer emulation options
#define fb_emulation (1<<0) //frame buffer emulation
#define fb_hwfbe (1<<1) //hardware frame buffer emualtion
#define fb_motionblur (1<<2) //emulate motion blur
#define fb_ref (1<<3) //read every frame
#define fb_read_alpha (1<<4) //read alpha
#define fb_hwfbe_buf_clear (1<<5) //clear auxiliary texture frame buffers
#define fb_depth_render (1<<6) //enable software depth render
#define fb_optimize_texrect (1<<7) //fast texrect rendering with hwfbe
#define fb_ignore_aux_copy (1<<8) //do not copy auxiliary frame buffers
#define fb_useless_is_useless (1<<10) //
#define fb_get_info (1<<11) //get frame buffer info
#define fb_read_back_to_screen (1<<12) //render N64 frame buffer to screen
#define fb_read_back_to_screen2 (1<<13) //render N64 frame buffer to screen
#define fb_cpu_write_hack (1<<14) //show images writed directly by CPU
#define fb_emulation_enabled ((settings.frame_buffer&fb_emulation)>0)
#define fb_hwfbe_enabled ((settings.frame_buffer&(fb_emulation|fb_hwfbe))==(fb_emulation|fb_hwfbe))
#define fb_depth_render_enabled ((settings.frame_buffer&fb_depth_render)>0)
uint32_t frame_buffer;
enum FBCRCMODE {
fbcrcNone = 0,
fbcrcFast = 1,
fbcrcSafe = 2
} fb_crc_mode;
#ifdef TEXTURE_FILTER
//Texture filtering options
std::string texture_dir;
int ghq_fltr;
int ghq_enht;
int ghq_cmpr;
int ghq_hirs;
int ghq_use;
int ghq_enht_cmpr;
int ghq_enht_tile;
int ghq_enht_f16bpp;
int ghq_enht_gz;
int ghq_enht_nobg;
int ghq_hirs_cmpr;
int ghq_hirs_tile;
int ghq_hirs_f16bpp;
int ghq_hirs_gz;
int ghq_hirs_altcrc;
int ghq_cache_save;
int ghq_cache_size;
int ghq_hirs_let_texartists_fly;
int ghq_hirs_dump;
#endif
//Debug
int autodetect_ucode;
int ucode;
int logging;
int elogging;
int log_clear;
int run_in_window;
int filter_cache;
int unk_as_red;
int log_unk;
int unk_clear;
int wireframe;
int wfmode;
// Special fixes
int offset_x, offset_y;
int scale_x, scale_y;
int fast_crc;
int alt_tex_size;
int use_sts1_only;
int flame_corona; //hack for zeldas flame's corona
int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect
int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect
int texture_correction; // enable perspective texture correction emulation. is on by default
int stipple_mode; //used for dithered alpha emulation
uint32_t stipple_pattern; //used for dithered alpha emulation
int force_microcheck; //check microcode each frame, for mixed F3DEX-S2DEX games
int force_quad3d; //force 0xb5 command to be quad, not line 3d
int clip_zmin; //enable near z clipping
int clip_zmax; //enable far plane clipping;
int adjust_aspect; //adjust screen aspect for wide screen mode
int force_calc_sphere; //use spheric mapping only, Ridge Racer 64
int pal230; //set special scale for PAL games
int correct_viewport; //correct viewport values
int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
int old_style_adither; //apply alpha dither regardless of alpha_dither_mode
int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does.
//Special game hacks
#define hack_ASB (1<<0) //All-Star Baseball games
#define hack_Banjo2 (1<<1) //Banjo Tooie
#define hack_BAR (1<<2) //Beetle Adventure Racing
#define hack_Chopper (1<<3) //Chopper Attack
#define hack_Diddy (1<<4) //diddy kong racing
#define hack_Fifa98 (1<<5) //FIFA - Road to World Cup 98
#define hack_Fzero (1<<6) //F-Zero
#define hack_GoldenEye (1<<7) //Golden Eye
#define hack_Hyperbike (1<<8) //Top Gear Hyper Bike
#define hack_ISS64 (1<<9) //International Superstar Soccer 64
#define hack_KI (1<<10) //Killer Instinct
#define hack_Knockout (1<<11) //Knockout Kings 2000
#define hack_Lego (1<<12) //LEGO Racers
#define hack_MK64 (1<<13) //Mario Kart
#define hack_Megaman (1<<14) //Megaman64
#define hack_Makers (1<<15) //Mischief-makers
#define hack_WCWnitro (1<<16) //WCW Nitro
#define hack_Ogre64 (1<<17) //Ogre Battle 64
#define hack_Pilotwings (1<<18) //Pilotwings
#define hack_PMario (1<<19) //Paper Mario
#define hack_PPL (1<<20) //pokemon puzzle league requires many special fixes
#define hack_RE2 (1<<21) //Resident Evil 2
#define hack_Starcraft (1<<22) //StarCraft64
#define hack_Supercross (1<<23) //Supercross 2000
#define hack_TGR (1<<24) //Top Gear Rally
#define hack_TGR2 (1<<25) //Top Gear Rally 2
#define hack_Tonic (1<<26) //tonic trouble
#define hack_Yoshi (1<<27) //Yoshi Story
#define hack_Zelda (1<<28) //zeldas hacks
#define hack_OoT (1<<29) //zelda OoT hacks
uint32_t hacks;
//wrapper settings
int wrpResolution;
int wrpVRAM;
int wrpFBO;
int wrpAnisotropic;
} SETTINGS;
typedef struct
{
uint8_t hk_ref;
@ -788,7 +636,6 @@ void ChangeSize();
void GoToFullScreen();
extern RDP rdp;
extern SETTINGS settings;
extern HOTKEY_INFO hotkey_info;
extern VOODOO voodoo;

77
Source/Glide64/trace.cpp Normal file
View File

@ -0,0 +1,77 @@
#include "trace.h"
#include "Config.h"
#include <Common/Trace.h>
#include <Common/path.h>
#include <Common/LogClass.h>
#include <Settings/Settings.h>
#ifdef ANDROID
#include <android/log.h>
class AndroidLogger : public CTraceModule
{
void Write(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char * Message)
{
switch (severity)
{
case TraceError: __android_log_print(ANDROID_LOG_ERROR, TraceModule(module), "%s: %s", function, Message); break;
case TraceWarning: __android_log_print(ANDROID_LOG_WARN, TraceModule(module), "%s: %s", function, Message); break;
case TraceNotice: __android_log_print(ANDROID_LOG_INFO, TraceModule(module), "%s: %s", function, Message); break;
case TraceInfo: __android_log_print(ANDROID_LOG_INFO, TraceModule(module), "%s: %s", function, Message); break;
case TraceDebug: __android_log_print(ANDROID_LOG_DEBUG, TraceModule(module), "%s: %s", function, Message); break;
case TraceVerbose: __android_log_print(ANDROID_LOG_VERBOSE, TraceModule(module), "%s: %s", function, Message); break;
default: __android_log_print(ANDROID_LOG_UNKNOWN, TraceModule(module), "%s: %s", function, Message); break;
}
}
};
static AndroidLogger * g_AndroidLogger = NULL;
#endif
static CTraceFileLog * g_LogFile = NULL;
void SetupTrace(void)
{
if (g_LogFile != NULL)
{
return;
}
#ifdef ANDROID
if (g_AndroidLogger == NULL)
{
g_AndroidLogger = new AndroidLogger();
}
TraceAddModule(g_AndroidLogger);
TraceSetMaxModule(MaxTraceModuleGlide64, TraceVerbose);
#else
#ifdef _DEBUG
TraceSetMaxModule(MaxTraceModuleGlide64, TraceVerbose);
#else
TraceSetMaxModule(MaxTraceModuleGlide64, TraceError);
#endif
#endif
TraceSetModuleName(TraceMD5, "MD5");
TraceSetModuleName(TraceSettings, "Settings");
TraceSetModuleName(TraceUnknown, "Unknown");
TraceSetModuleName(TraceInterface, "Interface");
char log_dir[260];
memset(log_dir, 0, sizeof(log_dir));
GetSystemSettingSz(Set_log_dir, log_dir, sizeof(log_dir));
if (strlen(log_dir) == 0)
{
return;
}
CPath LogFilePath(log_dir);
if (!LogFilePath.DirectoryExists())
{
LogFilePath.DirectoryCreate();
}
LogFilePath.SetNameExtension("Glide64.log");
g_LogFile = new CTraceFileLog(LogFilePath, GetSystemSetting(Set_log_flush) != 0, Log_New, 500);
TraceAddModule(g_LogFile);
}

13
Source/Glide64/trace.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#include <Common/TraceModulesCommon.h>
#include <Common/Trace.h>
enum TraceModuleGlide64
{
TraceSettings = MaxTraceModuleCommon,
TraceUnknown,
TraceInterface,
MaxTraceModuleGlide64,
};
void SetupTrace(void);

View File

@ -249,7 +249,7 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
static void Turbo3D()
{
LRDP("Start Turbo3D microcode\n");
settings.ucode = ucode_Fast3D;
g_settings->ucode = ucode_Fast3D;
uint32_t a = 0, pgstate = 0, pstate = 0, pvtx = 0, ptri = 0;
do {
a = rdp.pc[rdp.pc_i] & BMASK;
@ -270,5 +270,5 @@ static void Turbo3D()
rdp.pc[rdp.pc_i] += 16;
} while (pstate);
// rdp_fullsync();
settings.ucode = ucode_Turbo3d;
g_settings->ucode = ucode_Turbo3d;
}

View File

@ -376,7 +376,7 @@ static void uc0_movemem()
short trans_x = ((short*)gfx.RDRAM)[(a + 4) ^ 1] / 4;
short trans_y = ((short*)gfx.RDRAM)[(a + 5) ^ 1] / 4;
short trans_z = ((short*)gfx.RDRAM)[(a + 6) ^ 1];
if (settings.correct_viewport)
if (g_settings->correct_viewport)
{
scale_x = abs(scale_x);
scale_y = abs(scale_y);
@ -548,7 +548,7 @@ static void uc0_tri1()
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF) / 10],
&rdp.vtx[(rdp.cmd1 & 0xFF) / 10]
};
if (settings.hacks & hack_Makers)
if (g_settings->hacks & hack_Makers)
{
rdp.force_wrap = FALSE;
for (int i = 0; i < 3; i++)
@ -791,7 +791,7 @@ static void uc0_moveword()
static void uc0_texture()
{
int tile = (rdp.cmd0 >> 8) & 0x07;
if (tile == 7 && (settings.hacks&hack_Supercross)) tile = 0; //fix for supercross 2000
if (tile == 7 && (g_settings->hacks&hack_Supercross)) tile = 0; //fix for supercross 2000
rdp.mipmap_level = (rdp.cmd0 >> 11) & 0x07;
uint32_t on = (rdp.cmd0 & 0xFF);
rdp.cur_tile = tile;
@ -827,7 +827,7 @@ static void uc0_setothermode_h()
LRDP("uc0:setothermode_h: ");
int shift, len;
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_CBFD))
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
{
len = (rdp.cmd0 & 0xFF) + 1;
shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len;
@ -905,7 +905,7 @@ static void uc0_setothermode_l()
LRDP("uc0:setothermode_l ");
int shift, len;
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_CBFD))
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
{
len = (rdp.cmd0 & 0xFF) + 1;
shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len;
@ -947,7 +947,7 @@ static void uc0_setothermode_l()
rdp.update |= UPDATE_FOG_ENABLED; //if blender has no fog bits, fog must be set off
rdp.render_mode_changed |= rdp.rm ^ rdp.othermode_l;
rdp.rm = rdp.othermode_l;
if (settings.flame_corona && (rdp.rm == 0x00504341)) //hack for flame's corona
if (g_settings->flame_corona && (rdp.rm == 0x00504341)) //hack for flame's corona
rdp.othermode_l |= /*0x00000020 |*/ 0x00000010;
FRDP("rendermode: %08lx\n", rdp.othermode_l); // just output whole othermode_l
}

View File

@ -104,7 +104,7 @@ static void uc1_tri2()
static void uc1_line3d()
{
if (!settings.force_quad3d && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0))
if (!g_settings->force_quad3d && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0))
{
uint16_t width = (uint16_t)(rdp.cmd1 & 0xFF) + 3;

View File

@ -126,7 +126,7 @@ static void uc2_vertex()
}
uint32_t geom_mode = rdp.geom_mode;
if ((settings.hacks&hack_Fzero) && (rdp.geom_mode & 0x40000))
if ((g_settings->hacks&hack_Fzero) && (rdp.geom_mode & 0x40000))
{
if (((short*)gfx.RDRAM)[(((addr) >> 1) + 4) ^ 1] || ((short*)gfx.RDRAM)[(((addr) >> 1) + 5) ^ 1])
rdp.geom_mode ^= 0x40000;
@ -424,7 +424,7 @@ static void uc2_geom_mode()
{
if ((rdp.flags & ZBUF_ENABLED))
{
if (!settings.flame_corona || (rdp.rm != 0x00504341)) //hack for flame's corona
if (!g_settings->flame_corona || (rdp.rm != 0x00504341)) //hack for flame's corona
rdp.flags ^= ZBUF_ENABLED;
rdp.update |= UPDATE_ZBUF_ENABLED;
}

View File

@ -116,7 +116,7 @@ static void uc5_vertex()
// 0 = unused
int n = ((rdp.cmd0 >> 19) & 0x1F);// + 1;
if (settings.hacks&hack_Diddy)
if (g_settings->hacks&hack_Diddy)
n++;
if (rdp.cmd0 & 0x00010000)

View File

@ -210,7 +210,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
grDepthMask(FXFALSE);
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (settings.scr_res_x > 1024)
if (g_settings->scr_res_x > 1024)
LOD = GR_LOD_LOG2_2048;
float lr_x = (float)d.imageW * rdp.scale_x;
@ -262,8 +262,8 @@ void DrawDepthImage(const DRAWIMAGE & d)
float scale_y_src = 1.0f / rdp.scale_y;
int src_width = d.imageW;
int src_height = d.imageH;
int dst_width = minval(int(src_width*scale_x_dst), (int)settings.scr_res_x);
int dst_height = minval(int(src_height*scale_y_dst), (int)settings.scr_res_y);
int dst_width = minval(int(src_width*scale_x_dst), (int)g_settings->scr_res_x);
int dst_height = minval(int(src_height*scale_y_dst), (int)g_settings->scr_res_y);
uint16_t * src = (uint16_t*)(gfx.RDRAM + d.imagePtr);
uint16_t * dst = new uint16_t[dst_width*dst_height];
for (int y = 0; y < dst_height; y++)
@ -356,12 +356,12 @@ void DrawImage(DRAWIMAGE & d)
}
}
if ((settings.hacks&hack_PPL) > 0)
if ((g_settings->hacks&hack_PPL) > 0)
{
if (d.imageY > d.imageH)
d.imageY = (d.imageY%d.imageH);
}
else if ((settings.hacks&hack_Starcraft) > 0)
else if ((g_settings->hacks&hack_Starcraft) > 0)
{
if (d.imageH % 2 == 1)
d.imageH -= 1;
@ -443,7 +443,7 @@ void DrawImage(DRAWIMAGE & d)
rdp.allow_combine = 0;
if (rdp.ci_width == 512 && !no_dlist)
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
grClipWindow(0, 0, g_settings->scr_res_x, g_settings->scr_res_y);
else if (d.scaleX == 1.0f && d.scaleY == 1.0f)
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
else
@ -611,13 +611,13 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
setTBufTex(rdp.tbuff_tex->t_mem, rdp.tbuff_tex->width << rdp.tbuff_tex->size >> 1);
const float Z = set_sprite_combine_mode();
grClipWindow(0, 0, settings.res_x, settings.res_y);
grClipWindow(0, 0, g_settings->res_x, g_settings->res_y);
if (d.imageW % 2 == 1) d.imageW -= 1;
if (d.imageH % 2 == 1) d.imageH -= 1;
if (d.imageY > d.imageH) d.imageY = (d.imageY%d.imageH);
if (!(settings.hacks&hack_PPL))
if (!(g_settings->hacks&hack_PPL))
{
if ((d.frameX > 0) && (d.frameW == rdp.ci_width))
d.frameW -= (uint16_t)(2.0f*d.frameX);
@ -764,7 +764,7 @@ static void uc6_bg(bool bg_1cyc)
return;
}
if (settings.ucode == ucode_F3DEX2 || (settings.hacks&hack_PPL))
if (g_settings->ucode == ucode_F3DEX2 || (g_settings->hacks&hack_PPL))
{
if ((d.imagePtr != rdp.cimg) && (d.imagePtr != rdp.ocimg) && d.imagePtr) //can't draw from framebuffer
DrawImage(d);
@ -979,7 +979,7 @@ static void uc6_draw_polygons(VERTEX v[4])
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (settings.fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -1278,7 +1278,7 @@ static void uc6_obj_rectangle_r()
DRAWOBJECT d;
uc6_read_object_data(d);
if (d.imageFmt == 1 && (settings.hacks&hack_Ogre64)) //Ogre Battle needs to copy YUV texture to frame buffer
if (d.imageFmt == 1 && (g_settings->hacks&hack_Ogre64)) //Ogre Battle needs to copy YUV texture to frame buffer
{
float ul_x = d.objX / mat_2d.BaseScaleX + mat_2d.X;
float lr_x = (d.objX + d.imageW / d.scaleW) / mat_2d.BaseScaleX + mat_2d.X;
@ -1523,7 +1523,7 @@ void uc6_sprite2d()
d.frameY = ((short)(cmd1 & 0xFFFF)) / 4.0f;
d.frameW = (uint16_t)(d.imageW / d.scaleX);
d.frameH = (uint16_t)(d.imageH / d.scaleY);
if (settings.hacks&hack_WCWnitro)
if (g_settings->hacks&hack_WCWnitro)
{
int scaleY = (int)d.scaleY;
d.imageH /= scaleY;
@ -1692,7 +1692,7 @@ void uc6_sprite2d()
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (settings.fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}

View File

@ -222,7 +222,7 @@ static void fb_settextureimage()
rdp.scale_y = 1.0f;
}
}
else if (!(settings.frame_buffer & fb_ignore_aux_copy) && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)
else if (!(g_settings->frame_buffer & fb_ignore_aux_copy) && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)
{
rdp.copy_ci_index = rdp.ci_count - 1;
cur_fb.status = ci_aux_copy;
@ -407,7 +407,7 @@ static void fb_setcolorimage()
}
if (rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_unknown) //status of previous fb was not changed - it is useless
{
if (fb_hwfbe_enabled && !(settings.frame_buffer & fb_useless_is_useless))
if (fb_hwfbe_enabled && !(g_settings->frame_buffer & fb_useless_is_useless))
{
rdp.frame_buffers[rdp.ci_count - 1].status = ci_aux;
rdp.frame_buffers[rdp.ci_count - 1].changed = 0;
@ -432,7 +432,7 @@ static void fb_setcolorimage()
}
if (cur_fb.status == ci_main)
{
int viSwapOK = ((settings.swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
int viSwapOK = ((g_settings->swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
if ((rdp.maincimg[0].addr != cur_fb.addr) && SwapOK && viSwapOK)
{
SwapOK = FALSE;