Content: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Background: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Pattern: Blank Waves Notes Sharp Wood Rockface Leather Honey Vertical Triangles
Welcome to Xbox Chaos: Modding Evolved

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Lord Zedd

.MAP
Custom Bitmap Injection

42 posts in this topic

Doesn't take nearly as long as sounds do, promise. Again, turns out the SDK handles the file conversions.

 

Update 3: New tool, new info

 

Update 2: Oops rawpage no worky for this right now.

 

Update 1: Added new version of Injection Helper, added tutorial for converting an adj bin with unbundler

 

Gonna need some things:

 

1. Deciding Your Bitmap

 

As is common in all these injection tutorials, you need to know what you want. While you should be able to replace an existing bitmap without

 

Either way you will be using an existing bitmap as a base to duplicate off of, but are you modifying something existing or plan on making something all new? This will also help you choose your base.

 

With a modification, you are obviously going to want to use what you plan on editing. But for something new, it would be wise to find a bitmap that is applied similarly (UI bitmap if going for UI, HUD for HUD, etc) so the format doesn't need to be changed.

 

This tutorial will use modification but with a modified (upscaled) resolution to demonstrate what you'd do for a "new" image.

 

2. Tool Preparation

 

Extract the EasyBitmapInjection folder to your desktop and copy bundler.exe to EasyBitmapInjection's directory.

 

Extract the contents of "bitm Plugins.zip" to your Assembly directory and overwrite.

 

3. Map Preparation

 

Make a copy of the map you want (backups, yo) and open it in Assembly. Navigate to your base bitm and Right Click>Extract it using "Extract... (Without Raw)".

 

Extracting without raw will save some space in your map.

 

But before you reinject, you need to open up the tagc in a hex editor and modify the tag's name so it will inject. Nothing fancy, just swap a letter out for now.

 

To find it, do a text search (or just take a look, since the tagc should be pretty small) for "bitm" then the full name. So for me editing the Foundry signs, I need to find "bitmobjects\levels\dlc\warehouse\bitmaps\fence_sign_red"

ZGZdRKr.png

 

Just going to replace the "o" in "objects" to an "x". That will serve the added function of it sorting at the end of the tag tree for easy access.

 

Once done save it and inject the tagc back and open the new bitm for later.

 

4. Bitmap Preparation

 

While not necessary, it is highly recommended that you use the original image as a base. And in most cases Adjutant will provide that for you, here's how:

 

 

Open the map with the bitmap you wish to modify in Adjutant and bring it up.

 

Note down the format and then Right Click>Export This Image. Save it as .BIN and again as DDS.

oI49D83.png

 

Open the .DDS file in your image editor and give it a look over, does it look like it does in Adjutant? Is the alpha channel intact?

 

If the resolution isn't "normal" (not 64/128/256/etc) your DDS may be the wrong size, but a crop/canvas resize down to the correct resolution will work if everything else is fine (anchor the upper left corner).

 

If there is a major issue with the DDS you will need to convert that .bin you also extracted. But since that requires the tool let's get that mostly filled out first.

 

If the DDS is good feel free to edit and save as .tga, if not make sure the size is still right and save as .tga anyway so it can be used as a dummy for bin conversion.

 

5. Tool Usage A

 

 

With the injected bitm still open in Assembly you need to check 4 things; the "Is Tiled" flag, the format, the mipmap count, and the zone Asset Index at the bottom.

 

Open EasyBitmapInjection and get ready to start filling things in as such:

 

If "Is Tiled" is checked, leave the first Format dropdown alone, if unchecked, change it to "Linear"

 

Set the second Format dropdown to match the Format value in Assembly.

 

If you have to convert a .bin from Adjutant, just write down the mipmap count for now and keep it at 0/1 in the tool.

 

Lastly, enter the Zone Asset Index for the bitmap data.

 

Close the map in Assembly.

 

Current Notes:

For formats like  DXT*a_mono use DXT*a, the only difference is that they may use a single channel or something. If you having to convert a .bin it was probably one of these formats.

 

6 Manual Bitmap Conversion

 

This can be skipped if your DDS worked fine.

 

In the tool, tick "Keep XPR" but NOT "Inject Into Map" and run the tool, which will ask for your .tga.

 

What we are doing here is creating a dummy file that we can put the bin file into. Go ahead and delete the "convertedBitmap.bin", "convertedBitmap_mipmaps.bin" and CustomImageNoMip.xpr" files that got made

 

