diff --git a/lcs/generated/generated_unit_0164.cpp b/lcs/generated/generated_unit_0164.cpp index 55a0ecd..ff33559 100644 --- a/lcs/generated/generated_unit_0164.cpp +++ b/lcs/generated/generated_unit_0164.cpp @@ -10028,10 +10028,11 @@ L_08A97F70: } L_08A97F78: { - lcs::lcs_note_vehicle_control_read(); + const bool driving = lcs::lcs_guest_player_in_vehicle(aot_mem); + if (driving) lcs::lcs_note_vehicle_control_read(); std::int16_t brake = static_cast( - aot_mem.aot_load16(ctx.gpr[4] + lcs::lcs_brake_pad_offset())); - if (brake == 0 && lcs::lcs_host_brake()) brake = 255; + aot_mem.aot_load16(ctx.gpr[4] + (driving ? lcs::lcs_brake_pad_offset() : 38u))); + if (driving && brake == 0 && lcs::lcs_host_brake()) brake = 255; ctx.gpr[2] = (static_cast(static_cast(brake))); } goto L_08A97F7C; diff --git a/lcs/generated/generated_unit_0165.cpp b/lcs/generated/generated_unit_0165.cpp index bb6faff..f79160f 100644 --- a/lcs/generated/generated_unit_0165.cpp +++ b/lcs/generated/generated_unit_0165.cpp @@ -1379,10 +1379,11 @@ L_08A980E8: } L_08A980F0: { - lcs::lcs_note_vehicle_control_read(); + const bool driving = lcs::lcs_guest_player_in_vehicle(aot_mem); + if (driving) lcs::lcs_note_vehicle_control_read(); std::int16_t accelerate = static_cast( - aot_mem.aot_load16(ctx.gpr[4] + lcs::lcs_accelerate_pad_offset())); - if (accelerate == 0 && lcs::lcs_host_accelerate()) accelerate = 255; + aot_mem.aot_load16(ctx.gpr[4] + (driving ? lcs::lcs_accelerate_pad_offset() : 42u))); + if (driving && accelerate == 0 && lcs::lcs_host_accelerate()) accelerate = 255; ctx.gpr[2] = (static_cast(static_cast(accelerate))); } goto L_08A980F4; diff --git a/lcs/host/lcs_controls.hpp b/lcs/host/lcs_controls.hpp index 91b2ecd..03edad5 100644 --- a/lcs/host/lcs_controls.hpp +++ b/lcs/host/lcs_controls.hpp @@ -19,4 +19,11 @@ void lcs_set_host_drive_inputs(bool accelerate, bool brake) noexcept; void lcs_note_vehicle_control_read() noexcept; [[nodiscard]] bool lcs_player_in_vehicle() noexcept; +template +[[nodiscard]] bool lcs_guest_player_in_vehicle(Memory &memory) { + const std::uint32_t slot = memory.aot_load8(0x08B5E054u); + const std::uint32_t ped = memory.aot_load32(0x08B89A10u + slot * 368u); + return ped != 0u && memory.aot_load8(ped + 1336u) != 0u; +} + }