git-svn-id: http://svn.purei.org/purei/trunk@185 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
jpd002 2007-12-07 00:26:56 +00:00
parent fb16a959e5
commit 568d187f87
21 changed files with 7897 additions and 7884 deletions

View File

@ -1,6 +1,7 @@
#include "BasicBlock.h"
#include "MipsCodeGen.h"
#include "MemStream.h"
#include "offsetof_def.h"
using namespace Framework;

View File

@ -468,7 +468,7 @@ void CCOP_FPU::LWC1()
//Load the word
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 2, true);
// m_pB->Call(&CCacheBlock::GetWordProxy, 2, true);
m_pB->PullAddr(&m_pCtx->m_State.nCOP10[m_nFT * 2]);
}
CCodeGen::End();
@ -484,7 +484,7 @@ void CCOP_FPU::SWC1()
//Write the words
m_pB->PushAddr(&m_pCtx->m_State.nCOP10[m_nFT * 2]);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::SetWordProxy, 3, false);
// m_pB->Call(&CCacheBlock::SetWordProxy, 3, false);
}
CCodeGen::End();
}

View File

@ -5,6 +5,7 @@
#include "MIPS.h"
#include "CodeGen.h"
#include "MipsCodeGen.h"
#include "offsetof_def.h"
uint8 CCOP_SCU::m_nRT;
uint8 CCOP_SCU::m_nRD;

View File

@ -70,22 +70,22 @@ void CCOP_VU::LQC2()
//Load the word
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 1, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 1, true);
m_pB->PullAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV0);
m_pB->AddImm(4);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 1, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 1, true);
m_pB->PullAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV1);
m_pB->AddImm(4);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 1, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 1, true);
m_pB->PullAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV2);
m_pB->AddImm(4);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 2, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 2, true);
m_pB->PullAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV3);
}
@ -97,22 +97,22 @@ void CCOP_VU::SQC2()
//Write the words
m_pB->PushAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV0);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::SetWordProxy, 2, false);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 2, false);
m_pB->AddImm(4);
m_pB->PushAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV1);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::SetWordProxy, 2, false);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 2, false);
m_pB->AddImm(4);
m_pB->PushAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV2);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::SetWordProxy, 2, false);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 2, false);
m_pB->AddImm(4);
m_pB->PushAddr(&m_pCtx->m_State.nCOP2[m_nFT].nV3);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::SetWordProxy, 3, false);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 3, false);
}
//////////////////////////////////////////////////

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include <algorithm>
#include "GIF.h"
#include "uint128.h"
#include "PS2VM.h"
@ -6,6 +7,7 @@
#include "Log.h"
using namespace Framework;
using namespace std;
#ifdef PROFILE
#define PROFILE_GIFZONE "GIF"

View File

@ -20,12 +20,12 @@
#define W_REG(a, v, r) \
if((a) & 0x4) \
{ \
(r) &= 0x00000000FFFFFFFF; \
(r) &= 0x00000000FFFFFFFFLLU; \
(r) |= (uint64)(v) << 32; \
} \
else \
{ \
(r) &= 0xFFFFFFFF00000000; \
(r) &= 0xFFFFFFFF00000000LLU; \
(r) |= (v); \
}
@ -1169,3 +1169,45 @@ void CGSHandler::ThreadProc()
m_mailBox.ReceiveCall();
}
}
template <> uint8* CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT8>::GetPixelAddress(unsigned int nX, unsigned int nY)
{
typedef CGSHandler::STORAGEPSMT8 Storage;
unsigned int nByte, nTable;
uint32 nColumnNum, nOffset;
nColumnNum = (nY / Storage::COLUMNHEIGHT) & 0x01;
nOffset = GetColumnAddress(nX, nY);
nTable = (nY & 0x02) >> 1;
nByte = (nX & 0x08) >> 2;
nByte += (nY & 0x02) >> 1;
nTable ^= (nColumnNum);
nX &= 0x7;
nY &= 0x1;
return reinterpret_cast<uint8*>(&((uint32*)&m_pMemory[nOffset])[Storage::m_nColumnWordTable[nTable][nY][nX]]) + nByte;
}
template <> uint8 CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT4>::GetPixel(unsigned int nX, unsigned int nY)
{
typedef STORAGEPSMT4 Storage;
uint32 nAddress;
unsigned int nColumnNum, nSubTable, nShiftAmount;
nColumnNum = (nY / Storage::COLUMNHEIGHT) & 0x01;
nAddress = GetColumnAddress(nX, nY);
nShiftAmount = (nX & 0x18);
nShiftAmount += (nY & 0x02) << 1;
nSubTable = (nY & 0x02) >> 1;
nSubTable ^= (nColumnNum);
nX &= 0x07;
nY &= 0x01;
return (uint8)(((uint32*)&m_pMemory[nAddress])[Storage::m_nColumnWordTable[nSubTable][nY][nX]] >> nShiftAmount) & 0x0F;
}

