mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Splat merge (#470)
* First pass * Fix n64crc and add submodules properly * Fix other versions * Match func_8005B818 for v80 code. * Formatting * Fix build for JPN in last commit. Still broken in post v77 roms though. * Fix builds for other versions. * Match load_menu_text for other versions. * Fix progress script * update m2c * Modify asset tools to remove the LD script code. * Fix asm file macro inclue * Get a working splat version for us_1.0 to build from the assets tool. * update asm differ * Update tools again * Fix the makefile to only compile assets when requested. This will build all versions successfully, and compile assets for us_1.0 when requested. * First round of suggestions * Small cleanup * Fix the gcc_generate.py path. * Make entrypointThreadStack * Small addition to the last commit * "Fix" score script. Still need to fix the score values themselves, but at least it runs and is kind of close. * Much closer matching score script * Fix the splat version due to a breaking change in 0.33.0 for this repo for now. * Fix the main function name * Add gitignore entries * Fix the padding problem to be handled by objcopy instead of a binary pad from splat. * Update the README and change dependencies to setup. * Have a hasm header that can be tweaked. * Still calculate the checksum on no_verify builds or they won't work. * Add support for boot_custom.bin * Fix custom boot ld code. * Fix score script * Fix gcc building. * Update m2c * Fix warning, stop ignoring mod assets, and add some handy make rules. * Uggh, serves me right for not testing. * First stab at modifiable entrypoint. * Fix typo, and small README change * Stop n64crd from defaulting to returning 6105, so we can properly fail if the CIC checksum fails. Also, fix the * Extract custom boot script * Update automated scripts. * Woops, fixed the MAXCONTROLLERS thing now. * Add the method for building binutils back. Sorry! * Only use -m32 when the longbit says we're on a 64 bit platform. * Woops.... * Hopefully fix arm detection for raspi ido downloads.
This commit is contained in:
+30
-14
@@ -8,13 +8,20 @@ from score_display import ScoreDisplay
|
||||
|
||||
ASM_FOLDERS = [
|
||||
'./asm',
|
||||
'./lib/asm',
|
||||
'./src/hasm',
|
||||
'./libultra/src/gu',
|
||||
'./libultra/src/libc',
|
||||
'./libultra/src/os',
|
||||
]
|
||||
|
||||
BLACKLIST = [
|
||||
'/non_matchings/',
|
||||
'/nonmatchings/',
|
||||
'/assets/',
|
||||
'/boot/'
|
||||
'/boot/',
|
||||
'/data/',
|
||||
'/header.s',
|
||||
'/llmuldiv_gcc.s',
|
||||
'/libm_vals.s'
|
||||
]
|
||||
|
||||
BLACKLIST_C = [
|
||||
@@ -38,7 +45,7 @@ for asmDir in ASM_FOLDERS:
|
||||
|
||||
# These will automatically be added to the adventure one percentage.
|
||||
ASM_LABELS = []
|
||||
GLABEL_REGEX = r'glabel ([0-9A-Za-z_]+)'
|
||||
GLABEL_REGEX = r'glabel|leaf ([0-9A-Za-z_]+)'
|
||||
for filename in filelist:
|
||||
with open(filename, 'r') as asmFile:
|
||||
text = asmFile.read()
|
||||
@@ -48,12 +55,12 @@ for filename in filelist:
|
||||
if not glabel in ASM_LABELS:
|
||||
ASM_LABELS.append(glabel)
|
||||
|
||||
BUILD_DIRECTORY = './build/us_1.0'
|
||||
BUILD_DIRECTORY = './build'
|
||||
SRC_DIRECTORY = './src'
|
||||
LIB_SRC_DIRECTORY = './lib/src'
|
||||
FUNCTION_REGEX = r'^(?<!static\s)(?:(\/[*][*!][*]*\n(?:[^/]*\n)+?\s*[*]\/\n)(?:\s*)*?)?(?:\s*UNUSED\s+)?([^\s]+)\s(?:\s|[*])*?([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{'
|
||||
GLOBAL_ASM_REGEX = r'GLOBAL_ASM[(]".*(?=\/)\/([^.]+).s"[)]'
|
||||
WIP_REGEX = r'#ifdef\s+(?:NON_MATCHING|NON_EQUIVALENT)(?:.|\n)*?#else\s*(GLOBAL_ASM[(][^)]*[)])(.|\n)*?#endif'
|
||||
LIB_SRC_DIRECTORY = './libultra/src'
|
||||
FUNCTION_REGEX = r'^(?<!static\s)(?:(\/[*][*!][*]*\n(?:[^\/]*\n)+?\s*[*]\/\n)(?:\s*)*?)?(?:\s*UNUSED\s+)?([^\s]+)\s(?:\s|[*])*?([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{'
|
||||
GLOBAL_ASM_REGEX = r'\#pragma\sGLOBAL_ASM[(]".*(?=\/)\/([^.]+).s"[)]'
|
||||
WIP_REGEX = r'ifdef\s+(?:NON_MATCHING|NON_EQUIVALENT)(?:.|\n)*?\#else\s*(\#pragma\sGLOBAL_ASM[(][^)]*[)])(.|\n)*?'
|
||||
NON_MATCHING_REGEX = re.compile(r'^#ifdef[ ]+NON_MATCHING(?:.|\n)*?(?:\s*UNUSED\s+)?(?:[^\s]+)\s(?:\s|[*])*?([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{', re.MULTILINE)
|
||||
NON_EQUVIALENT_REGEX = re.compile(r'^#ifdef[ ]+NON_EQUIVALENT', re.MULTILINE)
|
||||
|
||||
@@ -64,15 +71,20 @@ CODE_SIZE = CODE_END - CODE_START
|
||||
class DkrMapFile:
|
||||
def __init__(self):
|
||||
try:
|
||||
with open(BUILD_DIRECTORY + '/dkr.map', 'r') as mapFile:
|
||||
with open(BUILD_DIRECTORY + '/dkr.us.v77.map', 'r') as mapFile:
|
||||
self.functionSizes = {}
|
||||
functions = []
|
||||
lines = mapFile.read().split('\n')
|
||||
for line in lines:
|
||||
if line.startswith(' 0x8'):
|
||||
lineSet = 0
|
||||
if line.startswith(' 0x00000000'):
|
||||
lineSet = 26
|
||||
elif line.startswith(' 0x8'):
|
||||
lineSet = 18
|
||||
if (lineSet != 0):
|
||||
if '=' in line:
|
||||
line = line[0:line.find('=')-1]
|
||||
address = int(line[18:18+8], 16)
|
||||
address = int(line[lineSet:lineSet+8], 16)
|
||||
if address >= CODE_START and address < CODE_END:
|
||||
symbol = line[line.rfind(' ')+1:]
|
||||
if (not symbol.startswith(".L") and not symbol.startswith("L800")
|
||||
@@ -89,14 +101,18 @@ class DkrMapFile:
|
||||
|
||||
|
||||
def contains_forbidden_func(self, string):
|
||||
for forbidden in ['__FUNC_RAM_START', 'cosf', 'sinf']:
|
||||
for forbidden in ['__FUNC_RAM_START', 'cosf', 'sinf', 'main_VRAM', 'main_TEXT_START', '.']:
|
||||
if forbidden in string:
|
||||
return True
|
||||
return False
|
||||
|
||||
MAP_FILE = DkrMapFile()
|
||||
|
||||
NOT_FUNCTION_NAMES = ['if', 'else', 'switch', 'while', 'for']
|
||||
# Adding regional and other version functions here to ignore since we're only scoring US_1.0 for now.
|
||||
NOT_FUNCTION_NAMES = ['if', 'else', 'switch', 'while', 'for', 'dmacopy_internal', 'func_80082BC8_837C8', 'rumble_enable',
|
||||
'func_800C6464_C7064', 'func_800C663C_C723C', 'func_800C67F4_C73F4', 'func_800C6870_C7470',
|
||||
'func_800C68CC_C74CC', 'func_800C6DD4_C79D4', 'func_800C7744_C8344', 'func_800C7804_C8404',
|
||||
'func_800C7864_C8464', 'func_800C78E0_C84E0']
|
||||
|
||||
class ScoreFileMatch:
|
||||
def __init__(self, comment, functionName):
|
||||
|
||||
Reference in New Issue
Block a user