gottyduke / SF_PluginTemplate

Plugin template for SFSE plugins. click "Use this template" to generate your project.
GNU General Public License v3.0
39 stars 7 forks source link

Suggestion: Replace the !IsDebuggerPresent() loop with a MessageBox #6

Closed igromanru closed 1 year ago

igromanru commented 1 year ago

Currently the !IsDebuggerPresent() loop in the Debug build will freeze the process until you attach a debugger. If you start the game by accident with your debug build or simply don't need a debugger to test something, you're forced to attach a debugger, no way around.

#ifndef NDEBUG
    while (!IsDebuggerPresent()) {
        Sleep(100);
    }
#endif

What I like to use instead, is a MessageBox. The MessageBox will "freeze" the process in place as well, but you can simply click on OK to continue or attach a debugger first.

#ifndef NDEBUG
    MessageBoxA(NULL, "Loaded. You can attach the debugger now", "Plugin Name", NULL);
#endif

Just wanted to share the idea.

gottyduke commented 1 year ago

Good call,thank you for the addition!