1
0
mirror of synced 2025-01-23 22:54:08 +01:00

writers.py: Remove unnecessary preallocation step

This commit is contained in:
Viv 2023-07-19 17:44:05 -04:00
parent 9ce1d76ca3
commit e38fc4d666

View File

@ -10,21 +10,6 @@ def writeFumen(path_out, song):
file = open(path_out, "wb")
file.write(song.header.raw_bytes) # Write header padding bytes
# Preallocate space in the file
len_measures = 0
for measureNumber in range(len(song.measures)):
len_measures += 40
measure = song.measures[measureNumber]
for branchNumber in range(len(branchNames)):
len_measures += 8
branch = measure.branches[branchNames[branchNumber]]
for noteNumber in range(branch.length):
len_measures += 24
note = branch.notes[noteNumber]
if note.type.lower() == "drumroll":
len_measures += 8
file.write(b'\x00' * len_measures)
# Write measure data
file.seek(0x208)
for measureNumber in range(len(song.measures)):