mirror of
https://github.com/blawar/ooot.git
synced 2024-07-02 09:03:36 +00:00
23 lines
585 B
Python
23 lines
585 B
Python
import os
|
|
import re
|
|
from oot import *
|
|
|
|
def fix(path):
|
|
with open(path, 'r', encoding="UTF-8") as f:
|
|
buffer = f.read()
|
|
|
|
result = re.sub(r'^(\s*)Mtx\s+([A-Za-z0-9_]*)\s*=\s*\{\s*([^}]*)\s*\};', r'\1Mtx \2 = MTX(\3);', buffer, flags=re.M)
|
|
|
|
with open(path, 'w', encoding="UTF-8") as f:
|
|
buffer = f.write(result)
|
|
|
|
PATH = assetPath()
|
|
result = [os.path.join(dp, f) for dp, dn, filenames in os.walk(PATH) for f in filenames if os.path.splitext(f)[1] in ['.cpp', '.h']]
|
|
for f in result:
|
|
try:
|
|
if str(f).endswith('.enc.h'):
|
|
continue
|
|
|
|
fix(f)
|
|
except:
|
|
print('failed: %s' % str(f)) |