| 133 | /////////////////////////////////////////// |
| 134 | |
| 135 | bool systems_initialize() { |
| 136 | if (!systems_sort()) |
| 137 | return false; |
| 138 | |
| 139 | for (int32_t i = 0; i < systems.count; i++) { |
| 140 | int32_t index = system_init_order[i]; |
| 141 | if (systems[index].func_initialize != nullptr) { |
| 142 | log_diagf("Initializing %s", systems[index].name); |
| 143 | |
| 144 | // start timing |
| 145 | uint64_t start = stm_now(); |
| 146 | |
| 147 | if (!systems[index].func_initialize()) { |
| 148 | log_errf("System %s failed to initialize!", systems[index].name); |
| 149 | return false; |
| 150 | } |
| 151 | |
| 152 | // end timing |
| 153 | systems[index].profile_start_duration = stm_since(start); |
| 154 | } |
| 155 | } |
| 156 | systems_initialized = true; |
| 157 | log_info("Initialization successful"); |
| 158 | return true; |
| 159 | } |
| 160 | |
| 161 | /////////////////////////////////////////// |
| 162 | |