Hey, it worked too! So my assumption that the bug is caused by uninitialized memory was correct! Awesome, thanks for the info, i suppose this solution is better than my workaround for doing the same thing the hard way, hehe.nice work Suslik
I think this is the laziest solution:// set the HEAP_ZERO_MEMORY flag for calls to HeapAlloc BACKUP ~blah_backup~ AUTHOR ~blah~ README ~~ VERSION ~v0~ BEGIN ~tob_spell_turning_workaround~ COPY ~bgmain.exe~ ~bgmain.exe~ WRITE_BYTE "0x0063951B" 0x08 WRITE_BYTE "0x0063AE6E" 0x08 WRITE_BYTE "0x00640E4B" 0x08
[RESOLVED] Spell protections bug
#21
Posted 01 January 2012 - 02:37 PM
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#22
Posted 06 January 2012 - 04:22 PM
I was investigating the problem in this thread for a while already: http://forums.gibber...showtopic=23754
I know you are a busy man and all and i'll try to summarize the info i currently have for you:
- Instead of being played normally, only the first frame of animation spsturni.bam appears in vanilla ToB game whenever a spell is reflected.
- The animation is played perfectly in vanilla SoA(without ToB)
- If I replace SoA's BGMain.exe with ToB's one it gets really glitchy due to lack of ToB's resources but I can load SoA's savegame with ToB's BGMain.exe and there is no reflection animation(only first frame again).
So I suggest that ToB's BGMain.exe fires spsturni.bam somehow wrong and only the first frame is played. SoA's BGMain.exe does it right on the other hand. If I am more or less able to debug ToB's executable(i know necessary function offsets), but i cannot do it with SoA's binary.
My question to you is: how do you suggest I can find the difference in spsturni.bam being fired in SoA's BGMain and ToB's one?
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#23
Posted 06 January 2012 - 09:03 PM
--------------
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)
#24
Posted 07 January 2012 - 01:42 AM
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#25
Posted 08 January 2012 - 11:12 AM
- "spsturni.bam" is fired somehow differently in SoA's BGMain.exe and ToB's one. This causes only the very first frame to be played in ToB.
- I know exact procedure address where it is called Both in SoA and ToB
- I have disassembled and then decompiled those two procedures.
Forgive me for posting such huge code listings, but I have failed to narrow the search range any further:
SoA's CReflectionSpellList::Update(), address 4605CB, it works well:
The same procedure in ToB's BGMain.exe, address 464BFB:
Most functions(i have checked about 95% of them) are 100% identical inside(of course addresses and offsets are different). But I only looked one level deeper(I did not compare functions inside functions and so on).
There was a minor difference in function 64C49B(one extra function was called in ToB and was not called in SoA), but editing it did not help(I have NOP'ed the function call).
Apparently both listings are quite similar. It seems like they only have different offsets and probably constants which I do not know.
Expected feedback:
- Amidoinitrite?
- Any info on functions/constants that were used in ToB's listing
- Any info on where else to look for the root of the problem
Edited by Suslik, 08 January 2012 - 12:23 PM.
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#26
Posted 08 January 2012 - 06:35 PM
--------------
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)
#27
Posted 08 January 2012 - 07:16 PM
I think I can do monotonous work like comparing all those functions myself, I want you just to tell me what to pay attention on. And where else to look.
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#28
Posted 08 January 2012 - 08:02 PM
Hmm, like I said, a bit hard without me delving into detail what's going on. I'll let you know when I do.I want you just to tell me what to pay attention on. And where else to look.
--------------
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)
#29
Posted 09 January 2012 - 04:07 AM
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#30
Posted 10 January 2012 - 06:01 PM
Not sure about the spell turning graphic yet.
--------------
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)
#31
Posted 10 January 2012 - 09:22 PM
Update: Turns out SoA 22941 still plays the spell turn graphic, and that this code is added somewhere between 22941 and 23037.
In void CVisualEffect::AIUpdate()
//using ToB26498 offsets mov edx, [ebp+var_34] mov eax, [edx+6450h] mov [ebp+var_1A0], eax mov ecx, [ebp+var_1A0] cmp ecx, ds:dword_AAD1D0 jnz short loc_654CCA mov edx, [ebp+var_2B4] mov eax, [edx+30h] mov [ebp+var_1A8], eax mov ecx, [ebp+var_34] mov [ebp+var_1A4], ecx mov edx, [ebp+var_1A4] mov eax, [ebp+var_1A8] mov [edx+6450h], eax jmp short loc_654D36 //if cre.eVisualEffect == -1, cre.eVisualEffect = this.e; ... loc_654CCA: mov ecx, [ebp+var_34] mov edx, [ecx+6450h] mov [ebp+var_1AC], edx mov eax, [ebp+var_2B4] mov ecx, [ebp+var_1AC] cmp ecx, [eax+30h] //if cre.eVisualEffect == this.e, ... jz short loc_654D36 mov edx, dword_B773CC mov eax, [edx+42BAh] mov [ebp+var_1B0], eax push 0FFFFFFFFh mov cl, ds:byte_AAD1CB push ecx mov edx, [ebp+var_2B4] mov eax, [edx+25Eh] push eax mov ecx, [ebp+var_1B0] add ecx, 37F6h call sub_676808 mov byte ptr [ebp+var_14], al mov ecx, [ebp+var_2B4] call sub_656D2E //purge! jmp loc_6561E8Since the spell turning graphic on the ground is already owned by the cre, the extra graphic gets purged because it is a new visual effect and doesn't have the same index (e) as the graphic on the ground.
Probably an unintentional bug created by a bugfix for something else, so we can't just remove this extra code.
Update2: So, you can simply make it play independently of the cre by not giving the VisualEffect an owner.
In void CProtectedSplList::Update(CCreatureObject&)
loc_465116: mov ecx, [ebp+var_100] mov [ebp+var_68], ecx mov [ebp+var_4], 0FFFFFFFFh mov edx, [ebp+var_68] mov [ebp+var_30], edx //pVisualEffect sub esp, 8 mov ecx, esp mov [ebp+var_70], esp push offset aSpsturni ; "spsturni" call sub_999EFB lea ecx, [ebp+var_40] call sub_64C310 mov [ebp+var_4], 3 lea ecx, [ebp+var_40] call sub_64C49B mov [ebp+var_44], eax //pVidCell mov eax, [ebp+var_20] add eax, 6 push eax mov ecx, [ebp+arg_0] add ecx, 6 push ecx call sub_8AD080 add esp, 8 movsx edx, ax mov eax, [ebp+var_44] mov [eax+30Ch], edx mov ecx, [ebp+var_44] mov dword ptr [ecx+7Ah], 8 mov edx, [ebp+var_44] mov byte ptr [edx+38Eh], 1 mov eax, [ebp+arg_0] mov ecx, [eax+30h] mov [ebp+var_C4], ecx //pCreatureObject->e mov edx, [ebp+var_30] mov eax, [ebp+var_C4] //------------------------------------------------------- nop me! mov [edx+25Eh], eax //pVisualEffect->eOwner //------------------------------------------------------- mov ecx, [ebp+var_30] mov dword ptr [ecx+52h], 1 mov edx, [ebp+arg_0] mov eax, [edx+6] mov ecx, [edx+0Ah] mov edx, [ebp+var_30] mov [edx+256h], eax mov [edx+25Ah], ecx mov eax, [ebp+arg_0] mov ecx, [eax+12h] mov [ebp+var_C8], ecx mov dl, ds:byte_AAA9EE push edx push 20h mov eax, [ebp+arg_0] add eax, 6 push eax mov ecx, [ebp+var_C8] push ecx mov ecx, [ebp+var_30] call sub_6561F8
Edited by Ascension64, 10 January 2012 - 10:40 PM.
--------------
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)
#32
Posted 11 January 2012 - 01:00 AM
Game Over Only on Party Dead (BGT/EasyTuTu/BG2)
WTP Familiars(BGT/BG2)
#33
Posted 12 January 2012 - 07:58 AM
Looks like the CProtectedSpl update counter at CCreatureObject+6448h doesn't get zero'ed, causing the problem that you fixed with zeroing memory.
Man, you're awesome.Update: Turns out SoA 22941 still plays the spell turn graphic, and that this code is added somewhere between 22941 and 23037.
I see. Apparently my asm comprehension skills fail to figure such complex issues myself. But why does it get purged only for being owned by the same creature? There are apparently a lot of graphics can be attached to 1 creature(spell protections/mirror images/globes/etc), why can't we attach one more?Since the spell turning graphic on the ground is already owned by the cre, the extra graphic gets purged because it is a new visual effect and doesn't have the same index (e) as the graphic on the ground.
Probably an unintentional bug created by a bugfix for something else, so we can't just remove this extra code.
It does work, but I have to call it only a workaround, because in SoA the animation is attached to cre and when creature walks, animation moves with it. But if we nullify its parent, it just stands where it was spawned. Do you see any ways to make it work without detaching it from cre?Update2: So, you can simply make it play independently of the cre by not giving the VisualEffect an owner.
and again, really great job.
Edited by Suslik, 12 January 2012 - 08:01 AM.
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#34
Posted 12 January 2012 - 11:02 PM
We can. A visual effect is essentially made up of a list of vid cells, and two lists of vef components. For various other visual effects, the engine would add a vid cell to the visual effect, if the creature already has an existing visual effect. The bugged code above is probably legacy in that it simply creates a visual effect, adds SPSTURNI vid cell, and sets the creature as its owner without actually checking beforehand whether the creature already had a visual effect.I see. Apparently my asm comprehension skills fail to figure such complex issues myself. But why does it get purged only for being owned by the same creature? There are apparently a lot of graphics can be attached to 1 creature(spell protections/mirror images/globes/etc), why can't we attach one more?
So a more complicated fix would be to check if the creature already has a visual effect, and if not make a visual effect containing SPSTURNI vid cell. If it already does, simply add the vid cell to it. I think there already exists a proc to do this, so we don't necessarily have to re-code it.It does work, but I have to call it only a workaround, because in SoA the animation is attached to cre and when creature walks, animation moves with it. But if we nullify its parent, it just stands where it was spawned. Do you see any ways to make it work without detaching it from cre?
However, I wonder why the bouncing animation should move with the creature. A spell bouncing off a wall should have the wall stationary and not moving.
--------------
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)
#35
Posted 13 January 2012 - 04:16 AM
well, it just looks somewhat weird when a creature with high movement speed(boots of speed, improved haste) can walk more than my screen's width while the animation is slowly floating stationary in the air.However, I wonder why the bouncing animation should move with the creature. A spell bouncing off a wall should have the wall stationary and not moving.
can you please send me 23037 executable? it's easier to compare with my 22941(?) than ToB.
Edited by Suslik, 13 January 2012 - 04:49 AM.
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#36
Posted 13 January 2012 - 07:09 AM
Isn't that - moving with the caster - the behaviour of all caster protections (mirror image, GOI, Otiluke etc) in the game?However, I wonder why the bouncing animation should move with the creature. A spell bouncing off a wall should have the wall stationary and not moving.
#37
Posted 13 January 2012 - 01:38 PM
Probably easier just to download the 23037 patch online and extract the cab.can you please send me 23037 executable? it's easier to compare with my 22941(?) than ToB.
These are continuous graphics though, like the spell turning graphic on the floor. The graphic that isn't showing is one that only plays when a spell bounces.Isn't that - moving with the caster - the behaviour of all caster protections (mirror image, GOI, Otiluke etc) in the game?
--------------
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)
#38
Posted 13 January 2012 - 04:08 PM
Turns out that if the visual effect isn't purged because the creature already has one, the vid cell itself is purged unless an effect re-applies it. So, it becomes incredibly tricky to achieve this.
--------------
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)
#39
Posted 13 January 2012 - 07:14 PM
but.. why? why did that not happen in earlier builds? and which functions(addresses i mean) are you currently investigating?Turns out that if the visual effect isn't purged because the creature already has one, the vid cell itself is purged unless an effect re-applies it. So, it becomes incredibly tricky to achieve this.
Howto: mage in Baldur's Gate. My lame guide.
List of issues I have encountered in BWP 10.3 tactical
Stutter-fixer for Infinity Engine
While you were reading this signature, I have probably edited the post above. Twice.
#40
Posted 14 January 2012 - 02:10 AM
Why is always a tough question to answer. I am reluctant to remove functioning code because it is likely to be part of a bugfix... there was lot wrong with unpatched Shadows of Amn.
--------------
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)