[1.9.0] Silent crash loading plugin libraries Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Nefadozone
Gnoblar
Posts: 5
Joined: Sun Sep 13, 2015 4:53 pm

[1.9.0] Silent crash loading plugin libraries

Post by Nefadozone »

Ogre Version:
1.9.0 x64 - compiled with vs 2019 *v141 toolset used

Operating System:
Windows 10 Pro

Render System:
Open GL & D3DX9 are compiled with 1.9 x64 and included in the root folder.

All of the rest of the plugins and dependencies were successfully compiled as x64 bit in VS 2019. Maybe there's a problem lurking here somewhere with a new IDE.

Upon porting a project from 1.7.4 to 1.9.0, a soft crash keeps me kind of out of the loop even when debugging.
The log gets to 'Loading library' and stops at the first one called in the code.

The project was made in codeblocks, and I've gotten it to compile before perfectly when going for x32 bits.

Ogre.log

Code: Select all

00:22:43: Creating resource group General
00:22:43: Creating resource group Internal
00:22:43: Creating resource group Autodetect
00:22:43: SceneManagerFactory for type 'DefaultSceneManager' registered.
00:22:43: Registering ResourceManager for type Material
00:22:43: Registering ResourceManager for type Mesh
00:22:43: Registering ResourceManager for type Skeleton
00:22:43: MovableObjectFactory for type 'ParticleSystem' registered.
00:22:43: ArchiveFactory for archive type FileSystem registered.
00:22:43: ArchiveFactory for archive type Zip registered.
00:22:43: ArchiveFactory for archive type EmbeddedZip registered.
00:22:43: DDS codec registering
00:22:43: FreeImage version: 3.13.1
00:22:43: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
00:22:43: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,bay,bmq,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,k25,kdc,mdc,mos,mrw,nef,orf,pef,pxn,raf,raw,rdc,sr2,srf,arw,3fr,cine,ia,kc2,mef,nrw,qtk,rw2,sti,drf,dsc,ptx,cap,iiq,rwz
00:22:43: ETC codec registering
00:22:43: Registering ResourceManager for type HighLevelGpuProgram
00:22:43: Registering ResourceManager for type Compositor
00:22:43: MovableObjectFactory for type 'Entity' registered.
00:22:43: MovableObjectFactory for type 'Light' registered.
00:22:43: MovableObjectFactory for type 'BillboardSet' registered.
00:22:43: MovableObjectFactory for type 'ManualObject' registered.
00:22:43: MovableObjectFactory for type 'BillboardChain' registered.
00:22:43: MovableObjectFactory for type 'RibbonTrail' registered.
00:22:43: *-*-* OGRE Initialising
00:22:43: *-*-* Version 1.9.0 (Ghadamon)
00:22:43: Loading library Plugin_CgProgramManager
I think that this main.cpp is preparing to create the window.

Code: Select all

#define _WIN64_WINNT 0x0500
#define WIN64_LEAN_AND_MEAN

//Include windows/Ogre/OIS headers
#include <Ogre.h>
#include <OIS.h>
#include <Application.h>
//#include "stdafx.h"
//#pragma comment(lib, "irrKlang.lib")
#include "md5.h"

// #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#include <windows.h>
//#include <winnt.h>
// #endif

using namespace boost;


#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( _In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR strCmdLine, _In_ INT nCmdShow)
#else
int main(int argc, char *argv[])
#endif
{
    try
    {
        Application app;
        if(app.load())app.run();
    }
    catch( Ogre::Exception& e )
    {
        #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        MessageBoxA( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
        #else
        std::cerr << "An exception has occured: " << e.getFullDescription().c_str() << std::endl;
        #endif
    }

	return 0;
}
This header has the rest of the application init stuffs.

Code: Select all

#ifndef _APPLICATION_H_
#define _APPLICATION_H_

using namespace Ogre;

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include <CoreFoundation/CoreFoundation.h>

// This function will locate the path to our application on OS X,
// unlike windows you can not rely on the curent working directory
// for locating your configuration files and resources.
std::string macBundlePath()
{
    char path[1024];
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    assert(mainBundle);

    CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
    assert(mainBundleURL);

    CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
    assert(cfStringRef);

    CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);

    CFRelease(mainBundleURL);
    CFRelease(cfStringRef);

    return std::string(path);
}
#endif

#include <LogoState.h>
#include <GuiHandler.h>
#include <MacAddress.h>

#define AppTitle "myapp"

class Application : public WindowEventListener
{
private:
    bool running;
    String resourcePath;

    Root *root;
	RenderWindow *window;
	GuiHandler *mGuiHandler;

	Real timeSinceLastFrame;
	Timer timer;
    unsigned long lastTime;

    std::vector<GameState*> mStates;
    GameState *mGameState;