View File

@ -641,26 +641,7 @@ protected:
//////////////////////////////////////////////
//Some storage methods templates specializations
template <> uint8 CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT4>::GetPixel(unsigned int nX, unsigned int nY)
{
typedef STORAGEPSMT4 Storage;
uint32 nAddress;
unsigned int nColumnNum, nSubTable, nShiftAmount;
nColumnNum = (nY / Storage::COLUMNHEIGHT) & 0x01;
nAddress = GetColumnAddress(nX, nY);
nShiftAmount = (nX & 0x18);
nShiftAmount += (nY & 0x02) << 1;
nSubTable = (nY & 0x02) >> 1;
nSubTable ^= (nColumnNum);
nX &= 0x07;
nY &= 0x01;
return (uint8)(((uint32*)&m_pMemory[nAddress])[Storage::m_nColumnWordTable[nSubTable][nY][nX]] >> nShiftAmount) & 0x0F;
}
template <> uint8 CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT4>::GetPixel(unsigned int nX, unsigned int nY);
/*
template <> void CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT4>::SetPixel(unsigned int nX, unsigned int nY, uint8 nPixel)
@ -689,25 +670,6 @@ template <> void CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT4>::SetPixel(u
}
*/
template <> uint8* CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT8>::GetPixelAddress(unsigned int nX, unsigned int nY)
{
typedef CGSHandler::STORAGEPSMT8 Storage;
unsigned int nByte, nTable;
uint32 nColumnNum, nOffset;
nColumnNum = (nY / Storage::COLUMNHEIGHT) & 0x01;
nOffset = GetColumnAddress(nX, nY);
nTable = (nY & 0x02) >> 1;
nByte = (nX & 0x08) >> 2;
nByte += (nY & 0x02) >> 1;
nTable ^= (nColumnNum);
nX &= 0x7;
nY &= 0x1;
return reinterpret_cast<uint8*>(&((uint32*)&m_pMemory[nOffset])[Storage::m_nColumnWordTable[nTable][nY][nX]]) + nByte;
}
template <> uint8* CGSHandler::CPixelIndexor<CGSHandler::STORAGEPSMT8>::GetPixelAddress(unsigned int nX, unsigned int nY);
#endif

View File

@ -164,20 +164,9 @@ namespace IOP
static void Log(const char*, ...);
};
template <> void CPadMan::CPadDataHandler<CPadMan::PADDATA>::SetModeCurId(unsigned int)
{
}
template <> void CPadMan::CPadDataHandler<CPadMan::PADDATA>::SetModeCurOffset(unsigned int)
{
}
template <> void CPadMan::CPadDataHandler<CPadMan::PADDATA>::SetModeTable(unsigned int, unsigned int)
{
}
template <> void CPadMan::CPadDataHandler<CPadMan::PADDATA>::SetModeCurId(unsigned int);
template <> void CPadMan::CPadDataHandler<CPadMan::PADDATA>::SetModeCurOffset(unsigned int);
template <> void CPadMan::CPadDataHandler<CPadMan::PADDATA>::SetModeTable(unsigned int, unsigned int);
}
#endif

View File

@ -4,6 +4,7 @@
#include "StdStream.h"
#include "File.h"
#include "DirectoryRecord.h"
#include "stricmp.h"
using namespace Framework;
using namespace ISO9660;
@ -76,7 +77,7 @@ bool CISO9660::GetFileRecordFromDirectory(CDirectoryRecord* pRecord, uint32 nAdd
if(Entry.GetLength() == 0) break;
if(Entry.IsDirectory()) continue;
if(_strnicmp(Entry.GetName(), sFilename, strlen(sFilename))) continue;
if(strnicmp(Entry.GetName(), sFilename, strlen(sFilename))) continue;
(*pRecord) = Entry;
return true;

View File

@ -1,6 +1,7 @@
#include <assert.h>
#include "PathTable.h"
#include "PtrMacro.h"
#include "stricmp.h"
using namespace Framework;
using namespace ISO9660;
@ -68,7 +69,7 @@ unsigned int CPathTable::FindDirectory(const char* sName, unsigned int nParent)
pRecord = m_Record.Find(i);
if(pRecord == NULL) continue;
if(nParent != pRecord->GetParentRecord()) continue;
if(_stricmp(sName, pRecord->GetName())) continue;
if(stricmp(sName, pRecord->GetName())) continue;
break;
}

View File

@ -1,4 +1,4 @@
#include <malloc.h>
#include <stdlib.h>
#include "PathTableRecord.h"
#include "PtrMacro.h"

