Gotham Knights

Gotham Knights

View Stats:
html99 Jan 6, 2023 @ 2:34am
23
16
8
12
3
5
5
2
3
2
2
36
Unofficial patch to fix the constant crashing
Got tired of the game crashing constantly so I debugged the game and wrote my own patch/workaround. Installation instructions are below. The crash is occurring in one of the functions in the game's audio library. This patch bypasses the part of the function that causes the crash. I've played several hours with my patch installed on both my windows laptop and on my steam deck without seeing any more crashes nor have I noticed any issues with the game's audio.

That said, install this patch at your own risk. It shouldn't break anything but, if it somehow does, I take no responsibility for it nor does it come with any kind of warranty.

Before continuing, please note that this patch is only for the 12/14/2022 version of the game (the latest version at the time that I'm writing this). If you try to install it on a newer version, it will simply do nothing and leave the game's files unchanged.



To install the patch:
1. If on a Steam Deck, switch to the desktop (Steam Button > Power > Switch to Desktop)
2. Open your Library in Steam
3. Open the folder Gotham Knights is installed to by right clicking on it and selecting Properties > Local Files > Browse
4. Continue from the set of steps below which correspond to your OS



To continue installing the patch on Windows:
5. Open Powershell by clicking the address bar in Explorer, typing "powershell" (without quotes) and pressing enter
6. Copy and paste the below commands into Powershell and press enter

$data = [System.IO.File]::ReadAllBytes('Mercury/Binaries/Win64/GothamKnights.exe')
if ( (Get-FileHash -InputStream ([System.IO.MemoryStream] $data) -Algorithm SHA1).Hash -eq '8117FB002B7C3DD2388C9F0B111197C30DB01496' )
{
$data[0x20A7716] = 0x40
$data[0x20A7717] = 0x85
$data[0x20A7718] = 0xC0
$data[0x20A7719] = 0x90
[System.IO.File]::WriteAllBytes('Mercury/Binaries/Win64/GothamKnights.exe', $data)
}
Write-Output (("`n" * 3) + [System.Text.Encoding]::ASCII.GetString(@(68, 111, 110, 101, 33)) + "`n")

7. Wait several seconds for the commands to finish. You can tell they're done when the word "Done!" is displayed.
8. Your game should now be patched. You can now close Explorer and Powershell.



To continue installing the patch on Linux and SteamOS:
5. Open a terminal in folder Gotham Knights is installed in. On SteamOS, this can be done by right clicking on the folder's background (the big dark gray area) and selecting "Open Terminal Here". The exact steps may be different for other OS's.
6. Type "python3" (without quotes) in the terminal and press enter
7. Copy and paste the below commands into the terminal and press enter

import sys, hashlib
fh = open('Mercury/Binaries/Win64/GothamKnights.exe', 'rb') ; data = fh.read() ; fh.close()
data = data.replace(bytes.fromhex('483942407553488b8318310000'), bytes.fromhex('4085C0907553488b8318310000')) if hashlib.sha1(data).hexdigest() == '8117fb002b7c3dd2388c9f0b111197c30db01496' else data
fh = open('Mercury/Binaries/Win64/GothamKnights.exe', 'wb') ; fh.write(data) ; fh.close()
sys.exit(('\n'*3)+bytes.fromhex('446f6e6521').decode())

7. Wait several seconds for the commands to finish. You can tell they're done when the word "Done!" is displayed.
8. Your game should now be patched. You can now close the file browser and terminal.



To uninstall the patch:

1. Open your Library in Steam
2. Right click on Gotham Knights (If on a Stem Deck in gaming mode, press the Start Button instead)
3. Select Properties > Local Files > Verify integrity of game files



To any of the developers reading this post:

The details of the exception causing the crash are included below. Please reach out to me and I can send you a full crash dump.

(40bc.3600): Access violation - code c0000005 (first/second chance not available)
GothamKnights!AK::WriteBytesCount::SetCount+0x75cc79:
00000001`41dad2f9 80781500 cmp byte ptr [rax+15h],0 ds:00000000`00000015=??
0:000> .ecxr
rax=0000000000000000 rbx=00000000ffffffff rcx=0000000000000000
rdx=00000000c13cfb50 rsi=0000000000000000 rdi=00000000c13cfb50
rip=0000000141dad2f9 rsp=00000000c13cfae0 rbp=000000024f2c2c80
r8=000000024f2c2740 r9=0000000000007706 r10=000000015d2a5560
r11=000000015d2a5560 r12=0000000000000000 r13=0000000000000000
r14=000000024f2c2c80 r15=0000000000000001
iopl=0 nv up ei pl zr na po nc
cs=0033 ss=002b ds=0000 es=0000 fs=0000 gs=0000 efl=00010244
GothamKnights!AK::WriteBytesCount::SetCount+0x75cc79:
00000001`41dad2f9 80781500 cmp byte ptr [rax+15h],0 ds:00000000`00000015=??
< >
Showing 1-15 of 157 comments
Nighttear Jan 6, 2023 @ 5:13am 
Just a heads up to the OP, I shared this link to this post on the Gotham Knights Official Discord. Hopefully that will have a better chance that the Devs see it and fix the problem.
Blackwolfe Jan 6, 2023 @ 5:42am 
Works well so far, though even if I was in the correct directory I had to put in the full path as just "Mercury/Binaries/Win64/GothamKnights.exe" wouldn't cut it.
Last edited by Blackwolfe; Jan 6, 2023 @ 5:42am
<>...mAma:)) Jan 6, 2023 @ 6:05am 
Save and post a link to the full crashdump and any other information you wish the devs to have.
Kizlev101 Jan 6, 2023 @ 7:27am 
Thank you so much for sharing this with the community. It's a shame that you had to do the work for paid devs and testers that are supposed to catch these things prior to release. WB should compensate you for your time, but they won't. It's becoming such a huge problem throughout the games industry where companies are relying on unpaid fans to fix or improve their work for them through mods or code fixes like this.
Blackwolfe Jan 6, 2023 @ 7:31am 
Originally posted by Kizlev101:
Thank you so much for sharing this with the community. It's a shame that you had to do the work for paid devs and testers that are supposed to catch these things prior to release. WB should compensate you for your time, but they won't. It's becoming such a huge problem throughout the games industry where companies are relying on unpaid fans to fix or improve their work for them through mods or code fixes like this.