    bool mProperShutdown;

public:
    Application()
    {
        mProperShutdown = false;
        bool previouslySuccessful = false;
        const bool showConfigDialog = shouldShowConfigDialog(previouslySuccessful);
        setShutdownSuccessful(false, previouslySuccessful);
        //Create default ogre.cfg if required
        OptionsManager::checkAndcreateDefaultVideoConfig(showConfigDialog && !previouslySuccessful);

        String macAddress = "";
        String resourcePath = "";
		String pluginPath = "";
        #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
        resourcePath = macBundlePath() + "/Contents/Resources/";
        #endif

        //Initialize Ogre
        root = OGRE_NEW Root("",resourcePath + "ogre.cfg",resourcePath + "ogre.log");

        //Load appropriate plugins
        #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        HWND hWnd = GetConsoleWindow();
        ShowWindow( hWnd, SW_SHOWNORMAL);
        root->loadPlugin("Plugin_CgProgramManager");
        root->loadPlugin("Plugin_OctreeSceneManager");
        root->loadPlugin("Plugin_ParticleFX");
        if(isRenderSystemOpenGL(resourcePath + "ogre.cfg"))root->loadPlugin("RenderSystem_GL");
        else root->loadPlugin("RenderSystem_Direct3D9");
        macAddress = getMACaddress();
        #else
        #define STRINGIFY(x) #x
        #define EXPAND(x) STRINGIFY(x)
        root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "Plugin_CgProgramManager");
        root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "Plugin_OctreeSceneManager");
        root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "Plugin_ParticleFX");
        if(isRenderSystemOpenGL(resourcePath + "ogre.cfg"))root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "RenderSystem_GL");
        else root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "RenderSystem_Direct3D9");
        #endif

        //Show dialog if config is absent
        bool usedConfigDialog = false;
        if(showConfigDialog)
        {
            if(root->showConfigDialog())usedConfigDialog = true;
            else
            {
                setShutdownSuccessful(false, false);
                OGRE_DELETE root;
                root = 0;
                return;
            }
            //Fill ogre.cfg blanks
            OptionsManager::checkAndcreateDefaultVideoConfig(false,true);
        }

        if(!usedConfigDialog)root->restoreConfig();
        window = root->initialise(true, AppTitle);
        loadResources(resourcePath);
        loadMapResources();
        srand(time(NULL));

        //To fix overlay caption bug since ogre 1.7
        FontManager *pFontMgr = FontManager::getSingletonPtr();
        pFontMgr->getByName("Tahoma")->load();
        pFontMgr->getByName("TempusSans")->load();
        pFontMgr->getByName("BlueHighway")->load();
        pFontMgr->getByName("FadeFont")->load();

        new LoggerManager();
        new LoadingBarManager();
        new ZipManager();
        new CapabilitiesManager(root);
        new KeyboardManager();
        new SplashScreenManager();
        new ScreenEffectsManager();
        new CollisionManager();
        new WaterManager();
        new CameraManager();
        new SoundManager();
        mGuiHandler = new GuiHandler(window);
        new GridManager();
        new LightManager();
        new SkyManager();
        new UnitManager();
        new CharCreateManager();
        new EmoteManager();
        new MarkingManager();
        new LipSyncManager();
        new NameTagManager();
        new WorldObjectManager();
        new MapManager();
        new NetworkManager(macAddress);
        new ChatManager();
        new FriendsManager();
        new PartyManager();
        new GroupManager();
        new InfoManager();
        new ControlManager();
        new MovieMaker();
        new ActionsManager();
        new ItemsManager();
        new SkillsManager();
        new MiniMapManager();
        new GamePanelManager();
		new Ogre::OverlayManager();
        OptionsManager *optionsMgr = new OptionsManager();

        WindowEventUtilities::addWindowEventListener(window, this);
        mGuiHandler->init(optionsMgr->getFullScreen(),optionsMgr->getMouseSensitivityPtr());
        loadScripts(resourcePath);

        mGameState = 0;
    }

    ~Application()
    {
        if(!root)return;

        unload();

        const bool restartRequired = OptionsManager::getSingletonPtr()->isRestartRequired();
        delete OptionsManager::getSingletonPtr();
        delete GamePanelManager::getSingletonPtr();
        delete MiniMapManager::getSingletonPtr();
        delete SkillsManager::getSingletonPtr();
        delete ItemsManager::getSingletonPtr();
        delete ActionsManager::getSingletonPtr();
        delete MovieMaker::getSingletonPtr();
        delete ControlManager::getSingletonPtr();
        delete InfoManager::getSingletonPtr();
        delete GroupManager::getSingletonPtr();
        delete PartyManager::getSingletonPtr();
        delete FriendsManager::getSingletonPtr();
        delete ChatManager::getSingletonPtr();
        delete NetworkManager::getSingletonPtr();
        delete MapManager::getSingletonPtr();
        delete WorldObjectManager::getSingletonPtr();
        delete NameTagManager::getSingletonPtr();
        delete LipSyncManager::getSingletonPtr();
        delete MarkingManager::getSingletonPtr();
        delete EmoteManager::getSingletonPtr();
        delete CharCreateManager::getSingletonPtr();
        delete UnitManager::getSingletonPtr();
        delete SkyManager::getSingletonPtr();
        delete LightManager::getSingletonPtr();
        delete GridManager::getSingletonPtr();
        delete mGuiHandler;
        WindowEventUtilities::removeWindowEventListener(window, this);
        delete SoundManager::getSingletonPtr();
        delete CameraManager::getSingletonPtr();
        delete WaterManager::getSingletonPtr();
        delete CollisionManager::getSingletonPtr();
        delete ScreenEffectsManager::getSingletonPtr();
        delete SplashScreenManager::getSingletonPtr();
        delete KeyboardManager::getSingletonPtr();
        delete CapabilitiesManager::getSingletonPtr();
        ZipManager::getSingletonPtr()->getTempFilenames();
        delete LoadingBarManager::getSingletonPtr();
        delete LoggerManager::getSingletonPtr();
		delete Ogre::OverlayManager::getSingletonPtr();

        //Shut down Ogre
        OGRE_DELETE root;

        delete ZipManager::getSingletonPtr();

        if(mProperShutdown)setShutdownSuccessful(true,!restartRequired);
    }

    const bool load()
    {
        if(!root)return false;

        //Init gamestate
        pushState(new LogoState());

        lastTime = timer.getMilliseconds();

        return true;
    }

    void unload()
    {
        mGuiHandler->exitProcedure();
        while(!mStates.empty())
        {
            GameState *state = mStates.back();
            mStates.pop_back();
            delete state;
        }
    }

    void run()
    {
        //Main loop
        while(running)
        {
            //Handle windows events
            WindowEventUtilities::messagePump();
            if(!running)break;

            //Update frame
            updateTimer();
            /*const Real tTimeThreshold = 0.1;
            while(timeSinceLastFrame>tTimeThreshold)
            {
                const Real tempTime = timeSinceLastFrame;
                timeSinceLastFrame = tTimeThreshold;
                render();
                timeSinceLastFrame = tempTime-tTimeThreshold;
            }*/
            if(timeSinceLastFrame>=0)
            {
                mGuiHandler->update(timeSinceLastFrame);
                //mGuiHandler->updateStats();
                mGameState->update(timeSinceLastFrame);
                //mGuiHandler->updateStats();
                if(mGameState->changeState)
                {
                    if(mGameState->mNextState)pushState(mGameState->mNextState,mGameState->replaceState);
                    else popState();
                }
            }
        }

        mProperShutdown = true;
    }

    void updateTimer()
    {
        const unsigned long currentTime = timer.getMilliseconds();

        //Calculate the amount of time passed since the last frame
        timeSinceLastFrame = (currentTime - lastTime) * 0.001f;
        if(timeSinceLastFrame >= 0.001f)lastTime = currentTime;
        else timeSinceLastFrame = 0;
    }

    void pushState(GameState *state, const bool &replace=false)
    {
        if(replace)popState(false);
        else if(mGameState)
        {
            mGuiHandler->exitProcedure();
            mGameState->exit();
        }
        mStates.push_back(state);
        mGameState = state;
        mGameState->enter();
        mGuiHandler->enterProcedure();
        mGuiHandler->setListeners(mGameState,mGameState,mGameState,mGameState);
        running = true;
    }
    void popState(const bool &enterPrevious=true)
    {
        if(!mStates.empty())
        {
            mGuiHandler->exitProcedure();
            GameState *state = mStates.back();
            mStates.pop_back();
            delete state;
            mGameState = (mStates.empty()?0:mStates.back());
            if(mGameState)
            {
                if(enterPrevious)
                {
                    mGameState->enter();
                    mGuiHandler->enterProcedure();
                    mGuiHandler->setListeners(mGameState,mGameState,mGameState,mGameState);
                }
            }
            else running = false;
        }
    }
    void loadResources(const String &resourcePath)
    {
        // Load resource paths from config file
        ConfigFile cf;
        cf.load(resourcePath + "resources.cfg");

        // Go through all sections & settings in the file
        ConfigFile::SectionIterator seci = cf.getSectionIterator();

        String secName, typeName, archName;
        while (seci.hasMoreElements())
        {
            secName = seci.peekNextKey();
            ConfigFile::SettingsMultiMap *settings = seci.getNext();
            ConfigFile::SettingsMultiMap::iterator i;
            for (i = settings->begin(); i != settings->end(); ++i)
            {
                typeName = i->first;
                archName = i->second;
                #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
                // OS X does not set the working directory relative to the app,
                // In order to make things portable on OS X we need to provide
                // the loading with it's own bundle path location
                ResourceGroupManager::getSingleton().addResourceLocation(
                    String(macBundlePath() + "/" + archName), typeName, secName);
                #else
                ResourceGroupManager::getSingleton().addResourceLocation(
                    archName, typeName, secName);
                #endif
            }
        }
        ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    }
    void loadMapResources()
    {
        const StringVector list = SaveFile::findResourceNames("Terrains","*.map");
        for(StringVector::const_iterator i = list.begin(); i!=list.end(); i++)
        {
            String mapName = *i;
            mapName.erase((int)mapName.length()-4,4);
            #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
            ResourceGroupManager::getSingleton().addResourceLocation(String(macBundlePath()+"/"+MAPMAKER_DIR+mapName),"FileSystem","Terrains/"+mapName);
            #else
            ResourceGroupManager::getSingleton().addResourceLocation(MAPMAKER_DIR+mapName,"FileSystem","Terrains/"+mapName);
            #endif
            ResourceGroupManager::getSingleton().initialiseResourceGroup("Terrains/"+mapName);
        }
    }
    void loadScripts(const String &resourcePath)
    {
        EmoteManager::getSingletonPtr()->load(resourcePath+"emotes.cfg");
        MarkingManager::getSingletonPtr()->load(resourcePath+"markings.cfg");
        MarkingManager::getSingletonPtr()->initEyeMaterials();
        SkyManager::getSingletonPtr()->loadWeathers();
        MovieMaker::getSingletonPtr()->loadCamMovements(resourcePath+"movieCamMovements.cfg");
        //MovieMaker::getSingletonPtr()->loadActions(resourcePath+"movieActions.cfg");
        ItemsManager::getSingletonPtr()->load(resourcePath+"items.cfg");
    }
    const bool isRenderSystemOpenGL(const String &filename)
    {
        std::ifstream inFile(filename.c_str());
        if(!inFile.good())return true;
        char buffer[64] = "";
        inFile.getline(buffer,64);
        inFile.close();
        if(StringUtil::endsWith(String(buffer),"opengl rendering subsystem",true))return true;
        return false;
    }
    const bool shouldShowConfigDialog(bool &previouslySuccessful)
    {
        const String filename = resourcePath + "config.good";
        std::ifstream inFile(filename.c_str());
        if(!inFile.good())return true;
        const char ch = inFile.get();
        previouslySuccessful = (inFile.get() == '1');
        inFile.close();
        return (ch == '0');
    }
    void setShutdownSuccessful(const bool &flag, const bool &previouslySuccessful=false)
    {
        const String filename = resourcePath + "config.good";
        std::ofstream outFile(filename.c_str());
        outFile.put(flag ? '1' : '0');
        outFile.put(previouslySuccessful ? '1' : '0');
        outFile.close();
    }
    bool windowClosing(RenderWindow *rw)
    {
        running = false;
        unload();
        mProperShutdown = true;
        return true;
    }
};

