Skip to content

Commit

Permalink
Workaround for 64bit shift issues for party status effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Renee Koecher committed Jul 16, 2022
1 parent 779033b commit 05236ed
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion addons/statustimers/conf_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.render_config_ui = function(settings, toggle)
imgui.SliderInt('\xef\x81\x9b Icons', target_size, 14, 256, '%dpx');
imgui.ShowHelp('Size for target status icons.', true);

local combo_flags = bit.bor(ImGuiComboFlags_None);
local combo_flags = ImGuiComboFlags_None;
local theme_paths = resources.get_theme_paths();

if (imgui.BeginCombo('\xef\x97\x83 Theme', theme_paths[ui.theme_index[1] ], combo_flags)) then
Expand Down
18 changes: 15 additions & 3 deletions addons/statustimers/party.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,21 @@ module.get_member_status = function(server_id)
local status_ids = T{};

for j = 0,31,1 do
if (icons_lo[j+1] ~= 255) then
-- icons_hi holds bit 9 & 10 in a 32 entry 2bit array
status_ids[#status_ids + 1] = icons_lo[j + 1] + bit.lshift(bit.band(bit.rshift(icons_hi, 2 * j), 3), 8);
--[[ FIXME: lua doesn't handle 64bit return values properly..
-- FIXME: the next lines are a workaround by Thorny that cover most but not all cases..
-- FIXME: .. to try and retrieve the high bits of the buff id.
-- TODO: revesit this once atom0s adjusted the API.
--]]
local high_bits;
if j < 16 then
high_bits = bit.lshift(bit.band(bit.rshift(icons_hi, 2* j), 3), 8);
else
local buffer = math.floor(icons_hi / 0xffffffff);
high_bits = bit.lshift(bit.band(bit.rshift(buffer, 2 * (j - 16)), 3), 8);
end
local buff_id = icons_lo[j+1] + high_bits;
if (buff_id ~= 255) then
status_ids[#status_ids + 1] = buff_id;
end
end

Expand Down
1 change: 0 additions & 1 deletion addons/statustimers/resources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ local icon_cache = T{
-- this table implements overrides for certain icons to handle
-- local buffs_table = nil;
local id_overrides = T{
_249 = 579
};
-------------------------------------------------------------------------------
-- local functions
Expand Down
2 changes: 1 addition & 1 deletion addons/statustimers/statustimers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

addon.name = 'statustimers';
addon.author = 'heals';
addon.version = '4.0.905';
addon.version = '4.0.906';
addon.desc = 'Replacement for the default status timer display';
addon.link = 'https://github.com/Shirk/statustimers';

Expand Down

0 comments on commit 05236ed

Please sign in to comment.