Repository navigation
Conversation
- Update hookshot-launch to correctly handle XDG_CONFIG_HOME and HOME variables. - Remove unused user directory functions and improve profile validation in profiles.py. - Enhance error handling in account initialization and ensure profiles are checked against the list. - Update documentation to clarify profile usage and behavior in various scenarios. - Add tests for profile management and user folder handling.
# Conflicts: # builder/linux/hookshot_builder.py # docs/tested-configurations.md # readme.md
|
Thanks for reading all of it. Point by point: Conflicts. I merged
CI. Understood. It needs a maintainer to approve the workflows. Profiles as a feature. Agreed, that is NotRexed's decision. I'd rather hear "no" or "not like this" now than polish it further. Empty files. Neither Eden nor NX2navi writes the files under
Windows build. Still untested: I have no llvm-mingw here. I've said so in the description. I've updated the description to match. |
|
Tried this on Linux (Arch, kernel 7.2.15, Python 3.12), head 8b6f26b, without the Tk window: the tests, then 1. One of the new tests fails on a PC that has an NX2navi save in its usual place. The test points 2. The profile logic does what the description says. On a new user folder: the list starts as One thing a player can run into: the import refuses while any Hookshot runs on the PC ( Not done yet: the game side ( |
|
Follow-up to my comment above: the game side, which the description lists as not tested (this head built from source, RTX 4090, NVIDIA 615.78.08, no window, scripted input; a user folder
So |
Joey-Magnus
left a comment
There was a problem hiding this comment.
The game side is well covered now: mooki000's runs show HOOKSHOT_PROFILE and its fallback doing what test_account_profile.py checks. I also read profiles.py's remove and export paths. Ids are checked with _ID.fullmatch, removing moves to save-backups/ rather than deleting, and export only ever rmtrees the folder it just created. I don't see a data-loss risk there.
Three things before it can merge:
- The decision is still open. NotRexed closed #1594, #1820 and #1868 into #1007, and nobody has said yet whether profiles are wanted in this form.
- It conflicts with main again, in nx2/make_game.py, docs/tested-configurations.md and tests/test_linux_play_diagnostics.py. Main has changed the builder's Play path and make_game.py since (#2279, #2367, #2391).
- mooki000's test fix isn't in:
test_import_offers_the_emulators_usual_folders_with_their_users_names(tests/test_launcher_profiles.py:245) only patchesXDG_DATA_HOME. On a PC with an NX2navi save in~/Games/Ocarinait fails. Adding"HOME": tmpto that dict fixes it.
The Windows build of the host/ change is still untested.
|
Currently it's only for Linux. But sure, but i haven't done it yet for windows. I thought splitting it up for the different launchers would be easier to review. Maybe someone else wants to implement it for windows? |
Joey-Magnus
left a comment
There was a problem hiding this comment.
My two concrete points are fixed. The branch merges cleanly with current main again, and test_import_offers_the_emulators_usual_folders_with_their_users_names now patches HOME as well as XDG_DATA_HOME (tests/test_launcher_profiles.py:246). I merged 61d19af into current main and ran the whole tests/run_all.py: 428 passed, and the only failure is test_lift_cache, which fails on main here too. That run covers test_launcher_profiles, test_account_profile, test_hookshot_launch, test_oot_saves and test_linux_play_diagnostics. CI's builds still wait for approval, so the Windows build of the host/ change (nn_applet.c, hos_main.c) hasn't been run anywhere.
What's left is the product decision. NotRexed closed #1594, #1820 and #1868 into #1007, and nobody has said yet whether profiles are wanted in this form. This is also Linux only. The Windows launcher would play the default profile, so the two launchers would differ until someone ports it, which hckrman101 asked about.
On Linux everyone who plays on one PC shares one set of saves, and moving a save over from an emulator means running
scripts/oot_saves.pyby hand. This PR adds profiles to the Linux launcher, so each player gets their own saves, and lets the launcher import a save from an emulator in a few clicks.Issues
scripts/oot_saves.pyby hand).What changed
Launcher (
builder/linux/hookshot_builder.py, newbuilder/linux/profiles.py)profile=inbuilder.ini).save-backups/<id>-<time>: nothing is deleted. The default profile cannot be removed, because the game plays it when it is started without the launcher.profiles.dat). Other folder… takes any other folder. When a folder holds saves of several emulator users, the launcher asks whose. The copy runs on a worker thread behind a "Copying the save…" screen, and a failure is shown in an error box.Hookshot save - <name> - <date and time>. It never writes into an emulator and replaces nothing.hookshot_version.txthasprofiles=1, whichnx2/make_game.pynow writes on every build. An older folder plays the default profile's saves, as before.Game (
host/nn_applet.c,host/hos_main.c)HOOKSHOT_PROFILE=<32 hex digits>picks the user, and so the save foldersave/<id>. The game reads it once at start-up (hos_account_init), after the user folder is known.profiles.txtin the user folder (a profile removed since it was chosen, or one from another user folder) falls back to the default profile, as does a missing or malformed value. The default profile's uid is unchanged, so existing saves stay where they were.hookshot-launchpasses the ini'sprofile=on asHOOKSHOT_PROFILE. Whether it is still on the list is the game's to check. It also starts withHOMEunset.scripts/oot_saves.pysavescommand: the saves of a folder, or of every emulator's usual folder, as JSON.listshows users' names.--hookshotcan name one profile's save folder, which an import creates if it isn't there yet.load/<title id>) is no longer taken for a user. User folders copied into a folder of any name are still found by their ids.Docs: readme ("Profiles, and saves from emulators"),
docs/saves.md("Copy from Hookshot's launcher"), and theHOOKSHOT_PROFILErow indocs/development.md.How it was tested
python -I -B tests/run_all.pyon CachyOS: 331 passed, 2 failed, 13 skipped. Both failures also happen onmain:test_wayland_libdecor_hint.py(-Wunused-but-set-globalin its harness with this clang) andnx2/test_nup_read_name.py(zstandardis not installed).test_launcher_profiles.py: add, rename, remove, ids never reused, a list in another encoding, import and export, a failed import shown as an error, an id starting with-.test_account_profile.py: builds the realhos_account_init, covering listed and unlisted ids, case, comments and malformed values.test_hookshot_launch.py: the profile passed on, and a start withoutHOME.test_oot_saves.py:saves, a new profile's folder, empty files, a failed copy restored, Eden's mods folder, copied user folders.v2.0.8-604-g829b783(this branch before its review fixes): Play starts the game with the profile chosen in the launcher, and the game plays that profile's saves. Four starts, two profiles (account: profile …0002,…0003inhookshot_log.txt). A row is added todocs/tested-configurations.md.Not tested
hos_account_init, read once at start-up, and its fall-back to the default profile for an id that is not inprofiles.txt. The game run above predates them;test_account_profile.pybuilds and checks that code.host/change. The Windows launcher has no profiles yet and plays the default profile.Screenshots
The launcher, with a profile chosen:
The profile list, and the Manage menu for the chosen profile:
New profile:
Import a save, from Eden with two users:
After the import: