Bypass sign-in UI for connected controllers, Press Start detection (tryJoin fix)

On Windows64 the sign-in checks gated the join behind IsLocalGame() and Live sign-in. Changed both checks so any physically connected controller can join without a profile.

The second controller's Start button was ignored because tryJoin required the button to still be physically held. Changed to also pass when the rising-edge latch is active, so a quick tap registers.
This commit is contained in:
Michal Schiller 2026-03-06 18:23:04 +01:00 committed by GitHub
parent 6cd6b21926
commit 7d96b6de4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -52,7 +52,6 @@
#include "..\Minecraft.World\net.minecraft.world.level.dimension.h"
#include "..\Minecraft.World\net.minecraft.world.item.h"
#include "..\Minecraft.World\Minecraft.World.h"
#include "Windows64\Windows64_Xuid.h"
#include "ClientConnection.h"
#include "..\Minecraft.World\HellRandomLevelSource.h"
#include "..\Minecraft.World\net.minecraft.world.entity.animal.h"
@ -742,7 +741,7 @@ void Minecraft::run()
while (System::currentTimeMillis() >= lastTime + 1000)
{
fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates";
Chunk::updates = 0;
lastTime += 1000;
frames = 0;
@ -1039,19 +1038,6 @@ shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, co
PlayerUID playerXUIDOnline = INVALID_XUID;
ProfileManager.GetXUID(idx,&playerXUIDOffline,false);
ProfileManager.GetXUID(idx,&playerXUIDOnline,true);
#ifdef _WINDOWS64
// Compatibility rule for Win64 id migration
// host keeps legacy host XUID, non-host uses persistent uid.dat XUID.
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
{
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
}
else
{
playerXUIDOffline = Win64Xuid::ResolvePersistentXuid();
}
#endif
localplayers[idx]->setXuid(playerXUIDOffline);
localplayers[idx]->setOnlineXuid(playerXUIDOnline);
localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx));
@ -1593,7 +1579,10 @@ void Minecraft::run_middle()
s_prevXButtons[i] = xCurButtons;
}
bool startJustPressed = s_startPressLatch[i] > 0;
bool tryJoin = !pause && !ui.IsIgnorePlayerJoinMenuDisplayed(ProfileManager.GetPrimaryPad()) && g_NetworkManager.SessionHasSpace() && xCurButtons != 0;
// Use (xCurButtons != 0 || startJustPressed) so that a quick Start tap that first
// triggers ShowPressStart (PressStartPlaying was false) can still complete the join
// on subsequent frames while the latch is active, even after the button is released.
bool tryJoin = !pause && !ui.IsIgnorePlayerJoinMenuDisplayed(ProfileManager.GetPrimaryPad()) && g_NetworkManager.SessionHasSpace() && (xCurButtons != 0 || startJustPressed);
#else
bool tryJoin = !pause && !ui.IsIgnorePlayerJoinMenuDisplayed(ProfileManager.GetPrimaryPad()) && g_NetworkManager.SessionHasSpace() && RenderManager.IsHiDef() && InputManager.ButtonPressed(i);
#endif
@ -1634,13 +1623,14 @@ void Minecraft::run_middle()
// are they signed in?
#ifdef _WINDOWS64
if(ProfileManager.IsSignedIn(i) || (g_NetworkManager.IsLocalGame() && InputManager.IsPadConnected(i)))
// On Windows64 any physically-connected controller can join without a profile sign-in.
if(ProfileManager.IsSignedIn(i) || InputManager.IsPadConnected(i))
#else
if(ProfileManager.IsSignedIn(i))
#endif
{
// if this is a local game, then the player just needs to be signed in
if( g_NetworkManager.IsLocalGame() || (ProfileManager.IsSignedInLive(i) && ProfileManager.AllowedToPlayMultiplayer(i) ) )
if( g_NetworkManager.IsLocalGame() || InputManager.IsPadConnected(i) || (ProfileManager.IsSignedInLive(i) && ProfileManager.AllowedToPlayMultiplayer(i) ) )
{
#ifdef __ORBIS__
bool contentRestricted = false;
@ -2048,7 +2038,7 @@ void Minecraft::run_middle()
while (System::nanoTime() >= lastTime + 1000000000)
{
MemSect(31);
fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates";
MemSect(0);
Chunk::updates = 0;
lastTime += 1000000000;
@ -3544,14 +3534,11 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
#ifdef _WINDOWS64
bool actionPressed = InputManager.ButtonPressed(iPad, MINECRAFT_ACTION_ACTION) || (iPad == 0 && g_KBMInput.IsKBMActive() && g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT));
bool actionHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION) || (iPad == 0 && g_KBMInput.IsKBMActive() && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT));
#else
bool actionPressed = InputManager.ButtonPressed(iPad, MINECRAFT_ACTION_ACTION);
bool actionHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION);
#endif
if (actionPressed)
if (actionHeld && ticks - player->lastClickTick[0] >= timer->ticksPerSecond / 4)
{
//printf("MINECRAFT_ACTION_ACTION ButtonDown");
player->handleMouseClick(0);
@ -4312,19 +4299,6 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
// player doesn't have an online UID, set it from the player name
playerXUIDOnline.setForAdhoc();
}
#endif
#ifdef _WINDOWS64
// On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`.
// To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID.
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer);
if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
{
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
}
else
{
playerXUIDOffline = Win64Xuid::ResolvePersistentXuid();
}
#endif
player->setXuid(playerXUIDOffline);
player->setOnlineXuid(playerXUIDOnline);
@ -4462,7 +4436,7 @@ void Minecraft::prepareLevel(int title)
wstring Minecraft::gatherStats1()
{
//return levelRenderer->gatherStats1();
return L"Time to autosave: " + std::to_wstring( app.SecondsToAutosave() ) + L"s";
return L"Time to autosave: " + _toString<unsigned int>( app.SecondsToAutosave() ) + L"s";
}
wstring Minecraft::gatherStats2()
@ -4508,18 +4482,6 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
PlayerUID playerXUIDOnline = INVALID_XUID;
ProfileManager.GetXUID(iTempPad,&playerXUIDOffline,false);
ProfileManager.GetXUID(iTempPad,&playerXUIDOnline,true);
#ifdef _WINDOWS64
// Same compatibility rule as create/init paths.
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iTempPad);
if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
{
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
}
else
{
playerXUIDOffline = Win64Xuid::ResolvePersistentXuid();
}
#endif
player->setXuid(playerXUIDOffline);
player->setOnlineXuid(playerXUIDOnline);
player->setIsGuest( ProfileManager.IsGuest(iTempPad) );
@ -4652,7 +4614,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
}
else
{
minecraft->user = new User(L"Player" + std::to_wstring(System::currentTimeMillis() % 1000), L"");
minecraft->user = new User(L"Player" + _toString<int>(System::currentTimeMillis() % 1000), L"");
}
}
//else
@ -4747,7 +4709,7 @@ void Minecraft::main()
// 4J-PB - Can't call this for the first 5 seconds of a game - MS rule
//if (ProfileManager.IsFullVersion())
{
name = L"Player" + std::to_wstring(System::currentTimeMillis() % 1000);
name = L"Player" + _toString<__int64>(System::currentTimeMillis() % 1000);
sessionId = L"-";
/* 4J - TODO - get a session ID from somewhere?
if (args.length > 0) name = args[0];
@ -5148,8 +5110,8 @@ void Minecraft::tickAllConnections()
bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
{
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it == m_pendingTextureRequests.end() )
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
if( it == m_pendingTextureRequests.end() )
{
m_pendingTextureRequests.push_back(textureName);
return true;
@ -5159,8 +5121,8 @@ bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
void Minecraft::handleClientTextureReceived(const wstring &textureName)
{
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it != m_pendingTextureRequests.end() )
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
if( it != m_pendingTextureRequests.end() )
{
m_pendingTextureRequests.erase(it);
}