-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Hex Edits
Hex Edits were the required method of enabling modding in Borderlands 2 and The Pre-Sequel for most of those games' modding lifecycles. Eventually, however, hex edits were supplanted by using PythonSDK instead.
Still, it's good to catalog the information about what used to be done. Some edits here, such as the Array Limit hex edit, are still useful in some circumstances, as well. So, this page serves as an archive of the edits which we're aware of. There's some gaps in this knowledge which could use filling in, but it should be reasonably complete.
- General Info
- Enable
set
Command - Array Limit Disabling
- Disable Sanity Check
- Offline-Only Mode
- Level 1 UVHM
Some things to keep in mind:
- When you see
??
in the search strings, it means that you should allow any value in that byte position. - Note that none of these have been verified on the standalone
Assault on Dragon Keep, released
in 2021, and BL2's
set
hexedit in particular ends up breaking the game. It's recommended to stick with PythonSDK regardless, but for AoDK it's basically required. - Linux users are strongly encouraged to use the Windows version via Proton, rather than the native version. That way your game is up-to-date and you can make use of PythonSDK. If Mac users have the ability to use the Windows version as well, that too is recommended for them.
For Windows, there's two components to this: one is to enable the set
command itself, and another to disable the auto-say
which happens when
you type in console commands. For the native Linux + Mac versions, there's
an alternate method which takes care of it with a single hexedit, though
keep in mind that with those hexedits, you have to execute mods from the
title screen, not the main menu. (The Mac version for BL2 apparently has
a separate hexedit which might improve that aspect.)
As mentioned above, keep in mind that installing PythonSDK is the preferred method of enabling this, rather than doing hexedits.
Search for:
83 C4 0C 85 ?? 75 1A 6A
The ??
byte is ordinarily C0
-- replace it with FF
Search for:
61 00 77 00 20 00 5B 00 47 00 54 00 5D 00 00 00 ?? 00 ?? 00 ?? 00 ?? 00 00 00 00 00 6D 73 67 20
The four ??
bytes are ordinarily 73 61 79 20
. Replace them with 00 00 00 20
.
Note: This edit requires the user to execute mods from the title screen, not main menu. Also, Linux users are encouraged to use the Windows versions via Proton, instead, in which case you should use the Windows edit, above.
Search for:
00 00 00 00 43 00 00 00 6F 00 00 00 6E 00 00 00 73 00 00 00 75 00 00 00 6D 00 00 00 65 00 00 00 00 00 00 00 4E 00 00 00
The sixteen bytes before that pattern are ordinarily:
73 00 00 00 61 00 00 00 79 00 00 00 20 00 00 00
... replace them instead with all NUL bytes:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Note: This edit requires the user to execute mods from the title screen, not main menu.
This is basically the same pattern as the BL2 Linux/Mac version above, except the sixteen bytes you change occur 24 bytes prior to the pattern, not 16 (so there's eight bytes inbetween what you're changing and the pattern.
So, search for the same string as the BL2 Linux/Mac version, above:
00 00 00 00 43 00 00 00 6F 00 00 00 6E 00 00 00 73 00 00 00 75 00 00 00 6D 00 00 00 65 00 00 00 00 00 00 00 4E 00 00 00
Go back 24 bytes from the start of that pattern. The 16 bytes found there are ordinarily:
73 00 00 00 61 00 00 00 79 00 00 00 20 00 00 00
... replace them instead with all NUL bytes:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
I believe this hex-edit allows the Mac version to execute patches from the main menu, rather than the title screen, though I'm honestly not sure.
Search for this pattern:
41 ?? 01 00 00 00 BA 01 00 00 00 E8 ?? ?? ?? ?? 85 ?? 75 19 48 8D
Moving forward 17 bytes from the start of the pattern (so: the final ??
wildcard in there), that byte is ordinarily C0
. Change it to D8
.
This theoretically does the same enhancement for TPS that the previous one does for BL2, but the notes in BLCMM mention that it seems to break mods entirely, instead of making them better. So, don't actually use this, but I'm including it for posterity in case anyone wants to investigate.
Search for this pattern:
89 3C 24 C7 44 24 08 01 00 00 00 C7 44 24 04 ?? ?? ?? ?? E8 ?? ?? ?? ?? 85 ?? 74 ?? 8B 8D
Moving forward 25 bytes from the start of the pattern (so: the second-to-last
??
wildcard in there), that byte is ordinarily C0
. Change it to D8
.
When using obj dump
on the console to view variables, arrays will generally
be limited to 100 items on the output. These hexedits get rid of that
restriction, which is useful to modders. It's of no interest to folks who
are just using mods.
There are technically two parts to this: disabling the limit itself, and then removing the message which gets printed on the console once you get to the 100th entry.
Search for this pattern:
8B 40 04 83 F8 64 ?? ?? ?? ?? ?? ?? 8B 8D 9C EE FF FF 83 C0 9D 50 68
The question-marked bytes are ordinarily 0F 8C 7B 00 00 00
-- replace
them with EB 7F 90 90 90 90
. (This is a better hexedit than the original
one. The original just replaced the 8C
with 85
, but had the downside
that the message would be printed if the array had exactly 100 items.)
Search for this pattern:
80 FF FF 8B 44 08 04 83 F8 64 89 C1 BA 64 00 00 00
Move ahead 0x35
bytes (53 in decimal) from the start of that pattern. The
byte at that location is ordinarily 7C
-- change it to 75
.
Search for this pattern:
FF 44 24 5C 8B 44 24 6C 8B 4C 24 68 8B 44 08 04 83 F8 64 89 C1
Move ahead 0x31
bytes (49 in decimal) from the start of that pattern. The
byte at that location is ordinarily 7C
-- change it to 75
.
Search for this pattern:
8B 40 04 83 F8 64 ?? 7B 8B 8D 94 EE FF FF 83 C0 9D 50 68
The ??
byte is ordinarily 7C
-- replace it with EB
.
Seach for this pattern:
80 FF FF 8B 44 08 04 83 F8 64 89 C1 BA 64 00 00 00
Move ahead 0x35
bytes (53 in decimal) from the start of that pattern. The
six bytes at that location are ordinarily 0F 8C 2F 01 00 00
-- change them
to 0F 85 2F 01 00 00
.
Search for this pattern:
FF 44 24 5C 8B 44 24 6C 8B 4C 24 68 8B 44 08 04 83 F8 64 89 C1
Move ahead 0x36
bytes (54 in decimal) from the start of that pattern. The
byte at that location is ordinarily 7C
-- change it to 75
.
Search for this pattern:
?? 05 B9 64 00 00 00 3B F9 0F 8D
The ??
byte is ordinarily 7E
-- replace it with EB
. (This is a more
proper edit than the original, which replaced it with 75
instead.)
Search for this pattern:
80 FF FF 8B 44 08 04 83 F8 64 89 C1 BA 64 00 00 00 ?? ?? ??
The three ??
bytes are ordinarily 0F 4F CA
-- replace them with 90 90 90
.
Search for this pattern:
FF 44 24 5C 8B 44 24 6C 8B 4C 24 68 8B 44 08 04 83 F8 64 89 C1 ?? ?? ??
The three ??
bytes are ordinarily 0F 4F CB
-- replace them with 90 90 90
.
Search for this pattern:
FF 44 24 5C 8B 44 24 6C 8B 4C 24 68 8B 44 08 04 83 F8 64 89 C1
Move ahead 0x1A
bytes (26 in decimal) from the start of that pattern. The
three bytes at that location are ordinarily 0F 4F CA
-- replace them with
90 90 90
.
BL2 and TPS ordinarily do a "sanity check" on weapons/items to make sure that they're valid. This can lead to modded gear getting deleted from savegames. These hexedits get rid of that check. Note that the PythonSDK mod Sanity Saver is a much more convenient way to do this.
The Windows hexedits we have are apparently just for weapons, and on a per-part basis, whereas the Linux/Mac ones are more generalized to one for items and another for weapons.
Search for:
83 7F 10 00 8D 47 10 74
Replace with:
83 7F 10 FF 8D 47 10 75
Search for:
83 7F 14 00 8D 47 14 74
Replace with:
83 7F 14 FF 8D 47 14 75
Search for:
83 7F 18 00 8D 47 18 74
Replace with:
83 7F 18 FF 8D 47 18 75
Search for:
83 7F 1C 00 8D 47 1C 74
Replace with:
83 7F 1C FF 8D 47 1C 75
Search for:
83 7F 20 00 8D 47 20 74 11
Replace with:
83 7F 20 FF 8D 47 20 75 11
Search for:
83 7F 24 00 8D 47 24 74
Replace with:
83 7F 24 FF 8D 47 24 75
Search for:
83 7F 28 00 8D 47 28 74
Replace with:
83 7F 28 FF 8D 47 28 75
Search for:
83 7F 2C 00 8D 47 2C 74
Replace with:
83 7F 2C FF 8D 47 2C 75
Search for:
83 7F 30 00 8D 47 30 74 11
Replace with:
83 7F 30 FF 8D 47 30 75 11
Search for:
83 7E 10 00 8D 46 10 74 30 50 8D 4D DC
Replace with:
83 7E 10 FF 8D 46 10 75 30 50 8D 4D DC
Search for:
83 7E 14 00 8D 46 14 74 0D 50 8D 4D DC
Replace with:
83 7E 14 FF 8D 46 14 75 0D 50 8D 4D DC
Search for:
83 7E 18 00 8D 46 18 74 11 50 8D 4D DC
Replace with:
83 7E 18 FF 8D 46 18 75 11 50 8D 4D DC
Search for:
83 7E 1C 00 8D 46 1C 74 11 50 8D 4D DC
Replace with:
83 7E 1C FF 8D 46 1C 75 11 50 8D 4D DC
Search for:
83 7E 20 00 8D 46 20 74 11 50 8D 4D DC
Replace with:
83 7E 20 FF 8D 46 20 75 11 50 8D 4D DC
Search for:
83 7E 24 00 8D 46 24 74 11 50 8D 4D DC
Replace with:
83 7E 24 FF 8D 46 24 75 11 50 8D 4D DC
Search for:
83 7E 28 00 8D 46 28 74 11 50 8D 4D DC
Replace with:
83 7E 28 FF 8D 46 28 75 11 50 8D 4D DC
Search for:
83 7E 2C 00 8D 46 2C 74 11 50 8D 4D DC
Replace with:
83 7E 2C FF 8D 46 2C 75 11 50 8D 4D DC
Search for:
83 7E 30 00 8D 46 30 74 11 50 8D 4D DC
Replace with:
83 7E 30 FF 8D 46 30 75 11 50 8D 4D DC
At the address 0x74AFD5
, you should find this pattern:
E8 58 A1 28 00
Replace with:
90 90 90 90 90
At the address 0x74AF61
, you should find this pattern:
E8 FE A1 28 00
Replace with:
90 90 90 90 90
At the address 0x9B83BE
, you should find this pattern:
E8 4F 49 CF FF
Replace with:
90 90 90 90 90
At the address 0x9B8346
, you should find this pattern:
E8 0B 4A CF FF
Replace with:
90 90 90 90 90
At the address 0xD26870
, you should find this pattern:
E8 F7 23 17 00
Replace with:
90 90 90 90 90
At the address 0xD267F0
, you should find this pattern:
E8 A9 24 17 00
Replace with:
90 90 90 90 90
At the address 0xCFE1C8
, you should find this pattern:
E8 0D 94 17 00
Replace with:
90 90 90 90 90
At the address 0xCFE148
, you should find this pattern:
E8 CF 94 17 00
Replace with:
90 90 90 90 90
This hexedit currently only exists for BL2 on Linux.
At the address 0x00B3B988
, you should find this pattern:
E8 E9 0C 5A FF
Replace with:
90 90 90 90 90
This edit allows UVHM to start from level 1, intended basically just for use with Kumakobi's Level 1 UVHM mod. Note that the hex edit in the description of that mod page is not correct, as of Feb 2024.
At the address 0xB4C14F
, you should find this pattern:
E8 CC FD FF FF 83 FE 32
Replace the last 32
with 01
, like so:
E8 CC FD FF FF 83 FE 01