From cb01d04a147057263f7730957d04fe6e81e72131 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 14 Aug 2023 14:02:26 +1000 Subject: [PATCH] Don't convert SND0 if it is already in AT3 format Signed-off-by: Ronnie Sahlberg --- pop-fe.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pop-fe.py b/pop-fe.py index 781ad1c..da3055c 100755 --- a/pop-fe.py +++ b/pop-fe.py @@ -380,6 +380,7 @@ def convert_snd0_to_at3(snd0, at3, duration, max_size, subdir = './'): subprocess.run(['atracdenc/src/atracdenc', '--encode=atrac3', '-i', tmp_wav, '-o', tmp_snd0], check=True) except: print('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\natracdenc not found.\nCan not create SND0.AT3\nPlease see README file for how to install atracdenc\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + return None print('Converting EA3 to AT3 file') if verbose else None temp_files.append(at3) create_riff(tmp_snd0, at3, number_of_samples=int(len(s['data']['data'])/4), max_data_size=0, loop=True) @@ -878,6 +879,15 @@ def create_psp(dest, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_fil True snd0_data = None + if snd0: + # Check if it is already in ATRAC3 format + with open(snd0, 'rb') as s: + buf = s.read(36) + if buf[:4] == b'RIFF' and buf[8:12] == b'WAVE' and struct.unpack_from('