BinaryData ZeroConfContainer::getNewZCkey() { uint32_t newId = topId_.fetch_add(1, memory_order_relaxed); BinaryData newKey = READHEX("ffff"); newKey.append(WRITE_UINT32_BE(newId)); return newKey; }
void A5InitLoader::relocateWorld(const uint32 a5, uint8 *dst, const uint8 *src, std::ostream &out) const throw() { assert(dst != nullptr); assert(src != nullptr); uint32 dummy = 0; while (true) { uint32 loops = 1; uint32 offset = *src++; if (offset) { if (offset & 0x80) { offset &= 0x7F; offset <<= 8; offset |= *src++; } } else { offset = *src++; if (!offset) return; if (offset & 0x80) { offset <<= 8; offset |= *src++; offset <<= 8; offset |= *src++; offset <<= 8; offset |= *src++; } else { loops = getRunLength(src, dummy); } } offset += offset; do { dst += offset; out << boost::format("Relocation at 0x%1$08X\n") % (dst - _executable.getMemory()); WRITE_UINT32_BE(dst, READ_UINT32_BE(dst) + a5); } while (--loops); } }
BinaryData DBUtils::getFilterPoolKey(uint32_t filenum) { uint32_t bucketKey = (DB_PREFIX_POOL << 24) | (uint32_t)filenum; return WRITE_UINT32_BE(bucketKey); }
BinaryData DBUtils::heightAndDupToHgtx(uint32_t hgt, uint8_t dup) { uint32_t hgtxInt = (hgt << 8) | (uint32_t)dup; return WRITE_UINT32_BE(hgtxInt); }