diff options
author | Fire_Head <Fire-Head@users.noreply.github.com> | 2020-04-23 10:50:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-23 10:50:06 +0200 |
commit | ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2 (patch) | |
tree | d461c5aca74e9679ec87d1e3d70a5e674a57ee21 /src/skel/crossplatform.h | |
parent | fix #ifdef (diff) | |
parent | Merge pull request #482 from withmorten/master (diff) | |
download | re3-ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2.tar re3-ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2.tar.gz re3-ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2.tar.bz2 re3-ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2.tar.lz re3-ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2.tar.xz re3-ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2.tar.zst re3-ff46dc1c6c5a9e8a42ba9f5ac5f1e7a5b7408cc2.zip |
Diffstat (limited to 'src/skel/crossplatform.h')
-rw-r--r-- | src/skel/crossplatform.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/skel/crossplatform.h b/src/skel/crossplatform.h new file mode 100644 index 00000000..1b3ad7d6 --- /dev/null +++ b/src/skel/crossplatform.h @@ -0,0 +1,65 @@ +#include <time.h> + +#ifndef MAX_PATH + #if !defined _WIN32 || defined __MINGW32__ + #define MAX_PATH PATH_MAX + #else + #define MAX_PATH 260 + #endif +#endif + +// Mostly wrappers around Windows functions + +// TODO: Remove USEALTERNATIVEWINFUNCS and don't use it anywhere when re3 becomes fully cross-platform, this is for testing +// Codes compatible with Windows and Linux +#if defined USEALTERNATIVEWINFUNCS || !defined _WIN32 || defined __MINGW32__ +#define DeleteFile unlink + +// Needed for save games +struct SYSTEMTIME { + uint16 wYear; + uint16 wMonth; + uint16 wDayOfWeek; + uint16 wDay; + uint16 wHour; + uint16 wMinute; + uint16 wSecond; + uint16 wMilliseconds; +}; + +#define GetLocalTime GetLocalTime_CP +#else +#include <Windows.h> +#endif + +void GetLocalTime_CP(SYSTEMTIME* out); + + +// Only runs on GNU/POSIX/etc. +#if !defined _WIN32 || defined __MINGW32__ +#define OutputDebugString(s) re3_debug("[DBG-2]: " s "\n") + +#include <iostream> +#include <dirent.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <langinfo.h> + +typedef DIR* HANDLE; +#define INVALID_HANDLE_VALUE NULL +#define FindClose closedir +#define LOCALE_USER_DEFAULT 0 +#define DATE_SHORTDATE 0 + +struct WIN32_FIND_DATA { + char extension[32]; // for searching + char folder[32]; // for searching + char cFileName[256]; // because tSkinInfo has it 256 + time_t ftLastWriteTime; +}; + +HANDLE FindFirstFile(char*, WIN32_FIND_DATA*); +bool FindNextFile(HANDLE, WIN32_FIND_DATA*); +void FileTimeToSystemTime(time_t*, SYSTEMTIME*); +void GetDateFormat(int, int, SYSTEMTIME*, int, char*, int); +#endif
\ No newline at end of file |