local ffi = require 'ffi'
local hook = require 'hooks'
local sw, sh = getScreenResolution()
local RsGlobals = {
maximumWidth = sw,
maximumHeight = sh,
}
ffi.cdef[[
typedef struct CVector2D { float x, y; } CVector2D;
typedef struct RwV2d { float x, y; } RwV2d;
]]
function radar_position(out, _in)
out[0].x = 0.5 * (94.0 * (RsGlobals.maximumWidth * 0.0015625)) + RsGlobals.maximumWidth * 0.0015625 * 40 + 94 * (RsGlobals.maximumWidth * 0.0015625) * _in.x * 0.4
out[0].y = RsGlobals.maximumHeight - 0.002232143 * RsGlobals.maximumHeight * 104 + 76 * (0.002232143 * RsGlobals.maximumHeight) * 0.5 - 76 * (0.002232143 * RsGlobals.maximumHeight) * _in.y * 0.5
return ffi.cast('RwV2d*', _in)
end
function main()
transformhook = hook.jmp.new('RwV2d*(__cdecl*)(CVector2D* out, CVector2D* in)', radar_position, 0x583480)
end