ConsolePort

ConsolePort

2M Downloads

ConsolePort menu does not pop up on Chinese Wrath client 3.4.3 (55392)

SwimmingTiger opened this issue ยท 3 comments

commented

The World of Warcraft Classic servers in China have reopened after being shut down for a year, and are staying at Wrath.

It has a special version: 3.4.3 (55392) (Chinese Release x64).

image

I noticed that the recent 2.9.x update broke compatibility with it. The ConsolePort menu no longer pops up and the addon initialization setup cannot be completed due to missing functions in C_AddOns.

3x ConsolePort/Controller/Convenience.lua:173: attempt to call field 'IsAddOnLoaded' (a nil value)
[string "@ConsolePort/Controller/Convenience.lua"]:173: in function <ConsolePort/Controller/Convenience.lua:172>
[string "@ConsolePort/Controller/Convenience.lua"]:249: in function `OnDataLoaded'
[string "@ConsolePort/Utils/Utils.lua"]:17: in function `?'
[string "@ConsolePort/Utils/Utils.lua"]:9: in function <ConsolePort/Utils/Utils.lua:7>

image

Like the previous Wrath client, it only has the GetAddOnMetadata function in C_AddOns, and other functions like LoadAddOn and GetAddOnInfo exist as global functions.

I had to remove a lot of C_AddOns prefixes in the code to get it to work properly. Perhaps you guys could consider adding a better solution?

image

Here are the compatibility code I found in the BugGrabber addon:

local GetAddOnMetadata = C_AddOns.GetAddOnMetadata
local DisableAddOn = C_AddOns.DisableAddOn or DisableAddOn
local GetAddOnInfo = C_AddOns.GetAddOnInfo or GetAddOnInfo
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded or IsAddOnLoaded
local GetNumAddOns = C_AddOns.GetNumAddOns or GetNumAddOns

And the last version that worked is ConsolePort-2.7.37.

commented

This temporary patch of mine lists the functions affected:

From 8843b373b65629d953a481b909a2b6e54012d5f5 Mon Sep 17 00:00:00 2001
From: SwimmingTiger <[email protected]>
Date: Mon, 1 Jul 2024 01:13:34 +0800
Subject: [PATCH] tmp patch for Chinese Wrath client 3.4.3 (55392)

---
 ConsolePort/Controller/Convenience.lua         | 10 +++++-----
 ConsolePort/Controller/Slash.lua               |  6 +++---
 ConsolePort_Bar/Controller/Blizzard/Retail.lua |  2 +-
 ConsolePort_Bar/View/Config/Config.lua         |  2 +-
 ConsolePort_Cursor/Controller/Stack.lua        |  4 ++--
 ConsolePort_Keyboard/Components/Config.lua     |  2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/ConsolePort/Controller/Convenience.lua b/ConsolePort/Controller/Convenience.lua
index db4426f..3864b5a 100644
--- a/ConsolePort/Controller/Convenience.lua
+++ b/ConsolePort/Controller/Convenience.lua
@@ -167,14 +167,14 @@ end
 local OnDemandModules, TryLoadModule = {
 	ConsolePort_Keyboard = 'keyboardEnable';
 	ConsolePort_Cursor   = 'UIenableCursor';
-}; do local RawEnableAddOn = C_AddOns.EnableAddOn;
+}; do local RawEnableAddOn = EnableAddOn;
 
 	function TryLoadModule(predicate, module)
-		if not db(predicate) or C_AddOns.IsAddOnLoaded(module) then
+		if not db(predicate) or IsAddOnLoaded(module) then
 			return
 		end
 		RawEnableAddOn(module)
-		local loaded, reason = C_AddOns.LoadAddOn(module)
+		local loaded, reason = LoadAddOn(module)
 		if not loaded then
 			CPAPI.Log('Failed to load %s. Reason: %s\nPlease check your installation.', (module:gsub('_', ' ')), _G['ADDON_'..reason])
 		end
