shaderfix

This commit is contained in:
bryanthaboi
2026-08-25 09:16:59 -04:00
parent 9dd38e06a5
commit d622e83a8e
11 changed files with 445 additions and 16 deletions
+8 -1
View File
@@ -76,7 +76,14 @@ local function sdlFfi()
]])
if sdlCdefOk then
local okLoad, lib = pcall(ffi.load, "SDL2")
sdlLib = okLoad and lib or ffi.C
lib = okLoad and lib or ffi.C
local okSyms = pcall(function()
return lib.SDL_InitSubSystem, lib.SDL_NumSensors, lib.SDL_SensorGetDeviceType,
lib.SDL_SensorOpen, lib.SDL_SensorUpdate, lib.SDL_SensorGetData,
lib.SDL_GL_GetCurrentWindow, lib.SDL_GetWindowDisplayIndex,
lib.SDL_GetDisplayOrientation
end)
sdlLib = okSyms and lib or false
end
end
if not sdlCdefOk or not sdlLib then return nil end
+18 -7
View File
@@ -984,6 +984,17 @@ local function modScopeChipsWidth(options, gap, m)
return need
end
local function profileState(imp)
if imp._profileCache == nil then
local LauncherMods = require("src.mods.LauncherMods")
local SaveData = require("src.core.SaveData")
local options = SaveData.loadOptions()
local list, cur = LauncherMods.getProfiles(options)
imp._profileCache = { options = options, list = list, active = cur }
end
return imp._profileCache
end
local function buildModScopeRow(imp, x, y, w, m)
local LauncherMods = require("src.mods.LauncherMods")
local h = math.max(Kit.tapMin(), math.floor(26 * m.s))
@@ -994,7 +1005,7 @@ local function buildModScopeRow(imp, x, y, w, m)
local options = modScopeOptions(imp)
-- Dedicated Profile control section (cycle button + gear icon button) on right side of Scope Bar
local _, activeProf = LauncherMods.getProfiles()
local activeProf = profileState(imp).active
local isCompact = (w < math.floor(500 * m.s))
local nameText = tostring(activeProf or "Default")
local profLabel = isCompact and nameText or Strings("Profile: %s", nameText)
@@ -3698,9 +3709,8 @@ local function buildSingleProfileActionsModal(imp, m)
if not pName then imp._singleProfileActions = nil return end
local LauncherMods = require("src.mods.LauncherMods")
local SaveData = require("src.core.SaveData")
local options = SaveData.loadOptions()
local profiles, active = LauncherMods.getProfiles(options)
local prof = profileState(imp)
local options, profiles = prof.options, prof.list
local pad = math.floor(18 * m.s)
local w = math.min(math.floor(380 * m.s), m.w - 2 * m.pad)
@@ -3715,6 +3725,7 @@ local function buildSingleProfileActionsModal(imp, m)
action = function()
LauncherMods.duplicateProfile(pName, options)
imp._singleProfileActions = nil
if imp._refreshMods then imp:_refreshMods() end
end
},
{
@@ -3736,6 +3747,7 @@ local function buildSingleProfileActionsModal(imp, m)
imp:pressDelete("profile", pName, nil, function()
LauncherMods.deleteProfile(pName, options)
imp._singleProfileActions = nil
if imp._refreshMods then imp:_refreshMods() end
end)
end
}
@@ -3771,9 +3783,8 @@ end
-- Modal for Mod Profiles (#593) - interactive profile manager (switch, edit, duplicate, delete)
local function buildProfilesModal(imp, m)
local LauncherMods = require("src.mods.LauncherMods")
local SaveData = require("src.core.SaveData")
local options = SaveData.loadOptions()
local profiles, active = LauncherMods.getProfiles(options)
local prof = profileState(imp)
local options, profiles, active = prof.options, prof.list, prof.active
local pad = math.floor(18 * m.s)
local w = math.min(math.floor(460 * m.s), m.w - 2 * m.pad)
+1
View File
@@ -4803,6 +4803,7 @@ function RomImporter:_refreshMods()
local LauncherMods = require("src.mods.LauncherMods")
local SaveData = require("src.core.SaveData")
self._cartPlan = nil
self._profileCache = nil
self.findInstalled = nil
self.safeMode = SaveData.isSafeMode(SaveData.loadOptions())
-- Once per session, ahead of the first listing: pull in any mod the player
+17 -3
View File
@@ -264,7 +264,9 @@ ShaderFX.BRIDGE_DIR = "tools/shaderfx-bridge"
local function libNames()
local osName = (love and love.system and love.system.getOS
and love.system.getOS()) or ""
if osName == "Windows" then
if osName == "iOS" then
return {}
elseif osName == "Windows" then
return { "librashader_bridge.dll" }
elseif osName == "OS X" then
return { "liblibrashader_bridge.dylib", "librashader_bridge.dylib" }
@@ -313,11 +315,13 @@ end
-- Every place the bridge may sit, most specific first.
local function libCandidates()
local names = libNames()
if #names == 0 then return {} end
local out = {}
local override = os.getenv("LIBRASHADER_BRIDGE_DLL")
if override and override ~= "" then out[#out + 1] = override end
local dirs, save = sourceDirs(), saveDir()
for _, name in ipairs(libNames()) do
for _, name in ipairs(names) do
for _, dir in ipairs(dirs) do
out[#out + 1] = dir .. "/" .. name
out[#out + 1] = dir .. "/" .. ShaderFX.BRIDGE_DIR .. "/target/release/" .. name
@@ -353,7 +357,17 @@ local function ensureLib()
end
tried[#tried + 1] = path
end
libError = "librashader bridge not found; looked in " .. table.concat(tried, ", ")
local okSym, sym = pcall(function()
return ffi.C and ffi.C.librashader_translate_preset
end)
if okSym and sym ~= nil then
lib = ffi.C
return lib
end
libError = "librashader bridge not found; ffi.C has no librashader_translate_preset"
if #tried > 0 then
libError = libError .. "; looked in " .. table.concat(tried, ", ")
end
return nil, libError
end