2021-12-27 19:23:03 +00:00
|
|
|
import os
|
|
|
|
import re
|
2022-02-17 21:15:00 +00:00
|
|
|
from oot import *
|
2021-12-27 19:23:03 +00:00
|
|
|
|
|
|
|
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)
|
2022-02-17 21:15:00 +00:00
|
|
|
|
|
|
|
PATH = assetPath()
|
2022-02-14 03:48:28 +00:00
|
|
|
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']]
|
2021-12-27 19:23:03 +00:00
|
|
|
for f in result:
|
|
|
|
try:
|
2022-02-17 21:15:00 +00:00
|
|
|
if str(f).endswith('.enc.h'):
|
|
|
|
continue
|
|
|
|
|
2021-12-27 19:23:03 +00:00
|
|
|
fix(f)
|
|
|
|
except:
|
|
|
|
print('failed: %s' % str(f))
|