2018-04-13 16:56:43 +00:00
|
|
|
/*
|
|
|
|
port.h -- Portability Layer for Windows types
|
|
|
|
Copyright (C) 2015 Alibek Omarov
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#ifndef PORT_H
|
|
|
|
#define PORT_H
|
|
|
|
|
2019-07-01 02:50:54 +00:00
|
|
|
#include "build.h"
|
2018-04-17 00:46:08 +00:00
|
|
|
|
2019-11-24 00:52:08 +00:00
|
|
|
#if !XASH_WIN32
|
|
|
|
#if XASH_APPLE
|
2018-04-13 16:56:43 +00:00
|
|
|
#include <sys/syslimits.h>
|
|
|
|
#define OS_LIB_EXT "dylib"
|
2019-05-01 16:21:47 +00:00
|
|
|
#define OPEN_COMMAND "open"
|
2018-04-13 16:56:43 +00:00
|
|
|
#else
|
|
|
|
#define OS_LIB_EXT "so"
|
2019-05-01 16:21:47 +00:00
|
|
|
#define OPEN_COMMAND "xdg-open"
|
2018-04-13 16:56:43 +00:00
|
|
|
#endif
|
2019-03-15 18:23:59 +00:00
|
|
|
#define OS_LIB_PREFIX "lib"
|
2018-04-13 16:56:43 +00:00
|
|
|
#define VGUI_SUPPORT_DLL "libvgui_support." OS_LIB_EXT
|
|
|
|
|
|
|
|
// Windows-specific
|
|
|
|
#define __cdecl
|
2018-05-28 20:44:52 +00:00
|
|
|
#define __stdcall
|
2018-04-13 16:56:43 +00:00
|
|
|
#define _inline static inline
|
2019-02-24 15:45:27 +00:00
|
|
|
#define FORCEINLINE inline __attribute__((always_inline))
|
2020-02-08 16:07:56 +00:00
|
|
|
|
2021-12-23 16:17:11 +00:00
|
|
|
#if XASH_POSIX
|
|
|
|
#include <unistd.h>
|
2023-02-07 22:03:59 +00:00
|
|
|
#if XASH_NSWITCH
|
2023-02-05 01:09:32 +00:00
|
|
|
#define SOLDER_LIBDL_COMPAT
|
|
|
|
#include <solder.h>
|
2023-02-13 19:53:17 +00:00
|
|
|
#elif XASH_PSVITA
|
|
|
|
#define VRTLD_LIBDL_COMPAT
|
|
|
|
#include <vrtld.h>
|
|
|
|
#define O_BINARY 0
|
2023-02-05 01:09:32 +00:00
|
|
|
#else
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#define HAVE_DUP
|
2023-02-05 01:16:56 +00:00
|
|
|
#define O_BINARY 0
|
2023-02-05 01:09:32 +00:00
|
|
|
#endif
|
2023-02-05 01:16:56 +00:00
|
|
|
#define O_TEXT 0
|
2021-12-23 16:17:11 +00:00
|
|
|
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
|
|
|
#endif
|
2018-04-13 16:56:43 +00:00
|
|
|
|
|
|
|
typedef void* HANDLE;
|
|
|
|
typedef void* HINSTANCE;
|
|
|
|
|
|
|
|
typedef struct tagPOINT
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
} POINT;
|
|
|
|
#else // WIN32
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
#define _inline static inline
|
2019-02-24 15:45:27 +00:00
|
|
|
#define FORCEINLINE inline __attribute__((always_inline))
|
|
|
|
#else
|
|
|
|
#define FORCEINLINE __forceinline
|
2018-04-13 16:56:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define open _open
|
|
|
|
#define read _read
|
2018-06-14 17:32:31 +00:00
|
|
|
#define alloca _alloca
|
2018-04-13 16:56:43 +00:00
|
|
|
|
|
|
|
#define HSPRITE WINAPI_HSPRITE
|
2019-08-08 23:28:28 +00:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <winsock2.h>
|
2018-04-13 16:56:43 +00:00
|
|
|
#include <windows.h>
|
|
|
|
#undef HSPRITE
|
|
|
|
|
2019-06-29 20:56:50 +00:00
|
|
|
#define OS_LIB_PREFIX ""
|
2018-04-13 16:56:43 +00:00
|
|
|
#define OS_LIB_EXT "dll"
|
|
|
|
#define VGUI_SUPPORT_DLL "../vgui_support." OS_LIB_EXT
|
2020-02-08 16:07:56 +00:00
|
|
|
#define HAVE_DUP
|
2018-04-13 16:56:43 +00:00
|
|
|
#endif //WIN32
|
2021-12-22 22:21:33 +00:00
|
|
|
|
2019-10-26 00:06:26 +00:00
|
|
|
#ifndef XASH_LOW_MEMORY
|
|
|
|
#define XASH_LOW_MEMORY 0
|
|
|
|
#endif
|
2018-04-13 16:56:43 +00:00
|
|
|
|
2019-08-08 23:46:29 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
2018-04-13 16:56:43 +00:00
|
|
|
|
2019-03-30 00:06:23 +00:00
|
|
|
#if defined XASH_SDL && !defined REF_DLL
|
2019-03-16 04:15:06 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#endif
|
|
|
|
|
2018-04-13 16:56:43 +00:00
|
|
|
#endif // PORT_H
|