internal static void ResolveStudioObjects(ExtensibleSaveFormat.PluginData extendedData, ResolveType resolveType) { Dictionary <int, ObjectInfo> ObjectList = StudioObjectSearch.FindObjectInfo(StudioObjectSearch.SearchType.All); //Resolve all patterns for objects if (extendedData != null && extendedData.data.ContainsKey("patternInfo")) { List <StudioPatternResolveInfo> extPatternInfo; if (resolveType == ResolveType.Save) { extPatternInfo = ((List <byte[]>)extendedData.data["patternInfo"]).Select(x => StudioPatternResolveInfo.Deserialize(x)).ToList(); } else { extPatternInfo = ((object[])extendedData.data["patternInfo"]).Select(x => StudioPatternResolveInfo.Deserialize((byte[])x)).ToList(); } foreach (StudioPatternResolveInfo extPatternResolve in extPatternInfo) { ResolveStudioObjectPattern(extPatternResolve, ObjectList[extPatternResolve.DicKey], resolveType); } } //Resolve every item with extended data if (extendedData != null && extendedData.data.ContainsKey("itemInfo")) { List <StudioResolveInfo> extInfo; if (resolveType == ResolveType.Save) { extInfo = ((List <byte[]>)extendedData.data["itemInfo"]).Select(x => StudioResolveInfo.Deserialize(x)).ToList(); } else { extInfo = ((object[])extendedData.data["itemInfo"]).Select(x => StudioResolveInfo.Deserialize((byte[])x)).ToList(); } foreach (StudioResolveInfo extResolve in extInfo) { ResolveStudioObject(extResolve, ObjectList[extResolve.DicKey], resolveType); ObjectList.Remove(extResolve.DicKey); } } //Resolve every item without extended data in case of hard mods if (resolveType == ResolveType.Load) { foreach (ObjectInfo OI in ObjectList.Where(x => x.Value is OIItemInfo || x.Value is OILightInfo || x.Value is OICharInfo).Select(x => x.Value)) { ResolveStudioObject(OI); } } }
internal static void ResolveStudioMap(ExtensibleSaveFormat.PluginData extData, ResolveType resolveType) { //Set map ID to the resolved ID int MapID = Singleton <Studio.Studio> .Instance.sceneInfo.map; if (MapID == -1) //Loaded scene has no map { return; } if (extData != null && extData.data.ContainsKey("mapInfoGUID")) { string MapGUID = (string)extData.data["mapInfoGUID"]; StudioResolveInfo intResolve = LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.Slot == MapID && x.GUID == MapGUID); if (intResolve != null) { if (resolveType == ResolveType.Load && Sideloader.DebugLogging.Value) { Sideloader.Logger.Log(LogLevel.Debug, $"Resolving (Studio Map) [{MapGUID}] {MapID}->{intResolve.LocalSlot}"); } Singleton <Studio.Studio> .Instance.sceneInfo.map = intResolve.LocalSlot; } else { ShowGUIDError(MapGUID); } } else if (resolveType == ResolveType.Load) { if (!Singleton <Info> .Instance.dicMapLoadInfo.TryGetValue(MapID, out Info.MapLoadInfo mapInfo)) { //Map ID saved to the scene doesn't exist in the map list, try compatibility resolving StudioResolveInfo intResolve = LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.Slot == MapID); if (intResolve != null) { //Found a matching sideloader mod if (Sideloader.DebugLogging.Value) { Sideloader.Logger.Log(LogLevel.Debug, $"Compatibility resolving (Studio Map) {MapID}->{intResolve.LocalSlot}"); } Singleton <Studio.Studio> .Instance.sceneInfo.map = intResolve.LocalSlot; } else { Sideloader.Logger.Log(LogLevel.Warning | LogLevel.Message, $"[UAR] Compatibility resolving (Studio Map) failed, no match found for ID {MapID}"); } } } }
internal static void ResolveStudioBGM(ExtensibleSaveFormat.PluginData extData, ResolveType resolveType) { //Set bgm ID to the resolved ID int bgmID = Singleton <Studio.Studio> .Instance.sceneInfo.bgmCtrl.no; if (bgmID == -1) //Loaded scene has no bgm { return; } if (extData != null && extData.data.ContainsKey("bgmInfoGUID")) { string bgmGUID = (string)extData.data["bgmInfoGUID"]; StudioResolveInfo intResolve = LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.Slot == bgmID && x.GUID == bgmGUID); if (intResolve != null) { if (resolveType == ResolveType.Load && Sideloader.DebugLogging.Value) { Sideloader.Logger.LogDebug($"Resolving (Studio BGM) [{bgmGUID}] {bgmID}->{intResolve.LocalSlot}"); } Singleton <Studio.Studio> .Instance.sceneInfo.bgmCtrl.no = intResolve.LocalSlot; } else { ShowGUIDError(bgmGUID); } } else if (resolveType == ResolveType.Load) { if (!Singleton <Info> .Instance.dicBGMLoadInfo.TryGetValue(bgmID, out Info.LoadCommonInfo bgmInfo)) { //BGM ID saved to the scene doesn't exist in the bgm list, try compatibility resolving StudioResolveInfo intResolve = LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.Slot == bgmID); if (intResolve != null) { //Found a matching sideloader mod if (Sideloader.DebugLogging.Value) { Sideloader.Logger.LogDebug($"Compatibility resolving (Studio BGM) {bgmID}->{intResolve.LocalSlot}"); } Singleton <Studio.Studio> .Instance.sceneInfo.bgmCtrl.no = intResolve.LocalSlot; } else { Sideloader.Logger.Log(BepInEx.Logging.LogLevel.Warning | BepInEx.Logging.LogLevel.Message, $"[UAR] Compatibility resolving (Studio BGM) failed, no match found for ID {bgmID}"); } } } }
internal static void ResolveStudioRamp(ExtensibleSaveFormat.PluginData extData, ResolveType resolveType) { #if KK //Set ramp ID to the resolved ID int rampID = Studio.Studio.Instance.sceneInfo.rampG; if (extData != null && extData.data.ContainsKey("rampInfoGUID")) { string rampGUID = (string)extData.data["rampInfoGUID"]; ResolveInfo intResolve = LoadedResolutionInfo.FirstOrDefault(x => x.Property == "Ramp" && x.GUID == rampGUID && x.Slot == rampID); if (intResolve != null) { if (resolveType == ResolveType.Load && Sideloader.DebugLogging.Value) { Sideloader.Logger.LogDebug($"Resolving (Studio Ramp) [{rampID}] {rampID}->{intResolve.LocalSlot}"); } Studio.Studio.Instance.sceneInfo.rampG = intResolve.LocalSlot; } else { ShowGUIDError(rampGUID); } } else if (resolveType == ResolveType.Load) { if (!Lists.InternalDataList[ChaListDefine.CategoryNo.mt_ramp].ContainsKey(rampID)) { //Ramp ID saved to the scene doesn't exist in the items list, try compatibility resolving ResolveInfo intResolve = LoadedResolutionInfo.FirstOrDefault(x => x.Property == "Ramp" && x.Slot == rampID); if (intResolve != null) { //Found a matching sideloader mod if (Sideloader.DebugLogging.Value) { Sideloader.Logger.LogDebug($"Compatibility resolving (Studio Ramp) {rampID}->{intResolve.LocalSlot}"); } Studio.Studio.Instance.sceneInfo.rampG = intResolve.LocalSlot; } else { Sideloader.Logger.Log(BepInEx.Logging.LogLevel.Warning | BepInEx.Logging.LogLevel.Message, $"[UAR] Compatibility resolving (Studio Ramp) failed, no match found for ID {rampID}"); } } } #endif }
internal static void ResolveStudioFilter(ExtensibleSaveFormat.PluginData extData, ResolveType resolveType) { #if KK //Set filter ID to the resolved ID int filterID = Studio.Studio.Instance.sceneInfo.aceNo; if (extData != null && extData.data.ContainsKey("filterInfoGUID")) { string filterGUID = (string)extData.data["filterInfoGUID"]; StudioResolveInfo intResolve = LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.Slot == filterID && x.GUID == filterGUID); if (intResolve != null) { if (resolveType == ResolveType.Load && Sideloader.DebugLogging.Value) { Sideloader.Logger.LogDebug($"Resolving (Studio Filter) [{filterGUID}] {filterID}->{intResolve.LocalSlot}"); } Studio.Studio.Instance.sceneInfo.aceNo = intResolve.LocalSlot; } else { ShowGUIDError(filterGUID); } } else if (resolveType == ResolveType.Load) { if (!Info.Instance.dicFilterLoadInfo.TryGetValue(filterID, out Info.LoadCommonInfo filterInfo)) { //Filter ID saved to the scene doesn't exist in the filter list, try compatibility resolving StudioResolveInfo intResolve = LoadedStudioResolutionInfo.FirstOrDefault(x => x.ResolveItem && x.Slot == filterID); if (intResolve != null) { //Found a matching sideloader mod if (Sideloader.DebugLogging.Value) { Sideloader.Logger.LogDebug($"Compatibility resolving (Studio Filter) {filterID}->{intResolve.LocalSlot}"); } Studio.Studio.Instance.sceneInfo.aceNo = intResolve.LocalSlot; } else { Sideloader.Logger.Log(BepInEx.Logging.LogLevel.Warning | BepInEx.Logging.LogLevel.Message, $"[UAR] Compatibility resolving (Studio Filter) failed, no match found for ID {filterID}"); } } } #endif }