From 07282faf8cdf344f91b86fa7dd92b641ba4a739a Mon Sep 17 00:00:00 2001 From: MountainFlash Date: Wed, 15 Sep 2021 20:46:30 +0530 Subject: [PATCH 1/3] updated action --- .github/workflows/main.yml | 3 +++ CUE4Parse | 2 +- FModel/FModel.sln | 6 ------ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 135a94ac..a56c0d4d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,9 @@ jobs: with: submodules: 'true' + - name: Fetch Submodules Recursively + run: git submodule update --init --recursive + - name: .NET 5 Setup uses: actions/setup-dotnet@v1 with: diff --git a/CUE4Parse b/CUE4Parse index 36d50f3b..49beea8c 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 36d50f3b253327bb355a7c39385c9f1b9802203d +Subproject commit 49beea8c444aa357023d8eca209ddb8139b7a1c1 diff --git a/FModel/FModel.sln b/FModel/FModel.sln index 5fea2b89..a53a4881 100644 --- a/FModel/FModel.sln +++ b/FModel/FModel.sln @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUE4Parse-Fortnite", "..\CU EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUE4Parse-Conversion", "..\CUE4Parse\CUE4Parse-Conversion\CUE4Parse-Conversion.csproj", "{D0E1E8F7-F56D-469A-8E24-C2439B9FFD83}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CUE4Parse-Natives", "..\CUE4Parse\CUE4Parse-Natives\builddir\CUE4Parse-Natives.vcxproj", "{5A57D90F-44F6-3F94-AC61-66E23DB2160E}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -35,10 +33,6 @@ Global {D0E1E8F7-F56D-469A-8E24-C2439B9FFD83}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0E1E8F7-F56D-469A-8E24-C2439B9FFD83}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0E1E8F7-F56D-469A-8E24-C2439B9FFD83}.Release|Any CPU.Build.0 = Release|Any CPU - {5A57D90F-44F6-3F94-AC61-66E23DB2160E}.Debug|Any CPU.ActiveCfg = Debug|x64 - {5A57D90F-44F6-3F94-AC61-66E23DB2160E}.Debug|Any CPU.Build.0 = Debug|x64 - {5A57D90F-44F6-3F94-AC61-66E23DB2160E}.Release|Any CPU.ActiveCfg = Release|x64 - {5A57D90F-44F6-3F94-AC61-66E23DB2160E}.Release|Any CPU.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From c27d7425c55d178e13c7202cffba108ee7071dab Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Thu, 16 Sep 2021 18:59:54 +0200 Subject: [PATCH 2/3] Corruption Zones --- CUE4Parse | 2 +- FModel/Constants.cs | 6 +- FModel/Creator/Utils.cs | 21 +++-- FModel/ViewModels/CUE4ParseViewModel.cs | 2 +- FModel/ViewModels/MapViewerViewModel.cs | 101 ++++++++++++------------ FModel/Views/MapViewer.xaml | 5 +- 6 files changed, 72 insertions(+), 65 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index 49beea8c..4736f823 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 49beea8c444aa357023d8eca209ddb8139b7a1c1 +Subproject commit 4736f8231f61631ffbc5afbd2b4a1281b8651be5 diff --git a/FModel/Constants.cs b/FModel/Constants.cs index 944402ca..2c00ab02 100644 --- a/FModel/Constants.cs +++ b/FModel/Constants.cs @@ -14,10 +14,10 @@ namespace FModel public const string GREEN = "#98C379"; public const string YELLOW = "#E5C07B"; public const string BLUE = "#528BCC"; - - public const string DONATE_LINK = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EP9SSWG8MW4UC&source=url"; + public const string ISSUE_LINK = "https://github.com/iAmAsval/FModel/issues/new/choose"; - public const string DISCORD_LINK = "https://discord.gg/fdkNYYQ"; + public const string DONATE_LINK = "https://fmodel.app/donate"; + public const string DISCORD_LINK = "https://fmodel.app/discord"; public const string _FN_LIVE_TRIGGER = "fortnite-live.manifest"; public const string _VAL_LIVE_TRIGGER = "valorant-live.manifest"; diff --git a/FModel/Creator/Utils.cs b/FModel/Creator/Utils.cs index 0b965013..9a6fd51b 100644 --- a/FModel/Creator/Utils.cs +++ b/FModel/Creator/Utils.cs @@ -107,6 +107,13 @@ namespace FModel.Creator public static SKBitmap GetBitmap(UTexture2D texture) => texture.IsVirtual ? null : SKBitmap.Decode(texture.Decode()?.Encode()); public static SKBitmap GetBitmap(byte[] data) => SKBitmap.Decode(data); + public static SKBitmap ResizeWithRatio(this SKBitmap me, double width, double height) + { + var ratioX = width / me.Width; + var ratioY = height / me.Height; + var ratio = ratioX < ratioY ? ratioX : ratioY; + return me.Resize(Convert.ToInt32(me.Width * ratio), Convert.ToInt32(me.Height * ratio)); + } public static SKBitmap Resize(this SKBitmap me, int size) => me.Resize(size, size); public static SKBitmap Resize(this SKBitmap me, int width, int height) { @@ -115,12 +122,14 @@ namespace FModel.Creator me.ScalePixels(pixmap, SKFilterQuality.Medium); return bmp; } - public static SKBitmap ResizeWithRatio(this SKBitmap me, double width, double height) - { - var ratioX = width / me.Width; - var ratioY = height / me.Height; - var ratio = ratioX < ratioY ? ratioX : ratioY; - return me.Resize(Convert.ToInt32(me.Width * ratio), Convert.ToInt32(me.Height * ratio)); + + public static void ClearToTransparent(this SKBitmap me) { + var colors = me.Pixels; + for (var n = 0; n < colors.Length; n++) { + if (colors[n] != SKColors.Black) continue; + colors[n] = SKColors.Transparent; + } + me.Pixels = colors; } public static bool TryGetPackageIndexExport(FPackageIndex packageIndex, out T export) where T : UObject diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 95307c02..db93bd5c 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -349,7 +349,7 @@ namespace FModel.ViewModels if (VirtualPathCount > 0) { FLogger.AppendInformation(); - FLogger.AppendText($"{VirtualPathCount} virtual paths loaded!", Constants.WHITE, true); + FLogger.AppendText($"{VirtualPathCount} virtual paths loaded", Constants.WHITE, true); } else { diff --git a/FModel/ViewModels/MapViewerViewModel.cs b/FModel/ViewModels/MapViewerViewModel.cs index d8793896..b13a8306 100644 --- a/FModel/ViewModels/MapViewerViewModel.cs +++ b/FModel/ViewModels/MapViewerViewModel.cs @@ -10,7 +10,6 @@ using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Assets.Objects; using CUE4Parse.UE4.Objects.Core.i18N; using CUE4Parse.UE4.Objects.Core.Math; -using CUE4Parse.UE4.Objects.GameplayTags; using CUE4Parse.UE4.Objects.UObject; using FModel.Creator; using FModel.Extensions; @@ -96,11 +95,11 @@ namespace FModel.ViewModels set => SetProperty(ref _brFireflies, value, "ApolloGameplay_Fireflies"); } - private bool _brInks; - public bool BrInks + private bool _brCorruptionZones; + public bool BrCorruptionZones { - get => _brInks; - set => SetProperty(ref _brInks, value, "ApolloGameplay_Inks"); + get => _brCorruptionZones; + set => SetProperty(ref _brCorruptionZones, value, "ApolloGameplay_CorruptionZones"); } private bool _prLandmarks; @@ -228,8 +227,14 @@ namespace FModel.ViewModels foreach (var (key, value) in _bitmaps[MapIndex]) { - if (!value.IsEnabled || !withMap && key == _FIRST_BITMAP) continue; - c.DrawBitmap(value.Layer, new SKRect(0, 0, _widthHeight, _widthHeight)); + if (!value.IsEnabled || !withMap && key == _FIRST_BITMAP) + continue; + + SKPaint p = null; + if (key == "ApolloGameplay_CorruptionZones") + p = new SKPaint { BlendMode = SKBlendMode.Color }; + + c.DrawBitmap(value.Layer, new SKRect(0, 0, _widthHeight, _widthHeight), p); } return ret; @@ -275,8 +280,8 @@ namespace FModel.ViewModels case "ApolloGameplay_Fireflies": await LoadFireflies(); break; - case "ApolloGameplay_Inks": - await LoadInks(); + case "ApolloGameplay_CorruptionZones": + await LoadCorruptionZones(); break; case "PapayaGameplay_CannonballGame": await LoadCannonballGame(); @@ -387,7 +392,7 @@ namespace FModel.ViewModels !mapMaterial.TryGetValue(out FStructFallback cachedExpressionData, "CachedExpressionData") || !cachedExpressionData.TryGetValue(out FStructFallback parameters, "Parameters") || !parameters.TryGetValue(out UTexture2D[] textureValues, "TextureValues")) return; - + _bitmaps[0][_FIRST_BITMAP] = new MapLayer{Layer = Utils.GetBitmap(textureValues[0]), IsEnabled = true}; _brMiniMapImage = GetImageSource(_bitmaps[0][_FIRST_BITMAP].Layer); }); @@ -812,45 +817,6 @@ namespace FModel.ViewModels _bitmaps[0]["ApolloGameplay_VendingMachines"] = new MapLayer {Layer = vendingMachinesBitmap, IsEnabled = false}; }); } - - private async Task LoadInks() - { - await _threadWorkerView.Begin(_ => - { - _fillPaint.StrokeWidth = 5; - var inksBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul); - using var c = new SKCanvas(inksBitmap); - - if (!Utils.TryLoadObject("BattlePassS18/Maps/BattlepassS18_LevelOverlay_Config.BattlepassS18_LevelOverlay_Config", out UObject config) || - !config.TryGetValue(out FStructFallback[] overlayList, "OverlayList") || overlayList.Length < 1) - return; - - foreach (var overlay in overlayList) - { - if (!overlay.TryGetValue(out FSoftObjectPath overlayWorld, "OverlayWorld")) continue; - - var exports = Utils.LoadExports(overlayWorld.AssetPathName.Text.SubstringBeforeLast(".")); - foreach (var export in exports) - { - if (!export.ExportType.StartsWith("BP_S18_ToonInk_CollectibleColor", StringComparison.OrdinalIgnoreCase)) continue; - - if (!export.TryGetValue(out FPackageIndex rootComponent, "RootComponent") || - !Utils.TryGetPackageIndexExport(rootComponent, out UObject uObject) || - !uObject.TryGetValue(out FVector relativeLocation, "RelativeLocation")) continue; - - if (!export.TryGetValue(out FPackageIndex questIconComponent, "QuestIconComponent") || - !Utils.TryGetPackageIndexExport(questIconComponent, out uObject) || - !uObject.TryGetValue(out FStructFallback mapIconData, "MapIconData") || - !mapIconData.TryGetValue(out FPackageIndex mapIcon, "MapIcon")) continue; - - var vector = GetMapPosition(relativeLocation, _brRadius); - c.DrawBitmap(Utils.GetBitmap(mapIcon), vector.X, vector.Y); - } - } - - _bitmaps[0]["ApolloGameplay_Inks"] = new MapLayer {Layer = inksBitmap, IsEnabled = false}; - }); - } private async Task LoadFireflies() { @@ -885,11 +851,11 @@ namespace FModel.ViewModels await _threadWorkerView.Begin(_ => { _fillPaint.StrokeWidth = 5; - var tagsLocationBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul); - using var c = new SKCanvas(tagsLocationBitmap); - if (!Utils.TryLoadObject("FortniteGame/Content/Quests/QuestTagToLocationDataRows.QuestTagToLocationDataRows", out UDataTable locationData)) return; + + var tagsLocationBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul); + using var c = new SKCanvas(tagsLocationBitmap); foreach (var (key, uObject) in locationData.RowMap) { @@ -912,5 +878,36 @@ namespace FModel.ViewModels _bitmaps[0]["ApolloGameplay_TagsLocation"] = new MapLayer {Layer = tagsLocationBitmap, IsEnabled = false}; }); } + + private async Task LoadCorruptionZones() + { + await _threadWorkerView.Begin(_ => + { + _fillPaint.StrokeWidth = 5; + if (!Utils.TryLoadObject("FortniteGame/Content/Athena/Apollo/Environments/Landscape/Materials/Corruption/T_InitialCorruptionAreas.T_InitialCorruptionAreas", out UTexture2D corruption)) + return; + + var overlay = Utils.GetBitmap(corruption); + var width = overlay.Width; + var height = overlay.Height; + var rotatedBitmap = new SKBitmap(width, height, SKColorType.Rgba8888, SKAlphaType.Opaque); + + using var c = new SKCanvas(rotatedBitmap); + c.Clear(); + c.Translate(0, width); + c.RotateDegrees(-90); + c.DrawRect(0, 0, width, height, new SKPaint + { + IsAntialias = true, FilterQuality = SKFilterQuality.High, + Shader = SKShader.CreateCompose(SKShader.CreateSweepGradient(new SKPoint(width / 2f, height / 2f),new [] { + SKColor.Parse("#352176"), SKColor.Parse("#fd78fa"), SKColor.Parse("#f0b843"), SKColor.Parse("#e54a21") + }, null), SKShader.CreatePerlinNoiseTurbulence(0.05f, 0.05f, 4, 0), SKBlendMode.SrcOver) + }); + c.DrawBitmap(overlay, 0, 0, new SKPaint { BlendMode = SKBlendMode.Darken }); + rotatedBitmap.ClearToTransparent(); + + _bitmaps[0]["ApolloGameplay_CorruptionZones"] = new MapLayer {Layer = rotatedBitmap.Resize(_widthHeight, _widthHeight), IsEnabled = false}; + }); + } } } diff --git a/FModel/Views/MapViewer.xaml b/FModel/Views/MapViewer.xaml index d42150b3..7c88543b 100644 --- a/FModel/Views/MapViewer.xaml +++ b/FModel/Views/MapViewer.xaml @@ -39,8 +39,9 @@ DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" /> - - + From 35ce351fbdf161de2c2720a93d47c8ffe0f6b686 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Fri, 17 Sep 2021 00:00:53 +0200 Subject: [PATCH 3/3] Cube Movements --- FModel/ViewModels/MapViewerViewModel.cs | 79 +++++++++++++++++++++++++ FModel/Views/MapViewer.xaml | 2 + 2 files changed, 81 insertions(+) diff --git a/FModel/ViewModels/MapViewerViewModel.cs b/FModel/ViewModels/MapViewerViewModel.cs index b13a8306..cd945bed 100644 --- a/FModel/ViewModels/MapViewerViewModel.cs +++ b/FModel/ViewModels/MapViewerViewModel.cs @@ -102,6 +102,13 @@ namespace FModel.ViewModels set => SetProperty(ref _brCorruptionZones, value, "ApolloGameplay_CorruptionZones"); } + private bool _brCubeMovements; + public bool BrCubeMovements + { + get => _brCubeMovements; + set => SetProperty(ref _brCubeMovements, value, "ApolloGameplay_CubeMovements"); + } + private bool _prLandmarks; public bool PrLandmarks { @@ -283,6 +290,9 @@ namespace FModel.ViewModels case "ApolloGameplay_CorruptionZones": await LoadCorruptionZones(); break; + case "ApolloGameplay_CubeMovements": + await LoadCubeMovements(); + break; case "PapayaGameplay_CannonballGame": await LoadCannonballGame(); break; @@ -909,5 +919,74 @@ namespace FModel.ViewModels _bitmaps[0]["ApolloGameplay_CorruptionZones"] = new MapLayer {Layer = rotatedBitmap.Resize(_widthHeight, _widthHeight), IsEnabled = false}; }); } + + /// + /// FortniteGame/Plugins/GameFeatures/CorruptionGameplay/Content/CorruptionGameplay_LevelOverlay.uasset + /// too lazy to filters + /// + private async Task LoadCubeMovements() + { + await _threadWorkerView.Begin(_ => + { + _fillPaint.StrokeWidth = 5; + var cubeMovementsBitmap = new SKBitmap(_widthHeight, _widthHeight, SKColorType.Rgba8888, SKAlphaType.Premul); + using var c = new SKCanvas(cubeMovementsBitmap); + + if (!Utils.TryLoadObject("/CorruptionGameplay/Levels/CorruptionGameplay_ApolloTerrain_Overlay.BP_CubeMovementGradient_2", out UObject overlay) || + !overlay.TryGetValue(out FSoftObjectPath[] cubeMovementStaticPaths, "cubeMovementStaticPaths") || cubeMovementStaticPaths.Length < 1) + return; + + var oldColor = _pathPaint.Color; + _pathPaint.Color = SKColors.Purple; + foreach (var cubeMovementStaticPath in cubeMovementStaticPaths) + { + var objectPath = cubeMovementStaticPath.AssetPathName.Text.SubstringBeforeLast("."); + var objectName = cubeMovementStaticPath.SubPathString.SubstringAfterLast("."); + if (!Utils.TryLoadObject($"{objectPath}.{objectName}", out UObject staticPath)) + continue; + + DrawCubeMovements(c, staticPath); + } + + if (Utils.TryLoadObject("/CorruptionGameplay/Levels/CubeMovement/Apollo_CM_Gold_Overlay.CM_Spline_Gold", out UObject goldPath)) + { + _pathPaint.Color = SKColors.Gold; + DrawCubeMovements(c, goldPath); + } + + _pathPaint.Color = oldColor; + _bitmaps[0]["ApolloGameplay_CubeMovements"] = new MapLayer {Layer = cubeMovementsBitmap, IsEnabled = false}; + }); + } + + private void DrawCubeMovements(SKCanvas c, UObject staticPath) + { + if (!staticPath.TryGetValue(out FStructFallback[] pathTravelers, "PathTravelers") || pathTravelers.Length < 1 || + !pathTravelers[0].TryGetValue(out FPackageIndex[] generatedSplinesArray, "GeneratedSplinesArray") || generatedSplinesArray.Length < 1 || + !pathTravelers[0].TryGetValue(out FStructFallback[] stepMetaData, "StepMetaData") || stepMetaData.Length < 1) + return; + + var bDone = false; + var path = new SKPath(); + for (var i = 0; i < generatedSplinesArray.Length; i++) + { + if (!stepMetaData[i].TryGetValue(out bool bSkipStep, "bSkipStep") || bSkipStep || + !Utils.TryGetPackageIndexExport(generatedSplinesArray[i], out UObject uObject) || + !uObject.TryGetValue(out FVector relativeLocation, "RelativeLocation")) continue; + + var vector = GetMapPosition(relativeLocation, _brRadius); + if (!bDone) + { + path.MoveTo(vector.X, vector.Y); + bDone = true; + } + else + { + path.LineTo(vector.X, vector.Y); + } + } + + c.DrawPath(path, _pathPaint); + } } } diff --git a/FModel/Views/MapViewer.xaml b/FModel/Views/MapViewer.xaml index 7c88543b..f7f9fd27 100644 --- a/FModel/Views/MapViewer.xaml +++ b/FModel/Views/MapViewer.xaml @@ -42,6 +42,8 @@ +