diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..c1108a81 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,22 @@ +# Pull Request Template + +## 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] diff --git a/Minecraft.Client/Common/DLC/DLCPack.cpp b/Minecraft.Client/Common/DLC/DLCPack.cpp index 187b1ee6..4a003d05 100644 --- a/Minecraft.Client/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Common/DLC/DLCPack.cpp @@ -384,7 +384,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 @@ -408,7 +411,7 @@ bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, const wstring &path) { //purchased return true; - } + }*/ } void DLCPack::UpdateLanguage() diff --git a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp index f3768a34..c845acd9 100644 --- a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp @@ -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; } diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index 7c69e5b8..d4d83228 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -65,7 +65,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)); diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index a9dd2d91..fa8d4776 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -1134,7 +1134,13 @@ 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 + const char* name = static_cast(thisPack->getName().c_str()); + int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); + std::wstring wName(len, 0); + MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); + setCentreLabel(wName.c_str()); + //setCentreLabel(thisPack->getName().c_str()); } else { @@ -1153,7 +1159,13 @@ 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 + const char* name = static_cast(thisPack->getName().c_str()); + int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); + std::wstring wName(len, 0); + MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); + setRightLabel(wName.c_str()); + //setRightLabel(thisPack->getName().c_str()); } else { @@ -1172,7 +1184,13 @@ 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 + const char* name = static_cast(thisPack->getName().c_str()); + int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); + std::wstring wName(len, 0); + MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); + setLeftLabel(wName.c_str()); + //setLeftLabel(thisPack->getName().c_str()); } else { diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 4a260d77..6ff69455 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -1468,7 +1468,12 @@ if not exist "$(TargetDir)\savedata" mkdir "$(TargetDir)\savedata" Copying sound assets to output directory xcopy /q /y /i /s /e "$(ProjectDir)Durango\Sound" "$(OutDir)Durango\Sound" -xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music" +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" $(ProjectDir)xbox\xex-dev.xml @@ -1602,7 +1607,12 @@ xcopy /q /y /i /s /e $(ProjectDir)DurangoMedia\CU $(LayoutDir)Image\Loose\CU Copying sound assets to output directory xcopy /q /y /i /s /e "$(ProjectDir)Durango\Sound" "$(OutDir)Durango\Sound" -xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music" +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" $(ProjectDir)xbox\xex-dev.xml diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index a8b2d9cc..bba33cad 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -14,6 +14,7 @@ CConsoleMinecraftApp app; CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() { + m_bShutdown = false; } void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId) @@ -26,8 +27,7 @@ void CConsoleMinecraftApp::StoreLaunchData() } void CConsoleMinecraftApp::ExitGame() { - // This is likely not the correct way to exit the game, but it will do for now - ExitProcess(0); + m_bShutdown = true; } void CConsoleMinecraftApp::FatalLoadError() { diff --git a/Minecraft.Client/Windows64/Windows64_App.h b/Minecraft.Client/Windows64/Windows64_App.h index 39351d55..de8f6d85 100644 --- a/Minecraft.Client/Windows64/Windows64_App.h +++ b/Minecraft.Client/Windows64/Windows64_App.h @@ -29,6 +29,8 @@ public: // original code virtual void TemporaryCreateGameStart(); + + bool m_bShutdown; }; extern CConsoleMinecraftApp app; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 42fb2d44..1bffe317 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -716,26 +716,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); - - WCHAR exePath[MAX_PATH] = { 0 }; - GetModuleFileNameW(NULL, exePath, MAX_PATH); - WCHAR* lastSlash = wcsrchr(exePath, L'\\'); - if (lastSlash) { - *lastSlash = L'\0'; - - WCHAR devCheckPath[MAX_PATH] = { 0 }; - swprintf_s(devCheckPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client\\Minecraft.Client.vcxproj", exePath); - - if (GetFileAttributesW(devCheckPath) != INVALID_FILE_ATTRIBUTES) { - WCHAR projectPath[MAX_PATH] = { 0 }; - swprintf_s(projectPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client", exePath); - SetCurrentDirectoryW(projectPath); - } - else { - SetCurrentDirectoryW(exePath); - } - } - // Declare DPI awareness so GetSystemMetrics returns physical pixels SetProcessDPIAware(); g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN); @@ -1054,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 ) ) { diff --git a/README.md b/README.md index 279f7051..76b0afe1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,23 @@ 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) +- **Inventory**: `E` +- **Drop Item**: `Q` +- **Crafting**: `C` +- **Toggle View (FPS/TPS)**: `F5` +- **Fullscreen**: `F11` +- **Pause Menu**: `Esc` +- **Attack / Destroy**: `Left Click` +- **Use / Place**: `Right Click` +- **Select Item**: `Mouse Wheel` or keys `1` to `9` ## Build & Run