1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 05:19:36 +00:00
oot/tools/get_overlay_stats.py
2020-03-17 00:31:30 -04:00

32 lines
991 B
Python

#!/usr/bin/python3
import os
import pprint
script_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = script_dir + "/../"
asm_dir = root_dir + "asm/non_matchings/overlays/actors"
overlays = {}
def main():
for root, dirs, files in os.walk(asm_dir):
for dir in dirs:
if dir.startswith("ovl_"):
avg_size = 0
max_size = -1
ovl_path = os.path.join(root, dir)
count = 0
for root2, dirs2, files2 in os.walk(ovl_path):
for file in files2:
count += 1
file_size = os.path.getsize(os.path.join(ovl_path, file))
avg_size += file_size
if file_size > max_size:
max_size = file_size
overlays[dir] = (max_size, count, avg_size / count)
print({k: v for k, v in sorted(overlays.items(), key=lambda item: item[1][2])})
main()