#endif
All of the necessary dll files and resources.cfg/ogre.cfg etc. are in the root folder I'm debugging, and manually trying to run the application from.

The app even says it can't find cg.dll, etc. if they are not in there with it.

I'm not incredible at coding, but I'm even worse with working with someone else's code. How do I fix this issue?
User avatar
EricB
Bronze Sponsor
Bronze Sponsor
Posts: 360
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 213
Contact:

Re: [1.9.0] Silent crash loading plugin libraries

Post by EricB »

What error does windows throw up when it crashes?

Are you able to get a call stack? Where in your code or Ogre's code or CG Plugin's code does it crash?

Do you need CG plugin?

Since you seem to be leaning toward issues with libs and dlls, have you tried using Dependency Walker to make sure that your libraries are correct?
Image
User avatar
Nefadozone
Gnoblar
Posts: 5
Joined: Sun Sep 13, 2015 4:53 pm

Re: [1.9.0] Silent crash loading plugin libraries

Post by Nefadozone »

So, I have changed many things and have progressed to an extent.

I stopped trying to use OGRE that I built with v141 tools and used the incredibly convenient prebuilt from Transporter here.

Something must've been wrong with the .dlls, not sure which one but the previous problem I had seems to be gone.

Dependency Walker is amazing and I don't know how I've never heard of it until today. It did clear up missing dependency woes though. None of the .dlls it needs from OGRE, irrKlang or RakNet are missing.

