CookiePLMonster / SilentPatch

SilentPatch for GTA III, Vice City, and San Andreas
MIT License
388 stars 15 forks source link

Random Crashes relating to "DisableStockVehiclesForSpecialVehicleFeature" function [GTA: SA] #115

Open kanadianborn opened 1 week ago

kanadianborn commented 1 week ago

when playing with the latest hotfix patch at seemingly random times the game will crash when using Crash info 1.2 + scrlog it points to Silentpatch.asi itself while scrlog shows no other script or mod to be the result of the crash i've removed all my vehicle related mods as well as some more for good measure to no avail, crash is inconsistent and happens at random but the cause in the log remains the same shown below

-----------[ Log From 2024-11-14 ]------------

GTA SA 1.0.0.0 US Unhandled exception at 0x6C24D197 in SilentPatchSA.asi (+0xd197): 0xC0000005: Access violation reading location 0x00000000. Register dump: EAX: 0x000003A6 EBX: 0x17A881A0 ECX: 0x00000000 EDX: 0x800C1FBC
EDI: 0x17A88170 ESI: 0x17A88188 EBP: 0x18BE4798 EIP: 0x6C24D197
ESP: 0x0177EACC EFL: 0x00210287 CS: 0x00000023 SS: 0x0000002B
GS: 0x0000002B FS: 0x00000053 ES: 0x0000002B DS: 0x0000002B

Stack dump:
    0x0177EACC:  3F61EF10 0177EC94 18C0D3E0 0177ECAC 0156136B 18C0D3E0
    0x0177EAE4:  18C0D3E0 0041E075 18C0D3E0 00000000 17A0FA68 0177EE00
    0x0177EAFC:  18C0D3E0 3F61EF10 431DDB99 00000014 3F61EF10 004147A1
    0x0177EB14:  00965A14 00000366 00965A08 00000000 009659FC 00000368
    0x0177EB2C:  0000006D 93C32260 3F431400 40233D00 43071860 00414E02
    0x0177EB44:  0177EB90 0177EB84 00414E22 18C050A8 00000000 C4CDA340
    0x0177EB5C:  C4CDC405 439C8100 43A5E4DC C4CD14C0 43A5E4DC C4CDC405
    0x0177EB74:  4200956B 00000000 410DE000 00000000 3EEC0000 408D4000
    0x0177EB8C:  C0C00000 3F431400 40233D00 43071860 43A5E4DC C4CDC405
    0x0177EBA4:  420F8766 C4CDC405 43A5E4DC C4CDC405 3B34D4D9 B9D81A4A
    base: 0x01580000   top: 0x0177EACC   bottom: 0x01780000

Backtrace (may be wrong):
    =>0x6C24D197 DisableStockVehiclesForSpecialVehicleFeature+0x7fc7 in SilentPatchSA.asi (+0xd197) (0x0177EAD8) 
      0x0156136B sub_15612E0+0x8b in gta-sa.exe (+0x116136b) (0x0177ECD0) 
      0x004F85E9 _ZN21CAEVehicleAudioEntity18PlayRoadNoiseSoundEsff+0x119 in gta-sa.exe (+0xf85e9) (0x0177ECE4) 
      0x004EFB80 _ZN15CAESoundManager15RequestNewSoundEP8CAESound+0x70 in gta-sa.exe (+0xefb80) (0x0177ECF4) 
      0x004F84A9 sub_4F8367+0x142 in gta-sa.exe (+0xf84a9) (0x0177ED0C) 
      0x004F87B1 _ZN21CAEVehicleAudioEntity17PlayFlatTyreSoundEsff+0x161 in gta-sa.exe (+0xf87b1) (0x0177ED44) 
      0x6B6F55A9 SetNewHandling+0xd649 in vehfuncs.asi (+0x355a9) (0x0177ED54) 
      0x6B6F6FFD SetNewHandling+0xf09d in vehfuncs.asi (+0x36ffd) (0x0177ED80) 
      0x006B52A7 _ZN11CAutomobile9ProcessAIERj+0xaa7 in gta-sa.exe (+0x2b52a7) (0x0177EDAC) 
      0x004F92D4 _ZN21CAEVehicleAudioEntity20ProcessRainOnVehicleER14cVehicleParams+0x14 in gta-sa.exe (+0xf92d4) (0x0177EDC8) 
      0x0050221E _ZN21CAEVehicleAudioEntity14ProcessVehicleEP9CPhysical+0x40e in gta-sa.exe (+0x10221e) (0x0177EE28) 
      0x005023C3 _ZN21CAEVehicleAudioEntity7ServiceEv+0x143 in gta-sa.exe (+0x1023c3) (0x0177EE30) 
      0x006D29D0 _ZN8CVehicle16UpdateClumpAlphaEv+0x50 in gta-sa.exe (+0x2d29d0) (0x0177EE3C) 
      0x006B1A7C _ZN11CAutomobile14ProcessControlEv+0x1fc in gta-sa.exe (+0x2b1a7c) (0x0177EE54) 
      0x0060111A _ZNK16CPedIntelligence14GetTaskJetPackEv+0xa in gta-sa.exe (+0x20111a) (0x0177EE5C) 
      0x005E1B61 _ZN4CPed14UpdatePositionEv+0x51 in gta-sa.exe (+0x1e1b61) (0x0177EE74) 
      0x006985F8 sub_6985E0+0x18 in gta-sa.exe (+0x2985f8) (0x0177EE7C) 
      0x0061A27F _ZN27CPlayerRelationshipRecorder28RecordRelationshipWithPlayerEPK4CPed+0xaf in gta-sa.exe (+0x21a27f) (0x0177EE88) 
      0x005E4CC5 _ZN4CPed20CalculateNewVelocityEv+0x75 in gta-sa.exe (+0x1e4cc5) (0x0177EEAC) 

-----------[ Log From 2024-11-13 ]------------

GTA SA 1.0.0.0 US Unhandled exception at 0x6931D197 in silentpatchsa.asi (+0xd197): 0xC0000005: Access violation reading location 0x00000000. Register dump: EAX: 0x000003A6 EBX: 0x19FE83D0 ECX: 0x00000000 EDX: 0x28F0AF38
EDI: 0x19FE83A0 ESI: 0x19FE83B8 EBP: 0x18093930 EIP: 0x6931D197
ESP: 0x0177E718 EFL: 0x00210287 CS: 0x00000023 SS: 0x0000002B
GS: 0x0000002B FS: 0x00000053 ES: 0x0000002B DS: 0x0000002B

Stack dump:
    0x0177E718:  2206CED0 0177E994 180D8BC8 0177E8A4 0156136B 180D8BC8
    0x0177E730:  180D8BC8 0041F125 180D8BC8 00000000 00B36B2C 00000800
    0x0177E748:  180D8BC8 2206CED0 2206CED0 00000014 2206CED0 45118EFF
    0x0177E760:  C48C7B07 41E07BCF 00533522 00000000 41FC3178 40FC3178
    0x0177E778:  BB3AF200 BE143560 3E28ACB2 45118EFF C48C7B07 41E07BCF
    0x0177E790:  0053426F 0177E79C 19FCBC90 45118EFF C48C7B07 41E07BCF
    0x0177E7A8:  00432477 0177E7C0 00B996F0 180DB428 0000006A 0000006B
    0x0177E7C0:  45118EFF C48C7B07 41E07BCF 0177EC50 00837440 FFFFFFFF
    0x0177E7D8:  004346F4 00B99704 180DB428 4512B0F2 C4925C38 451470F2
    0x0177E7F0:  C48EDC38 0177E834 41600000 28F20990 19FCA0B8 0177EB00
    base: 0x01580000   top: 0x0177E718   bottom: 0x01780000

Backtrace (may be wrong):
    =>0x6931D197 DisableStockVehiclesForSpecialVehicleFeature+0x7fc7 in silentpatchsa.asi (+0xd197) (0x0177E724) 
      0x0156136B sub_15704A0+0xffffffff in gta-sa.exe (+0x116136b) (0x0177E8CC) 
      0x004F84A9 sub_4F8367+0x142 in gta-sa.exe (+0xf84a9) (0x0177E8E4) 
      0x004F87B1 _ZN21CAEVehicleAudioEntity17PlayFlatTyreSoundEsff+0x161 in gta-sa.exe (+0xf87b1) (0x0177E978) 
      0x004F89DE _ZN21CAEVehicleAudioEntity22ProcessVehicleFlatTyreER14cVehicleParams+0x9e in gta-sa.exe (+0xf89de) (0x0177E984) 
      0x004F92D4 _ZN21CAEVehicleAudioEntity20ProcessRainOnVehicleER14cVehicleParams+0x14 in gta-sa.exe (+0xf92d4) (0x0177E9A0) 
      0x0050202B _ZN21CAEVehicleAudioEntity14ProcessVehicleEP9CPhysical+0x21b in gta-sa.exe (+0x10202b) (0x0177E9CC) 
      0x006BCD80 _ZN5CBike9ProcessAIERj+0x450 in gta-sa.exe (+0x2bcd80) (0x0177EA00) 
      0x005023C3 _ZN21CAEVehicleAudioEntity7ServiceEv+0x143 in gta-sa.exe (+0x1023c3) (0x0177EA08) 
      0x006D29D0 _ZN8CVehicle16UpdateClumpAlphaEv+0x50 in gta-sa.exe (+0x2d29d0) (0x0177EA14) 
      0x006B9354 _ZN5CBike14ProcessControlEv+0x104 in gta-sa.exe (+0x2b9354) (0x0177EA60) 
      0x77D01AC2 RtlWow64GetProcessMachines+0x162 in ntdll.dll (+0x61ac2) (0x0177EA9C) 
      0x77D017B0 RtlQueryPerformanceCounter+0xb0 in ntdll.dll (+0x617b0) 
CookiePLMonster commented 1 week ago

Do you have a crash dump? There may be one in %localappdata%\CrashDumps. Also FYI DisableStockVehiclesForSpecialVehicleFeature is a red herring, it's just the "last" symbol the ASI has before the crashing address.

kanadianborn commented 1 week ago

trying to get the crash dumps into a folder to send to u since the ones that are of interest are past 51 mb past the limit for github

kanadianborn commented 1 week ago

gta-sa.exe.2580.zip here ya go hopefully these can help pin point the issue

if you want to know what i have installed in my modloader folder feel free to ask

CookiePLMonster commented 1 week ago

Those crashlogs don't actually point at SP, the one from yesterday does not even have SilentPatch loaded and the today's one loaded SP at a different address range to the one from the above crashes. The crashdump from today crashes inside the Limit Adjuster, the one from yesterday - somewhere else. There are also hints of vectored crash handlers overflowing the stack, possibly from CrashInfo.SA.asi.

Try getting another crashdump without CrashInfo.SA.asi.

kanadianborn commented 1 week ago

gta_sa.exe.4192.dmp gta_sa.exe.17416.dmp gta_sa.exe.3032.dmp

here are some ones that u asked for since you just reminded me i did some tests without CrashInfo.SA.asi and maybe scrlog? im not sure if all of these ones dont have CrashInfo.SA.asi in them since im not filmier with how dump files work since im only a windows debugger noob with these kinds of files but hopefully this gives you some info u need, also im pretty sure SP being loaded at different ranges was because i moved SP in and out of modloader at various points to see if that was the issue

CookiePLMonster commented 1 week ago

None of those 3 have SilentPatch loaded. Whatever crash you're encontering appears to happen either before SP loaded, or there is something causing SP to unload entirely.

kanadianborn commented 1 week ago

Strange those dumps listed SP as the failing module in the windows debugger i dont know what would cause SP to unload but if it's any help i got MixSets also installed with most settings that could conflict with SP turned off of course as well as frameratevigilates high fps fixes mainly to fix the issue with strafing not working at times i play only at 60 fps just an fyi

kanadianborn commented 1 week ago

I'll try later on to grab a crashdump without crash log installed again but i have to be out of the house for a while tonight so i wont be able to comment till i get back thanks for the help and the work you've done to help keep this wonderful game alive and i hope to give you more info soon to help solve this issue since its been scratching my head for almost 1 and half weeks at this point,

kanadianborn commented 1 week ago

gta-sa.exe.20676.zip as per your request i got another crash dump without using crash log sorry for the wait

CookiePLMonster commented 1 week ago

This crash dump has SP in it but once again it got stuck on a stack overflow when crashing, and I can't tell if it crashed inside SP.

Do you still have this crash with Build 32, or without SP at all?

kanadianborn commented 1 week ago

i would have to test myself and see cause if it does not crash with the older version then i think it can help narrow down the issue can u send me a link for build 32 so i can install it and test from there?

CookiePLMonster commented 1 week ago

Build 32.1: SilentPatchSA.zip

The annoying thing about the crash you are encountering is that it doesn't even happen on the main thread, which means it's likely not the game's code, and SP is not spawning any extra threads. And since the stack overflows, I can't go back to see what it crashed on.

kanadianborn commented 1 week ago

so far i haven't had any crash with build 32.1 also i removed both scrlog.asi and CrashLogSA.asi and im currently doing some stress tests to see if the crashing is resolved