Open CustomImage.xpr in a hex editor as well as the Adjutant .bin.

 

Look at x4 in the file and ensure the 4 bytes after are equal to the size of the .bin. It should be.

hOlJEr6.png

 

Now go to offset x80C, hold shift, then press the End key on your keyboard. This will select everything past the offset. Delete the selection.

 

Switch to the .bin and do select all then copy.

 

Switch back to the XPR file and paste at the end. Save and close the Hex Editor.

 

Now make sure unbundler.exe is in the same location as your XPR, then right click>Open Command Window Here somewhere.

 

Enter the following:

unbundler customimage.xpr

Then hit enter. This will spit out a couple files, but among them will be InitialImage.tga. That is your image so go ahead and open it in your image editor.

 

This should be a perfect file so edit as you will and save as a new .tga (or the same, whatever) when done.

 

7. Tool Usage B

 

If you had to convert the .bin, you will need to remove any extra non dll or exe files from the directory to continue.

 

The tool should still be open so uncheck "Keep XPR" if needed.

 

Enter the Mipmap count

 

Select your map that you reinjected the bitm tag to and once again check the Asset Index one more time.

 

Run the tool and give it your .tga. If you have been following along it should tell you when everything is done with no problems. The process shouldn't take very long.

 

8. Applying The Bitmap

 

So open your map back up in Assembly and go to your bitm tag. If you made any modifications to width/height or mipmaps, update them here and save,

 

Now open whatever shader or relevant tag that you wish to use your bitmap in, then swap it and save.

 

Congratulations You Did The Thing! ;) Copy the map over and (hopefully) enjoy

XsjxRdA.jpg

 

Below is that manual later-half of the original tutorial. At this point it probably isn't very coherent and I don't really care to fix it but here it is:

 

4. Creating Bitmap Raw

 

In the bitm tag scroll down to the "Mipmap Count" value, you will need this in a second. (Or you can have your own count. But if it was 0 then you should probably not bother.)

 

Make sure bundler.exe is in the same location as Halo 3 Injection Helper, then open up Halo 3 Injection Helper and fill in the fields as necessary. Keep the first dropdown "D3DFMT_" but change the format to match Adjutant. Set the "Levels" value the same as the Mipmap Count, unless the count is 0, then use 1 instead. Once filled in hit "Generate Image Raw" and select your TGA.

 

The tool will then run bundler to swizzle your image and output either 1 or 2 files depending on if you have mipmaps. In the log on the left it will also give lengths which you will need, so make note of them.

xMe6G3a.png

 

With those lengths copied you can close the tool. You should close Assembly, too.

 

5. Map Preparation Part 2

 

Convert the Image Raw and MipMaps Raw lengths to hex and paste them next to the decimal values.

 

Then, take the Total Length value, and as hex, divide it by x1000, then convert it to decimal, this is the page count you will need to give to Mapexpand. I have xF0000, so that becomes xF0, then as decimal that's 240. 240 pages.

 

Open the MapExpand folder, copy your map to it, then Right Click>Open Command Window Here somewhere in the Window, not over a file. From the command prompt run Mapexpand kinda like this:

mapexpand warehouse.map resource 240

Except "warehouse.map" will be your map and "240" will be your page count.

 

Hit Enter and Mapexpand will add your pages to you map, then give you the offset of the blank data.

SRjYSc5.png

 

Zedd Note: I'm doing both signs at once in case you were wondering why the values suddenly changed.

 

Anyway, copy that offset somewhere safe and close the command window.

 

Copy the map back over (maybe make a backup by renaming the original instead of overwriting? hm?) and open it in a hex editor.

 

6. Copying Over Bitmap Raw

 

With the map open, jump to the offset Mapexpand gave, then open up your raw files.

 

Starting with the mipmap raw (if applicable, otherwise the only file you got), select all and copy its data, then in your map select the size of the raw (Hex Workshop has Edit>Select Block for doing this easily), then paste over the selection you made. After you paste you should be taken to the end of the data, so note the offset you are currently on. (Or you could do Mapexpand offset + the size.) Then from that location repeat the process with the other (main) raw.

 

A quick explanation, Halo seems to like to store bitmaps in 2 parts; the main image, and then all the mipmaps as one group. The mipmaps seem to always come first so it is better to follow that pattern here.

 

With the raw pasted and the offsets collected you can save and close the map and hex editor.

 

7. Fixin' Stuff

 

