Created
August 10, 2023 23:30
-
-
Save TheIndra55/5e6755117f97f083a775173263ff89ff to your computer and use it in GitHub Desktop.
Extract sources from Feral Interactive "shader_overrides.db"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sqlite3 | |
import zlib | |
con = sqlite3.connect("shader_overrides.db") | |
con.row_factory = sqlite3.Row | |
cur = con.cursor() | |
cur.execute("SELECT id, source FROM shaders") | |
for row in cur: | |
data = row["source"] | |
# Skip header; 4 bytes decompressed length; 4 bytes unknown | |
compressed = data[8:] | |
decompressed = zlib.decompress(compressed) | |
path = os.path.join("shaders", row["id"]) | |
f = open(path, "wb") | |
f.write(decompressed) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment