ersh1 / OpenAnimationReplacer

GNU General Public License v3.0
34 stars 8 forks source link

Crash on plugin load #13

Closed Telanor closed 4 months ago

Telanor commented 4 months ago

I'm unable to get versions from 2.3.0 and newer to load. Loading 2.3.6, SKSE64.log shows plugin OpenAnimationReplacer.dll (00000001 OpenAnimationReplacer 02030060) couldn't load plugin 998 (handle 4)

I wrote a stupid simple program to call LoadLibrary on the dll, it throws the same error code (998), but in debug mode I can get this callstack:

    msvcp140.dll!000007fedce22f58() Unknown
    [Inline Frame] OpenAnimationReplacer.dll!std::_Mutex_base::lock() Line 52   C++
    [Inline Frame] OpenAnimationReplacer.dll!std::unique_lock<std::mutex>::{ctor}(std::mutex &) Line 144    C++
    [Inline Frame] OpenAnimationReplacer.dll!REL::Module::get() Line 703    C++
    [Inline Frame] OpenAnimationReplacer.dll!REL::Module::GetRuntime() Line 846 C++
    OpenAnimationReplacer.dll!REL::VariantID::offset() Line 1702    C++
    [Inline Frame] OpenAnimationReplacer.dll!REL::VariantID::address() Line 1696    C++
    OpenAnimationReplacer.dll!`dynamic initializer for 'g_dwTlsIndex''() Line 3 C++
    ucrtbase.dll!_initterm()   Unknown
>   OpenAnimationReplacer.dll!dllmain_crt_process_attach(HINSTANCE__ * const instance, void * const reserved) Line 66   C++
    OpenAnimationReplacer.dll!dllmain_dispatch(HINSTANCE__ * const instance, const unsigned long reason, void * const reserved) Line 276    C++
    ntdll.dll!LdrpRunInitializeRoutines()  Unknown
    ntdll.dll!LdrpLoadDll()    Unknown
    ntdll.dll!LdrLoadDll() Unknown
    KernelBase.dll!000007fefd40b91a()   Unknown
    ConsoleApplication1.exe!main() Line 10  C++
    ConsoleApplication1.exe!invoke_main() Line 79   C++
    ConsoleApplication1.exe!__scrt_common_main_seh() Line 288   C++
    ConsoleApplication1.exe!__scrt_common_main() Line 331   C++
    ConsoleApplication1.exe!mainCRTStartup(void * __formal) Line 17 C++
    kernel32.dll!000000007738556d() Unknown
    ntdll.dll!RtlUserThreadStart() Unknown

With the error: Exception thrown at 0x000007FEDCE22F58 (msvcp140.dll) in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

I spent hours trying to compile OAR myself but vcpkg refuses to work for me. It seems they broke it for windows 7.

My best guess is there's something wonky happening with the static initialization, something isn't being initialized in time for this call. I'm having a hard time even figuring out which code this is calling because VS is telling me the source code I tried to load doesn't match what the 2.3.6 dll was compiled with. I'm guessing this isn't happening for everyone so depending on what code is being shared across plugins, it might work when some other plugin(s) are run before OAR, or possibly even a difference in init order due to being on win7.

I'm running skse64_1_6_1170, SkyrimSE, win7 x64.

ersh1 commented 4 months ago

Have you read the sticky posts on the Nexus page? This kind of seems like it is the same issue: You need to have VC Redist up to date. It's an extremely frustrating situation because it seems some completely unrelated installations/updates can even downgrade your current version. This shouldn't be happening at all, but here we are.

Telanor commented 4 months ago

Ahhh, the one time I didn't check the comments section. Yep that fixed it, sorry for the needless report. Thanks!