Get Linux working again.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2154 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-11-08 00:30:52 +00:00
parent 7732c7b46e
commit 8bed2e5ff3
4 changed files with 502 additions and 499 deletions

View File

@ -17,15 +17,19 @@ IsoFile::IsoFile(SectorSource* reader, IsoFileDescriptor fileEntry)
reader->readSector(currentSector,currentSectorNumber);
}
void IsoFile::seek(__int64 offset)
void IsoFile::seek(s64 offset)
{
__int64 endOffset = offset;
s64 endOffset = offset;
#ifdef __LINUX__
if (offset<0) throw "Seek offset out of bounds.";
#else
if(offset<0)
throw new exception("Seek offset out of bounds.");
#endif
int oldSectorNumber = currentSectorNumber;
__int64 newOffset = endOffset;
s64 newOffset = endOffset;
int newSectorNumber = fileEntry.lba + (int)(newOffset / sectorLength);
if(oldSectorNumber != newSectorNumber)
{
@ -36,7 +40,7 @@ void IsoFile::seek(__int64 offset)
sectorOffset = (int)(currentOffset % sectorLength);
}
void IsoFile::seek(__int64 offset, int ref_position)
void IsoFile::seek(s64 offset, int ref_position)
{
if(ref_position == SEEK_SET)
seek(offset);
@ -53,9 +57,9 @@ void IsoFile::reset()
seek(0);
}
__int64 IsoFile::skip(__int64 n)
s64 IsoFile::skip(s64 n)
{
__int64 oldOffset = currentOffset;
s64 oldOffset = currentOffset;
if(n<0)
return n;
@ -65,7 +69,7 @@ __int64 IsoFile::skip(__int64 n)
return currentOffset-oldOffset;
}
__int64 IsoFile::getFilePointer()
s64 IsoFile::getFilePointer()
{
return currentOffset;
}
@ -197,7 +201,7 @@ wstring IsoFile::readLineW()
return s;
}
__int64 IsoFile::getLength()
s64 IsoFile::getLength()
{
return maxOffset;
}

View File

@ -11,8 +11,8 @@ public:
private:
IsoFileDescriptor fileEntry;
__int64 currentOffset;
__int64 maxOffset;
s64 currentOffset;
s64 maxOffset;
int currentSectorNumber;
byte currentSector[sectorLength];
@ -27,12 +27,12 @@ public:
IsoFile(SectorSource* reader, IsoFileDescriptor fileEntry);
void seek(__int64 offset);
void seek(__int64 offset, int ref_position);
void seek(s64 offset);
void seek(s64 offset, int ref_position);
void reset();
__int64 skip(__int64 n);
__int64 getFilePointer();
s64 skip(s64 n);
s64 getFilePointer();
bool eof();
int read();
@ -55,7 +55,7 @@ public:
std::string readLine(); // Assume null-termination
std::wstring readLineW(); // (this one too)
__int64 getLength();
s64 getLength();
const IsoFileDescriptor& getEntry();

View File

@ -19,8 +19,8 @@
//#include "CDVD/IsoFSdrv.h"
#include "DebugTools/Debug.h"
#include "GS.h" // for sending game crc to mtgs
#include "cdvd/isofs/isofscdvd.h"
#include "cdvd/isofs/isofs.h"
#include "CDVD/IsoFS/IsoFSCDVD.h"
#include "CDVD/IsoFS/IsoFS.h"
using namespace std;
extern void InitPatch(wxString crc);
@ -336,7 +336,6 @@ struct ElfObject
int size = file.getLength();
char buffer[256]; //if the file is longer...it should be shorter :D
rsize = file.read((u8*)data.GetPtr(), data.GetSizeInBytes());
//if (fi < 0) throw Exception::FileNotFound( filename );
@ -568,9 +567,8 @@ void loadElfFile(const wxString& filename)
{
IsoFSCDVD isofs;
IsoDirectory fsroot(&isofs);
u32 crcval = 0;
Console.WriteLn("loadElfCRC: %s", filename);
Console.WriteLn(L"loadElfCRC: " + filename);
desc = fsroot.FindFile(fnptr + strlen( "cdromN:" ));
}
@ -634,9 +632,7 @@ void loadElfFile(const wxString& filename)
// 2 - PS2 CD
int GetPS2ElfName( wxString& name )
{
int f;
char buffer[g_MaxPath];//if a file is longer...it should be shorter :D
char *pos;
try {
IsoFSCDVD isofs;

View File

@ -122,11 +122,14 @@
<Unit filename="../CDVD/CDVDisoReader.h" />
<Unit filename="../CDVD/CdRom.cpp" />
<Unit filename="../CDVD/CdRom.h" />
<Unit filename="../CDVD/IsoFScdvd.h" />
<Unit filename="../CDVD/IsoFSdrv.cpp" />
<Unit filename="../CDVD/IsoFSdrv.h" />
<Unit filename="../CDVD/IsoFStools.cpp" />
<Unit filename="../CDVD/IsoFStools.h" />
<Unit filename="../CDVD/IsoFS/IsoFS.cpp" />
<Unit filename="../CDVD/IsoFS/IsoFS.h" />
<Unit filename="../CDVD/IsoFS/IsoFSCDVD.cpp" />
<Unit filename="../CDVD/IsoFS/IsoFSCDVD.h" />
<Unit filename="../CDVD/IsoFS/IsoFile.cpp" />
<Unit filename="../CDVD/IsoFS/IsoFile.h" />
<Unit filename="../CDVD/IsoFS/IsoFileDescriptor.h" />
<Unit filename="../CDVD/IsoFS/SectorSource.h" />
<Unit filename="../CDVD/IsoFileFormats.cpp" />
<Unit filename="../CDVD/IsoFileFormats.h" />
<Unit filename="../CDVD/IsoFileTools.cpp" />