Skip to content

Commit

Permalink
框架跟进,简化LOADFFI函数的使用
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Nov 18, 2024
1 parent 06e6d2b commit b115e65
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
Binary file added .github/build/extraLibs/Linux/libdiscord-rpc.so
Binary file not shown.
2 changes: 1 addition & 1 deletion Zenitha
Submodule Zenitha updated 3 files
+2 −1 init.lua
+36 −0 loadFFI.lua
+2 −2 log.lua
9 changes: 2 additions & 7 deletions assets/discordRPC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,8 @@ end
local ffi=require"ffi"

local Cname
if SYSTEM=='Windows' then
local suc
suc,Cname=pcall(ffi.load,"discord-rpc")
if not (suc and Cname) then
MSG.errorLog("Loading Discord-RPC lib: "..Cname)
Cname=nil
end
if SYSTEM=='Windows' or SYSTEM=='Linux' then
Cname=LOADFFI('discord-rpc')
elseif MOBILE then
LOG("warn",STRING.repD("No Discord-RPC for $1",SYSTEM))
else
Expand Down
25 changes: 2 additions & 23 deletions assets/fmod20221/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ if SYSTEM=='Web' then
})
end

local ffi=require'ffi'
local require=simpRequire(((...):gsub(".init$","").."."))

require'cdef'
Expand All @@ -29,28 +28,8 @@ M.banks={}
-- M.C=ffi.load(fmodPath)
-- M.C2=ffi.load(fmodstudioPath)

local path='$1'

if STRING.sArg(_G.arg[2] or '','--project') then path=love.filesystem.getSaveDirectory().."/lib/lib$1.so" end

do -- Load library
local suc
suc,M.C=pcall(ffi.load,STRING.repD(path,'fmod'))
if not suc then
MSG.errorLog("Loading FMOD lib:"..M.C)
M.C=nil
elseif not M.C then
MSG.errorLog("Loaded an empty FMOD lib")
end

suc,M.C2=pcall(ffi.load,STRING.repD(path,'fmodstudio'))
if not suc then
MSG.errorLog("Loading FMODstudio lib:"..M.C2)
M.C2=nil
elseif not M.C2 then
MSG.errorLog("Loaded an empty FMODstudio lib")
end
end
M.C=LOADFFI('fmod')
M.C2=LOADFFI('fmodstudio')

if M.C and M.C2 then
require'enums'
Expand Down

0 comments on commit b115e65

Please sign in to comment.