Linux compilation fixes and fix some signed/unsigned stuff in IsoReader.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2217 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-11-18 16:53:44 +00:00
parent 0f22852602
commit 1dced84153
20 changed files with 408 additions and 411 deletions

View File

@ -144,6 +144,8 @@
<Unit filename="../../../3rdparty/google/sparsehash/sparsehashtable.h" />
<Unit filename="../../../3rdparty/google/sparsetable" />
<Unit filename="../../../3rdparty/google/type_traits.h" />
<Unit filename="../../include/Utilities/Assertions.h" />
<Unit filename="../../include/Utilities/CheckedStaticBox.h" />
<Unit filename="../../include/Utilities/Console.h" />
<Unit filename="../../include/Utilities/Dependencies.h" />
<Unit filename="../../include/Utilities/EventSource.h" />
@ -159,11 +161,16 @@
<Unit filename="../../include/Utilities/StringHelpers.h" />
<Unit filename="../../include/Utilities/Threading.h" />
<Unit filename="../../include/Utilities/lnx_memzero.h" />
<Unit filename="../../include/Utilities/pxCheckBox.h" />
<Unit filename="../../include/Utilities/pxRadioPanel.h" />
<Unit filename="../../include/Utilities/pxStaticText.h" />
<Unit filename="../../include/Utilities/win_memzero.h" />
<Unit filename="../../include/Utilities/wxBaseTools.h" />
<Unit filename="../../include/Utilities/wxGuiTools.h" />
<Unit filename="../../include/Utilities/wxHelpers.h" />
<Unit filename="../../include/intrin_x86.h" />
<Unit filename="../../src/Utilities/AlignedMalloc.cpp" />
<Unit filename="../../src/Utilities/CheckedStaticBox.cpp" />
<Unit filename="../../src/Utilities/Console.cpp" />
<Unit filename="../../src/Utilities/EventSource.cpp" />
<Unit filename="../../src/Utilities/Exceptions.cpp" />
@ -173,14 +180,18 @@
<Unit filename="../../src/Utilities/Linux/LnxThreads.cpp" />
<Unit filename="../../src/Utilities/Mutex.cpp" />
<Unit filename="../../src/Utilities/PathUtils.cpp" />
<Unit filename="../../src/Utilities/PrecompiledHeader.cpp" />
<Unit filename="../../src/Utilities/PrecompiledHeader.h" />
<Unit filename="../../src/Utilities/Semaphore.cpp" />
<Unit filename="../../src/Utilities/StringHelpers.cpp" />
<Unit filename="../../src/Utilities/ThreadTools.cpp" />
<Unit filename="../../src/Utilities/ThreadingInternal.h" />
<Unit filename="../../src/Utilities/pxCheckBox.cpp" />
<Unit filename="../../src/Utilities/pxRadioPanel.cpp" />
<Unit filename="../../src/Utilities/pxStaticText.cpp" />
<Unit filename="../../src/Utilities/vssprintf.cpp" />
<Unit filename="../../src/Utilities/wxGuiTools.cpp" />
<Unit filename="../../src/Utilities/wxHelpers.cpp" />
<Unit filename="../../src/Utilities/x86/MemcpyFast.S" />
<Extensions>
<envvars />

View File

@ -149,8 +149,6 @@
<Unit filename="../../include/x86emitter/implement/simd_templated_helpers.h" />
<Unit filename="../../include/x86emitter/implement/test.h" />
<Unit filename="../../include/x86emitter/implement/xchg.h" />
<Unit filename="../../include/x86emitter/implement/xmm/moremovs.h" />
<Unit filename="../../include/x86emitter/implement/xmm/shufflepack.h" />
<Unit filename="../../include/x86emitter/inlines.inl" />
<Unit filename="../../include/x86emitter/instructions.h" />
<Unit filename="../../include/x86emitter/internal.h" />

View File

@ -16,9 +16,9 @@
#pragma once
// Register counts for x86/32 mode:
static const uint iREGCNT_XMM = 8;
static const uint iREGCNT_GPR = 8;
static const uint iREGCNT_MMX = 8;
static const int iREGCNT_XMM = 8;
static const int iREGCNT_GPR = 8;
static const int iREGCNT_MMX = 8;
enum XMMSSEType
{
@ -541,7 +541,7 @@ template< typename T > void xWrite( T val );
}
const xRegType& GetReg() const { return m_reg; }
const int GetImm() const { return m_imm; }
int GetImm() const { return m_imm; }
bool IsReg() const { return !m_reg.IsEmpty(); }
};

