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;

File diff suppressed because it is too large Load Diff

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;

File diff suppressed because it is too large Load Diff

View File

@ -1,289 +1,291 @@
#include <stdio.h>
#include "GIF.h"
#include "uint128.h"
#include "PS2VM.h"
#include "Profiler.h"
#include "Log.h"
using namespace Framework;
#ifdef PROFILE
#define PROFILE_GIFZONE "GIF"
#endif
CGIF::CGIF(CGSHandler*& gs, uint8* ram, uint8* spr) :
m_gs(gs),
m_ram(ram),
m_spr(spr),
m_nLoops(0),
m_nCmd(0),
m_nRegs(0),
m_nRegsTemp(0),
m_nRegList(0),
m_nEOP(false),
m_nQTemp(0)
{
}
CGIF::~CGIF()
{
}
void CGIF::Reset()
{
m_nLoops = 0;
m_nCmd = 0;
m_nEOP = false;
}
uint32 CGIF::ProcessPacked(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
uint32 nRegDesc, nStart;
uint64 nTemp;
uint128 nPacket;
nStart = nAddress;
while((m_nLoops != 0) && (nAddress < nEnd))
{
while((m_nRegsTemp != 0) && (nAddress < nEnd))
{
nRegDesc = (uint32)((m_nRegList >> ((m_nRegs - m_nRegsTemp) * 4)) & 0x0F);
nPacket = *(uint128*)&pMemory[nAddress];
nAddress += 0x10;
m_nRegsTemp--;
switch(nRegDesc)
{
case 0x01:
//RGBA
nTemp = (nPacket.nV[0] & 0xFF);
nTemp |= (nPacket.nV[1] & 0xFF) << 8;
nTemp |= (nPacket.nV[2] & 0xFF) << 16;
nTemp |= (nPacket.nV[3] & 0xFF) << 24;
nTemp |= ((uint64)m_nQTemp << 32);
m_gs->WriteRegister(GS_REG_RGBAQ, nTemp);
break;
case 0x02:
//ST
m_nQTemp = nPacket.nV2;
m_gs->WriteRegister(GS_REG_ST, nPacket.nD0);
break;
case 0x03:
//UV
nTemp = (nPacket.nV[0] & 0x7FFF);
nTemp |= (nPacket.nV[1] & 0x7FFF) << 16;
m_gs->WriteRegister(GS_REG_UV, nTemp);
break;
case 0x04:
//XYZF2
nTemp = (nPacket.nV[0] & 0xFFFF);
nTemp |= (nPacket.nV[1] & 0xFFFF) << 16;
nTemp |= (uint64)(nPacket.nV[2] & 0x0FFFFFF0) << 28;
nTemp |= (uint64)(nPacket.nV[3] & 0x00000FF0) << 52;
if(nPacket.nV[3] & 0x8000)
{
m_gs->WriteRegister(GS_REG_XYZF3, nTemp);
}
else
{
m_gs->WriteRegister(GS_REG_XYZF2, nTemp);
}
break;
case 0x05:
//XYZ2
nTemp = (nPacket.nV[0] & 0xFFFF);
nTemp |= (nPacket.nV[1] & 0xFFFF) << 16;
nTemp |= (uint64)(nPacket.nV[2] & 0xFFFFFFFF) << 32;
if(nPacket.nV[3] & 0x8000)
{
m_gs->WriteRegister(GS_REG_XYZ3, nTemp);
}
else
{
m_gs->WriteRegister(GS_REG_XYZ2, nTemp);
}
break;
case 0x06:
//TEX0_1
m_gs->WriteRegister(GS_REG_TEX0_1, nPacket.nD0);
break;
case 0x0E:
//A + D
m_gs->WriteRegister((uint8)nPacket.nD1, nPacket.nD0);
break;
default:
assert(0);
break;
}
}
if(m_nRegsTemp == 0)
{
m_nLoops--;
m_nRegsTemp = m_nRegs;
}
}
return nAddress - nStart;
}
uint32 CGIF::ProcessRegList(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
uint32 nRegDesc, j, nStart;
uint128 nPacket;
nStart = nAddress;
while(m_nLoops != 0)
{
for(j = 0; j < m_nRegs; j++)
{
assert(nAddress < nEnd);
nRegDesc = (uint32)((m_nRegList >> (j * 4)) & 0x0F);
nPacket.nV[0] = *(uint32*)&pMemory[nAddress + 0x00];
nPacket.nV[1] = *(uint32*)&pMemory[nAddress + 0x04];
nAddress += 0x08;
if(nRegDesc == 0x0F) continue;
m_gs->WriteRegister((uint8)nRegDesc, nPacket.nD0);
}
m_nLoops--;
}
//Align on qword boundary
if(nAddress & 0x07)
{
nAddress += 8;
}
return nAddress - nStart;
}
uint32 CGIF::ProcessImage(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
uint16 nTotalLoops;
nTotalLoops = (uint16)((nEnd - nAddress) / 0x10);
nTotalLoops = min(nTotalLoops, m_nLoops);
m_gs->FeedImageData(pMemory + nAddress, nTotalLoops * 0x10);
m_nLoops -= nTotalLoops;
return (nTotalLoops * 0x10);
}
uint32 CGIF::ProcessPacket(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
#ifdef PROFILE
CProfiler::GetInstance().BeginZone(PROFILE_GIFZONE);
#endif
uint128 nPacket;
uint32 nStart;
#ifdef _DEBUG
CLog::GetInstance().Print("gif", "Processed GIF packet at 0x%0.8X.\r\n", nAddress);
#endif
nStart = nAddress;
while(nAddress < nEnd)
{
if(m_nLoops == 0)
{
if(m_nEOP)
{
m_nEOP = false;
break;
}
//We need to update the registers
nPacket = *(uint128*)&pMemory[nAddress];
nAddress += 0x10;
m_nLoops = (uint16)((nPacket.nV0 >> 0) & 0x7FFF);
m_nCmd = ( uint8)((nPacket.nV1 >> 26) & 0x0003);
m_nRegs = ( uint8)((nPacket.nV1 >> 28) & 0x000F);
m_nRegList = nPacket.nD1;
m_nEOP = (nPacket.nV0 & 0x8000) != 0;
if(m_nCmd != 1)
{
if(nPacket.nV1 & 0x4000)
{
m_gs->WriteRegister(GS_REG_PRIM, (uint16)(nPacket.nV1 >> 15) & 0x3FF);
}
}
if(m_nRegs == 0) m_nRegs = 0x10;
m_nRegsTemp = m_nRegs;
continue;
}
switch(m_nCmd)
{
case 0x00:
nAddress += ProcessPacked(pMemory, nAddress, nEnd);
break;
case 0x01:
nAddress += ProcessRegList(pMemory, nAddress, nEnd);
break;
case 0x02:
case 0x03:
nAddress += ProcessImage(pMemory, nAddress, nEnd);
break;
}
}
if(m_nLoops == 0)
{
if(m_nEOP)
{
m_nEOP = false;
}
}
#ifdef PROFILE
CProfiler::GetInstance().EndZone();
#endif
return nAddress - nStart;
}
uint32 CGIF::ReceiveDMA(uint32 nAddress, uint32 nQWC, bool nTagIncluded)
{
uint32 nEnd, nSize;
uint8* pMemory;
assert(nTagIncluded == false);
if(nAddress & 0x80000000)
{
pMemory = m_spr;
nAddress &= CPS2VM::SPRSIZE - 1;
}
else
{
pMemory = m_ram;
}
nSize = nQWC * 0x10;
nEnd = nAddress + nSize;
while(nAddress < nEnd)
{
nAddress += ProcessPacket(pMemory, nAddress, nEnd);
}
return nQWC;
}
#include <stdio.h>
#include <algorithm>
#include "GIF.h"
#include "uint128.h"
#include "PS2VM.h"
#include "Profiler.h"
#include "Log.h"
using namespace Framework;
using namespace std;
#ifdef PROFILE
#define PROFILE_GIFZONE "GIF"
#endif
CGIF::CGIF(CGSHandler*& gs, uint8* ram, uint8* spr) :
m_gs(gs),
m_ram(ram),
m_spr(spr),
m_nLoops(0),
m_nCmd(0),
m_nRegs(0),
m_nRegsTemp(0),
m_nRegList(0),
m_nEOP(false),
m_nQTemp(0)
{
}
CGIF::~CGIF()
{
}
void CGIF::Reset()
{
m_nLoops = 0;
m_nCmd = 0;
m_nEOP = false;
}
uint32 CGIF::ProcessPacked(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
uint32 nRegDesc, nStart;
uint64 nTemp;
uint128 nPacket;
nStart = nAddress;
while((m_nLoops != 0) && (nAddress < nEnd))
{
while((m_nRegsTemp != 0) && (nAddress < nEnd))
{
nRegDesc = (uint32)((m_nRegList >> ((m_nRegs - m_nRegsTemp) * 4)) & 0x0F);
nPacket = *(uint128*)&pMemory[nAddress];
nAddress += 0x10;
m_nRegsTemp--;
switch(nRegDesc)
{
case 0x01:
//RGBA
nTemp = (nPacket.nV[0] & 0xFF);
nTemp |= (nPacket.nV[1] & 0xFF) << 8;
nTemp |= (nPacket.nV[2] & 0xFF) << 16;
nTemp |= (nPacket.nV[3] & 0xFF) << 24;
nTemp |= ((uint64)m_nQTemp << 32);
m_gs->WriteRegister(GS_REG_RGBAQ, nTemp);
break;
case 0x02:
//ST
m_nQTemp = nPacket.nV2;
m_gs->WriteRegister(GS_REG_ST, nPacket.nD0);
break;
case 0x03:
//UV
nTemp = (nPacket.nV[0] & 0x7FFF);
nTemp |= (nPacket.nV[1] & 0x7FFF) << 16;
m_gs->WriteRegister(GS_REG_UV, nTemp);
break;
case 0x04:
//XYZF2
nTemp = (nPacket.nV[0] & 0xFFFF);
nTemp |= (nPacket.nV[1] & 0xFFFF) << 16;
nTemp |= (uint64)(nPacket.nV[2] & 0x0FFFFFF0) << 28;
nTemp |= (uint64)(nPacket.nV[3] & 0x00000FF0) << 52;
if(nPacket.nV[3] & 0x8000)
{
m_gs->WriteRegister(GS_REG_XYZF3, nTemp);
}
else
{
m_gs->WriteRegister(GS_REG_XYZF2, nTemp);
}
break;
case 0x05:
//XYZ2
nTemp = (nPacket.nV[0] & 0xFFFF);
nTemp |= (nPacket.nV[1] & 0xFFFF) << 16;
nTemp |= (uint64)(nPacket.nV[2] & 0xFFFFFFFF) << 32;
if(nPacket.nV[3] & 0x8000)
{
m_gs->WriteRegister(GS_REG_XYZ3, nTemp);
}
else
{
m_gs->WriteRegister(GS_REG_XYZ2, nTemp);
}
break;
case 0x06:
//TEX0_1
m_gs->WriteRegister(GS_REG_TEX0_1, nPacket.nD0);
break;
case 0x0E:
//A + D
m_gs->WriteRegister((uint8)nPacket.nD1, nPacket.nD0);
break;
default:
assert(0);
break;
}
}
if(m_nRegsTemp == 0)
{
m_nLoops--;
m_nRegsTemp = m_nRegs;
}
}
return nAddress - nStart;
}
uint32 CGIF::ProcessRegList(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
uint32 nRegDesc, j, nStart;
uint128 nPacket;
nStart = nAddress;
while(m_nLoops != 0)
{
for(j = 0; j < m_nRegs; j++)
{
assert(nAddress < nEnd);
nRegDesc = (uint32)((m_nRegList >> (j * 4)) & 0x0F);
nPacket.nV[0] = *(uint32*)&pMemory[nAddress + 0x00];
nPacket.nV[1] = *(uint32*)&pMemory[nAddress + 0x04];
nAddress += 0x08;
if(nRegDesc == 0x0F) continue;
m_gs->WriteRegister((uint8)nRegDesc, nPacket.nD0);
}
m_nLoops--;
}
//Align on qword boundary
if(nAddress & 0x07)
{
nAddress += 8;
}
return nAddress - nStart;
}
uint32 CGIF::ProcessImage(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
uint16 nTotalLoops;
nTotalLoops = (uint16)((nEnd - nAddress) / 0x10);
nTotalLoops = min(nTotalLoops, m_nLoops);
m_gs->FeedImageData(pMemory + nAddress, nTotalLoops * 0x10);
m_nLoops -= nTotalLoops;
return (nTotalLoops * 0x10);
}
uint32 CGIF::ProcessPacket(uint8* pMemory, uint32 nAddress, uint32 nEnd)
{
#ifdef PROFILE
CProfiler::GetInstance().BeginZone(PROFILE_GIFZONE);
#endif
uint128 nPacket;
uint32 nStart;
#ifdef _DEBUG
CLog::GetInstance().Print("gif", "Processed GIF packet at 0x%0.8X.\r\n", nAddress);
#endif
nStart = nAddress;
while(nAddress < nEnd)
{
if(m_nLoops == 0)
{
if(m_nEOP)
{
m_nEOP = false;
break;
}
//We need to update the registers
nPacket = *(uint128*)&pMemory[nAddress];
nAddress += 0x10;
m_nLoops = (uint16)((nPacket.nV0 >> 0) & 0x7FFF);
m_nCmd = ( uint8)((nPacket.nV1 >> 26) & 0x0003);
m_nRegs = ( uint8)((nPacket.nV1 >> 28) & 0x000F);
m_nRegList = nPacket.nD1;
m_nEOP = (nPacket.nV0 & 0x8000) != 0;
if(m_nCmd != 1)
{
if(nPacket.nV1 & 0x4000)
{
m_gs->WriteRegister(GS_REG_PRIM, (uint16)(nPacket.nV1 >> 15) & 0x3FF);
}
}
if(m_nRegs == 0) m_nRegs = 0x10;
m_nRegsTemp = m_nRegs;
continue;
}
switch(m_nCmd)
{
case 0x00:
nAddress += ProcessPacked(pMemory, nAddress, nEnd);
break;
case 0x01:
nAddress += ProcessRegList(pMemory, nAddress, nEnd);
break;
case 0x02:
case 0x03:
nAddress += ProcessImage(pMemory, nAddress, nEnd);
break;
}
}
if(m_nLoops == 0)
{
if(m_nEOP)
{
m_nEOP = false;
}
}
#ifdef PROFILE
CProfiler::GetInstance().EndZone();
#endif
return nAddress - nStart;
}
uint32 CGIF::ReceiveDMA(uint32 nAddress, uint32 nQWC, bool nTagIncluded)
{
uint32 nEnd, nSize;
uint8* pMemory;
assert(nTagIncluded == false);
if(nAddress & 0x80000000)
{
pMemory = m_spr;
nAddress &= CPS2VM::SPRSIZE - 1;
}
else
{
pMemory = m_ram;
}
nSize = nQWC * 0x10;
nEnd = nAddress + nSize;
while(nAddress < nEnd)
{
nAddress += ProcessPacket(pMemory, nAddress, nEnd);
}
return nQWC;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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

@ -1,98 +1,99 @@
#include <limits.h>
#include "ISO9660.h"
#include "PtrMacro.h"
#include "StdStream.h"
#include "File.h"
#include "DirectoryRecord.h"
using namespace Framework;
using namespace ISO9660;
CISO9660::CISO9660(CStream* pStream)
{
m_pStream = pStream;
m_pVolumeDescriptor = new CVolumeDescriptor(pStream);
m_pPathTable = new CPathTable(pStream, m_pVolumeDescriptor->GetLPathTableAddress());
}
CISO9660::~CISO9660()
{
DELETEPTR(m_pVolumeDescriptor);
DELETEPTR(m_pPathTable);
DELETEPTR(m_pStream);
}
void CISO9660::ReadBlock(uint32 nAddress, void* pData)
{
//Caching mechanism?
m_pStream->Seek(nAddress * BLOCKSIZE, STREAM_SEEK_SET);
m_pStream->Read(pData, BLOCKSIZE);
}
bool CISO9660::GetFileRecord(CDirectoryRecord* pRecord, const char* sFilename)
{
const char* sNext;
char sDir[257];
unsigned int nRecord;
unsigned int nAddress;
size_t nLenght;
//Remove the first '/'
if(sFilename[0] == '/' || sFilename[0] == '\\') sFilename++;
nRecord = m_pPathTable->FindRoot();
while(1)
{
//Find the next '/'
sNext = strchr(sFilename, '/');
if(sNext == NULL) break;
nLenght = sNext - sFilename;
strncpy(sDir, sFilename, nLenght);
sDir[nLenght] = 0x00;
nRecord = m_pPathTable->FindDirectory(sDir, nRecord);
if(nRecord == 0)
{
return false;
}
sFilename = sNext + 1;
}
nAddress = m_pPathTable->GetDirectoryAddress(nRecord);
return GetFileRecordFromDirectory(pRecord, nAddress, sFilename);
}
bool CISO9660::GetFileRecordFromDirectory(CDirectoryRecord* pRecord, uint32 nAddress, const char* sFilename)
{
CFile Directory(this, nAddress * BLOCKSIZE, ULLONG_MAX - (nAddress * BLOCKSIZE));
while(1)
{
CDirectoryRecord Entry(&Directory);
if(Entry.GetLength() == 0) break;
if(Entry.IsDirectory()) continue;
if(_strnicmp(Entry.GetName(), sFilename, strlen(sFilename))) continue;
(*pRecord) = Entry;
return true;
}
return false;
}
CStream* CISO9660::Open(const char* sFilename)
{
CDirectoryRecord Record;
if(GetFileRecord(&Record, sFilename))
{
return new CFile(this, Record.GetPosition() * BLOCKSIZE, Record.GetDataLength());
}
return NULL;
}
#include <limits.h>
#include "ISO9660.h"
#include "PtrMacro.h"
#include "StdStream.h"
#include "File.h"
#include "DirectoryRecord.h"
#include "stricmp.h"
using namespace Framework;
using namespace ISO9660;
CISO9660::CISO9660(CStream* pStream)
{
m_pStream = pStream;
m_pVolumeDescriptor = new CVolumeDescriptor(pStream);
m_pPathTable = new CPathTable(pStream, m_pVolumeDescriptor->GetLPathTableAddress());
}
CISO9660::~CISO9660()
{
DELETEPTR(m_pVolumeDescriptor);
DELETEPTR(m_pPathTable);
DELETEPTR(m_pStream);
}
void CISO9660::ReadBlock(uint32 nAddress, void* pData)
{
//Caching mechanism?
m_pStream->Seek(nAddress * BLOCKSIZE, STREAM_SEEK_SET);
m_pStream->Read(pData, BLOCKSIZE);
}
bool CISO9660::GetFileRecord(CDirectoryRecord* pRecord, const char* sFilename)
{
const char* sNext;
char sDir[257];
unsigned int nRecord;
unsigned int nAddress;
size_t nLenght;
//Remove the first '/'
if(sFilename[0] == '/' || sFilename[0] == '\\') sFilename++;
nRecord = m_pPathTable->FindRoot();
while(1)
{
//Find the next '/'
sNext = strchr(sFilename, '/');
if(sNext == NULL) break;
nLenght = sNext - sFilename;
strncpy(sDir, sFilename, nLenght);
sDir[nLenght] = 0x00;
nRecord = m_pPathTable->FindDirectory(sDir, nRecord);
if(nRecord == 0)
{
return false;
}
sFilename = sNext + 1;
}
nAddress = m_pPathTable->GetDirectoryAddress(nRecord);
return GetFileRecordFromDirectory(pRecord, nAddress, sFilename);
}
bool CISO9660::GetFileRecordFromDirectory(CDirectoryRecord* pRecord, uint32 nAddress, const char* sFilename)
{
CFile Directory(this, nAddress * BLOCKSIZE, ULLONG_MAX - (nAddress * BLOCKSIZE));
while(1)
{
CDirectoryRecord Entry(&Directory);
if(Entry.GetLength() == 0) break;
if(Entry.IsDirectory()) continue;
if(strnicmp(Entry.GetName(), sFilename, strlen(sFilename))) continue;
(*pRecord) = Entry;
return true;
}
return false;
}
CStream* CISO9660::Open(const char* sFilename)
{
CDirectoryRecord Record;
if(GetFileRecord(&Record, sFilename))
{
return new CFile(this, Record.GetPosition() * BLOCKSIZE, Record.GetDataLength());
}
return NULL;
}

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,48 +1,48 @@
#include <malloc.h>
#include "PathTableRecord.h"
#include "PtrMacro.h"
using namespace Framework;
using namespace ISO9660;
CPathTableRecord::CPathTableRecord(CStream* pStream)
{
pStream->Read(&m_nNameLenght, 1);
pStream->Read(&m_nExLenght, 1);
pStream->Read(&m_nLocation, 4);
pStream->Read(&m_nParentDir, 2);
m_sDirectory = (char*)malloc(m_nNameLenght + 1);
pStream->Read(m_sDirectory, m_nNameLenght);
m_sDirectory[m_nNameLenght] = 0;
if(m_nNameLenght & 1)
{
pStream->Seek(1, STREAM_SEEK_CUR);
}
}
CPathTableRecord::~CPathTableRecord()
{
FREEPTR(m_sDirectory);
}
uint8 CPathTableRecord::GetNameLenght() const
{
return m_nNameLenght;
}
uint32 CPathTableRecord::GetAddress() const
{
return m_nLocation;
}
uint32 CPathTableRecord::GetParentRecord() const
{
return m_nParentDir;
}
const char* CPathTableRecord::GetName() const
{
return m_sDirectory;
}
#include <stdlib.h>
#include "PathTableRecord.h"
#include "PtrMacro.h"
using namespace Framework;
using namespace ISO9660;
CPathTableRecord::CPathTableRecord(CStream* pStream)
{
pStream->Read(&m_nNameLenght, 1);
pStream->Read(&m_nExLenght, 1);
pStream->Read(&m_nLocation, 4);
pStream->Read(&m_nParentDir, 2);
m_sDirectory = (char*)malloc(m_nNameLenght + 1);
pStream->Read(m_sDirectory, m_nNameLenght);
m_sDirectory[m_nNameLenght] = 0;
if(m_nNameLenght & 1)
{
pStream->Seek(1, STREAM_SEEK_CUR);
}
}
CPathTableRecord::~CPathTableRecord()
{
FREEPTR(m_sDirectory);
}
uint8 CPathTableRecord::GetNameLenght() const
{
return m_nNameLenght;
}
uint32 CPathTableRecord::GetAddress() const
{
return m_nLocation;
}
uint32 CPathTableRecord::GetParentRecord() const
{
return m_nParentDir;
}
const char* CPathTableRecord::GetName() const
{
return m_sDirectory;
}

View File

@ -1,52 +1,52 @@
#include <string.h>
#include <exception>
#include "VolumeDescriptor.h"
using namespace Framework;
using namespace ISO9660;
using namespace std;
CVolumeDescriptor::CVolumeDescriptor(CStream* pStream)
{
//Starts at LBA 16
pStream->Seek(0x8000, STREAM_SEEK_SET);
pStream->Read(&m_nType, 1);
if(m_nType != 0x01)
{
throw exception("Invalid ISO9660 Volume Descriptor.");
}
pStream->Read(m_sStdId, 5);
m_sStdId[5] = 0x00;
if(strcmp(m_sStdId, "CD001"))
{
throw exception("Invalid ISO9660 Volume Descriptor.");
}
pStream->Seek(34, STREAM_SEEK_CUR);
pStream->Read(m_sVolumeId, 32);
m_sVolumeId[32] = 0x00;
pStream->Seek(68, STREAM_SEEK_CUR);
pStream->Read(&m_nLPathTableAddress, 4);
pStream->Read(&m_nMPathTableAddress, 4);
}
CVolumeDescriptor::~CVolumeDescriptor()
{
}
uint32 CVolumeDescriptor::GetLPathTableAddress() const
{
return m_nLPathTableAddress;
}
uint32 CVolumeDescriptor::GetMPathTableAddress() const
{
return m_nMPathTableAddress;
}
#include <string.h>
#include <stdexcept>
#include "VolumeDescriptor.h"
using namespace Framework;
using namespace ISO9660;
using namespace std;
CVolumeDescriptor::CVolumeDescriptor(CStream* pStream)
{
//Starts at LBA 16
pStream->Seek(0x8000, STREAM_SEEK_SET);
pStream->Read(&m_nType, 1);
if(m_nType != 0x01)
{
throw runtime_error("Invalid ISO9660 Volume Descriptor.");
}
pStream->Read(m_sStdId, 5);
m_sStdId[5] = 0x00;
if(strcmp(m_sStdId, "CD001"))
{
throw runtime_error("Invalid ISO9660 Volume Descriptor.");
}
pStream->Seek(34, STREAM_SEEK_CUR);
pStream->Read(m_sVolumeId, 32);
m_sVolumeId[32] = 0x00;
pStream->Seek(68, STREAM_SEEK_CUR);
pStream->Read(&m_nLPathTableAddress, 4);
pStream->Read(&m_nMPathTableAddress, 4);
}
CVolumeDescriptor::~CVolumeDescriptor()
{
}
uint32 CVolumeDescriptor::GetLPathTableAddress() const
{
return m_nLPathTableAddress;
}
uint32 CVolumeDescriptor::GetMPathTableAddress() const
{
return m_nMPathTableAddress;
}

File diff suppressed because it is too large Load Diff

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

@ -1,45 +1,45 @@
#ifndef _OSEVENTMANAGER_H_
#define _OSEVENTMANAGER_H_
#include "Singleton.h"
#include "xml/Node.h"
#include "Types.h"
#include <vector>
class COsEventManager : public CSingleton<COsEventManager>
{
public:
friend CSingleton;
class COsEvent
{
public:
unsigned int nTime;
unsigned int nThreadId;
unsigned int nEventType;
uint32 nAddress;
std::string sDescription;
};
void Begin(const char*);
void InsertEvent(COsEvent);
void Flush();
Framework::Xml::CNode* GetEvents();
private:
enum
{
RESERVE = 500,
};
typedef std::vector<COsEvent> EventListType;
COsEventManager();
virtual ~COsEventManager();
unsigned int m_nCurrentTime;
EventListType m_Events;
std::string m_sRecordPath;
};
#endif
#ifndef _OSEVENTMANAGER_H_
#define _OSEVENTMANAGER_H_
#include "Singleton.h"
#include "xml/Node.h"
#include "Types.h"
#include <vector>
class COsEventManager : public CSingleton<COsEventManager>
{
public:
friend class CSingleton<COsEventManager>;
class COsEvent
{
public:
unsigned int nTime;
unsigned int nThreadId;
unsigned int nEventType;
uint32 nAddress;
std::string sDescription;
};
void Begin(const char*);
void InsertEvent(COsEvent);
void Flush();
Framework::Xml::CNode* GetEvents();
private:
enum
{
RESERVE = 500,
};
typedef std::vector<COsEvent> EventListType;
COsEventManager();
virtual ~COsEventManager();
unsigned int m_nCurrentTime;
EventListType m_Events;
std::string m_sRecordPath;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,62 +1,73 @@
#include "ThreadMsg.h"
CThreadMsg::CThreadMsg()
{
m_nMessage = false;
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
}
CThreadMsg::~CThreadMsg()
{
CloseHandle(m_hEvent);
}
unsigned int CThreadMsg::SendMessage(unsigned int nMsg, void* pParam)
{
unsigned long nStatus;
MSG wmmsg;
m_Msg.nMsg = nMsg;
m_Msg.pParam = pParam;
m_Msg.nRetValue = 0;
m_nMessage = true;
ResetEvent(m_hEvent);
while(1)
{
nStatus = MsgWaitForMultipleObjects(1, &m_hEvent, FALSE, INFINITE, QS_SENDMESSAGE);
if(nStatus == WAIT_OBJECT_0) break;
//Process the message in queue to prevent a possible deadlock
if(PeekMessage(&wmmsg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&wmmsg);
DispatchMessage(&wmmsg);
}
}
return m_Msg.nRetValue;
}
bool CThreadMsg::GetMessage(MESSAGE* pMsg)
{
if(!m_nMessage) return false;
if(pMsg != NULL)
{
pMsg->nMsg = m_Msg.nMsg;
pMsg->pParam = m_Msg.pParam;
}
return true;
}
void CThreadMsg::FlushMessage(unsigned int nRetValue)
{
if(!m_nMessage) return;
m_nMessage = false;
m_Msg.nRetValue = nRetValue;
SetEvent(m_hEvent);
}
bool CThreadMsg::IsMessagePending()
{
return m_nMessage;
}
#include "ThreadMsg.h"
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;
m_Msg.nMsg = nMsg;
m_Msg.pParam = pParam;
m_Msg.nRetValue = 0;
m_nMessage = true;
ResetEvent(m_hEvent);
while(1)
{
nStatus = MsgWaitForMultipleObjects(1, &m_hEvent, FALSE, INFINITE, QS_SENDMESSAGE);
if(nStatus == WAIT_OBJECT_0) break;
//Process the message in queue to prevent a possible deadlock
if(PeekMessage(&wmmsg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&wmmsg);
DispatchMessage(&wmmsg);
}
}
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()
{
return m_nMessage;
}

View File

@ -1,34 +1,35 @@
#include <string.h>
#include "Utils.h"
using namespace Framework;
void Utils::GetLine(CStream* pS, CStrA* pStr, bool nIgnoreCR)
{
unsigned char nChar;
(*pStr) = "";
pS->Read(&nChar, 1);
while(!pS->IsEOF())
{
if(!(nIgnoreCR && (nChar == '\r')))
{
(*pStr) += nChar;
}
pS->Read(&nChar, 1);
if(nChar == '\n') break;
}
}
const char* Utils::GetFilenameFromPath(const char* sPath, char nSeparator)
{
const char* sTemp;
sTemp = strchr(sPath, nSeparator);
while(sTemp != NULL)
{
sPath = sTemp + 1;
sTemp = strchr(sPath, nSeparator);
}
return sPath;
}
#include <string.h>
#include "Utils.h"
using namespace Framework;
using namespace std;
void Utils::GetLine(CStream* pS, string* pStr, bool nIgnoreCR)
{
unsigned char nChar;
(*pStr) = "";
pS->Read(&nChar, 1);
while(!pS->IsEOF())
{
if(!(nIgnoreCR && (nChar == '\r')))
{
(*pStr) += nChar;
}
pS->Read(&nChar, 1);
if(nChar == '\n') break;
}
}
const char* Utils::GetFilenameFromPath(const char* sPath, char nSeparator)
{
const char* sTemp;
sTemp = strchr(sPath, nSeparator);
while(sTemp != NULL)
{
sPath = sTemp + 1;
sTemp = strchr(sPath, nSeparator);
}
return sPath;
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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