cleanup of show message code for headless mode
This commit is contained in:
parent
8bbcdfbdb3
commit
957fe2d09b
|
@ -548,7 +548,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
|||
mainProgram->showMessage(msg.c_str());
|
||||
}
|
||||
|
||||
message(msg.c_str());
|
||||
message(msg.c_str(),GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -564,7 +564,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
|||
mainProgram->showMessage(msg.c_str());
|
||||
}
|
||||
|
||||
message(msg.c_str());
|
||||
message(msg.c_str(),GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||
}
|
||||
|
||||
void ExceptionHandler::logError(const char *msg, bool confirmToConsole) {
|
||||
|
@ -733,7 +733,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
|||
#endif
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
message(err);
|
||||
message(err,GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -789,7 +789,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
|||
}
|
||||
else {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp);
|
||||
message(msg);
|
||||
message(msg,GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp);
|
||||
|
@ -5434,7 +5434,7 @@ int glestMain(int argc, char** argv) {
|
|||
if(program != NULL &&
|
||||
program->getTryingRendererInit() == true &&
|
||||
program->getRendererInitOk() == false) {
|
||||
message(e.what());
|
||||
message(e.what(),GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5586,7 +5586,7 @@ static bool MinidumpCallback(const google_breakpad::MinidumpDescriptor& descript
|
|||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"An unhandled error was detected.\n\nA crash dump file has been created in the folder:\n%s\nCrash dump filename is: %s",descriptor.directory().c_str(),descriptor.path());
|
||||
//MessageBox(NULL, szBuf, "Unhandled error", MB_OK|MB_SYSTEMMODAL);
|
||||
message(szBuf);
|
||||
message(szBuf,GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||
}
|
||||
|
||||
return succeeded;
|
||||
|
|
|
@ -59,8 +59,7 @@ public:
|
|||
// =====================================================
|
||||
// Misc
|
||||
// =====================================================
|
||||
void message(string message);
|
||||
bool ask(string message);
|
||||
void message(string message,bool isNonGraphicalModeEnabled);
|
||||
void exceptionMessage(const exception &excp);
|
||||
|
||||
string getCommandLine();
|
||||
|
|
|
@ -78,24 +78,17 @@ bool showMessage(const std::string & warning) {
|
|||
return guiMessage;
|
||||
}
|
||||
|
||||
void message(string message) {
|
||||
showMessage(message);
|
||||
|
||||
void message(string message, bool isNonGraphicalModeEnabled) {
|
||||
std::cerr << "******************************************************\n";
|
||||
std::cerr << " " << message << "\n";
|
||||
std::cerr << "******************************************************\n";
|
||||
}
|
||||
|
||||
bool ask(string message) {
|
||||
std::cerr << "Confirmation: " << message << "\n";
|
||||
int res;
|
||||
std::cin >> res;
|
||||
return res != 0;
|
||||
if(isNonGraphicalModeEnabled == false) {
|
||||
showMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
void exceptionMessage(const exception &excp) {
|
||||
//showMessage(excp.what());
|
||||
|
||||
std::cerr << "Exception: " << excp.what() << std::endl;
|
||||
}
|
||||
|
||||
|
|
|
@ -325,21 +325,16 @@ megaglest_runtime_error::megaglest_runtime_error(const string& __arg,bool noStac
|
|||
// assert(dispChangeErr==DISP_CHANGE_SUCCESSFUL);
|
||||
//}
|
||||
|
||||
void message(string message){
|
||||
void message(string message, bool isNonGraphicalModeEnabled) {
|
||||
std::cerr << "******************************************************\n";
|
||||
std::cerr << " " << message << "\n";
|
||||
std::cerr << "******************************************************\n";
|
||||
|
||||
if(isNonGraphicalModeEnabled == false) {
|
||||
LPWSTR wstr = Ansi2WideString(message.c_str());
|
||||
MessageBox(NULL, wstr, L"Message", MB_OK | MB_SYSTEMMODAL);
|
||||
if(wstr) delete [] wstr;
|
||||
}
|
||||
|
||||
bool ask(string message){
|
||||
LPWSTR wstr = Ansi2WideString(message.c_str());
|
||||
bool result = MessageBox(NULL, wstr, L"Confirmation", MB_YESNO | MB_SYSTEMMODAL) == IDYES;
|
||||
if(wstr) delete [] wstr;
|
||||
return result;
|
||||
}
|
||||
|
||||
void exceptionMessage(const exception &excp){
|
||||
|
|
Loading…
Reference in New Issue
Block a user