Extract standalone Playground SDK source foundation

This commit is contained in:
CRTkafa 2026-10-02 16:54:36 +00:00
commit d49c22a06c
3567 changed files with 1657902 additions and 0 deletions

18
core/zxml.cpp Normal file
View file

@ -0,0 +1,18 @@
#include "core/zxml.h"
#include <cstring>
namespace playground {
bool isZxml(const Bytes& b) { return b.size() >= 12 && std::memcmp(b.data(), "ZXML", 4) == 0; }
static uint32_t rd32(const uint8_t* p) { return p[0] | (p[1] << 8) | (p[2] << 16) | (uint32_t(p[3]) << 24); }
bool zxmlDecode(const Bytes& in, Bytes& out, std::string* err) {
if (!isZxml(in)) { if (err) *err = "not ZXML"; return false; }
uint32_t comp = rd32(in.data() + 4), raw = rd32(in.data() + 8);
if (size_t(comp) + 12 > in.size()) { if (err) *err = "ZXML truncated"; return false; }
if (!zlibInflate(in.data() + 12, comp, out, raw)) { if (err) *err = "ZXML inflate failed"; return false; }
return true;
}
} // namespace playground