called from the main thread before the simulation thread is started and the main event loop is initiated
| 43 | // called from the main thread before the simulation thread is started |
| 44 | // and the main event loop is initiated |
| 45 | DFhackCExport void dfhooks_init() { |
| 46 | if (getenv("DFHACK_DISABLE")) { |
| 47 | fprintf(stderr, "dfhack: DFHACK_DISABLE detected in environment; disabling\n"); |
| 48 | disabled = true; |
| 49 | return; |
| 50 | } |
| 51 | |
| 52 | // we need to init DF globals before we can check the commandline |
| 53 | if (!DFHack::Core::getInstance().InitMainThread(std::filesystem::canonical(basepath)) || !df::global::game) { |
| 54 | // we don't set disabled to true here so symbol generation can work |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | const std::string & cmdline = df::global::game->command_line.original; |
| 59 | if (cmdline.find("--disable-dfhack") != std::string::npos) { |
| 60 | fprintf(stderr, "dfhack: --disable-dfhack specified on commandline; disabling\n"); |
| 61 | disabled = true; |
| 62 | return; |
| 63 | } |
| 64 | |
| 65 | fprintf(stderr, "DFHack pre-init successful.\n"); |
| 66 | } |
| 67 | |
| 68 | // called from the main thread after the main event loops exits |
| 69 | DFhackCExport void dfhooks_shutdown() { |
nothing calls this directly
no test coverage detected