diff --git a/modules/otclient/otclient.otmod b/modules/otclient/otclient.otmod index c5425b89..22a2841a 100644 --- a/modules/otclient/otclient.otmod +++ b/modules/otclient/otclient.otmod @@ -15,4 +15,4 @@ Module - textmessage - chat - outfit - + - tibiafiles diff --git a/modules/tibiafiles b/modules/tibiafiles deleted file mode 160000 index 8bb3b7d6..00000000 --- a/modules/tibiafiles +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8bb3b7d6d86e561be4622fbe7dbef208446a0319 diff --git a/src/framework/core/logger.cpp b/src/framework/core/logger.cpp index 2c8dde75..3210801c 100644 --- a/src/framework/core/logger.cpp +++ b/src/framework/core/logger.cpp @@ -22,6 +22,7 @@ #include "logger.h" #include "eventdispatcher.h" +#include Logger g_logger; @@ -47,6 +48,7 @@ void Logger::log(Fw::LogLevel level, std::string message) if(level == Fw::LogFatal) { m_terminated = true; + g_platform.displayFatalError(message); exit(-1); } } diff --git a/src/framework/core/modulemanager.cpp b/src/framework/core/modulemanager.cpp index 8e861417..cd09bedf 100644 --- a/src/framework/core/modulemanager.cpp +++ b/src/framework/core/modulemanager.cpp @@ -42,7 +42,7 @@ void ModuleManager::discoverAndLoadModules() for(const ModulePtr& module : m_modules) { if(!module->isLoaded() && module->autoLoad()) { if(!module->load()) - logFatal("cannot continue to run"); + logFatal("A required module has failed to load, cannot continue to run."); } } } diff --git a/src/framework/core/resourcemanager.cpp b/src/framework/core/resourcemanager.cpp index ecf5e12e..3dd2539e 100644 --- a/src/framework/core/resourcemanager.cpp +++ b/src/framework/core/resourcemanager.cpp @@ -52,7 +52,7 @@ void ResourceManager::init(const char* argv0, const char *appName) } if(!found) - logFatal("could not find modules directory"); + logFatal("Could not find modules directory."); // setup write directory std::string dir = g_platform.getAppUserDir(); diff --git a/src/framework/platform/platform.h b/src/framework/platform/platform.h index 1127c823..409b8aba 100644 --- a/src/framework/platform/platform.h +++ b/src/framework/platform/platform.h @@ -82,6 +82,8 @@ public: /// Get the app user directory, the place to save files configurations files std::string getAppUserDir(); + void displayFatalError(const std::string& message); + private: int m_lastTicks; }; diff --git a/src/framework/platform/win32platform.cpp b/src/framework/platform/win32platform.cpp index 744e5c56..62110e4d 100644 --- a/src/framework/platform/win32platform.cpp +++ b/src/framework/platform/win32platform.cpp @@ -289,7 +289,7 @@ void Platform::init(PlatformListener* platformListener, const char *appName) wc.lpszClassName = win32.appName.c_str(); // Set The Class Name if(!RegisterClassA(&wc)) - logFatal("FATAL ERROR: Failed to register the window class."); + logFatal("Failed to register the window class."); // force first tick updateTicks(); @@ -737,3 +737,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } return 0; } + +void Platform::displayFatalError(const std::string& message) +{ + MessageBoxA(NULL, message.c_str(), "Fatal Error", MB_OK | MB_ICONERROR); +} + diff --git a/src/framework/platform/x11platform.cpp b/src/framework/platform/x11platform.cpp index 2aa31325..f2380371 100644 --- a/src/framework/platform/x11platform.cpp +++ b/src/framework/platform/x11platform.cpp @@ -962,3 +962,8 @@ std::string Platform::getAppUserDir() logError("Couldn't create directory for saving configuration file. (",sdir.str(),")"); return sdir.str(); } + +void Platform::displayFatalError(const std::string& message) +{ + // nothing to do +} diff --git a/src/otclient/otclient.cpp b/src/otclient/otclient.cpp index a965f429..9929dec7 100644 --- a/src/otclient/otclient.cpp +++ b/src/otclient/otclient.cpp @@ -80,9 +80,6 @@ void OTClient::init(std::vector args) // initialize event dispatcher g_dispatcher.init(); - // initialize network - //g_network.init(); - // initialize the ui g_ui.init(); @@ -91,6 +88,11 @@ void OTClient::init(std::vector args) // discover and load modules g_modules.discoverAndLoadModules(); g_modules.getModule("otclient")->load(); + ModulePtr tibiaFilesModule = g_modules.getModule("tibiafiles"); + if(!tibiaFilesModule || !tibiaFilesModule->isLoaded()) { + logFatal("Could not find or load 'tibiafiles' module, this module contains SPR and DAT files.\n" + "Please download it and place in modules directory, then try running again."); + } // now that everything is initialized, setup configurations setupConfigurations();