Clean up most (99.99%) of the tab/space mismatches in the VideoSoftware project.

Got rid of trailing spaces that were unnecessary too.

Also update the license header for this project. We don't use SVN anymore.
This commit is contained in:
Lioncash 2013-04-13 23:54:02 -04:00
parent 48927c17d2
commit 7ab0cca645
51 changed files with 4633 additions and 4567 deletions

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "VideoCommon.h" #include "VideoCommon.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _BPMEMLOADER_H_ #ifndef _BPMEMLOADER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CPMEMLOADER_H_ #ifndef _CPMEMLOADER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
/* /*
@ -267,12 +267,14 @@ namespace Clipper
int numVertices = 2; int numVertices = 2;
if (clip_mask[0]) { if (clip_mask[0])
{
indices[0] = numVertices; indices[0] = numVertices;
AddInterpolatedVertex(t0, 0, 1, numVertices); AddInterpolatedVertex(t0, 0, 1, numVertices);
} }
if (clip_mask[1]) { if (clip_mask[1])
{
indices[1] = numVertices; indices[1] = numVertices;
AddInterpolatedVertex(t1, 1, 0, numVertices); AddInterpolatedVertex(t1, 1, 0, numVertices);
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CLIPPER_H_ #ifndef _CLIPPER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -148,7 +148,9 @@ void DumpEfb(const char* filename)
u8 sample[4]; u8 sample[4];
for (int y = 0; y < EFB_HEIGHT; y++) for (int y = 0; y < EFB_HEIGHT; y++)
for (int x = 0; x < EFB_WIDTH; x++) { {
for (int x = 0; x < EFB_WIDTH; x++)
{
EfbInterface::GetColor(x, y, sample); EfbInterface::GetColor(x, y, sample);
// ABGR to BGRA // ABGR to BGRA
*(writePtr++) = sample[1]; *(writePtr++) = sample[1];
@ -156,6 +158,7 @@ void DumpEfb(const char* filename)
*(writePtr++) = sample[3]; *(writePtr++) = sample[3];
*(writePtr++) = sample[0]; *(writePtr++) = sample[0];
} }
}
(void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data); (void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data);
@ -168,7 +171,9 @@ void DumpDepth(const char* filename)
u8 *writePtr = data; u8 *writePtr = data;
for (int y = 0; y < EFB_HEIGHT; y++) for (int y = 0; y < EFB_HEIGHT; y++)
for (int x = 0; x < EFB_WIDTH; x++) { {
for (int x = 0; x < EFB_WIDTH; x++)
{
u32 depth = EfbInterface::GetDepth(x, y); u32 depth = EfbInterface::GetDepth(x, y);
// depth to bgra // depth to bgra
*(writePtr++) = (depth >> 16) & 0xff; *(writePtr++) = (depth >> 16) & 0xff;
@ -176,6 +181,7 @@ void DumpDepth(const char* filename)
*(writePtr++) = depth & 0xff; *(writePtr++) = depth & 0xff;
*(writePtr++) = 255; *(writePtr++) = 255;
} }
}
(void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data); (void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DEBUGUTIL_H #ifndef _DEBUGUTIL_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "BPMemLoader.h" #include "BPMemLoader.h"
@ -42,7 +42,6 @@ namespace EfbCopy
} }
SWRenderer::SwapBuffer(); SWRenderer::SwapBuffer();
} }
void CopyToRam() void CopyToRam()

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EFB_COPY_H_ #ifndef _EFB_COPY_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -345,7 +345,8 @@ namespace EfbInterface
void LogicBlend(u32 srcClr, u32 &dstClr, int op) void LogicBlend(u32 srcClr, u32 &dstClr, int op)
{ {
switch (op) { switch (op)
{
case 0: // clear case 0: // clear
dstClr = 0; dstClr = 0;
break; break;
@ -423,9 +424,13 @@ namespace EfbInterface
BlendColor(color, dstClrPtr); BlendColor(color, dstClrPtr);
} }
else if (bpmem.blendmode.logicopenable) else if (bpmem.blendmode.logicopenable)
{
LogicBlend(*((u32*)color), dstClr, bpmem.blendmode.logicmode); LogicBlend(*((u32*)color), dstClr, bpmem.blendmode.logicmode);
}
else else
{
dstClrPtr = color; dstClrPtr = color;
}
if (bpmem.dstalpha.enable) if (bpmem.dstalpha.enable)
dstClrPtr[ALP_C] = bpmem.dstalpha.alpha; dstClrPtr[ALP_C] = bpmem.dstalpha.alpha;
@ -438,7 +443,9 @@ namespace EfbInterface
SetPixelColorOnly(offset, dstClrPtr); SetPixelColorOnly(offset, dstClrPtr);
} }
else if (bpmem.blendmode.alphaupdate) else if (bpmem.blendmode.alphaupdate)
{
SetPixelAlphaOnly(offset, dstClrPtr[ALP_C]); SetPixelAlphaOnly(offset, dstClrPtr[ALP_C]);
}
// branchless bounding box update // branchless bounding box update
SWPixelEngine::pereg.boxLeft = SWPixelEngine::pereg.boxLeft>x?x:SWPixelEngine::pereg.boxLeft; SWPixelEngine::pereg.boxLeft = SWPixelEngine::pereg.boxLeft>x?x:SWPixelEngine::pereg.boxLeft;
@ -458,8 +465,10 @@ namespace EfbInterface
SetPixelColorOnly(offset, color); SetPixelColorOnly(offset, color);
} }
else if (bpmem.blendmode.alphaupdate) else if (bpmem.blendmode.alphaupdate)
{
SetPixelAlphaOnly(offset, color[ALP_C]); SetPixelAlphaOnly(offset, color[ALP_C]);
} }
}
void SetDepth(u16 x, u16 y, u32 depth) void SetDepth(u16 x, u16 y, u32 depth)
{ {

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EFB_INTERFACE_H_ #ifndef _EFB_INTERFACE_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -369,8 +369,8 @@ namespace HwRasterizer
// extra checks cause textures to be reloaded much more // extra checks cause textures to be reloaded much more
if (texUnit.texImage0[0].hex != texImage0.hex || if (texUnit.texImage0[0].hex != texImage0.hex ||
//texUnit.texImage1[0].hex != texImage1.hex || // texUnit.texImage1[0].hex != texImage1.hex ||
//texUnit.texImage2[0].hex != texImage2.hex || // texUnit.texImage2[0].hex != texImage2.hex ||
texUnit.texImage3[0].hex != texImage3.hex || texUnit.texImage3[0].hex != texImage3.hex ||
texUnit.texTlut[0].hex != texTlut.hex) texUnit.texTlut[0].hex != texTlut.hex)
{ {

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _HW_RASTERIZER_H #ifndef _HW_RASTERIZER_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _NATIVEVERTEXFORMAT_H #ifndef _NATIVEVERTEXFORMAT_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../../Plugin_VideoOGL/Src/GLUtil.h" #include "../../Plugin_VideoOGL/Src/GLUtil.h"
@ -124,9 +124,11 @@ RasterFont::RasterFont()
{ {
// set GL modes // set GL modes
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
// create the raster font // create the raster font
fontOffset = glGenLists(128); fontOffset = glGenLists(128);
for (int i = 32; i < 127; i++) { for (int i = 32; i < 127; i++)
{
glNewList(i + fontOffset, GL_COMPILE); glNewList(i + fontOffset, GL_COMPILE);
glBitmap(8, 13, 0.0f, 2.0f, 10.0f, 0.0f, rasters[i - 32]); glBitmap(8, 13, 0.0f, 2.0f, 10.0f, 0.0f, rasters[i - 32]);
glEndList(); glEndList();
@ -153,7 +155,8 @@ void RasterFont::printString(const char *s, double x, double y, double z)
char *s2 = temp_buffer; char *s2 = temp_buffer;
memcpy(s2, s, length); memcpy(s2, s, length);
s2[length] = 0; s2[length] = 0;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++)
{
if (s2[i] < 32 || s2[i] > 126) if (s2[i] < 32 || s2[i] > 126)
s2[i] = '!'; s2[i] = '!';
} }
@ -209,7 +212,9 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
*t++ = ' '; *t++ = ' ';
} }
else else
{
*t++ = *text; *t++ = *text;
}
text++; text++;
} }

View File

@ -12,13 +12,14 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _RASTERFONT_H_ #ifndef _RASTERFONT_H_
#define _RASTERFONT_H_ #define _RASTERFONT_H_
class RasterFont { class RasterFont
{
public: public:
RasterFont(); RasterFont();
~RasterFont(void); ~RasterFont(void);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -458,7 +458,8 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
int c = (c00 << 0) | (c10 << 1) | (c01 << 2) | (c11 << 3); int c = (c00 << 0) | (c10 << 1) | (c01 << 2) | (c11 << 3);
// Skip block when outside an edge // Skip block when outside an edge
if(a == 0x0 || b == 0x0 || c == 0x0) continue; if(a == 0x0 || b == 0x0 || c == 0x0)
continue;
BuildBlock(x, y); BuildBlock(x, y);
@ -504,9 +505,7 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
} }
} }
} }
} }
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _RASTERIZER_H_ #ifndef _RASTERIZER_H_
@ -62,7 +62,6 @@ namespace Rasterizer
}; };
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
} }
#endif #endif

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -128,7 +128,8 @@ void RunGpu()
FPURoundMode::LoadDefaultSIMDState(); FPURoundMode::LoadDefaultSIMDState();
// run the opcode decoder // run the opcode decoder
do { do
{
RunBuffer(); RunBuffer();
} while (cpreg.ctrl.GPReadEnable && !AtBreakpoint() && cpreg.readptr != cpreg.writeptr); } while (cpreg.ctrl.GPReadEnable && !AtBreakpoint() && cpreg.readptr != cpreg.writeptr);
@ -248,11 +249,11 @@ void Write16(const u16 _Value, const u32 _Address)
case FIFO_BP_LO: case FIFO_BP_LO:
WriteLow ((u32 &)cpreg.breakpt, _Value & 0xFFE0); WriteLow ((u32 &)cpreg.breakpt, _Value & 0xFFE0);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_LO. breakpt is : %08x", cpreg.breakpt); DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_LO. breakpoint is : %08x", cpreg.breakpt);
break; break;
case FIFO_BP_HI: case FIFO_BP_HI:
WriteHigh ((u32 &)cpreg.breakpt, _Value); WriteHigh ((u32 &)cpreg.breakpt, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_HI. breakpt is : %08x", cpreg.breakpt); DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_HI. breakpoint is : %08x", cpreg.breakpt);
break; break;
case FIFO_RW_DISTANCE_LO: case FIFO_RW_DISTANCE_LO:
@ -399,8 +400,10 @@ void SetStatus()
SWCommandProcessor::UpdateInterruptsFromVideoBackend(userdata); SWCommandProcessor::UpdateInterruptsFromVideoBackend(userdata);
} }
else else
{
SWCommandProcessor::UpdateInterrupts(userdata); SWCommandProcessor::UpdateInterrupts(userdata);
} }
}
} }
bool RunBuffer() bool RunBuffer()

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _COMMANDPROCESSOR_H_ #ifndef _COMMANDPROCESSOR_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PIXELENGINE_H #ifndef _PIXELENGINE_H
#define _PIXELENGINE_H #define _PIXELENGINE_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _RENDERER_H_ #ifndef _RENDERER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "SWStatistics.h" #include "SWStatistics.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "CommonTypes.h" #include "CommonTypes.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -76,11 +76,13 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
g_VtxDesc.Tex0MatIdx, g_VtxDesc.Tex1MatIdx, g_VtxDesc.Tex2MatIdx, g_VtxDesc.Tex3MatIdx, g_VtxDesc.Tex0MatIdx, g_VtxDesc.Tex1MatIdx, g_VtxDesc.Tex2MatIdx, g_VtxDesc.Tex3MatIdx,
g_VtxDesc.Tex4MatIdx, g_VtxDesc.Tex5MatIdx, g_VtxDesc.Tex6MatIdx, g_VtxDesc.Tex7MatIdx g_VtxDesc.Tex4MatIdx, g_VtxDesc.Tex5MatIdx, g_VtxDesc.Tex6MatIdx, g_VtxDesc.Tex7MatIdx
}; };
// Colors // Colors
const u32 colDesc[2] = {g_VtxDesc.Color0, g_VtxDesc.Color1}; const u32 colDesc[2] = {g_VtxDesc.Color0, g_VtxDesc.Color1};
colElements[0] = m_CurrentVat->g0.Color0Elements; colElements[0] = m_CurrentVat->g0.Color0Elements;
colElements[1] = m_CurrentVat->g0.Color1Elements; colElements[1] = m_CurrentVat->g0.Color1Elements;
const u32 colComp[2] = {m_CurrentVat->g0.Color0Comp, m_CurrentVat->g0.Color1Comp}; const u32 colComp[2] = {m_CurrentVat->g0.Color0Comp, m_CurrentVat->g0.Color1Comp};
// TextureCoord // TextureCoord
const u32 tcDesc[8] = { const u32 tcDesc[8] = {
g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord, g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord, g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord,
@ -147,12 +149,14 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
m_Vertex.texMtx[7] = MatrixIndexB.Tex7MtxIdx; m_Vertex.texMtx[7] = MatrixIndexB.Tex7MtxIdx;
#endif #endif
if (g_VtxDesc.PosMatIdx != NOT_PRESENT) { if (g_VtxDesc.PosMatIdx != NOT_PRESENT)
{
AddAttributeLoader(LoadPosMtx); AddAttributeLoader(LoadPosMtx);
m_VertexSize++; m_VertexSize++;
} }
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i)
{
if (tmDesc[i] != NOT_PRESENT) if (tmDesc[i] != NOT_PRESENT)
{ {
AddAttributeLoader(LoadTexMtx, i); AddAttributeLoader(LoadTexMtx, i);
@ -181,7 +185,8 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
AddAttributeLoader(LoadNormal); AddAttributeLoader(LoadNormal);
} }
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++)
{
switch (colDesc[i]) switch (colDesc[i])
{ {
case NOT_PRESENT: case NOT_PRESENT:
@ -232,7 +237,8 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
} }
// Texture matrix indices (remove if corresponding texture coordinate isn't enabled) // Texture matrix indices (remove if corresponding texture coordinate isn't enabled)
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++)
{
const int desc = tcDesc[i]; const int desc = tcDesc[i];
const int format = tcFormat[i]; const int format = tcFormat[i];
const int elements = tcElements[i]; const int elements = tcElements[i];
@ -252,7 +258,6 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
(g_VtxDesc.Tex0Coord != NOT_PRESENT) && (g_VtxDesc.Tex0Coord != NOT_PRESENT) &&
(swxfregs.texMtxInfo[0].projection == XF_TEXPROJ_ST); (swxfregs.texMtxInfo[0].projection == XF_TEXPROJ_ST);
m_SetupUnit->Init(primitiveType); m_SetupUnit->Init(primitiveType);
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXLOADER_H_ #ifndef _VERTEXLOADER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "FileUtil.h" #include "FileUtil.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VIDEOSOFTWARE_CONFIG_H_ #ifndef _VIDEOSOFTWARE_CONFIG_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
@ -220,8 +220,10 @@ u32 VideoSoftware::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputDa
value = EfbInterface::GetDepth(x, y); value = EfbInterface::GetDepth(x, y);
break; break;
} }
case POKE_Z: case POKE_Z:
break; break;
case PEEK_COLOR: case PEEK_COLOR:
{ {
u32 color = 0; u32 color = 0;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "SetupUnit.h" #include "SetupUnit.h"
@ -80,7 +80,7 @@ void SetupUnit::SetupVertex()
OutputVertexData* temp = m_VertPointer[1]; OutputVertexData* temp = m_VertPointer[1];
m_VertPointer[1] = m_VertPointer[2]; m_VertPointer[1] = m_VertPointer[2];
m_VertPointer[2] = temp; m_VertPointer[2] = temp;
} }
void SetupUnit::SetupTriangle() void SetupUnit::SetupTriangle()
{ {

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -438,7 +438,8 @@ static bool TevAlphaTest(int alpha)
bool comp0 = AlphaCompare(alpha, bpmem.alpha_test.ref0, bpmem.alpha_test.comp0); bool comp0 = AlphaCompare(alpha, bpmem.alpha_test.ref0, bpmem.alpha_test.comp0);
bool comp1 = AlphaCompare(alpha, bpmem.alpha_test.ref1, bpmem.alpha_test.comp1); bool comp1 = AlphaCompare(alpha, bpmem.alpha_test.ref1, bpmem.alpha_test.comp1);
switch (bpmem.alpha_test.logic) { switch (bpmem.alpha_test.logic)
{
case 0: return comp0 && comp1; // and case 0: return comp0 && comp1; // and
case 1: return comp0 || comp1; // or case 1: return comp0 || comp1; // or
case 2: return comp0 ^ comp1; // xor case 2: return comp0 ^ comp1; // xor
@ -449,7 +450,8 @@ static bool TevAlphaTest(int alpha)
inline s32 WrapIndirectCoord(s32 coord, int wrapMode) inline s32 WrapIndirectCoord(s32 coord, int wrapMode)
{ {
switch (wrapMode) { switch (wrapMode)
{
case ITW_OFF: case ITW_OFF:
return coord; return coord;
case ITW_256: case ITW_256:
@ -476,7 +478,8 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t)
s32 indcoord[3]; s32 indcoord[3];
// alpha bump select // alpha bump select
switch (indirect.bs) { switch (indirect.bs)
{
case ITBA_OFF: case ITBA_OFF:
AlphaBump = 0; AlphaBump = 0;
break; break;
@ -499,7 +502,8 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t)
bias[2] = indirect.bias&4?biasValue:0; bias[2] = indirect.bias&4?biasValue:0;
// format // format
switch(indirect.fmt) { switch(indirect.fmt)
{
case ITF_8: case ITF_8:
indcoord[0] = indmap[TextureSampler::ALP_SMP] + bias[0]; indcoord[0] = indmap[TextureSampler::ALP_SMP] + bias[0];
indcoord[1] = indmap[TextureSampler::BLU_SMP] + bias[1]; indcoord[1] = indmap[TextureSampler::BLU_SMP] + bias[1];
@ -542,7 +546,8 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t)
int shift; int shift;
switch (indirect.mid & 12) { switch (indirect.mid & 12)
{
case 0: case 0:
shift = 3 + (17 - scale); shift = 3 + (17 - scale);
indtevtrans[0] = indmtx.col0.ma * indcoord[0] + indmtx.col1.mc * indcoord[1] + indmtx.col2.me * indcoord[2]; indtevtrans[0] = indmtx.col0.ma * indcoord[0] + indmtx.col1.mc * indcoord[1] + indmtx.col2.me * indcoord[2];
@ -713,7 +718,8 @@ void Tev::Draw()
if (bpmem.ztex2.op) if (bpmem.ztex2.op)
{ {
u32 ztex = bpmem.ztex1.bias; u32 ztex = bpmem.ztex1.bias;
switch (bpmem.ztex2.type) { switch (bpmem.ztex2.type)
{
case 0: // 8 bit case 0: // 8 bit
ztex += TexColor[ALP_C]; ztex += TexColor[ALP_C];
break; break;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TEV_H_ #ifndef _TEV_H_
@ -23,7 +23,8 @@
class Tev class Tev
{ {
struct InputRegType { struct InputRegType
{
unsigned a : 8; unsigned a : 8;
unsigned b : 8; unsigned b : 8;
unsigned c : 8; unsigned c : 8;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "TextureEncoder.h" #include "TextureEncoder.h"
@ -57,8 +57,10 @@ inline void boxfilterRGBA_to_RGBA8(u8 *src, u8 &r, u8 &g, u8 &b, u8 &a)
{ {
u16 r16 = 0, g16 = 0, b16 = 0, a16 = 0; u16 r16 = 0, g16 = 0, b16 = 0, a16 = 0;
for (int y = 0; y < 2; y++) { for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++) { {
for (int x = 0; x < 2; x++)
{
u32 srcColor = *(u32*)src; u32 srcColor = *(u32*)src;
a16 += srcColor & 0x3f; a16 += srcColor & 0x3f;
@ -81,8 +83,10 @@ inline void boxfilterRGBA_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
{ {
u16 r16 = 0, g16 = 0, b16 = 0; u16 r16 = 0, g16 = 0, b16 = 0;
for (int y = 0; y < 2; y++) { for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++) { {
for (int x = 0; x < 2; x++)
{
u32 srcColor = *(u32*)src; u32 srcColor = *(u32*)src;
b16 += (srcColor >> 6) & 0x3f; b16 += (srcColor >> 6) & 0x3f;
@ -103,8 +107,10 @@ inline void boxfilterRGBA_to_x8(u8 *src, u8 &x8, int shift)
{ {
u16 x16 = 0; u16 x16 = 0;
for (int y = 0; y < 2; y++) { for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++) { {
for (int x = 0; x < 2; x++)
{
u32 srcColor = *(u32*)src; u32 srcColor = *(u32*)src;
x16 += (srcColor >> shift) & 0x3f; x16 += (srcColor >> shift) & 0x3f;
@ -122,8 +128,10 @@ inline void boxfilterRGBA_to_xx8(u8 *src, u8 &x1, u8 &x2, int shift1, int shift2
u16 x16_1 = 0; u16 x16_1 = 0;
u16 x16_2 = 0; u16 x16_2 = 0;
for (int y = 0; y < 2; y++) { for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++) { {
for (int x = 0; x < 2; x++)
{
u32 srcColor = *(u32*)src; u32 srcColor = *(u32*)src;
x16_1 += (srcColor >> shift1) & 0x3f; x16_1 += (srcColor >> shift1) & 0x3f;
@ -142,9 +150,10 @@ inline void boxfilterRGB_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
{ {
u16 r16 = 0, g16 = 0, b16 = 0; u16 r16 = 0, g16 = 0, b16 = 0;
for (int y = 0; y < 2; y++) { for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++) { {
for (int x = 0; x < 2; x++)
{
b16 += src[0]; b16 += src[0];
g16 += src[1]; g16 += src[1];
r16 += src[2]; r16 += src[2];
@ -163,8 +172,10 @@ inline void boxfilterRGB_to_x8(u8 *src, u8 &x8, int comp)
{ {
u16 x16 = 0; u16 x16 = 0;
for (int y = 0; y < 2; y++) { for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++) { {
for (int x = 0; x < 2; x++)
{
x16 += src[comp]; x16 += src[comp];
@ -181,8 +192,10 @@ inline void boxfilterRGB_to_xx8(u8 *src, u8 &x1, u8 &x2, int comp1, int comp2)
u16 x16_1 = 0; u16 x16_1 = 0;
u16 x16_2 = 0; u16 x16_2 = 0;
for (int y = 0; y < 2; y++) { for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++) { {
for (int x = 0; x < 2; x++)
{
x16_1 += src[comp1]; x16_1 += src[comp1];
x16_2 += src[comp2]; x16_2 += src[comp2];

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/

View File

@ -11,7 +11,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TEXTURESAMPLER_H_ #ifndef _TEXTURESAMPLER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -222,16 +222,18 @@ inline float Clamp(float val, float a, float b)
inline float SafeDivide(float n, float d) inline float SafeDivide(float n, float d)
{ {
return (d==0)?(n>0?1:0):n/d; return (d==0) ? (n>0?1:0) : n/d;
} }
void LightColor(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChannel &chan, Vec3 &lightCol) void LightColor(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChannel &chan, Vec3 &lightCol)
{ {
const LightPointer *light = (const LightPointer*)&swxfregs.lights[0x10*lightNum]; const LightPointer *light = (const LightPointer*)&swxfregs.lights[0x10*lightNum];
if (!(chan.attnfunc & 1)) { if (!(chan.attnfunc & 1))
{
// atten disabled // atten disabled
switch (chan.diffusefunc) { switch (chan.diffusefunc)
{
case LIGHTDIF_NONE: case LIGHTDIF_NONE:
AddIntegerColor(light->color, lightCol); AddIntegerColor(light->color, lightCol);
break; break;
@ -252,12 +254,14 @@ void LightColor(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann
default: _assert_(0); default: _assert_(0);
} }
} }
else { // spec and spot else // spec and spot
{
// not sure about divide by zero checks // not sure about divide by zero checks
Vec3 ldir = light->pos - pos; Vec3 ldir = light->pos - pos;
float attn; float attn;
if (chan.attnfunc == 3) { // spot if (chan.attnfunc == 3) // spot
{
float dist2 = ldir.length2(); float dist2 = ldir.length2();
float dist = sqrtf(dist2); float dist = sqrtf(dist2);
ldir = ldir / dist; ldir = ldir / dist;
@ -267,7 +271,8 @@ void LightColor(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann
float distAtt = light->distatt.x + (light->distatt.y * dist) + (light->distatt.z * dist2); float distAtt = light->distatt.x + (light->distatt.y * dist) + (light->distatt.z * dist2);
attn = SafeDivide(max(0.0f, cosAtt), distAtt); attn = SafeDivide(max(0.0f, cosAtt), distAtt);
} }
else if (chan.attnfunc == 1) { // specular else if (chan.attnfunc == 1) // specular
{
// donko - what is going on here? 655.36 is a guess but seems about right. // donko - what is going on here? 655.36 is a guess but seems about right.
attn = (light->pos * normal) > -655.36 ? max(0.0f, (light->dir * normal)) : 0; attn = (light->pos * normal) > -655.36 ? max(0.0f, (light->dir * normal)) : 0;
ldir.set(1.0f, attn, attn * attn); ldir.set(1.0f, attn, attn * attn);
@ -275,12 +280,15 @@ void LightColor(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann
float cosAtt = max(0.0f, light->cosatt * ldir); float cosAtt = max(0.0f, light->cosatt * ldir);
float distAtt = light->distatt * ldir; float distAtt = light->distatt * ldir;
attn = SafeDivide(max(0.0f, cosAtt), distAtt); attn = SafeDivide(max(0.0f, cosAtt), distAtt);
} else { }
else
{
PanicAlert("LightColor"); PanicAlert("LightColor");
return; return;
} }
switch (chan.diffusefunc) { switch (chan.diffusefunc)
{
case LIGHTDIF_NONE: case LIGHTDIF_NONE:
AddScaledIntegerColor(light->color, attn, lightCol); AddScaledIntegerColor(light->color, attn, lightCol);
break; break;
@ -306,9 +314,11 @@ void LightAlpha(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann
{ {
const LightPointer *light = (const LightPointer*)&swxfregs.lights[0x10*lightNum]; const LightPointer *light = (const LightPointer*)&swxfregs.lights[0x10*lightNum];
if (!(chan.attnfunc & 1)) { if (!(chan.attnfunc & 1))
{
// atten disabled // atten disabled
switch (chan.diffusefunc) { switch (chan.diffusefunc)
{
case LIGHTDIF_NONE: case LIGHTDIF_NONE:
lightCol += light->color[0]; lightCol += light->color[0];
break; break;
@ -329,11 +339,13 @@ void LightAlpha(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann
default: _assert_(0); default: _assert_(0);
} }
} }
else { // spec and spot else // spec and spot
{
Vec3 ldir = light->pos - pos; Vec3 ldir = light->pos - pos;
float attn; float attn;
if (chan.attnfunc == 3) { // spot if (chan.attnfunc == 3) // spot
{
float dist2 = ldir.length2(); float dist2 = ldir.length2();
float dist = sqrtf(dist2); float dist = sqrtf(dist2);
ldir = ldir / dist; ldir = ldir / dist;
@ -343,7 +355,8 @@ void LightAlpha(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann
float distAtt = light->distatt.x + (light->distatt.y * dist) + (light->distatt.z * dist2); float distAtt = light->distatt.x + (light->distatt.y * dist) + (light->distatt.z * dist2);
attn = SafeDivide(max(0.0f, cosAtt), distAtt); attn = SafeDivide(max(0.0f, cosAtt), distAtt);
} }
else /* if (chan.attnfunc == 1) */ { // specular else /* if (chan.attnfunc == 1) */ // specular
{
// donko - what is going on here? 655.36 is a guess but seems about right. // donko - what is going on here? 655.36 is a guess but seems about right.
attn = (light->pos * normal) > -655.36 ? max(0.0f, (light->dir * normal)) : 0; attn = (light->pos * normal) > -655.36 ? max(0.0f, (light->dir * normal)) : 0;
ldir.set(1.0f, attn, attn * attn); ldir.set(1.0f, attn, attn * attn);
@ -353,7 +366,8 @@ void LightAlpha(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann
attn = SafeDivide(max(0.0f, cosAtt), distAtt); attn = SafeDivide(max(0.0f, cosAtt), distAtt);
} }
switch (chan.diffusefunc) { switch (chan.diffusefunc)
{
case LIGHTDIF_NONE: case LIGHTDIF_NONE:
lightCol += light->color[0] * attn; lightCol += light->color[0] * attn;
break; break;
@ -409,7 +423,8 @@ void TransformColor(const InputVertexData *src, OutputVertexData *dst)
} }
u8 mask = colorchan.GetFullLightMask(); u8 mask = colorchan.GetFullLightMask();
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i)
{
if (mask&(1<<i)) if (mask&(1<<i))
LightColor(dst->mvPosition, dst->normal[0], i, colorchan, lightCol); LightColor(dst->mvPosition, dst->normal[0], i, colorchan, lightCol);
} }
@ -440,7 +455,8 @@ void TransformColor(const InputVertexData *src, OutputVertexData *dst)
lightCol = (float)(swxfregs.ambColor[chan] & 0xff); lightCol = (float)(swxfregs.ambColor[chan] & 0xff);
u8 mask = alphachan.GetFullLightMask(); u8 mask = alphachan.GetFullLightMask();
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i)
{
if (mask&(1<<i)) if (mask&(1<<i))
LightAlpha(dst->mvPosition, dst->normal[0], i, alphachan, lightCol); LightAlpha(dst->mvPosition, dst->normal[0], i, alphachan, lightCol);
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TRANSFORM_UNIT_H_ #ifndef _TRANSFORM_UNIT_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VEC3_H #ifndef _VEC3_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "VideoConfigDiag.h" #include "VideoConfigDiag.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VIDEOSOFTWARE_CONFIG_DIAG_H_ #ifndef _VIDEOSOFTWARE_CONFIG_DIAG_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "VideoCommon.h" #include "VideoCommon.h"
@ -76,11 +76,11 @@ void SWLoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
size = 0x1058 - baseAddress; size = 0x1058 - baseAddress;
} }
if (size > 0) { if (size > 0)
{
memcpy_gc( &((u32*)&swxfregs)[baseAddress], pData, size * 4); memcpy_gc( &((u32*)&swxfregs)[baseAddress], pData, size * 4);
XFWritten(transferSize, baseAddress); XFWritten(transferSize, baseAddress);
} }
} }
void SWLoadIndexedXF(u32 val, int array) void SWLoadIndexedXF(u32 val, int array)

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _XFMEMLOADER_H_ #ifndef _XFMEMLOADER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "stdafx.h" #include "stdafx.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#pragma once #pragma once