Jump to content


Photo

Possible Bug with ToBEx 21+ and WINE


  • Please log in to reply
4 replies to this topic

#1 nirraven

nirraven
  • Member
  • 5 posts

Posted 24 January 2012 - 12:19 PM

Hi,
It seems that the latest two builds fail to patch the BGMain.exe when running Baldurs Gate in WINE (www.winehq.org). WINE is a wrapper to run Windows application in Linux and OS X and probably the best way to run Infinity Engine games on OS X.
The ToBEx Version 20 works fine.
The TobEx.log shows following: Build 0.20 works, 0.21 and 0.22 give
"ApplyPatch(): WriteProcessMemory failed, address: 0x93fffe, error code: 317"
error


I can start a game but it crashes after any spell is cast.
I run the latest wine (1.3.37) version, but older versions have the same problem.
My System is OS X Lion.
Attached is my LastRunWine.log and my TobEx.log
For the latest two starts i have activated all options in the DEBUG Section in the .ini

Attached Files


Edited by nirraven, 24 January 2012 - 02:02 PM.


#2 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 24 January 2012 - 11:10 PM

Hi,

It is good to see that TobEx works well on Wine (mostly). I am unsure what is going on here, as it appears that only a single patch isn't being applied. You can work around this by opening ./TobEx_ini/TobExCore.ini and changing

[Spells]
Casting Fixes=1

such that "Casting Fixes=0

The error code doesn't really help me because the code indicates it can't find the error message, so I'm a bit stumped on this one.

Let me know if this works around things for the time being.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#3 nirraven

nirraven
  • Member
  • 5 posts

Posted 25 January 2012 - 12:18 AM

Yes, the game patches with "Casting Fixes=0".

#4 i30817

i30817
  • Member
  • 611 posts

Posted 25 January 2012 - 04:58 AM

Wine is sometimes more sensitive to coding errors (stack corruption mostly) than windows.
Planescape Torment UB had a problem like that recently.

I haven't played BGT in a while, so no confirmation yet, but i was crashing on heavy spellcasting battles until i enabled the "turnbased mode" - but this was at runtime, not on patching. Can't recall the TobEx version i used either.

http://www.softwarev...com/blog/?p=376

Not just performance problems either!

In addition to the performance problems mentioned above there is another, more important consideration to be aware of: On x64 Windows operating systems you must have the stackframe correctly aligned. Correct stack alignment on x64 systems means that the stack frame must be aligned on a 16 byte boundary.
Failure to ensure that this is the case will mean that a few Windows API calls will fail with the cryptic error code ERROR_NOACCESS (hex: 0x3E6, decimal: 998). This means “Invalid access to memory location”.
The problem with the error code ERROR_NOACCESS in this case is that the real error code that gets converted into ERROR_NOACCESS is STATUS_DATATYPE_MISALIGNMENT, which tells you a lot more. I spent quite a bit of time digging around until I found the true error code for the bug I was chasing that lead me to write this article.
If you are writing code using a compiler, the compiler will sort the stack alignment details out for you. However if you are writing code in assembler, or writing hooks using dynamically created machine language, you need to be aware of the 16 byte stack alignment requirement.


Edited by i30817, 25 January 2012 - 05:42 AM.


#5 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 25 January 2012 - 02:34 PM

I shouldn't run into x64 problems, because I am developing a 32-bit application. If Wine has trouble with stack alignments, then TobEx should fail really badly, because I have to use 8-bit alignment to replicate some of the engine structures in lots of places. That only one hack is failing to write into memory is just weird. However, it is the biggest hack of them all, so maybe trimming down might work...

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)