mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Merge pull request #87 from AntonioCastelli/data-split-tool
Fixed issues with data region splitter.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* The comment below is needed for this file to be picked up by generate_ld */
|
||||
/* RAM_POS: 0x80076BA0*/
|
||||
/* RAM_POS: 0x80076BA0 */
|
||||
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* The comment below is needed for this file to be picked up by generate_ld */
|
||||
/* RAM_POS: 0x8009EC70 */
|
||||
/* RAM_POS: 0x8007F900 */
|
||||
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
|
||||
@@ -8,6 +8,10 @@ from file_util import FileUtil
|
||||
DATA_FILE_PATH = 'data/dkr.data.s'
|
||||
GLABEL_REGEX = r'D_[0-9A-F]{8}'
|
||||
GLABEL_DEF_REGEX = r'glabel (%s)' % GLABEL_REGEX
|
||||
# List of labels that are not used in the file they are defined in.
|
||||
# This throws off the splitter algorithm, so the troublesome ones
|
||||
# must be individually blacklisted for now.
|
||||
IGNORE_GLABELS = ['D_800E0001']
|
||||
|
||||
def _rom_offset(vaddr):
|
||||
"""
|
||||
@@ -25,7 +29,8 @@ def _get_glabels():
|
||||
Returns all the glabel definitions in the data file.
|
||||
"""
|
||||
data_file = FileUtil.get_text_from_file(DATA_FILE_PATH)
|
||||
return re.findall(GLABEL_DEF_REGEX, data_file)
|
||||
glabels = re.findall(GLABEL_DEF_REGEX, data_file)
|
||||
return [glabel for glabel in glabels if glabel not in IGNORE_GLABELS]
|
||||
|
||||
def _get_file_offset(file, contents):
|
||||
"""
|
||||
@@ -62,7 +67,8 @@ def _log_glabel_usage(glabels):
|
||||
c_file_offsets.append((file, offset))
|
||||
matches = re.findall(GLABEL_REGEX, contents)
|
||||
for glabel in matches:
|
||||
usage[glabel].add(offset)
|
||||
if glabel in usage:
|
||||
usage[glabel].add(offset)
|
||||
except:
|
||||
pass
|
||||
for glabel in usage:
|
||||
|
||||
Reference in New Issue
Block a user