Delete various unused files.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5909 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2010-07-18 16:15:43 +00:00
parent 378d3aaa52
commit a2e39a84f3
13 changed files with 0 additions and 2079 deletions

Binary file not shown.

Binary file not shown.

View File

@ -893,10 +893,6 @@
RelativePath=".\Src\stdafx.h"
>
</File>
<File
RelativePath=".\Src\Vec3.h"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -1,75 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <stdio.h>
#include "CPStructs.h"
#include "XFStructs.h"
#include "VertexManager.h"
#include "VertexLoader.h"
// PROBLEM - matrix switching within vbuffers may be stateful!
void CPUpdateMatricesA()
{
const float *flipmem = (const float *)xfmem;
CTransformEngine::SetPosNormalMatrix(
flipmem + MatrixIndexA.PosNormalMtxIdx * 4, //CHECK
flipmem + 0x400 + 3 * (MatrixIndexA.PosNormalMtxIdx & 31)); //CHECK
CTransformEngine::SetTexMatrix(0,flipmem + MatrixIndexA.Tex0MtxIdx * 4);
CTransformEngine::SetTexMatrix(1,flipmem + MatrixIndexA.Tex1MtxIdx * 4);
CTransformEngine::SetTexMatrix(2,flipmem + MatrixIndexA.Tex2MtxIdx * 4);
CTransformEngine::SetTexMatrix(3,flipmem + MatrixIndexA.Tex3MtxIdx * 4);
}
void CPUpdateMatricesB()
{
float *flipmem = (float *)xfmem;
CTransformEngine::SetTexMatrix(4,flipmem + MatrixIndexB.Tex4MtxIdx * 4);
CTransformEngine::SetTexMatrix(5,flipmem + MatrixIndexB.Tex5MtxIdx * 4);
CTransformEngine::SetTexMatrix(6,flipmem + MatrixIndexB.Tex6MtxIdx * 4);
CTransformEngine::SetTexMatrix(7,flipmem + MatrixIndexB.Tex7MtxIdx * 4);
}
void LoadCPReg(u32 SubCmd, u32 Value)
{
switch (SubCmd & 0xF0)
{
case 0x30:
MatrixIndexA.Hex = Value;
CPUpdateMatricesA();
break;
case 0x40:
MatrixIndexB.Hex = Value;
CPUpdateMatricesB();
break;
case 0x50:
VertexManager::Flush(); VertexLoader::SetVtxDesc_Lo(Value);
break;
case 0x60:
VertexManager::Flush(); VertexLoader::SetVtxDesc_Hi(Value);
break;
case 0x70: g_VertexLoaders[SubCmd & 7].SetVAT_group0(Value); _assert_((SubCmd & 0x0F) < 8); break;
case 0x80: g_VertexLoaders[SubCmd & 7].SetVAT_group1(Value); _assert_((SubCmd & 0x0F) < 8); break;
case 0x90: g_VertexLoaders[SubCmd & 7].SetVAT_group2(Value); _assert_((SubCmd & 0x0F) < 8); break;
case 0xA0: arraybases[SubCmd & 0xF] = Value & 0xFFFFFFFF; break;
case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break;
}
}

View File

@ -1,29 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CPSTRUCTS_H
#define _CPSTRUCTS_H
#include "Common.h"
#include "CPMemory.h"
#include "XFMemory.h"
void CPUpdateMatricesA();
void CPUpdateMatricesB();
void LoadCPReg(u32 SubCmd, u32 Value);
#endif

View File

