misc/libphyslayer/physfslualoader.c
author sheepluva
Thu, 16 Jan 2014 19:50:18 +0100
changeset 9994 8455993a7a1b
parent 9991 3858d99476f5
child 13537 ecdf6ce2301e
permissions -rw-r--r--
* allow telling cmake where to find required fonts in system when user supplies the paths, as suggested by unC0Rr, e.g. -DFONTS_DIRS='/usr/share/fonts/truetype/wqy;/usr/share/fonts/truetype/dejavu' * the build system will use the paths to lookup fonts and install those not found * the engine will load the paths into physfs (mountpoint /Fonts) to make the fonts available at runtime * overriding fonts in packages should be possible again now

#include "lua.h"
#include "physfs.h"

#include "physfscompat.h"

#define BUFSIZE 1024

void *physfsReaderBuffer;

PHYSFS_DECL const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size)
{

    if(PHYSFS_eof(f))
    {
        return NULL;
    }
    else
    {
        *size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE);

        if(*size == 0)
            return NULL;
        else
            return physfsReaderBuffer;
    }
}

PHYSFS_DECL void physfsReaderSetBuffer(void *buffer)
{
    physfsReaderBuffer = buffer;
}