| 412 | } |
| 413 | |
| 414 | void Emulator::Init() |
| 415 | { |
| 416 | // Log LLVM version |
| 417 | if (static bool logged_llvm = false; !logged_llvm) |
| 418 | { |
| 419 | #ifndef LLVM_AVAILABLE |
| 420 | sys_log.always()("LLVM version: Compiled without LLVM"); |
| 421 | #elif defined(LLVM_VERSION_STRING) |
| 422 | sys_log.always()("LLVM version: %s", LLVM_VERSION_STRING); |
| 423 | #else |
| 424 | sys_log.always()("LLVM version: Unknown"); |
| 425 | #endif |
| 426 | logged_llvm = true; |
| 427 | } |
| 428 | |
| 429 | jit_runtime::initialize(); |
| 430 | |
| 431 | const std::string emu_dir = rpcs3::utils::get_emu_dir(); |
| 432 | auto make_path_verbose = [&](const std::string& path, bool must_exist_outside_emu_dir) |
| 433 | { |
| 434 | if (fs::is_dir(path)) |
| 435 | { |
| 436 | return true; |
| 437 | } |
| 438 | |
| 439 | if (must_exist_outside_emu_dir) |
| 440 | { |
| 441 | const std::string parent = fs::get_parent_dir(path); |
| 442 | const std::string emu_dir_no_delim = emu_dir.substr(0, emu_dir.find_last_not_of(fs::delim) + 1); |
| 443 | |
| 444 | if (parent != emu_dir_no_delim && GetCallbacks().resolve_path(parent) != GetCallbacks().resolve_path(emu_dir_no_delim)) |
| 445 | { |
| 446 | sys_log.fatal("Cannot use '%s' for Virtual File System because it does not exist.\nPlease specify an existing and writable directory path in Toolbar -> Manage -> Virtual File System.", path); |
| 447 | return false; |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | if (!fs::create_path(path)) |
| 452 | { |
| 453 | sys_log.fatal("Failed to create path: %s (%s)", path, fs::g_tls_error); |
| 454 | return false; |
| 455 | } |
| 456 | |
| 457 | return true; |
| 458 | }; |
| 459 | |
| 460 | if (!g_tty) |
| 461 | { |
| 462 | make_path_verbose(fs::get_log_dir(), true); |
| 463 | |
| 464 | const auto tty_path = fs::get_log_dir() + "TTY.log"; |
| 465 | g_tty.open(tty_path, fs::rewrite + fs::append); |
| 466 | |
| 467 | if (!g_tty) |
| 468 | { |
| 469 | sys_log.fatal("Failed to create TTY log: %s (%s)", tty_path, fs::g_tls_error); |
| 470 | } |
| 471 | } |
no test coverage detected