From c674e6330fb780df8e4e4d795085eff346ebe5f2 Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Sat, 7 Mar 2009 23:34:16 +0000 Subject: [PATCH] Allow for self shutdown from video plugins. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2611 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/Fifo.cpp | 6 ++++++ Source/Core/VideoCommon/Src/Fifo.h | 1 + Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 8a502b5ef2..2dfd7ffa2e 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -119,6 +119,12 @@ void Fifo_ExitLoop() #endif } +// May be executed from any thread, even the graphics thread. +// Created to allow for self shutdown. +void Fifo_ExitLoopNonBlocking() { + fifoStateRun = false; +} + // void Fifo_EnterLoop(const SVideoInitialize &video_initialize) { diff --git a/Source/Core/VideoCommon/Src/Fifo.h b/Source/Core/VideoCommon/Src/Fifo.h index c0148ef99c..b71e3155d6 100644 --- a/Source/Core/VideoCommon/Src/Fifo.h +++ b/Source/Core/VideoCommon/Src/Fifo.h @@ -33,6 +33,7 @@ void Fifo_Shutdown(); // These two are for dual core mode only. void Fifo_EnterLoop(const SVideoInitialize &video_initialize); void Fifo_ExitLoop(); +void Fifo_ExitLoopNonBlocking(); void Fifo_DoState(PointerWrap &f); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp index f9495cea44..4f36f675fb 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp @@ -5,6 +5,7 @@ #include "Config.h" #include "main.h" #include "EmuWindow.h" +#include "Fifo.h" namespace EmuWindow { @@ -52,6 +53,7 @@ namespace EmuWindow break; case WM_CLOSE: + Fifo_ExitLoopNonBlocking(); Shutdown(); // Simple hack to easily exit without stopping. Hope to fix the stopping errors soon. ExitProcess(0);