Jump to content

Track viewer/editor (skb/pwb)


grappigegovert
 Share

Recommended Posts

grappigegovert
On 2-12-2016 at 8: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.

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

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:

 

Spoiler

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

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

grappigegovert
42 minutes ago, 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-


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

Fluffy Cupcake
1 hour ago, Firedude34 said:

There is actually someone who ported "imperial grand prix" track to Mario kart Wii.

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.

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

16 minutes ago, 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.

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

Fluffy Cupcake

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.

Link to comment
Share on other sites

5 minutes ago, 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.

OK cool, thanks.

Link to comment
Share on other sites

11 minutes ago, Xiron said:

No problem. Glad I could be of assistance.

Man...., I love these kind of relationships. Damn straight! :-D

Link to comment
Share on other sites

grappigegovert

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):
 

Spoiler

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

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

14 hours ago, 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.

 

Eh, it's okay. What version is the one that the program DOES work with?

Link to comment
Share on other sites

grappigegovert

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

20 hours ago, Xiron said:

Hey thanks for the complimentary feedback.

No problem brother. Hope this friendship gets better and bigger!

Link to comment
Share on other sites

Fluffy Cupcake
2 hours ago, Black Boy said:

Hope this friendship gets better and bigger!

That's really all we can ask for. Strong and healthy relationships within the community.

Link to comment
Share on other sites

Fluffy Cupcake

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

1 hour ago, 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.

Thanks! Appreciated. I was looking for this as well!

Link to comment
Share on other sites

grappigegovert

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:
 

Spoiler

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.

 

  • Like 2
Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.