internal.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <cstddef>
  3. #include <cstdint>
  4. #include "../../patterns/image_scan.h"
  5. namespace sunrise::client::hooks::teleport {
  6. using patterns::resolve_relative;
  7. using patterns::scan_main_image_unique;
  8. using patterns::signature;
  9. using patterns::signature_length;
  10. /**
  11. * Object-handle index bits. Two handles name the same object exactly when these bits match, so
  12. * comparing them is the whole ownership test. No datum array lookup is needed.
  13. */
  14. inline constexpr std::uint32_t kHandleIndexMask = 0x1FFF;
  15. /** The controlled-object getter writes this when the local player owns no object. */
  16. inline constexpr std::uint32_t kInvalidHandle = 0xFFFFFFFF;
  17. /** Camera pose block stride, indexed by player. Its vectors are plain floats. */
  18. inline constexpr std::size_t kCameraBlockStride = 0xC50;
  19. /** Camera pose fields inside one player camera block. */
  20. inline constexpr std::size_t kCameraPositionX = 0x594;
  21. /** Camera forward vector. Its default is (1,0,0), so the basis is X forward, Z up. */
  22. inline constexpr std::size_t kCameraForwardX = kCameraPositionX + 0x28;
  23. inline constexpr std::size_t kCameraUpX = kCameraPositionX + 0x34;
  24. inline constexpr std::size_t kCameraHorizontalFov = kCameraPositionX + 0x40;
  25. inline constexpr std::size_t kCameraAspect = kCameraPositionX + 0xB8;
  26. /** Object handle the physics component drives, as a u16. */
  27. inline constexpr std::size_t kPhysicsComponentObjectHandle = 44;
  28. /** Rigid-body array on the physics component. */
  29. inline constexpr std::size_t kPhysicsComponentBodyArray = 400;
  30. /** Index into that array, signed. */
  31. inline constexpr std::size_t kPhysicsComponentBodyIndex = 516;
  32. /** Array entry stride, and the body pointer inside one entry. */
  33. inline constexpr std::size_t kBodyEntryStride = 80;
  34. inline constexpr std::size_t kBodyPointer = 32;
  35. /**
  36. * Swept-transform centre of mass 1 of the body's motion state. The transform translation at
  37. * +416 is rebuilt from it by the physics step, so a body at rest does not follow a write here.
  38. */
  39. inline constexpr std::size_t kBodyPositionX = 448;
  40. /** Rigid-body velocity. The sync copies this into the physics component every tick. */
  41. inline constexpr std::size_t kBodyVelocityX = 560;
  42. } // namespace sunrise::client::hooks::teleport