Skip to content

Commit 730ae37

Browse files
authored
Merge pull request #5092 from myk002/myk_cleanup
startup output cleanup
2 parents 16117b3 + 9ed2926 commit 730ae37

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

library/Core.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,9 +1653,11 @@ bool Core::InitMainThread() {
16531653
// to faciliate the linux symbol discovery process (which runs without any symbols)
16541654
// or if --skip-size-check is discovered on the command line
16551655

1656-
if (df::global::global_table && df::global::game &&
1657-
df::global::game->command_line.original.find("--skip-size-check") == std::string::npos)
1656+
if (!df::global::global_table || !df::global::game ||
1657+
df::global::game->command_line.original.find("--skip-size-check") != std::string::npos)
16581658
{
1659+
std::cerr << "Skipping structure size verification check." << std::endl;
1660+
} else {
16591661
std::stringstream msg;
16601662
bool gt_error = false;
16611663
static const std::map<const std::string, const size_t> sizechecks{
@@ -1684,6 +1686,8 @@ bool Core::InitMainThread() {
16841686
errorstate = true;
16851687
return false;
16861688
}
1689+
1690+
std::cerr << "Structure size verification check passed." << std::endl;
16871691
}
16881692

16891693
perf_counters.reset();

library/Hooks.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@ DFhackCExport const int32_t dfhooks_priority = 100;
1111
// and the main event loop is initiated
1212
DFhackCExport void dfhooks_init() {
1313
if (getenv("DFHACK_DISABLE")) {
14-
fprintf(stdout, "dfhack: DFHACK_DISABLE detected in environment; disabling\n");
14+
fprintf(stderr, "dfhack: DFHACK_DISABLE detected in environment; disabling\n");
1515
disabled = true;
1616
return;
1717
}
1818

1919
// we need to init DF globals before we can check the commandline
20-
if (!DFHack::Core::getInstance().InitMainThread() || !df::global::game)
20+
if (!DFHack::Core::getInstance().InitMainThread() || !df::global::game) {
21+
disabled = true;
2122
return;
23+
}
24+
2225
const std::string & cmdline = df::global::game->command_line.original;
2326
if (cmdline.find("--disable-dfhack") != std::string::npos) {
24-
fprintf(stdout, "dfhack: --disable-dfhack specified on commandline; disabling\n");
27+
fprintf(stderr, "dfhack: --disable-dfhack specified on commandline; disabling\n");
2528
disabled = true;
29+
return;
2630
}
31+
32+
fprintf(stderr, "DFHack pre-init successful.\n");
2733
}
2834

2935
// called from the main thread after the main event loops exits

library/modules/DFSDL.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,24 @@ using std::vector;
2222
static DFLibrary *g_sdl_handle = nullptr;
2323
static DFLibrary *g_sdl_image_handle = nullptr;
2424
static const vector<string> SDL_LIBS {
25-
"SDL2.dll",
25+
#ifdef WIN32
26+
"SDL2.dll"
27+
#elif defined(_DARWIN)
2628
"SDL.framework/Versions/A/SDL",
27-
"SDL.framework/SDL",
29+
"SDL.framework/SDL"
30+
#else
2831
"libSDL2-2.0.so.0"
32+
#endif
2933
};
3034
static const vector<string> SDL_IMAGE_LIBS {
31-
"SDL2_image.dll",
35+
#ifdef WIN32
36+
"SDL2_image.dll"
37+
#elif defined(_DARWIN)
3238
"SDL_image.framework/Versions/A/SDL_image",
33-
"SDL_image.framework/SDL_image",
39+
"SDL_image.framework/SDL_image"
40+
#else
3441
"libSDL2_image-2.0.so.0"
42+
#endif
3543
};
3644

3745
SDL_Surface * (*g_IMG_Load)(const char *) = nullptr;

library/modules/DFSteam.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ static const int DFHACK_STEAM_APPID = 2346660;
1919
static bool g_steam_initialized = false;
2020
static DFLibrary* g_steam_handle = nullptr;
2121
static const std::vector<std::string> STEAM_LIBS {
22-
"steam_api64.dll",
23-
"libsteam_api.so",
22+
#ifdef WIN32
23+
"steam_api64.dll"
24+
#elif defined(_DARWIN)
2425
"steam_api" // TODO: validate this on OSX
26+
#else
27+
"libsteam_api.so"
28+
#endif
2529
};
2630

2731
bool (*g_SteamAPI_Init)() = nullptr;

0 commit comments

Comments
 (0)