[Glide64] Add critical section in to dlist/config

This commit is contained in:
zilmar 2016-01-25 20:33:04 +11:00
parent 76196d4d70
commit be46977de9
3 changed files with 28 additions and 12 deletions

View File

@ -49,12 +49,14 @@
#include "Config.h"
#ifdef _WIN32
#include <Common/CriticalSection.h>
#include <wx/file.h>
#include <wx/dir.h>
// begin wxGlade: ::extracode
// end wxGlade
short Set_basic_mode = 0, Set_texture_dir = 0;
extern CriticalSection * g_ProcessDListCS;
ConfigNotebook::ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long /*style*/) :
wxNotebook(parent, id, pos, size, 0)
@ -1072,6 +1074,8 @@ output: none
void CALL DllConfig(HWND hParent)
{
LOG("DllConfig ()\n");
#ifdef _WIN32
CGuard guard(*g_ProcessDListCS);
ReadSettings();
if (romopen)
@ -1089,7 +1093,6 @@ void CALL DllConfig(HWND hParent)
settings.ghq_use = 0;
}
#endif
//wxThread::Sleep(1000);
}
else
{
@ -1110,18 +1113,9 @@ void CALL DllConfig(HWND hParent)
Glide64Config->ShowModal();
delete hostWindow;
hostWindow = NULL;
#endif
}
/*#ifndef _DEBUG
//#if 1
#ifndef __GNUG__
void wxStringData::Free()
{
free(this);
}
#endif
#endif
*/
void CloseConfig()
{
if (romopen)

View File

@ -41,6 +41,7 @@
#include "Gfx_1.3.h"
#include "Version.h"
#include <Settings/Settings.h>
#include <Common/CriticalSection.h>
#include <wx/fileconf.h>
#include <wx/wfstream.h>
@ -1184,8 +1185,9 @@ int DllUnload(void)
return TRUE;
}
#ifdef __WINDOWS__
#ifdef _WIN32
void wxSetInstance(HINSTANCE hInstance);
CriticalSection * g_ProcessDListCS = NULL;
extern "C" int WINAPI DllMain(HINSTANCE hinst,
DWORD fdwReason,
@ -1197,11 +1199,19 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst,
if (fdwReason == DLL_PROCESS_ATTACH)
{
hinstDLL = hinst;
if (g_ProcessDListCS == NULL)
{
g_ProcessDListCS = new CriticalSection();
}
wxSetInstance(hinstDLL);
return DllLoad();
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
if (g_ProcessDListCS)
{
delete g_ProcessDListCS;
}
return DllUnload();
}
return TRUE;

View File

@ -49,6 +49,12 @@
#include "CRC.h"
#include <Common/StdString.h>
#ifdef _WIN32
#include <Common/CriticalSection.h>
extern CriticalSection * g_ProcessDListCS;
#endif
const int NumOfFormats = 3;
SCREEN_SHOT_FORMAT ScreenShotFormats[NumOfFormats] = { { "BMP", "bmp", wxBITMAP_TYPE_BMP }, { "PNG", "png", wxBITMAP_TYPE_PNG }, { "JPEG", "jpeg", wxBITMAP_TYPE_JPEG } };
@ -564,6 +570,9 @@ int depth_buffer_fog;
EXPORT void CALL ProcessDList(void)
{
#ifdef _WIN32
CGuard guard(*g_ProcessDListCS);
#endif
no_dlist = false;
update_screen_count = 0;
ChangeSize();
@ -4102,6 +4111,9 @@ output: none
*******************************************************************/
void CALL ProcessRDPList(void)
{
#ifdef _WIN32
CGuard guard(*g_ProcessDListCS);
#endif
LOG("ProcessRDPList ()\n");
LRDP("ProcessRDPList ()\n");