// 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 . // Embedded `!!!ClassicAPI` addon fallback. When the user doesn't have // the addon installed on disk, this module makes the engine think it // does — without writing anything to the filesystem. // // How: // // 1. The CMake build embeds every file under `AddOns/!!!ClassicAPI/` // as an RCDATA resource, plus a generated `{path, resourceId}` // manifest (`embedded_resources.h`). // // 2. We hook the engine's file-read function at `FUN_FILE_READ`. // When the engine asks for a path under // `Interface\AddOns\!!!ClassicAPI\`, we allocate a Storm buffer // via the same allocator the engine itself uses, copy the // embedded content in, and hand it back. The caller's normal // `SMemFree` reclaims it on completion — no special lifetime. // // 3. We hook the exists-check `FUN_FILE_EXISTS` so it answers the same // way for the same paths. Without it every embedded file reads fine // but reports as missing — the per-addon loader would skip an // embedded `Bindings.xml`, and `Xml::ScriptPath` would never find an // embedded `