Page 1 of 1

User Profile Settings (blam.sav)

Posted: Sun Jun 26, 2011 9:38 am
by Sparky
Player Profile Keyboard Settings
In deciding that Zeus should import and use the same key configurations within its scenario viewer to control movement of the camera and editing that Halo / Halo Demo are configured by the user to use in the game, I've begun analyzing the Documents > Halo Demo > savegames > [profile] > blam.sav file in order to determine how the keyboard controls are saved within the file.

After a few minutes of comparing files, it seems like there is a character map (a list of all the supported characters, as described in the vcky Virtual Keyboard tag in the metadata of the ui.map file) that consists of a SHORT value for each character beginning at offset 0x134 and ending at offset 0x93A, spanning a total of 2054 (0x806) bytes. Within this 2054-byte character map are SHORT values, one SHORT value for each supported character of the input devices, listed in ASCII order (I think), such as 1, 2, 3... a, b, c, etc. . Here's a snapshot of what it looks like in HexEdit:

Image

As a reminder, these byte values must be reversed in order to switch between Little Endian and Big Endian, if you were to interpret the values as integer numbers.

You can see that all those "empty" values are 7F FF (or FF7F when converted, which is a value of 65,407). Each of these SHORT values represents a keyboard character. When you see a value of 7F FF, it means this keyboard character is not assigned a task or binding to a control in the player's profile. However, if you see a different value at this offset, then the SHORT value at that offset ties that character to its keyboard control function.

For example, 00 13 is a value used by the player profile control "Move Forward". When that 00 13 value is at offset 0x156, which is the offset representing the character 1, then the 1 key is mapped to "Move Forward". If this "Move Forward" setting is changed in the game so that it is mapped to the character 2 instead, then the offset 0x156 will return to a value of 7F FF and the next SHORT value in the character map, which is at offset 0x158, will change to 00 13.

Below, I have the "Move Forward" control set to 3 instead of 1 or 2 used in the example above. The ??? values are represented by 7F FF in SHORT value in the hex code.
Image

You have multiple input devices, of course, including a mouse and keyboard with the configuration shown in the picture above. The second column represents the Mouse input device. This device's character map starts at offset 0x20E, which shows us that the majority of the unmapped characters in the input device character map are representing values for supported gamepads and other miscellaneous input devices supported by the game. Thus, the actual keyboard map is between offsets 0x134 and 0x20E, a size of 218 bytes (0xDA bytes). Perhaps there are 218 keyboard characters in the vcky tag in the ui.map file?

I will now present a complete character map for you (a work in progress) :

Code: Select all

Character Map Analysis for Halo Demo's blam.sav file


Complete Keyboard Input Device Mapping

The main text values for these settings are available in the following tag in your ui.map file:
ui\shell\main_menu\settings_select\player_setup\player_profile_edit\controls_setup\controls_keyboard_button_names

0x156		1
0x158		2
0x15A		3
0x15C		4
0x15E		5
0x160		6
0x162		7
0x164		8
0x166		9
0x168		0
0x16A		-
0x16C		

0x18E		A


Complete Mouse Input Device Mapping

The main text values for these settings are available in the following tag in your ui.map file:
ui\shell\main_menu\settings_select\player_setup\player_profile_edit\controls_setup\controls_mouse_button_names

0x20E		Left Button
0x210		Middle Button
0x212		Right Button
0x214		Button 4
0x216		Button 5
0x218		Button 6
0x21A		Button 7
0x21C		Button 8
0x21E		Horizontal Axis -
0x220		Horizontal Axis +
0x222		Vertical Axis -
0x224		Vertical Axis +
0x226		Wheel -
0x228		Wheel +


Control Device Action Values

The main text values for these settings are available in the following tag in your ui.map file:
ui\shell\main_menu\settings_select\player_setup\player_profile_edit\controls_setup\controls_binding_labels

Note that you will not be able to manually change the mapping for the values within the blam.sav file unless you also
change the 4-byte checksum at the end of the file. Without changing the checksum, the game will revert to default controls.

Move Forward		0013
Move Backward		0014
Move Left			0015
Move Right			0016
Look Up				0017
Look Down			0018
Look Left			0019
Look Right			001A

Re: User Profile Settings (blam.sav)

Posted: Sun Jun 26, 2011 10:28 am
by nil
Bets the byte order is dependent on whether or not the native architecture is ppc (big endian) or i386 (little endian).

Re: User Profile Settings (blam.sav)

Posted: Sun Jun 26, 2011 10:39 am
by Sparky
The character map list is in progress. See the first post for the latest.

I'll have to test some more values before I can say with certainty that the values coincide with the related ustr Unicode String List tag values. It looks rather promising, though the Wheel - and Wheel + values use both the "Wheel" string and the -/+ strings located in a separate ustr tag.

