Skip to content

Commit

Permalink
Nicely print BCD version
Browse files Browse the repository at this point in the history
  • Loading branch information
rejunity committed Nov 7, 2023
1 parent 658f80e commit 4ca1c23
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/vgmparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,5 +746,13 @@ def validate_vgm_data(self):
self.data.seek(original_pos)

def validate_vgm_version(self):
def bcd_version_to_str(bcd):
version = ""
while bcd > 0:
version = str(bcd & 15) + version
bcd >>= 4
return version

if self.metadata['version'] not in self.supported_ver_list:
raise VersionError('VGM version ' + str(self.metadata['version']//256) + '.' + str(self.metadata['version']&255) + ' is not supported')
version = self.metadata['version']
raise VersionError(f'VGM version {bcd_version_to_str(version>>8)}.{bcd_version_to_str(version&255)} is not supported')

0 comments on commit 4ca1c23

Please sign in to comment.