Now I can pull up the rendering window. It opens the application window afterwards, and before doing anything else it hardcrashes - but now with some verbosity for a change.

I still get a crash, but it's not silent this time. I believe that either some old code in place to port this source originally from 1.6 -> 1.7 might be causing the crash, or that something isn't initializing the overlay system properly.

It crashes at this line:

Code: Select all

// line 120 - To fix overlay caption bug since ogre 1.7
        FontManager *pFontMgr = FontManager::getSingletonPtr();
        pFontMgr->getByName("Tahoma")->load(); //breaks right here after this function
        pFontMgr->getByName("TempusSans")->load();
        pFontMgr->getByName("BlueHighway")->load();
        pFontMgr->getByName("FadeFont")->load();
Here's the full header, not formatted very well rn:

Code: Select all

#ifndef _APPLICATION_H_
#define _APPLICATION_H_

using namespace Ogre;

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include <CoreFoundation/CoreFoundation.h>

// This function will locate the path to our application on OS X,
// unlike windows you can not rely on the curent working directory
// for locating your configuration files and resources.
std::string macBundlePath()
{
    char path[1024];
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    assert(mainBundle);

    CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
    assert(mainBundleURL);

    CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
    assert(cfStringRef);

    CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);

    CFRelease(mainBundleURL);
    CFRelease(cfStringRef);

    return std::string(path);
}
#endif

