diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp
index d8ce4c83..eaee6b58 100644
--- a/Minecraft.Client/Common/UI/UIController.cpp
+++ b/Minecraft.Client/Common/UI/UIController.cpp
@@ -172,17 +172,6 @@ UIController::UIController()
InitializeCriticalSection(&m_Allocatorlock);
#endif
- // 4J Stu - This is a bit of a hack until we change the Minecraft initialisation to store the proper screen size for other platforms
-#if defined _WINDOWS64 || defined _DURANGO || defined __ORBIS__
- m_fScreenWidth = 1920.0f;
- m_fScreenHeight = 1080.0f;
- m_bScreenWidthSetup = true;
-#else
- m_fScreenWidth = 1280.0f;
- m_fScreenHeight = 720.0f;
- m_bScreenWidthSetup = false;
-#endif
-
for(unsigned int i = 0; i < eLibrary_Count; ++i)
{
m_iggyLibraries[i] = IGGY_INVALID_LIBRARY;
@@ -314,35 +303,30 @@ void UIController::SetupFont()
switch(XGetLanguage())
{
-#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
- case XC_LANGUAGE_JAPANESE:
- m_mcTTFFont = new UITTFFont("Common/Media/font/JPN/DF-DotDotGothic16.ttf", 0x203B); // JPN
- break;
- case XC_LANGUAGE_SCHINESE: //TODO
- case XC_LANGUAGE_TCHINESE:
- m_mcTTFFont = new UITTFFont("Common/Media/font/CHT/DFTT_R5.TTC", 0x203B); // CHT
- break;
- case XC_LANGUAGE_KOREAN:
- m_mcTTFFont = new UITTFFont("Common/Media/font/KOR/candadite2.ttf", 0x203B); // KOR
- break;
- // 4J-JEV, Cyrillic characters have been added to this font now, (4/July/14)
- //case XC_LANGUAGE_RUSSIAN:
- //case XC_LANGUAGE_GREEK:
-#else
case XC_LANGUAGE_JAPANESE:
+#if defined __PS3__ || __ORBIS__ || __PSVITA__
m_mcTTFFont = new UITTFFont("Common/Media/font/JPN/DFGMaruGothic-Md.ttf", 0x2022); // JPN
+#else
+ m_mcTTFFont = new UITTFFont("Common/Media/font/JPN/DF-DotDotGothic16.ttf", 0x203B); // JPN
+#endif
break;
- case XC_LANGUAGE_SCHINESE: //TODO
+ case XC_LANGUAGE_SCHINESE:
case XC_LANGUAGE_TCHINESE:
+#if defined __PS3__ || __ORBIS__ || __PSVITA__
m_mcTTFFont = new UITTFFont("Common/Media/font/CHT/DFHeiMedium-B5.ttf", 0x2022); // CHT
+#else
+ m_mcTTFFont = new UITTFFont("Common/Media/font/CHT/DFTT_R5.TTC", 0x203B); // CHT
+#endif
break;
case XC_LANGUAGE_KOREAN:
+#if defined __PS3__ || __ORBIS__ || __PSVITA__
m_mcTTFFont = new UITTFFont("Common/Media/font/KOR/BOKMSD.ttf", 0x2022); // KOR
- break;
+#else
+ m_mcTTFFont = new UITTFFont("Common/Media/font/KOR/candadite2.ttf", 0x203B); // KOR
#endif
+ break;
default:
bBitmapFont=true;
- // m_mcTTFFont = new UITTFFont("Common/Media/font/Mojangles.ttf", 0x2022); // 4J-JEV: Shouldn't be using this.
break;
}
@@ -426,7 +410,7 @@ void UIController::loadSkins()
#elif defined __PSVITA__
platformSkinPath = L"skinVita.swf";
#elif defined _WINDOWS64
- if(m_fScreenHeight==1080.0f)
+ if(m_fScreenHeight >= 1080.0f)
{
platformSkinPath = L"skinHDWin.swf";
}
@@ -435,7 +419,7 @@ void UIController::loadSkins()
platformSkinPath = L"skinWin.swf";
}
#elif defined _DURANGO
- if(m_fScreenHeight==1080.0f)
+ if(m_fScreenHeight >= 1080.0f)
{
platformSkinPath = L"skinHDDurango.swf";
}
@@ -444,7 +428,7 @@ void UIController::loadSkins()
platformSkinPath = L"skinDurango.swf";
}
#elif defined __ORBIS__
- if(m_fScreenHeight==1080.0f)
+ if(m_fScreenHeight >= 1080.0f)
{
platformSkinPath = L"skinHDOrbis.swf";
}
@@ -454,58 +438,37 @@ void UIController::loadSkins()
}
#endif
- // Every platform has one of these, so nothing shared
- if(m_fScreenHeight==1080.0f)
+
+ // str1k3r - Fixes 720p/480p Crashes on Windows64, also allows this to be used on 1080p consoles instead of just Windows64
+ // This also cleans up some 4J code and turns 3 if statements into 1.
+ if (ui.getScreenWidth() >= 1920.0f)
{
m_iggyLibraries[eLibrary_Platform] = loadSkin(platformSkinPath, L"platformskinHD.swf");
+ m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinHDGraphics.swf", L"skinHDGraphics.swf");
+ m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinHDGraphicsHud.swf", L"skinHDGraphicsHud.swf");
+ m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinHDGraphicsInGame.swf", L"skinHDGraphicsInGame.swf");
+ m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinHDGraphicsTooltips.swf", L"skinHDGraphicsTooltips.swf");
+ m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinHDGraphicsLabels.swf", L"skinHDGraphicsLabels.swf");
+ m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinHDLabels.swf", L"skinHDLabels.swf");
+ m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinHDInGame.swf", L"skinHDInGame.swf");
+ m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHDHud.swf", L"skinHDHud.swf");
+ m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinHDTooltips.swf", L"skinHDTooltips.swf");
+ m_iggyLibraries[eLibrary_Default] = loadSkin(L"skinHD.swf", L"skinHD.swf");
}
else
{
m_iggyLibraries[eLibrary_Platform] = loadSkin(platformSkinPath, L"platformskin.swf");
+ m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinGraphics.swf", L"skinGraphics.swf");
+ m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinGraphicsHud.swf", L"skinGraphicsHud.swf");
+ m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinGraphicsInGame.swf", L"skinGraphicsInGame.swf");
+ m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinGraphicsTooltips.swf", L"skinGraphicsTooltips.swf");
+ m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinGraphicsLabels.swf", L"skinGraphicsLabels.swf");
+ m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinLabels.swf", L"skinLabels.swf");
+ m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinInGame.swf", L"skinInGame.swf");
+ m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHud.swf", L"skinHud.swf");
+ m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinTooltips.swf", L"skinTooltips.swf");
+ m_iggyLibraries[eLibrary_Default] = loadSkin(L"skin.swf", L"skin.swf");
}
-
-#if defined(__PS3__) || defined(__PSVITA__)
- m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinGraphics.swf", L"skinGraphics.swf");
- m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinGraphicsHud.swf", L"skinGraphicsHud.swf");
- m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinGraphicsInGame.swf", L"skinGraphicsInGame.swf");
- m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinGraphicsTooltips.swf", L"skinGraphicsTooltips.swf");
- m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinGraphicsLabels.swf", L"skinGraphicsLabels.swf");
- m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinLabels.swf", L"skinLabels.swf");
- m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinInGame.swf", L"skinInGame.swf");
- m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHud.swf", L"skinHud.swf");
- m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinTooltips.swf", L"skinTooltips.swf");
- m_iggyLibraries[eLibrary_Default] = loadSkin(L"skin.swf", L"skin.swf");
-#endif
-
-#if ( defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) )
-
-#if defined(_WINDOWS64)
- // 4J Stu - Load the 720/480 skins so that we have something to fallback on during development
-#ifndef _FINAL_BUILD
- m_iggyLibraries[eLibraryFallback_GraphicsDefault] = loadSkin(L"skinGraphics.swf", L"skinGraphics.swf");
- m_iggyLibraries[eLibraryFallback_GraphicsHUD] = loadSkin(L"skinGraphicsHud.swf", L"skinGraphicsHud.swf");
- m_iggyLibraries[eLibraryFallback_GraphicsInGame] = loadSkin(L"skinGraphicsInGame.swf", L"skinGraphicsInGame.swf");
- m_iggyLibraries[eLibraryFallback_GraphicsTooltips] = loadSkin(L"skinGraphicsTooltips.swf", L"skinGraphicsTooltips.swf");
- m_iggyLibraries[eLibraryFallback_GraphicsLabels] = loadSkin(L"skinGraphicsLabels.swf", L"skinGraphicsLabels.swf");
- m_iggyLibraries[eLibraryFallback_Labels] = loadSkin(L"skinLabels.swf", L"skinLabels.swf");
- m_iggyLibraries[eLibraryFallback_InGame] = loadSkin(L"skinInGame.swf", L"skinInGame.swf");
- m_iggyLibraries[eLibraryFallback_HUD] = loadSkin(L"skinHud.swf", L"skinHud.swf");
- m_iggyLibraries[eLibraryFallback_Tooltips] = loadSkin(L"skinTooltips.swf", L"skinTooltips.swf");
- m_iggyLibraries[eLibraryFallback_Default] = loadSkin(L"skin.swf", L"skin.swf");
-#endif
-#endif
-
- m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinHDGraphics.swf", L"skinHDGraphics.swf");
- m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinHDGraphicsHud.swf", L"skinHDGraphicsHud.swf");
- m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinHDGraphicsInGame.swf", L"skinHDGraphicsInGame.swf");
- m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinHDGraphicsTooltips.swf", L"skinHDGraphicsTooltips.swf");
- m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinHDGraphicsLabels.swf", L"skinHDGraphicsLabels.swf");
- m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinHDLabels.swf", L"skinHDLabels.swf");
- m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinHDInGame.swf", L"skinHDInGame.swf");
- m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHDHud.swf", L"skinHDHud.swf");
- m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinHDTooltips.swf", L"skinHDTooltips.swf");
- m_iggyLibraries[eLibrary_Default] = loadSkin(L"skinHD.swf", L"skinHD.swf");
-#endif // HD platforms
}
IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinName)
@@ -558,28 +521,18 @@ void UIController::ReloadSkin()
m_iggyLibraries[i] = IGGY_INVALID_LIBRARY;
}
-#ifdef _WINDOWS64
- // 4J Stu - Don't load on a thread on windows. I haven't investigated this in detail, so a quick fix
- reloadSkinThreadProc(this);
-#else
- // Navigate to the timer scene so that we can display something while the loading is happening
- ui.NavigateToScene(0,eUIScene_Timer,(void *)1,eUILayer_Tooltips,eUIGroup_Fullscreen);
-
m_reloadSkinThread = new C4JThread(reloadSkinThreadProc, (void*)this, "Reload skin thread");
m_reloadSkinThread->SetProcessor(CPU_CORE_UI_SCENE);
- //m_reloadSkinThread->Run();
- //// Load new skin
- //loadSkins();
+ // Navigate to the timer scene so that we can display something while the loading is happening
+ // str1k3r - Exclude this from windows64 as its not needed
+#ifndef _WINDOWS64
+ ui.NavigateToScene(0,eUIScene_Timer,(void *)1,eUILayer_Tooltips,eUIGroup_Fullscreen);
+#endif
- //// Reload all scene swf
- //for(int i = eUIGroup_Player1; i <= eUIGroup_Player4; ++i)
- //{
- // m_groups[i]->ReloadAll();
- //}
-
- //// Always reload the fullscreen group
- //m_groups[eUIGroup_Fullscreen]->ReloadAll();
+ // str1k3r - Fixes 4J's issue with the screen staying on the timer scene if on another thread on windows64
+#ifdef _WINDOWS64
+ m_reloadSkinThread->Run();
#endif
}
diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj
index 84e4cf1f..756fc0f9 100644
--- a/Minecraft.Client/Minecraft.Client.vcxproj
+++ b/Minecraft.Client/Minecraft.Client.vcxproj
@@ -16633,6 +16633,44 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue
true
+
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+
true
true
diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters
index aca34fc8..10f3dd34 100644
--- a/Minecraft.Client/Minecraft.Client.vcxproj.filters
+++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters
@@ -3622,6 +3622,9 @@
Common\Source Files\UI\Scenes
+
+ Windows64\Source Files
+
diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp
index ef9f6cf6..035d080d 100644
--- a/Minecraft.Client/Windows64/Windows64_App.cpp
+++ b/Minecraft.Client/Windows64/Windows64_App.cpp
@@ -24,11 +24,108 @@ void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId)
void CConsoleMinecraftApp::StoreLaunchData()
{
}
+
void CConsoleMinecraftApp::ExitGame()
{
+ app.DebugPrintf("CConsoleMinecraftApp::ExitGame\n");
+
+ //str1k3r - since ExitGame is always ran by the user, it should always be 0
+ PostQuitMessage(0);
}
+
void CConsoleMinecraftApp::FatalLoadError()
{
+ //str1k3r - very much inspired by the PS3 FatalLoadError :3
+ wchar_t *aStrings[2];
+
+ app.DebugPrintf("CConsoleMinecraftApp::FatalLoadError\n");
+
+ switch (XGetLanguage())
+ {
+ case XC_LANGUAGE_GERMAN:
+ aStrings[0] = L"Ladefehler";
+ aStrings[1] = L"Minecraft: Legacy Edition konnte nicht geladen werden und kann daher nicht fortgesetzt werden.";
+ break;
+ case XC_LANGUAGE_SPANISH:
+ aStrings[0] = L"Error al cargar";
+ aStrings[1] = L"Se ha producido un error al cargar Minecraft: Legacy Edition y no es posible continuar.";
+ break;
+ case XC_LANGUAGE_FRENCH:
+ aStrings[0] = L"Échec du chargement";
+ aStrings[1] = L"Le chargement de Minecraft: Legacy Edition a échoué : impossible de continuer.";
+ break;
+ case XC_LANGUAGE_ITALIAN:
+ aStrings[0] = L"Errore caricamento";
+ aStrings[1] = L"Caricamento Minecraft: Legacy Edition non riuscito, impossibile continuare.";
+ break;
+ case XC_LANGUAGE_JAPANESE:
+ aStrings[0] = L"ロード エラー";
+ aStrings[1] = L"Minecraft Legacy 版のロードに失敗しました。続行できません";
+ break;
+ case XC_LANGUAGE_KOREAN:
+ aStrings[0] = L"불러오기 오류";
+ aStrings[1] = L"Minecraft: Legacy Edition 을 불러오는 중에 오류가 발생하여 계속할 수 없습니다.";
+ break;
+ case XC_LANGUAGE_PORTUGUESE:
+ aStrings[0] = L"Erro de Carregamento";
+ aStrings[1] = L"Não foi possível carregar Minecraft: Legacy Edition e não é possível continuar.";
+ break;
+ case XC_LANGUAGE_RUSSIAN:
+ aStrings[0] = L"Ошибка при загрузке";
+ aStrings[1] = L"Не удалось загрузить игру Minecraft: Legacy Edition. Продолжить загрузку невозможно.";
+ break;
+ case XC_LANGUAGE_TCHINESE:
+ aStrings[0] = L"載入錯誤";
+ aStrings[1] = L"無法載入「Minecraft: Legacy Edition」,因此無法繼續。";
+ break;
+ case XC_LANGUAGE_DUTCH:
+ aStrings[0] = L"Fout tijdens het laden";
+ aStrings[1] = L"Minecraft: Legacy Edition kan niet worden geladen.";
+ break;
+ case XC_LANGUAGE_FINISH:
+ aStrings[0] = L"Latausvirhe";
+ aStrings[1] = L"Minecraft: Legacy Edition -pelin lataaminen ei onnistunut, eikä sitä voi jatkaa.";
+ break;
+ case XC_LANGUAGE_SWEDISH:
+ aStrings[0] = L"Laddningsfel";
+ aStrings[1] = L"Minecraft: Legacy Edition kunde inte laddas och kan inte fortsätta.";
+ break;
+ case XC_LANGUAGE_DANISH:
+ aStrings[0] = L"Indlæsningsfejl";
+ aStrings[1] = L"Minecraft: Legacy Edition kunne ikke blive indlæst og kan derfor ikke fortsætte.";
+ break;
+ case XC_LANGUAGE_BNORWEGIAN:
+ aStrings[0] = L"Innlastingsfeil";
+ aStrings[1] = L"Feil under innlasting av Minecraft: Legacy Edition. Kan ikke fortsette.";
+ break;
+ case XC_LANGUAGE_POLISH:
+ aStrings[0] = L"Błąd wczytywania";
+ aStrings[1] = L"Wystąpił błąd podczas wczytywania Minecraft: Edycja Legacy. Dalsze działanie jest niemożliwe.";
+ break;
+ case XC_LANGUAGE_TURKISH:
+ aStrings[0] = L"Yükleme Hatası";
+ aStrings[1] = L"Minecraft: Legacy Edition yüklenemedi ve devam edemiyor.";
+ break;
+ case XC_LOCALE_LATIN_AMERICA:
+ aStrings[0] = L"Error al cargar";
+ aStrings[1] = L"Se produjo un error al cargar Minecraft: Legacy Edition y no es posible continuar.";
+ break;
+ default:
+ aStrings[0] = L"Loading Error";
+ aStrings[1] = L"Minecraft: Legacy Edition has failed to load, and cannot continue.";
+ break;
+ }
+
+ int result = MessageBoxW(
+ NULL,
+ aStrings[1],
+ aStrings[0],
+ MB_OK
+ );
+
+ if (result == IDOK) {
+ PostQuitMessage(1); //str1k3r - since this is a fatal load error, exit with a nonzero exitcode
+ }
}
void CConsoleMinecraftApp::CaptureSaveThumbnail()
@@ -55,7 +152,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
Minecraft *pMinecraft=Minecraft::GetInstance();
app.ReleaseSaveThumbnail();
ProfileManager.SetLockedProfile(0);
- pMinecraft->user->name = L"Windows";
+ pMinecraft->user->name = L"Windows64";
app.ApplyGameSettingsChanged(0);
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameJoinLoad::OnInit
diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
index 4d0c738b..14861b88 100644
--- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
+++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
@@ -4,6 +4,7 @@
#include "stdafx.h"
#include
+#include
#include "GameConfig\Minecraft.spa.h"
#include "..\MinecraftServer.h"
#include "..\LocalPlayer.h"
@@ -37,6 +38,7 @@
#include "..\..\Minecraft.World\compression.h"
#include "..\..\Minecraft.World\OldChunkStorage.h"
+#include "Windows64_Minecraft.h"
#include "Xbox/resource.h"
HINSTANCE hMyInst;
@@ -68,17 +70,54 @@ DWORD dwProfileSettingsA[NUM_PROFILE_VALUES]=
#endif
};
-//-------------------------------------------------------------------------------------
-// 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
-// for a long time.
-//-------------------------------------------------------------------------------------
+//str1k3r - request dedicated GPU from AMD and NVIDIA drivers
+extern "C"
+{
+ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
+ __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
+}
-BOOL g_bWidescreen = TRUE;
+BOOL g_isFullscreen = FALSE;
+BOOL g_bResolutionSetByCMD = FALSE;
int g_iScreenWidth = 1920;
int g_iScreenHeight = 1080;
+static LaunchArgs ParseLaunchArgs()
+{
+ LaunchArgs args = {};
+ args.resolution = 0;
+
+ int argc = 0;
+ LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+ if (argv == nullptr)
+ return args;
+
+ if (argc > 1 && lstrlenW(argv[1]) == 1)
+ {
+ if (argv[1][0] >= L'1' && argv[1][0] <= L'6')
+ args.resolution = argv[1][0] - L'0';
+ }
+
+ for (int i = 1; i < argc; ++i)
+ {
+ if (_wcsicmp(argv[i], L"-fullscreen") == 0)
+ {
+ args.fullscreen = true;
+ }
+ else if (_wcsicmp(argv[i], L"-resolution") == 0)
+ {
+ if (i + 1 < argc && argv[i + 1][0] >= L'1' && argv[i + 1][0] <= L'6')
+ {
+ args.resolution = argv[++i][0] - L'0';
+ }
+ }
+ }
+
+ LocalFree(argv);
+ return args;
+}
+
void DefineActions(void)
{
// The app needs to define the actions required, and the possible mappings for these
@@ -115,8 +154,8 @@ void DefineActions(void)
InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT);
- InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP);
- InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN);
+ InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_DOWN);
+ InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_UP);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_USE, _360_JOY_BUTTON_LT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_RT);
InputManager.SetGameJoypadMaps(MAP_STYLE_0,MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_RB);
@@ -164,8 +203,8 @@ void DefineActions(void)
InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT);
InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT);
InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT);
- InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP);
- InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN);
+ InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_DOWN);
+ InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_UP);
InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_USE, _360_JOY_BUTTON_RT);
InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_LT);
InputManager.SetGameJoypadMaps(MAP_STYLE_1,MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_DPAD_RIGHT);
@@ -205,8 +244,8 @@ void DefineActions(void)
InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT);
InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT);
InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT);
- InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP);
- InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN);
+ InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_DOWN);
+ InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_UP);
InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_USE, _360_JOY_BUTTON_RT);
InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_A);
InputManager.SetGameJoypadMaps(MAP_STYLE_2,MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_DPAD_RIGHT);
@@ -311,30 +350,41 @@ ID3D11Texture2D* g_pDepthStencilBuffer = NULL;
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- int wmId, wmEvent;
- PAINTSTRUCT ps;
- HDC hdc;
-
switch (message)
{
- case WM_COMMAND:
- wmId = LOWORD(wParam);
- wmEvent = HIWORD(wParam);
- // Parse the menu selections:
- switch (wmId)
- {
- case IDM_EXIT:
- DestroyWindow(hWnd);
- break;
+ case WM_ENTERMENULOOP:
+ case WM_ENTERSIZEMOVE:
+ SetTimer(hWnd, 1, USER_TIMER_MINIMUM, NULL);
+ break;
+ case WM_EXITMENULOOP:
+ case WM_EXITSIZEMOVE:
+ KillTimer(hWnd, 1);
+ break;
+ case WM_ERASEBKGND:
+ return 1;
+ case WM_TIMER:
+ if (wParam == 1)
+ {
+ // Tick UI
+ ui.tick();
+ ui.render();
+ RenderManager.Present();
+ ui.CheckMenuDisplayed();
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- break;
- case WM_PAINT:
- hdc = BeginPaint(hWnd, &ps);
- // TODO: Add any drawing code here...
- EndPaint(hWnd, &ps);
+ // Tick Managers
+ app.UpdateTime();
+ InputManager.Tick();
+ StorageManager.Tick();
+ RenderManager.Tick();
+
+ // Tick Music
+ Minecraft *pMinecraft=Minecraft::GetInstance();
+ pMinecraft->soundEngine->tick(NULL, 0.0f);
+ pMinecraft->soundEngine->playMusicTick();
+ }
+ break;
+ case WM_CLOSE:
+ app.ExitGame();
break;
case WM_DESTROY:
PostQuitMessage(0);
@@ -342,7 +392,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
- return 0;
+ return DefWindowProc(hWnd, message, wParam, lParam);
}
//
@@ -405,7 +455,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
return FALSE;
}
- ShowWindow(g_hWnd, nCmdShow);
+ ShowWindow(g_hWnd, SW_SHOWMAXIMIZED);
UpdateWindow(g_hWnd);
return TRUE;
@@ -466,17 +516,30 @@ HRESULT InitDevice()
{
HRESULT hr = S_OK;
- RECT rc;
- GetClientRect( g_hWnd, &rc );
- UINT width = rc.right - rc.left;
- UINT height = rc.bottom - rc.top;
-//app.DebugPrintf("width: %d, height: %d\n", width, height);
- width = g_iScreenWidth;
- height = g_iScreenHeight;
-app.DebugPrintf("width: %d, height: %d\n", width, height);
+ //str1k3r - use screen size instead of window size & detect if its widescreen or not
+ if (!g_bResolutionSetByCMD)
+ {
+ HMONITOR hMonitor = MonitorFromWindow(g_hWnd, MONITOR_DEFAULTTONEAREST);
+ MONITORINFO monitorInfo = { sizeof(MONITORINFO) };
+ if (GetMonitorInfo(hMonitor, &monitorInfo))
+ {
+ g_iScreenWidth = monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left;
+ g_iScreenHeight = monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top;
+ }
+ else
+ {
+ g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
+ g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN);
+ }
+ }
+
+ //str1k3r - stop hardcoding size and just use the screens actual size
+ UINT width = g_iScreenWidth;
+ UINT height = g_iScreenHeight;
UINT createDeviceFlags = 0;
#ifdef _DEBUG
+ app.DebugPrintf("Screen Width: %d, Screen Height: %d\n", width, height);
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
@@ -484,7 +547,9 @@ app.DebugPrintf("width: %d, height: %d\n", width, height);
{
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP,
+#ifdef _DEBUG //str1k3r - using this can actually SLOW stuff down, as its ran on the CPU instead of the GPU also only intended for debugging
D3D_DRIVER_TYPE_REFERENCE,
+#endif
};
UINT numDriverTypes = ARRAYSIZE( driverTypes );
@@ -544,6 +609,7 @@ app.DebugPrintf("width: %d, height: %d\n", width, height);
hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer);
D3D11_DEPTH_STENCIL_VIEW_DESC descDSView;
+ ZeroMemory(&descDSView, sizeof(descDSView));
descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
descDSView.Texture2D.MipSlice = 0;
@@ -567,8 +633,6 @@ app.DebugPrintf("width: %d, height: %d\n", width, height);
vp.TopLeftY = 0;
g_pImmediateContext->RSSetViewports( 1, &vp );
- RenderManager.Initialise(g_pd3dDevice, g_pSwapChain);
-
return S_OK;
}
@@ -607,27 +671,54 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
- if(lpCmdLine)
+ //str1k3r - tell windows that we are aware of high DPI displays
+ SetProcessDPIAware();
+
+ LaunchArgs launchArgs = ParseLaunchArgs();
+
+ if(launchArgs.resolution != 0)
{
- if(lpCmdLine[0] == '1')
+ if(launchArgs.resolution == 1)
{
+ // 2160p
+ g_iScreenWidth = 3840;
+ g_iScreenHeight = 2160;
+ g_bResolutionSetByCMD = TRUE;
+ }
+ else if(launchArgs.resolution == 2)
+ {
+ // 1440p
+ g_iScreenWidth = 2560;
+ g_iScreenHeight = 1440;
+ g_bResolutionSetByCMD = TRUE;
+ }
+ else if (launchArgs.resolution == 3)
+ {
+ // 1080p
+ g_iScreenWidth = 1920;
+ g_iScreenHeight = 1080;
+ g_bResolutionSetByCMD = TRUE;
+ }
+ else if(launchArgs.resolution == 4)
+ {
+ // 720p
g_iScreenWidth = 1280;
g_iScreenHeight = 720;
+ g_bResolutionSetByCMD = TRUE;
}
- else if(lpCmdLine[0] == '2')
+ else if(launchArgs.resolution == 5)
{
+ // 480p
g_iScreenWidth = 640;
g_iScreenHeight = 480;
+ g_bResolutionSetByCMD = TRUE;
}
- else if(lpCmdLine[0] == '3')
+ else if(launchArgs.resolution == 6)
{
- // Vita
- g_iScreenWidth = 720;
- g_iScreenHeight = 408;
-
- // Vita native
- //g_iScreenWidth = 960;
- //g_iScreenHeight = 544;
+ // Vita Native, 544p
+ g_iScreenWidth = 960;
+ g_iScreenHeight = 544;
+ g_bResolutionSetByCMD = TRUE;
}
}
diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.h b/Minecraft.Client/Windows64/Windows64_Minecraft.h
new file mode 100644
index 00000000..5bb66ff4
--- /dev/null
+++ b/Minecraft.Client/Windows64/Windows64_Minecraft.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include
+
+extern int g_iScreenWidth;
+extern int g_iScreenHeight;
+
+extern BOOL g_bResolutionSetByCMD;
+
+struct LaunchArgs
+{
+ bool fullscreen;
+ int resolution;
+ bool vsync;
+ bool name;
+};
\ No newline at end of file