| 1057 | }; |
| 1058 | |
| 1059 | void Core::fatal (std::string output, const char * title) |
| 1060 | { |
| 1061 | errorstate = true; |
| 1062 | std::stringstream out; |
| 1063 | out << output ; |
| 1064 | if (output[output.size() - 1] != '\n') |
| 1065 | out << '\n'; |
| 1066 | out << "DFHack will now deactivate.\n"; |
| 1067 | if(con.isInited()) |
| 1068 | { |
| 1069 | con.printerr("{}", out.str()); |
| 1070 | con.reset_color(); |
| 1071 | con.print("\n"); |
| 1072 | } |
| 1073 | fmt::print(stderr, "{}\n", out.str()); |
| 1074 | out << "Check file stderr.log for details.\n"; |
| 1075 | std::cout << "DFHack fatal error: " << out.str() << std::endl; |
| 1076 | if (!title) |
| 1077 | title = "DFHack error!"; |
| 1078 | DFSDL::DFSDL_ShowSimpleMessageBox(0x10 /* SDL_MESSAGEBOX_ERROR */, title, out.str().c_str(), nullptr); |
| 1079 | |
| 1080 | bool is_headless = bool(getenv("DFHACK_HEADLESS")); |
| 1081 | if (is_headless) |
| 1082 | { |
| 1083 | exit('f'); |
| 1084 | } |
| 1085 | } |
| 1086 | |
| 1087 | std::filesystem::path Core::getHackPath() |
| 1088 | { |