mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Added bss for unknown_001050, unknown_003260, and unknown_005740
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import re
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
@@ -55,6 +56,55 @@ def fixDoubleLoads():
|
||||
i += 1
|
||||
save_syms(syms)
|
||||
|
||||
#fixBadLabel()
|
||||
fixDoubleLoads()
|
||||
def getMatches(string, regex):
|
||||
out = []
|
||||
matches = re.finditer(regex, string, re.MULTILINE)
|
||||
for matchNum, match in enumerate(matches, start=1):
|
||||
start = match.start()
|
||||
end = match.end()
|
||||
out.append((string[start:end], match.groups(), (start, end)))
|
||||
return out
|
||||
|
||||
FILE_REGEX = r"(?:lib/)?(?:(?:src/)|(?:asm/non_matchings/))([^/.]*)"
|
||||
def getFiles(symbol):
|
||||
command = subprocess.run(['fgrep', '-ri', symbol], capture_output=True)
|
||||
outLines = command.stdout.decode("utf-8").split('\n')
|
||||
fileNames = []
|
||||
for outLine in outLines:
|
||||
if 'src' in outLine or 'asm' in outLine:
|
||||
match = getMatches(outLine, FILE_REGEX)[0][1][0]
|
||||
if match not in fileNames:
|
||||
fileNames.append(match)
|
||||
return fileNames
|
||||
|
||||
def getBss():
|
||||
currentFile = ''
|
||||
out = []
|
||||
syms = load_syms()
|
||||
for sym in syms:
|
||||
if ' = ' in sym:
|
||||
symSplit = sym.split(' = ')
|
||||
symbol = symSplit[0]
|
||||
address = int(symSplit[1][2:-1], 16)
|
||||
if address >= 0x80115CE8 and address <= 0x8012D3F0:
|
||||
try:
|
||||
files = getFiles(symbol)
|
||||
if currentFile not in files:
|
||||
if len(files) == 1:
|
||||
if currentFile != '':
|
||||
out.append('\n')
|
||||
currentFile = files[0]
|
||||
out.append(currentFile)
|
||||
else:
|
||||
print(symbol, files, 'Cannot tell which file to use!')
|
||||
except IndexError:
|
||||
print('Error with symbol: ' + symbol)
|
||||
out.append(sym)
|
||||
with open('bss.txt', 'w') as outFile:
|
||||
outFile.write('\n'.join(out))
|
||||
|
||||
|
||||
fixBadLabel()
|
||||
#fixDoubleLoads()
|
||||
#getBss()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user