Skip to content

Commit

Permalink
Lib update
Browse files Browse the repository at this point in the history
  • Loading branch information
Fafnyir committed Aug 13, 2024
1 parent 282de9f commit 27d62e2
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 202 deletions.
Binary file removed Textures/DPS.tga
Binary file not shown.
Binary file removed Textures/Heal.tga
Binary file not shown.
Binary file removed Textures/Tank.tga
Binary file not shown.
19 changes: 19 additions & 0 deletions libs/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
------------------------------------------------------------------------
r152 | funkehdude | 2024-07-09 18:28:54 +0000 (Tue, 09 Jul 2024) | 1 line
Changed paths:
M /trunk/LibSharedMedia-3.0.toc
D /trunk/LibSharedMedia-3.0_Cata.toc
D /trunk/LibSharedMedia-3.0_TBC.toc
D /trunk/LibSharedMedia-3.0_Vanilla.toc
D /trunk/LibSharedMedia-3.0_Wrath.toc

Merge toc files
------------------------------------------------------------------------
r151 | funkehdude | 2024-05-05 01:20:21 +0000 (Sun, 05 May 2024) | 1 line
Changed paths:
A /trunk/.luacheckrc
M /trunk/LibSharedMedia-3.0/LibSharedMedia-3.0.lua

The retail only safety check should no longer be needed
------------------------------------------------------------------------

72 changes: 18 additions & 54 deletions libs/CallbackHandler-1.0/CallbackHandler-1.0.lua
Original file line number Diff line number Diff line change
@@ -1,62 +1,26 @@
--[[ $Id: CallbackHandler-1.0.lua 18 2014-10-16 02:52:20Z mikk $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 6
--[[ $Id: CallbackHandler-1.0.lua 26 2022-12-12 15:09:39Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 8
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)

if not CallbackHandler then return end -- No upgrade needed

local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}

-- Lua APIs
local tconcat = table.concat
local assert, error, loadstring = assert, error, loadstring
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
local securecallfunction, error = securecallfunction, error
local setmetatable, rawget = setmetatable, rawget
local next, select, pairs, type, tostring = next, select, pairs, type, tostring

-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: geterrorhandler

local xpcall = xpcall

local function errorhandler(err)
return geterrorhandler()(err)
local function Dispatch(handlers, ...)
local index, method = next(handlers)
if not method then return end
repeat
securecallfunction(method, ...)
index, method = next(handlers, index)
until not method
end

local function CreateDispatcher(argCount)
local code = [[
local next, xpcall, eh = ...
local method, ARGS
local function call() method(ARGS) end
local function dispatch(handlers, ...)
local index
index, method = next(handlers)
if not method then return end
local OLD_ARGS = ARGS
ARGS = ...
repeat
xpcall(call, eh)
index, method = next(handlers, index)
until not method
ARGS = OLD_ARGS
end
return dispatch
]]

local ARGS, OLD_ARGS = {}, {}
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
end

local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})

--------------------------------------------------------------------------
-- CallbackHandler:New
--
Expand All @@ -65,7 +29,7 @@ end})
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.

function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName)
function CallbackHandler.New(_self, target, RegisterName, UnregisterName, UnregisterAllName)

RegisterName = RegisterName or "RegisterCallback"
UnregisterName = UnregisterName or "UnregisterCallback"
Expand All @@ -87,19 +51,19 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
local oldrecurse = registry.recurse
registry.recurse = oldrecurse + 1

Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
Dispatch(events[eventname], eventname, ...)

registry.recurse = oldrecurse

