Skip to content

Commit

Permalink
pop-fe: add support for CHD files
Browse files Browse the repository at this point in the history
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
  • Loading branch information
sahlberg committed Aug 14, 2023
1 parent 921dbdf commit 07413a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ formats:
MODE2/2352
.zip : ZIP file. The ZIP file will be extracted into the local directory
and if a .cue file is found it will be used.
.chd : CHD file. This requires that the chdman program is installed.
.* : Various memory card image formats.
Memory cards are detected by file size so the extensions does not
matter.
Expand Down
17 changes: 17 additions & 0 deletions pop-fe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,23 @@ def create_manual(source, gameid, subdir='./pop-fe-work/'):
zip = None
print('Processing', cue_file, '...')

if cue_file[-4:] == '.chd':
print('This is a CHD file. Uncompress the file.') if verbose else None
chd = cue_file
try:
tmpcue = subdir + 'CDH%d.cue' % (0 if not idx else idx[0])
tmpbin = subdir + 'CDH%d.bin' % (0 if not idx else idx[0])
temp_files.append(tmpcue)
temp_files.append(tmpbin)
print('Extracting', tmpcue, 'and', tmpbin, 'chd') if verbose else None
subprocess.run(['chdman', 'extractcd', '-f', '-i', chd, '-ob', tmpbin, '-o', tmpcue], check=True)
except:
print('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nCHDMAN not found.\nCan not convert game\nPlease see README file for how to install chdman\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
os._exit(10)
cue_file = tmpcue
# we didn't actually have a CUE file to start with so just
# replace the "real" cue filename with our temporary one
real_cue_files[-1] = cue_file
if cue_file[-4:] == '.zip':
print('This is a ZIP file. Uncompress the file.') if verbose else None
zip = cue_file
Expand Down

0 comments on commit 07413a0

Please sign in to comment.