kcat / dsoal

A DirectSound DLL replacer that enables surround sound, HRTF, and EAX support via OpenAL Soft
GNU Lesser General Public License v2.1
373 stars 49 forks source link

GTA San Andreas - Crash with Radio EQ option enabled #39

Open Kappa971 opened 2 years ago

Kappa971 commented 2 years ago

GTA San Andreas v1.0 crashes in the "Ryder" mission when CJ enters the barbershop. I have removed any mods or fixes. By removing DSOAL's dsound.dll file, no crashes. These are the errors present in the log file (DSOAL_LOGLEVEL=1): 3e8c:err:dsound:DSBuffer_Initialize Panning for multi-channel buffers is not supported 3e8c:fixme:dsound:DSBuffer_SetFX Cannot handle effect: {120ced89-3bf4-4173-a132-3cb406cf3231} 3e8c:fixme:dsound:DSBuffer_SetFX Cannot handle effect: {120ced89-3bf4-4173-a132-3cb406cf3231} 3e8c:fixme:dsound:DSBuffer_GetObjectInPath (0f5723f0)->({aa114de5-c262-4169-a1c8-23d698cc73b5}, 0, {c03ca9fe-fe90-4204-8078-82334cd177da}, 0177fcfc) : stub!

This is the complete log file: dsoal_log.zip

Kappa971 commented 2 years ago

In addition to the barber shop, it also happens in the bar and tattoo parlor without doing any mission. Typically this bug is present when particular mods are loaded but this is not the case (without DSOAL the game seems to work fine). The crash occurs in both Windows 10 and 11 and you need to add the following registry keys CURRENT_USER - Add dsound.zip (it is also needed for other games) to make the game use DSOAL's dsound.dll file and EAX.

It is a rather serious issue that doesn't allow the game to be completed, I hope it will be fixed soon (or at least make sure that the game doesn't crash). Thanks

EDIT Disabling the "Radio EQ" option from the game's audio settings, the crash no longer occurs. This old post explains what this option does:

In cars or other closed vehicles, the radio sound got balanced bass and treble.

In open vehicles, such as bikes, carts, quads, etc. it got no bass.

To solve it open Options, Audio Setup, then turn off the Radio EQ.

Note that after you deactivate it, all vehicles had the same radio sounds (the closed one) and Bass Boost from car modification won't give any effect.

It is therefore not an option of vital importance, however I leave the issue open to ensure that it is resolved in the future. Thanks

mirh commented 2 years ago

Also discussed at https://github.com/kcat/dsoal/issues/23#issuecomment-823958113 DirectSoundParamEqDMO and IDirectSoundFXParamEq not working properly sounds in fact a lot like closely related.

Kappa971 commented 2 years ago

Also discussed at #23 (comment) DirectSoundParamEqDMO and IDirectSoundFXParamEq not working properly sounds in fact a lot like closely related.

Unfortunately this is beyond my knowledge... Anyway, in my case the game doesn't crash when I get into a car (even with "Radio EQ" enabled), it only happens when you enter some buildings like bar, tattoo parlors, barber shop (I don't know which others are affected by this problem). With "Radio EQ" disabled, I played for over half an hour without any problems. I think it is still an issue that needs to be solved.

kcat commented 2 years ago

DirectSoundParamEqDMO and IDirectSoundFXParamEq not working properly sounds in fact a lot like closely related.

DirectSound's native FX API is not currently implemented. The SetFX method is a no-op (it essentially returns that it can't instantiate any effects), and GetObjectInPath simply returns a not-implemented error. I suppose the game is expecting it to work, so when it fails it tries to use a bad pointer. Might be fixable by clearing the 'returned' pointer to null instead of leaving it at its current value (if the game provides an old or uninitialized pointer value, and later checks it for null before use). Or it might need the functions to be implemented properly.

Kappa971 commented 2 years ago

DirectSound's native FX API is not currently implemented. The SetFX method is a no-op (it essentially returns that it can't instantiate any effects), and GetObjectInPath simply returns a not-implemented error. I suppose the game is expecting it to work, so when it fails it tries to use a bad pointer. Might be fixable by clearing the 'returned' pointer to null instead of leaving it at its current value (if the game provides an old or uninitialized pointer value, and later checks it for null before use). Or it might need the functions to be implemented properly.

I guess the best choice for it is to implement this function completely (maybe other games have problems of this type too), but obviously I don't know how much work it would take so in the end the choice is yours. Anyway thanks for your work.

kcat commented 2 years ago

With commit ed17110ba164d553310f232750af366694b86edc, GetObjectInPath clears the returned pointer, which hopefully may prevent the crash. The native FX API may take a while to properly support, since it seems to work fairly different from both EAX and EFX, so it will take time to work out how (or even if) it can be properly mapped.

Kappa971 commented 2 years ago

With commit ed17110, GetObjectInPath clears the returned pointer, which hopefully may prevent the crash. The native FX API may take a while to properly support, since it seems to work fairly different from both EAX and EFX, so it will take time to work out how (or even if) it can be properly mapped.

Unfortunately the game still crashes with the Radio EQ option enabled.

ThreeDeeJay commented 2 years ago