CookiePLMonster commented 1 week ago

I would check two mods specifically:

Those two are the most likely to be conflicting I think.

kanadianborn commented 1 week ago

Strange i haven't had any crashes since switching to build 32.1 as well as removing both scrlog.asi and CrashLogSA.asi the only annoyance i seem to be facing is the car being locked on the mission with sweet where you kill kane but that could also be cause by VehFuncs which im removing from my folder as i type

CookiePLMonster commented 1 week ago

This strongly hints at an incompatibility with some other mod then - the two I mentioned above would be my guess.

kanadianborn commented 1 week ago

I Will need to see what mods could be causing it since on the older Build of SP VehFuncs and Limit Adjuster are not causing crashes no more but on the Newer SP the Crashes are there

CookiePLMonster commented 1 week ago

Theory - try checking if your crash happens when:

Trying to check if it's indicative of an incompatibility with one of the fixes for detached parts.

kanadianborn commented 1 week ago

Funny you mention cause i just tried it out and it seems to be alright and the random crashes where occurring before i even installed VehFuncs my hunch is more on limit adjuster cause you mentioned previously that the dump files i sent u before pointed to limit adjuster being the cause rather then SP

kanadianborn commented 1 week ago

im going to update my Open Limit Adjuster since it might have been the root cause considering five days ago the git hub page released a new version stating "Prevent percentage memory calculation from overflowing (73)"

kanadianborn commented 1 week ago

gta-sa.exe.17540.zip heres another crash log does this one point to anything particular that can help me narrow it down? also what debugger you use to see dump files since im starting to think the method i use is not reliable enough anymore

CookiePLMonster commented 1 week ago

Yeah that crash is different, and with Build 32. It's crashing in CTaskManager::GetSimplestActiveTask, something (potentially a mod) calls it incorrectly. This one seems to be related to swimming.

kanadianborn commented 1 week ago

thats weird cause it crashed no where near a lake nor pool guess the npcs tried swimming through air to escape me out of fear then

kanadianborn commented 1 week ago

now that you mention swimming i think it might be related to frameratevigilates fps fixes cause it does mention fixing something about swimming

kanadianborn commented 1 week ago

just removed frameratevigilates fps fix mod and was able to get through a couple of missions without crashing and script related softlocks and that was also with VehFuncs installed we might have just found the culprit

CookiePLMonster commented 1 week ago

Yeah, at this point you should do the following:

  1. Grab the last SP again, verify that it is not crashing.
  2. Start re-adding your mods one by one.
kanadianborn commented 1 week ago

after switching to the lasted build of SP i crashed once again this time when i picked up a uzi from a fallen ballas log provided below gta-sa.exe.14268.zip

CookiePLMonster commented 1 week ago

OK great, this crash dump is inside SP and it points at a mistake I made! I don't know why it'd crash when picking up weapons because it happened while the cops were aborting the drive-by task, but regardless, it reveals a bug in my code.

Try testing with this: SilentPatchSA-issue-115-test.zip

kanadianborn commented 1 week ago

alright i'm gonna start testing it now i'll let you know if it works

kanadianborn commented 1 week ago

so far so good i haven't had any crashes yet i'll update you as i keep testing

kanadianborn commented 1 week ago

still have not crashed yet im doing some gang turf takeovers to stress test the pickups and no issues there yet as well

kanadianborn commented 1 week ago

i think its safe to say the issue has been pretty much remedied i got into one of those tense encounters where normally a random crash would happen and to my surprise and glee i did not crash even though i've been playing with the test build u sent for nearly an hour, Thank you so much and im glad to have helped push the bounds of SilentPatch just a little bit further i'll let you know if there is anymore crashing on my end caused by SP

CookiePLMonster commented 1 week ago

Excellent! It was a valid bug, I am surprised I haven't hit it myself while testing, but better late than never I guess.

I will keep this issue open for a bit longer, if you encounter no more crashes by the time I have Hotfix #⁠2 ready to release, I'll close it as resolved.

kanadianborn commented 1 week ago

gta-sa.exe.9288.zip don't know if its related to SilentPatch but i've been having some crashes on one of zeros mission so i thought i would share the log since it mentions that red herring you where talking about in the beginning

CookiePLMonster commented 1 week ago

Seems to be unrelated, crashed inside the SCM script.

kanadianborn commented 1 week ago

ah thank you i figured as such just needed conformation lol