From 1d1ea907c91ee87ab53bfa1714e4d3230d577fd3 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 8 Oct 2022 21:53:23 -0400 Subject: [PATCH] scripts: prevent infinite loop when preserved block can't be found (#1946) --- decompiler/config/jak2/all-types.gc | 4 ++-- scripts/gsrc/code_retention/all_types_retention.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 80071fedfa..ed856b5f20 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -32838,7 +32838,7 @@ ;; elevator ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; +++elevator-flags +;; +++elevator:elevator-flags (defenum elevator-flags :type uint64 :bitfield #t @@ -32851,7 +32851,7 @@ (elevator-flags-6) (elevator-flags-7) ) -;; ---elevator-flags +;; ---elevator:elevator-flags (deftype elevator-params (structure) ((xz-threshold float :offset-assert 0) diff --git a/scripts/gsrc/code_retention/all_types_retention.py b/scripts/gsrc/code_retention/all_types_retention.py index dc436bc8bc..4b791d8607 100644 --- a/scripts/gsrc/code_retention/all_types_retention.py +++ b/scripts/gsrc/code_retention/all_types_retention.py @@ -71,8 +71,10 @@ def update_all_blocks(game_name, block_dict): final_lines.append(line) block_id = line.split(";; +++")[1] # Look to see if we actually have that block + found_block = False for block in blocks: if block.block_id == block_id: + found_block = True # if we found the block, write the data, then proceed ahead until the end for block_line in block.data: final_lines.append(block_line) @@ -84,6 +86,8 @@ def update_all_blocks(game_name, block_dict): i = i + 1 break break + if not found_block: + i = i + 1 else: final_lines.append(line) i = i + 1