View File

@ -65,8 +65,9 @@ const IConsoleWriter ConsoleWriter_Null =
ConsoleNull_DoSetColor,
ConsoleNull_Newline,
ConsoleNull_SetTitle,
0, // instance-level indentation (should always be 0)
};
// --------------------------------------------------------------------------------------
@ -154,8 +155,9 @@ const IConsoleWriter ConsoleWriter_Stdio =
ConsoleStdio_DoSetColor,
ConsoleStdio_Newline,
ConsoleStdio_SetTitle,
0, // instance-level indentation (should always be 0)
};
// --------------------------------------------------------------------------------------
@ -179,8 +181,9 @@ const IConsoleWriter ConsoleWriter_Assert =
ConsoleNull_DoSetColor,
ConsoleNull_Newline,
ConsoleNull_SetTitle,
0, // instance-level indentation (should always be 0)
};
// --------------------------------------------------------------------------------------
@ -225,8 +228,9 @@ const IConsoleWriter ConsoleWriter_Buffered =
ConsoleNull_DoSetColor,
ConsoleNull_Newline,
ConsoleNull_SetTitle,
0, // instance-level indentation (should always be 0)
};
// --------------------------------------------------------------------------------------
@ -250,8 +254,9 @@ const IConsoleWriter ConsoleWriter_wxError =
ConsoleNull_DoSetColor,
ConsoleNull_Newline,
ConsoleNull_SetTitle,
0, // instance-level indentation (should always be 0)
};
// Sanity check: truncate strings if they exceed 512k in length. Anything like that

View File

@ -22,8 +22,6 @@
// the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not
// having the LOCK prefix is very bad indeed.
static bool isMultiCore = true; // assume more than one CPU (safer)
__forceinline void Threading::Sleep( int ms )
{
usleep( 1000*ms );

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="pcsx2_suite_2008 workspace">
<Project filename="pcsx2/Linux/pcsx2.cbp">
<Project filename="pcsx2/Linux/pcsx2.cbp" active="1">
<Depends filename="common/build/x86emitter/x86emitter.cbp" />
<Depends filename="common/build/Utilities/Utilities.cbp" />
<Depends filename="3rdparty/zlib/zlib.cbp" />
@ -25,7 +25,7 @@
<Project filename="plugins/spu2-x/src/Linux/SPU2-X.cbp">
<Depends filename="3rdparty/SoundTouch/SoundTouch.cbp" />
</Project>
<Project filename="plugins/zerospu2/Linux/ZeroSPU2.cbp" active="1">
<Project filename="plugins/zerospu2/Linux/ZeroSPU2.cbp">
<Depends filename="3rdparty/SoundTouch/SoundTouch.cbp" />
</Project>
</Workspace>

View File

@ -164,11 +164,6 @@ IsoFileDescriptor::IsoFileDescriptor(const u8* data, int length)
flags = data[25];
// This assert probably means a coder error, but let's fall back on a runtime exception
// in release builds since, most likely, the error is "recoverable" form a user standpoint.
if( !pxAssertDev( (lba>=0) && (length>=0), "Invalid ISO file descriptor data encountered." ) )
throw Exception::BadStream();
int fileNameLength = data[32];
if(fileNameLength==1)

View File

@ -36,6 +36,6 @@ int IsoFSCDVD::getNumSectors()
return td.lsn;
}
IsoFSCDVD::~IsoFSCDVD(void) throw()
IsoFSCDVD::~IsoFSCDVD() throw()
{
}

View File