@ -1,468 +0,0 @@
#include "stdafx.h"
#if 0
#include "OpcodeDecoding.h"
#include "VertexLoader.h"
#include "VertexHandler.h"
#include "DataReader.h"
#include "BPStructs.h"
#include "CPStructs.h"
#include "XFStructs.h"
#include "DLCompiler.h"
#include "x86.h"
#include "main.h"
#include "Utils.h"
CompiledDList::CompiledDList(u32 _addr, u32 _size)
{
dataSize = 0;
data = 0;
code = 0;
addr = _addr;
size = _size;
pass = 0;
numBatches = 0;
batches = 0;
}
CompiledDList::~CompiledDList()
{
if (data)
delete [] data;
if (code)
delete [] code;
if (batches)
delete [] batches;
}
bool CompiledDList::Call()
{
switch(pass) {
case 0: // First compiling pass : find data size
if (Pass1())
{
pass = 1;
return true;
}
else
return false;
case 1: // Second compiling pass : actually compile
//if pass1 succeeded, pass2 will too
Pass2();
pass = 2;
return true;
case 2: // Run pass - we have a compiled dlist, just call it
Run();
return true;
default:
//ERROR
return false;
}
}
bool CompiledDList::Pass1()
{
/* //find the size of code + data, if the dlist is worth recompiling etc
// at the same time, do the ordinary stuff
g_pDataReader = &dlistReader;
OpcodeReaders::SetDListReader(addr, addr+size);
dataSize = 0;
codeSize = 0;
numBatches = 0;
bool lastIsPrim = false;
while (OpcodeReaders::IsDListOKToRead())
{
int Cmd = g_pDataReader->Read8();
switch(Cmd)
{
case GX_LOAD_CP_REG: //0x08
{
u32 SubCmd = g_pDataReader->Read8();
u32 Value = g_pDataReader->Read32();
LoadCPReg(SubCmd,Value);
//COMPILER
codeSize+=13;
}
break;
case GX_LOAD_XF_REG:
{
u32 Cmd2 = g_pDataReader->Read32();
int dwTransferSize = ((Cmd2>>16)&15) + 1;
DWORD dwAddress = Cmd2 & 0xFFFF;
static u32 pData[16];
for (int i=0; i<dwTransferSize; i++)
pData[i] = g_pDataReader->Read32();
LoadXFReg(dwTransferSize,dwAddress,pData);
//COMPILER
dataSize+=dwTransferSize;
codeSize+=17;
}
break;
case GX_LOAD_BP_REG: //0x61
{
u32 cmd=g_pDataReader->Read32();
LoadBPReg(cmd);
codeSize+=9;
}
break;
case GX_LOAD_INDX_A: //used for position matrices
LoadIndexedXF(g_pDataReader->Read32(),0xC);
codeSize+=13;
break;
case GX_LOAD_INDX_B: //used for normal matrices
LoadIndexedXF(g_pDataReader->Read32(),0xD);
codeSize+=13;
break;
case GX_LOAD_INDX_C: //used for postmatrices
LoadIndexedXF(g_pDataReader->Read32(),0xE);
codeSize+=13;
break;
case GX_LOAD_INDX_D: //used for lights
LoadIndexedXF(g_pDataReader->Read32(),0xF);
codeSize+=13;
break;
case GX_CMD_CALL_DL:
MessageBox(0,"Display lists can't recurse!!","error",0);
break;
case GX_CMD_INVL_VC:// Invalidate (vertex cache?)
break;
case GX_NOP:
break;
default:
if (Cmd&0x80)
{
int primitive = (Cmd&GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT;
if (lastIsPrim)
{
//join to last
}
else
{
//finish up last and commit
}
u16 numVertices = g_pDataReader->Read16();
tempvarray.Reset();
VertexLoader::SetVArray(&tempvarray);
VertexLoader *loader = &VertexLoader[Cmd&GX_VAT_MASK];
loader->Setup();
loader->PrepareRun();
int vsize = loader->GetVertexSize();
loader->RunVertices(numVertices);
CVertexHandler::DrawVertices(primitive, numVertices, &tempvarray);
CVertexHandler::Flush();
//COMPILER
codeSize+=21;
numBatches++;
lastIsPrim = true;
}
break;
}
}
if (lastIsPrim)
{
//finish up last and commit
}
codeSize*=2;*/
return true;
}
void CompiledDList::Pass2()
{
/* OpcodeReaders::SetDListReader(addr, addr+size);
data = new u32[dataSize];
code = new u8[codeSize]; //at least
batches = new Batch[numBatches];
int batchCount = 0;
u32 *dataptr = data;
x86Init();
x86SetPtr((s8*)code);
//WC8(0xCC);
//actually do the recompiling, emit code and data, protect the memory
// but again, at the same time do the ordinary stuff
// so the compiled display list won't be run until the third time actually
bool dump = false,lastIsGeom=false;
FILE *f;
#ifndef TEASER
if (dump)
{
f=fopen("D:\\dlistlogs.txt","a");
fprintf(f,"===========================================\n");
}
#endif
while (OpcodeReaders::IsDListOKToRead())
{
int Cmd = g_pDataReader->Read8();
switch(Cmd)
{
case GX_LOAD_CP_REG: //0x08
{
lastIsGeom = false;
u32 SubCmd = g_pDataReader->Read8();
u32 Value = g_pDataReader->Read32();
if (dump)
fprintf(f,"CP | %02x %08x\n",SubCmd,Value);
LoadCPReg(SubCmd,Value);
//COMPILER
PUSH_WordToStack(Value);
PUSH_WordToStack(SubCmd);
CALLFunc((u32)LoadCPReg);
}
break;
case GX_LOAD_XF_REG:
{
lastIsGeom = false;
u32 Cmd2 = g_pDataReader->Read32();
int dwTransferSize = ((Cmd2>>16)&15) + 1;
u32 dwAddress = Cmd2 & 0xFFFF;
static u32 pData[16];
u32 *oldDataPtr = dataptr;
if (dump)
{
fprintf(f,"XF | %01xx %04x\n",dwTransferSize,dwAddress);
for (int i=0; i<dwTransferSize; i++)
fprintf(f, "%08x | %f\n",oldDataPtr[i], *((float*)oldDataPtr+i));
}
for (int i=0; i<dwTransferSize; i++) // a little compiler here too
*dataptr++ = g_pDataReader->Read32();
LoadXFReg(dwTransferSize,dwAddress,oldDataPtr);
//COMPILER
PUSH_WordToStack((u32)oldDataPtr);
PUSH_WordToStack(dwAddress);
PUSH_WordToStack(dwTransferSize);
CALLFunc((u32)LoadXFReg);
}
break;
case GX_LOAD_BP_REG: //0x61
{
lastIsGeom = false;
u32 cmd=g_pDataReader->Read32();
if (dump)
fprintf(f,"BP | %08x\n",cmd);
LoadBPReg(cmd);
//COMPILER
PUSH_WordToStack(cmd);
CALLFunc((u32)LoadBPReg);
}
break;
case GX_LOAD_INDX_A: //usually used for position matrices
{
lastIsGeom = false;
u32 value = g_pDataReader->Read32();
LoadIndexedXF(value,0xC);
//COMPILER
PUSH_WordToStack(0xC);
PUSH_WordToStack(value);
CALLFunc((u32)LoadIndexedXF);
if (dump)
fprintf(f,"LOADINDEXA | pos matrix\n");
}
break;
case GX_LOAD_INDX_B: //usually used for normal matrices
{
lastIsGeom = false;
u32 value = g_pDataReader->Read32();
LoadIndexedXF(value,0xD);
//COMPILER
PUSH_WordToStack(0xD);
PUSH_WordToStack(value);
CALLFunc((u32)LoadIndexedXF);
if (dump)
fprintf(f,"LOADINDEXB | nrm matrix\n");
}
break;
case GX_LOAD_INDX_C: //usually used for postmatrices
{
lastIsGeom = false;
u32 value = g_pDataReader->Read32();
LoadIndexedXF(value,0xE);
//COMPILER
PUSH_WordToStack(0xE);
PUSH_WordToStack(value);
CALLFunc((u32)LoadIndexedXF);
if (dump)
fprintf(f,"LOADINDEXC | post matrix\n");
}
break;
case GX_LOAD_INDX_D: //usually used for lights
{
lastIsGeom = false;
u32 value = g_pDataReader->Read32();
LoadIndexedXF(value,0xF);
//COMPILER
PUSH_WordToStack(0xF);
PUSH_WordToStack(value);
CALLFunc((u32)LoadIndexedXF);
if (dump)
fprintf(f,"LOADINDEXD | light\n");
}
break;
case GX_CMD_CALL_DL:
// ERORRR
break;
case GX_CMD_INVL_VC:// Invalidate (vertex cache?)
if (dump)
fprintf(f,"invalidate vc\n");
break;
case GX_NOP:
if (dump)
fprintf(f,"nop\n");
break;
default:
if (Cmd&0x80)
{
int primitive = (Cmd&GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT;
//if (lastIsGeom) INCSTAT(stats.numJoins);
u16 numVertices = g_pDataReader->Read16();
if (dump)
fprintf(f,"DP: prim=%02x numv=%i\n",primitive,numVertices);
DecodedVArray &va = batches[batchCount].varray;
VertexLoader *loader = &VertexLoader[Cmd&GX_VAT_MASK];
TVtxDesc &vd = loader->GetVtxDesc();
VertexLoader::SetVArray(&va);
loader->Setup();
loader->PrepareRun();
// va.numColors = loader->GetNumColors();
// va.numUVs = loader->GetNumTCs();
// va.numNormals = loader->GetNumNormals();
//va.num
va.Create(numVertices,vd.PosMatIdx,
vd.Tex0MatIdx+vd.Tex1MatIdx+vd.Tex2MatIdx+vd.Tex3MatIdx+
vd.Tex4MatIdx+vd.Tex5MatIdx+vd.Tex6MatIdx+vd.Tex7MatIdx,
va.numNormals, va.numColors, va.numTCs);
int vsize = loader->GetVertexSize();
loader->RunVertices(numVertices);
CVertexHandler::DrawVertices(primitive, numVertices, &va);
CVertexHandler::Flush();
// YES we have now filled our varray
//LETS COMPILE
PUSH_WordToStack(primitive);
PUSH_WordToStack(batchCount);
PUSH_WordToStack((u32)this);
CALLFunc((u32)DrawHelperHelper);
batchCount++;
lastIsGeom = true;
if (dump)
fprintf(f,"DRAW PRIMITIVE: prim=%02x numv=%i\n",primitive,numVertices);
}
break;
}
}
if (dump)
{
fprintf(f,"***************************************\n\n\n");
}
RET();
if (dump)
fclose(f);*/
//we're done, next time just kick the compiled list off, much much faster than interpreting!
}
void CompiledDList::DrawHelperHelper(CompiledDList *dl, int vno, int prim)
{
Batch &b = dl->batches[vno];
CVertexHandler::DrawVertices(prim, b.varray.GetSize(), &b.varray);
}
void CompiledDList::Run()
{
//run the code
((void (*)())(code))();
CVertexHandler::Flush();
}
DListCache::DLCache DListCache::dlists;
void DListCache::Init()
{
}
void DListCache::Shutdown()
{
DLCache::iterator iter = dlists.begin();
for (;iter!=dlists.end();iter++)
iter->second.Destroy();
dlists.clear();
}
void DListCache::Call(u32 _addr, u32 _size)
{
DLCache::iterator iter;
iter = dlists.find(_addr);
if (iter != dlists.end())
{
if (iter->second.size == _size)
{
iter->second.dlist->Call();
return;
}
else // wrong size, need to recompile
{
iter->second.Destroy();
iter=dlists.erase(iter);
}
}
//Make an entry in the table
DLCacheEntry entry;
entry.dlist = new CompiledDList(_addr, _size);
entry.dlist->Call();
entry.frameCount = frameCount;
entry.size = _size;
dlists[_addr] = entry;
INCSTAT(stats.numDListsCreated);
SETSTAT(stats.numDListsAlive,(int)dlists.size());
}
void DListCache::Cleanup()
{
for (DLCache::iterator iter=dlists.begin(); iter!=dlists.end();iter++)
{
DLCacheEntry &entry = iter->second;
if (entry.frameCount<frameCount-80)
{
entry.Destroy();
iter = dlists.erase(iter);
}
}
SETSTAT(stats.numDListsAlive,(int)dlists.size());
}
#endif

