mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Fixed score script
This commit is contained in:
+30
-16
@@ -2,30 +2,44 @@ import re
|
||||
import sys
|
||||
import argparse
|
||||
import time
|
||||
import os
|
||||
from file_util import FileUtil
|
||||
from score_display import ScoreDisplay
|
||||
|
||||
ASM_FOLDERS = [
|
||||
'./asm/unknown_0251F0',
|
||||
'./asm/unknown_031D30',
|
||||
'./asm/unknown_062930',
|
||||
'./asm/unknown_070110',
|
||||
'./asm/gzip',
|
||||
'./asm',
|
||||
'./lib/asm',
|
||||
'./lib/asm/exception',
|
||||
]
|
||||
|
||||
BLACKLIST = [
|
||||
'/non_matchings/'
|
||||
]
|
||||
|
||||
filelist = []
|
||||
|
||||
for asmDir in ASM_FOLDERS:
|
||||
for root, dirs, files in os.walk(asmDir):
|
||||
for file in files:
|
||||
fullPath = os.path.join(root,file)
|
||||
skipThis = False
|
||||
for blackListEntry in BLACKLIST:
|
||||
if blackListEntry in fullPath:
|
||||
skipThis = True
|
||||
break
|
||||
if not skipThis and fullPath.endswith('.s'):
|
||||
filelist.append(fullPath)
|
||||
|
||||
# These will automatically be added to the adventure one percentage.
|
||||
ASM_LABELS = [ 'entrypoint' ]
|
||||
for folder in ASM_FOLDERS:
|
||||
GLABEL_REGEX = r'glabel ([0-9A-Za-z_]+)'
|
||||
filenames = FileUtil.get_filenames_from_directory(folder, extensions=('.s',))
|
||||
for filename in filenames:
|
||||
with open(folder + '/' + filename, 'r') as asmFile:
|
||||
text = asmFile.read()
|
||||
matches = re.finditer(GLABEL_REGEX, text, re.MULTILINE)
|
||||
for matchNum, match in enumerate(matches, start=1):
|
||||
ASM_LABELS.append(match.groups()[0])
|
||||
ASM_LABELS = []
|
||||
GLABEL_REGEX = r'glabel ([0-9A-Za-z_]+)'
|
||||
for filename in filelist:
|
||||
with open(filename, 'r') as asmFile:
|
||||
text = asmFile.read()
|
||||
matches = re.finditer(GLABEL_REGEX, text, re.MULTILINE)
|
||||
for matchNum, match in enumerate(matches, start=1):
|
||||
glabel = match.groups()[0]
|
||||
if not glabel in ASM_LABELS:
|
||||
ASM_LABELS.append(glabel)
|
||||
|
||||
BUILD_DIRECTORY = './build/us_1.0'
|
||||
SRC_DIRECTORY = './src'
|
||||
|
||||
Reference in New Issue
Block a user