From d897ac2bc46784e35e2c67b7d478526a944b681a Mon Sep 17 00:00:00 2001 From: David Benepe Date: Thu, 1 Dec 2022 16:37:37 -0500 Subject: [PATCH 1/2] Fixed score script --- tools/python/score.py | 46 ++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/tools/python/score.py b/tools/python/score.py index f4e9d09a..a9e07ddf 100644 --- a/tools/python/score.py +++ b/tools/python/score.py @@ -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' From e3d26356854ad1099d012067fb324faed8e3f3f9 Mon Sep 17 00:00:00 2001 From: David Benepe Date: Thu, 1 Dec 2022 16:49:21 -0500 Subject: [PATCH 2/2] Matched func_80028CD0 --- include/structs.h | 5 ++++- src/unknown_0255E0.c | 48 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/include/structs.h b/include/structs.h index 1454fb41..599f6f49 100644 --- a/include/structs.h +++ b/include/structs.h @@ -1397,7 +1397,10 @@ typedef struct ObjectSegment { union { /* 0x0034 */ f32 unk34; - /* 0x0034 */ s16 levelSegmentIndex; + struct { + /* 0x0034 */ s16 levelSegmentIndex; + /* 0x0036 */ s16 unk36; + }; } unk34_a; union { diff --git a/src/unknown_0255E0.c b/src/unknown_0255E0.c index 857555f2..66e8a8a3 100644 --- a/src/unknown_0255E0.c +++ b/src/unknown_0255E0.c @@ -138,9 +138,9 @@ s32 D_8011D2B8[20]; s32 D_8011D308; LevelModel *D_8011D30C; s32 *D_8011D310; -s32 D_8011D314; -s32 D_8011D318; -s32 D_8011D31C; +f32 D_8011D314; +f32 D_8011D318; +f32 D_8011D31C; s32 *D_8011D320[4]; unk8011D330 *D_8011D330; s32 D_8011D334; @@ -621,7 +621,47 @@ void render_skydome(void) { } } -GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_80028CD0.s") +void func_800B8C04(s32, s32, s32, s32, s32); + +void func_80028CD0(s32 updateRate) { + s32 i; + s32 numRacers; + s32 sp3C; + Object** racers; // sp38? + s32 temp_v0; + Object_Racer *racer; + + D_8011B0B0 = func_80069D20(); + sp3C = get_object_render_stack_pos(); + func_80031018(); + set_and_normalize_D_8011AFE8((f32) D_8011D468.x / 65536.0f, (f32) D_8011D468.y / 65536.0f, (f32) D_8011D468.z / 65536.0f); + temp_v0 = D_8011B0B0->segment.unk34_a.levelSegmentIndex; + if ((temp_v0 >= 0) && (temp_v0 < gCurrentLevelModel->numberOfSegments)) { + D_8011B0D4 = (s32) gCurrentLevelModel->segments[temp_v0].unk28; + } else { + D_8011B0D4 = -1; + } + D_8011D314 = D_8011B0B0->segment.trans.x_position; + D_8011D318 = D_8011B0B0->segment.trans.y_position; + D_8011D31C = D_8011B0B0->segment.trans.z_position; + if (D_8011D384 != 0) { + func_800B8B8C(); + racers = get_racer_objects(&numRacers); + if ((D_8011B0B0->segment.unk34_a.unk36 != 7) && (numRacers > 0) && (!check_if_showing_cutscene_camera())) { + i = -1; + do { + i++; + racer = &racers[i]->unk64->racer; + } while((i < (numRacers - 1)) && (sp3C != (racer->playerIndex))); + func_800B8C04(racers[i]->segment.trans.x_position, racers[i]->segment.trans.y_position, racers[i]->segment.trans.z_position, get_object_render_stack_pos(), updateRate); + } else { + func_800B8C04((s32) D_8011B0B0->segment.trans.x_position, (s32) D_8011B0B0->segment.trans.y_position, (s32) D_8011B0B0->segment.trans.z_position, get_object_render_stack_pos(), updateRate); + } + } + get_current_level_header()->unk3 = 1; + render_level_geometry_and_objects(); +} + void func_80028FA0(s32 arg0) { D_8011B0FC = arg0;