Forza Studio 4.0 – Forza Motorsport 3 & 4 Resource Extraction Tool

With school now out of the way, I suppose it’s time for me to get my ass in gear and start finishing up the various side-projects I seemed to have accumulated throughout the years. Starting with the one most recently adopted, I present you a semi-finalized version of Forza Studio. Forza Studio 4.0 should now render all previous versions of my Forza-related utilities obsolete.  Any questions can be directed to the comments section of this post and I’ll happily reply to them as soon as I can.

Forza Studio 4.0 now officially supports the viewing and extraction of most cars (.carbin), wheels, brakes, rotors, calipers, tracks (.rmb.bin), and textures (.xds, .bix) from both versions of Forza 3 and Forza 4.

Its use is fairly straightforward in my opinion. Right-clicking various sections will bring up a context menu specific to that control. When viewing a model in the viewport, use the WASD keys on your keyboard to move the camera position and IJKL to look around. I’ve also included zip extraction functionality that can be found under the utilities menu for those who wish to use it instead of the usual QuickBMS script.

.NET Framework 2.0 (or greater)
XNA Framework 3.1 (4.0 is different)

Forza Studio 4.0 Application (11193)
Forza Studio 4.0 Source (5183)
Forza Studio 4.1 Application (Horizon Support) (12137) UPDATE!

C# x86 Assembly Interpreter

It’s been a while since my last post because work and school have both kept me pretty busy lately, so I figure I’ll take the time to post a link to one of my more recent projects (conveniently hosted on Google Code) here for any who might be interested in learning a bit more about basic x86 assembly instructions, cpu architecture, or the concept of emulation in general.

Because for some strange reason I’m still rather fond of writing code in assembler every now and then, I wanted to create a small x86 assembly interpreter written in C# for an independent study course I took over the summer, and this application was the result. I also had a lot of fun digging through my Intel reference manuals brushing up on some of the things I’ve forgotten, as the manuals (architecture, developers, and optimization manuals in particular) are a surprisingly good read in some parts.

This application is more or less a proof of concept, and not to be confused with bullet proof code (which it’s definitely not :P), as it’s still well in its infancy. However, I feel that I’ve implemented enough functionality to still have plenty of fun with it. I figure it may be of use to somebody, and at the very least, is rather amusing plugging in various instructions and observing the results of the execution in realtime.

As always, if you have any questions feel free to ask, otherwise enjoy :)

Main Project
Compiled Binaries

Forza 2, Forza 3, and Forza 4 Texture (.xds, .bix) Extraction Tool

Lately I’ve had a bit of time to start back up on some Forza-related research, and thought this might be useful to a few of you, so I figure I’ll go ahead and share early. Eventually I plan on integrating texture rendering/extraction support into Forza Studio, but for now, I’ve decided to release a standalone tool just for texture extraction. It’s use is fairly simple and straightforward, just open up any of the supported file formats (.zip, .xds, .bix), and right click the rendering window of the selected texture to save. As usual, I’m releasing the source code for anyone else interested in using any of it in their own projects.  Any questions, feel free to ask, otherwise enjoy… :)

Forza Texture Extractor (4400)
Forza Texture Extractor Source (2666)

Vanity: Halo Reach Player Armor Image Generator

Recently, I’ve had my hands in a project called Vanity, which is a great little application geared towards helping Halo Reach players pick out their ideal armor configuration before they start buying things in-game. Once finished, it displays the rank and credits required by the game in order to obtain the selected armor configuration, and also allows you the option to save the generated image onto your computer.

All of the content and UI was created by my buddy Nate (a more detailed and interesting description of his portion of the work can be found here at his website), and I tied everything together in code. After I initially spent a few days or so messing around with a windows forms version of the application, we decided to scrap that and use WPF instead for its more advanced presentation features. Vanity is written in C#.NET and boasts custom imaging code (see below) and a caching system created from scratch. The entire application ended up weighing in at around 130 megabytes due to the sheer amount of images (currently 3,117 to be specific) required in order to display all armor piece and color combinations.

Upon release, Louis Wu over at mentioned Vanity in their news section and was kind enough to offer us a secondary hosting source for the application which we greatly appreciate. Bungie also recognized the utility that Vanity offered and posted about it in their blog as well. Due to the large amount of publicity following its initial release, the hbo servers experienced over one terabyte of bandwidth the day after, and another terabyte throughout the next couple of weeks. So far, there have been over 22k unique visitors and 2TB of bandwidth consumed.

If you’re interested in trying out Vanity for yourself, you can find the download link here. In order to extract the Vanity.rar archive you will need to download WinRar, and in order for Vanity to run properly, you will also need to have the .NET Framework 3.5 installed on your computer. Make sure to not change the directory structure when running the application, as it must be run in the same directory as Guardian.dll and the content directory. As usual, any comments or suggestions that you may have are always welcome.

