2006-06-15 04:19:30 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "RegViewVU.h"
|
2006-07-13 02:44:13 +00:00
|
|
|
#include "../PS2VM.h"
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2013-04-29 04:53:49 +00:00
|
|
|
CRegViewVU::CRegViewVU(HWND hParent, const RECT& rect, CVirtualMachine& virtualMachine, CMIPS* pCtx)
|
|
|
|
: CRegViewPage(hParent, rect)
|
2012-03-12 05:24:43 +00:00
|
|
|
, m_pCtx(pCtx)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2012-03-12 05:24:43 +00:00
|
|
|
virtualMachine.OnMachineStateChange.connect(boost::bind(&CRegViewVU::Update, this));
|
|
|
|
virtualMachine.OnRunningStateChange.connect(boost::bind(&CRegViewVU::Update, this));
|
2006-06-15 04:19:30 +00:00
|
|
|
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
CRegViewVU::~CRegViewVU()
|
|
|
|
{
|
2006-12-26 21:53:04 +00:00
|
|
|
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CRegViewVU::Update()
|
|
|
|
{
|
2008-05-14 03:09:54 +00:00
|
|
|
SetDisplayText(GetDisplayText().c_str());
|
2006-06-15 04:19:30 +00:00
|
|
|
CRegViewPage::Update();
|
|
|
|
}
|
|
|
|
|
2012-03-12 05:24:43 +00:00
|
|
|
std::string CRegViewVU::GetDisplayText()
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
|
|
|
char sLine[256];
|
2012-03-12 05:24:43 +00:00
|
|
|
std::string result;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2008-05-14 03:09:54 +00:00
|
|
|
result += " x y \r\n";
|
|
|
|
result += " z w \r\n";
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2008-05-14 03:09:54 +00:00
|
|
|
MIPSSTATE* pState = &m_pCtx->m_State;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2008-05-14 03:09:54 +00:00
|
|
|
for(unsigned int i = 0; i < 32; i++)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2012-03-12 05:24:43 +00:00
|
|
|
char sReg1[32];
|
2008-05-14 03:09:54 +00:00
|
|
|
|
2006-06-15 04:19:30 +00:00
|
|
|
if(i < 10)
|
|
|
|
{
|
|
|
|
sprintf(sReg1, "VF%i ", i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(sReg1, "VF%i ", i);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(sLine, "%s: %+.7e %+.7e\r\n %+.7e %+.7e\r\n", sReg1, \
|
|
|
|
*(float*)&pState->nCOP2[i].nV0, \
|
|
|
|
*(float*)&pState->nCOP2[i].nV1, \
|
|
|
|
*(float*)&pState->nCOP2[i].nV2, \
|
|
|
|
*(float*)&pState->nCOP2[i].nV3);
|
|
|
|
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(sLine, "ACC : %+.7e %+.7e\r\n %+.7e %+.7e\r\n", \
|
|
|
|
*(float*)&pState->nCOP2A.nV0, \
|
|
|
|
*(float*)&pState->nCOP2A.nV1, \
|
|
|
|
*(float*)&pState->nCOP2A.nV2, \
|
|
|
|
*(float*)&pState->nCOP2A.nV3);
|
|
|
|
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
|
|
|
sprintf(sLine, "Q : %+.7e\r\n", *(float*)&pState->nCOP2Q);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
|
|
|
sprintf(sLine, "I : %+.7e\r\n", *(float*)&pState->nCOP2I);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
|
|
|
sprintf(sLine, "P : %+.7e\r\n", *(float*)&pState->nCOP2P);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2006-06-19 05:43:51 +00:00
|
|
|
sprintf(sLine, "R : %+.7e (0x%0.8X)\r\n", *(float*)&pState->nCOP2R, pState->nCOP2R);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2011-04-03 05:25:07 +00:00
|
|
|
sprintf(sLine, "MACF : 0x%0.4X\r\n", pState->nCOP2MF);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2015-03-20 01:41:09 -04:00
|
|
|
sprintf(sLine, "STKF : 0x%0.4X\r\n", pState->nCOP2SF);
|
|
|
|
result += sLine;
|
|
|
|
|
2011-04-03 05:25:07 +00:00
|
|
|
sprintf(sLine, "CLIP : 0x%0.6X\r\n", pState->nCOP2CF);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-11-23 00:42:38 -05:00
|
|
|
sprintf(sLine, "PIPE : 0x%0.4X\r\n", pState->pipeTime);
|
|
|
|
result += sLine;
|
|
|
|
|
2011-04-03 05:25:07 +00:00
|
|
|
sprintf(sLine, "PIPEQ: 0x%0.4X - %+.7e\r\n", pState->pipeQ.counter, *(float*)&pState->pipeQ.heldValue);
|
|
|
|
result += sLine;
|
|
|
|
|
2012-03-18 01:52:44 +00:00
|
|
|
unsigned int currentPipeMacCounter = pState->pipeMac.index - 1;
|
2011-04-03 05:25:07 +00:00
|
|
|
|
|
|
|
uint32 macFlagPipeValues[MACFLAG_PIPELINE_SLOTS];
|
2012-03-18 01:52:44 +00:00
|
|
|
uint32 macFlagPipeTimes[MACFLAG_PIPELINE_SLOTS];
|
2011-04-03 05:25:07 +00:00
|
|
|
for(unsigned int i = 0; i < MACFLAG_PIPELINE_SLOTS; i++)
|
|
|
|
{
|
2012-03-18 01:52:44 +00:00
|
|
|
unsigned int currIndex = (currentPipeMacCounter - i) & (MACFLAG_PIPELINE_SLOTS - 1);
|
|
|
|
macFlagPipeValues[i] = pState->pipeMac.values[currIndex];
|
|
|
|
macFlagPipeTimes[i] = pState->pipeMac.pipeTimes[currIndex];
|
2011-04-03 05:25:07 +00:00
|
|
|
}
|
|
|
|
|
2012-03-18 01:52:44 +00:00
|
|
|
sprintf(sLine, "PIPEM: 0x%0.4X:0x%0.4X, 0x%0.4X:0x%0.4X\r\n",
|
|
|
|
macFlagPipeTimes[0], macFlagPipeValues[0],
|
|
|
|
macFlagPipeTimes[1], macFlagPipeValues[1]);
|
2011-04-03 05:25:07 +00:00
|
|
|
result += sLine;
|
|
|
|
|
2012-03-18 01:52:44 +00:00
|
|
|
sprintf(sLine, " 0x%0.4X:0x%0.4X, 0x%0.4X:0x%0.4X\r\n",
|
|
|
|
macFlagPipeTimes[2], macFlagPipeValues[2],
|
|
|
|
macFlagPipeTimes[3], macFlagPipeValues[3]);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2008-05-14 03:09:54 +00:00
|
|
|
for(unsigned int i = 0; i < 16; i += 2)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2012-03-12 05:24:43 +00:00
|
|
|
char sReg1[32];
|
|
|
|
char sReg2[32];
|
2008-05-14 03:09:54 +00:00
|
|
|
|
2006-06-15 04:19:30 +00:00
|
|
|
if(i < 10)
|
|
|
|
{
|
|
|
|
sprintf(sReg1, "VI%i ", i);
|
|
|
|
sprintf(sReg2, "VI%i ", i + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(sReg1, "VI%i ", i);
|
|
|
|
sprintf(sReg2, "VI%i ", i + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(sLine, "%s: 0x%0.4X %s: 0x%0.4X\r\n", sReg1, pState->nCOP2VI[i] & 0xFFFF, sReg2, pState->nCOP2VI[i + 1] & 0xFFFF);
|
2008-05-14 03:09:54 +00:00
|
|
|
result += sLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
2008-05-14 03:09:54 +00:00
|
|
|
|
2012-03-12 05:24:43 +00:00
|
|
|
return result;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|