View File

@ -1,72 +0,0 @@
#pragma once
#if 0
#include "D3DBase.h"
#include "DecodedVArray.h"
#include <map>
class CompiledDList
{
u32 *data;
int dataSize;
int pass;
int codeSize;
u8 *code;
struct Batch
{
DecodedVArray varray;
LPDIRECT3DINDEXBUFFER9 ibuffer;
int numDraws;
};
Batch *batches;
int numBatches;
u32 addr, size;
bool Compile();
bool Pass1();
void Pass2();
void Run();
public:
CompiledDList(u32 _addr, u32 _size);
~CompiledDList();
bool Call();
static void DrawHelperHelper(CompiledDList *dl, int vno, int prim);
};
class DListCache
{
struct DLCacheEntry
{
CompiledDList *dlist;
int frameCount;
int pass;
u32 size;
DLCacheEntry()
{
pass=0;
dlist=0;
frameCount=0;
}
void Destroy()
{
if (dlist)
delete dlist;
}
};
typedef std::map<DWORD,DLCacheEntry> DLCache;
static DLCache dlists;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void Call(u32 _addr, u32 _size);
};
#endif

View File

@ -1,84 +0,0 @@
#ifndef _RGBAFLOAT_H
#define _RGBAFLOAT_H
struct RGBAFloat
{
float r,g,b,a;
RGBAFloat(){a=r=g=b=1.0f;}
RGBAFloat(float _r, float _g, float _b, float _a)
{
r=_r;g=_g;b=_b;a=_a;
}
void clamp()
{
if (r>1) r=1;
if (g>1) g=1;
if (b>1) b=1;
if (a>1) a=1;
if (r<0) r=0;
if (g<0) g=0;
if (b<0) b=0;
if (a<0) a=0;
}
void convertToD3DColor(u32 &color)
{
clamp();
color = (int(a*255)<<24) | (int(r*255)<<16) | (int(g*255)<<8) | (int(b*255));
}
void convertRGB_GC(u32 color)
{
r=((color>>24)&0xFF)/255.0f;
g=((color>>16)&0xFF)/255.0f;
b=((color>>8)&0xFF)/255.0f;
}
void convertRGB(u32 color)
{
r=((color>>16)&0xFF)/255.0f;
g=((color>>8)&0xFF)/255.0f;
b=((color)&0xFF)/255.0f;
}
void convertA(u32 color)
{
a=((color>>24)&0xFF)/255.0f;
}
void convertA_GC(u32 color)
{
a=((color)&0xFF)/255.0f;
}
void convert(u32 color)
{
convertRGB(color);
convertA(color);
}
void convert_GC(u32 color)
{
convertRGB_GC(color);
convertA_GC(color);
}
void operator *=(float f)
{
r*=f;g*=f;b*=f; a*=f;
}
RGBAFloat operator *(float f)
{
return RGBAFloat(r*f,g*f,b*f,a*f);
}
RGBAFloat operator *(RGBAFloat &o)
{
return RGBAFloat(r*o.r,g*o.g,b*o.b,a*o.a);
}
void operator *=(RGBAFloat &o)
{
r*=o.r;g*=o.g;b*=o.b;a*=o.a;
}
RGBAFloat operator +(RGBAFloat &o)
{
return RGBAFloat(r+o.r,g+o.g,b+o.b,a+o.a);
}
void operator +=(RGBAFloat &o)
{
r+=o.r;g+=o.g;b+=o.b;a+=o.a;
}
};
#endif

