MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / ApplyOptimizations

Method ApplyOptimizations

src/Phobos.cpp:242–296  ·  view source on GitHub ↗

Mainly used to disable hooks for optimization. Called after loading saved game and at end of scenario start after all INI data etc has been initialized. Only executed once per game session.

Source from the content-addressed store, hash-verified

240// Called after loading saved game and at end of scenario start after all INI data etc has been initialized.
241// Only executed once per game session.
242void Phobos::ApplyOptimizations()
243{
244 if (Phobos::Optimizations::Applied)
245 return;
246
247 // Disable BuildingClass_AI_Radiation
248 if (Phobos::Optimizations::DisableRadDamageOnBuildings)
249 Patch::Apply_RAW(0x43FB23, { 0x53, 0x55, 0x56, 0x8B, 0xF1 });
250
251 if (!SessionClass::IsMultiplayer())
252 {
253 // Disable Random2Class_Random_SyncLog
254 Patch::Apply_RAW(0x65C7D0, { 0xC3, 0x90, 0x90, 0x90, 0x90 });
255
256 // Disable Random2Class_RandomRanged_SyncLog
257 Patch::Apply_RAW(0x65C88A, { 0xC2, 0x08, 0x00, 0x90, 0x90 });
258
259 // Disable FacingClass_Set_SyncLog
260 Patch::Apply_RAW(0x4C9300, { 0x83, 0xEC, 0x10, 0x53, 0x56 });
261
262 // Disable InfantryClass_AssignTarget_SyncLog
263 Patch::Apply_RAW(0x51B1F0, { 0x53, 0x56, 0x8B, 0xF1, 0x57 });
264
265 // Disable BuildingClass_AssignTarget_SyncLog
266 Patch::Apply_RAW(0x443B90, { 0x56, 0x8B, 0xF1, 0x57, 0x83, 0xBE, 0xAC, 0x0, 0x0, 0x0, 0x13 });
267
268 // Disable TechnoClass_AssignTarget_SyncLog
269 Patch::Apply_RAW(0x6FCDB0, { 0x83, 0xEC, 0x0C, 0x53, 0x56 });
270
271 // Disable AircraftClass_AssignDestination_SyncLog
272 Patch::Apply_RAW(0x41AA80, { 0x53, 0x56, 0x57, 0x8B, 0x7C, 0x24, 0x10 });
273
274 // Disable BuildingClass_AssignDestination_SyncLog
275 Patch::Apply_RAW(0x455D50, { 0x56, 0x8B, 0xF1, 0x83, 0xBE, 0xAC, 0x0, 0x0, 0x0, 0x13 });
276
277 // Disable InfantryClass_AssignDestination_SyncLog
278 Patch::Apply_RAW(0x51AA40, { 0x83, 0xEC, 0x2C, 0x53, 0x55 });
279
280 // Disable UnitClass_AssignDestination_SyncLog
281 Patch::Apply_RAW(0x741970, { 0x81, 0xEC, 0x80, 0x0, 0x0, 0x0 });
282
283 // Disable AircraftClass_OverrideMission_SyncLog
284 Patch::Apply_RAW(0x41BB30, { 0x8B, 0x81, 0xAC, 0x0, 0x0, 0x0 });
285
286 // Disable FootClass_OverrideMission_SyncLog
287 Patch::Apply_RAW(0x4D8F40, { 0x8B, 0x54, 0x24, 0x4, 0x56 });
288
289 // Disable TechnoClass_OverrideMission_SyncLog
290 Patch::Apply_RAW(0x7013A0, { 0x8B, 0x54, 0x24, 0x4, 0x56 });
291
292 Phobos::Optimizations::DisableSyncLogging = true;
293 }
294
295 Phobos::Optimizations::Applied = true;
296}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected