diff --git a/common/build/Utilities/Utilities.cbp b/common/build/Utilities/Utilities.cbp index 9134ba8806..ed4ce19678 100644 --- a/common/build/Utilities/Utilities.cbp +++ b/common/build/Utilities/Utilities.cbp @@ -144,6 +144,8 @@ + + @@ -159,11 +161,16 @@ + + + + + @@ -173,14 +180,18 @@ + + + + diff --git a/common/build/x86emitter/x86emitter.cbp b/common/build/x86emitter/x86emitter.cbp index 0ffb3a9e61..82d1d050f7 100644 --- a/common/build/x86emitter/x86emitter.cbp +++ b/common/build/x86emitter/x86emitter.cbp @@ -149,8 +149,6 @@ - - diff --git a/common/include/x86emitter/x86types.h b/common/include/x86emitter/x86types.h index a1383930bc..951b0f21b7 100644 --- a/common/include/x86emitter/x86types.h +++ b/common/include/x86emitter/x86types.h @@ -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 { @@ -72,7 +72,7 @@ template< typename T > void xWrite( T val ); #endif // -------------------------------------------------------------------------------------- -// __emitline - preprocessors definition +// __emitline - preprocessors definition // -------------------------------------------------------------------------------------- // This is configured to inline emitter functions appropriately for release builds, and // disables some of the more aggressive inlines for dev builds (which can be helpful when @@ -168,12 +168,12 @@ template< typename T > void xWrite( T val ); // -------------------------------------------------------------------------------------- class OperandSizedObject { - public: + public: virtual uint GetOperandSize() const=0; bool Is8BitOp() const { return GetOperandSize() == 1; } void prefix16() const { if( GetOperandSize() == 2 ) xWrite8( 0x66 ); } - + void xWriteImm( int imm ) const { switch( GetOperandSize() ) @@ -195,7 +195,7 @@ template< typename T > void xWrite( T val ); // Represents an invalid or uninitialized register. If this is encountered by the emitter it // will generate an assertion. static const int xRegId_Invalid = -2; - + // -------------------------------------------------------------------------------------- // xRegisterBase - type-unsafe x86 register representation. // -------------------------------------------------------------------------------------- @@ -235,7 +235,7 @@ template< typename T > void xWrite( T val ); // is a valid non-null string for any Id, valid or invalid. No assertions are generated. const char* GetName(); }; - + class xRegisterInt : public xRegisterBase { typedef xRegisterBase _parent; @@ -261,7 +261,7 @@ template< typename T > void xWrite( T val ); public: xRegister8(): _parent() {} explicit xRegister8( int regId ) : _parent( regId ) {} - + virtual uint GetOperandSize() const { return 1; } bool operator==( const xRegister8& src ) const { return Id == src.Id; } @@ -281,7 +281,7 @@ template< typename T > void xWrite( T val ); bool operator==( const xRegister16& src ) const { return this->Id == src.Id; } bool operator!=( const xRegister16& src ) const { return this->Id != src.Id; } }; - + class xRegister32 : public xRegisterInt { typedef xRegisterInt _parent; @@ -295,7 +295,7 @@ template< typename T > void xWrite( T val ); bool operator==( const xRegister32& src ) const { return this->Id == src.Id; } bool operator!=( const xRegister32& src ) const { return this->Id != src.Id; } }; - + // -------------------------------------------------------------------------------------- // xRegisterMMX/SSE - Represents either a 64 bit or 128 bit SIMD register // -------------------------------------------------------------------------------------- @@ -424,7 +424,7 @@ template< typename T > void xWrite( T val ); return &m_convtype; } }; - + extern const xRegisterEmpty xEmptyReg; // -------------------------------------------------------------------------------------- @@ -512,7 +512,7 @@ template< typename T > void xWrite( T val ); extern const xRegisterCL cl; // I'm special! // -------------------------------------------------------------------------------------- - // xImmReg< typename xRegType > + // xImmReg< typename xRegType > // -------------------------------------------------------------------------------------- // Used to represent an immediate value which can also be optimized to a register. Note // that the immediate value represented by this structure is *always* legal. The register @@ -541,12 +541,12 @@ 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(); } }; // -------------------------------------------------------------------------------------- - // ModSib - Internal low-level representation of the ModRM/SIB information. + // ModSib - Internal low-level representation of the ModRM/SIB information. // -------------------------------------------------------------------------------------- // This class serves two purposes: It houses 'reduced' ModRM/SIB info only, which means // that the Base, Index, Scale, and Displacement values are all in the correct arrange- @@ -636,7 +636,7 @@ template< typename T > void xWrite( T val ); ModSib32orLess( xAddressReg base, xAddressReg index, int scale=0, s32 displacement=0 ) : _parent( base, index, scale, displacement ) {} }; - + // -------------------------------------------------------------------------------------- // ModSib8/16/32/64/128 // -------------------------------------------------------------------------------------- @@ -678,7 +678,7 @@ template< typename T > void xWrite( T val ); return !operator==( src ); \ } \ } - + DECLARE_CLASS_ModSibBits( 8, ModSib32orLess ); DECLARE_CLASS_ModSibBits( 16, ModSib32orLess ); DECLARE_CLASS_ModSibBits( 32, ModSib32orLess ); diff --git a/common/src/Utilities/Console.cpp b/common/src/Utilities/Console.cpp index 3015a5f532..fd2c2fa993 100644 --- a/common/src/Utilities/Console.cpp +++ b/common/src/Utilities/Console.cpp @@ -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 @@ -288,7 +293,7 @@ static FormatBuffer unicode_buffer( unicode_buffer_is_deleted ); static void format_that_ascii_mess( SafeArray& buffer, const char* fmt, va_list argptr ) { - + while( true ) { int size = buffer.GetLength(); @@ -431,10 +436,10 @@ IConsoleWriter IConsoleWriter::Indent( int tabcount ) const const IConsoleWriter& IConsoleWriter::SetColor( ConsoleColors color ) const { pxAssertMsg( color >= Color_Current && color < ConsoleColors_Count, "Invalid ConsoleColor specified." ); - + if( conlog_Color != color ) DoSetColor( conlog_Color = color ); - + return *this; } diff --git a/common/src/Utilities/Linux/LnxThreads.cpp b/common/src/Utilities/Linux/LnxThreads.cpp index a55caf7547..e96537d1ab 100644 --- a/common/src/Utilities/Linux/LnxThreads.cpp +++ b/common/src/Utilities/Linux/LnxThreads.cpp @@ -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 ); diff --git a/pcsx2-codeblocks.workspace b/pcsx2-codeblocks.workspace index 2b434e8b8e..9d9b65c93e 100644 --- a/pcsx2-codeblocks.workspace +++ b/pcsx2-codeblocks.workspace @@ -1,7 +1,7 @@ - + @@ -25,7 +25,7 @@ - + diff --git a/pcsx2/CDVD/IsoFS/IsoFS.cpp b/pcsx2/CDVD/IsoFS/IsoFS.cpp index dcb57f965d..9c0bed47b9 100644 --- a/pcsx2/CDVD/IsoFS/IsoFS.cpp +++ b/pcsx2/CDVD/IsoFS/IsoFS.cpp @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -12,8 +12,8 @@ * You should have received a copy of the GNU General Public License along with PCSX2. * If not, see . */ - - + + #include "PrecompiledHeader.h" #include "IsoFS.h" @@ -115,7 +115,7 @@ IsoFileDescriptor IsoDirectory::FindFile(const wxString& filePath) const { info = dir->GetEntry(parts.GetDirs()[i]); if(info.IsFile()) throw Exception::FileNotFound( filePath ); - + dir = deleteme = new IsoDirectory(internalReader, info); } @@ -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) diff --git a/pcsx2/CDVD/IsoFS/IsoFSCDVD.cpp b/pcsx2/CDVD/IsoFS/IsoFSCDVD.cpp index 5e77b60a78..aa8f45a26f 100644 --- a/pcsx2/CDVD/IsoFS/IsoFSCDVD.cpp +++ b/pcsx2/CDVD/IsoFS/IsoFSCDVD.cpp @@ -36,6 +36,6 @@ int IsoFSCDVD::getNumSectors() return td.lsn; } -IsoFSCDVD::~IsoFSCDVD(void) throw() +IsoFSCDVD::~IsoFSCDVD() throw() { } diff --git a/pcsx2/CDVD/IsoFileFormats.cpp b/pcsx2/CDVD/IsoFileFormats.cpp index 1b5c3fd473..996c517b8f 100644 --- a/pcsx2/CDVD/IsoFileFormats.cpp +++ b/pcsx2/CDVD/IsoFileFormats.cpp @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -13,7 +13,7 @@ * If not, see . */ - + #include "PrecompiledHeader.h" #include "IopCommon.h" @@ -23,13 +23,13 @@ #include "IsoFileFormats.h" -int detect(isoFile *iso) +static int detect(isoFile *iso) { u8 buf[2448]; u8* pbuf; if (isoReadBlock(iso, buf, 16) == -1) return -1; - + pbuf = (( iso->flags & ISOFLAGS_BLOCKDUMP_V3 ) ? buf : (buf + 24)); if (strncmp((char*)(pbuf+1), "CD001", 5)) return 0; @@ -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,13 +60,13 @@ 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; iso->blockofs = blockofs; if (detect(iso) == 1) return true; - + return false; } @@ -83,7 +83,7 @@ int isoDetect(isoFile *iso) _seekfile(iso->handle, 0, SEEK_SET); _readfile(iso->handle, buf, 4); - + if (strncmp(buf, "BDV2", 4) == 0) { iso->flags = ISOFLAGS_BLOCKDUMP_V2; @@ -144,26 +144,26 @@ 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) { int i; - + _closefile(iso->handle); iso->flags |= ISOFLAGS_MULTI; iso->blocks = 0; - + for (i = 0; i < 8; i++) { iso->filename[strlen(iso->filename) - 1] = '0' + i; iso->multih[i].handle = _openfile(iso->filename, O_RDONLY); - + if (iso->multih[i].handle == NULL) { break; } - + iso->multih[i].slsn = iso->blocks; _seekfile(iso->multih[i].handle, 0, SEEK_END); iso->blocks += (u32)((_tellfile(iso->multih[i].handle) - iso->offset) / (iso->blocksize)); @@ -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; } @@ -202,7 +202,7 @@ isoFile *isoCreate(const char *filename, int flags) memset(iso, 0, sizeof(isoFile)); strcpy(iso->filename, filename); - + iso->flags = flags; iso->offset = 0; iso->blockofs = 24; @@ -212,34 +212,34 @@ isoFile *isoCreate(const char *filename, int flags) { sprintf(Zfile, "%s.table", iso->filename); iso->htable = _openfile(Zfile, O_WRONLY); - + if (iso->htable == NULL) return NULL; } iso->handle = _openfile(iso->filename, O_WRONLY | O_CREAT); - + if (iso->handle == NULL) { Console.Error("Error loading %s", iso->filename); return NULL; } - + 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) { if (_writefile(iso->handle, "BDV2", 4) < 4) return -1; @@ -284,28 +284,27 @@ 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 %u, blocksize=%u, blockofs=%u\n", lsn, iso->blocksize, iso->blockofs); -// Console.WriteLn("_isoReadBlockD %d, blocksize=%d, blockofs=%d\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++) { @@ -335,36 +334,36 @@ int _isoReadBlockM(isoFile *iso, u8 *dst, int lsn) break; } } - + if (i == 8) return -1; 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); ret = _readfile(iso->multih[i].handle, dst + iso->blockofs, iso->blocksize); - + 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; } - + if (iso->flags & ISOFLAGS_BLOCKDUMP_V2) ret = _isoReadBlockD(iso, dst, lsn); else if( iso->flags & ISOFLAGS_BLOCKDUMP_V3 ) @@ -373,8 +372,8 @@ int isoReadBlock(isoFile *iso, u8 *dst, int lsn) ret = _isoReadBlockM(iso, dst, 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; + uint ret; -// Console.WriteLn("_isoWriteBlock %d (ofs=%d)", iso->blocksize, ofs); - 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); diff --git a/pcsx2/CDVD/IsoFileFormats.h b/pcsx2/CDVD/IsoFileFormats.h index b8b80ae555..ec3ac352d7 100644 --- a/pcsx2/CDVD/IsoFileFormats.h +++ b/pcsx2/CDVD/IsoFileFormats.h @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with PCSX2. * If not, see . */ - + #ifndef __LIBISO_H__ #define __LIBISO_H__ @@ -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__ */ diff --git a/pcsx2/CDVD/IsoFileTools.cpp b/pcsx2/CDVD/IsoFileTools.cpp index 258f78d1ac..477d505c17 100644 --- a/pcsx2/CDVD/IsoFileTools.cpp +++ b/pcsx2/CDVD/IsoFileTools.cpp @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with PCSX2. * If not, see . */ - + #include "PrecompiledHeader.h" #include "IsoFileTools.h" @@ -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); } diff --git a/pcsx2/CDVD/IsoFileTools.h b/pcsx2/CDVD/IsoFileTools.h index 8865294386..f601e72e42 100644 --- a/pcsx2/CDVD/IsoFileTools.h +++ b/pcsx2/CDVD/IsoFileTools.h @@ -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); diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 6c4d17c1b8..d9ddd5d738 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -584,7 +584,7 @@ void loadElfFile(const wxString& filename) if( memcmp( "rom0:OSDSYS", (char*)PSM( i ), 11 ) == 0 ) { strcpy( (char*)PSM( i ), fnptr ); - DevCon.WriteLn( "loadElfFile: addr %x \"%s\" -> \"%s\"", i, "rom0:OSDSYS", fnptr.data() ); + DevCon.WriteLn( "loadElfFile: addr %x \"%s\" -> \"%s\"", i, "rom0:OSDSYS", fnptr.data() ); } } ElfCRC = elfobj.GetCRC(); diff --git a/pcsx2/Gif.cpp b/pcsx2/Gif.cpp index cba6b211c4..e668af399b 100644 --- a/pcsx2/Gif.cpp +++ b/pcsx2/Gif.cpp @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -37,16 +37,16 @@ static u32 gifqwc = 0; static bool gifmfifoirq = false; static __forceinline void clearFIFOstuff(bool full) -{ +{ GSCSRr &= ~0xC000; //Clear FIFO stuff - + if (full) GSCSRr |= 0x8000; //FIFO full - else + else GSCSRr |= 0x4000; //FIFO empty } -__forceinline void gsInterrupt() +__forceinline void gsInterrupt() { GIF_LOG("gsInterrupt: %8.8x", cpuRegs.cycle); @@ -62,14 +62,14 @@ __forceinline void gsInterrupt() if (Path3progress != IMAGE_MODE) vif1Regs->stat.VGW = 0; } - if (Path3progress == STOPPED_MODE) + if (Path3progress == STOPPED_MODE) { gifRegs->stat.clear(GIF_STAT_APATH3 | GIF_STAT_OPH); } - - if ((gif->qwc > 0) || (!gspath3done)) + + if ((gif->qwc > 0) || (!gspath3done)) { - if (!dmacRegs->ctrl.DMAE) + if (!dmacRegs->ctrl.DMAE) { Console.Warning("gs dma masked, re-scheduling..."); // re-raise the int shortly in the future @@ -85,9 +85,9 @@ __forceinline void gsInterrupt() gscycles = 0; gif->chcr.STR = 0; vif1Regs->stat.VGW = 0; - - gifRegs->stat.clear(GIF_STAT_APATH3 | GIF_STAT_OPH | GIF_STAT_P3Q | GIF_STAT_FQC); - + + gifRegs->stat.clear(GIF_STAT_APATH3 | GIF_STAT_OPH | GIF_STAT_P3Q | GIF_STAT_FQC); + clearFIFOstuff(false); hwDmacIrq(DMAC_GIF); GIF_LOG("GIF DMA end"); @@ -95,26 +95,26 @@ __forceinline void gsInterrupt() } static u32 WRITERING_DMA(u32 *pMem, u32 qwc) -{ +{ gifRegs->stat.APATH = GIF_APATH3; - gifRegs->stat.OPH = 1; + gifRegs->stat.OPH = 1; int size = mtgsThread.PrepDataPacket(GIF_PATH_3, pMem, qwc); u8* pgsmem = mtgsThread.GetDataPacketPtr(); - memcpy_aligned(pgsmem, pMem, size<<4); - + memcpy_aligned(pgsmem, pMem, size<<4); + mtgsThread.SendDataPacket(); return size; -} +} -int _GIFchain() +int _GIFchain() { u32 qwc = min( gifsplit, (int)gif->qwc ); u32 *pMem; pMem = (u32*)dmaGetAddr(gif->madr); - if (pMem == NULL) + if (pMem == NULL) { // reset path3, fixes dark cloud 2 GIFPath_Clear( GIF_PATH_3 ); @@ -129,7 +129,7 @@ int _GIFchain() return WRITERING_DMA(pMem, qwc); } -static __forceinline void GIFchain() +static __forceinline void GIFchain() { Registers::Freeze(); if (gif->qwc) gscycles+= _GIFchain(); /* guessing */ @@ -144,21 +144,21 @@ static __forceinline bool checkTieBit(u32* &ptag) gspath3done = true; return true; } - + return false; } static __forceinline u32* ReadTag(u32 &id) { u32* ptag = (u32*)dmaGetAddr(gif->tadr); //Set memory pointer to TADR - + if (!(Tag::Transfer("Gif", gif, ptag))) return NULL; - + gif->madr = ptag[1]; //MADR = ADDR field - + id = Tag::Id(ptag); gscycles += 2; // Add 1 cycles from the QW read for the tag - + gspath3done = hwDmacSrcChainWithStack(gif, id); return ptag; } @@ -166,7 +166,7 @@ static __forceinline u32* ReadTag(u32 &id) static __forceinline u32* ReadTag2() { u32* ptag = (u32*)dmaGetAddr(gif->tadr); //Set memory pointer to TADR - + Tag::UnsafeTransfer(gif, ptag); gif->madr = ptag[1]; @@ -174,11 +174,11 @@ static __forceinline u32* ReadTag2() return ptag; } -void GIFdma() +void GIFdma() { u32 *ptag; u32 id; - + gscycles = prevcycles; if (gifRegs->ctrl.PSE) // temporarily stop @@ -191,22 +191,22 @@ void GIFdma() { Console.WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3, gif->madr, psHu32(DMAC_STADR)); - if ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) + if ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) { CPU_INT(2, gscycles); gscycles = 0; return; } - + prevcycles = 0; gif->qwc = 0; } clearFIFOstuff(true); gifRegs->stat.FQC |= 0x10;// FQC=31, hack ;) (for values of 31 that equal 16) [ used to be 0xE00; // OPH=1 | APATH=3] - + //Path2 gets priority in intermittent mode - if ((gifRegs->stat.P1Q || (vif1.cmd & 0x7f) == 0x50) && gifRegs->mode.IMT && (Path3progress == IMAGE_MODE)) + if ((gifRegs->stat.P1Q || (vif1.cmd & 0x7f) == 0x50) && gifRegs->mode.IMT && (Path3progress == IMAGE_MODE)) { // We are in image mode doing DIRECTHL, Path 1 is in queue, and in intermittant mode. GIF_LOG("Waiting VU %x, PATH2 %x, GIFMODE %x Progress %x", gifRegs->stat.P1Q, (vif1.cmd & 0x7f), gifRegs->mode._u32, Path3progress); @@ -214,9 +214,9 @@ void GIFdma() return; } - if (vif1Regs->mskpath3 || gifRegs->mode.M3R) + if (vif1Regs->mskpath3 || gifRegs->mode.M3R) { - if (gif->qwc == 0) + if (gif->qwc == 0) { if ((gif->chcr.MOD == CHAIN_MODE) && gif->chcr.STR) { @@ -227,8 +227,8 @@ void GIFdma() //Check TIE bit of CHCR and IRQ bit of tag if (checkTieBit(ptag)) GIF_LOG("PATH3 MSK dmaIrq Set"); } - } - + } + if (Path3progress == STOPPED_MODE) /*|| (vif1Regs->stat._u32 |= VIF1_STAT_VGW) == 0*/ { vif1Regs->stat.VGW = 0; @@ -243,19 +243,19 @@ void GIFdma() // Transfer Dn_QWC from Dn_MADR to GIF if ((gif->chcr.MOD == NORMAL_MODE) || (gif->qwc > 0)) // Normal Mode - { - + { + if ((dmacRegs->ctrl.STD == STD_GIF) && (gif->chcr.MOD == NORMAL_MODE)) - { + { Console.WriteLn("DMA Stall Control on GIF normal"); } GIFchain(); //Transfers the data set by the switch - + CPU_INT(2, gscycles * BIAS); - return; + return; } - + if ((gif->chcr.MOD == CHAIN_MODE) && (!gspath3done)) // Chain Mode { ptag = ReadTag(id); @@ -263,9 +263,9 @@ void GIFdma() GIF_LOG("gifdmaChain %8.8x_%8.8x size=%d, id=%d, addr=%lx", ptag[1], ptag[0], gif->qwc, id, gif->madr); if (dmacRegs->ctrl.STD == STD_GIF) - { + { // there are still bugs, need to also check if gif->madr +16*qwc >= stadr, if not, stall - if (!gspath3done && ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) && (id == 4)) + if (!gspath3done && ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) && (id == 4)) { // stalled Console.WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3,gif->madr, psHu32(DMAC_STADR)); @@ -277,34 +277,34 @@ void GIFdma() return; } } - + checkTieBit(ptag); } prevcycles = 0; - + if ((!gspath3done) && (gif->qwc == 0)) { ptag = (u32*)dmaGetAddr(gif->tadr); //Set memory pointer to TADR - + Tag::UnsafeTransfer(gif, ptag); gif->madr = ptag[1]; gspath3done = hwDmacSrcChainWithStack(gif, Tag::Id(ptag)); - + checkTieBit(ptag); - + GIF_LOG("gifdmaChain %8.8x_%8.8x size=%d, id=%d, addr=%lx", ptag[1], ptag[0], gif->qwc, (ptag[0] >> 28) & 0x7, gif->madr); CPU_INT(2, gscycles * BIAS); - } - else + } + else { CPU_INT(2, gscycles * BIAS); gscycles = 0; } } -void dmaGIF() +void dmaGIF() { //We used to add wait time for the buffer to fill here, fixing some timing problems in path 3 masking //It takes the time of 24 QW for the BUS to become ready - The Punisher And Streetball @@ -317,13 +317,13 @@ void dmaGIF() gifRegs->stat.FQC |= 0x10; // hack ;) clearFIFOstuff(true); - + if (dmacRegs->ctrl.MFD == MFD_GIF) // GIF MFIFO { //Console.WriteLn("GIF MFIFO"); gifMFIFOInterrupt(); return; - } + } if ((gif->qwc == 0) && (gif->chcr.MOD != NORMAL_MODE)) { @@ -337,21 +337,21 @@ void dmaGIF() //Halflife sets a QWC amount in chain mode, no tadr set. if (gif->qwc > 0) gspath3done = true; - + GIFdma(); } // called from only one location, so forceinline it: -static __forceinline int mfifoGIFrbTransfer() +static __forceinline int mfifoGIFrbTransfer() { u32 mfifoqwc = min(gifqwc, (u32)gif->qwc); u32 *src; /* Check if the transfer should wrap around the ring buffer */ - if ((gif->madr + mfifoqwc * 16) > (dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK + 16)) + 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. @@ -360,21 +360,21 @@ static __forceinline int mfifoGIFrbTransfer() if (src == NULL) return -1; s1 = WRITERING_DMA(src, s1); - if (s1 == (mfifoqwc - s2)) + if (s1 == (mfifoqwc - s2)) { /* and second copy 's2' bytes from 'maddr' to '&data[s1]' */ src = (u32*)PSM(dmacRegs->rbor.ADDR); if (src == NULL) return -1; s2 = WRITERING_DMA(src, s2); - } - else - { + } + else + { s2 = 0; } - + mfifoqwc = s1 + s2; - } - else + } + else { /* it doesn't, so just transfer 'qwc*16' words from 'gif->madr' to GS */ src = (u32*)PSM(gif->madr); @@ -389,23 +389,23 @@ static __forceinline int mfifoGIFrbTransfer() } // called from only one location, so forceinline it: -static __forceinline int mfifoGIFchain() -{ +static __forceinline int mfifoGIFchain() +{ /* Is QWC = 0? if so there is nothing to transfer */ if (gif->qwc == 0) return 0; if (gif->madr >= dmacRegs->rbor.ADDR && - gif->madr <= (dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK)) + gif->madr <= (dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK)) { if (mfifoGIFrbTransfer() == -1) return -1; - } - else + } + else { int mfifoqwc; - + u32 *pMem = (u32*)dmaGetAddr(gif->madr); if (pMem == NULL) return -1; - + mfifoqwc = WRITERING_DMA(pMem, gif->qwc); mfifocycles += (mfifoqwc) * 2; /* guessing */ } @@ -418,29 +418,29 @@ static u32 qwctag(u32 mask) return (dmacRegs->rbor.ADDR + (mask & dmacRegs->rbsr.RMSK)); } -void mfifoGIFtransfer(int qwc) +void mfifoGIFtransfer(int qwc) { u32 *ptag; int id; - + mfifocycles = 0; gifmfifoirq = false; - if(qwc > 0 ) + if(qwc > 0 ) { gifqwc += qwc; - + if (!(gifstate & GIF_STATE_EMPTY)) return; // if (gifempty == false) return; gifstate &= ~GIF_STATE_EMPTY; gifempty = false; } - + GIF_LOG("mfifoGIFtransfer %x madr %x, tadr %x", gif->chcr._u32, gif->madr, gif->tadr); - - if (gif->qwc == 0) + + if (gif->qwc == 0) { - if (gif->tadr == spr0->madr) + if (gif->tadr == spr0->madr) { //if( gifqwc > 1 ) DevCon.WriteLn("gif mfifo tadr==madr but qwc = %d", gifqwc); hwDmacIrq(DMAC_MFIFO_EMPTY); @@ -448,22 +448,22 @@ void mfifoGIFtransfer(int qwc) gifempty = true; return; } - + gif->tadr = qwctag(gif->tadr); - + ptag = (u32*)dmaGetAddr(gif->tadr); Tag::UnsafeTransfer(gif, ptag); - + gif->madr = ptag[1]; id =Tag::Id(ptag); mfifocycles += 2; - + GIF_LOG("dmaChain %8.8x_%8.8x size=%d, id=%d, madr=%lx, tadr=%lx mfifo qwc = %x spr0 madr = %x", ptag[1], ptag[0], gif->qwc, id, gif->madr, gif->tadr, gifqwc, spr0->madr); gifqwc--; - switch (id) + switch (id) { case TAG_REFE: // Refe - Transfer Packet According to ADDR field gif->tadr = qwctag(gif->tadr + 16); @@ -471,7 +471,7 @@ void mfifoGIFtransfer(int qwc) break; case TAG_CNT: // CNT - Transfer QWC following the tag. - gif->madr = qwctag(gif->tadr + 16); //Set MADR to QW after Tag + gif->madr = qwctag(gif->tadr + 16); //Set MADR to QW after Tag gif->tadr = qwctag(gif->madr + (gif->qwc << 4)); //Set TADR to QW following the data gifstate = GIF_STATE_READY; break; @@ -486,7 +486,7 @@ void mfifoGIFtransfer(int qwc) } case TAG_REF: // Ref - Transfer QWC from ADDR field - case TAG_REFS: // Refs - Transfer QWC from ADDR field (Stall Control) + case TAG_REFS: // Refs - Transfer QWC from ADDR field (Stall Control) gif->tadr = qwctag(gif->tadr + 16); //Set TADR to next tag gifstate = GIF_STATE_READY; break; @@ -497,7 +497,7 @@ void mfifoGIFtransfer(int qwc) gifstate = GIF_STATE_DONE; //End Transfer break; } - + if ((gif->chcr.TIE) && (Tag::IRQ(ptag))) { SPR_LOG("dmaIrq Set"); @@ -505,26 +505,26 @@ void mfifoGIFtransfer(int qwc) gifmfifoirq = true; } } - + Registers::Freeze(); - if (mfifoGIFchain() == -1) + if (mfifoGIFchain() == -1) { Console.WriteLn("GIF dmaChain error size=%d, madr=%lx, tadr=%lx", gif->qwc, gif->madr, gif->tadr); gifstate = GIF_STATE_STALL; } Registers::Thaw(); - + if ((gif->qwc == 0) && (gifstate & GIF_STATE_DONE)) gifstate = GIF_STATE_STALL; CPU_INT(11,mfifocycles); - - SPR_LOG("mfifoGIFtransfer end %x madr %x, tadr %x", gif->chcr._u32, gif->madr, gif->tadr); + + SPR_LOG("mfifoGIFtransfer end %x madr %x, tadr %x", gif->chcr._u32, gif->madr, gif->tadr); } void gifMFIFOInterrupt() { Console.WriteLn("gifMFIFOInterrupt"); mfifocycles = 0; - + if (Path3progress == STOPPED_MODE) { gifRegs->stat.APATH = GIF_APATH_IDLE; @@ -537,11 +537,11 @@ void gifMFIFOInterrupt() hwDmacIrq(DMAC_FROM_SPR); } - if (!(gif->chcr.STR)) - { + if (!(gif->chcr.STR)) + { Console.WriteLn("WTF GIFMFIFO"); - cpuRegs.interrupt &= ~(1 << 11); - return; + cpuRegs.interrupt &= ~(1 << 11); + return; } if ((gifRegs->stat.P1Q || (vif1.cmd & 0x7f) == 0x50) && gifRegs->mode.IMT && Path3progress == IMAGE_MODE) //Path2 gets priority in intermittent mode @@ -549,26 +549,26 @@ void gifMFIFOInterrupt() //GIF_LOG("Waiting VU %x, PATH2 %x, GIFMODE %x Progress %x", psHu32(GIF_STAT) & 0x100, (vif1.cmd & 0x7f), psHu32(GIF_MODE), Path3progress); CPU_INT(11,mfifocycles); return; - } - + } + if (!(gifstate & GIF_STATE_STALL)) { - if (gifqwc <= 0) + if (gifqwc <= 0) { //Console.WriteLn("Empty"); hwDmacIrq(DMAC_MFIFO_EMPTY); gifstate |= GIF_STATE_EMPTY; gifempty = true; - + gifRegs->stat.IMT = 0; return; } mfifoGIFtransfer(0); return; } - + #ifdef PCSX2_DEVBUILD - if ((gifstate & GIF_STATE_READY) || (gif->qwc > 0)) + if ((gifstate & GIF_STATE_READY) || (gif->qwc > 0)) { Console.Error("gifMFIFO Panic > Shouldn't go here!"); return; @@ -579,9 +579,9 @@ void gifMFIFOInterrupt() gspath3done = false; gscycles = 0; - + gifRegs->stat.clear(GIF_STAT_APATH3 | GIF_STAT_OPH | GIF_STAT_P3Q | GIF_STAT_FQC); // OPH, APATH, P3Q, FQC = 0 - + vif1Regs->stat.VGW = 0; gif->chcr.STR = 0; gifstate = GIF_STATE_READY; diff --git a/pcsx2/IPU/IPU.cpp b/pcsx2/IPU/IPU.cpp index 56f6709085..2b86df3e6f 100644 --- a/pcsx2/IPU/IPU.cpp +++ b/pcsx2/IPU/IPU.cpp @@ -222,7 +222,7 @@ void SaveStateBase::ipuFreeze() bool ipuCanFreeze() { - return (ipuCurCmd == 0xffffffff); + return (ipuCurCmd == -1); } __forceinline u32 ipuRead32(u32 mem) diff --git a/pcsx2/MMI.cpp b/pcsx2/MMI.cpp index 93cc27ee70..df0f8ba821 100644 --- a/pcsx2/MMI.cpp +++ b/pcsx2/MMI.cpp @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -107,7 +107,7 @@ namespace OpcodeImpl { if (_Rd_) cpuRegs.GPR.r[_Rd_].UD[0] = cpuRegs.LO.UD[1]; } - void DIV1() { + void DIV1() { if (cpuRegs.GPR.r[_Rs_].UL[0] == 0x80000000 && cpuRegs.GPR.r[_Rt_].UL[0] == 0xffffffff) { cpuRegs.LO.SD[1] = (s32)0x80000000; @@ -145,8 +145,8 @@ namespace MMI { //*****************MMI OPCODES********************************* -__forceinline void _PLZCW(int n) -{ +__forceinline void _PLZCW(int n) +{ // This function counts the number of "like" bits in the source register, starting // with the MSB and working its way down, and returns the result MINUS ONE. // So 0xff00 would return 7, not 8. @@ -161,7 +161,7 @@ __forceinline void _PLZCW(int n) // shift first, compare, then increment. This excludes the sign bit from our final count. while( i <<= 1, i < 0 ) c++; - cpuRegs.GPR.r[_Rd_].UL[n] = c; + cpuRegs.GPR.r[_Rd_].UL[n] = c; } void PLZCW() { @@ -171,13 +171,13 @@ void PLZCW() { _PLZCW (1); } -__forceinline void PMFHL_CLAMP(u16 dst, u16 src) +__forceinline void PMFHL_CLAMP(u16 dst, u16 src) { if ((int)src > (int)0x00007fff) - dst = 0x7fff; + dst = 0x7fff; else if ((int)src < (int)0xffff8000) // Ints only go up to 0x7FFFFFFF. Something's not right here. --arcum42 - dst = 0x8000; - else + dst = 0x8000; + else dst = (u16)src; } @@ -254,7 +254,7 @@ void PMTHL() { cpuRegs.HI.UL[2] = cpuRegs.GPR.r[_Rs_].UL[3]; } -__forceinline void _PSLLH(int n) +__forceinline void _PSLLH(int n) { cpuRegs.GPR.r[_Rd_].US[n] = cpuRegs.GPR.r[_Rt_].US[n] << ( _Sa_ & 0xf ); } @@ -266,7 +266,7 @@ void PSLLH() { _PSLLH(4); _PSLLH(5); _PSLLH(6); _PSLLH(7); } -__forceinline void _PSRLH(int n) +__forceinline void _PSRLH(int n) { cpuRegs.GPR.r[_Rd_].US[n] = cpuRegs.GPR.r[_Rt_].US[n] >> ( _Sa_ & 0xf ); } @@ -278,7 +278,7 @@ void PSRLH () { _PSRLH(4); _PSRLH(5); _PSRLH(6); _PSRLH(7); } -__forceinline void _PSRAH(int n) +__forceinline void _PSRAH(int n) { cpuRegs.GPR.r[_Rd_].US[n] = cpuRegs.GPR.r[_Rt_].SS[n] >> ( _Sa_ & 0xf ); } @@ -290,7 +290,7 @@ void PSRAH() { _PSRAH(4); _PSRAH(5); _PSRAH(6); _PSRAH(7); } -__forceinline void _PSLLW(int n) +__forceinline void _PSLLW(int n) { cpuRegs.GPR.r[_Rd_].UL[n] = cpuRegs.GPR.r[_Rt_].UL[n] << _Sa_; } @@ -301,7 +301,7 @@ void PSLLW() { _PSLLW(0); _PSLLW(1); _PSLLW(2); _PSLLW(3); } -__forceinline void _PSRLW(int n) +__forceinline void _PSRLW(int n) { cpuRegs.GPR.r[_Rd_].UL[n] = cpuRegs.GPR.r[_Rt_].UL[n] >> _Sa_; } @@ -312,7 +312,7 @@ void PSRLW() { _PSRLW(0); _PSRLW(1); _PSRLW(2); _PSRLW(3); } -__forceinline void _PSRAW(int n) +__forceinline void _PSRAW(int n) { cpuRegs.GPR.r[_Rd_].UL[n] = cpuRegs.GPR.r[_Rt_].SL[n] >> _Sa_; } @@ -326,7 +326,7 @@ void PSRAW() { //*****************END OF MMI OPCODES************************** //*************************MMI0 OPCODES************************ -__forceinline void _PADDW(int n) +__forceinline void _PADDW(int n) { cpuRegs.GPR.r[_Rd_].UL[n] = cpuRegs.GPR.r[_Rs_].UL[n] + cpuRegs.GPR.r[_Rt_].UL[n]; } @@ -337,7 +337,7 @@ void PADDW() { _PADDW(0); _PADDW(1); _PADDW(2); _PADDW(3); } -__forceinline void _PSUBW(int n) +__forceinline void _PSUBW(int n) { cpuRegs.GPR.r[_Rd_].UL[n] = cpuRegs.GPR.r[_Rs_].UL[n] - cpuRegs.GPR.r[_Rt_].UL[n]; } @@ -348,7 +348,7 @@ void PSUBW() { _PSUBW(0); _PSUBW(1); _PSUBW(2); _PSUBW(3); } -__forceinline void _PCGTW(int n) +__forceinline void _PCGTW(int n) { if (cpuRegs.GPR.r[_Rs_].SL[n] > cpuRegs.GPR.r[_Rt_].SL[n]) cpuRegs.GPR.r[_Rd_].UL[n] = 0xFFFFFFFF; @@ -362,7 +362,7 @@ void PCGTW() { _PCGTW(0); _PCGTW(1); _PCGTW(2); _PCGTW(3); } -__forceinline void _PMAXW(int n) +__forceinline void _PMAXW(int n) { if (cpuRegs.GPR.r[_Rs_].SL[n] > cpuRegs.GPR.r[_Rt_].SL[n]) cpuRegs.GPR.r[_Rd_].UL[n] = cpuRegs.GPR.r[_Rs_].UL[n]; @@ -376,7 +376,7 @@ void PMAXW() { _PMAXW(0); _PMAXW(1); _PMAXW(2); _PMAXW(3); } -__forceinline void _PADDH(int n) +__forceinline void _PADDH(int n) { cpuRegs.GPR.r[_Rd_].US[n] = cpuRegs.GPR.r[_Rs_].US[n] + cpuRegs.GPR.r[_Rt_].US[n]; } @@ -388,7 +388,7 @@ void PADDH() { _PADDH(4); _PADDH(5); _PADDH(6); _PADDH(7); } -__forceinline void _PSUBH(int n) +__forceinline void _PSUBH(int n) { cpuRegs.GPR.r[_Rd_].US[n] = cpuRegs.GPR.r[_Rs_].US[n] - cpuRegs.GPR.r[_Rt_].US[n]; } @@ -400,7 +400,7 @@ void PSUBH() { _PSUBH(4); _PSUBH(5); _PSUBH(6); _PSUBH(7); } -__forceinline void _PCGTH(int n) +__forceinline void _PCGTH(int n) { if (cpuRegs.GPR.r[_Rs_].SS[n] > cpuRegs.GPR.r[_Rt_].SS[n]) cpuRegs.GPR.r[_Rd_].US[n] = 0xFFFF; @@ -415,9 +415,9 @@ void PCGTH() { _PCGTH(4); _PCGTH(5); _PCGTH(6); _PCGTH(7); } -__forceinline void _PMAXH(int n) +__forceinline void _PMAXH(int n) { - if (cpuRegs.GPR.r[_Rs_].SS[n] > cpuRegs.GPR.r[_Rt_].SS[n]) + if (cpuRegs.GPR.r[_Rs_].SS[n] > cpuRegs.GPR.r[_Rt_].SS[n]) cpuRegs.GPR.r[_Rd_].US[n] = cpuRegs.GPR.r[_Rs_].US[n]; else cpuRegs.GPR.r[_Rd_].US[n] = cpuRegs.GPR.r[_Rt_].US[n]; @@ -430,7 +430,7 @@ void PMAXH() { _PMAXH(4); _PMAXH(5); _PMAXH(6); _PMAXH(7); } -__forceinline void _PADDB(int n) +__forceinline void _PADDB(int n) { cpuRegs.GPR.r[_Rd_].SC[n] = cpuRegs.GPR.r[_Rs_].SC[n] + cpuRegs.GPR.r[_Rt_].SC[n]; } @@ -456,7 +456,7 @@ void PSUBB() { _PSUBB( i ); } -__forceinline void _PCGTB(int n) +__forceinline void _PCGTB(int n) { if (cpuRegs.GPR.r[_Rs_].SC[n] > cpuRegs.GPR.r[_Rt_].SC[n]) cpuRegs.GPR.r[_Rd_].UC[n] = 0xFF; @@ -472,17 +472,17 @@ void PCGTB() { _PCGTB( i ); } -__forceinline void _PADDSW(int n) +__forceinline void _PADDSW(int n) { s64 sTemp64; - - sTemp64 = (s64)cpuRegs.GPR.r[_Rs_].SL[n] + (s64)cpuRegs.GPR.r[_Rt_].SL[n]; + + sTemp64 = (s64)cpuRegs.GPR.r[_Rs_].SL[n] + (s64)cpuRegs.GPR.r[_Rt_].SL[n]; if (sTemp64 > 0x7FFFFFFF) - cpuRegs.GPR.r[_Rd_].UL[n] = 0x7FFFFFFF; + cpuRegs.GPR.r[_Rd_].UL[n] = 0x7FFFFFFF; else if ((sTemp64 < (s32)0x80000000) ) - cpuRegs.GPR.r[_Rd_].UL[n] = 0x80000000LL; - else - cpuRegs.GPR.r[_Rd_].UL[n] = (s32)sTemp64; + cpuRegs.GPR.r[_Rd_].UL[n] = 0x80000000LL; + else + cpuRegs.GPR.r[_Rd_].UL[n] = (s32)sTemp64; } void PADDSW() { @@ -491,14 +491,14 @@ void PADDSW() { _PADDSW(0); _PADDSW(1); _PADDSW(2); _PADDSW(3); } -__forceinline void _PSUBSW(int n) +__forceinline void _PSUBSW(int n) { s64 sTemp64; - - sTemp64 = (s64)cpuRegs.GPR.r[_Rs_].SL[n] - (s64)cpuRegs.GPR.r[_Rt_].SL[n]; - + + sTemp64 = (s64)cpuRegs.GPR.r[_Rs_].SL[n] - (s64)cpuRegs.GPR.r[_Rt_].SL[n]; + if (sTemp64 >= 0x7FFFFFFF) - cpuRegs.GPR.r[_Rd_].UL[n] = 0x7FFFFFFF; + cpuRegs.GPR.r[_Rd_].UL[n] = 0x7FFFFFFF; else if ((sTemp64 < (s32)0x80000000)) cpuRegs.GPR.r[_Rd_].UL[n] = 0x80000000; else @@ -538,17 +538,17 @@ void PPACW() { cpuRegs.GPR.r[_Rd_].UL[3] = Rs.UL[2]; } -__forceinline void _PADDSH(int n) +__forceinline void _PADDSH(int n) { s32 sTemp32; - sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].SS[n] + (s32)cpuRegs.GPR.r[_Rt_].SS[n]; - + sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].SS[n] + (s32)cpuRegs.GPR.r[_Rt_].SS[n]; + if (sTemp32 > 0x7FFF) - cpuRegs.GPR.r[_Rd_].US[n] = 0x7FFF; - else if ((sTemp32 < (s32)0xffff8000) ) - cpuRegs.GPR.r[_Rd_].US[n] = 0x8000; - else - cpuRegs.GPR.r[_Rd_].US[n] = (s16)sTemp32; + cpuRegs.GPR.r[_Rd_].US[n] = 0x7FFF; + else if ((sTemp32 < (s32)0xffff8000) ) + cpuRegs.GPR.r[_Rd_].US[n] = 0x8000; + else + cpuRegs.GPR.r[_Rd_].US[n] = (s16)sTemp32; } void PADDSH() { @@ -558,16 +558,16 @@ void PADDSH() { _PADDSH(4); _PADDSH(5); _PADDSH(6); _PADDSH(7); } -__forceinline void _PSUBSH(int n) +__forceinline void _PSUBSH(int n) { s32 sTemp32; - sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].SS[n] - (s32)cpuRegs.GPR.r[_Rt_].SS[n]; - + sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].SS[n] - (s32)cpuRegs.GPR.r[_Rt_].SS[n]; + if (sTemp32 >= 0x7FFF) cpuRegs.GPR.r[_Rd_].US[n] = 0x7FFF; - else if ((sTemp32 < (s32)0xffff8000) ) - cpuRegs.GPR.r[_Rd_].US[n] = 0x8000; - else + else if ((sTemp32 < (s32)0xffff8000) ) + cpuRegs.GPR.r[_Rd_].US[n] = 0x8000; + else cpuRegs.GPR.r[_Rd_].US[n] = (s16)sTemp32; } @@ -610,17 +610,17 @@ void PPACH() { cpuRegs.GPR.r[_Rd_].US[7] = Rs.US[6]; } -__forceinline void _PADDSB(int n) +__forceinline void _PADDSB(int n) { s16 sTemp16; - sTemp16 = (s16)cpuRegs.GPR.r[_Rs_].SC[n] + (s16)cpuRegs.GPR.r[_Rt_].SC[n]; - - if (sTemp16 > 0x7F) - cpuRegs.GPR.r[_Rd_].UC[n] = 0x7F; - else if (sTemp16 < (s16)0xff80) - cpuRegs.GPR.r[_Rd_].UC[n] = 0x80; - else - cpuRegs.GPR.r[_Rd_].UC[n] = (s8)sTemp16; + sTemp16 = (s16)cpuRegs.GPR.r[_Rs_].SC[n] + (s16)cpuRegs.GPR.r[_Rt_].SC[n]; + + if (sTemp16 > 0x7F) + cpuRegs.GPR.r[_Rd_].UC[n] = 0x7F; + else if (sTemp16 < (s16)0xff80) + cpuRegs.GPR.r[_Rd_].UC[n] = 0x80; + else + cpuRegs.GPR.r[_Rd_].UC[n] = (s8)sTemp16; } void PADDSB() { @@ -628,19 +628,19 @@ void PADDSB() { if (!_Rd_) return; for( i=0; i<16; i++ ) - _PADDSB(i); + _PADDSB(i); } static __forceinline void _PSUBSB( u8 n ) { s16 sTemp16; - sTemp16 = (s16)cpuRegs.GPR.r[_Rs_].SC[n] - (s16)cpuRegs.GPR.r[_Rt_].SC[n]; - - if (sTemp16 >= 0x7F) + sTemp16 = (s16)cpuRegs.GPR.r[_Rs_].SC[n] - (s16)cpuRegs.GPR.r[_Rt_].SC[n]; + + if (sTemp16 >= 0x7F) cpuRegs.GPR.r[_Rd_].UC[n] = 0x7F; else if (sTemp16 <= (s16)0xff80) - cpuRegs.GPR.r[_Rd_].UC[n] = 0x80; - else + cpuRegs.GPR.r[_Rd_].UC[n] = 0x80; + else cpuRegs.GPR.r[_Rd_].UC[n] = (s8)sTemp16; } @@ -649,7 +649,7 @@ void PSUBSB() { if (!_Rd_) return; for( i=0; i<16; i++ ) - _PSUBSB(i); + _PSUBSB(i); } void PEXTLB() { @@ -706,7 +706,7 @@ void PPACB() { cpuRegs.GPR.r[_Rd_].UC[15] = Rs.UC[14]; } -__forceinline void _PEXT5(int n) +__forceinline void _PEXT5(int n) { cpuRegs.GPR.r[_Rd_].UL[n] = ((cpuRegs.GPR.r[_Rt_].UL[n] & 0x0000001F) << 3) | @@ -721,7 +721,7 @@ void PEXT5() { _PEXT5(0); _PEXT5(1); _PEXT5(2); _PEXT5(3); } -__forceinline void _PPAC5(int n) +__forceinline void _PPAC5(int n) { cpuRegs.GPR.r[_Rd_].UL[n] = ((cpuRegs.GPR.r[_Rt_].UL[n] >> 3) & 0x0000001F) | @@ -739,7 +739,7 @@ void PPAC5() { //***END OF MMI0 OPCODES****************************************** //**********MMI1 OPCODES************************************** -__forceinline void _PABSW(int n) +__forceinline void _PABSW(int n) { if (cpuRegs.GPR.r[_Rt_].UL[n] == 0x80000000) cpuRegs.GPR.r[_Rd_].UL[n] = 0x7fffffff; //clamp @@ -755,7 +755,7 @@ void PABSW() { _PABSW(0); _PABSW(1); _PABSW(2); _PABSW(3); } -__forceinline void _PCEQW(int n) +__forceinline void _PCEQW(int n) { if (cpuRegs.GPR.r[_Rs_].UL[n] == cpuRegs.GPR.r[_Rt_].UL[n]) cpuRegs.GPR.r[_Rd_].UL[n] = 0xFFFFFFFF; @@ -809,7 +809,7 @@ void PABSH() { static __forceinline void _PCEQH( u8 n ) { - if (cpuRegs.GPR.r[_Rs_].US[n] == cpuRegs.GPR.r[_Rt_].US[n]) + if (cpuRegs.GPR.r[_Rs_].US[n] == cpuRegs.GPR.r[_Rt_].US[n]) cpuRegs.GPR.r[_Rd_].US[n] = 0xFFFF; else cpuRegs.GPR.r[_Rd_].US[n] = 0x0000; @@ -837,12 +837,12 @@ void PMINH() { _PMINH(4); _PMINH(5); _PMINH(6); _PMINH(7); } -__forceinline void _PCEQB(int n) +__forceinline void _PCEQB(int n) { if (cpuRegs.GPR.r[_Rs_].UC[n] == cpuRegs.GPR.r[_Rt_].UC[n]) cpuRegs.GPR.r[_Rd_].UC[n] = 0xFF; else - cpuRegs.GPR.r[_Rd_].UC[n] = 0x00; + cpuRegs.GPR.r[_Rd_].UC[n] = 0x00; } void PCEQB() { @@ -850,17 +850,17 @@ void PCEQB() { if (!_Rd_) return; for( i=0; i<16; i++ ) - _PCEQB(i); + _PCEQB(i); } -__forceinline void _PADDUW(int n) +__forceinline void _PADDUW(int n) { s64 tmp; - tmp = (s64)cpuRegs.GPR.r[_Rs_].UL[n] + (s64)cpuRegs.GPR.r[_Rt_].UL[n]; - - if (tmp > 0xffffffff) - cpuRegs.GPR.r[_Rd_].UL[n] = 0xffffffff; - else + tmp = (s64)cpuRegs.GPR.r[_Rs_].UL[n] + (s64)cpuRegs.GPR.r[_Rt_].UL[n]; + + if (tmp > 0xffffffff) + cpuRegs.GPR.r[_Rd_].UL[n] = 0xffffffff; + else cpuRegs.GPR.r[_Rd_].UL[n] = (u32)tmp; } @@ -870,14 +870,14 @@ void PADDUW () { _PADDUW(0); _PADDUW(1); _PADDUW(2); _PADDUW(3); } -__forceinline void _PSUBUW(int n) +__forceinline void _PSUBUW(int n) { s64 sTemp64; - sTemp64 = (s64)cpuRegs.GPR.r[_Rs_].UL[n] - (s64)cpuRegs.GPR.r[_Rt_].UL[n]; - - if (sTemp64 <= 0x0) - cpuRegs.GPR.r[_Rd_].UL[n] = 0x0; - else + sTemp64 = (s64)cpuRegs.GPR.r[_Rs_].UL[n] - (s64)cpuRegs.GPR.r[_Rt_].UL[n]; + + if (sTemp64 <= 0x0) + cpuRegs.GPR.r[_Rd_].UL[n] = 0x0; + else cpuRegs.GPR.r[_Rd_].UL[n] = (u32)sTemp64; } @@ -899,13 +899,13 @@ void PEXTUW() { cpuRegs.GPR.r[_Rd_].UL[3] = Rs.UL[3]; } -__forceinline void _PADDUH(int n) +__forceinline void _PADDUH(int n) { s32 sTemp32; - sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].US[n] + (s32)cpuRegs.GPR.r[_Rt_].US[n]; - + sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].US[n] + (s32)cpuRegs.GPR.r[_Rt_].US[n]; + if (sTemp32 > 0xFFFF) - cpuRegs.GPR.r[_Rd_].US[n] = 0xFFFF; + cpuRegs.GPR.r[_Rd_].US[n] = 0xFFFF; else cpuRegs.GPR.r[_Rd_].US[n] = (u16)sTemp32; } @@ -917,15 +917,15 @@ void PADDUH() { _PADDUH(4); _PADDUH(5); _PADDUH(6); _PADDUH(7); } -__forceinline void _PSUBUH(int n) +__forceinline void _PSUBUH(int n) { s32 sTemp32; - sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].US[n] - (s32)cpuRegs.GPR.r[_Rt_].US[n]; - + sTemp32 = (s32)cpuRegs.GPR.r[_Rs_].US[n] - (s32)cpuRegs.GPR.r[_Rt_].US[n]; + if (sTemp32 <= 0x0) - cpuRegs.GPR.r[_Rd_].US[n] = 0x0; + cpuRegs.GPR.r[_Rd_].US[n] = 0x0; else - cpuRegs.GPR.r[_Rd_].US[n] = (u16)sTemp32; + cpuRegs.GPR.r[_Rd_].US[n] = (u16)sTemp32; } void PSUBUH() { @@ -952,15 +952,15 @@ void PEXTUH() { cpuRegs.GPR.r[_Rd_].US[7] = Rs.US[7]; } -__forceinline void _PADDUB(int n) +__forceinline void _PADDUB(int n) { u16 Temp16; - Temp16 = (u16)cpuRegs.GPR.r[_Rs_].UC[n] + (u16)cpuRegs.GPR.r[_Rt_].UC[n]; - + Temp16 = (u16)cpuRegs.GPR.r[_Rs_].UC[n] + (u16)cpuRegs.GPR.r[_Rt_].UC[n]; + if (Temp16 > 0xFF) - cpuRegs.GPR.r[_Rd_].UC[n] = 0xFF; + cpuRegs.GPR.r[_Rd_].UC[n] = 0xFF; else - cpuRegs.GPR.r[_Rd_].UC[n] = (u8)Temp16; + cpuRegs.GPR.r[_Rd_].UC[n] = (u8)Temp16; } void PADDUB() { @@ -968,14 +968,14 @@ void PADDUB() { if (!_Rd_) return; for( i=0; i<16; i++ ) - _PADDUB(i); + _PADDUB(i); } __forceinline void _PSUBUB(int n) { s16 sTemp16; - sTemp16 = (s16)cpuRegs.GPR.r[_Rs_].UC[n] - (s16)cpuRegs.GPR.r[_Rt_].UC[n]; - - if (sTemp16 <= 0x0) + sTemp16 = (s16)cpuRegs.GPR.r[_Rs_].UC[n] - (s16)cpuRegs.GPR.r[_Rt_].UC[n]; + + if (sTemp16 <= 0x0) cpuRegs.GPR.r[_Rd_].UC[n] = 0x0; else cpuRegs.GPR.r[_Rd_].UC[n] = (u8)sTemp16; @@ -1060,15 +1060,15 @@ void QFSRV() { // JayteeMaster: changed a bit to avoid screw up //*********MMI2 OPCODES*************************************** -__forceinline void _PMADDW(int dd, int ss) -{ - s64 temp = (s64)((s64)cpuRegs.LO.SL[ss] | ((s64)cpuRegs.HI.SL[ss] << 32)) + - ((s64)cpuRegs.GPR.r[_Rs_].SL[ss] * (s64)cpuRegs.GPR.r[_Rt_].SL[ss]); +__forceinline void _PMADDW(int dd, int ss) +{ + s64 temp = (s64)((s64)cpuRegs.LO.SL[ss] | ((s64)cpuRegs.HI.SL[ss] << 32)) + + ((s64)cpuRegs.GPR.r[_Rs_].SL[ss] * (s64)cpuRegs.GPR.r[_Rt_].SL[ss]); - cpuRegs.LO.SD[dd] = (s32)(temp & 0xffffffff); - cpuRegs.HI.SD[dd] = (s32)(temp >> 32); + cpuRegs.LO.SD[dd] = (s32)(temp & 0xffffffff); + cpuRegs.HI.SD[dd] = (s32)(temp >> 32); - if (_Rd_) cpuRegs.GPR.r[_Rd_].SD[dd] = temp; + if (_Rd_) cpuRegs.GPR.r[_Rd_].SD[dd] = temp; } void PMADDW() { @@ -1094,15 +1094,15 @@ void PSRLVW() { (cpuRegs.GPR.r[_Rs_].UL[2] & 0x1F)); } -__forceinline void _PMSUBW(int dd, int ss) -{ - s64 temp = (s64)((s64)cpuRegs.LO.SL[ss] | ((s64)cpuRegs.HI.SL[ss] << 32)) - - ((s64)cpuRegs.GPR.r[_Rs_].SL[ss] * (s64)cpuRegs.GPR.r[_Rt_].SL[ss]); +__forceinline void _PMSUBW(int dd, int ss) +{ + s64 temp = (s64)((s64)cpuRegs.LO.SL[ss] | ((s64)cpuRegs.HI.SL[ss] << 32)) - + ((s64)cpuRegs.GPR.r[_Rs_].SL[ss] * (s64)cpuRegs.GPR.r[_Rt_].SL[ss]); - cpuRegs.LO.SD[dd] = (s32)(temp & 0xffffffff); - cpuRegs.HI.SD[dd] = (s32)(temp >> 32); + cpuRegs.LO.SD[dd] = (s32)(temp & 0xffffffff); + cpuRegs.HI.SD[dd] = (s32)(temp >> 32); - if (_Rd_) cpuRegs.GPR.r[_Rd_].SD[dd] = temp; + if (_Rd_) cpuRegs.GPR.r[_Rd_].SD[dd] = temp; } void PMSUBW() { @@ -1140,14 +1140,14 @@ void PINTH() { cpuRegs.GPR.r[_Rd_].US[7] = Rs.US[7]; } -__forceinline void _PMULTW(int dd, int ss) -{ - s64 temp = (s64)cpuRegs.GPR.r[_Rs_].SL[ss] * (s64)cpuRegs.GPR.r[_Rt_].SL[ss]; +__forceinline void _PMULTW(int dd, int ss) +{ + s64 temp = (s64)cpuRegs.GPR.r[_Rs_].SL[ss] * (s64)cpuRegs.GPR.r[_Rt_].SL[ss]; - cpuRegs.LO.UD[dd] = (s32)(temp & 0xffffffff); - cpuRegs.HI.UD[dd] = (s32)(temp >> 32); + cpuRegs.LO.UD[dd] = (s32)(temp & 0xffffffff); + cpuRegs.HI.UD[dd] = (s32)(temp >> 32); - if (_Rd_) cpuRegs.GPR.r[_Rd_].SD[dd] = temp; + if (_Rd_) cpuRegs.GPR.r[_Rd_].SD[dd] = temp; } void PMULTW() { @@ -1163,9 +1163,9 @@ __forceinline void _PDIVW(int dd, int ss) cpuRegs.HI.SD[dd] = (s32)0; } else if (cpuRegs.GPR.r[_Rt_].SL[ss] != 0) - { - cpuRegs.LO.SD[dd] = cpuRegs.GPR.r[_Rs_].SL[ss] / cpuRegs.GPR.r[_Rt_].SL[ss]; - cpuRegs.HI.SD[dd] = cpuRegs.GPR.r[_Rs_].SL[ss] % cpuRegs.GPR.r[_Rt_].SL[ss]; + { + cpuRegs.LO.SD[dd] = cpuRegs.GPR.r[_Rs_].SL[ss] / cpuRegs.GPR.r[_Rt_].SL[ss]; + cpuRegs.HI.SD[dd] = cpuRegs.GPR.r[_Rs_].SL[ss] % cpuRegs.GPR.r[_Rt_].SL[ss]; } else { @@ -1229,21 +1229,21 @@ void PMADDH() { // JayteeMaster: changed a bit to avoid screw up } // JayteeMaster: changed a bit to avoid screw up -__forceinline void _PHMADH_LO(int dd, int n) -{ +__forceinline void _PHMADH_LO(int dd, int n) +{ s32 firsttemp = (s32)cpuRegs.GPR.r[_Rs_].SS[n+1] * (s32)cpuRegs.GPR.r[_Rt_].SS[n+1]; - s32 temp = firsttemp + (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; + s32 temp = firsttemp + (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; - cpuRegs.LO.UL[dd] = temp; - cpuRegs.LO.UL[dd+1] = firsttemp; + cpuRegs.LO.UL[dd] = temp; + cpuRegs.LO.UL[dd+1] = firsttemp; } -__forceinline void _PHMADH_HI(int dd, int n) -{ +__forceinline void _PHMADH_HI(int dd, int n) +{ s32 firsttemp = (s32)cpuRegs.GPR.r[_Rs_].SS[n+1] * (s32)cpuRegs.GPR.r[_Rt_].SS[n+1]; - s32 temp = firsttemp + (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; + s32 temp = firsttemp + (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; - cpuRegs.HI.UL[dd] = temp; + cpuRegs.HI.UL[dd] = temp; cpuRegs.HI.UL[dd+1] = firsttemp; } @@ -1314,21 +1314,21 @@ void PMSUBH() { // JayteeMaster: changed a bit to avoid screw up } // JayteeMaster: changed a bit to avoid screw up -__forceinline void _PHMSBH_LO(int dd, int n, int rdd) -{ +__forceinline void _PHMSBH_LO(int dd, int n, int rdd) +{ s32 firsttemp = (s32)cpuRegs.GPR.r[_Rs_].SS[n+1] * (s32)cpuRegs.GPR.r[_Rt_].SS[n+1]; - s32 temp = firsttemp - (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; + s32 temp = firsttemp - (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; - cpuRegs.LO.UL[dd] = temp; - cpuRegs.LO.UL[dd+1] = ~firsttemp; + cpuRegs.LO.UL[dd] = temp; + cpuRegs.LO.UL[dd+1] = ~firsttemp; } -__forceinline void _PHMSBH_HI(int dd, int n, int rdd) -{ +__forceinline void _PHMSBH_HI(int dd, int n, int rdd) +{ s32 firsttemp = (s32)cpuRegs.GPR.r[_Rs_].SS[n+1] * (s32)cpuRegs.GPR.r[_Rt_].SS[n+1]; - s32 temp = firsttemp - (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; + s32 temp = firsttemp - (s32)cpuRegs.GPR.r[_Rs_].SS[n] * (s32)cpuRegs.GPR.r[_Rt_].SS[n]; - cpuRegs.HI.UL[dd] = temp; - cpuRegs.HI.UL[dd+1] = ~firsttemp; + cpuRegs.HI.UL[dd] = temp; + cpuRegs.HI.UL[dd+1] = ~firsttemp; } void PHMSBH() { // JayteeMaster: changed a bit to avoid screw up @@ -1415,7 +1415,7 @@ void PMULTH() { // JayteeMaster: changed a bit to avoid screw up } } -__forceinline void _PDIVBW(int n) +__forceinline void _PDIVBW(int n) { if (cpuRegs.GPR.r[_Rs_].UL[n] == 0x80000000 && cpuRegs.GPR.r[_Rt_].US[0] == 0xffff) { @@ -1466,15 +1466,15 @@ void PROT3W() { //*************************MMI3 OPCODES************************ -__forceinline void _PMADDUW(int dd, int ss) -{ +__forceinline void _PMADDUW(int dd, int ss) +{ u64 tempu = (u64)((u64)cpuRegs.LO.UL[ss] | ((u64)cpuRegs.HI.UL[ss] << 32)) + \ - ((u64)cpuRegs.GPR.r[_Rs_].UL[ss] * (u64)cpuRegs.GPR.r[_Rt_].UL[ss]); + ((u64)cpuRegs.GPR.r[_Rs_].UL[ss] * (u64)cpuRegs.GPR.r[_Rt_].UL[ss]); - cpuRegs.LO.SD[dd] = (s32)(tempu & 0xffffffff); - cpuRegs.HI.SD[dd] = (s32)(tempu >> 32); + cpuRegs.LO.SD[dd] = (s32)(tempu & 0xffffffff); + cpuRegs.HI.SD[dd] = (s32)(tempu >> 32); - if (_Rd_) cpuRegs.GPR.r[_Rd_].UD[dd] = tempu; + if (_Rd_) cpuRegs.GPR.r[_Rd_].UD[dd] = tempu; } void PMADDUW() { @@ -1517,14 +1517,14 @@ void PINTEH() { cpuRegs.GPR.r[_Rd_].US[7] = Rs.US[6]; } -__forceinline void _PMULTUW(int dd, int ss) -{ - u64 tempu = (u64)cpuRegs.GPR.r[_Rs_].UL[ss] * (u64)cpuRegs.GPR.r[_Rt_].UL[ss]; +__forceinline void _PMULTUW(int dd, int ss) +{ + u64 tempu = (u64)cpuRegs.GPR.r[_Rs_].UL[ss] * (u64)cpuRegs.GPR.r[_Rt_].UL[ss]; - cpuRegs.LO.UD[dd] = (s32)(tempu & 0xffffffff); - cpuRegs.HI.UD[dd] = (s32)(tempu >> 32); + cpuRegs.LO.UD[dd] = (s32)(tempu & 0xffffffff); + cpuRegs.HI.UD[dd] = (s32)(tempu >> 32); - if (_Rd_) cpuRegs.GPR.r[_Rd_].UD[dd] = tempu; + if (_Rd_) cpuRegs.GPR.r[_Rd_].UD[dd] = tempu; } @@ -1533,11 +1533,11 @@ void PMULTUW() { _PMULTUW(1, 2); } -__forceinline void _PDIVUW(int dd, int ss) +__forceinline void _PDIVUW(int dd, int ss) { - if (cpuRegs.GPR.r[_Rt_].UL[ss] != 0) { - cpuRegs.LO.SD[dd] = (s32)(cpuRegs.GPR.r[_Rs_].UL[ss] / cpuRegs.GPR.r[_Rt_].UL[ss]); - cpuRegs.HI.SD[dd] = (s32)(cpuRegs.GPR.r[_Rs_].UL[ss] % cpuRegs.GPR.r[_Rt_].UL[ss]); + if (cpuRegs.GPR.r[_Rt_].UL[ss] != 0) { + cpuRegs.LO.SD[dd] = (s32)(cpuRegs.GPR.r[_Rs_].UL[ss] / cpuRegs.GPR.r[_Rt_].UL[ss]); + cpuRegs.HI.SD[dd] = (s32)(cpuRegs.GPR.r[_Rs_].UL[ss] % cpuRegs.GPR.r[_Rt_].UL[ss]); } else { @@ -1618,7 +1618,7 @@ void PEXCW() { cpuRegs.GPR.r[_Rd_].UL[3] = Rt.UL[3]; } -//**********************END OF MMI3 OPCODES******************** +//**********************END OF MMI3 OPCODES******************** // obs: // QFSRV not verified diff --git a/pcsx2/SaveState.cpp b/pcsx2/SaveState.cpp index a72a6c5d1d..cedd2549f5 100644 --- a/pcsx2/SaveState.cpp +++ b/pcsx2/SaveState.cpp @@ -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 ); diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index e366cba932..ec8fcb28f9 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -181,7 +181,7 @@ const wxDirName& AppConfig::FolderOptions::operator[]( FoldersEnum_t folderidx ) return const_cast( this )->operator[]( folderidx ); } -const bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const +bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const { switch( folderidx ) { @@ -387,7 +387,7 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini ) IniEntry( CurrentIso ); IniEntry( CurrentELF ); - + IniEntry( CloseGSonEsc ); IniEntry( EnableSpeedHacks ); @@ -588,4 +588,4 @@ void AppConfig_OnChangedSettingsFolder( bool overwrite ) wxConfigBase* GetAppConfig() { return wxConfigBase::Get( false ); -} \ No newline at end of file +} diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 7fb49169d1..98abd08caf 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -45,7 +45,7 @@ public: // Display position used if AutoDock is false (ignored otherwise) wxPoint DisplayPosition; wxSize DisplaySize; - + // Size of the font in points. int FontSize; @@ -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; }; // ------------------------------------------------------------------------ @@ -118,9 +118,9 @@ public: // Current language in use (correlates to a wxWidgets wxLANGUAGE specifier) wxLanguage LanguageId; - + int RecentFileCount; // number of files displayed in the Recent Isos list. - + // String value describing the desktop theme to use for pcsk2 (icons and background images) // The theme name is used to look up files in the themes folder (relative to the executable). wxString DeskTheme; @@ -138,10 +138,10 @@ public: // enables automatic ntfs compression of memory cards (Win32 only) bool McdEnableNTFS; - + // Closes the GS/Video port on escape (good for fullscreen activity) bool CloseGSonEsc; - + // Master toggle for enabling or disabling all speedhacks in one fail-free swoop. // (the toggle is applied when a new EmuConfig is sent through AppCoreThread::ApplySettings) bool EnableSpeedHacks; diff --git a/plugins/spu2-x/src/Linux/SPU2-X.cbp b/plugins/spu2-x/src/Linux/SPU2-X.cbp index 45edff99f2..fc01d3b4fb 100644 --- a/plugins/spu2-x/src/Linux/SPU2-X.cbp +++ b/plugins/spu2-x/src/Linux/SPU2-X.cbp @@ -81,14 +81,12 @@ - - @@ -105,13 +103,9 @@ - - - - @@ -125,6 +119,7 @@ +