View File

@ -1,116 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VEC3_H
#define _VEC3_H
#include <stdlib.h>
#include <math.h>
class Vec3
{
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;
}
void set(const float _x, const float _y, const float _z) {
x=_x; y=_y; z=_z;
}
Vec3 operator + (const Vec3 &other) const {
return Vec3(x+other.x, y+other.y, z+other.z);
}
void operator += (const Vec3 &other) {
x+=other.x; y+=other.y; z+=other.z;
}
Vec3 operator -(const Vec3 &v) const {
return Vec3(x-v.x,y-v.y,z-v.z);
}
void operator -= (const Vec3 &other)
{
x-=other.x; y-=other.y; z-=other.z;
}
Vec3 operator -() const {
return Vec3(-x,-y,-z);
}
Vec3 operator * (const float f) const {
return Vec3(x*f,y*f,z*f);
}
Vec3 operator / (const float f) const {
float invf = (1.0f/f);
return Vec3(x*invf,y*invf,z*invf);
}
void operator /= (const float f)
{
*this = *this / f;
}
float operator * (const Vec3 &other) const {
return x*other.x + y*other.y + z*other.z;
}
void operator *= (const float f) {
*this = *this * f;
}
Vec3 scaled_by(const Vec3 &other) const {
return Vec3(x*other.x, y*other.y, z*other.z);
}
Vec3 operator %(const Vec3 &v) const {
return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
}
float length2() const {
return x*x+y*y+z*z;
}
float length() const {
return sqrtf(length2());
}
float distance2_to(Vec3 &other)
{
return (other-(*this)).length2();
}
Vec3 normalized() const {
return (*this) / length();
}
void normalize() {
(*this) /= length();
}
float &operator [] (int i)
{
return *((&x) + i);
}
const float operator [] (const int i) const
{
return *((&x) + i);
}
bool operator == (const Vec3 &other) const
{
if (x==other.x && y==other.y && z==other.z)
return true;
else
return false;
}
void setZero()
{
memset((void *)this,0,sizeof(float)*3);
}
};
#endif

View File

@ -1,136 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "stdafx.h"
#include "Profiler.h"
#include "XFStructs.h"
#include "Render.h"
#include "main.h"
#include "VertexManager.h"
#include "Utils.h"
// LoadXFReg 0x10
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
{
DVSTARTPROFILE();
u32 address = baseAddress;
for (int i = 0; i < (int)transferSize; i++)
{
address = baseAddress + i;
// Setup a Matrix
if (address < 0x1000)
{
u32* p1 = &xfmem[address];
memcpy(p1, &pData[i], transferSize*4);
i += transferSize;
}
else if (address < 0x2000)
{
u32 data = pData[i];
switch (address)
{
case 0x1006:
//SetGPMetric
break;
case 0x1008: //__GXXfVtxSpecs, wrote 0004
break;
case 0x1009: //GXSetNumChans (no)
break;
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: 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:
VertexManager::Flush();
memcpy(xfregs.rawViewport, &pData[i], sizeof(xfregs.rawViewport));
XFUpdateVP();
i += 6;
break;
case 0x1020:
VertexManager::Flush();
memcpy(xfregs.rawProjection, &pData[i], sizeof(xfregs.rawProjection));
XFUpdatePJ();
i += 7;
return;
case 0x103f:
xfregs.numTexGens = 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: 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;
}
}
else if (address>=0x4000)
{
// MessageBox(NULL, "1", "1", MB_OK);
//4010 __GXSetGenMode
}
}
}
// Check docs for this sucker...
void LoadIndexedXF(u32 val, int array)
{
DVSTARTPROFILE();
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);
}
void XFUpdateVP()
{
Renderer::SetViewport(xfregs.rawViewport);
}
void XFUpdatePJ()
{
Renderer::SetProjection(xfregs.rawProjection, 0);
}