#include <LogoState.h>
#include <GuiHandler.h>
#include <MacAddress.h>

#define AppTitle "myapp"

class Application : public WindowEventListener
{
private:
    bool running;
    String resourcePath;

    Root *root;
	RenderWindow *window;
	GuiHandler *mGuiHandler;

	Real timeSinceLastFrame;
	Timer timer;
    unsigned long lastTime;

    std::vector<GameState*> mStates;
    GameState *mGameState;

    bool mProperShutdown;

public:
    Application()
    {
        mProperShutdown = false;
        bool previouslySuccessful = false;
        const bool showConfigDialog = shouldShowConfigDialog(previouslySuccessful);
        setShutdownSuccessful(false, previouslySuccessful);
        //Create default ogre.cfg if required
        OptionsManager::checkAndcreateDefaultVideoConfig(showConfigDialog && !previouslySuccessful);

        String macAddress = "";
        String resourcePath = "";
		String pluginPath = "";
        #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
        resourcePath = macBundlePath() + "/Contents/Resources/";
        #endif

        //Initialize Ogre
        root = OGRE_NEW Root("",resourcePath + "ogre.cfg",resourcePath + "ogre.log");

        //Load appropriate plugins
        #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        HWND hWnd = GetConsoleWindow();
        ShowWindow( hWnd, SW_SHOWNORMAL);
        root->loadPlugin("Plugin_CgProgramManager");
        root->loadPlugin("Plugin_OctreeSceneManager");
        root->loadPlugin("Plugin_ParticleFX");
        if(isRenderSystemOpenGL(resourcePath + "ogre.cfg"))root->loadPlugin("RenderSystem_GL");
        else root->loadPlugin("RenderSystem_Direct3D11");
        macAddress = getMACaddress();
        #else
        #define STRINGIFY(x) #x
        #define EXPAND(x) STRINGIFY(x)
        root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "Plugin_CgProgramManager");
        root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "Plugin_OctreeSceneManager");
        root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "Plugin_ParticleFX");
        if(isRenderSystemOpenGL(resourcePath + "ogre.cfg"))root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "RenderSystem_GL");
        else root->loadPlugin(EXPAND(OGRE_PLUGINDIR) "RenderSystem_Direct3D9");
        #endif

        //Show dialog if config is absent
        bool usedConfigDialog = false;
        if(showConfigDialog)
        {
            if(root->showConfigDialog())usedConfigDialog = true;
            else
            {
                setShutdownSuccessful(false, false);
                OGRE_DELETE root;
                root = 0;
                return;
            }
            //Fill ogre.cfg blanks
            OptionsManager::checkAndcreateDefaultVideoConfig(false,true);
        }

        if(!usedConfigDialog)root->restoreConfig();
        window = root->initialise(true, AppTitle);
        loadResources(resourcePath);
        loadMapResources();
        srand(time(NULL));

        //To fix overlay caption bug since ogre 1.7
        FontManager *pFontMgr = FontManager::getSingletonPtr();
        pFontMgr->getByName("Tahoma")->load();
        pFontMgr->getByName("TempusSans")->load();
        pFontMgr->getByName("BlueHighway")->load();
        pFontMgr->getByName("FadeFont")->load();

        new LoggerManager();
        new LoadingBarManager();
        new ZipManager();
        new CapabilitiesManager(root);
        new KeyboardManager();
        new SplashScreenManager();
        new ScreenEffectsManager();
        new CollisionManager();
        new WaterManager();
        new CameraManager();
        new SoundManager();
        mGuiHandler = new GuiHandler(window);
        new GridManager();
        new LightManager();
        new SkyManager();
        new UnitManager();
        new CharCreateManager();
        new EmoteManager();
        new MarkingManager();
        new LipSyncManager();
        new NameTagManager();
        new WorldObjectManager();
        new MapManager();
        new NetworkManager(macAddress);
        new ChatManager();
        new FriendsManager();
        new PartyManager();
        new GroupManager();
        new InfoManager();
        new ControlManager();
        new MovieMaker();
        new ActionsManager();
        new ItemsManager();
        new SkillsManager();
        new MiniMapManager();
        new GamePanelManager();
	new Ogre::OverlayManager(); //may be initialized wrong
        OptionsManager *optionsMgr = new OptionsManager();

        WindowEventUtilities::addWindowEventListener(window, this);
        mGuiHandler->init(optionsMgr->getFullScreen(),optionsMgr->getMouseSensitivityPtr());
        loadScripts(resourcePath);

        mGameState = 0;
    }

    ~Application()
    {
        if(!root)return;

        unload();

        const bool restartRequired = OptionsManager::getSingletonPtr()->isRestartRequired();
        delete OptionsManager::getSingletonPtr();
        delete GamePanelManager::getSingletonPtr();
        delete MiniMapManager::getSingletonPtr();
        delete SkillsManager::getSingletonPtr();
        delete ItemsManager::getSingletonPtr();
        delete ActionsManager::getSingletonPtr();
        delete MovieMaker::getSingletonPtr();
        delete ControlManager::getSingletonPtr();
        delete InfoManager::getSingletonPtr();
        delete GroupManager::getSingletonPtr();
        delete PartyManager::getSingletonPtr();
        delete FriendsManager::getSingletonPtr();
        delete ChatManager::getSingletonPtr();
        delete NetworkManager::getSingletonPtr();
        delete MapManager::getSingletonPtr();
        delete WorldObjectManager::getSingletonPtr();
        delete NameTagManager::getSingletonPtr();
        delete LipSyncManager::getSingletonPtr();
        delete MarkingManager::getSingletonPtr();
        delete EmoteManager::getSingletonPtr();
        delete CharCreateManager::getSingletonPtr();
        delete UnitManager::getSingletonPtr();
        delete SkyManager::getSingletonPtr();
        delete LightManager::getSingletonPtr();
        delete GridManager::getSingletonPtr();
        delete mGuiHandler;
        WindowEventUtilities::removeWindowEventListener(window, this);
        delete SoundManager::getSingletonPtr();
        delete CameraManager::getSingletonPtr();
        delete WaterManager::getSingletonPtr();
        delete CollisionManager::getSingletonPtr();
        delete ScreenEffectsManager::getSingletonPtr();
        delete SplashScreenManager::getSingletonPtr();
        delete KeyboardManager::getSingletonPtr();
        delete CapabilitiesManager::getSingletonPtr();
        ZipManager::getSingletonPtr()->getTempFilenames();
        delete LoadingBarManager::getSingletonPtr();
        delete LoggerManager::getSingletonPtr();
	delete Ogre::OverlayManager::getSingletonPtr(); //may be deleted wrong

        //Shut down Ogre
        OGRE_DELETE root;

        delete ZipManager::getSingletonPtr();

        if(mProperShutdown)setShutdownSuccessful(true,!restartRequired);
    }

    const bool load()
    {
        if(!root)return false;

        //Init gamestate
        pushState(new LogoState());

        lastTime = timer.getMilliseconds();

        return true;
    }

    void unload()
    {
        mGuiHandler->exitProcedure();
        while(!mStates.empty())
        {
            GameState *state = mStates.back();
            mStates.pop_back();
            delete state;
        }
    }

    void run()
    {
        //Main loop
        while(running)
        {
            //Handle windows events
            WindowEventUtilities::messagePump();
            if(!running)break;

            //Update frame
            updateTimer();
            /*const Real tTimeThreshold = 0.1;
            while(timeSinceLastFrame>tTimeThreshold)
            {
                const Real tempTime = timeSinceLastFrame;
                timeSinceLastFrame = tTimeThreshold;
                render();
                timeSinceLastFrame = tempTime-tTimeThreshold;
            }*/
            if(timeSinceLastFrame>=0)
            {
                mGuiHandler->update(timeSinceLastFrame);
                //mGuiHandler->updateStats();
                mGameState->update(timeSinceLastFrame);
                //mGuiHandler->updateStats();
                if(mGameState->changeState)
                {
                    if(mGameState->mNextState)pushState(mGameState->mNextState,mGameState->replaceState);
                    else popState();
                }
            }
        }

        mProperShutdown = true;
    }

    void updateTimer()
    {
        const unsigned long currentTime = timer.getMilliseconds();

        //Calculate the amount of time passed since the last frame
        timeSinceLastFrame = (currentTime - lastTime) * 0.001f;
        if(timeSinceLastFrame >= 0.001f)lastTime = currentTime;
        else timeSinceLastFrame = 0;
    }

    void pushState(GameState *state, const bool &replace=false)
    {
        if(replace)popState(false);
        else if(mGameState)
        {
            mGuiHandler->exitProcedure();
            mGameState->exit();
        }
        mStates.push_back(state);
        mGameState = state;
        mGameState->enter();
        mGuiHandler->enterProcedure();
        mGuiHandler->setListeners(mGameState,mGameState,mGameState,mGameState);
        running = true;
    }
    void popState(const bool &enterPrevious=true)
    {
        if(!mStates.empty())
        {
            mGuiHandler->exitProcedure();
            GameState *state = mStates.back();
            mStates.pop_back();
            delete state;
            mGameState = (mStates.empty()?0:mStates.back());
            if(mGameState)
            {
                if(enterPrevious)
                {
                    mGameState->enter();
                    mGuiHandler->enterProcedure();
                    mGuiHandler->setListeners(mGameState,mGameState,mGameState,mGameState);
                }
            }
            else running = false;
        }
    }
    void loadResources(const String &resourcePath)
    {
        // Load resource paths from config file
        ConfigFile cf;
        cf.load(resourcePath + "resources.cfg");

        // Go through all sections & settings in the file
        ConfigFile::SectionIterator seci = cf.getSectionIterator();

        String secName, typeName, archName;
        while (seci.hasMoreElements())
        {
            secName = seci.peekNextKey();
            ConfigFile::SettingsMultiMap *settings = seci.getNext();
            ConfigFile::SettingsMultiMap::iterator i;
            for (i = settings->begin(); i != settings->end(); ++i)
            {
                typeName = i->first;
                archName = i->second;
                #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
                // OS X does not set the working directory relative to the app,
                // In order to make things portable on OS X we need to provide
                // the loading with it's own bundle path location
                ResourceGroupManager::getSingleton().addResourceLocation(
                    String(macBundlePath() + "/" + archName), typeName, secName);
                #else
                ResourceGroupManager::getSingleton().addResourceLocation(
                    archName, typeName, secName);
                #endif
            }
        }
        ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    }
    void loadMapResources()
    {
        const StringVector list = SaveFile::findResourceNames("Terrains","*.map");
        for(StringVector::const_iterator i = list.begin(); i!=list.end(); i++)
        {
            String mapName = *i;
            mapName.erase((int)mapName.length()-4,4);
            #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
            ResourceGroupManager::getSingleton().addResourceLocation(String(macBundlePath()+"/"+MAPMAKER_DIR+mapName),"FileSystem","Terrains/"+mapName);
            #else
            ResourceGroupManager::getSingleton().addResourceLocation(MAPMAKER_DIR+mapName,"FileSystem","Terrains/"+mapName);
            #endif
            ResourceGroupManager::getSingleton().initialiseResourceGroup("Terrains/"+mapName);
        }
    }
    void loadScripts(const String &resourcePath)
    {
        EmoteManager::getSingletonPtr()->load(resourcePath+"emotes.cfg");
        MarkingManager::getSingletonPtr()->load(resourcePath+"markings.cfg");
        MarkingManager::getSingletonPtr()->initEyeMaterials();
        SkyManager::getSingletonPtr()->loadWeathers();
        MovieMaker::getSingletonPtr()->loadCamMovements(resourcePath+"movieCamMovements.cfg");
        //MovieMaker::getSingletonPtr()->loadActions(resourcePath+"movieActions.cfg");
        ItemsManager::getSingletonPtr()->load(resourcePath+"items.cfg");
    }
    const bool isRenderSystemOpenGL(const String &filename)
    {
        std::ifstream inFile(filename.c_str());
        if(!inFile.good())return true;
        char buffer[64] = "";
        inFile.getline(buffer,64);
        inFile.close();
        if(StringUtil::endsWith(String(buffer),"opengl rendering subsystem",true))return true;
        return false;
    }
    const bool shouldShowConfigDialog(bool &previouslySuccessful)
    {
        const String filename = resourcePath + "config.good";
        std::ifstream inFile(filename.c_str());
        if(!inFile.good())return true;
        const char ch = inFile.get();
        previouslySuccessful = (inFile.get() == '1');
        inFile.close();
        return (ch == '0');
    }
    void setShutdownSuccessful(const bool &flag, const bool &previouslySuccessful=false)
    {
        const String filename = resourcePath + "config.good";
        std::ofstream outFile(filename.c_str());
        outFile.put(flag ? '1' : '0');
        outFile.put(previouslySuccessful ? '1' : '0');
        outFile.close();
    }
    bool windowClosing(RenderWindow *rw)
    {
        running = false;
        unload();
        mProperShutdown = true;
        return true;
    }
};

