Move the dx11 check to GSInit, didn't like it only getting called on renderer changes in the middle of emulation.

PCSX2:
Report the savestate version as hex if loading an incompatible state. Looks better than -19793434481 :p

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3579 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-07-28 19:00:42 +00:00
parent 275bd2f629
commit 17465d1302
3 changed files with 7 additions and 6 deletions

View File

@ -51,14 +51,14 @@ static void SaveStateFile_ReadHeader( IStreamReader& thr )
// was removed entirely. // was removed entirely.
if( savever > g_SaveVersion ) if( savever > g_SaveVersion )
throw Exception::SaveStateLoadError( thr.GetStreamName() ) throw Exception::SaveStateLoadError( thr.GetStreamName() )
.SetDiagMsg(wxsFormat( L"Savestate uses an unsupported or unknown savestate version.\n(PCSX2 ver=%d, state ver=%d)", g_SaveVersion, savever )) .SetDiagMsg(wxsFormat( L"Savestate uses an unsupported or unknown savestate version.\n(PCSX2 ver=%x, state ver=%x)", g_SaveVersion, savever ))
.SetUserMsg(_("Cannot load this savestate. The state is from an incompatible edition of PCSX2 that is either newer than this version, or is no longer supported.")); .SetUserMsg(_("Cannot load this savestate. The state is from an incompatible edition of PCSX2 that is either newer than this version, or is no longer supported."));
// check for a "minor" version incompatibility; which happens if the savestate being loaded is a newer version // check for a "minor" version incompatibility; which happens if the savestate being loaded is a newer version
// than the emulator recognizes. 99% chance that trying to load it will just corrupt emulation or crash. // than the emulator recognizes. 99% chance that trying to load it will just corrupt emulation or crash.
if( (savever >> 16) != (g_SaveVersion >> 16) ) if( (savever >> 16) != (g_SaveVersion >> 16) )
throw Exception::SaveStateLoadError( thr.GetStreamName() ) throw Exception::SaveStateLoadError( thr.GetStreamName() )
.SetDiagMsg(wxsFormat( L"Savestate uses an unknown (future?!) savestate version.\n(PCSX2 ver=%d, state ver=%d)", g_SaveVersion, savever )) .SetDiagMsg(wxsFormat( L"Savestate uses an unknown (future?!) savestate version.\n(PCSX2 ver=%x, state ver=%x)", g_SaveVersion, savever ))
.SetUserMsg(_("Cannot load this savestate. The state is an unsupported version, likely created by a newer edition of PCSX2.")); .SetUserMsg(_("Cannot load this savestate. The state is an unsupported version, likely created by a newer edition of PCSX2."));
}; };

View File

@ -42,6 +42,7 @@ static bool s_vsync = false;
static bool s_exclusive = true; static bool s_exclusive = true;
static bool s_IsGsOpen2 = false; // boolean to remove some stuff from the config panel in new PCSX2's/ static bool s_IsGsOpen2 = false; // boolean to remove some stuff from the config panel in new PCSX2's/
static bool isdx11avail = false; // set on GSinit
EXPORT_C_(uint32) PS2EgetLibType() EXPORT_C_(uint32) PS2EgetLibType()
{ {
@ -107,6 +108,8 @@ EXPORT_C_(INT32) GSinit()
return -1; return -1;
} }
isdx11avail = GSUtil::IsDirect3D11Available();
#endif #endif
return 0; return 0;
@ -250,7 +253,6 @@ EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags )
int renderer = theApp.GetConfig("renderer", 0); int renderer = theApp.GetConfig("renderer", 0);
if( flags & 4 ) if( flags & 4 )
{ {
static bool isdx11avail = GSUtil::IsDirect3D11Available();
if (isdx11avail) renderer = 4; //dx11 sw if (isdx11avail) renderer = 4; //dx11 sw
else renderer = 1; //dx9 sw else renderer = 1; //dx9 sw
} }
@ -271,7 +273,6 @@ EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
if(mt == 2) if(mt == 2)
{ {
// pcsx2 sent a switch renderer request // pcsx2 sent a switch renderer request
static bool isdx11avail = GSUtil::IsDirect3D11Available();
if (isdx11avail) renderer = 4; //dx11 sw if (isdx11avail) renderer = 4; //dx11 sw
else renderer = 1; //dx9 sw else renderer = 1; //dx9 sw
mt = 1; mt = 1;

View File

@ -107,7 +107,7 @@ void GSSettingsDlg::OnInit()
} }
} }
bool isdx11avail = GSUtil::IsDirect3D11Available(); bool isdx11avail_config = GSUtil::IsDirect3D11Available();
vector<GSSetting> renderers; vector<GSSetting> renderers;
@ -115,7 +115,7 @@ void GSSettingsDlg::OnInit()
{ {
if(i >= 3 && i <= 5) if(i >= 3 && i <= 5)
{ {
if(!isdx11avail) continue; if(!isdx11avail_config) continue;
g_renderers[i].name = std::string("Direct3D") + (GSUtil::HasD3D11Features() ? "11" : "10"); g_renderers[i].name = std::string("Direct3D") + (GSUtil::HasD3D11Features() ? "11" : "10");
} }