View File

@ -1,30 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _XFSTRUCTS_H
#define _XFSTRUCTS_H
#include "Common.h"
#include "Vec3.h"
#include "XFMemory.h"
void XFUpdateVP();
void XFUpdatePJ();
void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
void LoadIndexedXF(u32 val, int array);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
/* bmp_io.h 16 May 1999 */
#ifndef _BMP_IO_H
#define _BMP_IO_H
int bmp_read ( char *filein_name, int *xsize, int *ysize, int **rarray,
int **garray, int **barray );
int bmp_read_data ( FILE *filein, int xsize, int ysize, int *rarray,
int *garray, int *barray );
int bmp_read_header ( FILE *filein, int *xsize, int *ysize, int *psize );
int bmp_read_palette ( FILE *filein, int psize );
int bmp_read_test ( char *filein_name );
int bmp_write ( char *fileout_name, int xsize, int ysize, char* rgba );
int bmp_write_data ( FILE *fileout, int xsize, int ysize, char *rarray, char *garray, char *barray );
int bmp_write_header ( FILE *fileout, int xsize, int ysize );
int bmp_write_test ( char *fileout_name );
int read_u_long_int ( unsigned long int *u_long_int_val, FILE *filein );
int read_u_short_int ( unsigned short int *u_short_int_val, FILE *filein );
int write_u_long_int ( unsigned long int u_long_int_val, FILE *fileout );
int write_u_short_int ( unsigned short int u_short_int_val, FILE *fileout );
#endif