X-Hax / sa_tools

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

Cannot Split Sonic Adventure 2 MDL models #230

Closed MoriyaFaith closed 1 year ago

MoriyaFaith commented 1 year ago

Describe the bug/request prs SA2 MDL files cannot be split. Any and all attempts to do so results in the same error.

To Reproduce (if applicable) Attempt to split an SA2 MDL file. This can be done with split.exe, SAMDL, or any other way an SA2 MDL can be split within the toolset

Expected behavior The file is properly split into .sa2mdl subfiles.

Log

Build Date: 11/10/2022 23:05:19
OS Version: Microsoft Windows NT 10.0.19045.0
Log:
Loading the model from F:\SteamLibrary\steamapps\common\Sonic Adventure 2\resource\gd_PC\teriosmdl.prs failed for the following reason(s):
System.ArgumentOutOfRangeException: Number was less than the array's lower bound in the first dimension. (Parameter 'sourceIndex')
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at SAModel.ByteConverter.ToInt32(Byte[] value, Int32 startIndex) in C:\Programs\sa_tools\Libraries\SAModel\ByteConverter.cs:line 95
   at SAModel.NJS_OBJECT..ctor(Byte[] file, Int32 address, UInt32 imageBase, ModelFormat format, NJS_OBJECT parent, Dictionary`2 labels, Dictionary`2 attaches) in C:\Programs\sa_tools\Libraries\SAModel\NJS_OBJECT.cs:line 173
   at SAModel.SAMDL.MainForm.LoadFile(String filename, Boolean cmdLoad) in C:\Programs\sa_tools\SAMDL\MainForm.cs:line 659
   at SAModel.SAMDL.MainForm.openToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Programs\sa_tools\SAMDL\MainForm.cs:line 417
PiKeyAr commented 1 year ago

The MDL files in the PC version of SA2 are actually SA2B MDL files, and attempting to open or split them as regular SA2 files will fail. While the tools you mention should work, the recommended way to split SA2 PC is to create a new project in SA Tools Hub, which will split all MDL files.

MoriyaFaith commented 1 year ago

Ooooh, that would have been good to know. I thanks for the help!