Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Apr 2020
atom0s Offline OP
stranger
OP Offline
stranger
Joined: Apr 2020
While playing, I encountered a crash that appears to be known as seen by this thread:
http://forums.larian.com/ubbthreads.php?ubb=showflat&Number=500447

Through debugging the game, I've discovered this isn't due to being encumbered but rather being marked 'Too Heavy' which tries to block movement altogether. For some reason, this messages' floating text causes the game to crash when popped up in the manner its setup for. The crash, in the current Steam version (v1.506) is happening here:

Code
.text:0057E53D loc_57E53D:                             ; CODE XREF: sub_57E100+439↑j
.text:0057E53D                 call    edx
.text:0057E53F                 mov     eax, [esp+0A4h+var_68]
.text:0057E543                 mov     ecx, [esp+0A4h+var_6C]
.text:0057E547                 mov     edi, [esp+0A4h+var_90]
.text:0057E54B                 mov     edx, eax
.text:0057E54D                 sub     edx, ecx
.text:0057E54F                 sar     edx, 2
.text:0057E552                 test    byte ptr [edi+4], 1           <-- Flag for 'Too Heavy' message is 1..
.text:0057E556                 jz      short loc_57E587              <-- Jump is taken from this check..
.text:0057E558                 test    edx, edx
.text:0057E55A                 ja      short loc_57E569
.text:0057E55C                 call    __invalid_parameter_noinfo
.text:0057E561                 mov     eax, [esp+0A4h+var_68]
.text:0057E565                 mov     ecx, [esp+0A4h+var_6C]

//
// snipped code to reduce post size..
//

.text:0057E587 loc_57E587:                             ; CODE XREF: sub_57E100+456↑j
.text:0057E587                 mov     esi, [esp+0A4h+var_88]
.text:0057E58B                 cmp     esi, edx                     <-- Compare is invalid..
.text:0057E58D                 jb      short loc_57E59C             <-- Jump is not taken..
.text:0057E58F                 call    __invalid_parameter_noinfo   <-- Crash is here, due to invalid param info exception..
.text:0057E594                 mov     eax, [esp+0A4h+var_68]
.text:0057E598                 mov     ecx, [esp+0A4h+var_6C]


To fix this, we can patch the exe to prevent the first jump from happening.

Please note! I have not played long with this patch in place! So I cannot say for sure this will fix the crash and not affect anything else during gameplay! Please backup your saved games and your exe before making any changes that I explain below!!!

What You Need
- Beyond Divinity (Only tested with the Steam version. 1.506)
- A hex editor. (Any that can scan for byte patterns will work fine. I use 010 Editor personally.)

How To Patch This Code

1. Open your hex editor.
2. Open div.exe inside of the hex editor.
3. Go to the following file offset: 0x17D956
4. Change the 74 2F at this location to: 90 90
5. Save your div.exe and close the hex editor.

For other versions, you can attempt this patch as well by searching for the following byte pattern instead of using the direct file offset:
Code
2B D1 C1 FA 02 F6 47 04 01 74 2F


While using this pattern instead, change the last two bytes of the pattern from 74 2F to 90 90 like above.

This should fix the crash for this 'Too Heavy' floating message now and allow you to play as normal.
You will be blocked from moving while 'Too Heavy' vs. just being slowed down while 'Encumbered'.

Joined: May 2010
Location: Oxford
Duchess of Gorgombert
Offline
Duchess of Gorgombert
Joined: May 2010
Location: Oxford
Blimey. Well done finding that. However many years I've done programming, I still view assembly as witchcraft; disassembly, doubly so.


J'aime le fromage.
Joined: Apr 2020
atom0s Offline OP
stranger
OP Offline
stranger
Joined: Apr 2020
Originally Posted by vometia
Blimey. Well done finding that. However many years I've done programming, I still view assembly as witchcraft; disassembly, doubly so.


Thanks. smile Was there every any SDK or debug symbols (.pdb) released for the game? Seems a lot of the resources for the Divinity titles have disappeared over the years.

And if not, any plans to maybe release the current Steam version .pdb and/or header files / SDK? laugh

Last edited by atom0s; 08/04/20 05:01 AM.
Joined: May 2010
Location: Oxford
Duchess of Gorgombert
Offline
Duchess of Gorgombert
Joined: May 2010
Location: Oxford
Raze may be able to find out what's the deal with it; personally I haven't a clue, not least as my ideal of "SDK" is cc, make and vi... Anyway, I digress, it would be nice to at least be able to give those variables and constants some names!


J'aime le fromage.
Joined: Mar 2003
Location: Canada
Support
Offline
Support
Joined: Mar 2003
Location: Canada

No, there wasn't an SDK or pdb file released for the game, and currently I do not believe there are any plans to do so.

Joined: Apr 2020
atom0s Offline OP
stranger
OP Offline
stranger
Joined: Apr 2020
Originally Posted by Raze

No, there wasn't an SDK or pdb file released for the game, and currently I do not believe there are any plans to do so.


Aww frown Just finished the game too.

I can now confirm this fix works fine for the entire duration of the game with no side effects that I could tell/see. smile


Moderated by  Larian_QA, Lynn, Macbeth 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5