mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-22 05:09:13 +00:00
Fixes to CoreLib and CoreLibExe.
This commit is contained in:
@ -80,4 +80,23 @@ void CCritSect::Enter () {
|
|||||||
void CCritSect::Leave () {
|
void CCritSect::Leave () {
|
||||||
LeaveCriticalSection(&m_handle);
|
LeaveCriticalSection(&m_handle);
|
||||||
}
|
}
|
||||||
|
#elif HS_BUILD_FOR_UNIX
|
||||||
|
//===========================================================================
|
||||||
|
CCritSect::CCritSect () {
|
||||||
|
m_handle = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
CCritSect::~CCritSect () {
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void CCritSect::Enter () {
|
||||||
|
pthread_mutex_lock(&m_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void CCritSect::Leave () {
|
||||||
|
pthread_mutex_unlock(&m_handle);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,6 +61,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#ifdef HS_BUILD_FOR_WIN32
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
typedef CRITICAL_SECTION CritSectHandle;
|
typedef CRITICAL_SECTION CritSectHandle;
|
||||||
|
#elif HS_BUILD_FOR_UNIX
|
||||||
|
# include <pthread.h>
|
||||||
|
typedef pthread_mutex_t CritSectHandle;
|
||||||
#else
|
#else
|
||||||
# error "CCritSect: Not implemented on this platform"
|
# error "CCritSect: Not implemented on this platform"
|
||||||
#endif
|
#endif
|
||||||
|
@ -427,7 +427,8 @@ void hsMatrix44::MakeZRotation(hsScalar radians)
|
|||||||
//
|
//
|
||||||
hsMatrix44& hsMatrix44::Make(const hsPoint3* f, const hsPoint3* at, const hsVector3* up)
|
hsMatrix44& hsMatrix44::Make(const hsPoint3* f, const hsPoint3* at, const hsVector3* up)
|
||||||
{
|
{
|
||||||
MakeTranslateMat(&hsVector3(f->fX, f->fY, f->fZ));
|
hsVector3 trans(f->fX, f->fY, f->fZ);
|
||||||
|
MakeTranslateMat(&trans);
|
||||||
|
|
||||||
hsVector3 back (f,at); // Z
|
hsVector3 back (f,at); // Z
|
||||||
back.Normalize();
|
back.Normalize();
|
||||||
@ -458,7 +459,8 @@ hsMatrix44& hsMatrix44::Make(const hsPoint3* f, const hsPoint3* at, const hsVect
|
|||||||
//
|
//
|
||||||
hsMatrix44& hsMatrix44::MakeUpPreserving(const hsPoint3* f, const hsPoint3* at, const hsVector3* up)
|
hsMatrix44& hsMatrix44::MakeUpPreserving(const hsPoint3* f, const hsPoint3* at, const hsVector3* up)
|
||||||
{
|
{
|
||||||
MakeTranslateMat(&hsVector3(f->fX, f->fY, f->fZ));
|
hsVector3 trans(f->fX, f->fY, f->fZ);
|
||||||
|
MakeTranslateMat(&trans);
|
||||||
|
|
||||||
hsVector3 topHead = *up;
|
hsVector3 topHead = *up;
|
||||||
topHead.Normalize();
|
topHead.Normalize();
|
||||||
|
@ -56,7 +56,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
***/
|
***/
|
||||||
|
|
||||||
static bool s_skipBreak;
|
static bool s_skipBreak;
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
static CCritSect * s_critsect;
|
static CCritSect * s_critsect;
|
||||||
|
#endif
|
||||||
|
|
||||||
// User options
|
// User options
|
||||||
static bool s_options[kNumErrorOptions];
|
static bool s_options[kNumErrorOptions];
|
||||||
@ -69,12 +71,14 @@ static bool s_options[kNumErrorOptions];
|
|||||||
***/
|
***/
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
AUTO_INIT_FUNC(hsExeErrorInit) {
|
AUTO_INIT_FUNC(hsExeErrorInit) {
|
||||||
// The critical section has to be initialized
|
// The critical section has to be initialized
|
||||||
// before program startup and never freed
|
// before program startup and never freed
|
||||||
static byte rawMemory[sizeof(CCritSect)];
|
static byte rawMemory[sizeof(CCritSect)];
|
||||||
s_critsect = new(rawMemory) CCritSect;
|
s_critsect = new(rawMemory) CCritSect;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
static void DoAssert (int line, const char file[], const char msg[]) {
|
static void DoAssert (int line, const char file[], const char msg[]) {
|
||||||
@ -118,7 +122,7 @@ static void DoAssert (int line, const char file[], const char msg[]) {
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#pragma auto_inline(off)
|
#pragma auto_inline(off)
|
||||||
void __cdecl ErrorFatal (int line, const char file[], const char fmt[], ...) {
|
void CDECL ErrorFatal (int line, const char file[], const char fmt[], ...) {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
@ -135,7 +139,7 @@ void __cdecl ErrorFatal (int line, const char file[], const char fmt[], ...) {
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#pragma auto_inline(off)
|
#pragma auto_inline(off)
|
||||||
void __cdecl ErrorAssert (int line, const char file[], const char fmt[], ...) {
|
void CDECL ErrorAssert (int line, const char file[], const char fmt[], ...) {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
@ -250,7 +254,7 @@ void DebugMsgV (const char fmt[], va_list args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void __cdecl DebugMsg (const char fmt[], ...) {
|
void CDECL DebugMsg (const char fmt[], ...) {
|
||||||
#ifdef HS_DEBUGGING
|
#ifdef HS_DEBUGGING
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -591,14 +591,16 @@ void * MemRealloc (void * ptr, unsigned bytes, unsigned flags, const char file[]
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
unsigned MemSize (void * ptr) {
|
unsigned MemSize (void * ptr) {
|
||||||
ASSERT(ptr);
|
ASSERT(ptr);
|
||||||
unsigned result;
|
unsigned result = 0;
|
||||||
|
|
||||||
#ifdef MEM_DEBUG
|
#ifdef MEM_DEBUG
|
||||||
const _CrtMemBlockHeader * pHead = pHdr(ptr);
|
const _CrtMemBlockHeader * pHead = pHdr(ptr);
|
||||||
unsigned block = pHead->nBlockUse;
|
unsigned block = pHead->nBlockUse;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
result = (unsigned)_msize_dbg(ptr, block);
|
result = (unsigned)_msize_dbg(ptr, block);
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user