Skip to content

Commit

Permalink
Add support to use CDDA tracks instead of ATRACK3 for PSP
Browse files Browse the repository at this point in the history
This because some games (V-Rally 2) depends on the feature of the audio
player that IF you tell it to play audio track #n, then when that track
ends it should automatically start playing the next track.
This does not happen for ATRAC3 audio on PSP so we need to switch that game
to use the raw CDDA tracks instead.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
  • Loading branch information
sahlberg committed Oct 21, 2023
1 parent 8d71cb1 commit bf4ae9b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
7 changes: 7 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ Command line arguments are:
contains a PSP or VITA memory card.
--psp-install-memory-card : Used to install memory card images on the PSP.
See memory card section below for usage.
--psp-use-cdda : With this setting the PSP EBOOT will be created
containing the full CDDA tracks but no ATRAC3
tracks will be injected.
This is helpful for games on PSP that depend on
the "cdrom" to automatically play the next track
when the current track ends, which PSP does not do
automatically for ATRAC3 audio files.
--ps2-dir : This is the directory that holds the USB stick to
install VCD files for running under POPS on a PS2.
--ps3-pkg : This creates a PS3 PKG
Expand Down
6 changes: 6 additions & 0 deletions gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
'pic0': 'https://images.launchbox-app.com/5171a09b-e88b-4b70-a673-e079d8d2a9b3.png',
'pic1': 'https://images.launchbox-app.com/8dda9b1c-e3e9-4c33-9947-85257f50742d.jpg',
'pspconfig': 'pspconfigs/V-Rally 2/SLPS-02516.bin',
'psp-use-cdda': True,
},
'SLPS91467': {
'url': "games/J/V/SLPS-91467.html",
Expand All @@ -177,6 +178,7 @@
'pic0': 'https://images.launchbox-app.com/5171a09b-e88b-4b70-a673-e079d8d2a9b3.png',
'pic1': 'https://images.launchbox-app.com/8dda9b1c-e3e9-4c33-9947-85257f50742d.jpg',
'pspconfig': 'pspconfigs/V-Rally 2/SLPS-91467.bin',
'psp-use-cdda': True,
},
'SLPM80500': {
'url': "games/J/V/SLPS-91467.html",
Expand All @@ -185,6 +187,7 @@
'pic0': 'https://images.launchbox-app.com/5171a09b-e88b-4b70-a673-e079d8d2a9b3.png',
'pic1': 'https://images.launchbox-app.com/8dda9b1c-e3e9-4c33-9947-85257f50742d.jpg',
'pspconfig': 'pspconfigs/V-Rally 2/SLPM-80500.bin',
'psp-use-cdda': True,
},
'SLPS00103': {
'url': "games/J/V/SLPS-00103.html",
Expand Down Expand Up @@ -12010,6 +12013,7 @@
'pic0': 'https://images.launchbox-app.com/79c6e6c0-102c-4c09-8d4c-51c67d41f663.png',
'pic1': 'https://images.launchbox-app.com/8dda9b1c-e3e9-4c33-9947-85257f50742d.jpg',
'pspconfig': 'pspconfigs/V-Rally 2/SLUS-01003.bin',
'psp-use-cdda': True,
},
'SLUS00218': {
'url': "games/U/V/SLUS-00218.html",
Expand Down Expand Up @@ -32431,6 +32435,7 @@
'pic0': 'https://images.launchbox-app.com/5171a09b-e88b-4b70-a673-e079d8d2a9b3.png',
'pic1': 'https://images.launchbox-app.com/8dda9b1c-e3e9-4c33-9947-85257f50742d.jpg',
'pspconfig': 'pspconfigs/V-Rally 2/SLED-02124.bin',
'psp-use-cdda': True,
},
'SLES01907': {
'url': "games/P/V/SLES-01907.html",
Expand All @@ -32439,6 +32444,7 @@
'pic0': 'https://images.launchbox-app.com/5171a09b-e88b-4b70-a673-e079d8d2a9b3.png',
'pic1': 'https://images.launchbox-app.com/8dda9b1c-e3e9-4c33-9947-85257f50742d.jpg',
'pspconfig': 'pspconfigs/V-Rally 2/SLES-01907.bin',
'psp-use-cdda': True,
},
'SLES00545': {
'url': "games/P/V/SLES-00545.html",
Expand Down
12 changes: 11 additions & 1 deletion pop-fe-psp.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(self, master=None):
self.pic1_tk = None
self.pkgdir = None
self.watermark = 'on'
self.cdda = 'off'
self.pic0_disabled = 'off'
self.snd0_disabled = 'off'
self.configs = []
Expand All @@ -92,6 +93,7 @@ def __init__(self, master=None):
'on_youtube_audio': self.on_youtube_audio,
'on_create_eboot': self.on_create_eboot,
'on_reset': self.on_reset,
'on_cdda': self.on_cdda,
'on_theme_selected': self.on_theme_selected,
}

