Fixed a crash in the gui when opening an xbe fails
This commit is contained in:
parent
a650fd2078
commit
0717c0166b
|
@ -46,7 +46,7 @@ extern "C" void CxbxKrnlPrintUEM(ULONG);
|
|||
#endif
|
||||
|
||||
// construct via Xbe file
|
||||
Xbe::Xbe(const char *x_szFilename, bool bFromGUI)
|
||||
Xbe::Xbe(const char *x_szFilename)
|
||||
{
|
||||
char szBuffer[MAX_PATH];
|
||||
|
||||
|
@ -64,13 +64,14 @@ Xbe::Xbe(const char *x_szFilename, bool bFromGUI)
|
|||
// NOTE: the check for the existence of the child window is necessary because the user could have previously loaded the dashboard,
|
||||
// removed/changed the path and attempt to load it again from the recent list, which will crash CxbxInitWindow below
|
||||
// Note that GetHwnd(), CxbxKrnl_hEmuParent and HalReturnToFirmware are all not suitable here for various reasons
|
||||
if (XbeName.compare(std::string("xboxdash.xbe")) == 0
|
||||
#ifdef CXBXR_EMU
|
||||
&& !bFromGUI
|
||||
) {
|
||||
if (XbeName.compare(std::string("xboxdash.xbe")) == 0) {
|
||||
// The dashboard could not be found on partition2. This is a fatal error on the Xbox so we display the UEM. The
|
||||
// error code is different if we have a launch data page
|
||||
|
||||
// This is necessary because CxbxInitWindow internally calls g_AffinityPolicy->SetAffinityOther. If we are launched directly from the command line and the dashboard
|
||||
// cannot be opened, we will crash below because g_AffinityPolicy will be empty
|
||||
g_AffinityPolicy = AffinityPolicy::InitPolicy();
|
||||
CxbxInitWindow(false);
|
||||
|
||||
ULONG FatalErrorCode = FATAL_ERROR_XBE_DASH_GENERIC;
|
||||
|
@ -86,13 +87,13 @@ Xbe::Xbe(const char *x_szFilename, bool bFromGUI)
|
|||
// TODO: FATAL_ERROR_XBE_DASH_X2_PASS (requires DVD drive authentication emulation...)
|
||||
}
|
||||
else {
|
||||
#else
|
||||
) {
|
||||
#endif
|
||||
// Report which xbe could not be found
|
||||
SetFatalError(std::string("Could not open the Xbe file ") + XbeName);
|
||||
return;
|
||||
#ifdef CXBXR_EMU
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
printf("OK\n");
|
||||
|
|
|
@ -50,7 +50,7 @@ class Xbe : public Error
|
|||
{
|
||||
public:
|
||||
// construct via Xbe file
|
||||
Xbe(const char *x_szFilename, bool bFromGUI);
|
||||
Xbe(const char *x_szFilename);
|
||||
|
||||
// deconstructor
|
||||
~Xbe();
|
||||
|
|
|
@ -640,7 +640,7 @@ static bool CxbxrKrnlXbeSystemSelector(int BootFlags, unsigned& reserved_systems
|
|||
}
|
||||
#endif // Chihiro wip block
|
||||
|
||||
CxbxKrnl_Xbe = new Xbe(xbePath.c_str(), false); // TODO : Instead of using the Xbe class, port Dxbx _ReadXbeBlock()
|
||||
CxbxKrnl_Xbe = new Xbe(xbePath.c_str()); // TODO : Instead of using the Xbe class, port Dxbx _ReadXbeBlock()
|
||||
|
||||
if (CxbxKrnl_Xbe->HasFatalError()) {
|
||||
CxbxrAbort(CxbxKrnl_Xbe->GetError().c_str());
|
||||
|
|
|
@ -1934,7 +1934,7 @@ void WndMain::OpenXbe(const char *x_filename)
|
|||
|
||||
strcpy(m_XbeFilename, x_filename);
|
||||
|
||||
m_Xbe = new Xbe(m_XbeFilename, true);
|
||||
m_Xbe = new Xbe(m_XbeFilename);
|
||||
|
||||
if(m_Xbe->HasError())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue