Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash at EnterCriticalSection #35

Closed
Lundar opened this issue Jun 20, 2018 · 1 comment
Closed

Crash at EnterCriticalSection #35

Lundar opened this issue Jun 20, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@Lundar
Copy link

Lundar commented Jun 20, 2018

First off great work. I might actually manage to contribute to a D1 project one of these days.

So I managed to compile and link the project. The first time I run it it crashes on startup (probably not that unexpected). I pull out the debugger and find its crashing engine.cpp line 1950. I put in some break points and find that InitializeCriticalSection is not being run for some reason. The struct at engine.cpp:1915 looks like a valid way of initializing the mutex to me, but for whatever reason isn't being run in my setup.

I moved the initialization function out of the struct and call it from start of WinMain. (Note there is already a proto for the function in engine.h). The game now starts. I start a new single player game, and another crash. This time another EnterCriticalSection but in dx.cpp. Same issue. For now I'm going to consolidate all the pre-main init functions, but do you guys have any insight on why this might be? Could it be being optimized out?

Im using Win7, Msys i686-w64-mingw32 (5.3.0 Rev2) to compile.

@ghost
Copy link

ghost commented Jun 21, 2018

It's definitely compiler related, since everything is executing fine on Mingw32/VC++. Either way, I don't think structs are the proper way to initialize them. As per the TODO:
3000 - Critical sections should be constructors using CCritSect
The PSX symbol file defines this as follows:
static CCritSect sgMemCrit;
Which is then used as a constructor in the class. This is likely the same problem I was having with newer versions of Visual Studio. Should get fixed as #13 develops.

Edit: I'm also using Win7 x64

@ghost ghost added the bug Something isn't working label Jun 21, 2018
@ghost ghost closed this as completed Apr 12, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant