mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Fix x64 problems for WIN64.
This commit is contained in:
parent
6bfb7d8186
commit
fcf7bee64a
|
|
@ -70,11 +70,42 @@ namespace Compiler
|
|||
|
||||
//------------------------------------------------------------
|
||||
|
||||
#ifdef TORQUE_CPU_X64
|
||||
// Fixed unsafe conversion from pointer to U32. @todo x64 revise
|
||||
U32 u32toSTEId = 0;
|
||||
typedef Map< U32, StringTableEntry > U32toSteMap;
|
||||
U32toSteMap u32toSTEMap;
|
||||
|
||||
StringTableEntry U32toSTE( U32 u )
|
||||
{
|
||||
// @todo x64 Added thread-safe convertion.
|
||||
const U32toSteMap::Iterator result = u32toSTEMap.find( u );
|
||||
AssertFatal( result != u32toSTEMap.end( ),
|
||||
"Don't converted U32 to STE. See evalSTEtoU32()." );
|
||||
return result->value;
|
||||
}
|
||||
|
||||
U32 evalSTEtoU32( StringTableEntry ste, U32 )
|
||||
{
|
||||
// @todo x64 Added thread-safe convertion.
|
||||
u32toSTEMap.insert( u32toSTEId++, ste );
|
||||
return (u32toSTEId - 1); // pointer to inserted
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
StringTableEntry U32toSTE(U32 u)
|
||||
{
|
||||
return *((StringTableEntry *) &u);
|
||||
}
|
||||
|
||||
U32 evalSTEtoU32(StringTableEntry ste, U32)
|
||||
{
|
||||
return *((U32 *) &ste);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
U32 compileSTEtoU32(StringTableEntry ste, U32 ip)
|
||||
{
|
||||
if(ste)
|
||||
|
|
|
|||
|
|
@ -218,10 +218,7 @@ namespace Compiler
|
|||
|
||||
//------------------------------------------------------------
|
||||
|
||||
inline StringTableEntry U32toSTE(U32 u)
|
||||
{
|
||||
return *((StringTableEntry *) &u);
|
||||
}
|
||||
StringTableEntry U32toSTE(U32 u);
|
||||
|
||||
extern U32 (*STEtoU32)(StringTableEntry ste, U32 ip);
|
||||
|
||||
|
|
|
|||
|
|
@ -696,7 +696,7 @@ namespace Con
|
|||
|
||||
extern void expandEscape(char *dest, const char *src);
|
||||
extern bool collapseEscape(char *buf);
|
||||
extern S32 HashPointer(StringTableEntry ptr);
|
||||
extern U32 HashPointer(StringTableEntry ptr);
|
||||
|
||||
|
||||
/// Extended information about a console function.
|
||||
|
|
|
|||
|
|
@ -262,9 +262,9 @@ void Dictionary::deleteVariables(const char *varString)
|
|||
}
|
||||
}
|
||||
|
||||
S32 HashPointer(StringTableEntry ptr)
|
||||
U32 HashPointer(StringTableEntry ptr)
|
||||
{
|
||||
return (S32)(((dsize_t)ptr) >> 2);
|
||||
return (U32)(((dsize_t)ptr) >> 2);
|
||||
}
|
||||
|
||||
Dictionary::Entry *Dictionary::lookup(StringTableEntry name)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
extern S32 HashPointer(StringTableEntry e);
|
||||
extern U32 HashPointer(StringTableEntry e);
|
||||
|
||||
SimNameDictionary::SimNameDictionary()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ U32 _StringTable::hashString(const char* str)
|
|||
char c;
|
||||
while((c = *str++) != 0) {
|
||||
ret <<= 1;
|
||||
ret ^= sgHashTable[static_cast<U32>(c)];
|
||||
ret ^= sgHashTable[static_cast<U8>(c)];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ U32 _StringTable::hashStringn(const char* str, S32 len)
|
|||
char c;
|
||||
while((c = *str++) != 0 && len--) {
|
||||
ret <<= 1;
|
||||
ret ^= sgHashTable[static_cast<U32>(c)];
|
||||
ret ^= sgHashTable[static_cast<U8>(c)];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
template< typename T >
|
||||
inline bool dCompareAndSwap( T* volatile& refPtr, T* oldPtr, T* newPtr )
|
||||
{
|
||||
return dCompareAndSwap( *reinterpret_cast< volatile U32* >( &refPtr ), ( U32 ) oldPtr, ( U32 ) newPtr );
|
||||
return dCompareAndSwap( *reinterpret_cast< volatile size_t* >( &refPtr ), ( size_t ) oldPtr, ( size_t ) newPtr );
|
||||
}
|
||||
|
||||
// Test-And-Set
|
||||
|
|
|
|||
|
|
@ -222,11 +222,11 @@ struct _TypeTraits< T* >
|
|||
typedef _DestructPtr Destruct;
|
||||
|
||||
template< typename A >
|
||||
static bool isTaggedPtr( A* ptr ) { return ( U32( ptr ) & 0x1 ); } //TODO: 64bits
|
||||
static bool isTaggedPtr( A* ptr ) { return ( size_t( ptr ) & 0x1 ); } //TODO: 64bits
|
||||
template< typename A >
|
||||
static A* getTaggedPtr( A* ptr ) { return ( A* ) ( U32( ptr ) | 0x1 ); } //TODO: 64bits
|
||||
static A* getTaggedPtr( A* ptr ) { return ( A* ) ( size_t( ptr ) | 0x1 ); } //TODO: 64bits
|
||||
template< typename A >
|
||||
static A* getUntaggedPtr( A* ptr ) { return ( A* ) ( U32( ptr ) & 0xFFFFFFFE ); } //TODO: 64bit
|
||||
static A* getUntaggedPtr( A* ptr ) { return ( A* ) ( size_t( ptr ) & (~0x1) ); } //TODO: 64bit
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
|
|
|
|||
|
|
@ -1170,7 +1170,10 @@ void TSShape::assembleShape()
|
|||
skip = true;
|
||||
TSMesh * mesh = TSMesh::assembleMesh(meshType,skip);
|
||||
if (ptr32)
|
||||
{
|
||||
ptr32[i] = skip ? 0 : (S32)mesh;
|
||||
meshes.push_back(skip ? 0 : mesh);
|
||||
}
|
||||
|
||||
// fill in location of verts, tverts, and normals for detail levels
|
||||
if (mesh && meshType!=TSMesh::DecalMeshType)
|
||||
|
|
@ -1198,7 +1201,6 @@ void TSShape::assembleShape()
|
|||
}
|
||||
}
|
||||
}
|
||||
meshes.set(ptr32,numMeshes);
|
||||
|
||||
tsalloc.checkGuard();
|
||||
|
||||
|
|
|
|||
|
|
@ -661,7 +661,7 @@ void Win32Window::_unregisterWindowClass()
|
|||
LRESULT PASCAL Win32Window::WindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
// CodeReview [tom, 4/30/2007] The two casts here seem somewhat silly and redundant ?
|
||||
Win32Window* window = (Win32Window*)((PlatformWindow*)GetWindowLong(hWnd, GWLP_USERDATA));
|
||||
Win32Window* window = (Win32Window*)((PlatformWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA));
|
||||
const WindowId devId = window ? window->getWindowId() : 0;
|
||||
|
||||
if (window && window->getOffscreenRender())
|
||||
|
|
@ -712,8 +712,8 @@ LRESULT PASCAL Win32Window::WindowProc( HWND hWnd, UINT message, WPARAM wParam,
|
|||
case WM_CREATE:
|
||||
// CodeReview [tom, 4/30/2007] Why don't we just cast this to a LONG
|
||||
// instead of having a ton of essentially pointless casts ?
|
||||
SetWindowLong(hWnd, GWLP_USERDATA,
|
||||
(LONG)((PlatformWindow*)((CREATESTRUCT*)lParam)->lpCreateParams));
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA,
|
||||
(LONG_PTR)((PlatformWindow*)((CREATESTRUCT*)lParam)->lpCreateParams));
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ void Win32WindowManager::buildMonitorsList()
|
|||
mMonitors.clear();
|
||||
|
||||
// Enumerate all monitors
|
||||
EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (U32)(void*)&mMonitors);
|
||||
EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (size_t)(void*)&mMonitors);
|
||||
}
|
||||
|
||||
S32 Win32WindowManager::findFirstMatchingMonitor(const char* name)
|
||||
|
|
@ -252,7 +252,7 @@ PlatformWindow *Win32WindowManager::createWindow(GFXDevice *device, const GFXVid
|
|||
w32w->setVideoMode(mode);
|
||||
|
||||
// Associate our window struct with the HWND.
|
||||
SetWindowLongPtrW(w32w->mWindowHandle, GWLP_USERDATA, (LONG)w32w);
|
||||
SetWindowLongPtr(w32w->mWindowHandle, GWLP_USERDATA, (LONG_PTR)w32w);
|
||||
|
||||
// Do some error checking.
|
||||
AssertFatal(w32w->mWindowHandle != NULL, "Win32WindowManager::createWindow - Could not create window!");
|
||||
|
|
@ -358,7 +358,7 @@ void Win32WindowManager::_process()
|
|||
|
||||
// [tom, 4/30/2007] I think this should work, but leaving the above commented
|
||||
// out just in case this is actually fubared with multiple windows.
|
||||
Win32Window* window = (Win32Window*)(GetWindowLong(msg.hwnd, GWLP_USERDATA));
|
||||
Win32Window* window = (Win32Window*)(GetWindowLongPtr(msg.hwnd, GWLP_USERDATA));
|
||||
if(window)
|
||||
translated = window->translateMessage(msg);
|
||||
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ static bool _dispatch(HWND hWnd,UINT message,WPARAM wParam,WPARAM lParam)
|
|||
static S32 mouseNCState = -1; // -1 denotes unchanged,
|
||||
// 0 denotes changed but was hidden
|
||||
// 1 denotes changed but was visible
|
||||
Win32Window* window = hWnd?(Win32Window*)GetWindowLong(hWnd, GWLP_USERDATA): 0;
|
||||
Win32Window* window = hWnd?(Win32Window*)GetWindowLongPtr(hWnd, GWLP_USERDATA): 0;
|
||||
const WindowId devId = window ? window->getWindowId() : 0;
|
||||
|
||||
// State tracking for focus/lose focus cursor management
|
||||
|
|
|
|||
Loading…
Reference in a new issue