grappigegovert Posted December 4, 2016 Author Share Posted December 4, 2016 On 12/2/2016 at 7:29 PM, Tim5corpion said: Hi. I was trying to use this utility to view tracks, but everytime I try to open a model, I get an error for an "unhandled exception" containing "System.Exception: Invalid data. Expected Float, got 16. at LibLR1.IO.LRBinaryReader.Expect(Token p_expected)" If there is anyone who can try and help me with this (and not yell at me for necroposting), I'd appreciate it. Expand Hey, thanks for posting your problem. Can you specify what file you were trying to open? And could you please post/send me the entire error log (there should be some additional 'at: ...' lines). (put it in a spoiler tag if it's very big) Thanks! Link to comment Share on other sites More sharing options...
Tim5corpion Posted December 4, 2016 Share Posted December 4, 2016 It seems to happen whenever I try to open any file. For this instance, I tried to open N64LEGO\GAMEDATA\RACEC0R0\RKTK.GDB Here's the full log: Reveal hidden contents See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.Exception: Invalid data. Expected Float, got 16. at LibLR1.IO.LRBinaryReader.Expect(Token p_expected) at LibLR1.Utils.LRVector3.Read(LRBinaryReader p_reader) at LibLR1.GDB_Vertex_Color.Read(LRBinaryReader p_reader) at LibLR1.IO.LRBinaryReader.ReadArrayBlock[T](Func`2 p_readFunc) at LibLR1.GDB..ctor(LRBinaryReader p_reader) at LibLR1.GDB..ctor(String p_filepath) at WindowsGame2.Loader.loadmodel(Game1 game, String modelpath, Boolean rotatingboundingbox) at WindowsGame2.Game1.loadModel(String modelpath) at WindowsGame2.Form1.OpenFileDialog(Int32 filterindex) at WindowsGame2.Form1.openToolStripMenuItem_Click(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.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.ToolStripDropDown.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.ToolStripDropDown.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.1076.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- WindowsGame2 Assembly Version: 1.1.180.2316 Win32 Version: 1.1.180.2316 CodeBase: file:///C:/Users/Tim/Applications/Lego%20Racers%20Hacking/lr_trackeditor_v1.1/Track%20Editor.exe ---------------------------------------- System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.6.1055.0 built by: NETFXREL2 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.6.1075.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.6.1055.0 built by: NETFXREL2 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.6.1068.2 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- Microsoft.Xna.Framework.Game Assembly Version: 4.0.0.0 Win32 Version: 4.0.20823.0 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/Microsoft.Xna.Framework.Game/v4.0_4.0.0.0__842cf8be1de50553/Microsoft.Xna.Framework.Game.dll ---------------------------------------- Microsoft.Xna.Framework Assembly Version: 4.0.0.0 Win32 Version: 4.0.20823.0 built by: xnabldr CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/Microsoft.Xna.Framework/v4.0_4.0.0.0__842cf8be1de50553/Microsoft.Xna.Framework.dll ---------------------------------------- System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.6.1055.0 built by: NETFXREL2 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.6.1067.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- LibLR1 Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/Tim/Applications/Lego%20Racers%20Hacking/lr_trackeditor_v1.1/LibLR1.DLL ---------------------------------------- Microsoft.Xna.Framework.Graphics Assembly Version: 4.0.0.0 Win32 Version: 4.0.20823.0 built by: xnabldr CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/Microsoft.Xna.Framework.Graphics/v4.0_4.0.0.0__842cf8be1de50553/Microsoft.Xna.Framework.Graphics.dll ---------------------------------------- Microsoft.Xna.Framework.Input.Touch Assembly Version: 4.0.0.0 Win32 Version: 4.0.20823.0 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Xna.Framework.Input.Touch/v4.0_4.0.0.0__842cf8be1de50553/Microsoft.Xna.Framework.Input.Touch.dll ---------------------------------------- Microsoft.Xna.Framework.GamerServices Assembly Version: 4.0.0.0 Win32 Version: 4.0.20823.0 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Xna.Framework.GamerServices/v4.0_4.0.0.0__842cf8be1de50553/Microsoft.Xna.Framework.GamerServices.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: <configuration> <system.windows.forms jitDebugging="true" /> </configuration> 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. Link to comment Share on other sites More sharing options...
Firedude34 Posted December 4, 2016 Share Posted December 4, 2016 There is actually someone who ported "imperial grand prix" track to Mario kart Wii. Which I believe is possible for us to port tracks from Mario kart Wii to Lego racers. Here is the link: http://wiki.tockdom.com/wiki/LEGO_Racers_Imperial_Grand_Prix Link to comment Share on other sites More sharing options...
grappigegovert Posted December 4, 2016 Author Share Posted December 4, 2016 On 12/4/2016 at 7:16 PM, Tim5corpion said: It seems to happen whenever I try to open any file. For this instance, I tried to open N64LEGO\GAMEDATA\RACEC0R0\RKTK.GDB Here's the full log: -snip- Expand Thanks for the log. Judging by the file path, it looks like you're trying to open a file from the n64 version, which I haven't tested this program with. Can you send me a copy of that file? because my version of that file loads without error. Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 4, 2016 Share Posted December 4, 2016 On 12/4/2016 at 7:30 PM, Firedude34 said: There is actually someone who ported "imperial grand prix" track to Mario kart Wii. Expand That "someone" is me. Also this post is so deviated from what is being talked about right now, I'd almost consider it off topic. Quote Which I believe is possible for us to port tracks from Mario kart Wii to Lego racers. Expand Well, at this time no. It would only be possible if there was a remotely efficient way to make custom models for LR. Link to comment Share on other sites More sharing options...
Firedude34 Posted December 4, 2016 Share Posted December 4, 2016 On 12/4/2016 at 8:35 PM, Xiron said: That "someone" is me. Also this post is so deviated from what is being talked about right now, I'd almost consider it off topic. Well, at this time no. It would only be possible if there was a remotely efficient way to make custom models for LR. Expand Wow what a coincidence. But is it possible to add new drivable cars? Or at least putting them in the background? Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 4, 2016 Share Posted December 4, 2016 Put new cars in LR? Eeeeh, if you want to spend much longer than it should ever need to be to make a model, then yes. Link to comment Share on other sites More sharing options...
Firedude34 Posted December 4, 2016 Share Posted December 4, 2016 On 12/4/2016 at 8:56 PM, Xiron said: Put new cars in LR? Eeeeh, if you want to spend much longer than it should ever need to be to make a model, then yes. Expand Actually it is a modern day car, not a Lego kart. Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 4, 2016 Share Posted December 4, 2016 I understand you are saying you want to put a modern car in the game? Well yes, LEGO or not the method Jimbob used works for anything. Firedude34 1 Link to comment Share on other sites More sharing options...
Firedude34 Posted December 4, 2016 Share Posted December 4, 2016 On 12/4/2016 at 9:03 PM, Xiron said: I understand you are saying you want to put a modern car in the game? Well yes, LEGO or not the method Jimbob used works for anything. Expand OK cool, thanks. Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 4, 2016 Share Posted December 4, 2016 No problem. Glad I could be of assistance. Link to comment Share on other sites More sharing options...
Black Boy Posted December 4, 2016 Share Posted December 4, 2016 On 12/4/2016 at 9:24 PM, Xiron said: No problem. Glad I could be of assistance. Expand Man...., I love these kind of relationships. Damn straight! :-D Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 4, 2016 Share Posted December 4, 2016 Hey thanks for the complimentary feedback. Link to comment Share on other sites More sharing options...
Tim5corpion Posted December 4, 2016 Share Posted December 4, 2016 On 12/4/2016 at 8:01 PM, grappigegovert said: Thanks for the log. Judging by the file path, it looks like you're trying to open a file from the n64 version, which I haven't tested this program with. Can you send me a copy of that file? because my version of that file loads without error. Expand http://oresome.rockraidersunited.com/download/427 Link to comment Share on other sites More sharing options...
grappigegovert Posted December 5, 2016 Author Share Posted December 5, 2016 I've looked at your file, and I am now fairly certain that it's a file from the n64 version The problem is not (technically) in this program, but rather in the library it uses, liblr1 (made by @WillKirkby). It looks like the n64 version uses some code that does not occur in the PC version of the game, and has not been implemented in liblr1. Some info for whomever would like to try and add this functionality (I don't think I have the time): Reveal hidden contents At 0x2C9 in the file @Tim5corpion linked, a new struct is created, with two (as of right now) unknown tokens, 0xF and 0x10. It looks like both are 2 bytes long, and they I think they should be decimals of some kind. I'm sorry @Tim5corpion, but I cannot fix this now. Link to comment Share on other sites More sharing options...
dead_name Posted December 5, 2016 Share Posted December 5, 2016 I'll see if I can get round to looking at it this week. I'm on christmas holiday from next weekend onwards so I'll have more time then. Link to comment Share on other sites More sharing options...
Tim5corpion Posted December 5, 2016 Share Posted December 5, 2016 On 12/5/2016 at 2:10 AM, grappigegovert said: I've looked at your file, and I am now fairly certain that it's a file from the n64 version The problem is not (technically) in this program, but rather in the library it uses, liblr1 (made by @WillKirkby). It looks like the n64 version uses some code that does not occur in the PC version of the game, and has not been implemented in liblr1. Some info for whomever would like to try and add this functionality (I don't think I have the time): Reveal hidden contents At 0x2C9 in the file @Tim5corpion linked, a new struct is created, with two (as of right now) unknown tokens, 0xF and 0x10. It looks like both are 2 bytes long, and they I think they should be decimals of some kind. I'm sorry @Tim5corpion, but I cannot fix this now. Expand Eh, it's okay. What version is the one that the program DOES work with? Link to comment Share on other sites More sharing options...
grappigegovert Posted December 5, 2016 Author Share Posted December 5, 2016 It's tested and working for the all three known PC versions. I have yet to find a gdb file from those versions that does not work. Link to comment Share on other sites More sharing options...
Black Boy Posted December 5, 2016 Share Posted December 5, 2016 On 12/4/2016 at 9:51 PM, Xiron said: Hey thanks for the complimentary feedback. Expand No problem brother. Hope this friendship gets better and bigger! Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 5, 2016 Share Posted December 5, 2016 On 12/5/2016 at 6:00 PM, Black Boy said: Hope this friendship gets better and bigger! Expand That's really all we can ask for. Strong and healthy relationships within the community. Link to comment Share on other sites More sharing options...
Black Boy Posted December 6, 2016 Share Posted December 6, 2016 Hey man you have done a great job. However i don't know where the tracks are located..can you tell me where they are? Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 6, 2016 Share Posted December 6, 2016 They are inside LEGO.JAM, under a \GAMEDATA\RACEC#R#\ folder. Most of them will have something like trk or track in the filename, with the extension .gdb. Link to comment Share on other sites More sharing options...
Firedude34 Posted December 6, 2016 Share Posted December 6, 2016 On 12/6/2016 at 9:00 PM, Xiron said: They are inside LEGO.JAM, under a \GAMEDATA\RACEC#R#\ folder. Most of them will have something like trk or track in the filename, with the extension .gdb. Expand Thanks! Appreciated. I was looking for this as well! Link to comment Share on other sites More sharing options...
Fluffy Cupcake Posted December 6, 2016 Share Posted December 6, 2016 Not a problem. You're welcome. Link to comment Share on other sites More sharing options...
grappigegovert Posted December 7, 2016 Author Share Posted December 7, 2016 I could not stop thinking about this and went ahead and worked on this instead of my homework. I found out how the new tokens work The 0x10 token is a fixed point number with 1 sign bit, 10 integer bits, and 5 fractional bits. The 0xF token is also a fixed point number, but with 1 sign bit, 3 integer bits, and 12 fractional bits. Until this is properly integrated in LibLR1, you can overwrite the liblr1.dll in the folder of my tool with this modified version to make my track viewer work with the N64 models. @WillKirkby, I added this bit of code: Reveal hidden contents I added these cases in BinaryFileHelper.RecursiveDecompress(): case 0x10: { p_writer.WriteToken(Token.Float); ushort s = p_reader.ReadUShort(); int intpart = (s & 0x7FFF) >> 5; double fracpart = (s & 0x1F) / 32f; if ((s & 0x8000) == 0x8000) // if first bit (sign bit) intpart = -(intpart ^ 0x03FF) - 1; // 2's complement p_writer.WriteBytes(BitConverter.GetBytes((float)(intpart + fracpart))); break; } case 0xF: { p_writer.WriteToken(Token.Float); ushort s = p_reader.ReadUShort(); int intpart = (s & 0x7FFF) >> 12; double fracpart = (s & 0x0FFF) / 4096f; if ((s & 0x8000) == 0x8000) // if first bit (sign bit) intpart = -(intpart ^ 0x0007) - 1; // 2's complement p_writer.WriteBytes(BitConverter.GetBytes((float)(intpart + fracpart))); break; } I just wrote a quick piece of code to get the GDB viewer to work, so I write the values as floats because the GDB reader expects floats. Not sure if you want that in your final code though. mumboking and Fluffy Cupcake 2 Link to comment Share on other sites More sharing options...
Recommended Posts