mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 20:25:57 +00:00
Merge task/basegame: name an update or a combined package chosen as the base game (#261)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
191b5459d3
4 files changed
+50
No files matched your search
@@ -219,6 +219,23 @@ def size_of(paths):
|
||||
|
||||
# ---- 1. check
|
||||
|
||||
UPDATE_TITLE_ID = '0100F2C0115B6800'
|
||||
|
||||
|
||||
def base_misuse(records):
|
||||
"""Name why a file chosen as the base game holds an update or a combined package, or return None.
|
||||
|
||||
The Meta NCA (content type 1) carries the package's own title id: the update's id (...800) for an update NSP, and
|
||||
several Meta NCAs mean base, update and DLC repacked into one file.
|
||||
"""
|
||||
metadata = [r['title_id'] for r, _ in records if r['content_type'] == 1]
|
||||
if len(metadata) > 1:
|
||||
return 'check.base_combined'
|
||||
if UPDATE_TITLE_ID in metadata:
|
||||
return 'check.base_is_update'
|
||||
return None
|
||||
|
||||
|
||||
class Check(Step):
|
||||
id = 'check'
|
||||
always = True
|
||||
@@ -350,6 +367,10 @@ class Check(Step):
|
||||
except ValueError as e:
|
||||
if is_update and 'BKTR' in str(e):
|
||||
raise InstallError('check.update_is_base') from None
|
||||
if not is_update:
|
||||
reason = base_misuse(records)
|
||||
if reason:
|
||||
raise InstallError(reason) from None
|
||||
raise InstallError('check.update_not_totk' if is_update else 'check.base_not_totk', detail=str(e)) from None
|
||||
try:
|
||||
nca_ctr_key(header, keys, tickets)
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
"check.ticket_personalized": "The {input} file carries a personalized ticket; a common ticket is needed.",
|
||||
"check.ticket_missing": "The {input} file lacks the ticket its content needs.",
|
||||
"check.base_not_totk": "The base game file is not The Legend of Zelda: Tears of the Kingdom ({detail}).",
|
||||
"check.base_is_update": "The base game file is an update. Choose the base game NSP or XCI (version 1.0.0) here and this file as the update.",
|
||||
"check.base_combined": "The base game file holds several packages (base game, update or DLC in one file). Choose a base game dump that contains only the game.",
|
||||
"check.update_not_nsp": "The update must be an NSP file.",
|
||||
"check.update_is_base": "The update file holds a base game. Choose the 1.1.1 or 1.2.1 or 1.4.3 update NSP.",
|
||||
"check.update_not_totk": "The update file is not a Tears of the Kingdom update ({detail}).",
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
"check.ticket_personalized": "В файле «{input}» личный тикет; нужен общий тикет.",
|
||||
"check.ticket_missing": "В файле «{input}» нет тикета, который нужен его содержимому.",
|
||||
"check.base_not_totk": "Файл базовой игры — не The Legend of Zelda: Tears of the Kingdom ({detail}).",
|
||||
"check.base_is_update": "Файл базовой игры — это обновление. Выберите здесь NSP или XCI базовой игры (версия 1.0.0), а этот файл укажите как обновление.",
|
||||
"check.base_combined": "Файл базовой игры содержит несколько пакетов (игра, обновление или DLC в одном файле). Выберите дамп, в котором только базовая игра.",
|
||||
"check.update_not_nsp": "Обновление должно быть файлом NSP.",
|
||||
"check.update_is_base": "Файл обновления содержит базовую игру. Выберите NSP с обновлением 1.1.1 или 1.2.1 или 1.4.3.",
|
||||
"check.update_not_totk": "Файл обновления — не обновление Tears of the Kingdom ({detail}).",
|
||||
|
||||
@@ -291,6 +291,31 @@ class CleanupTest(unittest.TestCase):
|
||||
self.assertEqual(self.run_cleanup(), 'cleanup.romfs_unreadable')
|
||||
|
||||
|
||||
class BaseGameCheckTest(unittest.TestCase):
|
||||
"""Issue #261: an update NSP chosen as the base game was reported as "not Tears of the Kingdom"."""
|
||||
BASE, UPDATE = '0100F2C0115B6000', '0100F2C0115B6800'
|
||||
|
||||
@staticmethod
|
||||
def nca(content_type, title_id):
|
||||
return ({'name': 'x.nca', 'nca_offset': 0, 'size': 0xc00, 'content_type': content_type, 'title_id': title_id}, b'')
|
||||
|
||||
def test_update_package_names_the_update(self):
|
||||
# An update NSP keeps the base title id on its Program NCA; only its Meta NCA carries the update id.
|
||||
records = [self.nca(0, self.BASE), self.nca(1, self.UPDATE)]
|
||||
with self.assertRaises(ValueError):
|
||||
steps.program_nca(records)
|
||||
self.assertEqual(steps.base_misuse(records), 'check.base_is_update')
|
||||
|
||||
def test_combined_package_is_named(self):
|
||||
records = [self.nca(0, self.BASE), self.nca(1, self.BASE), self.nca(1, self.UPDATE)]
|
||||
self.assertEqual(steps.base_misuse(records), 'check.base_combined')
|
||||
|
||||
def test_plain_base_game_passes(self):
|
||||
records = [self.nca(0, self.BASE), self.nca(1, self.BASE), self.nca(3, self.BASE)]
|
||||
self.assertIsNone(steps.base_misuse(records))
|
||||
self.assertEqual(steps.program_nca(records)[0]['title_id'], self.BASE)
|
||||
|
||||
|
||||
class EventsTest(unittest.TestCase):
|
||||
def test_lines_are_json_and_the_log_is_english(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
|
||||
Reference in new issue
Block a user