0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 04:50:45 -05:00
This commit is contained in:
Dev 2023-07-20 13:11:09 +01:00
parent 9482040d08
commit 8bef9700e2
6 changed files with 38 additions and 38 deletions

View File

@ -23,7 +23,7 @@ git config --local user.email "USERNAME@SOMETHING.com"
## Requirements ## Requirements
- Escape From Tarkov 24696 - Escape From Tarkov 24964
- BepInEx 5.4.19 - BepInEx 5.4.19
- Visual Studio Code - Visual Studio Code
- .NET 6 SDK - .NET 6 SDK

View File

@ -63,19 +63,32 @@ namespace Aki.Custom.Patches
return false; return false;
} }
public static string GetPairKey(KeyValuePair<string, BundleItem> x) private static async Task Init(EasyAssets instance, [CanBeNull] IBundleLock bundleLock, string defaultKey, string rootPath,
string platformName, [CanBeNull] Func<string, bool> shouldExclude, Func<string, Task> bundleCheck)
{ {
return x.Key; // platform manifest
var path = $"{rootPath.Replace("file:///", string.Empty).Replace("file://", string.Empty)}/{platformName}/";
var filepath = path + platformName;
var manifest = (File.Exists(filepath)) ? await GetManifestBundle(filepath) : await GetManifestJson(filepath);
// load bundles
var bundleNames = manifest.GetAllAssetBundles().Union(BundleManager.Bundles.Keys).ToArray();
var bundles = (IEasyBundle[])Array.CreateInstance(EasyBundleHelper.Type, bundleNames.Length);
if (bundleLock == null)
{
bundleLock = new BundleLock(int.MaxValue);
} }
public static BundleDetails GetPairValue(KeyValuePair<string, BundleItem> x) for (var i = 0; i < bundleNames.Length; i++)
{ {
return new BundleDetails bundles[i] = (IEasyBundle)Activator.CreateInstance(EasyBundleHelper.Type, new object[] { bundleNames[i], path, manifest, bundleLock, bundleCheck });
{ await JobScheduler.Yield(EJobPriority.Immediate);
FileName = x.Value.FileName, }
Crc = x.Value.Crc,
Dependencies = x.Value.Dependencies _manifestField.SetValue(instance, manifest);
}; _bundlesField.SetValue(instance, bundles);
_systemProperty.SetValue(instance, new DependencyGraph(bundles, defaultKey, shouldExclude));
} }
private static async Task<CompatibilityAssetBundleManifest> GetManifestBundle(string filepath) private static async Task<CompatibilityAssetBundleManifest> GetManifestBundle(string filepath)
@ -106,32 +119,19 @@ namespace Aki.Custom.Patches
return manifest; return manifest;
} }
private static async Task Init(EasyAssets instance, [CanBeNull] IBundleLock bundleLock, string defaultKey, string rootPath, public static string GetPairKey(KeyValuePair<string, BundleItem> x)
string platformName, [CanBeNull] Func<string, bool> shouldExclude, Func<string, Task> bundleCheck)
{ {
// platform manifest return x.Key;
var path = $"{rootPath.Replace("file:///", string.Empty).Replace("file://", string.Empty)}/{platformName}/"; }
var filepath = path + platformName;
var manifest = (File.Exists(filepath)) ? await GetManifestBundle(filepath) : await GetManifestJson(filepath);
// load bundles public static BundleDetails GetPairValue(KeyValuePair<string, BundleItem> x)
var bundleNames = manifest.GetAllAssetBundles().Union(BundleManager.Bundles.Keys).ToArray();
var bundles = (IEasyBundle[])Array.CreateInstance(EasyBundleHelper.Type, bundleNames.Length);
if (bundleLock == null)
{ {
bundleLock = new BundleLock(int.MaxValue); return new BundleDetails
}
for (var i = 0; i < bundleNames.Length; i++)
{ {
bundles[i] = (IEasyBundle)Activator.CreateInstance(EasyBundleHelper.Type, new object[] { bundleNames[i], path, manifest, bundleLock, bundleCheck }); FileName = x.Value.FileName,
await JobScheduler.Yield(EJobPriority.Immediate); Crc = x.Value.Crc,
} Dependencies = x.Value.Dependencies
};
_manifestField.SetValue(instance, manifest);
_bundlesField.SetValue(instance, bundles);
_systemProperty.SetValue(instance, new DependencyGraph(bundles, defaultKey, shouldExclude));
} }
} }
} }

View File

@ -33,7 +33,7 @@ namespace Aki.Custom.Patches
var player = Singleton<GameWorld>.Instance.MainPlayer; var player = Singleton<GameWorld>.Instance.MainPlayer;
if (profileId == player?.Profile.Id) if (profileId == player?.Profile.Id)
{ {
GClass2974.Instance.CloseAllScreensForced(); GClass2975.Instance.CloseAllScreensForced();
} }
return true; return true;

View File

@ -2,7 +2,7 @@
using HarmonyLib; using HarmonyLib;
using System; using System;
using System.Reflection; using System.Reflection;
using TraderInfo = EFT.Profile.GClass1726; using TraderInfo = EFT.Profile.GClass1727;
namespace Aki.SinglePlayer.Patches.RaidFix namespace Aki.SinglePlayer.Patches.RaidFix
{ {

View File

@ -114,9 +114,9 @@ namespace Aki.SinglePlayer.Patches.ScavMode
// Get fields from MainMenuController.cs // Get fields from MainMenuController.cs
var raidSettings = Traverse.Create(menuController).Field("raidSettings_0").GetValue<RaidSettings>(); var raidSettings = Traverse.Create(menuController).Field("raidSettings_0").GetValue<RaidSettings>();
var matchmakerPlayersController = Traverse.Create(menuController).Field("gclass3027_0").GetValue<GClass3027>(); var matchmakerPlayersController = Traverse.Create(menuController).Field("gclass3028_0").GetValue<GClass3028>();
var gclass = new MatchmakerOfflineRaidScreen.GClass3016(profile?.Info, ref raidSettings, matchmakerPlayersController); var gclass = new MatchmakerOfflineRaidScreen.GClass3017(profile?.Info, ref raidSettings, matchmakerPlayersController);
gclass.OnShowNextScreen += LoadOfflineRaidNextScreen; gclass.OnShowNextScreen += LoadOfflineRaidNextScreen;

Binary file not shown.