mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 07:07:09 +00:00
Fix bug in sfxconvert.py (#553)
* Darkmeiro decompilation Bg_Gnd_Darkmeiro decompiled, matched, and documented. * give this a shot * fix conflict * one more try * could be useful * whoops * ZAP2 stuff * ZAP why * ZAP again * small fix to function parser * off by one error
This commit is contained in:
parent
bde4a411b3
commit
4f2259e24e
1 changed files with 6 additions and 15 deletions
|
@ -71,10 +71,7 @@ def fix_sfx_flag(id):
|
||||||
|
|
||||||
def fix_sfx_func(sourcedata, i, j, repo):
|
def fix_sfx_func(sourcedata, i, j, repo):
|
||||||
data = ''.join(sourcedata[i:j])
|
data = ''.join(sourcedata[i:j])
|
||||||
func = find_audio_func(data)
|
func = data.split('(')[0].strip()
|
||||||
if(not func):
|
|
||||||
print('Function parse error at line', i)
|
|
||||||
return -3
|
|
||||||
index = data.find(func)
|
index = data.find(func)
|
||||||
argnum = AudioFunctions.get(func,-1)
|
argnum = AudioFunctions.get(func,-1)
|
||||||
if(argnum == -1 or index == -1):
|
if(argnum == -1 or index == -1):
|
||||||
|
@ -96,6 +93,7 @@ def fix_sfx_func(sourcedata, i, j, repo):
|
||||||
|
|
||||||
def find_audio_func(line):
|
def find_audio_func(line):
|
||||||
audiofuncs = list(AudioFunctions.keys())
|
audiofuncs = list(AudioFunctions.keys())
|
||||||
|
funcname = line.split('(')[0].strip()
|
||||||
for func in audiofuncs:
|
for func in audiofuncs:
|
||||||
if(line.count(func)):
|
if(line.count(func)):
|
||||||
return func
|
return func
|
||||||
|
@ -132,16 +130,11 @@ def fix_sfx(file, repo, outfile = None):
|
||||||
if(i < j):
|
if(i < j):
|
||||||
continue
|
continue
|
||||||
if(find_audio_func(line)):
|
if(find_audio_func(line)):
|
||||||
if(line.count(';')):
|
j = i
|
||||||
j = i + 1
|
while(sourcedata[j].count(';') == 0):
|
||||||
else:
|
j += 1
|
||||||
j = i
|
|
||||||
while(sourcedata[j].count(';') == 0):
|
|
||||||
j += 1
|
|
||||||
status = fix_sfx_func(sourcedata, i, j + 1, repo)
|
status = fix_sfx_func(sourcedata, i, j + 1, repo)
|
||||||
if(status == -3):
|
if(status == -2):
|
||||||
funcerrors += 1
|
|
||||||
elif(status == -2):
|
|
||||||
iderrors += 1
|
iderrors += 1
|
||||||
elif(status == -1):
|
elif(status == -1):
|
||||||
lookuperrors += 1
|
lookuperrors += 1
|
||||||
|
@ -156,8 +149,6 @@ def fix_sfx(file, repo, outfile = None):
|
||||||
print('No changes made to', file)
|
print('No changes made to', file)
|
||||||
if(lookuperrors > 0):
|
if(lookuperrors > 0):
|
||||||
print('Problem with function lookup. Try formatting functions.h')
|
print('Problem with function lookup. Try formatting functions.h')
|
||||||
if(funcerrors > 0):
|
|
||||||
print('Problem with function parsing. Encountering this message should be impossible, so please report that you did.')
|
|
||||||
if(iderrors > 0):
|
if(iderrors > 0):
|
||||||
print('Problem with id parsing. Make sure your SFX ids are in hex.')
|
print('Problem with id parsing. Make sure your SFX ids are in hex.')
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue