diff --git a/docs/API.md b/docs/API.md index 4b8c5a9f..844e68f6 100644 --- a/docs/API.md +++ b/docs/API.md @@ -883,6 +883,7 @@ build instructions. - [`C_XMLUtil.DoesTemplateExist(name)`](#c_xmlutildoestemplateexistname) - [`inherits` with more than one template](#inherits-with-more-than-one-template) - [`parentKey` in XML](#parentkey-in-xml) + - [Masks in XML](#masks-in-xml) - [`function` on XML script handlers](#function-on-xml-script-handlers) - [`style` on button font elements](#style-on-button-font-elements) - [`C_TTSSettings` — getters & setters](#c_ttssettings--getters--setters) @@ -6392,7 +6393,8 @@ buttons, and other shaped art. is opaque the texture shows, where the mask is transparent the texture is hidden. The mask stretches across the texture's full display area, so it always lines up with the texture. Pass `nil` or `""` to remove the mask; the texture -returns to its full rectangle. +returns to its full rectangle. If the file does not load, the texture keeps the +mask it had. A mask file must be one the client can load and must hold its shape in the alpha channel: @@ -6460,6 +6462,12 @@ A mask honors [`texture:SetRotation`](#texturesetrotationangle--cx-cy): rotate the mask and its clip shape turns with it. The mask can also move or resize each frame (drive it from an `OnUpdate`), so the clip animates. +> Outside its own rectangle, a mask repeats the alpha of its nearest edge +> pixel. A mask whose outer edge is transparent, like a circle, hides the +> texture outside the mask. A mask with an opaque edge does not clip the +> texture past its rectangle. To clip only part of a texture, use a mask with +> a transparent border. + ### `texture:RemoveMaskTexture([mask])` Removes `mask` from this texture. With no argument, removes every mask, so the @@ -20766,6 +20774,51 @@ already sees them, and a `parentKey` inside a virtual template is set on every frame built from it. A button's `` works the same way. +### Masks in XML + +A `` element takes a `mask` attribute. It is the same as +[`texture:SetMask(path)`](#texturesetmaskpath): + +```xml + +``` + +A `` also takes a `` element. It is the same as +[`frame:CreateMaskTexture`](#framecreatemasktexturename-layer-): the mask +loads like a texture (`file`, `inherits`, `parentKey`, ``, ``) +and never draws itself. Each `` inside `` +attaches the mask to one texture, the same as +[`texture:AddMaskTexture(mask)`](#textureaddmasktexturemask): + +- `childKey="Icon"` names the texture at `parent.Icon`, where `parent` is the + frame that holds the layer. +- `target="$parentIcon"` names a texture by its global name. `$parent` at the + start stands for the name of that frame. + +```xml + + + + + + + + + + + + + + + + +``` + +A `` can name a texture from any layer of the same frame. If +it names no texture, the load log gets a warning and the mask is not +attached. + ### `function` on XML script handlers A script element with `function="Name"` uses the global function `Name` as diff --git a/src/Offsets.h b/src/Offsets.h index 488164be..d69ea875 100644 --- a/src/Offsets.h +++ b/src/Offsets.h @@ -10163,6 +10163,26 @@ enum Offsets { FUN_XML_FRAME_LOAD = 0x00769820, FUN_XML_TEXTURE_LOAD = 0x0076FE20, FUN_XML_FONTSTRING_LOAD = 0x00770F40, + // CSimpleFrame::LoadXMLLayers — `__thiscall(frame, layersNode, status)`, + // `ret 8`, called by FUN_XML_FRAME_LOAD for each . For each + // it reads `level` (default ARTWORK, FUN_XML_DRAW_LAYER_FROM_NAME) + // and builds each (FUN_XML_ADD_TEXTURE_ELEMENT) and + // (FUN_XML_ADD_FONTSTRING_ELEMENT), then places it with + // FUN_REGION_SET_PARENT_AND_LAYER(region, frame, level, [region+0xC4]). + // Any other tag is warned with STR_XML_FRAME_UNKNOWN_CHILD (frame name or + // VAR_STR_UNNAMED, parent tag, child tag). Replaced by xml/Layers.cpp. + FUN_XML_LOAD_LAYERS = 0x00769D70, + // `CSimpleTexture *__fastcall(xmlNode, frame, status)`, `ret 4`: allocates + // a texture parented to the frame, runs its pre-load (name), its node + // loader (FUN_XML_TEXTURE_LOAD) and the implicit anchor. + FUN_XML_ADD_TEXTURE_ELEMENT = 0x006F26F0, + // The font string twin of FUN_XML_ADD_TEXTURE_ELEMENT, same convention. + FUN_XML_ADD_FONTSTRING_ELEMENT = 0x006F2780, + // `bool __fastcall(const char *name, int *outLayer)`: case-insensitive + // BACKGROUND..HIGHLIGHT -> 0..4; leaves *outLayer alone on a miss. + FUN_XML_DRAW_LAYER_FROM_NAME = 0x006F18B0, + // "Frame %s: Unknown child node in %s element: %s" + STR_XML_FRAME_UNKNOWN_CHILD = 0x008786E0, // Builds a node's children. `__thiscall(frame, node, status)`, // `ret 8`: recurses the node's `inherits` first (0x0076A092), then calls // the builder FUN_006EE280 per child with EDX = frame as the parent @@ -10378,8 +10398,13 @@ enum Offsets { // FUN_TEXTURE_LOAD_BY_PATH(path, &desc, flags, 0, 1) __fastcall, desc = // the 5-dword {PTR_TEXLOAD_DESC_VTBL, 8, &self8, (&self8)|1, 0} on-stack // node FUN_00770200 builds; flags via FUN_GX_TEXFLAGS_INIT(&flags, blend, - // 0,0, 0,0,0, 1, 0) __thiscall. Never returns null (engine substitutes a - // fallback texture). FUN_TEXTURE_GET_RENDERABLE(hTex, 1, 0) __fastcall + // 0,0, 0,0,0, 1, 0) __thiscall. Never returns null: a file that does not + // load returns the solid green fallback and sets the desc's severity + // (+0x10, the CStatus level) to 2 or more. SetTexture (0x00770288) tests + // that, then closes the handle (FUN_HANDLE_RELEASE), passes the status to + // FUN_SYSMSG_ADD_STATUS with 4 (shows nothing) and destroys it + // (FUN_FRAMESCRIPT_STATUS_RESET, also run on success at 0x007702C6). + // FUN_TEXTURE_GET_RENDERABLE(hTex, 1, 0) __fastcall // returns the bindable CGxTex at [hTex+0x140] and drives the streaming // load — calling it each frame IS the residency reference (what the // minimap's masked draw does for its mask at 0x004ec65c). @@ -10387,6 +10412,12 @@ enum Offsets { PTR_TEXLOAD_DESC_VTBL = 0x007FFA10, FUN_GX_TEXFLAGS_INIT = 0x0058A980, FUN_TEXTURE_GET_RENDERABLE = 0x0044ACF0, + // SysMsgAdd — `int __fastcall(CStatus *status, uint32_t level)`: hands a + // status's error text to the system-message printer 0x0044CB20, which in + // this build formats it and drops it (nothing reaches the screen; seen + // in-game: a bad SetTexture/SetMask path prints nothing). SetTexture's + // failure path (0x0077029D) calls it with 4; mirrored for parity. + FUN_SYSMSG_ADD_STATUS = 0x0044CB40, // --- Texture desaturation (`Texture:SetDesaturation` backport) -------------- // The engine desaturates by binding ONE pixel shader per region: the UI diff --git a/src/texture/Mask.cpp b/src/texture/Mask.cpp index 554dc7a6..c405672d 100644 --- a/src/texture/Mask.cpp +++ b/src/texture/Mask.cpp @@ -54,6 +54,7 @@ #include "Game.h" #include "Offsets.h" +#include "texture/Mask.h" #include "texture/Transform.h" #include "ui/FrameObject.h" @@ -74,7 +75,9 @@ namespace { bool g_enabled = true; // A region's mask: the loaded HTEXTURE plus the path (so a re-SetMask with the -// same path is a cheap no-op and the value is inspectable). Keyed by the +// same path is a cheap no-op and the value is inspectable). The entry owns one +// reference on the handle, closed when the entry is replaced or dropped, the +// way SetTexture closes the handle it held. Keyed by the // CSimpleTexture object pointer — the same pointer the Lua object resolves to // AND the base of the corner array the draw hook recovers. struct MaskEntry { @@ -95,6 +98,15 @@ std::unordered_set g_maskRegions; // --- path -> HTEXTURE loader (mirrors FUN_00770200's SetTexture load) -------- +using HandleRelease_t = void(__fastcall *)(void *handle); +using SysMsgAdd_t = int(__fastcall *)(void *status, uint32_t level); +using StatusDestroy_t = void(__thiscall *)(void *status); + +void ReleaseHandle(void *handle) { + if (handle != nullptr) + reinterpret_cast(Offsets::FUN_HANDLE_RELEASE)(handle); +} + using TexFlagsInit_t = void *(__thiscall *)(void *self, uint32_t blend, int, int, int, int, int, uint32_t, int); using TextureLoad_t = uint32_t(__fastcall *)(const char *path, void *desc, uint32_t flags, int, @@ -109,6 +121,10 @@ struct TexLoadDesc { int32_t field10; }; +// The loaded handle, or nullptr when the file does not load. Same failure +// test and cleanup as SetTexture: a status level of 2 or more closes the +// green fallback and passes the status to the (silent) system-message +// printer; the status is destroyed either way. void *LoadByPath(const char *path) { TexLoadDesc desc; desc.vtbl = reinterpret_cast(Offsets::PTR_TEXLOAD_DESC_VTBL); @@ -120,10 +136,64 @@ void *LoadByPath(const char *path) { const uint32_t blend = Game::Read(Offsets::VAR_TEXTURE_BLEND_DEFAULT); reinterpret_cast(Offsets::FUN_GX_TEXFLAGS_INIT)(&flags, blend, 0, 0, 0, 0, 0, 1, 0); - return reinterpret_cast(reinterpret_cast( + void *handle = reinterpret_cast(reinterpret_cast( Offsets::FUN_TEXTURE_LOAD_BY_PATH)(path, &desc, flags, 0, 1)); + if (desc.field10 >= 2) { + ReleaseHandle(handle); + handle = nullptr; + reinterpret_cast(Offsets::FUN_SYSMSG_ADD_STATUS)(&desc, 4); + } + reinterpret_cast(Offsets::FUN_FRAMESCRIPT_STATUS_RESET)(&desc); + return handle; } +// Drops a region's path mask and its handle reference. +void ClearPathMask(void *region) { + auto it = g_regionMask.find(region); + if (it == g_regionMask.end()) + return; + ReleaseHandle(it->second.handle); + g_regionMask.erase(it); +} + +} // namespace + +bool SetPath(void *region, const char *path) { + if (path == nullptr || path[0] == '\0') { + ClearPathMask(region); + return true; + } + auto it = g_regionMask.find(region); + if (it != g_regionMask.end() && it->second.path == path) + return true; // unchanged + void *handle = LoadByPath(path); + if (handle == nullptr) + return false; // keeps the mask it had, as SetTexture keeps its texture + ClearPathMask(region); + g_regionMask[region] = MaskEntry{handle, path}; + return true; +} + +using RegionHide_t = void(__fastcall *)(void *region); + +void MakeSource(void *region) { + Game::Ref(region, Offsets::OFF_REGION_DESIRED_SHOWN) = 0; + reinterpret_cast(Offsets::FUN_FONTSTRING_HIDE)(region); + g_maskRegions.insert(region); +} + +void Add(void *base, void *mask) { + if (base == mask) + return; + auto &v = g_baseMasks[base]; + for (void *m : v) + if (m == mask) + return; + v.push_back(mask); +} + +namespace { + // --- stream-primitive co-hook: apply the mask on unit 1 ---------------------- using GxRsSet_t = void(__fastcall *)(int selector, int value); @@ -414,7 +484,7 @@ Ctor_t g_ctorOriginal = nullptr; void *__fastcall Ctor_h(void *mem, void *edx, void *parent, int layer, int sublayer) { if (mem != nullptr) { // A (re)constructed region owns no mask and is no longer a mask source. - g_regionMask.erase(mem); + ClearPathMask(mem); g_baseMasks.erase(mem); // If the recycled memory WAS a mask region, detach it from every base // still holding it — otherwise the draw hook would read the recycled @@ -447,22 +517,11 @@ int __fastcall Script_SetMask(void *L) { const char *path = (Game::Lua::GetTop(L) >= 2 && Game::Lua::Type(L, 2) == Game::Lua::TYPE_STRING) ? Game::Lua::ToString(L, 2) : nullptr; - if (path == nullptr || path[0] == '\0') { - g_regionMask.erase(region); - return 0; - } - auto it = g_regionMask.find(region); - if (it != g_regionMask.end() && it->second.path == path) - return 0; // unchanged - MaskEntry e; - e.handle = LoadByPath(path); // never null (engine substitutes a fallback) - e.path = path; - g_regionMask[region] = std::move(e); + SetPath(region, path); return 0; } using ScriptFn_t = int(__fastcall *)(void *L); -using RegionHide_t = void(__fastcall *)(void *region); // frame:CreateMaskTexture([name, layer, ...]) — mint a MaskTexture. Delegates to // the engine's own CreateTexture (it reads the args off this same stack and @@ -473,11 +532,8 @@ int __fastcall Script_CreateMaskTexture(void *L) { if (rc != 1) return rc; // engine raised an error, or pushed nothing void *region = Game::Lua::ResolveObject(L, Game::Lua::GetTop(L)); - if (region != nullptr) { - Game::Ref(region, Offsets::OFF_REGION_DESIRED_SHOWN) = 0; - reinterpret_cast(Offsets::FUN_FONTSTRING_HIDE)(region); - g_maskRegions.insert(region); - } + if (region != nullptr) + MakeSource(region); return 1; // the region object the engine pushed is our return value } @@ -487,13 +543,8 @@ int __fastcall Script_CreateMaskTexture(void *L) { int __fastcall Script_AddMaskTexture(void *L) { void *base = Game::Lua::ResolveTexture(L); void *mask = Game::Lua::ResolveTexture(L, 2, /*raiseError=*/false); - if (base == nullptr || mask == nullptr || base == mask) - return 0; - auto &v = g_baseMasks[base]; - for (void *m : v) - if (m == mask) - return 0; - v.push_back(mask); + if (base != nullptr && mask != nullptr) + Add(base, mask); return 0; } @@ -586,6 +637,8 @@ static const Game::ModuleAutoRegister _autoreg{&RegisterLuaFunctions}; void PrepareForReload() { // /reload frees every region; forget the mask maps so a recycled address // can't be mistaken for a still-masked region before its ctor re-clears it. + for (auto &entry : g_regionMask) + ReleaseHandle(entry.second.handle); g_regionMask.clear(); g_baseMasks.clear(); g_maskRegions.clear(); diff --git a/src/texture/Mask.h b/src/texture/Mask.h index 0d522d4c..29d06a57 100644 --- a/src/texture/Mask.h +++ b/src/texture/Mask.h @@ -30,4 +30,15 @@ void PrepareForReload(); // zero-dimension texture without anyone having to reproduce the freeze. bool AnyMaskActive(); +// texture:SetMask(path) on `region`. nullptr or "" clears the mask. Returns +// false, keeping the mask it had, when the file does not load. +bool SetPath(void *region, const char *path); + +// Turns a texture region into a MaskTexture: hidden, never drawn, and +// accepted as a mask source. +void MakeSource(void *region); + +// base:AddMaskTexture(mask). Adding the same mask twice is a no-op. +void Add(void *base, void *mask); + } // namespace Texture::Mask diff --git a/src/xml/FrameLoad.cpp b/src/xml/FrameLoad.cpp index 02013ba4..c7b38a25 100644 --- a/src/xml/FrameLoad.cpp +++ b/src/xml/FrameLoad.cpp @@ -63,12 +63,12 @@ void LoadNode(void *object, const void *node, void *status) { Game::Read(vtable, Offsets::VTBL_XML_NODE_LOADER)(self, node, status); } -void Warn(void *status, const char *fmt, const char *a, const char *b) { +void Warn(void *status, const char *fmt, const char *a, const char *b, const char *c) { if (status == nullptr) return; const void *vtable = Game::Read(status, 0); Game::Read(vtable, Offsets::VTBL_XML_STATUS_ADD)( - status, Offsets::XML_STATUS_WARNING, fmt, a, b); + status, Offsets::XML_STATUS_WARNING, fmt, a, b, c); } bool PushWrapper(void *L, void *object) { diff --git a/src/xml/FrameLoad.h b/src/xml/FrameLoad.h index 6eec0e32..14366858 100644 --- a/src/xml/FrameLoad.h +++ b/src/xml/FrameLoad.h @@ -48,7 +48,8 @@ void LoadNode(void *object, const void *node, void *status); // The engine's load-status sink: `status->Add(STATUS_WARNING, fmt, ...)`, // the same warning the loaders log ("Couldn't find inherited node: %s"). -void Warn(void *status, const char *fmt, const char *a, const char *b = nullptr); +void Warn(void *status, const char *fmt, const char *a, const char *b = nullptr, + const char *c = nullptr); // Pushes `object`'s Lua wrapper and returns true, registering an unnamed, // never-exposed object the way the engine's own lazy path does. Pushes diff --git a/src/xml/Layers.cpp b/src/xml/Layers.cpp new file mode 100644 index 00000000..edd476f9 --- /dev/null +++ b/src/xml/Layers.cpp @@ -0,0 +1,175 @@ +// This file is part of ClassicAPI. +// +// ClassicAPI is free software: you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software Foundation, either +// version 3 of the License, or (at your option) any later version. +// +// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with +// ClassicAPI. If not, see . + +// `` in a frame's ``, the later-client schema: +// +// +// +// +// ... +// +// +// +// +// +// +// +// Vanilla's layer loader FUN_XML_LOAD_LAYERS builds only and +// and warns on any other child, so this replaces it with the +// same loop plus a branch. Every step is the engine's own: the +// `level` parse, the element builders, the parent-and-layer placement, and +// the warning (its format string and arguments). A MaskTexture is built +// exactly like a Texture, so `file`, `inherits`, `parentKey`, anchors and +// size all load through the texture loader. It is then turned into a mask +// source (Texture::Mask::MakeSource), the state frame:CreateMaskTexture +// leaves. +// +// resolve after the whole node has loaded, so a +// mask can name a texture from a later layer. `childKey` is a key on the +// mask's parent frame; `target` is a global name, with a leading `$parent` +// standing for the parent frame's name. + +#include "Game.h" +#include "Offsets.h" +#include "texture/Mask.h" +#include "xml/FrameLoad.h" + +#include +#include +#include +#include + +namespace Xml::Layers { + +namespace { + +using LoadLayers_t = void(__fastcall *)(void *frame, void *edx, const void *layers, void *status); +using AddElement_t = void *(__fastcall *)(const void *node, void *frame, void *status); +using SetParentAndLayer_t = void(__thiscall *)(void *region, void *frame, int layer, int show); +using LayerFromName_t = bool(__fastcall *)(const char *name, int *outLayer); +using GetName_t = const char *(__thiscall *)(void *object); + +LoadLayers_t g_orig = nullptr; + +const char *NameOf(void *object) { + return Game::Read(Game::Read(object, 0), + Offsets::VTBL_SCRIPTOBJECT_GET_NAME)(object); +} + +// The engine's "Frame %s: Unknown child node in %s element: %s". +void WarnUnknown(void *status, void *frame, const void *parent, const void *child) { + const char *name = NameOf(frame); + Xml::Warn(status, reinterpret_cast(Offsets::STR_XML_FRAME_UNKNOWN_CHILD), + name != nullptr ? name : reinterpret_cast(Offsets::VAR_STR_UNNAMED), + Xml::Tag(parent), Xml::Tag(child)); +} + +// The texture a names, or nullptr. +void *MaskedTarget(void *L, void *frame, const void *entry) { + const int top = Game::Lua::GetTop(L); + void *base = nullptr; + if (const char *key = Xml::Attr(entry, "childKey"); key != nullptr && *key != '\0') { + if (Xml::PushWrapper(L, frame)) { // [frame] + Game::Lua::PushString(L, key); + Game::Lua::GetTable(L, top + 1); // [frame, frame[key]] + base = Game::Lua::ResolveTexture(L, top + 2, /*raiseError=*/false); + } + } else if (const char *target = Xml::Attr(entry, "target"); + target != nullptr && *target != '\0') { + constexpr char kParent[] = "$parent"; + constexpr size_t kParentLen = sizeof(kParent) - 1; + std::string name = target; + if (name.compare(0, kParentLen, kParent) == 0) { + const char *parentName = NameOf(frame); + name = std::string(parentName != nullptr ? parentName : "") + name.substr(kParentLen); + } + Game::Lua::PushString(L, name.c_str()); + Game::Lua::GetTable(L, Game::Lua::GLOBALS_INDEX); // [_G[name]] + base = Game::Lua::ResolveTexture(L, top + 1, /*raiseError=*/false); + } + Game::Lua::SetTop(L, top); + return base; +} + +void BindMaskedTextures(void *frame, void *mask, const void *maskNode, void *status) { + void *L = Game::Lua::State(); + if (L == nullptr) + return; + for (const void *c = Xml::FirstChild(maskNode); c != nullptr; c = Xml::NextSibling(c)) { + if (!Xml::TagIs(c, "MaskedTextures")) + continue; + for (const void *e = Xml::FirstChild(c); e != nullptr; e = Xml::NextSibling(e)) { + if (!Xml::TagIs(e, "MaskedTexture")) { + WarnUnknown(status, frame, c, e); + continue; + } + void *base = MaskedTarget(L, frame, e); + if (base != nullptr) { + Texture::Mask::Add(base, mask); + continue; + } + const char *key = Xml::Attr(e, "childKey"); + Xml::Warn(status, "MaskTexture: Couldn't find masked texture: %s", + key != nullptr ? key : Xml::Attr(e, "target")); + } + } +} + +// FUN_XML_LOAD_LAYERS, `__thiscall` modelled as `__fastcall` with a dummy edx. +void __fastcall LoadLayers_h(void *frame, void *, const void *layers, void *status) { + const auto addTexture = reinterpret_cast(Offsets::FUN_XML_ADD_TEXTURE_ELEMENT); + const auto addFontString = + reinterpret_cast(Offsets::FUN_XML_ADD_FONTSTRING_ELEMENT); + const auto place = + reinterpret_cast(Offsets::FUN_REGION_SET_PARENT_AND_LAYER); + + std::vector> masks; + for (const void *layer = Xml::FirstChild(layers); layer != nullptr; + layer = Xml::NextSibling(layer)) { + if (!Xml::TagIs(layer, "Layer")) { + WarnUnknown(status, frame, layers, layer); + continue; + } + int level = Offsets::DRAWLAYER_ARTWORK; + if (const char *name = Xml::Attr(layer, "level"); name != nullptr && *name != '\0') + reinterpret_cast(Offsets::FUN_XML_DRAW_LAYER_FROM_NAME)(name, &level); + for (const void *child = Xml::FirstChild(layer); child != nullptr; + child = Xml::NextSibling(child)) { + const bool isMask = Xml::TagIs(child, "MaskTexture"); + void *region = nullptr; + if (isMask || Xml::TagIs(child, "Texture")) { + region = addTexture(child, frame, status); + } else if (Xml::TagIs(child, "FontString")) { + region = addFontString(child, frame, status); + } else { + WarnUnknown(status, frame, layer, child); + continue; + } + place(region, frame, level, Game::Read(region, Offsets::OFF_REGION_DESIRED_SHOWN)); + if (isMask) { + Texture::Mask::MakeSource(region); + masks.emplace_back(region, child); + } + } + } + for (const auto &[mask, node] : masks) + BindMaskedTextures(frame, mask, node, status); +} + +const Game::HookAutoRegister _hook{Offsets::FUN_XML_LOAD_LAYERS, + reinterpret_cast(&LoadLayers_h), + reinterpret_cast(&g_orig)}; + +} // namespace + +} // namespace Xml::Layers diff --git a/src/xml/ParentKey.cpp b/src/xml/ParentKey.cpp index 51ff57bc..ecabb0ae 100644 --- a/src/xml/ParentKey.cpp +++ b/src/xml/ParentKey.cpp @@ -72,12 +72,16 @@ // // Every loader also loads an child (Animation::Xml), before the // builder finalizes, so OnLoad sees the groups. +// +// The texture loader also reads `mask="path"` (``, +// the later-client attribute) and applies it as texture:SetMask(path). #include "xml/FrameLoad.h" #include "Game.h" #include "Offsets.h" #include "animation/Xml.h" +#include "texture/Mask.h" #include @@ -247,6 +251,8 @@ uintptr_t __fastcall TextureLoad_h(void *self, void *edx, const void *node, void if (self != nullptr && node != nullptr) { BindParentKey(RegionObject(self), node); Animation::Xml::LoadAnimations(RegionObject(self), node, status); + if (const char *mask = Xml::Attr(node, "mask"); mask != nullptr && *mask != '\0') + Texture::Mask::SetPath(RegionObject(self), mask); } return r; }