diff --git a/pop-fe-ps3.py b/pop-fe-ps3.py old mode 100644 new mode 100755 index 2f344fd..94963cd --- a/pop-fe-ps3.py +++ b/pop-fe-ps3.py @@ -82,7 +82,7 @@ def __init__(self, master=None): self.pkgdir = None self.data_track_only = 'off' self.configs = [] - self.subdir = 'pop-fe-ps3-work' + self.subdir = 'pop-fe-ps3-work/' self.master = master self.builder = builder = pygubu.Builder() @@ -389,25 +389,6 @@ def on_path_changed(self, event): img_file = self.subdir + mb + '.bin' temp_files.append(img_file) - print('Generating cu2') if verbose else None - cu2_file = cue_file[:-4] + '.cu2' - try: - os.stat(cu2_file).st_size - print('Using existing CU2 file: %s' % cu2_file) if verbose else None - except: - cu2_file = self.subdir + 'CUE' + disc + '.cu2' - print('Creating temporary CU2 file %s from %s' % (cu2_file, cue_file)) if verbose else None - if os.name == 'posix': - subprocess.call(['python3', './cue2cu2.py', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) - else: - subprocess.call(['cue2cu2.exe', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) - temp_files.append(cu2_file) - try: - os.stat(cu2_file).st_size - except: - print('Failed to convert to cu2. The cue file is probably from a bad dump.') - raise Exception('Bad dump CUE, can not convert to CU2') - print('Scanning for Game ID') if verbose else None tmp = self.subdir + 'TMP01.iso' disc_id = get_disc_id(cue_file, tmp) @@ -418,7 +399,6 @@ def on_path_changed(self, event): self.disc_ids.append(disc_id) self.real_disc_ids.append(disc_id) self.cue_files.append(cue_file) - self.cu2_files.append(cu2_file) self.configs.append(bytes()) try: @@ -790,10 +770,11 @@ def on_create_pkg(self): # # Apply all PPF fixes we might need - # XXX should we re-generate cu2 to after this? # self.cue_files, self.img_files = popfe.apply_ppf_fixes(self.real_disc_ids, self.cue_files, self.img_files, self.subdir) + self.cu2_files = popfe.generate_cu2_files(self.cue_files, self.img_files, self.subdir) + popfe.create_ps3(pkg, disc_ids, title, self.icon0 if self.icon0_disc=='off' else self.disc, self.pic0 if self.pic0_disabled =='off' else None, diff --git a/pop-fe-psp.py b/pop-fe-psp.py old mode 100644 new mode 100755 index 9476046..00443ca --- a/pop-fe-psp.py +++ b/pop-fe-psp.py @@ -238,19 +238,6 @@ def on_path_changed(self, event): img_file = self.subdir + mb + '.bin' temp_files.append(img_file) - print('Generating cu2') if verbose else None - cu2_file = cue_file[:-4] + '.cu2' - try: - os.stat(cu2_file).st_size - print('Using existing CU2 file: %s' % cu2_file) if verbose else None - except: - cu2_file = self.subdir + 'CUE' + disc + '.cu2' - print('Creating temporary CU2 file %s from %s' % (cu2_file, cue_file)) if verbose else None - if os.name == 'posix': - subprocess.call(['python3', './cue2cu2.py', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) - else: - subprocess.call(['cue2cu2.exe', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) - temp_files.append(cu2_file) print('Scanning for Game ID') if verbose else None tmp = self.subdir + 'TMP01.iso' disc_id = get_disc_id(cue_file, tmp) @@ -263,7 +250,6 @@ def on_path_changed(self, event): self.disc_ids.append(disc_id) self.real_disc_ids.append(disc_id) self.cue_files.append(cue_file) - self.cu2_files.append(cu2_file) if disc == 'd1': self.builder.get_object('discid1', self.master).config(state='normal') @@ -524,10 +510,11 @@ def on_create_eboot(self): # # Apply all PPF fixes we might need - # XXX should we re-generate cu2 to after this? # self.cue_files, self.img_files = popfe.apply_ppf_fixes(self.real_disc_ids, self.cue_files, self.img_files, self.subdir) + self.cu2_files = popfe.generate_cu2_files(self.cue_files, self.img_files, self.subdir) + popfe.create_psp(ebootdir, self.disc_ids, title, self.icon0, self.pic0 if self.pic0_disabled =='off' else None, diff --git a/pop-fe.py b/pop-fe.py index 8fed7d3..a32f8ea 100755 --- a/pop-fe.py +++ b/pop-fe.py @@ -1926,7 +1926,30 @@ def apply_ppf_fixes(real_disc_ids, cue_files, img_files, subdir): ApplyPPF(img_files[i], ppf_fixes[disc_id]['ppf']) return cue_files, img_files + +def generate_cu2_files(cue_files, img_files, subdir): + cu2_files = [] + + for i in range(len(cue_files)): + cue_file = cue_files[i] + img_file = img_files[i] + cu2_file = cue_file[:-4] + '.cu2' + try: + os.stat(cu2_file).st_size + print('Using existing CU2 file: %s' % cu2_file) if verbose else None + except: + cu2_file = subdir + 'TMP%d.cu2' % (i) + print('Creating temporary CU2 file: %s' % cu2_file) if verbose else None + if os.name == 'posix': + subprocess.call(['python3', './cue2cu2.py', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) + else: + subprocess.call(['cue2cu2.exe', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) + temp_files.append(cu2_file) + cu2_files.append(cu2_file) + return cu2_files + + # ICON0 is the game cover # PIC0 is logo # PIC1 is background image/poster @@ -2149,22 +2172,8 @@ def apply_ppf_fixes(real_disc_ids, cue_files, img_files, subdir): img_file = subdir + mb + '.bin' temp_files.append(img_file) - cu2_file = cue_file[:-4] + '.cu2' - try: - os.stat(cu2_file).st_size - print('Using existing CU2 file: %s' % cu2_file) if verbose else None - except: - cu2_file = subdir + 'TMP%d.cu2' % (0 if not idx else idx[0]) - print('Creating temporary CU2 file: %s' % cu2_file) if verbose else None - if os.name == 'posix': - subprocess.call(['python3', './cue2cu2.py', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) - else: - subprocess.call(['cue2cu2.exe', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file]) - temp_files.append(cu2_file) - img_files.append(img_file) cue_files.append(cue_file) - cu2_files.append(cu2_file) if args.psp_dir or args.ps3_pkg or args.retroarch_pbp_dir: bc = bchunk() @@ -2218,10 +2227,11 @@ def apply_ppf_fixes(real_disc_ids, cue_files, img_files, subdir): ps3configs[i] = ps3configs[i] + f.read() # # Apply all PPF fixes we might need - # XXX should we generation of cu2 to after this? # cue_files, img_files = apply_ppf_fixes(real_disc_ids, cue_files, img_files, subdir) + cu2_files = generate_cu2_files(cue_files, img_files, subdir) + if args.game_id: args.game_id = args.game_id.split(',') if args.psp_install_memory_card: