XNA Creators Club Online
Page 1 of 1 (9 items)
Sort Posts: Previous Next

Use XNB files as media files in my project

Last post 04/07/2009 12:49 by Lennart Moltrecht. 8 replies.
  • 12/11/2008 22:13

    Use XNB files as media files in my project

    *** EDIT ***
    For all of you interested in doing what I tried to do, decompiling a game and debugging the source code, I wrote a tutorial about how to do that:
    http://www.multimolti.de/blog/2008/11/19/how-to-decompilereverse-engineerdisassemble-any-xna-game/
    I hope you enjoy it!
    *** BACK TO TOPIC ***





    Hello!

    I wonder whether there is a way to use XNB files instead of the normal PNG/JPG/FBX files in my project. If you don't understand what I mean, here what I want:

    I just downloaded an XNA game which seems to be great, but there are some problems with it, at least at my computer. The game sometimes runs at 1000x the speed it should, and that's kinda weird.
    So I thought about debugging it myself. I used the .NET Reflector to extract the whole source code from the exe file (if that's illegal, I'm sorry, I won't publish the code or release it under my name or anything), converted the project it gave me to a VS2008 project, and tried to compile. There was one compiling error I solved by using another function as in the original code, and then I could actually compile the project!
    But of course it crashed when trying to load the content files. So I just took the whole Content folder from the orignal game and copied it to my bin/Debug folder. When I now start the thing, I am one step further: It can find the content files, but is not really able to read them. For the Font I get this error:
    Error loading "Content\Fonts\Menu". Cannot find ContentTypeReader Microsoft.Xna.Framework.Content.ListReader`1[[Microsoft.Xna.Framework.Rectangle, Microsoft.Xna.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d]].
    This happens in this line:
    this.font = this.content.Load<SpriteFont>("Content/Fonts/Menu");
    I read already that there is no way to convert the XNB files back to the original PNG/JPG/FBX files, so I think of leaving them as they are, since I don't want to change them, and just letting the game use them. But it's not working.

    Any ideas?

    Thanks, would be so kind!
    MMORPG Engine and Game |My Blog |Lennart Moltrecht's Website
    There are 10 kinds of people: Those who understand binary encoding and those who don't.
  • 12/11/2008 22:40 In reply to

    Re: Use XNB files as media files in my project

    If you want to help improve a game, why don't you contact the author and ask them for a copy of the source code?

    Sorry, but I'm not going to help you reverse engineer it in this way  :-)
    XNA Framework Developer - blog - homepage
  • 12/11/2008 22:47 In reply to

    Re: Use XNB files as media files in my project

    =(

    But can you at least explain why this happens? I mean, the game shouldn't care whether it first took the original data files, chased them through the content pipeline and copied them to /bin/Debug/Content/Fonts or I did that job. As long as the files are there, it should work, shouldn't it?

    And I contacted the author, but he hasn't answered yet, and because I was quite bored just now, I thought about starting already...
    MMORPG Engine and Game |My Blog |Lennart Moltrecht's Website
    There are 10 kinds of people: Those who understand binary encoding and those who don't.
  • 12/11/2008 23:09 In reply to

    Re: Use XNB files as media files in my project

    Lennart Moltrecht:

    As long as the files are there, it should work, shouldn't it?


    Not if you're using different framework versions...


    Lennart Moltrecht:

    converted the project it gave me to a VS2008 project

    [snip]

    For the Font I get this error:
    Error loading "Content\Fonts\Menu". Cannot find ContentTypeReader Microsoft.Xna.Framework.Content.ListReader`1[[Microsoft.Xna.Framework.Rectangle, Microsoft.Xna.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d]].

    XNA Framework Developer - blog - homepage
  • 13/11/2008 8:36 In reply to

    Re: Use XNB files as media files in my project

    Okay, I got it.

    I'm currently installing the old Visual Studio 2005 again, but I think I won't be able to install XNA Game Studio 2.0 again, since it's outdated compared to my newer 3.5 version?
    MMORPG Engine and Game |My Blog |Lennart Moltrecht's Website
    There are 10 kinds of people: Those who understand binary encoding and those who don't.
  • 13/11/2008 17:48 In reply to

    Re: Use XNB files as media files in my project

    Well, it actually worked! I installed VS 2005 and GS 2.0, no problems with the other versions installed, deleted the SLN file of the project, opened the CSPROJ with VS 2005 and compiled it. It could read the XNB files and now I can finally debug the project!
    MMORPG Engine and Game |My Blog |Lennart Moltrecht's Website
    There are 10 kinds of people: Those who understand binary encoding and those who don't.
  • 19/11/2008 20:28 In reply to

    Re: Use XNB files as media files in my project

    By now I'm in contact with the creator of the original game and we're doing quite a good teamwork polishing out all the small bugs in the game, but if you're not so lucky contacting the creator of a game or if you like this dirty stuff:

    I created a tutorial about How to decompile/reverse engineer/disassemble any XNA Game!

    Have fun!
    MMORPG Engine and Game |My Blog |Lennart Moltrecht's Website
    There are 10 kinds of people: Those who understand binary encoding and those who don't.
  • 04/07/2009 11:26 In reply to

    Re: Use XNB files as media files in my project

    Am interested in your decompiling instructions, but your blog seems to be unavailable
  • 04/07/2009 12:49 In reply to

    Re: Use XNB files as media files in my project

    Yeah, I'm sorry, the server is sometimes overloaded because too many visitors are on the site... I pay only 1€ (~1.40$) per month for it, so you can't expect too much :P Some day I will get a faster one. Just wait until it's night in the USA, then all visitors will be sleeping and you can visit the site again :P
    MMORPG Engine and Game |My Blog |Lennart Moltrecht's Website
    There are 10 kinds of people: Those who understand binary encoding and those who don't.
Page 1 of 1 (9 items) Previous Next