mirror of https://github.com/PCSX2/pcsx2.git
GSopen2: Detect GSRenderer changes across GSopen/GSclose calls, and preserve the GSState at the same time. Also added proper window closure code, so that STGA mode (legacy gui only) doesn't cause the GS window to be frightfully sticky. >_<
git-svn-id: http://pcsx2.googlecode.com/svn/branches/GSopen2@1864 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
788489f517
commit
851354eca3
|
@ -521,8 +521,8 @@ Global
|
|||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Devel|Win32.ActiveCfg = Devel|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Devel|Win32.Build.0 = Devel|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Devel|Win32.ActiveCfg = Release|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Devel|Win32.Build.0 = Release|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Devel|x64.ActiveCfg = Devel|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Release SSE2|Win32.ActiveCfg = Release|Win32
|
||||
{067D7863-393B-494F-B296-4A8853EB3D1D}.Release SSE2|Win32.Build.0 = Release|Win32
|
||||
|
|
|
@ -38,6 +38,7 @@ static HRESULT s_hr = E_FAIL;
|
|||
static GSRenderer* s_gs = NULL;
|
||||
static void (*s_irq)() = NULL;
|
||||
static uint8* s_basemem = NULL;
|
||||
static int s_renderer = -1;
|
||||
|
||||
EXPORT_C_(uint32) PS2EgetLibType()
|
||||
{
|
||||
|
@ -101,6 +102,7 @@ EXPORT_C GSshutdown()
|
|||
delete s_gs;
|
||||
|
||||
s_gs = NULL;
|
||||
s_renderer = -1;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
|
@ -134,6 +136,31 @@ static INT32 _GSopen(void* dsp, char* title, int renderer)
|
|||
|
||||
try
|
||||
{
|
||||
GSFreezeData tempsave = { 0, NULL };
|
||||
|
||||
if(s_gs && (s_renderer != renderer))
|
||||
{
|
||||
// This isn't a "normal" suspend resume case -- We need to swap renderers, but
|
||||
// we have to preserve the GSState at the same time, so quick-save it to the
|
||||
// tempsave, and then recover below after the new GSRenderer is in place.
|
||||
|
||||
s_gs->Freeze(&tempsave, true);
|
||||
|
||||
tempsave.data = (uint8*)_aligned_malloc( tempsave.size, 16 );
|
||||
|
||||
if(!tempsave.data)
|
||||
{
|
||||
throw std::bad_alloc("Failed allocating buffer for device-change savestate.");
|
||||
}
|
||||
|
||||
s_gs->Freeze( &tempsave, false );
|
||||
|
||||
delete s_gs;
|
||||
|
||||
s_gs = NULL;
|
||||
s_renderer = -1;
|
||||
}
|
||||
|
||||
switch(renderer)
|
||||
{
|
||||
default:
|
||||
|
@ -165,6 +192,13 @@ static INT32 _GSopen(void* dsp, char* title, int renderer)
|
|||
case 1: case 4: case 7: case 10: case 12:
|
||||
s_gs = new GSRendererSW(); break;
|
||||
}
|
||||
|
||||
s_renderer = renderer;
|
||||
}
|
||||
|
||||
if(tempsave.data)
|
||||
{
|
||||
s_gs->Defrost(&tempsave);
|
||||
}
|
||||
}
|
||||
catch( std::exception& ex )
|
||||
|
@ -344,7 +378,14 @@ EXPORT_C_(int) GSfreeze(int mode, GSFreezeData* data)
|
|||
|
||||
EXPORT_C GSconfigure()
|
||||
{
|
||||
GSSettingsDlg().DoModal();
|
||||
if( GSSettingsDlg().DoModal() == IDOK )
|
||||
{
|
||||
if( s_gs != NULL && s_gs->m_wnd.IsManaged() )
|
||||
{
|
||||
// Legacy apps like gsdxgui expect this...
|
||||
GSshutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(INT32) GStest()
|
||||
|
|
|
@ -250,8 +250,8 @@ public:
|
|||
virtual void SetGameCRC(uint32 crc, int options);
|
||||
void SetFrameSkip(int skip);
|
||||
void SetFrameLimit(bool limit);
|
||||
void SetRegsMem( uint8* basemem );
|
||||
void SetRegsMem(uint8* basemem);
|
||||
void SetIrqCallback(void (*irq)());
|
||||
void SetMultithreaded( bool isMT=true );
|
||||
void SetMultithreaded(bool isMT=true);
|
||||
};
|
||||
|
||||
|
|
|
@ -68,6 +68,9 @@ LRESULT GSWnd::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
// DestroyWindow(m_hWnd);
|
||||
return 0;
|
||||
case WM_DESTROY:
|
||||
// This kills the emulator when GS is closed, which *really* isn't desired behavior,
|
||||
// especially in STGS mode (worked in MTGS mode since it only quit the thread, but even
|
||||
// that wasn't needed).
|
||||
//PostQuitMessage(0);
|
||||
return 0;
|
||||
default:
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
bool Create(const string& title, int w, int h);
|
||||
bool Attach(HWND hWnd, bool isManaged=true);
|
||||
void Detach();
|
||||
bool IsManaged() const { return m_IsManaged; }
|
||||
|
||||
void* GetHandle() {return m_hWnd;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue