Skip to content

[BUG] - AnbMaker export-raw fills memory and fails in KHDDD PAM files #1260

Description

@PandaHo

OpenKH Build
OpenKh Build 1625 (master)

OpenKH Program
OpenKh.Command.AnbMaker.exe

Describe the Bug
I ran OpenKh.Command.AnbMaker.exe export-raw set1\anim-0000.anb set1\anim-0000.fbx. It filled my 16 GBs RAM fully and threw this error:

E:\Other stuff\OpenKH>OpenKh.Command.AnbMaker.exe export-raw set1\anim-0000.anb set1\anim-0000.fbx
Writing to: E:\Other stuff\OpenKH\set1\anim-0000.fbx
FATAL ERROR: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.List`1.set_Capacity(Int32 value)
   at System.Collections.Generic.List`1.Grow(Int32 capacity)
   at System.Collections.Generic.List`1.AddWithResize(T item)
   at OpenKh.Kh2.Motion.RawMotion..ctor(Stream stream)
   at OpenKh.Command.AnbMaker.Commands.ExportRawCommand.<>c.<OnExecute>b__9_6(Entry barEntry, Int32 barEntryIndex)
   at System.Linq.Enumerable.SelectIterator[TSource,TResult](IEnumerable`1 source, Func`3 selector)+MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at OpenKh.Command.AnbMaker.Commands.ExportRawCommand.OnExecute(CommandLineApplication app)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
--- End of stack trace from previous location ---
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](CommandLineContext context, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](IConsole console, String[] args)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](String[] args)
   at OpenKh.Command.AnbMaker.Program.Main(String[] args)

To Reproduce
The ANB files is basically from Kingdom Hearts Drop Dream Distance's Wheeflower Dream Eater.

  1. Export the ANB files from chara_npc\n_de24_001.pam using OpenKh.Command.KHAnimationConverter.exe: OpenKh.Command.KHAnimationConverter.exe chara_enemy\n_de24_001.pam set1
  2. Then use OpenKh.Command.AnbMaker.exe export-raw set1\anim-0000.anb set1\anim-0000.fbx to make one of them FBX. It gives this error from above.

Expected behavior
Exported FBX file of the ANB file, but got crash. I just need to put those animation files in blender for the model

Additional context
I already tried to export ANB from other dream eater PAM, and it seems to also fail the same way. If I use PAMtoFBXConverter tool (OpenKh.Command.PAMtoFBXConverter.exe chara_npc\n_de24s.pmo chara_npc\n_de24_001.pam), it throws ERROR: Invalid header. Same thing if I try another dream eater model with their own animation set file.
I reinstalled .NET 8.0 Desktop Runtime, and still nothing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions