Merge branch 'smartcmd:main' into main

This commit is contained in:
Omri
2026-03-02 00:00:08 +02:00
committed by GitHub
24 changed files with 145 additions and 48 deletions

View File

Before

Width:  |  Height:  |  Size: 952 KiB

After

Width:  |  Height:  |  Size: 952 KiB

22
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,22 @@
# Pull Request
## Description
Briefly describe the changes this PR introduces.
## Changes
### Previous Behavior
*Describe how the code behaved before this change.*
### Root Cause
*Explain the core reason behind the erroneous/old behavior (e.g., bug, design flaw, missing edge case).*
### New Behavior
*Describe how the code behaves after this change.*
### Fix Implementation
*Detail exactly how the issue was resolved (specific code changes, algorithms, logic flows).*
## Related Issues
- Fixes #[issue-number]
- Related to #[issue-number]

6
.gitignore vendored
View File

@@ -413,8 +413,12 @@ Minecraft.Client/Windows64/GameHDD/
# Intermediate build files (per-project)
Minecraft.Client/x64/
Minecraft.Client/Debug/
Minecraft.Client/x64_Debug/
Minecraft.Client/Release/
Minecraft.Client/x64_Release/
Minecraft.World/x64/
Minecraft.World/x64_Debug/
Minecraft.World/Debug/
Minecraft.World/x64_Debug/
Minecraft.World/Release/
Minecraft.World/x64_Release/

View File

@@ -56,7 +56,7 @@ void SoundEngine::playMusicTick() {};
#else
#ifdef _WINDOWS64
char SoundEngine::m_szSoundPath[]={"Durango\\Sound\\"};
char SoundEngine::m_szSoundPath[]={"Windows64Media\\Sound\\"};
char SoundEngine::m_szMusicPath[]={"music\\"};
char SoundEngine::m_szRedistName[]={"redist64"};
#elif defined _DURANGO

View File

@@ -3217,7 +3217,7 @@ void CMinecraftApp::HandleXuiActions(void)
bool gameStarted = false;
for(int i = 0; i < pMinecraft->levels.length; i++)
{
if (pMinecraft->levels.data[i] != nullptr)
if (pMinecraft->levels.data[i] != NULL)
{
gameStarted = true;
break;
@@ -9536,4 +9536,4 @@ bool CMinecraftApp::HasReachedMainMenu()
{
return m_hasReachedMainMenu;
}
#endif
#endif

View File

@@ -382,7 +382,10 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bo
bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, const wstring &path)
{
if(type == DLCManager::e_DLCType_All)
// Patch all DLC to be "purchased"
return true;
/*if(type == DLCManager::e_DLCType_All)
{
app.DebugPrintf("Unimplemented\n");
#ifndef _CONTENT_PACKAGE
@@ -406,5 +409,5 @@ bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, const wstring &path)
{
//purchased
return true;
}
}*/
}

View File

@@ -205,7 +205,9 @@ bool DLCSkinFile::getParameterAsBool(DLCManager::EDLCParameterType type)
switch(type)
{
case DLCManager::e_DLCParamType_Free:
return m_bIsFree;
// Patch all DLC to be "paid"
return false;
// return m_bIsFree;
default:
return false;
}

View File

@@ -935,6 +935,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
case ACTION_MENU_CANCEL: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break;
case ACTION_MENU_B: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break;
case ACTION_MENU_PAUSEMENU: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break;
case ACTION_MENU_LEFT_SCROLL: kbDown = KMInput.IsKeyDown('Q'); kbPressed = KMInput.IsKeyPressed('Q'); kbReleased = KMInput.IsKeyReleased('Q'); break;
case ACTION_MENU_RIGHT_SCROLL: kbDown = KMInput.IsKeyDown('E'); kbPressed = KMInput.IsKeyPressed('E'); kbReleased = KMInput.IsKeyReleased('E'); break;
}
pressed = pressed || kbPressed;
released = released || kbReleased;

View File

@@ -62,7 +62,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
LoadMenuInitData *params = (LoadMenuInitData *)initData;
//m_labelGameName.init(app.GetString(IDS_WORLD_NAME));
m_labelGameName.init(app.GetString(IDS_WORLD_NAME));
m_labelSeed.init(L"");
m_labelCreatedMode.init(app.GetString(IDS_CREATED_IN_SURVIVAL));

View File

@@ -334,7 +334,6 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
m_eAction=eAction_RunUnlockOrDLC;
signInReturnedFunc = &UIScene_MainMenu::UnlockFullGame_SignInReturned;
break;
#if defined _XBOX
case eControl_Exit:
if( ProfileManager.IsFullVersion() )
{
@@ -345,13 +344,14 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
}
else
{
#ifdef _XBOX
#ifdef _XBOX_ONE
ui.ShowPlayerDisplayname(true);
#endif
ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell);
#endif
}
break;
#endif
#ifdef _DURANGO
case eControl_XboxHelp:

View File

@@ -1242,6 +1242,15 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged()
updatePackDisplay();
}
std::wstring fakeWideToRealWide(const wchar_t* original)
{
const char* name = reinterpret_cast<const char*>(original);
int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0);
std::wstring wName(len, 0);
MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len);
return wName.c_str();
}
void UIScene_SkinSelectMenu::updatePackDisplay()
{
m_currentPackCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS;
@@ -1249,7 +1258,9 @@ void UIScene_SkinSelectMenu::updatePackDisplay()
if(m_packIndex >= SKIN_SELECT_MAX_DEFAULTS)
{
DLCPack *thisPack = app.m_dlcManager.getPack(m_packIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin);
setCentreLabel(thisPack->getName().c_str());
// Fix the incorrect string type on title to display correctly
setCentreLabel(fakeWideToRealWide(thisPack->getName().c_str()));
//setCentreLabel(thisPack->getName().c_str());
}
else
{
@@ -1268,7 +1279,9 @@ void UIScene_SkinSelectMenu::updatePackDisplay()
if(nextPackIndex >= SKIN_SELECT_MAX_DEFAULTS)
{
DLCPack *thisPack = app.m_dlcManager.getPack(nextPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin);
setRightLabel(thisPack->getName().c_str());
// Fix the incorrect string type on title to display correctly
setRightLabel(fakeWideToRealWide(thisPack->getName().c_str()));
//setRightLabel(thisPack->getName().c_str());
}
else
{
@@ -1287,7 +1300,9 @@ void UIScene_SkinSelectMenu::updatePackDisplay()
if(previousPackIndex >= SKIN_SELECT_MAX_DEFAULTS)
{
DLCPack *thisPack = app.m_dlcManager.getPack(previousPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin);
setLeftLabel(thisPack->getName().c_str());
// Fix the incorrect string type on title to display correctly
setLeftLabel(fakeWideToRealWide(thisPack->getName().c_str()));
//setLeftLabel(thisPack->getName().c_str());
}
else
{

View File

@@ -12,9 +12,11 @@ Input::Input()
{
xa = 0;
ya = 0;
sprintForward = 0;
wasJumping = false;
jumping = false;
sneaking = false;
usingKeyboardMovement = false;
lReset = false;
rReset = false;
@@ -40,16 +42,18 @@ void Input::tick(LocalPlayer *player)
ya = InputManager.GetJoypadStick_LY(iPad);
else
ya = 0.0f;
sprintForward = ya;
usingKeyboardMovement = false;
#ifdef _WINDOWS64
// WASD movement (combine with gamepad)
if (iPad == 0)
{
float kbX = 0.0f, kbY = 0.0f;
if (KMInput.IsKeyDown('W')) kbY += 1.0f;
if (KMInput.IsKeyDown('S')) kbY -= 1.0f;
if (KMInput.IsKeyDown('A')) kbX += 1.0f; // inverted like gamepad
if (KMInput.IsKeyDown('D')) kbX -= 1.0f;
if (KMInput.IsKeyDown('W')) { kbY += 1.0f; sprintForward += 1.0f; usingKeyboardMovement = true; }
if (KMInput.IsKeyDown('S')) { kbY -= 1.0f; sprintForward -= 1.0f; usingKeyboardMovement = true; }
if (KMInput.IsKeyDown('A')) { kbX += 1.0f; usingKeyboardMovement = true; } // inverted like gamepad
if (KMInput.IsKeyDown('D')) { kbX -= 1.0f; usingKeyboardMovement = true; }
// Normalize diagonal
if (kbX != 0.0f && kbY != 0.0f) { kbX *= 0.707f; kbY *= 0.707f; }
if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT))
@@ -58,11 +62,13 @@ void Input::tick(LocalPlayer *player)
ya = max(min(ya + kbY, 1.0f), -1.0f);
}
#endif
sprintForward = max(min(sprintForward, 1.0f), -1.0f);
#ifndef _CONTENT_PACKAGE
if (app.GetFreezePlayers())
{
xa = ya = 0.0f;
sprintForward = 0.0f;
player->abilities.flying = true;
}
#endif
@@ -74,6 +80,7 @@ void Input::tick(LocalPlayer *player)
lReset = true;
}
xa = ya = 0.0f;
sprintForward = 0.0f;
}
// 4J - in flying mode, don't actually toggle sneaking
@@ -168,4 +175,4 @@ void Input::tick(LocalPlayer *player)
#endif
//OutputDebugString("INPUT: End input tick\n");
}
}

