[Lua] GetActiveScreenResolution broken as of 787

As of client version 787-bb55e8dd469ad9bce64097794713046aa526b040 the native _GET_ACTIVE_SCREEN_RESOLUTION(int* x, int* y) no longer returns the intended y value (In lua)
The value returned is a really large number instead of the expected actual height of the game screen.

Testing it on version 785-3e77ab320ac6c899a36d0ae08b0d9d780641dbe5 gives the expected result.

local res_x, res_y = GetActiveScreenResolution()
print("Resolution: x " .. res_x .. ", y " .. res_y)

On a 1920x1080 game configuration, running this code yield the following results:
785: Resolution: x 1920, y 1080
787: Resolution: x 1920, y 140720308487224

A current workaround:

local aspect_ratio = GetAspectRatio(0)
local res_x, _ = GetActiveScreenResolution()
local res_y = res_x / aspect_ratio
print("Resolution: x " .. res_x .. ", y " .. res_y)

That yields the following results:
785: Resolution: x 1920, y 1079.9999919534
787: Resolution: x 1920, y 1079.9999919534

(The issue is also present on the current 790 version)

Fixed by the following commit:

1 Like