MinecraftConsoles/Minecraft.Client/Common/UI/UI.h
MrTheShy 4f2352361a Add Mojang/Ely.by/offline authentication system
The old Windows64 port had no real player identity — it used hardcoded
fake XUIDs, so anyone could impersonate anyone. This replaces that with
proper auth supporting Mojang, Ely.by, and offline accounts.

MCAuth library (new, MCAuth/):
  Mojang auth via MSA device code flow (XBL, SISU, MC services),
  Ely.by via Yggdrasil with 2FA, offline UUID generation matching
  Java Edition (MD5 v3 from "OfflinePlayer:<name>"). Multi-account
  manager with background token refresh, per-slot sessions, and
  on-disk token persistence. Server-side session verification via
  Mojang/Ely.by hasJoined API. Skin fetching and PNG validation
  from texture servers.

Network protocol (version bumped to 80):
  Three new packets (AuthScheme, AuthResponse, AuthResult) implement
  a server-driven auth handshake before login completes. Player
  identity migrated from 64-bit XUID to 128-bit GameUUID backed by
  two uint64 fields (hi/lo). readPlayerUID/writePlayerUID now
  serialize 16 bytes on the wire. Old and new clients cannot connect
  to each other — version mismatch is rejected at PreLogin.

Save migration:
  Map data mappings auto-migrate from old format: the old 64-bit
  XUID is placed in hi, lo is set to 0 as a sentinel. On first
  access by the real player, the sentinel entry is upgraded in-place
  to the full 128-bit UUID. Format detection is by file size (2080,
  2112, or 4160 bytes). Player .dat filenames inside saveData.ms
  change from decimal XUID to dashed UUID — old saves need manual
  entry renaming in the archive.

UI:
  NativeUIRenderer: immediate-mode drawing system (quads, text,
  9-slice panels, scrollbars, focus lists) for rendering auth
  screens without Flash/Scaleform. UIScene_MSAuth handles device
  code display, Ely.by credential input with 2FA, per-account
  skin head preview, and multi-account add/remove/switch.

Server:
  online-mode and auth-provider (mojang/elyby) in server.properties.
  Whitelist and ban checks validate against the server-verified UUID.
  Incompatible auth scheme logs which provider the server expects
  vs what the client is using.

Also fixes a pre-existing exploit where any client could send a
DebugOptionsPacket to grant themselves CraftAnything and other debug
privileges on any server — now requires OP status server-side.
2026-03-23 01:14:23 +01:00

131 lines
3.8 KiB
C

#pragma once
#include "UIEnums.h"
#include "UIStructs.h"
#include "UIBitmapFont.h"
#include "UITTFFont.h"
#include "UIScene.h"
#include "UILayer.h"
#include "UIGroup.h"
#include "UIController.h"
#include "UIControl.h"
#include "UIControl_Base.h"
#include "UIControl_Button.h"
#include "UIControl_CheckBox.h"
#include "UIControl_Slider.h"
#include "UIControl_Label.h"
#include "UIControl_TextInput.h"
#include "UIControl_SlotList.h"
#include "UIControl_Cursor.h"
#include "UIControl_ButtonList.h"
#include "UIControl_Progress.h"
#include "UIControl_TexturePackList.h"
#include "UIControl_LeaderboardList.h"
#include "UIControl_SaveList.h"
#include "UIControl_PlayerList.h"
#include "UIControl_BitmapIcon.h"
#include "UIControl_DLCList.h"
#include "UIControl_HTMLLabel.h"
#include "UIControl_DynamicLabel.h"
#include "UIControl_MinecraftPlayer.h"
#include "UIControl_MinecraftHorse.h"
#include "UIControl_PlayerSkinPreview.h"
#include "UIControl_EnchantmentButton.h"
#include "UIControl_EnchantmentBook.h"
#include "UIControl_SpaceIndicatorBar.h"
#include "UIControl_BeaconEffectButton.h"
#ifdef __PSVITA__
#include "UIControl_Touch.h"
#endif
#include "UIScene_HUD.h"
#include "UIComponent_Panorama.h"
#include "UIComponent_Logo.h"
#include "UIComponent_Tooltips.h"
#include "UIComponent_TutorialPopup.h"
#include "UIComponent_Chat.h"
#include "UIComponent_PressStartToPlay.h"
#include "UIComponent_MenuBackground.h"
#include "UIScene_QuadrantSignin.h"
#include "UIScene_MessageBox.h"
#include "UIScene_Timer.h"
#include "UIScene_Keyboard.h"
#include "UIScene_DebugOverlay.h"
#include "UIScene_DebugOptions.h"
#include "UIComponent_DebugUIConsole.h"
#include "UIComponent_DebugUIMarketingGuide.h"
#include "UIScene_DebugSetCamera.h"
#include "UIScene_DebugCreateSchematic.h"
#include "UIScene_TrialExitUpsell.h"
#include "UIScene_Intro.h"
#include "UIScene_SaveMessage.h"
#include "UIScene_MainMenu.h"
#include "UIScene_LoadMenu.h"
#include "UIScene_JoinMenu.h"
#include "UIScene_LoadOrJoinMenu.h"
#include "UIScene_CreateWorldMenu.h"
#include "UIScene_LaunchMoreOptionsMenu.h"
#include "UIScene_FullscreenProgress.h"
#include "UIScene_LeaderboardsMenu.h"
#include "UIScene_DLCMainMenu.h"
#include "UIScene_DLCOffersMenu.h"
#include "UIScene_ReinstallMenu.h"
#include "UIScene_HelpAndOptionsMenu.h"
#include "UIScene_SettingsMenu.h"
#include "UIScene_SettingsOptionsMenu.h"
#include "UIScene_SettingsAudioMenu.h"
#include "UIScene_SettingsControlMenu.h"
#include "UIScene_SettingsGraphicsMenu.h"
#include "UIScene_SettingsUIMenu.h"
#include "UIScene_SkinSelectMenu.h"
#include "UIScene_HowToPlayMenu.h"
#include "UIScene_LanguageSelector.h"
#ifndef MINECRAFT_SERVER_BUILD
#include "UIScene_MSAuth.h"
#endif
#include "UIScene_HowToPlay.h"
#include "UIScene_ControlsMenu.h"
#include "UIScene_Credits.h"
#include "UIScene_PauseMenu.h"
#include "UIScene_AbstractContainerMenu.h"
#include "UIScene_BrewingStandMenu.h"
#include "UIScene_ContainerMenu.h"
#include "UIScene_DispenserMenu.h"
#include "UIScene_EnchantingMenu.h"
#include "UIScene_InventoryMenu.h"
#include "UIScene_FurnaceMenu.h"
#include "UIScene_CreativeMenu.h"
#include "UIScene_TradingMenu.h"
#include "UIScene_AnvilMenu.h"
#include "UIScene_HorseInventoryMenu.h"
#include "UIScene_HopperMenu.h"
#include "UIScene_BeaconMenu.h"
#include "UIScene_FireworksMenu.h"
#include "UIScene_CraftingMenu.h"
#include "UIScene_SignEntryMenu.h"
#include "UIScene_ConnectingProgress.h"
#include "UIScene_DeathMenu.h"
#include "UIScene_InGameInfoMenu.h"
#include "UIScene_InGameHostOptionsMenu.h"
#include "UIScene_InGamePlayerOptionsMenu.h"
#if defined(_XBOX_ONE) || defined(__ORBIS__)
#include "UIScene_InGameSaveManagementMenu.h"
#endif
#include "UIScene_TeleportMenu.h"
#include "UIScene_EndPoem.h"
#include "UIScene_EULA.h"
#include "UIScene_NewUpdateMessage.h"
extern ConsoleUIController ui;