Example #1
0
void loom_asset_initialize(const char *rootUri)
{
    // Set up the lock for the mutex.
    lmAssert(gAssetLock == NULL, "Double initialization!");
    gAssetLock = loom_mutex_create();

    // Note the CWD.
    char tmpBuff[1024];
    platform_getCurrentWorkingDir(tmpBuff, 1024);
    lmLog(gAssetLogGroup, "Current working directory ='%s'", tmpBuff);

    // And the allocator.
    //gAssetAllocator = loom_allocator_initializeTrackerProxyAllocator(loom_allocator_getGlobalHeap());
    gAssetAllocator = (loom_allocator_getGlobalHeap());

    // Clear, it might have been filled up before (for unit tests)
    gAssetLoadQueue.clear();
    gAssetHash.clear();

    // Asset server connection state.
    gAssetServerSocketLock = loom_mutex_create();

    // And set up some default asset types.
    loom_asset_registerType(LATText, loom_asset_textDeserializer, loom_asset_textRecognizer);
    loom_asset_registerType(LATBinary, loom_asset_binaryDeserializer, loom_asset_binaryRecognizer);

    loom_asset_registerImageAsset();
    loom_asset_registerSoundAsset();
    loom_asset_registerScriptAsset();

    // Listen to log and send it if we have a connection.
    loom_log_addListener(loom_asset_logListener, NULL);
}
Example #2
0
// Clears the asset name cache that is built up
// through loom_asset_lock and others
static void loom_asset_clear()
{
    utHashTableIterator<utHashTable<utHashedString, loom_asset_t *> > assetIterator(gAssetHash);
    while (assetIterator.hasMoreElements())
    {
        utHashedString key = assetIterator.peekNextKey();
        lmDelete(NULL, assetIterator.peekNextValue());
        assetIterator.next();
    }
    gAssetHash.clear();
}
Example #3
0
void loom_asset_shutdown()
{
    loom_asset_flushAll();

    // Clear out our queues and maps.
    gAssetDeserializerMap.clear();
    gRecognizerList.clear();

    lmAssert(gAssetLock != NULL, "Shutdown without being initialized!");
    loom_mutex_destroy(gAssetLock);
    gAssetLock = NULL;
}
Example #4
0
    static void regenerateSourceBreakpoints()
    {
        sourceBreakpoints.clear();

        for (UTsize i = 0; i < breakpoints.size(); i++)
        {
            Breakpoint *bp = breakpoints.at(i);

            utFastStringHash fhash(bp->source);

            if (sourceBreakpoints.find(fhash) == UT_NPOS)
            {
                utArray<Breakpoint *> bps;
                sourceBreakpoints.insert(fhash, bps);
            }

            sourceBreakpoints.get(fhash)->push_back(bp);
        }
    }