*cough* Bethesda *cough*
Deckard Jan 6, 2023 @ 8:13am 
The game is still crashing with this patch applied. Maybe less often, not sure. But thanks for your work.
Deckard Jan 6, 2023 @ 9:55am 
Yes clearly less often :steamthumbsup:
ChubbiChibbai Jan 6, 2023 @ 10:27am 
I'm so furious that they 'patched' the game and basically broke it. The constant crashes made it not worth playing for me. The fact that they still haven't acknowledged is frustrating. Really terrible developers over in Montreal by the sounds of things.
Kizlev101 Jan 6, 2023 @ 10:40am 
Originally posted by dirtyCAT:
I'm so furious that they 'patched' the game and basically broke it. The constant crashes made it not worth playing for me. The fact that they still haven't acknowledged is frustrating. Really terrible developers over in Montreal by the sounds of things.
Yeah, no communication about these crashes anywhere is very telling. They eff'd up and they know it. WB's PR people probably telling the devs to keep their traps shut and just quietly release a patch under the radar and pretend like the crashes they created never happened once it's fixed.

Seems like they rushed the last patch likely due to the pressure of the holiday sales. Happens a lot with other developers working on live service games (yes, I know GK isn't technically a live service, but it has the bones of one). They resolved some of the lingering framerate issues, but didn't do enough QA testing to catch this new problem they created.
NSave Jan 6, 2023 @ 10:52am 
Can confirm that after PS command the game's much more stable, been able to roam for a while without any crash. But note that as Blackwolfe mentioned above, you'll need the full path to the .exe in the command in order to work.
Trin Jan 6, 2023 @ 12:19pm 
I really appreciate the effort you made, but I still got a crash the moment I started riding the bike.
Victoria Jan 6, 2023 @ 12:21pm 
Thank you, OP. You are the hero Gotham Knights deserves.
Blackwolfe Jan 6, 2023 @ 12:42pm 
Originally posted by Trin:
I really appreciate the effort you made, but I still got a crash the moment I started riding the bike.

Did the command run fully without errors?
starlord3689 Jan 6, 2023 @ 1:59pm 
Thank you. Played it for 2 hours with zero issues after I applied the patch :)
Zormac Jan 6, 2023 @ 3:33pm 
How about the constant multiplayer disconnects? Is it because of their servers or is it client-side?
< >
Showing 1-15 of 157 comments
Per page: 1530 50