mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-02-07 23:07:15 +01:00
Further file shuffling and finally builds.
This commit is contained in:
@@ -1,815 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2013-2018, tinydir authors:
|
||||
- Cong Xu
|
||||
- Lautis Sun
|
||||
- Baudouin Feildel
|
||||
- Andargor <andargor@yahoo.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef TINYDIR_H
|
||||
#define TINYDIR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if ((defined _UNICODE) && !(defined UNICODE))
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
#if ((defined UNICODE) && !(defined _UNICODE))
|
||||
#define _UNICODE
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _MSC_VER
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <tchar.h>
|
||||
# pragma warning(push)
|
||||
# pragma warning (disable : 4996)
|
||||
#else
|
||||
# include <dirent.h>
|
||||
# include <libgen.h>
|
||||
# include <sys/stat.h>
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
#ifdef __MINGW32__
|
||||
# include <tchar.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* types */
|
||||
|
||||
/* Windows UNICODE wide character support */
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
# define _tinydir_char_t TCHAR
|
||||
# define TINYDIR_STRING(s) _TEXT(s)
|
||||
# define _tinydir_strlen _tcslen
|
||||
# define _tinydir_strcpy _tcscpy
|
||||
# define _tinydir_strcat _tcscat
|
||||
# define _tinydir_strcmp _tcscmp
|
||||
# define _tinydir_strrchr _tcsrchr
|
||||
# define _tinydir_strncmp _tcsncmp
|
||||
#else
|
||||
# define _tinydir_char_t char
|
||||
# define TINYDIR_STRING(s) s
|
||||
# define _tinydir_strlen strlen
|
||||
# define _tinydir_strcpy strcpy
|
||||
# define _tinydir_strcat strcat
|
||||
# define _tinydir_strcmp strcmp
|
||||
# define _tinydir_strrchr strrchr
|
||||
# define _tinydir_strncmp strncmp
|
||||
#endif
|
||||
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
# include <windows.h>
|
||||
# define _TINYDIR_PATH_MAX MAX_PATH
|
||||
#elif defined __linux__
|
||||
# include <limits.h>
|
||||
# ifdef PATH_MAX
|
||||
# define _TINYDIR_PATH_MAX PATH_MAX
|
||||
# endif
|
||||
#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
# include <sys/param.h>
|
||||
# if defined(BSD)
|
||||
# include <limits.h>
|
||||
# ifdef PATH_MAX
|
||||
# define _TINYDIR_PATH_MAX PATH_MAX
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _TINYDIR_PATH_MAX
|
||||
#define _TINYDIR_PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* extra chars for the "\\*" mask */
|
||||
# define _TINYDIR_PATH_EXTRA 2
|
||||
#else
|
||||
# define _TINYDIR_PATH_EXTRA 0
|
||||
#endif
|
||||
|
||||
#define _TINYDIR_FILENAME_MAX 256
|
||||
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
#define _TINYDIR_DRIVE_MAX 3
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define _TINYDIR_FUNC static __inline
|
||||
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
|
||||
# define _TINYDIR_FUNC static __inline__
|
||||
#else
|
||||
# define _TINYDIR_FUNC static inline
|
||||
#endif
|
||||
|
||||
/* readdir_r usage; define TINYDIR_USE_READDIR_R to use it (if supported) */
|
||||
#ifdef TINYDIR_USE_READDIR_R
|
||||
|
||||
/* readdir_r is a POSIX-only function, and may not be available under various
|
||||
* environments/settings, e.g. MinGW. Use readdir fallback */
|
||||
#if _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE ||\
|
||||
_POSIX_SOURCE
|
||||
# define _TINYDIR_HAS_READDIR_R
|
||||
#endif
|
||||
#if _POSIX_C_SOURCE >= 200112L
|
||||
# define _TINYDIR_HAS_FPATHCONF
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#if _BSD_SOURCE || _SVID_SOURCE || \
|
||||
(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
|
||||
# define _TINYDIR_HAS_DIRFD
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if defined _TINYDIR_HAS_FPATHCONF && defined _TINYDIR_HAS_DIRFD &&\
|
||||
defined _PC_NAME_MAX
|
||||
# define _TINYDIR_USE_FPATHCONF
|
||||
#endif
|
||||
#if defined __MINGW32__ || !defined _TINYDIR_HAS_READDIR_R ||\
|
||||
!(defined _TINYDIR_USE_FPATHCONF || defined NAME_MAX)
|
||||
# define _TINYDIR_USE_READDIR
|
||||
#endif
|
||||
|
||||
/* Use readdir by default */
|
||||
#else
|
||||
# define _TINYDIR_USE_READDIR
|
||||
#endif
|
||||
|
||||
/* MINGW32 has two versions of dirent, ASCII and UNICODE*/
|
||||
#ifndef _MSC_VER
|
||||
#if (defined __MINGW32__) && (defined _UNICODE)
|
||||
#define _TINYDIR_DIR _WDIR
|
||||
#define _tinydir_dirent _wdirent
|
||||
#define _tinydir_opendir _wopendir
|
||||
#define _tinydir_readdir _wreaddir
|
||||
#define _tinydir_closedir _wclosedir
|
||||
#else
|
||||
#define _TINYDIR_DIR DIR
|
||||
#define _tinydir_dirent dirent
|
||||
#define _tinydir_opendir opendir
|
||||
#define _tinydir_readdir readdir
|
||||
#define _tinydir_closedir closedir
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Allow user to use a custom allocator by defining _TINYDIR_MALLOC and _TINYDIR_FREE. */
|
||||
#if defined(_TINYDIR_MALLOC) && defined(_TINYDIR_FREE)
|
||||
#elif !defined(_TINYDIR_MALLOC) && !defined(_TINYDIR_FREE)
|
||||
#else
|
||||
#error "Either define both alloc and free or none of them!"
|
||||
#endif
|
||||
|
||||
#if !defined(_TINYDIR_MALLOC)
|
||||
#define _TINYDIR_MALLOC(_size) malloc(_size)
|
||||
#define _TINYDIR_FREE(_ptr) free(_ptr)
|
||||
#endif /* !defined(_TINYDIR_MALLOC) */
|
||||
|
||||
typedef struct tinydir_file
|
||||
{
|
||||
_tinydir_char_t path[_TINYDIR_PATH_MAX];
|
||||
_tinydir_char_t name[_TINYDIR_FILENAME_MAX];
|
||||
_tinydir_char_t *extension;
|
||||
int is_dir;
|
||||
int is_reg;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifdef __MINGW32__
|
||||
struct _stat _s;
|
||||
#else
|
||||
struct stat _s;
|
||||
#endif
|
||||
#endif
|
||||
} tinydir_file;
|
||||
|
||||
typedef struct tinydir_dir
|
||||
{
|
||||
_tinydir_char_t path[_TINYDIR_PATH_MAX];
|
||||
int has_next;
|
||||
size_t n_files;
|
||||
|
||||
tinydir_file *_files;
|
||||
#ifdef _MSC_VER
|
||||
HANDLE _h;
|
||||
WIN32_FIND_DATA _f;
|
||||
#else
|
||||
_TINYDIR_DIR *_d;
|
||||
struct _tinydir_dirent *_e;
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
struct _tinydir_dirent *_ep;
|
||||
#endif
|
||||
#endif
|
||||
} tinydir_dir;
|
||||
|
||||
|
||||
/* declarations */
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path);
|
||||
_TINYDIR_FUNC
|
||||
void tinydir_close(tinydir_dir *dir);
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_next(tinydir_dir *dir);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i);
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_subdir_n(tinydir_dir *dir, size_t i);
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path);
|
||||
_TINYDIR_FUNC
|
||||
void _tinydir_get_ext(tinydir_file *file);
|
||||
_TINYDIR_FUNC
|
||||
int _tinydir_file_cmp(const void *a, const void *b);
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
_TINYDIR_FUNC
|
||||
size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* definitions*/
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path)
|
||||
{
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
int error;
|
||||
int size; /* using int size */
|
||||
#endif
|
||||
#else
|
||||
_tinydir_char_t path_buf[_TINYDIR_PATH_MAX];
|
||||
#endif
|
||||
_tinydir_char_t *pathp;
|
||||
|
||||
if (dir == NULL || path == NULL || _tinydir_strlen(path) == 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* initialise dir */
|
||||
dir->_files = NULL;
|
||||
#ifdef _MSC_VER
|
||||
dir->_h = INVALID_HANDLE_VALUE;
|
||||
#else
|
||||
dir->_d = NULL;
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
dir->_ep = NULL;
|
||||
#endif
|
||||
#endif
|
||||
tinydir_close(dir);
|
||||
|
||||
_tinydir_strcpy(dir->path, path);
|
||||
/* Remove trailing slashes */
|
||||
pathp = &dir->path[_tinydir_strlen(dir->path) - 1];
|
||||
while (pathp != dir->path && (*pathp == TINYDIR_STRING('\\') || *pathp == TINYDIR_STRING('/')))
|
||||
{
|
||||
*pathp = TINYDIR_STRING('\0');
|
||||
pathp++;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
_tinydir_strcpy(path_buf, dir->path);
|
||||
_tinydir_strcat(path_buf, TINYDIR_STRING("\\*"));
|
||||
#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
|
||||
dir->_h = FindFirstFileEx(path_buf, FindExInfoStandard, &dir->_f, FindExSearchNameMatch, NULL, 0);
|
||||
#else
|
||||
dir->_h = FindFirstFile(path_buf, &dir->_f);
|
||||
#endif
|
||||
if (dir->_h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
errno = ENOENT;
|
||||
#else
|
||||
dir->_d = _tinydir_opendir(path);
|
||||
if (dir->_d == NULL)
|
||||
{
|
||||
#endif
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* read first file */
|
||||
dir->has_next = 1;
|
||||
#ifndef _MSC_VER
|
||||
#ifdef _TINYDIR_USE_READDIR
|
||||
dir->_e = _tinydir_readdir(dir->_d);
|
||||
#else
|
||||
/* allocate dirent buffer for readdir_r */
|
||||
size = _tinydir_dirent_buf_size(dir->_d); /* conversion to int */
|
||||
if (size == -1) return -1;
|
||||
dir->_ep = (struct _tinydir_dirent*)_TINYDIR_MALLOC(size);
|
||||
if (dir->_ep == NULL) return -1;
|
||||
|
||||
error = readdir_r(dir->_d, dir->_ep, &dir->_e);
|
||||
if (error != 0) return -1;
|
||||
#endif
|
||||
if (dir->_e == NULL)
|
||||
{
|
||||
dir->has_next = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
bail:
|
||||
tinydir_close(dir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path)
|
||||
{
|
||||
/* Count the number of files first, to pre-allocate the files array */
|
||||
size_t n_files = 0;
|
||||
if (tinydir_open(dir, path) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
while (dir->has_next)
|
||||
{
|
||||
n_files++;
|
||||
if (tinydir_next(dir) == -1)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
tinydir_close(dir);
|
||||
|
||||
if (n_files == 0 || tinydir_open(dir, path) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
dir->n_files = 0;
|
||||
dir->_files = (tinydir_file *)_TINYDIR_MALLOC(sizeof *dir->_files * n_files);
|
||||
if (dir->_files == NULL)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
while (dir->has_next)
|
||||
{
|
||||
tinydir_file *p_file;
|
||||
dir->n_files++;
|
||||
|
||||
p_file = &dir->_files[dir->n_files - 1];
|
||||
if (tinydir_readfile(dir, p_file) == -1)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (tinydir_next(dir) == -1)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Just in case the number of files has changed between the first and
|
||||
second reads, terminate without writing into unallocated memory */
|
||||
if (dir->n_files == n_files)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qsort(dir->_files, dir->n_files, sizeof(tinydir_file), _tinydir_file_cmp);
|
||||
|
||||
return 0;
|
||||
|
||||
bail:
|
||||
tinydir_close(dir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
void tinydir_close(tinydir_dir *dir)
|
||||
{
|
||||
if (dir == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
memset(dir->path, 0, sizeof(dir->path));
|
||||
dir->has_next = 0;
|
||||
dir->n_files = 0;
|
||||
_TINYDIR_FREE(dir->_files);
|
||||
dir->_files = NULL;
|
||||
#ifdef _MSC_VER
|
||||
if (dir->_h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose(dir->_h);
|
||||
}
|
||||
dir->_h = INVALID_HANDLE_VALUE;
|
||||
#else
|
||||
if (dir->_d)
|
||||
{
|
||||
_tinydir_closedir(dir->_d);
|
||||
}
|
||||
dir->_d = NULL;
|
||||
dir->_e = NULL;
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
_TINYDIR_FREE(dir->_ep);
|
||||
dir->_ep = NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_next(tinydir_dir *dir)
|
||||
{
|
||||
if (dir == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!dir->has_next)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
if (FindNextFile(dir->_h, &dir->_f) == 0)
|
||||
#else
|
||||
#ifdef _TINYDIR_USE_READDIR
|
||||
dir->_e = _tinydir_readdir(dir->_d);
|
||||
#else
|
||||
if (dir->_ep == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (readdir_r(dir->_d, dir->_ep, &dir->_e) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if (dir->_e == NULL)
|
||||
#endif
|
||||
{
|
||||
dir->has_next = 0;
|
||||
#ifdef _MSC_VER
|
||||
if (GetLastError() != ERROR_SUCCESS &&
|
||||
GetLastError() != ERROR_NO_MORE_FILES)
|
||||
{
|
||||
tinydir_close(dir);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file)
|
||||
{
|
||||
const _tinydir_char_t *filename;
|
||||
if (dir == NULL || file == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
if (dir->_h == INVALID_HANDLE_VALUE)
|
||||
#else
|
||||
if (dir->_e == NULL)
|
||||
#endif
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
filename =
|
||||
#ifdef _MSC_VER
|
||||
dir->_f.cFileName;
|
||||
#else
|
||||
dir->_e->d_name;
|
||||
#endif
|
||||
if (_tinydir_strlen(dir->path) +
|
||||
_tinydir_strlen(filename) + 1 + _TINYDIR_PATH_EXTRA >=
|
||||
_TINYDIR_PATH_MAX)
|
||||
{
|
||||
/* the path for the file will be too long */
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
if (_tinydir_strlen(filename) >= _TINYDIR_FILENAME_MAX)
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
_tinydir_strcpy(file->path, dir->path);
|
||||
_tinydir_strcat(file->path, TINYDIR_STRING("/"));
|
||||
_tinydir_strcpy(file->name, filename);
|
||||
_tinydir_strcat(file->path, filename);
|
||||
#ifndef _MSC_VER
|
||||
#ifdef __MINGW32__
|
||||
if (_tstat(
|
||||
#elif (defined _BSD_SOURCE) || (defined _DEFAULT_SOURCE) \
|
||||
|| ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)) \
|
||||
|| ((defined _POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
|
||||
if (lstat(
|
||||
#else
|
||||
if (stat(
|
||||
#endif
|
||||
file->path, &file->_s) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
_tinydir_get_ext(file);
|
||||
|
||||
file->is_dir =
|
||||
#ifdef _MSC_VER
|
||||
!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
|
||||
#else
|
||||
S_ISDIR(file->_s.st_mode);
|
||||
#endif
|
||||
file->is_reg =
|
||||
#ifdef _MSC_VER
|
||||
!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) ||
|
||||
(
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DEVICE) &&
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) &&
|
||||
#ifdef FILE_ATTRIBUTE_INTEGRITY_STREAM
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_INTEGRITY_STREAM) &&
|
||||
#endif
|
||||
#ifdef FILE_ATTRIBUTE_NO_SCRUB_DATA
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NO_SCRUB_DATA) &&
|
||||
#endif
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) &&
|
||||
!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY));
|
||||
#else
|
||||
S_ISREG(file->_s.st_mode);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i)
|
||||
{
|
||||
if (dir == NULL || file == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (i >= dir->n_files)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(file, &dir->_files[i], sizeof(tinydir_file));
|
||||
_tinydir_get_ext(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_open_subdir_n(tinydir_dir *dir, size_t i)
|
||||
{
|
||||
_tinydir_char_t path[_TINYDIR_PATH_MAX];
|
||||
if (dir == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (i >= dir->n_files || !dir->_files[i].is_dir)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
_tinydir_strcpy(path, dir->_files[i].path);
|
||||
tinydir_close(dir);
|
||||
if (tinydir_open_sorted(dir, path) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Open a single file given its path */
|
||||
_TINYDIR_FUNC
|
||||
int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path)
|
||||
{
|
||||
tinydir_dir dir;
|
||||
int result = 0;
|
||||
int found = 0;
|
||||
_tinydir_char_t dir_name_buf[_TINYDIR_PATH_MAX];
|
||||
_tinydir_char_t file_name_buf[_TINYDIR_FILENAME_MAX];
|
||||
_tinydir_char_t *dir_name;
|
||||
_tinydir_char_t *base_name;
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
_tinydir_char_t drive_buf[_TINYDIR_PATH_MAX];
|
||||
_tinydir_char_t ext_buf[_TINYDIR_FILENAME_MAX];
|
||||
#endif
|
||||
|
||||
if (file == NULL || path == NULL || _tinydir_strlen(path) == 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the parent path */
|
||||
#if (defined _MSC_VER || defined __MINGW32__)
|
||||
#if ((defined _MSC_VER) && (_MSC_VER >= 1400))
|
||||
errno = _tsplitpath_s(
|
||||
path,
|
||||
drive_buf, _TINYDIR_DRIVE_MAX,
|
||||
dir_name_buf, _TINYDIR_FILENAME_MAX,
|
||||
file_name_buf, _TINYDIR_FILENAME_MAX,
|
||||
ext_buf, _TINYDIR_FILENAME_MAX);
|
||||
#else
|
||||
_tsplitpath(
|
||||
path,
|
||||
drive_buf,
|
||||
dir_name_buf,
|
||||
file_name_buf,
|
||||
ext_buf);
|
||||
#endif
|
||||
|
||||
if (errno)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* _splitpath_s not work fine with only filename and widechar support */
|
||||
#ifdef _UNICODE
|
||||
if (drive_buf[0] == L'\xFEFE')
|
||||
drive_buf[0] = '\0';
|
||||
if (dir_name_buf[0] == L'\xFEFE')
|
||||
dir_name_buf[0] = '\0';
|
||||
#endif
|
||||
|
||||
/* Emulate the behavior of dirname by returning "." for dir name if it's
|
||||
empty */
|
||||
if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0')
|
||||
{
|
||||
_tinydir_strcpy(dir_name_buf, TINYDIR_STRING("."));
|
||||
}
|
||||
/* Concatenate the drive letter and dir name to form full dir name */
|
||||
_tinydir_strcat(drive_buf, dir_name_buf);
|
||||
dir_name = drive_buf;
|
||||
/* Concatenate the file name and extension to form base name */
|
||||
_tinydir_strcat(file_name_buf, ext_buf);
|
||||
base_name = file_name_buf;
|
||||
#else
|
||||
_tinydir_strcpy(dir_name_buf, path);
|
||||
dir_name = dirname(dir_name_buf);
|
||||
_tinydir_strcpy(file_name_buf, path);
|
||||
base_name =basename(file_name_buf);
|
||||
#endif
|
||||
|
||||
/* Open the parent directory */
|
||||
if (tinydir_open(&dir, dir_name) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read through the parent directory and look for the file */
|
||||
while (dir.has_next)
|
||||
{
|
||||
if (tinydir_readfile(&dir, file) == -1)
|
||||
{
|
||||
result = -1;
|
||||
goto bail;
|
||||
}
|
||||
if (_tinydir_strcmp(file->name, base_name) == 0)
|
||||
{
|
||||
/* File found */
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
tinydir_next(&dir);
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
result = -1;
|
||||
errno = ENOENT;
|
||||
}
|
||||
|
||||
bail:
|
||||
tinydir_close(&dir);
|
||||
return result;
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
void _tinydir_get_ext(tinydir_file *file)
|
||||
{
|
||||
_tinydir_char_t *period = _tinydir_strrchr(file->name, TINYDIR_STRING('.'));
|
||||
if (period == NULL)
|
||||
{
|
||||
file->extension = &(file->name[_tinydir_strlen(file->name)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
file->extension = period + 1;
|
||||
}
|
||||
}
|
||||
|
||||
_TINYDIR_FUNC
|
||||
int _tinydir_file_cmp(const void *a, const void *b)
|
||||
{
|
||||
const tinydir_file *fa = (const tinydir_file *)a;
|
||||
const tinydir_file *fb = (const tinydir_file *)b;
|
||||
if (fa->is_dir != fb->is_dir)
|
||||
{
|
||||
return -(fa->is_dir - fb->is_dir);
|
||||
}
|
||||
return _tinydir_strncmp(fa->name, fb->name, _TINYDIR_FILENAME_MAX);
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _TINYDIR_USE_READDIR
|
||||
/*
|
||||
The following authored by Ben Hutchings <ben@decadent.org.uk>
|
||||
from https://womble.decadent.org.uk/readdir_r-advisory.html
|
||||
*/
|
||||
/* Calculate the required buffer size (in bytes) for directory *
|
||||
* entries read from the given directory handle. Return -1 if this *
|
||||
* this cannot be done. *
|
||||
* *
|
||||
* This code does not trust values of NAME_MAX that are less than *
|
||||
* 255, since some systems (including at least HP-UX) incorrectly *
|
||||
* define it to be a smaller value. */
|
||||
_TINYDIR_FUNC
|
||||
size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp)
|
||||
{
|
||||
long name_max;
|
||||
size_t name_end;
|
||||
/* parameter may be unused */
|
||||
(void)dirp;
|
||||
|
||||
#if defined _TINYDIR_USE_FPATHCONF
|
||||
name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX);
|
||||
if (name_max == -1)
|
||||
#if defined(NAME_MAX)
|
||||
name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
|
||||
#else
|
||||
return (size_t)(-1);
|
||||
#endif
|
||||
#elif defined(NAME_MAX)
|
||||
name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
|
||||
#else
|
||||
#error "buffer size for readdir_r cannot be determined"
|
||||
#endif
|
||||
name_end = (size_t)offsetof(struct _tinydir_dirent, d_name) + name_max + 1;
|
||||
return (name_end > sizeof(struct _tinydir_dirent) ?
|
||||
name_end : sizeof(struct _tinydir_dirent));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# if defined (_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
975
include/vcmp.h
975
include/vcmp.h
@@ -1,975 +0,0 @@
|
||||
/*
|
||||
Project: Vice City Multiplayer 0.4 Server / Plugin Kit
|
||||
File: plugin.h
|
||||
|
||||
Copyright 2011-2016 Ago Allikmaa (maxorator)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
uint32_t structSize;
|
||||
char serverName[128];
|
||||
uint32_t maxPlayers;
|
||||
uint32_t port;
|
||||
uint32_t flags;
|
||||
} ServerSettings;
|
||||
|
||||
#define PLUGIN_API_MAJOR 2
|
||||
#define PLUGIN_API_MINOR 0
|
||||
|
||||
typedef struct {
|
||||
uint32_t structSize;
|
||||
uint32_t pluginId;
|
||||
char name[32];
|
||||
uint32_t pluginVersion;
|
||||
uint16_t apiMajorVersion;
|
||||
uint16_t apiMinorVersion;
|
||||
} PluginInfo;
|
||||
|
||||
typedef enum {
|
||||
vcmpErrorNone = 0,
|
||||
vcmpErrorNoSuchEntity = 1,
|
||||
vcmpErrorBufferTooSmall = 2,
|
||||
vcmpErrorTooLargeInput = 3,
|
||||
vcmpErrorArgumentOutOfBounds = 4,
|
||||
vcmpErrorNullArgument = 5,
|
||||
vcmpErrorPoolExhausted = 6,
|
||||
vcmpErrorInvalidName = 7,
|
||||
vcmpErrorRequestDenied = 8,
|
||||
forceSizeVcmpError = INT32_MAX
|
||||
} vcmpError;
|
||||
|
||||
typedef enum {
|
||||
vcmpEntityPoolVehicle = 1,
|
||||
vcmpEntityPoolObject = 2,
|
||||
vcmpEntityPoolPickup = 3,
|
||||
vcmpEntityPoolRadio = 4,
|
||||
vcmpEntityPoolBlip = 7,
|
||||
vcmpEntityPoolCheckPoint = 8,
|
||||
forceSizeVcmpEntityPool = INT32_MAX
|
||||
} vcmpEntityPool;
|
||||
|
||||
typedef enum {
|
||||
vcmpDisconnectReasonTimeout = 0,
|
||||
vcmpDisconnectReasonQuit = 1,
|
||||
vcmpDisconnectReasonKick = 2,
|
||||
vcmpDisconnectReasonCrash = 3,
|
||||
vcmpDisconnectReasonAntiCheat = 4,
|
||||
forceSizeVcmpDisconnectReason = INT32_MAX
|
||||
} vcmpDisconnectReason;
|
||||
|
||||
typedef enum {
|
||||
vcmpBodyPartBody = 0,
|
||||
vcmpBodyPartTorso = 1,
|
||||
vcmpBodyPartLeftArm = 2,
|
||||
vcmpBodyPartRightArm = 3,
|
||||
vcmpBodyPartLeftLeg = 4,
|
||||
vcmpBodyPartRightLeg = 5,
|
||||
vcmpBodyPartHead = 6,
|
||||
vcmpBodyPartInVehicle = 7,
|
||||
forceSizeVcmpBodyPart = INT32_MAX
|
||||
} vcmpBodyPart;
|
||||
|
||||
typedef enum {
|
||||
vcmpPlayerStateNone = 0,
|
||||
vcmpPlayerStateNormal = 1,
|
||||
vcmpPlayerStateAim = 2,
|
||||
vcmpPlayerStateDriver = 3,
|
||||
vcmpPlayerStatePassenger = 4,
|
||||
vcmpPlayerStateEnterDriver = 5,
|
||||
vcmpPlayerStateEnterPassenger = 6,
|
||||
vcmpPlayerStateExit = 7,
|
||||
vcmpPlayerStateUnspawned = 8,
|
||||
forceSizeVcmpPlayerState = INT32_MAX
|
||||
} vcmpPlayerState;
|
||||
|
||||
typedef enum {
|
||||
vcmpPlayerUpdateNormal = 0,
|
||||
vcmpPlayerUpdateAiming = 1,
|
||||
vcmpPlayerUpdateDriver = 2,
|
||||
vcmpPlayerUpdatePassenger = 3,
|
||||
forceSizeVcmpPlayerUpdate = INT32_MAX
|
||||
} vcmpPlayerUpdate;
|
||||
|
||||
typedef enum {
|
||||
vcmpPlayerVehicleOut = 0,
|
||||
vcmpPlayerVehicleEntering = 1,
|
||||
vcmpPlayerVehicleExiting = 2,
|
||||
vcmpPlayerVehicleIn = 3,
|
||||
forceSizeVcmpPlayerVehicle = INT32_MAX
|
||||
} vcmpPlayerVehicle;
|
||||
|
||||
typedef enum {
|
||||
vcmpVehicleSyncNone = 0,
|
||||
vcmpVehicleSyncDriver = 1,
|
||||
vcmpVehicleSyncPassenger = 3,
|
||||
vcmpVehicleSyncNear = 4,
|
||||
forceSizeVcmpVehicleSync = INT32_MAX
|
||||
} vcmpVehicleSync;
|
||||
|
||||
typedef enum {
|
||||
vcmpVehicleUpdateDriverSync = 0,
|
||||
vcmpVehicleUpdateOtherSync = 1,
|
||||
vcmpVehicleUpdatePosition = 2,
|
||||
vcmpVehicleUpdateHealth = 4,
|
||||
vcmpVehicleUpdateColour = 5,
|
||||
vcmpVehicleUpdateRotation = 6,
|
||||
forceSizeVcmpVehicleUpdate = INT32_MAX
|
||||
} vcmpVehicleUpdate;
|
||||
|
||||
typedef enum {
|
||||
vcmpServerOptionSyncFrameLimiter = 0,
|
||||
vcmpServerOptionFrameLimiter = 1,
|
||||
vcmpServerOptionTaxiBoostJump = 2,
|
||||
vcmpServerOptionDriveOnWater = 3,
|
||||
vcmpServerOptionFastSwitch = 4,
|
||||
vcmpServerOptionFriendlyFire = 5,
|
||||
vcmpServerOptionDisableDriveBy = 6,
|
||||
vcmpServerOptionPerfectHandling = 7,
|
||||
vcmpServerOptionFlyingCars = 8,
|
||||
vcmpServerOptionJumpSwitch = 9,
|
||||
vcmpServerOptionShowMarkers = 10,
|
||||
vcmpServerOptionOnlyShowTeamMarkers = 11,
|
||||
vcmpServerOptionStuntBike = 12,
|
||||
vcmpServerOptionShootInAir = 13,
|
||||
vcmpServerOptionShowNameTags = 14,
|
||||
vcmpServerOptionJoinMessages = 15,
|
||||
vcmpServerOptionDeathMessages = 16,
|
||||
vcmpServerOptionChatTagsEnabled = 17,
|
||||
vcmpServerOptionUseClasses = 18,
|
||||
vcmpServerOptionWallGlitch = 19,
|
||||
vcmpServerOptionDisableBackfaceCulling = 20,
|
||||
vcmpServerOptionDisableHeliBladeDamage = 21,
|
||||
forceSizeVcmpServerOption = INT32_MAX
|
||||
} vcmpServerOption;
|
||||
|
||||
typedef enum {
|
||||
vcmpPlayerOptionControllable = 0,
|
||||
vcmpPlayerOptionDriveBy = 1,
|
||||
vcmpPlayerOptionWhiteScanlines = 2,
|
||||
vcmpPlayerOptionGreenScanlines = 3,
|
||||
vcmpPlayerOptionWidescreen = 4,
|
||||
vcmpPlayerOptionShowMarkers = 5,
|
||||
vcmpPlayerOptionCanAttack = 6,
|
||||
vcmpPlayerOptionHasMarker = 7,
|
||||
vcmpPlayerOptionChatTagsEnabled = 8,
|
||||
vcmpPlayerOptionDrunkEffects = 9,
|
||||
forceSizeVcmpPlayerOption = INT32_MAX
|
||||
} vcmpPlayerOption;
|
||||
|
||||
typedef enum {
|
||||
vcmpVehicleOptionDoorsLocked = 0,
|
||||
vcmpVehicleOptionAlarm = 1,
|
||||
vcmpVehicleOptionLights = 2,
|
||||
vcmpVehicleOptionRadioLocked = 3,
|
||||
vcmpVehicleOptionGhost = 4,
|
||||
vcmpVehicleOptionSiren = 5,
|
||||
vcmpVehicleOptionSingleUse = 6,
|
||||
forceSizeVcmpVehicleOption = INT32_MAX
|
||||
} vcmpVehicleOption;
|
||||
|
||||
typedef enum {
|
||||
vcmpPickupOptionSingleUse = 0,
|
||||
forceSizeVcmpPickupOption = INT32_MAX
|
||||
} vcmpPickupOption;
|
||||
|
||||
typedef struct {
|
||||
uint32_t structSize;
|
||||
|
||||
/**
|
||||
* Plugin system
|
||||
*/
|
||||
|
||||
/* success */
|
||||
uint32_t (*GetServerVersion) (void);
|
||||
/* vcmpErrorNullArgument */
|
||||
vcmpError (*GetServerSettings) (ServerSettings* settings);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*ExportFunctions) (int32_t pluginId, const void** functionList, size_t size);
|
||||
/* success */
|
||||
uint32_t (*GetNumberOfPlugins) (void);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument */
|
||||
vcmpError (*GetPluginInfo) (int32_t pluginId, PluginInfo* pluginInfo);
|
||||
/* -1 == vcmpEntityNone */
|
||||
int32_t (*FindPlugin) (const char* pluginName);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
const void** (*GetPluginExports) (int32_t pluginId, size_t* exportCount);
|
||||
/* vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SendPluginCommand) (uint32_t commandIdentifier, const char* format, ...);
|
||||
/* success */
|
||||
uint64_t (*GetTime) (void);
|
||||
/* vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*LogMessage) (const char* format, ...);
|
||||
/* success */
|
||||
vcmpError (*GetLastError) (void);
|
||||
|
||||
/**
|
||||
* Client messages
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SendClientScriptData) (int32_t playerId, const void* data, size_t size);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SendClientMessage) (int32_t playerId, uint32_t colour, const char* format, ...);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds, vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SendGameMessage) (int32_t playerId, int32_t type, const char* format, ...);
|
||||
|
||||
/*
|
||||
* Server settings
|
||||
*/
|
||||
|
||||
/* vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SetServerName) (const char* text);
|
||||
/* vcmpErrorNullArgument, vcmpErrorBufferTooSmall */
|
||||
vcmpError (*GetServerName) (char* buffer, size_t size);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetMaxPlayers) (uint32_t maxPlayers);
|
||||
/* success */
|
||||
uint32_t (*GetMaxPlayers) (void);
|
||||
/* vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SetServerPassword) (const char* password);
|
||||
/* vcmpErrorNullArgument, vcmpErrorBufferTooSmall */
|
||||
vcmpError (*GetServerPassword) (char* buffer, size_t size);
|
||||
/* vcmpErrorNullArgument, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SetGameModeText) (const char* gameMode);
|
||||
/* vcmpErrorNullArgument, vcmpErrorBufferTooSmall */
|
||||
vcmpError (*GetGameModeText) (char* buffer, size_t size);
|
||||
/* success */
|
||||
void (*ShutdownServer) (void);
|
||||
|
||||
/*
|
||||
* Game environment settings
|
||||
*/
|
||||
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetServerOption) (vcmpServerOption option, uint8_t toggle);
|
||||
/* GetLastError: vcmpErrorArgumentOutOfBounds */
|
||||
uint8_t (*GetServerOption) (vcmpServerOption option);
|
||||
/* success */
|
||||
void (*SetWorldBounds) (float maxX, float minX, float maxY, float minY);
|
||||
/* success */
|
||||
void (*GetWorldBounds) (float* maxXOut, float* minXOut, float* maxYOut, float* minYOut);
|
||||
/* success */
|
||||
void (*SetWastedSettings) (uint32_t deathTimer, uint32_t fadeTimer, float fadeInSpeed, float fadeOutSpeed, uint32_t fadeColour, uint32_t corpseFadeStart, uint32_t corpseFadeTime);
|
||||
/* success */
|
||||
void (*GetWastedSettings) (uint32_t* deathTimerOut, uint32_t* fadeTimerOut, float* fadeInSpeedOut, float* fadeOutSpeedOut, uint32_t* fadeColourOut, uint32_t* corpseFadeStartOut, uint32_t* corpseFadeTimeOut);
|
||||
/* success */
|
||||
void (*SetTimeRate) (int32_t timeRate);
|
||||
/* success */
|
||||
int32_t (*GetTimeRate) (void);
|
||||
/* success */
|
||||
void (*SetHour) (int32_t hour);
|
||||
/* success */
|
||||
int32_t (*GetHour) (void);
|
||||
/* success */
|
||||
void (*SetMinute) (int32_t minute);
|
||||
/* success */
|
||||
int32_t (*GetMinute) (void);
|
||||
/* success */
|
||||
void (*SetWeather) (int32_t weather);
|
||||
/* success */
|
||||
int32_t (*GetWeather) (void);
|
||||
/* success */
|
||||
void (*SetGravity) (float gravity);
|
||||
/* success */
|
||||
float (*GetGravity) (void);
|
||||
/* success */
|
||||
void (*SetGameSpeed) (float gameSpeed);
|
||||
/* success */
|
||||
float (*GetGameSpeed) (void);
|
||||
/* success */
|
||||
void (*SetWaterLevel) (float waterLevel);
|
||||
/* success */
|
||||
float (*GetWaterLevel) (void);
|
||||
/* success */
|
||||
void (*SetMaximumFlightAltitude) (float height);
|
||||
/* success */
|
||||
float (*GetMaximumFlightAltitude) (void);
|
||||
/* success */
|
||||
void (*SetKillCommandDelay) (int32_t delay);
|
||||
/* success */
|
||||
int32_t (*GetKillCommandDelay) (void);
|
||||
/* success */
|
||||
void (*SetVehiclesForcedRespawnHeight) (float height);
|
||||
/* success */
|
||||
float (*GetVehiclesForcedRespawnHeight) (void);
|
||||
|
||||
/*
|
||||
* Miscellaneous things
|
||||
*/
|
||||
|
||||
/* vcmpErrorArgumentOutOfBounds, vcmpErrorNoSuchEntity */
|
||||
vcmpError (*CreateExplosion) (int32_t worldId, int32_t type, float x, float y, float z, int32_t responsiblePlayerId, uint8_t atGroundLevel);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*PlaySound) (int32_t worldId, int32_t soundId, float x, float y, float z);
|
||||
/* success */
|
||||
void (*HideMapObject) (int32_t modelId, int16_t tenthX, int16_t tenthY, int16_t tenthZ);
|
||||
/* success */
|
||||
void (*ShowMapObject) (int32_t modelId, int16_t tenthX, int16_t tenthY, int16_t tenthZ);
|
||||
/* success */
|
||||
void (*ShowAllMapObjects) (void);
|
||||
|
||||
/*
|
||||
* Weapon settings
|
||||
*/
|
||||
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetWeaponDataValue) (int32_t weaponId, int32_t fieldId, double value);
|
||||
/* GetLastError: vcmpErrorArgumentOutOfBounds */
|
||||
double (*GetWeaponDataValue) (int32_t weaponId, int32_t fieldId);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*ResetWeaponDataValue) (int32_t weaponId, int32_t fieldId);
|
||||
/* GetLastError: vcmpErrorArgumentOutOfBounds */
|
||||
uint8_t (*IsWeaponDataValueModified) (int32_t weaponId, int32_t fieldId);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*ResetWeaponData) (int32_t weaponId);
|
||||
/* success */
|
||||
void (*ResetAllWeaponData) (void);
|
||||
|
||||
/*
|
||||
* Key binds
|
||||
*/
|
||||
|
||||
/* -1 == vcmpEntityNone */
|
||||
int32_t (*GetKeyBindUnusedSlot) (void);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetKeyBindData) (int32_t bindId, uint8_t* isCalledOnReleaseOut, int32_t* keyOneOut, int32_t* keyTwoOut, int32_t* keyThreeOut);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*RegisterKeyBind) (int32_t bindId, uint8_t isCalledOnRelease, int32_t keyOne, int32_t keyTwo, int32_t keyThree);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RemoveKeyBind) (int32_t bindId);
|
||||
/* success */
|
||||
void (*RemoveAllKeyBinds) (void);
|
||||
|
||||
/*
|
||||
* Coordinate blips
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpErrorPoolExhausted */
|
||||
int32_t (*CreateCoordBlip) (int32_t index, int32_t world, float x, float y, float z, int32_t scale, uint32_t colour, int32_t sprite);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*DestroyCoordBlip) (int32_t index);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetCoordBlipInfo) (int32_t index, int32_t* worldOut, float* xOut, float* yOUt, float* zOut, int32_t* scaleOut, uint32_t* colourOut, int32_t* spriteOut);
|
||||
|
||||
/*
|
||||
* Radios
|
||||
*/
|
||||
|
||||
/* vcmpErrorArgumentOutOfBounds, vcmpErrorNullArgument */
|
||||
vcmpError (*AddRadioStream) (int32_t radioId, const char* radioName, const char* radioUrl, uint8_t isListed);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RemoveRadioStream) (int32_t radioId);
|
||||
|
||||
/*
|
||||
* Spawning and classes
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpErrorArgumentOutOfBounds, vcmpErrorPoolExhausted */
|
||||
int32_t (*AddPlayerClass) (int32_t teamId, uint32_t colour, int32_t modelIndex, float x, float y, float z, float angle, int32_t weaponOne, int32_t weaponOneAmmo, int32_t weaponTwo, int32_t weaponTwoAmmo, int32_t weaponThree, int32_t weaponThreeAmmo);
|
||||
/* success */
|
||||
void (*SetSpawnPlayerPosition) (float x, float y, float z);
|
||||
/* success */
|
||||
void (*SetSpawnCameraPosition) (float x, float y, float z);
|
||||
/* success */
|
||||
void (*SetSpawnCameraLookAt) (float x, float y, float z);
|
||||
|
||||
/*
|
||||
* Administration
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerAdmin) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerAdmin) (int32_t playerId, uint8_t toggle);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */
|
||||
vcmpError (*GetPlayerIP) (int32_t playerId, char* buffer, size_t size);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */
|
||||
vcmpError (*GetPlayerUID) (int32_t playerId, char* buffer, size_t size);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */
|
||||
vcmpError (*GetPlayerUID2) (int32_t playerId, char* buffer, size_t size);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*KickPlayer) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*BanPlayer) (int32_t playerId);
|
||||
/* success */
|
||||
void (*BanIP) (char* ipAddress);
|
||||
/* success */
|
||||
uint8_t (*UnbanIP) (char* ipAddress);
|
||||
/* success */
|
||||
uint8_t (*IsIPBanned) (char* ipAddress);
|
||||
|
||||
/*
|
||||
* Player access and basic info
|
||||
*/
|
||||
|
||||
/* -1 == vcmpEntityNone */
|
||||
int32_t (*GetPlayerIdFromName) (const char* name);
|
||||
/* success */
|
||||
uint8_t (*IsPlayerConnected) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerStreamedForPlayer) (int32_t checkedPlayerId, int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetPlayerKey) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */
|
||||
vcmpError (*GetPlayerName) (int32_t playerId, char* buffer, size_t size);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorInvalidName, vcmpErrorTooLargeInput */
|
||||
vcmpError (*SetPlayerName) (int32_t playerId, const char* name);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
vcmpPlayerState (*GetPlayerState) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetPlayerOption) (int32_t playerId, vcmpPlayerOption option, uint8_t toggle);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
uint8_t (*GetPlayerOption) (int32_t playerId, vcmpPlayerOption option);
|
||||
|
||||
/*
|
||||
* Player world
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerWorld) (int32_t playerId, int32_t world);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerWorld) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerSecondaryWorld) (int32_t playerId, int32_t secondaryWorld);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerSecondaryWorld) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerUniqueWorld) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerWorldCompatible) (int32_t playerId, int32_t world);
|
||||
|
||||
/*
|
||||
* Player class, team, skin, colour
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerClass) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetPlayerTeam) (int32_t playerId, int32_t teamId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerTeam) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetPlayerSkin) (int32_t playerId, int32_t skinId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerSkin) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerColour) (int32_t playerId, uint32_t colour);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetPlayerColour) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player spawn cycle
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerSpawned) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*ForcePlayerSpawn) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*ForcePlayerSelect) (int32_t playerId);
|
||||
/* success */
|
||||
void (*ForceAllSelect) (void);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerTyping) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player money, score, wanted level
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GivePlayerMoney) (int32_t playerId, int32_t amount);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerMoney) (int32_t playerId, int32_t amount);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerMoney) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerScore) (int32_t playerId, int32_t score);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerScore) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerWantedLevel) (int32_t playerId, int32_t level);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerWantedLevel) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerPing) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
double (*GetPlayerFPS) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player health and immunity
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerHealth) (int32_t playerId, float health);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
float (*GetPlayerHealth) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerArmour) (int32_t playerId, float armour);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
float (*GetPlayerArmour) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerImmunityFlags) (int32_t playerId, uint32_t flags);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetPlayerImmunityFlags) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player position and rotation
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerPosition) (int32_t playerId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetPlayerPosition) (int32_t playerId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerSpeed) (int32_t playerId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetPlayerSpeed) (int32_t playerId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*AddPlayerSpeed) (int32_t playerId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerHeading) (int32_t playerId, float angle);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
float (*GetPlayerHeading) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerAlpha) (int32_t playerId, int32_t alpha, uint32_t fadeTime);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerAlpha) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetPlayerAimPosition) (int32_t playerId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetPlayerAimDirection) (int32_t playerId, float* xOut, float* yOut, float* zOut);
|
||||
|
||||
/*
|
||||
* Player actions and keys
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerOnFire) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerCrouching) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerAction) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetPlayerGameKeys) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player vehicle
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds, vcmpErrorRequestDenied */
|
||||
vcmpError (*PutPlayerInVehicle) (int32_t playerId, int32_t vehicleId, int32_t slotIndex, uint8_t makeRoom, uint8_t warp);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RemovePlayerFromVehicle) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
vcmpPlayerVehicle (*GetPlayerInVehicleStatus) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerInVehicleSlot) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerVehicleId) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player weapons
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*GivePlayerWeapon) (int32_t playerId, int32_t weaponId, int32_t ammo);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetPlayerWeapon) (int32_t playerId, int32_t weaponId, int32_t ammo);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerWeapon) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerWeaponAmmo) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetPlayerWeaponSlot) (int32_t playerId, int32_t slot);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerWeaponSlot) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
int32_t (*GetPlayerWeaponAtSlot) (int32_t playerId, int32_t slot);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
int32_t (*GetPlayerAmmoAtSlot) (int32_t playerId, int32_t slot);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RemovePlayerWeapon) (int32_t playerId, int32_t weaponId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RemoveAllWeapons) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player camera
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetCameraPosition) (int32_t playerId, float posX, float posY, float posZ, float lookX, float lookY, float lookZ);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RestoreCamera) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsCameraLocked) (int32_t playerId);
|
||||
|
||||
/*
|
||||
* Player miscellaneous stuff
|
||||
*/
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerAnimation) (int32_t playerId, int32_t groupId, int32_t animationId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerStandingOnVehicle) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerStandingOnObject) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPlayerAway) (int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPlayerSpectateTarget) (int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPlayerSpectateTarget) (int32_t playerId, int32_t targetId);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument */
|
||||
vcmpError (*RedirectPlayerToServer) (int32_t playerId, const char* ip, uint32_t port, const char* nick, const char* serverPassword, const char* userPassword);
|
||||
|
||||
/*
|
||||
* All entities
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpArgumentOutOfBounds */
|
||||
uint8_t (*CheckEntityExists) (vcmpEntityPool entityPool, int32_t index);
|
||||
|
||||
/*
|
||||
* Vehicles
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpErrorArgumentOutOfBounds, vcmpErrorPoolExhausted */
|
||||
int32_t (*CreateVehicle) (int32_t modelIndex, int32_t world, float x, float y, float z, float angle, int32_t primaryColour, int32_t secondaryColour);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*DeleteVehicle) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetVehicleOption) (int32_t vehicleId, vcmpVehicleOption option, uint8_t toggle);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
uint8_t (*GetVehicleOption) (int32_t vehicleId, vcmpVehicleOption option);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetVehicleSyncSource) (int32_t vehicleId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
vcmpVehicleSync (*GetVehicleSyncType) (int32_t vehicleId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsVehicleStreamedForPlayer) (int32_t vehicleId, int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleWorld) (int32_t vehicleId, int32_t world);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetVehicleWorld) (int32_t vehicleId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetVehicleModel) (int32_t vehicleId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
int32_t (*GetVehicleOccupant) (int32_t vehicleId, int32_t slotIndex);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RespawnVehicle) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleImmunityFlags) (int32_t vehicleId, uint32_t immunityFlags);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetVehicleImmunityFlags) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*ExplodeVehicle) (int32_t vehicleId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsVehicleWrecked) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehiclePosition) (int32_t vehicleId, float x, float y, float z, uint8_t removeOccupants);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehiclePosition) (int32_t vehicleId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleRotation) (int32_t vehicleId, float x, float y, float z, float w);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleRotationEuler) (int32_t vehicleId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleRotation) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, float* wOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleRotationEuler) (int32_t vehicleId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleSpeed) (int32_t vehicleId, float x, float y, float z, uint8_t add, uint8_t relative);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleSpeed) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, uint8_t relative);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleTurnSpeed) (int32_t vehicleId, float x, float y, float z, uint8_t add, uint8_t relative);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleTurnSpeed) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, uint8_t relative);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleSpawnPosition) (int32_t vehicleId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleSpawnPosition) (int32_t vehicleId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleSpawnRotation) (int32_t vehicleId, float x, float y, float z, float w);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleSpawnRotationEuler) (int32_t vehicleId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleSpawnRotation) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, float* wOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleSpawnRotationEuler) (int32_t vehicleId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleIdleRespawnTimer) (int32_t vehicleId, uint32_t millis);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetVehicleIdleRespawnTimer) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleHealth) (int32_t vehicleId, float health);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
float (*GetVehicleHealth) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleColour) (int32_t vehicleId, int32_t primaryColour, int32_t secondaryColour);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorNullArgument */
|
||||
vcmpError (*GetVehicleColour) (int32_t vehicleId, int32_t* primaryColourOut, int32_t* secondaryColourOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehiclePartStatus) (int32_t vehicleId, int32_t partId, int32_t status);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetVehiclePartStatus) (int32_t vehicleId, int32_t partId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleTyreStatus) (int32_t vehicleId, int32_t tyreId, int32_t status);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetVehicleTyreStatus) (int32_t vehicleId, int32_t tyreId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleDamageData) (int32_t vehicleId, uint32_t damageData);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetVehicleDamageData) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetVehicleRadio) (int32_t vehicleId, int32_t radioId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetVehicleRadio) (int32_t vehicleId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetVehicleTurretRotation) (int32_t vehicleId, float* horizontalOut, float* verticalOut);
|
||||
|
||||
/*
|
||||
* Vehicle handling
|
||||
*/
|
||||
|
||||
/* success */
|
||||
void (*ResetAllVehicleHandlings) (void);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
uint8_t (*ExistsHandlingRule) (int32_t modelIndex, int32_t ruleIndex);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetHandlingRule) (int32_t modelIndex, int32_t ruleIndex, double value);
|
||||
/* GetLastError: vcmpErrorArgumentOutOfBounds */
|
||||
double (*GetHandlingRule) (int32_t modelIndex, int32_t ruleIndex);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*ResetHandlingRule) (int32_t modelIndex, int32_t ruleIndex);
|
||||
/* vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*ResetHandling) (int32_t modelIndex);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
uint8_t (*ExistsInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex, double value);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
double (*GetInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex);
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*ResetInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*ResetInstHandling) (int32_t vehicleId);
|
||||
|
||||
/*
|
||||
* Pickups
|
||||
*/
|
||||
|
||||
/* vcmpErrorPoolExhausted */
|
||||
int32_t (*CreatePickup) (int32_t modelIndex, int32_t world, int32_t quantity, float x, float y, float z, int32_t alpha, uint8_t isAutomatic);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*DeletePickup) (int32_t pickupId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPickupStreamedForPlayer) (int32_t pickupId, int32_t playerId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPickupWorld) (int32_t pickupId, int32_t world);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPickupWorld) (int32_t pickupId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPickupAlpha) (int32_t pickupId, int32_t alpha);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPickupAlpha) (int32_t pickupId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPickupIsAutomatic) (int32_t pickupId, uint8_t toggle);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsPickupAutomatic) (int32_t pickupId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPickupAutoTimer) (int32_t pickupId, uint32_t durationMillis);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t (*GetPickupAutoTimer) (int32_t pickupId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RefreshPickup) (int32_t pickupId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetPickupPosition) (int32_t pickupId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetPickupPosition) (int32_t pickupId, float* xOut, float* yOut, float* zOut);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPickupModel) (int32_t pickupId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetPickupQuantity) (int32_t pickupId);
|
||||
|
||||
/*
|
||||
* Checkpoints
|
||||
*/
|
||||
|
||||
/* vcmpErrorPoolExhausted, vcmpErrorNoSuchEntity */
|
||||
int32_t (*CreateCheckPoint) (int32_t playerId, int32_t world, uint8_t isSphere, float x, float y, float z, int32_t red, int32_t green, int32_t blue, int32_t alpha, float radius);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*DeleteCheckPoint) (int32_t checkPointId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsCheckPointStreamedForPlayer) (int32_t checkPointId, int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsCheckPointSphere) (int32_t checkPointId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetCheckPointWorld) (int32_t checkPointId, int32_t world);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetCheckPointWorld) (int32_t checkPointId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetCheckPointColour) (int32_t checkPointId, int32_t red, int32_t green, int32_t blue, int32_t alpha);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetCheckPointColour) (int32_t checkPointId, int32_t* redOut, int32_t* greenOut, int32_t* blueOut, int32_t* alphaOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetCheckPointPosition) (int32_t checkPointId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetCheckPointPosition) (int32_t checkPointId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetCheckPointRadius) (int32_t checkPointId, float radius);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
float (*GetCheckPointRadius) (int32_t checkPointId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetCheckPointOwner) (int32_t checkPointId);
|
||||
|
||||
/*
|
||||
* Objects
|
||||
*/
|
||||
|
||||
/* GetLastError: vcmpErrorPoolExhausted */
|
||||
int32_t (*CreateObject) (int32_t modelIndex, int32_t world, float x, float y, float z, int32_t alpha);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*DeleteObject) (int32_t objectId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsObjectStreamedForPlayer) (int32_t objectId, int32_t playerId);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetObjectModel) (int32_t objectId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetObjectWorld) (int32_t objectId, int32_t world);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetObjectWorld) (int32_t objectId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetObjectAlpha) (int32_t objectId, int32_t alpha, uint32_t duration);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
int32_t (*GetObjectAlpha) (int32_t objectId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*MoveObjectTo) (int32_t objectId, float x, float y, float z, uint32_t duration);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*MoveObjectBy) (int32_t objectId, float x, float y, float z, uint32_t duration);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetObjectPosition) (int32_t objectId, float x, float y, float z);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetObjectPosition) (int32_t objectId, float* xOut, float* yOut, float* zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RotateObjectTo) (int32_t objectId, float x, float y, float z, float w, uint32_t duration);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RotateObjectToEuler) (int32_t objectId, float x, float y, float z, uint32_t duration);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RotateObjectBy) (int32_t objectId, float x, float y, float z, float w, uint32_t duration);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*RotateObjectByEuler) (int32_t objectId, float x, float y, float z, uint32_t duration);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetObjectRotation) (int32_t objectId, float* xOut, float* yOut, float *zOut, float *wOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*GetObjectRotationEuler) (int32_t objectId, float* xOut, float* yOut, float *zOut);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetObjectShotReportEnabled) (int32_t objectId, uint8_t toggle);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsObjectShotReportEnabled) (int32_t objectId);
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError (*SetObjectTouchedReportEnabled) (int32_t objectId, uint8_t toggle);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint8_t (*IsObjectTouchedReportEnabled) (int32_t objectId);
|
||||
|
||||
// TODO: MOVE LATER
|
||||
vcmpError (*GetPlayerModuleList) (int32_t playerId);
|
||||
|
||||
/* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
vcmpError (*SetPickupOption) (int32_t pickupId, vcmpPickupOption option, uint8_t toggle);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */
|
||||
uint8_t (*GetPickupOption) (int32_t pickupId, vcmpPickupOption option);
|
||||
|
||||
/* success */
|
||||
void (*SetFallTimer) (uint16_t timeRate);
|
||||
/* success */
|
||||
uint16_t (*GetFallTimer) (void);
|
||||
|
||||
/* vcmpErrorNoSuchEntity */
|
||||
vcmpError(*SetVehicleLightsData) (int32_t vehicleId, uint32_t lightsData);
|
||||
/* GetLastError: vcmpErrorNoSuchEntity */
|
||||
uint32_t(*GetVehicleLightsData) (int32_t vehicleId);
|
||||
|
||||
} PluginFuncs;
|
||||
|
||||
typedef struct {
|
||||
uint32_t structSize;
|
||||
|
||||
uint8_t (*OnServerInitialise) (void);
|
||||
void (*OnServerShutdown) (void);
|
||||
void (*OnServerFrame) (float elapsedTime);
|
||||
|
||||
uint8_t (*OnPluginCommand) (uint32_t commandIdentifier, const char* message);
|
||||
uint8_t (*OnIncomingConnection) (char* playerName, size_t nameBufferSize, const char* userPassword, const char* ipAddress);
|
||||
void (*OnClientScriptData) (int32_t playerId, const uint8_t* data, size_t size);
|
||||
|
||||
void (*OnPlayerConnect) (int32_t playerId);
|
||||
void (*OnPlayerDisconnect) (int32_t playerId, vcmpDisconnectReason reason);
|
||||
|
||||
uint8_t (*OnPlayerRequestClass) (int32_t playerId, int32_t offset);
|
||||
uint8_t (*OnPlayerRequestSpawn) (int32_t playerId);
|
||||
void (*OnPlayerSpawn) (int32_t playerId);
|
||||
void (*OnPlayerDeath) (int32_t playerId, int32_t killerId, int32_t reason, vcmpBodyPart bodyPart);
|
||||
void (*OnPlayerUpdate) (int32_t playerId, vcmpPlayerUpdate updateType);
|
||||
|
||||
uint8_t (*OnPlayerRequestEnterVehicle) (int32_t playerId, int32_t vehicleId, int32_t slotIndex);
|
||||
void (*OnPlayerEnterVehicle) (int32_t playerId, int32_t vehicleId, int32_t slotIndex);
|
||||
void (*OnPlayerExitVehicle) (int32_t playerId, int32_t vehicleId);
|
||||
|
||||
void (*OnPlayerNameChange) (int32_t playerId, const char* oldName, const char* newName);
|
||||
void (*OnPlayerStateChange) (int32_t playerId, vcmpPlayerState oldState, vcmpPlayerState newState);
|
||||
void (*OnPlayerActionChange) (int32_t playerId, int32_t oldAction, int32_t newAction);
|
||||
void (*OnPlayerOnFireChange) (int32_t playerId, uint8_t isOnFire);
|
||||
void (*OnPlayerCrouchChange) (int32_t playerId, uint8_t isCrouching);
|
||||
void (*OnPlayerGameKeysChange) (int32_t playerId, uint32_t oldKeys, uint32_t newKeys);
|
||||
void (*OnPlayerBeginTyping) (int32_t playerId);
|
||||
void (*OnPlayerEndTyping) (int32_t playerId);
|
||||
void (*OnPlayerAwayChange) (int32_t playerId, uint8_t isAway);
|
||||
|
||||
uint8_t (*OnPlayerMessage) (int32_t playerId, const char* message);
|
||||
uint8_t (*OnPlayerCommand) (int32_t playerId, const char* message);
|
||||
uint8_t (*OnPlayerPrivateMessage) (int32_t playerId, int32_t targetPlayerId, const char* message);
|
||||
|
||||
void (*OnPlayerKeyBindDown) (int32_t playerId, int32_t bindId);
|
||||
void (*OnPlayerKeyBindUp) (int32_t playerId, int32_t bindId);
|
||||
void (*OnPlayerSpectate) (int32_t playerId, int32_t targetPlayerId);
|
||||
void (*OnPlayerCrashReport) (int32_t playerId, const char* report);
|
||||
|
||||
void (*OnVehicleUpdate) (int32_t vehicleId, vcmpVehicleUpdate updateType);
|
||||
void (*OnVehicleExplode) (int32_t vehicleId);
|
||||
void (*OnVehicleRespawn) (int32_t vehicleId);
|
||||
|
||||
void (*OnObjectShot) (int32_t objectId, int32_t playerId, int32_t weaponId);
|
||||
void (*OnObjectTouched) (int32_t objectId, int32_t playerId);
|
||||
|
||||
uint8_t (*OnPickupPickAttempt) (int32_t pickupId, int32_t playerId);
|
||||
void (*OnPickupPicked) (int32_t pickupId, int32_t playerId);
|
||||
void (*OnPickupRespawn) (int32_t pickupId);
|
||||
|
||||
void (*OnCheckpointEntered) (int32_t checkPointId, int32_t playerId);
|
||||
void (*OnCheckpointExited) (int32_t checkPointId, int32_t playerId);
|
||||
|
||||
void (*OnEntityPoolChange) (vcmpEntityPool entityType, int32_t entityId, uint8_t isDeleted);
|
||||
void (*OnServerPerformanceReport) (size_t entryCount, const char** descriptions, uint64_t* times);
|
||||
|
||||
// TODO: MOVE LATER
|
||||
void(*OnPlayerModuleList) (int32_t playerId, const char* list);
|
||||
|
||||
} PluginCallbacks;
|
||||
1042
include/vcmp.new.h
1042
include/vcmp.new.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user