From b478b32e024b762aaf0651808e3495a891ef5bc5 Mon Sep 17 00:00:00 2001 From: Dexrn ZacAttack Date: Tue, 24 Feb 2026 05:45:41 -0800 Subject: [PATCH 1/2] feat: start on panorama, implement bunch of fui shit + loadSkins --- data/mcswitch_functions.csv | 22 ++--- .../NX/Program/PRO_Main.cpp | 18 ++-- src/4JLibraries_Source/fui/fui.cpp | 9 +- src/4JLibraries_Source/fui/fui.h | 6 +- .../fui/fuiRenderNodeTimeline.cpp | 4 + .../fui/fuiRenderNodeTimeline.h | 5 + .../fui/node/FJ_FuiNode.cpp | 21 ++++ src/4JLibraries_Source/fui/node/FJ_FuiNode.h | 5 + .../fui/node/document/menu/FJ_Panorama.cpp | 14 +++ .../fui/node/document/menu/FJ_Panorama.h | 1 + .../client/constants/UnityClient7.cpp | 2 +- .../client/ui/ConsoleUIController.cpp | 96 ++++++++++++++----- .../minecraft/client/ui/ConsoleUIController.h | 59 +++++++----- .../net/minecraft/client/ui/scene/UIScene.cpp | 23 +++-- .../scenes/UIScene_AbstractContainerMenu.cpp | 42 ++++---- .../ui/scene/scenes/UIScene_DeathMenu.cpp | 6 +- .../ui/scene/scenes/UIScene_HowToPlayMenu.cpp | 12 +-- .../client/ui/scene/scenes/UIScene_Intro.cpp | 2 +- .../ui/scene/scenes/UIScene_MainMenu.cpp | 8 +- .../scenes/component/UIComponent_Panorama.cpp | 57 +++++++++++ .../scenes/component/UIComponent_Panorama.h | 13 +++ 21 files changed, 305 insertions(+), 120 deletions(-) create mode 100644 src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.cpp create mode 100644 src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.h diff --git a/data/mcswitch_functions.csv b/data/mcswitch_functions.csv index dcb3e82f..578534fe 100644 --- a/data/mcswitch_functions.csv +++ b/data/mcswitch_functions.csv @@ -28221,7 +28221,7 @@ Address,Quality,Size,Name 0x0000007100400a80,O,000028,_ZN10FJ_FuiNode8getStageEv 0x0000007100400a9c,U,000256,_ZN10FJ_FuiNode16addEventListenerE12eFJEventTypePS_PFvS1_P8FJ_EventEb 0x0000007100400b9c,U,000004, -0x0000007100400ba0,U,000076,getChildByName__10FJ_FuiNodeFRCQ2_3std78basic_string__tm__58_cQ2_3std20char_traits__tm__2_cQ2_3std18allocator__tm__2_c +0x0000007100400ba0,O,000076,_ZN10FJ_FuiNode14getChildByNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE 0x0000007100400bec,O,000020,_ZN10FJ_FuiNode11asMovieClipEv 0x0000007100400c00,U,000044, 0x0000007100400c2c,U,000008, @@ -28471,7 +28471,7 @@ Address,Quality,Size,Name 0x0000007100406e50,U,000028, 0x0000007100406e6c,U,000068, 0x0000007100406eb0,U,000096, -0x0000007100406f10,U,000028, +0x0000007100406f10,O,000028,_ZN10FJ_FuiNode12currentFrameEv 0x0000007100406f2c,O,000016,_ZN10FJ_FuiNode4setXEf 0x0000007100406f3c,U,000080, 0x0000007100406f8c,O,000016,_ZN10FJ_FuiNode4setYEf @@ -29240,7 +29240,7 @@ Address,Quality,Size,Name 0x000000710042f058,U,000476, 0x000000710042f234,U,000332,_ZN11FJ_PanoramaC_gen 0x000000710042f380,U,000052, -0x000000710042f3b4,U,000132, +0x000000710042f3b4,O,000132,_ZN11FJ_Panorama15GetCurrentFrameEv 0x000000710042f438,U,000224, 0x000000710042f518,U,000008, 0x000000710042f520,U,000048,_ZN12FJ_PauseMenuC_gen @@ -30440,7 +30440,7 @@ Address,Quality,Size,Name 0x00000071004881a4,U,000264,_ZN7fuiFile17resolveReferencesEPS_ 0x00000071004882ac,O,000008,_ZN18fuiRenderNodeStage8addChildEP13fuiRenderNode 0x00000071004882b4,M,000280,_ZN3fui11unloadSceneEP7fuiFile -0x00000071004883cc,U,000012, +0x00000071004883cc,O,000012,_ZN3fui9setOriginEff 0x00000071004883d8,O,000048,_ZN3fui13setResolutionEi 0x0000007100488408,O,000008,_ZN3fui13getResolutionEv 0x0000007100488410,U,000104,_ZN3fui4tickEv @@ -30653,7 +30653,7 @@ Address,Quality,Size,Name 0x00000071004913d4,U,000012, 0x00000071004913e0,U,000008, 0x00000071004913e8,U,000088, -0x0000007100491440,U,000012, +0x0000007100491440,O,000012,_ZN21fuiRenderNodeTimeline12currentFrameEv 0x000000710049144c,U,000240, 0x000000710049153c,U,000008, 0x0000007100491544,U,000228, @@ -35327,7 +35327,7 @@ Address,Quality,Size,Name 0x000000710054bd30,U,000056, 0x000000710054bd68,U,000020,_ZN3Gui14sub_710054BD68Ei 0x000000710054bd7c,U,000420,UIComponent_Chat__render -0x000000710054bf20,U,000008, +0x000000710054bf20,O,000008,_ZN19ConsoleUIController15getScreenHeightEv 0x000000710054bf28,O,000008,_ZN19ConsoleUIController14getScreenWidthEv 0x000000710054bf30,U,000048, 0x000000710054bf60,O,000132,_ZN7UIScene6renderEiiN9C4JRender13eViewportTypeE @@ -35345,9 +35345,9 @@ Address,Quality,Size,Name 0x000000710054c39c,U,000420,_ZN26UIComponent_MenuBackground6renderEiiN9C4JRender13eViewportTypeE 0x000000710054c540,U,000108,_ZN20UIComponent_PanoramaC1EiP7UILayer 0x000000710054c5ac,U,000120, -0x000000710054c624,U,000260,_ZN20UIComponent_Panorama4tickEv +0x000000710054c624,O,000260,_ZN20UIComponent_Panorama4tickEv 0x000000710054c728,U,000072, -0x000000710054c770,U,000384,_ZN20UIComponent_Panorama6renderEiiN9C4JRender13eViewportTypeE +0x000000710054c770,M,000384,_ZN20UIComponent_Panorama6renderEiiN9C4JRender13eViewportTypeE 0x000000710054c8f0,U,000044,_ZN20UIComponent_Panorama12handleReloadEv 0x000000710054c91c,U,000416,_ZN28UIComponent_PressStartToPlayC1EiP7UILayer 0x000000710054cabc,U,000092,_ZN9UIControl10setVisibleEb @@ -35462,7 +35462,7 @@ Address,Quality,Size,Name 0x0000007100553aa8,U,000256,ConsoleUIController__TextureSubstitutionCreateCallbackFui 0x0000007100553ba8,U,000040,_ZN19ConsoleUIController37TextureSubstitutionDestroyCallbackFuiEi 0x0000007100553bd0,U,000692,_ZN19ConsoleUIController9SetupFontEv -0x0000007100553e84,U,002052,_ZN19ConsoleUIController9loadSkinsEv +0x0000007100553e84,O,002052,_ZN19ConsoleUIController9loadSkinsEv 0x0000007100554688,U,000068,_ZN19ConsoleUIController18getFontForLanguageEi 0x00000071005546cc,U,000888,_ZN19ConsoleUIController10createFontEN19ConsoleUIController5EFontE 0x0000007100554a44,U,000064,_ZN19ConsoleUIController17updateCurrentFontEv @@ -35478,7 +35478,7 @@ Address,Quality,Size,Name 0x0000007100554dd8,U,000120,_ZN7UIGroup15ReloadAllLayersEv 0x0000007100554e50,O,000024,_ZN19ConsoleUIController30setResolutionChangeDisableFlagEN13IUIController24eRESOLUTION_DISABLE_FLAGE 0x0000007100554e68,O,000024,_ZN19ConsoleUIController32clearResolutionChangeDisableFlagEN13IUIController24eRESOLUTION_DISABLE_FLAGE -0x0000007100554e80,U,000164, +0x0000007100554e80,O,000164,_ZN19ConsoleUIController8loadSkinERKNSt3__112basic_stringIwNS0_11char_traitsIwEENS0_9allocatorIwEEEES8_i 0x0000007100554f24,U,000280, 0x000000710055503c,U,000088, 0x0000007100555094,U,000196, @@ -37122,7 +37122,7 @@ Address,Quality,Size,Name 0x0000007100598e40,U,000008,_ZN26UIComponent_MenuBackground11stealsFocusEv 0x0000007100598e48,U,000008,_ZN26UIComponent_MenuBackground8hasFocusEi 0x0000007100598e50,U,000008,_ZN26UIComponent_MenuBackground16hidesLowerScenesEv -0x0000007100598e58,U,000036,_ZN20UIComponent_PanoramaD0Ev +0x0000007100598e58,O,000036,_ZN20UIComponent_PanoramaD0Ev 0x0000007100598e7c,U,000008, 0x0000007100598e84,U,000008,_ZN20UIComponent_Panorama11stealsFocusEv 0x0000007100598e8c,U,000008,_ZN20UIComponent_Panorama8hasFocusEi diff --git a/src/4JLibraries_Source/NX/Program/PRO_Main.cpp b/src/4JLibraries_Source/NX/Program/PRO_Main.cpp index 010c7fe5..c0b9ad24 100644 --- a/src/4JLibraries_Source/NX/Program/PRO_Main.cpp +++ b/src/4JLibraries_Source/NX/Program/PRO_Main.cpp @@ -196,7 +196,7 @@ void DefineActions() { } void PopupToast() { - gConsoleUIController.SetAchievementUnlocked(); + g_consoleUIController.SetAchievementUnlocked(); } bool unk() { @@ -251,7 +251,7 @@ extern "C" void nnMain() { CInput::sInstance->SetCircleCrossSwapped(true); int screenType = 1; // TODO: shove function that gets screenType, haven't done it so far because i'm // unsure on how to name that func - gConsoleUIController.setResolutionChangeDisableFlag(IUIController::eRESOLUTION_DISABLE_FLAG::FLAG_0); + g_consoleUIController.setResolutionChangeDisableFlag(IUIController::eRESOLUTION_DISABLE_FLAG::FLAG_0); int screenWidth, screenHeight; if (screenType == 1) { @@ -262,7 +262,7 @@ extern "C" void nnMain() { screenHeight = 720; } - gConsoleUIController.init(screenWidth, screenHeight); + g_consoleUIController.init(screenWidth, screenHeight); CConsoleMinecraftApp::sInstance.CommerceInit(); CConsoleMinecraftApp::sInstance.initTime(); // funny thing is that all args seems to be unused @@ -358,7 +358,7 @@ extern "C" void nnMain() { if (CGameNetworkManager::sInstance.IsLocalGame() && CGameNetworkManager::sInstance.GetPlayerCount() == 1) { primaryPad = CProfile::sInstance->GetPrimaryPad(); - isPaused = gConsoleUIController.IsPauseMenuDisplayed(primaryPad); + isPaused = g_consoleUIController.IsPauseMenuDisplayed(primaryPad); } else { isPaused = false; } @@ -375,18 +375,18 @@ extern "C" void nnMain() { Minecraft::sInstance->m_soundEngine->playMusicTick(); CConsoleMinecraftApp::sInstance.GetCommerceInstance()->tick(); InfoBarManager::StartTimingCategory(InfoBarManager::eTimingCagegory::ConsoleUIControllerTick); - gConsoleUIController.tick(); + g_consoleUIController.tick(); InfoBarManager::EndTimingCategory(InfoBarManager::eTimingCagegory::ConsoleUIControllerTick); Renderer::sInstance->vtbl_7101130608_func_17(); InfoBarManager::StartTimingCategory(InfoBarManager::eTimingCagegory::ConsoleUIControllerRender); - gConsoleUIController.render(); + g_consoleUIController.render(); InfoBarManager::EndTimingCategory(InfoBarManager::eTimingCagegory::ConsoleUIControllerRender); InfoBarManager::EndTimingCategory(InfoBarManager::eTimingCagegory::InitTicking); PIXBeginNamedEvent(0.0, "Frame present"); Renderer::sInstance->Present(); PIXEndNamedEvent(); Renderer::sInstance->Set_matrixDirty(); - gConsoleUIController.CheckMenuDisplayed(); + g_consoleUIController.CheckMenuDisplayed(); PIXBeginNamedEvent(0.0, "Profile load check"); if (CInput::sControllers) { @@ -428,7 +428,7 @@ extern "C" void nnMain() { CConsoleMinecraftApp::sInstance.HandleXuiActions(); if (CProfile::sInstance->IsFullVersion()) { if (!CConsoleMinecraftApp::sHideTrialTimer) { - gConsoleUIController.ShowTrialTimer(false); + g_consoleUIController.ShowTrialTimer(false); CConsoleMinecraftApp::sHideTrialTimer = true; } Vec3::resetPool(); @@ -438,7 +438,7 @@ extern "C" void nnMain() { if (CConsoleMinecraftApp::sInstance.IsAppPaused()) CConsoleMinecraftApp::sInstance.UpdateTrialPausedTimer(); primaryPad = CProfile::sInstance->GetPrimaryPad(); - gConsoleUIController.UpdateTrialTimer(primaryPad); + g_consoleUIController.UpdateTrialTimer(primaryPad); Vec3::resetPool(); } } diff --git a/src/4JLibraries_Source/fui/fui.cpp b/src/4JLibraries_Source/fui/fui.cpp index 703cd822..fbf1c70f 100644 --- a/src/4JLibraries_Source/fui/fui.cpp +++ b/src/4JLibraries_Source/fui/fui.cpp @@ -83,10 +83,10 @@ void fui::render(fuiFile* file, float a1, float a2, float a3, float a4, float a5 renderer->MatrixMode(0); renderer->MatrixSetIdentity(); - renderer->MatrixTranslate(this->m_unk5 - a1, this->m_unk6 - a2, -2000.0f); + renderer->MatrixTranslate(this->m_originX - a1, this->m_originY - a2, -2000.0f); renderer->MatrixScale(a5, a6, 1); - renderer->StateSetScissorRect(this->m_unk5, this->m_unk6, this->m_unk5 + a3, this->m_unk6 + a4); + renderer->StateSetScissorRect(this->m_originX, this->m_originY, this->m_originX + a3, this->m_originY + a4); file->m_renderNodeStage->gather(this->m_boolIdk); @@ -144,3 +144,8 @@ void fui::removeEventListenerForNode(FJ_FuiNode* node) { void fui::removeManagedTexture(fuiFile* file, fuiBitmap* texture) { this->m_textureManager->removeManagedTexture(file, texture); } + +void fui::setOrigin(float x, float y) { + this->m_originX = x; + this->m_originY = y; +} diff --git a/src/4JLibraries_Source/fui/fui.h b/src/4JLibraries_Source/fui/fui.h index 675484bf..51b47f19 100644 --- a/src/4JLibraries_Source/fui/fui.h +++ b/src/4JLibraries_Source/fui/fui.h @@ -39,11 +39,13 @@ struct fui { void removeManagedTexture(fuiFile*, fuiBitmap*); void setFontIndirection(const char*, const char*); + void setOrigin(float x, float y); + mat4x4 m_atrix; char m_fPad4[16]; char m_padding[568]; - float m_unk5; - float m_unk6; + float m_originX; + float m_originY; char m_padding3[0x4]; float m_screenWidth; float m_screenHeight; diff --git a/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.cpp b/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.cpp index 853eb836..98b03fc1 100644 --- a/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.cpp +++ b/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.cpp @@ -14,3 +14,7 @@ void fuiRenderNodeTimeline::progogateBoundsFromChild() { cur = tl->asTimeline(); } while (cur); } + +int fuiRenderNodeTimeline::currentFrame() { + return this->m_currentFrame + 1; +} diff --git a/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.h b/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.h index 04e1207e..9e87a8cf 100644 --- a/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.h +++ b/src/4JLibraries_Source/fui/fuiRenderNodeTimeline.h @@ -5,4 +5,9 @@ struct fuiRenderNodeTimeline : public fuiRenderNode { void progogateBoundsFromChild(); void updateBoundsLocal(); + + int currentFrame(); + + void *m_padding[7]; + int m_currentFrame; }; diff --git a/src/4JLibraries_Source/fui/node/FJ_FuiNode.cpp b/src/4JLibraries_Source/fui/node/FJ_FuiNode.cpp index ce309907..2ad948eb 100644 --- a/src/4JLibraries_Source/fui/node/FJ_FuiNode.cpp +++ b/src/4JLibraries_Source/fui/node/FJ_FuiNode.cpp @@ -8,6 +8,7 @@ #include "document/FJ_Document.h" #include "fui/fui.h" #include "fui/fuiRenderNode.h" +#include "fui/fuiRenderNodeTimeline.h" #include "fui/node/FJ_Base.h" #include "fui/node/FJ_FuiNodeStage.h" @@ -63,6 +64,26 @@ float FJ_FuiNode::getHeight() { return this->m_renderNode->getHeight(); } +fuiRenderNode* FJ_FuiNode::getChildByName(const std::string &name) { + if (m_renderNode->m_fuiObjectType != eFuiObjectType_Timeline) { + return nullptr; + } + + fuiRenderNode *node = m_renderNode->findNode(name.c_str()); + if (node) { + return reinterpret_cast(node->m_fuiNodeStage); + } + + return node; +} + +int FJ_FuiNode::currentFrame() { + if (this->m_renderNode->m_fuiObjectType != eFuiObjectType_Timeline) + return 1; + + return static_cast(this->m_renderNode)->currentFrame(); +} + void FJ_FuiNode::setWidth(float width) { this->m_renderNode->setWidth(width); } diff --git a/src/4JLibraries_Source/fui/node/FJ_FuiNode.h b/src/4JLibraries_Source/fui/node/FJ_FuiNode.h index 2e0ef7d2..29e106e0 100644 --- a/src/4JLibraries_Source/fui/node/FJ_FuiNode.h +++ b/src/4JLibraries_Source/fui/node/FJ_FuiNode.h @@ -43,6 +43,11 @@ class FJ_FuiNode { float getWidth(); float getHeight(); + fuiRenderNode *getChildByName(const std::string &name); + fuiRenderNode *getChildAt(int idx); + + int currentFrame(); + void setWidth(float width); int getTabIndex(); diff --git a/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.cpp b/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.cpp index 4afcf1e4..0d82a504 100644 --- a/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.cpp +++ b/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.cpp @@ -1,3 +1,17 @@ #include "fui/node/document/menu/FJ_Panorama.h" std::string FJ_Panorama::sName = "Panorama"; + +int FJ_Panorama::GetCurrentFrame() { + FJ_FuiNode *dayPanorama = reinterpret_cast(this->getChildByName("Panorama_Day")); + + if (dayPanorama) { + FJ_FuiNode *child = reinterpret_cast(dayPanorama->getChildAt(0)); + + if (child) { + return child->currentFrame(); + } + } + + return 0; +} diff --git a/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.h b/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.h index c9582892..b930f891 100644 --- a/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.h +++ b/src/4JLibraries_Source/fui/node/document/menu/FJ_Panorama.h @@ -13,4 +13,5 @@ class FJ_Panorama : public FJ_Document { static std::string sName; static FJ_FuiNode* Create(fuiRenderNode*); + int GetCurrentFrame(); }; diff --git a/src/Minecraft.Client/net/minecraft/client/constants/UnityClient7.cpp b/src/Minecraft.Client/net/minecraft/client/constants/UnityClient7.cpp index f9db9aa0..9e754929 100644 --- a/src/Minecraft.Client/net/minecraft/client/constants/UnityClient7.cpp +++ b/src/Minecraft.Client/net/minecraft/client/constants/UnityClient7.cpp @@ -1,3 +1,3 @@ #include "net/minecraft/client/ui/ConsoleUIController.h" -ConsoleUIController gConsoleUIController = ConsoleUIController(); +ConsoleUIController g_consoleUIController = ConsoleUIController(); diff --git a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp index 0738ba83..708ac41b 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp @@ -25,28 +25,29 @@ ConsoleUIController::ConsoleUIController() { this->m_screenHeight = 720.0f; this->m_byte41A = 0; this->m_preInited = 0; - this->m_qword13420 = 0LL; - this->m_qword13428 = 0LL; - this->m_qword13430 = 0LL; - this->m_qword13438 = 0LL; - this->m_qword13440 = 0LL; - this->m_qword13448 = 0LL; - this->m_qword13450 = 0LL; - this->m_qword13458 = 0LL; - this->m_qword13460 = 0LL; - this->m_qword13468 = 0LL; - this->m_qword13470 = 0LL; - this->m_qword13478 = 0LL; - this->m_qword13480 = 0LL; - this->m_qword13488 = 0LL; - this->m_qword13490 = 0LL; - this->m_qword13498 = 0LL; - this->m_qword134A0 = 0LL; - this->m_qword134A8 = 0LL; - this->m_qword134B0 = 0LL; - this->m_qword134B8 = 0LL; - this->m_qword134C0 = 0LL; - this->m_qword134C8 = 0LL; + + this->m_fuiFilePlatformSkin = nullptr; + this->m_fuiFileSkinGraphics = nullptr; + this->m_fuiFileSkinGraphicsHud = nullptr; + this->m_fuiFileSkinGraphicsInGame = nullptr; + this->m_qword13440 = nullptr; + this->m_fuiFileSkinGraphicsLabels = nullptr; + this->m_fuiFileSkinLabels = nullptr; + this->m_fuiFileSkinInGame = nullptr; + this->m_fuiFileSkinHud = nullptr; + this->m_qword13468 = nullptr; + this->m_fuiFileSkin = nullptr; + this->m_fuiFilePlatformSkinHd = nullptr; + this->m_fuiFileSkinHdGraphics = nullptr; + this->m_fuiFileSkinHdGraphicsHud = nullptr; + this->m_fuiFileSkinHdGraphicsInGame = nullptr; + this->m_qword13498 = nullptr; + this->m_fuiFileSkinHdGraphicsLabels = nullptr; + this->m_fuiFileSkinHdLabels = nullptr; + this->m_fuiFileSkinHdInGame = nullptr; + this->m_fuiFileSkinHdHud = nullptr; + this->m_qword134C0 = nullptr; + this->m_fuiFileSkinHd = nullptr; this->m_byte134E8 = 0; this->m_byte134E9 = 0; @@ -55,7 +56,7 @@ ConsoleUIController::ConsoleUIController() { this->m_byte134Ec = 0; this->m_dword134F0 = 0; this->m_dword134F8 = 0; - this->m_byte134Fc = 0; + this->m_hasSetupRenderPosition = 0; this->m_cipa = 0; this->m_dword1359C = 0; this->m_qword135A0 = 0LL; @@ -98,6 +99,14 @@ arrayWithLength ConsoleUIController::getMovieData(const std::wstring& nam } } +void ConsoleUIController::setupRenderPosition(int x, int y) { + this->m_hasSetupRenderPosition = true; + this->m_renderPositionX = x; + this->m_renderPositionY = y; + + fui::sInstance->setOrigin(x, y); +} + void ConsoleUIController::clearResolutionChangeDisableFlag(eRESOLUTION_DISABLE_FLAG flag) { this->m_flags &= ~(1 << flag); } @@ -130,3 +139,44 @@ void ConsoleUIController::SetEmptyQuadrantLogo(int) {} void ConsoleUIController::ShowOtherPlayersBaseScene(unsigned, bool) {} void ConsoleUIController::ShowAutosaveCountdownTimer(bool shown) {} void ConsoleUIController::UpdateAutosaveCountdownTimer(unsigned) {} + +fuiFile *ConsoleUIController::loadSkin(const std::wstring &filename, const std::wstring &fallback, int isHd) { + if (filename.empty() || !CConsoleMinecraftApp::sInstance.hasArchiveFile(filename, false)) + return nullptr; + + arrayWithLength file = CConsoleMinecraftApp::sInstance.getArchiveFile(filename, false); + fuiFile *f = fui::sInstance->load(file, false, isHd); + + delete file.m_data; + + return f; +} + +void ConsoleUIController::loadSkins() { + // I am so confused at why it was done in this way, but it only matches when I do this, so idk. + // Maybe it was some jank ifdef spam here + std::wstring platformSkin = L""; + + platformSkin = L"skinNX.fui"; + this->m_fuiFilePlatformSkin = this->loadSkin(platformSkin, L"platformskin.fui", 0); + + platformSkin = L"skinHDNX.fui"; + this->m_fuiFilePlatformSkinHd = this->loadSkin( platformSkin, L"platformskinHD.fui", 1); + + this->m_fuiFileSkinGraphics = this->loadSkin(L"skinGraphics.fui", L"skinGraphics.fui", 0); + this->m_fuiFileSkinGraphicsHud = this->loadSkin(L"skinGraphicsHud.fui", L"skinGraphicsHud.fui", 0); + this->m_fuiFileSkinGraphicsInGame = this->loadSkin(L"skinGraphicsInGame.fui", L"skinGraphicsInGame.fui", 0); + this->m_fuiFileSkinGraphicsLabels = this->loadSkin(L"skinGraphicsLabels.fui", L"skinGraphicsLabels.fui", 0); + this->m_fuiFileSkinLabels = this->loadSkin(L"skinLabels.fui", L"skinLabels.fui", 0); + this->m_fuiFileSkinInGame = this->loadSkin(L"skinInGame.fui", L"skinInGame.fui", 0); + this->m_fuiFileSkinHud = this->loadSkin(L"skinHud.fui", L"skinHud.fui", 0); + this->m_fuiFileSkin = this->loadSkin(L"skin.fui", L"skin.fui", 0); + this->m_fuiFileSkinHdGraphics = this->loadSkin(L"skinHDGraphics.fui", L"skinHDGraphics.fui", 1); + this->m_fuiFileSkinHdGraphicsHud = this->loadSkin(L"skinHDGraphicsHud.fui", L"skinHDGraphicsHud.fui", 1); + this->m_fuiFileSkinHdGraphicsInGame = this->loadSkin(L"skinHDGraphicsInGame.fui", L"skinHDGraphicsInGame.fui", 1); + this->m_fuiFileSkinHdGraphicsLabels = this->loadSkin(L"skinHDGraphicsLabels.fui", L"skinHDGraphicsLabels.fui", 1); + this->m_fuiFileSkinHdLabels = this->loadSkin(L"skinHDLabels.fui", L"skinHDLabels.fui", 1); + this->m_fuiFileSkinHdInGame = this->loadSkin(L"skinHDInGame.fui", L"skinHDInGame.fui", 1); + this->m_fuiFileSkinHdHud = this->loadSkin(L"skinHDHud.fui", L"skinHDHud.fui", 1); + this->m_fuiFileSkinHd = this->loadSkin(L"skinHD.fui", L"skinHD.fui", 1); +} diff --git a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h index de75f484..81ea8793 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h +++ b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h @@ -151,6 +151,7 @@ class ConsoleUIController : public IUIController { void NavigateToScene(int, EUIScene, void*, EUILayer, EUIGroup) override; arrayWithLength getMovieData(const std::wstring&); void setupRenderPosition(C4JRender::eViewportType); + void setupRenderPosition(int x, int y); void NavigateBack(int, bool, EUIScene, EUILayer) override; void* RegisterForCallbackId(UIScene*); void ResetSelectedItem() override; @@ -164,7 +165,10 @@ class ConsoleUIController : public IUIController { void RequestErrorMessage(int, int, int*, unsigned int, unsigned int, int (*)(void*, int, C4JStorage::EMessageResult), void*, wchar_t*, bool) override; + float getScreenWidth() { return this->m_screenWidth; } + float getScreenHeight() { return this->m_screenHeight; } + bool IsPauseMenuDisplayed(int pad) override; void UpdateTrialTimer(unsigned int pad) override; void ShowTrialTimer(bool) override; @@ -240,6 +244,9 @@ class ConsoleUIController : public IUIController { int (*)(void*, int, C4JStorage::EMessageResult), void*, wchar_t*, unsigned, bool, bool) override; + fuiFile *loadSkin(const std::wstring &filename, const std::wstring &fallback, int isHd); + void loadSkins(); + void* m_qword8; void* m_qword10; nn::os::MutexType m_mutex1; @@ -249,7 +256,9 @@ class ConsoleUIController : public IUIController { float m_screenWidth; float m_screenHeight; bool m_preInited; - char m_gap3E1[15]; + char m_gap3E1[3]; + int m_renderPositionX; + int m_renderPositionY; nn::os::MutexType m_mutex4; void* m_qword410; char m_byte418; @@ -266,28 +275,28 @@ class ConsoleUIController : public IUIController { char m_byte1340C; void* m_qword13410; char m_byte13418; - void* m_qword13420; - void* m_qword13428; - void* m_qword13430; - void* m_qword13438; - void* m_qword13440; - void* m_qword13448; - void* m_qword13450; - void* m_qword13458; - void* m_qword13460; - void* m_qword13468; - void* m_qword13470; - void* m_qword13478; - void* m_qword13480; - void* m_qword13488; - void* m_qword13490; - void* m_qword13498; - void* m_qword134A0; - void* m_qword134A8; - void* m_qword134B0; - void* m_qword134B8; - void* m_qword134C0; - void* m_qword134C8; + fuiFile *m_fuiFilePlatformSkin; + fuiFile *m_fuiFileSkinGraphics; + fuiFile *m_fuiFileSkinGraphicsHud; + fuiFile *m_fuiFileSkinGraphicsInGame; + void *m_qword13440; + fuiFile *m_fuiFileSkinGraphicsLabels; + fuiFile *m_fuiFileSkinLabels; + fuiFile *m_fuiFileSkinInGame; + fuiFile *m_fuiFileSkinHud; + void *m_qword13468; + fuiFile *m_fuiFileSkin; + fuiFile *m_fuiFilePlatformSkinHd; + fuiFile *m_fuiFileSkinHdGraphics; + fuiFile *m_fuiFileSkinHdGraphicsHud; + fuiFile *m_fuiFileSkinHdGraphicsInGame; + void *m_qword13498; + fuiFile *m_fuiFileSkinHdGraphicsLabels; + fuiFile *m_fuiFileSkinHdLabels; + fuiFile *m_fuiFileSkinHdInGame; + fuiFile *m_fuiFileSkinHdHud; + void *m_qword134C0; + fuiFile *m_fuiFileSkinHd; char m_gap134D0[24]; char m_byte134E8; char m_byte134E9; @@ -296,7 +305,7 @@ class ConsoleUIController : public IUIController { char m_byte134Ec; int m_dword134F0; __attribute__((aligned(8))) int m_dword134F8; - char m_byte134Fc; + bool m_hasSetupRenderPosition; std::unordered_map m_textureDetails; std::unordered_map m_cachedMovieDatas; std::vector<_QueuedMessageBoxData> m_queuedMessageBoxDatas; @@ -314,4 +323,4 @@ class ConsoleUIController : public IUIController { int m_viewportTouchOffset2; }; -extern ConsoleUIController gConsoleUIController; +extern ConsoleUIController g_consoleUIController; diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/UIScene.cpp b/src/Minecraft.Client/net/minecraft/client/ui/scene/UIScene.cpp index 5485bf55..1571cbd8 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/scene/UIScene.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/UIScene.cpp @@ -60,16 +60,15 @@ void UIScene::loadMovie() { fui* fui = fui::sInstance; - int v3; if (fui->getResolution()) { moviePath.append(L"1080.fui"); - v3 = 0; + this->m_resType = 0; } else { moviePath.append(L"720.fui"); - v3 = 1; + this->m_resType = 1; } - this->m_resType = v3; - arrayWithLength movieData = gConsoleUIController.getMovieData(moviePath.c_str()); + + arrayWithLength movieData = g_consoleUIController.getMovieData(moviePath.c_str()); this->m_fuiFile = fui->load(movieData, true, fui->getResolution()); this->m_fuiFile->getRootNode()->m_fuiNodeStage->setCallbackScene(this); @@ -84,8 +83,8 @@ void UIScene::loadMovie() { } void UIScene::navigateBack() { - gConsoleUIController.PlayUISFX(SoundEvents::BACK); - gConsoleUIController.NavigateBack(this->m_padId, false, EUIScene_DefaultMAYBE, (EUILayer)8); + g_consoleUIController.PlayUISFX(SoundEvents::BACK); + g_consoleUIController.NavigateBack(this->m_padId, false, EUIScene_DefaultMAYBE, (EUILayer)8); } void UIScene::sendInputToMovie(int key, bool a3, bool a4, bool a5) { @@ -121,7 +120,7 @@ bool UIScene::hasTimer(int id) { void* UIScene::GetCallbackUniqueId() { void* ret = this->m_callbackUniqueId; if (!ret) { - ret = gConsoleUIController.RegisterForCallbackId(this); + ret = g_consoleUIController.RegisterForCallbackId(this); this->m_callbackUniqueId = ret; } return ret; @@ -204,7 +203,7 @@ void UIScene::updateSafeZone() { void UIScene::updateViewportTouchOffset() { C4JRender::eViewportType viewPortType = this->m_uiLayer->getViewPort(); - gConsoleUIController.updateViewportTouchOffset(viewPortType); + g_consoleUIController.updateViewportTouchOffset(viewPortType); } bool UIScene::mapElementsAndNames() { @@ -244,8 +243,8 @@ bool UIScene::hasFocus(int padID) { } void UIScene::updateTooltips() { - if (!gConsoleUIController.IsReloadingSkin()) { - gConsoleUIController.SetTooltips(this->m_padId, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + if (!g_consoleUIController.IsReloadingSkin()) { + g_consoleUIController.SetTooltips(this->m_padId, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0); } } @@ -269,7 +268,7 @@ void* UIScene::GetMainPanel() { void UIScene::render(int a2, int a3, C4JRender::eViewportType viewPortType) { if (!this->m_hidden && this->m_hideLowerScenes) { if (this->m_fuiFile) { - gConsoleUIController.setupRenderPosition(viewPortType); + g_consoleUIController.setupRenderPosition(viewPortType); fui::sInstance->render(this->m_fuiFile, 0.0f, 0.0f, a2, a3); } } diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_AbstractContainerMenu.cpp b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_AbstractContainerMenu.cpp index 67d8904c..525ee7e9 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_AbstractContainerMenu.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_AbstractContainerMenu.cpp @@ -31,16 +31,16 @@ UIScene_AbstractContainerMenu::UIScene_AbstractContainerMenu(int padID, UILayer* layer) : UIScene(padID, layer) { this->m_focusedSection = ESceneSection_NONE; - gConsoleUIController.OverrideSFX(this->m_padId, 0, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 20, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 2, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 3, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 11, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 10, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 7, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 6, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 4, 1); - gConsoleUIController.OverrideSFX(this->m_padId, 5, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 0, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 20, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 2, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 3, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 11, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 10, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 7, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 6, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 4, 1); + g_consoleUIController.OverrideSFX(this->m_padId, 5, 1); this->m_byte110 = false; } @@ -159,7 +159,7 @@ void UIScene_AbstractContainerMenu::customDraw(const char* renderNodeName, fuiRe void UIScene_AbstractContainerMenu::handleInput(int a2, int a3, bool a4, bool a5, bool a6, bool& wasHandled) { if (!this->m_byte110) { - gConsoleUIController.AnimateKeyPress(this->m_padId, a3, a4, a5, a6); + g_consoleUIController.AnimateKeyPress(this->m_padId, a3, a4, a5, a6); if (a5) { wasHandled = this->handleKeyDown(this->m_padId, a3, a4); @@ -186,16 +186,16 @@ void UIScene_AbstractContainerMenu::handleDestroy() { player->closeContainer(); } - gConsoleUIController.OverrideSFX(this->m_padId, 0, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 20, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 2, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 3, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 11, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 10, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 7, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 6, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 4, 0); - gConsoleUIController.OverrideSFX(this->m_padId, 5, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 0, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 20, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 2, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 3, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 11, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 10, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 7, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 6, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 4, 0); + g_consoleUIController.OverrideSFX(this->m_padId, 5, 0); } int UIScene_AbstractContainerMenu::getPad() { diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_DeathMenu.cpp b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_DeathMenu.cpp index afc9c609..9c9a0cd7 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_DeathMenu.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_DeathMenu.cpp @@ -132,10 +132,10 @@ void UIScene_DeathMenu::tick() { void UIScene_DeathMenu::updateTooltips() { if (CConsoleMinecraftApp::sInstance.GetGameHostOption((eGameHostOption)0x1F)) { - gConsoleUIController.SetTooltips(this->m_padId, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + g_consoleUIController.SetTooltips(this->m_padId, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0); } else { - gConsoleUIController.SetTooltips(this->m_padId, StringIDs::Select, -1, -1, -1, -1, -1, -1, -1, -1, -1, + g_consoleUIController.SetTooltips(this->m_padId, StringIDs::Select, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0); } } @@ -156,7 +156,7 @@ void UIScene_DeathMenu::handleInput(int a2, int a3, bool a4, bool a5, bool a6, b if (this->m_byte10C) return; - gConsoleUIController.AnimateKeyPress(this->m_padId, a3, a4, a5, a6); + g_consoleUIController.AnimateKeyPress(this->m_padId, a3, a4, a5, a6); if (a3 == 21) { wasHandled = true; } diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_HowToPlayMenu.cpp b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_HowToPlayMenu.cpp index e5166d45..4e0df37d 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_HowToPlayMenu.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_HowToPlayMenu.cpp @@ -48,7 +48,7 @@ UIScene_HowToPlayMenu::UIScene_HowToPlayMenu(int padID, void* unk_unused, UILaye this->doHorizontalResizeCheck(); this->m_dword200 = 0; - gConsoleUIController.TouchBoxRebuild(this); + g_consoleUIController.TouchBoxRebuild(this); } std::wstring UIScene_HowToPlayMenu::getMoviePath() { @@ -59,7 +59,7 @@ std::wstring UIScene_HowToPlayMenu::getMoviePath() { } void UIScene_HowToPlayMenu::updateTooltips() { - gConsoleUIController.SetTooltips(this->m_padId, StringIDs::Select, StringIDs::Back_1, -1, -1, -1, -1, -1, + g_consoleUIController.SetTooltips(this->m_padId, StringIDs::Select, StringIDs::Back_1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0); } @@ -84,11 +84,11 @@ void UIScene_HowToPlayMenu::handleReload() { this->m_uicontrolList110.setCurrentSelection(this->m_dword200, false, true); this->doHorizontalResizeCheck(); - gConsoleUIController.TouchBoxRebuild(this); + g_consoleUIController.TouchBoxRebuild(this); } void UIScene_HowToPlayMenu::handleInput(int a2, int key, bool a4, bool a5, bool a6, bool& a7) { - gConsoleUIController.AnimateKeyPress(this->m_padId, key, a4, a5, a6); + g_consoleUIController.AnimateKeyPress(this->m_padId, key, a4, a5, a6); if (key == 4 || key == 5 || key == 8 || key == 9) { this->sendInputToMovie(key, false, a5, false); @@ -109,8 +109,8 @@ void UIScene_HowToPlayMenu::handleInput(int a2, int key, bool a4, bool a5, bool void UIScene_HowToPlayMenu::handlePress(int a2, int a3) { if (!a2) { this->m_dword200 = a3; - gConsoleUIController.PlayUISFX(SoundEvent::UI_PRESS); - gConsoleUIController.NavigateToScene( + g_consoleUIController.PlayUISFX(SoundEvent::UI_PRESS); + g_consoleUIController.NavigateToScene( this->m_padId, EUIScene::EUIScene_HowToPlay, reinterpret_cast(static_cast( 0x80000000 | ((dword_71011078D8[a3] << 16) | static_cast(this->m_padId)))), diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_Intro.cpp b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_Intro.cpp index 291fc28a..561dc912 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_Intro.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_Intro.cpp @@ -37,7 +37,7 @@ bool UIScene_Intro::hasFocus(int i) { void UIScene_Intro::handleGainFocus(bool focused) { if (this->m_skippable) - gConsoleUIController.NavigateToScene(0, EUIScene_MainMenu, nullptr, static_cast(6), + g_consoleUIController.NavigateToScene(0, EUIScene_MainMenu, nullptr, static_cast(6), static_cast(6)); } diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_MainMenu.cpp b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_MainMenu.cpp index d5b1b0da..3f8bc48a 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_MainMenu.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/UIScene_MainMenu.cpp @@ -24,7 +24,7 @@ UIScene_MainMenu::UIScene_MainMenu(int a1, void* a2, UILayer* layer) : UIScene(a1, layer) { Entity::fjDebugCheckSmallIdLeaks(); - gConsoleUIController.clearResolutionChangeDisableFlag(IUIController::FLAG_0); + g_consoleUIController.clearResolutionChangeDisableFlag(IUIController::FLAG_0); this->initialiseMovie(); layer->addComponent(a1, EUIComponent_Panorama, nullptr); layer->addComponent(a1, EUIComponent_Logo, nullptr); @@ -81,8 +81,8 @@ UIScene_MainMenu::UIScene_MainMenu(int a1, void* a2, UILayer* layer) : UIScene(a Minecraft::GetInstance()->SetupMiniGameInstance(MiniGameDef::GetCustomGameModeById(NORMAL_WORLD, true), 0); CGameNetworkManager::sInstance.ResetLeavingGame(); - gConsoleUIController.TouchBoxRebuild(this); - gConsoleUIController.ResetSelectedItem(); + g_consoleUIController.TouchBoxRebuild(this); + g_consoleUIController.ResetSelectedItem(); } bool UIScene_MainMenu::mapElementsAndNames() { @@ -152,7 +152,7 @@ void UIScene_MainMenu::tick() { void* inWorldMenu = (void*)(ConsoleUIController::sCurrentScene == EUIScene_LoadCreateJoinMenu && this->m_4eb); // ???? - gConsoleUIController.NavigateToScene(lockedProfile, ConsoleUIController::sCurrentScene, + g_consoleUIController.NavigateToScene(lockedProfile, ConsoleUIController::sCurrentScene, inWorldMenu, static_cast(6), static_cast(6)); diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.cpp b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.cpp new file mode 100644 index 00000000..ef37b1ca --- /dev/null +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.cpp @@ -0,0 +1,57 @@ +#include "NX/Platform.h" +#include "fui/fui.h" +#include "fui/fuiFile.h" +#include "fui/fuiRenderNode.h" +#include "fui/node/document/menu/FJ_Panorama.h" +#include "net/minecraft/client/Minecraft.h" +#include "net/minecraft/client/ui/ConsoleUIController.h" +#include "net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.h" +#include "net/minecraft/world/level/Level.h" +#include "net/minecraft/world/level/dimension/Dimension.h" +#include "net/minecraft/world/level/dimension/DimensionType.h" +#include "net/minecraft/world/level/storage/LevelData.h" +void UIComponent_Panorama::tick() { + if (this->hasMovie()) { + Minecraft *mc = Minecraft::GetInstance(); + + EnterCriticalSection(&mc->m_criticalSection); + if (mc->m_level && mc->m_level->m_dimension->getType() == DimensionType::OVERWORLD && mc->m_level->getLevelData()->getDayTime() % 24000 > 14000) { + this->setPanorama(false); + } else { + this->setPanorama(true); + } + LeaveCriticalSection(&mc->m_criticalSection); + + this->m_currentFrame = reinterpret_cast(this->m_fuiFile->getRootNode()->m_fuiNodeStage)->GetCurrentFrame(); + this->UIScene::tick(); + } +} + +// NON_MATCHING | Difference: 4036 +void UIComponent_Panorama::render(int i1, int i2, C4JRender::eViewportType viewportType) { + if (!this->m_unk || viewportType - 1 > 3) { + UIScene::render(i1, i2, viewportType); + return; + } + + if (viewportType == C4JRender::eViewportType_Bottom) { + g_consoleUIController.setupRenderPosition(0.0f, g_consoleUIController.getScreenHeight() * 0.5f); + fui::sInstance->render(this->m_fuiFile, 0.0f, 0.0f, i1, g_consoleUIController.getScreenHeight()); + return; + } + + if (viewportType == C4JRender::eViewportType_Right) { + g_consoleUIController.setupRenderPosition(g_consoleUIController.getScreenWidth() * 0.5f, 0.0f); + fui::sInstance->render(this->m_fuiFile, 0.0f, 0.0f, i1, g_consoleUIController.getScreenHeight()); + return; + } + + g_consoleUIController.setupRenderPosition(0.0f, 0.0f); + + if (viewportType > C4JRender::eViewportType_Right) { + fui::sInstance->render(this->m_fuiFile, 0.0f, 0.0f, g_consoleUIController.getScreenWidth(), g_consoleUIController.getScreenHeight(), 0.5f, 0.5f); + return; + } + + fui::sInstance->render(this->m_fuiFile, 0.0f, 0.0f, g_consoleUIController.getScreenWidth(), g_consoleUIController.getScreenHeight(), 0.5f, 0.5f); +} \ No newline at end of file diff --git a/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.h b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.h new file mode 100644 index 00000000..ad74bb6a --- /dev/null +++ b/src/Minecraft.Client/net/minecraft/client/ui/scene/scenes/component/UIComponent_Panorama.h @@ -0,0 +1,13 @@ +#pragma once +#include "net/minecraft/client/ui/scene/UIScene.h" + +class UIComponent_Panorama : public UIScene { + void tick() override; + void render(int i1, int i2, C4JRender::eViewportType viewportType) override; + + void setPanorama(bool daytime); + + int padding; + bool m_unk; + int m_currentFrame; +}; From 825edbdb7fb5eef43f7af8219002eeaa999afc56 Mon Sep 17 00:00:00 2001 From: Dexrn ZacAttack Date: Tue, 24 Feb 2026 05:53:47 -0800 Subject: [PATCH 2/2] refactor: add constants for skin type --- src/4JLibraries_Source/fui/fuiFile.h | 5 ++- .../client/ui/ConsoleUIController.cpp | 44 ++++++++++--------- .../minecraft/client/ui/ConsoleUIController.h | 2 +- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/4JLibraries_Source/fui/fuiFile.h b/src/4JLibraries_Source/fui/fuiFile.h index e234f508..803efa73 100644 --- a/src/4JLibraries_Source/fui/fuiFile.h +++ b/src/4JLibraries_Source/fui/fuiFile.h @@ -130,12 +130,15 @@ struct fuiData { }; struct fuiFile { + static constexpr int SKIN_TYPE_SD = 0; + static constexpr int SKIN_TYPE_HD = 1; + fuiFile(); ~fuiFile(); // NOTE: HAD TO CHANGE THE SIGNATURE BECAUSE OF THE METHOD BEING DIFFERENT // ORIG HAD A CALLBACK METHOD INSTEAD OF DATA static uint64_t addDataRegion(uint a1, uint a2, uchar** ptr, uint64_t* callbackData); - void load(arrayWithLength, int); + void load(arrayWithLength data, int skinType); bool resolveReferences(fuiFile*); void dumpUnresolvedReferences(); void initialiseRenderTexture(fuiBitmap*, bool); diff --git a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp index 708ac41b..cc3c139c 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp +++ b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.cpp @@ -1,10 +1,12 @@ #include "net/minecraft/client/ui/ConsoleUIController.h" #include "fui/fui.h" +#include "fui/fuiFile.h" #include "net/minecraft/client/CMinecraftApp.h" #include "net/minecraft/core/System.h" #include "net/minecraft/world/ArrayWithLength.h" #include "types.h" + #include // NON_MATCHING: TODO: finish this shit @@ -140,12 +142,12 @@ void ConsoleUIController::ShowOtherPlayersBaseScene(unsigned, bool) {} void ConsoleUIController::ShowAutosaveCountdownTimer(bool shown) {} void ConsoleUIController::UpdateAutosaveCountdownTimer(unsigned) {} -fuiFile *ConsoleUIController::loadSkin(const std::wstring &filename, const std::wstring &fallback, int isHd) { +fuiFile *ConsoleUIController::loadSkin(const std::wstring &filename, const std::wstring &fallback, int skinType) { if (filename.empty() || !CConsoleMinecraftApp::sInstance.hasArchiveFile(filename, false)) return nullptr; arrayWithLength file = CConsoleMinecraftApp::sInstance.getArchiveFile(filename, false); - fuiFile *f = fui::sInstance->load(file, false, isHd); + fuiFile *f = fui::sInstance->load(file, false, skinType); delete file.m_data; @@ -158,25 +160,25 @@ void ConsoleUIController::loadSkins() { std::wstring platformSkin = L""; platformSkin = L"skinNX.fui"; - this->m_fuiFilePlatformSkin = this->loadSkin(platformSkin, L"platformskin.fui", 0); + this->m_fuiFilePlatformSkin = this->loadSkin(platformSkin, L"platformskin.fui", fuiFile::SKIN_TYPE_SD); platformSkin = L"skinHDNX.fui"; - this->m_fuiFilePlatformSkinHd = this->loadSkin( platformSkin, L"platformskinHD.fui", 1); - - this->m_fuiFileSkinGraphics = this->loadSkin(L"skinGraphics.fui", L"skinGraphics.fui", 0); - this->m_fuiFileSkinGraphicsHud = this->loadSkin(L"skinGraphicsHud.fui", L"skinGraphicsHud.fui", 0); - this->m_fuiFileSkinGraphicsInGame = this->loadSkin(L"skinGraphicsInGame.fui", L"skinGraphicsInGame.fui", 0); - this->m_fuiFileSkinGraphicsLabels = this->loadSkin(L"skinGraphicsLabels.fui", L"skinGraphicsLabels.fui", 0); - this->m_fuiFileSkinLabels = this->loadSkin(L"skinLabels.fui", L"skinLabels.fui", 0); - this->m_fuiFileSkinInGame = this->loadSkin(L"skinInGame.fui", L"skinInGame.fui", 0); - this->m_fuiFileSkinHud = this->loadSkin(L"skinHud.fui", L"skinHud.fui", 0); - this->m_fuiFileSkin = this->loadSkin(L"skin.fui", L"skin.fui", 0); - this->m_fuiFileSkinHdGraphics = this->loadSkin(L"skinHDGraphics.fui", L"skinHDGraphics.fui", 1); - this->m_fuiFileSkinHdGraphicsHud = this->loadSkin(L"skinHDGraphicsHud.fui", L"skinHDGraphicsHud.fui", 1); - this->m_fuiFileSkinHdGraphicsInGame = this->loadSkin(L"skinHDGraphicsInGame.fui", L"skinHDGraphicsInGame.fui", 1); - this->m_fuiFileSkinHdGraphicsLabels = this->loadSkin(L"skinHDGraphicsLabels.fui", L"skinHDGraphicsLabels.fui", 1); - this->m_fuiFileSkinHdLabels = this->loadSkin(L"skinHDLabels.fui", L"skinHDLabels.fui", 1); - this->m_fuiFileSkinHdInGame = this->loadSkin(L"skinHDInGame.fui", L"skinHDInGame.fui", 1); - this->m_fuiFileSkinHdHud = this->loadSkin(L"skinHDHud.fui", L"skinHDHud.fui", 1); - this->m_fuiFileSkinHd = this->loadSkin(L"skinHD.fui", L"skinHD.fui", 1); + this->m_fuiFilePlatformSkinHd = this->loadSkin( platformSkin, L"platformskinHD.fui", fuiFile::SKIN_TYPE_HD); + + this->m_fuiFileSkinGraphics = this->loadSkin(L"skinGraphics.fui", L"skinGraphics.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkinGraphicsHud = this->loadSkin(L"skinGraphicsHud.fui", L"skinGraphicsHud.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkinGraphicsInGame = this->loadSkin(L"skinGraphicsInGame.fui", L"skinGraphicsInGame.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkinGraphicsLabels = this->loadSkin(L"skinGraphicsLabels.fui", L"skinGraphicsLabels.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkinLabels = this->loadSkin(L"skinLabels.fui", L"skinLabels.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkinInGame = this->loadSkin(L"skinInGame.fui", L"skinInGame.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkinHud = this->loadSkin(L"skinHud.fui", L"skinHud.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkin = this->loadSkin(L"skin.fui", L"skin.fui", fuiFile::SKIN_TYPE_SD); + this->m_fuiFileSkinHdGraphics = this->loadSkin(L"skinHDGraphics.fui", L"skinHDGraphics.fui", fuiFile::SKIN_TYPE_HD); + this->m_fuiFileSkinHdGraphicsHud = this->loadSkin(L"skinHDGraphicsHud.fui", L"skinHDGraphicsHud.fui", fuiFile::SKIN_TYPE_HD); + this->m_fuiFileSkinHdGraphicsInGame = this->loadSkin(L"skinHDGraphicsInGame.fui", L"skinHDGraphicsInGame.fui", fuiFile::SKIN_TYPE_HD); + this->m_fuiFileSkinHdGraphicsLabels = this->loadSkin(L"skinHDGraphicsLabels.fui", L"skinHDGraphicsLabels.fui", fuiFile::SKIN_TYPE_HD); + this->m_fuiFileSkinHdLabels = this->loadSkin(L"skinHDLabels.fui", L"skinHDLabels.fui", fuiFile::SKIN_TYPE_HD); + this->m_fuiFileSkinHdInGame = this->loadSkin(L"skinHDInGame.fui", L"skinHDInGame.fui", fuiFile::SKIN_TYPE_HD); + this->m_fuiFileSkinHdHud = this->loadSkin(L"skinHDHud.fui", L"skinHDHud.fui", fuiFile::SKIN_TYPE_HD); + this->m_fuiFileSkinHd = this->loadSkin(L"skinHD.fui", L"skinHD.fui", fuiFile::SKIN_TYPE_HD); } diff --git a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h index 81ea8793..cc746c61 100644 --- a/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h +++ b/src/Minecraft.Client/net/minecraft/client/ui/ConsoleUIController.h @@ -244,7 +244,7 @@ class ConsoleUIController : public IUIController { int (*)(void*, int, C4JStorage::EMessageResult), void*, wchar_t*, unsigned, bool, bool) override; - fuiFile *loadSkin(const std::wstring &filename, const std::wstring &fallback, int isHd); + fuiFile *loadSkin(const std::wstring &filename, const std::wstring &fallback, int skinType); void loadSkins(); void* m_qword8;