# -*- coding: utf-8 -*- # VRAM-compressed (compress/mode=2) textures ship S3TC + ETC2 + ETC variants. # On the Vita (PowerVR/GLES2) Godot picks the S3TC or ETC2 variant, which the # GPU can't render with alpha -> the texture shows white/black AND the driver # chokes (the DLC splash dropped to ~5 FPS). The ".etc" variant, however, is # plain uncompressed RGBA4444 (fmt 0x..06) which the Vita renders fine. # # Fix: rewrite each such .import so the [remap] points unconditionally at the # .etc (RGBA4444) variant, instead of letting Godot pick a compressed one. # python fix_vram_textures.py (apply) # python fix_vram_textures.py --restore (undo from .vrambak) import os, sys, glob, struct def _project_root(): # Walk up from this file (now under Tools//) until the project root. d = os.path.dirname(os.path.abspath(__file__)) while d != os.path.dirname(d): if os.path.isdir(os.path.join(d, "SteamVersion", "NewExtractPCK")): return d d = os.path.dirname(d) return os.getcwd() ROOT = os.path.join(_project_root(), "SteamVersion", "NewExtractPCK") IMP = os.path.join(ROOT, ".import") def is_rgba4444(stex_abs): try: b = open(stex_abs, "rb").read(20) except IOError: return False if b[0:4] != b"GDST": return False fmt = struct.unpack_from("