misc/libphyslayer/physfslualoader.c
author Wuzzy <Wuzzy2@mail.ru>
Mon, 13 Nov 2017 22:14:45 +0100
changeset 12836 8610462e3d33
parent 9991 3858d99476f5
child 13537 ecdf6ce2301e
permissions -rw-r--r--
Remove 2 unused number tags in Construction Mode GUI These numbers are shown aside the power tag, but the numbers never change. They don't serve any purpose and are just visual clutter and annoying, since they partially overlap. They are probably a leftover from copying code over from other scripts. With this changeset, only the power and turn time are left visible, as it is supposed to.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8074
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
     1
#include "lua.h"
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
     2
#include "physfs.h"
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     3
9991
3858d99476f5 add compatibility for physicsfs 2.0
sheepluva
parents: 8524
diff changeset
     4
#include "physfscompat.h"
3858d99476f5 add compatibility for physicsfs 2.0
sheepluva
parents: 8524
diff changeset
     5
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     6
#define BUFSIZE 1024
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     7
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
     8
void *physfsReaderBuffer;
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     9
8119
257ffa847aa2 physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents: 8074
diff changeset
    10
PHYSFS_DECL const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size)
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    11
{
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    12
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    13
    if(PHYSFS_eof(f))
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    14
    {
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    15
        return NULL;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    16
    }
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    17
    else
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    18
    {
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    19
        *size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE);
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    20
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    21
        if(*size == 0)
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    22
            return NULL;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    23
        else
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    24
            return physfsReaderBuffer;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    25
    }
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    26
}
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    27
8119
257ffa847aa2 physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents: 8074
diff changeset
    28
PHYSFS_DECL void physfsReaderSetBuffer(void *buffer)
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    29
{
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    30
    physfsReaderBuffer = buffer;
8074
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
    31
}
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
    32