C:/quickbuild-1.2.13/working/root/Docs/TGEA_Offline_Docs/checkouts/engine/source/platform/platform.h File Reference

#include <stdlib.h>
#include "torqueConfig.h"
#include "platform/types.h"
#include "platform/platformAssert.h"
#include "platform/nativeDialogs/msgBox.h"
#include "app/version.h"
#include <new>

Namespaces

namespace  Platform

Classes

struct  Processor
 Processor info manager. More...
struct  Platform::LocalTime
struct  Platform::FileInfo
struct  Platform::VolumeInformation
struct  Platform::SystemInfo_struct
struct  Platform::SystemInfo_struct::Processor
struct  Platform::KeyboardInputExclusion
 Description of a keyboard input we want to ignore. More...
struct  Math

Defines

#define TORQUE_DEBUGBREAK()   Platform::debugBreak();
 Macro to do in-line debug breaks, used for asserts. Does inline assembly when possible.
#define dT(s)   s
#define QSORT_CALLBACK   FN_CDECL
#define dMalloc(x)   dMalloc_r(x, __FILE__, __LINE__)
#define dRealloc(x, y)   dRealloc_r(x, y, __FILE__, __LINE__)

Typedefs

typedef voidFILE_HANDLE

Enumerations

enum  ProcessorType {
  CPU_X86Compatible,
  CPU_Intel_Unknown,
  CPU_Intel_486,
  CPU_Intel_Pentium,
  CPU_Intel_PentiumMMX,
  CPU_Intel_PentiumPro,
  CPU_Intel_PentiumII,
  CPU_Intel_PentiumCeleron,
  CPU_Intel_PentiumIII,
  CPU_Intel_Pentium4,
  CPU_Intel_Core,
  CPU_Intel_Core2,
  CPU_AMD_K6,
  CPU_AMD_K6_2,
  CPU_AMD_K6_3,
  CPU_AMD_Athlon,
  CPU_AMD_Unknown,
  CPU_Cyrix_6x86,
  CPU_Cyrix_MediaGX,
  CPU_Cyrix_6x86MX,
  CPU_Cyrix_GXm,
  CPU_Cyrix_Unknown,
  CPU_PowerPC_Unknown,
  CPU_PowerPC_601,
  CPU_PowerPC_603,
  CPU_PowerPC_603e,
  CPU_PowerPC_603ev,
  CPU_PowerPC_604,
  CPU_PowerPC_604e,
  CPU_PowerPC_604ev,
  CPU_PowerPC_G3,
  CPU_PowerPC_G4,
  CPU_PowerPC_G4_7450,
  CPU_PowerPC_G4_7455,
  CPU_PowerPC_G4_7447,
  CPU_PowerPC_G5,
  CPU_Xenon
}
 Global processor identifiers. More...
enum  x86Properties {
  CPU_PROP_C = (1<<0),
  CPU_PROP_FPU = (1<<1),
  CPU_PROP_MMX = (1<<2),
  CPU_PROP_3DNOW = (1<<3),
  CPU_PROP_SSE = (1<<4),
  CPU_PROP_RDTSC = (1<<5),
  CPU_PROP_SSE2 = (1<<6),
  CPU_PROP_MP = (1<<7)
}
 Properties for x86 architecture chips. More...
enum  PPCProperties {
  CPU_PROP_PPCMIN = (1<<0),
  CPU_PROP_ALTIVEC = (1<<1),
  CPU_PROP_PPCMP = (1<<7)
}
 Properties for PowerPC architecture chips. More...
enum  DriveType {
  DRIVETYPE_FIXED = 0,
  DRIVETYPE_REMOVABLE = 1,
  DRIVETYPE_REMOTE = 2,
  DRIVETYPE_CDROM = 3,
  DRIVETYPE_RAMDISK = 4,
  DRIVETYPE_UNKNOWN = 5
}
 Physical type of a drive. More...
enum  DFILE_STATUS { DFILE_OK = 1 }

Functions

