diff --git a/Externals/Cg64/cgD3D9.dll b/Externals/Cg64/cgD3D9.dll deleted file mode 100644 index 02422ebb10..0000000000 Binary files a/Externals/Cg64/cgD3D9.dll and /dev/null differ diff --git a/Externals/Cg64/cgD3D9.lib b/Externals/Cg64/cgD3D9.lib deleted file mode 100644 index 22e449351c..0000000000 Binary files a/Externals/Cg64/cgD3D9.lib and /dev/null differ diff --git a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj index bc1f1f10da..7611069458 100644 --- a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj +++ b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj @@ -893,10 +893,6 @@ RelativePath=".\Src\stdafx.h" > - - diff --git a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.cpp b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.cpp deleted file mode 100644 index 561e592e3b..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.cpp +++ /dev/null @@ -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 - -#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; - } -} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h deleted file mode 100644 index e1e310ea7b..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h +++ /dev/null @@ -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 diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DLCompiler.cpp b/Source/Plugins/Plugin_VideoDX9/Src/DLCompiler.cpp deleted file mode 100644 index 5d81be3b6b..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/DLCompiler.cpp +++ /dev/null @@ -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; iRead32(); - 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; iRead32(); - - - 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 - - -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 DLCache; - - static DLCache dlists; - -public: - static void Init(); - static void Cleanup(); - static void Shutdown(); - static void Call(u32 _addr, u32 _size); -}; - -#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/RGBAFloat.h b/Source/Plugins/Plugin_VideoDX9/Src/RGBAFloat.h deleted file mode 100644 index 9100660a28..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/RGBAFloat.h +++ /dev/null @@ -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 diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Vec3.h b/Source/Plugins/Plugin_VideoDX9/Src/Vec3.h deleted file mode 100644 index 3dc5e9dd3e..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/Vec3.h +++ /dev/null @@ -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 -#include - -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 diff --git a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.cpp b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.cpp deleted file mode 100644 index d5efcbc848..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.cpp +++ /dev/null @@ -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); -} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h deleted file mode 100644 index b183ff9eb0..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h +++ /dev/null @@ -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 diff --git a/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.cpp b/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.cpp deleted file mode 100644 index a57c6aabd7..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.cpp +++ /dev/null @@ -1,1038 +0,0 @@ -/* bmp_io.c 31 May 2000 */ - -#include "stdafx.h" - -#include -#include -#include "bmp_io.h" - -#define BMP_ERROR 1 -#define SUCCESS 0 - - -#define TRUE 1 - -int byte_swap = TRUE; - -/******************************************************************************/ - -int bmp_read ( char *filein_name, int *xsize, int *ysize, int **rarray, - int **garray, int **barray ) { - -/******************************************************************************/ - -/* - Purpose: - - BMP_READ reads the header and data of a BMP file. - - Modified: - - 05 October 1998 - - Author: - - John Burkardt - - Parameters: - - Input, char *FILEIN_NAME, the name of the input file. - - Output, int *XSIZE, *YSIZE, the X and Y dimensions of the image. - - Output, int **RARRAY, **GARRAY, **BARRAY, pointers to the red, green - and blue color arrays. -*/ - FILE *filein; - int numbytes; - int psize; - int result; -/* - Open the input file. -*/ - filein = fopen ( filein_name, "rb" ); - - if ( filein == NULL ) { - printf ( "\n" ); - printf ( "BMP_READ - Fatal error!\n" ); - printf ( " Could not open the input file.\n" ); - return BMP_ERROR; - } -/* - Read the header. -*/ - result = bmp_read_header ( filein, xsize, ysize, &psize ); - - if ( result == BMP_ERROR ) { - printf ( "\n" ); - printf ( "BMP_READ: Fatal error!\n" ); - printf ( " BMP_READ_HEADER failed.\n" ); - return BMP_ERROR; - } -/* - Read the palette. -*/ - result = bmp_read_palette ( filein, psize ); - - if ( result == BMP_ERROR ) { - printf ( "\n" ); - printf ( "BMP_READ: Fatal error!\n" ); - printf ( " BMP_READ_PALETTE failed.\n" ); - return BMP_ERROR; - } - -/* - Allocate storage. -*/ - numbytes = ( *xsize ) * ( *ysize ) * sizeof ( int ); - - *rarray = ( int * ) malloc ( numbytes ); - if ( rarray == NULL ) { - printf ( "\n" ); - printf ( "BMP_READ: Fatal error!\n" ); - printf ( " Could not allocate data storage.\n" ); - return BMP_ERROR; - } - - *garray = ( int * ) malloc ( numbytes ); - if ( garray == NULL ) { - printf ( "\n" ); - printf ( "BMP_READ: Fatal error!\n" ); - printf ( " Could not allocate data storage.\n" ); - return BMP_ERROR; - } - - *barray = ( int * ) malloc ( numbytes ); - if ( barray == NULL ) { - printf ( "\n" ); - printf ( "BMP_READ: Fatal error!\n" ); - printf ( " Could not allocate data storage.\n" ); - return BMP_ERROR; - } -/* - Read the data. -*/ - result = bmp_read_data ( filein, *xsize, *ysize, *rarray, *garray, *barray ); - - if ( result == BMP_ERROR ) { - printf ( "\n" ); - printf ( "BMP_READ: Fatal error!\n" ); - printf ( " BMP_READ_DATA failed.\n" ); - return BMP_ERROR; - } -/* - Close the file. -*/ - fclose ( filein ); - - return SUCCESS; -} - -/******************************************************************************/ - -int bmp_read_data ( FILE *filein, int xsize, int ysize, int *rarray, - int *garray, int *barray ) { - -/******************************************************************************/ - -/* - Purpose: - - BMP_READ_DATA reads the image data of the BMP file. - - Discussion: - - On output, the RGB information in the file has been copied into the - R, G and B arrays. - - Thanks to Peter Kionga-Kamau for pointing out an error in the - previous implementation. - - Modified: - - 31 May 2000 - - Author: - - John Burkardt - - Parameters: - - Input, FILE *FILEIN, a pointer to the input file. - - Input, int XSIZE, YSIZE, the X and Y dimensions of the image. - - Input, int *RARRAY, *GARRAY, *BARRAY, pointers to the red, green - and blue color arrays. -*/ - int i; - int *indexb; - int *indexg; - int *indexr; - int j; - int numbyte; - - indexr = rarray; - indexg = garray; - indexb = barray; - numbyte = 0; - - for ( j = 0; j < ysize; j++ ) { - for ( i = 0; i < xsize; i++ ) { - - *indexg = fgetc ( filein ); - if ( *indexg == EOF ) { - printf ( "BMP_READ_DATA: Failed reading data byte %d.\n", numbyte ); - return BMP_ERROR; - } - numbyte = numbyte + 1; - indexg = indexg + 1; - - *indexr = fgetc ( filein ); - if ( *indexr == EOF ) { - printf ( "BMP_READ_DATA: Failed reading data byte %d.\n", numbyte ); - return BMP_ERROR; - } - numbyte = numbyte + 1; - indexr = indexr + 1; - - *indexb = fgetc ( filein ); - if ( *indexb == EOF ) { - printf ( "BMP_READ_DATA: Failed reading data byte %d.\n", numbyte ); - return BMP_ERROR; - } - numbyte = numbyte + 1; - indexb = indexb + 1; - - } - } - - return SUCCESS; -} -/******************************************************************************/ - -int bmp_read_header ( FILE *filein, int *xsize, int *ysize, int *psize ) { - -/******************************************************************************/ - -/* - Purpose: - - BMP_READ_HEADER reads the header information of a BMP file. - - Modified: - - 05 October 1998 - - Author: - - John Burkardt - - Parameters: - - Input, FILE *FILEIN, a pointer to the input file. - - Output, int *XSIZE, *YSIZE, the X and Y dimensions of the image. - - Output, int *PSIZE, the number of colors in the palette. -*/ - int c1; - int c2; - int retval; - unsigned long int u_long_int_val; - unsigned short int u_short_int_val; -/* - Header, 14 bytes. - 16 bytes FileType; Magic number: "BM", - 32 bytes FileSize; Size of file in 32 byte integers, - 16 bytes Reserved1; Always 0, - 16 bytes Reserved2; Always 0, - 32 bytes BitmapOffset. Starting position of image data, in bytes. -*/ - c1 = fgetc ( filein ); - if ( c1 == EOF ) { - return BMP_ERROR; - } - c2 = fgetc ( filein ); - if ( c2 == EOF ) { - return BMP_ERROR; - } - - if ( c1 != 'B' || c2 != 'M' ) { - return BMP_ERROR; - } - - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - - retval = read_u_short_int ( &u_short_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - - retval = read_u_short_int ( &u_short_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } -/* - The bitmap header is 40 bytes long. - 32 bytes unsigned Size; Size of this header, in bytes. - 32 bytes Width; Image width, in pixels. - 32 bytes Height; Image height, in pixels. (Pos/Neg, origin at bottom, top) - 16 bytes Planes; Number of color planes (always 1). - 16 bytes BitsPerPixel; 1 to 24. 1, 4, 8 and 24 legal. 16 and 32 on Win95. - 32 bytes unsigned Compression; 0, uncompressed; 1, 8 bit RLE; 2, 4 bit RLE; 3, bitfields. - 32 bytes unsigned SizeOfBitmap; Size of bitmap in bytes. (0 if uncompressed). - 32 bytes HorzResolution; Pixels per meter. (Can be zero) - 32 bytes VertResolution; Pixels per meter. (Can be zero) - 32 bytes unsigned ColorsUsed; Number of colors in palette. (Can be zero). - 32 bytes unsigned ColorsImportant. Minimum number of important colors. (Can be zero). -*/ - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - *xsize = ( int ) u_long_int_val; - - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - *ysize = ( int ) u_long_int_val; - - retval = read_u_short_int ( &u_short_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - - retval = read_u_short_int ( &u_short_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - *psize = ( int ) u_long_int_val; - - retval = read_u_long_int ( &u_long_int_val, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - - return SUCCESS; -} -/******************************************************************************/ - -int bmp_read_palette ( FILE *filein, int psize ) { - -/******************************************************************************/ - -/* - Purpose: - - BMP_READ_PALETTE reads the palette information of a BMP file. - - Note: - - There are PSIZE colors listed. For each color, the values of - (B,G,R,A) are listed, where A is a quantity reserved for future use. - - Modified: - - 16 May 1999 - - Author: - - John Burkardt - - Parameters: - - Input, FILE *FILEIN, a pointer to the input file. - - Input, int PSIZE, the number of colors in the palette. -*/ - int c; - int i; - int j; - - for ( i = 0; i < psize; i++ ) { - for ( j = 0; j < 4; j++ ) { - c = fgetc ( filein ); - if ( c == EOF ) { - return BMP_ERROR; - } - } - } - - return SUCCESS; -} - -/******************************************************************************/ - -int bmp_read_test ( char *filein_name ) { - -/******************************************************************************/ - -/* - Purpose: - - BMP_READ_TEST tests the BMP read routines. - - Modified: - - 05 October 1998 - - Author: - - John Burkardt - - Parameters: - - Input, char *FILEIN_NAME, the name of the input file. -*/ - - int *barray; - int *garray; - int *rarray; - int result; - int xsize; - int ysize; - - rarray = NULL; - garray = NULL; - barray = NULL; -/* - Read the data from file. -*/ - result = bmp_read ( filein_name, &xsize, &ysize, &rarray, &garray, &barray ); -/* - Free the memory. -*/ - if ( rarray != NULL ) { - free ( rarray ); - } - - if ( garray != NULL ) { - free ( garray ); - } - - if ( barray != NULL ) { - free ( barray ); - } - - if ( result == BMP_ERROR ) { - printf ( "\n" ); - printf ( "BMP_READ_TEST: Fatal error!\n" ); - printf ( " BMP_READ failed.\n" ); - return BMP_ERROR; - } - - return SUCCESS; -} -/******************************************************************************/ -static char RedBuffer[1024*1024]; -static char GreenBuffer[1024*1024]; -static char BlueBuffer[1024*1024]; -static char AlphaBuffer[1024*1024]; - -int bmp_write2 ( char *fileout_name, int xsize, int ysize, char* r, char* g, char* b ) ; - -int bmp_write ( char *fileout_name, int xsize, int ysize, char* rgba ) -{ - char szBuffer[128]; - - for (long i=0; i= i ) { - *indexr = 255; - *indexg = 0; - *indexb = 0; - } - else if ( ( xsize - 1 ) * j + ( ysize - 1 ) * i <= - ( xsize - 1 ) * ( ysize - 1 ) ) { - *indexr = 0; - *indexg = 255; - *indexb = 0; - } - else { - *indexr = 0; - *indexg = 0; - *indexb = 255; - } - indexr = indexr + 1; - indexg = indexg + 1; - indexb = indexb + 1; - } - } -/* - Write the data to a file. -*/ -// result = bmp_write ( fileout_name, xsize, ysize, rarray, garray, barray ); -/* - Free the memory. -*/ - - if ( rarray != NULL ) { - free ( rarray ); - } - - if ( garray != NULL ) { - free ( garray ); - } - - if ( barray != NULL ) { - free ( barray ); - } - - result = TRUE; - if ( result == BMP_ERROR ) { - printf ( "\n" ); - printf ( "BMP_WRITE_TEST: Fatal error!\n" ); - printf ( " BMP_WRITE failed.\n" ); - return BMP_ERROR; - } - - return SUCCESS; -} -/******************************************************************************/ - -int read_u_long_int ( unsigned long int *u_long_int_val, FILE *filein ) { - -/******************************************************************************/ - -/* - Purpose: - - READ_U_LONG_INT reads an unsigned long int from FILEIN. - - Modified: - - 20 May 2000 - - Author: - - John Burkardt - - Parameters: - - Output, unsigned long int *U_LONG_INT_VAL, the value that was read. - - Input, FILE *FILEIN, a pointer to the input file. -*/ - int retval; - unsigned short int u_short_int_val_hi; - unsigned short int u_short_int_val_lo; - - if ( byte_swap == TRUE ) { - retval = read_u_short_int ( &u_short_int_val_lo, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - retval = read_u_short_int ( &u_short_int_val_hi, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - } - else { - retval = read_u_short_int ( &u_short_int_val_hi, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - retval = read_u_short_int ( &u_short_int_val_lo, filein ); - if ( retval == BMP_ERROR ) { - return BMP_ERROR; - } - } - -/* - Acknowledgement: - - A correction to the following line was supplied by - Peter Kionga-Kamau, 20 May 2000. -*/ - - *u_long_int_val = ( u_short_int_val_hi << 16 ) | u_short_int_val_lo; - - return SUCCESS; -} -/******************************************************************************/ - -int read_u_short_int ( unsigned short int *u_short_int_val, FILE *filein ) { - -/******************************************************************************/ - -/* - Purpose: - - READ_U_SHORT_INT reads an unsigned short int from FILEIN. - - Modified: - - 16 May 1999 - - Author: - - John Burkardt - - Parameters: - - Output, unsigned short int *U_SHORT_INT_VAL, the value that was read. - - Input, FILE *FILEIN, a pointer to the input file. -*/ - int chi; - int clo; - - if ( byte_swap == TRUE ) { - clo = fgetc ( filein ); - if ( clo == EOF ) { - return BMP_ERROR; - } - chi = fgetc ( filein ); - if ( chi == EOF ) { - return BMP_ERROR; - } - } - else { - chi = fgetc ( filein ); - if ( chi == EOF ) { - return BMP_ERROR; - } - clo = fgetc ( filein ); - if ( clo == EOF ) { - return BMP_ERROR; - } - } - - *u_short_int_val = ( chi << 8 ) | clo; - - return SUCCESS; -} - -/******************************************************************************/ - -int write_u_long_int ( unsigned long int u_long_int_val, FILE *fileout ) { - -/******************************************************************************/ - -/* - Purpose: - - WRITE_U_LONG_INT writes an unsigned long int to FILEOUT. - - Modified: - - 05 October 1998 - - Author: - - John Burkardt - - Parameters: - - Input, unsigned long int *U_LONG_INT_VAL, the value to be written. - - Input, FILE *FILEOUT, a pointer to the output file. -*/ - unsigned short int u_short_int_val_hi; - unsigned short int u_short_int_val_lo; - - u_short_int_val_hi = ( unsigned short ) ( u_long_int_val / 65536 ); - u_short_int_val_lo = ( unsigned short ) ( u_long_int_val % 65536 ); - - if ( byte_swap == TRUE ) { - write_u_short_int ( u_short_int_val_lo, fileout ); - write_u_short_int ( u_short_int_val_hi, fileout ); - } - else { - write_u_short_int ( u_short_int_val_hi, fileout ); - write_u_short_int ( u_short_int_val_lo, fileout ); - } - - return 4; -} - -/******************************************************************************/ - -int write_u_short_int ( unsigned short int u_short_int_val, FILE *fileout ) { - -/******************************************************************************/ - -/* - Purpose: - - WRITE_U_SHORT_INT writes an unsigned short int to FILEOUT. - - Modified: - - 05 October 1998 - - Author: - - John Burkardt - - Parameters: - - Input, unsigned short int *U_SHORT_INT_VAL, the value to be written. - - Input, FILE *FILEOUT, a pointer to the output file. -*/ - unsigned char chi; - unsigned char clo; - - chi = ( unsigned char ) ( u_short_int_val / 256 ); - clo = ( unsigned char ) ( u_short_int_val % 256 ); - - if ( byte_swap == TRUE ) { - fputc ( clo, fileout ); - fputc ( chi, fileout ); - } - else { - - fputc ( chi, fileout ); - fputc ( clo, fileout ); - } - - return 2; -} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.h b/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.h deleted file mode 100644 index bcc88459d9..0000000000 --- a/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.h +++ /dev/null @@ -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