Skip to content

Several user accounts: a user list, per-user nickname and picture, the game's user selector, a save per user #2292

Open

Description

@chayan-bit

What is missing

hle_account.c has one fixed user (k_uid), its nickname from DM_NICK, and ShowUserSelector returns that user without asking.
Two people on one device share one save, and a game that lists users or asks who is playing (3D World + Bowser's Fury lists all users) only ever sees one.

What you propose

Our fork's 31fdd96, adapted to main:

  • DM_USERS names a tab-separated file, one user per line: Uid (32 hex digits), nickname, profile image path (a JPEG, may be empty), at most 8. Without it nothing changes.
  • ListAllUsers, ListQualifiedUsers, GetUserCount, GetUserExistence, GetNickname and LoadProfileImage answer from that list.
  • ShowUserSelector calls a new hook, int front_user_select(char out[33]), on the game thread, blocking as front_text_input does: 1 picked, 0 cancelled (the cancel result's value is not yet checked against an SDK), -1 no picker. A weak default returns -1, so front ends without a picker behave as today.
  • MountSaveData with the preselected user's Uid mounts DM_SAVE as now; another user's Uid mounts that user's own folder, created on first mount.

Saves: the old form carries forward

No existing save moves or changes.
The preselected user stays k_uid unless a front end says otherwise, so every existing save still belongs to the user who opens by default.
Other users' saves go beside it, never in it.
Our fork uses DM_SAVE_ROOT/<uid>/saves/<title ID>/save, which suits our iOS front end; for nxnative something like <DM_SAVE>.users/<uid>/ beside save/ is probably clearer.
Since our change, main has gained the device save (<DM_SAVE>_device), cloud sync (DM_SAVE_SYNC, <DM_SAVE>-backups) and save transactions; each user's save would use the same clone-and-commit path.
The device save stays shared, as on the Switch.

Front ends

Front-ends: a new optional hook and an optional DM_USERS file; a front end that uses neither sees no change.

Scope and size

About 190 lines with tests (t_account; a t_fs case for another user's mount and commit), plus a picker per front end that wants one, plus the save-sync work above.

Alternatives considered

  • One install or one save folder per person: works today, but the game cannot see or switch users.
  • A user per controller (as 76545a5 maps controllers to players): games ask for users through the selector, not by controller.

Questions

  1. Is multi-user wanted in nxnative, or should it stay a front-end concern?
  2. Which layout for other users' saves?
  3. Should cloud sync cover every user or only the preselected one?
  4. The user list: DM_USERS, the saved choices, or both? Should it show in launcher.json?

Evidence we would bring

Host tests for the list, nickname, picture, selector and another user's mount and commit; an existing save opening unchanged after the update; and a game that lists users and one that shows the selector, played with two users on a Mac and an iPad.

Platforms: Mac, iPhone, iPad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions