jalil49/MoreAccessories

Koikatsu Sunshine and cards with more than 20 accessories

Closed this issue · 2 comments

Hi,

Using:

  • BepInEx 5.4.17
  • KKSAPI 1.27
  • MoreOutfits 1.1.0.0

I started to test cards with more than 20 accessories and when I try to talk to them MoreAccessories throws a stack trace and the girl in the talk scene is deformed. No head, hair, no clothes has an shlong, ... I need help to identify in the trace what plugin is causing the problem.

[Warning:MoreAccessories] Do not change showAccessory array size 20 != 29   at System.Environment.get_StackTrace () [0x00000] in <fb001e01371b4adca20013e0ac763896>:0 
  at MoreAccessoriesKOI.Patches.Common_Patches+ShowAccessorySetterPatch.Prefix (ChaFileStatus __instance, System.Boolean[] value) [0x00000] in <14143581a51c4df6ab76fc7f2e077b74>:0 
  at ChaFileStatus.DMD<ChaFileStatus::set_showAccessory> (ChaFileStatus , System.Boolean[] ) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at MoreAccessoriesKOI.Patches.ChaFile_Patches+ChaFileControl_Copy_Patches.Prefix (ChaFileStatus __instance, ChaFileStatus src) [0x00000] in <14143581a51c4df6ab76fc7f2e077b74>:0 
  at ChaFileStatus.DMD<ChaFileStatus::Copy> (ChaFileStatus , ChaFileStatus ) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at ChaFile.SetStatusBytes (System.Byte[] data) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at ChaControl.DMD<ChaControl::LoadNoAsync> (ChaControl , System.Boolean ) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at ChaControl+<LoadAsync>d__443.DMD<ChaControl+<LoadAsync>d__443::MoveNext> (ChaControl+<LoadAsync>d__443 ) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at UniRx.Observable+<WrapEnumerator>d__291.MoveNext () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0 
  at UnityEngine.MonoBehaviour.StartCoroutineManaged2 (System.Collections.IEnumerator enumerator) [0x00000] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0 
  at UnityEngine.MonoBehaviour.StartCoroutine (System.Collections.IEnumerator routine) [0x00000] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0 
  at UniRx.MainThreadDispatcher.StartCoroutine (System.Collections.IEnumerator routine) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.MainThreadDispatcher.SendStartCoroutine (System.Collections.IEnumerator routine) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.FromCoroutineObservable`1[T].SubscribeCore (System.IObserver`1[T] observer, System.IDisposable cancel) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.OperatorObservableBase`1[T].Subscribe (System.IObserver`1[T] observer) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.WhenAllObservable+WhenAll.Run () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.WhenAllObservable.SubscribeCore (System.IObserver`1[T] observer, System.IDisposable cancel) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.OperatorObservableBase`1[T].Subscribe (System.IObserver`1[T] observer) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.ObservableYieldInstruction`1[T]..ctor (System.IObservable`1[T] source, System.Boolean reThrowOnError, System.Threading.CancellationToken cancel) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Observable.ToYieldInstruction[T] (System.IObservable`1[T] source, System.Boolean throwOnError) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at ChaLoadingTask+<Loading>d__22.MoveNext () [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at UniRx.Observable+<WrapEnumerator>d__291.MoveNext () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0 
  at UnityEngine.MonoBehaviour.StartCoroutineManaged2 (System.Collections.IEnumerator enumerator) [0x00000] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0 
  at UnityEngine.MonoBehaviour.StartCoroutine (System.Collections.IEnumerator routine) [0x00000] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0 
  at UniRx.MainThreadDispatcher.StartCoroutine (System.Collections.IEnumerator routine) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.MainThreadDispatcher.SendStartCoroutine (System.Collections.IEnumerator routine) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.FromCoroutineObservable`1[T].SubscribeCore (System.IObserver`1[T] observer, System.IDisposable cancel) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.OperatorObservableBase`1[T].Subscribe (System.IObserver`1[T] observer) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.ObservableExtensions.Subscribe[T] (System.IObservable`1[T] source, System.Action`1[T] onNext, System.Action onCompleted) [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at ChaLoadingTask.Reserve (System.Int32 priority, ChaControl chaCtrl, System.Boolean isAsync, System.Boolean reflectStatus) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at ChaLoadingTask.Load (System.Int32 priority, ChaControl chaCtrl, System.Boolean reflectStatus) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at TalkScene+<Setup>d__243.MoveNext () [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].Run () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.AwaiterActions.Continuation (System.Object state) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].TrySetResult (TResult result) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].SetResult () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at TalkScene+<Fade>d__241.MoveNext () [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].Run () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.AwaiterActions.Continuation (System.Object state) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].TrySetResult (TResult result) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].SetResult () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at FadeCanvas+<StartFadeAysnc>d__28.MoveNext () [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].Run () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.AwaiterActions.Continuation (System.Object state) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].TrySetResult (TResult result) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].SetResult () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at FadeCanvas+<StartAysnc>d__53.MoveNext () [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].Run () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.AwaiterActions.Continuation (System.Object state) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.UniTaskCompletionSource`1[T].TrySignalCompletion (Cysharp.Threading.Tasks.UniTaskStatus status) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.UniTaskCompletionSource`1[T].TrySetResult (T result) [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at Cysharp.Threading.Tasks.UniTaskObservableExtensions+ToUniTaskObserver`1[T].OnCompleted () [0x00000] in <a6c8968257574c7f9471c6b472918e11>:0 
  at UniRx.Operators.DoObservable`1+Do[T].OnCompleted () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.FrameTimeIntervalObservable`1+FrameTimeInterval[T].OnCompleted () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.Operators.CreateSafeObservable`1+CreateSafe[T].OnCompleted () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at ReMotion.ObservableEasing+ObservableTween.MoveNext (System.Single& deltaTime, System.Single& unscaledDeltaTime) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at ReMotion.TweenEngine.Run (System.Single deltaTime, System.Single unscaledDeltaTime) [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at ReMotion.TweenEngine+<RunEveryFrame>d__11.MoveNext () [0x00000] in <f045b85cfc454de99e44d164d81c2489>:0 
  at UniRx.InternalUtil.MicroCoroutine.Run () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UniRx.MainThreadDispatcher+<RunUpdateMicroCoroutine>d__31.MoveNext () [0x00000] in <2a02c5dd823d469fbfe2a97ea97bb375>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0 

The cards have 23 and 28 accessories in all coordinates. Only four no extended number of outfits.

Logs:

LogOutput.log
output_log.txt

KoikatsuSunshine-2021-10-26-01-31-53-Render

Hi,

I think I found the cause in ChaFileStatus.MemberInit().

// ChaFileStatus
// Token: 0x06000C04 RID: 3076 RVA: 0x0004D180 File Offset: 0x0004B380
public void MemberInit()
{
	this.version = ChaFileDefine.ChaFileStatusVersion;
	this.coordinateType = 0;
	this.backCoordinateType = 0;
	this.clothesState = new byte[Enum.GetValues(typeof(ChaFileDefine.ClothesKind)).Length];
	this.shoesType = 1;
	this.showAccessory = new bool[20];   // <== initialization to 20
	for (int i = 0; i < this.showAccessory.Length; i++)
	{
		this.showAccessory[i] = true;
	}

I will try a postfix patch.

EDIT:

Made a Postfix for the showAccessory setter that solves the problem. As you can see is a system method that is causing the problem. I'm looking for a way to test that is a mod plugin that is making the call in order for the patch to just show the trace and not do a resize. If interested on a PR tell me.

my bad was busy testing KK and let this get by me for KKS since LoadNoAsync is unique to KKS