git-svn-id: http://svn.purei.org/purei/trunk@54 b36208d7-6611-0410-8bec-b1987f11c4a2

This commit is contained in:
jpd002 2006-07-11 00:05:44 +00:00
parent a073d3c9a6
commit eb8287eb76
7 changed files with 89 additions and 68 deletions

View file

@ -1740,53 +1740,73 @@ void CCodeGen::Xor()
void CCodeGen::Cmp64Eq()
{
if(\
(m_Shadow.GetAt(0) == VARIABLE) && \
(m_Shadow.GetAt(2) == VARIABLE) && \
(m_Shadow.GetAt(4) == VARIABLE) && \
(m_Shadow.GetAt(6) == VARIABLE))
(m_Shadow.GetAt(0) == RELATIVE) && \
(m_Shadow.GetAt(2) == RELATIVE) && \
(m_Shadow.GetAt(4) == RELATIVE) && \
(m_Shadow.GetAt(6) == RELATIVE))
{
uint32 nVariable1, nVariable2, nVariable3, nVariable4;
uint32 nRelative1, nRelative2, nRelative3, nRelative4;
uint32 nRegister1, nRegister2;
m_Shadow.Pull();
nVariable4 = m_Shadow.Pull();
nRelative4 = m_Shadow.Pull();
m_Shadow.Pull();
nVariable3 = m_Shadow.Pull();
nRelative3 = m_Shadow.Pull();
m_Shadow.Pull();
nVariable2 = m_Shadow.Pull();
nRelative2 = m_Shadow.Pull();
m_Shadow.Pull();
nVariable1 = m_Shadow.Pull();
nRelative1 = m_Shadow.Pull();
nRegister1 = AllocateRegister();
nRegister2 = AllocateRegister();
nRegister1 = AllocateRegister(REGISTER_HASLOW);
nRegister2 = AllocateRegister(REGISTER_HASLOW);
//mov reg1, dword ptr[Variable]
m_pBlock->StreamWrite(2, 0x8B, 0x00 | (m_nRegisterLookup[nRegister1] << 3) | (0x05));
m_pBlock->StreamWriteWord(nVariable2);
#ifdef AMD64
//cmp reg1, dword ptr[Variable]
m_pBlock->StreamWrite(2, 0x3B, 0x00 | (m_nRegisterLookup[nRegister1] << 3) | (0x05));
m_pBlock->StreamWriteWord(nVariable4);
if(((nRelative4 - nRelative3) == 4) && ((nRelative2 - nRelative1) == 4))
{
LoadRelativeInRegister64(nRegister1, nRelative1);
//sete reg1[l]
m_pBlock->StreamWrite(3, 0x0F, 0x94, 0xC0 | (0x00 << 3) | (m_nRegisterLookup[nRegister1]));
//cmp reg, qword ptr[base + rel4]
m_pBlock->StreamWrite(2, 0x48, 0x3B);
WriteRelativeRmRegister(nRegister1, nRelative3);
//mov reg2, dword ptr[Variable]
m_pBlock->StreamWrite(2, 0x8B, 0x00 | (m_nRegisterLookup[nRegister2] << 3) | (0x05));
m_pBlock->StreamWriteWord(nVariable1);
//sete reg[l]
m_pBlock->StreamWrite(3, 0x0F, 0x94, 0xC0 | (0x00 << 3) | (m_nRegisterLookup[nRegister1]));
//cmp reg2, dword ptr[Variable]
m_pBlock->StreamWrite(2, 0x3B, 0x00 | (m_nRegisterLookup[nRegister2] << 3) | (0x05));
m_pBlock->StreamWriteWord(nVariable3);
//movzx reg, reg[l]
m_pBlock->StreamWrite(3, 0x0F, 0xB6, 0xC0 | (m_nRegisterLookup[nRegister1] << 3) | (m_nRegisterLookup[nRegister1]));
}
else
//sete reg2[l]
m_pBlock->StreamWrite(3, 0x0F, 0x94, 0xC0 | (0x00 << 3) | (m_nRegisterLookup[nRegister2]));
#endif
{
//mov nReg1, dword ptr[nRel2]
LoadRelativeInRegister(nRegister1, nRelative2);
//and reg1, reg2
m_pBlock->StreamWrite(2, 0x23, 0xC0 | (m_nRegisterLookup[nRegister1] << 3) | (m_nRegisterLookup[nRegister2]));
//cmp nReg1, dword ptr[nRel4]
m_pBlock->StreamWrite(1, 0x3B);
WriteRelativeRmRegister(nRegister1, nRelative4);
//movzx reg1, reg1[l]
m_pBlock->StreamWrite(3, 0x0F, 0xB6, 0xC0 | (m_nRegisterLookup[nRegister1] << 3) | (m_nRegisterLookup[nRegister1]));
//sete reg1[l]
m_pBlock->StreamWrite(3, 0x0F, 0x94, 0xC0 | (0x00 << 3) | (m_nRegisterLookup[nRegister1]));
//mov reg2, dword ptr[nRel1]
LoadRelativeInRegister(nRegister2, nRelative1);
//cmp reg2, dword ptr[nRel3]
m_pBlock->StreamWrite(1, 0x3B);
WriteRelativeRmRegister(nRegister2, nRelative3);
//sete reg2[l]
m_pBlock->StreamWrite(3, 0x0F, 0x94, 0xC0 | (0x00 << 3) | (m_nRegisterLookup[nRegister2]));
//and reg1, reg2
m_pBlock->StreamWrite(2, 0x23, 0xC0 | (m_nRegisterLookup[nRegister1] << 3) | (m_nRegisterLookup[nRegister2]));
//movzx reg1, reg1[l]
m_pBlock->StreamWrite(3, 0x0F, 0xB6, 0xC0 | (m_nRegisterLookup[nRegister1] << 3) | (m_nRegisterLookup[nRegister1]));
}
FreeRegister(nRegister2);

View file

@ -862,12 +862,18 @@ void CGSH_OpenGL::Prim_Sprite()
glBegin(GL_QUADS);
{
//REMOVE
//glColor4d(1.0, 1.0, 1.0, 1.0);
glTexCoord2d(nU1, nV1);
glVertex3d(nX1, nY1, nZ1);
glTexCoord2d(nU2, nV1);
glVertex3d(nX2, nY1, nZ2);
//REMOVE
//glColor4d(0.5, 0.5, 0.5, 1.0);
glTexCoord2d(nU2, nV2);
glVertex3d(nX2, nY2, nZ1);

View file

@ -24,6 +24,8 @@ unsigned int CGSH_OpenGL::LoadTexture(GSTEX0* pReg0, GSTEX1* pReg1, CLAMP* pClam
nWidth = pReg0->GetWidth();
nHeight = pReg0->GetHeight();
//return NULL;
//Set the right texture function
switch(pReg0->nFunction)
{

View file

@ -6,7 +6,7 @@
using namespace IOP;
using namespace Framework;
#define PADNUM (0)
#define PADNUM (1)
#define MODE (0x4)
CPadMan::CPadMan()
@ -24,6 +24,9 @@ void CPadMan::Invoke(uint32 nMethod, void* pArgs, uint32 nArgsSize, void* pRet,
case 0x80000100:
Open(pArgs, nArgsSize, pRet, nRetSize);
break;
case 0x00000008:
SetActuatorAlign(pArgs, nArgsSize, pRet, nRetSize);
break;
case 0x00000010:
Init(pArgs, nArgsSize, pRet, nRetSize);
break;
@ -66,10 +69,12 @@ void CPadMan::SetButtonState(unsigned int nPadNumber, CPadListener::BUTTON nButt
nStatus |= nButton;
}
m_pPad[PADNUM].nReqState = 0;
m_pPad[PADNUM].nData[2] = (uint8)(nStatus >> 8);
m_pPad[PADNUM].nData[3] = (uint8)(nStatus >> 0);
m_pPad[PADNUM].nData[0] = 1;
m_pPad[PADNUM].nData[0] = 0;
m_pPad[PADNUM].nData[1] = MODE << 4;
}
@ -81,14 +86,11 @@ void CPadMan::Open(void* pArgs, uint32 nArgsSize, void* pRet, uint32 nRetSize)
nSlot = ((uint32*)pArgs)[2];
nAddress = ((uint32*)pArgs)[4];
if(nPort == 1)
if(nPort == 0)
{
((uint32*)pRet)[3] = 0x00000000;
return;
m_pPad = (PADDATA*)(CPS2VM::m_pRAM + nAddress);
}
m_pPad = (PADDATA*)(CPS2VM::m_pRAM + nAddress);
Log("Opening device on port %i and slot %i.\r\n", nPort, nSlot);
m_pPad[0].nFrame = 0;
@ -112,6 +114,13 @@ void CPadMan::Open(void* pArgs, uint32 nArgsSize, void* pRet, uint32 nRetSize)
((uint32*)pRet)[3] = 0x00000001;
}
void CPadMan::SetActuatorAlign(void* pArgs, uint32 nArgsSize, void* pRet, uint32 nRetSize)
{
assert(nRetSize >= 24);
((uint32*)pRet)[5] = 1;
}
void CPadMan::Init(void* pArgs, uint32 nArgsSize, void* pRet, uint32 nRetSize)
{
assert(nRetSize >= 0x10);

View file

@ -4,7 +4,7 @@
#include "IOP_Module.h"
#include "PadListener.h"
//#define USE_EX
#define USE_EX
namespace IOP
{
@ -82,7 +82,7 @@ namespace IOP
uint8 nReserved5[13];
};
#else
/*
struct PADDATA
{
uint32 nFrame;
@ -94,29 +94,13 @@ namespace IOP
uint32 nLength;
uint32 nReserved1[5];
};
*/
#pragma pack(push, 1)
//Castlevania: Yami no Juin - The structure is a bit different...
struct PADDATA
{
uint8 nData[0x20];
uint8 nReserved0[0x40];
uint32 nLength;
uint32 nReserved1;
uint32 nFrame;
uint32 nReserved2;
uint8 nState;
uint8 nReqState;
uint8 nOk;
uint8 nReserved3[0xD];
};
#pragma pack(pop)
#endif
PADDATA* m_pPad;
void Open(void*, uint32, void*, uint32);
void SetActuatorAlign(void*, uint32, void*, uint32);
void Init(void*, uint32, void*, uint32);
void GetModuleVersion(void*, uint32, void*, uint32);

View file

@ -297,11 +297,11 @@ void CMA_MIPSIV::BEQ()
{
CCodeGen::Begin(m_pB);
{
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRS].nV[0]);
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRS].nV[1]);
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRS].nV[0]));
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRS].nV[1]));
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRT].nV[0]);
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRT].nV[1]);
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRT].nV[0]));
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRT].nV[1]));
CCodeGen::Cmp64(CCodeGen::CONDITION_EQ);
@ -315,11 +315,11 @@ void CMA_MIPSIV::BNE()
{
CCodeGen::Begin(m_pB);
{
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRS].nV[0]);
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRS].nV[1]);
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRS].nV[0]));
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRS].nV[1]));
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRT].nV[0]);
CCodeGen::PushVar(&m_pCtx->m_State.nGPR[m_nRT].nV[1]);
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRT].nV[0]));
CCodeGen::PushRel(offsetof(CMIPS, m_State.nGPR[m_nRT].nV[1]));
CCodeGen::Cmp64(CCodeGen::CONDITION_EQ);

View file

@ -146,14 +146,14 @@ void CMIPSInstructionFactory::BranchEx(bool nCondition)
nImmediate = (uint16)(m_nOpcode & 0xFFFF);
CCodeGen::PushCst(MIPS_INVALID_PC);
CCodeGen::PullVar(&m_pCtx->m_State.nDelayedJumpAddr);
CCodeGen::PullRel(offsetof(CMIPS, m_State.nDelayedJumpAddr));
CCodeGen::BeginIf(nCondition);
{
CCodeGen::PushVar(&m_pCtx->m_State.nPC);
CCodeGen::PushRel(offsetof(CMIPS, m_State.nPC));
CCodeGen::PushCst(CMIPS::GetBranch(nImmediate));
CCodeGen::Add();
CCodeGen::PullVar(&m_pCtx->m_State.nDelayedJumpAddr);
CCodeGen::PullRel(offsetof(CMIPS, m_State.nDelayedJumpAddr));
}
CCodeGen::EndIf();