This step will be in 2 parts: Play and Zone Fixups. If you're only modifying in-place and didn't change the resolution or mipmap count, then you shouldn't need to mess with fixups, but it is possible you'll need to change a format-related value if you see garbage ingame.

 

7.1. Play Fixin'

So open your map back up in Assembly. If you missed the part earlier after the Helper Tool about closing Assembly and your map was still open, close it and reopen it.

 

Now, assuming you only injected 1 bitm and nothing else since then, you don't have to look up the Zone Asset Index and do any navigating. Open up the PLAY tag and scroll to the bottom. Go to the last "Segments" chunk (or whatever your navigation brought you to if you had to) and make sure both "Segment Offset" values are 0, unless the optional/secondary one is -1 (no mipmaps), then leave the -1. Save.

 

Scroll up to the "Raw Pages" block and go the the second to last chunk. If you had no mipmaps then go to the last chunk. We need to fix up the values in the(se) chunks to match the raw we added.

 

So first off, set both "Compression Codec Index" and "Shared Cache Index" to -1. The raw has no compression and it isn't in a shared location. (But if you are injecting to the mainmenu you need to make the Shared Cache Index 0 instead of -1).

 

Then on the left side of Assembly click the Map Information tab and double click the "Raw Table Offset" value. This will copy it so paste it somewhere. Go back to the Tags tab.

 

For the Block Offset value, you need to take the offsets you noted when copying the raw in, then subtract the Raw Table Offset from them. Convert the result to decimal then fill it in.

 

For both the Compressed and Uncompressed Block Size values, use the decimal Raw Length values from the Helper Tool. Both will be the same value since there is no compression.

 

For the rest you need to use the Hash Checker tool, so open that up then drag your raw file over it. Copy each value in the tool to the respective place in the Raw Pages chunk. To be proper and fancy, finish it off by setting the Block Asset Count to 1.

 

Repeat the above on the last chunk if applicable. When done, double check everything, then Save.

 

7.1. Zone Fixup Fixin'

So with the introduction of Fixup Data, parts of bitm are also stored in them as well as bitm, so changes to resolution or mipmap counts will need to be reflected there.

 

First off, make your changes to the bitm tag to get it out of the way. Then Save.

 

Now head to the ZONE tag and go to the last Tag Resources chunk. Make sure the Parent Tag matches then copy the "Fixup Information Offset" value. Maybe the size too if it is something not 64 but otherwise don't worry.

 

Convert that offset to hex then scroll down, way down, to the "Fixup Information" dataref. Copy the Offset value you see.

 

Go back to the Map Information tab and double click the Map Magic value to copy it, paste that somewhere.

 

Now what you need to do it take the offset you got from the dataref, then subtract the map magic from it. This will be your file offset for it. Close Assembly.

 

Open your map in the hex editor for a final time and head to the dataref file offset you math'd plus the offset you got from the Tag Resources chunk and converted to hex. For the sake of this tutorial I will be extracting the fixup data to a new document to point things out better, you however will be editing it in place.

 

The first noteworthy value is a size value at x14 from the beginning of the fixup. If your fixup has 00's then leave it.

86Wlip0.png

 

If it wasn't 0 you'll need to make it the size of the main raw (not mipmap).

 

The next stuff starts at x28, beginning with the width and height, both 2 bytes long. (Width is selected below)

e5lFGRR.png

 

The byte after (x2C) is depth, which you probably aren't changing.

 

The byte after depth (x2D), is the levels count from the Helper tool, or if you don't remember, then its "Mipmap Count + 1" (For me, 9 Mipmaps plus 1 is 10, or xA)

6hlmcCQ.png

 

The byte after that (x2E) is Type, which you also probably aren't going to change.

 

The bytes after the (x2F) is unknown at this time, lol.

 

The 4 bytes after that (x30) is the format value, but it's set up weird. The last two bytes (so starting at x32) of it is what you need to change if you see garbage ingame, and sadly there isn't much known about it. If you are having troubles try "01 54", and if that doesn't work, either PM me or go hunting in similar bitmap's fixups and try their values there.

MBuH0ES.png

 

Make the changes you need and save. Then close the hex editor.

Share this post


Link to post
Share on other sites

When opening my extracted dds in Photoshop, It just displays a black square.

RmWu72p.png

Whereas in Adjutant:

9BOH6Kv.png

Share this post


Link to post
Share on other sites

When opening my extracted dds in Photoshop, It just displays a black square.

Whereas in Adjutant:

 

 

If you go check the alpha channels in Photoshop can you see the alpha? Often if it's an alpha-only texture they just set the main texture map a solid color.