void Platform::getLocalTime (LocalTime &)
U32 Platform::getTime ()
U32 Platform::getVirtualMilliseconds ()
U32 Platform::getRealMilliseconds ()
void Platform::advanceTime (U32 delta)
S32 Platform::getBackgroundSleepTime ()
void Platform::init ()
void Platform::initConsole ()
void Platform::shutdown ()
void Platform::process ()
U32 Platform::getMathControlState ()
void Platform::setMathControlState (U32 state)
void Platform::setMathControlStateKnown ()
void Platform::sleep (U32 ms)
bool Platform::excludeOtherInstances (const char *string)
bool Platform::checkOtherInstances (const char *string)
void Platform::restartInstance ()
void Platform::postQuitMessage (const U32 in_quitVal)
void Platform::forceShutdown (S32 returnValue)
void Platform::outputDebugString (const char *string)
void Platform::debugBreak ()
float Platform::getRandom ()
void Platform::setWindowLocked (bool locked)
void Platform::minimizeWindow ()
void Platform::setWindowSize (U32 newWidth, U32 newHeight, bool fullScreen)
void Platform::closeWindow ()
bool Platform::doCDCheck ()
StringTableEntry Platform::createPlatformFriendlyFilename (const char *filename)
bool Platform::cdFileExists (const char *filePath, const char *volumeName, S32 serialNum)
void Platform::fileToLocalTime (const FileTime &ft, LocalTime *lt)
S32 Platform::compareFileTimes (const FileTime &a, const FileTime &b)
 compare file times returns < 0 if a is earlier than b, >0 if b is earlier than a
bool Platform::stringToFileTime (const char *string, FileTime *time)
bool Platform::fileTimeToString (FileTime *time, char *string, U32 strLen)
StringTableEntry Platform::getCurrentDirectory ()
bool Platform::setCurrentDirectory (StringTableEntry newDir)
StringTableEntry Platform::getTemporaryDirectory ()
StringTableEntry Platform::getTemporaryFileName ()
StringTableEntry Platform::getExecutableName ()
 Returns the filename of the torque executable.
StringTableEntry Platform::getExecutablePath ()
 Returns full pathname of the torque executable without filename.
StringTableEntry Platform::getMainDotCsDir ()
 Returns the full path to the directory that contains main.cs.
void Platform::setMainDotCsDir (const char *dir)
 Set main.cs directory. Used in runEntryScript().
StringTableEntry Platform::getPrefsPath (const char *file=NULL)
char * Platform::makeFullPathName (const char *path, char *buffer, U32 size, const char *cwd=NULL)
StringTableEntry Platform::stripBasePath (const char *path)
bool Platform::isFullPath (const char *path)
StringTableEntry Platform::makeRelativePathName (const char *path, const char *to)
bool Platform::dumpPath (const char *in_pBasePath, Vector< FileInfo > &out_rFileVector, S32 recurseDepth=-1)
bool Platform::dumpDirectories (const char *path, Vector< StringTableEntry > &directoryVector, S32 depth=0, bool noBasePath=false)
bool Platform::hasSubDirectory (const char *pPath)
bool Platform::getFileTimes (const char *filePath, FileTime *createTime, FileTime *modifyTime)
bool Platform::isFile (const char *pFilePath)
S32 Platform::getFileSize (const char *pFilePath)
bool Platform::isDirectory (const char *pDirPath)
bool Platform::isSubDirectory (const char *pParent, const char *pDir)
void Platform::addExcludedDirectory (const char *pDir)
void Platform::clearExcludedDirectories ()
bool Platform::isExcludedDirectory (const char *pDir)
bool Platform::createPath (const char *path)
 Given a directory path, create all necessary directories for that path to exist.
void Platform::AlertOK (const char *windowTitle, const char *message)
bool Platform::AlertOKCancel (const char *windowTitle, const char *message)
bool Platform::AlertRetry (const char *windowTitle, const char *message)
void Platform::getVolumeNamesList (Vector< const char * > &out_rNameVector, bool bOnlyFixedDrives=false)
void Platform::getVolumeInformationList (Vector< VolumeInformation > &out_rVolumeInfoVector, bool bOnlyFixedDrives=false)
bool Platform::openWebBrowser (const char *webAddress)
void Platform::openFolder (const char *path)
const char * Platform::getLoginPassword ()
bool Platform::setLoginPassword (const char *password)
const char * Platform::getClipboard ()
bool Platform::setClipboard (const char *text)
StringTableEntry Platform::getUserHomeDirectory ()
StringTableEntry Platform::getUserDataDirectory ()
bool Platform::getUserIsAdministrator ()
S32 Platform::messageBox (const UTF8 *title, const UTF8 *message, MBButtons buttons=MBOkCancel, MBIcons icon=MIInformation)
void Platform::clearKeyboardInputExclusion ()
 Reset the keyboard input exclusion list.
