From 28b5e022c931c225473833cc539f3fddf21a9969 Mon Sep 17 00:00:00 2001 From: konaka <> Date: Sat, 6 Dec 2025 23:47:29 +0800 Subject: [PATCH] Hopefully fix a crash in d3dx9 --- UnitXP_SP3_Addon.lua | 99 ++++++++++++++++++++++++++------------------ UnitXP_SP3_Addon.xml | 2 +- 2 files changed, 60 insertions(+), 41 deletions(-) diff --git a/UnitXP_SP3_Addon.lua b/UnitXP_SP3_Addon.lua index ad01de0..a21a71e 100755 --- a/UnitXP_SP3_Addon.lua +++ b/UnitXP_SP3_Addon.lua @@ -13,22 +13,6 @@ local function UnitXP_SP3_Print(msg) DEFAULT_CHAT_FRAME:AddMessage(tostring(msg)); end --- Commands -SLASH_UNITXP1 = "/unitxp"; -SlashCmdList["UNITXP"] = function() - if pcall(UnitXP, "nop", "nop") == true then - if xpsp3Frame:IsShown() then - PlaySound("igMainMenuContinue"); - xpsp3Frame:Hide(); - else - PlaySound("igMainMenuOpen"); - xpsp3Frame:Show(); - end - else - UnitXP_SP3_Print("UnitXP Service Pack 3 didn't load properly."); - end -end - -- Bindings BINDING_HEADER_UNITXPSP3TARGETING = "UnitXP SP3 Targeting Functions"; BINDING_NAME_UNITXPSP3NEARESTENEMY = "Nearest Enemy"; @@ -202,8 +186,22 @@ function UnitXP_SP3_detoured_CombatText_AddMessage(message, scrollFunction, r, g end end +local function UnitXP_SP3_combatTextSP3_debugText() + local test, result, scene_isEnabled = pcall(UnitXP, "combatTextSP3", "debugText"); + if not test then + if not skipUpdateMessage then + skipUpdateMessage = true; + UnitXP_SP3_Print( + "UnitXP_SP3.dll failed to execute \"combatTextSP3 debugText\". You might need to update UnitXP_SP3.dll to support this method."); + end + return false; + end + + UnitXP_SP3_Print("UnitXP_SP3 floating combat text debug: " .. result); +end + local function UnitXP_SP3_combatTextSP3(enable) - local test, result = pcall(UnitXP, "combatTextSP3", enable); + local test, result, scene_isEnabled = pcall(UnitXP, "combatTextSP3", enable); if not test then if not skipUpdateMessage then @@ -220,11 +218,15 @@ local function UnitXP_SP3_combatTextSP3(enable) "UnitXP_SP3.dll failed to execute \"combatTextSP3\". You might need to update UnitXP_SP3.dll to support this method."); end + if type(scene_isEnabled) == "boolean" and scene_isEnabled == false then + UnitXP_SP3_combatTextSP3_debugText(); + end + return result; end local function UnitXP_SP3_combatTextSP3_fontSize(size) - local test, result, reloadResult = pcall(UnitXP, "combatTextSP3", "setFontSize", size); + local test, result, scene_isEnabled = pcall(UnitXP, "combatTextSP3", "setFontSize", size); if not test then if not skipUpdateMessage then @@ -235,27 +237,22 @@ local function UnitXP_SP3_combatTextSP3_fontSize(size) return UnitXP_SP3_Addon["combatTextSP3_fontSize"]; end - if not reloadResult then - if not skipUpdateMessage then - skipUpdateMessage = true; - UnitXP_SP3_Print( - "UnitXP_SP3 failed to reload combat message font. This could because of missing d3dx9_43.dll on your system. Please try installing DirectX End-User Runtimes."); - end - return UnitXP_SP3_Addon["combatTextSP3_fontSize"]; - end - if type(result) ~= "number" then result = 40; UnitXP_SP3_Print( "UnitXP_SP3.dll failed to execute \"combatTextSP3 setFontSize\". You might need to update UnitXP_SP3.dll to support this method."); end + if type(scene_isEnabled) == "boolean" and scene_isEnabled == false then + UnitXP_SP3_combatTextSP3_debugText(); + end + UnitXP_SP3_Addon["combatTextSP3_fontSize"] = result; return UnitXP_SP3_Addon["combatTextSP3_fontSize"]; end local function UnitXP_SP3_combatTextSP3_fontName(name) - local test, result, reloadResult = pcall(UnitXP, "combatTextSP3", "setFontName", name); + local test, result, scene_isEnabled = pcall(UnitXP, "combatTextSP3", "setFontName", name); if not test then if not skipUpdateMessage then @@ -272,12 +269,16 @@ local function UnitXP_SP3_combatTextSP3_fontName(name) "UnitXP_SP3.dll failed to execute \"combatTextSP3 setFontName\". You might need to update UnitXP_SP3.dll to support this method."); end + if type(scene_isEnabled) == "boolean" and scene_isEnabled == false then + UnitXP_SP3_combatTextSP3_debugText(); + end + UnitXP_SP3_Addon["combatTextSP3_fontName"] = result; return UnitXP_SP3_Addon["combatTextSP3_fontName"]; end local function UnitXP_SP3_combatTextSP3_nameplateHeight(size) - local test, result = pcall(UnitXP, "combatTextSP3", "setNameplateHeight", size); + local test, result, scene_isEnabled = pcall(UnitXP, "combatTextSP3", "setNameplateHeight", size); if not test then if not skipUpdateMessage then @@ -294,6 +295,10 @@ local function UnitXP_SP3_combatTextSP3_nameplateHeight(size) "UnitXP_SP3.dll failed to execute \"combatTextSP3 setNameplateHeight\". You might need to update UnitXP_SP3.dll to support this method."); end + if type(scene_isEnabled) == "boolean" and scene_isEnabled == false then + UnitXP_SP3_combatTextSP3_debugText(); + end + UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"] = result; return UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]; end @@ -482,15 +487,6 @@ local function UnitXP_SP3_reloadConfig() UnitXP_SP3_backgroundFPScap(UnitXP_SP3_Addon["backgroundFPScap"]); xpsp3_editBox_backgroundFPScap:SetNumber(UnitXP_SP3_Addon["backgroundFPScap"]); - UnitXP_SP3_combatTextSP3_fontSize(UnitXP_SP3_Addon["combatTextSP3_fontSize"]); - xpsp3_editBox_combatTextSP3_fontSize:SetNumber(UnitXP_SP3_Addon["combatTextSP3_fontSize"]); - - UnitXP_SP3_combatTextSP3_nameplateHeight(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]); - xpsp3_editBox_combatTextSP3_nameplateHeight:SetNumber(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]); - - UnitXP_SP3_combatTextSP3_fontName(UnitXP_SP3_Addon["combatTextSP3_fontName"]); - xpsp3_editBox_combatTextSP3_fontName:SetText(UnitXP_SP3_Addon["combatTextSP3_fontName"]); - UnitXP_SP3_setTargetingRangeConeFactor(UnitXP_SP3_Addon["targetingRangeConeFactor"]); UnitXP_SP3_setCameraHeight(UnitXP_SP3_Addon["cameraHeight"]); @@ -520,6 +516,15 @@ local function UnitXP_SP3_reloadConfig() xpsp3_fontString_combatTextSP3_fontSize:Show(); xpsp3_fontString_combatTextSP3_nameplateHeight:Show(); xpsp3_fontString_combatTextSP3_fontName:Show(); + + UnitXP_SP3_combatTextSP3_fontSize(UnitXP_SP3_Addon["combatTextSP3_fontSize"]); + xpsp3_editBox_combatTextSP3_fontSize:SetNumber(UnitXP_SP3_Addon["combatTextSP3_fontSize"]); + + UnitXP_SP3_combatTextSP3_nameplateHeight(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]); + xpsp3_editBox_combatTextSP3_nameplateHeight:SetNumber(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]); + + UnitXP_SP3_combatTextSP3_fontName(UnitXP_SP3_Addon["combatTextSP3_fontName"]); + xpsp3_editBox_combatTextSP3_fontName:SetText(UnitXP_SP3_Addon["combatTextSP3_fontName"]); else UnitXP_SP3_combatTextSP3("disable"); xpsp3_checkButton_combatTextSP3:SetChecked(false); @@ -898,8 +903,6 @@ function UnitXP_SP3_OnEvent(event) UnitXP_SP3_Addon["notify_playSystemDefaultSound"]["UPDATE_BATTLEFIELD_STATUS"] = false; UnitXP_SP3_Addon["notify_playSystemDefaultSound"]["PARTY_MEMBERS_CHANGED"] = false; UnitXP_SP3_Addon["notify_playSystemDefaultSound"]["CHAT_MSG_ADDON"] = false; -- For LFT - - UnitXP_SP3_Print("UnitXP Service Pack 3 configuration is reset due to AddOn update.") end if UnitXP_SP3_Icon == nil then UnitXP_SP3_Icon = { @@ -928,6 +931,22 @@ function UnitXP_SP3_OnEvent(event) return; end + -- Chat Command + SLASH_UNITXP1 = "/unitxp"; + SlashCmdList["UNITXP"] = function() + if pcall(UnitXP, "nop", "nop") == true then + if xpsp3Frame:IsShown() then + PlaySound("igMainMenuContinue"); + xpsp3Frame:Hide(); + else + PlaySound("igMainMenuOpen"); + xpsp3Frame:Show(); + end + else + UnitXP_SP3_Print("UnitXP Service Pack 3 didn't load properly."); + end + end + if UnitXP_SP3_Addon["notify_flashTaskbarIcon"] ~= nil and UnitXP_SP3_Addon["notify_flashTaskbarIcon"]["PLAYER_REGEN_DISABLED"] == true and UnitAffectingCombat("player") then diff --git a/UnitXP_SP3_Addon.xml b/UnitXP_SP3_Addon.xml index 4c71928..93ed0d8 100755 --- a/UnitXP_SP3_Addon.xml +++ b/UnitXP_SP3_Addon.xml @@ -7,7 +7,7 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac