diff --git a/install.ps1 b/install.ps1 index c9f6e6a85..091143d41 100644 --- a/install.ps1 +++ b/install.ps1 @@ -16,7 +16,7 @@ # and Invoke-WebRequest throws on a cut transfer before the hash is read: # the site's build rewrites this line there (scripts/sitebootstrap.py). $mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." - $defaultInstallSha256 = "ababbdfc9c1c2164f4d0ffc8fcaa96a1816fb2d709e7c63c9f6beb1b3c973561" + $defaultInstallSha256 = "a65844ce190649e5c0666f3de835030f85b97d68dd7a3801a506ff0bbd813630" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. $maximumInstallerBytes = 8MB diff --git a/install.py b/install.py index 2330f6647..8aa3dad4c 100644 --- a/install.py +++ b/install.py @@ -24888,11 +24888,20 @@ def _tui_given(state: TuiState) -> list[tuple[str, str | None]]: def _record_key(options: Iterable[tuple[str, str | None]]) -> list: """A choice in a form two spellings of it share: one name per --system - and --core, in any order.""" + and --core, in any order, and the regions as one list in their order of + priority, each spelled as the manifests spell it.""" pairs = record_options(record_argv(options)) - return sorted((flag, name.strip()) for flag, value in pairs - for name in ((value or "").split(",") if flag in ("--system", "--core") - else [value or ""]) if name.strip() or value is None) + key = sorted((flag, name.strip()) for flag, value in pairs if flag != "--region" + for name in ((value or "").split(",") if flag in ("--system", "--core") + else [value or ""]) if name.strip() or value is None) + regions = [str(value) for flag, value in pairs if flag == "--region"] + if regions: + try: + spelled = ",".join(resolve_regions(regions)) + except ValueError: + spelled = ",".join(regions) + key.append(("--region", spelled)) + return key def tui_record_kept(state: TuiState) -> bool: diff --git a/install.sh b/install.sh index d28e310b6..1367637ec 100755 --- a/install.sh +++ b/install.sh @@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins # curl or wget stop on a cut transfer before the hash is read: the site's # build rewrites this line there (scripts/sitebootstrap.py). MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." -DEFAULT_INSTALL_SHA256="ababbdfc9c1c2164f4d0ffc8fcaa96a1816fb2d709e7c63c9f6beb1b3c973561" +DEFAULT_INSTALL_SHA256="a65844ce190649e5c0666f3de835030f85b97d68dd7a3801a506ff0bbd813630" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. MAX_INSTALLER_BYTES=8388608 diff --git a/install/launchers/index.json b/install/launchers/index.json index e0fa6de0a..8a2ceb88c 100644 --- a/install/launchers/index.json +++ b/install/launchers/index.json @@ -27,8 +27,8 @@ { "dest": "roms/ports/retrobios/install.py", "repo_path": "install.py", - "size": 1497896, - "sha256": "ababbdfc9c1c2164f4d0ffc8fcaa96a1816fb2d709e7c63c9f6beb1b3c973561", + "size": 1498299, + "sha256": "a65844ce190649e5c0666f3de835030f85b97d68dd7a3801a506ff0bbd813630", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1551521, - "sha256": "c2565c915141d5e5ca2169029428e1e93494c1f0820018a7431126312adeca88" + "size": 1551924, + "sha256": "a9e926aa27131e295742b8742e8f50d41841e36d1e6a6cab883d41c4f420083b" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1497896, - "sha256": "ababbdfc9c1c2164f4d0ffc8fcaa96a1816fb2d709e7c63c9f6beb1b3c973561", + "size": 1498299, + "sha256": "a65844ce190649e5c0666f3de835030f85b97d68dd7a3801a506ff0bbd813630", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1497896, - "sha256": "ababbdfc9c1c2164f4d0ffc8fcaa96a1816fb2d709e7c63c9f6beb1b3c973561", + "size": 1498299, + "sha256": "a65844ce190649e5c0666f3de835030f85b97d68dd7a3801a506ff0bbd813630", "executable": false }, { diff --git a/installer/tui_commands.py b/installer/tui_commands.py index feedc36f8..eafa2d19c 100644 --- a/installer/tui_commands.py +++ b/installer/tui_commands.py @@ -14,6 +14,7 @@ from installer.host_fs import _is_dir from installer.install_record import RECORD_NARROWING, record_argv, record_options from installer.invocation import DEFAULT_JOBS, Invocation from installer.offline import LOCAL +from installer.regions import resolve_regions from installer.tally import leave_out_game_data from installer.tui_routes import TUI_LIST_ENV, TUI_RECORD_ENV @@ -265,11 +266,20 @@ def _tui_given(state: TuiState) -> list[tuple[str, str | None]]: def _record_key(options: Iterable[tuple[str, str | None]]) -> list: """A choice in a form two spellings of it share: one name per --system - and --core, in any order.""" + and --core, in any order, and the regions as one list in their order of + priority, each spelled as the manifests spell it.""" pairs = record_options(record_argv(options)) - return sorted((flag, name.strip()) for flag, value in pairs - for name in ((value or "").split(",") if flag in ("--system", "--core") - else [value or ""]) if name.strip() or value is None) + key = sorted((flag, name.strip()) for flag, value in pairs if flag != "--region" + for name in ((value or "").split(",") if flag in ("--system", "--core") + else [value or ""]) if name.strip() or value is None) + regions = [str(value) for flag, value in pairs if flag == "--region"] + if regions: + try: + spelled = ",".join(resolve_regions(regions)) + except ValueError: + spelled = ",".join(regions) + key.append(("--region", spelled)) + return key def tui_record_kept(state: TuiState) -> bool: diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index b81678155..c69ee885b 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -1389,6 +1389,14 @@ class RecordedPlan(unittest.TestCase): self.assertEqual(record_state(record_setup( ["--region", "us", "--region", "zz"])).regions, ["north-america"]) + def test_a_recorded_region_is_the_same_choice_on_screen(self): + """The screen spells regions as the manifests do and joins them: the + record's own words are still its choice, in their order.""" + state = record_state(record_setup(["--region", "us", "--region", "jp"])) + self.assertTrue(install.tui_record_kept(state)) + self.assertNotEqual(install._record_key([("--region", "us,jp")]), + install._record_key([("--region", "jp,us")])) + def test_opens_on_the_plan_of_the_one_setup_found(self): state = record_state() self.assertTrue(state.opened_on_plan)