Merge remote-tracking branch 'origin/main' into networking

This commit is contained in:
2026-09-06 09:33:19 -04:00
1476 changed files with 260663 additions and 269030 deletions
+4 -231
View File
@@ -11,17 +11,6 @@
#endif
#include "PSVita\PSVitaExtras\ShutdownManager.h"
//#define HEAPINSPECTOR_PS3 1
// when defining HEAPINSPECTOR_PS3, add this line to the linker settings
// --wrap malloc --wrap free --wrap memalign --wrap calloc --wrap realloc --wrap reallocalign --wrap _malloc_init
#if HEAPINSPECTOR_PS3
#include "HeapInspector\Server\HeapInspectorServer.h"
#include "HeapInspector\Server\PS3\HeapHooks.hpp"
#endif
//#define DISABLE_MILES_SOUND
#include "PSVita_App.h"
#include "PSVitaExtras\PSVitaStrings.h"
#include "GameConfig\Minecraft.spa.h"
@@ -44,20 +33,14 @@
#include "..\..\Minecraft.World\ThreadName.h"
#include "..\..\Minecraft.Client\StatsCounter.h"
#include "..\ConnectScreen.h"
//#include "Social\SocialManager.h"
//#include "Leaderboards\LeaderboardManager.h"
//#include "XUI\XUI_Scene_Container.h"
//#include "NetworkManager.h"
#include "..\..\Minecraft.Client\Tesselator.h"
#include "..\Common\Console_Awards_enum.h"
#include "..\..\Minecraft.Client\Options.h"
#include "Sentient\SentientManager.h"
#include "..\..\Minecraft.World\IntCache.h"
#include "..\Textures.h"
//#include "Resource.h"
#include "..\..\Minecraft.World\compression.h"
#include "..\..\Minecraft.World\OldChunkStorage.h"
//#include "PS3\PS3Extras\EdgeZLib.h"
#include "..\..\Minecraft.World\C4JThread.h"
#include "Common\UI\IUIScene_PauseMenu.h"
#include "Conf.h"
@@ -69,64 +52,19 @@
#include <ult.h>
#include <apputil.h>
#define THEME_NAME "584111F70AAAAAAA"
#define THEME_FILESIZE 2797568
/* Encrypted ID for protected data file (*) You must edit these binaries!! */
/*char secureFileId[CELL_SAVEDATA_SECUREFILEID_SIZE] =
{
0xEE, 0xA9, 0x37, 0xCC,
0x5B, 0xD4, 0xD9, 0x0D,
0x55, 0xED, 0x25, 0x31,
0xFA, 0x33, 0xBD, 0xC4
};*/
#define FIFTY_ONE_MB (1000000*51) // Maximum TCR space required for a save is 52MB (checking for this on a selected device)
//#define PROFILE_VERSION 3 // new version for the interim bug fix 166 TU
#define NUM_PROFILE_VALUES 5
#define NUM_PROFILE_SETTINGS 4
DWORD dwProfileSettingsA[NUM_PROFILE_VALUES]=
{
#ifdef _XBOX
XPROFILE_OPTION_CONTROLLER_VIBRATION,
XPROFILE_GAMER_YAXIS_INVERSION,
XPROFILE_GAMER_CONTROL_SENSITIVITY,
XPROFILE_GAMER_ACTION_MOVEMENT_CONTROL,
XPROFILE_TITLE_SPECIFIC1,
#else
0,0,0,0,0
#endif
};
// functions for storing and converting rich presence strings from wchar to utf8
uint8_t * AddRichPresenceString(int iID);
void FreeRichPresenceStrings();
#if HEAPINSPECTOR_PS3
std::vector<HeapInspectorServer::HeapInfo> GetHeapInfo()
{
std::vector<HeapInspectorServer::HeapInfo> result = HeapInspectorServer::GetDefaultHeapInfo();
HeapInspectorServer::HeapInfo localHeapInfo;
localHeapInfo.m_Description = "VRAM";
localHeapInfo.m_Range.m_Min = 0xc0000000;
localHeapInfo.m_Range.m_Max = localHeapInfo.m_Range.m_Min + (249*1024*1024);
result.push_back(localHeapInfo);
return result;
}
extern "C" void* __real__malloc_init(size_t a_Boundary, size_t a_Size);
extern "C" void* __wrap__malloc_init(size_t a_Boundary, size_t a_Size)
{
void* result = __real__malloc_init(a_Boundary, a_Size);
HeapInspectorServer::Initialise(GetHeapInfo(), 3000, HeapInspectorServer::WaitForConnection_Enabled);
return result;
}
#endif // HEAPINSPECTOR_PS3
//-------------------------------------------------------------------------------------
// Time Since fAppTime is a float, we need to keep the quadword app time
// as a LARGE_INTEGER so that we don't lose precision after running
@@ -366,16 +304,6 @@ void RegisterAwardsWithProfileManager()
ProfileManager.RegisterAward(eAward_lionTamer, ACHIEVEMENT_50, eAwardType_Achievement);
#endif
#if 0
ProfileManager.RegisterAward(eAward_mine100Blocks, GAMER_PICTURE_GAMERPIC1, eAwardType_GamerPic,false,app.GetStringTable(),IDS_AWARD_TITLE,IDS_AWARD_GAMERPIC1,IDS_CONFIRM_OK);
ProfileManager.RegisterAward(eAward_kill10Creepers, GAMER_PICTURE_GAMERPIC2, eAwardType_GamerPic,false,app.GetStringTable(),IDS_AWARD_TITLE,IDS_AWARD_GAMERPIC2,IDS_CONFIRM_OK);
ProfileManager.RegisterAward(eAward_eatPorkChop, AVATARASSETAWARD_PORKCHOP_TSHIRT, eAwardType_AvatarItem,false,app.GetStringTable(),IDS_AWARD_TITLE,IDS_AWARD_AVATAR1,IDS_CONFIRM_OK);
ProfileManager.RegisterAward(eAward_play100Days, AVATARASSETAWARD_WATCH, eAwardType_AvatarItem,false,app.GetStringTable(),IDS_AWARD_TITLE,IDS_AWARD_AVATAR2,IDS_CONFIRM_OK);
ProfileManager.RegisterAward(eAward_arrowKillCreeper, AVATARASSETAWARD_CAP, eAwardType_AvatarItem,false,app.GetStringTable(),IDS_AWARD_TITLE,IDS_AWARD_AVATAR3,IDS_CONFIRM_OK);
ProfileManager.RegisterAward(eAward_socialPost, 0, eAwardType_Theme,false,app.GetStringTable(),IDS_AWARD_TITLE,IDS_AWARD_THEME,IDS_CONFIRM_OK,THEME_NAME,THEME_FILESIZE);
#endif
// Rich Presence init - number of presences, number of contexts
//printf("Rich presence strings are hard coded on PS3 for now, must change this!\n");
ProfileManager.RichPresenceInit(4,1);
@@ -641,17 +569,8 @@ int main()
StorageManager.SetIncompleteSaveCallback(CConsoleMinecraftApp::Callback_SaveGameIncomplete, (LPVOID)&app);
#if 0
// Set up the global title storage path
StorageManager.StoreTMSPathName();
#endif
// set a function to be called when there's a sign in change, so we can exit a level if the primary player signs out
ProfileManager.SetSignInChangeCallback(&CConsoleMinecraftApp::SignInChangeCallback,(LPVOID)&app);
#if 0
// set a function to be called when the ethernet is disconnected, so we can back out if required
ProfileManager.SetNotificationsCallback(&CConsoleMinecraftApp::NotificationsCallback,(LPVOID)&app);
#endif
// Set a callback for the default player options to be set - when there is no profile data for the player
StorageManager.SetDefaultOptionsCallback(&CConsoleMinecraftApp::DefaultOptionsCallback,(LPVOID)&app);
@@ -660,11 +579,6 @@ int main()
// Set a callback to deal with old profile versions needing updated to new versions
StorageManager.SetOldProfileVersionCallback(&CConsoleMinecraftApp::OldProfileVersionCallback,(LPVOID)&app);
#if 0
// Set a callback for when there is a read error on profile data
//StorageManager.SetProfileReadErrorCallback(&CConsoleMinecraftApp::ProfileReadErrorCallback,(LPVOID)&app);
#endif
StorageManager.SetDLCInfoMap(app.GetSonyDLCMap());
app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL
@@ -673,8 +587,6 @@ int main()
app.GetCommerce()->CheckForTrialUpgradeKey();
#endif
// debug switch to trial version
//ProfileManager.SetDebugFullOverride(false);
@@ -687,21 +599,7 @@ int main()
//ProfileManager.AddDLC(2);
StorageManager.SetDLCPackageRoot("DLCDrive");
#if 0
StorageManager.RegisterMarketplaceCountsCallback(&CConsoleMinecraftApp::MarketplaceCountsCallback,(LPVOID)&app);
// Kinect !
if(XNuiGetHardwareStatus()!=0)
{
// If the Kinect Sensor is not physically connected, this function returns 0.
NuiInitialize(NUI_INITIALIZE_FLAG_USES_HIGH_QUALITY_COLOR | NUI_INITIALIZE_FLAG_USES_DEPTH |
NUI_INITIALIZE_FLAG_EXTRAPOLATE_FLOOR_PLANE | NUI_INITIALIZE_FLAG_USES_FITNESS | NUI_INITIALIZE_FLAG_NUI_GUIDE_DISABLED | NUI_INITIALIZE_FLAG_SUPPRESS_AUTOMATIC_UI,NUI_INITIALIZE_DEFAULT_HARDWARE_THREAD );
}
// Sentient !
hr = SentientManager.Init();
#endif
// Initialise TLS for tesselator, for this main thread
Tesselator::CreateNewThreadStorage(1024*1024);
// Initialise TLS for AABB and Vec3 pools, for this main thread
@@ -749,22 +647,6 @@ int main()
//CXuiSceneBase::UpdateScreenSettings(0);
//#endif
app.InitialiseTips();
#if 0
DWORD initData=0;
#ifndef _FINAL_BUILD
#ifndef _DEBUG
#pragma message(__LOC__"Need to define the _FINAL_BUILD before submission")
#endif
#endif
// Set the default sound levels
pMinecraft->options->set(Options::Option::MUSIC,1.0f);
pMinecraft->options->set(Options::Option::SOUND,1.0f);
app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_Intro,&initData);
#endif
// wait for the trophy init to complete - nonblocking semaphore
while(( !ProfileManager.AreTrophiesInstalled() ) && ShutdownManager::ShouldRun(ShutdownManager::eMainThread))
@@ -790,46 +672,18 @@ int main()
// read the options here for controller 0 - this won't actually be actioned until a storagemanager tick later
StorageManager.ReadFromProfile(0);
//app.TemporaryCreateGameStart();
#ifdef _TEMPORARY_CREATE_GAME
app.TemporaryCreateGameStart();
//Sleep(10000);
#if 0
// Intro loop ?
while(app.IntroRunning())
{
ProfileManager.Tick();
// Tick XUI
app.RunFrame();
// 4J : WESTY : Added to ensure we always have clear background for intro.
RenderManager.SetClearColour(D3DCOLOR_RGBA(0,0,0,255));
RenderManager.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Render XUI
hr = app.Render();
// Present the frame.
RenderManager.Present();
// Update XUI Timers
hr = XuiTimersRun();
}
Sleep(10000);
#endif
while( true )
{
#ifndef DISABLE_PSN
SonyVoiceChat_Vita::tick();
#endif
RenderManager.StartFrame();
#if 0
if(pMinecraft->soundEngine->isStreamingWavebankReady() &&
!pMinecraft->soundEngine->isPlayingStreamingGameMusic() &&
!pMinecraft->soundEngine->isPlayingStreamingCDMusic() )
{
// play some music in the menus
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0, false);
}
#endif
// static bool bPlay=false;
// if(bPlay)
@@ -892,81 +746,9 @@ int main()
pMinecraft->soundEngine->playMusicTick();
#ifdef MEMORY_TRACKING
static bool bResetMemTrack = false;
static bool bDumpMemTrack = false;
MemPixStuff();
if( bResetMemTrack )
{
ResetMem();
MEMORYSTATUS memStat;
GlobalMemoryStatus(&memStat);
printf("RESETMEM: Avail. phys %d\n",memStat.dwAvailPhys/(1024*1024));
bResetMemTrack = false;
}
if( bDumpMemTrack )
{
DumpMem();
bDumpMemTrack = false;
MEMORYSTATUS memStat;
GlobalMemoryStatus(&memStat);
printf("DUMPMEM: Avail. phys %d\n",memStat.dwAvailPhys/(1024*1024));
printf("Renderer used: %d\n",RenderManager.CBuffSize(-1));
}
#endif
#if 0
static bool bDumpTextureUsage = false;
if( bDumpTextureUsage )
{
RenderManager.TextureGetStats();
bDumpTextureUsage = false;
}
#endif
ui.tick();
ui.render();
#if 0
app.HandleButtonPresses();
// store the minecraft renderstates, and re-set them after the xui render
GetRenderAndSamplerStates(pDevice,RenderStateA,SamplerStateA);
// Tick XUI
PIXBeginNamedEvent(0,"Xui running");
app.RunFrame();
PIXEndNamedEvent();
// Render XUI
PIXBeginNamedEvent(0,"XUI render");
MemSect(7);
hr = app.Render();
MemSect(0);
GetRenderAndSamplerStates(pDevice,RenderStateA2,SamplerStateA2);
PIXEndNamedEvent();
for(int i=0;i<8;i++)
{
if(RenderStateA2[i]!=RenderStateA[i])
{
//printf("Reseting RenderStateA[%d] after a XUI render\n",i);
pDevice->SetRenderState(RenderStateModes[i],RenderStateA[i]);
}
}
for(int i=0;i<5;i++)
{
if(SamplerStateA2[i]!=SamplerStateA[i])
{
//printf("Reseting SamplerStateA[%d] after a XUI render\n",i);
pDevice->SetSamplerState(0,SamplerStateModes[i],SamplerStateA[i]);
}
}
RenderManager.Set_matrixDirty();
#endif
// Present the frame.
RenderManager.Present();
@@ -1023,19 +805,10 @@ int main()
PIXBeginNamedEvent(0,"Network manager do work #2");
g_NetworkManager.DoWork();
PIXEndNamedEvent();
#if 0
PIXBeginNamedEvent(0,"Misc extra xui");
// Update XUI Timers
hr = XuiTimersRun();
#endif // #if 0
// Any threading type things to deal with from the xui side?
app.HandleXuiActions();
#if 0
PIXEndNamedEvent();
#endif
// 4J-PB - Update the trial timer display if we are in the trial version
if(!ProfileManager.IsFullVersion())
{