mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
More common things moved out from the GFX plugins. No visible changes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@27 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -279,13 +279,11 @@ union UGQR
|
||||
{
|
||||
unsigned ST_TYPE : 3;
|
||||
unsigned : 5;
|
||||
// signed ST_SCALE : 6;
|
||||
unsigned ST_SCALE : 6;
|
||||
unsigned ST_SCALE : 6;
|
||||
unsigned : 2;
|
||||
unsigned LD_TYPE : 3;
|
||||
unsigned : 5;
|
||||
// signed LD_SCALE : 6;
|
||||
unsigned LD_SCALE : 6;
|
||||
unsigned LD_SCALE : 6;
|
||||
unsigned : 2;
|
||||
};
|
||||
|
||||
|
||||
@@ -346,6 +346,7 @@ namespace Jit64
|
||||
js.blockStart = emaddress;
|
||||
js.fifoBytesThisBlock = 0;
|
||||
js.curBlock = &b;
|
||||
js.blockSetsQuantizers = false;
|
||||
|
||||
//Analyze the block, collect all instructions it is made of (including inlining,
|
||||
//if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace Jit64
|
||||
int downcountAmount;
|
||||
|
||||
bool isLastInstruction;
|
||||
bool blockSetsQuantizers;
|
||||
|
||||
int fifoBytesThisBlock;
|
||||
|
||||
|
||||
@@ -95,12 +95,14 @@ const double m_dequantizeTableD[] =
|
||||
(1 << 4), (1 << 3), (1 << 2), (1 << 1),
|
||||
};
|
||||
|
||||
// The big problem is likely instructions that set the quantizers in the same block.
|
||||
// We will have to break block after quantizers are written to.
|
||||
u32 temp;
|
||||
void psq_st(UGeckoInstruction inst)
|
||||
{
|
||||
BIT32OLD;
|
||||
OLD;
|
||||
if (!Core::GetStartupParameter().bOptimizeQuantizers)
|
||||
if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers)
|
||||
{
|
||||
Default(inst);
|
||||
return;
|
||||
@@ -220,7 +222,7 @@ void psq_l(UGeckoInstruction inst)
|
||||
{
|
||||
BIT32OLD;
|
||||
OLD;
|
||||
if (!Core::GetStartupParameter().bOptimizeQuantizers)
|
||||
if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers)
|
||||
{
|
||||
Default(inst);
|
||||
return;
|
||||
@@ -296,6 +298,14 @@ void psq_l(UGeckoInstruction inst)
|
||||
ADD(32, gpr.R(inst.RA), Imm32(offset));
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
Dynamic quantizer. Todo when we have a test set.
|
||||
MOVZX(32, 8, EAX, M(((char *)&PowerPC::ppcState.spr[SPR_GQR0 + inst.I]) + 3)); // it's in the high byte.
|
||||
AND(32, R(EAX), Imm8(0x3F));
|
||||
MOV(32, R(ECX), Imm32((u32)&m_dequantizeTableD));
|
||||
MOVDDUP(r, MComplex(RCX, EAX, 8, 0));
|
||||
*/
|
||||
#endif
|
||||
default:
|
||||
// 4 0
|
||||
|
||||
@@ -35,15 +35,32 @@ namespace Jit64
|
||||
{
|
||||
case SPR_LR:
|
||||
case SPR_CTR:
|
||||
gpr.Lock(d);
|
||||
gpr.LoadToX64(d,true);
|
||||
MOV(32, M(&PowerPC::ppcState.spr[iIndex]), gpr.R(d));
|
||||
gpr.UnlockAll();
|
||||
// These are safe to do the easy way, see the bottom of this function.
|
||||
break;
|
||||
|
||||
case SPR_GQR0:
|
||||
case SPR_GQR0 + 1:
|
||||
case SPR_GQR0 + 2:
|
||||
case SPR_GQR0 + 3:
|
||||
case SPR_GQR0 + 4:
|
||||
case SPR_GQR0 + 5:
|
||||
case SPR_GQR0 + 6:
|
||||
case SPR_GQR0 + 7:
|
||||
js.blockSetsQuantizers = false;
|
||||
// Prevent recompiler from compiling in old quantizer values.
|
||||
// TODO - actually save the set state and use it in following quantizer ops.
|
||||
break;
|
||||
// TODO - break block if quantizers are written to.
|
||||
default:
|
||||
Default(inst);
|
||||
return;
|
||||
}
|
||||
|
||||
// OK, this is easy.
|
||||
gpr.Lock(d);
|
||||
gpr.LoadToX64(d,true);
|
||||
MOV(32, M(&PowerPC::ppcState.spr[iIndex]), gpr.R(d));
|
||||
gpr.UnlockAll();
|
||||
}
|
||||
|
||||
void mfspr(UGeckoInstruction inst)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "LookUpTables.h"
|
||||
|
||||
int lut3to8[8];
|
||||
int lut4to8[16];
|
||||
int lut5to8[32];
|
||||
int lut6to8[64];
|
||||
float lutu8tosfloat[256];
|
||||
float lutu8toufloat[256];
|
||||
float luts8tosfloat[256];
|
||||
|
||||
void InitLUTs()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
lut3to8[i] = (i*255) / 7;
|
||||
for (int i = 0; i < 16; i++)
|
||||
lut4to8[i] = (i*255) / 15;
|
||||
for (int i = 0; i < 32; i++)
|
||||
lut5to8[i] = (i*255) / 31;
|
||||
for (int i = 0; i < 64; i++)
|
||||
lut6to8[i] = (i*255) / 63;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
lutu8tosfloat[i] = (float)(i-128) / 127.0f;
|
||||
lutu8toufloat[i] = (float)(i) / 255.0f;
|
||||
luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef _LOOKUPTABLES_H
|
||||
#define _LOOKUPTABLES_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
extern int lut3to8[8];
|
||||
extern int lut4to8[16];
|
||||
extern int lut5to8[32];
|
||||
extern int lut6to8[64];
|
||||
extern float lutu8tosfloat[256];
|
||||
extern float lutu8toufloat[256];
|
||||
extern float luts8tosfloat[256];
|
||||
|
||||
void InitLUTs();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,4 @@
|
||||
#include "XFMemory.h"
|
||||
|
||||
XFRegisters xfregs;
|
||||
u32 xfmem[XFMEM_SIZE];
|
||||
@@ -0,0 +1,218 @@
|
||||
#ifndef _XFMEMORY_H
|
||||
#define _XFMEMORY_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
/////////////
|
||||
// Lighting
|
||||
/////////////
|
||||
|
||||
#define XF_TEXPROJ_ST 0
|
||||
#define XF_TEXPROJ_STQ 1
|
||||
|
||||
#define XF_TEXINPUT_AB11 0
|
||||
#define XF_TEXINPUT_ABC1 1
|
||||
|
||||
#define XF_TEXGEN_REGULAR 0
|
||||
#define XF_TEXGEN_EMBOSS_MAP 1 // used when bump mapping
|
||||
#define XF_TEXGEN_COLOR_STRGBC0 2
|
||||
#define XF_TEXGEN_COLOR_STRGBC1 3
|
||||
|
||||
#define XF_SRCGEOM_INROW 0 // input is abc
|
||||
#define XF_SRCNORMAL_INROW 1 // input is abc
|
||||
#define XF_SRCCOLORS_INROW 2
|
||||
#define XF_SRCBINORMAL_T_INROW 3 // input is abc
|
||||
#define XF_SRCBINORMAL_B_INROW 4 // input is abc
|
||||
#define XF_SRCTEX0_INROW 5
|
||||
#define XF_SRCTEX1_INROW 6
|
||||
#define XF_SRCTEX2_INROW 7
|
||||
#define XF_SRCTEX3_INROW 8
|
||||
#define XF_SRCTEX4_INROW 9
|
||||
#define XF_SRCTEX5_INROW 10
|
||||
#define XF_SRCTEX6_INROW 11
|
||||
#define XF_SRCTEX7_INROW 12
|
||||
|
||||
#define GX_SRC_REG 0
|
||||
#define GX_SRC_VTX 1
|
||||
|
||||
struct Light
|
||||
{
|
||||
u32 useless[3];
|
||||
u32 color; //rgba
|
||||
float a0; //attenuation
|
||||
float a1;
|
||||
float a2;
|
||||
float k0; //k stuff
|
||||
float k1;
|
||||
float k2;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
float dpos[3];
|
||||
float ddir[3]; // specular lights only
|
||||
};
|
||||
struct {
|
||||
float sdir[3];
|
||||
float shalfangle[3]; // specular lights only
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#define LIGHTDIF_NONE 0
|
||||
#define LIGHTDIF_SIGN 1
|
||||
#define LIGHTDIF_CLAMP 2
|
||||
|
||||
#define LIGHTATTN_SPEC 0 // specular attenuation
|
||||
#define LIGHTATTN_SPOT 1 // distance/spotlight attenuation
|
||||
#define LIGHTATTN_NONE 2
|
||||
#define LIGHTATTN_DIR 3
|
||||
|
||||
union LitChannel
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned matsource : 1;
|
||||
unsigned enablelighting : 1;
|
||||
unsigned lightMask0_3 : 4;
|
||||
unsigned ambsource : 1;
|
||||
unsigned diffusefunc : 2; // LIGHTDIF_X
|
||||
unsigned attnfunc : 2; // LIGHTATTN_X
|
||||
unsigned lightMask4_7 : 4;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 hex : 15;
|
||||
u32 unused : 17;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 dummy0 : 7;
|
||||
u32 lightparams : 4;
|
||||
u32 dummy1 : 21;
|
||||
};
|
||||
unsigned int GetFullLightMask() const
|
||||
{
|
||||
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct ColorChannel
|
||||
{
|
||||
u32 ambColor;
|
||||
u32 matColor;
|
||||
LitChannel color;
|
||||
LitChannel alpha;
|
||||
};
|
||||
|
||||
union INVTXSPEC
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned numcolors : 2;
|
||||
unsigned numnormals : 2; // 0 - nothing, 1 - just normal, 2 - normals and binormals
|
||||
unsigned numtextures : 4;
|
||||
unsigned unused : 24;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union TexMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned unknown : 1;
|
||||
unsigned projection : 1; // XF_TEXPROJ_X
|
||||
unsigned inputform : 2; // XF_TEXINPUT_X
|
||||
unsigned texgentype : 3; // XF_TEXGEN_X
|
||||
unsigned sourcerow : 5; // XF_SRCGEOM_X
|
||||
unsigned embosssourceshift : 3; // what generated texcoord to use
|
||||
unsigned embosslightshift : 3; // light index that is used
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union PostMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned index : 6; // base row of dual transform matrix
|
||||
unsigned unused : 2;
|
||||
unsigned normalize : 1; // normalize before send operation
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
struct TexCoordInfo
|
||||
{
|
||||
TexMtxInfo texmtxinfo;
|
||||
PostMtxInfo postmtxinfo;
|
||||
};
|
||||
|
||||
struct XFRegisters
|
||||
{
|
||||
int numTexGens;
|
||||
int nNumChans;
|
||||
INVTXSPEC hostinfo; // number of textures,colors,normals from vertex input
|
||||
ColorChannel colChans[2]; //C0A0 C1A1
|
||||
TexCoordInfo texcoords[8];
|
||||
bool bEnableDualTexTransform;
|
||||
};
|
||||
|
||||
#define XFMEM_SIZE 0x8000
|
||||
#define XFMEM_POSMATRICES 0x000
|
||||
#define XFMEM_POSMATRICES_END 0x100
|
||||
#define XFMEM_NORMALMATRICES 0x400
|
||||
#define XFMEM_NORMALMATRICES_END 0x460
|
||||
#define XFMEM_POSTMATRICES 0x500
|
||||
#define XFMEM_POSTMATRICES_END 0x600
|
||||
#define XFMEM_LIGHTS 0x600
|
||||
#define XFMEM_LIGHTS_END 0x680
|
||||
|
||||
// Matrix indices
|
||||
union TMatrixIndexA
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned PosNormalMtxIdx : 6;
|
||||
unsigned Tex0MtxIdx : 6;
|
||||
unsigned Tex1MtxIdx : 6;
|
||||
unsigned Tex2MtxIdx : 6;
|
||||
unsigned Tex3MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 30;
|
||||
u32 unused : 2;
|
||||
};
|
||||
};
|
||||
|
||||
union TMatrixIndexB
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned Tex4MtxIdx : 6;
|
||||
unsigned Tex5MtxIdx : 6;
|
||||
unsigned Tex6MtxIdx : 6;
|
||||
unsigned Tex7MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 24;
|
||||
u32 unused : 8;
|
||||
};
|
||||
};
|
||||
|
||||
struct Viewport
|
||||
{
|
||||
float wd;
|
||||
float ht;
|
||||
float nearZ;
|
||||
float xOrig;
|
||||
float yOrig;
|
||||
float farZ;
|
||||
};
|
||||
|
||||
extern XFRegisters xfregs;
|
||||
extern u32 xfmem[XFMEM_SIZE];
|
||||
|
||||
#endif
|
||||
@@ -405,6 +405,22 @@
|
||||
RelativePath=".\Src\CPMemory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\LookUpTables.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\LookUpTables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\XFMemory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\XFMemory.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
||||
@@ -3,39 +3,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "CPMemory.h"
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Matrix indices
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
union TMatrixIndexA
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned PosNormalMtxIdx : 6;
|
||||
unsigned Tex0MtxIdx : 6;
|
||||
unsigned Tex1MtxIdx : 6;
|
||||
unsigned Tex2MtxIdx : 6;
|
||||
unsigned Tex3MtxIdx : 6;
|
||||
};
|
||||
};
|
||||
|
||||
union TMatrixIndexB
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned Tex4MtxIdx : 6;
|
||||
unsigned Tex5MtxIdx : 6;
|
||||
unsigned Tex6MtxIdx : 6;
|
||||
unsigned Tex7MtxIdx : 6;
|
||||
};
|
||||
};
|
||||
|
||||
#pragma pack ()
|
||||
#include "XFMemory.h"
|
||||
|
||||
extern TMatrixIndexA MatrixIndexA;
|
||||
extern TMatrixIndexB MatrixIndexB;
|
||||
|
||||
@@ -248,7 +248,7 @@ tevhash GetCurrentTEV()
|
||||
{
|
||||
hash = _rotl(hash,3) ^ (bpmem.combiners[i].colorC.hex*13);
|
||||
hash = _rotl(hash,7) ^ ((bpmem.combiners[i].alphaC.hex&0xFFFFFFFC)*3);
|
||||
hash = _rotl(hash,9) ^ texcoords[i].texmtxinfo.projection*451;
|
||||
hash = _rotl(hash,9) ^ xfregs.texcoords[i].texmtxinfo.projection*451;
|
||||
}
|
||||
for (int i = 0; i < (int)bpmem.genMode.numtevstages/2+1; i++)
|
||||
{
|
||||
@@ -369,7 +369,7 @@ void WriteStage(char *&p, int n)
|
||||
char *rasswap = swapModeTable[bpmem.combiners[n].alphaC.rswap];
|
||||
char *texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap];
|
||||
|
||||
int texfun = texcoords[n].texmtxinfo.projection;
|
||||
int texfun = xfregs.texcoords[n].texmtxinfo.projection;
|
||||
|
||||
WRITE(p,"rastemp=%s.%s;\n",tevRasTable[bpmem.tevorders[n/2].getColorChan(n&1)],rasswap);
|
||||
if (bpmem.tevorders[n/2].getEnable(n&1))
|
||||
|
||||
@@ -27,16 +27,29 @@ enum TextureFormat
|
||||
GX_TF_C14X2 = 0xA,
|
||||
GX_TF_CMPR = 0xE,
|
||||
|
||||
_GX_TF_CTF = 0x20, /* copy-texture-format only */
|
||||
_GX_TF_ZTF = 0x10, /* Z-texture-format */
|
||||
_GX_TF_CTF = 0x20, // copy-texture-format only (simply means linear?)
|
||||
_GX_TF_ZTF = 0x10, // Z-texture-format
|
||||
|
||||
GX_TF_Z8 = 0x1 | _GX_TF_ZTF,
|
||||
// these formats are also valid when copying targets
|
||||
GX_CTF_R4 = 0x0 | _GX_TF_CTF,
|
||||
GX_CTF_RA4 = 0x2 | _GX_TF_CTF,
|
||||
GX_CTF_RA8 = 0x3 | _GX_TF_CTF,
|
||||
GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF,
|
||||
GX_CTF_A8 = 0x7 | _GX_TF_CTF,
|
||||
GX_CTF_R8 = 0x8 | _GX_TF_CTF,
|
||||
GX_CTF_G8 = 0x9 | _GX_TF_CTF,
|
||||
GX_CTF_B8 = 0xA | _GX_TF_CTF,
|
||||
GX_CTF_RG8 = 0xB | _GX_TF_CTF,
|
||||
GX_CTF_GB8 = 0xC | _GX_TF_CTF,
|
||||
|
||||
GX_TF_Z8 = 0x1 | _GX_TF_ZTF,
|
||||
GX_TF_Z16 = 0x3 | _GX_TF_ZTF,
|
||||
GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF,
|
||||
|
||||
//and the strange copy texture formats..
|
||||
|
||||
|
||||
GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
};
|
||||
|
||||
int TexDecoder_GetTexelSizeInNibbles(int format);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Common.h"
|
||||
#include "Globals.h"
|
||||
#include "Vec3.h"
|
||||
#include "TransformEngine.h"
|
||||
#include "VertexHandler.h"
|
||||
#include "VertexLoader.h"
|
||||
@@ -34,7 +35,7 @@ float DoLighting(const Light *light, const LitChannel &chan, const Vec3 &pos, co
|
||||
float val;
|
||||
if (chan.attnfunc == 0 || chan.attnfunc == 2) //no attn
|
||||
{
|
||||
Vec3 ldir = (light->dpos-pos);
|
||||
Vec3 ldir = (Vec3(light->dpos) - pos);
|
||||
val = ldir.normalized() * normal;
|
||||
}
|
||||
else
|
||||
@@ -44,17 +45,17 @@ float DoLighting(const Light *light, const LitChannel &chan, const Vec3 &pos, co
|
||||
float mul = 1.0f;
|
||||
if (chan.attnfunc == 3)
|
||||
{
|
||||
Vec3 ldir = (light->dpos - pos);
|
||||
Vec3 ldir = (Vec3(light->dpos) - pos);
|
||||
d = ldir.length();
|
||||
Vec3 ldirNorm = ldir / d; //normalize
|
||||
float l = ldirNorm * normal;
|
||||
aattn = light->ddir * ldirNorm;
|
||||
aattn = Vec3(light->ddir) * ldirNorm;
|
||||
mul = l;
|
||||
}
|
||||
else if (chan.attnfunc == 1)
|
||||
{
|
||||
d = aattn = light->shalfangle * normal;
|
||||
mul = (light->sdir * normal > 0) ? (normal * light->shalfangle) : 0;
|
||||
d = aattn = Vec3(light->shalfangle) * normal;
|
||||
mul = (Vec3(light->sdir) * normal > 0) ? (normal * Vec3(light->shalfangle)) : 0;
|
||||
if (mul < 0)
|
||||
mul = 0;
|
||||
}
|
||||
@@ -167,14 +168,14 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//find all used lights
|
||||
u32 lightMask =
|
||||
colChans[0].color.GetFullLightMask() | colChans[0].alpha.GetFullLightMask() |
|
||||
colChans[1].color.GetFullLightMask() | colChans[1].alpha.GetFullLightMask();
|
||||
xfregs.colChans[0].color.GetFullLightMask() | xfregs.colChans[0].alpha.GetFullLightMask() |
|
||||
xfregs.colChans[1].color.GetFullLightMask() | xfregs.colChans[1].alpha.GetFullLightMask();
|
||||
|
||||
float r0=0,g0=0,b0=0,a0=0;
|
||||
|
||||
//go through them and compute the lit colors
|
||||
//Sum lighting for both two color channels if they're active
|
||||
for (int j=0; j<(int)bpmem.genMode.numcolchans; j++)
|
||||
for (int j = 0; j < (int)bpmem.genMode.numcolchans; j++)
|
||||
{
|
||||
RGBAFloat material;
|
||||
RGBAFloat lightSum(0,0,0,0);
|
||||
@@ -182,8 +183,8 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
bool hasColorJ = (varray->GetComponents() & (VB_HAS_COL0 << j)) != 0;
|
||||
|
||||
//get basic material color from appropriate sources (this would compile nicely!:)
|
||||
if (colChans[j].color.matsource==GX_SRC_REG)
|
||||
material.convertRGB_GC(colChans[j].matColor);
|
||||
if (xfregs.colChans[j].color.matsource == GX_SRC_REG)
|
||||
material.convertRGB_GC(xfregs.colChans[j].matColor);
|
||||
else
|
||||
{
|
||||
if (hasColorJ)
|
||||
@@ -192,8 +193,8 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
material.r=material.g=material.b=1.0f;
|
||||
}
|
||||
|
||||
if (colChans[j].alpha.matsource==GX_SRC_REG)
|
||||
material.convertA_GC(colChans[j].matColor);
|
||||
if (xfregs.colChans[j].alpha.matsource == GX_SRC_REG)
|
||||
material.convertA_GC(xfregs.colChans[j].matColor);
|
||||
else
|
||||
{
|
||||
if (hasColorJ)
|
||||
@@ -203,11 +204,11 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
}
|
||||
|
||||
//combine together the light values from the lights that affect the color
|
||||
if (colChans[j].color.enablelighting)
|
||||
if (xfregs.colChans[j].color.enablelighting)
|
||||
{
|
||||
//choose ambient source and start our lightsum accumulator with its value..
|
||||
if (colChans[j].color.ambsource == GX_SRC_REG)
|
||||
lightSum.convertRGB_GC(colChans[j].ambColor); //ambient
|
||||
if (xfregs.colChans[j].color.ambsource == GX_SRC_REG)
|
||||
lightSum.convertRGB_GC(xfregs.colChans[j].ambColor); //ambient
|
||||
else
|
||||
{
|
||||
if (hasColorJ)
|
||||
@@ -219,12 +220,12 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
}
|
||||
|
||||
//accumulate light colors
|
||||
int cmask = colChans[j].color.GetFullLightMask();
|
||||
int cmask = xfregs.colChans[j].color.GetFullLightMask();
|
||||
for (int l=0; l<8; l++)
|
||||
{
|
||||
if (cmask&1)
|
||||
{
|
||||
float val = DoLighting(GetLight(l), colChans[j].color, TempPos, TempNormal);
|
||||
float val = DoLighting(GetLight(l), xfregs.colChans[j].color, TempPos, TempNormal);
|
||||
float r = lightColors[l].r * val;
|
||||
float g = lightColors[l].g * val;
|
||||
float b = lightColors[l].b * val;
|
||||
@@ -237,15 +238,15 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
}
|
||||
else
|
||||
{
|
||||
lightSum.r=lightSum.g=lightSum.b=1.0f;
|
||||
lightSum.r = lightSum.g = lightSum.b = 1.0f;
|
||||
}
|
||||
|
||||
//combine together the light values from the lights that affect alpha (should be rare)
|
||||
if (colChans[j].alpha.enablelighting)
|
||||
if (xfregs.colChans[j].alpha.enablelighting)
|
||||
{
|
||||
//choose ambient source..
|
||||
if (colChans[j].alpha.ambsource==GX_SRC_REG)
|
||||
lightSum.convertA_GC(colChans[j].ambColor);
|
||||
if (xfregs.colChans[j].alpha.ambsource==GX_SRC_REG)
|
||||
lightSum.convertA_GC(xfregs.colChans[j].ambColor);
|
||||
else
|
||||
{
|
||||
if (hasColorJ)
|
||||
@@ -254,12 +255,12 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
lightSum.a=0.0f;
|
||||
}
|
||||
//accumulate light alphas
|
||||
int amask = colChans[j].alpha.GetFullLightMask();
|
||||
for (int l=0; l<8; l++)
|
||||
int amask = xfregs.colChans[j].alpha.GetFullLightMask();
|
||||
for (int l = 0; l < 8; l++)
|
||||
{
|
||||
if (amask&1)
|
||||
{
|
||||
float val = DoLighting(GetLight(l),colChans[j].alpha,TempPos,TempNormal);
|
||||
float val = DoLighting(GetLight(l), xfregs.colChans[j].alpha, TempPos, TempNormal);
|
||||
float a = lightColors[l].a * val;
|
||||
lightSum.a += a;
|
||||
}
|
||||
@@ -279,21 +280,21 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
//Step 3: Generate texture coordinates!
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Vec3 TempUVs[8];
|
||||
for (int j=0; j<miscxf.numTexGens; j++)
|
||||
for (int j = 0; j < xfregs.numTexGens; j++)
|
||||
{
|
||||
int n = bpmem.tevorders[j/2].getTexCoord(j&1); // <- yazor: dirty zelda patch ^^
|
||||
int n = bpmem.tevorders[j / 2].getTexCoord(j & 1); // <- yazor: dirty zelda patch ^^
|
||||
n = j;
|
||||
Vec3 t;
|
||||
|
||||
switch(texcoords[n].texmtxinfo.sourcerow) {
|
||||
case XF_GEOM_INROW: t = OrigPos; break; //HACK WTFF???
|
||||
case XF_NORMAL_INROW: t = OrigNormal; break;
|
||||
case XF_COLORS_INROW: break; //set uvs to something?
|
||||
case XF_BINORMAL_T_INROW: t=Vec3(0,0,0);break;
|
||||
case XF_BINORMAL_B_INROW: t=Vec3(0,0,0);break;
|
||||
switch (xfregs.texcoords[n].texmtxinfo.sourcerow) {
|
||||
case XF_SRCGEOM_INROW: t = OrigPos; break; //HACK WTFF???
|
||||
case XF_SRCNORMAL_INROW: t = OrigNormal; break;
|
||||
case XF_SRCCOLORS_INROW: break; //set uvs to something?
|
||||
case XF_SRCBINORMAL_T_INROW: t=Vec3(0,0,0);break;
|
||||
case XF_SRCBINORMAL_B_INROW: t=Vec3(0,0,0);break;
|
||||
default:
|
||||
{
|
||||
int c = texcoords[n].texmtxinfo.sourcerow - XF_TEX0_INROW;
|
||||
int c = xfregs.texcoords[n].texmtxinfo.sourcerow - XF_SRCTEX0_INROW;
|
||||
bool hasTCC = (varray->GetComponents() & (VB_HAS_UV0 << c)) != 0;
|
||||
if (c >= 0 && c <= 7 && hasTCC)
|
||||
{
|
||||
@@ -304,26 +305,26 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
}
|
||||
|
||||
Vec3 out,out2;
|
||||
switch (texcoords[n].texmtxinfo.texgentype)
|
||||
switch (xfregs.texcoords[n].texmtxinfo.texgentype)
|
||||
{
|
||||
case XF_TEXGEN_COLOR_STRGBC0:
|
||||
out=Vec3(chans[0].r*255, chans[0].g*255, 1)/255.0f;
|
||||
out = Vec3(chans[0].r*255, chans[0].g*255, 1)/255.0f;
|
||||
break;
|
||||
case XF_TEXGEN_COLOR_STRGBC1:
|
||||
out=Vec3(chans[1].r*255, chans[1].g*255, 1)/255.0f; //FIX: take color1 instead
|
||||
out = Vec3(chans[1].r*255, chans[1].g*255, 1)/255.0f; //FIX: take color1 instead
|
||||
break;
|
||||
case XF_TEXGEN_REGULAR:
|
||||
if (texcoords[n].texmtxinfo.projection)
|
||||
if (xfregs.texcoords[n].texmtxinfo.projection)
|
||||
VtxMulMtx43(out, t, m_pTexMatrix[n]);
|
||||
else
|
||||
VtxMulMtx42(out, t, m_pTexMatrix[n]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (texcoords[n].postmtxinfo.normalize)
|
||||
if (xfregs.texcoords[n].postmtxinfo.normalize)
|
||||
out.normalize();
|
||||
|
||||
int postMatrix = texcoords[n].postmtxinfo.index;
|
||||
int postMatrix = xfregs.texcoords[n].postmtxinfo.index;
|
||||
float *pmtx = ((float*)xfmem) + 0x500 + postMatrix * 4; //CHECK
|
||||
//multiply with postmatrix
|
||||
VtxMulMtx43(TempUVs[j], out, pmtx);
|
||||
@@ -332,12 +333,12 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//Step 4: Output the vertex!
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
for (int j=0; j<2; j++)
|
||||
for (int j = 0; j < 2; j++)
|
||||
chans[j].convertToD3DColor(vbuffer[i].colors[j]);
|
||||
|
||||
vbuffer[i].pos = TempPos;
|
||||
vbuffer[i].normal = TempNormal;
|
||||
for (int j=0; j<(int)bpmem.genMode.numtexgens; j++)
|
||||
for (int j = 0; j < (int)bpmem.genMode.numtexgens; j++)
|
||||
{
|
||||
vbuffer[i].uv[j].u = TempUVs[j].x;
|
||||
vbuffer[i].uv[j].v = TempUVs[j].y;
|
||||
|
||||
@@ -3,18 +3,11 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "main.h"
|
||||
#include "LookUpTables.h"
|
||||
|
||||
extern int frameCount;
|
||||
extern int lut3to8[8];
|
||||
extern int lut4to8[16];
|
||||
extern int lut5to8[32];
|
||||
extern int lut6to8[64];
|
||||
extern float lutu8tosfloat[256];
|
||||
extern float lutu8toufloat[256];
|
||||
extern float luts8tosfloat[256];
|
||||
|
||||
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void InitLUTs();
|
||||
|
||||
//#define RAM_MASK 0x1FFFFFF
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ public:
|
||||
float x,y,z;
|
||||
Vec3() { }
|
||||
explicit Vec3(float f) {x=y=z=f;}
|
||||
explicit Vec3(const float *f) {x=f[0]; y=f[1]; z=f[2];}
|
||||
Vec3(const float _x, const float _y, const float _z) {
|
||||
x=_x; y=_y; z=_z;
|
||||
}
|
||||
|
||||
@@ -5,23 +5,13 @@
|
||||
#include "VertexHandler.h"
|
||||
#include "Utils.h"
|
||||
|
||||
|
||||
//XF state
|
||||
ColorChannel colChans[2]; //C0A0 C1A1
|
||||
TexCoordInfo texcoords[8];
|
||||
MiscXF miscxf;
|
||||
u32 xfmem[XFMEM_SIZE];
|
||||
|
||||
float rawViewPort[6];
|
||||
float rawProjection[7];
|
||||
|
||||
|
||||
|
||||
#define BEGINSAVELOAD char *optr=ptr;
|
||||
#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size);
|
||||
#define ENDSAVELOAD return ptr-optr;
|
||||
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// LoadXFReg 0x10
|
||||
//
|
||||
@@ -52,54 +42,54 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
|
||||
break;
|
||||
case 0x1009: //GXSetNumChans (no)
|
||||
break;
|
||||
case 0x100a: colChans[0].ambColor = data; break; //GXSetChanAmbientcolor
|
||||
case 0x100b: colChans[1].ambColor = data; break; //GXSetChanAmbientcolor
|
||||
case 0x100c: colChans[0].matColor = data; break; //GXSetChanMatcolor (rgba)
|
||||
case 0x100d: colChans[1].matColor = data; break; //GXSetChanMatcolor (rgba)
|
||||
case 0x100a: xfregs.colChans[0].ambColor = data; break; //GXSetChanAmbientcolor
|
||||
case 0x100b: xfregs.colChans[1].ambColor = data; break; //GXSetChanAmbientcolor
|
||||
case 0x100c: xfregs.colChans[0].matColor = data; break; //GXSetChanMatcolor (rgba)
|
||||
case 0x100d: xfregs.colChans[1].matColor = data; break; //GXSetChanMatcolor (rgba)
|
||||
|
||||
case 0x100e: colChans[0].color.hex = data; break; //color0
|
||||
case 0x100f: colChans[1].color.hex = data; break; //color1
|
||||
case 0x1010: colChans[0].alpha.hex = data; break; //alpha0
|
||||
case 0x1011: colChans[1].alpha.hex = data; break; //alpha1
|
||||
case 0x100e: xfregs.colChans[0].color.hex = data; break; //color0
|
||||
case 0x100f: xfregs.colChans[1].color.hex = data; break; //color1
|
||||
case 0x1010: xfregs.colChans[0].alpha.hex = data; break; //alpha0
|
||||
case 0x1011: xfregs.colChans[1].alpha.hex = data; break; //alpha1
|
||||
|
||||
case 0x1018:
|
||||
break;
|
||||
|
||||
case 0x101a:
|
||||
CVertexHandler::Flush();
|
||||
memcpy(rawViewPort,&pData[i],sizeof(rawViewPort));
|
||||
memcpy(rawViewPort, &pData[i], sizeof(rawViewPort));
|
||||
XFUpdateVP();
|
||||
i += 6;
|
||||
break;
|
||||
|
||||
case 0x1020:
|
||||
CVertexHandler::Flush();
|
||||
memcpy(rawProjection,&pData[i],sizeof(rawProjection));
|
||||
memcpy(rawProjection, &pData[i], sizeof(rawProjection));
|
||||
XFUpdatePJ();
|
||||
i += 7;
|
||||
return;
|
||||
|
||||
case 0x103f:
|
||||
miscxf.numTexGens = data;
|
||||
xfregs.numTexGens = data;
|
||||
break;
|
||||
|
||||
case 0x1040: texcoords[0].texmtxinfo.hex = data; break;
|
||||
case 0x1041: texcoords[1].texmtxinfo.hex = data; break;
|
||||
case 0x1042: texcoords[2].texmtxinfo.hex = data; break;
|
||||
case 0x1043: texcoords[3].texmtxinfo.hex = data; break;
|
||||
case 0x1044: texcoords[4].texmtxinfo.hex = data; break;
|
||||
case 0x1045: texcoords[5].texmtxinfo.hex = data; break;
|
||||
case 0x1046: texcoords[6].texmtxinfo.hex = data; break;
|
||||
case 0x1047: texcoords[7].texmtxinfo.hex = data; break;
|
||||
case 0x1040: xfregs.texcoords[0].texmtxinfo.hex = data; break;
|
||||
case 0x1041: xfregs.texcoords[1].texmtxinfo.hex = data; break;
|
||||
case 0x1042: xfregs.texcoords[2].texmtxinfo.hex = data; break;
|
||||
case 0x1043: xfregs.texcoords[3].texmtxinfo.hex = data; break;
|
||||
case 0x1044: xfregs.texcoords[4].texmtxinfo.hex = data; break;
|
||||
case 0x1045: xfregs.texcoords[5].texmtxinfo.hex = data; break;
|
||||
case 0x1046: xfregs.texcoords[6].texmtxinfo.hex = data; break;
|
||||
case 0x1047: xfregs.texcoords[7].texmtxinfo.hex = data; break;
|
||||
|
||||
case 0x1050: texcoords[0].postmtxinfo.hex = data; break;
|
||||
case 0x1051: texcoords[1].postmtxinfo.hex = data; break;
|
||||
case 0x1052: texcoords[2].postmtxinfo.hex = data; break;
|
||||
case 0x1053: texcoords[3].postmtxinfo.hex = data; break;
|
||||
case 0x1054: texcoords[4].postmtxinfo.hex = data; break;
|
||||
case 0x1055: texcoords[5].postmtxinfo.hex = data; break;
|
||||
case 0x1056: texcoords[6].postmtxinfo.hex = data; break;
|
||||
case 0x1057: texcoords[7].postmtxinfo.hex = data; break;
|
||||
case 0x1050: xfregs.texcoords[0].postmtxinfo.hex = data; break;
|
||||
case 0x1051: xfregs.texcoords[1].postmtxinfo.hex = data; break;
|
||||
case 0x1052: xfregs.texcoords[2].postmtxinfo.hex = data; break;
|
||||
case 0x1053: xfregs.texcoords[3].postmtxinfo.hex = data; break;
|
||||
case 0x1054: xfregs.texcoords[4].postmtxinfo.hex = data; break;
|
||||
case 0x1055: xfregs.texcoords[5].postmtxinfo.hex = data; break;
|
||||
case 0x1056: xfregs.texcoords[6].postmtxinfo.hex = data; break;
|
||||
case 0x1057: xfregs.texcoords[7].postmtxinfo.hex = data; break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -118,9 +108,9 @@ void LoadIndexedXF(u32 val, int array)
|
||||
{
|
||||
DVSTARTPROFILE();
|
||||
|
||||
int index = val>>16;
|
||||
int address = val&0xFFF; //check mask
|
||||
int size = ((val>>12)&0xF)+1;
|
||||
int index = val >> 16;
|
||||
int address = val & 0xFFF; //check mask
|
||||
int size = ((val >> 12) & 0xF)+1;
|
||||
//load stuff from array to address in xf mem
|
||||
for (int i = 0; i < size; i++)
|
||||
xfmem[address + i] = Memory_Read_U32(arraybases[array] + arraystrides[array]*index + i*4);
|
||||
@@ -138,9 +128,8 @@ void XFUpdatePJ()
|
||||
size_t XFSaveLoadState(char *ptr, BOOL save)
|
||||
{
|
||||
BEGINSAVELOAD;
|
||||
SAVELOAD(colChans,2*sizeof(ColorChannel));
|
||||
SAVELOAD(texcoords,16*sizeof(TexCoordInfo));
|
||||
SAVELOAD(&miscxf,sizeof(MiscXF));
|
||||
SAVELOAD(xfregs.colChans,2*sizeof(ColorChannel));
|
||||
SAVELOAD(xfregs.texcoords,16*sizeof(TexCoordInfo));
|
||||
SAVELOAD(rawViewPort,sizeof(rawViewPort));
|
||||
SAVELOAD(rawProjection,sizeof(rawProjection));
|
||||
SAVELOAD(xfmem,XFMEM_SIZE*sizeof(u32));
|
||||
|
||||
@@ -3,153 +3,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Vec3.h"
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Lighting
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#define XF_TEX_ST 0x00000000
|
||||
#define XF_TEX_STQ 0x00000001
|
||||
|
||||
#define XF_TEX_AB11 0x00000000
|
||||
#define XF_TEX_ABC1 0x00000001
|
||||
|
||||
#define XF_TEXGEN_REGULAR 0x00000000
|
||||
#define XF_TEXGEN_EMBOSS_MAP 0x00000001
|
||||
#define XF_TEXGEN_COLOR_STRGBC0 0x00000002
|
||||
#define XF_TEXGEN_COLOR_STRGBC1 0x00000003
|
||||
|
||||
#define XF_GEOM_INROW 0x00000000
|
||||
#define XF_NORMAL_INROW 0x00000001
|
||||
#define XF_COLORS_INROW 0x00000002
|
||||
#define XF_BINORMAL_T_INROW 0x00000003
|
||||
#define XF_BINORMAL_B_INROW 0x00000004
|
||||
#define XF_TEX0_INROW 0x00000005
|
||||
#define XF_TEX1_INROW 0x00000006
|
||||
#define XF_TEX2_INROW 0x00000007
|
||||
#define XF_TEX3_INROW 0x00000008
|
||||
#define XF_TEX4_INROW 0x00000009
|
||||
#define XF_TEX5_INROW 0x0000000a
|
||||
#define XF_TEX6_INROW 0x0000000b
|
||||
#define XF_TEX7_INROW 0x0000000c
|
||||
|
||||
struct Light
|
||||
{
|
||||
u32 useless[3];
|
||||
//Vec3 direction;
|
||||
u32 color; //rgba
|
||||
float a0; //attenuation
|
||||
float a1;
|
||||
float a2;
|
||||
float k0; //k stuff
|
||||
float k1;
|
||||
float k2;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
Vec3 dpos;
|
||||
Vec3 ddir;
|
||||
};
|
||||
struct {
|
||||
Vec3 sdir;
|
||||
Vec3 shalfangle;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#define GX_SRC_REG 0
|
||||
#define GX_SRC_VTX 1
|
||||
|
||||
union LitChannel
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned matsource : 1;
|
||||
unsigned enablelighting : 1;
|
||||
unsigned lightMask0_3 : 4;
|
||||
unsigned ambsource : 1;
|
||||
unsigned diffusefunc : 2; //0=none 1=sign 2=clamp
|
||||
unsigned attnfunc : 2; //1=spec 3=spot 2=none ???
|
||||
unsigned lightMask4_7 : 4;
|
||||
};
|
||||
u32 hex;
|
||||
unsigned int GetFullLightMask()
|
||||
{
|
||||
return lightMask0_3 | (lightMask4_7 << 4);
|
||||
}
|
||||
};
|
||||
|
||||
struct ColorChannel
|
||||
{
|
||||
u32 ambColor;
|
||||
u32 matColor;
|
||||
LitChannel color;
|
||||
LitChannel alpha;
|
||||
};
|
||||
|
||||
struct MiscXF
|
||||
{
|
||||
int numTexGens;
|
||||
};
|
||||
|
||||
union TexMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned unknown : 1;
|
||||
unsigned projection : 1;
|
||||
unsigned inputform : 2; //1 if three-component, 0 if two-component ?
|
||||
unsigned texgentype : 3; //0-POS 1-NRM 3-BINRM 4-TANGENT 5-TEX0 ...12-TEX7 13-COLOR
|
||||
unsigned sourcerow : 5;
|
||||
unsigned embosssourceshift : 3;
|
||||
unsigned embosslightshift : 3;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union PostMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned index : 8;
|
||||
unsigned normalize : 1;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
struct TexCoordInfo
|
||||
{
|
||||
TexMtxInfo texmtxinfo;
|
||||
PostMtxInfo postmtxinfo;
|
||||
};
|
||||
|
||||
struct Viewport
|
||||
{
|
||||
float wd;
|
||||
float ht;
|
||||
float nearZ;
|
||||
float xOrig;
|
||||
float yOrig;
|
||||
float farZ;
|
||||
};
|
||||
|
||||
#define XFMEM_SIZE 0x8000
|
||||
#define XFMEM_POSMATRICES 0x000
|
||||
#define XFMEM_POSMATRICES_END 0x100
|
||||
#define XFMEM_NORMALMATRICES 0x400
|
||||
#define XFMEM_NORMALMATRICES_END 0x460
|
||||
#define XFMEM_POSTMATRICES 0x500
|
||||
#define XFMEM_POSTMATRICES_END 0x600
|
||||
#define XFMEM_LIGHTS 0x600
|
||||
#define XFMEM_LIGHTS_END 0x680
|
||||
|
||||
|
||||
extern TexCoordInfo texcoords[8];
|
||||
extern ColorChannel colChans[2]; //C0A0 C1A1
|
||||
extern MiscXF miscxf;
|
||||
|
||||
extern unsigned __int32 xfmem[XFMEM_SIZE];
|
||||
#include "XFMemory.h"
|
||||
|
||||
extern float rawViewPort[6];
|
||||
extern float rawProjection[7];
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "VertexLoader.h"
|
||||
|
||||
#include "BPStructs.h"
|
||||
#include "Render.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "TextureMngr.h"
|
||||
#include "TextureDecoder.h"
|
||||
|
||||
@@ -24,13 +24,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
int frameCount;
|
||||
int lut3to8[8];
|
||||
int lut4to8[16];
|
||||
int lut5to8[32];
|
||||
int lut6to8[64];
|
||||
float lutu8tosfloat[256];
|
||||
float lutu8toufloat[256];
|
||||
float luts8tosfloat[256];
|
||||
|
||||
int g_Res[NUMWNDRES][2] =
|
||||
{
|
||||
@@ -50,25 +43,6 @@ void Statistics::ResetFrame()
|
||||
memset(&thisFrame,0,sizeof(ThisFrame));
|
||||
}
|
||||
|
||||
void InitLUTs()
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<8; i++)
|
||||
lut3to8[i] = (i*255)/7;
|
||||
for (i=0; i<16; i++)
|
||||
lut4to8[i] = (i*255)/15;
|
||||
for (i=0; i<32; i++)
|
||||
lut5to8[i] = (i*255)/31;
|
||||
for (i=0; i<64; i++)
|
||||
lut6to8[i] = (i*255)/63;
|
||||
for (i=0; i<256; i++)
|
||||
{
|
||||
lutu8tosfloat[i] = (float)(i-128)/127.0f;
|
||||
lutu8toufloat[i] = (float)(i)/255.0f;
|
||||
luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f;
|
||||
}
|
||||
}
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
memset(this, 0, sizeof(Config));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user