Post: MenuDefs/ItemDefs
03-31-2012, 04:59 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Hey guys, if you're here then you're probably interested in modding .menu files (like color and position of stuff)
Fair word of warning though, this is complex stuff, so don't be frustrated if you can't understand this

What are menuDefs/itemDefs:

A menuDef is a grouping of itemDefs. This holds the settings for the menu (doesn't always have to be a menu, just a display)
An itemDef describes an item member of a menu. These basically represent the different parts that make up the menu, such as text and background.

Some Definitions:

Int: an int type is an integer number, negative or not, with no fractional (decimal) portion.

Float: a float type is a floating point number, negative or not, with or without a fractional (decimal) portion. Use this tool to convert decimals to single-precision floating number points: You must login or register to view this content.

Color: a color type is four sequential floats, indicating a RGBA value. Each float corresponds to:

Red component
Green component
Blue component
Alpha component

Locating Itemdefs:

.menu files will contain itemdefs and menudefs but they're still pretty hard to locate. They also start right after one another. The easiest way to find an itemdef is this:

1. Look for signs and text that signal the presence of a certain itemdef
2. Locate forecolor, usually 3F 80 00 00 3F 80 00 00 3F 80 00 00 3F 80 00 00, and from the start go 5C backwards. This should be the beginning. It doesn't necessarily correspond to forecolor though

The menuDefs/itemDefs:

This list was created by aerosoul94, descriptions added by me
Some of these don't always apply to their descriptions depending on the itemdef/menudef


menuDef:

0x00 name - pointer
Sets a name for the menu

0x04 rect - float4 // X Y LENGTH WIDTH
0x18 rect - float4
Define a rectangle on the screen for the menu to occupy. Menu rectangles may overlap; the last rect defined sits on top. Rect type is four sequential ints. The four numbers correspond to:
Horizontal (X) position of the rectangle's upper-left corner
Vertical (Y) position of the rectangle's upper-left corner
Width of the rectangle
Height of the rectangle

0x30 style - int
Defines a window style for the menu.

0x34 border - int
Sets a border type.

0x38 ownerDraw - int
Causes the MW2 engine to draw something within the confines of the menu rect. Primary use is in HUDs (such as showing health).

0x5C foreColor - float4
Sets menu foreground color. Used as tint color for background shaders.

0x6C backColor - float4
Sets the menu background color

0xB4 fullscreen - int
A method of setting up a rectangle on the screen for the menu to occupy that covers the entire screen and to tell the program that nothing else is being rendered underneath this menu

0xB8 numItems - int
The number of itemdefs in the menu

0xD8 blurWorld - float
The focus or "blur"

0x100 soundLoop - pointer
The given string is interpreted as a sound name (filename for the most part) to play in a loop

0x108 focusColor - float4
The highlight color of the text

itemDef:

0x04 rect 480 - float4
0x18 rect 720 - float4

0x38 ownerDraw - int

0x5C foreColor - float4
0x6C backColor - float4

0x100 type - int
0x104 type - int
Sets the type for the itemdef

0x108 align - int
Text alignment

0x10C textFont - int
The font, types include:

DAStacks
hudbig
hudsmall
smallfixed
bigfixed
objective

Values include 00 01 02 03 04 05 06 07 08 09 0A

0x110 textAlign - int
0x114 textAlignX - float
0x118 textAlignY - float
You can change these values to move the hud around the screen if you can get the itemdef Winky Winky

0x11C textScale - float
The size of the text

0x120 textStyle - int
Style properties of the text

Any comments or suggestions for the thread just ask Smile
Also tell me if I need to fix up any information if it's incorrect
(adsbygoogle = window.adsbygoogle || []).push({});

The following 13 users say thank you to Rainbow Gravity for this useful post:

Blackstorm, bottom feeder, Choco, daswiftguy, FuntCase, iMCSx, JonoEfthy, KCxFTW, Cmd-X, Rustled Jimmies, ICS Vortex, Xx--AIDAN--xX
03-31-2012, 05:56 AM #2
Just had a convo with aero today about this :p
03-31-2012, 06:37 AM #3
Blackstorm
Veni. Vidi. Vici.
how to cl pls

The following 4 users say thank you to Blackstorm for this useful post:

KCxFTW, Rainbow Gravity, TheFallen, Vampytwistッ
04-01-2012, 01:13 AM #4
Originally posted by Blackstorm View Post
how to cl pls

Lol I doubt that anyone actually understands this :dumb:

EDIT: This was a joke dumbasses stare

The following user groaned Rainbow Gravity for this awful post:

Cmd-X
04-01-2012, 01:36 AM #5
KCxFTW
Who’s Jim Erased?
I....kind....of.....get.....it :blank:<:Sad Awesomewat::dude..:
04-01-2012, 01:37 AM #6
Choco
Respect my authoritah!!
Originally posted by Rainbow
Lol I doubt that anyone actually understands this :dumb:


I do, I've been trying to figure these things out for the longest time :p Thanks, I'll take a look at COD4 and see if it's similar to this.
04-01-2012, 01:46 AM #7
Originally posted by .Choco View Post
I do, I've been trying to figure these things out for the longest time :p Thanks, I'll take a look at COD4 and see if it's similar to this.

The engine has the same structure so yes, it's based off quake 3
04-01-2012, 05:16 AM #8
add this:


    
//Not complete..
//Not 100% sure on the names
//most names are by NTA
//PC and XBOX may be slightly different
//Shaders may be different sizes as well as sounds
//This was structured by PS3 Menufiles

//rect
typedef struct rectDef_t
{
float x;
float y;
float w;
float h;
int8 h_align;
int8 v_align;
byte[0x2] nullBytes = ReadBytes(0x2);
};

/* For h_align, use...
#define HORIZONTAL_ALIGN_SUBLEFT 0 // left edge of a 4:3 screen (safe area not included)
#define HORIZONTAL_ALIGN_LEFT 1 // left viewable (safe area) edge
#define HORIZONTAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define HORIZONTAL_ALIGN_RIGHT 3 // right viewable (safe area) edge
#define HORIZONTAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define HORIZONTAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define HORIZONTAL_ALIGN_TO640 6 // scales a real-screen resolution x down into the 0 - 640 range
#define HORIZONTAL_ALIGN_CENTER_SAFEAREA 7 // center of the safearea
#define HORIZONTAL_ALIGN_MAX HORIZONTAL_ALIGN_CENTER_SAFEAREA
#define HORIZONTAL_ALIGN_DEFAULT HORIZONTAL_ALIGN_SUBLEFT

and then for v_align, use...
#define VERTICAL_ALIGN_SUBTOP 0 // top edge of the 4:3 screen (safe area not included)
#define VERTICAL_ALIGN_TOP 1 // top viewable (safe area) edge
#define VERTICAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define VERTICAL_ALIGN_BOTTOM 3 // bottom viewable (safe area) edge
#define VERTICAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define VERTICAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define VERTICAL_ALIGN_TO480 6 // scales a real-screen resolution y down into the 0 - 480 range
#define VERTICAL_ALIGN_CENTER_SAFEAREA 7 // center of the save area
#define VERTICAL_ALIGN_MAX VERTICAL_ALIGN_CENTER_SAFEAREA
#define VERTICAL_ALIGN_DEFAULT VERTICAL_ALIGN_SUBTOP*/

//color
typedef struct vec4_t
{
float red;
float green;
float blue;
float alpha;
};

//flags2
typedef struct flags2_t
{
int16 visible;
int16 hasForeColor;
};

//menuDef
typedef struct menuDef_t
{
int32 namePointer;
rectDef_t rect1; //not sure why theres two
rectDef_t rect2; //quake engine says first is for client and second is for screen?
int32 unknown1;
int32 style;
int32 border;
int32 ownerDraw;
int32 ownerDrawFlags;
float borderSize;
int32 flags1;
flags2_t flags2; //not sure why theres four
flags2_t flags2; //PC has one flags2
flags2_t flags2;
flags2_t flags2;
vec4_t foreColor;
vec4_t backColor;
vec4_t borderColor;
vec4_t outlineColor;
vec4_t disableColor;
int32 backgroundPointer;
int32 fullscreen;
int32 numItems;
int32 unknown2;
int32 unknownPointer1;
int32 unknownPointer2;
int32 unknownPointer3;
int32 unknownPointer4;
int32 fadeCycle;
float fadeClamp;
float fadeAmount;
float fadeInAmount;
int32 blurWorld;
int32 onOpenPointer;
int32 onRequestClosePointer;
int32 onClosePointer;
int32 onEscPointer;
int32 execKeysPointer;
int32 visibleWhenPointer;
int32 allowedBindingPointer
int32 soundLoopPointer;
int32 unknown3;
vec4_t focusColor;
int32 unknown4;
int32 unknownPointer;
int32 unknown6;
int32 unknown7;
int32 itemsPointer;
bytes[0x1C0] unknownNullBytes = ReadBytes(0x1C0);

//not sure if needed for menu to run
//if it is then we got more work to do xD
int32 parentMenuPointer;
wtfisthisshit loadSomeStuffFromHere;

if( namePointer == -1 )
string name = ReadNullTerminatedString();

//shader
if(backgroundPointer == -1)
{
unknownPointer = ReadInt32();
bytes[0xA4] unknownNullBytes = ReadBytes(0xA4);
string background = ReadNullTerminatedString();
}

if( onOpenPointer == -1 )
menuScript_t onOpen;

if( onClosePointer == -1 )
menuScript_t onClose;

if( onEscPointer == -1 )
menuScript_t onEsc;

//sound
if( soundLoopPointer == -1 )
{
bytes[0x1C] nullBytes = ReadBytes(0x1C);
string soundLoop = ReadNullTerminatedString();
}

if( itemsPointer == -1 )
{
for( int32 i = 0; i < numItems ; i++ )
itemDefPointer.Add(ReadInt32());

for( int32 i = 0; i < numItems ; i++ )
{
if(itemDefPointer[i] == -1)
{
itemDef itemDef = new itemDef();
itemDef.Read();
itemDefs.Add(itemDef);
}
}
}
};

//itemDef
typedef struct itemDef_t
{
int32 namePointer;
rectdef_t rect1;
rectdef_t rect2;
int32 groupPointer;
int32 style;
int32 border;
int32 ownerDraw;
int32 ownerDrawFlags;
float borderSize;
int32 flags1;
flags2_t flags2; //not sure why theres four
flags2_t flags2; //PC has one flags2
flags2_t flags2;
flags2_t flags2;
int32 unknown1;
vec4_t foreColor;
vec4_t backColor;
vec4_t borderColor;
vec4_t outlineColor;
vec4_t disableColor;
int32 backgroundPointer;

//either padding or same as menudef just unused
//have yet to find data in these 0x50 bytes
bytes[0x50] unknownNullBytes = ReadBytes(0x50);
int32 type1;
int32 type2;
int32 align;
int32 textFont;
int32 textAlign;
float textAlignX;
float textAlignY;
float textScale;
int32 textStyle;
int32 gameMsgWindowIndex;
int32 gameMsgWindowMode;
int32 textPointer;
int32 unknown3;
int32 unknown4;
int32 mouseEnterText;
int32 mouseExitText;
int32 mouseEnter;
int32 mouseExit;
int32 actionPointer;
int32 acceptPointer;
int32 onFocusPointer;
int32 leaveFocusPointer;
int32 dvarPointer;
int32 dvarTestPointer;
int32 xDvarPointer;
int32 localVarPointer;
int32 xDvarType;
int32 focusSoundPointer;
float feeder;
int32 unknown8;
int32 unknown9;
int32 unknown10;
int32 unknown11;
int32 typeDataPointer;
int32 unknown13;
int32 unknown14;
int32 unknownPointer;
int32 visibleExpPointer;
int32 disabledExp;
int32 textExpPointer;
int32 unknownPointer;
byte[0x28] unknownBytes = ReadBytes(0x2Cool Man (aka Tustin);
if(namePointer == -1)
string name = ReadNullTerminatedString();

if(groupPointer == -1)
string group = ReadNullTerminatedString();

//shader
if(backgroundPointer == -1)
{
unknownPointer = ReadInt32();
bytes[0xA4] unknownNullBytes = ReadBytes(0xA4);
string background = ReadNullTerminatedString();
}

if(textPointer == -1)
string text = ReadNullTerminatedString();

//menuScript_t not finished
if(actionPointer == -1)
menuScript_t action;

if(acceptPointer == -1)
menuScript_t accept;

if(onFocusPointer == -1)
menuScript_t onFocus;

if(leaveFocusPointer == -1)
menuScript_t leaveFocus;

if(dvarPointer == -1)
string dvar = readNullTerminatedString();

if(dvarTestPointer == -1)
string dvarTest = readNullTerminatedString();

//need to map out execKey_t
if(execKeysPointer == -1)
execKey_t execKeys;

if(localVarPointer == -1)
string localVar = ReadNullTerminatedString();

};



---------- Post added at 12:16 AM ---------- Previous post was at 12:12 AM ----------

Originally posted by Rainbow
Lol I doubt that anyone actually understands this :dumb:


It's just how to data is made up :p

This isn't fully done yet Gaspkay:
04-01-2012, 05:19 AM #9
Originally posted by DEVASTATION View Post
add this:


    
//Not complete..
//Not 100% sure on the names
//most names are by NTA
//PC and XBOX may be slightly different
//Shaders may be different sizes as well as sounds
//This was structured by PS3 Menufiles

//rect
typedef struct rectDef_t
{
float x;
float y;
float w;
float h;
int8 h_align;
int8 v_align;
byte[0x2] nullBytes = ReadBytes(0x2);
};

/* For h_align, use...
#define HORIZONTAL_ALIGN_SUBLEFT 0 // left edge of a 4:3 screen (safe area not included)
#define HORIZONTAL_ALIGN_LEFT 1 // left viewable (safe area) edge
#define HORIZONTAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define HORIZONTAL_ALIGN_RIGHT 3 // right viewable (safe area) edge
#define HORIZONTAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define HORIZONTAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define HORIZONTAL_ALIGN_TO640 6 // scales a real-screen resolution x down into the 0 - 640 range
#define HORIZONTAL_ALIGN_CENTER_SAFEAREA 7 // center of the safearea
#define HORIZONTAL_ALIGN_MAX HORIZONTAL_ALIGN_CENTER_SAFEAREA
#define HORIZONTAL_ALIGN_DEFAULT HORIZONTAL_ALIGN_SUBLEFT

and then for v_align, use...
#define VERTICAL_ALIGN_SUBTOP 0 // top edge of the 4:3 screen (safe area not included)
#define VERTICAL_ALIGN_TOP 1 // top viewable (safe area) edge
#define VERTICAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define VERTICAL_ALIGN_BOTTOM 3 // bottom viewable (safe area) edge
#define VERTICAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define VERTICAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define VERTICAL_ALIGN_TO480 6 // scales a real-screen resolution y down into the 0 - 480 range
#define VERTICAL_ALIGN_CENTER_SAFEAREA 7 // center of the save area
#define VERTICAL_ALIGN_MAX VERTICAL_ALIGN_CENTER_SAFEAREA
#define VERTICAL_ALIGN_DEFAULT VERTICAL_ALIGN_SUBTOP*/

//color
typedef struct vec4_t
{
float red;
float green;
float blue;
float alpha;
};

//flags2
typedef struct flags2_t
{
int16 visible;
int16 hasForeColor;
};

//menuDef
typedef struct menuDef_t
{
int32 namePointer;
rectDef_t rect1; //not sure why theres two
rectDef_t rect2; //quake engine says first is for client and second is for screen?
int32 unknown1;
int32 style;
int32 border;
int32 ownerDraw;
int32 ownerDrawFlags;
float borderSize;
int32 flags1;
flags2_t flags2; //not sure why theres four
flags2_t flags2; //PC has one flags2
flags2_t flags2;
flags2_t flags2;
vec4_t foreColor;
vec4_t backColor;
vec4_t borderColor;
vec4_t outlineColor;
vec4_t disableColor;
int32 backgroundPointer;
int32 fullscreen;
int32 numItems;
int32 unknown2;
int32 unknownPointer1;
int32 unknownPointer2;
int32 unknownPointer3;
int32 unknownPointer4;
int32 fadeCycle;
float fadeClamp;
float fadeAmount;
float fadeInAmount;
int32 blurWorld;
int32 onOpenPointer;
int32 onRequestClosePointer;
int32 onClosePointer;
int32 onEscPointer;
int32 execKeysPointer;
int32 visibleWhenPointer;
int32 allowedBindingPointer
int32 soundLoopPointer;
int32 unknown3;
vec4_t focusColor;
int32 unknown4;
int32 unknownPointer;
int32 unknown6;
int32 unknown7;
int32 itemsPointer;
bytes[0x1C0] unknownNullBytes = ReadBytes(0x1C0);

//not sure if needed for menu to run
//if it is then we got more work to do xD
int32 parentMenuPointer;
wtfisthisshit loadSomeStuffFromHere;

if( namePointer == -1 )
string name = ReadNullTerminatedString();

//shader
if(backgroundPointer == -1)
{
unknownPointer = ReadInt32();
bytes[0xA4] unknownNullBytes = ReadBytes(0xA4);
string background = ReadNullTerminatedString();
}

if( onOpenPointer == -1 )
menuScript_t onOpen;

if( onClosePointer == -1 )
menuScript_t onClose;

if( onEscPointer == -1 )
menuScript_t onEsc;

//sound
if( soundLoopPointer == -1 )
{
bytes[0x1C] nullBytes = ReadBytes(0x1C);
string soundLoop = ReadNullTerminatedString();
}

if( itemsPointer == -1 )
{
for( int32 i = 0; i < numItems ; i++ )
itemDefPointer.Add(ReadInt32());

for( int32 i = 0; i < numItems ; i++ )
{
if(itemDefPointer[i] == -1)
{
itemDef itemDef = new itemDef();
itemDef.Read();
itemDefs.Add(itemDef);
}
}
}
};

//itemDef
typedef struct itemDef_t
{
int32 namePointer;
rectdef_t rect1;
rectdef_t rect2;
int32 groupPointer;
int32 style;
int32 border;
int32 ownerDraw;
int32 ownerDrawFlags;
float borderSize;
int32 flags1;
flags2_t flags2; //not sure why theres four
flags2_t flags2; //PC has one flags2
flags2_t flags2;
flags2_t flags2;
int32 unknown1;
vec4_t foreColor;
vec4_t backColor;
vec4_t borderColor;
vec4_t outlineColor;
vec4_t disableColor;
int32 backgroundPointer;

//either padding or same as menudef just unused
//have yet to find data in these 0x50 bytes
bytes[0x50] unknownNullBytes = ReadBytes(0x50);
int32 type1;
int32 type2;
int32 align;
int32 textFont;
int32 textAlign;
float textAlignX;
float textAlignY;
float textScale;
int32 textStyle;
int32 gameMsgWindowIndex;
int32 gameMsgWindowMode;
int32 textPointer;
int32 unknown3;
int32 unknown4;
int32 mouseEnterText;
int32 mouseExitText;
int32 mouseEnter;
int32 mouseExit;
int32 actionPointer;
int32 acceptPointer;
int32 onFocusPointer;
int32 leaveFocusPointer;
int32 dvarPointer;
int32 dvarTestPointer;
int32 xDvarPointer;
int32 localVarPointer;
int32 xDvarType;
int32 focusSoundPointer;
float feeder;
int32 unknown8;
int32 unknown9;
int32 unknown10;
int32 unknown11;
int32 typeDataPointer;
int32 unknown13;
int32 unknown14;
int32 unknownPointer;
int32 visibleExpPointer;
int32 disabledExp;
int32 textExpPointer;
int32 unknownPointer;
byte[0x28] unknownBytes = ReadBytes(0x2Cool Man (aka Tustin);
if(namePointer == -1)
string name = ReadNullTerminatedString();

if(groupPointer == -1)
string group = ReadNullTerminatedString();

//shader
if(backgroundPointer == -1)
{
unknownPointer = ReadInt32();
bytes[0xA4] unknownNullBytes = ReadBytes(0xA4);
string background = ReadNullTerminatedString();
}

if(textPointer == -1)
string text = ReadNullTerminatedString();

//menuScript_t not finished
if(actionPointer == -1)
menuScript_t action;

if(acceptPointer == -1)
menuScript_t accept;

if(onFocusPointer == -1)
menuScript_t onFocus;

if(leaveFocusPointer == -1)
menuScript_t leaveFocus;

if(dvarPointer == -1)
string dvar = readNullTerminatedString();

if(dvarTestPointer == -1)
string dvarTest = readNullTerminatedString();

//need to map out execKey_t
if(execKeysPointer == -1)
execKey_t execKeys;

if(localVarPointer == -1)
string localVar = ReadNullTerminatedString();

};



---------- Post added at 12:16 AM ---------- Previous post was at 12:12 AM ----------



It's just how to data is made up :p

This isn't fully done yet Gaspkay:

I've used the alignment before, it made it aligned to the right instead of the left. This is hex based though, and it needs offsets rather than values, but I'll try update the offsets off what you've listed. Bordersize was one, but I've got it somewhere else on my pc. It looks kinda like this with the border:

04-01-2012, 06:26 AM #10
You must login or register to view this content.Just had a convo with aero today about this

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo