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

View File

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

View File

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