I also tried the latest DSOAL (and even the XP fork which fixed other 2 issues) with no luck 😔

On an side note, I was gonna open a new issue but I just found the but I was going to report isn't DSOAL-specific, but rather game-specific. When frame limiter is turned off, panning the camera quickly adds a weird pitch filter like the underwater/Zora Link voice filter from Majora's Mask. It happens with DSOAL, ALchemy and even XP. Apparently this happens because the game was a console port programmed to run at locked FPS, so turning off the frame limiter results in increased framerate at the cost of several (sometimes game-breaking) visual, physics, mechanics and of course, audio glitches. I even tried Framerate Vigilante, which is supposed to fix some framelimit-less-related issues and locks FPS to 60 instead of the original 30, but that still breaks audio, except it removes the only option (30FPS lock) that fixes this issue.

I know that's probably not within the scope of DSOAL, but this proposed fix for another issue might be https://github.com/kcat/openal-soft/issues/637

Kappa971 commented 2 years ago

The original GTA trilogy unfortunately must be played with the fps limiter enabled (30 fps) otherwise it causes the problems you described (I didn't know it also caused audio problems). GTA San Andreas, without SilentPatch, has the limiter at 25 fps. The Framerate Vigilante mod, the last time I checked, didn't fix all the problems so I opted to play all three games at 30fps (actually you don't notice much). Considering that remasters are bad, this is the only way.

mirh commented 2 years ago

The remasters are bad even in this department, they fixed none of the framerate issues (if not perhaps in the same half-assed ad-hoc way that framerate vigilante also employs).

Anyhow, I'd be curious to know if playing version 1.01 could somehow improve things. God forbid this was one fix that silentpatch didn't backport.

ThreeDeeJay commented 1 year ago

I know the cause is known, but I noticed the CrashInfo mod mentions something that might be useful (particularly the last few lines) so I thought I'd share:

GTA SA 1.0.0.0 US
Unhandled exception at 0x004F1BAB in gta_sa.exe (+0xf1bab): 0xC0000005: Access violation reading location 0x00000000.
    Register dump:
        EAX: 0x00000000  EBX: 0x00000000  ECX: 0x1C991750  EDX: 0x019DBFF5  
        EDI: 0x152B5290  ESI: 0x152B5290  EBP: 0x008CB6F8  EIP: 0x004F1BAB  
        ESP: 0x0177F588  EFL: 0x00210202  CS: 0x00000023   SS: 0x0000002B   
        GS: 0x0000002B   FS: 0x00000053   ES: 0x0000002B   DS: 0x0000002B   

    Stack dump:
        0x0177F588:  00000006 67BBFF02 0077F67C 00000000 00000004 00000004
        0x0177F5A0:  00000020 00000000 120CED89 41733BF4 B43C32A1 3132CF06
        0x0177F5B8:  00000000 00000000 00000020 00000000 120CED89 41733BF4
        0x0177F5D0:  B43C32A1 3132CF06 00000000 00000000 004F1F62 FFFFFFFA
        0x0177F5E8:  67BBFF01 004EB6EA FFFFFFFA 00200246 004EBAD8 00000002
        0x0177F600:  3F666666 00B6BC90 0177F67C 0050780A FFFFFFFA 0184BA90
        0x0177F618:  0184BA90 67B5B9F7 E0395473 0181D5F0 0177F708 FFFFFFFF
        0x0177F630:  0177F658 0177F648 6B1E13C7 017F0000 00000001 275D6360
        0x0177F648:  0177F674 6B1BF0E5 275D6360 49657355 48656C64 006B6F6F
        0x0177F660:  275D6360 0000000B 0000000F E0395473 0177F6C4 67B938C8
        base: 0x01580000   top: 0x0177F588   bottom: 0x01780000

    Backtrace (may be wrong):
        =>0x004F1BAB CAEStreamingChannel::AddFX+0xcb in gta_sa.exe (+0xf1bab) (0x0177F5DC) 
          0x004F1F62 _ZN19CAEStreamingChannel9SetBassEQEaf+0x32 in gta_sa.exe (+0xf1f62) 
mirh commented 1 year ago

*handwaves pretty hard at the fact that people did decompile the game and that function is in literal plain text* EDIT: also reminder that you should probably check this kind of issue against version 1.01 or at least by using silentpatch, because it might be as well that proper dsound behaviour is for the game to crash

ThreeDeeJay commented 1 year ago

@mirh I've been using SilentPatch but it doesn't seem to help. also decided to try 1.01, especially after reading a seemingly relevant fix in the changelog:

- Audio problems in interior / exterior transitions and getting in / out of cars fixed.

and got this:

gta-sa_RdlQpQlwPT but 1.01 still crashes even without SilentPatch. I tried installing CrashInfo but it doesn't seem to work with 1.01, just like most mods out there. and I checked the DSOAL log and it was pretty much the same as the OP's

mirh commented 1 year ago

I feel like you have missed another line of the changelog, anyway good to know this isn't it. Thanks and sorry.

mr-sihc commented 1 year ago

*handwaves pretty hard at the fact that people did decompile the game and that function is in literal plain text*

vice city and 3 but not SA

also this doesnt bring anything further because we know its the SetFX function