Add Glide64 plugin

This commit is contained in:
zilmar 2013-04-05 08:22:19 +11:00
parent bae237dd5e
commit 5d4340d2e5
96 changed files with 75848 additions and 0 deletions

269
Source/Glide64/3dmath.cpp Normal file
View File

@ -0,0 +1,269 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#include "Gfx #1.3.h"
#include "3dmath.h"
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 (wxUint32 l=0; l<rdp.num_lights; l++)
{
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 = (wxUint8)(color[0]*255.0f);
v->g = (wxUint8)(color[1]*255.0f);
v->b = (wxUint8)(color[2]*255.0f);
}
//*
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;
#ifdef EXTREME_LOGGING
FRDP ("calc linear u: %f, v: %f\n", v->ou, v->ov);
#endif
}
void calc_sphere (VERTEX *v)
{
// LRDP("calc_sphere\n");
DECLAREALIGN16VAR(vec[3]);
int s_scale, t_scale;
if (settings.hacks&hack_Chopper)
{
s_scale = min(rdp.tiles[rdp.cur_tile].org_s_scale >> 6, rdp.tiles[rdp.cur_tile].lr_s);
t_scale = min(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);
#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];
return(result);
}
void NormalizeVectorC(float *v)
{
register float len;
len = sqrtf(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
if (len > 0.0f)
{
v[0] /= len;
v[1] /= len;
v[2] /= len;
}
}
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];
}
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];
}
void MulMatricesC(float m1[4][4],float m2[4][4],float r[4][4])
{
for (int i=0; i<4; i++)
{
for (int j=0; j<4; j++)
{
r[i][j] = m1[i][0] * m2[0][j] +
m1[i][1] * m2[1][j] +
m1[i][2] * m2[2][j] +
m1[i][3] * m2[3][j];
}
}
}
// 2008.03.29 H.Morii - added SSE 3DNOW! 3x3 1x3 matrix multiplication
// and 3DNOW! 4x4 4x4 matrix multiplication
MULMATRIX MulMatrices = MulMatricesC;
TRANSFORMVECTOR TransformVector = TransformVectorC;
TRANSFORMVECTOR InverseTransformVector = InverseTransformVectorC;
DOTPRODUCT DotProduct = DotProductC;
NORMALIZEVECTOR NormalizeVector = NormalizeVectorC;
extern "C" void TransformVectorSSE(float *src, float *dst, float mat[4][4]);
extern "C" void TransformVector3DNOW(float *src, float *dst, float mat[4][4]);
extern "C" void InverseTransformVector3DNOW(float *src, float *dst, float mat[4][4]);
extern "C" void MulMatricesSSE(float m1[4][4],float m2[4][4],float r[4][4]);
extern "C" void MulMatrices3DNOW(float m1[4][4],float m2[4][4],float r[4][4]);
extern "C" float DotProductSSE3(register float *v1, register float *v2);
extern "C" float DotProduct3DNOW(register float *v1, register float *v2);
extern "C" void NormalizeVectorSSE(float *v);
extern "C" void NormalizeVector3DNOW(float *v);
extern "C" void DetectSIMD(int function, int * iedx, int * iecx);
void math_init()
{
#ifndef _DEBUG
int iecx = 0, iedx = 0;
GLIDE64_TRY
{
DetectSIMD(0x0000001, &iedx, &iecx);
}
GLIDE64_CATCH
{
return;
}
if (iedx & 0x2000000) //SSE
{
MulMatrices = MulMatricesSSE;
TransformVector = TransformVectorSSE;
//InverseTransformVector = InverseTransformVectorSSE;
//NormalizeVector = NormalizeVectorSSE; /* not ready yet */
LOG("SSE detected.\n");
}
if (iedx & 0x4000000) // SSE2
{
LOG("SSE2 detected.\n");
}
if (iecx & 0x1) // SSE3
{
//DotProduct = DotProductSSE3; /* not ready yet */
LOG("SSE3 detected.\n");
}
// the 3dnow version is faster than sse
iecx = 0;
iedx = 0;
GLIDE64_TRY
{
DetectSIMD(0x80000001, &iedx, &iecx);
}
GLIDE64_CATCH
{
return;
}
if (iedx & 0x80000000) //3DNow!
{
MulMatrices = MulMatrices3DNOW;
TransformVector = TransformVector3DNOW;
InverseTransformVector = InverseTransformVector3DNOW;
//DotProduct = DotProduct3DNOW; //not ready yet
NormalizeVector = NormalizeVector3DNOW; // not ready yet
LOG("3DNOW! detected.\n");
}
#endif //_DEBUG
}

54
Source/Glide64/3dmath.h Normal file
View File

@ -0,0 +1,54 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
void calc_light (VERTEX *v);
void calc_linear (VERTEX *v);
void calc_sphere (VERTEX *v);
void math_init();
typedef void (*MULMATRIX)(float m1[4][4],float m2[4][4],float r[4][4]);
extern MULMATRIX MulMatrices;
typedef void (*TRANSFORMVECTOR)(float *src,float *dst,float mat[4][4]);
extern TRANSFORMVECTOR TransformVector;
extern TRANSFORMVECTOR InverseTransformVector;
typedef float (*DOTPRODUCT)(register float *v1, register float *v2);
extern DOTPRODUCT DotProduct;
typedef void (*NORMALIZEVECTOR)(float *v);
extern NORMALIZEVECTOR NormalizeVector;

View File

@ -0,0 +1,497 @@
;/*
;* Glide64 - Glide video plugin for Nintendo 64 emulators.
;*
;* This program is free software; you can redistribute it and/or modify
;* it under the terms of the GNU General Public License as published by
;* the Free Software Foundation; either version 2 of the License, or
;* any later version.
;*
;* This program is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;* GNU General Public License for more details.
;*
;* You should have received a copy of the GNU General Public License
;* along with this program; if not, write to the Free Software
;* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;*/
;
;****************************************************************
;
; Glide64 - Glide Plugin for Nintendo 64 emulators
; Project started on December 29th, 2001
;
; Authors:
; Dave2001, original author, founded the project in 2001, left it in 2002
; Gugaman, joined the project in 2002, left it in 2002
; Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
; Hiroshi 'KoolSmoky' Morii, joined the project in 2007
;
;****************************************************************
;
; To modify Glide64:
; * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
; * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
;
;****************************************************************
%include "inc/c32.mac"
segment .text
proc DetectSIMD
%$func arg
%$iedx arg
%$iecx arg
mov eax,[ebp + %$func]
cpuid
mov eax,[ebp + %$iedx]
mov [eax],edx
mov eax,[ebp + %$iecx]
mov [eax],ecx
endproc ;DetectSIMD
;****************************************************************
;
; ******** SSE ********
;
;****************************************************************
proc TransformVectorSSE
CPU P3
%$src arg ; float *src
%$dst arg ; float *dst
%$mat arg ; float mat[4][4]
mov ecx,[ebp + %$src]
mov eax,[ebp + %$dst]
mov edx,[ebp + %$mat]
movss xmm0,[ecx] ; 0 0 0 src[0]
movss xmm5,[edx] ; 0 0 0 mat[0][0]
movhps xmm5,[edx+4] ; mat[0][2] mat[0][1] 0 mat[0][0]
shufps xmm0,xmm0, 0 ; src[0] src[0] src[0] src[0]
movss xmm1,[ecx+4] ; 0 0 0 src[1]
movss xmm3,[edx+16] ; 0 0 0 mat[1][0]
movhps xmm3,[edx+20] ; mat[1][2] mat[1][1] 0 mat[1][0]
shufps xmm1,xmm1, 0 ; src[1] src[1] src[1] src[1]
mulps xmm0,xmm5 ; mat[0][2]*src[0] mat[0][1]*src[0] 0 mat[0][0]*src[0]
mulps xmm1,xmm3 ; mat[1][2]*src[1] mat[1][1]*src[1] 0 mat[1][0]*src[1]
movss xmm2,[ecx+8] ; 0 0 0 src[2]
shufps xmm2,xmm2, 0 ; src[2] src[2] src[2] src[2]
movss xmm4,[edx+32] ; 0 0 0 mat[2][0]
movhps xmm4,[edx+36] ; mat[2][2] mat[2][1] 0 mat[2][0]
addps xmm0,xmm1 ; mat[0][2]*src[0]+mat[1][2]*src[1] mat[0][1]*src[0]+mat[1][1]*src[1] 0 mat[0][0]*src[0]+mat[1][0]*src[1]
mulps xmm2,xmm4 ; mat[2][2]*src[2] mat[2][1]*src[2] 0 mat[2][0]*src[2]
addps xmm0,xmm2 ; mat[0][2]*src[0]+mat[1][2]*src[1]+mat[2][2]*src[2] mat[0][1]*src[0]+mat[1][1]*src[1]+mat[2][1]*src[2] 0 mat[0][0]*src[0]+mat[1][0]*src[1]+mat[2][0]*src[2]
movss [eax],xmm0 ; mat[0][0]*src[0]+mat[1][0]*src[1]+mat[2][0]*src[2]
movhps [eax+4],xmm0 ; mat[0][2]*src[0]+mat[1][2]*src[1]+mat[2][2]*src[2] mat[0][1]*src[0]+mat[1][1]*src[1]+mat[2][1]*src[2]
endproc ;TransformVectorSSE
proc MulMatricesSSE
CPU P3
%$m1 arg ; float m1[4][4]
%$m2 arg ; float m2[4][4]
%$r arg ; float r[4][4]
mov eax,[ebp + %$r]
mov ecx,[ebp + %$m1]
mov edx,[ebp + %$m2]
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]
movaps xmm4,[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
mulps xmm4,xmm0
mulps xmm5,xmm1
mulps xmm6,xmm2
mulps xmm7,xmm3
addps xmm4,xmm5
addps xmm4,xmm6
addps xmm4,xmm7
movaps [eax],xmm4
; r[1][0],r[1][1],r[1][2],r[1][3]
movaps xmm4,[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
mulps xmm4,xmm0
mulps xmm5,xmm1
mulps xmm6,xmm2
mulps xmm7,xmm3
addps xmm4,xmm5
addps xmm4,xmm6
addps xmm4,xmm7
movaps [eax+16],xmm4
; r[2][0],r[2][1],r[2][2],r[2][3]
movaps xmm4,[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
mulps xmm4,xmm0
mulps xmm5,xmm1
mulps xmm6,xmm2
mulps xmm7,xmm3
addps xmm4,xmm5
addps xmm4,xmm6
addps xmm4,xmm7
movaps [eax+32],xmm4
; r[3][0],r[3][1],r[3][2],r[3][3]
movaps xmm4,[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
mulps xmm4,xmm0
mulps xmm5,xmm1
mulps xmm6,xmm2
mulps xmm7,xmm3
addps xmm4,xmm5
addps xmm4,xmm6
addps xmm4,xmm7
movaps [eax+48],xmm4
endproc ;MulMatricesSSE
proc NormalizeVectorSSE
CPU P3
%$v arg
mov edx, [ebp + %$v]
movaps xmm0, [edx] ; x y z 0
movaps xmm2, xmm0 ; x y z 0
mulps xmm0, xmm0 ; x*x y*y z*z 0
movaps xmm1, xmm0 ; x*x y*y z*z 0
shufps xmm0, xmm1, 0x4e ; z*z 0 x*x y*y
addps xmm0, xmm1 ; x*x+z*z y*y z*z+x*x y*y
movaps xmm1, xmm0 ; x*x+z*z y*y z*z+x*x y*y
shufps xmm1, xmm1, 0x11 ; y*y z*z+x*x y*y z*z+x*x
addps xmm0, xmm1 ; x*x+z*z+y*y
rsqrtps xmm0, xmm0 ; 1.0/sqrt(x*x+z*z+y*y)
mulps xmm2, xmm0 ; x/sqrt(x*x+z*z+y*y) y/sqrt(x*x+z*z+y*y) z/sqrt(x*x+z*z+y*y) 0
movaps [edx], xmm2
endproc ;NormalizeVectorSSE
;****************************************************************
;
; ******** SSE3 ********
;
;****************************************************************
proc DotProductSSE3
CPU PRESCOTT
%$v1 arg
%$v2 arg
mov eax,[ebp + %$v1]
mov edx,[ebp + %$v2]
movaps xmm0, [eax]
mulps xmm0, [edx]
haddps xmm0, xmm0
haddps xmm0, xmm0
; movss eax, xmm0
endproc ;DotProductSSE3
;****************************************************************
;
; ******** 3DNOW ********
;
;****************************************************************
proc TransformVector3DNOW
CPU 586
%$src arg ; float *src
%$dst arg ; float *dst
%$mat arg ; float mat[4][4]
femms
mov ecx,[ebp + %$src]
mov eax,[ebp + %$dst]
mov edx,[ebp + %$mat]
movq mm0,[ecx] ; src[1] src[0]
movd mm2,[ecx+8] ; 0 src[2]
movq mm1,mm0 ; src[1] src[0]
punpckldq mm0,mm0 ; src[0] src[0]
punpckhdq mm1,mm1 ; src[1] src[1]
punpckldq mm2,mm2 ; src[2] src[2]
movq mm3,mm0 ; src[0] src[0]
movq mm4,mm1 ; src[1] src[1]
movq mm5,mm2 ; src[2] src[2]
pfmul mm0,[edx] ; src[0]*mat[0][1] src[0]*mat[0][0]
pfmul mm3,[edx+8] ; 0 src[0]*mat[0][2]
pfmul mm1,[edx+16] ; src[1]*mat[1][1] src[1]*mat[1][0]
pfmul mm4,[edx+24] ; 0 src[1]*mat[1][2]
pfmul mm2,[edx+32] ; src[2]*mat[2][1] src[2]*mat[2][0]
pfmul mm5,[edx+40] ; 0 src[2]*mat[2][2]
pfadd mm0,mm1 ; src[0]*mat[0][1]+src[1]*mat[1][1] src[0]*mat[0][0]+src[1]*mat[1][0]
pfadd mm3,mm4 ; 0 src[0]*mat[0][2]+src[1]*mat[1][2]
pfadd mm0,mm2 ; src[0]*mat[0][1]+src[1]*mat[1][1]+src[2]*mat[2][1] src[0]*mat[0][0]+src[1]*mat[1][0]+src[2]*mat[2][0]
pfadd mm3,mm5 ; 0 src[0]*mat[0][2]+src[1]*mat[1][2]+src[2]*mat[2][2]
movq [eax],mm0 ; mat[0][1]*src[0]+mat[1][1]*src[1]+mat[2][1]*src[2] mat[0][0]*src[0]+mat[1][0]*src[1]+mat[2][0]*src[2]
movd [eax+8],mm3 ; mat[0][2]*src[0]+mat[1][2]*src[1]+mat[2][2]*src[2]
femms
endproc ;TransformVector3DNOW
proc InverseTransformVector3DNOW
CPU 586
%$src arg ; float *src
%$dst arg ; float *dst
%$mat arg ; float mat[4][4]
femms
mov ecx,[ebp + %$src]
mov eax,[ebp + %$dst]
mov edx,[ebp + %$mat]
movq mm0,[ecx] ; src[1] src[0]
movd mm4,[ecx+8] ; 0 src[2]
movq mm1,mm0 ; src[1] src[0]
pfmul mm0,[edx] ; src[1]*mat[0][1] src[0]*mat[0][0]
movq mm5,mm4 ; 0 src[2]
pfmul mm4,[edx+8] ; 0 src[2]*mat[0][2]
movq mm2,mm1 ; src[1] src[0]
pfmul mm1,[edx+16] ; src[1]*mat[1][1] src[0]*mat[1][0]
movq mm6,mm5 ; 0 src[2]
pfmul mm5,[edx+24] ; 0 src[2]*mat[1][2]
movq mm3,mm2 ; src[1] src[0]
pfmul mm2,[edx+32] ; src[1]*mat[2][1] src[0]*mat[2][0]
movq mm7,mm6 ; 0 src[2]
pfmul mm6,[edx+40] ; 0 src[2]*mat[2][2]
pfacc mm0,mm4 ; src[2]*mat[0][2] src[1]*mat[0][1]+src[0]*mat[0][0]
pfacc mm1,mm5 ; src[2]*mat[1][2] src[1]*mat[1][1]+src[0]*mat[1][0]
pfacc mm2,mm6 ; src[2]*mat[2][2] src[1]*mat[2][1]+src[0]*mat[2][0]
pfacc mm0,mm1 ; src[2]*mat[1][2]+src[1]*mat[1][1]+src[0]*mat[1][0] src[2]*mat[0][2]+src[1]*mat[0][1]+src[0]*mat[0][0]
pfacc mm2,mm3 ; 0 src[2]*mat[2][2]+src[1]*mat[2][1]+src[0]*mat[2][0]
movq [eax],mm0 ; mat[1][0]*src[0]+mat[1][1]*src[1]+mat[1][2]*src[2] mat[0][0]*src[0]+mat[0][1]*src[1]+mat[0][2]*src[2]
movd [eax+8],mm2 ; mat[2][0]*src[0]+mat[2][1]*src[1]+mat[2][2]*src[2]
femms
endproc ;InverseTransformVector3DNOW
proc MulMatrices3DNOW
CPU 586
%$m1 arg ; float m1[4][4]
%$m2 arg ; float m2[4][4]
%$r arg ; float r[4][4]
femms
mov ecx,[ebp + %$m1]
mov eax,[ebp + %$r]
mov edx,[ebp + %$m2]
movq mm0,[ecx]
movq mm1,[ecx+8]
movq mm4,[edx]
punpckhdq mm2,mm0
movq mm5,[edx+16]
punpckhdq mm3,mm1
movq mm6,[edx+32]
punpckldq mm0,mm0
punpckldq mm1,mm1
pfmul mm4,mm0
punpckhdq mm2,mm2
pfmul mm0,[edx+8]
movq mm7,[edx+48]
pfmul mm5,mm2
punpckhdq mm3,mm3
pfmul mm2,[edx+24]
pfmul mm6,mm1
pfadd mm5,mm4
pfmul mm1,[edx+40]
pfadd mm2,mm0
pfmul mm7,mm3
pfadd mm6,mm5
pfmul mm3,[edx+56]
pfadd mm2,mm1
pfadd mm7,mm6
movq mm0,[ecx+16]
pfadd mm3,mm2
movq mm1,[ecx+24]
movq [eax],mm7
movq mm4,[edx]
movq [eax+8],mm3
punpckhdq mm2,mm0
movq mm5,[edx+16]
punpckhdq mm3,mm1
movq mm6,[edx+32]
punpckldq mm0,mm0
punpckldq mm1,mm1
pfmul mm4,mm0
punpckhdq mm2,mm2
pfmul mm0,[edx+8]
movq mm7,[edx+48]
pfmul mm5,mm2
punpckhdq mm3,mm3
pfmul mm2,[edx+24]
pfmul mm6,mm1
pfadd mm5,mm4
pfmul mm1,[edx+40]
pfadd mm2,mm0
pfmul mm7,mm3
pfadd mm6,mm5
pfmul mm3,[edx+56]
pfadd mm2,mm1
pfadd mm7,mm6
movq mm0,[ecx+32]
pfadd mm3,mm2
movq mm1,[ecx+40]
movq [eax+16],mm7
movq mm4,[edx]
movq [eax+24],mm3
punpckhdq mm2,mm0
movq mm5,[edx+16]
punpckhdq mm3,mm1
movq mm6,[edx+32]
punpckldq mm0,mm0
punpckldq mm1,mm1
pfmul mm4,mm0
punpckhdq mm2,mm2
pfmul mm0,[edx+8]
movq mm7,[edx+48]
pfmul mm5,mm2
punpckhdq mm3,mm3
pfmul mm2,[edx+24]
pfmul mm6,mm1
pfadd mm5,mm4
pfmul mm1,[edx+40]
pfadd mm2,mm0
pfmul mm7,mm3
pfadd mm6,mm5
pfmul mm3,[edx+56]
pfadd mm2,mm1
pfadd mm7,mm6
movq mm0,[ecx+48]
pfadd mm3,mm2
movq mm1,[ecx+56]
movq [eax+32],mm7
movq mm4,[edx]
movq [eax+40],mm3
punpckhdq mm2,mm0
movq mm5,[edx+16]
punpckhdq mm3,mm1
movq mm6,[edx+32]
punpckldq mm0,mm0
punpckldq mm1,mm1
pfmul mm4,mm0
punpckhdq mm2,mm2
pfmul mm0,[edx+8]
movq mm7,[edx+48]
pfmul mm5,mm2
punpckhdq mm3,mm3
pfmul mm2,[edx+24]
pfmul mm6,mm1
pfadd mm5,mm4
pfmul mm1,[edx+40]
pfadd mm2,mm0
pfmul mm7,mm3
pfadd mm6,mm5
pfmul mm3,[edx+56]
pfadd mm2,mm1
pfadd mm7,mm6
pfadd mm3,mm2
movq [eax+48],mm7
movq [eax+56],mm3
femms
endproc ;MulMatrices3DNOW
proc DotProduct3DNOW
CPU 586
%$v1 arg
%$v2 arg
femms
mov edx,[ebp + %$v1]
mov eax,[ebp + %$v2]
movq mm0,[edx]
movq mm3,[eax]
pfmul mm0,mm3
movq mm2,[edx+8]
movq mm1,[eax+8]
pfacc mm0,mm0
pfmul mm1,mm2
pfadd mm0,mm1
movd eax,mm0
femms
endproc ;DotProduct3DNOW
proc NormalizeVector3DNOW
CPU 586
%$v arg
femms
mov edx,[ebp + %$v]
movq mm0,[edx]
movq mm3,[edx+8]
movq mm1,mm0
movq mm2,mm3
pfmul mm0,mm0
pfmul mm3,mm3
pfacc mm0,mm0
pfadd mm0,mm3
;movq mm4,mm0 ; prepare for 24bit precision
;punpckldq mm4,mm4 ; prepare for 24bit precision
pfrsqrt mm0,mm0 ; 15bit precision 1/sqrtf(v)
;movq mm3,mm0
;pfmul mm0,mm0
;pfrsqit1 mm0,mm4
;pfrcpit2 mm0,mm3 ; 24bit precision 1/sqrtf(v)
pfmul mm1,mm0
pfmul mm2,mm0
movq [edx],mm1
movq [edx+8],mm2
femms
endproc ;NormalizeVector3DNOW

View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Glide64" />
<Option makefile="Makefile.gcc" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Option virtualFolders="Config/;Texture/;Ucode/;Resources/;" />
<Build>
<Target title="Debug">
<Option output="../Plugin/Glide64" prefix_auto="1" extension_auto="1" />
<Option working_dir="../Plugin" />
<Option object_output="obj/Debug/" />
<Option type="3" />
<Option compiler="gcc" />
<Option host_application="mupen64plus" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="-DBUILD_DLL" />
</Compiler>
<MakeCommands>
<Build command="$make -f $makefile " />
<CompileFile command="" />
<Clean command="" />
<DistClean command="" />
</MakeCommands>
</Target>
<Target title="Release">
<Option output="../Plugin/Glide64" prefix_auto="1" extension_auto="1" />
<Option working_dir="../Plugin" />
<Option object_output="obj/Release/" />
<Option type="3" />
<Option compiler="gcc" />
<Compiler>
<Add option="-DBUILD_DLL" />
<Add directory="../inc" />
<Add directory="$(WXDIR)/include" />
</Compiler>
<Linker>
<Add option="-s" />
<Add directory="../" />
<Add directory="../lib" />
<Add directory="$(WXDIR)/lib/gcc_lib" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="`wx-config --cppflags`" />
<Add option="-fexceptions" />
<Add option="-fPIC" />
<Add option="-D__unix__" />
<Add directory="../inc" />
</Compiler>
<Linker>
<Add option="`wx-config --libs`" />
<Add option="-lglide3x" />
<Add option="../3dmathSIMD.o" />
<Add option="../FixedPoint.o" />
<Add option="../Texture.o" />
<Add directory="../lib" />
</Linker>
<Unit filename="../3dmath.cpp" />
<Unit filename="../3dmath.h" />
<Unit filename="../CRC.cpp">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../CRC.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../Combine.cpp" />
<Unit filename="../Combine.h" />
<Unit filename="../Config.cpp">
<Option virtualFolder="Config/" />
</Unit>
<Unit filename="../Config.h">
<Option virtualFolder="Config/" />
</Unit>
<Unit filename="../Debugger.cpp" />
<Unit filename="../Debugger.h" />
<Unit filename="../DepthBufferRender.cpp" />
<Unit filename="../DepthBufferRender.h" />
<Unit filename="../Ext_TxFilter.cpp" />
<Unit filename="../Ext_TxFilter.h" />
<Unit filename="../FBtoScreen.cpp" />
<Unit filename="../FBtoScreen.h" />
<Unit filename="../Gfx #1.3.h" />
<Unit filename="../GlideExtensions.h" />
<Unit filename="../Keys.cpp" />
<Unit filename="../Keys.h" />
<Unit filename="../Main.cpp" />
<Unit filename="../MiClWr16b.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../MiClWr32b.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../MiClWr8b.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexBuffer.cpp" />
<Unit filename="../TexBuffer.h" />
<Unit filename="../TexCache.cpp">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexCache.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexConv.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexLoad.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexLoad16b.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexLoad32b.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexLoad4b.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexLoad8b.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexMod.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../TexModCI.h">
<Option virtualFolder="Texture/" />
</Unit>
<Unit filename="../Util.cpp" />
<Unit filename="../Util.h" />
<Unit filename="../australia.xpm" />
<Unit filename="../brazil.xpm" />
<Unit filename="../c32.mac" />
<Unit filename="../cursor.h" />
<Unit filename="../font.h" />
<Unit filename="../france.xpm" />
<Unit filename="../japan.xpm" />
<Unit filename="../logo.xpm" />
<Unit filename="../main.h" />
<Unit filename="../rdp.cpp" />
<Unit filename="../rdp.h" />
<Unit filename="../russia.xpm" />
<Unit filename="../turbo3D.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode00.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode01.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode02.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode03.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode04.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode05.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode06.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode07.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode08.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode09.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucode09rdp.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../ucodeFB.h">
<Option virtualFolder="Ucode/" />
</Unit>
<Unit filename="../usa.xpm" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

142
Source/Glide64/CRC.cpp Normal file
View File

@ -0,0 +1,142 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// CRC32 calculation functions
//
// Created by Gonetz, 2004
//
//****************************************************************
//*
#define CRC32_POLYNOMIAL 0x04C11DB7
unsigned int CRCTable[ 256 ];
unsigned int Reflect( unsigned int ref, char ch )
{
unsigned int value = 0;
// Swap bit 0 for bit 7
// bit 1 for bit 6, etc.
for (char i = 1; i < (ch + 1); i++)
{
if(ref & 1)
value |= 1 << (ch - i);
ref >>= 1;
}
return value;
}
void CRC_BuildTable()
{
unsigned int crc;
for (unsigned i = 0; i <= 255; i++)
{
crc = Reflect( i, 8 ) << 24;
for (unsigned j = 0; j < 8; j++)
crc = (crc << 1) ^ (crc & (1 << 31) ? CRC32_POLYNOMIAL : 0);
CRCTable[i] = Reflect( crc, 32 );
}
}
//*/
//*
unsigned int CRC32( unsigned int crc, void *buffer, unsigned int count )
{
unsigned int orig = crc;
unsigned char * p = reinterpret_cast<unsigned char*>(buffer);
while (count--)
crc = (crc >> 8) ^ CRCTable[(crc & 0xFF) ^ *p++];
return crc ^ orig;
}
//*/
/*
wxUint32 CRC_Calculate( wxUint32 crc, void *buffer, wxUint32 count )
{
wxUint32 Crc32=crc;
__asm {
mov esi, buffer
mov ecx, count
mov edx, crc
xor eax, eax
loop1:
inc esi
mov al, dl
xor al, byte ptr [esi]
shr edx, 8
mov ebx, [CRCTable+eax*4]
xor edx, ebx
loop loop1
xor Crc32, edx
}
return Crc32;
}
*/
/*
unsigned int CRC_Calculate( unsigned int crc, void *buffer, unsigned int count )
{
unsigned int Crc32=crc;
__asm {
mov esi, buffer
mov edx, count
add edx, esi
mov ecx, crc
loop1:
mov bl, byte ptr [esi]
movzx eax, cl
inc esi
xor al, bl
shr ecx, 8
mov ebx, [CRCTable+eax*4]
xor ecx, ebx
cmp edx, esi
jne loop1
xor Crc32, ecx
}
return Crc32;
}
//*/

48
Source/Glide64/CRC.h Normal file
View File

@ -0,0 +1,48 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// CRC32 calculation functions
//
// Created by Gonetz, 2004
//
//****************************************************************
void CRC_BuildTable();
unsigned int CRC32( unsigned int crc, void *buffer, unsigned int count );

16654
Source/Glide64/Combine.cpp Normal file

File diff suppressed because it is too large Load Diff

120
Source/Glide64/Combine.h Normal file
View File

@ -0,0 +1,120 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#ifndef COMBINE_H
#define COMBINE_H
// texture MOD types
#define TMOD_TEX_INTER_COLOR_USING_FACTOR 1
#define TMOD_TEX_INTER_COL_USING_COL1 2
#define TMOD_FULL_COLOR_SUB_TEX 3
#define TMOD_COL_INTER_COL1_USING_TEX 4
#define TMOD_COL_INTER_COL1_USING_TEXA 5
#define TMOD_COL_INTER_COL1_USING_TEXA__MUL_TEX 6
#define TMOD_COL_INTER_TEX_USING_TEXA 7
#define TMOD_COL2_INTER__COL_INTER_COL1_USING_TEX__USING_TEXA 8
#define TMOD_TEX_SCALE_FAC_ADD_FAC 9
#define TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX 10
#define TMOD_TEX_SCALE_COL_ADD_COL 11
#define TMOD_TEX_ADD_COL 12
#define TMOD_TEX_SUB_COL 13
#define TMOD_TEX_SUB_COL_MUL_FAC 14
#define TMOD_COL_INTER_TEX_USING_COL1 15
#define TMOD_COL_MUL_TEXA_ADD_TEX 16
#define TMOD_COL_INTER_TEX_USING_TEX 17
#define TMOD_TEX_INTER_NOISE_USING_COL 18
#define TMOD_TEX_INTER_COL_USING_TEXA 19
#define TMOD_TEX_MUL_COL 20
#define TMOD_TEX_SCALE_FAC_ADD_COL 21
#define COMBINE_EXT_COLOR 1
#define COMBINE_EXT_ALPHA 2
#define TEX_COMBINE_EXT_COLOR 1
#define TEX_COMBINE_EXT_ALPHA 2
typedef struct
{
wxUint32 ccolor; // constant color to set at the end, color and alpha
wxUint32 c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags
wxUint32 a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags
wxUint32 tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert;
wxUint32 tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert;
int dc0_lodbias, dc1_lodbias;
wxUint8 dc0_detailscale, dc1_detailscale;
float dc0_detailmax, dc1_detailmax;
float lodbias0, lodbias1;
wxUint32 abf1, abf2;
wxUint32 mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
wxUint32 mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
//combine extensions
wxUint32 c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
int c_ext_c_invert, c_ext_d_invert;
wxUint32 a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
int a_ext_c_invert, a_ext_d_invert;
wxUint32 t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
int t0c_ext_c_invert, t0c_ext_d_invert;
wxUint32 t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
int t0a_ext_c_invert, t0a_ext_d_invert;
wxUint32 t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
int t1c_ext_c_invert, t1c_ext_d_invert;
wxUint32 t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
int t1a_ext_c_invert, t1a_ext_d_invert;
GRCOLORCOMBINEEXT grColorCombineExt;
GRCOLORCOMBINEEXT grAlphaCombineExt;
GRTEXCOLORCOMBINEEXT grTexColorCombineExt;
GRTEXCOLORCOMBINEEXT grTexAlphaCombineExt;
GRCONSTANTCOLORVALUEEXT grConstantColorValueExt;
wxUint32 tex_ccolor;
int combine_ext;
wxUint8 cmb_ext_use;
wxUint8 tex_cmb_ext_use;
wxUint32 shade_mod_hash;
} COMBINE;
extern COMBINE cmb;
void Combine ();
void CombineBlender ();
void CountCombine ();
void InitCombine ();
void ColorCombinerToExtension ();
void AlphaCombinerToExtension ();
void TexColorCombinerToExtension (GrChipID_t tmu);
void TexAlphaCombinerToExtension (GrChipID_t tmu);
#endif //COMBINE _H

1430
Source/Glide64/Config.cpp Normal file

File diff suppressed because it is too large Load Diff

264
Source/Glide64/Config.h Normal file
View File

@ -0,0 +1,264 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Glide64 dialogs
// Created by Gonetz, 2008
//
//****************************************************************
// -*- C++ -*- generated by wxGlade 0.6.3 on Wed Oct 08 18:56:23 2008
#include <wx/wx.h>
#include <wx/image.h>
// begin wxGlade: ::dependencies
#include <wx/spinctrl.h>
#include <wx/notebook.h>
// end wxGlade
#ifndef CONFIG_H
#define CONFIG_H
// begin wxGlade: ::extracode
// end wxGlade
class ConfigNotebook: public wxNotebook {
public:
// begin wxGlade: ConfigNotebook::ids
enum {
wxID_VRAM = wxID_HIGHEST + 1000,
wxID_FBEnable = wxID_HIGHEST + 1002,
wxID_TexEdit = wxID_HIGHEST + 1004,
wxID_Performance = wxID_HIGHEST + 1006,
wxID_Quality = wxID_HIGHEST + 1008,
wxID_Language = wxID_HIGHEST + 1010
};
// end wxGlade
ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=0);
private:
// begin wxGlade: ConfigNotebook::methods
void set_properties();
void do_layout();
// end wxGlade
int lang_id;
protected:
// begin wxGlade: ConfigNotebook::attributes
wxStaticBox* BasicRenderingSizer_staticbox;
wxStaticBox* OnScreenDisplaySizer_staticbox;
wxStaticBox* SpeedSizer_staticbox;
wxStaticBox* TimeSizer_staticbox;
wxStaticText* lblResolution;
wxComboBox* cmbResolution;
wxCheckBox* cbxVSync;
wxCheckBox* cbxFPS;
wxCheckBox* cbxVIS;
wxCheckBox* cbxPercent;
wxCheckBox* cbxClockEnabled;
wxCheckBox* cbxClock24;
wxCheckBox* cbxTextTransparent;
wxStaticBox* WrapperSizer_staticbox;
wxStaticBox* WrapperFBOptionsSizer_staticbox;
wxStaticText* lblFSResolution;
wxComboBox* cmbFSResolution;
wxCheckBox* cbxAnisotropic;
wxCheckBox* cbxVRAM;
wxStaticText* lblVRAM;
wxSpinCtrl* spinVRAM;
wxStaticText* lblMb;
wxCheckBox* cbxFBO;
wxStaticBox* OtherSizer_staticbox;
wxCheckBox* cbxAdvancedSettings;
wxCheckBox* cbxTextureSettings;
wxStaticText* lblScreenShotFormat;
wxComboBox* cmbScreenShotFormat;
wxButton* btnLanguage;
wxPanel* BasicSettingsPanel;
wxStaticBox* EmuSettingsBoxSizer_staticbox;
wxStaticBox* EmuSettingsLeftSizer_staticbox;
wxStaticBox* DepthBufferSizer_staticbox;
wxStaticBox* FrameBufferSizer_staticbox;
wxStaticText* lbFiltering;
wxComboBox* cmbFiltering;
wxStaticText* lbBufferSwap;
wxComboBox* cmbBufferSwap;
wxStaticText* lblLOD;
wxComboBox* cmbLOD;
wxStaticText* lblAspect;
wxComboBox* cmbAspect;
wxCheckBox* cbxFog;
wxCheckBox* cbxBuffer;
wxCheckBox* cbxFBEnable;
wxCheckBox* cbxFBHWFBE;
wxCheckBox* cbxFBGetFBI;
wxCheckBox* cbxFBReadEveryFrame;
wxCheckBox* cbxFBasTex;
wxCheckBox* cbxDetect;
wxCheckBox* cbxFBDepthBuffer;
wxPanel* EmuSettingsPanel;
#ifdef TEXTURE_FILTER
wxStaticBox* PresetsSizer_staticbox;
wxStaticBox* CommonSizer_staticbox;
wxStaticBox* TextureRightSizer_staticbox;
wxStaticBox* EnhTexSizer_staticbox;
wxStaticBox* HRTexPerfTweaksSizer_staticbox;
wxStaticBox* EnhTexPerfTweaksSizer_staticbox;
wxStaticText* lblFilter;
wxComboBox* cmbEnhFilter;
wxStaticText* lblEnhancement;
wxComboBox* cmbEnhEnhancement;
wxStaticText* lblTexCache;
wxSpinCtrl* spinEnhCacheSize;
wxStaticText* lblTexCacheMB;
wxCheckBox* cbxEnhIgnoreBG;
wxCheckBox* cbxEnhTexCompression;
wxCheckBox* cbxEnhCompressCache;
wxStaticText* lblHrsFormat;
wxComboBox* cmbHrsFormat;
wxCheckBox* cbxHrsTile;
wxCheckBox* cbxHrsForce16;
wxCheckBox* cbxHrsAltCRC;
wxCheckBox* cbxHrsTexCompression;
wxCheckBox* cbxHrsCompressCache;
wxCheckBox* cbxHrsLetFly;
wxCheckBox* cbxHrsTexEdit;
wxStaticText* lblTexCompression;
wxComboBox* cmbTextureCompression;
wxCheckBox* cbxSaveTexCache;
wxButton* btnPerformance;
wxButton* btnQuality;
wxPanel* TexturePanel;
#endif //TEXTURE_FILTER
#ifndef _ENDUSER_RELEASE_
wxStaticBox* DebugSizer_staticbox;
wxStaticBox* DevSettingsSizer_staticbox;
wxCheckBox* cbxAutoUcode;
wxStaticText* lblForceUcode;
wxComboBox* cmbForceUcode;
wxCheckBox* cbxWireframe;
wxComboBox* cmbWireframe;
wxCheckBox* cbxLog;
wxCheckBox* cbxCombRed;
wxCheckBox* cbxLogClear;
wxCheckBox* cbxCmbLog;
wxCheckBox* cbxWindowLog;
wxCheckBox* cbxCmbLogClear;
wxCheckBox* cbxErrLog;
wxCheckBox* cbxBilinearTexCache;
wxPanel* DebugPanel;
#endif //_ENDUSER_RELEASE_
// end wxGlade
DECLARE_EVENT_TABLE();
public:
virtual void OnClickVRAM(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void OnClickFB(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void OnLanguageSelect(wxCommandEvent &event); // wxGlade: <event_handler>
#ifdef TEXTURE_FILTER
virtual void onPerformace(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void onQuality(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void OnClickTexEdit(wxCommandEvent &event); // wxGlade: <event_handler>
#endif //TEXTURE_FILTER
// virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: <event_handler>
// virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: <event_handler>
void SaveSettings();
}; // wxGlade: end class
class Glide64ConfigDialog: public wxDialog {
public:
// begin wxGlade: Glide64ConfigDialog::ids
// end wxGlade
Glide64ConfigDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE);
void OnClose(wxCloseEvent& event);
private:
// begin wxGlade: Glide64ConfigDialog::methods
void set_properties();
void do_layout();
// end wxGlade
protected:
// begin wxGlade: Glide64ConfigDialog::attributes
ConfigNotebook* Config;
wxButton* btnOK;
wxButton* btnCancel;
// end wxGlade
DECLARE_EVENT_TABLE();
public:
// virtual void onPageChanged(wxNotebookEvent &event); // wxGlade: <event_handler>
// virtual void onPageChanging(wxNotebookEvent &event); // wxGlade: <event_handler>
virtual void OnOK(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void OnCancel(wxCommandEvent &event); // wxGlade: <event_handler>
}; // wxGlade: end class
class AboutDialog: public wxDialog {
public:
// begin wxGlade: AboutDialog::ids
// end wxGlade
AboutDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE);
private:
// begin wxGlade: AboutDialog::methods
void set_properties();
void do_layout();
// end wxGlade
protected:
// begin wxGlade: AboutDialog::attributes
wxButton* button_ok;
// end wxGlade
}; // wxGlade: end class
#endif // CONFIG_H

1020
Source/Glide64/Debugger.cpp Normal file

File diff suppressed because it is too large Load Diff

137
Source/Glide64/Debugger.h Normal file
View File

@ -0,0 +1,137 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#define SELECTED_NONE 0x00000000
#define SELECTED_TRI 0x00000001
#define SELECTED_TEX 0x00000002
typedef struct TEX_INFO_t
{
wxUint32 cur_cache[2]; // Current cache #
wxUint8 format;
wxUint8 size;
wxUint32 width, height;
wxUint16 line, wid;
wxUint8 palette;
wxUint8 clamp_s, clamp_t;
wxUint8 mirror_s, mirror_t;
wxUint8 mask_s, mask_t;
wxUint8 shift_s, shift_t;
wxUint16 ul_s, ul_t, lr_s, lr_t;
wxUint16 t_ul_s, t_ul_t, t_lr_s, t_lr_t;
float scale_s, scale_t;
int tmu;
} TEX_INFO;
typedef struct TRI_INFO_t
{
wxUint32 nv; // Number of vertices
VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline
wxUint32 cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering
wxUint8 uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
wxUint32 geom_mode; // geometry mode flags
wxUint32 othermode_h; // setothermode_h flags
wxUint32 othermode_l; // setothermode_l flags
wxUint32 tri_n; // Triangle number
wxUint32 flags;
int type; // 0-normal, 1-texrect, 2-fillrect
// texture info
TEX_INFO t[2];
// colors
wxUint32 fog_color;
wxUint32 fill_color;
wxUint32 prim_color;
wxUint32 blend_color;
wxUint32 env_color;
wxUint32 prim_lodmin, prim_lodfrac;
TRI_INFO_t *pNext;
} TRI_INFO;
typedef struct DEBUGGER_t
{
int capture; // Capture moment for debugging?
wxUint32 selected; // Selected object (see flags above)
TRI_INFO *tri_sel;
wxUint32 tex_scroll; // texture scrolling
wxUint32 tex_sel;
// CAPTURE INFORMATION
wxUint8 *screen; // Screen capture
TRI_INFO *tri_list; // Triangle information list
TRI_INFO *tri_last; // Last in the list (first in)
wxUint32 tmu; // tmu #
wxUint32 draw_mode;
// Page number
int page;
} GLIDE64_DEBUGGER;
#define PAGE_GENERAL 0
#define PAGE_TEX1 1
#define PAGE_TEX2 2
#define PAGE_COLORS 3
#define PAGE_FBL 4
#define PAGE_OTHERMODE_L 5
#define PAGE_OTHERMODE_H 6
#define PAGE_TEXELS 7
#define PAGE_COORDS 8
#define PAGE_TEX_INFO 9
#define TRI_TRIANGLE 0
#define TRI_TEXRECT 1
#define TRI_FILLRECT 2
#define TRI_BACKGROUND 3
extern GLIDE64_DEBUGGER _debugger;
void debug_init ();
void debug_capture ();
void debug_cacheviewer ();
void debug_mouse ();
void debug_keys ();
void output (float x, float y, int scale, const char *fmt, ...);

View File

@ -0,0 +1,300 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Software rendering into N64 depth buffer
// Idea and N64 depth value format by Orkin
// Polygon rasterization algorithm is taken from FATMAP2 engine by Mats Byggmastar, mri@penti.sit.fi
//
// Created by Gonetz, Dec 2004
//
//****************************************************************
#include "Gfx #1.3.h"
#include "rdp.h"
#include "DepthBufferRender.h"
wxUint16 * zLUT = 0;
void ZLUT_init()
{
if (zLUT)
return;
zLUT = new wxUint16[0x40000];
for(int i=0; i<0x40000; i++)
{
wxUint32 exponent = 0;
wxUint32 testbit = 1 << 17;
while((i & testbit) && (exponent < 7))
{
exponent++;
testbit = 1 << (17 - exponent);
}
wxUint32 mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff;
zLUT[i] = (wxUint16)(((exponent << 11) | mantissa) << 2);
}
}
void ZLUT_release()
{
delete[] zLUT;
zLUT = 0;
}
static vertexi * max_vtx; // Max y vertex (ending vertex)
static vertexi * start_vtx, * end_vtx; // First and last vertex in array
static vertexi * right_vtx, * left_vtx; // Current right and left vertex
static int right_height, left_height;
static int right_x, right_dxdy, left_x, left_dxdy;
static int left_z, left_dzdy;
extern "C" int imul16(int x, int y);
extern "C" int imul14(int x, int y);
extern "C" int idiv16(int x, int y);
__inline int iceil(int x)
{
x += 0xffff;
return (x >> 16);
}
static void RightSection(void)
{
// Walk backwards trough the vertex array
vertexi * v2, * v1 = right_vtx;
if(right_vtx > start_vtx) v2 = right_vtx-1;
else v2 = end_vtx; // Wrap to end of array
right_vtx = v2;
// v1 = top vertex
// v2 = bottom vertex
// Calculate number of scanlines in this section
right_height = iceil(v2->y) - iceil(v1->y);
if(right_height <= 0) return;
// Guard against possible div overflows
if(right_height > 1) {
// OK, no worries, we have a section that is at least
// one pixel high. Calculate slope as usual.
int height = v2->y - v1->y;
right_dxdy = idiv16(v2->x - v1->x, height);
}
else {
// Height is less or equal to one pixel.
// Calculate slope = width * 1/height
// using 18:14 bit precision to avoid overflows.
int inv_height = (0x10000 << 14) / (v2->y - v1->y);
right_dxdy = imul14(v2->x - v1->x, inv_height);
}
// Prestep initial values
int prestep = (iceil(v1->y) << 16) - v1->y;
right_x = v1->x + imul16(prestep, right_dxdy);
}
static void LeftSection(void)
{
// Walk forward trough the vertex array
vertexi * v2, * v1 = left_vtx;
if(left_vtx < end_vtx) v2 = left_vtx+1;
else v2 = start_vtx; // Wrap to start of array
left_vtx = v2;
// v1 = top vertex
// v2 = bottom vertex
// Calculate number of scanlines in this section
left_height = iceil(v2->y) - iceil(v1->y);
if(left_height <= 0) return;
// Guard against possible div overflows
if(left_height > 1) {
// OK, no worries, we have a section that is at least
// one pixel high. Calculate slope as usual.
int height = v2->y - v1->y;
left_dxdy = idiv16(v2->x - v1->x, height);
left_dzdy = idiv16(v2->z - v1->z, height);
}
else {
// Height is less or equal to one pixel.
// Calculate slope = width * 1/height
// using 18:14 bit precision to avoid overflows.
int inv_height = (0x10000 << 14) / (v2->y - v1->y);
left_dxdy = imul14(v2->x - v1->x, inv_height);
left_dzdy = imul14(v2->z - v1->z, inv_height);
}
// Prestep initial values
int prestep = (iceil(v1->y) << 16) - v1->y;
left_x = v1->x + imul16(prestep, left_dxdy);
left_z = v1->z + imul16(prestep, left_dzdy);
}
void Rasterize(vertexi * vtx, int vertices, int dzdx)
{
start_vtx = vtx; // First vertex in array
// Search trough the vtx array to find min y, max y
// and the location of these structures.
vertexi * min_vtx = vtx;
max_vtx = vtx;
int min_y = vtx->y;
int max_y = vtx->y;
vtx++;
for(int n=1; n<vertices; n++) {
if(vtx->y < min_y) {
min_y = vtx->y;
min_vtx = vtx;
}
else
if(vtx->y > max_y) {
max_y = vtx->y;
max_vtx = vtx;
}
vtx++;
}
// OK, now we know where in the array we should start and
// where to end while scanning the edges of the polygon
left_vtx = min_vtx; // Left side starting vertex
right_vtx = min_vtx; // Right side starting vertex
end_vtx = vtx-1; // Last vertex in array
// Search for the first usable right section
do {
if(right_vtx == max_vtx) return;
RightSection();
} while(right_height <= 0);
// Search for the first usable left section
do {
if(left_vtx == max_vtx) return;
LeftSection();
} while(left_height <= 0);
wxUint16 * destptr = (wxUint16*)(gfx.RDRAM+rdp.zimg);
int y1 = iceil(min_y);
if (y1 >= (int)rdp.scissor_o.lr_y) return;
int shift;
for(;;)
{
int x1 = iceil(left_x);
if (x1 < (int)rdp.scissor_o.ul_x)
x1 = rdp.scissor_o.ul_x;
int width = iceil(right_x) - x1;
if (x1+width >= (int)rdp.scissor_o.lr_x)
width = rdp.scissor_o.lr_x - x1 - 1;
if(width > 0 && y1 >= (int)rdp.scissor_o.ul_y) {
// Prestep initial z
int prestep = (x1 << 16) - left_x;
int z = left_z + imul16(prestep, dzdx);
shift = x1 + y1*rdp.zi_width;
//draw to depth buffer
int trueZ;
int idx;
wxUint16 encodedZ;
for (int x = 0; x < width; x++)
{
trueZ = z/8192;
if (trueZ < 0) trueZ = 0;
else if (trueZ > 0x3FFFF) trueZ = 0x3FFFF;
encodedZ = zLUT[trueZ];
idx = (shift+x)^1;
if(encodedZ < destptr[idx])
destptr[idx] = encodedZ;
z += dzdx;
}
}
//destptr += rdp.zi_width;
y1++;
if (y1 >= (int)rdp.scissor_o.lr_y) return;
// Scan the right side
if(--right_height <= 0) { // End of this section?
do {
if(right_vtx == max_vtx) return;
RightSection();
} while(right_height <= 0);
}
else
right_x += right_dxdy;
// Scan the left side
if(--left_height <= 0) { // End of this section?
do {
if(left_vtx == max_vtx) return;
LeftSection();
} while(left_height <= 0);
}
else {
left_x += left_dxdy;
left_z += left_dzdy;
}
}
}

View File

@ -0,0 +1,60 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Software rendering to N64 depth buffer
// Created by Gonetz, Dec 2004
//
//****************************************************************
#ifndef DEPTH_BUFFER_RENDER_H
#define DEPTH_BUFFER_RENDER_H
struct vertexi
{
int x,y; // Screen position in 16:16 bit fixed point
int z; // z value in 16:16 bit fixed point
};
extern wxUint16 * zLUT;
void ZLUT_init();
void ZLUT_release();
void Rasterize(vertexi * vtx, int vertices, int dzdx);
#endif //DEPTH_BUFFER_RENDER_H

View File

@ -0,0 +1,164 @@
/*
* Texture Filtering
* Version: 1.0
*
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
* Email koolsmoky(at)users.sourceforge.net
* Web http://www.3dfxzone.it/koolsmoky
*
* this is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <memory.h>
#include <stdlib.h>
#include "Ext_TxFilter.h"
typedef boolean (*txfilter_init)(int maxwidth, int maxheight, int maxbpp,
int options, int cachesize,
wchar_t *path, wchar_t *ident,
dispInfoFuncExt callback);
typedef void (*txfilter_shutdown)(void);
typedef boolean (*txfilter_filter)(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
uint64 g64crc, GHQTexInfo *info);
typedef boolean (*txfilter_hirestex)(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info);
typedef uint64 (*txfilter_checksum)(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette);
typedef boolean (*txfilter_dmptx)(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64);
typedef boolean (*txfilter_reloadhirestex)();
static struct {
TXHMODULE lib;
txfilter_init init;
txfilter_shutdown shutdown;
txfilter_filter filter;
txfilter_hirestex hirestex;
txfilter_checksum checksum;
txfilter_dmptx dmptx;
txfilter_reloadhirestex reloadhirestex;
} txfilter;
void ext_ghq_shutdown(void)
{
if (txfilter.shutdown)
(*txfilter.shutdown)();
if (txfilter.lib) {
DLCLOSE(txfilter.lib);
memset(&txfilter, 0, sizeof(txfilter));
}
}
boolean ext_ghq_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
wchar_t *path, wchar_t *ident,
dispInfoFuncExt callback)
{
boolean bRet = 0;
if (!txfilter.lib) {
wchar_t curpath[MAX_PATH];
wcscpy(curpath, path);
#ifdef WIN32
wcscat(curpath, L"\\GlideHQ.dll");
txfilter.lib = DLOPEN(curpath);
#else
char cbuf[MAX_PATH];
wcscat(curpath, L"/GlideHQ.so");
wcstombs(cbuf, curpath, MAX_PATH);
txfilter.lib = DLOPEN(cbuf);
#endif
}
if (txfilter.lib) {
if (!txfilter.init)
txfilter.init = (txfilter_init)DLSYM(txfilter.lib, "txfilter_init");
if (!txfilter.shutdown)
txfilter.shutdown = (txfilter_shutdown)DLSYM(txfilter.lib, "txfilter_shutdown");
if (!txfilter.filter)
txfilter.filter = (txfilter_filter)DLSYM(txfilter.lib, "txfilter");
if (!txfilter.hirestex)
txfilter.hirestex = (txfilter_hirestex)DLSYM(txfilter.lib, "txfilter_hirestex");
if (!txfilter.checksum)
txfilter.checksum = (txfilter_checksum)DLSYM(txfilter.lib, "txfilter_checksum");
if (!txfilter.dmptx)
txfilter.dmptx = (txfilter_dmptx)DLSYM(txfilter.lib, "txfilter_dmptx");
if (!txfilter.reloadhirestex)
txfilter.reloadhirestex = (txfilter_reloadhirestex)DLSYM(txfilter.lib, "txfilter_reloadhirestex");
}
if (txfilter.init && txfilter.shutdown && txfilter.filter &&
txfilter.hirestex && txfilter.checksum /*&& txfilter.dmptx && txfilter.reloadhirestex */)
bRet = (*txfilter.init)(maxwidth, maxheight, maxbpp, options, cachesize, path, ident, callback);
else
ext_ghq_shutdown();
return bRet;
}
boolean ext_ghq_txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
uint64 g64crc, GHQTexInfo *info)
{
boolean ret = 0;
if (txfilter.filter)
ret = (*txfilter.filter)(src, srcwidth, srcheight, srcformat,
g64crc, info);
return ret;
}
boolean ext_ghq_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info)
{
boolean ret = 0;
if (txfilter.hirestex)
ret = (*txfilter.hirestex)(g64crc, r_crc64, palette, info);
return ret;
}
uint64 ext_ghq_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette)
{
uint64 ret = 0;
if (txfilter.checksum)
ret = (*txfilter.checksum)(src, width, height, size, rowStride, palette);
return ret;
}
boolean ext_ghq_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64)
{
boolean ret = 0;
if (txfilter.dmptx)
ret = (*txfilter.dmptx)(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64);
return ret;
}
boolean ext_ghq_reloadhirestex()
{
boolean ret = 0;
if (txfilter.reloadhirestex)
ret = (*txfilter.reloadhirestex)();
return ret;
}

View File

@ -0,0 +1,211 @@
/*
* Texture Filtering
* Version: 1.0
*
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
* Email koolsmoky(at)users.sourceforge.net
* Web http://www.3dfxzone.it/koolsmoky
*
* this is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* this is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __EXT_TXFILTER_H__
#define __EXT_TXFILTER_H__
#ifdef WIN32
#include <windows.h>
#define TXHMODULE HMODULE
#define DLOPEN(a) LoadLibraryW(a)
#define DLCLOSE(a) FreeLibrary(a)
#define DLSYM(a, b) GetProcAddress(a, b)
#define GETCWD(a, b) GetCurrentDirectoryW(a, b)
#define CHDIR(a) SetCurrentDirectoryW(a)
#else
#include <iostream>
#include <dlfcn.h>
#define MAX_PATH 4095
#define TXHMODULE void*
#define DLOPEN(a) dlopen(a, RTLD_LAZY|RTLD_GLOBAL)
#define DLCLOSE(a) dlclose(a)
#define DLSYM(a, b) dlsym(a, b)
#define GETCWD(a, b) getcwd(b, a)
#define CHDIR(a) chdir(a)
#endif
#ifdef __MSC__
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
typedef long long int64;
typedef unsigned long long uint64;
typedef unsigned char boolean;
#endif
#define NO_OPTIONS 0x00000000
#define FILTER_MASK 0x000000ff
#define NO_FILTER 0x00000000
#define SMOOTH_FILTER_MASK 0x0000000f
#define NO_SMOOTH_FILTER 0x00000000
#define SMOOTH_FILTER_1 0x00000001
#define SMOOTH_FILTER_2 0x00000002
#define SMOOTH_FILTER_3 0x00000003
#define SMOOTH_FILTER_4 0x00000004
#define SHARP_FILTER_MASK 0x000000f0
#define NO_SHARP_FILTER 0x00000000
#define SHARP_FILTER_1 0x00000010
#define SHARP_FILTER_2 0x00000020
#define ENHANCEMENT_MASK 0x00000f00
#define NO_ENHANCEMENT 0x00000000
#define X2_ENHANCEMENT 0x00000100
#define X2SAI_ENHANCEMENT 0x00000200
#define HQ2X_ENHANCEMENT 0x00000300
#define LQ2X_ENHANCEMENT 0x00000400
#define HQ4X_ENHANCEMENT 0x00000500
#define HQ2XS_ENHANCEMENT 0x00000600
#define LQ2XS_ENHANCEMENT 0x00000700
#define COMPRESSION_MASK 0x0000f000
#define NO_COMPRESSION 0x00000000
#define FXT1_COMPRESSION 0x00001000
#define NCC_COMPRESSION 0x00002000
#define S3TC_COMPRESSION 0x00003000
#define HIRESTEXTURES_MASK 0x000f0000
#define NO_HIRESTEXTURES 0x00000000
#define GHQ_HIRESTEXTURES 0x00010000
#define RICE_HIRESTEXTURES 0x00020000
#define JABO_HIRESTEXTURES 0x00030000
#define COMPRESS_TEX 0x00100000
#define COMPRESS_HIRESTEX 0x00200000
#define GZ_TEXCACHE 0x00400000
#define GZ_HIRESTEXCACHE 0x00800000
#define DUMP_TEXCACHE 0x01000000
#define DUMP_HIRESTEXCACHE 0x02000000
#define TILE_HIRESTEX 0x04000000
#define UNDEFINED_0 0x08000000
#define FORCE16BPP_HIRESTEX 0x10000000
#define FORCE16BPP_TEX 0x20000000
#define LET_TEXARTISTS_FLY 0x40000000 /* a little freedom for texture artists */
#define DUMP_TEX 0x80000000
#ifndef __GLIDE_H__ /* GLIDE3 */
/* from 3Dfx Interactive Inc. glide.h */
#define GR_TEXFMT_ALPHA_8 0x2
#define GR_TEXFMT_INTENSITY_8 0x3
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
#define GR_TEXFMT_P_8 0x5
#define GR_TEXFMT_RGB_565 0xa
#define GR_TEXFMT_ARGB_1555 0xb
#define GR_TEXFMT_ARGB_4444 0xc
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
/* from 3Dfx Interactive Inc. g3ext.h */
#define GR_TEXFMT_ARGB_CMP_FXT1 0x11
#define GR_TEXFMT_ARGB_8888 0x12
#define GR_TEXFMT_ARGB_CMP_DXT1 0x16
#define GR_TEXFMT_ARGB_CMP_DXT3 0x18
#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A
#endif /* GLIDE3 */
struct GHQTexInfo {
unsigned char *data;
int width;
int height;
unsigned short format;
int smallLodLog2;
int largeLodLog2;
int aspectRatioLog2;
int tiles;
int untiled_width;
int untiled_height;
unsigned char is_hires_tex;
};
/* Callback to display hires texture info.
* Gonetz <gonetz(at)ngs.ru>
*
* void DispInfo(const char *format, ...)
* {
* va_list args;
* char buf[INFO_BUF];
*
* va_start(args, format);
* vsprintf(buf, format, args);
* va_end(args);
*
* printf(buf);
* }
*/
#define INFO_BUF 4095
typedef void (*dispInfoFuncExt)(const wchar_t *format, ...);
#ifndef TXFILTER_DLL
boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */
int maxheight,/* maximum texture height supported by hardware */
int maxbpp, /* maximum texture bpp supported by hardware */
int options, /* options */
int cachesize,/* cache textures to system memory */
wchar_t *path, /* plugin directory. must be smaller than MAX_PATH */
wchar_t *ident, /* name of ROM. must be no longer than 64 in character. */
dispInfoFuncExt callback /* callback function to display info */
);
void ext_ghq_shutdown(void);
boolean ext_ghq_txfilter(unsigned char *src, /* input texture */
int srcwidth, /* width of input texture */
int srcheight, /* height of input texture */
unsigned short srcformat, /* format of input texture */
uint64 g64crc, /* glide64 crc */
GHQTexInfo *info /* output */
);
boolean ext_ghq_hirestex(uint64 g64crc, /* glide64 crc */
uint64 r_crc64, /* checksum hi:palette low:texture */
unsigned short *palette, /* palette for CI textures */
GHQTexInfo *info /* output */
);
uint64 ext_ghq_checksum(unsigned char *src, /* input texture */
int width, /* width of texture */
int height, /* height of texture */
int size, /* type of texture pixel */
int rowStride, /* row stride in bytes */
unsigned char *palette /* palette */
);
boolean ext_ghq_dmptx(unsigned char *src, /* input texture (must be in 3Dfx Glide format) */
int width, /* width of texture */
int height, /* height of texture */
int rowStridePixel, /* row stride of input texture in pixels */
unsigned short gfmt, /* glide format of input texture */
unsigned short n64fmt,/* N64 format hi:format low:size */
uint64 r_crc64 /* checksum hi:palette low:texture */
);
boolean ext_ghq_reloadhirestex();
#endif /* TXFILTER_DLL */
#endif /* __EXT_TXFILTER_H__ */

View File

@ -0,0 +1,663 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Draw N64 frame buffer to screen.
// Created by Gonetz, 2007
//
//****************************************************************
#include "Gfx #1.3.h"
#include "FBtoScreen.h"
#include "TexCache.h"
static int SetupFBtoScreenCombiner(wxUint32 texture_size, wxUint32 opaque)
{
int tmu;
if (voodoo.tmem_ptr[GR_TMU0]+texture_size < voodoo.tex_max_addr[0])
{
tmu = GR_TMU0;
grTexCombine( GR_TMU1,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE );
grTexCombine( GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE );
}
else
{
if (voodoo.tmem_ptr[GR_TMU1]+texture_size >= voodoo.tex_max_addr[1])
ClearCache ();
tmu = GR_TMU1;
grTexCombine( GR_TMU1,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE );
grTexCombine( GR_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
FXFALSE,
FXFALSE );
}
int filter = (rdp.filter_mode!=2)?GR_TEXTUREFILTER_POINT_SAMPLED:GR_TEXTUREFILTER_BILINEAR;
grTexFilterMode (tmu, filter, filter);
grTexClampMode (tmu,
GR_TEXTURECLAMP_CLAMP,
GR_TEXTURECLAMP_CLAMP);
// grConstantColorValue (0xFFFFFFFF);
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
if (opaque)
{
grAlphaTestFunction (GR_CMP_ALWAYS);
grAlphaBlendFunction( GR_BLEND_ONE,
GR_BLEND_ZERO,
GR_BLEND_ONE,
GR_BLEND_ZERO);
}
else
{
grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,
GR_BLEND_ONE_MINUS_SRC_ALPHA,
GR_BLEND_ONE,
GR_BLEND_ZERO);
}
grDepthBufferFunction (GR_CMP_ALWAYS);
grCullMode(GR_CULL_DISABLE);
grDepthMask (FXFALSE);
rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
return tmu;
}
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 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 lr_u = (fb_info.width - 1)*scale;
float lr_v = (fb_info.height - 1)*scale;
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
{ lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
{ ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
}
static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
{
FRDP("DrawRE2Video256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
wxUint32 * src = (wxUint32*)(gfx.RDRAM+fb_info.addr);
GrTexInfo t_info;
t_info.smallLodLog2 = GR_LOD_LOG2_256;
t_info.largeLodLog2 = GR_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
wxUint16 * tex = (wxUint16*)texture_buffer;
wxUint16 * dst = tex;
wxUint32 col;
wxUint8 r, g, b;
fb_info.height = min(256, fb_info.height);
for (wxUint32 h = 0; h < fb_info.height; h++)
{
for (wxUint32 w = 0; w < 256; w++)
{
col = *(src++);
r = (wxUint8)((col >> 24)&0xFF);
r = (wxUint8)((float)r / 255.0f * 31.0f);
g = (wxUint8)((col >> 16)&0xFF);
g = (wxUint8)((float)g / 255.0f * 63.0f);
b = (wxUint8)((col >> 8)&0xFF);
b = (wxUint8)((float)b / 255.0f * 31.0f);
*(dst++) = (r << 11) | (g << 5) | b;
}
src += (fb_info.width - 256);
}
t_info.format = GR_TEXFMT_RGB_565;
t_info.data = tex;
int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
grTexDownloadMipMap (tmu,
voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
grTexSource (tmu,
voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
DrawRE2Video(fb_info, 1.0f);
}
static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
{
if (settings.hacks&hack_RE2)
{
DrawRE2Video256(fb_info);
return;
}
FRDP("DrawFrameBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 width256 = ((width-1) >> 8) + 1;
wxUint32 height256 = ((height-1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.format = GR_TEXFMT_ARGB_1555;
wxUint16 * tex = (wxUint16*)texture_buffer;
t_info.data = tex;
wxUint32 tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
wxUint16 * src = (wxUint16*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 * src32 = (wxUint32*)image;
src32 += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 w_tail = width%256;
wxUint32 h_tail = height%256;
wxUint16 c;
wxUint32 c32;
wxUint32 idx;
wxUint32 bound = BMASK+1-fb_info.addr;
bound = fb_info.size == 2 ? bound >> 1 : bound >> 2;
wxUint8 r, g, b, a;
wxUint32 cur_width, cur_height, cur_tail;
wxUint32 tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
if ((voodoo.tmem_ptr[tmu] < TEXMEM_2MB_EDGE) && (voodoo.tmem_ptr[tmu]+tex_size*width256*height256 > TEXMEM_2MB_EDGE))
{
tex_adr = TEXMEM_2MB_EDGE;
}
for (wxUint32 h = 0; h < height256; h++)
{
for (wxUint32 w = 0; w < width256; w++)
{
cur_width = (256*(w+1) < width) ? 256 : w_tail;
cur_height = (256*(h+1) < height) ? 256 : h_tail;
cur_tail = 256 - cur_width;
wxUint16 * dst = tex;
if (fb_info.size == 2)
{
for (wxUint32 y=0; y < cur_height; y++)
{
for (wxUint32 x=0; x < cur_width; x++)
{
idx = (x+256*w+(y+256*h)*fb_info.width)^1;
if (idx >= bound)
break;
c = src[idx];
*(dst++) = (c >> 1) | ((c&1)<<15);
}
dst += cur_tail;
}
}
else
{
for (wxUint32 y=0; y < cur_height; y++)
{
for (wxUint32 x=0; x < cur_width; x++)
{
idx = (x+256*w+(y+256*h)*fb_info.width);
if (idx >= bound)
break;
c32 = src32[idx];
r = (wxUint8)((c32 >> 24)&0xFF);
r = (wxUint8)((float)r / 255.0f * 31.0f);
g = (wxUint8)((c32 >> 16)&0xFF);
g = (wxUint8)((float)g / 255.0f * 63.0f);
b = (wxUint8)((c32 >> 8)&0xFF);
b = (wxUint8)((float)b / 255.0f * 31.0f);
a = (c32&0xFF) ? 1 : 0;
*(dst++) = (a<<15) | (r << 10) | (g << 5) | b;
}
dst += cur_tail;
}
}
grTexDownloadMipMap (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
grTexSource (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
tex_adr += tex_size;
float ul_x = (float)(fb_info.ul_x + 256*w);
float ul_y = (float)(fb_info.ul_y + 256*h);
float lr_x = (ul_x + (float)(cur_width)) * rdp.scale_x;
float lr_y = (ul_y + (float)(cur_height)) * rdp.scale_y;
ul_x *= rdp.scale_x;
ul_y *= rdp.scale_y;
ul_x += rdp.offset_x;
ul_y += rdp.offset_y;
lr_x += rdp.offset_x;
lr_y += rdp.offset_y;
float lr_u = (float)(cur_width-1);
float lr_v = (float)(cur_height-1);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
{ lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
{ ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
}
}
}
bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
{
if (fb_info.width < 200 || fb_info.size < 2)
return false;
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
wxUint32 max_size = min(voodoo.max_tex_size, 512);
if (width > (wxUint32)max_size || height > (wxUint32)max_size)
{
DrawFrameBufferToScreen256(fb_info);
return true;
}
FRDP("DrawFrameBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 texwidth, texheight;
float scale;
if (width <= 256)
{
texwidth = 256;
scale = 1.0f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
}
else
{
texwidth = 512;
scale = 0.5f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_512;
}
if (height <= (texwidth>>1))
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
texheight = texwidth>>1;
}
else
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
texheight = texwidth;
}
if (fb_info.size == 2)
{
wxUint16 * tex = (wxUint16*)texture_buffer;
wxUint16 * dst = tex;
wxUint16 * src = (wxUint16*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint16 c;
wxUint32 idx;
const wxUint32 bound = (BMASK+1-fb_info.addr) >> 1;
bool empty = true;
for (wxUint32 y=0; y < height; y++)
{
for (wxUint32 x=0; x < width; x++)
{
idx = (x+y*fb_info.width)^1;
if (idx >= bound)
break;
c = src[idx];
if (c) empty = false;
*(dst++) = (c >> 1) | ((c&1)<<15);
}
dst += texwidth-width;
}
if (empty)
return false;
t_info.format = GR_TEXFMT_ARGB_1555;
t_info.data = tex;
}
else
{
wxUint32 * tex = (wxUint32*)texture_buffer;
wxUint32 * dst = tex;
wxUint32 * src = (wxUint32*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 col;
wxUint32 idx;
const wxUint32 bound = (BMASK+1-fb_info.addr) >> 2;
for (wxUint32 y=0; y < height; y++)
{
for (wxUint32 x=0; x < width; x++)
{
idx = x+y*fb_info.width;
if (idx >= bound)
break;
col = src[idx];
*(dst++) = (col >> 8) | 0xFF000000;
}
dst += texwidth-width;
}
t_info.format = GR_TEXFMT_ARGB_8888;
t_info.data = tex;
}
int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
grTexDownloadMipMap (tmu,
voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
grTexSource (tmu,
voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
if (settings.hacks&hack_RE2)
{
DrawRE2Video(fb_info, scale);
}
else
{
float ul_x = fb_info.ul_x * rdp.scale_x + rdp.offset_x;
float ul_y = fb_info.ul_y * rdp.scale_y + rdp.offset_y;
float lr_x = fb_info.lr_x * rdp.scale_x + rdp.offset_x;
float lr_y = fb_info.lr_y * rdp.scale_y + rdp.offset_y;
float lr_u = (width-1)*scale;
float lr_v = (height-1)*scale;
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
{ lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
{ ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
}
return true;
}
static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
{
FRDP("DrawDepthBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 width256 = ((width-1) >> 8) + 1;
wxUint32 height256 = ((height-1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
wxUint16 * tex = (wxUint16*)texture_buffer;
t_info.data = tex;
wxUint32 tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
grConstantColorValue (rdp.fog_color);
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
wxUint16 * src = (wxUint16*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 w_tail = width%256;
wxUint32 h_tail = height%256;
wxUint32 cur_width, cur_height, cur_tail;
wxUint32 tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
if ((voodoo.tmem_ptr[tmu] < TEXMEM_2MB_EDGE) && (voodoo.tmem_ptr[tmu]+tex_size*width256*height256 > TEXMEM_2MB_EDGE))
{
tex_adr = TEXMEM_2MB_EDGE;
}
for (wxUint32 h = 0; h < height256; h++)
{
for (wxUint32 w = 0; w < width256; w++)
{
cur_width = (256*(w+1) < width) ? 256 : w_tail;
cur_height = (256*(h+1) < height) ? 256 : h_tail;
cur_tail = 256 - cur_width;
wxUint16 * dst = tex;
for (wxUint32 y=0; y < cur_height; y++)
{
for (wxUint32 x=0; x < cur_width; x++)
{
*(dst++) = rdp.pal_8[src[(x+256*w+(y+256*h)*fb_info.width)^1]>>8];
}
dst += cur_tail;
}
grTexDownloadMipMap (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
grTexSource (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
tex_adr += tex_size;
float ul_x = (float)(fb_info.ul_x + 256*w);
float ul_y = (float)(fb_info.ul_y + 256*h);
float lr_x = (ul_x + (float)(cur_width)) * rdp.scale_x + rdp.offset_x;
float lr_y = (ul_y + (float)(cur_height)) * rdp.scale_y + rdp.offset_y;
ul_x = ul_x * rdp.scale_x + rdp.offset_x;
ul_y = ul_y * rdp.scale_y + rdp.offset_y;
float lr_u = (float)(cur_width-1);
float lr_v = (float)(cur_height-1);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
{ lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
{ ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
}
}
}
static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
{
FRDP("DrawHiresDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
GrTexInfo t_info;
float scale = 0.25f;
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (settings.scr_res_x > 1024)
{
scale = 0.125f;
LOD = GR_LOD_LOG2_2048;
}
t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
t_info.smallLodLog2 = t_info.largeLodLog2 = LOD;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
grConstantColorValue (rdp.fog_color);
grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,
GR_BLEND_ONE_MINUS_SRC_ALPHA,
GR_BLEND_ONE,
GR_BLEND_ZERO);
grDepthBufferFunction (GR_CMP_ALWAYS);
grDepthMask (FXFALSE);
grCullMode (GR_CULL_DISABLE);
grTexCombine( GR_TMU1,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE );
grTexCombine( GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE);
// grAuxBufferExt( GR_BUFFER_AUXBUFFER );
grTexSource( rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(t_info) );
float ul_x = (float)rdp.scissor.ul_x;
float ul_y = (float)rdp.scissor.ul_y;
float lr_x = (float)rdp.scissor.lr_x;
float lr_y = (float)rdp.scissor.lr_y;
float ul_u = (float)rdp.scissor.ul_x * scale;
float ul_v = (float)rdp.scissor.ul_y * scale;
float lr_u = (float)rdp.scissor.lr_x * scale;
float lr_v = (float)rdp.scissor.lr_y * scale;
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, ul_u, ul_v, ul_u, ul_v, {ul_u, ul_v, ul_u, ul_v} },
{ lr_x, ul_y, 1, 1, lr_u, ul_v, lr_u, ul_v, {lr_u, ul_v, lr_u, ul_v} },
{ ul_x, lr_y, 1, 1, ul_u, lr_v, ul_u, lr_v, {ul_u, lr_v, ul_u, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
// grAuxBufferExt( GR_BUFFER_TEXTUREAUXBUFFER_EXT );
rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
}
void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
{
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
if (width > (wxUint32)voodoo.max_tex_size || height > (wxUint32)voodoo.max_tex_size || width > 512)
{
DrawDepthBufferToScreen256(fb_info);
return;
}
if (fb_hwfbe_enabled && !evoodoo)
{
DrawHiresDepthBufferToScreen(fb_info);
return;
}
FRDP("DrawDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 texwidth, texheight;
float scale;
if (width <= 256)
{
texwidth = 256;
scale = 1.0f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
}
else
{
texwidth = 512;
scale = 0.5f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_512;
}
if (height <= (texwidth>>1))
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
texheight = texwidth>>1;
}
else
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
texheight = texwidth;
}
wxUint16 * tex = (wxUint16*)texture_buffer;
wxUint16 * dst = tex;
wxUint16 * src = (wxUint16*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
for (wxUint32 y=0; y < height; y++)
{
for (wxUint32 x=0; x < width; x++)
{
*(dst++) = rdp.pal_8[src[(x+y*fb_info.width)^1]>>8];
}
dst += texwidth-width;
}
t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
t_info.data = tex;
int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
grConstantColorValue (rdp.fog_color);
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
grTexDownloadMipMap (tmu,
voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
grTexSource (tmu,
voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
float ul_x = fb_info.ul_x * rdp.scale_x + rdp.offset_x;
float ul_y = fb_info.ul_y * rdp.scale_y + rdp.offset_y;
float lr_x = fb_info.lr_x * rdp.scale_x + rdp.offset_x;
float lr_y = fb_info.lr_y * rdp.scale_y + rdp.offset_y;
float lr_u = (width-1)*scale;
float lr_v = (height-1)*scale;
float zero = scale*0.5f;
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, {zero, zero, zero, zero} },
{ lr_x, ul_y, 1, 1, lr_u, zero, lr_u, zero, {lr_u, zero, lr_u, zero} },
{ ul_x, lr_y, 1, 1, zero, lr_v, zero, lr_v, {zero, lr_v, zero, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
}

View File

@ -0,0 +1,63 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Render N64 frame buffer to screen
// Created by Gonetz, 2007
//
//****************************************************************
#ifndef FBtoSCREEN_H
#define FBtoSCREEN_H
typedef struct
{
wxUint32 addr; //color image address
wxUint32 size;
wxUint32 width;
wxUint32 height;
wxUint32 ul_x;
wxUint32 ul_y;
wxUint32 lr_x;
wxUint32 lr_y;
wxUint32 opaque;
} FB_TO_SCREEN_INFO;
bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info);
void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info);
#endif // #ifndef FBtoSCREEN_H

View File

@ -0,0 +1,81 @@
;/*
;* Glide64 - Glide video plugin for Nintendo 64 emulators.
;*
;* This program is free software; you can redistribute it and/or modify
;* it under the terms of the GNU General Public License as published by
;* the Free Software Foundation; either version 2 of the License, or
;* any later version.
;*
;* This program is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;* GNU General Public License for more details.
;*
;* You should have received a copy of the GNU General Public License
;* along with this program; if not, write to the Free Software
;* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;*/
;
;****************************************************************
;
; Glide64 - Glide Plugin for Nintendo 64 emulators
; Project started on December 29th, 2001
;
; Authors:
; Dave2001, original author, founded the project in 2001, left it in 2002
; Gugaman, joined the project in 2002, left it in 2002
; Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
; Hiroshi 'KoolSmoky' Morii, joined the project in 2007
;
;****************************************************************
;
; To modify Glide64:
; * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
; * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
;
;****************************************************************
%include "inc/c32.mac"
segment .text
; (x * y) >> 16
proc imul16
CPU 586
%$x arg
%$y arg
mov eax, [ebp + %$x]
mov edx, [ebp + %$y]
imul edx
shrd eax,edx,16
endproc ;imul16
;(x * y) >> 14
proc imul14
CPU 586
%$x arg
%$y arg
mov eax, [ebp + %$x]
mov edx, [ebp + %$y]
imul edx
shrd eax,edx,14
endproc ;imul14
;(x << 16) / y
proc idiv16
CPU 586
%$x arg
%$y arg
mov eax, [ebp + %$x]
mov ebx, [ebp + %$y]
mov edx,eax
sar edx,16
shl eax,16
idiv ebx
endproc ;idiv16

700
Source/Glide64/Gfx #1.3.h Normal file
View File

@ -0,0 +1,700 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
/**********************************************************************************
Common gfx plugin spec, version #1.3 maintained by zilmar (zilmar@emulation64.com)
All questions or suggestions should go through the mailing list.
http://www.egroups.com/group/Plugin64-Dev
***********************************************************************************
Notes:
------
Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which
are both passed to the DLL in InitiateGFX will generate an Interrupt from with in
the plugin.
The Setting of the RSP flags and generating an SP interrupt should not be done in
the plugin
**********************************************************************************/
// THIS FILE IS A PRECOMPILED HEADER TO DECREASE BUILD TIME. INCLUDE ALL STANDARD
// .H FILES HERE
#ifndef _GFX_H_INCLUDED__
#define _GFX_H_INCLUDED__
#include <wx/wx.h>
#include <wx/dynlib.h>
#include <wx/filename.h>
#include <wx/datetime.h>
#include <stdio.h>
#include <fstream>
#include <stddef.h> // offsetof
#include <glide.h>
#include "GlideExtensions.h"
#include "rdp.h"
#include "Keys.h"
#if defined __VISUALC__
#define GLIDE64_TRY __try
#define GLIDE64_CATCH __except (EXCEPTION_EXECUTE_HANDLER)
#else
#define GLIDE64_TRY try
#define GLIDE64_CATCH catch (...)
#endif
#ifndef __WINDOWS__
typedef void* HWND;
#endif
#ifndef TEXTURE_FILTER
typedef wxInt64 int64;
typedef wxUint64 uint64;
#endif
#if defined(__cplusplus)
extern "C" {
#endif
#define _ENDUSER_RELEASE_
//********
// Logging
// ********************************
// ** TAKE OUT BEFORE RELEASE!!! **
//#define LOGGING // log of spec functions called
//#define LOG_KEY // says "Key!!!" in the log when space bar is pressed
//#define LOG_UCODE
//#define ALTTAB_FIX
//#define EXTREME_LOGGING // lots of logging
// note that some of these things are inserted/removed
// from within the code & may not be changed by this define.
//#define TLUT_LOGGING // log every entry of the TLUT?
// ********************************
#define FPS // fps counter able? (not enabled necessarily)
#define LOGNOTKEY // Log if not pressing:
#define LOGKEY 0x11 // this key (CONTROL)
#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
// "The gfx plugin has caused an exception" instead.
#define FLUSH // flush the file buffer. slower logging, but makes sure
// the command is logged before continuing (in case of
// crash or exception, the log will not be cut short)
#ifndef _ENDUSER_RELEASE_
#define RDP_LOGGING // Allow logging (will not log unless checked, but allows the option)
// Logging functions will not be compiled if this is not present.
//#define RDP_ERROR_LOG
#endif
#define FPS_FRAMES 10 // Number of frames in which to make an FPS count
//#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer,
// usually used to debug clamping issues.
// Usually enabled
#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
#ifdef ALTTAB_FIX
extern HHOOK hhkLowLevelKybd;
extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam);
#endif
// Simulations
//#define SIMULATE_VOODOO1
//#define SIMULATE_BANSHEE
//********
#ifdef EXT_LOGGING
extern std::ofstream extlog;
#define EXT(x) extlog.open("ext.txt",std::ios::app); extlog << x; extlog.close();
#else
#define EXT(x)
#endif
#ifndef _ENDUSER_RELEASE_
#define UNIMP_LOG // Keep enabled, option in dialog
#define BRIGHT_RED // Keep enabled, option in dialog
#endif
#define COLORED_DEBUGGER // ;) pretty colors
#ifdef FPS
extern wxDateTime fps_last;
extern wxDateTime fps_next;
extern float fps;
extern wxUint32 fps_count;
#endif
// rdram mask at 0x400000 bytes (bah, not right for majora's mask)
//#define BMASK 0x7FFFFF
extern unsigned int BMASK;
#define WMASK 0x3FFFFF
#define DMASK 0x1FFFFF
extern wxUint32 update_screen_count;
extern wxUint32 resolutions[0x18][2];
int CheckKeyPressed(int key, int mask);
//#define PERFORMANCE
#ifdef PERFORMANCE
extern int64 perf_cur;
extern int64 perf_next;
#endif
#ifdef LOGGING
extern std::ofstream loga;
#define LOG(x) loga.open("glide64_log.txt",std::ios::app); loga << x; loga.flush(); loga.close();
#else
#define LOG(x)
#endif
#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; }
#ifdef LOGNOTKEY
#define LRDP(x) EXT("RDP (...)\n"); if (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(); }
#endif
#else
#define OPEN_RDP_LOG()
#define CLOSE_RDP_LOG()
#define LRDP(x)
#endif
#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); }
#else
#define OPEN_RDP_E_LOG()
#define CLOSE_RDP_E_LOG()
#define RDP_E(x)
#endif
__inline void FRDP (const char *fmt, ...)
{
#ifdef RDP_LOGGING
if (!settings.logging || !log_open) return;
#ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY,0x8000)) return;
#endif
va_list ap;
va_start(ap, fmt);
vsprintf(out_buf, fmt, ap);
LRDP (out_buf);
va_end(ap);
#endif
}
__inline void FRDP_E (const char *fmt, ...)
{
#ifdef RDP_ERROR_LOG
if (!settings.elogging || !elog_open) return;
#ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY,0x8000)) return;
#endif
sprintf (out_buf, "%08lx: (%08lx, %08lx) ", rdp.pc[rdp.pc_i]-8, rdp.cmd0, rdp.cmd1);
rdp_err << out_buf;
va_list ap2;
va_start(ap2, fmt);
vsprintf(out_buf, fmt, ap2);
rdp_err << out_buf;
rdp_err.flush();
va_end(ap2);
#endif
}
extern int fullscreen;
extern int romopen;
extern int to_fullscreen;
extern int debugging;
extern int evoodoo;
extern int ev_fullscreen;
extern int exception;
extern wxMutex *mutexProcessDList;
int InitGfx ();
void ReleaseGfx ();
// The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to
// add to it.
__inline wxUint32 segoffset (wxUint32 so)
{
return (rdp.segment[(so>>24)&0x0f] + (so&BMASK))&BMASK;
}
/* Plugin types */
#define PLUGIN_TYPE_GFX 2
#ifdef __WINDOWS__
#define EXPORT __declspec(dllexport)
#define CALL _cdecl
#else
#define EXPORT extern
#define CALL
#endif
/***** Structures *****/
typedef struct {
wxUint16 Version; /* Set to 0x0103 */
wxUint16 Type; /* Set to PLUGIN_TYPE_GFX */
char Name[100]; /* Name of the DLL */
/* If DLL supports memory these memory options then set them to TRUE or FALSE
if it does not support it */
int NormalMemory; /* a normal wxUint8 array */
int MemoryBswaped; /* a normal wxUint8 array where the memory has been pre
bswap on a dword (32 bits) boundry */
} PLUGIN_INFO;
typedef struct {
HWND hWnd; /* Render window */
HWND hStatusBar; /* if render window does not have a status bar then this is NULL */
int MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
wxUint8 * HEADER; // This is the rom header (first 40h bytes of the rom
// This will be in the same memory format as the rest of the memory.
wxUint8 * RDRAM;
wxUint8 * DMEM;
wxUint8 * IMEM;
wxUint32 * MI_INTR_REG;
wxUint32 * DPC_START_REG;
wxUint32 * DPC_END_REG;
wxUint32 * DPC_CURRENT_REG;
wxUint32 * DPC_STATUS_REG;
wxUint32 * DPC_CLOCK_REG;
wxUint32 * DPC_BUFBUSY_REG;
wxUint32 * DPC_PIPEBUSY_REG;
wxUint32 * DPC_TMEM_REG;
wxUint32 * VI_STATUS_REG;
wxUint32 * VI_ORIGIN_REG;
wxUint32 * VI_WIDTH_REG;
wxUint32 * VI_INTR_REG;
wxUint32 * VI_V_CURRENT_LINE_REG;
wxUint32 * VI_TIMING_REG;
wxUint32 * VI_V_SYNC_REG;
wxUint32 * VI_H_SYNC_REG;
wxUint32 * VI_LEAP_REG;
wxUint32 * VI_H_START_REG;
wxUint32 * VI_V_START_REG;
wxUint32 * VI_V_BURST_REG;
wxUint32 * VI_X_SCALE_REG;
wxUint32 * VI_Y_SCALE_REG;
void (*CheckInterrupts)( void );
} GFX_INFO;
extern GFX_INFO gfx;
extern wxWindow * GFXWindow;
extern bool no_dlist;
typedef GrContext_t (FX_CALL *GRWINOPENEXT)( FxU32 hWnd,
GrScreenResolution_t resolution,
GrScreenRefresh_t refresh,
GrColorFormat_t format,
GrOriginLocation_t origin,
GrPixelFormat_t pixelformat,
int nColBuffers,
int nAuxBuffers) ;
typedef void (FX_CALL *GRTEXBUFFEREXT)( GrChipID_t tmu,
FxU32 startAddress,
GrLOD_t lodmin,
GrLOD_t lodmax,
GrAspectRatio_t aspect,
GrTextureFormat_t fmt,
FxU32 evenOdd) ;
typedef void (FX_CALL *GRAUXBUFFEREXT)( GrBuffer_t buffer ) ;
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a,
GrCombineMode_t a_mode,
GrCCUColor_t b,
GrCombineMode_t b_mode,
GrCCUColor_t c,
FxBool c_invert,
GrCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert) ;
typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu,
GrTCCUColor_t a,
GrCombineMode_t a_mode,
GrTCCUColor_t b,
GrCombineMode_t b_mode,
GrTCCUColor_t c,
FxBool c_invert,
GrTCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT)
(GrChipID_t tmu,
GrColor_t value);
typedef void (FX_CALL *GRSTIPPLE)( FxI32 mode) ;
typedef void (FX_CALL *GRCONFIGWRAPPEREXT)(FxI32, FxI32, FxBool, FxBool);
typedef GrScreenResolution_t (FX_CALL *GRWRAPPERFULLSCREENRESOLUTIONEXT)(wxUint32*, wxUint32*);
typedef char ** (FX_CALL *GRQUERYRESOLUTIONSEXT)(FxI32*);
typedef int (*GETTEXADDR)(int tmu, int texsize);
extern GRTEXBUFFEREXT grTextureBufferExt;
extern GRTEXBUFFEREXT grTextureAuxBufferExt;
extern GRAUXBUFFEREXT grAuxBufferExt;
extern GRSTIPPLE grStippleModeExt;
extern GRSTIPPLE grStipplePatternExt;
extern GETTEXADDR GetTexAddr;
#ifndef GR_STIPPLE_DISABLE
#define GR_STIPPLE_DISABLE 0x0
#define GR_STIPPLE_PATTERN 0x1
#define GR_STIPPLE_ROTATE 0x2
#endif
void ReadSettings ();
void ReadSpecialSettings (const char * name);
void WriteSettings (bool saveEmulationSettings = false);
/******************************************************************
Function: CaptureScreen
Purpose: This function dumps the current frame to a file
input: pointer to the directory to save the file to
output: none
*******************************************************************/
EXPORT void CALL CaptureScreen ( char * Directory );
/******************************************************************
Function: ChangeWindow
Purpose: to change the window between fullscreen and window
mode. If the window was in fullscreen this should
change the screen to window mode and vice vesa.
input: none
output: none
*******************************************************************/
EXPORT void CALL ChangeWindow (void);
/******************************************************************
Function: CloseDLL
Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise.
input: none
output: none
*******************************************************************/
EXPORT void CALL CloseDLL (void);
/******************************************************************
Function: DllAbout
Purpose: This function is optional function that is provided
to give further information about the DLL.
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllAbout ( HWND hParent );
/******************************************************************
Function: DllConfig
Purpose: This function is optional function that is provided
to allow the user to configure the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllConfig ( HWND hParent );
/******************************************************************
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllTest ( HWND hParent );
EXPORT void CALL ReadScreen(void **dest, int *width, int *height);
/******************************************************************
Function: DrawScreen
Purpose: This function is called when the emulator receives a
WM_PAINT message. This allows the gfx to fit in when
it is being used in the desktop.
input: none
output: none
*******************************************************************/
EXPORT void CALL DrawScreen (void);
/******************************************************************
Function: GetDllInfo
Purpose: This function allows the emulator to gather information
about the dll by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO stucture that needs to be
filled by the function. (see def above)
output: none
*******************************************************************/
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo );
/******************************************************************
Function: InitiateGFX
Purpose: This function is called when the DLL is started to give
information from the emulator that the n64 graphics
uses. This is not called from the emulation thread.
Input: Gfx_Info is passed to this function which is defined
above.
Output: TRUE on success
FALSE on failure to initialise
** note on interrupts **:
To generate an interrupt set the appropriate bit in MI_INTR_REG
and then call the function CheckInterrupts to tell the emulator
that there is a waiting interrupt.
*******************************************************************/
EXPORT int CALL InitiateGFX (GFX_INFO Gfx_Info);
/******************************************************************
Function: MoveScreen
Purpose: This function is called in response to the emulator
receiving a WM_MOVE passing the xpos and ypos passed
from that message.
input: xpos - the x-coordinate of the upper-left corner of the
client area of the window.
ypos - y-coordinate of the upper-left corner of the
client area of the window.
output: none
*******************************************************************/
EXPORT void CALL MoveScreen (int xpos, int ypos);
/******************************************************************
Function: ProcessDList
Purpose: This function is called when there is a Dlist to be
processed. (High level GFX list)
input: none
output: none
*******************************************************************/
EXPORT void CALL ProcessDList(void);
/******************************************************************
Function: ProcessRDPList
Purpose: This function is called when there is a Dlist to be
processed. (Low level GFX list)
input: none
output: none
*******************************************************************/
EXPORT void CALL ProcessRDPList(void);
/******************************************************************
Function: RomClosed
Purpose: This function is called when a rom is closed.
input: none
output: none
*******************************************************************/
EXPORT void CALL RomClosed (void);
/******************************************************************
Function: RomOpen
Purpose: This function is called when a rom is open. (from the
emulation thread)
input: none
output: none
*******************************************************************/
EXPORT void CALL RomOpen (void);
/******************************************************************
Function: ShowCFB
Purpose: Useally once Dlists are started being displayed, cfb is
ignored. This function tells the dll to start displaying
them again.
input: none
output: none
*******************************************************************/
EXPORT void CALL ShowCFB (void);
/******************************************************************
Function: UpdateScreen
Purpose: This function is called in response to a vsync of the
screen were the VI bit in MI_INTR_REG has already been
set
input: none
output: none
*******************************************************************/
EXPORT void CALL UpdateScreen (void);
/******************************************************************
Function: ViStatusChanged
Purpose: This function is called to notify the dll that the
ViStatus registers value has been changed.
input: none
output: none
*******************************************************************/
EXPORT void CALL ViStatusChanged (void);
/******************************************************************
Function: ViWidthChanged
Purpose: This function is called to notify the dll that the
ViWidth registers value has been changed.
input: none
output: none
*******************************************************************/
EXPORT void CALL ViWidthChanged (void);
/******************************************************************
Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
output: none
*******************************************************************/
EXPORT void CALL FBWrite(wxUint32, wxUint32);
typedef struct
{
wxUint32 addr;
wxUint32 val;
wxUint32 size; // 1 = wxUint8, 2 = wxUint16, 4=wxUint32
} FrameBufferModifyEntry;
/******************************************************************
Function: FrameBufferWriteList
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: FrameBufferModifyEntry *plist
size = size of the plist, max = 1024
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size);
/******************************************************************
Function: FrameBufferRead
Purpose: This function is called to notify the dll that the
frame buffer memory is beening read at the given address.
DLL should copy content from its render buffer to the frame buffer
in N64 RDRAM
DLL is responsible to maintain its own frame buffer memory addr list
DLL should copy 4KB block content back to RDRAM frame buffer.
Emulator should not call this function again if other memory
is read within the same 4KB range
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
output: none
*******************************************************************/
EXPORT void CALL FBRead(wxUint32 addr);
/************************************************************************
Function: FBGetFrameBufferInfo
Purpose: This function is called by the emulator core to retrieve depth
buffer information from the video plugin in order to be able
to notify the video plugin about CPU depth buffer read/write
operations
size:
= 1 byte
= 2 word (16 bit) <-- this is N64 default depth buffer format
= 4 dword (32 bit)
when depth buffer information is not available yet, set all values
in the FrameBufferInfo structure to 0
input: FrameBufferInfo *pinfo
pinfo is pointed to a FrameBufferInfo structure which to be
filled in by this function
output: Values are return in the FrameBufferInfo structure
************************************************************************/
EXPORT void CALL FBGetFrameBufferInfo(void *pinfo);
/******************************************************************
NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
ORIGINAL SPEC
Function: SetConfigDir
Purpose: To pass the location where config files should be read/
written to.
input: path to config directory
output: none
*******************************************************************/
EXPORT void CALL SetConfigDir(char *configDir);
#if defined(__cplusplus)
}
#endif
#endif //_GFX_H_INCLUDED__

View File

@ -0,0 +1,45 @@
#define GR_BUFFER_TEXTUREBUFFER_EXT 0x6
#define GR_BUFFER_TEXTUREAUXBUFFER_EXT 0x7
typedef FxU32 GrPixelFormat_t;
#define GR_PIXFMT_RGB_565 0x03
#define GR_PIXFMT_ARGB_1555 0x0004
#define GR_PIXFMT_ARGB_8888 0x0005
typedef FxU32 GrCCUColor_t;
typedef FxU32 GrACUColor_t;
typedef FxU32 GrTCCUColor_t;
typedef FxU32 GrTACUColor_t;
#define GR_CMBX_ZERO 0x00
#define GR_CMBX_TEXTURE_ALPHA 0x01
#define GR_CMBX_ALOCAL 0x02
#define GR_CMBX_AOTHER 0x03
#define GR_CMBX_B 0x04
#define GR_CMBX_CONSTANT_ALPHA 0x05
#define GR_CMBX_CONSTANT_COLOR 0x06
#define GR_CMBX_DETAIL_FACTOR 0x07
#define GR_CMBX_ITALPHA 0x08
#define GR_CMBX_ITRGB 0x09
#define GR_CMBX_LOCAL_TEXTURE_ALPHA 0x0a
#define GR_CMBX_LOCAL_TEXTURE_RGB 0x0b
#define GR_CMBX_LOD_FRAC 0x0c
#define GR_CMBX_OTHER_TEXTURE_ALPHA 0x0d
#define GR_CMBX_OTHER_TEXTURE_RGB 0x0e
#define GR_CMBX_TEXTURE_RGB 0x0f
#define GR_CMBX_TMU_CALPHA 0x10
#define GR_CMBX_TMU_CCOLOR 0x11
typedef FxU32 GrCombineMode_t;
#define GR_FUNC_MODE_ZERO 0x00
#define GR_FUNC_MODE_X 0x01
#define GR_FUNC_MODE_ONE_MINUS_X 0x02
#define GR_FUNC_MODE_NEGATIVE_X 0x03
#define GR_FUNC_MODE_X_MINUS_HALF 0x04
#define GR_TEXFMT_ARGB_8888 0x12
#define GR_LOD_LOG2_2048 0xb
#define GR_LOD_LOG2_1024 0xa
#define GR_LOD_LOG2_512 0x9
#define GR_TEXTURE_UMA_EXT 0x06

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

113
Source/Glide64/Keys.cpp Normal file
View File

@ -0,0 +1,113 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Keys, used by Glide64.
// Since key codes are different for WinAPI and SDL, this difference is managed here
// Created by Sergey 'Gonetz' Lipski, July 2009
//
//****************************************************************
#include "Gfx #1.3.h"
Glide64Keys::Glide64Keys()
{
#ifdef __WINDOWS__
_keys[G64_VK_CONTROL] = 0x11;
_keys[G64_VK_ALT] = 0x12;
_keys[G64_VK_INSERT] = 0x2D;
_keys[G64_VK_LBUTTON] = 0x01;
_keys[G64_VK_UP] = 0x26;
_keys[G64_VK_DOWN] = 0x28;
_keys[G64_VK_LEFT] = 0x25;
_keys[G64_VK_RIGHT] = 0x27;
_keys[G64_VK_SPACE] = 0x20;
_keys[G64_VK_BACK] = 0x08;
_keys[G64_VK_SCROLL] = 0x91;
_keys[G64_VK_1] = 0x31;
_keys[G64_VK_2] = 0x32;
_keys[G64_VK_3] = 0x33;
_keys[G64_VK_4] = 0x34;
_keys[G64_VK_5] = 0x35;
_keys[G64_VK_6] = 0x36;
_keys[G64_VK_7] = 0x37;
_keys[G64_VK_8] = 0x38;
_keys[G64_VK_9] = 0x39;
_keys[G64_VK_0] = 0x30;
_keys[G64_VK_A] = 0x41;
_keys[G64_VK_B] = 0x42;
_keys[G64_VK_D] = 0x44;
_keys[G64_VK_G] = 0x47;
_keys[G64_VK_Q] = 0x51;
_keys[G64_VK_R] = 0x52;
_keys[G64_VK_S] = 0x53;
_keys[G64_VK_V] = 0x56;
_keys[G64_VK_W] = 0x57;
#else
_keys[G64_VK_CONTROL] = 306;
_keys[G64_VK_ALT] = 308;
_keys[G64_VK_INSERT] = 277;
_keys[G64_VK_LBUTTON] = 1;
_keys[G64_VK_UP] = 273;
_keys[G64_VK_DOWN] = 274;
_keys[G64_VK_LEFT] = 276;
_keys[G64_VK_RIGHT] = 275;
_keys[G64_VK_SPACE] = 32;
_keys[G64_VK_BACK] = 8;
_keys[G64_VK_SCROLL] = 302;
_keys[G64_VK_1] = 49;
_keys[G64_VK_2] = 50;
_keys[G64_VK_3] = 51;
_keys[G64_VK_4] = 52;
_keys[G64_VK_5] = 53;
_keys[G64_VK_6] = 54;
_keys[G64_VK_7] = 55;
_keys[G64_VK_8] = 56;
_keys[G64_VK_9] = 57;
_keys[G64_VK_0] = 48;
_keys[G64_VK_A] = 97;
_keys[G64_VK_B] = 98;
_keys[G64_VK_D] = 100;
_keys[G64_VK_G] = 103;
_keys[G64_VK_Q] = 113;
_keys[G64_VK_R] = 114;
_keys[G64_VK_S] = 115;
_keys[G64_VK_V] = 118;
_keys[G64_VK_W] = 119;
#endif
}

93
Source/Glide64/Keys.h Normal file
View File

@ -0,0 +1,93 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Keys, used by Glide64.
// Since key codes are different for WinAPI and SDL, this difference is managed here
// Created by Sergey 'Gonetz' Lipski, July 2009
//
//****************************************************************
#ifndef Keys_H
#define Keys_H
#define G64_VK_CONTROL 0
#define G64_VK_ALT 1
#define G64_VK_INSERT 2
#define G64_VK_LBUTTON 3
#define G64_VK_UP 4
#define G64_VK_DOWN 5
#define G64_VK_LEFT 6
#define G64_VK_RIGHT 7
#define G64_VK_SPACE 8
#define G64_VK_BACK 9
#define G64_VK_SCROLL 10
#define G64_VK_1 11
#define G64_VK_2 12
#define G64_VK_3 13
#define G64_VK_4 14
#define G64_VK_5 15
#define G64_VK_6 16
#define G64_VK_7 17
#define G64_VK_8 18
#define G64_VK_9 19
#define G64_VK_0 20
#define G64_VK_A 21
#define G64_VK_B 22
#define G64_VK_D 23
#define G64_VK_G 24
#define G64_VK_Q 25
#define G64_VK_R 26
#define G64_VK_S 27
#define G64_VK_V 28
#define G64_VK_W 29
#define G64_NUM_KEYS 30
class Glide64Keys
{
public:
Glide64Keys();
~Glide64Keys(){}
int operator[](unsigned int index){return _keys[index];}
private:
int _keys[G64_NUM_KEYS];
};
#endif //Keys_H

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"></assembly>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,518 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Glide64"
ProjectGUID="{A4D13408-A794-4199-8FC7-4A9A32505005}"
RootNamespace="n64Glide"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/n64Glide.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(WXDIR)\lib\vc_lib\msw&quot;;&quot;$(WXDIR)\include&quot;;..\inc"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/n64Glide.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="3dmathSIMD.obj Texture.obj FixedPoint.obj glide3x.lib wxmsw28d_core.lib wxbase28d.lib wxexpatd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib winmm.lib comctl32.lib rpcrt4.lib wsock32.lib msvcrtd.lib"
OutputFile="$(OutDir)\Glide64.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\lib;&quot;$(WXDIR)\lib\vc_lib&quot;"
IgnoreAllDefaultLibraries="false"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/Glide64.pdb"
ImportLibrary=".\Debug/Glide64.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/n64Glide.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="D:\Games\N64\plugin\Glide64.dll"
IntermediateDirectory=".\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/n64Glide.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories="&quot;$(WXDIR)\lib\vc_lib\msw&quot;;&quot;$(WXDIR)\include&quot;;..\inc"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=".\Release/n64Glide.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="3dmathSIMD.obj Texture.obj FixedPoint.obj glide3x.lib wxmsw28_core.lib wxbase28.lib wxexpat.lib wxjpeg.lib wxpng.lib wxzlib.lib winmm.lib comctl32.lib rpcrt4.lib wsock32.lib msvcrt.lib LIBCMT.lib"
OutputFile="$(OutDir)\Glide64.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\lib;&quot;$(WXDIR)\lib\vc_lib&quot;"
GenerateManifest="true"
ProgramDatabaseFile=".\Release/Glide64.pdb"
ImportLibrary=".\Release/Glide64.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/n64Glide.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="ucode"
>
<File
RelativePath="..\turbo3D.h"
>
</File>
<File
RelativePath="..\ucode.h"
>
</File>
<File
RelativePath="..\ucode00.h"
>
</File>
<File
RelativePath="..\ucode01.h"
>
</File>
<File
RelativePath="..\ucode02.h"
>
</File>
<File
RelativePath="..\ucode03.h"
>
</File>
<File
RelativePath="..\ucode04.h"
>
</File>
<File
RelativePath="..\ucode05.h"
>
</File>
<File
RelativePath="..\ucode06.h"
>
</File>
<File
RelativePath="..\ucode07.h"
>
</File>
<File
RelativePath="..\ucode08.h"
>
</File>
<File
RelativePath="..\ucode09.h"
>
</File>
<File
RelativePath="..\ucode09rdp.h"
>
</File>
<File
RelativePath="..\ucodeFB.h"
>
</File>
</Filter>
<Filter
Name="Texture"
>
<File
RelativePath="..\CRC.cpp"
>
</File>
<File
RelativePath="..\CRC.h"
>
</File>
<File
RelativePath="..\MiClWr16b.h"
>
</File>
<File
RelativePath="..\MiClWr32b.h"
>
</File>
<File
RelativePath="..\MiClWr8b.h"
>
</File>
<File
RelativePath="..\TexCache.cpp"
>
</File>
<File
RelativePath="..\TexCache.h"
>
</File>
<File
RelativePath="..\TexConv.h"
>
</File>
<File
RelativePath="..\TexLoad.h"
>
</File>
<File
RelativePath="..\TexLoad16b.h"
>
</File>
<File
RelativePath="..\TexLoad32b.h"
>
</File>
<File
RelativePath="..\TexLoad4b.h"
>
</File>
<File
RelativePath="..\TexLoad8b.h"
>
</File>
<File
RelativePath="..\TexMod.h"
>
</File>
<File
RelativePath="..\TexModCI.h"
>
</File>
<File
RelativePath="..\Texture.asm"
>
</File>
</Filter>
<Filter
Name="Config"
>
<File
RelativePath="..\Config.cpp"
>
</File>
<File
RelativePath="..\Config.h"
>
</File>
</Filter>
<Filter
Name="Doc"
Filter="txt"
>
<File
RelativePath="..\gpl.txt"
>
</File>
</Filter>
<Filter
Name="Icons"
>
<File
RelativePath="..\australia.xpm"
>
</File>
<File
RelativePath="..\brazil.xpm"
>
</File>
<File
RelativePath="..\france.xpm"
>
</File>
<File
RelativePath="..\japan.xpm"
>
</File>
<File
RelativePath="..\logo.xpm"
>
</File>
<File
RelativePath="..\russia.xpm"
>
</File>
<File
RelativePath="..\usa.xpm"
>
</File>
</Filter>
<Filter
Name="Res"
>
<File
RelativePath="..\cursor.h"
>
</File>
<File
RelativePath="..\font.h"
>
</File>
</Filter>
<File
RelativePath="..\3dmath.cpp"
>
</File>
<File
RelativePath="..\3dmath.h"
>
</File>
<File
RelativePath="..\3dmathSIMD.asm"
>
</File>
<File
RelativePath="..\Combine.cpp"
>
</File>
<File
RelativePath="..\Combine.h"
>
</File>
<File
RelativePath="..\Debugger.cpp"
>
</File>
<File
RelativePath="..\Debugger.h"
>
</File>
<File
RelativePath="..\DepthBufferRender.cpp"
>
</File>
<File
RelativePath="..\DepthBufferRender.h"
>
</File>
<File
RelativePath="..\Ext_TxFilter.cpp"
>
</File>
<File
RelativePath="..\Ext_TxFilter.h"
>
</File>
<File
RelativePath="..\FBtoScreen.cpp"
>
</File>
<File
RelativePath="..\FBtoScreen.h"
>
</File>
<File
RelativePath="..\FixedPoint.asm"
>
</File>
<File
RelativePath="..\Gfx #1.3.h"
>
</File>
<File
RelativePath="..\GlideExtensions.h"
>
</File>
<File
RelativePath="..\Keys.cpp"
>
</File>
<File
RelativePath="..\Keys.h"
>
</File>
<File
RelativePath="..\Main.cpp"
>
</File>
<File
RelativePath="..\rdp.cpp"
>
</File>
<File
RelativePath="..\rdp.h"
>
</File>
<File
RelativePath="..\TexBuffer.cpp"
>
</File>
<File
RelativePath="..\TexBuffer.h"
>
</File>
<File
RelativePath="..\Util.cpp"
>
</File>
<File
RelativePath="..\Util.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

2435
Source/Glide64/Main.cpp Normal file

File diff suppressed because it is too large Load Diff

189
Source/Glide64/Makefile.gcc Normal file
View File

@ -0,0 +1,189 @@
# This MUST be processed by GNU make
#
# Glide64 Makefile
# Version: 1.0
#
# this is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# this is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Make; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Available options:
#
# Environment variables:
# DEBUG=1 enable debugging checks and messages
# default = no
#
# Environment variables:
#
# Targets:
# all: build dynamic module
# clean: remove object files
# realclean: remove all generated files
#
#
# Requirements:
#
# Compiler:
# GCC 4.2
#
# Libraries:
# glide3x - build Glitch64 first, copy the result dll to 'lib' folder
# wx-widgets 2.8 (http://www.wxwidgets.org)
#
#
# GCC does not have SEH (structured exception handling)
#
.PHONY: all clean realclean ostype
OS=$(shell uname)
ifeq ($(findstring MINGW,$(OS)),MINGW)
OS := WINDOWS
endif
ifeq ($(findstring CYGWIN,$(OS)),CYGWIN)
OS=WINDOWS
endif
ifeq ($(findstring WINNT,$(OS)),WINNT)
OS=WINDOWS
endif
ifeq ($(OS),Darwin)
OS=MACOSX
endif
ifeq ($(OS), WINDOWS)
DLLNAME = Glide64.dll
else
DLLNAME = Glide64.so
endif
EXT_INC = ./inc
EXT_LIB = ./lib
CC = g++
STRIP = strip
CFLAGS = -DBUILDING_DLL=1 -fexceptions
LDLIBS = -L"." -L"lib" `wx-config --libs`
ifeq ($(OS), Linux)
CC += -V 4.2
LDFLAGS = -shared -lstdc++
CFLAGS += -D__unix__
LDLIBS += $(EXT_LIB)/glide3x.so
endif
ifeq ($(OS), MACOSX)
LDFLAGS = -dynamiclib -lstdc++
CFLAGS += -D__unix__ -Dmacintosh
LDLIBS += $(EXT_LIB)/glide3x.dylib
endif
ifeq ($(OS), WINDOWS)
LDFLAGS = -shared -mwindows
CFLAGS += -D__WIN32__ -DWIN32 -D_WIN32
LDLIBS += $(EXT_LIB)/glide3x.lib
endif
CFLAGS += -ffast-math -funroll-loops
#CFLAGS += -fexpensive-optimizations -march=k6
CFLAGS += -I. -I$(EXT_INC) `wx-config --cppflags`
ifdef DEBUG
CFLAGS += -g -DDEBUG
endif
LD = g++
AS = nasm
ifeq ($(OS), Linux)
ASFLAGS = -O6 -felf -D__linux__
ASM_OBJ = \
3dmathSIMD.o \
FixedPoint.o \
Texture.o
else
ifeq ($(OS), MACOSX)
ASFLAGS = -O6 -fmacho --prefix _
ASM_OBJ = \
3dmathSIMD.o \
FixedPoint.o \
Texture.o
else
ifeq ($(OS), WINDOWS)
ASFLAGS = -O6 -fwin32 -D__WIN32__ --prefix _
ASM_OBJ = \
3dmathSIMD.obj \
FixedPoint.obj \
Texture.obj
endif
endif
endif
RM = rm
SOURCES = \
3dmath.cpp \
Combine.cpp \
Config.cpp \
CRC.cpp \
Debugger.cpp \
DepthBufferRender.cpp \
Ext_TxFilter.cpp \
FBtoScreen.cpp \
Main.cpp \
Keys.cpp \
rdp.cpp \
TexBuffer.cpp \
TexCache.cpp \
Util.cpp
OBJECTS = $(SOURCES:.cpp=.o)
.cpp.o:
$(CC) -o $@ $(CFLAGS) -c $<
all: $(DLLNAME)
$(DLLNAME): $(OBJECTS) $(ASM_OBJ)
$(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS)
ifeq ($(OS), Linux)
$(STRIP) $@
endif
ifneq ($(OS), WINDOWS)
3dmathSIMD.o: 3dmathSIMD.asm
$(AS) -o $@ $(ASFLAGS) $<
FixedPoint.o: FixedPoint.asm
$(AS) -o $@ $(ASFLAGS) $<
Texture.o: Texture.asm
$(AS) -o $@ $(ASFLAGS) $<
else
3dmathSIMD.obj: 3dmathSIMD.asm
$(AS) -o $@ $(ASFLAGS) $<
FixedPoint.obj: FixedPoint.asm
$(AS) -o $@ $(ASFLAGS) $<
Texture.obj: Texture.asm
$(AS) -o $@ $(ASFLAGS) $<
endif
clean:
-$(RM) *.o
realclean: clean
-$(RM) $(DLLNAME)
ostype:
echo $(OS)
-include depend

167
Source/Glide64/MiClWr16b.h Normal file
View File

@ -0,0 +1,167 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
extern "C" void asmMirror16bS (int tex, int start, int width, int height, int mask, int line, int full, int count);
extern "C" void asmWrap16bS (int tex, int start, int height, int mask, int line, int full, int count);
extern "C" void asmClamp16bS (int tex, int constant, int height,int line, int full, int count);
//****************************************************************
// 16-bit Horizontal Mirror
void Mirror16bS (wxUint32 tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) << 1;
if (mask_width >= max_width) return;
int count = max_width - mask_width;
if (count <= 0) return;
int line_full = real_width << 1;
int line = line_full - (count << 1);
if (line < 0) return;
wxUint32 start = tex + (mask_width << 1);
asmMirror16bS (tex, start, mask_width, height, mask_mask, line, line_full, count);
}
//****************************************************************
// 16-bit Horizontal Wrap (like mirror)
void Wrap16bS (wxUint32 tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) >> 1;
if (mask_width >= max_width) return;
int count = (max_width - mask_width) >> 1;
if (count <= 0) return;
int line_full = real_width << 1;
int line = line_full - (count << 2);
if (line < 0) return;
wxUint32 start = tex + (mask_width << 1);
asmWrap16bS (tex, start, height, mask_mask, line, line_full, count);
}
//****************************************************************
// 16-bit Horizontal Clamp
void Clamp16bS (wxUint32 tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
{
if (real_width <= width) return;
wxUint32 dest = tex + (width << 1);
wxUint32 constant = dest-2;
int count = clamp_to - width;
int line_full = real_width << 1;
int line = width << 1;
asmClamp16bS (dest, constant, real_height, line, line_full, count);
}
//****************************************************************
// 16-bit Vertical Mirror
void Mirror16bT (wxUint32 tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 1;
wxUint32 dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
{
if (y & mask_height)
{
// mirrored
memcpy ((void*)dst, (void*)(tex + (mask_mask - (y & mask_mask)) * line_full), line_full);
}
else
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
}
dst += line_full;
}
}
//****************************************************************
// 16-bit Vertical Wrap
void Wrap16bT (wxUint32 tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 1;
wxUint32 dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
dst += line_full;
}
}
//****************************************************************
// 16-bit Vertical Clamp
void Clamp16bT (wxUint32 tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
{
int line_full = real_width << 1;
wxUint32 dst = tex + height * line_full;
wxUint32 const_line = dst - line_full;
for (wxUint32 y=height; y<clamp_to; y++)
{
memcpy ((void*)dst, (void*)const_line, line_full);
dst += line_full;
}
}

171
Source/Glide64/MiClWr32b.h Normal file
View File

@ -0,0 +1,171 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Created by Gonetz, 2007
//
//****************************************************************
extern "C" void asmMirror32bS (int tex, int start, int width, int height, int mask, int line, int full, int count);
extern "C" void asmWrap32bS (int tex, int start, int height, int mask, int line, int full, int count);
extern "C" void asmClamp32bS (int tex, int constant, int height,int line, int full, int count);
//****************************************************************
// 32-bit Horizontal Mirror
void Mirror32bS (wxUint32 tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) << 2;
if (mask_width >= max_width) return;
int count = max_width - mask_width;
if (count <= 0) return;
int line_full = real_width << 2;
int line = line_full - (count << 2);
if (line < 0) return;
wxUint32 start = tex + (mask_width << 2);
asmMirror32bS (tex, start, mask_width, height, mask_mask, line, line_full, count);
}
//****************************************************************
// 32-bit Horizontal Wrap
void Wrap32bS (wxUint32 tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1);
if (mask_width >= max_width) return;
int count = (max_width - mask_width);
if (count <= 0) return;
int line_full = real_width << 2;
int line = line_full - (count << 2);
if (line < 0) return;
wxUint32 start = tex + (mask_width << 2);
asmWrap32bS (tex, start, height, mask_mask, line, line_full, count);
}
//****************************************************************
// 32-bit Horizontal Clamp
void Clamp32bS (wxUint32 tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
{
if (real_width <= width) return;
wxUint32 dest = tex + (width << 2);
wxUint32 constant = dest-4;
int count = clamp_to - width;
int line_full = real_width << 2;
int line = width << 2;
asmClamp32bS (dest, constant, real_height, line, line_full, count);
}
//****************************************************************
// 32-bit Vertical Mirror
void Mirror32bT (wxUint32 tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 2;
wxUint32 dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
{
if (y & mask_height)
{
// mirrored
memcpy ((void*)dst, (void*)(tex + (mask_mask - (y & mask_mask)) * line_full), line_full);
}
else
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
}
dst += line_full;
}
}
//****************************************************************
// 32-bit Vertical Wrap
void Wrap32bT (wxUint32 tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 2;
wxUint32 dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
dst += line_full;
}
}
//****************************************************************
// 32-bit Vertical Clamp
void Clamp32bT (wxUint32 tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
{
int line_full = real_width << 2;
wxUint32 dst = tex + height * line_full;
wxUint32 const_line = dst - line_full;
for (wxUint32 y=height; y<clamp_to; y++)
{
memcpy ((void*)dst, (void*)const_line, line_full);
dst += line_full;
}
}

166
Source/Glide64/MiClWr8b.h Normal file
View File

@ -0,0 +1,166 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//****************************************************************
// 8-bit Horizontal Mirror
extern "C" void asmMirror8bS (int tex, int start, int width, int height, int mask, int line, int full, int count);
extern "C" void asmWrap8bS (int tex, int start, int height, int mask, int line, int full, int count);
extern "C" void asmClamp8bS (int tex, int constant, int height,int line, int full, int count);
void Mirror8bS (wxUint32 tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1);
if (mask_width >= max_width) return;
int count = max_width - mask_width;
if (count <= 0) return;
int line_full = real_width;
int line = line_full - (count);
if (line < 0) return;
wxUint32 start = tex + (mask_width);
asmMirror8bS (tex, start, mask_width, height, mask_mask, line, line_full, count);
}
//****************************************************************
// 8-bit Horizontal Wrap (like mirror) ** UNTESTED **
void Wrap8bS (wxUint32 tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) >> 2;
if (mask_width >= max_width) return;
int count = (max_width - mask_width) >> 2;
if (count <= 0) return;
int line_full = real_width;
int line = line_full - (count << 2);
if (line < 0) return;
wxUint32 start = tex + (mask_width);
asmWrap8bS (tex, start, height, mask_mask, line, line_full, count);
}
//****************************************************************
// 8-bit Horizontal Clamp
void Clamp8bS (wxUint32 tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
{
if (real_width <= width) return;
wxUint32 dest = tex + (width);
wxUint32 constant = dest-1;
int count = clamp_to - width;
int line_full = real_width;
int line = width;
asmClamp8bS (dest, constant, real_height, line, line_full, count);
}
//****************************************************************
// 8-bit Vertical Mirror
void Mirror8bT (wxUint32 tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width;
wxUint32 dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
{
if (y & mask_height)
{
// mirrored
memcpy ((void*)dst, (void*)(tex + (mask_mask - (y & mask_mask)) * line_full), line_full);
}
else
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
}
dst += line_full;
}
}
//****************************************************************
// 8-bit Vertical Wrap
void Wrap8bT (wxUint32 tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width;
wxUint32 dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
dst += line_full;
}
}
//****************************************************************
// 8-bit Vertical Clamp
void Clamp8bT (wxUint32 tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
{
int line_full = real_width;
wxUint32 dst = tex + height * line_full;
wxUint32 const_line = dst - line_full;
for (wxUint32 y=height; y<clamp_to; y++)
{
memcpy ((void*)dst, (void*)const_line, line_full);
dst += line_full;
}
}

View File

@ -0,0 +1,752 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Hardware frame buffer emulation
// Dec 2003 created by Gonetz
//
//****************************************************************
#include "Gfx #1.3.h"
#include "TexBuffer.h"
#include "CRC.h"
static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
{
TBUFF_COLOR_IMAGE texbuf;
texbuf.addr = cimage.addr;
texbuf.end_addr = cimage.addr + ((cimage.width*cimage.height)<<cimage.size>>1);
texbuf.width = cimage.width;
texbuf.height = cimage.height;
texbuf.format = cimage.format;
texbuf.size = cimage.size;
texbuf.scr_width = min(cimage.width * rdp.scale_x, settings.scr_res_x);
float height = min(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;
texbuf.scr_height = height * rdp.scale_y;
// texbuf.scr_height = texbuf.height * rdp.scale_y;
wxUint16 max_size = max((wxUint16)texbuf.scr_width, (wxUint16)texbuf.scr_height);
if (max_size > voodoo.max_tex_size) //texture size is too large
return 0;
wxUint32 tex_size;
//calculate LOD
switch ((max_size-1) >> 6)
{
case 0:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_64;
tex_size = 64;
break;
case 1:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_128;
tex_size = 128;
break;
case 2:
case 3:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_256;
tex_size = 256;
break;
case 4:
case 5:
case 6:
case 7:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_512;
tex_size = 512;
break;
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_1024;
tex_size = 1024;
break;
default:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_2048;
tex_size = 2048;
}
//calculate aspect
if (texbuf.scr_width >= texbuf.scr_height)
{
if ((texbuf.scr_width/texbuf.scr_height) >= 2)
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
texbuf.tex_width = tex_size;
texbuf.tex_height = tex_size >> 1;
}
else
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
texbuf.tex_width = texbuf.tex_height = tex_size;
}
}
else
{
if ((texbuf.scr_height/texbuf.scr_width) >= 2)
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_1x2;
texbuf.tex_width = tex_size >> 1;
texbuf.tex_height = tex_size;
}
else
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
texbuf.tex_width = texbuf.tex_height = tex_size;
}
}
if ((cimage.format != 0))// && (cimage.width <= 64))
texbuf.info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
else
texbuf.info.format = GR_TEXFMT_RGB_565;
texbuf.lr_u = 256.0f * texbuf.scr_width / (float)tex_size;// + 1.0f;
texbuf.lr_v = 256.0f * texbuf.scr_height / (float)tex_size;// + 1.0f;
texbuf.tile = 0;
texbuf.tile_uls = 0;
texbuf.tile_ult = 0;
texbuf.u_shift = 0;
texbuf.v_shift = 0;
texbuf.drawn = FALSE;
texbuf.u_scale = texbuf.lr_u / (float)(texbuf.width);
texbuf.v_scale = texbuf.lr_v / (float)(texbuf.height);
texbuf.cache = 0;
texbuf.crc = 0;
texbuf.t_mem = 0;
FRDP("\nAllocateTextureBuffer. width: %d, height: %d, scr_width: %f, scr_height: %f, vi_width: %f, vi_height:%f, scale_x: %f, scale_y: %f, lr_u: %f, lr_v: %f, u_scale: %f, v_scale: %f\n", texbuf.width, texbuf.height, texbuf.scr_width, texbuf.scr_height, rdp.vi_width, rdp.vi_height, rdp.scale_x, rdp.scale_y, texbuf.lr_u, texbuf.lr_v, texbuf.u_scale, texbuf.v_scale);
wxUint32 required = grTexCalcMemRequired(texbuf.info.smallLodLog2, texbuf.info.largeLodLog2,
texbuf.info.aspectRatioLog2, texbuf.info.format);
//find free space
for (int i = 0; i < voodoo.num_tmu; i++)
{
wxUint32 available = 0;
wxUint32 top = 0;
if (rdp.texbufs[i].count)
{
TBUFF_COLOR_IMAGE & t = rdp.texbufs[i].images[rdp.texbufs[i].count - 1];
if (rdp.read_whole_frame || rdp.motionblur)
{
if ((cimage.status == ci_aux) && (rdp.cur_tex_buf == i))
{
top = t.tex_addr + t.tex_width * (int)(t.scr_height+1) * 2;
if (rdp.texbufs[i].end - top < required)
return 0;
}
else
top = rdp.texbufs[i].end;
}
else
top = t.tex_addr + t.tex_width * t.tex_height * 2;
available = rdp.texbufs[i].end - top;
}
else
{
available = rdp.texbufs[i].end - rdp.texbufs[i].begin;
top = rdp.texbufs[i].begin;
}
if (available >= required)
{
rdp.texbufs[i].count++;
rdp.texbufs[i].clear_allowed = FALSE;
texbuf.tex_addr = top;
rdp.cur_tex_buf = i;
texbuf.tmu = rdp.texbufs[i].tmu;
rdp.texbufs[i].images[rdp.texbufs[i].count - 1] = texbuf;
return &(rdp.texbufs[i].images[rdp.texbufs[i].count - 1]);
}
}
//not found. keep recently accessed bank, clear second one
if (!rdp.texbufs[rdp.cur_tex_buf^1].clear_allowed) //can't clear => can't allocate
return 0;
rdp.cur_tex_buf ^= 1;
rdp.texbufs[rdp.cur_tex_buf].count = 1;
rdp.texbufs[rdp.cur_tex_buf].clear_allowed = FALSE;
texbuf.tmu = rdp.texbufs[rdp.cur_tex_buf].tmu;
texbuf.tex_addr = rdp.texbufs[rdp.cur_tex_buf].begin;
rdp.texbufs[rdp.cur_tex_buf].images[0] = texbuf;
return &(rdp.texbufs[rdp.cur_tex_buf].images[0]);
}
int OpenTextureBuffer(COLOR_IMAGE & cimage)
{
FRDP("OpenTextureBuffer. cur_tex_buf: %d, addr: %08lx, width: %d, height: %d", rdp.cur_tex_buf, cimage.addr, cimage.width, cimage.height);
if (!fullscreen) return FALSE;
int found = FALSE, search = TRUE;
TBUFF_COLOR_IMAGE *texbuf = 0;
wxUint32 addr = cimage.addr;
if ((settings.hacks&hack_Banjo2) && cimage.status == ci_copy_self)
addr = rdp.frame_buffers[rdp.copy_ci_index].addr;
wxUint32 end_addr = addr + ((cimage.width*cimage.height)<<cimage.size>>1);
if (rdp.motionblur)
{
// if (cimage.format != 0)
// return FALSE;
search = FALSE;
}
if (rdp.read_whole_frame)
{
if (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);
}
else
{
if (!rdp.texbufs[0].clear_allowed || !rdp.texbufs[1].clear_allowed)
{
if (cimage.status == ci_main)
{
texbuf = &(rdp.texbufs[rdp.cur_tex_buf].images[0]);
found = TRUE;
}
else
{
for (int t = 0; (t < rdp.texbufs[rdp.cur_tex_buf].count) && !found; t++)
{
texbuf = &(rdp.texbufs[rdp.cur_tex_buf].images[t]);
if (addr == texbuf->addr && cimage.width == texbuf->width)
{
texbuf->drawn = FALSE;
found = TRUE;
}
}
}
}
search = FALSE;
}
}
if (search)
{
for (int i = 0; (i < voodoo.num_tmu) && !found; i++)
{
for (int j = 0; (j < rdp.texbufs[i].count) && !found; j++)
{
texbuf = &(rdp.texbufs[i].images[j]);
if (addr == texbuf->addr && cimage.width == texbuf->width)
{
//texbuf->height = cimage.height;
//texbuf->end_addr = end_addr;
texbuf->drawn = FALSE;
texbuf->format = (wxUint16)cimage.format;
if ((cimage.format != 0))
texbuf->info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
else
texbuf->info.format = GR_TEXFMT_RGB_565;
texbuf->crc = 0;
texbuf->t_mem = 0;
texbuf->tile = 0;
found = TRUE;
rdp.cur_tex_buf = i;
rdp.texbufs[i].clear_allowed = FALSE;
}
else //check intersection
{
if (!((end_addr <= texbuf->addr) || (addr >= texbuf->end_addr))) //intersected, remove
{
grRenderBuffer( GR_BUFFER_TEXTUREBUFFER_EXT );
grTextureBufferExt( texbuf->tmu, texbuf->tex_addr, texbuf->info.smallLodLog2, texbuf->info.largeLodLog2,
texbuf->info.aspectRatioLog2, texbuf->info.format, GR_MIPMAPLEVELMASK_BOTH );
grDepthMask (FXFALSE);
grBufferClear (0, 0, 0xFFFF);
grDepthMask (FXTRUE);
grRenderBuffer( GR_BUFFER_BACKBUFFER );
rdp.texbufs[i].count--;
if (j < rdp.texbufs[i].count)
memcpy(&(rdp.texbufs[i].images[j]), &(rdp.texbufs[i].images[j+1]), sizeof(TBUFF_COLOR_IMAGE)*(rdp.texbufs[i].count-j));
}
}
}
}
}
else
{
LRDP(" not searched");
}
if (!found)
{
LRDP(" not found");
texbuf = AllocateTextureBuffer(cimage);
}
else
{
LRDP(" found");
}
if (!texbuf)
{
LRDP(" KO\n");
return FALSE;
}
rdp.acc_tex_buf = rdp.cur_tex_buf;
rdp.cur_image = texbuf;
grRenderBuffer( GR_BUFFER_TEXTUREBUFFER_EXT );
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)
{
rdp.cur_image->clear = FALSE;
grDepthMask (FXFALSE);
grBufferClear (0, 0, 0xFFFF);
grDepthMask (FXTRUE);
}
//*/
// memset(gfx.RDRAM+cimage.addr, 0, cimage.width*cimage.height*cimage.size);
FRDP(" texaddr: %08lx, tex_width: %d, tex_height: %d, cur_tex_buf: %d, texformat: %d, motionblur: %d\n", rdp.cur_image->tex_addr, rdp.cur_image->tex_width, rdp.cur_image->tex_height, rdp.cur_tex_buf, rdp.cur_image->info.format, rdp.motionblur);
if (!rdp.offset_x_bak)
{
rdp.offset_x_bak = rdp.offset_x;
rdp.offset_x = 0;
}
if (!rdp.offset_y_bak)
{
rdp.offset_y_bak = rdp.offset_y;
rdp.offset_y = 0;
}
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
return TRUE;
}
static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
{
grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
// grConstantColorValue (0xFFFFFFFF);
grAlphaBlendFunction (GR_BLEND_ONE, // use alpha compare, but not T0 alpha
GR_BLEND_ZERO,
GR_BLEND_ONE,
GR_BLEND_ZERO);
grClipWindow (0, 0, settings.scr_res_x, settings.scr_res_y);
grDepthBufferFunction (GR_CMP_ALWAYS);
grDepthMask (FXFALSE);
grCullMode (GR_CULL_DISABLE);
grFogMode (GR_FOG_DISABLE);
GrTextureFormat_t buf_format = (rdp.tbuff_tex) ? rdp.tbuff_tex->info.format : GR_TEXFMT_RGB_565;
GrCombineFunction_t color_source = GR_COMBINE_FUNCTION_LOCAL;
if (!force_rgb && rdp.black_ci_index > 0 && rdp.black_ci_index <= rdp.copy_ci_index)
{
color_source = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
buf_format = GR_TEXFMT_ALPHA_INTENSITY_88;
}
if (rdp.tbuff_tex->tmu == GR_TMU0)
{
grTexCombine( GR_TMU1,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE );
grTexCombine( GR_TMU0,
color_source,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXTRUE );
}
else
{
grTexCombine( GR_TMU1,
color_source,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXTRUE );
grTexCombine( GR_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
FXFALSE,
FXFALSE );
}
return buf_format;
}
int CloseTextureBuffer(int draw)
{
if (!fullscreen || !rdp.cur_image)
{
LRDP("CloseTextureBuffer KO\n");
return FALSE;
}
grRenderBuffer( GR_BUFFER_BACKBUFFER );
rdp.offset_x = rdp.offset_x_bak;
rdp.offset_y = rdp.offset_y_bak;
rdp.offset_x_bak = rdp.offset_y_bak = 0;
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
if (!draw)
{
LRDP("CloseTextureBuffer no draw, OK\n");
rdp.cur_image = 0;
return TRUE;
}
rdp.tbuff_tex = rdp.cur_image;
rdp.cur_image = 0;
rdp.tbuff_tex->info.format = TexBufSetupCombiner();
float zero = 0.0f;
float ul_x = rdp.offset_x;
float ul_y = rdp.offset_y;
float lr_x = rdp.tbuff_tex->scr_width + rdp.offset_x;
float lr_y = rdp.tbuff_tex->scr_height + rdp.offset_y;
float lr_u = rdp.tbuff_tex->lr_u;
float lr_v = rdp.tbuff_tex->lr_v;
FRDP("lr_x: %f, lr_y: %f, lr_u: %f, lr_v: %f\n", lr_x, lr_y, lr_u, lr_v);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, {zero, zero, zero, zero} },
{ lr_x, ul_y, 1, 1, lr_u, zero, lr_u, zero, {lr_u, zero, lr_u, zero} },
{ ul_x, lr_y, 1, 1, zero, lr_v, zero, lr_v, {zero, lr_v, zero, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
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);
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))
{
grFogMode (GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
LRDP("CloseTextureBuffer draw, OK\n");
rdp.tbuff_tex = 0;
return TRUE;
}
int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
{
if (!fullscreen)
return FALSE;
FRDP("CopyTextureBuffer from %08x to %08x\n", fb_from.addr, fb_to.addr);
if (rdp.cur_image)
{
rdp.cur_image->crc = 0;
if (rdp.cur_image->addr == fb_to.addr)
return CloseTextureBuffer(TRUE);
rdp.tbuff_tex = rdp.cur_image;
}
else if (!FindTextureBuffer(fb_from.addr, (wxUint16)fb_from.width))
{
LRDP("Can't find 'from' buffer.\n");
return FALSE;
}
if (!OpenTextureBuffer(fb_to))
{
LRDP("Can't open new buffer.\n");
return CloseTextureBuffer(TRUE);
}
rdp.tbuff_tex->crc = 0;
GrTextureFormat_t buf_format = rdp.tbuff_tex->info.format;
rdp.tbuff_tex->info.format = GR_TEXFMT_RGB_565;
TexBufSetupCombiner(TRUE);
float ul_x = 0.0f;
float ul_y = 0.0f;
float lr_x = rdp.tbuff_tex->scr_width;
float lr_y = rdp.tbuff_tex->scr_height;
float zero = 0.0f;
float lr_u = rdp.tbuff_tex->lr_u;
float lr_v = rdp.tbuff_tex->lr_v;
FRDP("lr_x: %f, lr_y: %f\n", lr_x, lr_y);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, {zero, zero, zero, zero} },
{ lr_x, ul_y, 1, 1, lr_u, zero, lr_u, zero, {lr_u, zero, lr_u, zero} },
{ ul_x, lr_y, 1, 1, zero, lr_v, zero, lr_v, {zero, lr_v, zero, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grTexSource( rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info) );
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
grRenderBuffer( GR_BUFFER_BACKBUFFER );
rdp.offset_x = rdp.offset_x_bak;
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);
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))
grFogMode (GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
LRDP("CopyTextureBuffer draw, OK\n");
rdp.tbuff_tex = 0;
rdp.cur_image = 0;
return TRUE;
}
int CopyDepthBuffer()
{
if (!fullscreen)
return FALSE;
LRDP("CopyDepthBuffer. ");
float bound = 1024.0f;
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (settings.scr_res_x > 1024)
{
bound = 2048.0f;
LOD = GR_LOD_LOG2_2048;
}
rdp.tbuff_tex = &(rdp.texbufs[0].images[0]);
rdp.tbuff_tex->tmu = rdp.texbufs[0].tmu;
rdp.tbuff_tex->info.format = GR_TEXFMT_RGB_565;
rdp.tbuff_tex->info.smallLodLog2 = rdp.tbuff_tex->info.largeLodLog2 = LOD;
rdp.tbuff_tex->info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
TexBufSetupCombiner(TRUE);
float ul_x = 0.0f;
float ul_y = 0.0f;
float lr_x = bound;
float lr_y = bound;
float zero = 0.0f;
float lr_u = 255.5f;
float lr_v = 255.5f;
FRDP("lr_x: %f, lr_y: %f\n", lr_x, lr_y);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, {zero, zero, zero, zero} },
{ lr_x, ul_y, 1, 1, lr_u, zero, lr_u, zero, {lr_u, zero, lr_u, zero} },
{ ul_x, lr_y, 1, 1, zero, lr_v, zero, lr_v, {zero, lr_v, zero, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grAuxBufferExt( GR_BUFFER_AUXBUFFER );
grTexSource( rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info) );
grRenderBuffer( GR_BUFFER_TEXTUREBUFFER_EXT );
grTextureBufferExt( rdp.texbufs[1].tmu, rdp.texbufs[1].begin, LOD, LOD,
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH );
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
grRenderBuffer( GR_BUFFER_BACKBUFFER );
grTextureAuxBufferExt( rdp.texbufs[1].tmu, rdp.texbufs[1].begin, LOD, LOD,
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH );
grAuxBufferExt( GR_BUFFER_TEXTUREAUXBUFFER_EXT );
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (settings.fog && (rdp.flags & FOG_ENABLED))
grFogMode (GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
LRDP("CopyDepthBuffer draw, OK\n");
rdp.tbuff_tex = 0;
return TRUE;
}
int SwapTextureBuffer()
{
if (!fullscreen || !rdp.tbuff_tex)
return FALSE;
LRDP("SwapTextureBuffer.");
COLOR_IMAGE ci;
ci.addr = rdp.tbuff_tex->addr;
ci.format = rdp.tbuff_tex->format;
ci.width = rdp.tbuff_tex->width;
ci.height = rdp.tbuff_tex->height;
ci.size = 2;
ci.status = ci_main;
ci.changed = FALSE;
TBUFF_COLOR_IMAGE * texbuf = AllocateTextureBuffer(ci);
if (!texbuf)
{
LRDP("Failed!\n");
return FALSE;
}
TexBufSetupCombiner();
float ul_x = 0.0f;
float ul_y = 0.0f;
float lr_x = rdp.tbuff_tex->scr_width;
float lr_y = rdp.tbuff_tex->scr_height;
float zero = 0.0f;
float lr_u = rdp.tbuff_tex->lr_u;
float lr_v = rdp.tbuff_tex->lr_v;
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, {zero, zero, zero, zero} },
{ lr_x, ul_y, 1, 1, lr_u, zero, lr_u, zero, {lr_u, zero, lr_u, zero} },
{ ul_x, lr_y, 1, 1, zero, lr_v, zero, lr_v, {zero, lr_v, zero, lr_v} },
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
};
grTexSource( rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info) );
texbuf->tile_uls = rdp.tbuff_tex->tile_uls;
texbuf->tile_ult = rdp.tbuff_tex->tile_ult;
texbuf->v_shift = rdp.tbuff_tex->v_shift;
grRenderBuffer( GR_BUFFER_TEXTUREBUFFER_EXT );
grTextureBufferExt( texbuf->tmu, texbuf->tex_addr, texbuf->info.smallLodLog2, texbuf->info.largeLodLog2,
texbuf->info.aspectRatioLog2, texbuf->info.format, GR_MIPMAPLEVELMASK_BOTH );
grDrawTriangle (&v[0], &v[2], &v[1]);
grDrawTriangle (&v[2], &v[3], &v[1]);
rdp.texbufs[rdp.tbuff_tex->tmu].clear_allowed = TRUE;
rdp.texbufs[rdp.tbuff_tex->tmu].count = 0;
texbuf->tile_uls = rdp.tbuff_tex->tile_uls;
texbuf->tile_ult = rdp.tbuff_tex->tile_ult;
texbuf->u_shift = rdp.tbuff_tex->u_shift;
texbuf->v_shift = rdp.tbuff_tex->v_shift;
rdp.tbuff_tex = texbuf;
if (rdp.cur_image)
{
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 );
}
else
{
grRenderBuffer( GR_BUFFER_BACKBUFFER );
rdp.offset_x = rdp.offset_x_bak;
rdp.offset_y = rdp.offset_y_bak;
rdp.offset_x_bak = rdp.offset_y_bak = 0;
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))
{
grFogMode (GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
LRDP("SwapTextureBuffer draw, OK\n");
return TRUE;
}
static wxUint32 CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
{
wxUint32 result = 0;
if ((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)
result = *((wxUint32*)(gfx.RDRAM + pTCI->addr + (pTCI->end_addr-pTCI->addr)/2));
else if (settings.fb_crc_mode == SETTINGS::fbcrcSafe)
{
wxUint8 * pSrc = gfx.RDRAM + pTCI->addr;
const wxUint32 nSize = pTCI->end_addr-pTCI->addr;
result = CRC32(0xFFFFFFFF, pSrc, 32);
result = CRC32(result, pSrc + (nSize>>1), 32);
result = CRC32(result, pSrc + nSize - 32, 32);
}
return result;
}
int FindTextureBuffer(wxUint32 addr, wxUint16 width)
{
if (rdp.skip_drawing)
return FALSE;
FRDP("FindTextureBuffer. addr: %08lx, width: %d, scale_x: %f\n", addr, width, rdp.scale_x);
int found = FALSE;
wxUint32 shift = 0;
for (int i = 0; i < voodoo.num_tmu && !found; i++)
{
wxUint8 index = rdp.cur_tex_buf^i;
for (int j = 0; j < rdp.texbufs[index].count && !found; j++)
{
rdp.tbuff_tex = &(rdp.texbufs[index].images[j]);
if(addr >= rdp.tbuff_tex->addr && addr < rdp.tbuff_tex->end_addr)// && rdp.timg.format == 0)
{
bool bCorrect;
if (rdp.tbuff_tex->crc == 0)
{
rdp.tbuff_tex->crc = CalcCRC(rdp.tbuff_tex);
bCorrect = width == 1 || rdp.tbuff_tex->width == width || (rdp.tbuff_tex->width > 320 && rdp.tbuff_tex->width == width*2);
}
else
bCorrect = rdp.tbuff_tex->crc == CalcCRC(rdp.tbuff_tex);
if (bCorrect)
{
shift = addr - rdp.tbuff_tex->addr;
// if (!rdp.motionblur)
if (!rdp.cur_image)
rdp.cur_tex_buf = index;
found = TRUE;
// FRDP("FindTextureBuffer, found in TMU%d buffer: %d\n", rdp.tbuff_tex->tmu, j);
}
else //new texture is loaded into this place, texture buffer is not valid anymore
{
rdp.texbufs[index].count--;
if (j < rdp.texbufs[index].count)
memcpy(&(rdp.texbufs[index].images[j]), &(rdp.texbufs[index].images[j+1]), sizeof(TBUFF_COLOR_IMAGE)*(rdp.texbufs[index].count-j));
}
}
}
}
if (found)
{
rdp.tbuff_tex->tile_uls = 0;
rdp.tbuff_tex->tile_ult = 0;
if (shift > 0)
{
shift >>= 1;
rdp.tbuff_tex->v_shift = shift / rdp.tbuff_tex->width;
rdp.tbuff_tex->u_shift = shift % rdp.tbuff_tex->width;
}
else
{
rdp.tbuff_tex->v_shift = 0;
rdp.tbuff_tex->u_shift = 0;
}
FRDP("FindTextureBuffer, found, u_shift: %d, v_shift: %d, format: %s\n", rdp.tbuff_tex->u_shift, rdp.tbuff_tex->v_shift, str_format[rdp.tbuff_tex->format]);
//FRDP("Buffer, addr=%08lx, end_addr=%08lx, width: %d, height: %d\n", rdp.tbuff_tex->addr, rdp.tbuff_tex->end_addr, rdp.tbuff_tex->width, rdp.tbuff_tex->height);
return TRUE;
}
rdp.tbuff_tex = 0;
LRDP("FindTextureBuffer, not found\n");
return FALSE;
}

View File

@ -0,0 +1,60 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Hardware frame buffer emulation
// Dec 2003 created by Gonetz
//
//****************************************************************
#ifndef TEXBUFFER_H
#define TEXBUFFER_H
int OpenTextureBuffer(COLOR_IMAGE & cimage);
int CloseTextureBuffer(int draw = FALSE);
int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to);
int CopyDepthBuffer();
int SwapTextureBuffer();
int FindTextureBuffer(wxUint32 addr, wxUint16 width);
#endif // ifndef TEXBUFFER

1807
Source/Glide64/TexCache.cpp Normal file

File diff suppressed because it is too large Load Diff

49
Source/Glide64/TexCache.h Normal file
View File

@ -0,0 +1,49 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#ifndef TEXCACHE_H
#define TEXCACHE_H
void TexCacheInit ();
void TexCache ();
void ClearCache ();
extern wxUint8 * texture_buffer;
#endif //TEXCACHE_H

75
Source/Glide64/TexConv.h Normal file
View File

@ -0,0 +1,75 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
extern "C" void asmTexConv_ARGB1555_ARGB4444(wxUIntPtr src, wxUIntPtr dst, int size);
extern "C" void asmTexConv_AI88_ARGB4444(wxUIntPtr src, wxUIntPtr dst, int size);
extern "C" void asmTexConv_AI44_ARGB4444(wxUIntPtr src, wxUIntPtr dst, int size);
extern "C" void asmTexConv_A8_ARGB4444(wxUIntPtr src, wxUIntPtr dst, int size);
void TexConv_ARGB1555_ARGB4444 (wxUIntPtr src, wxUIntPtr dst, int width, int height)
{
int size = (width * height) >> 1; // Hiroshi Morii <koolsmoky@users.sourceforge.net>
// 2 pixels are converted in one loop
// NOTE: width * height must be a multiple of 2
asmTexConv_ARGB1555_ARGB4444(src, dst, size);
}
void TexConv_AI88_ARGB4444 (wxUIntPtr src, wxUIntPtr dst, int width, int height)
{
int size = (width * height) >> 1; // Hiroshi Morii <koolsmoky@users.sourceforge.net>
// 2 pixels are converted in one loop
// NOTE: width * height must be a multiple of 2
asmTexConv_AI88_ARGB4444(src, dst, size);
}
void TexConv_AI44_ARGB4444 (wxUIntPtr src, wxUIntPtr dst, int width, int height)
{
int size = (width * height) >> 2; // Hiroshi Morii <koolsmoky@users.sourceforge.net>
// 4 pixels are converted in one loop
// NOTE: width * height must be a multiple of 4
asmTexConv_AI44_ARGB4444(src, dst, size);
}
void TexConv_A8_ARGB4444 (wxUIntPtr src, wxUIntPtr dst, int width, int height)
{
int size = (width * height) >> 2; // Hiroshi Morii <koolsmoky@users.sourceforge.net>
// 4 pixels are converted in one loop
// NOTE: width * height must be a multiple of 4
asmTexConv_A8_ARGB4444(src, dst, size);
}

76
Source/Glide64/TexLoad.h Normal file
View File

@ -0,0 +1,76 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#include "TexLoad4b.h"
#include "TexLoad8b.h"
#include "TexLoad16b.h"
#include "TexLoad32b.h"
wxUint32 LoadNone (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
memset (texture, 0, 4096*4);
return (1 << 16) | GR_TEXFMT_ARGB_1555;
}
typedef wxUint32 (*texfunc)(wxUIntPtr, wxUIntPtr, int, int, int, int, int);
texfunc load_table [4][5] = { // [size][format]
{ Load4bSelect,
LoadNone,
Load4bCI,
Load4bIA,
Load4bI },
{ Load8bCI,
LoadNone,
Load8bCI,
Load8bIA,
Load8bI },
{ Load16bRGBA,
Load16bYUV,
Load16bRGBA,
Load16bIA,
LoadNone },
{ Load32bRGBA,
LoadNone,
LoadNone,
LoadNone,
LoadNone }
};

136
Source/Glide64/TexLoad16b.h Normal file
View File

@ -0,0 +1,136 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
extern "C" void asmLoad16bRGBA (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext);
extern "C" void asmLoad16bIA (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext);
//****************************************************************
// Size: 2, Format: 0
//
wxUint32 Load16bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 2)) << 1;
asmLoad16bRGBA(src, dst, wid_64, height, line, ext);
return (1 << 16) | GR_TEXFMT_ARGB_1555;
}
//****************************************************************
// Size: 2, Format: 3
//
wxUint32 Load16bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 2)) << 1;
asmLoad16bIA(src, dst, wid_64, height, line, ext);
return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88;
}
//****************************************************************
// Size: 2, Format: 1
//
wxUint16 yuv_to_rgb565(wxUint8 y, wxUint8 u, wxUint8 v)
{
//*
float r = y + (1.370705f * (v-128));
float g = y - (0.698001f * (v-128)) - (0.337633f * (u-128));
float b = y + (1.732446f * (u-128));
r *= 0.125f;
g *= 0.25f;
b *= 0.125f;
//clipping the result
if (r > 31) r = 31;
if (g > 63) g = 63;
if (b > 31) b = 31;
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
wxUint16 c = (wxUint16)(((wxUint16)(r) << 11) |
((wxUint16)(g) << 5) |
(wxUint16)(b) );
return c;
//*/
/*
const wxUint32 c = y - 16;
const wxUint32 d = u - 128;
const wxUint32 e = v - 128;
wxUint32 r = (298 * c + 409 * e + 128) & 0xf800;
wxUint32 g = ((298 * c - 100 * d - 208 * e + 128) >> 5) & 0x7e0;
wxUint32 b = ((298 * c + 516 * d + 128) >> 11) & 0x1f;
WORD texel = (WORD)(r | g | b);
return texel;
*/
}
//****************************************************************
// Size: 2, Format: 1
//
wxUint32 Load16bYUV (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
wxUint32 * mb = (wxUint32*)(gfx.RDRAM+rdp.addr[rdp.tiles[tile].t_mem]); //pointer to the macro block
wxUint16 * tex = (wxUint16*)dst;
wxUint16 i;
for (i = 0; i < 128; i++)
{
wxUint32 t = mb[i]; //each wxUint32 contains 2 pixels
wxUint8 y1 = (wxUint8)t&0xFF;
wxUint8 v = (wxUint8)(t>>8)&0xFF;
wxUint8 y0 = (wxUint8)(t>>16)&0xFF;
wxUint8 u = (wxUint8)(t>>24)&0xFF;
wxUint16 c = yuv_to_rgb565(y0, u, v);
*(tex++) = c;
c = yuv_to_rgb565(y1, u, v);
*(tex++) = c;
}
return (1 << 16) | GR_TEXFMT_RGB_565;
}

177
Source/Glide64/TexLoad32b.h Normal file
View File

@ -0,0 +1,177 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//****************************************************************
// Size: 2, Format: 0
//
// Load 32bit RGBA texture
// Based on sources of angrylion's software plugin.
//
wxUint32 Load32bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (height < 1) height = 1;
const wxUint16 *tmem16 = (wxUint16*)rdp.tmem;
const wxUint32 tbase = (src - (wxUIntPtr)rdp.tmem) >> 1;
const wxUint32 width = max(1, wid_64 << 1);
const int ext = real_width - width;
line = width + (line>>2);
wxUint32 s, t, c;
wxUint32 * tex = (wxUint32*)dst;
wxUint16 rg, ba;
for (t = 0; t < (wxUint32)height; t++)
{
wxUint32 tline = tbase + line * t;
wxUint32 xorval = (t & 1) ? 3 : 1;
for (s = 0; s < width; s++)
{
wxUint32 taddr = ((tline + s) ^ xorval) & 0x3ff;
rg = tmem16[taddr];
ba = tmem16[taddr|0x400];
c = ((ba&0xFF)<<24) | (rg << 8) | (ba>>8);
*tex++ = c;
}
tex += ext;
}
int id = tile - rdp.cur_tile;
wxUint32 mod = (id == 0) ? cmb.mod_0 : cmb.mod_1;
if (mod || !voodoo.sup_32bit_tex)
{
//convert to ARGB_4444
const wxUint32 tex_size = real_width * height;
tex = (wxUint32 *)dst;
wxUint16 *tex16 = (wxUint16*)dst;
wxUint16 a, r, g, b;
for (wxUint32 i = 0; i < tex_size; i++) {
c = tex[i];
a = (c >> 28) & 0xF;
r = (c >> 20) & 0xF;
g = (c >> 12) & 0xF;
b = (c >> 4) & 0xF;
tex16[i] = (a <<12) | (r << 8) | (g << 4) | b;
}
return (1 << 16) | GR_TEXFMT_ARGB_4444;
}
return (2 << 16) | GR_TEXFMT_ARGB_8888;
}
//****************************************************************
// LoadTile for 32bit RGBA texture
// Based on sources of angrylion's software plugin.
//
void LoadTile32b (wxUint32 tile, wxUint32 ul_s, wxUint32 ul_t, wxUint32 width, wxUint32 height)
{
const wxUint32 line = rdp.tiles[tile].line << 2;
const wxUint32 tbase = rdp.tiles[tile].t_mem << 2;
const wxUint32 addr = rdp.timg.addr >> 2;
const wxUint32* src = (const wxUint32*)gfx.RDRAM;
wxUint16 *tmem16 = (wxUint16*)rdp.tmem;
wxUint32 c, ptr, tline, s, xorval;
for (wxUint32 j = 0; j < height; j++)
{
tline = tbase + line * j;
s = ((j + ul_t) * rdp.timg.width) + ul_s;
xorval = (j & 1) ? 3 : 1;
for (wxUint32 i = 0; i < width; i++)
{
c = src[addr + s + i];
ptr = ((tline + i) ^ xorval) & 0x3ff;
tmem16[ptr] = c >> 16;
tmem16[ptr|0x400] = c & 0xffff;
}
}
}
//****************************************************************
// LoadBlock for 32bit RGBA texture
// Based on sources of angrylion's software plugin.
//
void LoadBlock32b(wxUint32 tile, wxUint32 ul_s, wxUint32 ul_t, wxUint32 lr_s, wxUint32 dxt)
{
const wxUint32 * src = (const wxUint32*)gfx.RDRAM;
const wxUint32 tb = rdp.tiles[tile].t_mem << 2;
const wxUint32 tiwindwords = rdp.timg.width;
const wxUint32 slindwords = ul_s;
const wxUint32 line = rdp.tiles[tile].line << 2;
wxUint16 *tmem16 = (wxUint16*)rdp.tmem;
wxUint32 addr = rdp.timg.addr >> 2;
wxUint32 width = (lr_s - ul_s + 1) << 2;
if (width & 7)
width = (width & (~7)) + 8;
if (dxt != 0)
{
wxUint32 j= 0;
wxUint32 t = 0;
wxUint32 oldt = 0;
wxUint32 ptr;
addr += (ul_t * tiwindwords) + slindwords;
wxUint32 c = 0;
for (wxUint32 i = 0; i < width; i += 2)
{
oldt = t;
t = ((j >> 11) & 1) ? 3 : 1;
if (t != oldt)
i += line;
ptr = ((tb + i) ^ t) & 0x3ff;
c = src[addr + i];
tmem16[ptr] = c >> 16;
tmem16[ptr|0x400] = c & 0xffff;
ptr = ((tb+ i + 1) ^ t) & 0x3ff;
c = src[addr + i + 1];
tmem16[ptr] = c >> 16;
tmem16[ptr|0x400] = c & 0xffff;
j += dxt;
}
}
else
{
addr += (ul_t * tiwindwords) + slindwords;
wxUint32 c, ptr;
for (wxUint32 i = 0; i < width; i ++)
{
ptr = ((tb + i) ^ 1) & 0x3ff;
c = src[addr + i];
tmem16[ptr] = c >> 16;
tmem16[ptr|0x400] = c & 0xffff;
}
}
}

114
Source/Glide64/TexLoad4b.h Normal file
View File

@ -0,0 +1,114 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
extern "C" void asmLoad4bCI (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext, wxUIntPtr pal);
extern "C" void asmLoad4bIAPal (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext, wxUIntPtr pal);
extern "C" void asmLoad4bIA (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext);
extern "C" void asmLoad4bI (wxUIntPtr src, int dst, wxUIntPtr wid_64, int height, int line, int ext);
//****************************************************************
// Size: 0, Format: 2
wxUint32 Load4bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 4)) << 1;
if (rdp.tlut_mode == 0)
{
//in tlut DISABLE mode load CI texture as plain intensity texture instead of palette dereference.
//Thanks to angrylion for the advice
asmLoad4bI (src, dst, wid_64, height, line, ext);
return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44;
}
wxUIntPtr pal = wxPtrToUInt(rdp.pal_8 + (rdp.tiles[tile].palette << 4));
if (rdp.tlut_mode == 2)
{
asmLoad4bCI (src, dst, wid_64, height, line, ext, pal);
return (1 << 16) | GR_TEXFMT_ARGB_1555;
}
asmLoad4bIAPal (src, dst, wid_64, height, line, ext, pal);
return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88;
}
//****************************************************************
// Size: 0, Format: 3
//
// ** BY GUGAMAN **
wxUint32 Load4bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load4bCI (dst, src, wid_64, height, line, real_width, tile);
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 4));
asmLoad4bIA (src, dst, wid_64, height, line, ext);
return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44;
}
//****************************************************************
// Size: 0, Format: 4
wxUint32 Load4bI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load4bCI (dst, src, wid_64, height, line, real_width, tile);
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 4));
asmLoad4bI (src, dst, wid_64, height, line, ext);
return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44;
}
//****************************************************************
// Size: 0, Format: 0
wxUint32 Load4bSelect (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode == 0)
return Load4bI (dst, src, wid_64, height, line, real_width, tile);
return Load4bCI (dst, src, wid_64, height, line, real_width, tile);
}

103
Source/Glide64/TexLoad8b.h Normal file
View File

@ -0,0 +1,103 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
extern "C" void asmLoad8bCI (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext, wxUIntPtr pal);
extern "C" void asmLoad8bIA8 (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext, wxUIntPtr pal);
extern "C" void asmLoad8bIA4 (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext);
extern "C" void asmLoad8bI (wxUIntPtr src, int dst, wxUIntPtr wid_64, int height, int line, int ext);
//****************************************************************
// Size: 1, Format: 2
//
wxUint32 Load8bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 3));
wxUIntPtr pal = wxPtrToUInt(rdp.pal_8);
switch (rdp.tlut_mode) {
case 0: //palette is not used
//in tlut DISABLE mode load CI texture as plain intensity texture instead of palette dereference.
//Thanks to angrylion for the advice
asmLoad8bI (src, dst, wid_64, height, line, ext);
return /*(0 << 16) | */GR_TEXFMT_ALPHA_8;
case 2: //color palette
ext <<= 1;
asmLoad8bCI (src, dst, wid_64, height, line, ext, pal);
return (1 << 16) | GR_TEXFMT_ARGB_1555;
default: //IA palette
ext <<= 1;
asmLoad8bIA8 (src, dst, wid_64, height, line, ext, pal);
return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88;
}
}
//****************************************************************
// Size: 1, Format: 3
//
wxUint32 Load8bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load8bCI (dst, src, wid_64, height, line, real_width, tile);
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 3));
asmLoad8bIA4 (src, dst, wid_64, height, line, ext);
return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44;
}
//****************************************************************
// Size: 1, Format: 4
//
wxUint32 Load8bI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load8bCI (dst, src, wid_64, height, line, real_width, tile);
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 3));
asmLoad8bI (src, dst, wid_64, height, line, ext);
return /*(0 << 16) | */GR_TEXFMT_ALPHA_8;
}

581
Source/Glide64/TexMod.h Normal file
View File

@ -0,0 +1,581 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
static void mod_tex_inter_color_using_factor (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
{
float percent = factor / 255.0f;
float percent_i = 1 - percent;
wxUint32 cr, cg, cb;
wxUint16 col, a;
wxUint8 r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
r = (wxUint8)(percent_i * ((col >> 8) & 0xF) + percent * cr);
g = (wxUint8)(percent_i * ((col >> 4) & 0xF) + percent * cg);
b = (wxUint8)(percent_i * (col & 0xF) + percent * cb);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_inter_col_using_col1 (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
{
wxUint32 cr, cg, cb;
wxUint16 col, a;
wxUint8 r, g, b;
float percent_r = ((color1 >> 12) & 0xF) / 15.0f;
float percent_g = ((color1 >> 8) & 0xF) / 15.0f;
float percent_b = ((color1 >> 4) & 0xF) / 15.0f;
float percent_r_i = 1.0f - percent_r;
float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b;
cr = (color0 >> 12) & 0xF;
cg = (color0 >> 8) & 0xF;
cb = (color0 >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
r = (wxUint8)(percent_r_i * ((col >> 8) & 0xF) + percent_r * cr);
g = (wxUint8)(percent_g_i * ((col >> 4) & 0xF) + percent_g * cg);
b = (wxUint8)(percent_b_i * (col & 0xF) + percent_b * cb);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_full_color_sub_tex (wxUint16 *dst, int size, wxUint32 color)
{
wxUint32 cr, cg, cb, ca;
wxUint16 col;
wxUint8 a, r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
ca = color & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)(ca - ((col >> 12) & 0xF));
r = (wxUint8)(cr - ((col >> 8) & 0xF));
g = (wxUint8)(cg - ((col >> 4) & 0xF));
b = (wxUint8)(cb - (col & 0xF));
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_col1_using_tex (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent_r, percent_g, percent_b;
cr0 = (color0 >> 12) & 0xF;
cg0 = (color0 >> 8) & 0xF;
cb0 = (color0 >> 4) & 0xF;
cr1 = (color1 >> 12) & 0xF;
cg1 = (color1 >> 8) & 0xF;
cb1 = (color1 >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = min(15, (wxUint8)((1.0f-percent_r) * cr0 + percent_r * cr1 + 0.0001f));
g = min(15, (wxUint8)((1.0f-percent_g) * cg0 + percent_g * cg1 + 0.0001f));
b = min(15, (wxUint8)((1.0f-percent_b) * cb0 + percent_b * cb1 + 0.0001f));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_col1_using_texa (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent, percent_i;
cr0 = (color0 >> 12) & 0xF;
cg0 = (color0 >> 8) & 0xF;
cb0 = (color0 >> 4) & 0xF;
cr1 = (color1 >> 12) & 0xF;
cg1 = (color1 >> 8) & 0xF;
cb1 = (color1 >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(percent_i * cr0 + percent * cr1);
g = (wxUint8)(percent_i * cg0 + percent * cg1);
b = (wxUint8)(percent_i * cb0 + percent * cb1);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_col1_using_texa__mul_tex (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent, percent_i;
cr0 = (color0 >> 12) & 0xF;
cg0 = (color0 >> 8) & 0xF;
cb0 = (color0 >> 4) & 0xF;
cr1 = (color1 >> 12) & 0xF;
cg1 = (color1 >> 8) & 0xF;
cb1 = (color1 >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(((percent_i * cr0 + percent * cr1) / 15.0f) * (((col & 0x0F00) >> 8) / 15.0f) * 15.0f);
g = (wxUint8)(((percent_i * cg0 + percent * cg1) / 15.0f) * (((col & 0x00F0) >> 4) / 15.0f) * 15.0f);
b = (wxUint8)(((percent_i * cb0 + percent * cb1) / 15.0f) * ((col & 0x000F) / 15.0f) * 15.0f);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_tex_using_tex (wxUint16 *dst, int size, wxUint32 color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent_r, percent_g, percent_b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = (wxUint8)((1.0f-percent_r) * cr + percent_r * ((col & 0x0F00) >> 8));
g = (wxUint8)((1.0f-percent_g) * cg + percent_g * ((col & 0x00F0) >> 4));
b = (wxUint8)((1.0f-percent_b) * cb + percent_b * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_tex_using_texa (wxUint16 *dst, int size, wxUint32 color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent, percent_i;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(percent_i * cr + percent * ((col & 0x0F00) >> 8));
g = (wxUint8)(percent_i * cg + percent * ((col & 0x00F0) >> 4));
b = (wxUint8)(percent_i * cb + percent * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col2_inter__col_inter_col1_using_tex__using_texa (wxUint16 *dst, int size,
wxUint32 color0, wxUint32 color1,
wxUint32 color2)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1, cr2, cg2, cb2;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent_r, percent_g, percent_b, percent_a;
cr0 = (color0 >> 12) & 0xF;
cg0 = (color0 >> 8) & 0xF;
cb0 = (color0 >> 4) & 0xF;
cr1 = (color1 >> 12) & 0xF;
cg1 = (color1 >> 8) & 0xF;
cb1 = (color1 >> 4) & 0xF;
cr2 = (color2 >> 12) & 0xF;
cg2 = (color2 >> 8) & 0xF;
cb2 = (color2 >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent_a = (a >> 12) / 15.0f;
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = (wxUint8)(((1.0f-percent_r) * cr0 + percent_r * cr1) * percent_a + cr2 * (1.0f-percent_a));
g = (wxUint8)(((1.0f-percent_g) * cg0 + percent_g * cg1) * percent_a + cg2 * (1.0f-percent_a));
b = (wxUint8)(((1.0f-percent_b) * cb0 + percent_b * cb1) * percent_a + cb2 * (1.0f-percent_a));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_scale_fac_add_fac (wxUint16 *dst, int size, wxUint32 factor)
{
float percent = factor / 255.0f;
wxUint16 col;
wxUint8 a;
float base_a = (1.0f - percent) * 15.0f;
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)(base_a + percent * (col>>12));
*(dst++) = (a<<12) | (col & 0x0FFF);
}
}
static void mod_tex_sub_col_mul_fac_add_tex (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
{
float percent = factor / 255.0f;
wxUint32 cr, cg, cb;
wxUint16 col, a;
float r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
r = (float)((col >> 8) & 0xF);
r = /*max(*/(r - cr) * percent/*, 0.0f)*/ + r;
if (r > 15.0f) r = 15.0f;
if (r < 0.0f) r = 0.0f;
g = (float)((col >> 4) & 0xF);
g = /*max(*/(g - cg) * percent/*, 0.0f)*/ + g;
if (g > 15.0f) g = 15.0f;
if (g < 0.0f) g = 0.0f;
b = (float)(col & 0xF);
b = /*max(*/(b - cb) * percent/*, 0.0f)*/ + b;
if (b > 15.0f) b = 15.0f;
if (b < 0.0f) b = 0.0f;
*(dst++) = a | ((wxUint16)r << 8) | ((wxUint16)g << 4) | (wxUint16)b;
}
}
static void mod_tex_scale_col_add_col (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent_r, percent_g, percent_b;
cr0 = (color0 >> 12) & 0xF;
cg0 = (color0 >> 8) & 0xF;
cb0 = (color0 >> 4) & 0xF;
cr1 = (color1 >> 12) & 0xF;
cg1 = (color1 >> 8) & 0xF;
cb1 = (color1 >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = min(15, (wxUint8)(percent_r * cr0 + cr1 + 0.0001f));
g = min(15, (wxUint8)(percent_g * cg0 + cg1 + 0.0001f));
b = min(15, (wxUint8)(percent_b * cb0 + cb1 + 0.0001f));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_add_col (wxUint16 *dst, int size, wxUint32 color)
{
wxUint32 cr, cg, cb, ca;
wxUint16 col;
wxUint8 a, r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
ca = color & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)((col >> 12) & 0xF);
// a = col & 0xF000;
r = (wxUint8)(cr + ((col >> 8) & 0xF))&0xF;
g = (wxUint8)(cg + ((col >> 4) & 0xF))&0xF;
b = (wxUint8)(cb + (col & 0xF))&0xF;
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_col_mul_texa_add_tex (wxUint16 *dst, int size, wxUint32 color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float factor;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
factor = (a >> 12) / 15.0f;
r = (wxUint8)(cr*factor + ((col >> 8) & 0xF))&0xF;
g = (wxUint8)(cg*factor + ((col >> 4) & 0xF))&0xF;
b = (wxUint8)(cb*factor + (col & 0xF))&0xF;
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_sub_col (wxUint16 *dst, int size, wxUint32 color)
{
int cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)(col & 0xF000);
r = (wxUint8)max((((col >> 8) & 0xF) - cr), 0);
g = (wxUint8)max((((col >> 4) & 0xF) - cg), 0);
b = (wxUint8)max(((col & 0xF) - cb), 0);
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_sub_col_mul_fac (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
{
float percent = factor / 255.0f;
wxUint32 cr, cg, cb;
wxUint16 col, a;
float r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)((col >> 12) & 0xF);
r = (float)((col >> 8) & 0xF);
r = (r - cr) * percent;
if (r > 15.0f) r = 15.0f;
if (r < 0.0f) r = 0.0f;
g = (float)((col >> 4) & 0xF);
g = (g - cg) * percent;
if (g > 15.0f) g = 15.0f;
if (g < 0.0f) g = 0.0f;
b = (float)(col & 0xF);
b = (b - cb) * percent;
if (b > 15.0f) b = 15.0f;
if (b < 0.0f) b = 0.0f;
*(dst++) = (a << 12) | ((wxUint16)r << 8) | ((wxUint16)g << 4) | (wxUint16)b;
}
}
static void mod_col_inter_tex_using_col1 (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
{
wxUint32 cr, cg, cb;
wxUint16 col, a;
wxUint8 r, g, b;
float percent_r = ((color1 >> 12) & 0xF) / 15.0f;
float percent_g = ((color1 >> 8) & 0xF) / 15.0f;
float percent_b = ((color1 >> 4) & 0xF) / 15.0f;
float percent_r_i = 1.0f - percent_r;
float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b;
cr = (color0 >> 12) & 0xF;
cg = (color0 >> 8) & 0xF;
cb = (color0 >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)((col >> 12) & 0xF);
r = (wxUint8)(percent_r * ((col >> 8) & 0xF) + percent_r_i * cr);
g = (wxUint8)(percent_g * ((col >> 4) & 0xF) + percent_g_i * cg);
b = (wxUint8)(percent_b * (col & 0xF) + percent_b_i * cb);
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_inter_noise_using_col (wxUint16 *dst, int size, wxUint32 color)
{
wxUint16 col, a;
wxUint8 r, g, b, noise;
float percent_r = ((color >> 12) & 0xF) / 15.0f;
float percent_g = ((color >> 8) & 0xF) / 15.0f;
float percent_b = ((color >> 4) & 0xF) / 15.0f;
float percent_r_i = 1.0f - percent_r;
float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
noise = rand()%16;
r = (wxUint8)(percent_r_i * ((col >> 8) & 0xF) + percent_r * noise);
g = (wxUint8)(percent_g_i * ((col >> 4) & 0xF) + percent_g * noise);
b = (wxUint8)(percent_b_i * (col & 0xF) + percent_b * noise);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_inter_col_using_texa (wxUint16 *dst, int size, wxUint32 color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent, percent_i;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(percent * cr + percent_i * ((col & 0x0F00) >> 8));
g = (wxUint8)(percent * cg + percent_i * ((col & 0x00F0) >> 4));
b = (wxUint8)(percent * cb + percent_i * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_mul_col (wxUint16 *dst, int size, wxUint32 color)
{
float cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
float percent, percent_i;
cr = (float)((color >> 12) & 0xF)/16.0f;
cg = (float)((color >> 8) & 0xF)/16.0f;
cb = (float)((color >> 4) & 0xF)/16.0f;
for (int i=0; i<size; i++)
{
col = *dst;
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(cr * ((col & 0x0F00) >> 8));
g = (wxUint8)(cg * ((col & 0x00F0) >> 4));
b = (wxUint8)(cb * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_scale_fac_add_col (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
{
float percent = factor / 255.0f;
wxUint32 cr, cg, cb;
wxUint16 col;
float r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
cb = (color >> 4) & 0xF;
for (int i=0; i<size; i++)
{
col = *dst;
r = cr + percent * (float)((col>>8)&0xF);
g = cg + percent * (float)((col>>4)&0xF);
b = cb + percent * (float)(col&0xF);
*(dst++) = (col&0xF000) | ((wxUint8)r << 8) | ((wxUint8)g << 4) | (wxUint8)b;
}
}

437
Source/Glide64/TexModCI.h Normal file
View File

@ -0,0 +1,437 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
static void mod_tex_inter_color_using_factor_CI (wxUint32 color, wxUint32 factor)
{
float percent = factor / 255.0f;
float percent_i = 1 - percent;
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_i * r + percent * cr));
g = (wxUint8)(min(255, percent_i * g + percent * cg));
b = (wxUint8)(min(255, percent_i * b + percent * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_tex_inter_col_using_col1_CI (wxUint32 color0, wxUint32 color1)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
float percent_r = ((color1 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color1 >> 16) & 0xFF) / 255.0f;
float percent_b = ((color1 >> 8) & 0xFF) / 255.0f;
float percent_r_i = 1.0f - percent_r;
float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b;
cr = (wxUint8)((color0 >> 24) & 0xFF);
cg = (wxUint8)((color0 >> 16) & 0xFF);
cb = (wxUint8)((color0 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r_i * r + percent_r * cr));
g = (wxUint8)(min(255, percent_g_i * g + percent_g * cg));
b = (wxUint8)(min(255, percent_b_i * b + percent_b * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_full_color_sub_tex_CI (wxUint32 color)
{
wxUint8 cr, cg, cb, ca;
wxUint16 col;
wxUint8 a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
ca = (wxUint8)(color & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
a = max(0, ca - a);
r = max(0, cr - r);
g = max(0, cg - g);
b = max(0, cb - b);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_col_inter_col1_using_tex_CI (wxUint32 color0, wxUint32 color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 a, r, g, b;
float percent_r, percent_g, percent_b;
cr0 = (wxUint8)((color0 >> 24) & 0xFF);
cg0 = (wxUint8)((color0 >> 16) & 0xFF);
cb0 = (wxUint8)((color0 >> 8) & 0xFF);
cr1 = (wxUint8)((color1 >> 24) & 0xFF);
cg1 = (wxUint8)((color1 >> 16) & 0xFF);
cb1 = (wxUint8)((color1 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
percent_r = ((col&0xF800) >> 11) / 31.0f;
percent_g = ((col&0x07C0) >> 6) / 31.0f;
percent_b = ((col&0x003E) >> 1) / 31.0f;
r = (wxUint8)(min((1.0f-percent_r) * cr0 + percent_r * cr1, 255));
g = (wxUint8)(min((1.0f-percent_g) * cg0 + percent_g * cg1, 255));
b = (wxUint8)(min((1.0f-percent_b) * cb0 + percent_b * cb1, 255));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_tex_sub_col_mul_fac_add_tex_CI (wxUint32 color, wxUint32 factor)
{
float percent = factor / 255.0f;
wxUint8 cr, cg, cb, a;
wxUint16 col;
float r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (r - cr) * percent + r;
if (r > 255.0f) r = 255.0f;
if (r < 0.0f) r = 0.0f;
g = (g - cg) * percent + g;
if (g > 255.0f) g = 255.0f;
if (g < 0.0f) g = 0.0f;
b = (b - cb) * percent + b;
if (b > 255.0f) g = 255.0f;
if (b < 0.0f) b = 0.0f;
rdp.pal_8[i] = (wxUint16)(((wxUint16)((wxUint8)(r) >> 3) << 11) |
((wxUint16)((wxUint8)(g) >> 3) << 6) |
((wxUint16)((wxUint8)(b) >> 3) << 1) |
(wxUint16)(a) );
}
}
static void mod_tex_scale_col_add_col_CI (wxUint32 color0, wxUint32 color1)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
float percent_r = ((color0 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color0 >> 16) & 0xFF) / 255.0f;
float percent_b = ((color0 >> 8) & 0xFF) / 255.0f;
cr = (wxUint8)((color1 >> 24) & 0xFF);
cg = (wxUint8)((color1 >> 16) & 0xFF);
cb = (wxUint8)((color1 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r * r + cr));
g = (wxUint8)(min(255, percent_g * g + cg));
b = (wxUint8)(min(255, percent_b * b + cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_tex_add_col_CI (wxUint32 color)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = min(cr + r, 255);
g = min(cg + g, 255);
b = min(cb + b, 255);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_tex_sub_col_CI (wxUint32 color)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = max(r - cr, 0);
g = max(g - cg, 0);
b = max(b - cb, 0);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_tex_sub_col_mul_fac_CI (wxUint32 color, wxUint32 factor)
{
float percent = factor / 255.0f;
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a;
float r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);
r = (float)((col&0xF800) >> 11) / 31.0f * 255.0f;
g = (float)((col&0x07C0) >> 6) / 31.0f * 255.0f;
b = (float)((col&0x003E) >> 1) / 31.0f * 255.0f;
r = (r - cr) * percent;
if (r > 255.0f) r = 255.0f;
if (r < 0.0f) r = 0.0f;
g = (g - cg) * percent;
if (g > 255.0f) g = 255.0f;
if (g < 0.0f) g = 0.0f;
b = (b - cb) * percent;
if (b > 255.0f) g = 255.0f;
if (b < 0.0f) b = 0.0f;
rdp.pal_8[i] = (wxUint16)(((wxUint16)((wxUint8)(r) >> 3) << 11) |
((wxUint16)((wxUint8)(g) >> 3) << 6) |
((wxUint16)((wxUint8)(b) >> 3) << 1) |
(wxUint16)(a) );
}
}
static void mod_col_inter_tex_using_col1_CI (wxUint32 color0, wxUint32 color1)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
float percent_r = ((color1 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color1 >> 16) & 0xFF) / 255.0f;
float percent_b = ((color1 >> 8) & 0xFF) / 255.0f;
float percent_r_i = 1.0f - percent_r;
float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b;
cr = (wxUint8)((color0 >> 24) & 0xFF);
cg = (wxUint8)((color0 >> 16) & 0xFF);
cb = (wxUint8)((color0 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r * r + percent_r_i * cr));
g = (wxUint8)(min(255, percent_g * g + percent_g_i * cg));
b = (wxUint8)(min(255, percent_b * b + percent_b_i * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void mod_tex_inter_col_using_texa_CI (wxUint32 color)
{
wxUint8 a, r, g, b;
r = (wxUint8)((float)((color >> 24) & 0xFF) / 255.0f * 31.0f);
g = (wxUint8)((float)((color >> 16) & 0xFF) / 255.0f * 31.0f);
b = (wxUint8)((float)((color >> 8) & 0xFF) / 255.0f * 31.0f);
a = (color&0xFF) ? 1 : 0;
wxUint16 col16 = (wxUint16)((r<<11)|(g<<6)|(b<<1)|a);
for (int i=0; i<256; i++)
{
if (rdp.pal_8[i]&1)
rdp.pal_8[i] = col16;
}
}
static void mod_tex_mul_col_CI (wxUint32 color)
{
wxUint8 a, r, g, b;
wxUint16 col;
float cr, cg, cb;
cr = (float)((color >> 24) & 0xFF) / 255.0f;
cg = (float)((color >> 16) & 0xFF) / 255.0f;
cb = (float)((color >> 8) & 0xFF) / 255.0f;
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) * cr);
g = (wxUint8)((float)((col&0x07C0) >> 6) * cg);
b = (wxUint8)((float)((col&0x003E) >> 1) * cb);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
}
}
static void ModifyPalette(wxUint32 mod, wxUint32 modcolor, wxUint32 modcolor1, wxUint32 modfactor)
{
switch (mod)
{
case TMOD_TEX_INTER_COLOR_USING_FACTOR:
mod_tex_inter_color_using_factor_CI (modcolor, modfactor);
break;
case TMOD_TEX_INTER_COL_USING_COL1:
mod_tex_inter_col_using_col1_CI (modcolor, modcolor1);
break;
case TMOD_FULL_COLOR_SUB_TEX:
mod_full_color_sub_tex_CI (modcolor);
break;
case TMOD_COL_INTER_COL1_USING_TEX:
mod_col_inter_col1_using_tex_CI (modcolor, modcolor1);
break;
case TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX:
mod_tex_sub_col_mul_fac_add_tex_CI (modcolor, modfactor);
break;
case TMOD_TEX_SCALE_COL_ADD_COL:
mod_tex_scale_col_add_col_CI (modcolor, modcolor1);
break;
case TMOD_TEX_ADD_COL:
mod_tex_add_col_CI (modcolor);
break;
case TMOD_TEX_SUB_COL:
mod_tex_sub_col_CI (modcolor);
break;
case TMOD_TEX_SUB_COL_MUL_FAC:
mod_tex_sub_col_mul_fac_CI (modcolor, modfactor);
break;
case TMOD_COL_INTER_TEX_USING_COL1:
mod_col_inter_tex_using_col1_CI (modcolor, modcolor1);
break;
case TMOD_TEX_INTER_COL_USING_TEXA:
mod_tex_inter_col_using_texa_CI (modcolor);
break;
case TMOD_TEX_MUL_COL:
mod_tex_mul_col_CI (modcolor);
break;
default:
;
}
}

3836
Source/Glide64/Texture.asm Normal file

File diff suppressed because it is too large Load Diff

2182
Source/Glide64/Util.cpp Normal file

File diff suppressed because it is too large Load Diff

93
Source/Glide64/Util.h Normal file
View File

@ -0,0 +1,93 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#ifndef Util_H
#define Util_H
#define NOT_TMU0 0x00
#define NOT_TMU1 0x01
#define NOT_TMU2 0x02
void util_init ();
void render_tri (wxUint16 linew = 0);
int cull_tri (VERTEX **v);
void draw_tri (VERTEX **v, wxUint16 linew = 0);
void do_triangle_stuff (wxUint16 linew = 0, int old_interpolate = TRUE);
void do_triangle_stuff_2 (wxUint16 linew = 0);
void add_tri (VERTEX *v, int n, int type);
void apply_shade_mods (VERTEX *v);
void update ();
void update_scissor ();
void set_message_combiner ();
float ScaleZ(float z);
// positional and texel coordinate clipping
#define CCLIP(ux,lx,ut,lt,uc,lc) \
if (ux > lx || lx < uc || ux > lc) { rdp.tri_n += 2; return; } \
if (ux < uc) { \
float p = (uc-ux)/(lx-ux); \
ut = p*(lt-ut)+ut; \
ux = uc; \
} \
if (lx > lc) { \
float p = (lc-ux)/(lx-ux); \
lt = p*(lt-ut)+ut; \
lx = lc; \
}
#define CCLIP2(ux,lx,ut,lt,un,ln,uc,lc) \
if (ux > lx || lx < uc || ux > lc) { rdp.tri_n += 2; return; } \
if (ux < uc) { \
float p = (uc-ux)/(lx-ux); \
ut = p*(lt-ut)+ut; \
un = p*(ln-un)+un; \
ux = uc; \
} \
if (lx > lc) { \
float p = (lc-ux)/(lx-ux); \
lt = p*(lt-ut)+ut; \
ln = p*(ln-un)+un; \
lx = lc; \
}
#endif // ifndef Util_H

View File

@ -0,0 +1,34 @@
/* XPM */
static const char *australia_xpm[]={
"30 15 16 1",
" c #E68885",
"0 c #D7BCC7",
"1 c #2F4C95",
"2 c #092A7F",
"3 c #DC2C23",
"4 c #EB9A99",
"5 c #916785",
"6 c #59659D",
"7 c #AEA8C3",
"8 c #DDD5E1",
"9 c #7689BA",
"a c #F7F8FA",
"b c #E46A64",
"c c #C08494",
"d c #6C426C",
"e c #6C2A54",
" 001120342215 0222222221222221",
"65 07143 15 781222222212222222",
"99700a03400a099222222281222222",
"333333333333333222222222222222",
"44 44 b3b4 4 4 222222222221222",
"2170 c43478 512222122222297222",
"08 5227342270 5222792222222222",
"6d22226e122229d222222222122222",
"222222222222222222222222122222",
"222222922222222222222222222222",
"222228a72222222222222222222222",
"22226aa81222222222222212222222",
"222229762222222222222286222222",
"222221212222222222222212222222",
"122222222222222222222222222221"};

40
Source/Glide64/brazil.xpm Normal file
View File

@ -0,0 +1,40 @@
/* XPM */
static const char *brazil_xpm[]={
"30 21 16 1",
" c #3A8E12",
"0 c #3B960A",
"1 c #6FAA02",
"2 c #96B802",
"3 c #FBDD02",
"4 c #D6CA0C",
"5 c #B8BF0D",
"6 c #728652",
"7 c #426272",
"8 c #A29E3A",
"9 c #063C9F",
"a c #A2C2AA",
"b c #8AB1A3",
"c c #3A68A2",
"d c #1D4DA0",
"e c #528492",
" 0 0 0 0 0 ",
" 0000000000000000000000000000 ",
" 0000000000000110000000000000 ",
" 0000000000002332000000000000 ",
" 0000000000143333410000000000 ",
" 0000000005346776435000000000 ",
" 0000000133899999983310000000 ",
" 0000005338999999998335000000 ",
" 000023333abbbbc999d333320000 ",
" 0014333349999cebc99433334100 ",
" 0133333359999999ebd533333310 ",
" 0014333349d999d99da433334100 ",
" 000023333d9d99d99dc333320000 ",
" 0000005338999999dd8335000000 ",
" 0000000133899999983310000000 ",
" 0000000002346776435000000000 ",
" 0000000000143333410000000000 ",
" 0000000000002332000000000000 ",
" 0000000000000000000000000000 ",
" 0000000000000000000000000000 ",
" 0 0 0 0 0 "};

View File

@ -0,0 +1,3 @@
nasm.exe -o lib\Texture.obj -O6 -fwin32 -D__WIN32__ --prefix _ Texture.asm
nasm.exe -o lib\FixedPoint.obj -O6 -fwin32 -D__WIN32__ --prefix _ FixedPoint.asm
nasm.exe -o lib\3dmathSIMD.obj -O6 -fwin32 -D__WIN32__ --prefix _ 3dmathSIMD.asm

File diff suppressed because it is too large Load Diff

2049
Source/Glide64/cursor.h Normal file

File diff suppressed because it is too large Load Diff

2049
Source/Glide64/font.h Normal file

File diff suppressed because it is too large Load Diff

28
Source/Glide64/france.xpm Normal file
View File

@ -0,0 +1,28 @@
/* XPM */
static const char *france_xpm[]={
"30 20 5 1",
" c #0C429C",
"0 c #F4F6FC",
"1 c #FCFEFC",
"2 c #FCEAEC",
"3 c #FC0204",
" 01111111123333333333",
" 21111111123333333333",
" 01111111123333333333",
" 21111111123333333333",
" 01111111123333333333",
" 21111111123333333333",
" 01111111123333333333",
" 21111111123333333333",
" 01111111123333333333",
" 21111111123333333333",
" 01111111123333333333",
" 21111111123333333333",
" 01111111123333333333",
" 01111111123333333333",
" 01111111123333333333",
" 21111111123333333333",
" 01111111123333333333",
" 01111111123333333333",
" 01111111123333333333",
" 01111111123333333333"};

340
Source/Glide64/gpl.txt Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so int as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

130
Source/Glide64/inc/3dfx.h Normal file
View File

@ -0,0 +1,130 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Revision: 1.3.4.2 $
** $Date: 2003/05/05 06:50:41 $
*/
#ifndef __3DFX_H__
#define __3DFX_H__
/*
** basic data types
*/
typedef unsigned char FxU8;
typedef signed char FxI8;
typedef unsigned short FxU16;
typedef signed short FxI16;
#if defined(__alpha__) || defined (__LP64__)
typedef signed int FxI32;
typedef unsigned int FxU32;
#else
typedef signed long FxI32;
typedef unsigned long FxU32;
#endif
typedef unsigned long AnyPtr;
typedef int FxBool;
typedef float FxFloat;
typedef double FxDouble;
/*
** color types
*/
typedef unsigned long FxColor_t;
typedef struct { float r, g, b, a; } FxColor4;
/*
** fundamental types
*/
#define FXTRUE 1
#define FXFALSE 0
/*
** helper macros
*/
#define FXUNUSED( a ) ((void)(a))
#define FXBIT( i ) ( 1L << (i) )
/*
** export macros
*/
#if defined(__MSC__) || defined(_MSC_VER)
# if defined (MSVC16)
# define FX_ENTRY
# define FX_CALL
# else
# define FX_ENTRY extern
# define FX_CALL __stdcall
# endif
#elif defined(__WATCOMC__)
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined (__IBMC__) || defined (__IBMCPP__)
/* IBM Visual Age C/C++: */
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined(__DJGPP__)
# define FX_ENTRY extern
# define FX_CALL
#elif defined(__MINGW32__)
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined(__unix__)
# define FX_ENTRY extern
# define FX_CALL
#elif defined(__MWERKS__)
# if macintosh
# define FX_ENTRY extern
# define FX_CALL
# else /* !macintosh */
# error "Unknown MetroWerks target platform"
# endif /* !macintosh */
#else
# warning define FX_ENTRY & FX_CALL for your compiler
# define FX_ENTRY extern
# define FX_CALL
#endif
/*
** x86 compiler specific stuff
*/
#if defined(__BORLANDC_)
# define REALMODE
# define REGW( a, b ) ((a).x.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int86(a,b,c)
# define INT86X( a, b, c, d ) int86x(a,b,c,d)
# define RM_SEG( a ) FP_SEG( a )
# define RM_OFF( a ) FP_OFF( a )
#elif defined(__WATCOMC__)
# undef FP_SEG
# undef FP_OFF
# define REGW( a, b ) ((a).w.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int386(a,b,c)
# define INT86X( a, b, c, d ) int386x(a,b,c,d)
# define RM_SEG( a ) ( ( ( ( FxU32 ) (a) ) & 0x000F0000 ) >> 4 )
# define RM_OFF( a ) ( ( FxU16 ) (a) )
#endif
#endif /* !__3DFX_H__ */

View File

@ -0,0 +1,52 @@
; NASM macro set to make interfacing to 32-bit programs easier -*- nasm -*-
%imacro proc 1 ; begin a procedure definition
%push proc
global %1
%1: push ebp
mov ebp,esp
%assign %$arg 8
%define %$procname %1
%endmacro
%imacro arg 0-1 4 ; used with the argument name as a label
%00 equ %$arg
%assign %$arg %1+%$arg
%endmacro
%imacro endproc 0
%ifnctx proc
%error Mismatched `endproc'/`proc'
%else
leave
ret
__end_%$procname: ; useful for calculating function size
%pop
%endif
%endmacro

946
Source/Glide64/inc/glide.h Normal file
View File

@ -0,0 +1,946 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
*/
/*
** GLIDE.H
**
** The following #defines are relevant when using Glide:
**
** One of the following "platform constants" must be defined during
** compilation:
**
** __DOS__ Defined for 32-bit DOS applications
** __WIN32__ Defined for 32-bit Windows applications
** __sparc__ Defined for Sun Solaris/SunOS
** __linux__ Defined for Linux applications
** __FreeBSD__ Defined for FreeBSD applications
** __NetBSD__ Defined for NetBSD applications
** __OpenBSD__ Defined for OpenBSD applications
** __IRIX__ Defined for SGI Irix applications
**
*/
#ifndef __GLIDE_H__
#define __GLIDE_H__
#include <3dfx.h>
#include <glidesys.h>
#include <sst1vid.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
** -----------------------------------------------------------------------
** TYPE DEFINITIONS
** -----------------------------------------------------------------------
*/
typedef FxU32 GrColor_t;
typedef FxU8 GrAlpha_t;
typedef FxU32 GrMipMapId_t;
typedef FxU32 GrStipplePattern_t;
typedef FxU8 GrFog_t;
typedef FxU32 GrContext_t;
typedef int (FX_CALL *GrProc)();
/*
** -----------------------------------------------------------------------
** CONSTANTS AND TYPES
** -----------------------------------------------------------------------
*/
#define GR_NULL_MIPMAP_HANDLE ((GrMipMapId_t) -1)
#define GR_MIPMAPLEVELMASK_EVEN FXBIT(0)
#define GR_MIPMAPLEVELMASK_ODD FXBIT(1)
#define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD )
#define GR_LODBIAS_BILINEAR 0.5
#define GR_LODBIAS_TRILINEAR 0.0
typedef FxI32 GrChipID_t;
#define GR_TMU0 0x0
#define GR_TMU1 0x1
#define GR_TMU2 0x2
#define GR_FBI 0x0
typedef FxI32 GrCombineFunction_t;
#define GR_COMBINE_FUNCTION_ZERO 0x0
#define GR_COMBINE_FUNCTION_NONE GR_COMBINE_FUNCTION_ZERO
#define GR_COMBINE_FUNCTION_LOCAL 0x1
#define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2
#define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3
#define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER
#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4
#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5
#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6
#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7
#define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8
#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9
#define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10
typedef FxI32 GrCombineFactor_t;
#define GR_COMBINE_FACTOR_ZERO 0x0
#define GR_COMBINE_FACTOR_NONE GR_COMBINE_FACTOR_ZERO
#define GR_COMBINE_FACTOR_LOCAL 0x1
#define GR_COMBINE_FACTOR_OTHER_ALPHA 0x2
#define GR_COMBINE_FACTOR_LOCAL_ALPHA 0x3
#define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4
#define GR_COMBINE_FACTOR_TEXTURE_RGB 0x5
#define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA
#define GR_COMBINE_FACTOR_LOD_FRACTION 0x5
#define GR_COMBINE_FACTOR_ONE 0x8
#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9
#define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa
#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb
#define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc
#define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA
#define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd
typedef FxI32 GrCombineLocal_t;
#define GR_COMBINE_LOCAL_ITERATED 0x0
#define GR_COMBINE_LOCAL_CONSTANT 0x1
#define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT
#define GR_COMBINE_LOCAL_DEPTH 0x2
typedef FxI32 GrCombineOther_t;
#define GR_COMBINE_OTHER_ITERATED 0x0
#define GR_COMBINE_OTHER_TEXTURE 0x1
#define GR_COMBINE_OTHER_CONSTANT 0x2
#define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT
typedef FxI32 GrAlphaSource_t;
#define GR_ALPHASOURCE_CC_ALPHA 0x0
#define GR_ALPHASOURCE_ITERATED_ALPHA 0x1
#define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2
#define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3
typedef FxI32 GrColorCombineFnc_t;
#define GR_COLORCOMBINE_ZERO 0x0
#define GR_COLORCOMBINE_CCRGB 0x1
#define GR_COLORCOMBINE_ITRGB 0x2
#define GR_COLORCOMBINE_ITRGB_DELTA0 0x3
#define GR_COLORCOMBINE_DECAL_TEXTURE 0x4
#define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5
#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6
#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7
#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8
#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9
#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa
#define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb
#define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc
#define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd
#define GR_COLORCOMBINE_DIFF_SPEC_A 0xe
#define GR_COLORCOMBINE_DIFF_SPEC_B 0xf
#define GR_COLORCOMBINE_ONE 0x10
typedef FxI32 GrAlphaBlendFnc_t;
#define GR_BLEND_ZERO 0x0
#define GR_BLEND_SRC_ALPHA 0x1
#define GR_BLEND_SRC_COLOR 0x2
#define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR
#define GR_BLEND_DST_ALPHA 0x3
#define GR_BLEND_ONE 0x4
#define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5
#define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6
#define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR
#define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7
#define GR_BLEND_RESERVED_8 0x8
#define GR_BLEND_RESERVED_9 0x9
#define GR_BLEND_RESERVED_A 0xa
#define GR_BLEND_RESERVED_B 0xb
#define GR_BLEND_RESERVED_C 0xc
#define GR_BLEND_RESERVED_D 0xd
#define GR_BLEND_RESERVED_E 0xe
#define GR_BLEND_ALPHA_SATURATE 0xf
#define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE
typedef FxI32 GrAspectRatio_t;
#define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */
#define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */
#define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */
#define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */
#define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */
#define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */
#define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */
typedef FxI32 GrBuffer_t;
#define GR_BUFFER_FRONTBUFFER 0x0
#define GR_BUFFER_BACKBUFFER 0x1
#define GR_BUFFER_AUXBUFFER 0x2
#define GR_BUFFER_DEPTHBUFFER 0x3
#define GR_BUFFER_ALPHABUFFER 0x4
#define GR_BUFFER_TRIPLEBUFFER 0x5
typedef FxI32 GrChromakeyMode_t;
#define GR_CHROMAKEY_DISABLE 0x0
#define GR_CHROMAKEY_ENABLE 0x1
typedef FxI32 GrChromaRangeMode_t;
#define GR_CHROMARANGE_RGB_ALL_EXT 0x0
#define GR_CHROMARANGE_DISABLE_EXT 0x00
#define GR_CHROMARANGE_ENABLE_EXT 0x01
typedef FxI32 GrTexChromakeyMode_t;
#define GR_TEXCHROMA_DISABLE_EXT 0x0
#define GR_TEXCHROMA_ENABLE_EXT 0x1
#define GR_TEXCHROMARANGE_RGB_ALL_EXT 0x0
typedef FxI32 GrCmpFnc_t;
#define GR_CMP_NEVER 0x0
#define GR_CMP_LESS 0x1
#define GR_CMP_EQUAL 0x2
#define GR_CMP_LEQUAL 0x3
#define GR_CMP_GREATER 0x4
#define GR_CMP_NOTEQUAL 0x5
#define GR_CMP_GEQUAL 0x6
#define GR_CMP_ALWAYS 0x7
typedef FxI32 GrColorFormat_t;
#define GR_COLORFORMAT_ARGB 0x0
#define GR_COLORFORMAT_ABGR 0x1
#define GR_COLORFORMAT_RGBA 0x2
#define GR_COLORFORMAT_BGRA 0x3
typedef FxI32 GrCullMode_t;
#define GR_CULL_DISABLE 0x0
#define GR_CULL_NEGATIVE 0x1
#define GR_CULL_POSITIVE 0x2
typedef FxI32 GrDepthBufferMode_t;
#define GR_DEPTHBUFFER_DISABLE 0x0
#define GR_DEPTHBUFFER_ZBUFFER 0x1
#define GR_DEPTHBUFFER_WBUFFER 0x2
#define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS 0x3
#define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS 0x4
typedef FxI32 GrDitherMode_t;
#define GR_DITHER_DISABLE 0x0
#define GR_DITHER_2x2 0x1
#define GR_DITHER_4x4 0x2
typedef FxI32 GrStippleMode_t;
#define GR_STIPPLE_DISABLE 0x0
#define GR_STIPPLE_PATTERN 0x1
#define GR_STIPPLE_ROTATE 0x2
typedef FxI32 GrFogMode_t;
#define GR_FOG_DISABLE 0x0
#define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1
#define GR_FOG_WITH_TABLE_ON_Q 0x2
#define GR_FOG_WITH_TABLE_ON_W GR_FOG_WITH_TABLE_ON_Q
#define GR_FOG_WITH_ITERATED_Z 0x3
#define GR_FOG_WITH_ITERATED_ALPHA_EXT 0x4
#define GR_FOG_MULT2 0x100
#define GR_FOG_ADD2 0x200
typedef FxU32 GrLock_t;
#define GR_LFB_READ_ONLY 0x00
#define GR_LFB_WRITE_ONLY 0x01
#define GR_LFB_IDLE 0x00
#define GR_LFB_NOIDLE 0x10
#define GR_LFB_WRITE_ONLY_EXPLICIT_EXT 0x02 /* explicitly not allow reading from the lfb pointer */
typedef FxI32 GrLfbBypassMode_t;
#define GR_LFBBYPASS_DISABLE 0x0
#define GR_LFBBYPASS_ENABLE 0x1
typedef FxI32 GrLfbWriteMode_t;
#define GR_LFBWRITEMODE_565 0x0 /* RGB:RGB */
#define GR_LFBWRITEMODE_555 0x1 /* RGB:RGB */
#define GR_LFBWRITEMODE_1555 0x2 /* ARGB:ARGB */
#define GR_LFBWRITEMODE_RESERVED1 0x3
#define GR_LFBWRITEMODE_888 0x4 /* RGB */
#define GR_LFBWRITEMODE_8888 0x5 /* ARGB */
#define GR_LFBWRITEMODE_RESERVED2 0x6
#define GR_LFBWRITEMODE_RESERVED3 0x7
#define GR_LFBWRITEMODE_RESERVED4 0x8
#define GR_LFBWRITEMODE_RESERVED5 0x9
#define GR_LFBWRITEMODE_RESERVED6 0xa
#define GR_LFBWRITEMODE_RESERVED7 0xb
#define GR_LFBWRITEMODE_565_DEPTH 0xc /* RGB:DEPTH */
#define GR_LFBWRITEMODE_555_DEPTH 0xd /* RGB:DEPTH */
#define GR_LFBWRITEMODE_1555_DEPTH 0xe /* ARGB:DEPTH */
#define GR_LFBWRITEMODE_ZA16 0xf /* DEPTH:DEPTH */
#define GR_LFBWRITEMODE_ANY 0xFF
typedef FxI32 GrOriginLocation_t;
#define GR_ORIGIN_UPPER_LEFT 0x0
#define GR_ORIGIN_LOWER_LEFT 0x1
#define GR_ORIGIN_ANY 0xFF
typedef struct {
int size;
void *lfbPtr;
FxU32 strideInBytes;
GrLfbWriteMode_t writeMode;
GrOriginLocation_t origin;
} GrLfbInfo_t;
typedef FxI32 GrLOD_t;
#define GR_LOD_LOG2_256 0x8
#define GR_LOD_LOG2_128 0x7
#define GR_LOD_LOG2_64 0x6
#define GR_LOD_LOG2_32 0x5
#define GR_LOD_LOG2_16 0x4
#define GR_LOD_LOG2_8 0x3
#define GR_LOD_LOG2_4 0x2
#define GR_LOD_LOG2_2 0x1
#define GR_LOD_LOG2_1 0x0
typedef FxI32 GrMipMapMode_t;
#define GR_MIPMAP_DISABLE 0x0 /* no mip mapping */
#define GR_MIPMAP_NEAREST 0x1 /* use nearest mipmap */
#define GR_MIPMAP_NEAREST_DITHER 0x2 /* GR_MIPMAP_NEAREST + LOD dith */
typedef FxI32 GrSmoothingMode_t;
#define GR_SMOOTHING_DISABLE 0x0
#define GR_SMOOTHING_ENABLE 0x1
typedef FxI32 GrTextureClampMode_t;
#define GR_TEXTURECLAMP_WRAP 0x0
#define GR_TEXTURECLAMP_CLAMP 0x1
#define GR_TEXTURECLAMP_MIRROR_EXT 0x2
typedef FxI32 GrTextureCombineFnc_t;
#define GR_TEXTURECOMBINE_ZERO 0x0 /* texout = 0 */
#define GR_TEXTURECOMBINE_DECAL 0x1 /* texout = texthis */
#define GR_TEXTURECOMBINE_OTHER 0x2 /* this TMU in passthru mode */
#define GR_TEXTURECOMBINE_ADD 0x3 /* tout = tthis + t(this+1) */
#define GR_TEXTURECOMBINE_MULTIPLY 0x4 /* texout = tthis * t(this+1) */
#define GR_TEXTURECOMBINE_SUBTRACT 0x5 /* Sutract from upstream TMU */
#define GR_TEXTURECOMBINE_DETAIL 0x6 /* detail--detail on tthis */
#define GR_TEXTURECOMBINE_DETAIL_OTHER 0x7 /* detail--detail on tthis+1 */
#define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8 /* trilinear--odd levels tthis*/
#define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9 /*trilinear--even levels tthis*/
#define GR_TEXTURECOMBINE_ONE 0xa /* texout = 0xFFFFFFFF */
typedef FxI32 GrTextureFilterMode_t;
#define GR_TEXTUREFILTER_POINT_SAMPLED 0x0
#define GR_TEXTUREFILTER_BILINEAR 0x1
typedef FxI32 GrTextureFormat_t;
/* KoolSmoky - */
#define GR_TEXFMT_8BIT 0x0
#define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT
#define GR_TEXFMT_YIQ_422 0x1
#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
#define GR_TEXFMT_P_8 0x5 /* 8-bit palette */
#define GR_TEXFMT_RSVD0 0x6 /* GR_TEXFMT_P_8_RGBA */
#define GR_TEXFMT_P_8_6666 GR_TEXFMT_RSVD0
#define GR_TEXFMT_P_8_6666_EXT GR_TEXFMT_RSVD0
#define GR_TEXFMT_RSVD1 0x7
#define GR_TEXFMT_16BIT 0x8
#define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT
#define GR_TEXFMT_AYIQ_8422 0x9
#define GR_TEXFMT_RGB_565 0xa
#define GR_TEXFMT_ARGB_1555 0xb
#define GR_TEXFMT_ARGB_4444 0xc
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
#define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */
#define GR_TEXFMT_RSVD2 0xf
#define GR_TEXFMT_RSVD4 GR_TEXFMT_RSVD2
typedef FxU32 GrTexTable_t;
#define GR_TEXTABLE_NCC0 0x0
#define GR_TEXTABLE_NCC1 0x1
#define GR_TEXTABLE_PALETTE 0x2
#define GR_TEXTABLE_PALETTE_6666_EXT 0x3
typedef FxU32 GrNCCTable_t;
#define GR_NCCTABLE_NCC0 0x0
#define GR_NCCTABLE_NCC1 0x1
typedef FxU32 GrTexBaseRange_t;
#define GR_TEXBASE_256 0x3
#define GR_TEXBASE_128 0x2
#define GR_TEXBASE_64 0x1
#define GR_TEXBASE_32_TO_1 0x0
typedef FxU32 GrEnableMode_t;
#define GR_MODE_DISABLE 0x0
#define GR_MODE_ENABLE 0x1
#define GR_AA_ORDERED 0x01
#define GR_ALLOW_MIPMAP_DITHER 0x02
#define GR_PASSTHRU 0x03
#define GR_SHAMELESS_PLUG 0x04
#define GR_VIDEO_SMOOTHING 0x05
typedef FxU32 GrCoordinateSpaceMode_t;
#define GR_WINDOW_COORDS 0x00
#define GR_CLIP_COORDS 0x01
/* Types of data in strips */
#define GR_FLOAT 0
#define GR_U8 1
/* Parameters for strips */
#define GR_PARAM_XY 0x01
#define GR_PARAM_Z 0x02
#define GR_PARAM_W 0x03
#define GR_PARAM_Q 0x04
#define GR_PARAM_FOG_EXT 0x05
#define GR_PARAM_A 0x10
#define GR_PARAM_RGB 0x20
#define GR_PARAM_PARGB 0x30
#define GR_PARAM_ST0 0x40
#define GR_PARAM_ST1 GR_PARAM_ST0+1
#define GR_PARAM_ST2 GR_PARAM_ST0+2
#define GR_PARAM_Q0 0x50
#define GR_PARAM_Q1 GR_PARAM_Q0+1
#define GR_PARAM_Q2 GR_PARAM_Q0+2
#define GR_PARAM_DISABLE 0x00
#define GR_PARAM_ENABLE 0x01
/*
** grDrawVertexArray/grDrawVertexArrayContiguous primitive type
*/
#define GR_POINTS 0
#define GR_LINE_STRIP 1
#define GR_LINES 2
#define GR_POLYGON 3
#define GR_TRIANGLE_STRIP 4
#define GR_TRIANGLE_FAN 5
#define GR_TRIANGLES 6
#define GR_TRIANGLE_STRIP_CONTINUE 7
#define GR_TRIANGLE_FAN_CONTINUE 8
/*
** grGet/grReset types
*/
#define GR_BITS_DEPTH 0x01
#define GR_BITS_RGBA 0x02
#define GR_FIFO_FULLNESS 0x03
#define GR_FOG_TABLE_ENTRIES 0x04
#define GR_GAMMA_TABLE_ENTRIES 0x05
#define GR_GLIDE_STATE_SIZE 0x06
#define GR_GLIDE_VERTEXLAYOUT_SIZE 0x07
#define GR_IS_BUSY 0x08
#define GR_LFB_PIXEL_PIPE 0x09
#define GR_MAX_TEXTURE_SIZE 0x0a
#define GR_MAX_TEXTURE_ASPECT_RATIO 0x0b
#define GR_MEMORY_FB 0x0c
#define GR_MEMORY_TMU 0x0d
#define GR_MEMORY_UMA 0x0e
#define GR_NUM_BOARDS 0x0f
#define GR_NON_POWER_OF_TWO_TEXTURES 0x10
#define GR_NUM_FB 0x11
#define GR_NUM_SWAP_HISTORY_BUFFER 0x12
#define GR_NUM_TMU 0x13
#define GR_PENDING_BUFFERSWAPS 0x14
#define GR_REVISION_FB 0x15
#define GR_REVISION_TMU 0x16
#define GR_STATS_LINES 0x17 /* grGet/grReset */
#define GR_STATS_PIXELS_AFUNC_FAIL 0x18
#define GR_STATS_PIXELS_CHROMA_FAIL 0x19
#define GR_STATS_PIXELS_DEPTHFUNC_FAIL 0x1a
#define GR_STATS_PIXELS_IN 0x1b
#define GR_STATS_PIXELS_OUT 0x1c
#define GR_STATS_PIXELS 0x1d /* grReset */
#define GR_STATS_POINTS 0x1e /* grGet/grReset */
#define GR_STATS_TRIANGLES_IN 0x1f
#define GR_STATS_TRIANGLES_OUT 0x20
#define GR_STATS_TRIANGLES 0x21 /* grReset */
#define GR_SWAP_HISTORY 0x22
#define GR_SUPPORTS_PASSTHRU 0x23
#define GR_TEXTURE_ALIGN 0x24
#define GR_VIDEO_POSITION 0x25
#define GR_VIEWPORT 0x26
#define GR_WDEPTH_MIN_MAX 0x27
#define GR_ZDEPTH_MIN_MAX 0x28
#define GR_VERTEX_PARAMETER 0x29
#define GR_BITS_GAMMA 0x2a
#define GR_GET_RESERVED_1 0x1000
/*
** grGetString types
*/
#define GR_EXTENSION 0xa0
#define GR_HARDWARE 0xa1
#define GR_RENDERER 0xa2
#define GR_VENDOR 0xa3
#define GR_VERSION 0xa4
/*
** -----------------------------------------------------------------------
** STRUCTURES
** -----------------------------------------------------------------------
*/
typedef struct {
GrLOD_t smallLodLog2;
GrLOD_t largeLodLog2;
GrAspectRatio_t aspectRatioLog2;
GrTextureFormat_t format;
void *data;
} GrTexInfo;
typedef struct GrSstPerfStats_s {
FxU32 pixelsIn; /* # pixels processed (minus buffer clears) */
FxU32 chromaFail; /* # pixels not drawn due to chroma key */
FxU32 zFuncFail; /* # pixels not drawn due to Z comparison */
FxU32 aFuncFail; /* # pixels not drawn due to alpha comparison */
FxU32 pixelsOut; /* # pixels drawn (including buffer clears) */
} GrSstPerfStats_t;
typedef struct {
GrScreenResolution_t resolution;
GrScreenRefresh_t refresh;
int numColorBuffers;
int numAuxBuffers;
} GrResolution;
typedef GrResolution GlideResolution;
#define GR_QUERY_ANY ((FxU32)(~0))
typedef FxU32 GrLfbSrcFmt_t;
#define GR_LFB_SRC_FMT_565 0x00
#define GR_LFB_SRC_FMT_555 0x01
#define GR_LFB_SRC_FMT_1555 0x02
#define GR_LFB_SRC_FMT_888 0x04
#define GR_LFB_SRC_FMT_8888 0x05
#define GR_LFB_SRC_FMT_565_DEPTH 0x0c
#define GR_LFB_SRC_FMT_555_DEPTH 0x0d
#define GR_LFB_SRC_FMT_1555_DEPTH 0x0e
#define GR_LFB_SRC_FMT_ZA16 0x0f
#define GR_LFB_SRC_FMT_RLE16 0x80
#ifdef H3D
#define GR_HINT_H3DENABLE 4
#undef GR_HINTTYPE_MAX
#define GR_HINTTYPE_MAX 4
#endif
/*
** -----------------------------------------------------------------------
** FUNCTION PROTOTYPES
** -----------------------------------------------------------------------
*/
#ifndef FX_GLIDE_NO_FUNC_PROTO
/*
** rendering functions
*/
FX_ENTRY void FX_CALL
grDrawPoint( const void *pt );
FX_ENTRY void FX_CALL
grDrawLine( const void *v1, const void *v2 );
FX_ENTRY void FX_CALL
grDrawTriangle( const void *a, const void *b, const void *c );
FX_ENTRY void FX_CALL
grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode);
FX_ENTRY void FX_CALL
grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers);
FX_ENTRY void FX_CALL
grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride);
/*
** Antialiasing Functions
*/
FX_ENTRY void FX_CALL
grAADrawTriangle(
const void *a, const void *b, const void *c,
FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias
);
/*
** buffer management
*/
FX_ENTRY void FX_CALL
grBufferClear( GrColor_t color, GrAlpha_t alpha, FxU32 depth );
FX_ENTRY void FX_CALL
grBufferSwap( FxU32 swap_interval );
FX_ENTRY void FX_CALL
grRenderBuffer( GrBuffer_t buffer );
/*
** error management
*/
typedef void (*GrErrorCallbackFnc_t)( const char *string, FxBool fatal );
FX_ENTRY void FX_CALL
grErrorSetCallback( GrErrorCallbackFnc_t fnc );
/*
** SST routines
*/
FX_ENTRY void FX_CALL
grFinish(void);
FX_ENTRY void FX_CALL
grFlush(void);
FX_ENTRY GrContext_t FX_CALL
grSstWinOpen(
FxU32 hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers,
int nAuxBuffers);
FX_ENTRY FxBool FX_CALL
grSstWinClose( GrContext_t context );
FX_ENTRY void FX_CALL
grSetNumPendingBuffers(FxI32 NumPendingBuffers);
FX_ENTRY FxBool FX_CALL
grSelectContext( GrContext_t context );
FX_ENTRY void FX_CALL
grSstOrigin(GrOriginLocation_t origin);
FX_ENTRY void FX_CALL
grSstSelect( int which_sst );
/*
** Glide configuration and special effect maintenance functions
*/
FX_ENTRY void FX_CALL
grAlphaBlendFunction(
GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df,
GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df
);
FX_ENTRY void FX_CALL
grAlphaCombine(
GrCombineFunction_t function, GrCombineFactor_t factor,
GrCombineLocal_t local, GrCombineOther_t other,
FxBool invert
);
FX_ENTRY void FX_CALL
grAlphaControlsITRGBLighting( FxBool enable );
FX_ENTRY void FX_CALL
grAlphaTestFunction( GrCmpFnc_t function );
FX_ENTRY void FX_CALL
grAlphaTestReferenceValue( GrAlpha_t value );
FX_ENTRY void FX_CALL
grChromakeyMode( GrChromakeyMode_t mode );
FX_ENTRY void FX_CALL
grChromakeyValue( GrColor_t value );
FX_ENTRY void FX_CALL
grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
FX_ENTRY void FX_CALL
grColorCombine(
GrCombineFunction_t function, GrCombineFactor_t factor,
GrCombineLocal_t local, GrCombineOther_t other,
FxBool invert );
FX_ENTRY void FX_CALL
grColorMask( FxBool rgb, FxBool a );
FX_ENTRY void FX_CALL
grCullMode( GrCullMode_t mode );
FX_ENTRY void FX_CALL
grConstantColorValue( GrColor_t value );
FX_ENTRY void FX_CALL
grDepthBiasLevel( FxI32 level );
FX_ENTRY void FX_CALL
grDepthBufferFunction( GrCmpFnc_t function );
FX_ENTRY void FX_CALL
grDepthBufferMode( GrDepthBufferMode_t mode );
FX_ENTRY void FX_CALL
grDepthMask( FxBool mask );
FX_ENTRY void FX_CALL
grDisableAllEffects( void );
FX_ENTRY void FX_CALL
grDitherMode( GrDitherMode_t mode );
FX_ENTRY void FX_CALL
grFogColorValue( GrColor_t fogcolor );
FX_ENTRY void FX_CALL
grFogMode( GrFogMode_t mode );
FX_ENTRY void FX_CALL
grFogTable( const GrFog_t ft[] );
FX_ENTRY void FX_CALL
grLoadGammaTable( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
FX_ENTRY void FX_CALL
grSplash(float x, float y, float width, float height, FxU32 frame);
FX_ENTRY FxU32 FX_CALL
grGet( FxU32 pname, FxU32 plength, FxI32 *params );
FX_ENTRY const char * FX_CALL
grGetString( FxU32 pname );
FX_ENTRY FxI32 FX_CALL
grQueryResolutions( const GrResolution *resTemplate, GrResolution *output );
FX_ENTRY FxBool FX_CALL
grReset( FxU32 what );
FX_ENTRY GrProc FX_CALL
grGetProcAddress( char *procName );
FX_ENTRY void FX_CALL
grEnable( GrEnableMode_t mode );
FX_ENTRY void FX_CALL
grDisable( GrEnableMode_t mode );
FX_ENTRY void FX_CALL
grCoordinateSpace( GrCoordinateSpaceMode_t mode );
FX_ENTRY void FX_CALL
grDepthRange( FxFloat n, FxFloat f );
FX_ENTRY void FX_CALL
grStippleMode( GrStippleMode_t mode );
FX_ENTRY void FX_CALL
grStipplePattern( GrStipplePattern_t mode );
FX_ENTRY void FX_CALL
grViewport( FxI32 x, FxI32 y, FxI32 width, FxI32 height );
/*
** texture mapping control functions
*/
FX_ENTRY FxU32 FX_CALL
grTexCalcMemRequired(
GrLOD_t lodmin, GrLOD_t lodmax,
GrAspectRatio_t aspect, GrTextureFormat_t fmt);
FX_ENTRY FxU32 FX_CALL
grTexTextureMemRequired( FxU32 evenOdd,
GrTexInfo *info );
FX_ENTRY FxU32 FX_CALL
grTexMinAddress( GrChipID_t tmu );
FX_ENTRY FxU32 FX_CALL
grTexMaxAddress( GrChipID_t tmu );
FX_ENTRY void FX_CALL
grTexNCCTable( GrNCCTable_t table );
FX_ENTRY void FX_CALL
grTexSource( GrChipID_t tmu,
FxU32 startAddress,
FxU32 evenOdd,
GrTexInfo *info );
FX_ENTRY void FX_CALL
grTexClampMode(
GrChipID_t tmu,
GrTextureClampMode_t s_clampmode,
GrTextureClampMode_t t_clampmode
);
FX_ENTRY void FX_CALL
grTexCombine(
GrChipID_t tmu,
GrCombineFunction_t rgb_function,
GrCombineFactor_t rgb_factor,
GrCombineFunction_t alpha_function,
GrCombineFactor_t alpha_factor,
FxBool rgb_invert,
FxBool alpha_invert
);
FX_ENTRY void FX_CALL
grTexDetailControl(
GrChipID_t tmu,
int lod_bias,
FxU8 detail_scale,
float detail_max
);
FX_ENTRY void FX_CALL
grTexFilterMode(
GrChipID_t tmu,
GrTextureFilterMode_t minfilter_mode,
GrTextureFilterMode_t magfilter_mode
);
FX_ENTRY void FX_CALL
grTexLodBiasValue(GrChipID_t tmu, float bias );
FX_ENTRY void FX_CALL
grTexDownloadMipMap( GrChipID_t tmu,
FxU32 startAddress,
FxU32 evenOdd,
GrTexInfo *info );
FX_ENTRY void FX_CALL
grTexDownloadMipMapLevel( GrChipID_t tmu,
FxU32 startAddress,
GrLOD_t thisLod,
GrLOD_t largeLod,
GrAspectRatio_t aspectRatio,
GrTextureFormat_t format,
FxU32 evenOdd,
void *data );
FX_ENTRY FxBool FX_CALL
grTexDownloadMipMapLevelPartial( GrChipID_t tmu,
FxU32 startAddress,
GrLOD_t thisLod,
GrLOD_t largeLod,
GrAspectRatio_t aspectRatio,
GrTextureFormat_t format,
FxU32 evenOdd,
void *data,
int start,
int end );
FX_ENTRY void FX_CALL
grTexDownloadTable( GrTexTable_t type,
void *data );
FX_ENTRY void FX_CALL
grTexDownloadTablePartial( GrTexTable_t type,
void *data,
int start,
int end );
FX_ENTRY void FX_CALL
grTexMipMapMode( GrChipID_t tmu,
GrMipMapMode_t mode,
FxBool lodBlend );
FX_ENTRY void FX_CALL
grTexMultibase( GrChipID_t tmu,
FxBool enable );
FX_ENTRY void FX_CALL
grTexMultibaseAddress( GrChipID_t tmu,
GrTexBaseRange_t range,
FxU32 startAddress,
FxU32 evenOdd,
GrTexInfo *info );
/*
** linear frame buffer functions
*/
FX_ENTRY FxBool FX_CALL
grLfbLock( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
GrOriginLocation_t origin, FxBool pixelPipeline,
GrLfbInfo_t *info );
FX_ENTRY FxBool FX_CALL
grLfbUnlock( GrLock_t type, GrBuffer_t buffer );
FX_ENTRY void FX_CALL
grLfbConstantAlpha( GrAlpha_t alpha );
FX_ENTRY void FX_CALL
grLfbConstantDepth( FxU32 depth );
FX_ENTRY void FX_CALL
grLfbWriteColorSwizzle(FxBool swizzleBytes, FxBool swapWords);
FX_ENTRY void FX_CALL
grLfbWriteColorFormat(GrColorFormat_t colorFormat);
FX_ENTRY FxBool FX_CALL
grLfbWriteRegion( GrBuffer_t dst_buffer,
FxU32 dst_x, FxU32 dst_y,
GrLfbSrcFmt_t src_format,
FxU32 src_width, FxU32 src_height,
FxBool pixelPipeline,
FxI32 src_stride, void *src_data );
FX_ENTRY FxBool FX_CALL
grLfbReadRegion( GrBuffer_t src_buffer,
FxU32 src_x, FxU32 src_y,
FxU32 src_width, FxU32 src_height,
FxU32 dst_stride, void *dst_data );
/*
** glide management functions
*/
FX_ENTRY void FX_CALL
grGlideInit( void );
FX_ENTRY void FX_CALL
grGlideShutdown( void );
FX_ENTRY void FX_CALL
grGlideGetState( void *state );
FX_ENTRY void FX_CALL
grGlideSetState( const void *state );
FX_ENTRY void FX_CALL
grGlideGetVertexLayout( void *layout );
FX_ENTRY void FX_CALL
grGlideSetVertexLayout( const void *layout );
#endif /* FX_GLIDE_NO_FUNC_PROTO */
#ifdef __cplusplus
}
#endif
#include <glideutl.h>
#endif /* __GLIDE_H__ */

View File

@ -0,0 +1,160 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Header: /cvsroot/glide/glide3x/h5/glide3/src/glidesys.h,v 1.3.4.3 2003/07/24 03:51:08 anholt Exp $
** $Log:
** 3 3dfx 1.0.1.0.1.0 10/11/00 Brent Forced check in to enforce
** branching.
** 2 3dfx 1.0.1.0 06/20/00 Joseph Kain Changes to support the
** Napalm Glide open source release. Changes include cleaned up offensive
** comments and new legal headers.
** 1 3dfx 1.0 09/11/99 StarTeam VTS Administrator
** $
**
** 4 11/05/98 11:18a Russp
** Fix GLIDE_NUM_TMU error check (change "&&" to "||")
**
** 3 7/24/98 1:41p Hohn
**
** 2 6/15/98 10:50a Peter
** made csim compile time option
*
* 1 1/16/98 4:29p Atai
* create glide 3 src
*
* 10 12/09/97 12:20p Peter
* mac glide port
*
* 9 11/04/97 4:00p Dow
* Banshee Mods
*
* 8 8/18/97 3:52p Peter
* pre-hw arrival fixes/cleanup
*
* 7 6/02/97 4:09p Peter
* Compile w/ gcc for Dural
*
* 6 5/27/97 1:16p Peter
* Basic cvg, w/o cmd fifo stuff.
*
* 5 5/21/97 6:05a Peter
*/
#ifndef __GLIDESYS_H__
#define __GLIDESYS_H__
/*
n** -----------------------------------------------------------------------
** COMPILER/ENVIRONMENT CONFIGURATION
** -----------------------------------------------------------------------
*/
/* Endianness is stored in bits [30:31] */
#define GLIDE_ENDIAN_SHIFT 30
#define GLIDE_ENDIAN_LITTLE (0x1 << GLIDE_ENDIAN_SHIFT)
#define GLIDE_ENDIAN_BIG (0x2 << GLIDE_ENDIAN_SHIFT)
/* OS is stored in bits [0:6] */
#define GLIDE_OS_SHIFT 0
#define GLIDE_OS_UNIX 0x1
#define GLIDE_OS_DOS32 0x2
#define GLIDE_OS_WIN32 0x4
#define GLIDE_OS_MACOS 0x8
#define GLIDE_OS_OS2 0x10
#define GLIDE_OS_OTHER 0x40 /* For Proprietary Arcade HW */
/* Sim vs. Hardware is stored in bits [7:8] */
#define GLIDE_SST_SHIFT 7
#define GLIDE_SST_SIM (0x1 << GLIDE_SST_SHIFT)
#define GLIDE_SST_HW (0x2 << GLIDE_SST_SHIFT)
/* Hardware Type is stored in bits [9:13] */
#define GLIDE_HW_SHIFT 9
#define GLIDE_HW_SST1 (0x1 << GLIDE_HW_SHIFT)
#define GLIDE_HW_SST96 (0x2 << GLIDE_HW_SHIFT)
#define GLIDE_HW_H3 (0x4 << GLIDE_HW_SHIFT)
#define GLIDE_HW_SST2 (0x8 << GLIDE_HW_SHIFT)
#define GLIDE_HW_CVG (0x10 << GLIDE_HW_SHIFT)
/*
** Make sure we handle all instances of WIN32
*/
#ifndef __WIN32__
# if defined (_WIN32) || defined (WIN32) || defined(__NT__)
# define __WIN32__
# endif
#endif
/* We need two checks on the OS: one for endian, the other for OS */
/* Check for endianness */
#if defined(__IRIX__) || defined(__sparc__) || defined(MACOS)
# define GLIDE_ENDIAN GLIDE_ENDIAN_BIG
#else
# define GLIDE_ENDIAN GLIDE_ENDIAN_LITTLE
#endif
/* Check for OS */
#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__) || \
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# define GLIDE_OS GLIDE_OS_UNIX
#elif defined(__DOS__)
# define GLIDE_OS GLIDE_OS_DOS32
#elif defined(__WIN32__)
# define GLIDE_OS GLIDE_OS_WIN32
#elif defined(macintosh)
# define GLIDE_OS GLIDE_OS_MACOS
#else
#error "Unknown OS"
#endif
/* Check for Simulator vs. Hardware */
#if HAL_CSIM || HWC_CSIM
# define GLIDE_SST GLIDE_SST_SIM
#else
# define GLIDE_SST GLIDE_SST_HW
#endif
/* Check for type of hardware */
#ifdef SST96
# define GLIDE_HW GLIDE_HW_SST96
#elif defined(H3)
# define GLIDE_HW GLIDE_HW_H3
#elif defined(SST2)
# define GLIDE_HW GLIDE_HW_SST2
#elif defined(CVG)
# define GLIDE_HW GLIDE_HW_CVG
#else /* Default to SST1 */
# define GLIDE_HW GLIDE_HW_SST1
#endif
#define GLIDE_PLATFORM (GLIDE_ENDIAN | GLIDE_OS | GLIDE_SST | GLIDE_HW)
/*
** Control the number of TMUs
*/
#ifndef GLIDE_NUM_TMU
# define GLIDE_NUM_TMU 2
#endif
#if ((GLIDE_NUM_TMU < 0) || (GLIDE_NUM_TMU > 3))
# error "GLIDE_NUM_TMU set to an invalid value"
#endif
#endif /* __GLIDESYS_H__ */

View File

@ -0,0 +1,153 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Header: /cvsroot/glide/glide3x/h5/glide3/src/glideutl.h,v 1.3.4.2 2003/06/05 08:23:53 koolsmoky Exp $
** $Log:
** 3 3dfx 1.0.1.0.1.0 10/11/00 Brent Forced check in to enforce
** branching.
** 2 3dfx 1.0.1.0 06/20/00 Joseph Kain Changes to support the
** Napalm Glide open source release. Changes include cleaned up offensive
** comments and new legal headers.
** 1 3dfx 1.0 09/11/99 StarTeam VTS Administrator
** $
**
** 4 7/24/98 1:41p Hohn
**
** 3 1/30/98 4:27p Atai
** gufog* prototype
**
** 1 1/29/98 4:00p Atai
*
* 1 1/16/98 4:29p Atai
* create glide 3 src
*
* 11 1/07/98 11:18a Atai
* remove GrMipMapInfo and GrGC.mm_table in glide3
*
* 10 1/06/98 6:47p Atai
* undo grSplash and remove gu routines
*
* 9 1/05/98 6:04p Atai
* move 3df gu related data structure from glide.h to glideutl.h
*
* 8 12/18/97 2:13p Peter
* fogTable cataclysm
*
* 7 12/15/97 5:52p Atai
* disable obsolete glide2 api for glide3
*
* 6 8/14/97 5:32p Pgj
* remove dead code per GMT
*
* 5 6/12/97 5:19p Pgj
* Fix bug 578
*
* 4 3/05/97 9:36p Jdt
* Removed guFbWriteRegion added guEncodeRLE16
*
* 3 1/16/97 3:45p Dow
* Embedded fn protos in ifndef FX_GLIDE_NO_FUNC_PROTO
*/
/* Glide Utility routines */
#ifndef __GLIDEUTL_H__
#define __GLIDEUTL_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
** 3DF texture file structs
*/
typedef struct
{
FxU32 width, height;
int small_lod, large_lod;
GrAspectRatio_t aspect_ratio;
GrTextureFormat_t format;
} Gu3dfHeader;
typedef struct
{
FxU8 yRGB[16];
FxI16 iRGB[4][3];
FxI16 qRGB[4][3];
FxU32 packed_data[12];
} GuNccTable;
typedef struct {
FxU32 data[256];
} GuTexPalette;
typedef union {
GuNccTable nccTable;
GuTexPalette palette;
} GuTexTable;
typedef struct
{
Gu3dfHeader header;
GuTexTable table;
void *data;
FxU32 mem_required; /* memory required for mip map in bytes. */
} Gu3dfInfo;
#ifndef FX_GLIDE_NO_FUNC_PROTO
/*
** Gamma functions
*/
FX_ENTRY void FX_CALL
guGammaCorrectionRGB( FxFloat red, FxFloat green, FxFloat blue );
/*
** fog stuff
*/
FX_ENTRY float FX_CALL
guFogTableIndexToW( int i );
FX_ENTRY void FX_CALL
guFogGenerateExp( GrFog_t *fogtable, float density );
FX_ENTRY void FX_CALL
guFogGenerateExp2( GrFog_t *fogtable, float density );
FX_ENTRY void FX_CALL
guFogGenerateLinear(GrFog_t *fogtable,
float nearZ, float farZ );
/*
** hi-level texture manipulation tools.
*/
FX_ENTRY FxBool FX_CALL
gu3dfGetInfo( const char *filename, Gu3dfInfo *info );
FX_ENTRY FxBool FX_CALL
gu3dfLoad( const char *filename, Gu3dfInfo *data );
#endif /* FX_GLIDE_NO_FUNC_PROTO */
#ifdef __cplusplus
}
#endif
#endif /* __GLIDEUTL_H__ */

View File

@ -0,0 +1,148 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Header: /cvsroot/glide/glide3x/h5/incsrc/sst1vid.h,v 1.3.4.1 2003/04/06 18:23:10 koolsmoky Exp $
** $Log:
** 7 3dfx 1.4.1.0.1.0 10/11/00 Brent Forced check in to enforce
** branching.
** 6 3dfx 1.4.1.0 06/20/00 Joseph Kain Changes to support the
** Napalm Glide open source release. Changes include cleaned up offensive
** comments and new legal headers.
** 5 3dfx 1.4 12/10/99 Leo Galway Removed previous hi-res
** mode information for Glide3. These modes were only necessary for
** Cornerstone (or future hi-res) support in RT4.2 source branch and
** proceeded to break the V3 and V2 builds (from 3dfx view), hence they have
** been removed.
** 4 3dfx 1.3 12/08/99 Leo Galway Added mode information for
** 1600x1280, 1792x1440, 1920x1080, 1920x1200, 2046x1536 (as a result of
** glide being tested with Cornerstone modes). Although not all of these
** modes are currently capable under Glide, their inclusion prevents Glide
** apps from displaying in incorrect modes when these hi-res modes are
** selected. Search for SUSTAINED_ENGINEERING_CHANGE_BEGIN.
** 3 3dfx 1.2 09/17/99 Jeremy Zelsnack
** 2 3dfx 1.1 09/17/99 Jeremy Zelsnack
** 1 3dfx 1.0 09/11/99 StarTeam VTS Administrator
** $
**
** 8 3/04/99 1:19p Atai
** sync new res modes
**
** 10 2/27/99 12:28p Dow
** new resolutions
**
** 6 2/13/99 1:56p Dow
** Added new resolution constants
**
** 5 7/24/98 1:38p Hohn
*
* 4 9/09/97 7:35p Sellers
* Added 400x300 resolution
*
* 3 8/24/97 9:31a Sellers
* moved new video timing to sst1vid.h
* redefined 1600x1280 to be 1600x1200
*
* 2 6/05/97 11:14p Pgj
*
* 5 7/24/96 3:43p Sellers
* added 512x384 @ 60 Hz for arcade monitors
* added 512x256 @ 60 Hz for arcade monitors
*
* 4 7/18/96 10:58a Sellers
* fixed FT and TF clock delay values for lower frequencies with
* .5/.5 combos
*
* 3 6/18/96 6:54p Sellers
* added sst1InitShutdownSli() to fix Glide Splash screen problems with
* SLI
*
* 2 6/13/96 7:45p Sellers
* added "voodoo.ini" support
* added DirectX support
* misc cleanup
*
* 2 6/11/96 1:43p Sellers
* added support for 60, 75, 85, and 120 Hz refresh rates for "most"
* resolutions
*
* 1 5/08/96 5:43p Paik
* Video definitions
*/
#ifndef __SST1VID_H__
#define __SST1VID_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Video defines */
typedef FxI32 GrScreenRefresh_t;
#define GR_REFRESH_60Hz 0x0
#define GR_REFRESH_70Hz 0x1
#define GR_REFRESH_72Hz 0x2
#define GR_REFRESH_75Hz 0x3
#define GR_REFRESH_80Hz 0x4
#define GR_REFRESH_90Hz 0x5
#define GR_REFRESH_100Hz 0x6
#define GR_REFRESH_85Hz 0x7
#define GR_REFRESH_120Hz 0x8
#define GR_REFRESH_NONE 0xff
typedef FxI32 GrScreenResolution_t;
#define GR_RESOLUTION_320x200 0x0
#define GR_RESOLUTION_320x240 0x1
#define GR_RESOLUTION_400x256 0x2
#define GR_RESOLUTION_512x384 0x3
#define GR_RESOLUTION_640x200 0x4
#define GR_RESOLUTION_640x350 0x5
#define GR_RESOLUTION_640x400 0x6
#define GR_RESOLUTION_640x480 0x7
#define GR_RESOLUTION_800x600 0x8
#define GR_RESOLUTION_960x720 0x9
#define GR_RESOLUTION_856x480 0xa
#define GR_RESOLUTION_512x256 0xb
#define GR_RESOLUTION_1024x768 0xC
#define GR_RESOLUTION_1280x1024 0xD
#define GR_RESOLUTION_1600x1200 0xE
#define GR_RESOLUTION_400x300 0xF
#define GR_RESOLUTION_1152x864 0x10
#define GR_RESOLUTION_1280x960 0x11
#define GR_RESOLUTION_1600x1024 0x12
#define GR_RESOLUTION_1792x1344 0x13
#define GR_RESOLUTION_1856x1392 0x14
#define GR_RESOLUTION_1920x1440 0x15
#define GR_RESOLUTION_2048x1536 0x16
#define GR_RESOLUTION_2048x2048 0x17
#define GR_RESOLUTION_NONE 0xff
#ifdef GR_RESOLUTION_MAX
#undef GR_RESOLUTION_MAX
#endif
#ifdef GR_RESOLUTION_MIN
#undef GR_RESOLUTION_MIN
#endif
#define GR_RESOLUTION_MIN GR_RESOLUTION_320x200
#define GR_RESOLUTION_MAX GR_RESOLUTION_2048x2048
#ifdef __cplusplus
}
#endif
#endif /* __SST1VID_H__ */

27
Source/Glide64/japan.xpm Normal file
View File

@ -0,0 +1,27 @@
/* XPM */
static const char *japan_xpm[]={
"30 20 4 1",
" c #FFFFFF",
"0 c #C0C0C0",
"1 c #FF0000",
"2 c #808080",
" ",
" ",
" ",
" ",
" 011110 ",
" 11111111 ",
" 1111111111 ",
" 211111111110 ",
" 111111111111 ",
" 111111111111 ",
" 111111111111 ",
" 111111111111 ",
" 211111111110 ",
" 1111111111 ",
" 11111111 ",
" 211112 ",
" ",
" ",
" ",
" "};

Binary file not shown.

360
Source/Glide64/logo.xpm Normal file
View File

@ -0,0 +1,360 @@
/* XPM */
static const char *logo_xpm[] = {
/* columns rows colors chars-per-pixel */
"315 98 256 2",
" c #141A2C",
". c #848E94",
"X c #52565C",
"o c #C4CACC",
"O c #ACAEAC",
"+ c #546A94",
"@ c #343A3C",
"# c #6C7274",
"$ c #768EBC",
"% c #DCE6E4",
"& c #9CAECC",
"* c #44567C",
"= c #2C3E64",
"- c #9C9E9C",
"; c #6C7E94",
": c #BCCAE4",
"> c #444A4C",
", c #ECF6F4",
"< c #B2BECC",
"1 c #1F2A34",
"2 c #7C8EAC",
"3 c #687EAC",
"4 c #5F666C",
"5 c #8D9EBC",
"6 c #2B3A54",
"7 c #767E84",
"8 c #DCE6F4",
"9 c #5B667C",
"0 c #D0DAE4",
"q c #24324C",
"w c #48566C",
"e c #BBBEC4",
"r c #7B8694",
"t c #869ECC",
"y c #949694",
"u c #A1AEBC",
"i c #3B4A64",
"p c #ADBEDC",
"a c #647284",
"s c #919EAC",
"d c #2B323C",
"f c #D7DBDC",
"g c #647694",
"h c #AAB8CC",
"j c #58698C",
"k c #545E6C",
"l c #B0B7BC",
"z c #3E5074",
"x c #A2A9AC",
"c c #CCD2D4",
"v c #394454",
"b c #E4EEF4",
"n c #D7E2F4",
"m c #3C4244",
"M c #8B98AC",
"N c #EBEFEC",
"B c #9BA9BC",
"V c #6B80A4",
"C c #404C5C",
"Z c #F4FEFC",
"A c #C1C6CC",
"S c #646E7C",
"D c #DFE2E4",
"F c #465264",
"G c #747A84",
"H c #6379A4",
"J c #172334",
"K c #8391A4",
"L c #8498BC",
"P c #50607C",
"I c #C4D3E4",
"U c #232D44",
"Y c #7388AC",
"T c #7687A4",
"R c #A8B9DC",
"E c #C0CCDC",
"W c #555F64",
"Q c #2F3B4C",
"! c #E5E7E4",
"~ c #F4F7F4",
"^ c #93A8CC",
"/ c #8A97A4",
"( c #758094",
") c #686E74",
"_ c #81868C",
"` c #D2DCEC",
"' c #7B889C",
"] c #A3B0C4",
"[ c #3B4D6C",
"{ c #B9C6DC",
"} c #6D7484",
"| c #93A1B4",
" . c #273344",
".. c #6C7A94",
"X. c #A5B7D4",
"o. c #536074",
"O. c #EDF0F4",
"+. c #CBD6EC",
"@. c #8F8F94",
"#. c #4C5664",
"$. c #787A7C",
"%. c #B3C1D4",
"&. c #202B3C",
"*. c #2F3E5C",
"=. c #566784",
"-. c #495874",
";. c #A9B6C4",
":. c #9AA6B4",
">. c #38455C",
",. c #8898B4",
"<. c #1B263C",
"1. c #849ACC",
"2. c #4F6084",
"3. c #748ABC",
"4. c #617294",
"5. c #9CB1D4",
"6. c #7B90B4",
"7. c #5F6874",
"8. c #8AA0C4",
"9. c #737E8C",
"0. c #DEEAFC",
"q. c #243454",
"w. c #97A7C4",
"e. c #4A525C",
"r. c #849AC4",
"t. c #7088B4",
"y. c #93A9D4",
"u. c #C1CBD4",
"i. c #6B747C",
"p. c #4C5254",
"a. c #374664",
"s. c #C4C6C4",
"d. c #5D6E8C",
"f. c #A9AFB4",
"g. c #343B44",
"h. c #414B54",
"j. c #93989C",
"k. c #CAD3DC",
"l. c #3B424C",
"z. c #DCE2DC",
"x. c #BBC6D4",
"c. c #636E84",
"v. c #D8E2EC",
"b. c #44526C",
"n. c #141E34",
"m. c #828F9C",
"M. c #546E9C",
"N. c #7C92C4",
"B. c #DCE6EC",
"V. c #445A84",
"C. c #9A9FA4",
"Z. c #6B7E9C",
"A. c #ECF7FC",
"S. c #6C82B4",
"D. c #B4C2E4",
"F. c #63728C",
"G. c #63789C",
"H. c #3C527C",
"J. c #E4F0FC",
"K. c #E6E9EC",
"L. c #F6F9FC",
"P. c #75829C",
"I. c #6C768C",
"U. c #6C7A9C",
"Y. c #EDF2FC",
"T. c #8C929C",
"R. c #BCC2CC",
"E. c #343E54",
"W. c #E4E9F4",
"Q. c #646A7C",
"!. c #DCDEE4",
"~. c #545A6C",
"^. c #C4C2C4",
"/. c #848994",
"(. c #ACB2BC",
"). c #444E64",
"_. c #9CA2AC",
"`. c #34363C",
"'. c #B4BACC",
"]. c #5C626C",
"[. c #444654",
"{. c #949AAC",
"}. c #F4F2EC",
"|. c #A4AABC",
" X c #7482A4",
".X c #4C4E5C",
"XX c #6C7AA4",
"oX c #8C92A4",
"OX c #8C9ABC",
"+X c #5C627C",
"@X c #CCD5E4",
"#X c #7C8AAC",
"$X c #CCCEDC",
"%X c #3C3E4C",
"&X c #9CAACC",
"*X c #9499A4",
"=X c #DCDEEC",
"-X c #848A9C",
";X c #ACB2C4",
":X c #444E6C",
">X c #9CA2B4",
",X c #343644",
"<X c #B4BAD4",
"1X c #5C6274",
"2X c #545A64",
"3X c #BCC2D4",
"4X c #2C2E3C",
"5X c #B4BAC4",
"6X c #A4A9B4",
"7X c #A4B2D4",
"8X c #8492B4",
"9X c #94A2C4",
"0X c #7C818C",
"qX c #CCCED4",
"wX c #74757C",
"eX c #B4B2B4",
"rX c #3C3E44",
"tX c #4C4E54",
"yX c #9C9A9C",
"uX c #D4D6DC",
"iX c #44464C",
"pX c #6D7A8C",
"aX c #B8C6E4",
"sX c #5C729C",
"dX c #FCFEFC",
"fX c #6C6E7C",
"gX c #C4C6D4",
"hX c #141E2C",
"jX c #545A5C",
"kX c #CCCECC",
"lX c #5C6E94",
"zX c #7C92BC",
"xX c #A3B2CC",
"cX c #4A5A7C",
"vX c #2F4264",
"bX c #C2CEE4",
"nX c #B4C2CC",
"mX c #242E34",
"MX c #8292AC",
"NX c #6C82AC",
"BX c #646A6C",
"VX c #94A2BC",
"CX c #2C3E54",
"ZX c #DCEAF4",
"AX c #5C6A7C",
"SX c #D4DEE4",
"DX c #2A364C",
"FX c #4C5A6C",
"GX c #BCC2C4",
"H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L.O.O.b B.n v.n v.v.v.` v.` v.` v.` v.=X=Xv.` v.v.` v.` v.` v.` v.` v.` v.` v.` v.v.` v.v.8 K.W.8 n I PX8.=. .w pXpXpX..9.( ( P.' ' ' K K M s >X(.E bX` n v.v.v.v.` v.` v.` v.` v.v.B.B.ZXO.b O.O.b ZX8 v.v.` v.` v.` v.` v.` v.` v.` v.` v.` ` +.bXD.X.r.2.DX_.dXdXdXL.A.A.Y.A.Y.Y.A.Y.Y.A.Y.J.O.b E ` =Xv.v.=Xv.=Xv.` v.` v.` v.=Xv.` v.` v.` v.` v.v.` v.` v.v.` v.` v.` v.` v.` v.v.v.ZXO.O., , O.b b B.n v.v.` v.` v.` v.v.` v.` v.v.` v.` =Xv.v.` v.` v.` v.` v.` v.` v.` v.` v.=Xv.8 8 O.O.O.A., O.b 8 n v.v.v.` v.` v.` v.` v.v.v.8 W.O.L.~ L.L.A.~ O.ZXK.8 v.v.` v.v.` v.v.` v.=Xv.v.8 W.O.L.L.L.dXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdX~ dX~ A.W.B.` @XI bX{ : : : : : : : : : : : : : : bXbX: : E : : aX: : aX: : : : : : : : : : bXbXI ` ` 0 @XaX^ T a.Q a pXpXpX( ; ( r ' ' ' -XK K M s :.5XI E @XI bXbX: : : : : : : : : { bXbXI ` ` 8 B.v.` @XI bX: : : : : : : : : : : : : E : : bX{ : PXR 5.1.G.*.C L.dXdXZ A.A.A.A.Y.A.A.Y.A.A.O.Y.b N K.{ : : : : : : : : : : : : : : : : : bXbXE bX: E : : : : : : : : : : : : : : : : : bXI ` ` ZXW.b 8 ` +.I bX: : : : : : : { bX: : : : : bX: bXE : : : : : : : : : : { : : : : : : : : : bX@X` B.W.W.W.v.` @XI bX: : : : : : : : : : : bX@X` B.O.Y.A.L.O.b 8 ` @XI bXbX: { : : : : : aX: : I I ` v.W.O.L.dXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.O.ZX` +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 q.DXq.q q q.q q q.q.q q.q.q q.6 6 CXw ; w.X.y.L 4.z *.q.q.q q.q.q.q.q.q.q.q.q.6 6 v >.>.C C >.>.CX*.q.q.q.q.q.q.q.q.q.q.q.q.q.6 6 CX>.C =.| R 5.JXV 2.i 6 6 q.q.6 q.q.q.6 q.6 *.6 *.C o.s bX=X` I PX^ Y 2.i *.q.6 q.6 q.6 q.6 q.q.6 CX*.i k M k.W.A.L.dXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXdXdXL.Y.K.+.{ ^ Z.b. .<.J n.J n.J J n.J J J J <.1 &.&.d ,Xg.g.,Xd &.<.J J J <.J <.n.<.J <.<.J <.J <.&.&.d Q 9 t.H i DXS a pXpXpXpXpX( ( ( ' ' -XK K {.s |.< { w.V b.DX<.<.U <.U &.&.U &.U U U &. . . .CX=.t.NXcXCXU J U U .U U .U .U . .,X .g.%Xl.v iXv l.,Xh./.O.dXdXdXdXZ A.L.L.A.L.L.L.L.L.L., O.K.z.SXM z DX&.J . .U .U .U .U . . .,Xg.%Xl.v iXv %XDX . .U U .U U .U U &.U U &. .&. . .g.CX9 5 ^ $ d.CXU <.&.&.&.U &.&.<.&.&.&.&.&.&. .,Xg.%X%X%Xg. .4X&.&.<.&.<.<.<.<.<.<.<.J <.<.<.<.&.U d F 2 ^ 8.H b.q <.J <.J J J J J J J J J J <.4Xd v . E ` I aX& V z q <.J J J n.J n.J n.n.<.J J <.&.d l.r k.O.L.dXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXL.dXA.O.` bXX.Y b.U n. hXn.hXn.n.J J J <.J &.&. .%Xh.X o.AXo.C Q g.Q Q DXQ 6 CXv *.v >.C >.LXLXw w k o.a T NXcXq #.} I.I.pXpX..( ( ( ' ' ' K K M {.| ;.{ X.Y z U .9.] ;.h < X.x.%.{ { E I I I +.0 0 I Y V.DXd P.v.A.A.A.A.Z A.Z Z Z Z Z Z dXdXdXdXdXdXZ dXdXdXdXdXdXdXdXZ L.A.Z L.L.L.Z L.Z L.L.~ N ! !.h -.U Q 6XL.dXdXdXdXdXdXdXdXdXdXdXdXdXdXZ dXZ Z Z L.A.A.A.A.A.J.J.J.0.0.ZX0.n n +.+.+.I I I k.I w.r.d.*.<.FXs xX] ] B B B | | M | s s | s >X:.f.u u s m.( 0XpXpXI.} a a Q.9 o.o.w #.F #.#.#.#.~.} OX8.NXb.U J U .DX .q .U &. .&.&.&.&.&. .%X2X| E @XaXX.2 z .n. hX n. hXn.J 4X,X2X6Xv.O.L.dXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXdXL.O.8 @XPX8.j DXJ n.n.J n.n.<.J J &.&. .%X.X7./.>XB K 9 v Q .DXQ Q E.E.E.v >.>.>.C LXF F FXFXo.P.L g *.Q a F.} I.pXpXpX9.( ( P.' -XK K M s |.< E L j .LX| ] ;.h xXh < X.%.%.PX{ E E I E E I +.K *.DX%.J.A.J.J.J.J.A.A.A.A.A.A.Z Z Z Z Z dXdXdXdXZ dXdXdXdXdXdXZ L.Z L.L.L.Z dXZ Z dXdX~ }.K.! 0 F.DX2XO.dXdXdXdXdXdXdXdXdXdXdXdXdXZ dXZ Z dXL.L.A.A.A.J.J.J.0.0.ZX8 8 n n v.` I +.I I k.E E { @Xp V i &.m.h & ] ] w.B B | | | | ,.s M s >XB 5XE @Xk.< {.r ; 9.pXG I.} a S AXo.o.FXw w w w FXk AXT w.L 2.DX&.DXQ DXDX .DX . .U U &.&.U &. .%XC 9.< +.I p 8.d.DXJ hX n. n.n.hXn.hXn.hXn.J J ,Xe.m.!.O.L.L.dXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXL.A.W.` : ^ V >.J hX n.n.n.n.J n.J <.n.<.<.&.,X%Xe.9.(.bX+.aXw.F.>.g.Q Q Q E.6 E.v >.>.>.i i F F FXo.o.a MX,.-.U o.a a } I.pXpX( pX( P.r ' -XK / {.>X;.{ 7XV >.CX| ] ] ] ] ;.xXh h < %.%.%.{ { E E E k.I P DX< J.A.J.0.ZXZX0.ZX0.J.J.Y.A.A.A.A.L.L.L.~ O.b K.A.Z dXdXZ Z L.A.Z L.Z Z Z L.dXdXdX~ ~ N ! ! |.a.%XK.dXdXdXdXdXdXdXdXZ dXZ Z Z Z L.A.A.L.A.O.O.B.n ZX0.ZXZX8 8 n v.v.` ` +.0 I k.E E E { u.E I 8.2. .r X.< ;.] B B B | | | M M s M s s |.5X0 O.O.v.gX{.( 0X0X9.pXG } } a S 7.o.o.k k k k o.7.( VX8.Z.a.&.Q Q Q DXDXDX .q .U .U U &. .,Xv S :.I I D.& T i <. n. n.hXn.hXhXn. n.hXn.J <.d tXr f dXL.L.dXdXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXL.O.v.I p L P .hX n.hXhXn.n.n.<.n.J J &.&.4XDXh.fX;.8 J.` : 5 o.CXQ Q Q Q 6 E.v v >.>.C C ).F w FXk 7.P.5 G.q.v c.} a I.pXpXpXpX( ( ( ' ' m.K *Xs u %.p 6.P .( u ] ] u ] ] ] ;.h xX%.h %.%.x.x.x.E I ,.DX9.0.J.0.n n v.n 8 8 8 ZXZXb J.J.Y.O.Y.O.O.v.: 9Xd.T.L.dXZ Z L.Z L.L.Z Z dXdXdXdX~ L.~ O.! D uX2. .6XdXdXdXdXdXdXZ Z dXZ L.A.L.A.A.A.Y.O.O.O.v.PXOX=.B ZXZX8 n v.v.` ` 0 0 @X@XI E E { u.u.{ k.%.G.>.>.h nXxX] ] B VX:.| | ,.| M M M M | (.k.b A.8 I :.i.r _ ( 0X9.pXG G } i.S 7.7.].o.].7.7.} s ^ 6.cXU DXQ Q 6 Q DXDXq . . .&.U &. . .Q X ' %.bX: X.zXP .n.hX n.hXn. n.n. n.hXn.J J 4Xl.fXA L.L.A.dXdXdXdXdX",
"dXdXdXdXdXdXdXdXdXdXdX~ ~ W.+.aX^ g *.J hXn. n.n.n.n.J n.n.<.<.<.&. .v k *Xv.A.8 @X{ T C g.Q Q CXv v v >.>.C C ).).F w FXk o.a 6.6.b. .7.c.a } I.} pXpX9.( ( ( ' ' K oXM :.h E w.G.>.LXVXB B u w.] ] ] ;.xX< h %.< %.x.x.x.I x.b.DXI 0.ZXn v.v.v.n v.n 8 ZXZXZXb J.b J.O.N v.E X.6.b.k dXdXdXZ L.L.Z Z dXdXL.~ dXL.dX~ O.N D z.M a.#.L.dXdXdXdXdXZ L.L.A.L.A.A.A.Y.A.O.b O.K.0 aX& V ).r 0.ZXn v.v.` 0 +.0 @XI k.E E E { x.x.E k.6.-. .| nXh ;.] B B :.| | ,.s s M M M M :.< ` B.` ` E oX#._ r 0X_ 9.9.7 G G } S S 7.7.7.S S G M & 9X4.CX .CXQ CXQ DXDXDXDXDX .U .U .U .%Xo.VXPXPXR JXg *.1 hXn. hXn.hXn.hXn.hXn.hXn.J &.,X2Xs O.dX~ L.dXdXdXdXdX",
"dXdXdXdXdXdXdXdXdXdXL.~ W.n bXX.6.b.<.hX n.hXn.n.n.n.n.<.J <.&.U Q e.9.A A.Y.B.0 ] S g.Q %Xv v v v C C C C F F #.#.FXk o.S T ,.d.DXLXQ.c.a a } pXpX..pX( ( P.' m.K *Xs u x.<XY b.DXK VXB B u B u ] ] ] ;.xXh < < %.nXx.{ I P.U K ZX0.n v.` ` ` v.v.v.8 8 8 ZXW.J.b b N v.bXR 9Xj DX6XdXdXZ L.Z L.Z Z dX~ dXdXdXdXL.~ }.! !.A -.DXqXdXdXdXdXdXZ L.Z L.~ A.L.Y.A.A.J.b W.K.0 aXR L P DXnXJ.ZX8 v.` SX+.0 @XI @XI I E { u.%.u.bXxXj 6 9 x.X.h ] ] B B :.| | | s M M M / M B x.I : bXbX%.' S m.m.' r r r r ( 9.9.G } } } G 0Xm.:.h X.#Xb.U %XE.E.Q 6 Q Q DX .q . .U U U U ,X>...& 5.5.JXNX[ U n.hX n. n. n.hXn.n.hXn.J J .h.9.uXdXL.L.dXdXdXdXdXdX",
"dXdXdXdXdXdXdXdXdXdXL.~ 8 ` PX8.4.Q J n.hXn.hXn.n.<.n.<.J <.J &.,Xl.1Xx 8 A.O.8 bXM e.g.l.CXh.h.C C C C e.F F #.FXk k ].7...L Y >. .AXc.c.} a I.pXpXpX( ( ( ' ' m.oXM :.'.E 8.d.DXo.:.B B B :.u w.] ] ;.;.h h %.%.%.%.x.E xX>.LX0 n n v.` ` v.v.v.n v.8 8 ZXZXb W.b b K.@X: 5.V i F ~ dXdXdXZ L.Z dXdXdXdXdX~ dXL.~ O.K.! D P.DX} dXdXdXdXdXZ Z L.L.A.L.A.A.A.Y.O.O.W.K.D : p ^ G.6 o.L.A.0.8 v.` ` 0 I 0 I k.I k.E E x.u.u.E 2 [ q ] %.< ;.] w.B :.VX:.| | M M M *XM s ] { p R p R X.L | :.| | | | M M M M M M M M s :.;Xx.$X{ ] F.Q DXv v E.6 Q Q Q Q DX . . . . . . .Q -.Y y.y.t $ j q J hXn.hXn.n.hXn.n.n. n.n.n.J &.,X4 (.L.L.~ L.dXdXdXdXdXdX",
"dXdXdXdXdXdXdXdXdXdXA.W.` bX5.T LX<.hX hXn.hXn.n.n.n.n.J <.&. .%XC 0XE A.b ZXv.x._ l.l.h.h.h.C e.C e.F #.#.2Xk ].o.7.AXpXM 5 P U F AXS c.a a } I.pXpX; ( ( ' -XK / s ] %.X.Y i Q M B B B B B u w.] ] ;.xXh < h %.nX%.x.E c.DXu n n v.` ` 0 ` ` v.v.n B.8 ZXb W.b W.O.SX: p L P DXA dXdXdXdXZ Z dXdX~ dXL.dXdXdXL.O.}.! D 5X:XDXD dXdXdXdXdXdXdXZ L.L.L.A.A.A.O.J.W.B.D bXR y.6.-.U f Z A.ZXv.v.v.+.0 +.@X0 I @XI E E x.u.E ^ j DX9.%.%.< ] ] u B B B | | s | s M M M | xXX.JXJXy.JXJXt xXX.xXxXxXxX& & & & & & 7X%.: @Xv.v.=XPX,.w ,Xh.>.v v v v E.%XQ Q Q Q DXg. . . .%X2.6.N.N.S.+ *.<.J n.hXn.n.hXn.hXhXhXn.hXn.J &. .tXm.B.dX~ L.L.dXdXdXdXdXdX",
"dXdXdXdXdXdXdXdXL.~ O.8 I p L 2. .n. n.hXn.hXn.n.n.n.<.n.J <.&. .v 7.6X8 O.8 v.+.< ( #.e.e.#.#.#.FXFXk k o.o.7.S S i.9.' | 8. XCXDX7.AXc.a } a I.pXpX..9.( r ' K K *X6X< PXL 2.q a | B B VX:.B B ] u ] ;.;.h < %.< %.x.E VX6 o.n v.v.` ` 0 ` v.` v.v.n 8 8 ZXZXb W.N K.I PX& G.*.7.dXdXdXdXZ Z dXZ dXL.dXdXdXL.~ ~ }.K.D f d.q j.dXdXdXdXdXdXdX~ dXZ ~ A.~ A.O.O.b B.D I X.y.r.j DXHXdXZ J.0.n v.` ` SX0 @X@X@Xk.k.k.E u.E x.Z.a.CX%.%.%.xX;.] u B B | :.| | s M s M *Xs ] 6.t.3.3.S.t.S.3.r.L r.L L L L L N.r.8.8.7XPX+.n 8 @X'.pXl.v C C C C >.h.v v v l.l.%X%XQ %Xg.DXE.P V S.H V.*.<.n.n.n.n.n.n.n. n.n.n.n.n.n.J 4Xl.7.A L.L.L.L.dXdXdXdXdXdXdX",
"dXdXdXdXdXdXdXdXdXY.b ` { 5.Z.*.<.hX n.hX n.n.n.n.n.<.J &.4X%X#.0Xx.J.v.` @XbXX.,.; F.g g ..; Z.; ; Z.' ' T K M s :.] xX,.w .w 9 AXc.c.a } I.I.9.pX( ( ' ' T./ s ] E ^ G.>.>.| | B | B B B B ] ] ] ;.h h h < < nXE E -.q < n n ` ` 0 ` 0 ` v.v.v.n 8 ZXb W.W.b K.` : R ,.cXDXf dXdXdXdXdXZ Z dXL.dXdXL.dXdX~ O.N ! !.| i C ~ dXdXdXdXdXL.dXdX~ Z L.L.A.A.A.O.K.B.SXX.y.8.XX[ v O.dXA.J.ZXv.v.v.` ` 0 ` 0 @X@X@XE qXu.k.L cX .M { %.< ;.] u B B :.B | | | | | s {.{.s T -.2.cX* V.* V.* * * H.V.* V.V.* * * P 2.d.' ] @Xn ` 6X].[.X #.X F e.e.C tXC h.h.[.[.v l.l.%X%X%XC -.* i DX<.n.J n.n.J n.n.hXn.hX hXhXn.J &.,X#.oXN dXL.L.dXdXdXdXdXdXdXdX",
"dXdXdXdXdXdXdXL.~ O.v.bXX.,.-.&.n.hXn.n.hXn.hXn.n.n.J <.J <.&.,Xv S 6X` 8 ` : PXR ^ 8.zX,.L L r.L r.r.8.8.t ^ & X.%.PXPXX.8.d.6 v o.7.AXc.c.a F.I.pXpXpX( ( ' ' K M B %.PX6.-. .r | VX:.| B :.B B ] ] ] xXh < < < < x.E MXDXpX` n ` ` 0 ` ` ` ` v.v.n 8 B.ZXW.b W.N B.I p 9Xg CX/.dXdXdXdXZ Z Z dX~ dXdXdXdXL.~ ~ }.! D qXP DXl dXdXdXdXdXL.dXL.dXdXL.Z L.A., , O.B.D x.JX8.Y -. .l dXZ A.J.ZXv.n v.` SX` 0 @X@X@XuXE E k.%.4.CXw I { %.< xX;.& u B B :.B | | :.| >XIXs {.9. .U U U U <.U <.U <.U <.<.<.<.U <.U U .Q #.oXk.W.0 *XjX2Xk k k W ~.2X2X#.X #.X e.e..XtXh.h.[.%XQ .U &.J n.J n.J n.n.n.n.n. n.n.n.n.J J 4Xv 7 u.dXL.~ L.dXdXdXdXdXdXdXdX",
"dXdXdXdXdXdXL.L.A.8 ` D.w.4.CXn.hX n.hXn. n. n.n.n.J J <. .Q X m.E n +.bXp 5.8.$ $ Y S.S.S.S.t.t.t.t.t.6.zXr.w.5.X.X.^ Y i U w o.9 AXc.c.} a I.I.pXpX( ( ' m.oXs ;.{ w.4.6 F | | | VX>X| B B u w.] ;.;.h h < < x.E < LXCX{ ` v.v.+.0 0 ` 0 ` ` v.8 8 8 ZXZXW.b K.@X: X.#X:X[.N dXdXdXdXZ Z dXdXdXdXdXdX~ L.~ O.K.z.B.K 6 1XdXdXdXdXdXdXdXL.dXdX~ Z dXA.L.A.O.b % 0 ,.6...-.Q ].L.dXA.O.W.8 v.v.v.` D ` 0 ` 0 @Xk.k.E k.6.z .KXE x.X.h ;.] KXw.B B B | :.| | >X:.>X:.IXM } FX2Xw F F F F ).).C i C C C >.C v >.C C 7._.@XW.K.O $.G wX$.} } wXwXi.i.i.# ) ) ) ) BX4 ].W e.C g.&.J <.J <.J n.n.J n.n.n.hX hXhXn.J 4X,Xk 6XA.L.L.L.dXdXdXdXdXdXdXdXdX",
"dXdXdXdXdXdXL.L.O.` bXX.Y b.&.hX n.n.hXn.hXn.n.n.n.J J <.&.,Xh.S ;X` +.bXp ^ zX4.V.z z z z z z z z z z z z -.cX9 G.L JXzX=.DXv FXo.9 AXS c.a I.I.pXpX( ( r ' T.M |.%.X.6.z .T | | | | | B B B B ] ] ] ;.h < h nXx.{ g .M 0 +.` +.0 0 +.` v.` v.v.n B.ZXW.K.W.b v.bXPX8.=. .6XdXdXdXdXZ L.Z Z L.dX~ dXL.dXL.~ }.! !.gX-. .k.dXdXdXdXdXdXL.dXL.dXdX~ Z ~ L., O.O.K.KX7.-.C rXC !.dXdXY.J.W.8 B.v.v.v.` SX` SX0 @Xk.k.k.& 4.CXa { { %.< ;.xX] KXu B B B :.B :.B 6Xu (.'.< KXs K m.' ' ' ( ( ( pXpXpX} } a c.c.c.} } 9.6X=XK.A.O.f A e e ^.R.^.R.e ^.GXe e e e e l l eX6XC.K pX~.DX&.J J n.n.<.n.n.n.n.n. n.n.n.J J .v _ !.dXL.L.L.dXdXdXdXdXdXdXdXdX",
"dXdXdXdXdXdXL.O.8 @Xp 5 =.DXn. n.hX n.n. n.hXn.n.n.J <. .l.2X/ @X` I PX^ V z CX<.<.<.<.J <.<.J <.<.<.<.<.&.U .i G.zXG.*.U #.-.o.9 AXc.c.a } I.pXpX9.( ' -XK >Xh PXL j DX7.M | | | | | >XB B B ] ] ] ;.h h < %.E u CXLX+.+.+.0 0 I 0 +.0 +.` v.v.8 8 8 ZXb W.K.@XaX5. X>.F L.dXdXdXZ L.Z Z dXdXL.dXL.dXL.~ O.K.z.!.( q.0XdXdXdXdXdXdXL.dXdXL.dXL.dXL.Z Z A., O.K.l %Xg.,XG K.dXZ A.O.8 B.v.v.v.v.` v.` ` 0 0 @Xk.@XE T [ Q %.: x.%.< xX;.] u w.B B B :.B 6X|.(.< k.uXI x.B K -X' ' ' ( ( ( ( pXpXI.a a a c.} } 9.*Xk.L.O.L.L.L.L.L.dXL.L.dXL.dXdXL.dXL.dXL.dXL.L.~ W.0 3Xw.g v &.<.J <.J n.n.J n.n. n.hXhXJ J 4X%X4 5XL.L.~ dXL.dXdXdXdXdXdXdXdXdX",
"dXdXdXdXdXdX~ W.v.: 7XT a.<.hXn.hXn.n.n. hXhXn.n.n.J <.&. ..XG ;.` +.{ X.6.-. .<.J <.<.&. .&.U U U . .q DX%XQ v -.Z.3 z .C b.FXo.9 Q.c.c.} F.} pXpX( r ' m./ u { h V a.Q M M | | | | | VX:.B u u ] ;.h 5X;.< x.E =.U :.I 0 I 0 I 0 0 0 ` SX` v.n n B.ZXW.K.K.v.bX<XL P q A dXdXdXZ Z Z L.Z dXL.dXdXdXL.~ ~ K.! D u a.v K.dXdXdXdXdXdXL.dXL.dXdXdXdX~ L.~ L., O.N W.o l D Z Z L.A.b 8 B.v.v.=XSX` SX` D SXSX0 0 f 0 w.=. .K E E x.%.h ;.xX;.] B B B B B B |.u < 0 v.` E &X' K ' HXP.r ( ( pXpXpXI.I.} a a } } pXr l O.L.L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.L.W.` { & ..CX&.J J n.<.n.n.n.n.n.n. n.n.J J .e.T.B.dXL.L.L.dXdXdXdXdXdXdXdXdXdX",
"dXdXdXdXL.A.O.v.I R L P U n.hX n. n.hXn.n.hXn.n.J J <. .l.4 s k.` bXR L =.DXJ <.U . . .DXDXQ Q 6 6 CXv >.C ).FX..Y j CXDXw w -.o.9 =.S c.a } I.I.9.( r /.oXIX< PX6.P .} M | M ,.| | | | B B u ] ] ] ;.h < %.{ ,.6 9 I +.I I I @XI 0 +.0 ` ` v.n B.ZX8 W.N B.I D.&XU.a.i.dXdXdXdXZ A.L.Z Z dX~ dX~ dXL.~ }.! ! uX=.U 6XdXdXdXdXdXdXL.dXL.dXdX~ dX~ Z Z A., O.O.N N b O., A.A.b K.v.v.SXSX0 SXSXSXSXD v.v.B.D SXuX%.Z.*.C I I { %.< h ;.& ] u ] B B B B u (.'.k.B.` { 5.T >.a ' ' ' P.( ( ..pXpXpXI.a a a } pX0Xs @XdXA.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.~ O.B.I p r.P U <.J J <.n.<.n.J n.n.n.hXn.J J 4Xl.wXgXL.L.~ L.dXdXdXdXdXdXdXdXdXdXdX",
"dXdXdXdXL.~ W.` { ^ g *.J hXn. n.n.hXn. hXn.n.n.J J &.Q .X0X%.` +.aX& Z.>.<.<. .d .q DXDXDXDXCXQ E.v >.C C F 9 T Y [ &.LXF w FXo.o.AXc.c.a F.I.pX9.( ' -XM KXPX&XG.*.>.M s ,.s | M | | B B :.w.u ] ;.h ;.< x.%.b.DXh I I I I I I 0 0 0 +.SXv.n v.8 B.ZXK.W.0 : X.6.z %XD dXdXdXdXL.A.L.L.Z dXL.dXdX~ ~ O.K.D ! {.*.e.L.dXdXdXdXdXL.dXdXL.dXL.dXdX~ dXA.~ O.}.K.! K.K.N ZXK.K.B.v.D SXSXSXSXSX0 SXv.v.B.K.B.B.0 %.zXP .VXI E x.%.h ;.xX;.] ] B B B |.u u ;.u.v.v.bX<XL 2.U pX' ' ' ( ( ( I.pXI.} } a a } I.9.T.< O.dXL.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.A.W.` aX& Z.>.J <.J J J n.J n.n.n.hXn.n.n.J &.,X#._.O.dXL.L.dXdXdXdXdXdXdXdXdXdXdXdX",
"dXdXdXdXL.O.v.I R 6.-.U hXhX n.hXn. n.n.n. hXn.J <. .l.].:.` ` { p 6.-.U &.&.&.U . .DXDXDXQ Q 6 6 >.v C F FXg 6.d.DX6 F b.w FXo.9 AXS c.} a I.pX( r HXK >X%.X.6.-.U ( / ,.M s M | | | | B B u ] ] ;.;.h x.{ P. .r E I I E I k.I I 0 +.0 v.` v.n B.ZXK.K.B.I PX^ F.q . dXdXdXZ L.L.L.L.Z Z L.dXdXL.L.~ }.! z.$XP q R.dXdXdXdXdXdXdXL.dXL.dXdXdX~ Z ~ ~ ~ N K.D I %.5.w.L ,.,.6.6.6.6.6.6.6.6.6.6.,.5 w.h { aXX.^ g CX9 I I { PX< < h ;.] ] u ] u B u u ] R.@Xv.I aX^ U.>.v K m.' ' ( ( ( pXpXI.I.I.} } G 7 r 6Xv.L.~ L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.O.v.I p 8X-. .&.J J J <.n.n.J n.n.n.n.hXJ J .v G uXdXL.L.dXdXdXdXdXdXdXdXdXdXdXdXdX",
"dXdXdXL.O.W.@XPX8.d.DXJ n.hXn. n.n. n.hXn.n.n.J 4Xg.F r x.` bXp ^ 4.6 &.&.&.U . . .q .DXQ CXQ CXv >.C F =.Y V a.U C F w w -.o.o.AXc.c.a } I.pX( r -X{.;XPXOXd.CXw / M M M M s | | | B :.B u ] ;.;.;.h u.xX*.CX{ I I E E bXI I 0 I SX` ` v.v.8 n B.W.K.@XaX7X#X[ v O.dXdXZ L.L.A.L.L.Z L.dXdX~ dX~ O.K.! z.T E.fXdXdXdXdXdXdXL.dXdXL.dXL.dXL.dX~ ~ , N ! 0 aX7X8.H cX[ = = = *.= = *.= = vX*.vXa.LX-.I.9XX.y.Y b.CX%.I I x.%.h h ;.h ;.] u ] B u u ] 5XE v.0 : R 8X-. .( K ' ' P.( ( pXpXpXI.} } } I.pX( *Xu.L.L.L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.O.W.+.PX^ lX6 J J J <.J n.<.n.n.J n.n.hXJ J &.rX].f.L.L.L.L.L.dXdXdXdXdXdXdXdXdXdXdXdX",
"dXdXL.A.b ` bX7X#XLX&. hXn.hXn.n.hXn. n.hXn.J J 4X%X7.:.@X+.: 5.2 b.&.<.&.&.U &. .q .DXDX6 Q 6 v v C LXo.Z.Y 2. .v LXb.F w FXo.9 S S c.a I.pX9.( ' m.:.%.X.Y i DX' K M M M M s ,.| | :.B B u ] ] ;.;.x.{ F. .MXE I : E E k.I I 0 I +.0 ` v.v.v.B.K.K.` bXp 8.=.DXf.dXdXdXL.A.A.L.A.L.L.Z ~ dXL.~ ~ N ! D < i Q D dXdXdXdXdXdXdXL.L.dXdXdX~ dXL.~ O.N K.0 E p 8.d.vXU n.J J J J J n.J J J J J J &.&.,XF #X^ r.j q r ` I { %.%.< < h xX] ] ] ] B ] KX] R.0 v.bXPXw.4.6 w oXK m.' ' ( ( ( pXpXpXI.I.pXpX0Xm.(.W.L.~ dXL.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.A.O.v.bXX.2 b.&.<.J <.J <.<.n.J n.n.n.n.n.J &.4XC /.v.dX~ L.dXdXdXdXdXdXdXdXdXdXdXdXdXdX",
"dXdXL.O.B.+.p OX=.DXhXhXn.n. n.hXhXn.hXhXn.n.J J &. .C r %.bX: R 5 j Q <.&.&.U . .U .DXDXDXQ Q CXv >.C F c.2 G.E. .).LXF b.w FXo.P AXc.c.a } pX0Xr -Xs h p OX2.DX7.MX/ MXM M M s | | | | B B ] ] ] ;.h x.VX*.F { E E E { E E I I 0 0 0 ` ` v.v.v.v.B.D bXD.&XZ.a.k L.dXdXZ A.A.A.L.A.L.L.Z L.Z dX~ }.K.! !.F.q T.dXdXdXdXdXdXL.dXdXdXdXL.dXL.dX~ , }.K.!.: p &XU.>.U #.f.k.uXuXk.uXk.k.k.E E E E qXE x.x.] t V a.v I ` I { %.%.h h ;.;.;.] KXu ] u ] 5XqX` bXD.5.t.b. .-XMXK ' ' P.( ( ( pXpXpX} pXpX9.r _.k.L.L.L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.O.8 +.PX5 j DXJ &.J J <.J n.<.n.n.<.n.n.n.J d %XS R.L.L.L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdX",
"dX~ L.W.` : & Z.>.J n.hXhXn.n.n.n.hXn.n.hXn.n.J &.,Xk | PX{ p ^ G.i &.J &.&.&.U U U .DXDXDXQ 6 CXv C C o. XY z U v LXF b.#.w -.o.9 AXS a } I.9.( HXoXB %.& V vXQ m.M K M K M M M | | | B B B u ;X] ;.%.%.-.DXu E E { x.E { E k.@XI 0 +.SX` ` v.D v.v.I p X.6.-.DXqXdXdXZ A.A.A.Y.L.A.A.L.Z Z dX~ }.N ! D |.vXv O.dXdXdXdXdXL.dXL.dXdXL.dXdXdX~ ~ }.K.D E p y.Y b.U *XdXdXdXdXdXZ Z Z Z Z A.L.A.A.A.J.b ZX+.6.P .| v.+.E x.%.%.< h h h ] ] ] ] ] u ;X%.uXI PXX.L =.q AXK / K ' ' ' ( ( 9.pXpXpXpX9.9.( *X< O.L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.A.O.` : & V i &.J <.1 <.<.<.J <.n.J n.n.J J &.,X#.*XO.L.~ L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdX",
"dXL.O.W.+.p L -. .n. n. hXhXhXhXhXhXhXn.hXJ J 4XE.F.&XR R y.zXcX .J &.<.&.U U . . .DXDXDXQ CXv v C w F.2 4.6 .i ).).F b.w FXo.9 AXc.a } pX0Xr /.>X%.%.6.P .a K K MXoXM M M s | | | :.B u ] u ;.%.E K DX9 { E { u.{ { { E I I @X+.0 +.SX` ` ` D ` R 5.JXsX6 S dXdXZ L.A.Y.A.A.A.L.~ A.L.Z ~ ~ O.N z.uX=.DXeXdXdXdXdXdXdXdXL.dXL.dXdXL.L.~ ~ O.N ! k.R 5.r.=.6 @.dXdXdXdXZ A.A.Y.J.A.J.J.J.0.J.8 B.v.B.{ 4.>.o.` ` I { x.< h < h ;.] ;.] KXu ] u h u.I R X.JXU.a.v oXM K K ' ' P.( ( 9.( pXpXpX9.( /.6X!.L.~ L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.O.W.@XD.OXP DXJ &.<.J J J J J n.J n.J n.n.J 4Xv i.qXdXL.L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdX",
"L.A.O.v.bXxX..E.<.hXn.hXn.J n.J n.n.n.n.n.J n.J J U LX Xy.y.JXzXlX6 J &.<.<. .&.U .U q .DXDXQ v v C ).AXT Y :X .C LXLXF b.w FX-.o.7.S c.} I.9.( ' *Xh E &Xg >.F ' K / K K M M M M | | | B B u ] ;.h x.%.[ Q ;.E { { { x.{ u.E I @X@X0 0 0 ` ` SXSXSX%.5.JXY b.Q D dXdXL.A.A.A.Y.Y.A.A.L.A.L.Z L.~ N ! D M >.1XdXdXdXdXdXdXdXL.dXL.dXL.dXL.dX~ , N ! SX5.y.8.G.a.F A.dXdXZ L.Y.Y.J.J.J.ZXZX0.W.8 8 B.` v.v.,.-.Q %.n @XE u.%.%.%.< h h h ;.] ] ] u ] < E R 5.y.t.cX .( M M K m.' ' r P.( ( 9.pX( 9.( /.*XgXA.L.L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.L.J.=XbXX.Z.v &.&.&.&.&.&.<.<.J <.J J J J 1 &.%X4 6XA.dX~ L.L.dXdXdXdXdXdXdXdXdXdXdXdXdXdXdX",
"dX~ J.=X{ 5 o.4XJ hX1 J J n.J J J J J J J J J J <.DXP $ t 1.N.M.[ <.<.J &.&.&.U U d .q DXDXDXQ CXC C o.' OXd.Q E.C F F b.#.w FXo.o.AXc.a } 9.( r / f.E : ,.o.,X( K K K / M M M {.s | | B B u u ;Xh x.E ' Q ( { { x.x.x.{ { E E k.@X@X0 0 ` 0 0 0 ` E y.JX6.2.Q T.dXdXZ A.Y.J.Y.A.A.A.L.A.A.L.L.~ , K.N qXo.Q k.dXdXdXdXdXdXdXL.dXdXdXdX~ dXL.~ }.K.D PX^ JXY -. .GXdXdXdXA.A.J.0.b W.ZX8 8 B.8 v.v.v.!.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X dXdXdXdX dXdX dXdX dXdX dXdXdX dXdXdXdX dXdXdXdXdXdXdXdXdXdXdXdX dXdXdXdXdXdX dX dX dX dXdX dXdXdXdX dXdXdXdXdX dXdXdX dXdXdXdXdXdXdX dXdXdXdX dXdX dXdX dXdX dXdXdXdXdXdXdXdXdXdX dXdXdXdXdXdX dXdXdXdXdXdX dXdX dXdXdXdXdX dXdXdX dXdX dXdXdXdXdXdXdX dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.L.O.k.y X iX) u.dXL.L.L.dXdXdXdXdX dXdXdXdX dXdX dXdXdX dXdXdXdXdX dXdXdXdXdXdX dXdXdXdXdXdX dXdX dXdX dXdX dXdXdX dXdXdXdXdXdXdX dXdXdXdX dXdX dXdX dXdX dXdX dXdX dXdXdXdX dXdXdXdXdXdXdXdXdXdXdXdX dXdXdXdXdXdX dX dX dX dXdX dXdXdXdX dXdXdXdX dXdX dXdXdX dXdXdXdXdXdXdX dXdXdXdX dXdX dXdX dXdX dXdXdXdXdXdXdXdXdXdX dXdXdXdXdXdX dXdXdXdXdXdX dXdX dXdXdXdXdX dXdXdX dXdXdXdXdXdX dXdXdXdXdXdXdX dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdX",
"dXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXL.L.K.o _ BXyXO.dXL.L.dXdXdXdXdXdX dXdXdXdX dXdX dXdXdX dXdXdXdXdX dXdXdXdXdXdX dXdXdXdXdXdX dXdX dXdX dXdX dXdXdX dXdXdXdXdXdXdX dXdXdXdX dXdX dXdX dXdX dXdX dXdX dXdXdXdX dXdXdXdXdXdXdXdXdXdXdXdX dXdXdXdXdXdX dX dX dX dXdX dXdXdXdX dXdXdXdX dXdX dXd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XdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdXdX"
};

4025
Source/Glide64/rdp.cpp Normal file

File diff suppressed because it is too large Load Diff

912
Source/Glide64/rdp.h Normal file
View File

@ -0,0 +1,912 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#ifndef RDP_H
#define RDP_H
extern char out_buf[2048];
extern wxUint32 frame_count; // frame counter
//GlideHQ support
#define TEXTURE_FILTER
#ifdef TEXTURE_FILTER
#include "Ext_TxFilter.h"
#endif
#define MAX_CACHE 1024*4
#define MAX_TRI_CACHE 768 // this is actually # of vertices, not triangles
#define MAX_VTX 256
#define MAX_TMU 2
#define TEXMEM_2MB_EDGE 2097152
// Supported flags
#define SUP_TEXMIRROR 0x00000001
// Clipping flags
#define CLIP_XMAX 0x00000001
#define CLIP_XMIN 0x00000002
#define CLIP_YMAX 0x00000004
#define CLIP_YMIN 0x00000008
#define CLIP_WMIN 0x00000010
#define CLIP_ZMAX 0x00000020
#define CLIP_ZMIN 0x00000040
// Flags
#define ZBUF_ENABLED 0x00000001
#define ZBUF_DECAL 0x00000002
#define ZBUF_COMPARE 0x00000004
#define ZBUF_UPDATE 0x00000008
#define ALPHA_COMPARE 0x00000010
#define FORCE_BL 0x00000020
#define CULL_FRONT 0x00001000 // * must be here
#define CULL_BACK 0x00002000 // * must be here
#define FOG_ENABLED 0x00010000
#define CULLMASK 0x00003000
#define CULLSHIFT 12
// Update flags
#define UPDATE_ZBUF_ENABLED 0x00000001
#define UPDATE_TEXTURE 0x00000002 // \ Same thing!
#define UPDATE_COMBINE 0x00000002 // /
#define UPDATE_CULL_MODE 0x00000004
#define UPDATE_LIGHTS 0x00000010
#define UPDATE_BIASLEVEL 0x00000020
#define UPDATE_ALPHA_COMPARE 0x00000040
#define UPDATE_VIEWPORT 0x00000080
#define UPDATE_MULT_MAT 0x00000100
#define UPDATE_SCISSOR 0x00000200
#define UPDATE_FOG_ENABLED 0x00010000
#define CMB_MULT 0x00000001
#define CMB_SET 0x00000002
#define CMB_SUB 0x00000004
#define CMB_ADD 0x00000008
#define CMB_A_MULT 0x00000010
#define CMB_A_SET 0x00000020
#define CMB_A_SUB 0x00000040
#define CMB_A_ADD 0x00000080
#define CMB_SETSHADE_SHADEALPHA 0x00000100
#define CMB_INTER 0x00000200
#define CMB_MULT_OWN_ALPHA 0x00000400
#define CMB_COL_SUB_OWN 0x00000800
#define uc(x) coord[x<<1]
#define vc(x) coord[(x<<1)+1]
#if defined __VISUALC__
#define DECLAREALIGN16VAR(var) __declspec(align(16)) float (var)
#elif defined __GNUG__
#define DECLAREALIGN16VAR(var) float (var) __attribute__ ((aligned(16)))
#endif
// Vertex structure
typedef struct
{
float x, y, z, q;
float u0, v0, u1, v1;
float coord[4];
float w;
wxUint16 flags;
wxUint8 b; // These values are arranged like this so that *(wxUint32*)(VERTEX+?) is
wxUint8 g; // ARGB format that glide can use.
wxUint8 r;
wxUint8 a;
float f; //fog
float vec[3]; // normal vector
float sx, sy, sz;
float x_w, y_w, z_w, u0_w, v0_w, u1_w, v1_w, oow;
wxUint8 not_zclipped;
wxUint8 screen_translated;
wxUint8 uv_scaled;
wxUint32 uv_calculated; // like crc
wxUint32 shade_mod;
wxUint32 color_backup;
float ou, ov;
int number; // way to identify it
int scr_off, z_off; // off the screen?
} VERTEX;
// Clipping (scissors)
typedef struct {
wxUint32 ul_x;
wxUint32 ul_y;
wxUint32 lr_x;
wxUint32 lr_y;
} SCISSOR;
#ifdef TEXTURE_FILTER
extern wxUint32 texfltr[];
extern wxUint32 texenht[];
extern wxUint32 texcmpr[];
extern wxUint32 texhirs[];
typedef struct {
wxUint16 tile_ul_s;
wxUint16 tile_ul_t;
wxUint16 tile_width;
wxUint16 tile_height;
wxUint16 tex_width;
wxUint16 tex_size;
wxUint32 dxt;
} LOAD_TILE_INFO;
#endif
typedef struct {
const wxChar * format;
const wxChar * extension;
wxBitmapType type;
} SCREEN_SHOT_FORMAT;
extern const int NumOfFormats;
extern SCREEN_SHOT_FORMAT ScreenShotFormats[];
typedef struct {
int card_id;
int lang_id;
wxUint32 res_x, scr_res_x;
wxUint32 res_y, scr_res_y;
wxUint32 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)
wxUint32 frame_buffer;
enum FBCRCMODE {
fbcrcNone = 0,
fbcrcFast = 1,
fbcrcSafe = 2} fb_crc_mode;
#ifdef TEXTURE_FILTER
//Texture filtering options
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
wxUint32 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
wxUint32 hacks;
//wrapper settings
int wrpResolution;
int wrpVRAM;
int wrpFBO;
int wrpAnisotropic;
} SETTINGS;
typedef struct
{
wxUint8 hk_ref;
wxUint8 hk_motionblur;
wxUint8 hk_filtering;
} HOTKEY_INFO;
typedef struct
{
int num_tmu;
int max_tex_size;
int sup_large_tex;
int sup_mirroring;
int sup_32bit_tex;
int has_2mb_tex_boundary;
int tex_UMA;
int gamma_correction;
FxI32 gamma_table_size;
FxU32 *gamma_table_r;
FxU32 *gamma_table_g;
FxU32 *gamma_table_b;
wxUint32 tmem_ptr[MAX_TMU];
wxUint32 tex_min_addr[MAX_TMU];
wxUint32 tex_max_addr[MAX_TMU];
} VOODOO;
// This structure is what is passed in by rdp:settextureimage
typedef struct {
wxUint8 format; // format: ARGB, IA, ...
wxUint8 size; // size: 4,8,16, or 32 bit
wxUint16 width; // used in settextureimage
wxUint32 addr; // address in RDRAM to load the texture from
int set_by; // 0-loadblock 1-loadtile
} TEXTURE_IMAGE;
// This structure is a tile descriptor (as used by rdp:settile and rdp:settilesize)
typedef struct
{
// rdp:settile
wxUint8 format; // format: ARGB, IA, ...
wxUint8 size; // size: 4,8,16, or 32 bit
wxUint16 line; // size of one row (x axis) in 64 bit words
wxUint16 t_mem; // location in texture memory (in 64 bit words, max 512 (4MB))
wxUint8 palette; // palette # to use
wxUint8 clamp_t; // clamp or wrap (y axis)?
wxUint8 mirror_t; // mirroring on (y axis)?
wxUint8 mask_t; // mask to wrap around (ex: 5 would wrap around 32) (y axis)
wxUint8 shift_t; // ??? (scaling)
wxUint8 clamp_s; // clamp or wrap (x axis)?
wxUint8 mirror_s; // mirroring on (x axis)?
wxUint8 mask_s; // mask to wrap around (x axis)
wxUint8 shift_s; // ??? (scaling)
// rdp:settilesize
wxUint16 ul_s; // upper left s coordinate
wxUint16 ul_t; // upper left t coordinate
wxUint16 lr_s; // lower right s coordinate
wxUint16 lr_t; // lower right t coordinate
float f_ul_s;
float f_ul_t;
// these are set by loadtile
wxUint16 t_ul_s; // upper left s coordinate
wxUint16 t_ul_t; // upper left t coordinate
wxUint16 t_lr_s; // lower right s coordinate
wxUint16 t_lr_t; // lower right t coordinate
wxUint32 width;
wxUint32 height;
// uc0:texture
wxUint8 on;
float s_scale;
float t_scale;
wxUint16 org_s_scale;
wxUint16 org_t_scale;
} TILE;
// This structure forms the lookup table for cached textures
typedef struct {
wxUint32 addr; // address in RDRAM
wxUint32 crc; // CRC check
wxUint32 palette; // Palette #
wxUint32 width; // width
wxUint32 height; // height
wxUint32 format; // format
wxUint32 size; // size
wxUint32 last_used; // what frame # was this texture last used (used for replacing)
wxUint32 line;
wxUint32 flags; // clamp/wrap/mirror flags
wxUint32 realwidth; // width of actual texture
wxUint32 realheight; // height of actual texture
wxUint32 lod;
wxUint32 aspect;
wxUint8 set_by;
wxUint8 texrecting;
int f_mirror_s;
int f_mirror_t;
int f_wrap_s;
int f_wrap_t;
float scale_x; // texture scaling
float scale_y;
float scale; // general scale to 256
GrTexInfo t_info; // texture info (glide)
wxUint32 tmem_addr; // addres in texture memory (glide)
int uses; // 1 triangle that uses this texture
int splits; // number of splits
int splitheight;
float c_off; // ul center texel offset (both x and y)
float c_scl_x; // scale to lower-right center-texel x
float c_scl_y; // scale to lower-right center-texel y
wxUint32 mod, mod_color, mod_color1, mod_color2, mod_factor;
#ifdef TEXTURE_FILTER
uint64 ricecrc;
int is_hires_tex;
#endif
} CACHE_LUT;
// Lights
typedef struct {
float r, g, b, a; // color
float dir_x, dir_y, dir_z; // direction towards the light source
float x, y, z, w; // light position
float ca, la, qa;
wxUint32 nonblack;
wxUint32 nonzero;
} LIGHT;
typedef enum {
ci_main, //0, main color image
ci_zimg, //1, depth image
ci_unknown, //2, status is unknown
ci_useless, //3, status is unclear
ci_old_copy, //4, auxiliary color image, copy of last color image from previous frame
ci_copy, //5, auxiliary color image, copy of previous color image
ci_copy_self, //6, main color image, it's content will be used to draw into itself
ci_zcopy, //7, auxiliary color image, copy of depth image
ci_aux, //8, auxiliary color image
ci_aux_copy //9, auxiliary color image, partial copy of previous color image
} CI_STATUS;
// Frame buffers
typedef struct
{
wxUint32 addr; //color image address
wxUint8 format;
wxUint8 size;
wxUint16 width;
wxUint16 height;
CI_STATUS status;
int changed;
} COLOR_IMAGE;
typedef struct
{
GrChipID_t tmu;
wxUint32 addr; //address of color image
wxUint32 end_addr;
wxUint32 tex_addr; //address in video memory
wxUint32 width; //width of color image
wxUint32 height; //height of color image
wxUint8 format; //format of color image
wxUint8 size; //format of color image
wxUint8 clear; //flag. texture buffer must be cleared
wxUint8 drawn; //flag. if equal to 1, this image was already drawn in current frame
wxUint32 crc; //checksum of the color image
float scr_width; //width of rendered image
float scr_height; //height of rendered image
wxUint32 tex_width; //width of texture buffer
wxUint32 tex_height; //height of texture buffer
int tile; //
wxUint16 tile_uls; //shift from left bound of the texture
wxUint16 tile_ult; //shift from top of the texture
wxUint32 v_shift; //shift from top of the texture
wxUint32 u_shift; //shift from left of the texture
float lr_u;
float lr_v;
float u_scale; //used to map vertex u,v coordinates into hires texture
float v_scale; //used to map vertex u,v coordinates into hires texture
CACHE_LUT * cache; //pointer to texture cache item
GrTexInfo info;
wxUint16 t_mem;
} TBUFF_COLOR_IMAGE;
typedef struct
{
GrChipID_t tmu;
wxUint32 begin; //start of the block in video memory
wxUint32 end; //end of the block in video memory
wxUint8 count; //number of allocated texture buffers
int clear_allowed; //stack of buffers can be cleared
TBUFF_COLOR_IMAGE images[256];
} TEXTURE_BUFFER;
#define NUMTEXBUF 92
struct RDP_Base{
float vi_width;
float vi_height;
int window_changed;
float offset_x, offset_y, offset_x_bak, offset_y_bak;
float scale_x, scale_1024, scale_x_bak;
float scale_y, scale_768, scale_y_bak;
float view_scale[3];
float view_trans[3];
float clip_min_x, clip_max_x, clip_min_y, clip_max_y;
float clip_ratio;
int updatescreen;
wxUint32 tri_n; // triangle counter
wxUint32 debug_n;
// Program counter
wxUint32 pc[10]; // DList PC stack
wxUint32 pc_i; // current PC index in the stack
int dl_count; // number of instructions before returning
int LLE;
// Segments
wxUint32 segment[16]; // Segment pointer
// Marks the end of DList execution (done in uc?:enddl)
int halt;
// Next command
wxUint32 cmd0;
wxUint32 cmd1;
wxUint32 cmd2;
wxUint32 cmd3;
// Clipping
SCISSOR scissor_o;
SCISSOR scissor;
int scissor_set;
// Colors
wxUint32 fog_color;
wxUint32 fill_color;
wxUint32 prim_color;
wxUint32 blend_color;
wxUint32 env_color;
wxUint32 SCALE;
wxUint32 CENTER;
wxUint32 prim_lodmin, prim_lodfrac;
wxUint16 prim_depth;
wxUint16 prim_dz;
wxUint8 K4;
wxUint8 K5;
enum {
noise_none,
noise_combine,
noise_texture
} noise;
float col[4]; // color multiplier
float coladd[4]; // color add/subtract
float shade_factor;
float col_2[4];
wxUint32 cmb_flags, cmb_flags_2;
// othermode_l flags
int acmp; // 0 = none, 1 = threshold, 2 = dither
int zsrc; // 0 = pixel, 1 = prim
wxUint8 alpha_dither_mode;
// Matrices
DECLAREALIGN16VAR(model[4][4]);
DECLAREALIGN16VAR(proj[4][4]);
DECLAREALIGN16VAR(combined[4][4]);
DECLAREALIGN16VAR(dkrproj[3][4][4]);
DECLAREALIGN16VAR(model_stack[32][4][4]); // 32 deep, will warn if overflow
int model_i; // index in the model matrix stack
int model_stack_size;
// Textures
TEXTURE_IMAGE timg; // 1 for each tmem address
TILE tiles[8]; // 8 tile descriptors
wxUint8 tmem[4096]; // 4k tmem
wxUint32 addr[512]; // 512 addresses (used to determine address loaded from)
#ifdef TEXTURE_FILTER
LOAD_TILE_INFO load_info[512]; // 512 addresses. inforamation about tile loading.
#endif
int cur_tile; // current tile
int mipmap_level;
int last_tile; // last tile set
int last_tile_size; // last tile size set
int t0, t1;
int best_tex; // if no 2-tmus, which texture? (0 or 1)
int tex;
int filter_mode;
// Texture palette
wxUint16 pal_8[256];
wxUint32 pal_8_crc[16];
wxUint32 pal_256_crc;
wxUint8 tlut_mode;
int LOD_en;
int Persp_en;
int persp_supported;
int force_wrap;
#ifdef TEXTURE_FILTER
wxUint16 pal_8_rice[512];
#endif
// Lighting
wxUint32 num_lights;
LIGHT light[12];
float light_vector[12][3];
float lookat[2][3];
int use_lookat;
// Combine modes
wxUint32 cycle1, cycle2, cycle_mode;
wxUint8 c_a0, c_b0, c_c0, c_d0, c_Aa0, c_Ab0, c_Ac0, c_Ad0;
wxUint8 c_a1, c_b1, c_c1, c_d1, c_Aa1, c_Ab1, c_Ac1, c_Ad1;
wxUint8 fbl_a0, fbl_b0, fbl_c0, fbl_d0;
wxUint8 fbl_a1, fbl_b1, fbl_c1, fbl_d1;
wxUint8 uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
// float YUV_C0, YUV_C1, YUV_C2, YUV_C3, YUV_C4; //YUV textures conversion coefficients
// What needs updating
wxUint32 update;
wxUint32 flags;
int first;
wxUint32 tex_ctr; // incremented every time textures are updated
int allow_combine; // allow combine updating?
int s2dex_tex_loaded;
wxUint16 bg_image_height;
// Debug stuff
wxUint32 rm; // use othermode_l instead, this just as a check for changes
wxUint32 render_mode_changed;
wxUint32 geom_mode;
wxUint32 othermode_h;
wxUint32 othermode_l;
// used to check if in texrect while loading texture
wxUint8 texrecting;
//frame buffer related slots. Added by Gonetz
wxUint32 cimg, ocimg, zimg, tmpzimg, vi_org_reg;
COLOR_IMAGE maincimg[2];
wxUint32 last_drawn_ci_addr;
wxUint32 main_ci, main_ci_end, main_ci_bg, main_ci_last_tex_addr, zimg_end, last_bg;
wxUint32 ci_width, ci_height, ci_size, ci_end;
wxUint32 zi_width;
int zi_lrx, zi_lry;
wxUint8 ci_count, num_of_ci, main_ci_index, copy_ci_index, copy_zi_index;
int swap_ci_index, black_ci_index;
wxUint32 ci_upper_bound, ci_lower_bound;
int motionblur, fb_drawn, fb_drawn_front, read_previous_ci, read_whole_frame;
CI_STATUS ci_status;
TBUFF_COLOR_IMAGE * cur_image; //image currently being drawn
TBUFF_COLOR_IMAGE * tbuff_tex; //image, which corresponds to currently selected texture
TBUFF_COLOR_IMAGE * aTBuffTex[2];
wxUint8 cur_tex_buf;
wxUint8 acc_tex_buf;
int skip_drawing; //rendering is not required. used for frame buffer emulation
//fog related slots. Added by Gonetz
float fog_multiplier, fog_offset;
enum {
fog_disabled,
fog_enabled,
fog_blend,
fog_blend_inverse
}
fog_mode;
};
struct RDP : public RDP_Base
{
// Clipping
int clip; // clipping flags
VERTEX *vtx1; //[256] copy vertex buffer #1 (used for clipping)
VERTEX *vtx2; //[256] copy vertex buffer #2
VERTEX *vtxbuf; // current vertex buffer (reset to vtx, used to determine current vertex buffer)
VERTEX *vtxbuf2;
int n_global; // Used to pass the number of vertices from clip_z to clip_tri
int vtx_buffer;
CACHE_LUT *cache[MAX_TMU]; //[MAX_CACHE]
CACHE_LUT *cur_cache[MAX_TMU];
wxUint32 cur_cache_n[MAX_TMU];
int n_cached[MAX_TMU];
// Vertices
VERTEX *vtx; //[MAX_VTX]
int v0, vn;
COLOR_IMAGE *frame_buffers; //[NUMTEXBUF+2]
TEXTURE_BUFFER texbufs[2];
wxString RomName;
RDP();
~RDP();
void Reset();
};
void SetWireframeCol ();
void ChangeSize ();
void GoToFullScreen();
extern RDP rdp;
extern SETTINGS settings;
extern HOTKEY_INFO hotkey_info;
extern VOODOO voodoo;
extern GrTexInfo fontTex;
extern GrTexInfo cursorTex;
extern wxUint32 offset_font;
extern wxUint32 offset_cursor;
extern wxUint32 offset_textures;
extern wxUint32 offset_texbuf1;
extern int ucode_error_report;
extern wxString pluginPath;
extern wxString iniPath;
// RDP functions
void rdp_reset ();
extern const char *ACmp[];
extern const char *Mode0[];
extern const char *Mode1[];
extern const char *Mode2[];
extern const char *Mode3[];
extern const char *Alpha0[];
#define Alpha1 Alpha0
extern const char *Alpha2[];
#define Alpha3 Alpha0
extern const char *FBLa[];
extern const char *FBLb[];
extern const char *FBLc[];
extern const char *FBLd[];
extern const char *str_zs[];
extern const char *str_yn[];
extern const char *str_offon[];
extern const char *str_cull[];
// I=intensity probably
extern const char *str_format[];
extern const char *str_size[];
extern const char *str_cm[];
extern const char *str_lod[];
extern const char *str_aspect[];
extern const char *str_filter[];
extern const char *str_tlut[];
extern const char *CIStatus[];
#define FBL_D_1 2
#define FBL_D_0 3
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef HIWORD
#define HIWORD(a) ((unsigned int)(a) >> 16)
#endif
#ifndef LOWORD
#define LOWORD(a) ((a) & 0xFFFF)
#endif
// Convert from u0/v0/u1/v1 to the real coordinates without regard to tmu
__inline void ConvertCoordsKeep (VERTEX *v, int n)
{
for (int i=0; i<n; i++)
{
v[i].uc(0) = v[i].u0;
v[i].vc(0) = v[i].v0;
v[i].uc(1) = v[i].u1;
v[i].vc(1) = v[i].v1;
}
}
// Convert from u0/v0/u1/v1 to the real coordinates based on the tmu they are on
__inline void ConvertCoordsConvert (VERTEX *v, int n)
{
for (int i=0; i<n; i++)
{
v[i].uc(rdp.t0) = v[i].u0;
v[i].vc(rdp.t0) = v[i].v0;
v[i].uc(rdp.t1) = v[i].u1;
v[i].vc(rdp.t1) = v[i].v1;
}
}
__inline void AllowShadeMods (VERTEX *v, int n)
{
for (int i=0; i<n; i++)
{
v[i].shade_mod = 0;
}
}
__inline void AddOffset (VERTEX *v, int n)
{
for (int i=0; i<n; i++)
{
v[i].x += rdp.offset_x;
v[i].y += rdp.offset_y;
}
}
__inline void CalculateFog (VERTEX *v)
{
if (rdp.flags & FOG_ENABLED)
{
if (v->w < 0.0f)
v->f = 0.0f;
else
v->f = min(255.0f, max(0.0f, v->z_w * rdp.fog_multiplier + rdp.fog_offset));
v->a = (wxUint8)v->f;
}
else
{
v->f = 1.0f;
}
}
void newSwapBuffers();
extern int SwapOK;
// ** utility functions
void load_palette (wxUint32 addr, wxUint16 start, wxUint16 count);
void setTBufTex(wxUint16 t_mem, wxUint32 cnt);
#endif // ifndef RDP_H

35
Source/Glide64/russia.xpm Normal file
View File

@ -0,0 +1,35 @@
/* XPM */
static const char *russia_xpm[]={
"30 20 12 1",
" c #E7E7E7",
"0 c #F7F7F7",
"1 c #FFFFFF",
"2 c #ADCEE7",
"3 c #B5D6EF",
"4 c #0073C6",
"5 c #0073CE",
"6 c #9C394A",
"7 c #9C3942",
"8 c #CE2918",
"9 c #DE2110",
"a c #D62110",
" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ",
"011111111111111111111111111110",
"01111111111111111111111111111 ",
"001111111111111111111111111110",
"01111111111111111111111111111 ",
"001111111111111111111111111110",
"223232323232323232323232323232",
"455555555555555555555555555554",
"455555555555555555555555555554",
"455555555555555555555555555554",
"455555555555555555555555555554",
"455555555555555555555555555554",
"455555555555555555555555555554",
"677677677677677677677677677676",
"89999999999999999999999999999a",
"89999999999999999999999999999a",
"a99999999999999999999999999998",
"89999999999999999999999999999a",
"899999999999999999999999999998",
"88a8a8a8a8a8a8a8a8a8a8a8a8a8a8"};

276
Source/Glide64/turbo3D.h Normal file
View File

@ -0,0 +1,276 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Created by Gonetz, 2008
//
//****************************************************************
/******************Turbo3D microcode*************************/
struct t3dGlobState {
wxUint16 pad0;
wxUint16 perspNorm;
wxUint32 flag;
wxUint32 othermode0;
wxUint32 othermode1;
wxUint32 segBases[16];
/* the viewport to use */
short vsacle1;
short vsacle0;
short vsacle3;
short vsacle2;
short vtrans1;
short vtrans0;
short vtrans3;
short vtrans2;
wxUint32 rdpCmds;
};
struct t3dState {
wxUint32 renderState; /* render state */
wxUint32 textureState; /* texture state */
wxUint8 flag;
wxUint8 triCount; /* how many tris? */
wxUint8 vtxV0; /* where to load verts? */
wxUint8 vtxCount; /* how many verts? */
wxUint32 rdpCmds; /* ptr (segment address) to RDP DL */
wxUint32 othermode0;
wxUint32 othermode1;
};
struct t3dTriN{
wxUint8 flag, v2, v1, v0; /* flag is which one for flat shade */
};
static void t3dProcessRDP(wxUint32 a)
{
if (a)
{
rdp.LLE = 1;
rdp.cmd0 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd1 = ((wxUint32*)gfx.RDRAM)[a++];
while (rdp.cmd0 + rdp.cmd1) {
gfx_instruction[0][rdp.cmd0>>24] ();
rdp.cmd0 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd1 = ((wxUint32*)gfx.RDRAM)[a++];
wxUint32 cmd = rdp.cmd0>>24;
if (cmd == 0xE4 || cmd == 0xE5)
{
rdp.cmd2 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd3 = ((wxUint32*)gfx.RDRAM)[a++];
}
}
rdp.LLE = 0;
}
}
static void t3dLoadGlobState(wxUint32 pgstate)
{
t3dGlobState *gstate = (t3dGlobState*)&gfx.RDRAM[segoffset(pgstate)];
FRDP ("Global state. pad0: %04lx, perspNorm: %04lx, flag: %08lx\n", gstate->pad0, gstate->perspNorm, gstate->flag);
rdp.cmd0 = gstate->othermode0;
rdp.cmd1 = gstate->othermode1;
rdp_setothermode();
for (int s = 0; s < 16; s++)
{
rdp.segment[s] = gstate->segBases[s];
FRDP ("segment: %08lx -> seg%d\n", rdp.segment[s], s);
}
short scale_x = gstate->vsacle0 / 4;
short scale_y = gstate->vsacle1 / 4;;
short scale_z = gstate->vsacle2;
short trans_x = gstate->vtrans0 / 4;
short trans_y = gstate->vtrans1 / 4;
short trans_z = gstate->vtrans2;
rdp.view_scale[0] = scale_x * rdp.scale_x;
rdp.view_scale[1] = -scale_y * rdp.scale_y;
rdp.view_scale[2] = 32.0f * scale_z;
rdp.view_trans[0] = trans_x * rdp.scale_x;
rdp.view_trans[1] = trans_y * rdp.scale_y;
rdp.view_trans[2] = 32.0f * trans_z;
rdp.update |= UPDATE_VIEWPORT;
FRDP ("viewport scale(%d, %d, %d), trans(%d, %d, %d)\n", scale_x, scale_y, scale_z,
trans_x, trans_y, trans_z);
t3dProcessRDP(segoffset(gstate->rdpCmds) >> 2);
}
static void t3d_vertex(wxUint32 addr, wxUint32 v0, wxUint32 n)
{
float x, y, z;
rdp.v0 = v0; // Current vertex
rdp.vn = n; // Number of vertices to copy
n <<= 4;
for (wxUint32 i=0; i < n; i+=16)
{
VERTEX *v = &rdp.vtx[v0 + (i>>4)];
x = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 2)^1];
v->flags = ((wxUint16*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->ou = 2.0f * (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = 2.0f * (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0;
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3];
v->a = ((wxUint8*)gfx.RDRAM)[(addr+i + 15)^3];
v->x = x*rdp.combined[0][0] + y*rdp.combined[1][0] + z*rdp.combined[2][0] + rdp.combined[3][0];
v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];
v->z = x*rdp.combined[0][2] + y*rdp.combined[1][2] + z*rdp.combined[2][2] + rdp.combined[3][2];
v->w = x*rdp.combined[0][3] + y*rdp.combined[1][3] + z*rdp.combined[2][3] + rdp.combined[3][3];
if (fabs(v->w) < 0.001) v->w = 0.001f;
v->oow = 1.0f / v->w;
v->x_w = v->x * v->oow;
v->y_w = v->y * v->oow;
v->z_w = v->z * v->oow;
v->uv_calculated = 0xFFFFFFFF;
v->screen_translated = 0;
v->shade_mod = 0;
v->scr_off = 0;
if (v->x < -v->w) v->scr_off |= 1;
if (v->x > v->w) v->scr_off |= 2;
if (v->y < -v->w) v->scr_off |= 4;
if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16;
#ifdef EXTREME_LOGGING
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i>>4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a);
#endif
}
}
static void t3dLoadObject(wxUint32 pstate, wxUint32 pvtx, wxUint32 ptri)
{
LRDP("Loading Turbo3D object\n");
t3dState *ostate = (t3dState*)&gfx.RDRAM[segoffset(pstate)];
rdp.cur_tile = (ostate->textureState)&7;
FRDP("tile: %d\n", rdp.cur_tile);
if (rdp.tiles[rdp.cur_tile].s_scale < 0.001f)
rdp.tiles[rdp.cur_tile].s_scale = 0.015625;
if (rdp.tiles[rdp.cur_tile].t_scale < 0.001f)
rdp.tiles[rdp.cur_tile].t_scale = 0.015625;
#ifdef EXTREME_LOGGING
FRDP("renderState: %08lx, textureState: %08lx, othermode0: %08lx, othermode1: %08lx, rdpCmds: %08lx, triCount : %d, v0: %d, vn: %d\n", ostate->renderState, ostate->textureState,
ostate->othermode0, ostate->othermode1, ostate->rdpCmds, ostate->triCount, ostate->vtxV0, ostate->vtxCount);
#endif
rdp.cmd0 = ostate->othermode0;
rdp.cmd1 = ostate->othermode1;
rdp_setothermode();
rdp.cmd1 = ostate->renderState;
uc0_setgeometrymode();
if (!(ostate->flag&1)) //load matrix
{
wxUint32 addr = segoffset(pstate+sizeof(t3dState)) & BMASK;
load_matrix(rdp.combined, addr);
#ifdef EXTREME_LOGGING
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
#endif
}
rdp.geom_mode &= ~0x00020000;
rdp.geom_mode |= 0x00000200;
if (pvtx) //load vtx
t3d_vertex(segoffset(pvtx) & BMASK, ostate->vtxV0, ostate->vtxCount);
t3dProcessRDP(segoffset(ostate->rdpCmds) >> 2);
if (ptri)
{
update ();
wxUint32 a = segoffset(ptri);
for (int t=0; t < ostate->triCount; t++)
{
t3dTriN * tri = (t3dTriN*)&gfx.RDRAM[a];
a += 4;
FRDP("tri #%d - %d, %d, %d\n", t, tri->v0, tri->v1, tri->v2);
VERTEX *v[3] = { &rdp.vtx[tri->v0], &rdp.vtx[tri->v1], &rdp.vtx[tri->v2] };
if (cull_tri(v))
rdp.tri_n ++;
else
{
draw_tri (v);
rdp.tri_n ++;
}
}
}
}
static void Turbo3D()
{
LRDP("Start Turbo3D microcode\n");
settings.ucode = ucode_Fast3D;
wxUint32 a = 0, pgstate = 0, pstate = 0, pvtx = 0, ptri = 0;
do {
a = rdp.pc[rdp.pc_i] & BMASK;
pgstate = ((wxUint32*)gfx.RDRAM)[a>>2];
pstate = ((wxUint32*)gfx.RDRAM)[(a>>2)+1];
pvtx = ((wxUint32*)gfx.RDRAM)[(a>>2)+2];
ptri = ((wxUint32*)gfx.RDRAM)[(a>>2)+3];
FRDP("GlobalState: %08lx, Object: %08lx, Vertices: %08lx, Triangles: %08lx\n", pgstate, pstate, pvtx, ptri);
if (!pstate)
{
rdp.halt = 1;
break;
}
if (pgstate)
t3dLoadGlobState(pgstate);
t3dLoadObject(pstate, pvtx, ptri);
// Go to the next instruction
rdp.pc[rdp.pc_i] += 16;
} while (pstate);
// rdp_fullsync();
settings.ucode = ucode_Turbo3d;
}

792
Source/Glide64/ucode.h Normal file
View File

@ -0,0 +1,792 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
typedef void (*rdp_instr)();
// RDP graphic instructions pointer table
static rdp_instr gfx_instruction[10][256] =
{
{
// uCode 0 - RSP SW 2.0X
// 00-3f
// games: Super Mario 64, Tetrisphere, Demos
spnoop, uc0_matrix, rsp_reserved0, uc0_movemem,
uc0_vertex, rsp_reserved1, uc0_displaylist, rsp_reserved2,
rsp_reserved3, uc6_sprite2d, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: Unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: Immediate commands
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, uc0_tri4, rdphalf_cont, rdphalf_2,
rdphalf_1, uc0_line3d, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, uc0_popmatrix, uc0_culldl, uc0_tri1,
// c0-ff: RDP commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, undef, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
// uCode 1 - F3DEX 1.XX
// 00-3f
// games: Mario Kart, Star Fox
{
spnoop, uc0_matrix, rsp_reserved0, uc0_movemem,
uc1_vertex, rsp_reserved1, uc0_displaylist, rsp_reserved2,
rsp_reserved3, uc6_sprite2d, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: Immediate commands
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, uc6_loaducode,
uc1_branch_z, uc1_tri2, uc2_modifyvtx, rdphalf_2,
uc1_rdphalf_1, uc1_line3d, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, uc0_popmatrix, uc2_culldl, uc1_tri1,
// c0-ff: RDP commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, undef, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
// uCode 2 - F3DEX 2.XX
// games: Zelda 64
{
// 00-3f
spnoop, uc2_vertex, uc2_modifyvtx, uc2_culldl,
uc1_branch_z, uc2_tri1, uc2_quad, uc2_quad,
uc2_line3d, uc6_bg_1cyc, uc6_bg_copy, uc6_obj_rendermode/*undef*/,
undef, undef, undef, undef,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// c0-ff: RDP commands mixed with uc2 commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, uc2_special3,
uc2_special2, uc2_dlist_cnt, uc2_dma_io, uc0_texture,
uc2_pop_matrix, uc2_geom_mode, uc2_matrix, uc2_moveword,
uc2_movemem, uc2_load_ucode, uc0_displaylist, uc0_enddl,
spnoop, uc1_rdphalf_1, uc0_setothermode_l, uc0_setothermode_h,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, uc2_rdphalf_2, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
// uCode 3 - "RSP SW 2.0D", but not really
// 00-3f
// games: Wave Race
// ** Added by Gonetz **
{
spnoop, uc0_matrix, rsp_reserved0, uc0_movemem,
uc3_vertex, rsp_reserved1, uc0_displaylist, rsp_reserved2,
rsp_reserved3, uc6_sprite2d, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: Immediate commands
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, uc3_tri2, rdphalf_cont, rdphalf_2,
rdphalf_1, uc3_quad3d, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, uc0_popmatrix, uc0_culldl, uc3_tri1,
// c0-ff: RDP commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, undef, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
{
// uCode 4 - RSP SW 2.0D EXT
// 00-3f
// games: Star Wars: Shadows of the Empire
spnoop, uc0_matrix, rsp_reserved0, uc0_movemem,
uc4_vertex, rsp_reserved1, uc0_displaylist, rsp_reserved2,
rsp_reserved3, uc6_sprite2d, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: Unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: Immediate commands
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, uc0_tri4, rdphalf_cont, rdphalf_2,
rdphalf_1, uc4_quad3d, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, uc0_popmatrix, uc0_culldl, uc4_tri1,
// c0-ff: RDP commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, undef, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
{
// uCode 5 - RSP SW 2.0 Diddy
// 00-3f
// games: Diddy Kong Racing
spnoop, uc5_matrix, rsp_reserved0, uc0_movemem,
uc5_vertex, uc5_tridma, uc0_displaylist, uc5_dl_in_mem,
rsp_reserved3, uc6_sprite2d, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: Unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: Immediate commands
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, uc0_tri4, rdphalf_cont, rdphalf_2,
rdphalf_1, uc0_line3d, uc5_cleargeometrymode, uc5_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc5_moveword, uc0_popmatrix, uc0_culldl, uc5_dma_offsets,
// c0-ff: RDP commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, undef, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
// uCode 6 - S2DEX 1.XX
// games: Yoshi's Story
{
spnoop, uc6_bg_1cyc, uc6_bg_copy, uc6_obj_rectangle,
uc6_obj_sprite, uc6_obj_movemem, uc0_displaylist, rsp_reserved2,
rsp_reserved3, undef/*uc6_sprite2d*/, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: Immediate commands
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, uc6_loaducode,
uc6_select_dl, uc6_obj_rendermode, uc6_obj_rectangle_r, rdphalf_2,
rdphalf_1, uc1_line3d, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, uc0_popmatrix, uc2_culldl, uc1_tri1,
// c0-ff: RDP commands
rdp_noop, uc6_obj_loadtxtr, uc6_obj_ldtx_sprite, uc6_obj_ldtx_rect,
uc6_ldtx_rect_r, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, undef, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
// uCode 7 - unknown
// games: Perfect Dark
{
// 00-3f
spnoop, uc0_matrix, rsp_reserved0, uc0_movemem,
uc7_vertex, rsp_reserved1, uc0_displaylist, uc7_colorbase,
rsp_reserved3, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, uc0_tri4, rdphalf_cont, rdphalf_2,
rdphalf_1, uc1_tri2, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, uc0_popmatrix, uc0_culldl, uc0_tri1,
// c0-ff: RDP commands mixed with uc2 commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, rdphalf_2, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
// uCode 8 - unknown
// games: Conker's Bad Fur Day
{
// 00-3f
spnoop, uc8_vertex, uc2_modifyvtx, uc2_culldl,
uc1_branch_z, uc2_tri1, uc2_quad, uc2_quad,
uc2_line3d, uc6_bg_1cyc, uc6_bg_copy, uc6_obj_rendermode/*undef*/,
undef, undef, undef, undef,
uc8_tri4, uc8_tri4, uc8_tri4, uc8_tri4,
uc8_tri4, uc8_tri4, uc8_tri4, uc8_tri4,
uc8_tri4, uc8_tri4, uc8_tri4, uc8_tri4,
uc8_tri4, uc8_tri4, uc8_tri4, uc8_tri4,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// c0-ff: RDP commands mixed with uc2 commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, uc2_special3,
uc2_special2, uc2_dlist_cnt, uc2_dma_io, uc0_texture,
uc2_pop_matrix, uc2_geom_mode, uc2_matrix, uc8_moveword,
uc8_movemem, uc2_load_ucode, uc0_displaylist, uc0_enddl,
spnoop, rdphalf_1, uc0_setothermode_l, uc0_setothermode_h,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, uc2_rdphalf_2, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
{
// uCode 9 - gzsort
// games: Telefoot Soccer
// 00-3f
spnoop, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: Unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: Immediate commands
uc9_object, uc9_rpdcmd, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
rdphalf_1, undef, uc0_cleargeometrymode, uc0_setgeometrymode,
uc0_enddl, uc0_setothermode_l, uc0_setothermode_h, uc0_texture,
uc0_moveword, undef, uc0_culldl, undef,
// c0-ff: RDP commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
uc9_mix, uc9_fmlight, uc9_light, undef,
uc9_mtxtrnsp, uc9_mtxcat, uc9_mult_mpmtx, uc9_link_subdl,
uc9_set_subdl, uc9_wait_signal, uc9_send_signal, uc0_moveword,
uc9_movemem, undef, uc0_displaylist, uc0_enddl,
undef, undef, uc0_setothermode_l, uc0_setothermode_h,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, uc9_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, rdphalf_2, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
};

1156
Source/Glide64/ucode00.h Normal file

File diff suppressed because it is too large Load Diff

163
Source/Glide64/ucode01.h Normal file
View File

@ -0,0 +1,163 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// vertex - loads vertices
//
static void uc1_vertex()
{
int v0 = (rdp.cmd0 >> 17) & 0x7F; // Current vertex
int n = (rdp.cmd0 >> 10) & 0x3F; // Number to copy
rsp_vertex(v0, n);
}
//
// tri1 - renders a triangle
//
static void uc1_tri1()
{
if (rdp.skip_drawing)
{
LRDP("uc1:tri1. skipped\n");
return;
}
FRDP("uc1:tri1 #%d - %d, %d, %d - %08lx - %08lx\n", rdp.tri_n,
((rdp.cmd1 >> 17) & 0x7F),
((rdp.cmd1 >> 9) & 0x7F),
((rdp.cmd1 >> 1) & 0x7F), rdp.cmd0, rdp.cmd1);
VERTEX *v[3] = {
&rdp.vtx[(rdp.cmd1 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 1) & 0x7F]
};
rsp_tri1(v);
}
static void uc1_tri2 ()
{
if (rdp.skip_drawing)
{
LRDP("uc1:tri2. skipped\n");
return;
}
LRDP("uc1:tri2");
FRDP(" #%d, #%d - %d, %d, %d - %d, %d, %d\n", rdp.tri_n, rdp.tri_n+1,
((rdp.cmd0 >> 17) & 0x7F),
((rdp.cmd0 >> 9) & 0x7F),
((rdp.cmd0 >> 1) & 0x7F),
((rdp.cmd1 >> 17) & 0x7F),
((rdp.cmd1 >> 9) & 0x7F),
((rdp.cmd1 >> 1) & 0x7F));
VERTEX *v[6] = {
&rdp.vtx[(rdp.cmd0 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 1) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 1) & 0x7F]
};
rsp_tri2(v);
}
static void uc1_line3d()
{
if (!settings.force_quad3d && ((rdp.cmd1&0xFF000000) == 0) && ((rdp.cmd0&0x00FFFFFF) == 0))
{
wxUint16 width = (wxUint16)(rdp.cmd1&0xFF) + 3;
FRDP("uc1:line3d width: %d #%d, #%d - %d, %d\n", width, rdp.tri_n, rdp.tri_n+1,
(rdp.cmd1 >> 17) & 0x7F,
(rdp.cmd1 >> 9) & 0x7F);
VERTEX *v[3] = {
&rdp.vtx[(rdp.cmd1 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F]
};
wxUint32 cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
rdp.flags |= CULLMASK;
rdp.update |= UPDATE_CULL_MODE;
rsp_tri1(v, width);
rdp.flags ^= CULLMASK;
rdp.flags |= cull_mode << CULLSHIFT;
rdp.update |= UPDATE_CULL_MODE;
}
else
{
FRDP("uc1:quad3d #%d, #%d\n", rdp.tri_n, rdp.tri_n+1);
VERTEX *v[6] = {
&rdp.vtx[(rdp.cmd1 >> 25) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 1) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 25) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F]
};
rsp_tri2(v);
}
}
wxUint32 branch_dl = 0;
static void uc1_rdphalf_1()
{
LRDP("uc1:rdphalf_1\n");
branch_dl = rdp.cmd1;
rdphalf_1();
}
static void uc1_branch_z()
{
wxUint32 addr = segoffset(branch_dl);
FRDP ("uc1:branch_less_z, addr: %08lx\n", addr);
wxUint32 vtx = (rdp.cmd0 & 0xFFF) >> 1;
if( fabs(rdp.vtx[vtx].z) <= (rdp.cmd1/*&0xFFFF*/) )
{
rdp.pc[rdp.pc_i] = addr;
}
}

815
Source/Glide64/ucode02.h Normal file
View File

@ -0,0 +1,815 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
static void calc_point_light (VERTEX *v, float * vpos)
{
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 (wxUint32 l=0; l<rdp.num_lights; l++)
{
if (rdp.light[l].nonblack)
{
float lvec[3] = {rdp.light[l].x, rdp.light[l].y, rdp.light[l].z};
lvec[0] -= vpos[0];
lvec[1] -= vpos[1];
lvec[2] -= vpos[2];
float light_len2 = lvec[0]*lvec[0] + lvec[1]*lvec[1] + lvec[2]*lvec[2];
float light_len = sqrtf(light_len2);
#ifdef EXTREME_LOGGING
FRDP ("calc_point_light: len: %f, len2: %f\n", light_len, light_len2);
#endif
float at = rdp.light[l].ca + light_len/65535.0f*rdp.light[l].la + light_len2/65535.0f*rdp.light[l].qa;
if (at > 0.0f)
light_intensity = 1/at;//DotProduct (lvec, nvec) / (light_len * normal_len * at);
else
light_intensity = 0.0f;
}
else
{
light_intensity = 0.0f;
}
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 = (wxUint8)(color[0]*255.0f);
v->g = (wxUint8)(color[1]*255.0f);
v->b = (wxUint8)(color[2]*255.0f);
}
static void uc6_obj_rectangle();
static void uc2_vertex ()
{
if (!(rdp.cmd0 & 0x00FFFFFF))
{
uc6_obj_rectangle();
return;
}
// This is special, not handled in update(), but here
// * Matrix Pre-multiplication idea by Gonetz (Gonetz@ngs.ru)
if (rdp.update & UPDATE_MULT_MAT)
{
rdp.update ^= UPDATE_MULT_MAT;
MulMatrices(rdp.model, rdp.proj, rdp.combined);
}
if (rdp.update & UPDATE_LIGHTS)
{
rdp.update ^= UPDATE_LIGHTS;
// Calculate light vectors
for (wxUint32 l=0; l<rdp.num_lights; l++)
{
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
NormalizeVector (rdp.light_vector[l]);
}
}
wxUint32 addr = segoffset(rdp.cmd1);
int v0, i, n;
float x, y, z;
rdp.vn = n = (rdp.cmd0 >> 12) & 0xFF;
rdp.v0 = v0 = ((rdp.cmd0 >> 1) & 0x7F) - n;
FRDP ("uc2:vertex n: %d, v0: %d, from: %08lx\n", n, v0, addr);
if (v0 < 0)
{
RDP_E ("** ERROR: uc2:vertex v0 < 0\n");
LRDP("** ERROR: uc2:vertex v0 < 0\n");
return;
}
wxUint32 geom_mode = rdp.geom_mode;
if ((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;
}
for (i=0; i < (n<<4); i+=16)
{
VERTEX *v = &rdp.vtx[v0 + (i>>4)];
x = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 2)^1];
v->flags = ((wxUint16*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0;
v->a = ((wxUint8*)gfx.RDRAM)[(addr+i + 15)^3];
v->x = x*rdp.combined[0][0] + y*rdp.combined[1][0] + z*rdp.combined[2][0] + rdp.combined[3][0];
v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];
v->z = x*rdp.combined[0][2] + y*rdp.combined[1][2] + z*rdp.combined[2][2] + rdp.combined[3][2];
v->w = x*rdp.combined[0][3] + y*rdp.combined[1][3] + z*rdp.combined[2][3] + rdp.combined[3][3];
if (fabs(v->w) < 0.001) v->w = 0.001f;
v->oow = 1.0f / v->w;
v->x_w = v->x * v->oow;
v->y_w = v->y * v->oow;
v->z_w = v->z * v->oow;
CalculateFog (v);
v->uv_calculated = 0xFFFFFFFF;
v->screen_translated = 0;
v->shade_mod = 0;
v->scr_off = 0;
if (v->x < -v->w) v->scr_off |= 1;
if (v->x > v->w) v->scr_off |= 2;
if (v->y < -v->w) v->scr_off |= 4;
if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16;
// if (v->z_w > 1.0f) v->scr_off |= 32;
if (rdp.geom_mode & 0x00020000)
{
v->vec[0] = ((char*)gfx.RDRAM)[(addr+i + 12)^3];
v->vec[1] = ((char*)gfx.RDRAM)[(addr+i + 13)^3];
v->vec[2] = ((char*)gfx.RDRAM)[(addr+i + 14)^3];
// FRDP("Calc light. x: %f, y: %f z: %f\n", v->vec[0], v->vec[1], v->vec[2]);
// if (!(rdp.geom_mode & 0x800000))
{
if (rdp.geom_mode & 0x40000)
{
if (rdp.geom_mode & 0x80000)
{
calc_linear (v);
#ifdef EXTREME_LOGGING
FRDP ("calc linear: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
#endif
}
else
{
calc_sphere (v);
#ifdef EXTREME_LOGGING
FRDP ("calc sphere: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
#endif
}
}
}
if (rdp.geom_mode & 0x00400000)
{
float tmpvec[3] = {x, y, z};
calc_point_light (v, tmpvec);
}
else
{
NormalizeVector (v->vec);
calc_light (v);
}
}
else
{
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3];
}
#ifdef EXTREME_LOGGING
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i>>4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a);
#endif
}
rdp.geom_mode = geom_mode;
}
static void uc2_modifyvtx ()
{
wxUint8 where = (wxUint8)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 vtx = (wxUint16)((rdp.cmd0 >> 1) & 0xFFFF);
FRDP ("uc2:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
uc0_modifyvtx(where, vtx, rdp.cmd1);
}
static void uc2_culldl ()
{
wxUint16 vStart = (wxUint16)(rdp.cmd0 & 0xFFFF) >> 1;
wxUint16 vEnd = (wxUint16)(rdp.cmd1 & 0xFFFF) >> 1;
wxUint32 cond = 0;
FRDP ("uc2:culldl start: %d, end: %d\n", vStart, vEnd);
if (vEnd < vStart) return;
for (wxUint16 i=vStart; i<=vEnd; i++)
{
/*
VERTEX v = &rdp.vtx[i];
// Check if completely off the screen (quick frustrum clipping for 90 FOV)
if (v->x >= -v->w)
cond |= 0x01;
if (v->x <= v->w)
cond |= 0x02;
if (v->y >= -v->w)
cond |= 0x04;
if (v->y <= v->w)
cond |= 0x08;
if (v->w >= 0.1f)
cond |= 0x10;
if (cond == 0x1F)
return;
//*/
#ifdef EXTREME_LOGGING
FRDP (" v[%d] = (%02f, %02f, %02f, 0x%02lx)\n", i, rdp.vtx[i].x, rdp.vtx[i].y, rdp.vtx[i].w, rdp.vtx[i].scr_off);
#endif
cond |= (~rdp.vtx[i].scr_off) & 0x1F;
if (cond == 0x1F)
return;
}
LRDP(" - "); // specify that the enddl is not a real command
uc0_enddl ();
}
static void uc6_obj_loadtxtr ();
static void uc2_tri1()
{
if ((rdp.cmd0 & 0x00FFFFFF) == 0x17)
{
uc6_obj_loadtxtr ();
return;
}
if (rdp.skip_drawing)
{
LRDP("uc2:tri1. skipped\n");
return;
}
FRDP("uc2:tri1 #%d - %d, %d, %d\n", rdp.tri_n,
((rdp.cmd0 >> 17) & 0x7F),
((rdp.cmd0 >> 9) & 0x7F),
((rdp.cmd0 >> 1) & 0x7F));
VERTEX *v[3] = {
&rdp.vtx[(rdp.cmd0 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 1) & 0x7F]
};
rsp_tri1(v);
}
static void uc6_obj_ldtx_sprite ();
static void uc6_obj_ldtx_rect ();
static void uc2_quad ()
{
if ((rdp.cmd0 & 0x00FFFFFF) == 0x2F)
{
wxUint32 command = rdp.cmd0>>24;
if (command == 0x6)
{
uc6_obj_ldtx_sprite ();
return;
}
if (command == 0x7)
{
uc6_obj_ldtx_rect ();
return;
}
}
if (rdp.skip_drawing)
{
LRDP("uc2_quad. skipped\n");
return;
}
LRDP("uc2:quad");
FRDP(" #%d, #%d - %d, %d, %d - %d, %d, %d\n", rdp.tri_n, rdp.tri_n+1,
((rdp.cmd0 >> 17) & 0x7F),
((rdp.cmd0 >> 9) & 0x7F),
((rdp.cmd0 >> 1) & 0x7F),
((rdp.cmd1 >> 17) & 0x7F),
((rdp.cmd1 >> 9) & 0x7F),
((rdp.cmd1 >> 1) & 0x7F));
VERTEX *v[6] = {
&rdp.vtx[(rdp.cmd0 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 1) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 1) & 0x7F]
};
rsp_tri2(v);
}
static void uc6_ldtx_rect_r ();
static void uc2_line3d ()
{
if ( (rdp.cmd0&0xFF) == 0x2F )
uc6_ldtx_rect_r ();
else
{
FRDP("uc2:line3d #%d, #%d - %d, %d\n", rdp.tri_n, rdp.tri_n+1,
(rdp.cmd0 >> 17) & 0x7F,
(rdp.cmd0 >> 9) & 0x7F);
VERTEX *v[3] = {
&rdp.vtx[(rdp.cmd0 >> 17) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 9) & 0x7F]
};
wxUint16 width = (wxUint16)(rdp.cmd0 + 3)&0xFF;
wxUint32 cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
rdp.flags |= CULLMASK;
rdp.update |= UPDATE_CULL_MODE;
rsp_tri1(v, width);
rdp.flags ^= CULLMASK;
rdp.flags |= cull_mode << CULLSHIFT;
rdp.update |= UPDATE_CULL_MODE;
}
}
static void uc2_special3 ()
{
LRDP("uc2:special3\n");
}
static void uc2_special2 ()
{
LRDP("uc2:special2\n");
}
static void uc2_dma_io ()
{
LRDP("uc2:dma_io\n");
}
static void uc2_pop_matrix ()
{
FRDP ("uc2:pop_matrix %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
// Just pop the modelview matrix
modelview_pop (rdp.cmd1 >> 6);
}
static void uc2_geom_mode ()
{
// Switch around some things
wxUint32 clr_mode = (rdp.cmd0 & 0x00DFC9FF) |
((rdp.cmd0 & 0x00000600) << 3) |
((rdp.cmd0 & 0x00200000) >> 12) | 0xFF000000;
wxUint32 set_mode = (rdp.cmd1 & 0xFFDFC9FF) |
((rdp.cmd1 & 0x00000600) << 3) |
((rdp.cmd1 & 0x00200000) >> 12);
FRDP("uc2:geom_mode c:%08lx, s:%08lx ", clr_mode, set_mode);
rdp.geom_mode &= clr_mode;
rdp.geom_mode |= set_mode;
FRDP ("result:%08lx\n", rdp.geom_mode);
if (rdp.geom_mode & 0x00000001) // Z-Buffer enable
{
if (!(rdp.flags & ZBUF_ENABLED))
{
rdp.flags |= ZBUF_ENABLED;
rdp.update |= UPDATE_ZBUF_ENABLED;
}
}
else
{
if ((rdp.flags & ZBUF_ENABLED))
{
if (!settings.flame_corona || (rdp.rm != 0x00504341)) //hack for flame's corona
rdp.flags ^= ZBUF_ENABLED;
rdp.update |= UPDATE_ZBUF_ENABLED;
}
}
if (rdp.geom_mode & 0x00001000) // Front culling
{
if (!(rdp.flags & CULL_FRONT))
{
rdp.flags |= CULL_FRONT;
rdp.update |= UPDATE_CULL_MODE;
}
}
else
{
if (rdp.flags & CULL_FRONT)
{
rdp.flags ^= CULL_FRONT;
rdp.update |= UPDATE_CULL_MODE;
}
}
if (rdp.geom_mode & 0x00002000) // Back culling
{
if (!(rdp.flags & CULL_BACK))
{
rdp.flags |= CULL_BACK;
rdp.update |= UPDATE_CULL_MODE;
}
}
else
{
if (rdp.flags & CULL_BACK)
{
rdp.flags ^= CULL_BACK;
rdp.update |= UPDATE_CULL_MODE;
}
}
//Added by Gonetz
if (rdp.geom_mode & 0x00010000) // Fog enable
{
if (!(rdp.flags & FOG_ENABLED))
{
rdp.flags |= FOG_ENABLED;
rdp.update |= UPDATE_FOG_ENABLED;
}
}
else
{
if (rdp.flags & FOG_ENABLED)
{
rdp.flags ^= FOG_ENABLED;
rdp.update |= UPDATE_FOG_ENABLED;
}
}
}
static void uc6_obj_rectangle_r ();
static void uc2_matrix ()
{
if (!(rdp.cmd0 & 0x00FFFFFF))
{
uc6_obj_rectangle_r();
return;
}
LRDP("uc2:matrix\n");
DECLAREALIGN16VAR(m[4][4]);
load_matrix(m, segoffset(rdp.cmd1));
wxUint8 command = (wxUint8)((rdp.cmd0 ^ 1) & 0xFF);
switch (command)
{
case 0: // modelview mul nopush
LRDP("modelview mul\n");
modelview_mul (m);
break;
case 1: // modelview mul push
LRDP("modelview mul push\n");
modelview_mul_push (m);
break;
case 2: // modelview load nopush
LRDP("modelview load\n");
modelview_load (m);
break;
case 3: // modelview load push
LRDP("modelview load push\n");
modelview_load_push (m);
break;
case 4: // projection mul nopush
case 5: // projection mul push, can't push projection
LRDP("projection mul\n");
projection_mul (m);
break;
case 6: // projection load nopush
case 7: // projection load push, can't push projection
LRDP("projection load\n");
projection_load (m);
break;
default:
FRDP_E ("Unknown matrix command, %02lx", command);
FRDP ("Unknown matrix command, %02lx", command);
}
#ifdef EXTREME_LOGGING
FRDP ("{%f,%f,%f,%f}\n", m[0][0], m[0][1], m[0][2], m[0][3]);
FRDP ("{%f,%f,%f,%f}\n", m[1][0], m[1][1], m[1][2], m[1][3]);
FRDP ("{%f,%f,%f,%f}\n", m[2][0], m[2][1], m[2][2], m[2][3]);
FRDP ("{%f,%f,%f,%f}\n", m[3][0], m[3][1], m[3][2], m[3][3]);
FRDP ("\nmodel\n{%f,%f,%f,%f}\n", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
FRDP ("\nproj\n{%f,%f,%f,%f}\n", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
#endif
}
static void uc2_moveword ()
{
wxUint8 index = (wxUint8)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF);
wxUint32 data = rdp.cmd1;
FRDP ("uc2:moveword ");
switch (index)
{
// NOTE: right now it's assuming that it sets the integer part first. This could
// be easily fixed, but only if i had something to test with.
case 0x00: // moveword matrix
{
// do matrix pre-mult so it's re-updated next time
if (rdp.update & UPDATE_MULT_MAT)
{
rdp.update ^= UPDATE_MULT_MAT;
MulMatrices(rdp.model, rdp.proj, rdp.combined);
}
if (rdp.cmd0 & 0x20) // fractional part
{
int index_x = (rdp.cmd0 & 0x1F) >> 1;
int index_y = index_x >> 2;
index_x &= 3;
float fpart = (rdp.cmd1>>16)/65536.0f;
rdp.combined[index_y][index_x] = (float)(int)rdp.combined[index_y][index_x];
rdp.combined[index_y][index_x] += fpart;
fpart = (rdp.cmd1&0xFFFF)/65536.0f;
rdp.combined[index_y][index_x+1] = (float)(int)rdp.combined[index_y][index_x+1];
rdp.combined[index_y][index_x+1] += fpart;
}
else
{
int index_x = (rdp.cmd0 & 0x1F) >> 1;
int index_y = index_x >> 2;
index_x &= 3;
float fpart = (float)fabs(rdp.combined[index_y][index_x] - (int)rdp.combined[index_y][index_x]);
rdp.combined[index_y][index_x] = (short)(rdp.cmd1>>16);
fpart = (float)fabs(rdp.combined[index_y][index_x+1] - (int)rdp.combined[index_y][index_x+1]);
rdp.combined[index_y][index_x+1] = (short)(rdp.cmd1&0xFFFF);
}
LRDP("matrix\n");
}
break;
case 0x02:
rdp.num_lights = data / 24;
rdp.update |= UPDATE_LIGHTS;
FRDP ("numlights: %d\n", rdp.num_lights);
break;
case 0x04:
if (offset == 0x04)
{
rdp.clip_ratio = sqrt((float)rdp.cmd1);
rdp.update |= UPDATE_VIEWPORT;
}
FRDP ("mw_clip %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
break;
case 0x06: // moveword SEGMENT
{
FRDP ("SEGMENT %08lx -> seg%d\n", data, offset >> 2);
if ((data&BMASK)<BMASK)
rdp.segment[(offset >> 2) & 0xF] = data;
}
break;
case 0x08:
{
rdp.fog_multiplier = (short)(rdp.cmd1 >> 16);
rdp.fog_offset = (short)(rdp.cmd1 & 0x0000FFFF);
FRDP ("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
//offset must be 0 for move_fog, but it can be non zero in Nushi Zuri 64 - Shiokaze ni Notte
//low-level display list has setothermode commands in this place, so this is obviously not move_fog.
if (offset == 0x04)
rdp.tlut_mode = (data == 0xffffffff) ? 0 : 2;
}
break;
case 0x0a: // moveword LIGHTCOL
{
int n = offset / 24;
FRDP ("lightcol light:%d, %08lx\n", n, data);
rdp.light[n].r = (float)((data >> 24) & 0xFF) / 255.0f;
rdp.light[n].g = (float)((data >> 16) & 0xFF) / 255.0f;
rdp.light[n].b = (float)((data >> 8) & 0xFF) / 255.0f;
rdp.light[n].a = 255;
}
break;
case 0x0c:
RDP_E ("uc2:moveword forcemtx - IGNORED\n");
LRDP("forcemtx - IGNORED\n");
break;
case 0x0e:
LRDP("perspnorm - IGNORED\n");
break;
default:
FRDP_E("uc2:moveword unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
FRDP ("unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
}
}
static void uc6_obj_movemem ();
static void uc2_movemem ()
{
int idx = rdp.cmd0 & 0xFF;
wxUint32 addr = segoffset(rdp.cmd1);
int ofs = (rdp.cmd0 >> 5) & 0x7F8;
FRDP ("uc2:movemem ofs:%d ", ofs);
switch (idx)
{
case 0:
case 2:
uc6_obj_movemem ();
break;
case 8: // VIEWPORT
{
wxUint32 a = addr >> 1;
short scale_x = ((short*)gfx.RDRAM)[(a+0)^1] >> 2;
short scale_y = ((short*)gfx.RDRAM)[(a+1)^1] >> 2;
short scale_z = ((short*)gfx.RDRAM)[(a+2)^1];
short trans_x = ((short*)gfx.RDRAM)[(a+4)^1] >> 2;
short trans_y = ((short*)gfx.RDRAM)[(a+5)^1] >> 2;
short trans_z = ((short*)gfx.RDRAM)[(a+6)^1];
rdp.view_scale[0] = scale_x * rdp.scale_x;
rdp.view_scale[1] = -scale_y * rdp.scale_y;
rdp.view_scale[2] = 32.0f * scale_z;
rdp.view_trans[0] = trans_x * rdp.scale_x;
rdp.view_trans[1] = trans_y * rdp.scale_y;
rdp.view_trans[2] = 32.0f * trans_z;
rdp.update |= UPDATE_VIEWPORT;
FRDP ("viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx\n", scale_x, scale_y, scale_z,
trans_x, trans_y, trans_z, a);
}
break;
case 10: // LIGHT
{
int n = ofs / 24;
if (n < 2)
{
char dir_x = ((char*)gfx.RDRAM)[(addr+8)^3];
rdp.lookat[n][0] = (float)(dir_x) / 127.0f;
char dir_y = ((char*)gfx.RDRAM)[(addr+9)^3];
rdp.lookat[n][1] = (float)(dir_y) / 127.0f;
char dir_z = ((char*)gfx.RDRAM)[(addr+10)^3];
rdp.lookat[n][2] = (float)(dir_z) / 127.0f;
rdp.use_lookat = TRUE;
if (n == 1)
{
if (!dir_x && !dir_y)
rdp.use_lookat = FALSE;
}
FRDP("lookat_%d (%f, %f, %f)\n", n, rdp.lookat[n][0], rdp.lookat[n][1], rdp.lookat[n][2]);
return;
}
n -= 2;
if (n > 7) return;
// Get the data
wxUint8 col = gfx.RDRAM[(addr+0)^3];
rdp.light[n].r = (float)col / 255.0f;
rdp.light[n].nonblack = col;
col = gfx.RDRAM[(addr+1)^3];
rdp.light[n].g = (float)col / 255.0f;
rdp.light[n].nonblack += col;
col = gfx.RDRAM[(addr+2)^3];
rdp.light[n].b = (float)col / 255.0f;
rdp.light[n].nonblack += col;
rdp.light[n].a = 1.0f;
// ** Thanks to Icepir8 for pointing this out **
// Lighting must be signed byte instead of byte
rdp.light[n].dir_x = (float)(((char*)gfx.RDRAM)[(addr+8)^3]) / 127.0f;
rdp.light[n].dir_y = (float)(((char*)gfx.RDRAM)[(addr+9)^3]) / 127.0f;
rdp.light[n].dir_z = (float)(((char*)gfx.RDRAM)[(addr+10)^3]) / 127.0f;
wxUint32 a = addr >> 1;
rdp.light[n].x = (float)(((short*)gfx.RDRAM)[(a+4)^1]);
rdp.light[n].y = (float)(((short*)gfx.RDRAM)[(a+5)^1]);
rdp.light[n].z = (float)(((short*)gfx.RDRAM)[(a+6)^1]);
rdp.light[n].ca = (float)(gfx.RDRAM[(addr+3)^3]) / 16.0f;
rdp.light[n].la = (float)(gfx.RDRAM[(addr+7)^3]);
rdp.light[n].qa = (float)(gfx.RDRAM[(addr+14)^3]) / 8.0f;
#ifdef EXTREME_LOGGING
FRDP ("light: n: %d, pos: x: %f, y: %f, z: %f, ca: %f, la:%f, qa: %f\n",
n, rdp.light[n].x, rdp.light[n].y, rdp.light[n].z, rdp.light[n].ca, rdp.light[n].la, rdp.light[n].qa);
#endif
FRDP ("light: n: %d, r: %.3f, g: %.3f, b: %.3f. dir: x: %.3f, y: %.3f, z: %.3f\n",
n, rdp.light[n].r, rdp.light[n].g, rdp.light[n].b,
rdp.light[n].dir_x, rdp.light[n].dir_y, rdp.light[n].dir_z);
}
break;
case 14: // matrix
{
// do not update the combined matrix!
rdp.update &= ~UPDATE_MULT_MAT;
load_matrix(rdp.combined, segoffset(rdp.cmd1));
#ifdef EXTREME_LOGGING
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
#endif
}
break;
default:
FRDP ("uc2:matrix unknown (%d)\n", idx);
FRDP ("** UNKNOWN %d\n", idx);
}
}
static void uc2_load_ucode ()
{
LRDP("uc2:load_ucode\n");
}
static void uc2_rdphalf_2 ()
{
LRDP("uc2:rdphalf_2\n");
}
static void uc2_dlist_cnt ()
{
wxUint32 addr = segoffset(rdp.cmd1) & BMASK;
int count = rdp.cmd0 & 0x000000FF;
FRDP ("dl_count - addr: %08lx, count: %d\n", addr, count);
if (addr == 0)
return;
if (rdp.pc_i >= 9) {
RDP_E ("** DL stack overflow **\n");
LRDP("** DL stack overflow **\n");
return;
}
rdp.pc_i ++; // go to the next PC in the stack
rdp.pc[rdp.pc_i] = addr; // jump to the address
rdp.dl_count = count + 1;
}

114
Source/Glide64/ucode03.h Normal file
View File

@ -0,0 +1,114 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// vertex - loads vertices
//
static void uc3_vertex()
{
int v0 = ((rdp.cmd0 >> 16) & 0xFF)/5; // Current vertex
int n = (wxUint16)((rdp.cmd0&0xFFFF) + 1)/0x210; // Number to copy
if (v0 >= 32)
v0 = 31;
if ((v0 + n) > 32)
n = 32 - v0;
rsp_vertex(v0, n);
}
//
// tri1 - renders a triangle
//
static void uc3_tri1()
{
FRDP("uc3:tri1 #%d - %d, %d, %d - %08lx - %08lx\n", rdp.tri_n,
((rdp.cmd1 >> 16) & 0xFF)/5,
((rdp.cmd1 >> 8) & 0xFF)/5,
((rdp.cmd1 ) & 0xFF)/5, rdp.cmd0, rdp.cmd1);
VERTEX *v[3] = {
&rdp.vtx[((rdp.cmd1 >> 16) & 0xFF)/5],
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF)/5],
&rdp.vtx[(rdp.cmd1 & 0xFF)/5]
};
rsp_tri1(v);
}
static void uc3_tri2 ()
{
FRDP("uc3:tri2 #%d, #%d - %d, %d, %d - %d, %d, %d\n", rdp.tri_n, rdp.tri_n+1,
((rdp.cmd0 >> 16) & 0xFF)/5,
((rdp.cmd0 >> 8) & 0xFF)/5,
((rdp.cmd0 ) & 0xFF)/5,
((rdp.cmd1 >> 16) & 0xFF)/5,
((rdp.cmd1 >> 8) & 0xFF)/5,
((rdp.cmd1 ) & 0xFF)/5);
VERTEX *v[6] = {
&rdp.vtx[((rdp.cmd0 >> 16) & 0xFF)/5],
&rdp.vtx[((rdp.cmd0 >> 8) & 0xFF)/5],
&rdp.vtx[(rdp.cmd0 & 0xFF)/5],
&rdp.vtx[((rdp.cmd1 >> 16) & 0xFF)/5],
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF)/5],
&rdp.vtx[(rdp.cmd1 & 0xFF)/5]
};
rsp_tri2(v);
}
static void uc3_quad3d()
{
FRDP("uc3:quad3d #%d, #%d\n", rdp.tri_n, rdp.tri_n+1);
VERTEX *v[6] = {
&rdp.vtx[((rdp.cmd1 >> 24) & 0xFF)/5],
&rdp.vtx[((rdp.cmd1 >> 16) & 0xFF)/5],
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF)/5],
&rdp.vtx[(rdp.cmd1 & 0xFF)/5],
&rdp.vtx[((rdp.cmd1 >> 24) & 0xFF)/5],
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF)/5]
};
rsp_tri2(v);
}

82
Source/Glide64/ucode04.h Normal file
View File

@ -0,0 +1,82 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//****************************************************************
// uCode 4 - RSP SW 2.0D EXT
//****************************************************************
static void uc4_vertex()
{
int v0 = 0; // Current vertex
int n = ((rdp.cmd0 >> 4) & 0xFFF) / 33 + 1; // Number of vertices to copy
rsp_vertex(v0, n);
}
static void uc4_tri1()
{
int v1 = ((rdp.cmd1 >> 16) & 0xFF) / 5;
int v2 = ((rdp.cmd1 >> 8) & 0xFF) / 5;
int v3 = (rdp.cmd1 & 0xFF) / 5;
FRDP("uc4:tri1 #%d - %d, %d, %d\n", rdp.tri_n,
v1, v2, v3);
VERTEX *v[3] = {
&rdp.vtx[v1],
&rdp.vtx[v2],
&rdp.vtx[v3]
};
rsp_tri1(v);
}
static void uc4_quad3d()
{
FRDP("uc4:quad3d #%d, #%d\n", rdp.tri_n, rdp.tri_n+1);
VERTEX *v[6] = {
&rdp.vtx[((rdp.cmd1 >> 24) & 0xFF) / 5],
&rdp.vtx[((rdp.cmd1 >> 16) & 0xFF) / 5],
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF) / 5],
&rdp.vtx[((rdp.cmd1 >> 24) & 0xFF) / 5],
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF) / 5],
&rdp.vtx[(rdp.cmd1 & 0xFF) / 5]
};
rsp_tri2(v);
}

375
Source/Glide64/ucode05.h Normal file
View File

@ -0,0 +1,375 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
int cur_mtx = 0;
int billboarding = 0;
int vtx_last = 0;
wxUint32 dma_offset_mtx = 0;
wxUint32 dma_offset_vtx = 0;
static void uc5_dma_offsets ()
{
dma_offset_mtx = rdp.cmd0 & 0x00FFFFFF;
dma_offset_vtx = rdp.cmd1 & 0x00FFFFFF;
vtx_last = 0;
FRDP("uc5:dma_offsets - mtx: %08lx, vtx: %08lx\n", dma_offset_mtx, dma_offset_vtx);
}
static void uc5_matrix ()
{
// Use segment offset to get the address
wxUint32 addr = dma_offset_mtx + (segoffset(rdp.cmd1) & BMASK);
wxUint8 n = (wxUint8)((rdp.cmd0 >> 16) & 0xF);
wxUint8 multiply;
if (n == 0) //DKR
{
n = (wxUint8)((rdp.cmd0 >> 22) & 0x3);
multiply = 0;
}
else //JF
{
multiply = (wxUint8)((rdp.cmd0 >> 23) & 0x1);
}
cur_mtx = n;
FRDP("uc5:matrix - #%d, addr: %08lx\n", n, addr);
if (multiply)
{
DECLAREALIGN16VAR(m[4][4]);
load_matrix(m, addr);
DECLAREALIGN16VAR(m_src[4][4]);
memcpy (m_src, rdp.dkrproj[0], 64);
MulMatrices(m, m_src, rdp.dkrproj[n]);
}
else
{
load_matrix(rdp.dkrproj[n], addr);
}
rdp.update |= UPDATE_MULT_MAT;
#ifdef EXTREME_LOGGING
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][0][0], rdp.dkrproj[n][0][1], rdp.dkrproj[n][0][2], rdp.dkrproj[n][0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][1][0], rdp.dkrproj[n][1][1], rdp.dkrproj[n][1][2], rdp.dkrproj[n][1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][2][0], rdp.dkrproj[n][2][1], rdp.dkrproj[n][2][2], rdp.dkrproj[n][2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][3][0], rdp.dkrproj[n][3][1], rdp.dkrproj[n][3][2], rdp.dkrproj[n][3][3]);
for (int i=0; i<3; i++)
{
FRDP ("proj %d\n", i);
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][0][0], rdp.dkrproj[i][0][1], rdp.dkrproj[i][0][2], rdp.dkrproj[i][0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][1][0], rdp.dkrproj[i][1][1], rdp.dkrproj[i][1][2], rdp.dkrproj[i][1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][2][0], rdp.dkrproj[i][2][1], rdp.dkrproj[i][2][2], rdp.dkrproj[i][2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][3][0], rdp.dkrproj[i][3][1], rdp.dkrproj[i][3][2], rdp.dkrproj[i][3][3]);
}
#endif
}
static void uc5_vertex ()
{
wxUint32 addr = dma_offset_vtx + (segoffset(rdp.cmd1) & BMASK);
// | cccc cccc 1111 1??? 0000 0002 2222 2222 | cmd1 = address |
// c = vtx command
// 1 = method #1 of getting count
// 2 = method #2 of getting count
// ? = unknown, but used
// 0 = unused
int n = ((rdp.cmd0 >> 19) & 0x1F);// + 1;
if (settings.hacks&hack_Diddy)
n++;
if (rdp.cmd0 & 0x00010000)
{
if (billboarding)
vtx_last = 1;
}
else
vtx_last = 0;
int first = ((rdp.cmd0 >> 9) & 0x1F) + vtx_last;
FRDP ("uc5:vertex - addr: %08lx, first: %d, count: %d, matrix: %08lx\n", addr, first, n, cur_mtx);
int prj = cur_mtx;
int start = 0;
float x, y, z;
for (int i=first; i<first+n; i++)
{
start = (i-first) * 10;
VERTEX *v = &rdp.vtx[i];
x = (float)((short*)gfx.RDRAM)[(((addr+start) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+start) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+start) >> 1) + 2)^1];
v->x = x*rdp.dkrproj[prj][0][0] + y*rdp.dkrproj[prj][1][0] + z*rdp.dkrproj[prj][2][0] + rdp.dkrproj[prj][3][0];
v->y = x*rdp.dkrproj[prj][0][1] + y*rdp.dkrproj[prj][1][1] + z*rdp.dkrproj[prj][2][1] + rdp.dkrproj[prj][3][1];
v->z = x*rdp.dkrproj[prj][0][2] + y*rdp.dkrproj[prj][1][2] + z*rdp.dkrproj[prj][2][2] + rdp.dkrproj[prj][3][2];
v->w = x*rdp.dkrproj[prj][0][3] + y*rdp.dkrproj[prj][1][3] + z*rdp.dkrproj[prj][2][3] + rdp.dkrproj[prj][3][3];
if (billboarding)
{
v->x += rdp.vtx[0].x;
v->y += rdp.vtx[0].y;
v->z += rdp.vtx[0].z;
v->w += rdp.vtx[0].w;
}
if (fabs(v->w) < 0.001) v->w = 0.001f;
v->oow = 1.0f / v->w;
v->x_w = v->x * v->oow;
v->y_w = v->y * v->oow;
v->z_w = v->z * v->oow;
v->uv_calculated = 0xFFFFFFFF;
v->screen_translated = 0;
v->shade_mod = 0;
v->scr_off = 0;
if (v->x < -v->w) v->scr_off |= 1;
if (v->x > v->w) v->scr_off |= 2;
if (v->y < -v->w) v->scr_off |= 4;
if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16;
if (fabs(v->z_w) > 1.0) v->scr_off |= 32;
v->r = ((wxUint8*)gfx.RDRAM)[(addr+start + 6)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+start + 7)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+start + 8)^3];
v->a = ((wxUint8*)gfx.RDRAM)[(addr+start + 9)^3];
CalculateFog (v);
#ifdef EXTREME_LOGGING
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i, v->x, v->y, v->z, v->w, v->z_w, v->r, v->g, v->b, v->a);
#endif
}
vtx_last += n;
}
static void uc5_tridma ()
{
vtx_last = 0; // we've drawn something, so the vertex index needs resetting
if (rdp.skip_drawing)
return;
// | cccc cccc 2222 0000 1111 1111 1111 0000 | cmd1 = address |
// c = tridma command
// 1 = method #1 of getting count
// 2 = method #2 of getting count
// 0 = unused
wxUint32 addr = segoffset(rdp.cmd1) & BMASK;
int num = (rdp.cmd0 & 0xFFF0) >> 4;
//int num = ((rdp.cmd0 & 0x00F00000) >> 20) + 1; // same thing!
FRDP("uc5:tridma #%d - addr: %08lx, count: %d\n", rdp.tri_n, addr, num);
int start, v0, v1, v2, flags;
for (int i=0; i<num; i++)
{
start = i << 4;
v0 = gfx.RDRAM[addr+start];
v1 = gfx.RDRAM[addr+start+1];
v2 = gfx.RDRAM[addr+start+2];
FRDP("tri #%d - %d, %d, %d\n", rdp.tri_n, v0, v1, v2);
VERTEX *v[3] = {
&rdp.vtx[v0],
&rdp.vtx[v1],
&rdp.vtx[v2]
};
flags = gfx.RDRAM[addr+start+3];
if (flags & 0x40) { // no cull
rdp.flags &= ~CULLMASK;
grCullMode (GR_CULL_DISABLE);
}
else { // front cull
rdp.flags &= ~CULLMASK;
if (rdp.view_scale[0] < 0) {
rdp.flags |= CULL_BACK; // agh, backwards culling
grCullMode (GR_CULL_POSITIVE);
}
else {
rdp.flags |= CULL_FRONT;
grCullMode (GR_CULL_NEGATIVE);
}
}
start += 4;
v[0]->ou = (float)((short*)gfx.RDRAM)[((addr+start) >> 1) + 5] / 32.0f;
v[0]->ov = (float)((short*)gfx.RDRAM)[((addr+start) >> 1) + 4] / 32.0f;
v[1]->ou = (float)((short*)gfx.RDRAM)[((addr+start) >> 1) + 3] / 32.0f;
v[1]->ov = (float)((short*)gfx.RDRAM)[((addr+start) >> 1) + 2] / 32.0f;
v[2]->ou = (float)((short*)gfx.RDRAM)[((addr+start) >> 1) + 1] / 32.0f;
v[2]->ov = (float)((short*)gfx.RDRAM)[((addr+start) >> 1) + 0] / 32.0f;
v[0]->uv_calculated = 0xFFFFFFFF;
v[1]->uv_calculated = 0xFFFFFFFF;
v[2]->uv_calculated = 0xFFFFFFFF;
if (cull_tri(v))
rdp.tri_n ++;
else
{
update ();
draw_tri (v);
rdp.tri_n ++;
}
}
}
static void uc5_dl_in_mem ()
{
wxUint32 addr = segoffset(rdp.cmd1) & BMASK;
int count = (rdp.cmd0 & 0x00FF0000) >> 16;
FRDP ("uc5:dl_in_mem - addr: %08lx, count: %d\n", addr, count);
if (rdp.pc_i >= 9) {
RDP_E ("** DL stack overflow **\n");
LRDP("** DL stack overflow **\n");
return;
}
rdp.pc_i ++; // go to the next PC in the stack
rdp.pc[rdp.pc_i] = addr; // jump to the address
rdp.dl_count = count + 1;
}
static void uc5_moveword()
{
LRDP("uc5:moveword ");
// Find which command this is (lowest byte of cmd0)
switch (rdp.cmd0 & 0xFF)
{
case 0x02: // moveword matrix 2 billboard
billboarding = (rdp.cmd1 & 1);
FRDP ("matrix billboard - %s\n", str_offon[billboarding]);
break;
case 0x04: // clip (verified same)
if (((rdp.cmd0>>8)&0xFFFF) == 0x04)
{
rdp.clip_ratio = sqrt((float)rdp.cmd1);
rdp.update |= UPDATE_VIEWPORT;
}
FRDP ("clip %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
break;
case 0x06: // segment (verified same)
FRDP ("segment: %08lx -> seg%d\n", rdp.cmd1, (rdp.cmd0 >> 10) & 0x0F);
rdp.segment[(rdp.cmd0 >> 10) & 0x0F] = rdp.cmd1;
break;
case 0x08:
{
rdp.fog_multiplier = (short)(rdp.cmd1 >> 16);
rdp.fog_offset = (short)(rdp.cmd1 & 0x0000FFFF);
FRDP ("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
// rdp.update |= UPDATE_FOG_ENABLED;
}
break;
case 0x0a: // moveword matrix select
cur_mtx = (rdp.cmd1 >> 6) & 3;
FRDP ("matrix select - mtx: %d\n", cur_mtx);
break;
default:
FRDP ("(unknown) %02lx - IGNORED\n", rdp.cmd0&0xFF);
}
}
static void uc5_setgeometrymode()
{
FRDP("uc0:setgeometrymode %08lx\n", rdp.cmd1);
rdp.geom_mode |= rdp.cmd1;
if (rdp.cmd1 & 0x00000001) // Z-Buffer enable
{
if (!(rdp.flags & ZBUF_ENABLED))
{
rdp.flags |= ZBUF_ENABLED;
rdp.update |= UPDATE_ZBUF_ENABLED;
}
}
//Added by Gonetz
if (rdp.cmd1 & 0x00010000) // Fog enable
{
if (!(rdp.flags & FOG_ENABLED))
{
rdp.flags |= FOG_ENABLED;
rdp.update |= UPDATE_FOG_ENABLED;
}
}
}
static void uc5_cleargeometrymode()
{
FRDP("uc0:cleargeometrymode %08lx\n", rdp.cmd1);
rdp.geom_mode &= (~rdp.cmd1);
if (rdp.cmd1 & 0x00000001) // Z-Buffer enable
{
if (rdp.flags & ZBUF_ENABLED)
{
rdp.flags ^= ZBUF_ENABLED;
rdp.update |= UPDATE_ZBUF_ENABLED;
}
}
//Added by Gonetz
if (rdp.cmd1 & 0x00010000) // Fog enable
{
if (rdp.flags & FOG_ENABLED)
{
rdp.flags ^= FOG_ENABLED;
rdp.update |= UPDATE_FOG_ENABLED;
}
}
}

1720
Source/Glide64/ucode06.h Normal file

File diff suppressed because it is too large Load Diff

179
Source/Glide64/ucode07.h Normal file
View File

@ -0,0 +1,179 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Oct 2002 Created by Gonetz (Gonetz@ngs.ru)
// Info about this ucode is taken from TR64 OGL plugin. Thanks, Icepir8!
// Oct 2003 Modified by Gonetz (Gonetz@ngs.ru)
// Bugs fixed with help from glN64 sources. Thanks, Orkin!
//****************************************************************
wxUint32 pd_col_addr = 0;
static void uc7_colorbase ()
{
LRDP("uc7_colorbase\n");
pd_col_addr = segoffset(rdp.cmd1);
}
typedef struct
{
short y;
short x;
wxUint16 idx;
short z;
short t;
short s;
} vtx_uc7;
static void uc7_vertex ()
{
if (rdp.update & UPDATE_MULT_MAT)
{
rdp.update ^= UPDATE_MULT_MAT;
MulMatrices(rdp.model, rdp.proj, rdp.combined);
}
// This is special, not handled in update()
if (rdp.update & UPDATE_LIGHTS)
{
rdp.update ^= UPDATE_LIGHTS;
// Calculate light vectors
for (wxUint32 l=0; l<rdp.num_lights; l++)
{
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
NormalizeVector (rdp.light_vector[l]);
}
}
wxUint32 addr = segoffset(rdp.cmd1);
wxUint32 v0, i, n;
float x, y, z;
rdp.v0 = v0 = (rdp.cmd0 & 0x0F0000) >> 16;
rdp.vn = n = ((rdp.cmd0 & 0xF00000) >> 20) + 1;
FRDP ("uc7:vertex n: %d, v0: %d, from: %08lx\n", n, v0, addr);
vtx_uc7 *vertex = (vtx_uc7 *)&gfx.RDRAM[addr];
for(i = 0; i < n; i++)
{
VERTEX *v = &rdp.vtx[v0 + i];
x = (float)vertex->x;
y = (float)vertex->y;
z = (float)vertex->z;
v->flags = 0;
v->ou = (float)vertex->s;
v->ov = (float)vertex->t;
v->uv_scaled = 0;
#ifdef EXTREME_LOGGING
// FRDP ("before: v%d - x: %f, y: %f, z: %f, flags: %04lx, ou: %f, ov: %f\n", i>>4, x, y, z, v->flags, v->ou, v->ov);
#endif
v->x = x*rdp.combined[0][0] + y*rdp.combined[1][0] + z*rdp.combined[2][0] + rdp.combined[3][0];
v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];
v->z = x*rdp.combined[0][2] + y*rdp.combined[1][2] + z*rdp.combined[2][2] + rdp.combined[3][2];
v->w = x*rdp.combined[0][3] + y*rdp.combined[1][3] + z*rdp.combined[2][3] + rdp.combined[3][3];
if (fabs(v->w) < 0.001) v->w = 0.001f;
v->oow = 1.0f / v->w;
v->x_w = v->x * v->oow;
v->y_w = v->y * v->oow;
v->z_w = v->z * v->oow;
v->uv_calculated = 0xFFFFFFFF;
v->screen_translated = 0;
v->scr_off = 0;
if (v->x < -v->w) v->scr_off |= 1;
if (v->x > v->w) v->scr_off |= 2;
if (v->y < -v->w) v->scr_off |= 4;
if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16;
wxUint8 *color = &gfx.RDRAM[pd_col_addr + (vertex->idx & 0xff)];
v->a = color[0];
CalculateFog (v);
if (rdp.geom_mode & 0x00020000)
{
v->vec[0] = (char)color[3];
v->vec[1] = (char)color[2];
v->vec[2] = (char)color[1];
if (rdp.geom_mode & 0x80000)
{
calc_linear (v);
#ifdef EXTREME_LOGGING
FRDP ("calc linear: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
#endif
}
else if (rdp.geom_mode & 0x40000)
{
calc_sphere (v);
#ifdef EXTREME_LOGGING
FRDP ("calc sphere: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
#endif
}
NormalizeVector (v->vec);
calc_light (v);
}
else
{
v->r = color[3];
v->g = color[2];
v->b = color[1];
}
#ifdef EXTREME_LOGGING
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f\n", i>>4, v->x, v->y, v->z, v->w, v->ou, v->ov);
#endif
vertex++;
}
}

546
Source/Glide64/ucode08.h Normal file
View File

@ -0,0 +1,546 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// January 2004 Created by Gonetz (Gonetz@ngs.ru)
//
//****************************************************************
wxUint32 uc8_normale_addr = 0;
float uc8_coord_mod[16];
static void uc8_vertex ()
{
if (rdp.update & UPDATE_MULT_MAT)
{
rdp.update ^= UPDATE_MULT_MAT;
MulMatrices(rdp.model, rdp.proj, rdp.combined);
}
wxUint32 addr = segoffset(rdp.cmd1);
int v0, i, n;
float x, y, z;
rdp.vn = n = (rdp.cmd0 >> 12) & 0xFF;
rdp.v0 = v0 = ((rdp.cmd0 >> 1) & 0x7F) - n;
FRDP ("uc8:vertex n: %d, v0: %d, from: %08lx\n", n, v0, addr);
if (v0 < 0)
{
RDP_E ("** ERROR: uc2:vertex v0 < 0\n");
LRDP("** ERROR: uc2:vertex v0 < 0\n");
return;
}
//*
// This is special, not handled in update()
if (rdp.update & UPDATE_LIGHTS)
{
rdp.update ^= UPDATE_LIGHTS;
// Calculate light vectors
for (wxUint32 l=0; l<rdp.num_lights; l++)
{
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
NormalizeVector (rdp.light_vector[l]);
#ifdef EXTREME_LOGGING
FRDP("light_vector[%d] x: %f, y: %f, z: %f\n", l, rdp.light_vector[l][0], rdp.light_vector[l][1], rdp.light_vector[l][2]);
#endif
}
}
//*/
for (i=0; i < (n<<4); i+=16)
{
VERTEX *v = &rdp.vtx[v0 + (i>>4)];
x = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 2)^1];
v->flags = ((wxUint16*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0;
v->a = ((wxUint8*)gfx.RDRAM)[(addr+i + 15)^3];
#ifdef EXTREME_LOGGING
FRDP ("before v%d - x: %f, y: %f, z: %f\n", i>>4, x, y, z);
#endif
v->x = x*rdp.combined[0][0] + y*rdp.combined[1][0] + z*rdp.combined[2][0] + rdp.combined[3][0];
v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];
v->z = x*rdp.combined[0][2] + y*rdp.combined[1][2] + z*rdp.combined[2][2] + rdp.combined[3][2];
v->w = x*rdp.combined[0][3] + y*rdp.combined[1][3] + z*rdp.combined[2][3] + rdp.combined[3][3];
#ifdef EXTREME_LOGGING
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, flags: %d\n", i>>4, v->x, v->y, v->z, v->w, v->ou, v->ov, v->flags);
#endif
if (fabs(v->w) < 0.001) v->w = 0.001f;
v->oow = 1.0f / v->w;
v->x_w = v->x * v->oow;
v->y_w = v->y * v->oow;
v->z_w = v->z * v->oow;
v->uv_calculated = 0xFFFFFFFF;
v->screen_translated = 0;
v->shade_mod = 0;
v->scr_off = 0;
if (v->x < -v->w) v->scr_off |= 1;
if (v->x > v->w) v->scr_off |= 2;
if (v->y < -v->w) v->scr_off |= 4;
if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16;
///*
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3];
#ifdef EXTREME_LOGGING
FRDP ("r: %02lx, g: %02lx, b: %02lx, a: %02lx\n", v->r, v->g, v->b, v->a);
#endif
if ((rdp.geom_mode & 0x00020000))
{
wxUint32 shift = v0 << 1;
v->vec[0] = ((char*)gfx.RDRAM)[(uc8_normale_addr + (i>>3) + shift + 0)^3];
v->vec[1] = ((char*)gfx.RDRAM)[(uc8_normale_addr + (i>>3) + shift + 1)^3];
v->vec[2] = (char)(v->flags&0xff);
if (rdp.geom_mode & 0x80000)
{
calc_linear (v);
#ifdef EXTREME_LOGGING
FRDP ("calc linear: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
#endif
}
else if (rdp.geom_mode & 0x40000)
{
calc_sphere (v);
#ifdef EXTREME_LOGGING
FRDP ("calc sphere: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
#endif
}
// FRDP("calc light. r: 0x%02lx, g: 0x%02lx, b: 0x%02lx, nx: %.3f, ny: %.3f, nz: %.3f\n", v->r, v->g, v->b, v->vec[0], v->vec[1], v->vec[2]);
FRDP("v[%d] calc light. r: 0x%02lx, g: 0x%02lx, b: 0x%02lx\n", i>>4, v->r, v->g, v->b);
float color[3] = {rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b};
FRDP("ambient light. r: %f, g: %f, b: %f\n", color[0], color[1], color[2]);
float light_intensity = 0.0f;
wxUint32 l;
if (rdp.geom_mode & 0x00400000)
{
NormalizeVector (v->vec);
for (l = 0; l < rdp.num_lights-1; l++)
{
if (!rdp.light[l].nonblack)
continue;
light_intensity = DotProduct (rdp.light_vector[l], v->vec);
FRDP("light %d, intensity : %f\n", l, light_intensity);
if (light_intensity < 0.0f)
continue;
//*
if (rdp.light[l].ca > 0.0f)
{
float vx = (v->x + uc8_coord_mod[8])*uc8_coord_mod[12] - rdp.light[l].x;
float vy = (v->y + uc8_coord_mod[9])*uc8_coord_mod[13] - rdp.light[l].y;
float vz = (v->z + uc8_coord_mod[10])*uc8_coord_mod[14] - rdp.light[l].z;
float vw = (v->w + uc8_coord_mod[11])*uc8_coord_mod[15] - rdp.light[l].w;
float len = (vx*vx+vy*vy+vz*vz+vw*vw)/65536.0f;
float p_i = rdp.light[l].ca / len;
if (p_i > 1.0f) p_i = 1.0f;
light_intensity *= p_i;
FRDP("light %d, len: %f, p_intensity : %f\n", l, len, p_i);
}
//*/
color[0] += rdp.light[l].r * light_intensity;
color[1] += rdp.light[l].g * light_intensity;
color[2] += rdp.light[l].b * light_intensity;
FRDP("light %d r: %f, g: %f, b: %f\n", l, color[0], color[1], color[2]);
}
light_intensity = DotProduct (rdp.light_vector[l], v->vec);
FRDP("light %d, intensity : %f\n", l, light_intensity);
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;
}
FRDP("light %d r: %f, g: %f, b: %f\n", l, color[0], color[1], color[2]);
}
else
{
for (l = 0; l < rdp.num_lights; l++)
{
if (rdp.light[l].nonblack && rdp.light[l].nonzero)
{
float vx = (v->x + uc8_coord_mod[8])*uc8_coord_mod[12] - rdp.light[l].x;
float vy = (v->y + uc8_coord_mod[9])*uc8_coord_mod[13] - rdp.light[l].y;
float vz = (v->z + uc8_coord_mod[10])*uc8_coord_mod[14] - rdp.light[l].z;
float vw = (v->w + uc8_coord_mod[11])*uc8_coord_mod[15] - rdp.light[l].w;
float len = (vx*vx+vy*vy+vz*vz+vw*vw)/65536.0f;
light_intensity = rdp.light[l].ca / len;
if (light_intensity > 1.0f) light_intensity = 1.0f;
FRDP("light %d, p_intensity : %f\n", l, light_intensity);
color[0] += rdp.light[l].r * light_intensity;
color[1] += rdp.light[l].g * light_intensity;
color[2] += rdp.light[l].b * light_intensity;
//FRDP("light %d r: %f, g: %f, b: %f\n", l, color[0], color[1], color[2]);
}
}
}
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 = (wxUint8)(((float)v->r)*color[0]);
v->g = (wxUint8)(((float)v->g)*color[1]);
v->b = (wxUint8)(((float)v->b)*color[2]);
#ifdef EXTREME_LOGGING
FRDP("color after light: r: 0x%02lx, g: 0x%02lx, b: 0x%02lx\n", v->r, v->g, v->b);
#endif
}
}
}
static void uc8_moveword ()
{
wxUint8 index = (wxUint8)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF);
wxUint32 data = rdp.cmd1;
FRDP ("uc8:moveword ");
switch (index)
{
// NOTE: right now it's assuming that it sets the integer part first. This could
// be easily fixed, but only if i had something to test with.
case 0x02:
rdp.num_lights = (data / 48);
rdp.update |= UPDATE_LIGHTS;
FRDP ("numlights: %d\n", rdp.num_lights);
break;
case 0x04:
if (offset == 0x04)
{
rdp.clip_ratio = sqrt((float)rdp.cmd1);
rdp.update |= UPDATE_VIEWPORT;
}
FRDP ("mw_clip %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
break;
case 0x06: // moveword SEGMENT
{
FRDP ("SEGMENT %08lx -> seg%d\n", data, offset >> 2);
rdp.segment[(offset >> 2) & 0xF] = data;
}
break;
case 0x08:
{
rdp.fog_multiplier = (short)(rdp.cmd1 >> 16);
rdp.fog_offset = (short)(rdp.cmd1 & 0x0000FFFF);
FRDP ("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
}
break;
case 0x0c:
RDP_E ("uc8:moveword forcemtx - IGNORED\n");
LRDP("forcemtx - IGNORED\n");
break;
case 0x0e:
LRDP("perspnorm - IGNORED\n");
break;
case 0x10: // moveword coord mod
{
wxUint8 n = offset >> 2;
FRDP ("coord mod:%d, %08lx\n", n, data);
if (rdp.cmd0&8)
return;
wxUint32 idx = (rdp.cmd0>>1)&3;
wxUint32 pos = rdp.cmd0&0x30;
if (pos == 0)
{
uc8_coord_mod[0+idx] = (short)(rdp.cmd1>>16);
uc8_coord_mod[1+idx] = (short)(rdp.cmd1&0xffff);
}
else if (pos == 0x10)
{
uc8_coord_mod[4+idx] = (rdp.cmd1>>16)/65536.0f;
uc8_coord_mod[5+idx] = (rdp.cmd1&0xffff)/65536.0f;
uc8_coord_mod[12+idx] = uc8_coord_mod[0+idx] + uc8_coord_mod[4+idx];
uc8_coord_mod[13+idx] = uc8_coord_mod[1+idx] + uc8_coord_mod[5+idx];
}
else if (pos == 0x20)
{
uc8_coord_mod[8+idx] = (short)(rdp.cmd1>>16);
uc8_coord_mod[9+idx] = (short)(rdp.cmd1&0xffff);
#ifdef EXTREME_LOGGING
if (idx)
{
for (int k = 8; k < 16; k++)
{
FRDP("coord_mod[%d]=%f\n", k, uc8_coord_mod[k]);
}
}
#endif
}
}
break;
default:
FRDP_E("uc8:moveword unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
FRDP ("unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
}
}
static void uc8_movemem ()
{
int idx = rdp.cmd0 & 0xFF;
wxUint32 addr = segoffset(rdp.cmd1);
int ofs = (rdp.cmd0 >> 5) & 0x3FFF;
FRDP ("uc8:movemem ofs:%d ", ofs);
switch (idx)
{
case 8: // VIEWPORT
{
wxUint32 a = addr >> 1;
short scale_x = ((short*)gfx.RDRAM)[(a+0)^1] >> 2;
short scale_y = ((short*)gfx.RDRAM)[(a+1)^1] >> 2;
short scale_z = ((short*)gfx.RDRAM)[(a+2)^1];
short trans_x = ((short*)gfx.RDRAM)[(a+4)^1] >> 2;
short trans_y = ((short*)gfx.RDRAM)[(a+5)^1] >> 2;
short trans_z = ((short*)gfx.RDRAM)[(a+6)^1];
rdp.view_scale[0] = scale_x * rdp.scale_x;
rdp.view_scale[1] = -scale_y * rdp.scale_y;
rdp.view_scale[2] = 32.0f * scale_z;
rdp.view_trans[0] = trans_x * rdp.scale_x;
rdp.view_trans[1] = trans_y * rdp.scale_y;
rdp.view_trans[2] = 32.0f * trans_z;
rdp.update |= UPDATE_VIEWPORT;
FRDP ("viewport scale(%d, %d), trans(%d, %d), from:%08lx\n", scale_x, scale_y,
trans_x, trans_y, a);
}
break;
case 10: // LIGHT
{
int n = (ofs / 48);
if (n < 2)
{
char dir_x = ((char*)gfx.RDRAM)[(addr+8)^3];
rdp.lookat[n][0] = (float)(dir_x) / 127.0f;
char dir_y = ((char*)gfx.RDRAM)[(addr+9)^3];
rdp.lookat[n][1] = (float)(dir_y) / 127.0f;
char dir_z = ((char*)gfx.RDRAM)[(addr+10)^3];
rdp.lookat[n][2] = (float)(dir_z) / 127.0f;
rdp.use_lookat = TRUE;
if (n == 1)
{
if (!dir_x && !dir_y)
rdp.use_lookat = FALSE;
}
FRDP("lookat_%d (%f, %f, %f)\n", n, rdp.lookat[n][0], rdp.lookat[n][1], rdp.lookat[n][2]);
return;
}
n -= 2;
wxUint8 col = gfx.RDRAM[(addr+0)^3];
rdp.light[n].r = (float)col / 255.0f;
rdp.light[n].nonblack = col;
col = gfx.RDRAM[(addr+1)^3];
rdp.light[n].g = (float)col / 255.0f;
rdp.light[n].nonblack += col;
col = gfx.RDRAM[(addr+2)^3];
rdp.light[n].b = (float)col / 255.0f;
rdp.light[n].nonblack += col;
rdp.light[n].a = 1.0f;
rdp.light[n].dir_x = (float)(((char*)gfx.RDRAM)[(addr+8)^3]) / 127.0f;
rdp.light[n].dir_y = (float)(((char*)gfx.RDRAM)[(addr+9)^3]) / 127.0f;
rdp.light[n].dir_z = (float)(((char*)gfx.RDRAM)[(addr+10)^3]) / 127.0f;
// **
wxUint32 a = addr >> 1;
rdp.light[n].x = (float)(((short*)gfx.RDRAM)[(a+16)^1]);
rdp.light[n].y = (float)(((short*)gfx.RDRAM)[(a+17)^1]);
rdp.light[n].z = (float)(((short*)gfx.RDRAM)[(a+18)^1]);
rdp.light[n].w = (float)(((short*)gfx.RDRAM)[(a+19)^1]);
rdp.light[n].nonzero = gfx.RDRAM[(addr+12)^3];
rdp.light[n].ca = (float)rdp.light[n].nonzero / 16.0f;
//rdp.light[n].la = rdp.light[n].ca * 1.0f;
#ifdef EXTREME_LOGGING
FRDP ("light: n: %d, pos: x: %f, y: %f, z: %f, w: %f, ca: %f\n",
n, rdp.light[n].x, rdp.light[n].y, rdp.light[n].z, rdp.light[n].w, rdp.light[n].ca);
#endif
FRDP ("light: n: %d, r: %f, g: %f, b: %f. dir: x: %.3f, y: %.3f, z: %.3f\n",
n, rdp.light[n].r, rdp.light[n].g, rdp.light[n].b,
rdp.light[n].dir_x, rdp.light[n].dir_y, rdp.light[n].dir_z);
#ifdef EXTREME_LOGGING
for (int t=0; t < 24; t++)
{
FRDP ("light[%d] = 0x%04lx \n", t, ((wxUint16*)gfx.RDRAM)[(a+t)^1]);
}
#endif
}
break;
case 14: //Normales
{
uc8_normale_addr = segoffset(rdp.cmd1);
FRDP ("Normale - addr: %08lx\n", uc8_normale_addr);
#ifdef EXTREME_LOGGING
int i;
for (i = 0; i < 32; i++)
{
char x = ((char*)gfx.RDRAM)[uc8_normale_addr + ((i<<1) + 0)^3];
char y = ((char*)gfx.RDRAM)[uc8_normale_addr + ((i<<1) + 1)^3];
FRDP("#%d x = %d, y = %d\n", i, x, y);
}
wxUint32 a = uc8_normale_addr >> 1;
for (i = 0; i < 32; i++)
{
FRDP ("n[%d] = 0x%04lx \n", i, ((wxUint16*)gfx.RDRAM)[(a+i)^1]);
}
#endif
}
break;
default:
FRDP ("uc8:movemem unknown (%d)\n", idx);
}
}
static void uc8_tri4() //by Gugaman Apr 19 2002
{
if (rdp.skip_drawing)
{
LRDP("uc8:tri4. skipped\n");
return;
}
FRDP("uc8:tri4 (#%d - #%d), %d-%d-%d, %d-%d-%d, %d-%d-%d, %d-%d-%d\n",
rdp.tri_n,
rdp.tri_n+3,
((rdp.cmd0 >> 23) & 0x1F),
((rdp.cmd0 >> 18) & 0x1F),
((((rdp.cmd0 >> 15) & 0x7) << 2) | ((rdp.cmd1 >> 30) &0x3)),
((rdp.cmd0 >> 10) & 0x1F),
((rdp.cmd0 >> 5) & 0x1F),
((rdp.cmd0 >> 0) & 0x1F),
((rdp.cmd1 >> 25) & 0x1F),
((rdp.cmd1 >> 20) & 0x1F),
((rdp.cmd1 >> 15) & 0x1F),
((rdp.cmd1 >> 10) & 0x1F),
((rdp.cmd1 >> 5) & 0x1F),
((rdp.cmd1 >> 0) & 0x1F));
VERTEX *v[12] = {
&rdp.vtx[(rdp.cmd0 >> 23) & 0x1F],
&rdp.vtx[(rdp.cmd0 >> 18) & 0x1F],
&rdp.vtx[((((rdp.cmd0 >> 15) & 0x7) << 2) | ((rdp.cmd1 >> 30) &0x3))],
&rdp.vtx[(rdp.cmd0 >> 10) & 0x1F],
&rdp.vtx[(rdp.cmd0 >> 5) & 0x1F],
&rdp.vtx[(rdp.cmd0 >> 0) & 0x1F],
&rdp.vtx[(rdp.cmd1 >> 25) & 0x1F],
&rdp.vtx[(rdp.cmd1 >> 20) & 0x1F],
&rdp.vtx[(rdp.cmd1 >> 15) & 0x1F],
&rdp.vtx[(rdp.cmd1 >> 10) & 0x1F],
&rdp.vtx[(rdp.cmd1 >> 5) & 0x1F],
&rdp.vtx[(rdp.cmd1 >> 0) & 0x1F]
};
int updated = 0;
if (cull_tri(v))
rdp.tri_n ++;
else
{
updated = 1;
update ();
draw_tri (v);
rdp.tri_n ++;
}
if (cull_tri(v+3))
rdp.tri_n ++;
else
{
if (!updated)
{
updated = 1;
update ();
}
draw_tri (v+3);
rdp.tri_n ++;
}
if (cull_tri(v+6))
rdp.tri_n ++;
else
{
if (!updated)
{
updated = 1;
update ();
}
draw_tri (v+6);
rdp.tri_n ++;
}
if (cull_tri(v+9))
rdp.tri_n ++;
else
{
if (!updated)
{
updated = 1;
update ();
}
draw_tri (v+9);
rdp.tri_n ++;
}
}

687
Source/Glide64/ucode09.h Normal file
View File

@ -0,0 +1,687 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// December 2008 Created by Gonetz (Gonetz@ngs.ru)
//
//****************************************************************
void uc9_rpdcmd ();
typedef float M44[4][4];
struct ZSORTRDP {
float view_scale[2];
float view_trans[2];
float scale_x;
float scale_y;
} zSortRdp = {{0, 0}, {0, 0}, 0, 0};
//RSP command VRCPL
static int Calc_invw (int w) {
int count, neg;
union {
wxInt32 W;
wxUint32 UW;
wxInt16 HW[2];
wxUint16 UHW[2];
} Result;
Result.W = w;
if (Result.UW == 0) {
Result.UW = 0x7FFFFFFF;
} else {
if (Result.W < 0) {
neg = TRUE;
if (Result.UHW[1] == 0xFFFF && Result.HW[0] < 0) {
Result.W = ~Result.W + 1;
} else {
Result.W = ~Result.W;
}
} else {
neg = FALSE;
}
for (count = 31; count > 0; count--) {
if ((Result.W & (1 << count))) {
Result.W &= (0xFFC00000 >> (31 - count) );
count = 0;
}
}
Result.W = 0x7FFFFFFF / Result.W;
for (count = 31; count > 0; count--) {
if ((Result.W & (1 << count))) {
Result.W &= (0xFFFF8000 >> (31 - count) );
count = 0;
}
}
if (neg == TRUE) {
Result.W = ~Result.W;
}
}
return Result.W;
}
static void uc9_draw_object (wxUint8 * addr, wxUint32 type)
{
wxUint32 textured, vnum, vsize;
switch (type) {
case 0: //null
textured = vnum = vsize = 0;
break;
case 1: //sh tri
textured = 0;
vnum = 3;
vsize = 8;
break;
case 2: //tx tri
textured = 1;
vnum = 3;
vsize = 16;
break;
case 3: //sh quad
textured = 0;
vnum = 4;
vsize = 8;
break;
case 4: //tx quad
textured = 1;
vnum = 4;
vsize = 16;
break;
}
VERTEX vtx[4];
for (wxUint32 i = 0; i < vnum; i++)
{
VERTEX &v = vtx[i];
v.sx = zSortRdp.scale_x * ((short*)addr)[0^1];
v.sy = zSortRdp.scale_y * ((short*)addr)[1^1];
v.sz = 1.0f;
v.r = addr[4^3];
v.g = addr[5^3];
v.b = addr[6^3];
v.a = addr[7^3];
v.flags = 0;
v.uv_scaled = 0;
v.uv_calculated = 0xFFFFFFFF;
v.shade_mod = 0;
v.scr_off = 0;
v.screen_translated = 2;
if (textured)
{
v.ou = ((short*)addr)[4^1];
v.ov = ((short*)addr)[5^1];
v.w = Calc_invw(((int*)addr)[3]) / 31.0f;
v.oow = 1.0f / v.w;
FRDP ("v%d - sx: %f, sy: %f ou: %f, ov: %f, w: %f, r=%d, g=%d, b=%d, a=%d\n", i, v.sx/rdp.scale_x, v.sy/rdp.scale_y, v.ou*rdp.tiles[rdp.cur_tile].s_scale, v.ov*rdp.tiles[rdp.cur_tile].t_scale, v.w, v.r, v.g, v.b, v.a);
}
else
{
v.oow = v.w = 1.0f;
FRDP ("v%d - sx: %f, sy: %f r=%d, g=%d, b=%d, a=%d\n", i, v.sx/rdp.scale_x, v.sy/rdp.scale_y, v.r, v.g, v.b, v.a);
}
addr += vsize;
}
//*
VERTEX *pV[4] = {
&vtx[0],
&vtx[1],
&vtx[2],
&vtx[3]
};
if (vnum == 3)
{
FRDP("uc9:Tri #%d, #%d\n", rdp.tri_n, rdp.tri_n+1);
draw_tri (pV, 0);
rdp.tri_n ++;
}
else
{
FRDP("uc9:Quad #%d, #%d\n", rdp.tri_n, rdp.tri_n+1);
draw_tri (pV, 0);
draw_tri (pV+1, 0);
rdp.tri_n += 2;
}
}
static wxUint32 uc9_load_object (wxUint32 zHeader, wxUint32 * rdpcmds)
{
wxUint32 type = zHeader & 7;
wxUint8 * addr = gfx.RDRAM + (zHeader&0xFFFFFFF8);
switch (type) {
case 1: //sh tri
case 3: //sh quad
{
rdp.cmd1 = ((wxUint32*)addr)[1];
if (rdp.cmd1 != rdpcmds[0])
{
rdpcmds[0] = rdp.cmd1;
uc9_rpdcmd ();
}
update ();
uc9_draw_object(addr + 8, type);
}
break;
case 0: //null
case 2: //tx tri
case 4: //tx quad
{
rdp.cmd1 = ((wxUint32*)addr)[1];
if (rdp.cmd1 != rdpcmds[0])
{
rdpcmds[0] = rdp.cmd1;
uc9_rpdcmd ();
}
rdp.cmd1 = ((wxUint32*)addr)[2];
if (rdp.cmd1 != rdpcmds[1])
{
uc9_rpdcmd ();
rdpcmds[1] = rdp.cmd1;
}
rdp.cmd1 = ((wxUint32*)addr)[3];
if (rdp.cmd1 != rdpcmds[2])
{
uc9_rpdcmd ();
rdpcmds[2] = rdp.cmd1;
}
if (type)
{
update ();
uc9_draw_object(addr + 16, type);
}
}
break;
}
return segoffset(((wxUint32*)addr)[0]);
}
static void uc9_object ()
{
LRDP("uc9:object\n");
wxUint32 rdpcmds[3] = {0, 0, 0};
wxUint32 cmd1 = rdp.cmd1;
wxUint32 zHeader = segoffset(rdp.cmd0);
while (zHeader)
zHeader = uc9_load_object(zHeader, rdpcmds);
zHeader = segoffset(cmd1);
while (zHeader)
zHeader = uc9_load_object(zHeader, rdpcmds);
}
static void uc9_mix ()
{
LRDP("uc9:mix IGNORED\n");
}
static void uc9_fmlight ()
{
int mid = rdp.cmd0&0xFF;
rdp.num_lights = 1 + ((rdp.cmd1>>12)&0xFF);
wxUint32 a = -1024 + (rdp.cmd1&0xFFF);
FRDP ("uc9:fmlight matrix: %d, num: %d, dmem: %04lx\n", mid, rdp.num_lights, a);
M44 *m;
switch (mid) {
case 4:
m = (M44*)rdp.model;
break;
case 6:
m = (M44*)rdp.proj;
break;
case 8:
m = (M44*)rdp.combined;
break;
}
rdp.light[rdp.num_lights].r = (float)(((wxUint8*)gfx.DMEM)[(a+0)^3]) / 255.0f;
rdp.light[rdp.num_lights].g = (float)(((wxUint8*)gfx.DMEM)[(a+1)^3]) / 255.0f;
rdp.light[rdp.num_lights].b = (float)(((wxUint8*)gfx.DMEM)[(a+2)^3]) / 255.0f;
rdp.light[rdp.num_lights].a = 1.0f;
FRDP ("ambient light: r: %.3f, g: %.3f, b: %.3f\n", rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b);
a += 8;
wxUint32 i;
for (i = 0; i < rdp.num_lights; i++)
{
rdp.light[i].r = (float)(((wxUint8*)gfx.DMEM)[(a+0)^3]) / 255.0f;
rdp.light[i].g = (float)(((wxUint8*)gfx.DMEM)[(a+1)^3]) / 255.0f;
rdp.light[i].b = (float)(((wxUint8*)gfx.DMEM)[(a+2)^3]) / 255.0f;
rdp.light[i].a = 1.0f;
rdp.light[i].dir_x = (float)(((char*)gfx.DMEM)[(a+8)^3]) / 127.0f;
rdp.light[i].dir_y = (float)(((char*)gfx.DMEM)[(a+9)^3]) / 127.0f;
rdp.light[i].dir_z = (float)(((char*)gfx.DMEM)[(a+10)^3]) / 127.0f;
FRDP ("light: n: %d, r: %.3f, g: %.3f, b: %.3f, x: %.3f, y: %.3f, z: %.3f\n",
i, rdp.light[i].r, rdp.light[i].g, rdp.light[i].b,
rdp.light[i].dir_x, rdp.light[i].dir_y, rdp.light[i].dir_z);
// TransformVector(&rdp.light[i].dir_x, rdp.light_vector[i], *m);
InverseTransformVector(&rdp.light[i].dir_x, rdp.light_vector[i], *m);
NormalizeVector (rdp.light_vector[i]);
FRDP ("light vector: n: %d, x: %.3f, y: %.3f, z: %.3f\n",
i, rdp.light_vector[i][0], rdp.light_vector[i][1], rdp.light_vector[i][2]);
a += 24;
}
for (i = 0; i < 2; i++)
{
float dir_x = (float)(((char*)gfx.DMEM)[(a+8)^3]) / 127.0f;
float dir_y = (float)(((char*)gfx.DMEM)[(a+9)^3]) / 127.0f;
float dir_z = (float)(((char*)gfx.DMEM)[(a+10)^3]) / 127.0f;
if (sqrt(dir_x*dir_x + dir_y*dir_y + dir_z*dir_z) < 0.98)
{
rdp.use_lookat = FALSE;
return;
}
rdp.lookat[i][0] = dir_x;
rdp.lookat[i][1] = dir_y;
rdp.lookat[i][2] = dir_z;
a += 24;
}
rdp.use_lookat = TRUE;
}
static void uc9_light ()
{
wxUint32 csrs = -1024 + ((rdp.cmd0>>12)&0xFFF);
wxUint32 nsrs = -1024 + (rdp.cmd0&0xFFF);
wxUint32 num = 1 + ((rdp.cmd1>>24)&0xFF);
wxUint32 cdest = -1024 + ((rdp.cmd1>>12)&0xFFF);
wxUint32 tdest = -1024 + (rdp.cmd1&0xFFF);
int use_material = (csrs != 0x0ff0);
tdest >>= 1;
FRDP ("uc9:light n: %d, colsrs: %04lx, normales: %04lx, coldst: %04lx, texdst: %04lx\n", num, csrs, nsrs, cdest, tdest);
VERTEX v;
for (wxUint32 i = 0; i < num; i++)
{
v.vec[0] = ((char*)gfx.DMEM)[(nsrs++)^3];
v.vec[1] = ((char*)gfx.DMEM)[(nsrs++)^3];
v.vec[2] = ((char*)gfx.DMEM)[(nsrs++)^3];
calc_sphere (&v);
// calc_linear (&v);
NormalizeVector (v.vec);
calc_light (&v);
v.a = 0xFF;
if (use_material)
{
v.r = (wxUint8)(((wxUint32)v.r * gfx.DMEM[(csrs++)^3])>>8);
v.g = (wxUint8)(((wxUint32)v.g * gfx.DMEM[(csrs++)^3])>>8);
v.b = (wxUint8)(((wxUint32)v.b * gfx.DMEM[(csrs++)^3])>>8);
v.a = gfx.DMEM[(csrs++)^3];
}
gfx.DMEM[(cdest++)^3] = v.r;
gfx.DMEM[(cdest++)^3] = v.g;
gfx.DMEM[(cdest++)^3] = v.b;
gfx.DMEM[(cdest++)^3] = v.a;
((short*)gfx.DMEM)[(tdest++)^1] = (short)v.ou;
((short*)gfx.DMEM)[(tdest++)^1] = (short)v.ov;
}
}
static void uc9_mtxtrnsp ()
{
LRDP("uc9:mtxtrnsp - ignored\n");
/*
LRDP("uc9:mtxtrnsp ");
M44 *s;
switch (rdp.cmd1&0xF) {
case 4:
s = (M44*)rdp.model;
LRDP("Model\n");
break;
case 6:
s = (M44*)rdp.proj;
LRDP("Proj\n");
break;
case 8:
s = (M44*)rdp.combined;
LRDP("Comb\n");
break;
}
float m = *s[1][0];
*s[1][0] = *s[0][1];
*s[0][1] = m;
m = *s[2][0];
*s[2][0] = *s[0][2];
*s[0][2] = m;
m = *s[2][1];
*s[2][1] = *s[1][2];
*s[1][2] = m;
*/
}
static void uc9_mtxcat ()
{
LRDP("uc9:mtxcat ");
M44 *s;
M44 *t;
wxUint32 S = rdp.cmd0&0xF;
wxUint32 T = (rdp.cmd1>>16)&0xF;
wxUint32 D = rdp.cmd1&0xF;
switch (S) {
case 4:
s = (M44*)rdp.model;
LRDP("Model * ");
break;
case 6:
s = (M44*)rdp.proj;
LRDP("Proj * ");
break;
case 8:
s = (M44*)rdp.combined;
LRDP("Comb * ");
break;
}
switch (T) {
case 4:
t = (M44*)rdp.model;
LRDP("Model -> ");
break;
case 6:
t = (M44*)rdp.proj;
LRDP("Proj -> ");
break;
case 8:
LRDP("Comb -> ");
t = (M44*)rdp.combined;
break;
}
DECLAREALIGN16VAR(m[4][4]);
MulMatrices(*s, *t, m);
switch (D) {
case 4:
memcpy (rdp.model, m, 64);;
LRDP("Model\n");
break;
case 6:
memcpy (rdp.proj, m, 64);;
LRDP("Proj\n");
break;
case 8:
memcpy (rdp.combined, m, 64);;
LRDP("Comb\n");
break;
}
#ifdef EXTREME_LOGGING
FRDP ("\nmodel\n{%f,%f,%f,%f}\n", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
FRDP ("\nproj\n{%f,%f,%f,%f}\n", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
FRDP ("\ncombined\n{%f,%f,%f,%f}\n", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
#endif
}
typedef struct {
short sy;
short sx;
int invw;
short yi;
short xi;
short wi;
wxUint8 fog;
wxUint8 cc;
} zSortVDest;
static void uc9_mult_mpmtx ()
{
//int id = rdp.cmd0&0xFF;
int num = 1+ ((rdp.cmd1>>24)&0xFF);
int src = -1024 + ((rdp.cmd1>>12)&0xFFF);
int dst = -1024 + (rdp.cmd1&0xFFF);
FRDP ("uc9:mult_mpmtx from: %04lx to: %04lx n: %d\n", src, dst, num);
short * saddr = (short*)(gfx.DMEM+src);
zSortVDest * daddr = (zSortVDest*)(gfx.DMEM+dst);
int idx = 0;
zSortVDest v;
memset(&v, 0, sizeof(zSortVDest));
//float scale_x = 4.0f/rdp.scale_x;
//float scale_y = 4.0f/rdp.scale_y;
for (int i = 0; i < num; i++)
{
short sx = saddr[(idx++)^1];
short sy = saddr[(idx++)^1];
short sz = saddr[(idx++)^1];
float x = sx*rdp.combined[0][0] + sy*rdp.combined[1][0] + sz*rdp.combined[2][0] + rdp.combined[3][0];
float y = sx*rdp.combined[0][1] + sy*rdp.combined[1][1] + sz*rdp.combined[2][1] + rdp.combined[3][1];
float z = sx*rdp.combined[0][2] + sy*rdp.combined[1][2] + sz*rdp.combined[2][2] + rdp.combined[3][2];
float w = sx*rdp.combined[0][3] + sy*rdp.combined[1][3] + sz*rdp.combined[2][3] + rdp.combined[3][3];
v.sx = (short)(zSortRdp.view_trans[0] + x / w * zSortRdp.view_scale[0]);
v.sy = (short)(zSortRdp.view_trans[1] + y / w * zSortRdp.view_scale[1]);
v.xi = (short)x;
v.yi = (short)y;
v.wi = (short)w;
v.invw = Calc_invw((int)(w * 31.0));
if (w < 0.0f)
v.fog = 0;
else
{
int fog = (int)(z / w * rdp.fog_multiplier + rdp.fog_offset);
if (fog > 255)
fog = 255;
v.fog = (fog >= 0) ? (wxUint8)fog : 0;
}
v.cc = 0;
if (x < -w) v.cc |= 0x10;
if (x > w) v.cc |= 0x01;
if (y < -w) v.cc |= 0x20;
if (y > w) v.cc |= 0x02;
if (w < 0.1f) v.cc |= 0x04;
daddr[i] = v;
//memcpy(gfx.DMEM+dst+sizeof(zSortVDest)*i, &v, sizeof(zSortVDest));
// FRDP("v%d x: %d, y: %d, z: %d -> sx: %d, sy: %d, w: %d, xi: %d, yi: %d, wi: %d, fog: %d\n", i, sx, sy, sz, v.sx, v.sy, v.invw, v.xi, v.yi, v.wi, v.fog);
FRDP("v%d x: %d, y: %d, z: %d -> sx: %04lx, sy: %04lx, invw: %08lx - %f, xi: %04lx, yi: %04lx, wi: %04lx, fog: %04lx\n", i, sx, sy, sz, v.sx, v.sy, v.invw, w, v.xi, v.yi, v.wi, v.fog);
}
}
static void uc9_link_subdl ()
{
LRDP("uc9:link_subdl IGNORED\n");
}
static void uc9_set_subdl ()
{
LRDP("uc9:set_subdl IGNORED\n");
}
static void uc9_wait_signal ()
{
LRDP("uc9:wait_signal IGNORED\n");
}
static void uc9_send_signal ()
{
LRDP("uc9:send_signal IGNORED\n");
}
void uc9_movemem ()
{
LRDP("uc9:movemem\n");
int idx = rdp.cmd0 & 0x0E;
int ofs = ((rdp.cmd0>>6)&0x1ff)<<3;
int len = (1 + ((rdp.cmd0>>15)&0x1ff))<<3;
FRDP ("uc9:movemem ofs: %d, len: %d. ", ofs, len);
int flag = rdp.cmd0 & 0x01;
wxUint32 addr = segoffset(rdp.cmd1);
switch (idx)
{
case 0: //save/load
if (flag == 0)
{
int dmem_addr = (idx<<3) + ofs;
FRDP ("Load to DMEM. %08lx -> %08lx\n", addr, dmem_addr);
memcpy(gfx.DMEM + dmem_addr, gfx.RDRAM + addr, len);
}
else
{
int dmem_addr = (idx<<3) + ofs;
FRDP ("Load from DMEM. %08lx -> %08lx\n", dmem_addr, addr);
memcpy(gfx.RDRAM + addr, gfx.DMEM + dmem_addr, len);
}
break;
case 4: // model matrix
case 6: // projection matrix
case 8: // combined matrix
{
DECLAREALIGN16VAR(m[4][4]);
load_matrix(m, addr);
switch (idx)
{
case 4: // model matrix
LRDP("Modelview load\n");
modelview_load (m);
break;
case 6: // projection matrix
LRDP("Projection load\n");
projection_load (m);
break;
case 8: // projection matrix
LRDP("Combined load\n");
rdp.update &= ~UPDATE_MULT_MAT;
memcpy (rdp.combined, m, 64);;
break;
}
#ifdef EXTREME_LOGGING
FRDP ("{%f,%f,%f,%f}\n", m[0][0], m[0][1], m[0][2], m[0][3]);
FRDP ("{%f,%f,%f,%f}\n", m[1][0], m[1][1], m[1][2], m[1][3]);
FRDP ("{%f,%f,%f,%f}\n", m[2][0], m[2][1], m[2][2], m[2][3]);
FRDP ("{%f,%f,%f,%f}\n", m[3][0], m[3][1], m[3][2], m[3][3]);
FRDP ("\nmodel\n{%f,%f,%f,%f}\n", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
FRDP ("\nproj\n{%f,%f,%f,%f}\n", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
#endif
}
break;
case 10:
LRDP("Othermode - IGNORED\n");
break;
case 12: // VIEWPORT
{
wxUint32 a = addr >> 1;
short scale_x = ((short*)gfx.RDRAM)[(a+0)^1] >> 2;
short scale_y = ((short*)gfx.RDRAM)[(a+1)^1] >> 2;
short scale_z = ((short*)gfx.RDRAM)[(a+2)^1];
rdp.fog_multiplier = ((short*)gfx.RDRAM)[(a+3)^1];
short trans_x = ((short*)gfx.RDRAM)[(a+4)^1] >> 2;
short trans_y = ((short*)gfx.RDRAM)[(a+5)^1] >> 2;
short trans_z = ((short*)gfx.RDRAM)[(a+6)^1];
rdp.fog_offset = ((short*)gfx.RDRAM)[(a+7)^1];
rdp.view_scale[0] = scale_x * rdp.scale_x;
rdp.view_scale[1] = scale_y * rdp.scale_y;
rdp.view_scale[2] = 32.0f * scale_z;
rdp.view_trans[0] = trans_x * rdp.scale_x;
rdp.view_trans[1] = trans_y * rdp.scale_y;
rdp.view_trans[2] = 32.0f * trans_z;
zSortRdp.view_scale[0] = (float)(scale_x*4);
zSortRdp.view_scale[1] = (float)(scale_y*4);
zSortRdp.view_trans[0] = (float)(trans_x*4);
zSortRdp.view_trans[1] = (float)(trans_y*4);
zSortRdp.scale_x = rdp.scale_x / 4.0f;
zSortRdp.scale_y = rdp.scale_y / 4.0f;
rdp.update |= UPDATE_VIEWPORT;
rdp.mipmap_level = 0;
rdp.cur_tile = 0;
TILE *tmp_tile = &rdp.tiles[0];
tmp_tile->on = 1;
tmp_tile->org_s_scale = 0xFFFF;
tmp_tile->org_t_scale = 0xFFFF;
tmp_tile->s_scale = 0.031250f;
tmp_tile->t_scale = 0.031250f;
rdp.geom_mode |= 0x0200;
FRDP ("viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx\n", scale_x, scale_y, scale_z,
trans_x, trans_y, trans_z, a);
FRDP ("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
}
break;
default:
FRDP ("** UNKNOWN %d\n", idx);
}
}
static void uc9_setscissor()
{
rdp_setscissor();
if ((rdp.scissor_o.lr_x - rdp.scissor_o.ul_x) > (zSortRdp.view_scale[0] - zSortRdp.view_trans[0]))
{
float w = (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x) / 2.0f;
float h = (rdp.scissor_o.lr_y - rdp.scissor_o.ul_y) / 2.0f;
rdp.view_scale[0] = w * rdp.scale_x;
rdp.view_scale[1] = h * rdp.scale_y;
rdp.view_trans[0] = w * rdp.scale_x;
rdp.view_trans[1] = h * rdp.scale_y;
zSortRdp.view_scale[0] = w * 4.0f;
zSortRdp.view_scale[1] = h * 4.0f;
zSortRdp.view_trans[0] = w * 4.0f;
zSortRdp.view_trans[1] = h * 4.0f;
zSortRdp.scale_x = rdp.scale_x / 4.0f;
zSortRdp.scale_y = rdp.scale_y / 4.0f;
rdp.update |= UPDATE_VIEWPORT;
rdp.mipmap_level = 0;
rdp.cur_tile = 0;
TILE *tmp_tile = &rdp.tiles[0];
tmp_tile->on = 1;
tmp_tile->org_s_scale = 0xFFFF;
tmp_tile->org_t_scale = 0xFFFF;
tmp_tile->s_scale = 0.031250f;
tmp_tile->t_scale = 0.031250f;
rdp.geom_mode |= 0x0200;
}
}

View File

@ -0,0 +1,70 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// December 2008 Created by Gonetz (Gonetz@ngs.ru)
//
//****************************************************************
void uc9_rpdcmd ()
{
wxUint32 a = segoffset(rdp.cmd1) >> 2;
FRDP ("uc9:rdpcmd addr: %08lx\n", a);
if (a)
{
rdp.LLE = 1;
wxUint32 cmd = 0;
while(1)
{
rdp.cmd0 = ((wxUint32*)gfx.RDRAM)[a++];
cmd = rdp.cmd0>>24;
if (cmd == 0xDF)
break;
rdp.cmd1 = ((wxUint32*)gfx.RDRAM)[a++];
if (cmd == 0xE4 || cmd == 0xE5)
{
a++;
rdp.cmd2 = ((wxUint32*)gfx.RDRAM)[a++];
a++;
rdp.cmd3 = ((wxUint32*)gfx.RDRAM)[a++];
}
gfx_instruction[ucode_zSort][cmd] ();
};
rdp.LLE = 0;
}
}

1110
Source/Glide64/ucodeFB.h Normal file

File diff suppressed because it is too large Load Diff

35
Source/Glide64/usa.xpm Normal file
View File

@ -0,0 +1,35 @@
/* XPM */
static const char *usa_xpm[]={
"30 16 16 1",
" c #303F8B",
"0 c #27327A",
"1 c #D3332B",
"2 c #1A2A7A",
"3 c #3A428E",
"4 c #F5CDCD",
"5 c #3A4A8E",
"6 c #EB8E8D",
"7 c #122272",
"8 c #E56A64",
"9 c #FBE1E1",
"a c #FBEEEE",
"b c #DE322A",
"c c #F3D6DB",
"d c #EA7A7A",
"e c #636DA9",
" 0 0 0 0 0 0111111111111111111",
"23 3 3 3 3 2444444444444444444",
"5 666666666666666666",
"73 7888888888888888888",
"3 3 9aaaaaaaaaaaaaaaa9",
"0535535355301bbbbbbbbbbbbbbbb1",
"05 3 3 3 3 0cccccccccccccccc94",
"3 3 3 3 3 dddddddddddddddddd",
"eeeeeeeeeeeedddddddddddddddddd",
"cc9c9c9c9c9c9c99c99c99c99c99cc",
"1bbbbbbbbbbbbbbbbbbbbbbbbbbbb1",
"99aaa9aa9aa9aaa9aa9aaa9aaa9aa9",
"888888888888888888888888888888",
"666666666666666666666666666666",
"444444444444444444444444444444",
"111111111111111111111111111111"};