mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Changes for Linux.
This commit is contained in:
parent
aa35157eef
commit
3336bffad2
30 changed files with 99 additions and 173 deletions
|
|
@ -465,7 +465,7 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
|
||||||
connectArgv[i + 3] = mConnectArgv[i];
|
connectArgv[i + 3] = mConnectArgv[i];
|
||||||
}
|
}
|
||||||
connectArgv[0] = "onConnectRequest";
|
connectArgv[0] = "onConnectRequest";
|
||||||
connectArgv[1] = NULL;
|
connectArgv[1] = 0;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
Net::addressToString(getNetAddress(), buffer);
|
Net::addressToString(getNetAddress(), buffer);
|
||||||
connectArgv[2] = buffer;
|
connectArgv[2] = buffer;
|
||||||
|
|
|
||||||
|
|
@ -1647,7 +1647,7 @@ StringStackConsoleWrapper::~StringStackConsoleWrapper()
|
||||||
{
|
{
|
||||||
for (int i=0; i<argc; i++)
|
for (int i=0; i<argc; i++)
|
||||||
{
|
{
|
||||||
argv[i] = NULL;
|
argv[i] = 0;
|
||||||
}
|
}
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -579,7 +579,7 @@ AbstractClassRep* ConsoleObject::getClassRep() const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
String ConsoleObject::_getLogMessage(const char* fmt, void* args) const
|
String ConsoleObject::_getLogMessage(const char* fmt, va_list args) const
|
||||||
{
|
{
|
||||||
String objClass = "UnknownClass";
|
String objClass = "UnknownClass";
|
||||||
if(getClassRep())
|
if(getClassRep())
|
||||||
|
|
|
||||||
|
|
@ -863,7 +863,7 @@ public:
|
||||||
/// @param fmt A printf style format string.
|
/// @param fmt A printf style format string.
|
||||||
/// @param args A va_list containing the args passed ot a log function.
|
/// @param args A va_list containing the args passed ot a log function.
|
||||||
/// @note It is suggested that you use String::VToString.
|
/// @note It is suggested that you use String::VToString.
|
||||||
virtual String _getLogMessage(const char* fmt, void* args) const;
|
virtual String _getLogMessage(const char* fmt, va_list args) const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1833,7 +1833,7 @@ void SimObject::inspectPostApply()
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
String SimObject::_getLogMessage(const char* fmt, void* args) const
|
String SimObject::_getLogMessage(const char* fmt, va_list args) const
|
||||||
{
|
{
|
||||||
String objClass = "UnknownClass";
|
String objClass = "UnknownClass";
|
||||||
if(getClassRep())
|
if(getClassRep())
|
||||||
|
|
|
||||||
|
|
@ -411,7 +411,7 @@ class SimObject: public ConsoleObject
|
||||||
virtual void _onUnselected() {}
|
virtual void _onUnselected() {}
|
||||||
|
|
||||||
/// We can provide more detail, like object name and id.
|
/// We can provide more detail, like object name and id.
|
||||||
virtual String _getLogMessage(const char* fmt, void* args) const;
|
virtual String _getLogMessage(const char* fmt, va_list args) const;
|
||||||
|
|
||||||
DEFINE_CREATE_METHOD
|
DEFINE_CREATE_METHOD
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -391,9 +391,9 @@ void dPrintf(const char *format, ...)
|
||||||
vprintf(format, args);
|
vprintf(format, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 dVprintf(const char *format, void *arglist)
|
S32 dVprintf(const char *format, va_list arglist)
|
||||||
{
|
{
|
||||||
return vprintf(format, (char*)arglist);
|
return (S32)vprintf(format, arglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...)
|
S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...)
|
||||||
|
|
@ -409,9 +409,9 @@ S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist)
|
S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, va_list arglist)
|
||||||
{
|
{
|
||||||
S32 len = vsnprintf(buffer, bufferSize, format, (char*)arglist);
|
S32 len = vsnprintf(buffer, bufferSize, format, arglist);
|
||||||
|
|
||||||
AssertWarn( len < bufferSize, "Buffer too small in call to dVsprintf!" );
|
AssertWarn( len < bufferSize, "Buffer too small in call to dVsprintf!" );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <cstdarg>
|
||||||
|
|
||||||
#ifndef _TORQUE_TYPES_H_
|
#ifndef _TORQUE_TYPES_H_
|
||||||
#include "platform/types.h"
|
#include "platform/types.h"
|
||||||
|
|
@ -229,9 +230,9 @@ int dItoa(int n, char s[]);
|
||||||
// standard I/O functions [defined in platformString.cpp]
|
// standard I/O functions [defined in platformString.cpp]
|
||||||
|
|
||||||
extern void dPrintf(const char *format, ...);
|
extern void dPrintf(const char *format, ...);
|
||||||
extern S32 dVprintf(const char *format, void *arglist);
|
extern S32 dVprintf(const char *format, va_list arglist);
|
||||||
extern S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...);
|
extern S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...);
|
||||||
extern S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist);
|
extern S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, va_list arglist);
|
||||||
extern S32 dSscanf(const char *buffer, const char *format, ...);
|
extern S32 dSscanf(const char *buffer, const char *format, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1434,19 +1434,19 @@ String::StrFormat::~StrFormat()
|
||||||
dFree( _dynamicBuffer );
|
dFree( _dynamicBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 String::StrFormat::format( const char *format, void *args )
|
S32 String::StrFormat::format( const char *format, va_list args )
|
||||||
{
|
{
|
||||||
_len=0;
|
_len=0;
|
||||||
return formatAppend(format,args);
|
return formatAppend(format,args);
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 String::StrFormat::formatAppend( const char *format, void *args )
|
S32 String::StrFormat::formatAppend( const char *format, va_list args )
|
||||||
{
|
{
|
||||||
// Format into the fixed buffer first.
|
// Format into the fixed buffer first.
|
||||||
S32 startLen = _len;
|
S32 startLen = _len;
|
||||||
if (_dynamicBuffer == NULL)
|
if (_dynamicBuffer == NULL)
|
||||||
{
|
{
|
||||||
_len += vsnprintf(_fixedBuffer + _len, sizeof(_fixedBuffer) - _len, format, *(va_list*)args);
|
_len += vsnprintf(_fixedBuffer + _len, sizeof(_fixedBuffer) - _len, format, args);
|
||||||
if (_len >= 0 && _len < sizeof(_fixedBuffer))
|
if (_len >= 0 && _len < sizeof(_fixedBuffer))
|
||||||
return _len;
|
return _len;
|
||||||
|
|
||||||
|
|
@ -1535,9 +1535,9 @@ String String::ToString(const char *str, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
String String::VToString(const char* str, void* args)
|
String String::VToString(const char* str, va_list args)
|
||||||
{
|
{
|
||||||
StrFormat format(str,&args);
|
StrFormat format(str,args);
|
||||||
|
|
||||||
// Copy it into a string
|
// Copy it into a string
|
||||||
U32 len = format.length();
|
U32 len = format.length();
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ public:
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
static String ToString(const char *format, ...);
|
static String ToString(const char *format, ...);
|
||||||
static String VToString(const char* format, void* args);
|
static String VToString(const char* format, va_list args);
|
||||||
|
|
||||||
static String ToString( bool v );
|
static String ToString( bool v );
|
||||||
static inline String ToString( U32 v ) { return ToString( "%u", v ); }
|
static inline String ToString( U32 v ) { return ToString( "%u", v ); }
|
||||||
|
|
@ -245,7 +245,7 @@ public:
|
||||||
_fixedBuffer[0] = '\0';
|
_fixedBuffer[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
StrFormat(const char *formatStr, void *args)
|
StrFormat(const char *formatStr, va_list args)
|
||||||
: _dynamicBuffer( NULL ),
|
: _dynamicBuffer( NULL ),
|
||||||
_dynamicSize( 0 ),
|
_dynamicSize( 0 ),
|
||||||
_len( 0 )
|
_len( 0 )
|
||||||
|
|
@ -255,8 +255,8 @@ public:
|
||||||
|
|
||||||
~StrFormat();
|
~StrFormat();
|
||||||
|
|
||||||
S32 format( const char *format, void *args );
|
S32 format( const char *format, va_list args );
|
||||||
S32 formatAppend( const char *format, void *args );
|
S32 formatAppend( const char *format, va_list args );
|
||||||
S32 append(const char * str, S32 len);
|
S32 append(const char * str, S32 len);
|
||||||
S32 append(const char * str);
|
S32 append(const char * str);
|
||||||
|
|
||||||
|
|
@ -357,7 +357,7 @@ class StringBuilder
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
return mFormat.formatAppend(fmt, &args);
|
return mFormat.formatAppend(fmt, args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,14 @@ public:
|
||||||
{ if ((x)==0) \
|
{ if ((x)==0) \
|
||||||
::PlatformAssert::processAssert(::PlatformAssert::Warning, __FILE__, __LINE__, y); }
|
::PlatformAssert::processAssert(::PlatformAssert::Warning, __FILE__, __LINE__, y); }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Helper macro called when AssertFatal failed.
|
||||||
|
Used for help static code analyzers.
|
||||||
|
*/
|
||||||
|
#ifndef ON_FAIL_ASSERTFATAL
|
||||||
|
#define ON_FAIL_ASSERTFATAL
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Assert that the statement x is true, otherwise halt.
|
Assert that the statement x is true, otherwise halt.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,12 @@
|
||||||
// must ensure BIOS settings is not configured to restrict CPUID functionalities.
|
// must ensure BIOS settings is not configured to restrict CPUID functionalities.
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if defined(TORQUE_OS_LINUX) || defined(LINUX)
|
||||||
|
|
||||||
|
// TODO GCC code don't compile on Release with optimizations, mover code to platform layer
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "platform/platformCPUCount.h"
|
#include "platform/platformCPUCount.h"
|
||||||
|
|
||||||
|
|
@ -666,3 +672,5 @@ next:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -68,7 +68,7 @@ inline bool dCompareAndSwap( volatile U32& ref, U32 oldVal, U32 newVal )
|
||||||
#if defined(TORQUE_OS_PS3)
|
#if defined(TORQUE_OS_PS3)
|
||||||
return ( cellAtomicCompareAndSwap32( (std::uint32_t *)&ref, newVal, oldVal ) == oldVal );
|
return ( cellAtomicCompareAndSwap32( (std::uint32_t *)&ref, newVal, oldVal ) == oldVal );
|
||||||
#elif !defined(TORQUE_OS_MAC)
|
#elif !defined(TORQUE_OS_MAC)
|
||||||
return ( __sync_val_compare_and_swap( ( volatile long* ) &ref, oldVal, newVal ) == oldVal );
|
return ( __sync_val_compare_and_swap( &ref, oldVal, newVal ) == oldVal );
|
||||||
#else
|
#else
|
||||||
return OSAtomicCompareAndSwap32(oldVal, newVal, (int32_t *) &ref);
|
return OSAtomicCompareAndSwap32(oldVal, newVal, (int32_t *) &ref);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -79,7 +79,7 @@ inline bool dCompareAndSwap( volatile U64& ref, U64 oldVal, U64 newVal )
|
||||||
#if defined(TORQUE_OS_PS3)
|
#if defined(TORQUE_OS_PS3)
|
||||||
return ( cellAtomicCompareAndSwap32( (std::uint32_t *)&ref, newVal, oldVal ) == oldVal );
|
return ( cellAtomicCompareAndSwap32( (std::uint32_t *)&ref, newVal, oldVal ) == oldVal );
|
||||||
#elif !defined(TORQUE_OS_MAC)
|
#elif !defined(TORQUE_OS_MAC)
|
||||||
return ( __sync_val_compare_and_swap( ( volatile long long* ) &ref, oldVal, newVal ) == oldVal );
|
return ( __sync_val_compare_and_swap( &ref, oldVal, newVal ) == oldVal );
|
||||||
#else
|
#else
|
||||||
return OSAtomicCompareAndSwap64(oldVal, newVal, (int64_t *) &ref);
|
return OSAtomicCompareAndSwap64(oldVal, newVal, (int64_t *) &ref);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,13 @@
|
||||||
|
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
// Types
|
// Types
|
||||||
|
#if TORQUE_X86
|
||||||
typedef signed long long S64;
|
typedef signed long long S64;
|
||||||
typedef unsigned long long U64;
|
typedef unsigned long long U64;
|
||||||
|
#else
|
||||||
|
typedef signed long S64;
|
||||||
|
typedef unsigned long U64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
|
|
@ -73,11 +78,11 @@ typedef unsigned long long U64;
|
||||||
# define TORQUE_OS_PS3
|
# define TORQUE_OS_PS3
|
||||||
# include "platform/types.posix.h"
|
# include "platform/types.posix.h"
|
||||||
|
|
||||||
#elif defined(linux)
|
#elif defined(linux) || defined(LINUX)
|
||||||
# define TORQUE_OS_STRING "Linux"
|
# define TORQUE_OS_STRING "Linux"
|
||||||
# define TORQUE_OS_LINUX
|
# define TORQUE_OS_LINUX
|
||||||
# define TORQUE_SUPPORTS_NASM
|
//# define TORQUE_SUPPORTS_NASM
|
||||||
# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM
|
//# define TORQUE_SUPPORTS_GCC_INLINE_X86_ASM
|
||||||
# include "platform/types.posix.h"
|
# include "platform/types.posix.h"
|
||||||
|
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined(__OpenBSD__)
|
||||||
|
|
@ -115,6 +120,11 @@ typedef unsigned long long U64;
|
||||||
# define TORQUE_CPU_X86
|
# define TORQUE_CPU_X86
|
||||||
# define TORQUE_LITTLE_ENDIAN
|
# define TORQUE_LITTLE_ENDIAN
|
||||||
|
|
||||||
|
#elif defined(__x86_64__)
|
||||||
|
# define TORQUE_CPU_STRING "Intel x64"
|
||||||
|
# define TORQUE_CPU_X64
|
||||||
|
# define TORQUE_LITTLE_ENDIAN
|
||||||
|
|
||||||
#elif defined(__ppc__)
|
#elif defined(__ppc__)
|
||||||
# define TORQUE_CPU_STRING "PowerPC"
|
# define TORQUE_CPU_STRING "PowerPC"
|
||||||
# define TORQUE_CPU_PPC
|
# define TORQUE_CPU_PPC
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@
|
||||||
// size_t is needed to overload new
|
// size_t is needed to overload new
|
||||||
// size_t tends to be OS and compiler specific and may need to
|
// size_t tends to be OS and compiler specific and may need to
|
||||||
// be if/def'ed in the future
|
// be if/def'ed in the future
|
||||||
typedef unsigned int dsize_t;
|
#include <stddef.h>
|
||||||
|
typedef size_t dsize_t;
|
||||||
|
|
||||||
|
|
||||||
/** Platform dependent file date-time structure. The defination of this structure
|
/** Platform dependent file date-time structure. The defination of this structure
|
||||||
|
|
|
||||||
|
|
@ -27,130 +27,21 @@
|
||||||
#include "core/strings/stringFunctions.h"
|
#include "core/strings/stringFunctions.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "platform/platformCPUCount.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
Platform::SystemInfo_struct Platform::SystemInfo;
|
Platform::SystemInfo_struct Platform::SystemInfo;
|
||||||
|
|
||||||
extern void PlatformBlitInit();
|
void Processor::init() {}
|
||||||
extern void SetProcessorInfo(Platform::SystemInfo_struct::Processor& pInfo,
|
|
||||||
char* vendor, U32 processor, U32 properties, U32 properties2); // platform/platformCPU.cc
|
|
||||||
|
|
||||||
// asm cpu detection routine from platform code
|
// TODO LINUX CPUInfo::CPUCount better support
|
||||||
extern "C"
|
namespace CPUInfo
|
||||||
{
|
{
|
||||||
void detectX86CPUInfo(char *vendor, U32 *processor, U32 *properties);
|
EConfig CPUCount(U32& TotAvailLogical, U32& TotAvailCore, U32& PhysicalNum)
|
||||||
}
|
{
|
||||||
|
PhysicalNum = TotAvailCore = 0;
|
||||||
|
TotAvailLogical = (int)sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
|
||||||
/* used in the asm */
|
return CONFIG_SingleCoreHTDisabled;
|
||||||
static U32 time[2];
|
}
|
||||||
static char vendor[13] = {0,};
|
}; // namespace CPUInfo
|
||||||
static U32 properties = 0;
|
|
||||||
static U32 processor = 0;
|
|
||||||
U32 clockticks = 0;
|
|
||||||
U32 timeHi = 0;
|
|
||||||
U32 timeLo = 0;
|
|
||||||
|
|
||||||
void Processor::init()
|
|
||||||
{
|
|
||||||
// Reference:
|
|
||||||
// www.cyrix.com
|
|
||||||
// www.amd.com
|
|
||||||
// www.intel.com
|
|
||||||
// http://developer.intel.com/design/PentiumII/manuals/24512701.pdf
|
|
||||||
Platform::SystemInfo.processor.type = CPU_X86Compatible;
|
|
||||||
Platform::SystemInfo.processor.name = StringTable->insert("Unknown x86 Compatible");
|
|
||||||
Platform::SystemInfo.processor.mhz = 0;
|
|
||||||
Platform::SystemInfo.processor.properties = CPU_PROP_C;
|
|
||||||
|
|
||||||
clockticks = properties = processor = time[0] = 0;
|
|
||||||
dStrcpy(vendor, "");
|
|
||||||
|
|
||||||
detectX86CPUInfo(vendor, &processor, &properties);
|
|
||||||
SetProcessorInfo(Platform::SystemInfo.processor,
|
|
||||||
vendor, processor, properties, 0);
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
// if RDTSC support calculate the aproximate Mhz of the CPU
|
|
||||||
if (Platform::SystemInfo.processor.properties & CPU_PROP_RDTSC &&
|
|
||||||
Platform::SystemInfo.processor.properties & CPU_PROP_FPU)
|
|
||||||
{
|
|
||||||
const U32 MS_INTERVAL = 750;
|
|
||||||
|
|
||||||
#if defined(TORQUE_COMPILER_GCC) && ((__GNUC__ >= 3) && (__GNUC_MINOR__ >=4)) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ >=0))
|
|
||||||
asm("rdtsc" : "=a" (timeLo), "=d" (timeHi));
|
|
||||||
#else
|
|
||||||
__asm__(
|
|
||||||
"pushl %eax\n"
|
|
||||||
"pushl %edx\n"
|
|
||||||
"rdtsc\n"
|
|
||||||
"movl %eax, (time)\n"
|
|
||||||
"movl %edx, (time+4)\n"
|
|
||||||
"popl %edx\n"
|
|
||||||
"popl %eax\n"
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
U32 ms = Platform::getRealMilliseconds();
|
|
||||||
while ( Platform::getRealMilliseconds() < ms+MS_INTERVAL )
|
|
||||||
{ /* empty */ }
|
|
||||||
ms = Platform::getRealMilliseconds()-ms;
|
|
||||||
#if defined(TORQUE_COMPILER_GCC) && ((__GNUC__ >= 3) && (__GNUC_MINOR__ >= 4)) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ >=0))
|
|
||||||
asm(
|
|
||||||
"pushl %eax\n"
|
|
||||||
"pushl %edx\n"
|
|
||||||
"rdtsc\n"
|
|
||||||
"sub (timeHi), %edx\n"
|
|
||||||
"sbb (timeLo), %eax\n"
|
|
||||||
"mov %eax, (clockticks)\n"
|
|
||||||
"popl %edx\n"
|
|
||||||
"popl %eax\n"
|
|
||||||
);
|
|
||||||
#else
|
|
||||||
asm(
|
|
||||||
"pushl %eax\n"
|
|
||||||
"pushl %edx\n"
|
|
||||||
"rdtsc\n"
|
|
||||||
"sub (time+4), %edx\n"
|
|
||||||
"sbb (time), %eax\n"
|
|
||||||
"mov %eax, (clockticks)\n"
|
|
||||||
"popl %edx\n"
|
|
||||||
"popl %eax\n"
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
U32 mhz = static_cast<U32>(F32(clockticks) / F32(ms) / 1000.0f);
|
|
||||||
|
|
||||||
// catch-22 the timing method used above to calc Mhz is generally
|
|
||||||
// wrong by a few percent so we want to round to the nearest clock
|
|
||||||
// multiple but we also want to be careful to not touch overclocked
|
|
||||||
// results
|
|
||||||
|
|
||||||
// measure how close the Raw Mhz number is to the center of each clock
|
|
||||||
// bucket
|
|
||||||
U32 bucket25 = mhz % 25;
|
|
||||||
U32 bucket33 = mhz % 33;
|
|
||||||
U32 bucket50 = mhz % 50;
|
|
||||||
|
|
||||||
if (bucket50 < 8 || bucket50 > 42)
|
|
||||||
Platform::SystemInfo.processor.mhz =
|
|
||||||
U32((mhz+(50.0f/2.0f))/50.0f) * 50;
|
|
||||||
else if (bucket25 < 5 || bucket25 > 20)
|
|
||||||
Platform::SystemInfo.processor.mhz =
|
|
||||||
U32((mhz+(25.0f/2.0f))/25.0f) * 25;
|
|
||||||
else if (bucket33 < 5 || bucket33 > 28)
|
|
||||||
Platform::SystemInfo.processor.mhz =
|
|
||||||
U32((mhz+(33.0f/2.0f))/33.0f) * 33;
|
|
||||||
else
|
|
||||||
Platform::SystemInfo.processor.mhz = U32(mhz);
|
|
||||||
}
|
|
||||||
|
|
||||||
Con::printf("Processor Init:");
|
|
||||||
Con::printf(" %s, %d Mhz", Platform::SystemInfo.processor.name, Platform::SystemInfo.processor.mhz);
|
|
||||||
if (Platform::SystemInfo.processor.properties & CPU_PROP_FPU)
|
|
||||||
Con::printf(" FPU detected");
|
|
||||||
if (Platform::SystemInfo.processor.properties & CPU_PROP_MMX)
|
|
||||||
Con::printf(" MMX detected");
|
|
||||||
if (Platform::SystemInfo.processor.properties & CPU_PROP_3DNOW)
|
|
||||||
Con::printf(" 3DNow detected");
|
|
||||||
if (Platform::SystemInfo.processor.properties & CPU_PROP_SSE)
|
|
||||||
Con::printf(" SSE detected");
|
|
||||||
Con::printf(" ");
|
|
||||||
|
|
||||||
PlatformBlitInit();
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@
|
||||||
#if defined(TORQUE_OS_MAC)
|
#if defined(TORQUE_OS_MAC)
|
||||||
# include <OpenAL/al.h>
|
# include <OpenAL/al.h>
|
||||||
# include <OpenAL/alc.h>
|
# include <OpenAL/alc.h>
|
||||||
|
#elif defined(TORQUE_OS_LINUX)
|
||||||
|
# include <AL/al.h>
|
||||||
|
# include <AL/alc.h>
|
||||||
#else
|
#else
|
||||||
# include <al/al.h>
|
# include <al/al.h>
|
||||||
# include <al/alc.h>
|
# include <al/alc.h>
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
#include "aldlist.h"
|
#include "aldlist.h"
|
||||||
#if defined(TORQUE_OS_MAC)
|
#if defined(TORQUE_OS_MAC)
|
||||||
#include <OpenAL/alc.h>
|
#include <OpenAL/alc.h>
|
||||||
|
#elif defined(TORQUE_OS_LINUX)
|
||||||
|
#include <AL/alc.h>
|
||||||
#else
|
#else
|
||||||
#include <al/alc.h>
|
#include <al/alc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ SFXALDevice::SFXALDevice( SFXProvider *provider,
|
||||||
AssertFatal( mDevice != NULL && mContext != NULL, "Failed to create OpenAL device and/or context!" );
|
AssertFatal( mDevice != NULL && mContext != NULL, "Failed to create OpenAL device and/or context!" );
|
||||||
|
|
||||||
// Start the update thread.
|
// Start the update thread.
|
||||||
|
#ifndef TORQUE_OS_LINUX
|
||||||
if( !Con::getBoolVariable( "$_forceAllMainThread" ) )
|
if( !Con::getBoolVariable( "$_forceAllMainThread" ) )
|
||||||
{
|
{
|
||||||
SFXInternal::gUpdateThread = new AsyncPeriodicUpdateThread
|
SFXInternal::gUpdateThread = new AsyncPeriodicUpdateThread
|
||||||
|
|
@ -68,6 +68,7 @@ SFXALDevice::SFXALDevice( SFXProvider *provider,
|
||||||
Con::getIntVariable( "$pref::SFX::updateInterval", SFXInternal::DEFAULT_UPDATE_INTERVAL ) );
|
Con::getIntVariable( "$pref::SFX::updateInterval", SFXInternal::DEFAULT_UPDATE_INTERVAL ) );
|
||||||
SFXInternal::gUpdateThread->start();
|
SFXInternal::gUpdateThread->start();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "sfx/sfxProvider.h"
|
#include "sfx/sfxProvider.h"
|
||||||
#include "sfx/openal/sfxALDevice.h"
|
#include "sfx/openal/sfxALDevice.h"
|
||||||
#include "sfx/openal/aldlist.h"
|
#include "sfx/openal/aldlist.h"
|
||||||
|
#include "sfx/openal/LoadOAL.h"
|
||||||
|
|
||||||
#include "core/strings/stringFunctions.h"
|
#include "core/strings/stringFunctions.h"
|
||||||
#include "console/console.h"
|
#include "console/console.h"
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ void PlatformCursorController::pushCursor( S32 cursorID )
|
||||||
// Place the new cursor shape onto the stack
|
// Place the new cursor shape onto the stack
|
||||||
mCursors.increment();
|
mCursors.increment();
|
||||||
|
|
||||||
CursorShape &shape = mCursors.last();
|
Cursor_Shape &shape = mCursors.last();
|
||||||
shape.mCursorType = CursorShape::TYPE_RESOURCE;
|
shape.mCursorType = Cursor_Shape::TYPE_RESOURCE;
|
||||||
shape.mCursorID = cursorID;
|
shape.mCursorID = cursorID;
|
||||||
|
|
||||||
// Now Change the Cursor Shape.
|
// Now Change the Cursor Shape.
|
||||||
|
|
@ -42,8 +42,8 @@ void PlatformCursorController::pushCursor( const UTF8 *fileName )
|
||||||
mCursors.increment();
|
mCursors.increment();
|
||||||
|
|
||||||
// Store the Details.
|
// Store the Details.
|
||||||
CursorShape &shape = mCursors.last();
|
Cursor_Shape &shape = mCursors.last();
|
||||||
shape.mCursorType = CursorShape::TYPE_FILE;
|
shape.mCursorType = Cursor_Shape::TYPE_FILE;
|
||||||
shape.mCursorFile = String::ToString( "%s", fileName );
|
shape.mCursorFile = String::ToString( "%s", fileName );
|
||||||
|
|
||||||
// Now Change the Cursor Shape.
|
// Now Change the Cursor Shape.
|
||||||
|
|
@ -71,11 +71,11 @@ void PlatformCursorController::refreshCursor()
|
||||||
setCursorShape( mCursors.last(), false );
|
setCursorShape( mCursors.last(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlatformCursorController::setCursorShape( const CursorShape &shape, bool reload )
|
void PlatformCursorController::setCursorShape( const Cursor_Shape &shape, bool reload )
|
||||||
{
|
{
|
||||||
switch( shape.mCursorType )
|
switch( shape.mCursorType )
|
||||||
{
|
{
|
||||||
case CursorShape::TYPE_RESOURCE :
|
case Cursor_Shape::TYPE_RESOURCE :
|
||||||
{
|
{
|
||||||
|
|
||||||
// Set Resource.
|
// Set Resource.
|
||||||
|
|
@ -83,7 +83,7 @@ void PlatformCursorController::setCursorShape( const CursorShape &shape, bool re
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case CursorShape::TYPE_FILE :
|
case Cursor_Shape::TYPE_FILE :
|
||||||
{
|
{
|
||||||
|
|
||||||
// Set File.
|
// Set File.
|
||||||
|
|
@ -91,4 +91,4 @@ void PlatformCursorController::setCursorShape( const CursorShape &shape, bool re
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class PlatformCursorController
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
struct CursorShape
|
struct Cursor_Shape
|
||||||
{
|
{
|
||||||
enum Type
|
enum Type
|
||||||
{
|
{
|
||||||
|
|
@ -46,7 +46,7 @@ protected:
|
||||||
String mCursorFile; // Points to a custom cursor file
|
String mCursorFile; // Points to a custom cursor file
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<CursorShape> mCursors;
|
Vector<Cursor_Shape> mCursors;
|
||||||
|
|
||||||
/// The PlatformWindow that owns this Cursor Controller
|
/// The PlatformWindow that owns this Cursor Controller
|
||||||
PlatformWindow *mOwner;
|
PlatformWindow *mOwner;
|
||||||
|
|
@ -85,7 +85,7 @@ public:
|
||||||
virtual void setCursorVisible( bool visible ) = 0;
|
virtual void setCursorVisible( bool visible ) = 0;
|
||||||
virtual bool isCursorVisible() = 0;
|
virtual bool isCursorVisible() = 0;
|
||||||
|
|
||||||
virtual void setCursorShape( const CursorShape &shape, bool reload );
|
virtual void setCursorShape( const Cursor_Shape &shape, bool reload );
|
||||||
virtual void setCursorShape( U32 cursorID ) = 0;
|
virtual void setCursorShape( U32 cursorID ) = 0;
|
||||||
virtual void setCursorShape( const UTF8 *filename, bool reload ) = 0;
|
virtual void setCursorShape( const UTF8 *filename, bool reload ) = 0;
|
||||||
|
|
||||||
|
|
@ -99,4 +99,4 @@ public:
|
||||||
virtual S32 getDoubleClickHeight() = 0;
|
virtual S32 getDoubleClickHeight() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier
|
// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier
|
||||||
// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader
|
// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader
|
||||||
|
|
||||||
#include "./postFx.glsl"
|
#include "./postFX.glsl"
|
||||||
#include "../../gl/torque.glsl"
|
#include "../../gl/torque.glsl"
|
||||||
#include "../../gl/hlslCompat.glsl"
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
|
@ -59,4 +59,4 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
OUT_col = vec4( outColor.rgb, 1 );
|
OUT_col = vec4( outColor.rgb, 1 );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "./postFx.glsl"
|
#include "./postFX.glsl"
|
||||||
#include "../../gl/torque.glsl"
|
#include "../../gl/torque.glsl"
|
||||||
#include "../../gl/hlslCompat.glsl"
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "../../../gl/hlslCompat.glsl"
|
#include "../../../gl/hlslCompat.glsl"
|
||||||
#include "shadergen:/autogenConditioners.h"
|
#include "shadergen:/autogenConditioners.h"
|
||||||
#include "../../gl/postFx.glsl"
|
#include "../../gl/postFX.glsl"
|
||||||
|
|
||||||
uniform sampler2D backBuffer; // The original backbuffer.
|
uniform sampler2D backBuffer; // The original backbuffer.
|
||||||
uniform sampler2D prepassTex; // The pre-pass depth and normals.
|
uniform sampler2D prepassTex; // The pre-pass depth and normals.
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "../../../gl/hlslCompat.glsl"
|
#include "../../../gl/hlslCompat.glsl"
|
||||||
#include "../../gl/postFx.glsl"
|
#include "../../gl/postFX.glsl"
|
||||||
|
|
||||||
uniform sampler2D frameSampler;
|
uniform sampler2D frameSampler;
|
||||||
uniform sampler2D backBuffer;
|
uniform sampler2D backBuffer;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier
|
// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier
|
||||||
// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader
|
// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader
|
||||||
|
|
||||||
#include "./postFx.glsl"
|
#include "./postFX.glsl"
|
||||||
#include "../../gl/torque.glsl"
|
#include "../../gl/torque.glsl"
|
||||||
#include "../../gl/hlslCompat.glsl"
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
|
@ -59,4 +59,4 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
OUT_col = vec4( outColor.rgb, 1 );
|
OUT_col = vec4( outColor.rgb, 1 );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "./postFx.glsl"
|
#include "./postFX.glsl"
|
||||||
#include "../../gl/torque.glsl"
|
#include "../../gl/torque.glsl"
|
||||||
#include "../../gl/hlslCompat.glsl"
|
#include "../../gl/hlslCompat.glsl"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "../../../gl/hlslCompat.glsl"
|
#include "../../../gl/hlslCompat.glsl"
|
||||||
#include "shadergen:/autogenConditioners.h"
|
#include "shadergen:/autogenConditioners.h"
|
||||||
#include "../../gl/postFx.glsl"
|
#include "../../gl/postFX.glsl"
|
||||||
|
|
||||||
uniform sampler2D backBuffer; // The original backbuffer.
|
uniform sampler2D backBuffer; // The original backbuffer.
|
||||||
uniform sampler2D prepassTex; // The pre-pass depth and normals.
|
uniform sampler2D prepassTex; // The pre-pass depth and normals.
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "../../../gl/hlslCompat.glsl"
|
#include "../../../gl/hlslCompat.glsl"
|
||||||
#include "../../gl/postFx.glsl"
|
#include "../../gl/postFX.glsl"
|
||||||
|
|
||||||
uniform sampler2D frameSampler;
|
uniform sampler2D frameSampler;
|
||||||
uniform sampler2D backBuffer;
|
uniform sampler2D backBuffer;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue