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

This commit is contained in:
jpd002 2006-08-08 06:27:51 +00:00
parent 64cb660a11
commit 1d04853ae0
7 changed files with 26 additions and 16 deletions

View File

@ -1,6 +1,8 @@
#ifndef _ARRAYSTACK_H_
#define _ARRAYSTACK_H_
#include <exception>
template <typename Type, unsigned int MAXSIZE = 0x100> class CArrayStack
{
public:
@ -18,7 +20,7 @@ public:
{
if(m_nStackPointer + nAddress >= MAXSIZE)
{
throw "Invalid Address.";
throw std::exception("Invalid Address.");
}
return m_nStack[m_nStackPointer + nAddress];
}
@ -27,7 +29,7 @@ public:
{
if(m_nStackPointer + nAddress >= MAXSIZE)
{
throw "Invalid Address.";
throw std::exception("Invalid Address.");
}
m_nStack[m_nStackPointer + nAddress] = nValue;
}
@ -36,7 +38,7 @@ public:
{
if(m_nStackPointer == 0)
{
throw "Stack Full.";
throw std::exception("Stack Full.");
}
m_nStack[--m_nStackPointer] = nValue;
}
@ -45,7 +47,7 @@ public:
{
if(m_nStackPointer == MAXSIZE)
{
throw "Stack Empty.";
throw std::exception("Stack Empty.");
}
return m_nStack[m_nStackPointer++];
}

View File

@ -1,8 +1,10 @@
#include <assert.h>
#include <string.h>
#include <exception>
#include "ELF.h"
using namespace Framework;
using namespace std;
CELF::CELF(CStream* pS)
{
@ -20,12 +22,12 @@ CELF::CELF(CStream* pS)
if(m_Header.nId[0] != 0x7F || m_Header.nId[1] != 'E' || m_Header.nId[2] != 'L' || m_Header.nId[3] != 'F')
{
throw "This file isn't a valid ELF file.";
throw exception("This file isn't a valid ELF file.");
}
if(m_Header.nId[4] != 1 || m_Header.nId[5] != 1)
{
throw "This ELF file format is not supported. Only 32-bits LSB ordered ELFs are supported.";
throw exception("This ELF file format is not supported. Only 32-bits LSB ordered ELFs are supported.");
}
nCount = m_Header.nProgHeaderCount;

View File

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

View File

@ -255,23 +255,23 @@ void CPS2OS::LoadELF(CStream* pStream, const char* sExecName)
pELF = new CELF(pStream);
delete pStream;
}
catch(const char* sError)
catch(const exception& Exception)
{
delete pStream;
throw sError;
throw Exception;
}
//Check for MIPS CPU
if(pELF->m_Header.nCPU != 8)
{
DELETEPTR(pELF);
throw "Invalid target CPU. Must be MIPS.";
throw exception("Invalid target CPU. Must be MIPS.");
}
if(pELF->m_Header.nType != 2)
{
DELETEPTR(pELF);
throw "Not an executable ELF file.";
throw exception("Not an executable ELF file.");
}
CPS2VM::Pause();

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include <exception>
#include "PS2VM.h"
#include "DMAC.h"
#include "INTC.h"
@ -38,6 +39,7 @@
using namespace Framework;
using namespace boost;
using namespace std;
uint8* CPS2VM::m_pRAM = NULL;
uint8* CPS2VM::m_pBIOS = NULL;
@ -400,9 +402,9 @@ void CPS2VM::CDROM0_Mount(const char* sPath)
}
m_pCDROM0 = new CISO9660(pStream);
}
catch(const char* sError)
catch(const exception& Exception)
{
printf("PS2VM: Error mounting cdrom0 device: %s\r\n", sError);
printf("PS2VM: Error mounting cdrom0 device: %s\r\n", Exception.what());
}
}

View File

@ -1,7 +1,9 @@
#include <exception>
#include "VolumeStream.h"
using namespace Framework;
using namespace Framework::Win32;
using namespace std;
CVolumeStream::CVolumeStream(char nDriveLetter)
{
@ -41,7 +43,7 @@ void CVolumeStream::Seek(int64 nDistance, STREAM_SEEK_DIRECTION nFrom)
m_nPosition += nDistance;
break;
case STREAM_SEEK_END:
throw "Operation not supported.";
throw exception("Operation not supported.");
break;
}
}
@ -83,7 +85,7 @@ uint64 CVolumeStream::Read(void* pBuffer, uint64 nSize)
uint64 CVolumeStream::Write(const void* pBuffer, uint64 nSize)
{
throw "Operation not-supported.";
throw exception("Operation not-supported.");
}
bool CVolumeStream::IsEOF()

Binary file not shown.