localcc / PalworldModdingKit

A modding kit for Palworld
299 stars 69 forks source link

EAV caused by Wwise #20

Closed Nixdorfer closed 8 months ago

Nixdorfer commented 8 months ago

Every time I try to start the mod preview, which is when I click the green play button, the game immediately crashes and displays the following message:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION writing address 0x000000000000035d
UnrealEditor_AkAudio!FAkAudioDevice::RemoveDefaultListener() [...\Plugins\Wwise\Source\AkAudio\Private\AkAudioDevice.cpp:3956]
UnrealEditor_AkAudio!TBaseRawMethodDelegateInstance<0,FAkAudioDevice,void __cdecl(bool),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [C:\Program Files\Epic Games\UE_5.1\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:476]
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

I've tried adding to .../Config/Windows/WindowsEngine.ini and writing:

[Audio]
AudioDeviceModuleName=
AudioMixerModuleName=

to fix this issue, but it didn't work. Restarting the computer also didn't help. Then, I tried a somewhat "burying my head in the sand" approach by commenting out the faulty line in the file, specifically the statement in ...\Plugins\Wwise\Source\AkAudio\Private\AkAudioDevice.cpp: in_pListener->IsDefaultListener = true; It sounds foolish, but I thought it might shift the problem elsewhere to provide more information. However, the error still stubbornly occurs at the same spot. Additionally, an error stating 'File not Found' occurred in the Project Settings > Wwise > Integration Settings > Wwise Project Path, because it points to a file Testing.wproj located in ../../Documents/WwiseProjects/Testing. I'm unsure if this is causing the issue, as I have never used Wwise before.

Nixdorfer commented 8 months ago

After some exploration, I found a solution to this issue. The main problem was that Wwise did not check for null pointers, leading to an EAV error. This error was caused by three sections of code: AkAudioDevice.cpp:3941in_pListener->IsDefaultListener = true; AkAudioDevice.cpp:3956in_pListener->IsDefaultListener = true; AkComponent.cpp:829Listener->Emitters.Remove(this); are problematic. The solution is to add nullptr checks to these lines, like so:

if (in_pListener != nullptr) {
    in_pListener->IsDefaultListener = true;
}
if (in_pListener != nullptr) {
    in_pListener->IsDefaultListener = true;
}
for (auto Listener : Listeners) {
    if (Listener != nullptr) {
        Listener->Emitters.Remove(this);
    }
}

Finally, to fix this issue, close the currently running project, delete the Binaries, Intermediate, and Saved folders in the SDK directory, and recompile the cache.

Wastarch commented 8 months ago

after changed the code,it still have error AkAudioDevice.cpp:3959

Nixdorfer commented 8 months ago

after changed the code,it still have error AkAudioDevice.cpp:3959

What‘s ur error code, EAV? Or provide us ur log.

yuejiewudi1997 commented 6 months ago

谢谢,非常有效!