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

startup output cleanup #5092

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions library/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1653,9 +1653,11 @@ bool Core::InitMainThread() {
// to faciliate the linux symbol discovery process (which runs without any symbols)
// or if --skip-size-check is discovered on the command line

if (df::global::global_table && df::global::game &&
df::global::game->command_line.original.find("--skip-size-check") == std::string::npos)
if (!df::global::global_table || !df::global::game ||
df::global::game->command_line.original.find("--skip-size-check") != std::string::npos)
{
std::cerr << "Skipping structure size verification check." << std::endl;
} else {
std::stringstream msg;
bool gt_error = false;
static const std::map<const std::string, const size_t> sizechecks{
Expand Down Expand Up @@ -1684,6 +1686,8 @@ bool Core::InitMainThread() {
errorstate = true;
return false;
}

std::cerr << "Structure size verification check passed." << std::endl;
}

perf_counters.reset();
Expand Down
12 changes: 9 additions & 3 deletions library/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ DFhackCExport const int32_t dfhooks_priority = 100;
// and the main event loop is initiated
DFhackCExport void dfhooks_init() {
if (getenv("DFHACK_DISABLE")) {
fprintf(stdout, "dfhack: DFHACK_DISABLE detected in environment; disabling\n");
fprintf(stderr, "dfhack: DFHACK_DISABLE detected in environment; disabling\n");
disabled = true;
return;
}

// we need to init DF globals before we can check the commandline
if (!DFHack::Core::getInstance().InitMainThread() || !df::global::game)
if (!DFHack::Core::getInstance().InitMainThread() || !df::global::game) {
disabled = true;
return;
}

const std::string & cmdline = df::global::game->command_line.original;
if (cmdline.find("--disable-dfhack") != std::string::npos) {
fprintf(stdout, "dfhack: --disable-dfhack specified on commandline; disabling\n");
fprintf(stderr, "dfhack: --disable-dfhack specified on commandline; disabling\n");
disabled = true;
return;
}

fprintf(stderr, "DFHack pre-init successful.\n");
}

// called from the main thread after the main event loops exits
Expand Down
16 changes: 12 additions & 4 deletions library/modules/DFSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,24 @@ using std::vector;
static DFLibrary *g_sdl_handle = nullptr;
static DFLibrary *g_sdl_image_handle = nullptr;
static const vector<string> SDL_LIBS {
"SDL2.dll",
#ifdef WIN32
"SDL2.dll"
#elif defined(_DARWIN)
"SDL.framework/Versions/A/SDL",
"SDL.framework/SDL",
"SDL.framework/SDL"
#else
"libSDL2-2.0.so.0"
#endif
};
static const vector<string> SDL_IMAGE_LIBS {
"SDL2_image.dll",
#ifdef WIN32
"SDL2_image.dll"
#elif defined(_DARWIN)
"SDL_image.framework/Versions/A/SDL_image",
"SDL_image.framework/SDL_image",
"SDL_image.framework/SDL_image"
#else
"libSDL2_image-2.0.so.0"
#endif
};

SDL_Surface * (*g_IMG_Load)(const char *) = nullptr;
Expand Down
8 changes: 6 additions & 2 deletions library/modules/DFSteam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ static const int DFHACK_STEAM_APPID = 2346660;
static bool g_steam_initialized = false;
static DFLibrary* g_steam_handle = nullptr;
static const std::vector<std::string> STEAM_LIBS {
"steam_api64.dll",
"libsteam_api.so",
#ifdef WIN32
"steam_api64.dll"
#elif defined(_DARWIN)
"steam_api" // TODO: validate this on OSX
#else
"libsteam_api.so"
#endif
};

bool (*g_SteamAPI_Init)() = nullptr;
Expand Down
Loading