gdkchan / SPICA

Experimental H3D tool
The Unlicense
93 stars 47 forks source link

BCH Texture Encoding #40

Open KekMcGee opened 6 years ago

KekMcGee commented 6 years ago

Would it be possible to add a way to change how the texture is encoded, as just exporting a bch leaves it as the default rgba8 etc, this usually crashes most games when trying to replace a model. ETC1, ETC1a4, HiLo8 etc

gdkchan commented 6 years ago

How do you know that the texture format is the cause of the crashes? The only bch format it exports atm is the one with backward compatibility byte = 0x21, which is used by OR/AS and a few other games, so any game that uses a different format will crash when performing the version check.

The reason the other texture formats are not yet implemented is just that I just wanted something simple to test, but the other formats are easy to implement too (except for etc1/a4 that needs to be compressed).

KekMcGee commented 6 years ago

My bad, forgot about the different versions. Now my new question is, would it be possible to easily add support for Miitopia's BCH Version? as that was the game I was trying to mod. sample if needed https://mega.nz/#!B1ghQRwA!kaK_BGo4Ybq3qpp8YM4DNVBdKkxT5g8TfvccNmxR2Kg

gdkchan commented 6 years ago

This files seems to use backward compatibility = 0x22 and forward compatibility = 0x23. Exporting with this version should be as easy as changing the lines here. The tools currently lacks a interface to select the desired version at export, and this is the main issue preventing me from de-hardcoding those values.

KekMcGee commented 6 years ago

Thanks, that worked, but now it just soft locks when trying to load it in-game. I also decided to take a look into X/Y, Backward and Forward are both 0x07 but exporting an SMD/OBJ to BCH errors out, It exports the game's bch's to bch fine however.

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** System.NullReferenceException: Object reference not set to an instance of an object. at SPICA.Serialization.BinarySerializer.WriteValue(Object Value) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 127 at SPICA.Serialization.BinarySerializer.WriteObject(Object Value) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 432 at SPICA.Serialization.BinarySerializer.WriteValue(Object Value) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 186 at SPICA.Serialization.BinarySerializer.WriteList(IList List) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 242 at SPICA.Serialization.BinarySerializer.WriteValue(Object Value) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 150 at SPICA.Serialization.BinarySerializer.WriteValue(RefValue Ref) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 273 at SPICA.Serialization.BinarySerializer.WriteSection(List1 Values) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 116 at SPICA.Serialization.BinarySerializer.WriteSection(List1 Values) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 121 at SPICA.Serialization.BinarySerializer.WriteSection(List1 Values) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 121 at SPICA.Serialization.BinarySerializer.WriteSection(List1 Values) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 121 at SPICA.Serialization.BinarySerializer.WriteSection(Section Section) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 95 at SPICA.Serialization.BinarySerializer.Serialize(Object Value) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Serialization\BinarySerializer.cs:line 72 at SPICA.Formats.CtrH3D.H3D.Save(String FileName, H3D Scene) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA\Formats\CtrH3D\H3D.cs:line 157 at SPICA.WinForms.Formats.FileIO.Save(H3D Scene, SceneState State) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA.WinForms\Formats\FileIO.cs:line 88 at SPICA.WinForms.FrmMain.Save() in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA.WinForms\FrmMain.cs:line 403 at SPICA.WinForms.FrmMain.TBtnSave_Click(Object sender, EventArgs e) in C:\Users\kek\Downloads\3 APKs\0\Animal Crossing Pocket Camp\SPICA-master\SPICA-master\SPICA.WinForms\FrmMain.cs:line 322 at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

** Loaded Assemblies ** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

SPICA.WinForms Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/kek/Downloads/3%20APKs/0/Animal%20Crossing%20Pocket%20Camp/SPICA-master/SPICA-master/SPICA.WinForms/bin/Debug/SPICA.WinForms.exe

System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

OpenTK Assembly Version: 2.0.0.0 Win32 Version: 2.0.0 CodeBase: file:///C:/Users/kek/Downloads/3%20APKs/0/Animal%20Crossing%20Pocket%20Camp/SPICA-master/SPICA-master/SPICA.WinForms/bin/Debug/OpenTK.DLL

OpenTK.GLControl Assembly Version: 2.0.0.0 Win32 Version: 2.0.0 CodeBase: file:///C:/Users/kek/Downloads/3%20APKs/0/Animal%20Crossing%20Pocket%20Camp/SPICA-master/SPICA-master/SPICA.WinForms/bin/Debug/OpenTK.GLControl.DLL

System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

SPICA Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/kek/Downloads/3%20APKs/0/Animal%20Crossing%20Pocket%20Camp/SPICA-master/SPICA-master/SPICA.WinForms/bin/Debug/SPICA.DLL

SPICA.Rendering Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/kek/Downloads/3%20APKs/0/Animal%20Crossing%20Pocket%20Camp/SPICA-master/SPICA-master/SPICA.WinForms/bin/Debug/SPICA.Rendering.DLL

System.Numerics Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll

Microsoft.CSharp Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll

System.Dynamic Assembly Version: 4.0.0.0 Win32 Version: 4.6.1099.0 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll

Anonymously Hosted DynamicMethods Assembly Assembly Version: 0.0.0.0 Win32 Version: 4.6.1099.0 built by: NETFXREL4STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll

** JIT Debugging ** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.

For example:

When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.