mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 12:55:57 +00:00
Make the PC prompts for every game resolution the setup lays the UI out for
The setup wrote romfs-patches-pc for 16:9 only, so prompts = pc on a 21:9, 32:9, 16:10 or 3:2 screen kept the game resolution at 1920x1080 (cfg.c) or, with output_res set to the screen's shape, fell back to the Switch prompts. - make_romfs_patches.py --reuse <folder>: a file of an earlier overlay whose contents match is hard-linked (copied where links fail) instead of compressed again; the output is byte for byte the same. - The setup builds romfs-patches-pc-<w>x<h> for each of ASPECT_SIZES from romfs-patches-pc with --reuse: only the Common archive is compressed, so the fifteen folders take about two minutes and 6 MiB each instead of 22 minutes and 73 MiB each. - cfg.c: the display-shaped output_res default applies with prompts = pc when romfs-patches-pc-<w>x<h> is there (romfs_shaped_pc_ready); Xbox prompts keep 1920x1080 as before.
This commit is contained in:
1 parent
ae30a61b7b
commit
ceece5683a
10 files changed
+125
-26
No files matched your search
@@ -13,6 +13,7 @@ import importlib.util
|
||||
import io
|
||||
import json
|
||||
import random
|
||||
import shutil
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -572,6 +573,34 @@ class PromptsTest(unittest.TestCase):
|
||||
self.assertEqual(proc.returncode, 0, proc.stderr)
|
||||
self.assertEqual((out / 'manifest.tsv').read_bytes(), (self.outs['v121', 'xbox'][0] / 'manifest.tsv').read_bytes())
|
||||
|
||||
def test_reuse_links_the_files_that_match_and_writes_the_same_overlay(self):
|
||||
romfs = self.romfs['v143']
|
||||
pc, pc_summary = self.outs['v143', 'pc']
|
||||
source = self.base / 'reuse' / 'source' # a copy, so the class's folder is never linked or rewritten
|
||||
shutil.copytree(pc, source)
|
||||
out = self.base / 'reuse' / 'pc'
|
||||
proc = romfs.run(out, '--prompts', 'pc', '--reuse', str(source))
|
||||
self.assertEqual(proc.returncode, 0, proc.stderr)
|
||||
self.assertEqual((out / 'manifest.tsv').read_bytes(), (pc / 'manifest.tsv').read_bytes())
|
||||
self.assertEqual(sorted(json.loads(proc.stdout.strip().splitlines()[-1])['reused']), sorted(manifest(pc)))
|
||||
self.assertEqual(pc_summary['reused'], [])
|
||||
# From the Xbox prompts only what both share is taken; the rest is made, and the overlay is the same.
|
||||
xbox = self.outs['v143', 'xbox'][0]
|
||||
out = self.base / 'reuse' / 'from-xbox'
|
||||
proc = romfs.run(out, '--prompts', 'pc', '--reuse', str(xbox))
|
||||
self.assertEqual(proc.returncode, 0, proc.stderr)
|
||||
self.assertEqual((out / 'manifest.tsv').read_bytes(), (pc / 'manifest.tsv').read_bytes())
|
||||
shared = {p for p, row in manifest(pc).items() if manifest(xbox).get(p) == row}
|
||||
self.assertEqual(set(json.loads(proc.stdout.strip().splitlines()[-1])['reused']), shared)
|
||||
# A new run into the source folder replaces its files instead of writing through the links.
|
||||
before = {p: (self.base / 'reuse' / 'pc' / p).read_bytes() for p in manifest(pc)}
|
||||
ini = self.base / 'reuse' / 'totk.ini'
|
||||
ini.write_text('[input]\nbind_A = key:F\n', encoding='utf-8')
|
||||
proc = romfs.run(source, '--prompts', 'pc', '--binds', str(ini))
|
||||
self.assertEqual(proc.returncode, 0, proc.stderr)
|
||||
self.assertNotEqual((source / 'manifest.tsv').read_bytes(), (pc / 'manifest.tsv').read_bytes())
|
||||
self.assertEqual({p: (self.base / 'reuse' / 'pc' / p).read_bytes() for p in manifest(pc)}, before)
|
||||
|
||||
def test_unrecognised_romfs_fails_before_writing(self):
|
||||
cases = {'no text fonts': (dict(text_fonts=False), icons.TEXT_FONTS[0]),
|
||||
'no size entry': (dict(restbl_skips=(REGIONAL_FONT,)), 'has no entry in the resource size table'),
|
||||
|
||||
Reference in new issue
Block a user