Gta Vice City Keys.dat Review
Contrary to what the name might imply, keys.dat is not a file that stores your keyboard bindings or controller settings. That is a common misconception. In GTA: Vice City, control mappings are actually stored in gta_vc.set (a configuration file saved in the User Files folder).
So, what does keys.dat do?
keys.dat is a proprietary, binary-format data file used by the game’s engine (RenderWare) to manage gamepad (joystick) input mappings. Specifically, it contains a lookup table that tells the game how to translate signals from a connected controller into in-game actions like accelerating, braking, shooting, or changing radio stations.
In essence:
The file is typically found in the game’s installation directory (e.g., C:\Program Files\Rockstar Games\Grand Theft Auto Vice City\). gta vice city keys.dat
[+] Found 12 custom bindings
PED_FORWARD -> W PED_BACKWARD -> S PED_LEFT -> A PED_RIGHT -> D PED_FIREWEAPON -> LMB PED_AIM -> RMB PED_JUMP -> SPACE VEHICLE_ACCELERATE -> W VEHICLE_BRAKE_REVERSE -> S VEHICLE_STEER_LEFT -> A VEHICLE_STEER_RIGHT -> D VEHICLE_HANDBRAKE -> SPACE Shift
Cause: The game can’t locate the file (wrong path or deleted).
Fix:
A: Technically, yes. Some players have deleted keys.dat and the game launches fine—if they never plug in a controller. However, some executables (especially cracked ones) still check for the file’s existence and will crash if it’s absent. Safer to keep it. Contrary to what the name might imply, keys
GTA: Vice City was released in 2002–2003. Modern Xbox One, PS4/PS5, or generic USB controllers often send different signal IDs than the old SideWinder or Logitech controllers from that era. When the game reads keys.dat and doesn’t find a matching device ID, your controller won’t work at all.
If all else fails, you can manually recreate a minimal, working keys.dat. This is risky but possible. A healthy file starts with the header 0x01 0x00 0x00 0x00. Here’s a simplified approach:
Modders have reverse-engineered the keys.dat format. It contains a series of device descriptors followed by arrays of button-to-action mappings. To add support for a new controller (e.g., DualShock 4):
Warning: A single misplaced byte will break the entire file. Always backup your original
keys.datbefore attempting to mod it. The file is typically found in the game’s
DIK_NAMES = 0x11: "W", 0x1F: "S", 0x1E: "A", 0x20: "D", 0x22: "LMB", 0x23: "RMB", 0x39: "SPACE", 0x1C: "ENTER", 0x2A: "LSHIFT", 0x0E: "BACKSPACE", 0x0F: "TAB",
def parse_keys_dat(filepath): if not os.path.exists(filepath): print(f"[-] File not found: filepath") return
with open(filepath, "rb") as f:
# Read header (first 4 bytes: number of entries)
header = f.read(4)
if len(header) < 4:
print("[-] Invalid keys.dat (too small)")
return
num_entries = struct.unpack("<I", header)[0]
print(f"[+] Found num_entries custom bindings\n")
for i in range(num_entries):
data = f.read(6) # each entry: 2 bytes actionID, 2 bytes DIK, 2 bytes flags
if len(data) < 6:
break
action_id, dik_code, flags = struct.unpack("<HHH", data)
action_name = ACTION_NAMES.get(action_id, f"UNKNOWN_0xaction_id:04X")
key_name = DIK_NAMES.get(dik_code, f"DIK_0xdik_code:02X")
mods = []
if flags & 1: mods.append("Ctrl")
if flags & 2: mods.append("Shift")
if flags & 4: mods.append("Alt")
mod_str = "+".join(mods) if mods else ""
print(f"action_name:25 -> key_name:<10 mod_str")
if name == "main": # Typical path – change if needed path = os.path.expanduser("~/Documents/GTA Vice City User Files/keys.dat") parse_keys_dat(path)