2020-04-21 12:28:06 +02:00
# include <time.h>
2020-05-11 04:55:57 +02:00
// This is the common include for platform/renderer specific skeletons(glfw.cpp, win.cpp etc.) and using cross platform things (like Windows directories wrapper, platform specific global arrays etc.)
// Functions that's different on glfw and win but have same signature, should be located on platform.h.
2020-04-26 12:25:03 +02:00
2020-07-24 19:43:51 +02:00
enum eWinVersion
{
OS_WIN95 = 0 ,
OS_WIN98 ,
OS_WINNT ,
OS_WIN2000 ,
OS_WINXP ,
} ;
2020-11-14 15:46:12 +01:00
# if !defined(_MSC_VER) && !defined(__CWCC__)
char * _strdate ( char * buf ) ;
# endif
2020-04-26 12:25:03 +02:00
# ifdef _WIN32
2020-07-24 19:43:51 +02:00
2020-07-25 14:13:27 +02:00
// As long as WITHWINDOWS isn't defined / <Windows.h> isn't included, we only need type definitions so let's include <IntSafe.h>.
// NOTE: It's perfectly fine to include <Windows.h> here, but it can increase build size and time in *some* conditions, and maybe substantially in future if we'll use crossplatform.h more.
2020-07-24 19:43:51 +02:00
# ifndef _INC_WINDOWS
2020-07-25 14:13:27 +02:00
# include <IntSafe.h>
2020-07-24 19:43:51 +02:00
# endif
# if defined RW_D3D9 || defined RWLIBS
2020-04-26 12:25:03 +02:00
# include "win.h"
2020-07-24 19:43:51 +02:00
# endif
2020-05-11 04:55:57 +02:00
extern DWORD _dwOperatingSystemVersion ;
2020-07-26 19:59:58 +02:00
# define fcaseopen fopen
2020-05-11 04:55:57 +02:00
# else
char * strupr ( char * str ) ;
char * strlwr ( char * str ) ;
enum {
LANG_OTHER ,
LANG_GERMAN ,
LANG_FRENCH ,
LANG_ENGLISH ,
LANG_ITALIAN ,
LANG_SPANISH ,
} ;
enum {
SUBLANG_OTHER ,
SUBLANG_ENGLISH_AUS
} ;
extern long _dwOperatingSystemVersion ;
2020-07-26 19:59:58 +02:00
char * casepath ( char const * path , bool checkPathFirst = true ) ;
FILE * _fcaseopen ( char const * filename , char const * mode ) ;
# define fcaseopen _fcaseopen
2020-04-26 12:25:03 +02:00
# endif
# ifdef RW_GL3
typedef struct
{
GLFWwindow * window ;
RwBool fullScreen ;
RwV2d lastMousePos ;
double mouseWheel ; // glfw doesn't cache it
2020-07-24 19:43:51 +02:00
bool cursorIsInWindow ;
2020-05-11 04:55:57 +02:00
RwInt8 joy1id ;
RwInt8 joy2id ;
2020-04-26 12:25:03 +02:00
}
psGlobalType ;
# define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var)
void CapturePad ( RwInt32 padID ) ;
void joysChangeCB ( int jid , int event ) ;
# endif
2020-09-30 19:02:47 +02:00
# ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
extern char gSelectedJoystickName [ 128 ] ;
# endif
2020-04-26 12:25:03 +02:00
enum eGameState
{
GS_START_UP = 0 ,
GS_INIT_LOGO_MPEG ,
GS_LOGO_MPEG ,
GS_INIT_INTRO_MPEG ,
GS_INTRO_MPEG ,
GS_INIT_ONCE ,
GS_INIT_FRONTEND ,
GS_FRONTEND ,
GS_INIT_PLAYING_GAME ,
GS_PLAYING_GAME ,
} ;
extern RwUInt32 gGameState ;
RwBool IsForegroundApp ( ) ;
2020-04-21 12:28:06 +02:00
# ifndef MAX_PATH
# if !defined _WIN32 || defined __MINGW32__
# define MAX_PATH PATH_MAX
# else
# define MAX_PATH 260
# endif
# endif
// Codes compatible with Windows and Linux
2020-05-11 19:10:01 +02:00
# ifndef _WIN32
2020-04-21 12:28:06 +02:00
# define DeleteFile unlink
// Needed for save games
struct SYSTEMTIME {
2020-05-11 04:55:57 +02:00
RwUInt16 wYear ;
RwUInt16 wMonth ;
RwUInt16 wDayOfWeek ;
RwUInt16 wDay ;
RwUInt16 wHour ;
RwUInt16 wMinute ;
RwUInt16 wSecond ;
RwUInt16 wMilliseconds ;
2020-04-21 12:28:06 +02:00
} ;
2020-04-26 12:25:03 +02:00
void GetLocalTime_CP ( SYSTEMTIME * out ) ;
2020-04-21 12:28:06 +02:00
# define GetLocalTime GetLocalTime_CP
2020-05-11 04:55:57 +02:00
# define OutputDebugString(s) re3_debug("[DBG-2]: %s\n",s)
2020-04-21 12:28:06 +02:00
# endif
2020-05-11 04:55:57 +02:00
// Compatible with Linux/POSIX and MinGW on Windows
2020-05-11 19:10:01 +02:00
# ifndef _WIN32
2020-04-21 12:28:06 +02:00
# include <iostream>
# include <dirent.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <langinfo.h>
2020-05-11 04:55:57 +02:00
# include <unistd.h>
2020-04-21 12:28:06 +02:00
2020-05-11 04:55:57 +02:00
typedef void * HANDLE ;
2020-04-21 12:28:06 +02:00
# define INVALID_HANDLE_VALUE NULL
2020-05-11 04:55:57 +02:00
# define FindClose(h) closedir((DIR*)h)
2020-04-21 12:28:06 +02:00
# 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 ;
} ;
2020-05-11 04:55:57 +02:00
HANDLE FindFirstFile ( const char * , WIN32_FIND_DATA * ) ;
2020-04-21 12:28:06 +02:00
bool FindNextFile ( HANDLE , WIN32_FIND_DATA * ) ;
void FileTimeToSystemTime ( time_t * , SYSTEMTIME * ) ;
void GetDateFormat ( int , int , SYSTEMTIME * , int , char * , int ) ;
2020-05-11 04:55:57 +02:00
# endif