@ -23,7 +23,7 @@
#include "IsoFileFormats.h"
int detect(isoFile *iso)
static int detect(isoFile *iso)
{
u8 buf[2448];
u8* pbuf;
@ -42,9 +42,9 @@ int detect(isoFile *iso)
return 1;
}
int _isoReadDtable(isoFile *iso)
static int _isoReadDtable(isoFile *iso)
{
int ret;
uint ret;
_seekfile(iso->handle, 0, SEEK_END);
iso->dtablesize = (_tellfile(iso->handle) - 16) / (iso->blocksize + 4);
@ -60,7 +60,7 @@ int _isoReadDtable(isoFile *iso)
return 0;
}
bool tryIsoType(isoFile *iso, u32 size, u32 offset, u32 blockofs)
static bool tryIsoType(isoFile *iso, u32 size, u32 offset, u32 blockofs)
{
iso->blocksize = size;
iso->offset = offset;
@ -144,7 +144,7 @@ isoFile *isoOpen(const char *filename)
if (isoDetect(iso) == -1) return NULL;
Console.WriteLn("detected blocksize = %d", iso->blocksize);
Console.WriteLn("detected blocksize = %u", iso->blocksize);
if ((strlen(iso->filename) > 3) && strncmp(iso->filename + (strlen(iso->filename) - 3), "I00", 3) == 0)
{
@ -183,11 +183,11 @@ isoFile *isoOpen(const char *filename)
}
Console.WriteLn("isoOpen: %s ok", iso->filename);
Console.WriteLn("offset = %d", iso->offset);
Console.WriteLn("blockofs = %d", iso->blockofs);
Console.WriteLn("blocksize = %d", iso->blocksize);
Console.WriteLn("blocks = %d", iso->blocks);
Console.WriteLn("type = %d", iso->type);
Console.WriteLn("offset = %u", iso->offset);
Console.WriteLn("blockofs = %u", iso->blockofs);
Console.WriteLn("blocksize = %u", iso->blocksize);
Console.WriteLn("blocks = %u", iso->blocks);
Console.WriteLn("type = %u", iso->type);
return iso;
}
@ -225,20 +225,20 @@ isoFile *isoCreate(const char *filename, int flags)
}
Console.WriteLn("isoCreate: %s ok", iso->filename);
Console.WriteLn("offset = %d", iso->offset);
Console.WriteLn("offset = %u", iso->offset);
return iso;
}
int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks)
int isoSetFormat(isoFile *iso, uint blockofs, uint blocksize, uint blocks)
{
iso->blocksize = blocksize;
iso->blocks = blocks;
iso->blockofs = blockofs;
Console.WriteLn("blockofs = %d", iso->blockofs);
Console.WriteLn("blocksize = %d", iso->blocksize);
Console.WriteLn("blocks = %d", iso->blocks);
Console.WriteLn("blockofs = %u", iso->blockofs);
Console.WriteLn("blocksize = %u", iso->blocksize);
Console.WriteLn("blocks = %u", iso->blocks);
if (iso->flags & ISOFLAGS_BLOCKDUMP_V2)
{
@ -284,27 +284,26 @@ void LSNtoMSF(u8 *Time, s32 lsn)
int _isoReadBlock(isoFile *iso, u8 *dst, int lsn)
{
u64 ofs = (u64)lsn * iso->blocksize + iso->offset;
int ret;
memset(dst, 0, iso->blockofs);
_seekfile(iso->handle, ofs, SEEK_SET);
ret = _readfile(iso->handle, dst + iso->blockofs, iso->blocksize);
uint ret = _readfile(iso->handle, dst + iso->blockofs, iso->blocksize);
if (ret < iso->blocksize)
{
Console.Error("read error %d in _isoReadBlock", ret);
Console.Error("read error in _isoReadBlock." );
return -1;
}
return 0;
}
int _isoReadBlockD(isoFile *iso, u8 *dst, int lsn)
int _isoReadBlockD(isoFile *iso, u8 *dst, uint lsn)
{
int ret;
uint ret;
// Console.WriteLn("_isoReadBlockD %d, blocksize=%d, blockofs=%d\n", lsn, iso->blocksize, iso->blockofs);
// Console.WriteLn("_isoReadBlockD %u, blocksize=%u, blockofs=%u\n", lsn, iso->blocksize, iso->blockofs);
memset(dst, 0, iso->blockofs);
for (int i = 0; i < iso->dtablesize; i++)
@ -318,15 +317,15 @@ int _isoReadBlockD(isoFile *iso, u8 *dst, int lsn)
return 0;
}
Console.WriteLn("Block %d not found in dump", lsn);
Console.WriteLn("Block %u not found in dump", lsn);
return -1;
}
int _isoReadBlockM(isoFile *iso, u8 *dst, int lsn)
int _isoReadBlockM(isoFile *iso, u8 *dst, uint lsn)
{
u64 ofs;
int ret, i;
uint ret, i;
for (i = 0; i < 8; i++)
{
@ -340,7 +339,7 @@ int _isoReadBlockM(isoFile *iso, u8 *dst, int lsn)
ofs = (u64)(lsn - iso->multih[i].slsn) * iso->blocksize + iso->offset;
// Console.WriteLn("_isoReadBlock %d, blocksize=%d, blockofs=%d\n", lsn, iso->blocksize, iso->blockofs);
// Console.WriteLn("_isoReadBlock %u, blocksize=%u, blockofs=%u\n", lsn, iso->blocksize, iso->blockofs);
memset(dst, 0, iso->blockofs);
_seekfile(iso->multih[i].handle, ofs, SEEK_SET);
@ -348,20 +347,20 @@ int _isoReadBlockM(isoFile *iso, u8 *dst, int lsn)
if (ret < iso->blocksize)
{
Console.WriteLn("read error %d in _isoReadBlockM", ret);
Console.Error("read error in _isoReadBlockM");
return -1;
}
return 0;
}
int isoReadBlock(isoFile *iso, u8 *dst, int lsn)
int isoReadBlock(isoFile *iso, u8 *dst, uint lsn)
{
int ret;
uint ret;
if (lsn > iso->blocks)
{
Console.WriteLn("isoReadBlock: %d > %d", lsn, iso->blocks);
Console.WriteLn("isoReadBlock: %u > %u", lsn, iso->blocks);
return -1;
}
@ -374,7 +373,7 @@ int isoReadBlock(isoFile *iso, u8 *dst, int lsn)
else
ret = _isoReadBlock(iso, dst, lsn);
if (ret == -1) return -1;
if (ret < lsn) return -1;
if (iso->type == ISOTYPE_CD)
{
@ -386,9 +385,9 @@ int isoReadBlock(isoFile *iso, u8 *dst, int lsn)
}
int _isoWriteBlock(isoFile *iso, u8 *src, int lsn)
int _isoWriteBlock(isoFile *iso, u8 *src, uint lsn)
{
int ret;
uint ret;
u64 ofs = (u64)lsn * iso->blocksize + iso->offset;
_seekfile(iso->handle, ofs, SEEK_SET);
@ -398,24 +397,20 @@ int _isoWriteBlock(isoFile *iso, u8 *src, int lsn)
return 0;
}
int _isoWriteBlockD(isoFile *iso, u8 *src, int lsn)
int _isoWriteBlockD(isoFile *iso, u8 *src, uint lsn)
{
int ret;
// Console.WriteLn("_isoWriteBlock %d (ofs=%d)", iso->blocksize, ofs);
uint ret;
ret = _writefile(iso->handle, &lsn, 4);
if (ret < 4) return -1;
ret = _writefile(iso->handle, src + iso->blockofs, iso->blocksize);
// Console.WriteLn("_isoWriteBlock %d", ret);
if (ret < iso->blocksize) return -1;
return 0;
}
int isoWriteBlock(isoFile *iso, u8 *src, int lsn)
int isoWriteBlock(isoFile *iso, u8 *src, uint lsn)
{
if (iso->flags & ISOFLAGS_BLOCKDUMP_V3)
return _isoWriteBlockD(iso, src, lsn);

View File

@ -73,10 +73,10 @@ struct isoFile
extern isoFile *isoOpen(const char *filename);
extern isoFile *isoCreate(const char *filename, int mode);
extern int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks);
extern int isoSetFormat(isoFile *iso, uint blockofs, uint blocksize, uint blocks);
extern int isoDetect(isoFile *iso);
extern int isoReadBlock(isoFile *iso, u8 *dst, int lsn);
extern int isoWriteBlock(isoFile *iso, u8 *src, int lsn);
extern int isoReadBlock(isoFile *iso, u8 *dst, uint lsn);
extern int isoWriteBlock(isoFile *iso, u8 *src, uint lsn);
extern void isoClose(isoFile *iso);
#endif /* __LIBISO_H__ */

View File

@ -60,7 +60,7 @@ int _seekfile(void *handle, u64 offset, int whence)
return 0;
}
int _readfile(void *handle, void *dst, int size)
u32 _readfile(void *handle, void *dst, int size)
{
DWORD ret;
@ -69,7 +69,7 @@ int _readfile(void *handle, void *dst, int size)
return ret;
}
int _writefile(void *handle, const void *src, int size)
u32 _writefile(void *handle, const void *src, int size)
{
DWORD ret;
@ -123,12 +123,12 @@ int _seekfile(void *handle, u64 offset, int whence)
return seekerr;
}
int _readfile(void *handle, void *dst, int size)
u32 _readfile(void *handle, void *dst, int size)
{
return fread(dst, 1, size, (FILE*)handle);
}
int _writefile(void *handle, const void *src, int size)
u32 _writefile(void *handle, const void *src, int size)
{
return fwrite(src, 1, size, (FILE*)handle);
}

View File

@ -42,7 +42,7 @@
extern void *_openfile(const char *filename, int flags);
extern u64 _tellfile(void *handle);
extern int _seekfile(void *handle, u64 offset, int whence);
extern int _readfile(void *handle, void *dst, int size);
extern int _writefile(void *handle, const void *src, int size);
extern u32 _readfile(void *handle, void *dst, int size);
extern u32 _writefile(void *handle, const void *src, int size);
extern void _closefile(void *handle);

View File

@ -350,8 +350,8 @@ static __forceinline int mfifoGIFrbTransfer()
/* Check if the transfer should wrap around the ring buffer */
if ((gif->madr + mfifoqwc * 16) > (dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK + 16))
{
int s1 = ((dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK + 16) - gif->madr) >> 4;
int s2 = (mfifoqwc - s1);
uint s1 = ((dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK + 16) - gif->madr) >> 4;
uint s2 = (mfifoqwc - s1);
// fixme - I don't think these should use WRITERING_DMA, since our source
// isn't the DmaGetAddr(gif->madr) address that WRITERING_DMA expects.

View File

@ -222,7 +222,7 @@ void SaveStateBase::ipuFreeze()
bool ipuCanFreeze()
{
return (ipuCurCmd == 0xffffffff);
return (ipuCurCmd == -1);
}
__forceinline u32 ipuRead32(u32 mem)

View File

@ -69,7 +69,7 @@ void SaveStateBase::PrepBlock( int size )
void SaveStateBase::FreezeTag( const char* src )
{
const int allowedlen = sizeof( m_tagspace )-1;
const uint allowedlen = sizeof( m_tagspace )-1;
pxAssertDev( strlen(src) < allowedlen, wxsFormat( L"Tag name exceeds the allowed length of %d chars.", allowedlen) );
memzero( m_tagspace );

View File

@ -181,7 +181,7 @@ const wxDirName& AppConfig::FolderOptions::operator[]( FoldersEnum_t folderidx )
return const_cast<FolderOptions*>( this )->operator[]( folderidx );
}
const bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const
bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const
{
switch( folderidx )
{

View File

@ -86,7 +86,7 @@ public:
const wxDirName& operator[]( FoldersEnum_t folderidx ) const;
wxDirName& operator[]( FoldersEnum_t folderidx );
const bool IsDefault( FoldersEnum_t folderidx ) const;
bool IsDefault( FoldersEnum_t folderidx ) const;
};
// ------------------------------------------------------------------------

View File

@ -81,14 +81,12 @@
<Unit filename="../3rdparty/liba52/tables.h" />
<Unit filename="../3rdparty/liba52/tendra.h" />
<Unit filename="../ADSR.cpp" />
<Unit filename="../BaseTypes.h" />
<Unit filename="../ConvertUTF.cpp" />
<Unit filename="../ConvertUTF.h" />
<Unit filename="../DPLII.h" />
<Unit filename="../Debug.cpp" />
<Unit filename="../Debug.h" />
<Unit filename="../Decoder.cpp" />
<Unit filename="../DllInterface.cpp" />
<Unit filename="../Dma.cpp" />
<Unit filename="../Dma.h" />
<Unit filename="Alsa.cpp" />
@ -105,13 +103,9 @@
<Unit filename="../ReadInput.cpp" />
<Unit filename="../RegLog.cpp" />
<Unit filename="../RegTable.cpp" />
<Unit filename="../RegTable.h" />
<Unit filename="../Reverb.cpp" />
<Unit filename="../SaveStateSPU.cpp" />
<Unit filename="../SndOut.cpp" />
<Unit filename="../SndOut.h" />
<Unit filename="../Spu2.cpp" />
<Unit filename="../Spu2.h" />
<Unit filename="../Spu2replay.cpp" />
<Unit filename="../Spu2replay.h" />
<Unit filename="../Timestretcher.cpp" />
@ -125,6 +119,7 @@
<Extensions>
<code_completion />
<debugger />
<envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>