Share this post


Link to post
Share on other sites

If you go check the alpha channels in Photoshop can you see the alpha? Often if it's an alpha-only texture they just set the main texture map a solid color.

It's only loading into RGB channels. Is that something I need to amend?

edit: It seems to be an issue with the DXT5a_mono format. Has anyone encountered this? I'm using an older version of Adjutant, so that might be it.

Share this post


Link to post
Share on other sites

It's only loading into RGB channels. Is that something I need to amend?

edit: It seems to be an issue with the DXT5a_mono format. Has anyone encountered this? I'm using an older version of Adjutant, so that might be it.

Yeah it's an Adjutant thing. I guess I'll write up an extra tutorial on using unbundler (another SKD tool) to convert the raw .bin file option in a bit.

 

Edit: Added.

Share this post


Link to post
Share on other sites

Interesting! Thanks for this Zedd! Now all we need is to be able to import custom models so we could make custom .maps! Also custom characters, vehicles, and weapons. ;) Then .map modding in Halo 3 will be like Halo 2 again! :D But back on this now all we need is to make adding sounds and bitmaps easy by a click of a button in Assembly but until then this is really helpful. :)

Share this post


Link to post
Share on other sites

Interesting! Thanks for this Zedd! Now all we need is to be able to import custom models so we could make custom .maps! Also custom characters, vehicles, and weapons. ;) Then .map modding in Halo 3 will be like Halo 2 again! :biggrin: But back on this now all we need is to make adding sounds and bitmaps easy by a click of a button in Assembly but until then this is really helpful. :smile:

characters, vehicles, and weapons arent something you import. you make them from models, sounds, and bitmaps. so once we can inject models you can do those as well

Share this post


Link to post
Share on other sites

characters, vehicles, and weapons arent something you import. you make them from models, sounds, and bitmaps. so once we can inject models you can do those as well

I thought that was what I said? o.o O did say when we can import models.. Also when I say import I mean inject. .-. Sorry if I didn't use the proper word..

Share this post


Link to post
Share on other sites

I'm on a roll here zedd. When injecting the tagc (extracted without raw). It's throwing this:

CIKJzJr.png

`_extractedResourcePageByPageIndex` is empty, but the index it's trying to grab is 3268.

stipo360 likes this

Share this post


Link to post
Share on other sites

I'm on a roll here zedd. When injecting the tagc (extracted without raw). It's throwing this:

-snip-

`_extractedResourcePageByPageIndex` is empty, but the index it's trying to grab is 3268.

I get this error too. 

Share this post


Link to post
Share on other sites

I get this error too.

Just extract with raw for now. I'm sure Zedd will work it out when he's back on - just a warning that this will probably add a lot of data to the map, so only do it this way on a test map for now.

Share this post


Link to post
Share on other sites

Just extract with raw for now. I'm sure Zedd will work it out when he's back on - just a warning that this will probably add a lot of data to the map, so only do it this way on a test map for now.

Alrighty then, I'll keep doing that. I first noticed a large increase in file size when I tag duped the old way. I'll stop talking about this since it's throwing this thread off topic.

Edited by The404Spartan

Share this post


Link to post
Share on other sites

Oops sorry guys, it didn't cross my mind when adding rawless extracting back to rawpage that the import code would be looking for raw. (Zedd master coder)

 

Just use master for now and all will be dandy. I replaced the link in the meantime.

Share this post


Link to post
Share on other sites

I can not save anything because it says that it can not find the file shared.map. Help me please.

Edited by Dark Universe

Share this post


Link to post
Share on other sites

I can not save bitmap as .BIN just as .TIF, I do not see .BIN. And I can not save anything because it says that it can not find the file shared.map. Help me please.

raw data is what i believe zedd means by bin

make sure your shared.map is in the same folder as your map that you have opened to extract images from

Dark Universe likes this

Share this post


Link to post
Share on other sites

raw data is what i believe zedd means by bin

make sure your shared.map is in the same folder as your map that you have opened to extract images from

Thanks !

Share this post


Link to post
Share on other sites

when i check the bitm tag in adjutant is says "--Block length does not match with its complement."

what does this mean???

Edited by forerunner569

Share this post


Link to post
Share on other sites

it would be awesome if while in a .map in assembly, in the bitmap tag, to be able to just simply inject a .tga, and have it somehow convert the raw data, into the bitmap.
Or, easiest of all, just have a replace button, in the raw extractor of adjutant.

Edited by weighta

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now