View File

@ -1,5 +1,5 @@
#include <string.h>
#include <exception>
#include <stdexcept>
#include "VolumeDescriptor.h"
using namespace Framework;
@ -14,7 +14,7 @@ CVolumeDescriptor::CVolumeDescriptor(CStream* pStream)
if(m_nType != 0x01)
{
throw exception("Invalid ISO9660 Volume Descriptor.");
throw runtime_error("Invalid ISO9660 Volume Descriptor.");
}
pStream->Read(m_sStdId, 5);
@ -22,7 +22,7 @@ CVolumeDescriptor::CVolumeDescriptor(CStream* pStream)
if(strcmp(m_sStdId, "CD001"))
{
throw exception("Invalid ISO9660 Volume Descriptor.");
throw runtime_error("Invalid ISO9660 Volume Descriptor.");
}
pStream->Seek(34, STREAM_SEEK_CUR);

View File

@ -4,6 +4,7 @@
#include "MIPS.h"
#include "MipsCodeGen.h"
#include "PS2OS.h"
#include "offsetof_def.h"
using namespace CodeGen;
@ -71,22 +72,22 @@ void CMA_EE::LQ()
//Load the word
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 1, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 1, true);
m_pB->PullAddr(&m_pCtx->m_State.nGPR[m_nRT].nV[0]);
m_pB->AddImm(4);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 1, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 1, true);
m_pB->PullAddr(&m_pCtx->m_State.nGPR[m_nRT].nV[1]);
m_pB->AddImm(4);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 1, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 1, true);
m_pB->PullAddr(&m_pCtx->m_State.nGPR[m_nRT].nV[2]);
m_pB->AddImm(4);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 2, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 2, true);
m_pB->PullAddr(&m_pCtx->m_State.nGPR[m_nRT].nV[3]);
}
@ -100,7 +101,7 @@ void CMA_EE::SQ()
m_codeGen->PushRef(m_pCtx);
m_codeGen->PushRel(offsetof(CMIPS, m_State.nGPR[m_nRT].nV[i]));
m_codeGen->PushIdx(2);
m_codeGen->Call(&CCacheBlock::SetWordProxy, 3, false);
m_codeGen->Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 3, false);
if(i != 3)
{

View File

@ -5,6 +5,7 @@
#include "VUShared.h"
#include "CodeGen.h"
#include "CodeGen_FPU.h"
#include "offsetof_def.h"
using namespace CodeGen;
@ -148,7 +149,7 @@ void CMA_VU::CLower::LQ()
///////////////////////////////
// Call
CCodeGen::Call(&CCacheBlock::GetWordProxy, 2, true);
CCodeGen::Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 2, true);
///////////////////////////////
// Store value
@ -192,7 +193,7 @@ void CMA_VU::CLower::SQ()
///////////////////////////////
// Call
CCodeGen::Call(&CCacheBlock::SetWordProxy, 3, false);
CCodeGen::Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 3, false);
}
}
@ -209,7 +210,7 @@ void CMA_VU::CLower::ILW()
m_pB->AddImm(GetDestOffset(m_nDest));
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::GetWordProxy, 2, true);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 2, true);
m_pB->PullAddr(&m_pCtx->m_State.nCOP2VI[m_nIT]);
}
@ -226,7 +227,7 @@ void CMA_VU::CLower::ISW()
m_pB->AndImm(0xFFFF);
m_pB->PushRef(m_pCtx);
m_pB->Call(&CCacheBlock::SetWordProxy, 3, false);
m_pB->Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 3, false);
}
//08
@ -577,7 +578,7 @@ void CMA_VU::CLower::LQI()
///////////////////////////////
// Call
CCodeGen::Call(&CCacheBlock::GetWordProxy, 2, true);
CCodeGen::Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 2, true);
///////////////////////////////
// Store result
@ -683,7 +684,7 @@ void CMA_VU::CLower::SQI()
///////////////////////////////
// Call
CCodeGen::Call(&CCacheBlock::SetWordProxy, 3, false);
CCodeGen::Call(reinterpret_cast<void*>(&CCacheBlock::SetWordProxy), 3, false);
}
CCodeGen::PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIT]));
@ -746,7 +747,7 @@ void CMA_VU::CLower::ILWR()
CCodeGen::PushCst(GetDestOffset(m_nDest));
CCodeGen::Add();
CCodeGen::Call(&CCacheBlock::GetWordProxy, 2, true);
CCodeGen::Call(reinterpret_cast<void*>(&CCacheBlock::GetWordProxy), 2, true);
CCodeGen::PullRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIT]));
}

View File