void Platform::addKeyboardInputExclusion (const KeyboardInputExclusion &kie)
 Add a new keyboard exclusion.
const bool Platform::checkKeyboardInputExclusion (const InputEventInfo *info)
 Check if a given input event should be excluded.
void dQsort (void *base, U32 nelem, U32 width, int(QSORT_CALLBACK *fcmp)(const void *, const void *))
void setBreakAlloc (dsize_t)
void setMinimumAllocUnit (U32)
voiddMalloc_r (dsize_t in_size, const char *, const dsize_t)
void dFree (void *in_pFree)
voiddRealloc_r (void *in_pResize, dsize_t in_size, const char *, const dsize_t)
voiddRealMalloc (dsize_t)
void dRealFree (void *)
voiddMemcpy (void *dst, const void *src, dsize_t size)
voiddMemmove (void *dst, const void *src, dsize_t size)
voiddMemset (void *dst, int c, dsize_t size)
int dMemcmp (const void *ptr1, const void *ptr2, dsize_t size)
bool dFileDelete (const char *name)
bool dFileRename (const char *oldName, const char *newName)
bool dFileTouch (const char *name)
bool dPathCopy (const char *fromName, const char *toName, bool nooverwrite=true)
FILE_HANDLE dOpenFileRead (const char *name, DFILE_STATUS &error)
FILE_HANDLE dOpenFileReadWrite (const char *name, bool append, DFILE_STATUS &error)
int dFileRead (FILE_HANDLE handle, U32 bytes, char *dst, DFILE_STATUS &error)
int dFileWrite (FILE_HANDLE handle, U32 bytes, const char *dst, DFILE_STATUS &error)
void dFileClose (FILE_HANDLE handle)
StringTableEntry osGetTemporaryDirectory ()
template<class T>
T * constructInPlace (T *p)
 Constructs an object that already has memory allocated for it.
template<class T>
T * constructInPlace (T *p, const T *copy)
 Copy constructs an object that already has memory allocated for it.
template<class T, class T2>
T * constructInPlace (T *ptr, T2 t2)
template<class T, class T2, class T3>
T * constructInPlace (T *ptr, T2 t2, T3 t3)
template<class T, class T2, class T3, class T4>
T * constructInPlace (T *ptr, T2 t2, T3 t3, T4 t4)
template<class T, class T2, class T3, class T4, class T5>
T * constructInPlace (T *ptr, T2 t2, T3 t3, T4 t4, T5 t5)
template<class T>
void destructInPlace (T *p)
 Destructs an object without freeing the memory associated with it.

Variables

VolumeInformation * Platform::PVolumeInformation
SystemInfo_struct Platform::SystemInfo


Define Documentation

 
#define TORQUE_DEBUGBREAK (  )     Platform::debugBreak();

Macro to do in-line debug breaks, used for asserts. Does inline assembly when possible.

#define dT (  )     s

#define QSORT_CALLBACK   FN_CDECL

#define dMalloc ( x   )     dMalloc_r(x, __FILE__, __LINE__)

#define dRealloc ( x,
y   )     dRealloc_r(x, y, __FILE__, __LINE__)


Typedef Documentation

typedef void* FILE_HANDLE


Enumeration Type Documentation

Global processor identifiers.

