mirror of
https://github.com/ihaveamac/custom-install.git
synced 2025-12-06 06:41:45 +00:00
custominstall: support --seeddb argument (close #6), test id0 folders as a hexstring
This commit is contained in:
@@ -27,6 +27,7 @@ boot9 is needed:
|
|||||||
|
|
||||||
A [SeedDB](https://github.com/ihaveamac/3DS-rom-tools/wiki/SeedDB-list) is needed for newer games (2015+) that use seeds.
|
A [SeedDB](https://github.com/ihaveamac/3DS-rom-tools/wiki/SeedDB-list) is needed for newer games (2015+) that use seeds.
|
||||||
SeedDB is checked in order of:
|
SeedDB is checked in order of:
|
||||||
|
* `-s` or `--seeddb` argument (if set)
|
||||||
* `SEEDDB_PATH` environment variable (if set)
|
* `SEEDDB_PATH` environment variable (if set)
|
||||||
* `%APPDATA%\3ds\seeddb.bin` (Windows-specific)
|
* `%APPDATA%\3ds\seeddb.bin` (Windows-specific)
|
||||||
* `~/Library/Application Support/3ds/seeddb.bin` (macOS-specific)
|
* `~/Library/Application Support/3ds/seeddb.bin` (macOS-specific)
|
||||||
|
|||||||
@@ -131,12 +131,16 @@ def save_cifinish(path: 'Union[PathLike, bytes, str]', data: dict):
|
|||||||
|
|
||||||
|
|
||||||
class CustomInstall:
|
class CustomInstall:
|
||||||
def __init__(self, boot9, movable, cias, sd, skip_contents=False):
|
|
||||||
|
cia: CIAReader
|
||||||
|
|
||||||
|
def __init__(self, boot9, seeddb, movable, cias, sd, skip_contents=False):
|
||||||
self.event = Events()
|
self.event = Events()
|
||||||
self.log_lines = [] # Stores all info messages for user to view
|
self.log_lines = [] # Stores all info messages for user to view
|
||||||
|
|
||||||
self.crypto = CryptoEngine(boot9=boot9)
|
self.crypto = CryptoEngine(boot9=boot9)
|
||||||
self.crypto.setup_sd_key_from_file(movable)
|
self.crypto.setup_sd_key_from_file(movable)
|
||||||
|
self.seeddb = seeddb
|
||||||
self.cias = cias
|
self.cias = cias
|
||||||
self.sd = sd
|
self.sd = sd
|
||||||
self.skip_contents = skip_contents
|
self.skip_contents = skip_contents
|
||||||
@@ -151,7 +155,6 @@ class CustomInstall:
|
|||||||
dst.write(data)
|
dst.write(data)
|
||||||
left -= to_read
|
left -= to_read
|
||||||
total_read = size - left
|
total_read = size - left
|
||||||
# self.log(f' {(total_read / size) * 100:>5.1f}% {total_read / 1048576:>.1f} MiB / {size / 1048576:.1f} MiB')
|
|
||||||
self.event.update_percentage((total_read / size) * 100, total_read / 1048576, size / 1048576)
|
self.event.update_percentage((total_read / size) * 100, total_read / 1048576, size / 1048576)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
@@ -178,7 +181,7 @@ class CustomInstall:
|
|||||||
for c in self.cias:
|
for c in self.cias:
|
||||||
self.log('Reading ' + c)
|
self.log('Reading ' + c)
|
||||||
|
|
||||||
cia = CIAReader(c)
|
cia = CIAReader(c, seeddb=self.seeddb)
|
||||||
self.cia = cia
|
self.cia = cia
|
||||||
|
|
||||||
tid_parts = (cia.tmd.title_id[0:8], cia.tmd.title_id[8:16])
|
tid_parts = (cia.tmd.title_id[0:8], cia.tmd.title_id[8:16])
|
||||||
@@ -401,8 +404,9 @@ class CustomInstall:
|
|||||||
for d in scandir(sd_path):
|
for d in scandir(sd_path):
|
||||||
if d.is_dir() and len(d.name) == 32:
|
if d.is_dir() and len(d.name) == 32:
|
||||||
try:
|
try:
|
||||||
# id1_tmp = bytes.fromhex(d.name)
|
# check if the name can be converted to hex
|
||||||
pass
|
# I'm not sure what the 3DS does if there is a folder that is not a 32-char hex string.
|
||||||
|
bytes.fromhex(d.name)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
@@ -441,12 +445,14 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('cia', help='CIA files', nargs='+')
|
parser.add_argument('cia', help='CIA files', nargs='+')
|
||||||
parser.add_argument('-m', '--movable', help='movable.sed file', required=True)
|
parser.add_argument('-m', '--movable', help='movable.sed file', required=True)
|
||||||
parser.add_argument('-b', '--boot9', help='boot9 file')
|
parser.add_argument('-b', '--boot9', help='boot9 file')
|
||||||
|
parser.add_argument('-s', '--seeddb', help='seeddb file')
|
||||||
parser.add_argument('--sd', help='path to SD root', required=True)
|
parser.add_argument('--sd', help='path to SD root', required=True)
|
||||||
parser.add_argument('--skip-contents', help="don't add contents, only add title info entry", action='store_true')
|
parser.add_argument('--skip-contents', help="don't add contents, only add title info entry", action='store_true')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
installer = CustomInstall(boot9=args.boot9,
|
installer = CustomInstall(boot9=args.boot9,
|
||||||
|
seeddb=args.seeddb,
|
||||||
cias=args.cia,
|
cias=args.cia,
|
||||||
movable=args.movable,
|
movable=args.movable,
|
||||||
sd=args.sd,
|
sd=args.sd,
|
||||||
|
|||||||
Reference in New Issue
Block a user