Skip to content

Commit

Permalink
util: removed PCM block merging which isn't needed anymore
Browse files Browse the repository at this point in the history
It also caused issues of its own
dan-rodrigues committed Apr 1, 2021
1 parent 84a4081 commit 67fecf9
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions scripts/vgm_preprocess.py
Original file line number Diff line number Diff line change
@@ -54,30 +54,6 @@ def sort_pcm_blocks(self, assume_unified_pcm):
b_offset = 0 if assume_unified_pcm else 0x1000000
sorted(self.pcm_blocks, key=lambda block: block.offset + b_offset if block.type == PCMType.B else 0)

def merge_contiguous_pcm_blocks(self):
last_end_address = None
indexes_to_remove = []

for i in range(0, len(self.pcm_blocks)):
block = self.pcm_blocks[i]
if last_end_address is None:
last_end_address = block.offset + len(block.data)
continue

if last_end_address == block.offset:
# Blocks needs merging to prevent discontinuity when rebasing
merged_block = self.pcm_blocks[i - 1]
merged_block.data.extend(block.data)
indexes_to_remove.append(i)

last_end_address = block.offset + len(block.data)

indexes_to_remove.reverse()
for i in indexes_to_remove:
del self.pcm_blocks[i]

print("Merged {:d} PCM blocks".format(len(indexes_to_remove)))

def rebase_pcm_blocks(self):
base = 0

@@ -157,8 +133,6 @@ def preprocess_pcm(self, pcm_bank_address_indexes, total_size):
# PCM blocks need sorting according to their position and type..
assume_unified_pcm = (total_size >= 0x400000)
self.sort_pcm_blocks(assume_unified_pcm)
# ..then possibly merged into contiguous blocks..
self.merge_contiguous_pcm_blocks()
# ..then offsets need adjusting from a zero-base..
self.rebase_pcm_blocks()
# ..then the address high bytes need adjusting according to the newly sorted position

0 comments on commit 67fecf9

Please sign in to comment.