feat: possibly fix saves

This commit is contained in:
NOTPIES 2026-03-01 21:40:49 -03:00
parent 21a5a4aef0
commit 14dd49de96
3 changed files with 16 additions and 4 deletions

View file

@ -1396,8 +1396,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
Minecraft *pMinecraft = Minecraft::GetInstance();
Socket *socket = NULL;
int userIdx = pNetworkPlayer->GetUserIndex();
shared_ptr<MultiplayerLocalPlayer> mpPlayer = (userIdx >= 0 && userIdx < XUSER_MAX_COUNT) ? pMinecraft->localplayers[userIdx] : nullptr;
shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
{
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change

View file

@ -978,6 +978,19 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
ProfileManager.RichPresenceInit(4,1);
ProfileManager.RegisterRichPresenceContext(CONTEXT_GAME_STATE);
// Ensure the GameHDD save directory exists at runtime (the 4J_Storage lib expects it)
{
wchar_t exePath[MAX_PATH];
GetModuleFileNameW(NULL, exePath, MAX_PATH);
wstring exeDir(exePath);
size_t lastSlash = exeDir.find_last_of(L"\\/");
if (lastSlash != wstring::npos)
exeDir = exeDir.substr(0, lastSlash);
wstring gameHDDPath = exeDir + L"\\Windows64\\GameHDD";
CreateDirectoryW((exeDir + L"\\Windows64").c_str(), NULL);
CreateDirectoryW(gameHDDPath.c_str(), NULL);
}
// initialise the storage manager with a default save display name, a Minimum save size, and a callback for displaying the saving message
StorageManager.Init(app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app);
// Set up the global title storage path

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "InputOutputStream.h"
#include "Socket.h"
#include "Connection.h"
@ -308,7 +308,7 @@ bool Connection::readTick()
// printf("Con:0x%x readTick close EOS\n",this);
// 4J Stu - Remove this line
// Fix for #10410 - UI: If the player is removed from a splitscreened hosts game, the next game that player joins will produce a message stating that the host has left.
// Fix for #10410 - UI: If the player is removed from a splitscreened host<EFBFBD>s game, the next game that player joins will produce a message stating that the host has left.
//close(DisconnectPacket::eDisconnect_EndOfStream);
}