mirror of
https://github.com/pmret/papermario.git
synced 2024-11-12 22:12:38 +01:00
a4e1c2f522
* fix vscode cpp extension messing with files.associations * move stuff * it builds! * symlink papermario.us.z64 * ci: put baserom in right place * add jp * fix splat dir * ignore starrod dump * .s deps * update jenkins * add dsl back * configure.py versions * wups * fine ethan * fix paths * configure: default to only the version(s) with existing baseroms * fix coverage * fix progress.py * progress.py verisoning * remove format.sh from CONTRIBUTING * update CONTRIBUTING * fix first_diff * diff.py: use ver/current/ * update splat.yaml * trying to fix subrepo * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "06a737f02d" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "06a737f02d" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * configure fix * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "41786effd3" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "41786effd3" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Ethan Roseman <ethteck@gmail.com>
32 lines
816 B
Python
Executable File
32 lines
816 B
Python
Executable File
#! /usr/bin/python3
|
|
|
|
from sys import argv
|
|
import re
|
|
import png
|
|
|
|
if __name__ == "__main__":
|
|
infile, outfile = argv[1:]
|
|
|
|
img = png.Reader(infile)
|
|
width, height, rows, info = img.read()
|
|
|
|
cname = re.sub(r"[^0-9a-zA-Z_]", "_", infile)
|
|
|
|
if cname.startswith("ver_"):
|
|
cname = "_".join(cname.split("_")[2:])
|
|
|
|
if cname.startswith("src_"):
|
|
cname = cname[4:]
|
|
elif cname.startswith("assets_"):
|
|
cname = cname[7:]
|
|
|
|
with open(outfile, "w") as f:
|
|
f.write("// Generated file, do not edit.\n")
|
|
f.write(f"#ifndef _{cname.upper()}_\n")
|
|
f.write(f"#define _{cname.upper()}_\n")
|
|
f.write(f"\n")
|
|
f.write(f"#define {cname}_width {width}\n")
|
|
f.write(f"#define {cname}_height {height}\n")
|
|
f.write(f"\n")
|
|
f.write(f"#endif\n")
|