Skip to content

feat: add API compatibility layer for cross-version support#142

Open
Bearstonk wants to merge 1 commit intoebonyfaye:masterfrom
Bearstonk:fix/tbc-anniversary-init
Open

feat: add API compatibility layer for cross-version support#142
Bearstonk wants to merge 1 commit intoebonyfaye:masterfrom
Bearstonk:fix/tbc-anniversary-init

Conversation

@Bearstonk
Copy link
Copy Markdown

@Bearstonk Bearstonk commented Jan 16, 2026

What This Does

Adds compatibility wrapper functions for the C_AddOns API, which doesn't exist in TBC Classic but does in Retail WoW.

Context

The current deployed version (v4.3) uses the older GetAddOnMetadata/IsAddOnLoaded API
which works in TBC Classic. However, newer code in master uses C_AddOns namespace
which doesn't exist in TBC, causing nil errors.

This PR adds a compatibility layer to support both APIs, allowing the addon to work
across all WoW versions (Classic, TBC, Wrath, Cata, Retail).

Why It's Needed

  • TBC Anniversary uses older API (GetAddOnMetadata, IsAddOnLoaded as globals)
  • Retail uses newer API (C_AddOns.GetAddOnMetadata, C_AddOns.IsAddOnLoaded)
  • This wrapper detects which API is available and uses it

How It Works

GetAddOnMetadataCompat and IsAddOnLoadedCompat check:

  1. Does C_AddOns exist? Use it
  2. Otherwise, use the global function
  3. Return nil/false if neither available

Files Changed

  • Core/Core.lua (added compatibility layer)

Next Steps

This is foundation for subsequent PRs that will use these wrappers throughout the codebase.

@Bearstonk
Copy link
Copy Markdown
Author

✅ TESTED - Core initialization fixed (no more nil cascade), but identified secondary issues in DisplayTeam.lua and Quest-Classic.lua that also need the compatibility wrapper. Ready to proceed with incremental fixes in follow-up PRs.

Successfully tested on TBC Anniversary 2.5.4 with EMA v4.3 (0229) deployed version

  • Addon loads without nil errors
  • Settings panel opens correctly
  • Version displays properly
  • No errors in BugSack

The compatibility layer resolves the C_AddOns API issues that were causing cascading nil errors.image

Remaining Bugs
DisplayTeam.lua:29 - IsAddOnLoaded still nil (needs to use the compatibility wrapper)
Quest-Classic.lua:1954 - IsAddOnLoaded still nil (same issue)
ItemUse.lua:170 - ContainerButton nil (unrelated, different issue)
LDBBar.lua:38 - Bad font argument (unrelated)

image

@Bearstonk
Copy link
Copy Markdown
Author

Also tested on 0230
image
image

@Bearstonk Bearstonk force-pushed the fix/tbc-anniversary-init branch from 0404089 to 056d431 Compare January 16, 2026 02:55
- Add GetAddOnMetadataCompat wrapper for C_AddOns.GetAddOnMetadata
- Add IsAddOnLoadedCompat wrapper for C_AddOns.IsAddOnLoaded
- Supports TBC Classic, Wrath, Cata, and Retail
- Safely checks if C_AddOns namespace exists before using it
@Bearstonk Bearstonk force-pushed the fix/tbc-anniversary-init branch from 056d431 to 4706bb3 Compare January 16, 2026 02:56
Bearstonk added a commit to Bearstonk/ema that referenced this pull request Jan 16, 2026
- DisplayTeam.lua: Replace C_AddOns.IsAddOnLoaded with EMAPrivate.Core.IsAddOnLoaded
  - Line 29: TrufiGCD initialization
  - Lines 3263, 3280: TrufiGCD integration checks

- Quest-Classic.lua: Replace IsAddOnLoaded with EMAPrivate.Core.IsAddOnLoaded
  - Line 1959: ElvUI detection for frame positioning

Enables cross-version compatibility by using the compatibility wrapper functions
exported by Core.lua in PR ebonyfaye#143. Fixes nil value errors in TBC Anniversary.

Depends on: PR ebonyfaye#142, PR ebonyfaye#143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant