X-Hax / sa_tools

Sonic Adventure Toolset
http://info.sonicretro.org/SA_Tools
103 stars 24 forks source link

SA2 Event Viewer and splitEvent not working for certain events #108

Closed tbentham closed 4 years ago

tbentham commented 4 years ago

Hi,

Most SA2 events aren't working for me in both SA2 Event Viewer and splitEvent. Here's the error for splitEvent:

Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at SonicRetro.SAModel.NJS_MOTION..ctor(Byte[] file, Int32 address, UInt32 imageBase, Int32 nummodels, Dictionary`2 labels, Boolean shortrot) in E:\Programs\sa_tools\SAModel\Animation.cs:line 287
   at splitEvent.Program.ReadMotionFile(String filename) in E:\Programs\sa_tools\splitEvent\Program.cs:line 239
   at splitEvent.Program.Main(String[] args) in E:\Programs\sa_tools\splitEvent\Program.cs:line 46

And the error for SA2 Event Viewer:

error_SA2EventViewer

The following events do work in both, but they're literally the only ones:

e0000, e0100, e0105, e0109, e0118, e0124, e0131, e0200, e0206, e0211

Some patterns I noticed that may or may not be significant:

Hope that's enough to go on.

MainMemory commented 4 years ago

I know exactly why this is happening, but I don't know how to fix it. These events contain shape motions with only one unique vertex array, but the parser needs at least two in order to determine the length of the vertex array. I checked how the game handles this when loading events, and it doesn't; it waits until the motion is called upon and uses the data from the model to determine the length of the array, which is not something we can do.

MainMemory commented 4 years ago

I did a thing so all the events should work now, tested e0002 and it works fine.

tbentham commented 4 years ago

Nice! It all seems to work now.