mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Rewrite debug logging
This commit is contained in:
parent
8d519e03df
commit
ee60040a78
|
@ -122,7 +122,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>UNICODE;GL_USE_UNIFORMBLOCK;TXFILTER_LIB;WIN32_ASM;OS_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>DEBUG_DUMP;UNICODE;GL_USE_UNIFORMBLOCK;TXFILTER_LIB;WIN32_ASM;OS_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -149,7 +149,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>UNICODE;GL_USE_UNIFORMBLOCK;TXFILTER_LIB;MUPENPLUSAPI;WIN32;OS_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>DEBUG_DUMP;UNICODE;GL_USE_UNIFORMBLOCK;TXFILTER_LIB;MUPENPLUSAPI;WIN32;OS_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -275,6 +275,7 @@
|
|||
<ClCompile Include="..\..\src\Config.cpp" />
|
||||
<ClCompile Include="..\..\src\convert.cpp" />
|
||||
<ClCompile Include="..\..\src\CRC_OPT.cpp" />
|
||||
<ClCompile Include="..\..\src\DebugDump.cpp" />
|
||||
<ClCompile Include="..\..\src\DepthBuffer.cpp" />
|
||||
<ClCompile Include="..\..\src\DepthBufferRender\ClipPolygon.cpp" />
|
||||
<ClCompile Include="..\..\src\DepthBufferRender\DepthBufferRender.cpp" />
|
||||
|
@ -413,7 +414,7 @@
|
|||
<ClInclude Include="..\..\src\convert.h" />
|
||||
<ClInclude Include="..\..\src\CRC.h" />
|
||||
<ClInclude Include="..\..\src\CRC32.h" />
|
||||
<ClInclude Include="..\..\src\Debug.h" />
|
||||
<ClInclude Include="..\..\src\DebugDump.h" />
|
||||
<ClInclude Include="..\..\src\DepthBuffer.h" />
|
||||
<ClInclude Include="..\..\src\DepthBufferRender\ClipPolygon.h" />
|
||||
<ClInclude Include="..\..\src\DepthBufferRender\DepthBufferRender.h" />
|
||||
|
|
|
@ -356,6 +356,9 @@
|
|||
<ClCompile Include="..\..\src\T3DUX.cpp">
|
||||
<Filter>Source Files\uCodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\DebugDump.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\3DMath.h">
|
||||
|
@ -373,9 +376,6 @@
|
|||
<ClInclude Include="..\..\src\CRC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Debug.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\DepthBuffer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -661,5 +661,8 @@
|
|||
<ClInclude Include="..\..\src\F3DTEXA.h">
|
||||
<Filter>Header Files\uCodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\DebugDump.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -14,6 +14,7 @@ set(GLideN64_SOURCES
|
|||
Config.cpp
|
||||
convert.cpp
|
||||
CRC32.cpp
|
||||
DebugDump.cpp
|
||||
DepthBuffer.cpp
|
||||
DisplayWindow.cpp
|
||||
F3D.cpp
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <osal_files.h>
|
||||
|
||||
#include "Combiner.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "gDP.h"
|
||||
#include "Config.h"
|
||||
#include "PluginAPI.h"
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
// TODO Debug log.
|
||||
#define DebugMsg(A, ...)
|
||||
#define DebugRSPState(A, ...)
|
||||
|
||||
#endif // DEBUG_H
|
105
src/DebugDump.cpp
Normal file
105
src/DebugDump.cpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "PluginAPI.h"
|
||||
#include "Log.h"
|
||||
#include "wst.h"
|
||||
#include "DebugDump.h"
|
||||
|
||||
#ifdef DEBUG_DUMP
|
||||
|
||||
class BufferedLog
|
||||
{
|
||||
public:
|
||||
BufferedLog(u32 _mode);
|
||||
BufferedLog(const BufferedLog&) = delete;
|
||||
~BufferedLog();
|
||||
|
||||
void print(const char* _message);
|
||||
bool needPrint(u32 _mode) const;
|
||||
|
||||
private:
|
||||
u32 m_mode;
|
||||
std::ofstream m_log;
|
||||
std::vector<char> m_logBuffer;
|
||||
};
|
||||
|
||||
BufferedLog::BufferedLog(u32 _mode) : m_mode(_mode)
|
||||
{
|
||||
try {
|
||||
m_logBuffer.resize(1024*1024);
|
||||
m_log.rdbuf()->pubsetbuf(&m_logBuffer.front(), m_logBuffer.size());
|
||||
} catch(std::bad_alloc&) {
|
||||
LOG(LOG_ERROR, "Failed to alloc memory for log buffer\n");
|
||||
}
|
||||
|
||||
wchar_t logPath[PLUGIN_PATH_SIZE + 16];
|
||||
api().GetUserDataPath(logPath);
|
||||
gln_wcscat(logPath, wst("/gliden64.debug.log"));
|
||||
const size_t bufSize = PLUGIN_PATH_SIZE * 6;
|
||||
char cbuf[bufSize];
|
||||
wcstombs(cbuf, logPath, bufSize);
|
||||
m_log.open(cbuf, std::ios::trunc);
|
||||
}
|
||||
|
||||
BufferedLog::~BufferedLog()
|
||||
{
|
||||
m_log.flush();
|
||||
m_log.close();
|
||||
}
|
||||
|
||||
void BufferedLog::print(const char* _message)
|
||||
{
|
||||
m_log << _message;
|
||||
}
|
||||
|
||||
bool BufferedLog::needPrint(u32 _mode) const
|
||||
{
|
||||
return (m_mode&_mode) != 0;
|
||||
}
|
||||
|
||||
std::unique_ptr<BufferedLog> g_log;
|
||||
|
||||
void DebugMsg(u32 _mode, const char * _format, ...)
|
||||
{
|
||||
if (!g_log || !g_log->needPrint(_mode))
|
||||
return;
|
||||
|
||||
char text[1024];
|
||||
|
||||
va_list va;
|
||||
va_start(va, _format);
|
||||
vsprintf(text, _format, va);
|
||||
va_end(va);
|
||||
|
||||
g_log->print(text);
|
||||
}
|
||||
|
||||
void StartDump(u32 _mode)
|
||||
{
|
||||
g_log.reset(new BufferedLog(_mode));
|
||||
}
|
||||
|
||||
void EndDump()
|
||||
{
|
||||
g_log.reset();
|
||||
}
|
||||
|
||||
void SwitchDump(u32 _mode)
|
||||
{
|
||||
if (!g_log)
|
||||
StartDump(_mode);
|
||||
else
|
||||
EndDump();
|
||||
}
|
||||
|
||||
bool IsDump()
|
||||
{
|
||||
return !!g_log;
|
||||
}
|
||||
|
||||
#endif // DEBUG_DUMP
|
202
src/DebugDump.h
Normal file
202
src/DebugDump.h
Normal file
|
@ -0,0 +1,202 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
#include "Types.h"
|
||||
|
||||
#define DEBUG_NORMAL 0x01
|
||||
#define DEBUG_DETAIL 0x02
|
||||
#define DEBUG_IGNORED 0x04
|
||||
#define DEBUG_ERROR 0x08
|
||||
|
||||
#ifdef DEBUG_DUMP
|
||||
|
||||
void DebugMsg(u32 _mode, const char * _format, ...);
|
||||
void StartDump(u32 _mode);
|
||||
void EndDump();
|
||||
void SwitchDump(u32 _mode);
|
||||
bool IsDump();
|
||||
|
||||
static const char *ImageFormatText[] =
|
||||
{
|
||||
"G_IM_FMT_RGBA",
|
||||
"G_IM_FMT_YUV",
|
||||
"G_IM_FMT_CI",
|
||||
"G_IM_FMT_IA",
|
||||
"G_IM_FMT_I",
|
||||
"G_IM_FMT_INVALID",
|
||||
"G_IM_FMT_INVALID",
|
||||
"G_IM_FMT_INVALID"
|
||||
};
|
||||
|
||||
static const char *ImageSizeText[] =
|
||||
{
|
||||
"G_IM_SIZ_4b",
|
||||
"G_IM_SIZ_8b",
|
||||
"G_IM_SIZ_16b",
|
||||
"G_IM_SIZ_32b"
|
||||
};
|
||||
|
||||
static const char *SegmentText[] =
|
||||
{
|
||||
"G_MWO_SEGMENT_0", "G_MWO_SEGMENT_1", "G_MWO_SEGMENT_2", "G_MWO_SEGMENT_3",
|
||||
"G_MWO_SEGMENT_4", "G_MWO_SEGMENT_5", "G_MWO_SEGMENT_6", "G_MWO_SEGMENT_7",
|
||||
"G_MWO_SEGMENT_8", "G_MWO_SEGMENT_9", "G_MWO_SEGMENT_A", "G_MWO_SEGMENT_B",
|
||||
"G_MWO_SEGMENT_C", "G_MWO_SEGMENT_D", "G_MWO_SEGMENT_E", "G_MWO_SEGMENT_F"
|
||||
};
|
||||
|
||||
static const char *AAEnableText = "AA_EN";
|
||||
static const char *DepthCompareText = "Z_CMP";
|
||||
static const char *DepthUpdateText = "Z_UPD";
|
||||
static const char *ClearOnCvgText = "CLR_ON_CVG";
|
||||
static const char *CvgXAlphaText = "CVG_X_ALPHA";
|
||||
static const char *AlphaCvgSelText = "ALPHA_CVG_SEL";
|
||||
static const char *ForceBlenderText = "FORCE_BL";
|
||||
|
||||
static const char *AlphaCompareText[] =
|
||||
{
|
||||
"G_AC_NONE", "G_AC_THRESHOLD", "G_AC_INVALID", "G_AC_DITHER"
|
||||
};
|
||||
|
||||
static const char *DepthSourceText[] =
|
||||
{
|
||||
"G_ZS_PIXEL", "G_ZS_PRIM"
|
||||
};
|
||||
|
||||
static const char *AlphaDitherText[] =
|
||||
{
|
||||
"G_AD_PATTERN", "G_AD_NOTPATTERN", "G_AD_NOISE", "G_AD_DISABLE"
|
||||
};
|
||||
|
||||
static const char *ColorDitherText[] =
|
||||
{
|
||||
"G_CD_MAGICSQ", "G_CD_BAYER", "G_CD_NOISE", "G_CD_DISABLE"
|
||||
};
|
||||
|
||||
static const char *CombineKeyText[] =
|
||||
{
|
||||
"G_CK_NONE", "G_CK_KEY"
|
||||
};
|
||||
|
||||
static const char *TextureConvertText[] =
|
||||
{
|
||||
"G_TC_CONV", "G_TC_INVALID", "G_TC_INVALID", "G_TC_INVALID", "G_TC_INVALID", "G_TC_FILTCONV", "G_TC_FILT", "G_TC_INVALID"
|
||||
};
|
||||
|
||||
static const char *TextureFilterText[] =
|
||||
{
|
||||
"G_TF_POINT", "G_TF_INVALID", "G_TF_BILERP", "G_TF_AVERAGE"
|
||||
};
|
||||
|
||||
static const char *TextureLUTText[] =
|
||||
{
|
||||
"G_TT_NONE", "G_TT_INVALID", "G_TT_RGBA16", "G_TT_IA16"
|
||||
};
|
||||
|
||||
static const char *TextureLODText[] =
|
||||
{
|
||||
"G_TL_TILE", "G_TL_LOD"
|
||||
};
|
||||
|
||||
static const char *TextureDetailText[] =
|
||||
{
|
||||
"G_TD_CLAMP", "G_TD_SHARPEN", "G_TD_DETAIL"
|
||||
};
|
||||
|
||||
static const char *TexturePerspText[] =
|
||||
{
|
||||
"G_TP_NONE", "G_TP_PERSP"
|
||||
};
|
||||
|
||||
static const char *CycleTypeText[] =
|
||||
{
|
||||
"G_CYC_1CYCLE", "G_CYC_2CYCLE", "G_CYC_COPY", "G_CYC_FILL"
|
||||
};
|
||||
|
||||
static const char *PipelineModeText[] =
|
||||
{
|
||||
"G_PM_NPRIMITIVE", "G_PM_1PRIMITIVE"
|
||||
};
|
||||
|
||||
static const char *CvgDestText[] =
|
||||
{
|
||||
"CVG_DST_CLAMP", "CVG_DST_WRAP", "CVG_DST_FULL", "CVG_DST_SAVE"
|
||||
};
|
||||
|
||||
static const char *DepthModeText[] =
|
||||
{
|
||||
"ZMODE_OPA", "ZMODE_INTER", "ZMODE_XLU", "ZMODE_DEC"
|
||||
};
|
||||
|
||||
static const char *ScissorModeText[] =
|
||||
{
|
||||
"G_SC_NON_INTERLACE", "G_SC_INVALID", "G_SC_EVEN_INTERLACE", "G_SC_ODD_INTERLACE"
|
||||
};
|
||||
|
||||
static const char *saRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "NOISE", "1",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0"
|
||||
};
|
||||
|
||||
static const char *sbRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "CENTER", "K4",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0"
|
||||
};
|
||||
|
||||
static const char *mRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "SCALE", "COMBINED_ALPHA",
|
||||
"TEXEL0_ALPHA", "TEXEL1_ALPHA", "PRIMITIVE_ALPHA", "SHADE_ALPHA",
|
||||
"ENV_ALPHA", "LOD_FRACTION", "PRIM_LOD_FRAC", "K5",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0"
|
||||
};
|
||||
|
||||
static const char *aRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
|
||||
static const char *saAText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
|
||||
static const char *sbAText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
|
||||
static const char *mAText[] =
|
||||
{
|
||||
"LOD_FRACTION", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "PRIM_LOD_FRAC", "0",
|
||||
};
|
||||
|
||||
static const char *aAText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#define DebugMsg(type, A, ...)
|
||||
#define DebugRSPState(A, ...)
|
||||
#define SwitchDump(A)
|
||||
|
||||
#endif // DEBUG_DUMP
|
||||
|
||||
#endif // DEBUG_H
|
|
@ -9,7 +9,7 @@
|
|||
#include "DepthBuffer.h"
|
||||
#include "VI.h"
|
||||
#include "Config.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include <Graphics/Context.h>
|
||||
#include <Graphics/Parameters.h>
|
||||
#include "DisplayWindow.h"
|
||||
|
@ -454,12 +454,6 @@ void DepthBufferList::saveBuffer(u32 _address)
|
|||
frameBufferList().attachDepthBuffer();
|
||||
if (pDepthBuffer->m_address != gDP.depthImageAddress)
|
||||
m_pCurrent = pCurrent;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "DepthBuffer_SetBuffer( 0x%08X ); color buffer is 0x%08X\n",
|
||||
address, ( pFrameBuffer != nullptr && pFrameBuffer->m_FBO > 0) ? pFrameBuffer->m_startAddress : 0
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DepthBufferList::clearBuffer(u32 _ulx, u32 _uly, u32 _lrx, u32 _lry)
|
||||
|
|
10
src/F3D.cpp
10
src/F3D.cpp
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "N64.h"
|
||||
#include "RSP.h"
|
||||
|
@ -16,9 +16,7 @@ void F3D_SPNoOp( u32 w0, u32 w1 )
|
|||
void F3D_Mtx( u32 w0, u32 w1 )
|
||||
{
|
||||
if (_SHIFTR( w0, 0, 16 ) != 64) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_MEDIUM | DEBUG_HIGH | DEBUG_ERROR, "G_MTX: address = 0x%08X length = %i params = 0x%02X\n", w1, _SHIFTR( w0, 0, 16 ), _SHIFTR( w0, 16, 8 ) );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "G_MTX: address = 0x%08X length = %i params = 0x%02X\n", w1, _SHIFTR(w0, 0, 16), _SHIFTR(w0, 16, 8));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,9 +25,7 @@ void F3D_Mtx( u32 w0, u32 w1 )
|
|||
|
||||
void F3D_Reserved0( u32 w0, u32 w1 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_MEDIUM | DEBUG_IGNORED | DEBUG_UNKNOWN, "G_RESERVED0: w0=0x%08lX w1=0x%08lX\n", w0, w1 );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_IGNORED, "G_RESERVED0: w0=0x%08lX w1=0x%08lX\n", w0, w1);
|
||||
}
|
||||
|
||||
void F3D_MoveMem( u32 w0, u32 w1 )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DEX.h"
|
||||
#include "F3DBETA.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DDKR.h"
|
||||
#include "N64.h"
|
||||
|
@ -12,9 +12,7 @@
|
|||
void F3DDKR_DMA_Mtx( u32 w0, u32 w1 )
|
||||
{
|
||||
if (_SHIFTR( w0, 0, 16 ) != 64) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_MEDIUM | DEBUG_HIGH | DEBUG_ERROR, "G_MTX: address = 0x%08X length = %i params = 0x%02X\n", w1, _SHIFTR( w0, 0, 16 ), _SHIFTR( w0, 16, 8 ) );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "G_MTX: address = 0x%08X length = %i params = 0x%02X\n", w1, _SHIFTR(w0, 0, 16), _SHIFTR(w0, 16, 8));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DEX.h"
|
||||
#include "N64.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DEX.h"
|
||||
#include "F3DEX2.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DEX.h"
|
||||
#include "F3DEX2.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <assert.h>
|
||||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DGOLDEN.h"
|
||||
#include "N64.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DGOLDEN.h"
|
||||
#include "F3DPD.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <assert.h>
|
||||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DSETA.h"
|
||||
#include "N64.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "Combiner.h"
|
||||
#include "Types.h"
|
||||
#include "Config.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "PostProcessor.h"
|
||||
#include "FrameBufferInfo.h"
|
||||
#include "Log.h"
|
||||
|
@ -635,11 +635,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
else
|
||||
attachDepthBuffer();
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "FrameBuffer_SaveBuffer( 0x%08X ); depth buffer is 0x%08X\n",
|
||||
address, (depthBuffer.top != nullptr && depthBuffer.top->renderbuf > 0) ? depthBuffer.top->address : 0
|
||||
);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "FrameBuffer_SaveBuffer( 0x%08X )\n", _address);
|
||||
|
||||
if (m_pCurrent->isAuxiliary() &&
|
||||
m_pCurrent->m_pDepthBuffer != nullptr &&
|
||||
|
|
11
src/GBI.cpp
11
src/GBI.cpp
|
@ -29,7 +29,7 @@
|
|||
#include "ZSort.h"
|
||||
#include "CRC.h"
|
||||
#include "Log.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "Graphics/Context.h"
|
||||
#include "Graphics/Parameters.h"
|
||||
|
||||
|
@ -114,14 +114,7 @@ GBIInfo GBI;
|
|||
|
||||
void GBI_Unknown( u32 w0, u32 w1 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (Debug.level == DEBUG_LOW)
|
||||
DebugMsg( DEBUG_LOW | DEBUG_UNKNOWN, "UNKNOWN GBI COMMAND 0x%02X", _SHIFTR( w0, 24, 8 ) );
|
||||
if (Debug.level == DEBUG_MEDIUM)
|
||||
DebugMsg( DEBUG_MEDIUM | DEBUG_UNKNOWN, "Unknown GBI Command 0x%02X", _SHIFTR( w0, 24, 8 ) );
|
||||
else if (Debug.level == DEBUG_HIGH)
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_UNKNOWN, "// Unknown GBI Command 0x%02X", _SHIFTR( w0, 24, 8 ) );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "UNKNOWN GBI COMMAND 0x%02X", _SHIFTR(w0, 24, 8));
|
||||
}
|
||||
|
||||
void GBIInfo::init()
|
||||
|
|
198
src/GBI.h
198
src/GBI.h
|
@ -177,24 +177,6 @@
|
|||
#define G_MWO_POINT_XYSCREEN 0x18
|
||||
#define G_MWO_POINT_ZSCREEN 0x1C
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char *MWOPointText[] =
|
||||
{
|
||||
"G_MWO_POINT_RGBA",
|
||||
"G_MWO_POINT_ST",
|
||||
"G_MWO_POINT_XYSCREEN",
|
||||
"G_MWO_POINT_ZSCREEN"
|
||||
};
|
||||
|
||||
static const char *MWOMatrixText[] =
|
||||
{
|
||||
"G_MWO_MATRIX_XX_XY_I", "G_MWO_MATRIX_XZ_XW_I", "G_MWO_MATRIX_YX_YY_I", "G_MWO_MATRIX_YZ_YW_I",
|
||||
"G_MWO_MATRIX_ZX_ZY_I", "G_MWO_MATRIX_ZZ_ZW_I", "G_MWO_MATRIX_WX_WY_I", "G_MWO_MATRIX_WZ_WW_I",
|
||||
"G_MWO_MATRIX_XX_XY_F", "G_MWO_MATRIX_XZ_XW_F", "G_MWO_MATRIX_YX_YY_F", "G_MWO_MATRIX_YZ_YW_F",
|
||||
"G_MWO_MATRIX_ZX_ZY_F", "G_MWO_MATRIX_ZZ_ZW_F", "G_MWO_MATRIX_WX_WY_F", "G_MWO_MATRIX_WZ_WW_F"
|
||||
};
|
||||
#endif
|
||||
|
||||
// These flags change between ucodes
|
||||
extern u32 G_MTX_STACKSIZE;
|
||||
|
||||
|
@ -240,36 +222,6 @@ extern u32 G_MWO_aLIGHT_8, G_MWO_bLIGHT_8;
|
|||
#define G_TX_MIRROR 0x1
|
||||
#define G_TX_CLAMP 0x2
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char *ImageFormatText[] =
|
||||
{
|
||||
"G_IM_FMT_RGBA",
|
||||
"G_IM_FMT_YUV",
|
||||
"G_IM_FMT_CI",
|
||||
"G_IM_FMT_IA",
|
||||
"G_IM_FMT_I",
|
||||
"G_IM_FMT_INVALID",
|
||||
"G_IM_FMT_INVALID",
|
||||
"G_IM_FMT_INVALID"
|
||||
};
|
||||
|
||||
static const char *ImageSizeText[] =
|
||||
{
|
||||
"G_IM_SIZ_4b",
|
||||
"G_IM_SIZ_8b",
|
||||
"G_IM_SIZ_16b",
|
||||
"G_IM_SIZ_32b"
|
||||
};
|
||||
|
||||
static const char *SegmentText[] =
|
||||
{
|
||||
"G_MWO_SEGMENT_0", "G_MWO_SEGMENT_1", "G_MWO_SEGMENT_2", "G_MWO_SEGMENT_3",
|
||||
"G_MWO_SEGMENT_4", "G_MWO_SEGMENT_5", "G_MWO_SEGMENT_6", "G_MWO_SEGMENT_7",
|
||||
"G_MWO_SEGMENT_8", "G_MWO_SEGMENT_9", "G_MWO_SEGMENT_A", "G_MWO_SEGMENT_B",
|
||||
"G_MWO_SEGMENT_C", "G_MWO_SEGMENT_D", "G_MWO_SEGMENT_E", "G_MWO_SEGMENT_F"
|
||||
};
|
||||
#endif
|
||||
|
||||
#define G_NOOP 0x00
|
||||
|
||||
#define G_IMMFIRST -65
|
||||
|
@ -428,156 +380,6 @@ static const char *SegmentText[] =
|
|||
#define G_SC_EVEN_INTERLACE 2
|
||||
#define G_SC_ODD_INTERLACE 3
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char *AAEnableText = "AA_EN";
|
||||
static const char *DepthCompareText = "Z_CMP";
|
||||
static const char *DepthUpdateText = "Z_UPD";
|
||||
static const char *ClearOnCvgText = "CLR_ON_CVG";
|
||||
static const char *CvgXAlphaText = "CVG_X_ALPHA";
|
||||
static const char *AlphaCvgSelText = "ALPHA_CVG_SEL";
|
||||
static const char *ForceBlenderText = "FORCE_BL";
|
||||
|
||||
static const char *AlphaCompareText[] =
|
||||
{
|
||||
"G_AC_NONE", "G_AC_THRESHOLD", "G_AC_INVALID", "G_AC_DITHER"
|
||||
};
|
||||
|
||||
static const char *DepthSourceText[] =
|
||||
{
|
||||
"G_ZS_PIXEL", "G_ZS_PRIM"
|
||||
};
|
||||
|
||||
static const char *AlphaDitherText[] =
|
||||
{
|
||||
"G_AD_PATTERN", "G_AD_NOTPATTERN", "G_AD_NOISE", "G_AD_DISABLE"
|
||||
};
|
||||
|
||||
static const char *ColorDitherText[] =
|
||||
{
|
||||
"G_CD_MAGICSQ", "G_CD_BAYER", "G_CD_NOISE", "G_CD_DISABLE"
|
||||
};
|
||||
|
||||
static const char *CombineKeyText[] =
|
||||
{
|
||||
"G_CK_NONE", "G_CK_KEY"
|
||||
};
|
||||
|
||||
static const char *TextureConvertText[] =
|
||||
{
|
||||
"G_TC_CONV", "G_TC_INVALID", "G_TC_INVALID", "G_TC_INVALID", "G_TC_INVALID", "G_TC_FILTCONV", "G_TC_FILT", "G_TC_INVALID"
|
||||
};
|
||||
|
||||
static const char *TextureFilterText[] =
|
||||
{
|
||||
"G_TF_POINT", "G_TF_INVALID", "G_TF_BILERP", "G_TF_AVERAGE"
|
||||
};
|
||||
|
||||
static const char *TextureLUTText[] =
|
||||
{
|
||||
"G_TT_NONE", "G_TT_INVALID", "G_TT_RGBA16", "G_TT_IA16"
|
||||
};
|
||||
|
||||
static const char *TextureLODText[] =
|
||||
{
|
||||
"G_TL_TILE", "G_TL_LOD"
|
||||
};
|
||||
|
||||
static const char *TextureDetailText[] =
|
||||
{
|
||||
"G_TD_CLAMP", "G_TD_SHARPEN", "G_TD_DETAIL"
|
||||
};
|
||||
|
||||
static const char *TexturePerspText[] =
|
||||
{
|
||||
"G_TP_NONE", "G_TP_PERSP"
|
||||
};
|
||||
|
||||
static const char *CycleTypeText[] =
|
||||
{
|
||||
"G_CYC_1CYCLE", "G_CYC_2CYCLE", "G_CYC_COPY", "G_CYC_FILL"
|
||||
};
|
||||
|
||||
static const char *PipelineModeText[] =
|
||||
{
|
||||
"G_PM_NPRIMITIVE", "G_PM_1PRIMITIVE"
|
||||
};
|
||||
|
||||
static const char *CvgDestText[] =
|
||||
{
|
||||
"CVG_DST_CLAMP", "CVG_DST_WRAP", "CVG_DST_FULL", "CVG_DST_SAVE"
|
||||
};
|
||||
|
||||
static const char *DepthModeText[] =
|
||||
{
|
||||
"ZMODE_OPA", "ZMODE_INTER", "ZMODE_XLU", "ZMODE_DEC"
|
||||
};
|
||||
|
||||
static const char *ScissorModeText[] =
|
||||
{
|
||||
"G_SC_NON_INTERLACE", "G_SC_INVALID", "G_SC_EVEN_INTERLACE", "G_SC_ODD_INTERLACE"
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char *saRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "NOISE", "1",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0"
|
||||
};
|
||||
|
||||
static const char *sbRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "CENTER", "K4",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0"
|
||||
};
|
||||
|
||||
static const char *mRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "SCALE", "COMBINED_ALPHA",
|
||||
"TEXEL0_ALPHA", "TEXEL1_ALPHA", "PRIMITIVE_ALPHA", "SHADE_ALPHA",
|
||||
"ENV_ALPHA", "LOD_FRACTION", "PRIM_LOD_FRAC", "K5",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0",
|
||||
"0", "0", "0", "0"
|
||||
};
|
||||
|
||||
static const char *aRGBText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
|
||||
static const char *saAText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
|
||||
static const char *sbAText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
|
||||
static const char *mAText[] =
|
||||
{
|
||||
"LOD_FRACTION", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "PRIM_LOD_FRAC", "0",
|
||||
};
|
||||
|
||||
static const char *aAText[] =
|
||||
{
|
||||
"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE",
|
||||
"SHADE", "ENVIRONMENT", "1", "0",
|
||||
};
|
||||
#endif
|
||||
|
||||
extern u32 G_RDPHALF_1, G_RDPHALF_2, G_RDPHALF_CONT;
|
||||
extern u32 G_SPNOOP;
|
||||
extern u32 G_SETOTHERMODE_H, G_SETOTHERMODE_L;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "L3D.h"
|
||||
#include "N64.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DEX.h"
|
||||
#include "L3D.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DEX.h"
|
||||
#include "F3DEX2.h"
|
||||
|
|
16
src/RDP.cpp
16
src/RDP.cpp
|
@ -8,15 +8,13 @@
|
|||
#include "gDP.h"
|
||||
#include "gSP.h"
|
||||
#include "Config.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "DisplayWindow.h"
|
||||
|
||||
void RDP_Unknown( u32 w0, u32 w1 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_UNKNOWN, "RDP_Unknown\r\n" );
|
||||
DebugMsg( DEBUG_UNKNOWN, "\tUnknown RDP opcode %02X\r\n", _SHIFTR( w0, 24, 8 ) );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "RDP_Unknown\r\n");
|
||||
DebugMsg(DEBUG_NORMAL, "\tUnknown RDP opcode %02X\r\n", _SHIFTR(w0, 24, 8));
|
||||
}
|
||||
|
||||
void RDP_NoOp( u32 w0, u32 w1 )
|
||||
|
@ -505,7 +503,7 @@ void RDP_Half_1( u32 _c )
|
|||
u32 w0 = 0, w1 = _c;
|
||||
u32 cmd = _SHIFTR( _c, 24, 8 );
|
||||
if (cmd >= 0xc8 && cmd <=0xcf) {//triangle command
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPHalf_1 LLE Triangle\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gDPHalf_1 LLE Triangle\n");
|
||||
RDP.cmd_ptr = 0;
|
||||
RDP.cmd_cur = 0;
|
||||
do {
|
||||
|
@ -516,8 +514,8 @@ void RDP_Half_1( u32 _c )
|
|||
w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4];
|
||||
RSP.cmd = _SHIFTR( w0, 24, 8 );
|
||||
|
||||
DebugRSPState( RSP.PCi, RSP.PC[RSP.PCi], _SHIFTR( w0, 24, 8 ), w0, w1 );
|
||||
DebugMsg( DEBUG_LOW | DEBUG_HANDLED, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR( w0, 24, 8 ), w0, w1 );
|
||||
//DebugRSPState( RSP.PCi, RSP.PC[RSP.PCi], _SHIFTR( w0, 24, 8 ), w0, w1 );
|
||||
DebugMsg(DEBUG_NORMAL, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR(w0, 24, 8), w0, w1);
|
||||
|
||||
RSP.PC[RSP.PCi] += 8;
|
||||
// RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[RSP.PC[RSP.PCi]], 24, 8 );
|
||||
|
@ -528,7 +526,7 @@ void RDP_Half_1( u32 _c )
|
|||
w1 = RDP.cmd_data[RDP.cmd_cur+1];
|
||||
LLEcmd[RSP.cmd](w0, w1);
|
||||
} else {
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_IGNORED, "gDPHalf_1()\n" );
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_IGNORED, "gDPHalf_1()\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
25
src/RSP.cpp
25
src/RSP.cpp
|
@ -1,6 +1,6 @@
|
|||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "RSP.h"
|
||||
#include "RDP.h"
|
||||
#include "N64.h"
|
||||
|
@ -29,7 +29,7 @@ void RSP_CheckDLCounter()
|
|||
if (RSP.count == 0) {
|
||||
RSP.count = -1;
|
||||
--RSP.PCi;
|
||||
DebugMsg( DEBUG_LOW | DEBUG_HANDLED, "End of DL\n" );
|
||||
DebugMsg(DEBUG_NORMAL, "End of DL\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,20 +81,7 @@ void RSP_ProcessDList()
|
|||
default:
|
||||
while (!RSP.halt) {
|
||||
if ((RSP.PC[RSP.PCi] + 8) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
switch (Debug.level)
|
||||
{
|
||||
case DEBUG_LOW:
|
||||
DebugMsg( DEBUG_LOW | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n" );
|
||||
break;
|
||||
case DEBUG_MEDIUM:
|
||||
DebugMsg( DEBUG_MEDIUM | DEBUG_ERROR, "Attempting to execute RSP command at invalid RDRAM location\n" );
|
||||
break;
|
||||
case DEBUG_HIGH:
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to execute RSP command at invalid RDRAM location\n" );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -102,10 +89,8 @@ void RSP_ProcessDList()
|
|||
RSP.w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4];
|
||||
RSP.cmd = _SHIFTR(RSP.w0, 24, 8);
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugRSPState( RSP.PCi, RSP.PC[RSP.PCi], _SHIFTR( RSP.w0, 24, 8 ), RSP.w0, RSP.w1 );
|
||||
DebugMsg( DEBUG_LOW | DEBUG_HANDLED, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR( RSP.w0, 24, 8 ), RSP.w0, RSP.w1 );
|
||||
#endif
|
||||
// DebugRSPState( RSP.PCi, RSP.PC[RSP.PCi], _SHIFTR( RSP.w0, 24, 8 ), RSP.w0, RSP.w1 );
|
||||
// DebugMsg( DEBUG_LOW | DEBUG_HANDLED, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR( RSP.w0, 24, 8 ), RSP.w0, RSP.w1 );
|
||||
|
||||
RSP.PC[RSP.PCi] += 8;
|
||||
u32 pci = RSP.PCi;
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "FrameBufferInfo.h"
|
||||
#include "Config.h"
|
||||
#include "Performance.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "Keys.h"
|
||||
#include "DisplayWindow.h"
|
||||
#include <Graphics/Context.h>
|
||||
|
||||
|
@ -115,6 +116,10 @@ void VI_UpdateScreen()
|
|||
return;
|
||||
wnd.saveScreenshot();
|
||||
|
||||
if (isKeyPressed(G64_VK_G, 0x0001)) {
|
||||
SwitchDump(DEBUG_NORMAL);
|
||||
}
|
||||
|
||||
bool bVIUpdated = false;
|
||||
if (*REG.VI_ORIGIN != VI.lastOrigin) {
|
||||
VI_UpdateSize();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <RDP.h>
|
||||
#include <VI.h>
|
||||
#include <Config.h>
|
||||
#include <Debug.h>
|
||||
#include <FrameBufferInfo.h>
|
||||
#include <TextureFilterHandler.h>
|
||||
#include <Log.h>
|
||||
|
@ -188,10 +187,6 @@ void PluginAPI::RomClosed()
|
|||
dwnd().stop();
|
||||
GBI.destroy();
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
CloseDebugDlg();
|
||||
#endif
|
||||
}
|
||||
|
||||
void PluginAPI::RomOpen()
|
||||
|
@ -209,10 +204,6 @@ void PluginAPI::RomOpen()
|
|||
Config_LoadConfig();
|
||||
dwnd().start();
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
OpenDebugDlg();
|
||||
#endif
|
||||
}
|
||||
|
||||
void PluginAPI::ShowCFB()
|
||||
|
|
154
src/gDP.cpp
154
src/gDP.cpp
|
@ -9,7 +9,7 @@
|
|||
#include "gDP.h"
|
||||
#include "gSP.h"
|
||||
#include "Types.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "convert.h"
|
||||
#include "CRC.h"
|
||||
#include "FrameBuffer.h"
|
||||
|
@ -34,8 +34,8 @@ void gDPSetOtherMode( u32 mode0, u32 mode1 )
|
|||
|
||||
gDP.changed |= CHANGED_RENDERMODE | CHANGED_CYCLETYPE | CHANGED_ALPHACOMPARE;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetOtherMode( %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s, %s | %s | %s%s%s%s%s | %s | %s%s%s );\n",
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetOtherMode( %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s, %s | %s | %s%s%s%s%s | %s | %s%s%s );\n",
|
||||
AlphaDitherText[gDP.otherMode.alphaDither],
|
||||
ColorDitherText[gDP.otherMode.colorDither],
|
||||
CombineKeyText[gDP.otherMode.combineKey],
|
||||
|
@ -69,20 +69,15 @@ void gDPSetPrimDepth( u16 z, u16 dz )
|
|||
gDP.primDepth.z = min(1.0f, max(-1.0f, (_FIXED2FLOAT(_SHIFTR(z, 0, 15), 15) - gSP.viewport.vtrans[2]) / gSP.viewport.vscale[2]));
|
||||
gDP.primDepth.deltaZ = _FIXED2FLOAT(_SHIFTR(dz, 0, 15), 15);
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetPrimDepth( %f, %f );\n",
|
||||
gDP.primDepth.z,
|
||||
gDP.primDepth.deltaZ);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetPrimDepth( %f, %f );\n", gDP.primDepth.z, gDP.primDepth.deltaZ);
|
||||
}
|
||||
|
||||
void gDPSetTexturePersp( u32 enable )
|
||||
{
|
||||
gDP.otherMode.texturePersp = enable & 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTexturePersp( %s );\n",
|
||||
TexturePerspText[gDP.otherMode.texturePersp] );
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetTexturePersp( %s );\n", TexturePerspText[gDP.otherMode.texturePersp] );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -90,9 +85,8 @@ void gDPSetTextureLUT( u32 mode )
|
|||
{
|
||||
gDP.otherMode.textureLUT = mode & 3;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTextureLUT( %s );\n",
|
||||
TextureLUTText[gDP.otherMode.textureLUT] );
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetTextureLUT( %s );\n", TextureLUTText[gDP.otherMode.textureLUT] );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -103,8 +97,8 @@ void gDPSetCombine( s32 muxs0, s32 muxs1 )
|
|||
|
||||
gDP.changed |= CHANGED_COMBINE;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_COMBINE, "gDPSetCombine( %s, %s, %s, %s, %s, %s, %s, %s,\n",
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetCombine( %s, %s, %s, %s, %s, %s, %s, %s,\n",
|
||||
saRGBText[gDP.combine.saRGB0],
|
||||
sbRGBText[gDP.combine.sbRGB0],
|
||||
mRGBText[gDP.combine.mRGB0],
|
||||
|
@ -114,7 +108,7 @@ void gDPSetCombine( s32 muxs0, s32 muxs1 )
|
|||
mAText[gDP.combine.mA0],
|
||||
aAText[gDP.combine.aA0] );
|
||||
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_COMBINE, " %s, %s, %s, %s, %s, %s, %s, %s );\n",
|
||||
DebugMsg( DEBUG_NORMAL, " %s, %s, %s, %s, %s, %s, %s, %s );\n",
|
||||
saRGBText[gDP.combine.saRGB1],
|
||||
sbRGBText[gDP.combine.sbRGB1],
|
||||
mRGBText[gDP.combine.mRGB1],
|
||||
|
@ -141,8 +135,8 @@ void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address )
|
|||
gDP.colorImage.height = 0;
|
||||
gDP.colorImage.address = address;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetColorImage( %s, %s, %i, 0x%08X );\n",
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetColorImage( %s, %s, %i, 0x%08X );\n",
|
||||
ImageFormatText[gDP.colorImage.format],
|
||||
ImageSizeText[gDP.colorImage.size],
|
||||
gDP.colorImage.width,
|
||||
|
@ -168,8 +162,8 @@ void gDPSetTextureImage(u32 format, u32 size, u32 width, u32 address)
|
|||
gSP.DMAOffsets.tex_count = 0;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTextureImage( %s, %s, %i, 0x%08X );\n",
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetTextureImage( %s, %s, %i, 0x%08X );\n",
|
||||
ImageFormatText[gDP.textureImage.format],
|
||||
ImageSizeText[gDP.textureImage.size],
|
||||
gDP.textureImage.width,
|
||||
|
@ -183,9 +177,7 @@ void gDPSetDepthImage( u32 address )
|
|||
gDP.depthImageAddress = address;
|
||||
depthBufferList().saveBuffer(address);
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetDepthImage( 0x%08X );\n", gDP.depthImageAddress );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetDepthImage( 0x%08X );\n", gDP.depthImageAddress );
|
||||
}
|
||||
|
||||
void gDPSetEnvColor( u32 r, u32 g, u32 b, u32 a )
|
||||
|
@ -195,10 +187,7 @@ void gDPSetEnvColor( u32 r, u32 g, u32 b, u32 a )
|
|||
gDP.envColor.b = b * 0.0039215689f;
|
||||
gDP.envColor.a = a * 0.0039215689f;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_COMBINE, "gDPSetEnvColor( %i, %i, %i, %i );\n",
|
||||
r, g, b, a );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetEnvColor( %i, %i, %i, %i );\n", r, g, b, a );
|
||||
}
|
||||
|
||||
void gDPSetBlendColor( u32 r, u32 g, u32 b, u32 a )
|
||||
|
@ -209,10 +198,8 @@ void gDPSetBlendColor( u32 r, u32 g, u32 b, u32 a )
|
|||
gDP.blendColor.a = a * 0.0039215689f;
|
||||
|
||||
gDP.changed |= CHANGED_BLENDCOLOR;
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetBlendColor( %i, %i, %i, %i );\n",
|
||||
r, g, b, a );
|
||||
#endif
|
||||
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetBlendColor( %i, %i, %i, %i );\n", r, g, b, a );
|
||||
}
|
||||
|
||||
void gDPSetFogColor( u32 r, u32 g, u32 b, u32 a )
|
||||
|
@ -224,10 +211,7 @@ void gDPSetFogColor( u32 r, u32 g, u32 b, u32 a )
|
|||
|
||||
gDP.changed |= CHANGED_FOGCOLOR;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetFogColor( %i, %i, %i, %i );\n",
|
||||
r, g, b, a );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetFogColor( %i, %i, %i, %i );\n", r, g, b, a );
|
||||
}
|
||||
|
||||
void gDPSetFillColor( u32 c )
|
||||
|
@ -236,9 +220,7 @@ void gDPSetFillColor( u32 c )
|
|||
gDP.fillColor.z = (f32)_SHIFTR( c, 2, 14 );
|
||||
gDP.fillColor.dz = (f32)_SHIFTR( c, 0, 2 );
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetFillColor( 0x%08X );\n", c );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetFillColor( 0x%08X );\n", c );
|
||||
}
|
||||
|
||||
void gDPGetFillColor(f32 _fillColor[4])
|
||||
|
@ -266,10 +248,7 @@ void gDPSetPrimColor( u32 m, u32 l, u32 r, u32 g, u32 b, u32 a )
|
|||
gDP.primColor.b = b * 0.0039215689f;
|
||||
gDP.primColor.a = a * 0.0039215689f;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_COMBINE, "gDPSetPrimColor( %i, %i, %i, %i, %i, %i );\n",
|
||||
m, l, r, g, b, a );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetPrimColor( %i, %i, %i, %i, %i, %i );\n", m, l, r, g, b, a );
|
||||
}
|
||||
|
||||
void gDPSetTile( u32 format, u32 size, u32 line, u32 tmem, u32 tile, u32 palette, u32 cmt, u32 cms, u32 maskt, u32 masks, u32 shiftt, u32 shifts )
|
||||
|
@ -303,8 +282,8 @@ void gDPSetTile( u32 format, u32 size, u32 line, u32 tmem, u32 tile, u32 palette
|
|||
|
||||
gDP.changed |= CHANGED_TILE;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTile( %s, %s, %i, %i, %i, %i, %s%s, %s%s, %i, %i, %i, %i );\n",
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetTile( %s, %s, %i, %i, %i, %i, %s%s, %s%s, %i, %i, %i, %i );\n",
|
||||
ImageFormatText[format],
|
||||
ImageSizeText[size],
|
||||
line,
|
||||
|
@ -337,14 +316,12 @@ void gDPSetTileSize( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt )
|
|||
|
||||
gDP.changed |= CHANGED_TILE;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTileSize( %i, %.2f, %.2f, %.2f, %.2f );\n",
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetTileSize( %i, %.2f, %.2f, %.2f, %.2f );\n",
|
||||
tile,
|
||||
gDP.tiles[tile].fuls,
|
||||
gDP.tiles[tile].fult,
|
||||
gDP.tiles[tile].flrs,
|
||||
gDP.tiles[tile].flrt );
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -503,10 +480,9 @@ void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt)
|
|||
tmemAddr += line;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPLoadTile( %i, %i, %i, %i, %i );\n",
|
||||
|
||||
DebugMsg( DEBUG_NORMAL, "gDPLoadTile( %i, %i, %i, %i, %i );\n",
|
||||
tile, gDP.loadTile->uls, gDP.loadTile->ult, gDP.loadTile->lrs, gDP.loadTile->lrt );
|
||||
#endif
|
||||
}
|
||||
|
||||
//****************************************************************
|
||||
|
@ -593,11 +569,8 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
|
|||
u32 address = gDP.textureImage.address + ult * gDP.textureImage.bpl + (uls << gDP.textureImage.size >> 1);
|
||||
|
||||
if (bytes == 0 || (address + bytes) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR | DEBUG_TEXTURE, "// Attempting to load texture block out of range\n" );
|
||||
DebugMsg(DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPLoadBlock( %i, %i, %i, %i, %i );\n",
|
||||
tile, uls, ult, lrs, dxt );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load texture block out of range\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gDPLoadBlock( %i, %i, %i, %i, %i );\n", tile, uls, ult, lrs, dxt );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -638,10 +611,8 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
|
|||
DWordInterleaveWrap((u32*)TMEM, tmemAddr << 1, 0x3FF, line);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPLoadBlock( %i, %i, %i, %i, %i );\n",
|
||||
tile, uls, ult, lrs, dxt );
|
||||
#endif
|
||||
|
||||
DebugMsg( DEBUG_NORMAL, "gDPLoadBlock( %i, %i, %i, %i, %i );\n", tile, uls, ult, lrs, dxt );
|
||||
}
|
||||
|
||||
void gDPLoadTLUT( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt )
|
||||
|
@ -676,10 +647,8 @@ void gDPLoadTLUT( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt )
|
|||
|
||||
gDP.changed |= CHANGED_TMEM;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPLoadTLUT( %i, %i, %i, %i, %i );\n",
|
||||
DebugMsg( DEBUG_NORMAL, "gDPLoadTLUT( %i, %i, %i, %i, %i );\n",
|
||||
tile, gDP.tiles[tile].uls, gDP.tiles[tile].ult, gDP.tiles[tile].lrs, gDP.tiles[tile].lrt );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gDPSetScissor( u32 mode, f32 ulx, f32 uly, f32 lrx, f32 lry )
|
||||
|
@ -703,8 +672,8 @@ void gDPSetScissor( u32 mode, f32 ulx, f32 uly, f32 lrx, f32 lry )
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_IGNORED, "gDPSetScissor( %s, %.2f, %.2f, %.2f, %.2f );\n",
|
||||
#ifdef DEBUG_DUMP
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetScissor( %s, %.2f, %.2f, %.2f, %.2f );\n",
|
||||
ScissorModeText[gDP.scissor.mode],
|
||||
gDP.scissor.ulx,
|
||||
gDP.scissor.uly,
|
||||
|
@ -780,10 +749,7 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry )
|
|||
|
||||
frameBufferList().setBufferChanged(lry);
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPFillRectangle( %i, %i, %i, %i );\n",
|
||||
ulx, uly, lrx, lry );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPFillRectangle( %i, %i, %i, %i );\n", ulx, uly, lrx, lry );
|
||||
}
|
||||
|
||||
void gDPSetConvert( s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5 )
|
||||
|
@ -798,6 +764,8 @@ void gDPSetConvert( s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5 )
|
|||
gDP.convert.k3 = SIGN(k3, 9);
|
||||
gDP.convert.k4 = SIGN(k4, 9);
|
||||
gDP.convert.k5 = SIGN(k5, 9);
|
||||
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetConvert( %i, %i, %i, %i, %i, %i );\n", k0, k1, k2, k3, k4, k5);
|
||||
}
|
||||
|
||||
void gDPSetKeyR( u32 cR, u32 sR, u32 wR )
|
||||
|
@ -805,6 +773,7 @@ void gDPSetKeyR( u32 cR, u32 sR, u32 wR )
|
|||
gDP.key.center.r = cR * 0.0039215689f;
|
||||
gDP.key.scale.r = sR * 0.0039215689f;
|
||||
gDP.key.width.r = wR * 0.0039215689f;
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetKeyR( %u, %u, %u );\n", cR, sR, wR );
|
||||
}
|
||||
|
||||
void gDPSetKeyGB(u32 cG, u32 sG, u32 wG, u32 cB, u32 sB, u32 wB )
|
||||
|
@ -815,6 +784,8 @@ void gDPSetKeyGB(u32 cG, u32 sG, u32 wG, u32 cB, u32 sB, u32 wB )
|
|||
gDP.key.center.b = cB * 0.0039215689f;
|
||||
gDP.key.scale.b = sB * 0.0039215689f;
|
||||
gDP.key.width.b = wB * 0.0039215689f;
|
||||
DebugMsg( DEBUG_NORMAL, "gDPSetKeyGB( %u, %u, %u, %u, %u, %u );\n",
|
||||
cG, sG, wG, cB, sB, wB );
|
||||
}
|
||||
|
||||
void gDPTextureRectangle(f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f32 t, f32 dsdx, f32 dtdy , bool flip)
|
||||
|
@ -863,14 +834,12 @@ void gDPTextureRectangle(f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f3
|
|||
|
||||
frameBufferList().setBufferChanged(lry);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (flip)
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPTextureRectangleFlip( %f, %f, %f, %f, %i, %f, %f, %f, %f);\n",
|
||||
DebugMsg( DEBUG_NORMAL, "gDPTextureRectangleFlip( %f, %f, %f, %f, %i, %f, %f, %f, %f);\n",
|
||||
ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy );
|
||||
else
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPTextureRectangle( %f, %f, %f, %f, %i, %i, %f, %f, %f, %f );\n",
|
||||
DebugMsg( DEBUG_NORMAL, "gDPTextureRectangle( %f, %f, %f, %f, %i, %i, %f, %f, %f, %f );\n",
|
||||
ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gDPFullSync()
|
||||
|
@ -901,37 +870,27 @@ void gDPFullSync()
|
|||
|
||||
CheckInterrupts();
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPFullSync();\n" );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "gDPFullSync();\n" );
|
||||
}
|
||||
|
||||
void gDPTileSync()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_IGNORED | DEBUG_TEXTURE, "gDPTileSync();\n" );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPTileSync();\n" );
|
||||
}
|
||||
|
||||
void gDPPipeSync()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_IGNORED, "gDPPipeSync();\n" );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPPipeSync();\n" );
|
||||
}
|
||||
|
||||
void gDPLoadSync()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_IGNORED, "gDPLoadSync();\n" );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPLoadSync();\n" );
|
||||
}
|
||||
|
||||
void gDPNoOp()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_IGNORED, "gDPNoOp();\n" );
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPNoOp();\n" );
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
|
@ -1236,6 +1195,9 @@ void gDPLLETriangle(u32 _w1, u32 _w2, int _shade, int _texture, int _zbuffer, u3
|
|||
drawer.drawScreenSpaceTriangle(vtx - vtx0);
|
||||
gSP.textureTile[0] = textureTileOrg[0];
|
||||
gSP.textureTile[1] = textureTileOrg[1];
|
||||
|
||||
DebugMsg( DEBUG_NORMAL, "gDPLLETriangle(%08x, %08x) shade: %d, texture: %d, zbuffer: %d\n",
|
||||
_w1, _w2, _shade, _texture, _zbuffer);
|
||||
}
|
||||
|
||||
static void gDPTriangle(u32 _w1, u32 _w2, int shade, int texture, int zbuffer)
|
||||
|
@ -1246,47 +1208,47 @@ static void gDPTriangle(u32 _w1, u32 _w2, int shade, int texture, int zbuffer)
|
|||
void gDPTriFill(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 0, 0, 0);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "trifill\n");
|
||||
DebugMsg( DEBUG_NORMAL, "trifill\n");
|
||||
}
|
||||
|
||||
void gDPTriShade(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 1, 0, 0);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "trishade\n");
|
||||
DebugMsg( DEBUG_NORMAL, "trishade\n");
|
||||
}
|
||||
|
||||
void gDPTriTxtr(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 0, 1, 0);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "tritxtr\n");
|
||||
DebugMsg( DEBUG_NORMAL, "tritxtr\n");
|
||||
}
|
||||
|
||||
void gDPTriShadeTxtr(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 1, 1, 0);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "trishadetxtr\n");
|
||||
DebugMsg( DEBUG_NORMAL, "trishadetxtr\n");
|
||||
}
|
||||
|
||||
void gDPTriFillZ(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 0, 0, 1);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "trifillz\n");
|
||||
DebugMsg( DEBUG_NORMAL, "trifillz\n");
|
||||
}
|
||||
|
||||
void gDPTriShadeZ(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 1, 0, 1);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "trishadez\n");
|
||||
DebugMsg( DEBUG_NORMAL, "trishadez\n");
|
||||
}
|
||||
|
||||
void gDPTriTxtrZ(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 0, 1, 1);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "tritxtrz\n");
|
||||
DebugMsg( DEBUG_NORMAL, "tritxtrz\n");
|
||||
}
|
||||
|
||||
void gDPTriShadeTxtrZ(u32 w0, u32 w1)
|
||||
{
|
||||
gDPTriangle(w0, w1, 1, 1, 1);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "trishadetxtrz\n");
|
||||
DebugMsg( DEBUG_NORMAL, "trishadetxtrz\n");
|
||||
}
|
||||
|
|
359
src/gSP.cpp
359
src/gSP.cpp
|
@ -4,7 +4,7 @@
|
|||
#include <assert.h>
|
||||
#include "N64.h"
|
||||
#include "GLideN64.h"
|
||||
#include "Debug.h"
|
||||
#include "DebugDump.h"
|
||||
#include "Types.h"
|
||||
#include "RSP.h"
|
||||
#include "GBI.h"
|
||||
|
@ -639,9 +639,7 @@ void gSPLoadUcodeEx( u32 uc_start, u32 uc_dstart, u16 uc_dsize )
|
|||
void gSPNoOp()
|
||||
{
|
||||
gSPFlushTriangles();
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_IGNORED, "gSPNoOp();\n" );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_IGNORED, "gSPNoOp();\n");
|
||||
}
|
||||
|
||||
void gSPMatrix( u32 matrix, u8 param )
|
||||
|
@ -651,14 +649,12 @@ void gSPMatrix( u32 matrix, u8 param )
|
|||
u32 address = RSP_SegmentToPhysical( matrix );
|
||||
|
||||
if (address + 64 > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR | DEBUG_MATRIX, "// Attempting to load matrix from invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPMatrix( 0x%08X, %s | %s | %s );\n",
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load matrix from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPMatrix( 0x%08X, %s | %s | %s );\n",
|
||||
matrix,
|
||||
(param & G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_MODELVIEW",
|
||||
(param & G_MTX_LOAD) ? "G_MTX_LOAD" : "G_MTX_MUL",
|
||||
(param & G_MTX_PUSH) ? "G_MTX_PUSH" : "G_MTX_NOPUSH" );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -673,11 +669,8 @@ void gSPMatrix( u32 matrix, u8 param )
|
|||
if ((param & G_MTX_PUSH) && (gSP.matrix.modelViewi < (gSP.matrix.stackSize))) {
|
||||
CopyMatrix( gSP.matrix.modelView[gSP.matrix.modelViewi + 1], gSP.matrix.modelView[gSP.matrix.modelViewi] );
|
||||
gSP.matrix.modelViewi++;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DebugMsg( DEBUG_ERROR | DEBUG_MATRIX, "// Modelview stack overflow\n" );
|
||||
#endif
|
||||
} else
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Modelview stack overflow\n");
|
||||
|
||||
if (param & G_MTX_LOAD)
|
||||
CopyMatrix( gSP.matrix.modelView[gSP.matrix.modelViewi], mtx );
|
||||
|
@ -688,21 +681,19 @@ void gSPMatrix( u32 matrix, u8 param )
|
|||
|
||||
gSP.changed |= CHANGED_MATRIX;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[0][0], mtx[0][1], mtx[0][2], mtx[0][3] );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[1][0], mtx[1][1], mtx[1][2], mtx[1][3] );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[2][0], mtx[2][1], mtx[2][2], mtx[2][3] );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[3][0], mtx[3][1], mtx[3][2], mtx[3][3] );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPMatrix( 0x%08X, %s | %s | %s );\n",
|
||||
DebugMsg( DEBUG_NORMAL, "gSPMatrix( 0x%08X, %s | %s | %s );\n",
|
||||
matrix,
|
||||
(param & G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_MODELVIEW",
|
||||
(param & G_MTX_LOAD) ? "G_MTX_LOAD" : "G_MTX_MUL",
|
||||
(param & G_MTX_PUSH) ? "G_MTX_PUSH" : "G_MTX_NOPUSH" );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPDMAMatrix( u32 matrix, u8 index, u8 multiply )
|
||||
|
@ -711,11 +702,9 @@ void gSPDMAMatrix( u32 matrix, u8 index, u8 multiply )
|
|||
u32 address = gSP.DMAOffsets.mtx + RSP_SegmentToPhysical( matrix );
|
||||
|
||||
if (address + 64 > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR | DEBUG_MATRIX, "// Attempting to load matrix from invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPDMAMatrix( 0x%08X, %i, %s );\n",
|
||||
matrix, index, multiply ? "TRUE" : "FALSE" );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load matrix from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDMAMatrix( 0x%08X, %i, %s );\n",
|
||||
matrix, index, multiply ? "TRUE" : "FALSE");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -732,18 +721,16 @@ void gSPDMAMatrix( u32 matrix, u8 index, u8 multiply )
|
|||
|
||||
|
||||
gSP.changed |= CHANGED_MATRIX;
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[0][0], mtx[0][1], mtx[0][2], mtx[0][3] );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[1][0], mtx[1][1], mtx[1][2], mtx[1][3] );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[2][0], mtx[2][1], mtx[2][2], mtx[2][3] );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED | DEBUG_MATRIX, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// %12.6f %12.6f %12.6f %12.6f\n",
|
||||
mtx[3][0], mtx[3][1], mtx[3][2], mtx[3][3] );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPDMAMatrix( 0x%08X, %i, %s );\n",
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDMAMatrix( 0x%08X, %i, %s );\n",
|
||||
matrix, index, multiply ? "TRUE" : "FALSE" );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPViewport( u32 v )
|
||||
|
@ -751,10 +738,8 @@ void gSPViewport( u32 v )
|
|||
u32 address = RSP_SegmentToPhysical( v );
|
||||
|
||||
if ((address + 16) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to load viewport from invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPViewport( 0x%08X );\n", v );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load viewport from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPViewport( 0x%08X );\n", v);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -779,9 +764,7 @@ void gSPViewport( u32 v )
|
|||
|
||||
gSP.changed |= CHANGED_VIEWPORT;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPViewport( 0x%08X );\n", v );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPViewport( 0x%08X );\n", v);
|
||||
}
|
||||
|
||||
void gSPForceMatrix( u32 mptr )
|
||||
|
@ -789,10 +772,8 @@ void gSPForceMatrix( u32 mptr )
|
|||
u32 address = RSP_SegmentToPhysical( mptr );
|
||||
|
||||
if (address + 64 > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR | DEBUG_MATRIX, "// Attempting to load from invalid address" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPForceMatrix( 0x%08X );\n", mptr );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load from invalid address");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPForceMatrix( 0x%08X );\n", mptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -800,9 +781,7 @@ void gSPForceMatrix( u32 mptr )
|
|||
|
||||
gSP.changed &= ~CHANGED_MATRIX;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPForceMatrix( 0x%08X );\n", mptr );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPForceMatrix( 0x%08X );\n", mptr);
|
||||
}
|
||||
|
||||
void gSPLight( u32 l, s32 n )
|
||||
|
@ -811,11 +790,8 @@ void gSPLight( u32 l, s32 n )
|
|||
u32 addrByte = RSP_SegmentToPhysical( l );
|
||||
|
||||
if ((addrByte + sizeof( Light )) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to load light from invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPLight( 0x%08X, LIGHT_%i );\n",
|
||||
l, n );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load light from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n", l, n );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -842,14 +818,12 @@ void gSPLight( u32 l, s32 n )
|
|||
|
||||
gSP.changed |= CHANGED_LIGHT;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// x = %2.6f y = %2.6f z = %2.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// x = %2.6f y = %2.6f z = %2.6f\n",
|
||||
_FIXED2FLOAT( light->x, 7 ), _FIXED2FLOAT( light->y, 7 ), _FIXED2FLOAT( light->z, 7 ) );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// r = %3i g = %3i b = %3i\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// r = %3i g = %3i b = %3i\n",
|
||||
light->r, light->g, light->b );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPLight( 0x%08X, LIGHT_%i );\n",
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n",
|
||||
l, n );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPLightCBFD( u32 l, s32 n )
|
||||
|
@ -857,11 +831,8 @@ void gSPLightCBFD( u32 l, s32 n )
|
|||
u32 addrByte = RSP_SegmentToPhysical( l );
|
||||
|
||||
if ((addrByte + sizeof( Light )) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to load light from invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPLight( 0x%08X, LIGHT_%i );\n",
|
||||
l, n );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load light from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n", l, n );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -887,14 +858,12 @@ void gSPLightCBFD( u32 l, s32 n )
|
|||
|
||||
gSP.changed |= CHANGED_LIGHT;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// x = %2.6f y = %2.6f z = %2.6f\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// x = %2.6f y = %2.6f z = %2.6f\n",
|
||||
_FIXED2FLOAT( light->x, 7 ), _FIXED2FLOAT( light->y, 7 ), _FIXED2FLOAT( light->z, 7 ) );
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// r = %3i g = %3i b = %3i\n",
|
||||
DebugMsg( DEBUG_DETAIL, "// r = %3i g = %3i b = %3i\n",
|
||||
light->r, light->g, light->b );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPLight( 0x%08X, LIGHT_%i );\n",
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLight( 0x%08X, LIGHT_%i );\n",
|
||||
l, n );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPLookAt( u32 _l, u32 _n )
|
||||
|
@ -902,11 +871,8 @@ void gSPLookAt( u32 _l, u32 _n )
|
|||
u32 address = RSP_SegmentToPhysical(_l);
|
||||
|
||||
if ((address + sizeof(Light)) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg(DEBUG_HIGH | DEBUG_ERROR, "// Attempting to load light from invalid address\n");
|
||||
DebugMsg(DEBUG_HIGH | DEBUG_HANDLED, "gSPLookAt( 0x%08X, LOOKAT_%i );\n",
|
||||
l, n);
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load light from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLookAt( 0x%08X, LOOKAT_%i );\n", _l, _n);
|
||||
return;
|
||||
}
|
||||
assert(_n < 2);
|
||||
|
@ -1014,6 +980,7 @@ void gSPVertex(u32 a, u32 n, u32 v0)
|
|||
}
|
||||
} else {
|
||||
LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i\n", v0, n);
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1094,6 +1061,7 @@ void gSPCIVertex( u32 a, u32 n, u32 v0 )
|
|||
}
|
||||
} else {
|
||||
LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i\n", v0, n);
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1166,6 +1134,7 @@ void gSPDMAVertex( u32 a, u32 n, u32 v0 )
|
|||
}
|
||||
} else {
|
||||
LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i\n", v0, n);
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1238,6 +1207,7 @@ void gSPCBFDVertex( u32 a, u32 n, u32 v0 )
|
|||
}
|
||||
} else {
|
||||
LOG(LOG_ERROR, "Using Vertex outside buffer v0=%i, n=%i\n", v0, n);
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "//Using Vertex outside buffer v0 = %i, n = %i\n", v0, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1308,30 +1278,20 @@ void gSPDisplayList( u32 dl )
|
|||
u32 address = RSP_SegmentToPhysical( dl );
|
||||
|
||||
if ((address + 8) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to load display list from invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPDisplayList( 0x%08X );\n",
|
||||
dl );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load display list from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDisplayList( 0x%08X );\n", dl );
|
||||
return;
|
||||
}
|
||||
|
||||
if (RSP.PCi < (GBI.PCStackSize - 1)) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPDisplayList( 0x%08X );\n",
|
||||
dl );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDisplayList( 0x%08X );\n", dl);
|
||||
RSP.PCi++;
|
||||
RSP.PC[RSP.PCi] = address;
|
||||
RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[address], 24, 8 );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
assert(false);
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// PC stack overflow\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPDisplayList( 0x%08X );\n",
|
||||
dl );
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// PC stack overflow\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDisplayList( 0x%08X );\n", dl );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1340,18 +1300,12 @@ void gSPBranchList( u32 dl )
|
|||
u32 address = RSP_SegmentToPhysical( dl );
|
||||
|
||||
if ((address + 8) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to branch to display list at invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPBranchList( 0x%08X );\n",
|
||||
dl );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to branch to display list at invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBranchList( 0x%08X );\n", dl );
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPBranchList( 0x%08X );\n",
|
||||
dl );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBranchList( 0x%08X );\n", dl );
|
||||
|
||||
RSP.PC[RSP.PCi] = address;
|
||||
RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[address], 24, 8 );
|
||||
|
@ -1362,11 +1316,8 @@ void gSPBranchLessZ( u32 branchdl, u32 vtx, u32 zval )
|
|||
const u32 address = RSP_SegmentToPhysical( branchdl );
|
||||
|
||||
if ((address + 8) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Specified display list at invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPBranchLessZ( 0x%08X, %i, %i );\n",
|
||||
branchdl, vtx, zval );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Specified display list at invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBranchLessZ( 0x%08X, %i, %i );\n", branchdl, vtx, zval );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1375,10 +1326,7 @@ void gSPBranchLessZ( u32 branchdl, u32 vtx, u32 zval )
|
|||
if (zTest > 0x03FF || zTest <= zval)
|
||||
RSP.PC[RSP.PCi] = address;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPBranchLessZ( 0x%08X, %i, %i );\n",
|
||||
branchdl, vtx, zval );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBranchLessZ( 0x%08X, %i, %i );\n", branchdl, vtx, zval );
|
||||
}
|
||||
|
||||
void gSPBranchLessW( u32 branchdl, u32 vtx, u32 wval )
|
||||
|
@ -1386,11 +1334,8 @@ void gSPBranchLessW( u32 branchdl, u32 vtx, u32 wval )
|
|||
const u32 address = RSP_SegmentToPhysical( branchdl );
|
||||
|
||||
if ((address + 8) > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Specified display list at invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPBranchLessZ( 0x%08X, %i, %i );\n",
|
||||
branchdl, vtx, wval );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Specified display list at invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBranchLessW( 0x%08X, %i, %i );\n", branchdl, vtx, wval);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1398,28 +1343,25 @@ void gSPBranchLessW( u32 branchdl, u32 vtx, u32 wval )
|
|||
if (v.w < (float)wval)
|
||||
RSP.PC[RSP.PCi] = address;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPBranchLessZ( 0x%08X, %i, %i );\n",
|
||||
branchdl, vtx, wval );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBranchLessZ( 0x%08X, %i, %i );\n", branchdl, vtx, wval);
|
||||
}
|
||||
|
||||
void gSPDlistCount(u32 count, u32 v)
|
||||
{
|
||||
u32 address = RSP_SegmentToPhysical( v );
|
||||
if (address == 0 || (address + 8) > RDRAMSize) {
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to branch to display list at invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPDlistCnt(%d, 0x%08X );\n", count, v );
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to branch to display list at invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDlistCnt(%d, 0x%08X );\n", count, v);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RSP.PCi >= 9) {
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// ** DL stack overflow **\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPDlistCnt(%d, 0x%08X );\n", count, v );
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// ** DL stack overflow **\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDlistCnt(%d, 0x%08X );\n", count, v);
|
||||
return;
|
||||
}
|
||||
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPDlistCnt(%d, 0x%08X );\n", count, v );
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDlistCnt(%d, 0x%08X );\n", count, v);
|
||||
|
||||
++RSP.PCi; // go to the next PC in the stack
|
||||
RSP.PC[RSP.PCi] = address; // jump to the address
|
||||
|
@ -1432,10 +1374,7 @@ void gSPSetDMAOffsets( u32 mtxoffset, u32 vtxoffset )
|
|||
gSP.DMAOffsets.mtx = mtxoffset;
|
||||
gSP.DMAOffsets.vtx = vtxoffset;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPSetDMAOffsets( 0x%08X, 0x%08X );\n",
|
||||
mtxoffset, vtxoffset );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSetDMAOffsets( 0x%08X, 0x%08X );\n", mtxoffset, vtxoffset );
|
||||
}
|
||||
|
||||
void gSPSetDMATexOffset(u32 _addr)
|
||||
|
@ -1449,30 +1388,22 @@ void gSPSetVertexColorBase( u32 base )
|
|||
{
|
||||
gSP.vertexColorBase = RSP_SegmentToPhysical( base );
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPSetVertexColorBase( 0x%08X );\n",
|
||||
base );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSetVertexColorBase( 0x%08X );\n", base );
|
||||
}
|
||||
|
||||
void gSPSetVertexNormaleBase( u32 base )
|
||||
{
|
||||
gSP.vertexNormalBase = RSP_SegmentToPhysical( base );
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPSetVertexNormaleBase( 0x%08X );\n",
|
||||
base );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSetVertexNormaleBase( 0x%08X );\n", base );
|
||||
}
|
||||
|
||||
void gSPDMATriangles( u32 tris, u32 n ){
|
||||
const u32 address = RSP_SegmentToPhysical( tris );
|
||||
|
||||
if (address + sizeof( DKRTriangle ) * n > RDRAMSize) {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR | DEBUG_TRIANGLE, "// Attempting to load triangles from invalid address\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TRIANGLE, "gSPDMATriangles( 0x%08X, %i );\n" );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to load triangles from invalid address\n");
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDMATriangles( 0x%08X, %i );\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1518,6 +1449,7 @@ void gSPDMATriangles( u32 tris, u32 n ){
|
|||
++pVtx;
|
||||
++triangles;
|
||||
}
|
||||
DebugMsg(DEBUG_NORMAL, "gSPDMATriangles( 0x%08X, %i );\n");
|
||||
drawer.drawDMATriangles(pVtx - drawer.getDMAVerticesData());
|
||||
}
|
||||
|
||||
|
@ -1527,10 +1459,7 @@ void gSP1Quadrangle( s32 v0, s32 v1, s32 v2, s32 v3 )
|
|||
gSPTriangle( v0, v2, v3);
|
||||
gSPFlushTriangles();
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TRIANGLE, "gSP1Quadrangle( %i, %i, %i, %i );\n",
|
||||
v0, v1, v2, v3 );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSP1Quadrangle( %i, %i, %i, %i );\n", v0, v1, v2, v3 );
|
||||
}
|
||||
|
||||
bool gSPCullVertices( u32 v0, u32 vn )
|
||||
|
@ -1557,42 +1486,28 @@ void gSPCullDisplayList( u32 v0, u32 vn )
|
|||
if (RSP.PCi > 0)
|
||||
RSP.PCi--;
|
||||
else {
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// End of display list, halting execution\n" );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "End of display list, halting execution\n");
|
||||
RSP.halt = TRUE;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// Culling display list\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPCullDisplayList( %i, %i );\n\n",
|
||||
v0, vn );
|
||||
#endif
|
||||
DebugMsg( DEBUG_DETAIL, "// Culling display list\n" );
|
||||
DebugMsg(DEBUG_NORMAL, "gSPCullDisplayList( %i, %i );\n\n", v0, vn );
|
||||
} else {
|
||||
DebugMsg( DEBUG_DETAIL, "// Not culling display list\n" );
|
||||
DebugMsg(DEBUG_NORMAL, "gSPCullDisplayList( %i, %i );\n", v0, vn);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// Not culling display list\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPCullDisplayList( %i, %i );\n",
|
||||
v0, vn );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPPopMatrixN( u32 param, u32 num )
|
||||
void gSPPopMatrixN(u32 param, u32 num)
|
||||
{
|
||||
if (gSP.matrix.modelViewi > num - 1) {
|
||||
gSP.matrix.modelViewi -= num;
|
||||
|
||||
gSP.changed |= CHANGED_MATRIX;
|
||||
} else {
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to pop matrix stack below 0\n");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR | DEBUG_MATRIX, "// Attempting to pop matrix stack below 0\n" );
|
||||
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPPopMatrixN( %s, %i );\n",
|
||||
DebugMsg(DEBUG_NORMAL, "gSPPopMatrixN( %s, %i );\n",
|
||||
(param == G_MTX_MODELVIEW) ? "G_MTX_MODELVIEW" :
|
||||
(param == G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_INVALID",
|
||||
num );
|
||||
#endif
|
||||
(param == G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_INVALID", num );
|
||||
}
|
||||
|
||||
void gSPPopMatrix( u32 param )
|
||||
|
@ -1608,27 +1523,29 @@ void gSPPopMatrix( u32 param )
|
|||
case 1: // projection, can't
|
||||
break;
|
||||
default:
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR | DEBUG_MATRIX, "// Attempting to pop matrix stack below 0\n" );
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_MATRIX, "gSPPopMatrix( %s );\n",
|
||||
(param == G_MTX_MODELVIEW) ? "G_MTX_MODELVIEW" :
|
||||
(param == G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_INVALID" );
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Attempting to pop matrix stack below 0\n");
|
||||
}
|
||||
DebugMsg(DEBUG_NORMAL, "gSPPopMatrix( %s );\n",
|
||||
(param == G_MTX_MODELVIEW) ? "G_MTX_MODELVIEW" :
|
||||
(param == G_MTX_PROJECTION) ? "G_MTX_PROJECTION" : "G_MTX_INVALID");
|
||||
}
|
||||
|
||||
void gSPSegment( s32 seg, s32 base )
|
||||
{
|
||||
gSP.segment[seg] = base;
|
||||
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPSegment( %s, 0x%08X );\n",
|
||||
SegmentText[seg], base );
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSegment( %s, 0x%08X );\n", SegmentText[seg], base );
|
||||
}
|
||||
|
||||
void gSPClipRatio( u32 r )
|
||||
{
|
||||
DebugMsg(DEBUG_NORMAL|DEBUG_IGNORED, "gSPClipRatio(%u);\n", r);
|
||||
}
|
||||
|
||||
void gSPInsertMatrix( u32 where, u32 num )
|
||||
{
|
||||
DebugMsg(DEBUG_NORMAL, "gSPInsertMatrix(%u, %u);\n", where, num);
|
||||
|
||||
f32 fraction, integer;
|
||||
|
||||
if (gSP.changed & CHANGED_MATRIX)
|
||||
|
@ -1677,16 +1594,19 @@ void gSPModifyVertex( u32 _vtx, u32 _where, u32 _val )
|
|||
vtx0.g = _SHIFTR( _val, 16, 8 ) * 0.0039215689f;
|
||||
vtx0.b = _SHIFTR( _val, 8, 8 ) * 0.0039215689f;
|
||||
vtx0.a = _SHIFTR( _val, 0, 8 ) * 0.0039215689f;
|
||||
vtx0.modify|= MODIFY_RGBA;
|
||||
break;
|
||||
vtx0.modify |= MODIFY_RGBA;
|
||||
DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: RGBA(%02f, %02f, %02f, %02f);\n", vtx0.r, vtx0.g, vtx0.b, vtx0.a);
|
||||
break;
|
||||
case G_MWO_POINT_ST:
|
||||
vtx0.s = _FIXED2FLOAT( (s16)_SHIFTR( _val, 16, 16 ), 5 ) / gSP.texture.scales;
|
||||
vtx0.t = _FIXED2FLOAT((s16)_SHIFTR(_val, 0, 16), 5) / gSP.texture.scalet;
|
||||
//vtx0.modify |= MODIFY_ST; // still neeed to divide by 2 in vertex shader if TexturePersp disabled
|
||||
break;
|
||||
DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: ST(%02f, %02f);\n", vtx0.s, vtx0.t);
|
||||
break;
|
||||
case G_MWO_POINT_XYSCREEN:
|
||||
vtx0.x = _FIXED2FLOAT((s16)_SHIFTR(_val, 16, 16), 2);
|
||||
vtx0.y = _FIXED2FLOAT((s16)_SHIFTR(_val, 0, 16), 2);
|
||||
DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: XY(%02f, %02f);\n", vtx0.x, vtx0.y);
|
||||
if ((config.generalEmulation.hacks & hack_ModifyVertexXyInShader) == 0) {
|
||||
vtx0.x = (vtx0.x - gSP.viewport.vtrans[0]) / gSP.viewport.vscale[0];
|
||||
if (gSP.viewport.vscale[0] < 0)
|
||||
|
@ -1708,6 +1628,7 @@ void gSPModifyVertex( u32 _vtx, u32 _where, u32 _val )
|
|||
case G_MWO_POINT_ZSCREEN:
|
||||
{
|
||||
f32 scrZ = _FIXED2FLOAT((s16)_SHIFTR(_val, 16, 16), 15);
|
||||
DebugMsg(DEBUG_NORMAL, "gSPModifyVertex: Z(%02f);\n", vtx0.z);
|
||||
vtx0.z = (scrZ - gSP.viewport.vtrans[2]) / (gSP.viewport.vscale[2]);
|
||||
vtx0.clip &= ~CLIP_W;
|
||||
vtx0.modify |= MODIFY_Z;
|
||||
|
@ -1721,16 +1642,11 @@ void gSPNumLights( s32 n )
|
|||
if (n < 12) {
|
||||
gSP.numLights = n;
|
||||
gSP.changed |= CHANGED_LIGHT;
|
||||
} else {
|
||||
DebugMsg(DEBUG_NORMAL | DEBUG_ERROR, "// Setting an invalid number of lights\n");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Setting an invalid number of lights\n" );
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPNumLights( %i );\n",
|
||||
n );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPNumLights( %i );\n", n);
|
||||
}
|
||||
|
||||
void gSPLightColor( u32 lightNum, u32 packedColor )
|
||||
|
@ -1744,10 +1660,7 @@ void gSPLightColor( u32 lightNum, u32 packedColor )
|
|||
gSP.lights.rgb[lightNum][B] = _SHIFTR( packedColor, 8, 8 ) * 0.0039215689f;
|
||||
gSP.changed |= CHANGED_HW_LIGHT;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPLightColor( %i, 0x%08X );\n",
|
||||
lightNum, packedColor );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLightColor( %i, 0x%08X );\n", lightNum, packedColor );
|
||||
}
|
||||
|
||||
void gSPFogFactor( s16 fm, s16 fo )
|
||||
|
@ -1756,21 +1669,18 @@ void gSPFogFactor( s16 fm, s16 fo )
|
|||
gSP.fog.offset = fo;
|
||||
|
||||
gSP.changed |= CHANGED_FOGPOSITION;
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPFogFactor( %i, %i );\n", fm, fo );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPFogFactor( %i, %i );\n", fm, fo);
|
||||
}
|
||||
|
||||
void gSPPerspNormalize( u16 scale )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_UNHANDLED, "gSPPerspNormalize( %i );\n", scale );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL| DEBUG_IGNORED, "gSPPerspNormalize( %i );\n", scale);
|
||||
}
|
||||
|
||||
void gSPCoordMod(u32 _w0, u32 _w1)
|
||||
{
|
||||
if ((_w0&8) != 0)
|
||||
DebugMsg(DEBUG_NORMAL, "gSPCoordMod( %u, %u );\n", _w0, _w1);
|
||||
if ((_w0 & 8) != 0)
|
||||
return;
|
||||
u32 idx = _SHIFTR(_w0, 1, 2);
|
||||
u32 pos = _w0&0x30;
|
||||
|
@ -1809,27 +1719,19 @@ void gSPTexture( f32 sc, f32 tc, s32 level, s32 tile, s32 on )
|
|||
|
||||
gSP.changed |= CHANGED_TEXTURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gSPTexture( %f, %f, %i, %i, %i );\n",
|
||||
sc, tc, level, tile, on );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPTexture( %f, %f, %i, %i, %i );\n", sc, tc, level, tile, on );
|
||||
}
|
||||
|
||||
void gSPEndDisplayList()
|
||||
{
|
||||
if (RSP.PCi > 0)
|
||||
--RSP.PCi;
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_DETAIL | DEBUG_HANDLED, "// End of display list, halting execution\n" );
|
||||
#endif
|
||||
else {
|
||||
DebugMsg( DEBUG_NORMAL, "End of display list, halting execution\n" );
|
||||
RSP.halt = TRUE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPEndDisplayList();\n\n" );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPEndDisplayList();\n\n");
|
||||
}
|
||||
|
||||
void gSPGeometryMode( u32 clear, u32 set )
|
||||
|
@ -1838,8 +1740,7 @@ void gSPGeometryMode( u32 clear, u32 set )
|
|||
|
||||
gSP.changed |= CHANGED_GEOMETRYMODE;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPGeometryMode( %s%s%s%s%s%s%s%s%s%s, %s%s%s%s%s%s%s%s%s%s );\n",
|
||||
DebugMsg(DEBUG_NORMAL, "gSPGeometryMode( %s%s%s%s%s%s%s%s%s%s, %s%s%s%s%s%s%s%s%s%s );\n",
|
||||
clear & G_SHADE ? "G_SHADE | " : "",
|
||||
clear & G_LIGHTING ? "G_LIGHTING | " : "",
|
||||
clear & G_SHADING_SMOOTH ? "G_SHADING_SMOOTH | " : "",
|
||||
|
@ -1860,7 +1761,6 @@ void gSPGeometryMode( u32 clear, u32 set )
|
|||
set & G_CULL_BACK ? "G_CULL_BACK | " : "",
|
||||
set & G_FOG ? "G_FOG | " : "",
|
||||
set & G_CLIPPING ? "G_CLIPPING" : "" );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPSetGeometryMode( u32 mode )
|
||||
|
@ -1868,8 +1768,8 @@ void gSPSetGeometryMode( u32 mode )
|
|||
gSP.geometryMode |= mode;
|
||||
|
||||
gSP.changed |= CHANGED_GEOMETRYMODE;
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPSetGeometryMode( %s%s%s%s%s%s%s%s%s%s );\n",
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSetGeometryMode( %s%s%s%s%s%s%s%s%s%s );\n",
|
||||
mode & G_SHADE ? "G_SHADE | " : "",
|
||||
mode & G_LIGHTING ? "G_LIGHTING | " : "",
|
||||
mode & G_SHADING_SMOOTH ? "G_SHADING_SMOOTH | " : "",
|
||||
|
@ -1880,7 +1780,6 @@ void gSPSetGeometryMode( u32 mode )
|
|||
mode & G_CULL_BACK ? "G_CULL_BACK | " : "",
|
||||
mode & G_FOG ? "G_FOG | " : "",
|
||||
mode & G_CLIPPING ? "G_CLIPPING" : "" );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPClearGeometryMode( u32 mode )
|
||||
|
@ -1889,8 +1788,7 @@ void gSPClearGeometryMode( u32 mode )
|
|||
|
||||
gSP.changed |= CHANGED_GEOMETRYMODE;
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gSPClearGeometryMode( %s%s%s%s%s%s%s%s%s%s );\n",
|
||||
DebugMsg(DEBUG_NORMAL, "gSPClearGeometryMode( %s%s%s%s%s%s%s%s%s%s );\n",
|
||||
mode & G_SHADE ? "G_SHADE | " : "",
|
||||
mode & G_LIGHTING ? "G_LIGHTING | " : "",
|
||||
mode & G_SHADING_SMOOTH ? "G_SHADING_SMOOTH | " : "",
|
||||
|
@ -1901,7 +1799,6 @@ void gSPClearGeometryMode( u32 mode )
|
|||
mode & G_CULL_BACK ? "G_CULL_BACK | " : "",
|
||||
mode & G_FOG ? "G_FOG | " : "",
|
||||
mode & G_CLIPPING ? "G_CLIPPING" : "" );
|
||||
#endif
|
||||
}
|
||||
|
||||
void gSPSetOtherMode_H(u32 _length, u32 _shift, u32 _data)
|
||||
|
@ -1911,6 +1808,8 @@ void gSPSetOtherMode_H(u32 _length, u32 _shift, u32 _data)
|
|||
|
||||
if (mask & 0x00300000) // cycle type
|
||||
gDP.changed |= CHANGED_CYCLETYPE;
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSetOtherMode_H length=%u shift=%u data=%u result=0x%08x\n", _length, _shift, _data, gDP.otherMode.h);
|
||||
}
|
||||
|
||||
void gSPSetOtherMode_L(u32 _length, u32 _shift, u32 _data)
|
||||
|
@ -1923,29 +1822,30 @@ void gSPSetOtherMode_L(u32 _length, u32 _shift, u32 _data)
|
|||
|
||||
if (mask & 0xFFFFFFF8) // rendermode / blender bits
|
||||
gDP.changed |= CHANGED_RENDERMODE;
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSetOtherMode_L length=%u shift=%u data=%u result=0x%08x\n", _length, _shift, _data, gDP.otherMode.l);
|
||||
}
|
||||
|
||||
void gSPLine3D( s32 v0, s32 v1, s32 flag )
|
||||
{
|
||||
dwnd().getDrawer().drawLine(v0, v1, 1.5f);
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_UNHANDLED, "gSPLine3D( %i, %i, %i );\n", v0, v1, flag );
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLine3D( %i, %i, %i )\n", v0, v1, flag);
|
||||
}
|
||||
|
||||
void gSPLineW3D( s32 v0, s32 v1, s32 wd, s32 flag )
|
||||
{
|
||||
dwnd().getDrawer().drawLine(v0, v1, 1.5f + wd * 0.5f);
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_UNHANDLED, "gSPLineW3D( %i, %i, %i, %i );\n", v0, v1, wd, flag );
|
||||
#endif
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPLineW3D( %i, %i, %i, %i )\n", v0, v1, wd, flag);
|
||||
}
|
||||
|
||||
void gSPSetStatus(u32 sid, u32 val)
|
||||
{
|
||||
assert(sid <= 12);
|
||||
gSP.status[sid>>2] = val;
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSetStatus sid=%u val=%u\n", sid, val);
|
||||
}
|
||||
|
||||
void gSPObjLoadTxtr( u32 tx )
|
||||
|
@ -1959,17 +1859,20 @@ void gSPObjLoadTxtr( u32 tx )
|
|||
gDPSetTextureImage( 0, 1, 0, objTxtr->block.image );
|
||||
gDPSetTile( 0, 1, 0, objTxtr->block.tmem, 7, 0, 0, 0, 0, 0, 0, 0 );
|
||||
gDPLoadBlock( 7, 0, 0, ((objTxtr->block.tsize + 1) << 3) - 1, objTxtr->block.tline );
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjLoadTxtr: load block\n");
|
||||
break;
|
||||
case G_OBJLT_TXTRTILE:
|
||||
gDPSetTextureImage( 0, 1, (objTxtr->tile.twidth + 1) << 1, objTxtr->tile.image );
|
||||
gDPSetTile( 0, 1, (objTxtr->tile.twidth + 1) >> 2, objTxtr->tile.tmem, 0, 0, 0, 0, 0, 0, 0, 0 );
|
||||
gDPSetTile( 0, 1, (objTxtr->tile.twidth + 1) >> 2, objTxtr->tile.tmem, 7, 0, 0, 0, 0, 0, 0, 0 );
|
||||
gDPLoadTile( 7, 0, 0, (((objTxtr->tile.twidth + 1) << 1) - 1) << 2, (((objTxtr->tile.theight + 1) >> 2) - 1) << 2 );
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjLoadTxtr: load tile\n");
|
||||
break;
|
||||
case G_OBJLT_TLUT:
|
||||
gDPSetTextureImage( 0, 2, 1, objTxtr->tlut.image );
|
||||
gDPSetTile( 0, 2, 0, objTxtr->tlut.phead, 7, 0, 0, 0, 0, 0, 0, 0 );
|
||||
gDPLoadTLUT( 7, 0, 0, objTxtr->tlut.pnum << 2, 0 );
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjLoadTxtr: load tlut\n");
|
||||
break;
|
||||
}
|
||||
gSP.status[objTxtr->block.sid >> 2] = (gSP.status[objTxtr->block.sid >> 2] & ~objTxtr->block.mask) | (objTxtr->block.flag & objTxtr->block.mask);
|
||||
|
@ -2217,6 +2120,7 @@ void gSPObjRectangle(u32 _sp)
|
|||
gSPSetSpriteTile(objSprite);
|
||||
ObjCoordinates objCoords(objSprite, false);
|
||||
gSPDrawObjRect(objCoords);
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjRectangle\n");
|
||||
}
|
||||
|
||||
void gSPObjRectangleR(u32 _sp)
|
||||
|
@ -2229,6 +2133,8 @@ void gSPObjRectangleR(u32 _sp)
|
|||
if (objSprite->imageFmt == G_IM_FMT_YUV && (config.generalEmulation.hacks&hack_Ogre64)) //Ogre Battle needs to copy YUV texture to frame buffer
|
||||
_drawYUVImageToFrameBuffer(objCoords);
|
||||
gSPDrawObjRect(objCoords);
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjRectangleR\n");
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -2354,6 +2260,8 @@ void gSPBgRect1Cyc( u32 _bg )
|
|||
|
||||
ObjCoordinates objCoords(objScaleBg);
|
||||
gSPDrawObjRect(objCoords);
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBgRect1Cyc\n");
|
||||
}
|
||||
|
||||
void gSPBgRectCopy( u32 _bg )
|
||||
|
@ -2372,6 +2280,8 @@ void gSPBgRectCopy( u32 _bg )
|
|||
|
||||
ObjCoordinates objCoords(objBg);
|
||||
gSPDrawObjRect(objCoords);
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPBgRectCopy\n");
|
||||
}
|
||||
|
||||
void gSPObjSprite(u32 _sp)
|
||||
|
@ -2431,6 +2341,8 @@ void gSPObjSprite(u32 _sp)
|
|||
vtx3.t = lrt;
|
||||
|
||||
drawer.drawScreenSpaceTriangle(4);
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjSprite\n");
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -2462,6 +2374,7 @@ void _loadSpriteImage(const uSprite *_pSprite)
|
|||
|
||||
void gSPSprite2DBase(u32 _base)
|
||||
{
|
||||
DebugMsg(DEBUG_NORMAL, "gSPSprite2DBase\n");
|
||||
assert(RSP.nextCmd == 0xBE);
|
||||
const u32 address = RSP_SegmentToPhysical( _base );
|
||||
uSprite *pSprite = (uSprite*)&RDRAM[address];
|
||||
|
@ -2597,7 +2510,7 @@ void gSPObjLoadTxRectR(u32 txsp)
|
|||
|
||||
void gSPObjMatrix( u32 mtx )
|
||||
{
|
||||
u32 address = RSP_SegmentToPhysical( mtx );
|
||||
u32 address = RSP_SegmentToPhysical(mtx);
|
||||
uObjMtx *objMtx = (uObjMtx*)&RDRAM[address];
|
||||
|
||||
gSP.objMatrix.A = _FIXED2FLOAT( objMtx->A, 16 );
|
||||
|
@ -2608,6 +2521,8 @@ void gSPObjMatrix( u32 mtx )
|
|||
gSP.objMatrix.Y = _FIXED2FLOAT( objMtx->Y, 2 );
|
||||
gSP.objMatrix.baseScaleX = _FIXED2FLOAT( objMtx->BaseScaleX, 10 );
|
||||
gSP.objMatrix.baseScaleY = _FIXED2FLOAT( objMtx->BaseScaleY, 10 );
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjMatrix\n");
|
||||
}
|
||||
|
||||
void gSPObjSubMatrix( u32 mtx )
|
||||
|
@ -2618,11 +2533,15 @@ void gSPObjSubMatrix( u32 mtx )
|
|||
gSP.objMatrix.Y = _FIXED2FLOAT(objMtx->Y, 2);
|
||||
gSP.objMatrix.baseScaleX = _FIXED2FLOAT(objMtx->BaseScaleX, 10);
|
||||
gSP.objMatrix.baseScaleY = _FIXED2FLOAT(objMtx->BaseScaleY, 10);
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjSubMatrix\n");
|
||||
}
|
||||
|
||||
void gSPObjRendermode(u32 _mode)
|
||||
{
|
||||
gSP.objRendermode = _mode;
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gSPObjRendermode(0x%08x)\n", _mode);
|
||||
}
|
||||
|
||||
#ifdef __NEON_OPT
|
||||
|
|
|
@ -24,6 +24,7 @@ MY_LOCAL_SRC_FILES := \
|
|||
$(SRCDIR)/Config.cpp \
|
||||
$(SRCDIR)/convert.cpp \
|
||||
$(SRCDIR)/CRC_OPT.cpp \
|
||||
$(SRCDIR)/DebugDump.cpp \
|
||||
$(SRCDIR)/DepthBuffer.cpp \
|
||||
$(SRCDIR)/DisplayWindow.cpp \
|
||||
$(SRCDIR)/F3D.cpp \
|
||||
|
|
Loading…
Reference in New Issue
Block a user