mirror of https://github.com/PCSX2/pcsx2.git
Fixed a foopah in r451 that caused most games to run at PAL framerates and timings. Oops, heh.
Squashed another race condition in the MTGS; this one when hitting escape to close the GS window (very rare). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@453 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
9f454da8d6
commit
27af6983c7
|
@ -234,6 +234,7 @@ void gsClose()
|
||||||
|
|
||||||
if( mtgsThread != NULL )
|
if( mtgsThread != NULL )
|
||||||
{
|
{
|
||||||
|
mtgsThread->Close();
|
||||||
safe_delete( mtgsThread );
|
safe_delete( mtgsThread );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -373,7 +374,7 @@ __forceinline void _gsSMODEwrite( u32 mem, u32 value )
|
||||||
switch (mem)
|
switch (mem)
|
||||||
{
|
{
|
||||||
case GS_SMODE1:
|
case GS_SMODE1:
|
||||||
gsSetVideoRegionType( !!(value & 0x6000) );
|
gsSetVideoRegionType( (value & 0x6000) == 0x6000 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_SMODE2:
|
case GS_SMODE2:
|
||||||
|
|
|
@ -137,6 +137,7 @@ enum GS_RINGTYPE
|
||||||
, GS_RINGTYPE_WRITECSR
|
, GS_RINGTYPE_WRITECSR
|
||||||
, GS_RINGTYPE_MODECHANGE // for issued mode changes.
|
, GS_RINGTYPE_MODECHANGE // for issued mode changes.
|
||||||
, GS_RINGTYPE_STARTTIME // special case for min==max fps frameskip settings
|
, GS_RINGTYPE_STARTTIME // special case for min==max fps frameskip settings
|
||||||
|
, GS_RINGTYPE_QUIT
|
||||||
};
|
};
|
||||||
|
|
||||||
class mtgsThreadObject : public Threading::Thread
|
class mtgsThreadObject : public Threading::Thread
|
||||||
|
@ -181,9 +182,7 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the MTGS "dummy" GIFtag info!
|
// the MTGS "dummy" GIFtag info!
|
||||||
// 16 byte alignment isn't "critical" here, so if GCC ignores the aignment directive
|
GIFPath m_path[3];
|
||||||
// it shouldn't cause any issues.
|
|
||||||
PCSX2_ALIGNED16( GIFPath m_path[3] );
|
|
||||||
|
|
||||||
// contains aligned memory allocations for gs and Ringbuffer.
|
// contains aligned memory allocations for gs and Ringbuffer.
|
||||||
SafeAlignedArray<u128,16> m_RingBuffer;
|
SafeAlignedArray<u128,16> m_RingBuffer;
|
||||||
|
@ -196,6 +195,7 @@ public:
|
||||||
mtgsThreadObject();
|
mtgsThreadObject();
|
||||||
virtual ~mtgsThreadObject();
|
virtual ~mtgsThreadObject();
|
||||||
|
|
||||||
|
void Close();
|
||||||
void Reset();
|
void Reset();
|
||||||
void GIFSoftReset( int mask );
|
void GIFSoftReset( int mask );
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ only recv2 & dataout influences padman
|
||||||
|
|
||||||
|
|
||||||
void sio2Reset() {
|
void sio2Reset() {
|
||||||
SysPrintf("Sio2 init\n");
|
DevCon::Status( "Sio2 Reset" );
|
||||||
memzero_obj(sio2);
|
memzero_obj(sio2);
|
||||||
sio2.packet.recvVal1 = 0x1D100; // Nothing is connected at start
|
sio2.packet.recvVal1 = 0x1D100; // Nothing is connected at start
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ void sio2_serialIn(u8 value){
|
||||||
sioWrite8(value);
|
sioWrite8(value);
|
||||||
|
|
||||||
if (sio2.packet.sendSize > BUFSIZE) {//asadr
|
if (sio2.packet.sendSize > BUFSIZE) {//asadr
|
||||||
SysPrintf("*PCSX2*: sendSize >= %d\n", BUFSIZE);
|
Console::Notice("*PCSX2*: sendSize >= %d", params BUFSIZE);
|
||||||
} else {
|
} else {
|
||||||
sio2.buf[sio2.packet.sendSize] = sioRead8();
|
sio2.buf[sio2.packet.sendSize] = sioRead8();
|
||||||
sio2.packet.sendSize++;
|
sio2.packet.sendSize++;
|
||||||
|
@ -199,11 +199,16 @@ u8 sio2_fifoOut(){
|
||||||
//PAD_LOG("READING %x\n",sio2.buf[sio2.recvIndex]);
|
//PAD_LOG("READING %x\n",sio2.buf[sio2.recvIndex]);
|
||||||
return sio2.buf[sio2.recvIndex++];
|
return sio2.buf[sio2.recvIndex++];
|
||||||
} else {
|
} else {
|
||||||
SysPrintf("*PCSX2*: buffer overrun\n");
|
Console::Error( "*PCSX2*: buffer overrun" );
|
||||||
}
|
}
|
||||||
return 0; // No Data
|
return 0; // No Data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveState::sio2Freeze()
|
||||||
|
{
|
||||||
|
Freeze(sio2);
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////// DMA
|
//////////////////////////////////////////// DMA
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
|
@ -264,7 +269,3 @@ void psxDMA12Interrupt()
|
||||||
psxDmaInterrupt2(5);
|
psxDmaInterrupt2(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveState::sio2Freeze() {
|
|
||||||
Freeze(sio2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -219,10 +219,14 @@ mtgsThreadObject::mtgsThreadObject() :
|
||||||
|
|
||||||
mtgsThreadObject::~mtgsThreadObject()
|
mtgsThreadObject::~mtgsThreadObject()
|
||||||
{
|
{
|
||||||
Console::WriteLn( "MTGS > Closing GS thread..." );
|
}
|
||||||
SetEvent();
|
|
||||||
|
|
||||||
// rest of the cleanup will be handled by the inherited object destructors...
|
void mtgsThreadObject::Close()
|
||||||
|
{
|
||||||
|
Console::WriteLn( "MTGS > Closing GS thread..." );
|
||||||
|
SendSimplePacket( GS_RINGTYPE_QUIT, 0, 0, 0 );
|
||||||
|
SetEvent();
|
||||||
|
pthread_join( m_thread, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
void mtgsThreadObject::Reset()
|
void mtgsThreadObject::Reset()
|
||||||
|
@ -452,10 +456,9 @@ int mtgsThreadObject::Callback()
|
||||||
PacketTagType prevCmd;
|
PacketTagType prevCmd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while( !m_sigterm )
|
while( true )
|
||||||
{
|
{
|
||||||
m_post_event.Wait();
|
m_post_event.Wait();
|
||||||
//if( m_sigterm ) break;
|
|
||||||
|
|
||||||
AtomicExchange( m_RingBufferIsBusy, 1 );
|
AtomicExchange( m_RingBufferIsBusy, 1 );
|
||||||
|
|
||||||
|
@ -592,6 +595,10 @@ int mtgsThreadObject::Callback()
|
||||||
m_iSlowStart += tag.data[0];
|
m_iSlowStart += tag.data[0];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GS_RINGTYPE_QUIT:
|
||||||
|
GSclose();
|
||||||
|
return 0;
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
default:
|
default:
|
||||||
Console::Error("GSThreadProc, bad packet (%x) at m_RingPos: %x, m_WritePos: %x", params tag.command, m_RingPos, m_WritePos);
|
Console::Error("GSThreadProc, bad packet (%x) at m_RingPos: %x, m_WritePos: %x", params tag.command, m_RingPos, m_WritePos);
|
||||||
|
@ -611,9 +618,6 @@ int mtgsThreadObject::Callback()
|
||||||
}
|
}
|
||||||
AtomicExchange( m_RingBufferIsBusy, 0 );
|
AtomicExchange( m_RingBufferIsBusy, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
GSclose();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waits for the GS to empty out the entire ring buffer contents.
|
// Waits for the GS to empty out the entire ring buffer contents.
|
||||||
|
|
|
@ -27,7 +27,6 @@ namespace Threading
|
||||||
m_thread()
|
m_thread()
|
||||||
, m_returncode( 0 )
|
, m_returncode( 0 )
|
||||||
, m_terminated( false )
|
, m_terminated( false )
|
||||||
, m_sigterm( 0 )
|
|
||||||
, m_post_event()
|
, m_post_event()
|
||||||
{
|
{
|
||||||
if( pthread_create( &m_thread, NULL, _internal_callback, this ) != 0 )
|
if( pthread_create( &m_thread, NULL, _internal_callback, this ) != 0 )
|
||||||
|
@ -41,8 +40,7 @@ namespace Threading
|
||||||
|
|
||||||
void Thread::Close()
|
void Thread::Close()
|
||||||
{
|
{
|
||||||
AtomicExchange( m_sigterm, 1 );
|
pthread_cancel( m_thread );
|
||||||
m_post_event.Post();
|
|
||||||
pthread_join( m_thread, NULL );
|
pthread_join( m_thread, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,6 @@ namespace Threading
|
||||||
pthread_t m_thread;
|
pthread_t m_thread;
|
||||||
int m_returncode; // value returned from the thread on close.
|
int m_returncode; // value returned from the thread on close.
|
||||||
bool m_terminated; // set true after the thread has been closed.
|
bool m_terminated; // set true after the thread has been closed.
|
||||||
u32 m_sigterm; // set to true(1) when the thread has been requested to exit.
|
|
||||||
Semaphore m_post_event; // general wait event that's needed by most threads.
|
Semaphore m_post_event; // general wait event that's needed by most threads.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="WIN32_PTHREADS"
|
PreprocessorDefinitions="WIN32_PTHREADS;__CLEANUP_SEH"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
ExceptionHandling="2"
|
ExceptionHandling="2"
|
||||||
SmallerTypeCheck="false"
|
SmallerTypeCheck="false"
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32_PTHREADS"
|
PreprocessorDefinitions="NDEBUG;WIN32_PTHREADS;__CLEANUP_SEH"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
ExceptionHandling="2"
|
ExceptionHandling="2"
|
||||||
SmallerTypeCheck="false"
|
SmallerTypeCheck="false"
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
Optimization="3"
|
Optimization="3"
|
||||||
EnableFiberSafeOptimizations="true"
|
EnableFiberSafeOptimizations="true"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="NDEBUG,WIN32_PTHREADS"
|
PreprocessorDefinitions="NDEBUG,WIN32_PTHREADS;__CLEANUP_SEH"
|
||||||
ExceptionHandling="2"
|
ExceptionHandling="2"
|
||||||
SmallerTypeCheck="false"
|
SmallerTypeCheck="false"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""$(InputDir)""
|
AdditionalIncludeDirectories=""$(InputDir)""
|
||||||
PreprocessorDefinitions="PTW32_STATIC_LIB;WIN32;_DEBUG;_LIB"
|
PreprocessorDefinitions="PTW32_STATIC_LIB;__CLEANUP_SEH;WIN32;_DEBUG;_LIB"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
ExceptionHandling="2"
|
ExceptionHandling="2"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
EnableFiberSafeOptimizations="true"
|
EnableFiberSafeOptimizations="true"
|
||||||
AdditionalIncludeDirectories=""$(InputDir)""
|
AdditionalIncludeDirectories=""$(InputDir)""
|
||||||
PreprocessorDefinitions="PTW32_STATIC_LIB;PTW32_BUILD_INLINED;WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="PTW32_STATIC_LIB;PTW32_BUILD_INLINED;__CLEANUP_SEH;WIN32;NDEBUG;_LIB"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
ExceptionHandling="2"
|
ExceptionHandling="2"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
|
|
Loading…
Reference in New Issue