@ -9,7 +9,7 @@
class COsEventManager : public CSingleton<COsEventManager>
{
public:
friend CSingleton;
friend class CSingleton<COsEventManager>;
class COsEvent
{

View File

@ -181,7 +181,7 @@ void CPS2OS::BootFromFile(const char* sPath)
void CPS2OS::BootFromCDROM()
{
CStream* pFile;
CStrA sLine;
string sLine;
const char* sExecPath;
const char* sExecName;
@ -189,7 +189,7 @@ void CPS2OS::BootFromCDROM()
// pFile = CSIF::GetFileIO()->GetFile(IOP::CFileIO::O_RDONLY, "cdrom0:SYSTEM.CNF");
if(pFile == NULL)
{
throw exception("No 'SYSTEM.CNF' file found on the cdrom0 device.");
throw runtime_error("No 'SYSTEM.CNF' file found on the cdrom0 device.");
}
sExecPath = NULL;
@ -197,9 +197,9 @@ void CPS2OS::BootFromCDROM()
Utils::GetLine(pFile, &sLine);
while(!pFile->IsEOF())
{
if(!strncmp(sLine, "BOOT2", 5))
if(!strncmp(sLine.c_str(), "BOOT2", 5))
{
sExecPath = strstr(sLine, "=");
sExecPath = strstr(sLine.c_str(), "=");
if(sExecPath != NULL)
{
sExecPath++;
@ -214,7 +214,7 @@ void CPS2OS::BootFromCDROM()
if(sExecPath == NULL)
{
throw exception("Error parsing 'SYSTEM.CNF' for a BOOT2 value.");
throw runtime_error("Error parsing 'SYSTEM.CNF' for a BOOT2 value.");
}
// pFile = CSIF::GetFileIO()->GetFile(IOP::CFileIO::O_RDONLY, sExecPath);
@ -254,13 +254,13 @@ void CPS2OS::LoadELF(CStream* pStream, const char* sExecName)
if(pELF->m_Header.nCPU != 8)
{
DELETEPTR(pELF);
throw exception("Invalid target CPU. Must be MIPS.");
throw runtime_error("Invalid target CPU. Must be MIPS.");
}
if(pELF->m_Header.nType != 2)
{
DELETEPTR(pELF);
throw exception("Not an executable ELF file.");
throw runtime_error("Not an executable ELF file.");
}
// CPS2VM::Pause();

View File

@ -3,16 +3,21 @@
CThreadMsg::CThreadMsg()
{
m_nMessage = false;
#ifdef WIN32
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
#endif
}
CThreadMsg::~CThreadMsg()
{
#ifdef WIN32
CloseHandle(m_hEvent);
#endif
}
unsigned int CThreadMsg::SendMessage(unsigned int nMsg, void* pParam)
{
#ifdef WIN32
unsigned long nStatus;
MSG wmmsg;
@ -35,25 +40,31 @@ unsigned int CThreadMsg::SendMessage(unsigned int nMsg, void* pParam)
}
return m_Msg.nRetValue;
#endif
return 0;
}
bool CThreadMsg::GetMessage(MESSAGE* pMsg)
{
#ifdef WIN32
if(!m_nMessage) return false;
if(pMsg != NULL)
{
pMsg->nMsg = m_Msg.nMsg;
pMsg->pParam = m_Msg.pParam;
}
#endif
return true;
}
void CThreadMsg::FlushMessage(unsigned int nRetValue)
{
#ifdef WIN32
if(!m_nMessage) return;
m_nMessage = false;
m_Msg.nRetValue = nRetValue;
SetEvent(m_hEvent);
#endif
}
bool CThreadMsg::IsMessagePending()

View File

@ -2,8 +2,9 @@
#include "Utils.h"
using namespace Framework;
using namespace std;
void Utils::GetLine(CStream* pS, CStrA* pStr, bool nIgnoreCR)
void Utils::GetLine(CStream* pS, string* pStr, bool nIgnoreCR)
{
unsigned char nChar;

View File

@ -1,13 +1,12 @@
#ifndef _UTILS_H_
#define _UTILS_H_
#include <string>
#include "Stream.h"
#include "Str.h"
#include "win32/Window.h"
namespace Utils
{
void GetLine(Framework::CStream*, Framework::CStrA*, bool = true);
void GetLine(Framework::CStream*, std::string*, bool = true);
const char* GetFilenameFromPath(const char*, char = '\\');
};

View File

@ -2,7 +2,7 @@
#include "MIPS.h"
#include "CodeGen_FPU.h"
#include "CodeGen_VUF128.h"
#include <stddef.h>
#include "offsetof_def.h"
using namespace VUShared;
using namespace CodeGen;

View File

@ -4,6 +4,7 @@
#include "MIPSReflection.h"
#include "CacheBlock.h"
#include "uint128.h"
#include <string.h>
namespace VUShared
{