Fixed gamertag being blank upon renaming and re-joining a save

This commit is contained in:
dtentiion 2026-03-05 01:42:40 +00:00
parent ff75e8f6e1
commit d4ef7b0894
2 changed files with 12 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#include "UI.h"
#include "UIScene_LoadMenu.h"
#include "..\..\Minecraft.h"
#include "..\..\User.h"
#include "..\..\TexturePackRepository.h"
#include "..\..\Options.h"
#include "..\..\MinecraftServer.h"
@ -273,7 +274,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
m_bIgnoreInput = false;
Minecraft *pMinecraft = Minecraft::GetInstance();
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
unsigned int texturePacksCount = (unsigned int)pMinecraft->skins->getTexturePackCount();
for(unsigned int i = 0; i < texturePacksCount; ++i)
{
TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i);
@ -1629,6 +1630,12 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal
param->settings = app.GetGameHostOption( eGameHostOption_All );
#ifdef _WINDOWS64
{
extern wchar_t g_Win64UsernameW[17];
Minecraft::GetInstance()->user->name = g_Win64UsernameW;
}
#endif
#ifndef _XBOX
g_NetworkManager.FakeLocalPlayerJoined();
#endif

View file

@ -329,6 +329,10 @@ void IQNet::EndGame()
m_player[i].m_gamertag[0] = 0;
m_player[i].SetCustomDataValue(0);
}
// Restore local player 0's gamertag so re-joining works correctly
extern wchar_t g_Win64UsernameW[17];
m_player[0].m_isHostPlayer = true;
wcscpy_s(m_player[0].m_gamertag, 32, g_Win64UsernameW);
}
DWORD MinecraftDynamicConfigurations::GetTrialTime() { return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; }