From 54f1409090519445558b77ff17e44254ac64fac9 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sun, 18 Oct 2009 17:12:02 +0000 Subject: [PATCH 01/10] Gave the frame limiter some smarts so it can sleep the EEcore a bit if there's nothing to do for a while. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2033 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Counters.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index 3524e0ba8..a4b53141b 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -322,11 +322,22 @@ static __forceinline void frameLimit() m_iStart = uExpectedEnd; - while( sDeltaTime < 0 ) + // Shortcut for cases where no waiting is needed (they're running slow already, + // so don't bog 'em down with extra math...) + if( sDeltaTime >= 0 ) return; + + // If we're way ahead then we can afford to sleep the thread a bit. + + s32 msec = (int)((sDeltaTime*-1000) / (s64)GetTickFrequency()); + if( msec > 2 ) Threading::Sleep( msec - 2 ); + + // + while( true ) { - Timeslice(); iEnd = GetCPUTicks(); sDeltaTime = iEnd - uExpectedEnd; + if( sDeltaTime >= 0 ) break; + Timeslice(); } } From 29e8fe94e9a7e72b6d1fdc2b5d5aa77f29d2ef95 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Mon, 19 Oct 2009 10:42:36 +0000 Subject: [PATCH 02/10] Change a few project options and get rid of _unused. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2036 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/build/Utilities/Utilities.cbp | 11 +++++++++++ common/build/x86emitter/x86emitter.cbp | 3 +++ common/include/Pcsx2Defs.h | 2 -- common/include/Utilities/Threading.h | 2 +- common/include/x86emitter/implement/dwshift.h | 12 ++++++------ common/include/x86emitter/implement/group2.h | 4 ++-- common/src/Utilities/ThreadTools.cpp | 2 +- pcsx2/CDVD/CDVD_internal.h | 8 ++++---- pcsx2/CDVD/CDVDaccess.cpp | 2 +- pcsx2/CDVD/CDVDisoReader.cpp | 2 +- pcsx2/Linux/pcsx2.cbp | 6 +++--- pcsx2/System.h | 2 +- pcsx2/gui/Dialogs/ImportSettingsDialog.cpp | 4 ++-- pcsx2/gui/Panels/PathsPanel.cpp | 2 +- 14 files changed, 37 insertions(+), 25 deletions(-) diff --git a/common/build/Utilities/Utilities.cbp b/common/build/Utilities/Utilities.cbp index 6b7419fa4..78afe01da 100644 --- a/common/build/Utilities/Utilities.cbp +++ b/common/build/Utilities/Utilities.cbp @@ -58,6 +58,17 @@ + + + + + + + + + + + diff --git a/common/build/x86emitter/x86emitter.cbp b/common/build/x86emitter/x86emitter.cbp index 5e4039a55..7ff25bc07 100644 --- a/common/build/x86emitter/x86emitter.cbp +++ b/common/build/x86emitter/x86emitter.cbp @@ -59,6 +59,7 @@ + @@ -67,6 +68,8 @@ + + diff --git a/common/include/Pcsx2Defs.h b/common/include/Pcsx2Defs.h index 5cd4e4686..818d1e3d4 100644 --- a/common/include/Pcsx2Defs.h +++ b/common/include/Pcsx2Defs.h @@ -189,7 +189,6 @@ # define PCSX2_ALIGNED16_EXTERN(x) extern __declspec(align(16)) x # define __naked __declspec(naked) -# define __unused /*unused*/ # define __noinline __declspec(noinline) # define __threadlocal __declspec(thread) @@ -244,7 +243,6 @@ This theoretically unoptimizes. Not having much luck so far. // happens *by design* like all the friggen time >_<) # define __fastcall __attribute__((fastcall)) -# define __unused __attribute__((unused)) # define _inline __inline__ __attribute__((unused)) # ifdef NDEBUG # define __forceinline __attribute__((always_inline,unused)) diff --git a/common/include/Utilities/Threading.h b/common/include/Utilities/Threading.h index 07a7d5717..b77cb671c 100644 --- a/common/include/Utilities/Threading.h +++ b/common/include/Utilities/Threading.h @@ -314,7 +314,7 @@ namespace Threading // Section of methods for internal use only. void _DoSetThreadName( const wxString& name ); - void _DoSetThreadName( __unused const char* name ); + void _DoSetThreadName( const char* name ); void _internal_execute(); void _try_virtual_invoke( void (PersistentThread::*method)() ); void _ThreadCleanup(); diff --git a/common/include/x86emitter/implement/dwshift.h b/common/include/x86emitter/implement/dwshift.h index 427b7c551..689b74639 100644 --- a/common/include/x86emitter/implement/dwshift.h +++ b/common/include/x86emitter/implement/dwshift.h @@ -32,17 +32,17 @@ class DwordShiftImplAll public: // ---------- 32 Bit Interface ----------- - __forceinline void operator()( const xRegister32& to, const xRegister32& from, __unused const xRegisterCL& clreg ) const { xOpWrite0F( 0xa5 | m_shiftop, to, from ); } - __forceinline void operator()( void* dest, const xRegister32& from, __unused const xRegisterCL& clreg ) const { xOpWrite0F( 0xa5 | m_shiftop, from, dest ); } - __forceinline void operator()( const ModSibBase& dest, const xRegister32& from, __unused const xRegisterCL& clreg ) const { xOpWrite0F( 0xa5 | m_shiftop, from, dest ); } + __forceinline void operator()( const xRegister32& to, const xRegister32& from, const xRegisterCL& clreg ) const { xOpWrite0F( 0xa5 | m_shiftop, to, from ); } + __forceinline void operator()( void* dest, const xRegister32& from, const xRegisterCL& clreg ) const { xOpWrite0F( 0xa5 | m_shiftop, from, dest ); } + __forceinline void operator()( const ModSibBase& dest, const xRegister32& from, const xRegisterCL& clreg ) const { xOpWrite0F( 0xa5 | m_shiftop, from, dest ); } __forceinline void operator()( const xRegister32& to, const xRegister32& from, u8 shiftcnt ) const { if( shiftcnt != 0 ) xOpWrite0F( 0xa4 | m_shiftop, to, from ); } __forceinline void operator()( void* dest, const xRegister32& from, u8 shiftcnt ) const { if( shiftcnt != 0 ) xOpWrite0F( 0xa4 | m_shiftop, from, dest, shiftcnt ); } __forceinline void operator()( const ModSibBase& dest, const xRegister32& from, u8 shiftcnt ) const { if( shiftcnt != 0 ) xOpWrite0F( 0xa4 | m_shiftop, from, dest, shiftcnt ); } // ---------- 16 Bit Interface ----------- - __forceinline void operator()( const xRegister16& to, const xRegister16& from, __unused const xRegisterCL& clreg ) const { xOpWrite0F( 0x66, 0xa5 | m_shiftop, to, from ); } - __forceinline void operator()( void* dest, const xRegister16& from, __unused const xRegisterCL& clreg ) const { xOpWrite0F( 0x66, 0xa5 | m_shiftop, from, dest ); } - __forceinline void operator()( const ModSibBase& dest, const xRegister16& from, __unused const xRegisterCL& clreg ) const { xOpWrite0F( 0x66, 0xa5 | m_shiftop, from, dest ); } + __forceinline void operator()( const xRegister16& to, const xRegister16& from, const xRegisterCL& clreg ) const { xOpWrite0F( 0x66, 0xa5 | m_shiftop, to, from ); } + __forceinline void operator()( void* dest, const xRegister16& from, const xRegisterCL& clreg ) const { xOpWrite0F( 0x66, 0xa5 | m_shiftop, from, dest ); } + __forceinline void operator()( const ModSibBase& dest, const xRegister16& from, const xRegisterCL& clreg ) const { xOpWrite0F( 0x66, 0xa5 | m_shiftop, from, dest ); } __forceinline void operator()( const xRegister16& to, const xRegister16& from, u8 shiftcnt ) const { if( shiftcnt != 0 ) xOpWrite0F( 0x66, 0xa4 | m_shiftop, to, from ); } __forceinline void operator()( void* dest, const xRegister16& from, u8 shiftcnt ) const { if( shiftcnt != 0 ) xOpWrite0F( 0x66, 0xa4 | m_shiftop, from, dest, shiftcnt ); } __forceinline void operator()( const ModSibBase& dest, const xRegister16& from, u8 shiftcnt ) const { if( shiftcnt != 0 ) xOpWrite0F( 0x66, 0xa4 | m_shiftop, from, dest, shiftcnt ); } diff --git a/common/include/x86emitter/implement/group2.h b/common/include/x86emitter/implement/group2.h index 57506a232..42c9a8c7c 100644 --- a/common/include/x86emitter/implement/group2.h +++ b/common/include/x86emitter/implement/group2.h @@ -39,14 +39,14 @@ template< G2Type InstType > class Group2ImplAll { public: - template< typename T > __forceinline void operator()( const xRegister& to, __unused const xRegisterCL& from ) const + template< typename T > __forceinline void operator()( const xRegister& to, const xRegisterCL& from ) const { prefix16(); xWrite8( Is8BitOp() ? 0xd2 : 0xd3 ); EmitSibMagic( InstType, to ); } - template< typename T > __noinline void operator()( const ModSibStrict& sibdest, __unused const xRegisterCL& from ) const + template< typename T > __noinline void operator()( const ModSibStrict& sibdest, const xRegisterCL& from ) const { prefix16(); xWrite8( Is8BitOp() ? 0xd2 : 0xd3 ); diff --git a/common/src/Utilities/ThreadTools.cpp b/common/src/Utilities/ThreadTools.cpp index 4a5e2cafb..43cdfae27 100644 --- a/common/src/Utilities/ThreadTools.cpp +++ b/common/src/Utilities/ThreadTools.cpp @@ -424,7 +424,7 @@ void Threading::PersistentThread::_DoSetThreadName( const wxString& name ) _DoSetThreadName( name.ToUTF8() ); } -void Threading::PersistentThread::_DoSetThreadName( __unused const char* name ) +void Threading::PersistentThread::_DoSetThreadName( const char* name ) { pxAssertMsg( IsSelf(), "Thread affinity error." ); // only allowed from our own thread, thanks. diff --git a/pcsx2/CDVD/CDVD_internal.h b/pcsx2/CDVD/CDVD_internal.h index f77c4c6b0..207d4a25f 100644 --- a/pcsx2/CDVD/CDVD_internal.h +++ b/pcsx2/CDVD/CDVD_internal.h @@ -129,9 +129,9 @@ static const uint PSX_DVD_READSPEED = 1382400 + 256000; // normal is 1 Byte Time static const uint Cdvd_FullSeek_Cycles = (PSXCLK*100) / 1000; // average number of cycles per fullseek (100ms) static const uint Cdvd_FastSeek_Cycles = (PSXCLK*30) / 1000; // average number of cycles per fastseek (37ms) -static const __unused char *mg_zones[8] = {"Japan", "USA", "Europe", "Oceania", "Asia", "Russia", "China", "Mexico"}; +static const char *mg_zones[8] = {"Japan", "USA", "Europe", "Oceania", "Asia", "Russia", "China", "Mexico"}; -static const __unused char *nCmdName[0x100]= { +static const char *nCmdName[0x100]= { "CdSync", "CdNop", "CdStandby", @@ -168,7 +168,7 @@ enum nCmds N_CD_CHG_SPDL_CTRL = 0x0F, // CdChgSpdlCtrl }; -static const __unused char *sCmdName[0x100]= { +static const char *sCmdName[0x100]= { "", "sceCdGetDiscType", "sceCdReadSubQ", "subcommands",//sceCdGetMecaconVersion, read/write console id, read renewal date "", "sceCdTrayState", "sceCdTrayCtrl", "", "sceCdReadClock", "sceCdWriteClock", "sceCdReadNVM", "sceCdWriteNVM", @@ -232,4 +232,4 @@ static NVMLayout nvmlayouts[NVM_FORMAT_MAX] = {0x146, 0x270, 0x2B0, 0x200, 0x1C8, 0x1E0, 0x1B0, 0x180, 0x198}, // eeproms from bios v1.70 and up }; -#endif \ No newline at end of file +#endif diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index fc3756abf..0600e7a77 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -497,7 +497,7 @@ s32 CALLBACK NODISCdummyS32() return 0; } -void CALLBACK NODISCnewDiskCB(__unused void (*callback)()) +void CALLBACK NODISCnewDiskCB( void (*callback)()) { } diff --git a/pcsx2/CDVD/CDVDisoReader.cpp b/pcsx2/CDVD/CDVDisoReader.cpp index 6510015f9..e0993443c 100644 --- a/pcsx2/CDVD/CDVDisoReader.cpp +++ b/pcsx2/CDVD/CDVDisoReader.cpp @@ -396,7 +396,7 @@ s32 CALLBACK ISOdummyS32() return 0; } -void CALLBACK ISOnewDiskCB(__unused void(*callback)()) +void CALLBACK ISOnewDiskCB( void(*callback)()) { } diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp index 75da45c50..5568c5f69 100644 --- a/pcsx2/Linux/pcsx2.cbp +++ b/pcsx2/Linux/pcsx2.cbp @@ -16,6 +16,7 @@