Also, in the spirit of open source and the nature of this blog in general, I’ve included a snippet of code below containing my custom DrawImage method which has been heavily optimized for use in Vanity due to the large amount of drawing performed within. This method clocks in around twice as fast as it’s GDI equivalent Graphics.DrawImage method on my machine, and also does proper alpha blending which Graphics.DrawImage seems to fall short on. The alpha blending formula I’ve came up with performs a simple linear interpolation starting from the base alpha, but the color blending formulas were a bit more involved. I know it may be hard to read due to the heavy use of pointers and integer shifts in place of floating point math, but understand that this was a necessary evil in order to squeeze the absolute most performance possible out of it.

In order to use, you will need to pass it a canvas image, the image you wish to draw on top of that, and the area that you will be drawing in. I’ve made some pretty big assumptions on these arguments for the pixel format and dimensions in particular, so it may require some minor tweaking depending on your specific needs, but it should be a good starting point if you need something similar in one of your projects.

private static void DrawImage(Bitmap canvas, Bitmap render, Rectangle area)
    if (canvas != null && render != null && area != null)
        int canvasWidth = render.Width;
        int canvasHeight = render.Height;
        int xMin = area.X;
        int xMax = xMin + area.Width;
        int yMin = area.Y;
        int yMax = yMin + area.Height;
        BitmapData renderBits = render.LockBits(new Rectangle(0, 0, canvasWidth, canvasHeight), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
        BitmapData canvasBits = canvas.LockBits(new Rectangle(0, 0, canvasWidth, canvasHeight), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

            for (int y = yMin; y < yMax; y++)
                byte* ptrRender = (byte*)renderBits.Scan0 + y * renderBits.Stride;
                byte* ptrCanvas = (byte*)canvasBits.Scan0 + y * canvasBits.Stride;
                for (int x = xMin; x < xMax; x++)
                    byte alpha = ptrRender[(x << 2) + 3];
                    if (alpha > 0)
                        // colorResult = newAlpha * newColor + (1 - newAlpha) * canvasColor
                        ptrCanvas[(x << 2)] = (byte)((alpha * (ptrRender[(x << 2)]) + (256 - alpha) * (ptrCanvas[(x << 2)])) >> 8);
                        ptrCanvas[(x << 2) + 1] = (byte)((alpha * (ptrRender[(x << 2) + 1]) + (256 - alpha) * (ptrCanvas[(x << 2) + 1])) >> 8);
                        ptrCanvas[(x << 2) + 2] = (byte)((alpha * (ptrRender[(x << 2) + 2]) + (256 - alpha) * (ptrCanvas[(x << 2) + 2])) >> 8);

                        // alphaResult = oldAlpha + (1 - oldAlpha) * newAlpha
                        ptrCanvas[(x << 2) + 3] = (byte)(((ptrCanvas[(x << 2) + 3] << 8) + (256 - ptrCanvas[(x << 2) + 3]) * alpha) >> 8);

Forza Studio: Forza 3 .Carbin Resource Extraction Tool

The history behind this utility started when a good friend of mine requested that I attempt to extract some of the Forza 3 car model resources (.carbin) from the game so that he could use them in some of his renders. While searching the interwebs for any information related to the subject, I came across the XeNTaX community, and started this thread in hopes that others would join in on my efforts. Their members were quite helpful (ajmiles in particular for his initial help with vertex decoding) at reducing my time spent during the research process. Soon enough I had created a nice little utility for extracting the contents of the Forza 3 .carbin model resources from the game.

Forza studio provides you with the ability to open up entire Forza 3 car or track zip files, as well as the individual .carbin or track .bin files if you manually extract them from the archive.  It also allows for selective piece extraction and exports the selected items into the Wavefront OBJ model format for easy importation into almost all model editing applications.  Use the WASDQE keys to move the camera and the arrow keys to change the look direction.  Right click the viewport to bring up a context menu where you can change other rendering options.

I’ve kept this Visual Studios 2008 C#.NET project open source throughout it’s entire development so that anyone can do what they will with it and pick up wherever I leave off. Since I was researching and developing at the same time, I apologize for the source being a bit messy in parts, but it is what it is. I’ve attached the two most recent builds below with source included as usual. The first one is probably the most stable build for car extraction, and the second one I started refactoring and added partial support for track extraction (and probably broke a few things in the process). In order to run this application on your computer you will need to have the Microsoft .NET 3.5 and Microsoft XNA 3.1 frameworks installed. If you have any questions or problems getting this to run on your machine, give me a shout, and I’ll see what I can do to help you out.

Forza Studio (5.29.10) (4226)
Forza Studio (7.9.10) (5239)