/[pcsx2_0.9.7]/trunk/pcsx2/System/SysCoreThread.cpp
ViewVC logotype

Diff of /trunk/pcsx2/System/SysCoreThread.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 31 by william, Tue Sep 7 03:24:11 2010 UTC revision 62 by william, Tue Sep 7 11:08:22 2010 UTC
# Line 16  Line 16 
16  #include "PrecompiledHeader.h"  #include "PrecompiledHeader.h"
17  #include "Common.h"  #include "Common.h"
18    
19    #include "IopBios.h"
20    
21  #include "Counters.h"  #include "Counters.h"
22  #include "GS.h"  #include "GS.h"
23  #include "Elfheader.h"  #include "Elfheader.h"
# Line 104  void SysCoreThread::SetElfOverride( cons Line 106  void SysCoreThread::SetElfOverride( cons
106  {  {
107          //pxAssertDev( !m_hasValidMachine, "Thread synchronization error while assigning ELF override." );          //pxAssertDev( !m_hasValidMachine, "Thread synchronization error while assigning ELF override." );
108          m_elf_override = elf;          m_elf_override = elf;
109    
110    
111            Hle_SetElfPath(elf.ToUTF8());
112  }  }
113    
114  void SysCoreThread::Reset()  void SysCoreThread::Reset()
# Line 151  bool SysCoreThread::HasPendingStateChang Line 156  bool SysCoreThread::HasPendingStateChang
156    
157  void SysCoreThread::_reset_stuff_as_needed()  void SysCoreThread::_reset_stuff_as_needed()
158  {  {
159            // Note that resetting recompilers along with the virtual machine is only really needed
160            // because of changes to the TLB.  We don't actually support the TLB, however, so rec
161            // resets aren't in fact *needed* ... yet.  But might as well, no harm.  --air
162    
163          if( m_resetVirtualMachine || m_resetRecompilers || m_resetProfilers )          if( m_resetVirtualMachine || m_resetRecompilers || m_resetProfilers )
164          {          {
165                  SysClearExecutionCache();                  SysClearExecutionCache();
166                  memBindConditionalHandlers();                  memBindConditionalHandlers();
167                    SetCPUState( EmuConfig.Cpu.sseMXCSR, EmuConfig.Cpu.sseVUMXCSR );
168    
169                  m_resetRecompilers              = false;                  m_resetRecompilers              = false;
170                  m_resetProfilers                = false;                  m_resetProfilers                = false;
171          }          }
# Line 162  void SysCoreThread::_reset_stuff_as_need Line 173  void SysCoreThread::_reset_stuff_as_need
173          if( m_resetVirtualMachine )          if( m_resetVirtualMachine )
174          {          {
175                  DoCpuReset();                  DoCpuReset();
176    
177                  m_resetVirtualMachine   = false;                  m_resetVirtualMachine   = false;
178                  m_resetRecompilers              = true;                  m_resetVsyncTimers              = false;
179          }          }
180    
181          if( m_resetVsyncTimers )          if( m_resetVsyncTimers )
182          {          {
183                  UpdateVSyncRate();                  UpdateVSyncRate();
184                  frameLimitReset();                  frameLimitReset();
185    
186                  m_resetVsyncTimers              = false;                  m_resetVsyncTimers              = false;
187          }          }
   
         SetCPUState( EmuConfig.Cpu.sseMXCSR, EmuConfig.Cpu.sseVUMXCSR );  
188  }  }
189    
190  void SysCoreThread::DoCpuReset()  void SysCoreThread::DoCpuReset()
# Line 182  void SysCoreThread::DoCpuReset() Line 193  void SysCoreThread::DoCpuReset()
193          cpuReset();          cpuReset();
194  }  }
195    
 void SysCoreThread::PostVsyncToUI()  
 {  
 }  
   
196  // This is called from the PS2 VM at the start of every vsync (either 59.94 or 50 hz by PS2  // This is called from the PS2 VM at the start of every vsync (either 59.94 or 50 hz by PS2
197  // clock scale, which does not correlate to the actual host machine vsync).  // clock scale, which does not correlate to the actual host machine vsync).
198  //  //
# Line 197  void SysCoreThread::PostVsyncToUI() Line 204  void SysCoreThread::PostVsyncToUI()
204  //  //
205  void SysCoreThread::VsyncInThread()  void SysCoreThread::VsyncInThread()
206  {  {
         PostVsyncToUI();  
207          if (EmuConfig.EnablePatches) ApplyPatch();          if (EmuConfig.EnablePatches) ApplyPatch();
208          if (EmuConfig.EnableCheats)  ApplyCheat();          if (EmuConfig.EnableCheats)  ApplyCheat();
209  }  }
210    
211  void SysCoreThread::StateCheckInThread()  void SysCoreThread::GameStartingInThread()
212  {  {
213          GetMTGS().RethrowException();          GetMTGS().SendGameCRC(ElfCRC);
214          _parent::StateCheckInThread();  
215            if (EmuConfig.EnablePatches) ApplyPatch(0);
216            if (EmuConfig.EnableCheats)  ApplyCheat(0);
217    }
218    
219          _reset_stuff_as_needed();               // kinda redundant but could catch unexpected threaded state changes...  bool SysCoreThread::StateCheckInThread()
220    {
221            GetMTGS().RethrowException();
222            return _parent::StateCheckInThread() && (_reset_stuff_as_needed(), true);
223  }  }
224    
225  // Runs CPU cycles indefinitely, until the user or another thread requests execution to break.  // Runs CPU cycles indefinitely, until the user or another thread requests execution to break.
# Line 248  void SysCoreThread::OnResumeInThread( bo Line 260  void SysCoreThread::OnResumeInThread( bo
260  // Invoked by the pthread_exit or pthread_cancel.  // Invoked by the pthread_exit or pthread_cancel.
261  void SysCoreThread::OnCleanupInThread()  void SysCoreThread::OnCleanupInThread()
262  {  {
263          m_hasActiveMachine = false;          m_ExecMode                              = ExecMode_Closing;
264    
265            m_hasActiveMachine              = false;
266            m_resetVirtualMachine   = true;
267    
268          GetCorePlugins().Close();          GetCorePlugins().Close();
269          GetCorePlugins().Shutdown();          GetCorePlugins().Shutdown();
# Line 256  void SysCoreThread::OnCleanupInThread() Line 271  void SysCoreThread::OnCleanupInThread()
271          _mm_setcsr( m_mxcsr_saved.bitmask );          _mm_setcsr( m_mxcsr_saved.bitmask );
272          Threading::DisableHiresScheduler();          Threading::DisableHiresScheduler();
273          _parent::OnCleanupInThread();          _parent::OnCleanupInThread();
274    
275            m_ExecMode                              = ExecMode_NoThreadYet;
276  }  }
277    

Legend:
Removed from v.31  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.22