"""Regenerate src/RR/Patching/LogoArt.h - the Campus logo the patch swaps in for Rec Room's. python tools/make_logo_art.py [--game D:\\Puck\\Campus2025] [--check] What it does (see src/RR/Patching/LogoSwap.h for why): 1. Opens the game's UI bundle (91aca73acb86d6607f0efa1f803348be.bundle) with UnityPy and reads the raw bytes of the two logo textures, RecRoomLogo_Sprite_Shadow and RecRoomLogo_Sprite (1024x1024, DXT5, one mip), hashing each (FNV-1a over 64-bit words - the same function as LogoSwap::Fnv). Those hashes are how the patch recognises the originals. 2. Encodes (must be 1024x1024, RGBA - transparent background) as BC3 with etcpak, in the memory order Unity uses (bottom row first, so the image is flipped before encoding). 3. Writes LogoArt.h. --check only verifies the existing header already matches this png + bundle. Needs: pip install UnityPy etcpak texture2ddecoder pillow numpy """ import argparse, os, struct, sys import numpy as np from PIL import Image, ImageOps import UnityPy, etcpak, texture2ddecoder BUNDLE = r'StreamingAssets\aa\StandaloneWindows64\91aca73acb86d6607f0efa1f803348be.bundle' NAMES = ('RecRoomLogo_Sprite_Shadow', 'RecRoomLogo_Sprite') HERE = os.path.dirname(os.path.abspath(__file__)) OUT = os.path.normpath(os.path.join(HERE, '..', 'src', 'RR', 'Patching', 'LogoArt.h')) def fnv64(b: bytes) -> int: h = 0xcbf29ce484222325; M = (1 << 64) - 1 n = len(b) // 8 for (w,) in struct.iter_unpack('', 'namespace LogoArt {', ' inline constexpr int kSize = 1024;', ' inline constexpr uint32_t kBytes = 1024u * 1024u;'] for n in NAMES: lines.append(f' inline constexpr uint64_t k{n.replace("_", "")}Hash = 0x{fnv64(orig[n]):016x}ULL; // original {n}') lines.append(' alignas(16) inline const unsigned char kBc3[1048576] = {') for i in range(0, len(blob), 32): lines.append(' ' + ','.join(str(x) for x in blob[i:i + 32]) + ',') lines += [' };', '}'] text = '\r\n'.join(lines) + '\r\n' if a.check: same = os.path.exists(OUT) and open(OUT, 'rb').read() == text.encode() print('LogoArt.h is', 'up to date' if same else 'DIFFERENT from this png/bundle'); sys.exit(0 if same else 1) open(OUT, 'wb').write(text.encode()) print('wrote', OUT) main()