mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-19 11:49:09 +00:00
@ -8,6 +8,10 @@ endif(WIN32 AND NOT CYGWIN)
|
|||||||
if(UNIX)
|
if(UNIX)
|
||||||
add_definitions(-DHS_BUILD_FOR_UNIX)
|
add_definitions(-DHS_BUILD_FOR_UNIX)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
add_definitions(-std=c++0x)
|
||||||
|
endif()
|
||||||
# End HeadSpin Configuration
|
# End HeadSpin Configuration
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
@ -55,7 +55,7 @@ void PythonInterface::initPython(std::string rootDir)
|
|||||||
{
|
{
|
||||||
// initialize the Python stuff
|
// initialize the Python stuff
|
||||||
// let Python do some intialization...
|
// let Python do some intialization...
|
||||||
Py_SetProgramName("plasma");
|
Py_SetProgramName(const_cast<char*>("plasma"));
|
||||||
Py_NoSiteFlag = 1;
|
Py_NoSiteFlag = 1;
|
||||||
Py_IgnoreEnvironmentFlag = 1;
|
Py_IgnoreEnvironmentFlag = 1;
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
@ -66,7 +66,7 @@ void PythonInterface::initPython(std::string rootDir)
|
|||||||
// plasmaMod = PyImport_ImportModule("Plasma");
|
// plasmaMod = PyImport_ImportModule("Plasma");
|
||||||
|
|
||||||
// create the StringIO for the stdout and stderr file
|
// create the StringIO for the stdout and stderr file
|
||||||
PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import("cStringIO", "cStringIO_CAPI");
|
PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import(const_cast<char*>("cStringIO"), const_cast<char*>("cStringIO_CAPI"));
|
||||||
stdFile = (*PycStringIO->NewOutput)(20000);
|
stdFile = (*PycStringIO->NewOutput)(20000);
|
||||||
// if we need the builtins then find the builtin module
|
// if we need the builtins then find the builtin module
|
||||||
PyObject* sysmod = PyImport_ImportModule("sys");
|
PyObject* sysmod = PyImport_ImportModule("sys");
|
||||||
@ -191,7 +191,7 @@ int PythonInterface::getOutputAndReset(char** line)
|
|||||||
int size = PyString_Size( pyStr );
|
int size = PyString_Size( pyStr );
|
||||||
|
|
||||||
// reset the file back to zero
|
// reset the file back to zero
|
||||||
PyObject_CallMethod(stdFile,"reset","");
|
PyObject_CallMethod(stdFile, const_cast<char*>("reset"), const_cast<char*>(""));
|
||||||
/*
|
/*
|
||||||
// check to see if the debug python module is loaded
|
// check to see if the debug python module is loaded
|
||||||
if ( dbgOut != nil )
|
if ( dbgOut != nil )
|
||||||
|
@ -169,8 +169,7 @@ void DebugMsg(const char fmt[], ...)
|
|||||||
OutputDebugStringA("\n");
|
OutputDebugStringA("\n");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, msg);
|
fprintf(stderr, "%s\n", msg);
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,6 +314,7 @@ int hsMessageBoxWithOwner(hsWindowHndl owner, const char message[], const char c
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
return hsMBoxCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wchar_t caption[], int kind, int icon)
|
int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wchar_t caption[], int kind, int icon)
|
||||||
@ -367,6 +367,7 @@ int hsMessageBoxWithOwner(hsWindowHndl owner, const wchar_t message[], const wch
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
return hsMBoxCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hsMessageBox(const char message[], const char caption[], int kind, int icon)
|
int hsMessageBox(const char message[], const char caption[], int kind, int icon)
|
||||||
|
@ -80,14 +80,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
# define NOMINMAX // Needed to prevent NxMath conflicts
|
# define NOMINMAX // Needed to prevent NxMath conflicts
|
||||||
# endif
|
# endif
|
||||||
# include <Windows.h>
|
# include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Just some fun typedefs...
|
|
||||||
typedef HWND hsWindowHndl;
|
|
||||||
typedef HINSTANCE hsWindowInst;
|
|
||||||
#else
|
|
||||||
typedef int32_t* hsWindowHndl;
|
|
||||||
typedef int32_t* hsWindowInst;
|
|
||||||
#endif // HS_BUILD_FOR_WIN32
|
|
||||||
|
|
||||||
//======================================
|
//======================================
|
||||||
// We don't want the Windows.h min/max!
|
// We don't want the Windows.h min/max!
|
||||||
@ -112,6 +106,18 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
//======================================
|
||||||
|
// Just some fun typedefs...
|
||||||
|
//======================================
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
typedef HWND hsWindowHndl;
|
||||||
|
typedef HINSTANCE hsWindowInst;
|
||||||
|
#else
|
||||||
|
typedef int32_t* hsWindowHndl;
|
||||||
|
typedef int32_t* hsWindowInst;
|
||||||
|
#endif // HS_BUILD_FOR_WIN32
|
||||||
|
|
||||||
|
|
||||||
//======================================
|
//======================================
|
||||||
// Basic macros
|
// Basic macros
|
||||||
//======================================
|
//======================================
|
||||||
|
@ -40,7 +40,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
*==LICENSE==*/
|
*==LICENSE==*/
|
||||||
|
|
||||||
#include <intrin.h>
|
#if defined(_MSC_VER) || ((defined(_WIN32) || defined(_WIN64)) && defined(__INTEL_COMPILER))
|
||||||
|
# include <intrin.h>
|
||||||
|
# define MSC_COMPATIBLE
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
# include <cpuid.h>
|
||||||
|
# define GCC_COMPATIBLE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "hsCpuID.h"
|
#include "hsCpuID.h"
|
||||||
|
|
||||||
@ -53,15 +59,43 @@ hsCpuId::hsCpuId() {
|
|||||||
const unsigned int sse42_flag = 1<<20;
|
const unsigned int sse42_flag = 1<<20;
|
||||||
const unsigned int avx_flag = 1 << 28;
|
const unsigned int avx_flag = 1 << 28;
|
||||||
|
|
||||||
unsigned int cpu_info[4];
|
unsigned int ax = 0, bx = 0, cx = 0, dx = 0;
|
||||||
__cpuid((int*)cpu_info, 1);
|
|
||||||
has_sse1 = (cpu_info[3] & sse1_flag) || false;
|
|
||||||
has_sse2 = (cpu_info[3] & sse2_flag) || false;
|
/**
|
||||||
has_sse3 = (cpu_info[2] & sse3_flag) || false;
|
* Portable implementation of CPUID, successfully tested with:
|
||||||
has_ssse3 = (cpu_info[2] & ssse3_flag) || false;
|
* - Microsoft Visual Studio 2010,
|
||||||
has_sse41 = (cpu_info[2] & sse41_flag) || false;
|
* - GNU GCC 4.5,
|
||||||
has_sse42 = (cpu_info[2] & sse42_flag) || false;
|
* - Intel C++ Compiler 12.0
|
||||||
has_avx = (cpu_info[2] & avx_flag) || false;
|
* - Sun Studio 12,
|
||||||
|
* - AMD x86 Open64 Compiler Suite.
|
||||||
|
*
|
||||||
|
* Ref: http://primesieve.googlecode.com/svn-history/r388/trunk/soe/cpuid.h
|
||||||
|
*/
|
||||||
|
#if defined(MSC_COMPATIBLE)
|
||||||
|
int CPUInfo[4] = {ax, bx, cx, dx};
|
||||||
|
__cpuid(CPUInfo, 0);
|
||||||
|
|
||||||
|
// check if the CPU supports the cpuid instruction.
|
||||||
|
if (CPUInfo[0] != 0) {
|
||||||
|
__cpuid(CPUInfo, 1);
|
||||||
|
ax = CPUInfo[0];
|
||||||
|
bx = CPUInfo[1];
|
||||||
|
cx = CPUInfo[2];
|
||||||
|
dx = CPUInfo[3];
|
||||||
|
}
|
||||||
|
#elif defined(GCC_COMPATIBLE)
|
||||||
|
__get_cpuid(1, &ax, &bx, &cx, &dx);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
has_sse1 = (dx & sse1_flag) || false;
|
||||||
|
has_sse2 = (dx & sse2_flag) || false;
|
||||||
|
has_sse3 = (cx & sse3_flag) || false;
|
||||||
|
has_ssse3 = (cx & ssse3_flag) || false;
|
||||||
|
has_sse41 = (cx & sse41_flag) || false;
|
||||||
|
has_sse42 = (cx & sse42_flag) || false;
|
||||||
|
has_avx = (cx & avx_flag) || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hsCpuId& hsCpuId::instance()
|
const hsCpuId& hsCpuId::instance()
|
||||||
|
@ -98,7 +98,7 @@ struct hsWide {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const hsWide kPosInfinity64 = { kPosInfinity32, 0xffffffff };
|
const hsWide kPosInfinity64 = { kPosInfinity32, 0xffffffff };
|
||||||
const hsWide kNegInfinity64 = { kNegInfinity32, 0 };
|
const hsWide kNegInfinity64 = { static_cast<int32_t>(kNegInfinity32), 0 };
|
||||||
|
|
||||||
/////////////////////// Inline implementations ///////////////////////
|
/////////////////////// Inline implementations ///////////////////////
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ plStringBuffer<wchar_t> plString::ToWchar() const
|
|||||||
plStringBuffer<uint16_t> utf16 = ToUtf16();
|
plStringBuffer<uint16_t> utf16 = ToUtf16();
|
||||||
return *reinterpret_cast<plStringBuffer<wchar_t>*>(&utf16);
|
return *reinterpret_cast<plStringBuffer<wchar_t>*>(&utf16);
|
||||||
#else
|
#else
|
||||||
plStringBuffer<uint16_t> result;
|
plStringBuffer<wchar_t> result;
|
||||||
if (IsEmpty())
|
if (IsEmpty())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ plString plString::IFormat(const char *fmt, va_list vptr)
|
|||||||
}
|
}
|
||||||
} else if (chars >= 256) {
|
} else if (chars >= 256) {
|
||||||
va_copy(vptr, vptr_save);
|
va_copy(vptr, vptr_save);
|
||||||
std::auto_ptr<char> bigbuffer(new char[chars+1]);
|
std::unique_ptr<char> bigbuffer(new char[chars+1]);
|
||||||
vsnprintf(bigbuffer.get(), chars+1, fmt, vptr);
|
vsnprintf(bigbuffer.get(), chars+1, fmt, vptr);
|
||||||
return plString::FromUtf8(bigbuffer.get(), chars);
|
return plString::FromUtf8(bigbuffer.get(), chars);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ void plLightModifier::AddTarget(plSceneObject* so)
|
|||||||
|
|
||||||
void plLightModifier::RemoveTarget(plSceneObject* so)
|
void plLightModifier::RemoveTarget(plSceneObject* so)
|
||||||
{
|
{
|
||||||
if( so = fTarget )
|
if (so == fTarget)
|
||||||
fLight = nil;
|
fLight = nil;
|
||||||
plSimpleModifier::RemoveTarget(so);
|
plSimpleModifier::RemoveTarget(so);
|
||||||
}
|
}
|
||||||
|
@ -510,11 +510,11 @@ void plWinAudible::DeActivate()
|
|||||||
|
|
||||||
bool plWinAudible::MsgReceive(plMessage* msg)
|
bool plWinAudible::MsgReceive(plMessage* msg)
|
||||||
{
|
{
|
||||||
plGenRefMsg *refMsg;
|
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef(msg);
|
||||||
if (refMsg = plGenRefMsg::ConvertNoRef(msg))
|
if (refMsg)
|
||||||
{
|
{
|
||||||
plSound *snd;
|
plSound *snd = plSound::ConvertNoRef(refMsg->GetRef());
|
||||||
if (snd = plSound::ConvertNoRef(refMsg->GetRef()))
|
if (snd)
|
||||||
{
|
{
|
||||||
int index = refMsg->fWhich;
|
int index = refMsg->fWhich;
|
||||||
if( refMsg->GetContext() & (plRefMsg::kOnCreate | plRefMsg::kOnRequest) )
|
if( refMsg->GetContext() & (plRefMsg::kOnCreate | plRefMsg::kOnRequest) )
|
||||||
|
@ -94,6 +94,7 @@ protected:
|
|||||||
|
|
||||||
friend class plDynaDecalMgr;
|
friend class plDynaDecalMgr;
|
||||||
public:
|
public:
|
||||||
|
virtual ~plDynaDecal() { }
|
||||||
|
|
||||||
virtual bool Age(double t, float ramp, float decay, float life) = 0;
|
virtual bool Age(double t, float ramp, float decay, float life) = 0;
|
||||||
};
|
};
|
||||||
|
@ -291,7 +291,8 @@ void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& c
|
|||||||
if( IsEmpty() )
|
if( IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( fCullFunc = cull )
|
fCullFunc = cull;
|
||||||
|
if (fCullFunc)
|
||||||
IHarvestAndCullEnabledLeaves(fRoot, cache, list);
|
IHarvestAndCullEnabledLeaves(fRoot, cache, list);
|
||||||
else
|
else
|
||||||
IHarvestEnabledLeaves(fRoot, cache, list);
|
IHarvestEnabledLeaves(fRoot, cache, list);
|
||||||
@ -372,7 +373,8 @@ void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsBitVector& list) const
|
|||||||
{
|
{
|
||||||
if( !IsEmpty() )
|
if( !IsEmpty() )
|
||||||
{
|
{
|
||||||
if( fCullFunc = cull )
|
fCullFunc = cull;
|
||||||
|
if (fCullFunc)
|
||||||
IHarvestAndCullLeaves(fTree[fRoot], scratchTotVec, list);
|
IHarvestAndCullLeaves(fTree[fRoot], scratchTotVec, list);
|
||||||
else
|
else
|
||||||
IHarvestLeaves(fTree[fRoot], scratchTotVec, list);
|
IHarvestLeaves(fTree[fRoot], scratchTotVec, list);
|
||||||
|
@ -191,7 +191,7 @@ plMipmap* plPNG::ReadFromFile(const wchar_t* fileName)
|
|||||||
hsUNIXStream in;
|
hsUNIXStream in;
|
||||||
|
|
||||||
if (!in.Open(fileName, L"rb")) {
|
if (!in.Open(fileName, L"rb")) {
|
||||||
return false;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
plMipmap* ret = IRead(&in);
|
plMipmap* ret = IRead(&in);
|
||||||
|
@ -99,6 +99,8 @@ public:
|
|||||||
kPositional = 0x80
|
kPositional = 0x80
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual ~plShadowSlave() { }
|
||||||
|
|
||||||
void SetFlag(SlaveFlag f, bool on) { if(on) fFlags |= f; else fFlags &= ~f; }
|
void SetFlag(SlaveFlag f, bool on) { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||||
bool HasFlag(SlaveFlag f) const { return 0 != (fFlags & f); }
|
bool HasFlag(SlaveFlag f) const { return 0 != (fFlags & f); }
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ plMipmap* plJPEG::ReadFromFile( const wchar_t *fileName )
|
|||||||
hsRAMStream tempstream;
|
hsRAMStream tempstream;
|
||||||
hsUNIXStream in;
|
hsUNIXStream in;
|
||||||
if (!in.Open(fileName, L"rb"))
|
if (!in.Open(fileName, L"rb"))
|
||||||
return false;
|
return nil;
|
||||||
|
|
||||||
// The stream reader for JPEGs expects a 32-bit size at the start,
|
// The stream reader for JPEGs expects a 32-bit size at the start,
|
||||||
// so insert that into the stream before passing it on
|
// so insert that into the stream before passing it on
|
||||||
|
@ -551,7 +551,7 @@ void plGraphPlate::SetDataColors( const std::vector<uint32_t> & hexColors )
|
|||||||
|
|
||||||
//// SetLabelText ////////////////////////////////////////////////////////////
|
//// SetLabelText ////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void plGraphPlate::SetLabelText( char *text1, char *text2, char *text3, char *text4 )
|
void plGraphPlate::SetLabelText(const char *text1, const char *text2, const char *text3, const char *text4 )
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
std::vector<std::string> strings;
|
||||||
if( text1 != nil )
|
if( text1 != nil )
|
||||||
|
@ -170,7 +170,7 @@ class plGraphPlate : public plPlate
|
|||||||
|
|
||||||
void SetDataRange( uint32_t min, uint32_t max, uint32_t width );
|
void SetDataRange( uint32_t min, uint32_t max, uint32_t width );
|
||||||
void SetDataLabels( uint32_t min, uint32_t max );
|
void SetDataLabels( uint32_t min, uint32_t max );
|
||||||
void SetLabelText( char *text1, char *text2 = nil, char *text3 = nil, char *text4 = nil );
|
void SetLabelText(const char *text1, const char *text2 = nil, const char *text3 = nil, const char *text4 = nil );
|
||||||
void SetLabelText( const std::vector<std::string> & text );
|
void SetLabelText( const std::vector<std::string> & text );
|
||||||
void ClearData( void );
|
void ClearData( void );
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ plRegistryPageNode* plResManager::FindSinglePage(const char* path) const
|
|||||||
PageMap::const_iterator it;
|
PageMap::const_iterator it;
|
||||||
for (it = fAllPages.begin(); it != fAllPages.end(); it++)
|
for (it = fAllPages.begin(); it != fAllPages.end(); it++)
|
||||||
{
|
{
|
||||||
if (strcmpi((it->second)->GetPagePath(), path) == 0)
|
if (stricmp((it->second)->GetPagePath(), path) == 0)
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,12 +423,18 @@ bool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream)
|
|||||||
ko = hsKeyedObject::ConvertNoRef(cre);
|
ko = hsKeyedObject::ConvertNoRef(cre);
|
||||||
|
|
||||||
if (ko != nil)
|
if (ko != nil)
|
||||||
|
{
|
||||||
kResMgrLog(4, ILog(4, " ...Creatable read and valid"));
|
kResMgrLog(4, ILog(4, " ...Creatable read and valid"));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
kResMgrLog(3, ILog(3, " ...Creatable read from stream not keyed object!"));
|
kResMgrLog(3, ILog(3, " ...Creatable read from stream not keyed object!"));
|
||||||
|
}
|
||||||
|
|
||||||
if (fProgressProc != nil)
|
if (fProgressProc != nil)
|
||||||
|
{
|
||||||
fProgressProc(plKey::Make(pKey));
|
fProgressProc(plKey::Make(pKey));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1651,8 +1657,8 @@ plRegistryPageNode* plResManager::FindPage(const char* age, const char* page) co
|
|||||||
for (it = fAllPages.begin(); it != fAllPages.end(); ++it)
|
for (it = fAllPages.begin(); it != fAllPages.end(); ++it)
|
||||||
{
|
{
|
||||||
const plPageInfo& info = (it->second)->GetPageInfo();
|
const plPageInfo& info = (it->second)->GetPageInfo();
|
||||||
if (strcmpi(info.GetAge(), age) == 0 &&
|
if (stricmp(info.GetAge(), age) == 0 &&
|
||||||
strcmpi(info.GetPage(), page) == 0)
|
stricmp(info.GetPage(), page) == 0)
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1766,7 +1772,7 @@ bool plResManager::IteratePages(plRegistryPageIterator* iterator, const char* ag
|
|||||||
if (page->GetPageInfo().GetLocation() == plLocation::kGlobalFixedLoc)
|
if (page->GetPageInfo().GetLocation() == plLocation::kGlobalFixedLoc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!ageToRestrictTo || strcmpi(page->GetPageInfo().GetAge(), ageToRestrictTo) == 0)
|
if (!ageToRestrictTo || stricmp(page->GetPageInfo().GetAge(), ageToRestrictTo) == 0)
|
||||||
{
|
{
|
||||||
if (!iterator->EatPage(page))
|
if (!iterator->EatPage(page))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user