if registry.insertQueue and oldrecurse==0 then
-- Something in one of our callbacks wanted to register more callbacks; they got queued
for eventname,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for self,func in pairs(callbacks) do
events[eventname][self] = func
for event,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, event) or not next(events[event]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for object,func in pairs(callbacks) do
events[event][object] = func
-- fire OnUsed callback?
if first and registry.OnUsed then
registry.OnUsed(registry, target, eventname)
registry.OnUsed(registry, target, event)
first = nil
end
end
Expand Down
18 changes: 18 additions & 0 deletions libs/LibSharedMedia-3.0.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Interface: 11502, 11503, 20504, 30403, 40400, 100207, 110000, 110002
## LoadOnDemand: 1

## Title: Lib: SharedMedia-3.0
## Notes: Shared handling of media data (fonts, sounds, textures, ...) between addons.
## Author: Elkano
## Version: 3.0-152
## X-Website: https://www.curseforge.com/wow/addons/libsharedmedia-3-0
## X-Category: Library

## X-Revision: 152
## X-Date: 2024-07-09T18:28:54Z

LibStub\LibStub.lua
CallbackHandler-1.0\CallbackHandler-1.0.lua

LibSharedMedia-3.0\lib.xml

29 changes: 18 additions & 11 deletions libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
--@curseforge-project-slug: libsharedmedia-3-0@
--[[
Name: LibSharedMedia-3.0
Revision: $Revision: 91 $
Revision: $Revision: 151 $
Author: Elkano ([email protected])
Inspired By: SurfaceLib by Haste/Otravi ([email protected])
Website: http://www.wowace.com/projects/libsharedmedia-3-0/
Expand All @@ -9,7 +10,7 @@ Dependencies: LibStub, CallbackHandler-1.0
License: LGPL v2.1
]]

local MAJOR, MINOR = "LibSharedMedia-3.0", 6010002 -- 6.1.0 v2 / increase manually on changes
local MAJOR, MINOR = "LibSharedMedia-3.0", 8020003 -- 8.2.0 v3 / increase manually on changes
local lib = LibStub:NewLibrary(MAJOR, MINOR)

if not lib then return end
Expand All @@ -20,13 +21,11 @@ local pairs = _G.pairs
local type = _G.type

local band = _G.bit.band

local table_insert = _G.table.insert
local table_sort = _G.table.sort

local locale = GetLocale()
local locale_is_western
local LOCALE_MASK = 0
local LOCALE_MASK
lib.LOCALE_BIT_koKR = 1
lib.LOCALE_BIT_ruRU = 2
lib.LOCALE_BIT_zhCN = 4
Expand Down Expand Up @@ -193,11 +192,12 @@ if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end
lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]]
lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]]
lib.MediaTable.statusbar["Blizzard Raid Bar"] = [[Interface\RaidFrame\Raid-Bar-Hp-Fill]]
lib.MediaTable.statusbar["Solid"] = [[Interface\Buttons\WHITE8X8]]
lib.DefaultMedia.statusbar = "Blizzard"

-- SOUND
if not lib.MediaTable.sound then lib.MediaTable.sound = {} end
lib.MediaTable.sound["None"] = [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input.
lib.MediaTable.sound["None"] = 1 -- Relies on the fact that PlaySoundFile doesn't error on this value
lib.DefaultMedia.sound = "None"

local function rebuildMediaList(mediatype)
Expand All @@ -222,18 +222,25 @@ function lib:Register(mediatype, key, data, langmask)
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
end
mediatype = mediatype:lower()
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end
if mediatype == lib.MediaType.SOUND and type(data) == "string" then
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then
-- ignore fonts that aren't flagged as supporting local glyphs on non-western clients
return false
end
if type(data) == "string" and (mediatype == lib.MediaType.BACKGROUND or mediatype == lib.MediaType.BORDER or mediatype == lib.MediaType.STATUSBAR or mediatype == lib.MediaType.SOUND) then
local path = data:lower()
-- Only ogg and mp3 are valid sounds.
if not path:find(".ogg", nil, true) and not path:find(".mp3", nil, true) then
if not path:find("^interface") then
-- files accessed via path only allowed from interface folder
return false
end
if mediatype == lib.MediaType.SOUND and not (path:find(".ogg", nil, true) or path:find(".mp3", nil, true)) then
-- Only ogg and mp3 are valid sounds.
return false
end
end
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end
local mtable = mediaTable[mediatype]
if mtable[key] then return false end

mtable[key] = data
rebuildMediaList(mediatype)
self.callbacks:Fire("LibSharedMedia_Registered", mediatype, key)
Expand Down
2 changes: 1 addition & 1 deletion libs/LibSharedMedia-3.0/lib.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="LibSharedMedia-3.0.lua" />
</Ui>
</Ui>
4 changes: 2 additions & 2 deletions libs/LibStub/LibStub.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info
-- $Id: LibStub.lua 76 2007-09-03 01:50:17Z mikk $
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
Expand Down
9 changes: 0 additions & 9 deletions libs/LibStub/LibStub.toc

This file was deleted.

41 changes: 0 additions & 41 deletions libs/LibStub/tests/test.lua

This file was deleted.

27 changes: 0 additions & 27 deletions libs/LibStub/tests/test2.lua

This file was deleted.

14 changes: 0 additions & 14 deletions libs/LibStub/tests/test3.lua

This file was deleted.

41 changes: 0 additions & 41 deletions libs/LibStub/tests/test4.lua

This file was deleted.

5 changes: 3 additions & 2 deletions ...llbackHandler-1.0/CallbackHandler-1.0.xml → libs/lib.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="CallbackHandler-1.0.lua"/>
</Ui>
<Include file="LibSharedMedia-3.0\lib.xml"/>
</Ui>

0 comments on commit 27d62e2

Please sign in to comment.