misc/libphyslayer/physfslualoader.c
author S.D.
Tue, 27 Sep 2022 14:59:03 +0300
changeset 15878 fc3cb23fd26f
parent 13537 ecdf6ce2301e
permissions -rw-r--r--
Allow to see rooms of incompatible versions in the lobby For the new clients the room version is shown in a separate column. There is also a hack for previous versions clients: the room vesion specifier is prepended to the room names for rooms of incompatible versions, and the server shows 'incompatible version' error if the client tries to join them.
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
13537
ecdf6ce2301e Fix warnings about unused params in C code
Wuzzy <Wuzzy2@mail.ru>
parents: 9991
diff changeset
     7
#define UNUSED(x) (void)(x)
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     8
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
     9
void *physfsReaderBuffer;
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    10
8119
257ffa847aa2 physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents: 8074
diff changeset
    11
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
    12
{
13537
ecdf6ce2301e Fix warnings about unused params in C code
Wuzzy <Wuzzy2@mail.ru>
parents: 9991
diff changeset
    13
    UNUSED(L);
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    14
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    15
    if(PHYSFS_eof(f))
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    16
    {
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    17
        return NULL;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    18
    }
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    19
    else
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    20
    {
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    21
        *size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE);
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    22
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    23
        if(*size == 0)
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    24
            return NULL;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    25
        else
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    26
            return physfsReaderBuffer;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    27
    }
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    28
}
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    29
8119
257ffa847aa2 physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents: 8074
diff changeset
    30
PHYSFS_DECL void physfsReaderSetBuffer(void *buffer)
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    31
{
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    32
    physfsReaderBuffer = buffer;
8074
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
    33
}
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
    34