diff --git a/src/xenia/kernel/xam/profile_manager.cc b/src/xenia/kernel/xam/profile_manager.cc index 33bb26479..66535d619 100644 --- a/src/xenia/kernel/xam/profile_manager.cc +++ b/src/xenia/kernel/xam/profile_manager.cc @@ -27,6 +27,16 @@ DEFINE_string(logged_profile_slot_2_xuid, "", DEFINE_string(logged_profile_slot_3_xuid, "", "XUID of the profile to load on boot in slot 3", "Profiles"); +DEFINE_string( + create_profile_if_none, "", + "Reverse-engineering aid: if no profile exists on disk, create one with " + "this gamertag at startup and sign it in. Without a signed-in profile the " + "title screen's (A) opens the Sign In dialog and the game goes no further, " + "and this container has no way to type a gamertag into it: the dialog is " + "an ImGui text field and synthetic X key events never reach it. Ignored " + "when a profile already exists.", + "Profiles"); + namespace xe { namespace kernel { namespace xam { @@ -105,6 +115,17 @@ ProfileManager::ProfileManager(KernelState* kernel_state, LoadAccount(account_xuid); } + // RE aid: bootstrap a profile for scripted runs (see the cvar's help). The + // fixed XUID is what makes it usable from a script — `default_xuid` gives + // 0xB13EBABEBABEBABE every time, so a run can pass + // --logged_profile_slot_0_xuid=B13EBABEBABEBABE and be deterministic. + if (accounts_.empty() && !cvars::create_profile_if_none.empty()) { + const bool ok = + CreateProfile(cvars::create_profile_if_none, true, true); + XELOGI("ProfileManager: RE bootstrap profile '{}' -> {}", + cvars::create_profile_if_none, ok ? "created" : "FAILED"); + } + if (!cvars::logged_profile_slot_0_xuid.empty()) { Login(xe::string_util::from_string( cvars::logged_profile_slot_0_xuid, true),