PadSimple: Added rerecording option in that the input saving counter it saved with the save state and rewinded when a saved state is loaded

Core: Tried to a address a semi-frequent hanging that would occur in single core mode and render to main frame

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2191 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-09 23:12:15 +00:00
parent ec71298b06
commit 72424eeadc
8 changed files with 173 additions and 98 deletions

View File

@ -45,7 +45,10 @@ struct LinkedListItem : public T
class PointerWrap
{
public:
enum Mode // also defined in pluginspecs.h. Didn't want to couple them.
/* READ is when we read from the save state file, WRITE is when we write to the
save state file. This enumareted list is also defined in pluginspecs.h. Didn't
want to couple them. */
enum Mode
{
MODE_READ = 1,
MODE_WRITE,

View File

@ -437,15 +437,30 @@ THREAD_RETURN EmuThread(void *pArg)
Plugins.GetVideo()->Video_EnterLoop();
}
// Wait for CPU thread to exit - it should have been signaled to do so by now
if (cpuThread)
cpuThread->WaitForDeath();
if (g_pUpdateFPSDisplay != NULL)
g_pUpdateFPSDisplay("Stopping...");
// We have now exited the Video Loop and will shut down
/* Check if we are using single core and are rendering to the main window. In that case we must avoid the WaitForSingleObject()
loop in the cpu thread thread, because it will hang on occation, perhaps one time in three or so. I had this problem in the Wiimote plugin, what happened was that if I entered the
WaitForSingleObject loop or any loop at all in the main thread, the separate thread would halt at a place where it called a function in
the wxDialog class. The solution was to wait for the thread to stop with a timer from the wxDialog, and the proceed to shutdown.
Perhaps something like that can be done here to? I just don't exactly how since in single core mode there should only be one
thread right? So how can WaitForSingleObject() hang in it? */
bool bRenderToMainSingleCore = false;
if (GetParent((HWND)g_pWindowHandle) == NULL || _CoreParameter.bUseDualCore) bRenderToMainSingleCore = true;
/* Wait for CPU thread to exit - it should have been signaled to do so by now. On the other hand this will be called by
delete cpuThread to. So now we call it twice right? */
if(!bRenderToMainSingleCore) if (cpuThread) cpuThread->WaitForDeath();
// Write message
if (g_pUpdateFPSDisplay != NULL) g_pUpdateFPSDisplay("Stopping...");
if (cpuThread)
{
delete cpuThread; // This joins the cpu thread.
// This joins the cpu thread.
if(!bRenderToMainSingleCore) delete cpuThread;
// Returns after game exited
cpuThread = NULL;
}

View File

@ -72,6 +72,7 @@ void DoState(PointerWrap &p)
CPluginManager &pm = CPluginManager::GetInstance();
pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode());
pm.GetDSP()->DoState(p.GetPPtr(), p.GetMode());
pm.GetPad(0)->DoState(p.GetPPtr(), p.GetMode());
PowerPC::DoState(p);
HW::DoState(p);
CoreTiming::DoState(p);