@@ -182,7 +182,7 @@ local OnDemandModules, TryLoadModule = {
 
 	-- Automatically load modules when they are enabled through the addon list
 	local function OnEnableAddOn(module)
-		local name = C_AddOns.GetAddOnInfo(module)
+		local name = GetAddOnInfo(module)
 		local var  = name and OnDemandModules[name];
 		if ( name and var ) then
 			db('Settings/'..var, true)
@@ -192,7 +192,7 @@ local OnDemandModules, TryLoadModule = {
 
 	-- Automatically disable predicate variable when a module is disabled through the addon list
 	local function OnDisableAddOn(module)
-		local name = C_AddOns.GetAddOnInfo(module)
+		local name = GetAddOnInfo(module)
 		local var  = name and OnDemandModules[name];
 		if ( var ) then
 			db('Settings/'..var, false)
diff --git a/ConsolePort/Controller/Slash.lua b/ConsolePort/Controller/Slash.lua
index a44a08d..0ea96c9 100644
--- a/ConsolePort/Controller/Slash.lua
+++ b/ConsolePort/Controller/Slash.lua
@@ -49,9 +49,9 @@ local function HandleSlashCommand(self, msg)
 	elseif ProcessVarUpdate((' '):split(msg or '')) then
 		return
 	end
-	if not C_AddOns.IsAddOnLoaded(CONFIG_ADDON_NAME) then
-		C_AddOns.EnableAddOn(CONFIG_ADDON_NAME)
-		C_AddOns.LoadAddOn(CONFIG_ADDON_NAME)
+	if not IsAddOnLoaded(CONFIG_ADDON_NAME) then
+		EnableAddOn(CONFIG_ADDON_NAME)
+		LoadAddOn(CONFIG_ADDON_NAME)
 	end
 	ConsolePortConfig:SetShown(not ConsolePortConfig:IsShown())
 end
diff --git a/ConsolePort_Bar/Controller/Blizzard/Retail.lua b/ConsolePort_Bar/Controller/Blizzard/Retail.lua
index 423988f..b68e690 100644
--- a/ConsolePort_Bar/Controller/Blizzard/Retail.lua
+++ b/ConsolePort_Bar/Controller/Blizzard/Retail.lua
@@ -98,7 +98,7 @@ function env.UIHandler:HideBlizzard()
 
 	---------------------------------------------------------------
 	-- Misc
-	if C_AddOns.IsAddOnLoaded('Blizzard_NewPlayerExperience') then
+	if IsAddOnLoaded('Blizzard_NewPlayerExperience') then
 		NPE_LoadUI()
 	elseif NPE_LoadUI ~= nil then
 		hooksecurefunc('NPE_LoadUI', NPE_LoadUI)
diff --git a/ConsolePort_Bar/View/Config/Config.lua b/ConsolePort_Bar/View/Config/Config.lua
index a701ec2..25e2f50 100644
--- a/ConsolePort_Bar/View/Config/Config.lua
+++ b/ConsolePort_Bar/View/Config/Config.lua
@@ -262,7 +262,7 @@ local Config = CreateFromMixins(CPButtonCatcherMixin);
 function Config:OnLoad()
 	CPButtonCatcherMixin.OnLoad(self)
 	self:SetUserPlaced(false)
-	C_AddOns.LoadAddOn('ConsolePort_Config');
+	LoadAddOn('ConsolePort_Config');
 	env.SharedConfig.Env = ConsolePortConfig:GetEnvironment();
 	Mixin(Setting, env.SharedConfig.Env.SettingMixin) -- borrow code from the config for the settings
 
diff --git a/ConsolePort_Cursor/Controller/Stack.lua b/ConsolePort_Cursor/Controller/Stack.lua
index d919626..ceed6cc 100644
--- a/ConsolePort_Cursor/Controller/Stack.lua
+++ b/ConsolePort_Cursor/Controller/Stack.lua
@@ -250,7 +250,7 @@ function Stack:OnDataLoaded()
 
 	-- Load all existing frames in the registry
 	for addon in pairs(self.Registry) do
-		if C_AddOns.IsAddOnLoaded(addon) then
+		if IsAddOnLoaded(addon) then
 			self:LoadAddonFrames(addon)
 		end
 	end
@@ -346,4 +346,4 @@ end
 ---------------------------------------------------------------
 -- On demand explicit load
 ---------------------------------------------------------------
-if C_AddOns.IsAddOnLoaded(_) then Stack:ADDON_LOADED(_) end;
\ No newline at end of file
+if IsAddOnLoaded(_) then Stack:ADDON_LOADED(_) end;
\ No newline at end of file
diff --git a/ConsolePort_Keyboard/Components/Config.lua b/ConsolePort_Keyboard/Components/Config.lua
index 969ee31..18e90ad 100644
--- a/ConsolePort_Keyboard/Components/Config.lua
+++ b/ConsolePort_Keyboard/Components/Config.lua
@@ -496,7 +496,7 @@ local function OnConfigLoaded(localEnv, config, env)
 	end, localEnv)
 end
 
-if C_AddOns.IsAddOnLoaded('ConsolePort_Config') then
+if IsAddOnLoaded('ConsolePort_Config') then
 	OnConfigLoaded(env, ConsolePortConfig, ConsolePortConfig:GetEnvironment())
 else
 	ConsolePort:DB():RegisterCallback('OnConfigLoaded', OnConfigLoaded, env)
-- 
2.43.0.windows.1
commented

Generally speaking there's a wrapper file for this kind of thing. I'll change them to use the wrapper instead.

commented