mirror of https://github.com/PCSX2/pcsx2.git
Signed/Unsigned bug introduced from r2217 squashed (fixes Issue 483: Extreme G3 crash); also added some more complete filesystem partition detection and logging to IsoFS.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2263 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
b78944866b
commit
ded0aabaa5
|
@ -1,16 +1,24 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
enum IsoFS_Type
|
||||||
|
{
|
||||||
|
FStype_ISO9660 = 1,
|
||||||
|
FStype_Joliet = 2,
|
||||||
|
};
|
||||||
|
|
||||||
class IsoDirectory
|
class IsoDirectory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectorSource& internalReader;
|
SectorSource& internalReader;
|
||||||
std::vector<IsoFileDescriptor> files;
|
std::vector<IsoFileDescriptor> files;
|
||||||
|
IsoFS_Type m_fstype;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IsoDirectory(SectorSource& r);
|
IsoDirectory(SectorSource& r);
|
||||||
IsoDirectory(SectorSource& r, IsoFileDescriptor directoryEntry);
|
IsoDirectory(SectorSource& r, IsoFileDescriptor directoryEntry);
|
||||||
~IsoDirectory() throw();
|
virtual ~IsoDirectory() throw();
|
||||||
|
|
||||||
|
wxString FStype_ToString() const;
|
||||||
SectorSource& GetReader() const { return internalReader; }
|
SectorSource& GetReader() const { return internalReader; }
|
||||||
|
|
||||||
bool Exists(const wxString& filePath) const;
|
bool Exists(const wxString& filePath) const;
|
||||||
|
|
|
@ -23,22 +23,81 @@
|
||||||
// IsoDirectory
|
// IsoDirectory
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Used to load the Root directory from an image
|
//u8 filesystemType; // 0x01 = ISO9660, 0x02 = Joliet, 0xFF = NULL
|
||||||
IsoDirectory::IsoDirectory(SectorSource& r) :
|
//u8 volID[5]; // "CD001"
|
||||||
internalReader(r)
|
|
||||||
|
|
||||||
|
wxString IsoDirectory::FStype_ToString() const
|
||||||
{
|
{
|
||||||
u8 sector[2048];
|
switch( m_fstype )
|
||||||
|
{
|
||||||
|
case FStype_ISO9660: L"ISO9660"; break;
|
||||||
|
case FStype_Joliet: L"Joliet"; break;
|
||||||
|
}
|
||||||
|
|
||||||
internalReader.readSector(sector,16);
|
return wxsFormat( L"Unrecognized Code (0x%x)", m_fstype );
|
||||||
|
}
|
||||||
|
|
||||||
IsoFileDescriptor rootDirEntry(sector+156,38);
|
// Used to load the Root directory from an image
|
||||||
|
IsoDirectory::IsoDirectory(SectorSource& r)
|
||||||
|
: internalReader(r)
|
||||||
|
{
|
||||||
|
m_fstype = FStype_ISO9660;
|
||||||
|
|
||||||
Init(rootDirEntry);
|
IsoFileDescriptor rootDirEntry;
|
||||||
|
bool isValid = false;
|
||||||
|
uint i = 16;
|
||||||
|
while( true )
|
||||||
|
{
|
||||||
|
u8 sector[2048];
|
||||||
|
internalReader.readSector(sector,i);
|
||||||
|
if( memcmp( §or[1], "CD001", 5 ) == 0 )
|
||||||
|
{
|
||||||
|
if( sector[0] == 0 )
|
||||||
|
{
|
||||||
|
Console.WriteLn( Color_Green, "(IsoFS) Block 0x%x: Boot partition info.", i );
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( sector[0] == 1 )
|
||||||
|
{
|
||||||
|
Console.WriteLn( "(IsoFS) Block 0x%x: Primary partition info.", i );
|
||||||
|
rootDirEntry.Load( sector+156, 38 );
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( sector[0] == 2 )
|
||||||
|
{
|
||||||
|
// Probably means Joliet (long filenames support), which PCSX2 doesn't care about.
|
||||||
|
Console.WriteLn( Color_Green, "(IsoFS) Block 0x%x: Extended partition info.", i );
|
||||||
|
m_fstype = FStype_Joliet;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( sector[0] == 0xff )
|
||||||
|
{
|
||||||
|
// Null terminator. End of partition information.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sector[9] = 0;
|
||||||
|
Console.Error( "(IsoFS) Invalid partition descriptor encountered at block 0x%x: '%s'", i, §or[1] );
|
||||||
|
break; // if no valid root partition was found, an exception will be thrown below.
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !isValid )
|
||||||
|
throw Exception::BadStream( "IsoFS", "Root directory not found on ISO image." );
|
||||||
|
|
||||||
|
DevCon.WriteLn( "(IsoFS) Filesystem is %s", FStype_ToString() );
|
||||||
|
Init( rootDirEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to load a specific directory from a file descriptor
|
// Used to load a specific directory from a file descriptor
|
||||||
IsoDirectory::IsoDirectory(SectorSource& r, IsoFileDescriptor directoryEntry) :
|
IsoDirectory::IsoDirectory(SectorSource& r, IsoFileDescriptor directoryEntry)
|
||||||
internalReader(r)
|
: internalReader(r)
|
||||||
{
|
{
|
||||||
Init(directoryEntry);
|
Init(directoryEntry);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +113,7 @@ void IsoDirectory::Init(const IsoFileDescriptor& directoryEntry)
|
||||||
|
|
||||||
files.clear();
|
files.clear();
|
||||||
|
|
||||||
int remainingSize = directoryEntry.size;
|
uint remainingSize = directoryEntry.size;
|
||||||
|
|
||||||
u8 b[257];
|
u8 b[257];
|
||||||
|
|
||||||
|
@ -150,6 +209,11 @@ IsoFileDescriptor::IsoFileDescriptor()
|
||||||
}
|
}
|
||||||
|
|
||||||
IsoFileDescriptor::IsoFileDescriptor(const u8* data, int length)
|
IsoFileDescriptor::IsoFileDescriptor(const u8* data, int length)
|
||||||
|
{
|
||||||
|
Load( data, length );
|
||||||
|
}
|
||||||
|
|
||||||
|
void IsoFileDescriptor::Load( const u8* data, int length )
|
||||||
{
|
{
|
||||||
lba = (u32&)data[2];
|
lba = (u32&)data[2];
|
||||||
size = (u32&)data[10];
|
size = (u32&)data[10];
|
||||||
|
|
|
@ -22,6 +22,8 @@ struct IsoFileDescriptor
|
||||||
IsoFileDescriptor();
|
IsoFileDescriptor();
|
||||||
IsoFileDescriptor(const u8* data, int length);
|
IsoFileDescriptor(const u8* data, int length);
|
||||||
|
|
||||||
|
void Load( const u8* data, int length );
|
||||||
|
|
||||||
bool IsFile() const { return !(flags & 2); }
|
bool IsFile() const { return !(flags & 2); }
|
||||||
bool IsDir() const { return !IsFile(); }
|
bool IsDir() const { return !IsFile(); }
|
||||||
};
|
};
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
static bool detect(isoFile *iso)
|
static bool detect(isoFile *iso)
|
||||||
{
|
{
|
||||||
u8 buf[2448];
|
u8 buf[2456];
|
||||||
u8* pbuf;
|
u8* pbuf;
|
||||||
|
|
||||||
if (!isoReadBlock(iso, buf, 16)) return false; // Not readable
|
if (!isoReadBlock(iso, buf, 16)) return false; // Not readable
|
||||||
|
@ -60,7 +60,7 @@ static bool _isoReadDtable(isoFile *iso)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tryIsoType(isoFile *iso, u32 size, u32 offset, u32 blockofs)
|
static bool tryIsoType(isoFile *iso, u32 size, s32 offset, s32 blockofs)
|
||||||
{
|
{
|
||||||
iso->blocksize = size;
|
iso->blocksize = size;
|
||||||
iso->offset = offset;
|
iso->offset = offset;
|
||||||
|
@ -182,8 +182,8 @@ isoFile *isoOpen(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLn("isoOpen: %s ok", iso->filename);
|
Console.WriteLn("isoOpen: %s ok", iso->filename);
|
||||||
Console.WriteLn("offset = %u", iso->offset);
|
Console.WriteLn("offset = %d", iso->offset);
|
||||||
Console.WriteLn("blockofs = %u", iso->blockofs);
|
Console.WriteLn("blockofs = %d", iso->blockofs);
|
||||||
Console.WriteLn("blocksize = %u", iso->blocksize);
|
Console.WriteLn("blocksize = %u", iso->blocksize);
|
||||||
Console.WriteLn("blocks = %u", iso->blocks);
|
Console.WriteLn("blocks = %u", iso->blocks);
|
||||||
Console.WriteLn("type = %u", iso->type);
|
Console.WriteLn("type = %u", iso->type);
|
||||||
|
@ -224,18 +224,18 @@ isoFile *isoCreate(const char *filename, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLn("isoCreate: %s ok", iso->filename);
|
Console.WriteLn("isoCreate: %s ok", iso->filename);
|
||||||
Console.WriteLn("offset = %u", iso->offset);
|
Console.WriteLn("offset = %d", iso->offset);
|
||||||
|
|
||||||
return iso;
|
return iso;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isoSetFormat(isoFile *iso, uint blockofs, uint blocksize, uint blocks)
|
bool isoSetFormat(isoFile *iso, int blockofs, uint blocksize, uint blocks)
|
||||||
{
|
{
|
||||||
iso->blocksize = blocksize;
|
iso->blocksize = blocksize;
|
||||||
iso->blocks = blocks;
|
iso->blocks = blocks;
|
||||||
iso->blockofs = blockofs;
|
iso->blockofs = blockofs;
|
||||||
|
|
||||||
Console.WriteLn("blockofs = %u", iso->blockofs);
|
Console.WriteLn("blockofs = %d", iso->blockofs);
|
||||||
Console.WriteLn("blocksize = %u", iso->blocksize);
|
Console.WriteLn("blocksize = %u", iso->blocksize);
|
||||||
Console.WriteLn("blocks = %u", iso->blocks);
|
Console.WriteLn("blocks = %u", iso->blocks);
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,8 @@ struct isoFile
|
||||||
char filename[256];
|
char filename[256];
|
||||||
isoType type;
|
isoType type;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
u32 offset;
|
s32 offset;
|
||||||
u32 blockofs;
|
s32 blockofs;
|
||||||
u32 blocksize;
|
u32 blocksize;
|
||||||
u32 blocks;
|
u32 blocks;
|
||||||
void *handle;
|
void *handle;
|
||||||
|
@ -73,7 +73,7 @@ struct isoFile
|
||||||
|
|
||||||
extern isoFile *isoOpen(const char *filename);
|
extern isoFile *isoOpen(const char *filename);
|
||||||
extern isoFile *isoCreate(const char *filename, int mode);
|
extern isoFile *isoCreate(const char *filename, int mode);
|
||||||
extern bool isoSetFormat(isoFile *iso, uint blockofs, uint blocksize, uint blocks);
|
extern bool isoSetFormat(isoFile *iso, int blockofs, uint blocksize, uint blocks);
|
||||||
extern bool isoDetect(isoFile *iso);
|
extern bool isoDetect(isoFile *iso);
|
||||||
extern bool isoReadBlock(isoFile *iso, u8 *dst, uint lsn);
|
extern bool isoReadBlock(isoFile *iso, u8 *dst, uint lsn);
|
||||||
extern bool isoWriteBlock(isoFile *iso, u8 *src, uint lsn);
|
extern bool isoWriteBlock(isoFile *iso, u8 *src, uint lsn);
|
||||||
|
|
|
@ -1112,7 +1112,7 @@ void vif1Write32(u32 mem, u32 value)
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
/* Only FDR bit is writable, so mask the rest */
|
/* Only FDR bit is writable, so mask the rest */
|
||||||
if ((vif1Regs->stat.FDR) ^(value & VIF1_STAT_FDR))
|
if ((vif1Regs->stat.FDR) ^ ((tVIF_STAT&)value).FDR)
|
||||||
{
|
{
|
||||||
// different so can't be stalled
|
// different so can't be stalled
|
||||||
if (vif1Regs->stat.test(VIF1_STAT_INT | VIF1_STAT_VSS | VIF1_STAT_VIS | VIF1_STAT_VFS))
|
if (vif1Regs->stat.test(VIF1_STAT_INT | VIF1_STAT_VSS | VIF1_STAT_VIS | VIF1_STAT_VFS))
|
||||||
|
|
Loading…
Reference in New Issue