Anyway, there's a checksum which is the last 4 bytes of the blam.sav file. The file gets overwritten with default values if the checksum fails. If you simply change a value in the file with Hex Edit, the checksum will fail and you will lose your user profile configuration settings for the input device controls at least.

Lucky for me, Zeus will just read the settings rather than write them, so I don't have to figure out the checksum nonsense. (But nil probably already knows from the gametype files, don't you?)

Re: User Profile Settings (blam.sav)

Posted: Sun Jun 26, 2011 1:51 pm
by Modzy
nil wrote:Bets the byte order is dependent on whether or not the native architecture is ppc (big endian) or i386 (little endian).

Re: User Profile Settings (blam.sav)

Posted: Mon Mar 19, 2012 5:53 pm
by Sparky
I was going to make another topic for this question, but just out of curiosity, which keyboard controls do you guys use?

Here are mine:

Re: User Profile Settings (blam.sav)

Posted: Wed Mar 21, 2012 4:06 pm
by Vegerot
The hayls wrong wit'u? That is the most retarded keyboard setup I've ever seen.

Re: User Profile Settings (blam.sav)

Posted: Wed Mar 21, 2012 11:14 pm
by Samuco
You obviously have not seen mine then :p

Re: User Profile Settings (blam.sav)

Posted: Thu Mar 22, 2012 7:45 am
by nil
@Sparky:

Interesting you adjusted to esdf instead of wasd, probably to give you more key choices? Most settings seem reasonable, except for the MISC ones besides tab as showing scores, since your right hand ought to remain on mouse. Your reload option seems terrible for backpack reloading though, and double melee, however.

Nothing that special with my controls, though I use T,G,B for chat functions and tab for showing scores. Wheel for changing weapons.

Working with HaloMD, I had only recently figured out the checksum. There's a script in the HaloMD app bundle that just takes the file path to the blam file and fixes the checksum on it. (In particular, the CRC32 of whole file is always 0xFFFFFFFF, so you have to forge the last 4 bytes to make it so).

Re: User Profile Settings (blam.sav)

Posted: Thu Mar 22, 2012 2:44 pm
by Sparky
The main idea I use is to keep my hand on the keys I should when I should. The movement keys (strafing in each direction, crouching, jumping) and the activate key are primary and therefore I use my pinkie for most other functions. The mouse I associate with aim-related, complicated, and secondarily repetitive actions such as firing, meleeing, throwing things, reloading, scope zoom and switching equipment. The mouse I use has five reprogrammable buttons. There is a related topic at MGM already about input devices like mice and trackballs. When I go to chat, I don't need to use the mouse anymore, since my hands are on the keyboard to type letters, so I move my right hand away from the mouse, tap the ";" semicolon with my right pinkie and start typing, pressing Return to submit the text.

ESDF brings my hand into a more natural location away from the Caps Lock key on the left and lets me keep my movement fingers on the appropriate keys. It's more natural because that's where your left hand is located when you are typing; you just slightly place your left middle finger up onto the E key.

Re: User Profile Settings (blam.sav)

Posted: Wed Aug 01, 2012 5:15 pm
by 002
Fire is left mouse
Throw grenade is V or right mouse
Scope is Z or middle mouse
Running is WASD
Aiming is with mouse or arrow keys
Crouch is C
Picking up Weapons is X
Changing Weapons is TAB
Chatting is TYH
Jump is Space
Changing grenades is G
Melee is F
Use is E
F1 is player scores
Q is flashlight
Alt-F4 is ragequit

pretty default control scheme

Re: User Profile Settings (blam.sav)

Posted: Wed Aug 01, 2012 7:05 pm
by Sparky
002 wrote:Fire is left mouse
Throw grenade is V or right mouse
Scope is Z or middle mouse
Running is WASD
Aiming is with mouse or arrow keys
Crouch is C
Picking up Weapons is X
Changing Weapons is TAB
Chatting is TYH
Jump is Space
Changing grenades is G
Melee is F
Use is E
F1 is player scores
Q is flashlight
Alt-F4 is ragequit

pretty default control scheme
Do you use your thumb to press the G key?

Re: User Profile Settings (blam.sav)

Posted: Wed Aug 01, 2012 7:45 pm
by Mgalekgolo
I would always use the index of my left hand, but i'm left handed so idk if that effects it or not.

Re: User Profile Settings (blam.sav)

Posted: Thu Aug 02, 2012 10:50 am
by 002
Sparky wrote:Do you use your thumb to press the G key?
Not unless I am moving to the right, which I use middle finger for up (W) and index for right (D). I use my index for G and thumb for space. This makes it easier to rush into players with the assault rifle.

I only use thumb for V, space, and C.
Mgalekgolo wrote:I would always use the index of my left hand, but i'm left handed so idk if that effects it or not.
It can and probably does. You can, however, be a touch-typist who learned it that way.