#endif

Imo, I don't think it's actually finding the .overlay files. I don't even see in the source anywhere where it asks for them by name. That's what I'm used to doing in another 1.7 project I had. In the log it has the folders where all of the .overlay files are located, so at least that's working okay.

The ogre.log gives me a hint that the overlay may not be initialized, and that fonts are definitely not being loaded:
Link to it via pastebin

myapp.log tells me a few things but not much. I'd consider it to be stuff that ISN'T broken:

Code: Select all

Capabilities:: VertexProgram: YES
Capabilities:: FragmentProgram: YES
Sound:: Initialized: YES
I don't know how this application in particular gets the .overlay files. When I comment out the loadFont(s) it breaks at a line in another header (yes they used nothing but headers for the entire application)

The break if I comment out the loadFont(s), this in SplashScreenManager.h:

Code: Select all

...
class SplashScreenManager : public Ogre::Singleton<SplashScreenManager>
{
private:
    Overlay *mSplashOverlay;
    OverlayElement *mLoadingScreen;
    OverlayElement *mFlavourText;
    unsigned short mNumLoadingScreens;
    unsigned short mNumFlavourTexts;
public:
    SplashScreenManager()
    {
        mSplashOverlay = OverlayManager::getSingleton().getByName("SplashScreen");
        mLoadingScreen = OverlayManager::getSingleton().getOverlayElement("SplashScreen/Loading");
        mFlavourText = OverlayManager::getSingleton().getOverlayElement("SplashScreen/FlavourText");
        ...
Autos with interesting NULL goofs:

Code: Select all

-		pFontMgr	0x0000000000000000 <NULL>	Ogre::FontManager *
+		Ogre::ResourceManager	<struct at NULL>	Ogre::ResourceManager
		Ogre::Singleton<Ogre::FontManager>	{...}	Ogre::Singleton<Ogre::FontManager>
-		this	0x00000003b83bf870 {running=true (104) resourcePath="" root=0x000001ad5e5e64f8 {mRenderers={ size=1 } ...} ...}	Application *
+		Ogre::WindowEventListener	{...}	Ogre::WindowEventListener
		running	true (104)	bool
+		resourcePath	""	std::basic_string<char,std::char_traits<char>,std::allocator<char> >
+		root	0x000001ad5e5e64f8 {mRenderers={ size=1 } mActiveRenderer=0x000001ad5e5ee378 <Information not available, no symbols loaded for RenderSystem_GL.dll> ...}	Ogre::Root *
+		window	0x000001ad5e5f8588 <Information not available, no symbols loaded for RenderSystem_GL.dll>	Ogre::RenderWindow *
+		mGuiHandler	0x0000000000000000 <NULL>	GuiHandler *
		timeSinceLastFrame	-9.203e-40#DEN	float
+		timer	{mZeroClock=64 mStartTick=140303890 mLastTime=0 ...}	Ogre::Timer
		lastTime	2149032112	unsigned long
+		mStates	{ size=0 }	std::vector<GameState *,std::allocator<GameState *> >
+		mGameState	ucrtbase.dll!0x00007ffb800b10b0 (load symbols for additional information) {mRoot=0x48c38b48f375c084 {...} ...}	GameState *
		mProperShutdown	false	bool
Call stack:

Code: Select all


 	OgreOverlay.dll!00007ffb5397f51e()	Unknown
>	BlueFHClient_Win64.exe!Application::Application() Line 122	C++
 	BlueFHClient_Win64.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * hPrevInstance, char * strCmdLine, int nCmdShow) Line 29	C++
 	[External Code]	
Here is a debug log in vs2019:

Code: Select all

'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\BlueFHClient_Win64.exe'. Symbols loaded.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\OgreOverlay.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\OgreMain.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\RakNetDLL.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\OIS.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\irrKlang.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. 
... trying to shorten log length, yes it loaded windows dlls ...
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\Plugin_CgProgramManager.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\cg.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\Plugin_OctreeSceneManager.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\Plugin_ParticleFX.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Projects\FeralHeart\BlueFH\BlueFH-Client-win32\x64\Release\RenderSystem_GL.dll'. Module was built without symbols.
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\opengl32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\glu32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0338885.inf_amd64_648d9ae54bb276d8\B338884\atig6pxx.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0338885.inf_amd64_648d9ae54bb276d8\B338884\atio6axx.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\dxva2.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0338885.inf_amd64_648d9ae54bb276d8\B338884\atig6txx.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\atiadlxx.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\psapi.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\wintrust.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\dhcpcsvc.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.17763.437_none_05b63dca071e5dd6\comctl32.dll'. 
'BlueFHClient_Win64.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. 
Exception thrown at 0x00007FFB5397F51E (OgreOverlay.dll) in BlueFHClient_Win64.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

Post Reply