2015-05-06 01:27:59 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "RegViewVU.h"
|
|
|
|
#include "../PS2VM.h"
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
CRegViewVU::CRegViewVU(HWND hParent, const RECT& rect, CVirtualMachine& virtualMachine, CMIPS* ctx)
|
2015-05-06 01:27:59 -04:00
|
|
|
: CRegViewPage(hParent, rect)
|
2016-06-09 20:58:55 -04:00
|
|
|
, m_ctx(ctx)
|
2015-05-06 01:27:59 -04:00
|
|
|
{
|
|
|
|
virtualMachine.OnMachineStateChange.connect(boost::bind(&CRegViewVU::Update, this));
|
|
|
|
virtualMachine.OnRunningStateChange.connect(boost::bind(&CRegViewVU::Update, this));
|
|
|
|
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
CRegViewVU::~CRegViewVU()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CRegViewVU::Update()
|
|
|
|
{
|
|
|
|
SetDisplayText(GetDisplayText().c_str());
|
|
|
|
CRegViewPage::Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string CRegViewVU::GetDisplayText()
|
|
|
|
{
|
|
|
|
char sLine[256];
|
|
|
|
std::string result;
|
|
|
|
|
|
|
|
result += " x y \r\n";
|
|
|
|
result += " z w \r\n";
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
const auto& state = m_ctx->m_State;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
|
|
|
for(unsigned int i = 0; i < 32; i++)
|
|
|
|
{
|
|
|
|
char sReg1[32];
|
|
|
|
|
|
|
|
if(i < 10)
|
|
|
|
{
|
|
|
|
sprintf(sReg1, "VF%i ", i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(sReg1, "VF%i ", i);
|
|
|
|
}
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "%s: %+.7e %+.7e\r\n %+.7e %+.7e\r\n", sReg1,
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2[i].nV0),
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2[i].nV1),
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2[i].nV2),
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2[i].nV3)
|
|
|
|
);
|
2015-05-06 01:27:59 -04:00
|
|
|
|
|
|
|
result += sLine;
|
|
|
|
}
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "ACC : %+.7e %+.7e\r\n %+.7e %+.7e\r\n",
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2A.nV0),
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2A.nV1),
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2A.nV2),
|
|
|
|
*reinterpret_cast<const float*>(&state.nCOP2A.nV3)
|
|
|
|
);
|
2015-05-06 01:27:59 -04:00
|
|
|
|
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "Q : %+.7e\r\n", *reinterpret_cast<const float*>(&state.nCOP2Q));
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "I : %+.7e\r\n", *reinterpret_cast<const float*>(&state.nCOP2I));
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "P : %+.7e\r\n", *reinterpret_cast<const float*>(&state.nCOP2P));
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "R : %+.7e (0x%0.8X)\r\n", *reinterpret_cast<const float*>(&state.nCOP2R), state.nCOP2R);
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "MACF : 0x%0.4X\r\n", state.nCOP2MF);
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "STKF : 0x%0.4X\r\n", state.nCOP2SF);
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "CLIP : 0x%0.6X\r\n", state.nCOP2CF);
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "PIPE : 0x%0.4X\r\n", state.pipeTime);
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "PIPEQ: 0x%0.4X - %+.7e\r\n", state.pipeQ.counter, *reinterpret_cast<const float*>(&state.pipeQ.heldValue));
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
unsigned int currentPipeMacCounter = state.pipeMac.index - 1;
|
2015-05-06 01:27:59 -04:00
|
|
|
|
|
|
|
uint32 macFlagPipeValues[MACFLAG_PIPELINE_SLOTS];
|
|
|
|
uint32 macFlagPipeTimes[MACFLAG_PIPELINE_SLOTS];
|
|
|
|
for(unsigned int i = 0; i < MACFLAG_PIPELINE_SLOTS; i++)
|
|
|
|
{
|
|
|
|
unsigned int currIndex = (currentPipeMacCounter - i) & (MACFLAG_PIPELINE_SLOTS - 1);
|
2016-06-09 20:58:55 -04:00
|
|
|
macFlagPipeValues[i] = state.pipeMac.values[currIndex];
|
|
|
|
macFlagPipeTimes[i] = state.pipeMac.pipeTimes[currIndex];
|
2015-05-06 01:27:59 -04: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]);
|
|
|
|
result += sLine;
|
|
|
|
|
|
|
|
sprintf(sLine, " 0x%0.4X:0x%0.4X, 0x%0.4X:0x%0.4X\r\n",
|
|
|
|
macFlagPipeTimes[2], macFlagPipeValues[2],
|
|
|
|
macFlagPipeTimes[3], macFlagPipeValues[3]);
|
|
|
|
result += sLine;
|
|
|
|
|
|
|
|
for(unsigned int i = 0; i < 16; i += 2)
|
|
|
|
{
|
|
|
|
char sReg1[32];
|
|
|
|
char sReg2[32];
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-06-09 20:58:55 -04:00
|
|
|
sprintf(sLine, "%s: 0x%0.4X %s: 0x%0.4X\r\n", sReg1, state.nCOP2VI[i] & 0xFFFF, sReg2, state.nCOP2VI[i + 1] & 0xFFFF);
|
2015-05-06 01:27:59 -04:00
|
|
|
result += sLine;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|