Note:
These enums must be globally scoped so that they work with the inline assembly
Enumerator:
CPU_X86Compatible 
CPU_Intel_Unknown 
CPU_Intel_486 
CPU_Intel_Pentium 
CPU_Intel_PentiumMMX 
CPU_Intel_PentiumPro 
CPU_Intel_PentiumII 
CPU_Intel_PentiumCeleron 
CPU_Intel_PentiumIII 
CPU_Intel_Pentium4 
CPU_Intel_Core 
CPU_Intel_Core2 
CPU_AMD_K6 
CPU_AMD_K6_2 
CPU_AMD_K6_3 
CPU_AMD_Athlon 
CPU_AMD_Unknown 
CPU_Cyrix_6x86 
CPU_Cyrix_MediaGX 
CPU_Cyrix_6x86MX 
CPU_Cyrix_GXm  Media GX w/ MMX.
CPU_Cyrix_Unknown 
CPU_PowerPC_Unknown 
CPU_PowerPC_601 
CPU_PowerPC_603 
CPU_PowerPC_603e 
CPU_PowerPC_603ev 
CPU_PowerPC_604 
CPU_PowerPC_604e 
CPU_PowerPC_604ev 
CPU_PowerPC_G3 
CPU_PowerPC_G4 
CPU_PowerPC_G4_7450 
CPU_PowerPC_G4_7455 
CPU_PowerPC_G4_7447 
CPU_PowerPC_G5 
CPU_Xenon 

Properties for x86 architecture chips.

Enumerator:
CPU_PROP_C  We should use C fallback math functions.
CPU_PROP_FPU  Has an FPU. (It better!).
CPU_PROP_MMX  Supports MMX instruction set extension.
CPU_PROP_3DNOW  Supports AMD 3dNow! instruction set extension.
CPU_PROP_SSE  Supports SSE instruction set extension.
CPU_PROP_RDTSC  Supports Read Time Stamp Counter op.
CPU_PROP_SSE2  Supports SSE2 instruction set extension.
CPU_PROP_MP  This is a multi-processor system.

Properties for PowerPC architecture chips.

Enumerator:
CPU_PROP_PPCMIN 
CPU_PROP_ALTIVEC  Supports AltiVec instruction set extension.
CPU_PROP_PPCMP  Multi-processor system.

enum DriveType

Physical type of a drive.

Enumerator:
DRIVETYPE_FIXED  Non-removable fixed drive.
DRIVETYPE_REMOVABLE  Removable drive.
DRIVETYPE_REMOTE  Networked/remote drive.
DRIVETYPE_CDROM  CD-Rom.
DRIVETYPE_RAMDISK  A ramdisk!
DRIVETYPE_UNKNOWN  Don't know.

Enumerator:
DFILE_OK 


Function Documentation

void dQsort ( void base,
U32  nelem,
U32  width,
int(QSORT_CALLBACK *fcmp)(const void *, const void *)   
) [inline]

void setBreakAlloc ( dsize_t   ) 

void setMinimumAllocUnit ( U32   ) 

void* dMalloc_r ( dsize_t  in_size,
const char *  ,
const   dsize_t 
)

void dFree ( void in_pFree  ) 

void* dRealloc_r ( void in_pResize,
dsize_t  in_size,
const char *  ,
const   dsize_t 
)

void* dRealMalloc ( dsize_t   ) 

void dRealFree ( void  ) 

void* dMemcpy ( void dst,
const void src,
dsize_t  size 
)

void* dMemmove ( void dst,
const void src,
dsize_t  size 
)

void* dMemset ( void dst,
int  c,
dsize_t  size 
)

int dMemcmp ( const void ptr1,
const void ptr2,
dsize_t  size 
)

bool dFileDelete ( const char *  name  ) 

bool dFileRename ( const char *  oldName,
const char *  newName 
)

bool dFileTouch ( const char *  name  ) 

bool dPathCopy ( const char *  fromName,
const char *  toName,
bool  nooverwrite = true 
)

FILE_HANDLE dOpenFileRead ( const char *  name,
DFILE_STATUS error 
)

FILE_HANDLE dOpenFileReadWrite ( const char *  name,
bool  append,
DFILE_STATUS error 
)

int dFileRead ( FILE_HANDLE  handle,
U32  bytes,
char *  dst,
DFILE_STATUS error 
)

int dFileWrite ( FILE_HANDLE  handle,
U32  bytes,
const char *  dst,
DFILE_STATUS error 
)

void dFileClose ( FILE_HANDLE  handle  ) 

StringTableEntry osGetTemporaryDirectory (  )