gdkchan / Ohana3DS-Rebirth

WIP new version of Ohana3DS in C#.
176 stars 40 forks source link

Interesting exception thrown on any build #24

Open Fallenleader opened 8 years ago

Fallenleader commented 8 years ago

First off, I have never posted issues or exceptions thrown from modified source. I should note that this was discovered after merging @Quibilia 's alterations to a working copy of latest Ohana. His alterations fix the importing of the PB and PK animations, and I will be submitting a pull request of the modified merged changes since his copy is horribly broken.

I have found a new issue that as mentioned before, plauges any variations, including vanilla. (System.IO.EndOfStreamException - various *.PC files)

I should mention that if that exception is thrown, that there may be a valid reason. maybe some PC's have skeletal animations!?!?!? This would explain why there are over 8067 files in ORAS. doing the math: All Pokemon including megas include gender forms Include unique forms this totals to ~865 pokemon MODELS, give or take a few (some gender alterations may simply be texture) Multiply all the file formats with 2 extra for shiny texture and being generous as with the models for texture only gender changes (multiply by 6. Still being generous here. by this time, take a few away) 5190 total.

Grab random pc files. If it throws an exception, RE it. It might just be skeletal animations. This could also hold true for MM and (I forgot the format for in battle models).

Going on a limb here, multiplying it by 7(doubling PC count again for assumed animations) is 6055 which still shy of 8067 files. Yea, I think we might have found our animations that were missing. If not,, we have something going squirrely here.

Code line responsible: Root\Ohana\Models\BCH.cs

      if (header.backwardCompatibility > 7)
        {
            header.flags = input.ReadUInt16();      // This line is the exception

Exception details:

System.IO.EndOfStreamException was unhandled Message=Unable to read beyond the end of the stream. Source=mscorlib StackTrace: at System.IO.__Error.EndOfFile() at System.IO.BinaryReader.FillBuffer(Int32 numBytes) at System.IO.BinaryReader.ReadUInt16() at Ohana3DS_Rebirth.Ohana.Models.BCH.load(MemoryStream data) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\Ohana\Models\BCH.cs:line 196 at Ohana3DS_Rebirth.Ohana.Models.PocketMonsters.PC.load(Stream data) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\Ohana\Models\PocketMonsters\PC.cs:line 28 at Ohana3DS_Rebirth.Ohana.FileIO.load(Stream data) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\Ohana\FileIO.cs:line 127 at Ohana3DS_Rebirth.Ohana.FileIO.load(Stream data) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\Ohana\FileIO.cs:line 140 at Ohana3DS_Rebirth.Ohana.FileIO.load(String fileName) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\Ohana\FileIO.cs:line 50 at Ohana3DS_Rebirth.Ohana.FileIO.import(fileType type) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\Ohana\FileIO.cs:line 236 at Ohana3DS_Rebirth.GUI.OModelsPanel.BtnImport_Click(Object sender, EventArgs e) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\GUI\Panels\OModelsPanel.cs:line 44 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Ohana3DS_Rebirth.Program.Main(String[] args) in C:\Users\Fallenleader\Desktop\Ohana3DS-Rebirth-master\Ohana3DS Rebirth\Program.cs:line 19 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

Fallenleader commented 8 years ago

Note that regardless if this exception is unrelated, theory should be tested. Math doesn't add up either way, and we are missing skeletal animations for all models. It doesn't simply appear out of code does it?

Taicanium commented 8 years ago

Unfortunately, I think I've figured this out, and it has nothing to do with skeletal animations.

The PC files contain two models: A normal, regular model, and a "shadow" model which is identical to the regular model but transparent. After modifying the PC class load method to only load in the regular model and exclude the shadow model, this exception no longer seems to occur. I also tested loading in both models with a for loop, and the problem appears to be that either I or GDKChan forgot to change the model index to "i" instead of "0" in the loop, because once I fixed that, the exception equally ceased.

Disappoint.

Fallenleader commented 8 years ago

as @Quibilia pointed out, this is not animation related (unfortunately) but should be addressed in the future. Low priority.