| 269 | } |
| 270 | |
| 271 | void Output::ErrorStr(std::string const& err) { |
| 272 | WriteLog(LogLevel::Error, err); |
| 273 | std::string error = "Error:\n" + err + "\n\nEasyRPG Player will close now."; |
| 274 | |
| 275 | static bool recursive_call = false; |
| 276 | if (!recursive_call && DisplayUi) { |
| 277 | recursive_call = true; |
| 278 | // Try platform handler first, then global one |
| 279 | if (!DisplayUi->HandleErrorOutput(error)) { |
| 280 | HandleErrorOutput(error); |
| 281 | } |
| 282 | DisplayUi.reset(); |
| 283 | } else { |
| 284 | // Fallback to Console if the display is not ready yet |
| 285 | std::cout << error << std::endl; |
| 286 | #if defined (PLAYER_NINTENDO) || defined(__vita__) |
| 287 | // stdin is non-blocking |
| 288 | Game_Clock::SleepFor(5s); |
| 289 | #elif defined (EMSCRIPTEN) |
| 290 | // Don't show JavaScript Window.prompt from stdin call |
| 291 | std::cout << " Process finished."; |
| 292 | #else |
| 293 | std::cout << " Press any key..." << std::endl; |
| 294 | std::cin.get(); |
| 295 | #endif |
| 296 | } |
| 297 | |
| 298 | Player::exit_code = EXIT_FAILURE; |
| 299 | |
| 300 | // FIXME: No idea how to indicate error from core in libretro |
| 301 | exit(Player::exit_code); |
| 302 | } |
| 303 | |
| 304 | void Output::WarningStr(std::string const& warn) { |
| 305 | if (log_level < LogLevel::Warning) { |
nothing calls this directly
no test coverage detected