diff --git a/Minecraft.Client/Common/App_Defines.h b/Minecraft.Client/Common/App_Defines.h index 6704baf2..eeb9942d 100644 --- a/Minecraft.Client/Common/App_Defines.h +++ b/Minecraft.Client/Common/App_Defines.h @@ -108,6 +108,7 @@ enum EGameHostOptionWorldSize #define GAMESETTING_VSYNC 0x01000000 #define GAMESETTING_EXCLUSIVEFULLSCREEN 0x02000000 #define GAMESETTING_CLASSICCRAFTING 0x04000000 +#define GAMESETTING_HIDESAVESIZEBAR 0x08000000 // defines for languages diff --git a/Minecraft.Client/Common/App_enums.h b/Minecraft.Client/Common/App_enums.h index 44d889bc..981e407e 100644 --- a/Minecraft.Client/Common/App_enums.h +++ b/Minecraft.Client/Common/App_enums.h @@ -184,6 +184,8 @@ enum eGameSetting //TU25 eGameSetting_ClassicCrafting, + // if enabled hides the save size bar in loadcreatejoinmenu (load tab) + eGameSetting_HideSaveSizeBar, }; @@ -971,4 +973,4 @@ enum eMCLang eMCLang_hans, eMCLang_hant, -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index a3c84c48..89ed29e3 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -1502,6 +1502,7 @@ void CMinecraftApp::ApplyGameSettingsChanged(int iPad) //TU25 ActionGameSettings(iPad, eGameSetting_ClassicCrafting); + ActionGameSettings(iPad, eGameSetting_HideSaveSizeBar); } void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) @@ -1755,6 +1756,9 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_ClassicCrafting: //nothing to do here break; + case eGameSetting_HideSaveSizeBar: + //nothing to do here + break; } } @@ -2512,6 +2516,21 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV GameSettingsA[iPad]->bSettingsChanged = true; } break; + case eGameSetting_HideSaveSizeBar: + if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_HIDESAVESIZEBAR) != (ucVal & 0x01) << 27) + { + if (ucVal == 1) + { + GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_HIDESAVESIZEBAR; + } + else + { + GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_HIDESAVESIZEBAR; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; } } @@ -2650,6 +2669,9 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal) case eGameSetting_ClassicCrafting: return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLASSICCRAFTING) >> 26; + case eGameSetting_HideSaveSizeBar: + return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_HIDESAVESIZEBAR) >> 27; + case eGameSetting_VSync: return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_VSYNC)>>24; diff --git a/Minecraft.Client/Common/Media/MediaWindows64/Graphics/AdventureIcon.png b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/AdventureIcon.png new file mode 100644 index 00000000..60d306fe Binary files /dev/null and b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/AdventureIcon.png differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/Graphics/CreativeIcon.png b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/CreativeIcon.png new file mode 100644 index 00000000..2ef0df6d Binary files /dev/null and b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/CreativeIcon.png differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/Graphics/SurvivalIcon.png b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/SurvivalIcon.png new file mode 100644 index 00000000..6d045a6e Binary files /dev/null and b/Minecraft.Client/Common/Media/MediaWindows64/Graphics/SurvivalIcon.png differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/LoadCreateJoinMenu480.swf b/Minecraft.Client/Common/Media/MediaWindows64/LoadCreateJoinMenu480.swf new file mode 100644 index 00000000..aaa69e64 Binary files /dev/null and b/Minecraft.Client/Common/Media/MediaWindows64/LoadCreateJoinMenu480.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/LoadCreateJoinMenu720.swf b/Minecraft.Client/Common/Media/MediaWindows64/LoadCreateJoinMenu720.swf new file mode 100644 index 00000000..a234f0e5 Binary files /dev/null and b/Minecraft.Client/Common/Media/MediaWindows64/LoadCreateJoinMenu720.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/SettingsUIMenu720.swf b/Minecraft.Client/Common/Media/MediaWindows64/SettingsUIMenu720.swf index 0ff83a37..7fd4cca9 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/SettingsUIMenu720.swf and b/Minecraft.Client/Common/Media/MediaWindows64/SettingsUIMenu720.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/skinGraphicsLC.swf b/Minecraft.Client/Common/Media/MediaWindows64/skinGraphicsLC.swf new file mode 100644 index 00000000..995a7d3a Binary files /dev/null and b/Minecraft.Client/Common/Media/MediaWindows64/skinGraphicsLC.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/skinLabelsLC.swf b/Minecraft.Client/Common/Media/MediaWindows64/skinLabelsLC.swf new file mode 100644 index 00000000..ee934f6f Binary files /dev/null and b/Minecraft.Client/Common/Media/MediaWindows64/skinLabelsLC.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/skinWin.swf b/Minecraft.Client/Common/Media/MediaWindows64/skinWin.swf index d5ea35fd..4a788aa8 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/skinWin.swf and b/Minecraft.Client/Common/Media/MediaWindows64/skinWin.swf differ diff --git a/Minecraft.Client/Common/UI/UIControl.cpp b/Minecraft.Client/Common/UI/UIControl.cpp index f17612e4..9b774542 100644 --- a/Minecraft.Client/Common/UI/UIControl.cpp +++ b/Minecraft.Client/Common/UI/UIControl.cpp @@ -94,6 +94,18 @@ S32 UIControl::getYPos() return m_y; } +void UIControl::setXPos(S32 x) +{ + m_x = x; + IggyValueSetF64RS( getIggyValuePath(), m_nameXPos, nullptr, (F64)x ); +} + +void UIControl::setYPos(S32 y) +{ + m_y = y; + IggyValueSetF64RS( getIggyValuePath(), m_nameYPos, nullptr, (F64)y ); +} + S32 UIControl::getWidth() { return m_width; diff --git a/Minecraft.Client/Common/UI/UIControl.h b/Minecraft.Client/Common/UI/UIControl.h index f6ea6aa0..afccd7aa 100644 --- a/Minecraft.Client/Common/UI/UIControl.h +++ b/Minecraft.Client/Common/UI/UIControl.h @@ -81,6 +81,8 @@ public: S32 getXPos(); S32 getYPos(); + void setXPos(S32 x); + void setYPos(S32 y); S32 getWidth(); S32 getHeight(); diff --git a/Minecraft.Client/Common/UI/UIControl_SaveList.cpp b/Minecraft.Client/Common/UI/UIControl_SaveList.cpp index 0ce28b02..09cb0274 100644 --- a/Minecraft.Client/Common/UI/UIControl_SaveList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_SaveList.cpp @@ -14,6 +14,14 @@ bool UIControl_SaveList::setupControl(UIScene *scene, IggyValuePath *parent, con return success; } +void UIControl_SaveList::enableX2Icons() +{ + IggyName useX2 = registerFastName(L"m_bUseX2IconButtons"); + IggyValueSetBooleanRS(getIggyValuePath(), useX2, nullptr, true); +} + + + void UIControl_SaveList::addItem(const wstring &label) { addItem(label, L""); @@ -92,6 +100,78 @@ void UIControl_SaveList::addItem(const wstring &label, const wstring &iconName, IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 3 , value ); } +void UIControl_SaveList::addItem(const string &label, const wstring &iconName1, const wstring &iconName2) +{ + addItem(label, iconName1, iconName2, m_itemCount); + ++m_itemCount; +} + +void UIControl_SaveList::addItem(const wstring &label, const wstring &iconName1, const wstring &iconName2) +{ + addItem(label, iconName1, iconName2, m_itemCount); + ++m_itemCount; +} + +void UIControl_SaveList::addItem(const string &label, const wstring &iconName1, const wstring &iconName2, int data) +{ + IggyDataValue result; + IggyDataValue value[4]; + + IggyStringUTF8 stringVal; + stringVal.string = (char*)label.c_str(); + stringVal.length = static_cast(label.length()); + value[0].type = IGGY_DATATYPE_string_UTF8; + value[0].string8 = stringVal; + + value[1].type = IGGY_DATATYPE_number; + value[1].number = data; + + IggyStringUTF16 stringVal2; + stringVal2.string = (IggyUTF16*)iconName1.c_str(); + stringVal2.length = iconName1.length(); + value[2].type = IGGY_DATATYPE_string_UTF16; + value[2].string16 = stringVal2; + + IggyStringUTF16 stringVal3; + stringVal3.string = (IggyUTF16*)iconName2.c_str(); + stringVal3.length = iconName2.length(); + value[3].type = IGGY_DATATYPE_string_UTF16; + value[3].string16 = stringVal3; + + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_addNewItemFunc, 4, value); +} + +void UIControl_SaveList::addItem(const wstring &label, const wstring &iconName1, const wstring &iconName2, int data) +{ + wstring shaped = shapeArabicText(label); + + IggyDataValue result; + IggyDataValue value[4]; + + IggyStringUTF16 stringVal; + stringVal.string = (IggyUTF16*)shaped.c_str(); + stringVal.length = static_cast(shaped.length()); + value[0].type = IGGY_DATATYPE_string_UTF16; + value[0].string16 = stringVal; + + value[1].type = IGGY_DATATYPE_number; + value[1].number = data; + + IggyStringUTF16 stringVal2; + stringVal2.string = (IggyUTF16*)iconName1.c_str(); + stringVal2.length = iconName1.length(); + value[2].type = IGGY_DATATYPE_string_UTF16; + value[2].string16 = stringVal2; + + IggyStringUTF16 stringVal3; + stringVal3.string = (IggyUTF16*)iconName2.c_str(); + stringVal3.length = iconName2.length(); + value[3].type = IGGY_DATATYPE_string_UTF16; + value[3].string16 = stringVal3; + + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_addNewItemFunc, 4, value); +} + void UIControl_SaveList::setTextureName(int iId, const wstring &iconName) { IggyDataValue result; @@ -107,3 +187,4 @@ void UIControl_SaveList::setTextureName(int iId, const wstring &iconName) value[1].string16 = stringVal; IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetTextureName , 2 , value ); } + diff --git a/Minecraft.Client/Common/UI/UIControl_SaveList.h b/Minecraft.Client/Common/UI/UIControl_SaveList.h index 7c72fea9..e1937ba1 100644 --- a/Minecraft.Client/Common/UI/UIControl_SaveList.h +++ b/Minecraft.Client/Common/UI/UIControl_SaveList.h @@ -20,10 +20,17 @@ public: void addItem(const string &label, const wstring &iconName); void addItem(const wstring &label, const wstring &iconName); + void addItem(const string &label, const wstring &iconName1, const wstring &iconName2); + void addItem(const wstring &label, const wstring &iconName1, const wstring &iconName2); void setTextureName(int iId, const wstring &iconName); + void enableX2Icons(); + private: void addItem(const string &label, const wstring &iconName, int data); void addItem(const wstring &label, const wstring &iconName, int data); + void addItem(const string &label, const wstring &iconName1, const wstring &iconName2, int data); + void addItem(const wstring &label, const wstring &iconName1, const wstring &iconName2, int data); + }; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 99a659c1..86161e97 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -615,6 +615,8 @@ void UIController::loadSkins() //used these as skin.swf and skinInGame.swf it breaks some other things m_iggyLibraries[eLibrary_LCDefault] = loadSkin(L"skinLC.swf", L"skinLC.swf"); m_iggyLibraries[eLibrary_LCInGame] = loadSkin(L"skinInGameLC.swf", L"skinInGameLC.swf"); + m_iggyLibraries[eLibrary_LCGraphics] = loadSkin(L"skinGraphicsLC.swf", L"skinGraphicsLC.swf"); + m_iggyLibraries[eLibrary_LCLabels] = loadSkin(L"skinLabelsLC.swf", L"skinLabelsLC.swf"); // Some 1080p menu ports (such as LoadCreateJoin) may import DR-specific HD // libraries by distinct names. Load them opportunistically when present so @@ -1487,10 +1489,16 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) // hovering a horizontal list (e.g. TexturePackList), UP/DOWN otherwise. if (pressed && g_KBMInput.IsKBMActive()) { - if (m_bMouseHoverHorizontalList) - key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_LEFT : ACTION_MENU_RIGHT; - else - key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_UP : ACTION_MENU_DOWN; + UIScene* pTopScene = GetTopScene(0); // using 0 as default pad for KBM + bool isJoinMenu = pTopScene && pTopScene->getSceneType() == eUIScene_JoinMenu; + + if (!isJoinMenu) + { + if (m_bMouseHoverHorizontalList) + key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_LEFT : ACTION_MENU_RIGHT; + else + key = (key == ACTION_MENU_OTHER_STICK_UP) ? ACTION_MENU_UP : ACTION_MENU_DOWN; + } } } } diff --git a/Minecraft.Client/Common/UI/UIController.h b/Minecraft.Client/Common/UI/UIController.h index 6876bcee..776de903 100644 --- a/Minecraft.Client/Common/UI/UIController.h +++ b/Minecraft.Client/Common/UI/UIController.h @@ -105,6 +105,8 @@ private: eLibrary_LCDefault, eLibrary_LCInGame, + eLibrary_LCGraphics, + eLibrary_LCLabels, #if defined(_WINDOWS64) // Non-HD skin libraries needed by 720p/480p scene SWFs. diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 2e75c662..88cdbb5f 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -12,10 +12,18 @@ #ifdef _WINDOWS64 #include "../../Windows64/Network/WinsockNetLayer.h" +#include "../../Windows64/4JLibs/inc/4J_Input.h" #endif #define UPDATE_PLAYERS_TIMER_ID 0 -#define UPDATE_PLAYERS_TIMER_TIME 30000 +#define UPDATE_PLAYERS_TIMER_TIME 400.0 + +// static overlay state for howtoplay +static Iggy* s_movieServerDesc = nullptr; +static vector s_movieDataServerDesc; +static IggyName s_funcLoadPage = 0; +static bool s_textInjected = false; +static int s_injectionDelay = 0; UIScene_JoinMenu::UIScene_JoinMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { @@ -32,9 +40,65 @@ UIScene_JoinMenu::UIScene_JoinMenu(int iPad, void *_initData, UILayer *parentLay m_editServerPhase = eEditServer_Idle; m_editServerButtonIndex = -1; m_deleteServerButtonIndex = -1; + + // reset the howtoplay state + s_textInjected = false; + s_injectionDelay = 0; + + // load howtoplay it's like the messagebox xd + if (!s_movieServerDesc) + { + wstring moviePath = L"HowToPlay"; + if (m_loadedResolution == eSceneResolution_1080) moviePath.append(L"1080.swf"); + else if (m_loadedResolution == eSceneResolution_720) moviePath.append(L"720.swf"); + else moviePath.append(L"480.swf"); + + byteArray baFile = ui.getMovieData(moviePath.c_str()); + if (baFile.data) + { + s_movieDataServerDesc.assign((unsigned char*)baFile.data, (unsigned char*)baFile.data + baFile.length); + s_movieServerDesc = IggyPlayerCreateFromMemory(s_movieDataServerDesc.data(), (unsigned int)s_movieDataServerDesc.size(), nullptr); + if (s_movieServerDesc) + { + IggyPlayerInitializeAndTickRS(s_movieServerDesc); + IggyPlayerSetDisplaySize(s_movieServerDesc, m_movieWidth, m_movieHeight); + s_funcLoadPage = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"LoadHowToPlayPage", -1); + + // it maintains the resolution at 1080p so that it looks sharp + IggyValuePath *root = IggyPlayerRootPath(s_movieServerDesc); + if (root) + { + IggyValueSetF64RS(root, IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"x", -1), nullptr, 0.0); + IggyValueSetF64RS(root, IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"y", -1), nullptr, 0.0); + IggyValueSetF64RS(root, IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"width", -1), nullptr, (double)m_movieWidth); + IggyValueSetF64RS(root, IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"height", -1), nullptr, (double)m_movieHeight); + + // it hides the logo and other things that the howtoplay has + const char* elementsToHide[] = { "__id0_", "__id1_", "__id2_" }; + IggyName visibleName = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"visible", -1); + for (int i = 0; i < 3; i++) { + IggyValuePath path; + if (IggyValuePathMakeNameRef(&path, root, elementsToHide[i])) { + IggyValueSetBooleanRS(&path, visibleName, nullptr, false); + } + } + } + } + } + } #endif } +UIScene_JoinMenu::~UIScene_JoinMenu() +{ + // destroy the player when closing the scene to avoid zombie pointers + if (s_movieServerDesc) + { + IggyPlayerDestroy(s_movieServerDesc); + s_movieServerDesc = nullptr; + } +} + void UIScene_JoinMenu::updateTooltips() { int iA = -1; @@ -79,6 +143,7 @@ void UIScene_JoinMenu::tick() m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME),eControl_JoinGame); m_buttonListPlayers.init(eControl_GamePlayers); + m_buttonListPlayers.setYPos( m_buttonListPlayers.getYPos() + 300 ); #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ ) @@ -216,6 +281,7 @@ void UIScene_JoinMenu::tick() m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME),eControl_JoinGame); m_buttonListPlayers.init(eControl_GamePlayers); + m_buttonListPlayers.setYPos( m_buttonListPlayers.getYPos() + 300 ); m_labelLabels[eLabel_Difficulty].init(app.GetString(IDS_LABEL_DIFFICULTY)); m_labelLabels[eLabel_GameType].init(app.GetString(IDS_LABEL_GAME_TYPE)); @@ -250,6 +316,95 @@ void UIScene_JoinMenu::tick() #endif } +#ifdef _WINDOWS64 + if (s_movieServerDesc) + { + if (IggyPlayerReadyToTick(s_movieServerDesc)) + { + IggyPlayerTickRS(s_movieServerDesc); + + IggyValuePath *root = IggyPlayerRootPath(s_movieServerDesc); + if (root) + { + // scale the size before Iggy reads it + IggyValuePath textPath; + if (IggyValuePathMakeNameRef(&textPath, root, "HowToPlayText_0")) + { + IggyName nameX = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"x", -1); + IggyName nameY = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"y", -1); + IggyName nameW = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"width", -1); + IggyName nameH = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"height", -1); + + if (m_loadedResolution == eSceneResolution_1080) + { + IggyValueSetF64RS(&textPath, nameX, nullptr, 333.0);// horizontal + IggyValueSetF64RS(&textPath, nameY, nullptr, 340.0);// vertical + IggyValueSetF64RS(&textPath, nameW, nullptr, 580.0); + IggyValueSetF64RS(&textPath, nameH, nullptr, 270.0); + } + else //720 + { + IggyValueSetF64RS(&textPath, nameX, nullptr, 252.0); + IggyValueSetF64RS(&textPath, nameY, nullptr, 285.0); + IggyValueSetF64RS(&textPath, nameW, nullptr, 440.0); + IggyValueSetF64RS(&textPath, nameH, nullptr, 220.0); + } + } + + // harcoded text for test it, later im gonna delete this and + // and convert it so that people can add their description when adding the server + if (!s_textInjected && s_funcLoadPage != 0) + { + IggyDataValue result; + IggyDataValue args[2]; + args[0].type = IGGY_DATATYPE_number; + args[0].number = 0; // 0 is the what's new page on howtoplay don't change it + + wstring testText = L"\nNothing yet..."; + IggyStringUTF16 iggyStr; + wstring formattedText = app.FormatChatMessage(testText); + iggyStr.string = (IggyUTF16*)formattedText.c_str(); + iggyStr.length = (unsigned int)formattedText.length(); + + args[1].type = IGGY_DATATYPE_string_UTF16; + args[1].string16 = iggyStr; + + IggyResult res = IggyPlayerCallMethodRS(s_movieServerDesc, &result, root, s_funcLoadPage, 2, args); + if (res == IGGY_RESULT_SUCCESS) + { + s_textInjected = true; + } + } + + // keeps the text fixed so it doesn't move from its place + IggyValuePath panelPath; + if (s_textInjected && IggyValuePathMakeNameRef(&panelPath, root, "DynamicHtmlText")) + { + IggyName nameX = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"x", -1); + IggyName nameY = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"y", -1); + IggyName nameW = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"width", -1); + IggyName nameH = IggyPlayerCreateFastName(s_movieServerDesc, (IggyUTF16 *)L"height", -1); + + if (m_loadedResolution == eSceneResolution_1080) + { + IggyValueSetF64RS(&panelPath, nameX, nullptr, 332.0);// horizontal + IggyValueSetF64RS(&panelPath, nameY, nullptr, 340.0);// vertical + IggyValueSetF64RS(&panelPath, nameW, nullptr, 580.0); + IggyValueSetF64RS(&panelPath, nameH, nullptr, 270.0); + } + else //720p + { + IggyValueSetF64RS(&panelPath, nameX, nullptr, 250.0); + IggyValueSetF64RS(&panelPath, nameY, nullptr, 290.0); + IggyValueSetF64RS(&panelPath, nameW, nullptr, 400.0); + IggyValueSetF64RS(&panelPath, nameH, nullptr, 230.0); + } + } + } + } + } +#endif + UIScene::tick(); } @@ -275,6 +430,7 @@ int UIScene_JoinMenu::ErrorDialogReturned(void *pParam, int iPad, const C4JStora return 0; } + void UIScene_JoinMenu::updateComponents() { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -286,6 +442,19 @@ wstring UIScene_JoinMenu::getMoviePath() return L"JoinMenu"; } +void UIScene_JoinMenu::render(S32 width, S32 height, C4JRender::eViewportType viewpBort) +{ + UIScene::render(width, height, viewpBort); + +#ifdef _WINDOWS64 + if (s_movieServerDesc) + { + IggyPlayerSetDisplaySize(s_movieServerDesc, width, height); + IggyPlayerDraw(s_movieServerDesc); + } +#endif +} + void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { if(m_bIgnoreInput) return; @@ -353,6 +522,21 @@ void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, sendInputToMovie(key, repeat, pressed, released); handled = true; break; +#ifdef _WINDOWS64 + case ACTION_MENU_OTHER_STICK_UP: + case ACTION_MENU_OTHER_STICK_DOWN: + if (s_movieServerDesc) + { + IggyEvent keyEvent; + IggyKeycode iggyKeyCode = (key == ACTION_MENU_OTHER_STICK_UP) ? IGGY_KEYCODE_F11 : IGGY_KEYCODE_F12; + IggyMakeEventKey(&keyEvent, pressed ? IGGY_KEYEVENT_Down : IGGY_KEYEVENT_Up, iggyKeyCode, IGGY_KEYLOC_Standard); + + IggyEventResult res; + IggyPlayerDispatchEventRS(s_movieServerDesc, &keyEvent, &res); + handled = true; + } + break; +#endif } } diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.h b/Minecraft.Client/Common/UI/UIScene_JoinMenu.h index 566697cd..f8ae2159 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.h @@ -34,6 +34,10 @@ private: UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_buttonJoinGame, "JoinGame") UI_MAP_ELEMENT( m_buttonListPlayers, "GamePlayers") + if (m_loadedResolution == eSceneResolution_720) + { + m_buttonListPlayers.setYPos(170.0); + } UI_MAP_ELEMENT( m_labelLabels[0], "Label0") UI_MAP_ELEMENT( m_labelLabels[1], "Label1") @@ -74,19 +78,22 @@ private: public: UIScene_JoinMenu(int iPad, void *initData, UILayer *parentLayer); + virtual ~UIScene_JoinMenu(); void tick(); static void friendSessionUpdated(bool success, void *pParam); static int ErrorDialogReturned(void *pParam, int iPad, const C4JStorage::EMessageResult); virtual void updateTooltips(); virtual void updateComponents(); + virtual void render(S32 width, S32 height, C4JRender::eViewportType viewpBort); - virtual EUIScene getSceneType() { return eUIScene_LoadMenu;} + virtual EUIScene getSceneType() { return eUIScene_JoinMenu;} protected: // TODO: This should be pure virtual in this class virtual wstring getMoviePath(); +public: public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp index 3c2b94b0..b38fa9ce 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp @@ -751,6 +751,7 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, m_buttonListNewGames.init(eControl_NewGamesList); m_buttonListGames.init(eControl_GamesList); + m_buttonListGames.enableX2Icons(); @@ -1614,6 +1615,32 @@ void UIScene_LoadCreateJoinMenu::UpdateMouseHoverForActiveTab() if (!ConvertMouseToSceneCoords(sceneMouseX, sceneMouseY)) return; + // tab area threshold (approx coordinates based on handleMouseClick) + float maxY = (getSceneResolution() == eSceneResolution_1080) ? 200.0f : 135.0f; + + if (sceneMouseY < maxY) + { + // mouse is high up (near or on tabs) deselect lists to avoid collisions + if (m_buttonListSaves.getCurrentSelection() != -1) + { + m_buttonListSaves.setCurrentSelection(-1); + } + if (m_buttonListNewGames.getCurrentSelection() != -1) + { + m_buttonListNewGames.setCurrentSelection(-1); + } + if (m_buttonListGames.getCurrentSelection() != -1) + { + m_buttonListGames.setCurrentSelection(-1); + } + + // reset internal indices to -1 so tick() doesn't restore selection + m_iSaveListIndex = -1; + m_iNewGameListIndex = -1; + m_iGameListIndex = -1; + m_bUpdateSaveSize = true; // refresh save size bar / secondary UI + } + UIControl_ButtonList *pActiveList = nullptr; switch (m_activeTab) { @@ -1757,6 +1784,76 @@ void UIScene_LoadCreateJoinMenu::UpdateMouseHoverForActiveTab() m_bPendingSaveSizeBarRefresh = true; m_bPendingJoinTabAvailabilityRefresh = true; } + +bool UIScene_LoadCreateJoinMenu::handleMouseClick(F32 x, F32 y) +{ + if (!hasFocus(m_iPad) || getMovie() == nullptr || g_KBMInput.IsMouseGrabbed() || !g_KBMInput.IsKBMActive()) + { + return false; + } + + if (m_bIgnoreInput) + { + return false; + } + + float sceneMouseX = 0.0f; + float sceneMouseY = 0.0f; + if (!ConvertMouseToSceneCoords(sceneMouseX, sceneMouseY)) + { + return false; + } + + float loadMinX = 335.0f; + float loadMaxX = 535.0f; + float createMaxX = 735.0f; + float joinMaxX = 935.0f; + float minY = 77.0f; + float maxY = 135.0f; + + if (getSceneResolution() == eSceneResolution_1080) + { + loadMinX = 502.0f; + loadMaxX = 802.0f; + createMaxX = 1102.0f; + joinMaxX = 1402.0f; + minY = 115.0f; + maxY = 200.0f; + } + + if (sceneMouseY >= minY && sceneMouseY <= maxY) + { + if (sceneMouseX >= loadMinX && sceneMouseX <= loadMaxX) + { + if (m_activeTab != eTab_Load) + { + SetActiveTab(eTab_Load, true); + ui.PlayUISFX(eSFX_Press); + } + return true; // click consumed by tab + } + else if (sceneMouseX > loadMaxX && sceneMouseX <= createMaxX) + { + if (m_activeTab != eTab_Create) + { + SetActiveTab(eTab_Create, true); + ui.PlayUISFX(eSFX_Press); + } + return true; // click consumed by tab + } + else if (sceneMouseX > createMaxX && sceneMouseX <= joinMaxX) + { + if (m_activeTab != eTab_Join) + { + SetActiveTab(eTab_Join, true); + ui.PlayUISFX(eSFX_Press); + } + return true; // click consumed by tab + } + } + + return UIScene::handleMouseClick(x, y); +} #endif wstring UIScene_LoadCreateJoinMenu::getMoviePath() @@ -1943,7 +2040,10 @@ void UIScene_LoadCreateJoinMenu::UpdateSaveSizeBarVisibility() - const bool showSaveSizeBar = (m_activeTab == eTab_Load); + // user option to hide the save size bar entirely (added via SettingsUIMenu checkbox) + const bool hideBar = (app.GetGameSettings(m_iPad, eGameSetting_HideSaveSizeBar) != 0); + + const bool showSaveSizeBar = (m_activeTab == eTab_Load) && !hideBar; IggyDataValue result; @@ -1963,6 +2063,10 @@ void UIScene_LoadCreateJoinMenu::tick() UIScene::tick(); +#ifdef _WINDOWS64 + UpdateMouseHoverForActiveTab(); +#endif + #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined __PSVITA__) if(m_bExitScene) // navigate forward or back @@ -4587,81 +4691,74 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) m_buttonListGames.setCurrentSelection(0); - for( FriendSessionInfo *sessionInfo : *m_currentSessions ) - + for (FriendSessionInfo *sessionInfo : *m_currentSessions) { + const int gameType = app.GetGameHostOption(sessionInfo->data.m_uiGameHostSettings, eGameHostOption_GameType); + const wchar_t *modeIconFile = L"SurvivalIcon.png"; + const wchar_t *modeIconName = L"SurvivalIcon"; - wchar_t textureName[64] = L"\0"; - - if(sessionInfo->data.texturePackParentId!=0) - + if (gameType == GameType::CREATIVE->getId()) { - - Minecraft *pMinecraft = Minecraft::GetInstance(); - TexturePack *tp = pMinecraft->skins->getTexturePackById(sessionInfo->data.texturePackParentId); - DWORD dwImageBytes=0; - PBYTE pbImageData=nullptr; - - if(tp==nullptr) - - { - - DWORD dwBytes=0; - PBYTE pbData=nullptr; - app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); - app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); - - if(dwImageBytes > 0 && pbImageData) - - { - - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); - registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); - - } - - } - - else - - { - - pbImageData = tp->getPackIcon(dwImageBytes); - if(dwImageBytes > 0 && pbImageData) - - { - - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); - registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); - - } - - } - + modeIconFile = L"CreativeIcon.png"; + modeIconName = L"CreativeIcon"; + } + else if (gameType == GameType::ADVENTURE->getId()) + { + modeIconFile = L"AdventureIcon.png"; + modeIconName = L"AdventureIcon"; } - else + // register game mode icon + TrySetButtonListIcon(m_buttonListGames, -1, modeIconFile, modeIconName); + // texture pack icon logic + wchar_t tpIconName[64] = L"\0"; + if (sessionInfo->data.texturePackParentId != 0) { + Minecraft *pMinecraft = Minecraft::GetInstance(); + TexturePack *tp = pMinecraft->skins->getTexturePackById(sessionInfo->data.texturePackParentId); + DWORD dwImageBytes = 0; + PBYTE pbImageData = nullptr; + if (tp == nullptr) + { + DWORD dwBytes = 0; + PBYTE pbData = nullptr; + app.GetTPD(sessionInfo->data.texturePackParentId, &pbData, &dwBytes); + app.GetFileFromTPD(eTPDFileType_Icon, pbData, dwBytes, &pbImageData, &dwImageBytes); + + if (dwImageBytes > 0 && pbImageData) + { + swprintf(tpIconName, 64, L"tp_%ls", sessionInfo->displayLabel); + registerSubstitutionTexture(tpIconName, pbImageData, dwImageBytes); + } + } + else + { + pbImageData = tp->getPackIcon(dwImageBytes); + if (dwImageBytes > 0 && pbImageData) + { + swprintf(tpIconName, 64, L"tp_%ls", sessionInfo->displayLabel); + registerSubstitutionTexture(tpIconName, pbImageData, dwImageBytes); + } + } + } + else + { Minecraft *pMinecraft = Minecraft::GetInstance(); TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(0); DWORD dwImageBytes; PBYTE pbImageData = tp->getPackIcon(dwImageBytes); - if(dwImageBytes > 0 && pbImageData) - + if (dwImageBytes > 0 && pbImageData) { - - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); - registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); - + swprintf(tpIconName, 64, L"tp_%ls", sessionInfo->displayLabel); + registerSubstitutionTexture(tpIconName, pbImageData, dwImageBytes); } - } - m_buttonListGames.addItem( sessionInfo->displayLabel, textureName ); + m_buttonListGames.addItem(sessionInfo->displayLabel, modeIconName, tpIconName); - if(memcmp( &selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID) ) == 0) + if (memcmp(&selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID)) == 0) { diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h index c60a228f..dd12816e 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h @@ -220,6 +220,7 @@ private: void UpdateSaveSizeBarVisibility(); #ifdef _WINDOWS64 void UpdateMouseHoverForActiveTab(); + virtual bool handleMouseClick(F32 x, F32 y) override; bool ConvertMouseToSceneCoords(float &sceneMouseX, float &sceneMouseY); void GetAbsoluteControlRect(UIControl *pControl, S32 &x, S32 &y, S32 &w, S32 &h); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp index 54146758..b5b15a4a 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "../App_enums.h" #include "UI.h" #include "UIScene_SettingsUIMenu.h" @@ -16,6 +17,8 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer m_checkboxSplitscreen.init(app.GetString(IDS_CHECKBOX_VERTICAL_SPLIT_SCREEN),eControl_Splitscreen,(app.GetGameSettings(m_iPad,eGameSetting_SplitScreenVertical)!=0)); m_checkboxShowSplitscreenGamertags.init(app.GetString(IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS),eControl_ShowSplitscreenGamertags,(app.GetGameSettings(m_iPad,eGameSetting_DisplaySplitscreenGamertags)!=0)); m_checkboxShowClassicCrafting.init(app.GetString(IDS_CHECKBOX_CLASSICCRAFTING), eControl_ShowClassicCrafting, (app.GetGameSettings(m_iPad, eGameSetting_ClassicCrafting) != 0)); + // label is hardcoded for now (no IDS_* yet) + m_checkboxHideLoadCreateJoinSaveSizeBar.init(L"Hide world disk space bar", eControl_HideSaveSizeBar, (app.GetGameSettings(m_iPad, eGameSetting_HideSaveSizeBar) != 0)); WCHAR TempString[256]; @@ -106,6 +109,7 @@ void UIScene_SettingsUIMenu::handleInput(int iPad, int key, bool repeat, bool pr app.SetGameSettings(m_iPad,eGameSetting_DeathMessages,m_checkboxDisplayDeathMessages.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_AnimatedCharacter,m_checkboxDisplayAnimatedCharacter.IsChecked()?1:0); app.SetGameSettings(m_iPad, eGameSetting_ClassicCrafting, m_checkboxShowClassicCrafting.IsChecked() ? 1 : 0); + app.SetGameSettings(m_iPad, eGameSetting_HideSaveSizeBar, m_checkboxHideLoadCreateJoinSaveSizeBar.IsChecked() ? 1 : 0); // if the splitscreen vertical/horizontal has changed, need to update the scenes diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h index 9529bbd5..34ffaebc 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h @@ -14,11 +14,12 @@ private: eControl_Splitscreen, eControl_ShowSplitscreenGamertags, eControl_ShowClassicCrafting, + eControl_HideSaveSizeBar, eControl_UISize, eControl_UISizeSplitscreen }; - UIControl_CheckBox m_checkboxDisplayHUD, m_checkboxDisplayHand, m_checkboxDisplayDeathMessages, m_checkboxDisplayAnimatedCharacter, m_checkboxSplitscreen, m_checkboxShowSplitscreenGamertags, m_checkboxShowClassicCrafting; // Checkboxes + UIControl_CheckBox m_checkboxDisplayHUD, m_checkboxDisplayHand, m_checkboxDisplayDeathMessages, m_checkboxDisplayAnimatedCharacter, m_checkboxSplitscreen, m_checkboxShowSplitscreenGamertags, m_checkboxShowClassicCrafting, m_checkboxHideLoadCreateJoinSaveSizeBar; // Checkboxes UIControl_Slider m_sliderUISize, m_sliderUISizeSplitscreen; // Sliders UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_checkboxDisplayHUD, "DisplayHUD") @@ -28,6 +29,7 @@ private: UI_MAP_ELEMENT( m_checkboxSplitscreen, "Splitscreen") UI_MAP_ELEMENT( m_checkboxShowSplitscreenGamertags, "ShowSplitscreenGamertags") UI_MAP_ELEMENT(m_checkboxShowClassicCrafting, "ShowClassicCrafting") + UI_MAP_ELEMENT(m_checkboxHideLoadCreateJoinSaveSizeBar, "LoadCreateJoinSaveSizeBar") UI_MAP_ELEMENT( m_sliderUISize, "UISize") UI_MAP_ELEMENT( m_sliderUISizeSplitscreen, "UISizeSplitscreen") @@ -52,4 +54,4 @@ public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); virtual void handleSliderMove(F64 sliderId, F64 currentValue); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 29986a85..48af6508 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -1570,6 +1570,32 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, const Win64LaunchOptions launchOptions = ParseLaunchOptions(); ApplyScreenMode(launchOptions.screenMode); + // load resolution from resolution.txt + char resPath[MAX_PATH] = {}; + _snprintf_s(resPath, sizeof(resPath), _TRUNCATE, "%sresolution.txt", exePath); + FILE *fRes = nullptr; + if (fopen_s(&fRes, resPath, "r") == 0 && fRes) + { + char resBuf[128] = {}; + if (fgets(resBuf, sizeof(resBuf), fRes)) + { + int w = 0, h = 0; + if (sscanf_s(resBuf, "%dx%d", &w, &h) == 2 && w > 0 && h > 0) + { + g_rScreenWidth = w; + g_rScreenHeight = h; + g_iScreenWidth = w; + g_iScreenHeight = h; + } + else + { + if (strstr(resBuf, "1080")) { g_rScreenWidth = 1920; g_rScreenHeight = 1080; g_iScreenWidth = 1920; g_iScreenHeight = 1080; } + else if (strstr(resBuf, "720")) { g_rScreenWidth = 1280; g_rScreenHeight = 720; g_iScreenWidth = 1280; g_iScreenHeight = 720; } + } + } + fclose(fRes); + } + // Ensure uid.dat exists from startup (before any multiplayer/login path). Win64Xuid::ResolvePersistentXuid();