37 lines
1.5 KiB
C++
37 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "gk/types.h"
|
|
|
|
namespace gk::game {
|
|
|
|
// Camera-elevation control surface the NuiThread drives through the live
|
|
// INuiSensor. Declared as a C++ interface so MinGW emits the Itanium vtable
|
|
// (never copy MSVC vtable bytes, per docs/conventions.md). The two slots used
|
|
// here mirror INuiSensor::NuiCameraElevationGetAngle and
|
|
// ::NuiCameraElevationSetAngle (kinect/fallback/windows-nui/nui_interfaces.h),
|
|
// the methods the original dispatches at vtable offsets 0x3c and 0x38.
|
|
class ICameraElevation {
|
|
public:
|
|
virtual std::int32_t GK_STDCALL GetAngle(std::int32_t* out_degrees) = 0;
|
|
virtual std::int32_t GK_STDCALL SetAngle(std::int32_t degrees) = 0;
|
|
};
|
|
|
|
// NuiThread elevation-smoothing state. Offsets pinned to the original
|
|
// FUN_1000f510 frame: the object arrives in ESI and the function touches
|
|
// +0x38/+0x3c/+0x40/+0x44 and the sensor pointer at +0x15fc.
|
|
struct ElevationThread {
|
|
std::int32_t desired_angle; // +0x38, caller-requested elevation
|
|
std::int32_t applied_angle; // +0x3c, last angle pushed to the sensor
|
|
std::int32_t smoothed_angle; // +0x40, published smoothed estimate
|
|
std::int32_t accumulator; // +0x44, IIR state, sentinel -0x168
|
|
ICameraElevation* sensor; // +0x15fc, live INuiSensor
|
|
};
|
|
|
|
// cmp DWORD PTR [esi+0x44],0xfffffe98 at 0x1000f527.
|
|
constexpr std::int32_t kAccumulatorSentinel = -0x168;
|
|
|
|
// rva=0x1000f510 (orig FUN_1000f510)
|
|
void GK_CDECL UpdateCameraElevation(ElevationThread& thread);
|
|
|
|
} // namespace gk::game
|