View File

@@ -6,10 +6,12 @@ class Input
public:
float xa;
float ya;
float sprintForward;
bool wasJumping;
bool jumping;
bool sneaking;
bool usingKeyboardMovement;
Input(); // 4J - added
@@ -20,4 +22,4 @@ private:
bool lReset;
bool rReset;
bool m_gamepadSneaking;
};
};

View File

@@ -44,7 +44,7 @@ public:
#endif
static const int CHUNK_Y_COUNT = Level::maxBuildHeight / CHUNK_SIZE;
#if defined _XBOX_ONE
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 512 * 1024 * 1024; // 4J - added
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 2047 * 1024 * 1024; // Changed to 2047. 4J had set to 512.
#elif defined __ORBIS__
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 448 * 1024 * 1024; // 4J - added - hard limit is 512 so giving a lot of headroom here for fragmentation (have seen 16MB lost to fragmentation in multiplayer crash dump before)
#elif defined __PS3__

View File

@@ -274,11 +274,13 @@ void LocalPlayer::aiStep()
if (changingDimensionDelay > 0) changingDimensionDelay--;
bool wasJumping = input->jumping;
float runTreshold = 0.8f;
float sprintForward = input->sprintForward;
bool wasRunning = input->ya >= runTreshold;
bool wasRunning = sprintForward >= runTreshold;
//input->tick( dynamic_pointer_cast<Player>( shared_from_this() ) );
// 4J-PB - make it a localplayer
input->tick( this );
sprintForward = input->sprintForward;
if (isUsingItem())
{
input->xa *= 0.2f;
@@ -302,9 +304,20 @@ void LocalPlayer::aiStep()
// world with low food, then reload it in creative.
if(abilities.mayfly || isAllowedToFly() ) enoughFoodToSprint = true;
bool forwardEnoughToTriggerSprint = sprintForward >= runTreshold;
bool forwardReturnedToDeadzone = sprintForward == 0.0f;
bool forwardEnoughToContinueSprint = sprintForward >= runTreshold;
#ifdef _WINDOWS64
if (GetXboxPad() == 0 && input->usingKeyboardMovement)
{
forwardEnoughToContinueSprint = sprintForward > 0.0f;
}
#endif
#ifdef _WINDOWS64
// Keyboard sprint: Ctrl held while moving forward
if (GetXboxPad() == 0 && KMInput.IsKeyDown(VK_CONTROL) && input->ya > 0.0f &&
if (GetXboxPad() == 0 && input->usingKeyboardMovement && KMInput.IsKeyDown(VK_CONTROL) && sprintForward > 0.0f &&
enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && onGround)
{
if (!isSprinting()) setSprinting(true);
@@ -314,7 +327,7 @@ void LocalPlayer::aiStep()
// 4J - altered this slightly to make sure that the joypad returns to below returnTreshold in between registering two movements up to runThreshold
if (onGround && !isSprinting() && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness))
{
if( !wasRunning && input->ya >= runTreshold )
if( !wasRunning && forwardEnoughToTriggerSprint )
{
if (sprintTriggerTime == 0)
{
@@ -331,7 +344,7 @@ void LocalPlayer::aiStep()
}
}
}
else if( ( sprintTriggerTime > 0 ) && ( input->ya == 0.0f ) ) // ya of 0.0f here signifies that we have returned to the deadzone
else if( ( sprintTriggerTime > 0 ) && forwardReturnedToDeadzone ) // zero sprintForward here signifies that we have returned to the deadzone
{
sprintTriggerRegisteredReturn = true;
}
@@ -339,7 +352,7 @@ void LocalPlayer::aiStep()
if (isSneaking()) sprintTriggerTime = 0;
// 4J-PB - try not stopping sprint on collision
//if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint))
if (isSprinting() && (input->ya < runTreshold || !enoughFoodToSprint))
if (isSprinting() && (!forwardEnoughToContinueSprint || !enoughFoodToSprint || isSneaking() || isUsingItem()))
{
setSprinting(false);
}
@@ -1622,4 +1635,3 @@ void LocalPlayer::SetPlayerAdditionalModelParts(vector<ModelPart *>pAdditionalMo
{
m_pAdditionalModelParts=pAdditionalModelParts;
}

View File

@@ -1304,7 +1304,12 @@ if not exist "$(TargetDir)\savedata" mkdir "$(TargetDir)\savedata"</Command>
<PostBuildEvent>
<Message>Copying sound assets to output directory</Message>
<Command>xcopy /q /y /i /s /e "$(ProjectDir)Durango\Sound" "$(OutDir)Durango\Sound"
xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music"</Command>
xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music"
xcopy /q /y /i /s /e "$(ProjectDir)Windows64\GameHDD" "$(OutDir)Windows64\GameHDD"
xcopy /q /y /i /s /e "$(ProjectDir)Common\Media" "$(OutDir)Common\Media"
xcopy /q /y /i /s /e "$(ProjectDir)Common\res" "$(OutDir)Common\res"
xcopy /q /y /i /s /e "$(ProjectDir)Common\Trial" "$(OutDir)Common\Trial"
xcopy /q /y /i /s /e "$(ProjectDir)Common\Tutorial" "$(OutDir)Common\Tutorial"</Command>
</PostBuildEvent>
<ImageXex>
<ConfigurationFile>$(ProjectDir)xbox\xex-dev.xml</ConfigurationFile>
@@ -1435,9 +1440,25 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
<SuppressStartupBanner>false</SuppressStartupBanner>
</Link>
<PostBuildEvent>
<Message>Copying sound assets to output directory</Message>
<Command>xcopy /q /y /i /s /e "$(ProjectDir)Durango\Sound" "$(OutDir)Durango\Sound"
xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music"</Command>
<Message>Copying game assets to output directory</Message>
<Command>mkdir "$(OutDir)music" 2&gt;nul
mkdir "$(OutDir)Windows64\GameHDD" 2&gt;nul
mkdir "$(OutDir)Common\Media" 2&gt;nul
mkdir "$(OutDir)Common\res" 2&gt;nul
mkdir "$(OutDir)Common\Trial" 2&gt;nul
mkdir "$(OutDir)Common\Tutorial" 2&gt;nul
mkdir "$(OutDir)Windows64Media" 2&gt;nul
xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music" || exit /b 0
xcopy /q /y /i /s /e "$(ProjectDir)Windows64\GameHDD" "$(OutDir)Windows64\GameHDD" || exit /b 0
xcopy /q /y /i /s /e "$(ProjectDir)Common\Media" "$(OutDir)Common\Media" || exit /b 0
xcopy /q /y /i /s /e "$(ProjectDir)Common\res" "$(OutDir)Common\res" || exit /b 0
xcopy /q /y /i /s /e "$(ProjectDir)Common\Trial" "$(OutDir)Common\Trial" || exit /b 0
xcopy /q /y /i /s /e "$(ProjectDir)Common\Tutorial" "$(OutDir)Common\Tutorial" || exit /b 0
xcopy /q /y /i /s /e "$(ProjectDir)DurangoMedia" "$(OutDir)Windows64Media" || exit /b 0
xcopy /q /y /i /s /e "$(ProjectDir)Windows64Media" "$(OutDir)Windows64Media" || exit /b 0
exit /b 0</Command>
</PostBuildEvent>
<ImageXex>
<ConfigurationFile>$(ProjectDir)xbox\xex-dev.xml</ConfigurationFile>

View File

@@ -6014,9 +6014,6 @@
<Filter>PS3\SPUObjFiles\ContentPackage</Filter>
</Object>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Durango\Autogenerated.appxmanifest" />
</ItemGroup>
<ItemGroup>
<Xml Include="Durango\manifest.xml" />
</ItemGroup>

View File

@@ -14,6 +14,7 @@ CConsoleMinecraftApp app;
CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp()
{
m_bShutdown = false;
}
void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId)
@@ -26,6 +27,7 @@ void CConsoleMinecraftApp::StoreLaunchData()
}
void CConsoleMinecraftApp::ExitGame()
{
m_bShutdown = true;
}
void CConsoleMinecraftApp::FatalLoadError()
{

View File

@@ -29,6 +29,8 @@ public:
// original code
virtual void TemporaryCreateGameStart();
bool m_bShutdown;
};
extern CConsoleMinecraftApp app;

View File

@@ -1034,7 +1034,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
#endif
MSG msg = {0};
while( WM_QUIT != msg.message )
while( WM_QUIT != msg.message && !app.m_bShutdown)
{
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{

View File

@@ -50,7 +50,7 @@ void ConsoleUIController::init(ID3D11Device *dev, ID3D11DeviceContext *ctx, ID3D
really big so if you substitute a different file it should work. */
gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_vertexbuffer, 5000, 16 * 1024 * 1024);
gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_texture , 5000, 128 * 1024 * 1024);
gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_rendertarget, 10, 32 * 1024 * 1024);
gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_rendertarget, 10, 64 * 1024 * 1024);
/* GDraw is all set, so we'll point Iggy at it. */
IggySetGDraw(gdraw_funcs);

View File

@@ -9,18 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Minecraft.Client", "Minecra
EndProjectSection
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 3
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs4jstudios.visualstudio.com/defaultcollection
SccLocalPath0 = .
SccProjectUniqueName1 = Minecraft.World\\Minecraft.World.vcxproj
SccProjectName1 = Minecraft.World
SccLocalPath1 = Minecraft.World
SccProjectUniqueName2 = Minecraft.Client\\Minecraft.Client.vcxproj
SccProjectName2 = Minecraft.Client
SccLocalPath2 = Minecraft.Client
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
ContentPackage_NO_TU|Durango = ContentPackage_NO_TU|Durango
ContentPackage_NO_TU|ORBIS = ContentPackage_NO_TU|ORBIS

View File

@@ -2,7 +2,7 @@
[![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/5CSzhc9t)
![img.png](img.png)
![img.png](.github/IMG_8725.png)
## Introduction
@@ -15,6 +15,24 @@ This project contains the source code of Minecraft Legacy Console Edition v1.3.0
- Added fullscreen mode support (toggle using F11)
- Disabled V-Sync for better performance
- Auto-detect native monitor resolution with DPI awareness, resulting in sharper visuals on high-resolution displays
- Full support for keyboard and mouse input
## Controls (Keyboard & Mouse)
- **Movement**: `W` `A` `S` `D`
- **Jump / Fly (Up)**: `Space`
- **Sneak / Fly (Down)**: `Shift` (Hold)
- **Sprint**: `Ctrl` (Hold) or Double-tap `W`
- **Inventory**: `E`
- **Drop Item**: `Q`
- **Crafting**: `C`
- **Toggle View (FPS/TPS)**: `F5`
- **Fullscreen**: `F11`
- **Pause Menu**: `Esc`
- **Toggle Mouse Capture**: `Left Alt` (for debugging)
- **Attack / Destroy**: `Left Click`
- **Use / Place**: `Right Click`
- **Select Item**: `Mouse Wheel` or keys `1` to `9`
## Build & Run