| 985 | } |
| 986 | |
| 987 | game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, usz recursion_count) |
| 988 | { |
| 989 | if (recursion_count == 0 && m_restrict_emu_state_change) |
| 990 | { |
| 991 | return game_boot_result::currently_restricted; |
| 992 | } |
| 993 | |
| 994 | if (recursion_count == 0 && m_state != system_state::stopped) |
| 995 | { |
| 996 | return game_boot_result::still_running; |
| 997 | } |
| 998 | |
| 999 | struct cleanup_t |
| 1000 | { |
| 1001 | Emulator* _this; |
| 1002 | usz recursion_count; |
| 1003 | |
| 1004 | ~cleanup_t() noexcept |
| 1005 | { |
| 1006 | if (recursion_count != 0) |
| 1007 | { |
| 1008 | return; |
| 1009 | } |
| 1010 | |
| 1011 | _this->m_state.compare_and_swap_test(system_state::loading, system_state::stopped); |
| 1012 | |
| 1013 | if (_this->IsStopped()) |
| 1014 | { |
| 1015 | _this->Kill(false); |
| 1016 | } |
| 1017 | } |
| 1018 | } cleanup{this, recursion_count}; |
| 1019 | |
| 1020 | ensure(recursion_count != 0 || m_state.compare_and_swap_test(system_state::stopped, system_state::loading)); |
| 1021 | |
| 1022 | const auto guard = MakeEmulationStateGuard(); |
| 1023 | |
| 1024 | // Enable logging |
| 1025 | rpcs3::utils::configure_logs(true); |
| 1026 | |
| 1027 | m_ar.reset(); |
| 1028 | |
| 1029 | { |
| 1030 | if (m_config_mode == cfg_mode::continuous) |
| 1031 | { |
| 1032 | // The program is being booted from another running program |
| 1033 | // CELL_GAME_GAMETYPE_GAMEDATA is not used as boot type |
| 1034 | |
| 1035 | if (m_cat == "DG"sv) |
| 1036 | { |
| 1037 | m_boot_source_type = CELL_GAME_GAMETYPE_DISC; |
| 1038 | } |
| 1039 | else if (m_cat == "HM"sv) |
| 1040 | { |
| 1041 | m_boot_source_type = CELL_GAME_GAMETYPE_HOME; |
| 1042 | } |
| 1043 | else |
| 1044 | { |
no test coverage detected