| 1068 | } |
| 1069 | |
| 1070 | game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, usz recursion_count) |
| 1071 | { |
| 1072 | if (recursion_count == 0 && m_restrict_emu_state_change) |
| 1073 | { |
| 1074 | return game_boot_result::currently_restricted; |
| 1075 | } |
| 1076 | |
| 1077 | if (recursion_count == 0 && m_state != system_state::stopped) |
| 1078 | { |
| 1079 | return game_boot_result::still_running; |
| 1080 | } |
| 1081 | |
| 1082 | struct cleanup_t |
| 1083 | { |
| 1084 | Emulator* _this; |
| 1085 | usz recursion_count; |
| 1086 | |
| 1087 | ~cleanup_t() noexcept |
| 1088 | { |
| 1089 | if (recursion_count != 0) |
| 1090 | { |
| 1091 | return; |
| 1092 | } |
| 1093 | |
| 1094 | _this->m_state.compare_and_swap_test(system_state::loading, system_state::stopped); |
| 1095 | |
| 1096 | if (_this->IsStopped()) |
| 1097 | { |
| 1098 | _this->Kill(false); |
| 1099 | } |
| 1100 | } |
| 1101 | } cleanup{this, recursion_count}; |
| 1102 | |
| 1103 | ensure(recursion_count != 0 || m_state.compare_and_swap_test(system_state::stopped, system_state::loading)); |
| 1104 | |
| 1105 | const auto guard = MakeEmulationStateGuard(); |
| 1106 | |
| 1107 | // Enable logging |
| 1108 | rpcs3::utils::configure_logs(true); |
| 1109 | |
| 1110 | m_ar.reset(); |
| 1111 | |
| 1112 | { |
| 1113 | if (m_config_mode == cfg_mode::continuous) |
| 1114 | { |
| 1115 | // The program is being booted from another running program |
| 1116 | // CELL_GAME_GAMETYPE_GAMEDATA is not used as boot type |
| 1117 | |
| 1118 | if (m_cat == "DG"sv) |
| 1119 | { |
| 1120 | m_boot_source_type = CELL_GAME_GAMETYPE_DISC; |
| 1121 | } |
| 1122 | else if (m_cat == "HM"sv) |
| 1123 | { |
| 1124 | m_boot_source_type = CELL_GAME_GAMETYPE_HOME; |
| 1125 | } |
| 1126 | else |
| 1127 | { |
no test coverage detected