Skip to content

Commit

Permalink
Merge pull request #5 from ThornyFFXI/spriterenderer
Browse files Browse the repository at this point in the history
Spriterenderer
  • Loading branch information
ThornyFFXI authored Nov 17, 2023
2 parents 299b4bd + 153e039 commit 7fbaf4c
Show file tree
Hide file tree
Showing 1,492 changed files with 3,179 additions and 3,648 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "gdifonts"]
path = addons/tCrossBar/gdifonts
url = https://github.com/ThornyFFXI/gdifonts
178 changes: 78 additions & 100 deletions bindinggui.lua → addons/tCrossBar/bindinggui.lua

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions bindings.lua → addons/tCrossBar/bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ local function WriteJob(jobBindings)
end

local function ApplyBindings()
local squareManager = gInterface:GetSquareManager();
if (squareManager == nil) then
if (gSingleDisplay == nil) then
return;
end

Expand All @@ -106,7 +105,8 @@ local function ApplyBindings()
end
end

squareManager:UpdateBindings(output);
gSingleDisplay:UpdateBindings(output);
gDoubleDisplay:UpdateBindings(output);
end

local exposed = {};
Expand Down Expand Up @@ -192,6 +192,19 @@ function exposed:BindPalette(hotkey, binding)
ApplyBindings();
end

function exposed:GetDisplayText()
if (bindings.ActivePalette == nil) then
return;
end

local paletteCount = #bindings.JobBindings.Palettes;
if (paletteCount == 1) then
return;
else
return string.format ('%s (%u/%u)', bindings.ActivePalette.Name, bindings.ActivePaletteIndex, paletteCount);
end
end

function exposed:PreviousPalette()
local paletteCount = #bindings.JobBindings.Palettes;
if (paletteCount == 1) then
Expand Down
125 changes: 125 additions & 0 deletions addons/tCrossBar/callbacks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
local renderTarget;
local player = require('state.player');
local pGameMenu = ashita.memory.find('FFXiMain.dll', 0, "8B480C85C974??8B510885D274??3B05", 16, 0);
local pEventSystem = ashita.memory.find('FFXiMain.dll', 0, "A0????????84C0741AA1????????85C0741166A1????????663B05????????0F94C0C3", 0, 0);
local pInterfaceHidden = ashita.memory.find('FFXiMain.dll', 0, "8B4424046A016A0050B9????????E8????????F6D81BC040C3", 0, 0);

local function GetMenuName()
local subPointer = ashita.memory.read_uint32(pGameMenu);
local subValue = ashita.memory.read_uint32(subPointer);
if (subValue == 0) then
return '';
end
local menuHeader = ashita.memory.read_uint32(subValue + 4);
local menuName = ashita.memory.read_string(menuHeader + 0x46, 16);
return string.gsub(menuName, '\x00', '');
end

local function GetEventSystemActive()
if (pEventSystem == 0) then
return false;
end
local ptr = ashita.memory.read_uint32(pEventSystem + 1);
if (ptr == 0) then
return false;
end

return (ashita.memory.read_uint8(ptr) == 1);

end

local function GetInterfaceHidden()
if (pEventSystem == 0) then
return false;
end
local ptr = ashita.memory.read_uint32(pInterfaceHidden + 10);
if (ptr == 0) then
return false;
end

return (ashita.memory.read_uint8(ptr + 0xB4) == 1);
end

local function ShouldHide()
if (gSettings.HideWhileZoning) then
if (player:GetLoggedIn() == false) then
return true;
end
end

if (gSettings.HideWhileCutscene) then
if (GetEventSystemActive()) then
return true;
end
end

if (gSettings.HideWhileMap) then
if (string.match(GetMenuName(), 'map')) then
return true;
end
end

if (GetInterfaceHidden()) then
return true;
end

return false;
end

ashita.events.register('d3d_present', 'd3d_present_cb', function ()
player:UpdateBLUSpells();
gController:Tick();
gConfigGUI:Render();
gBindingGUI:Render();

renderTarget = nil;
if (gConfigGUI.ForceDisplay) then
gConfigGUI.ForceDisplay:Render(1);
renderTarget = gConfigGUI.ForceDisplay;
return;
end

if (gBindingGUI.ForceDisplay) then
gBindingGUI.ForceDisplay:Render(gBindingGUI.ForceState);
renderTarget = gBindingGUI.ForceDisplay;
return;
end

if (ShouldHide()) then
return;
end

renderTarget = gSingleDisplay;
local macroState = gController:GetMacroState();
if (macroState == 0) then
if (gSettings.ShowDoubleDisplay) then
renderTarget = gDoubleDisplay;
end
elseif (macroState < 3) then
if (gSettings.SwapToSingleDisplay == false) then
renderTarget = gDoubleDisplay;
end
end

renderTarget:Render(macroState);
end);

local mouseDown;
ashita.events.register('mouse', 'mouse_cb', function (e)
if (renderTarget ~= nil) then
renderTarget:HandleMouse(e);
end

if (e.message == 513) then
if (e.blocked == true) then
mouseDown = true;
end
end

if (e.message == 514) then
if mouseDown then
e.blocked = true;
mouseDown = false;
end
end
end);
17 changes: 17 additions & 0 deletions addons/tCrossBar/commands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ashita.events.register('command', 'command_cb', function (e)
local args = e.command:args();
if (#args == 0 or string.lower(args[1]) ~= '/tc') then
return;
end
e.blocked = true;

if (#args == 1) then
gConfigGUI:Show();
return;
end

if (#args > 1) and (string.lower(args[2]) == 'palette') then
gBindings:HandleCommand(args);
return;
end
end);
Loading

0 comments on commit 7fbaf4c

Please sign in to comment.