mirror of
https://github.com/ihaveamac/custom-install.git
synced 2025-12-06 06:41:45 +00:00
custominstall: extract title.db before installing (untested)
This should help prevent installing a bunch of titles, only to find title.db doesn't exist.
This commit is contained in:
@@ -217,6 +217,38 @@ class CustomInstall:
|
||||
cifinish_path = self.cifinish_out
|
||||
else:
|
||||
cifinish_path = join(self.sd, 'cifinish.bin')
|
||||
|
||||
with TemporaryDirectory(suffix='-custom-install') as tempdir:
|
||||
# set up the common arguments for the two times we call save3ds_fuse
|
||||
save3ds_fuse_common_args = [
|
||||
save3ds_fuse_path,
|
||||
'-b', crypto.b9_path,
|
||||
'-m', self.movable,
|
||||
'--sd', self.sd,
|
||||
'--db', 'sdtitle',
|
||||
tempdir
|
||||
]
|
||||
|
||||
extra_kwargs = {}
|
||||
if is_windows:
|
||||
# hide console window
|
||||
extra_kwargs['creationflags'] = 0x08000000 # CREATE_NO_WINDOW
|
||||
|
||||
# extract the title database to add our own entry to
|
||||
self.log('Extracting Title Database...')
|
||||
out = subprocess.run(save3ds_fuse_common_args + ['-x'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding=getpreferredencoding(),
|
||||
**extra_kwargs)
|
||||
if out.returncode:
|
||||
for l in out.stdout.split('\n'):
|
||||
self.log(l)
|
||||
self.log('Command line:')
|
||||
for l in pformat(out.args).split('\n'):
|
||||
self.log(l)
|
||||
return False, False
|
||||
|
||||
sd_path = join(sd_path, id1s[0])
|
||||
title_info_entries = {}
|
||||
try:
|
||||
@@ -426,36 +458,6 @@ class CustomInstall:
|
||||
save_cifinish(cifinish_path, cifinish_data)
|
||||
|
||||
if title_info_entries:
|
||||
with TemporaryDirectory(suffix='-custom-install') as tempdir:
|
||||
# set up the common arguments for the two times we call save3ds_fuse
|
||||
save3ds_fuse_common_args = [
|
||||
save3ds_fuse_path,
|
||||
'-b', crypto.b9_path,
|
||||
'-m', self.movable,
|
||||
'--sd', self.sd,
|
||||
'--db', 'sdtitle',
|
||||
tempdir
|
||||
]
|
||||
|
||||
extra_kwargs = {}
|
||||
if is_windows:
|
||||
# hide console window
|
||||
extra_kwargs['creationflags'] = 0x08000000 # CREATE_NO_WINDOW
|
||||
|
||||
# extract the title database to add our own entry to
|
||||
self.log('Extracting Title Database...')
|
||||
out = subprocess.run(save3ds_fuse_common_args + ['-x'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding=getpreferredencoding(),
|
||||
**extra_kwargs)
|
||||
if out.returncode:
|
||||
for l in out.stdout.split('\n'):
|
||||
self.log(l)
|
||||
self.log('Command line:')
|
||||
for l in pformat(out.args).split('\n'):
|
||||
self.log(l)
|
||||
return False, False
|
||||
|
||||
for title_id, entry in title_info_entries.items():
|
||||
# write the title info entry to the temp directory
|
||||
|
||||
Reference in New Issue
Block a user