Expand Down Expand Up @@ -149,6 +151,7 @@ def init_data(self):
self.preview_tk = None
self.configs = []
self.builder.get_variable('watermark_variable').set(self.watermark)
self.builder.get_variable('cdda_variable').set(self.cdda)
for idx in range(1,6):
self.builder.get_object('discid%d' % (idx), self.master).config(state='disabled')
for idx in range(1,5):
Expand Down Expand Up @@ -330,6 +333,10 @@ def on_path_changed(self, event):
self.cue_files.append(cue_file)
self.configs.append(bytes())

if disc_id in games and 'psp-use-cdda' in games[disc_id]:
self.cdda = 'on'
self.builder.get_variable('cdda_variable').set(self.cdda)

if disc_id in games and 'pspconfig' in games[disc_id]:
print('Found an external config for', disc_id)
with open(games[disc_id]['pspconfig'], 'rb') as f:
Expand Down Expand Up @@ -548,7 +555,8 @@ def on_create_eboot(self):
aea_files, subdir=self.subdir, snd0=snd0,
watermark=True if self.watermark=='on' else False,
subchannels=subchannels, manual=manual,
configs=self.configs)
configs=self.configs,
use_cdda=True if self.cdda=='on' else False)
self.master.config(cursor='')

d = FinishedDialog(self.master)
Expand All @@ -558,6 +566,8 @@ def on_create_eboot(self):
def on_reset(self):
self.init_data()

def on_cdda(self):
self.cdda = self.builder.get_variable('cdda_variable').get()

if __name__ == "__main__":
parser = argparse.ArgumentParser()
Expand Down
14 changes: 14 additions & 0 deletions pop-fe-psp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,20 @@
</layout>
</object>
</child>
<child>
<object class="ttk.Checkbutton" id="cdda">
<property name="command" type="command" cbtype="simple">on_cdda</property>
<property name="offvalue">off</property>
<property name="onvalue">on</property>
<property name="text" translatable="yes">Use CDDA, not ATRAC3</property>
<property name="variable">string:cdda_variable</property>
<layout manager="grid">
<property name="column">1</property>
<property name="row">0</property>
<property name="sticky">w</property>
</layout>
</object>
</child>
</object>
</child>
</object>
Expand Down
13 changes: 10 additions & 3 deletions pop-fe.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ def generate_pbp(dest_file, disc_ids, game_title, icon0, pic0, pic1, cue_files,
True


def create_psp(dest, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_files, img_files, mem_cards, aea_files, subdir = './', snd0=None, watermark=False, subchannels=[], manual=None, configs=None):
def create_psp(dest, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_files, img_files, mem_cards, aea_files, subdir = './', snd0=None, watermark=False, subchannels=[], manual=None, configs=None, use_cdda=False):
# Convert ICON0 to a file object
if icon0:
if icon0.size[0] / icon0.size[1] < 1.4 and icon0.size[0] / icon0.size[1] > 0.75:
Expand Down Expand Up @@ -973,7 +973,11 @@ def create_psp(dest, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_fil
snd0_data = i.read()

dest_file = f + '/EBOOT.PBP'
generate_pbp(dest_file, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_files, img_files, aea_files, snd0=snd0_data, whole_disk=False, subchannels=subchannels, configs=configs)
whole_disk=False
if use_cdda:
aea_files = []
whole_disk = True
generate_pbp(dest_file, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_files, img_files, aea_files, snd0=snd0_data, whole_disk=whole_disk, subchannels=subchannels, configs=configs)

if manual:
print('Installing manual as', f + '/DOCUMENT.DAT')
Expand Down Expand Up @@ -2151,6 +2155,7 @@ def force_ntsc_config(ps3config):
parser.add_argument('--psp-install-memory-card', action='store_true',
help='Finish installing a PSX memory card after '
'running the game at least once')
parser.add_argument('--psp-use-cdda', action='store_true', help='Use CDDA instead of ATRAC3 for audio tracks on PSP')
parser.add_argument('--ps2-dir',
help='Where the PS2 USB-stick is mounted')
parser.add_argument('--ps3-pkg',
Expand Down Expand Up @@ -2530,6 +2535,8 @@ def force_ntsc_config(ps3config):
subchannels = []
magic_word = []
for idx in range(len(real_disc_ids)):
if 'psp-use-cdda' in games[real_disc_ids[idx]]:
args.psp_use_cdda = True
if real_disc_ids[idx] not in libcrypt:
magic_word.append(0)
subchannels.append(None)
Expand Down Expand Up @@ -2601,7 +2608,7 @@ def force_ntsc_config(ps3config):
temp_files.append(snd0)

if args.psp_dir:
create_psp(args.psp_dir, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_files, img_files, mem_cards, aea_files, snd0=snd0, subdir=subdir, watermark=args.watermark, subchannels=subchannels, manual=manual, configs=pspconfigs)
create_psp(args.psp_dir, disc_ids, game_title, icon0, pic0, pic1, cue_files, cu2_files, img_files, mem_cards, aea_files, snd0=snd0, subdir=subdir, watermark=args.watermark, subchannels=subchannels, manual=manual, configs=pspconfigs, use_cdda=args.psp_use_cdda)
if args.ps2_dir:
create_ps2(args.ps2_dir, disc_ids, game_title, icon0, pic1, cue_files, cu2_files, img_files)
if args.ps3_pkg:
Expand Down

0 comments on commit bf4ae9b

Please sign in to comment.