mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-20 15:13:45 +00:00
Minimal changes to compile T3D on WIN64.
This commit is contained in:
parent
a93f179138
commit
8ed0f508ca
13 changed files with 161 additions and 18 deletions
|
|
@ -24,6 +24,8 @@
|
|||
#include "platform/platform.h"
|
||||
#include "platform/platformCPUCount.h"
|
||||
|
||||
#if defined(TORQUE_OS_LINUX) || defined(TORQUE_OS_OSX) || defined(TORQUE_OS_XENON) || defined(TORQUE_OS_PS3)
|
||||
|
||||
// Consoles don't need this
|
||||
#if defined(TORQUE_OS_XENON) || defined(TORQUE_OS_PS3)
|
||||
namespace CPUInfo
|
||||
|
|
@ -661,4 +663,6 @@ next:
|
|||
}
|
||||
|
||||
} // namespace CPUInfo
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ public:
|
|||
/// This is just for createPlatformFont to call.
|
||||
///
|
||||
/// @todo Rethink this so we don't have a private public.
|
||||
virtual bool create(const char *name, U32 size, U32 charset = TGE_ANSI_CHARSET) = 0;
|
||||
virtual bool create( const char *name, dsize_t size, U32 charset = TGE_ANSI_CHARSET ) = 0;
|
||||
static void enumeratePlatformFonts( Vector<StringTableEntry>& fonts, UTF16* fontFamily = NULL );
|
||||
};
|
||||
|
||||
extern PlatformFont *createPlatformFont(const char *name, U32 size, U32 charset = TGE_ANSI_CHARSET);
|
||||
extern PlatformFont *createPlatformFont(const char *name, dsize_t size, U32 charset = TGE_ANSI_CHARSET);
|
||||
|
||||
#endif // _PLATFORMFONT_H_
|
||||
|
|
|
|||
|
|
@ -476,8 +476,8 @@ void Profiler::hashPop(ProfilerRootData *expected)
|
|||
else
|
||||
{
|
||||
Con::warnf("Warning: the Torque profiler thread may now run on any cpu.");
|
||||
DWORD procMask;
|
||||
DWORD sysMask;
|
||||
DWORD_PTR procMask;
|
||||
DWORD_PTR sysMask;
|
||||
GetProcessAffinityMask( GetCurrentProcess(), &procMask, &sysMask);
|
||||
SetThreadAffinityMask( GetCurrentThread(), procMask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ typedef unsigned _int64 U64;
|
|||
# define TORQUE_OS_STRING "Xbox"
|
||||
# define TORQUE_OS_XBOX
|
||||
# include "platform/types.win.h"
|
||||
#elif defined( _WIN32 )
|
||||
#elif defined( _WIN32 ) && !defined ( _WIN64 )
|
||||
# define TORQUE_OS_STRING "Win32"
|
||||
# define TORQUE_OS_WIN
|
||||
# define TORQUE_OS_WIN32
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ static UINT_PTR CALLBACK FolderHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPA
|
|||
SendMessage(hParent, CDM_HIDECONTROL, cmb1, 0);
|
||||
SendMessage(hParent, CDM_HIDECONTROL, stc2, 0);
|
||||
|
||||
LONG oldProc = SetWindowLong(hParent, GWL_WNDPROC, (LONG)OKBtnFolderHackProc);
|
||||
LONG oldProc = SetWindowLong(hParent, GWLP_WNDPROC, (LONG)OKBtnFolderHackProc);
|
||||
SetProp(hParent, dT("OldWndProc"), (HANDLE)oldProc);
|
||||
SetProp(hParent, dT("OFN"), (HANDLE)lpofn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ void PlatformFont::enumeratePlatformFonts( Vector<StringTableEntry>& fonts, UTF1
|
|||
EnumFontFamilies( fontHDC, fontFamily, (FONTENUMPROC)EnumFamCallBack, (LPARAM)&fonts );
|
||||
}
|
||||
|
||||
PlatformFont *createPlatformFont(const char *name, U32 size, U32 charset /* = TGE_ANSI_CHARSET */)
|
||||
PlatformFont *createPlatformFont(const char *name, dsize_t size, U32 charset /* = TGE_ANSI_CHARSET */)
|
||||
{
|
||||
PlatformFont *retFont = new WinFont;
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ WinFont::~WinFont()
|
|||
}
|
||||
}
|
||||
|
||||
bool WinFont::create(const char *name, U32 size, U32 charset /* = TGE_ANSI_CHARSET */)
|
||||
bool WinFont::create(const char *name, dsize_t size, U32 charset /* = TGE_ANSI_CHARSET */)
|
||||
{
|
||||
if(name == NULL || size < 1)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,23 @@ void Platform::setMathControlStateKnown()
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
U32 Platform::getMathControlState( )
|
||||
{
|
||||
// @todo x64 See http://msdn.microsoft.com/en-us/library/c9676k6h.aspx
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Platform::setMathControlState( U32 state )
|
||||
{
|
||||
// @todo x64 See http://msdn.microsoft.com/en-us/library/c9676k6h.aspx
|
||||
}
|
||||
|
||||
void Platform::setMathControlStateKnown( )
|
||||
{
|
||||
// @todo x64 See http://msdn.microsoft.com/en-us/library/c9676k6h.aspx
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -23,26 +23,26 @@
|
|||
#include "platformWin32/platformWin32.h"
|
||||
#include <xmmintrin.h>
|
||||
|
||||
void* dMemcpy(void *dst, const void *src, unsigned size)
|
||||
void* dMemcpy(void *dst, const void *src, dsize_t size)
|
||||
{
|
||||
return memcpy(dst,src,size);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
void* dMemmove(void *dst, const void *src, unsigned size)
|
||||
void* dMemmove(void *dst, const void *src, dsize_t size)
|
||||
{
|
||||
return memmove(dst,src,size);
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
void* dMemset(void *dst, S32 c, unsigned size)
|
||||
void* dMemset(void *dst, S32 c, dsize_t size)
|
||||
{
|
||||
return memset(dst,c,size);
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
S32 dMemcmp(const void *ptr1, const void *ptr2, unsigned len)
|
||||
S32 dMemcmp(const void *ptr1, const void *ptr2, dsize_t len)
|
||||
{
|
||||
return memcmp(ptr1, ptr2, len);
|
||||
}
|
||||
|
|
|
|||
119
Engine/source/platformWin32/winPlatformCPUCount.cpp
Normal file
119
Engine/source/platformWin32/winPlatformCPUCount.cpp
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
// Original code is:
|
||||
// Copyright (c) 2005 Intel Corporation
|
||||
// All Rights Reserved
|
||||
//
|
||||
// CPUCount.cpp : Detects three forms of hardware multi-threading support across IA-32 platform
|
||||
// The three forms of HW multithreading are: Multi-processor, Multi-core, and
|
||||
// HyperThreading Technology.
|
||||
// This application enumerates all the logical processors enabled by OS and BIOS,
|
||||
// determine the HW topology of these enabled logical processors in the system
|
||||
// using information provided by CPUID instruction.
|
||||
// A multi-processing system can support any combination of the three forms of HW
|
||||
// multi-threading support. The relevant topology can be identified using a
|
||||
// three level decomposition of the "initial APIC ID" into
|
||||
// Package_id, core_id, and SMT_id. Such decomposition provides a three-level map of
|
||||
// the topology of hardware resources and
|
||||
// allow multi-threaded software to manage shared hardware resources in
|
||||
// the platform to reduce resource contention
|
||||
|
||||
// Multicore detection algorithm for processor and cache topology requires
|
||||
// all leaf functions of CPUID instructions be available. System administrator
|
||||
// must ensure BIOS settings is not configured to restrict CPUID functionalities.
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "platform/platform.h"
|
||||
|
||||
#if defined( TORQUE_OS_WIN )
|
||||
|
||||
#include "platform/platformCPUCount.h"
|
||||
#include <windows.h>
|
||||
#include <intrin.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
namespace CPUInfo {
|
||||
|
||||
// based on http://msdn.microsoft.com/en-us/library/ms683194.aspx
|
||||
|
||||
// Helper function to count set bits in the processor mask.
|
||||
DWORD CountSetBits( ULONG_PTR bitMask )
|
||||
{
|
||||
DWORD LSHIFT = sizeof( ULONG_PTR ) * 8 - 1;
|
||||
DWORD bitSetCount = 0;
|
||||
ULONG_PTR bitTest = (ULONG_PTR)1 << LSHIFT;
|
||||
DWORD i;
|
||||
|
||||
for( i = 0; i <= LSHIFT; ++i )
|
||||
{
|
||||
bitSetCount += ((bitMask & bitTest) ? 1 : 0);
|
||||
bitTest /= 2;
|
||||
}
|
||||
|
||||
return bitSetCount;
|
||||
}
|
||||
|
||||
EConfig CPUCount( U32& TotAvailLogical, U32& TotAvailCore, U32& PhysicalNum )
|
||||
{
|
||||
EConfig StatusFlag = CONFIG_UserConfigIssue;
|
||||
TotAvailLogical = 0;
|
||||
TotAvailCore = 0;
|
||||
PhysicalNum = 0;
|
||||
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL;
|
||||
DWORD returnLength = 0;
|
||||
|
||||
// get buffer length
|
||||
DWORD rc = GetLogicalProcessorInformation( buffer, &returnLength );
|
||||
buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)malloc( returnLength );
|
||||
|
||||
rc = GetLogicalProcessorInformation( buffer, &returnLength );
|
||||
|
||||
if( FALSE == rc )
|
||||
{
|
||||
free( buffer );
|
||||
return StatusFlag;
|
||||
}
|
||||
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = buffer;
|
||||
|
||||
DWORD byteOffset = 0;
|
||||
while( byteOffset + sizeof( SYSTEM_LOGICAL_PROCESSOR_INFORMATION ) <= returnLength )
|
||||
{
|
||||
switch( ptr->Relationship )
|
||||
{
|
||||
|
||||
case RelationProcessorCore:
|
||||
TotAvailCore++;
|
||||
|
||||
// A hyperthreaded core supplies more than one logical processor.
|
||||
TotAvailLogical += CountSetBits( ptr->ProcessorMask );
|
||||
break;
|
||||
|
||||
case RelationProcessorPackage:
|
||||
// Logical processors share a physical package.
|
||||
PhysicalNum++;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
byteOffset += sizeof( SYSTEM_LOGICAL_PROCESSOR_INFORMATION );
|
||||
ptr++;
|
||||
}
|
||||
|
||||
free( buffer );
|
||||
|
||||
StatusFlag = CONFIG_SingleCoreAndHTNotCapable;
|
||||
|
||||
if( TotAvailCore == 1 && TotAvailLogical > TotAvailCore )
|
||||
StatusFlag = CONFIG_SingleCoreHTEnabled;
|
||||
else if( TotAvailCore > 1 && TotAvailLogical == TotAvailCore )
|
||||
StatusFlag = CONFIG_MultiCoreAndHTNotCapable;
|
||||
else if( TotAvailCore > 1 && TotAvailLogical > TotAvailCore )
|
||||
StatusFlag = CONFIG_MultiCoreAndHTEnabled;
|
||||
|
||||
return StatusFlag;
|
||||
}
|
||||
|
||||
} // namespace CPUInfo
|
||||
#endif
|
||||
|
|
@ -25,7 +25,10 @@
|
|||
#include "core/stringTable.h"
|
||||
#include "core/strings/unicode.h"
|
||||
|
||||
#ifndef TORQUE_OS_WIN64
|
||||
typedef long SHANDLE_PTR;
|
||||
#endif
|
||||
|
||||
#include <shlobj.h>
|
||||
#include <windows.h>
|
||||
#include <lmcons.h>
|
||||
|
|
|
|||
|
|
@ -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, GWL_USERDATA));
|
||||
Win32Window* window = (Win32Window*)((PlatformWindow*)GetWindowLong(hWnd, GWLP_USERDATA));
|
||||
const WindowId devId = window ? window->getWindowId() : 0;
|
||||
|
||||
if (window && window->getOffscreenRender())
|
||||
|
|
@ -712,7 +712,7 @@ 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, GWL_USERDATA,
|
||||
SetWindowLong(hWnd, GWLP_USERDATA,
|
||||
(LONG)((PlatformWindow*)((CREATESTRUCT*)lParam)->lpCreateParams));
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -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, GWL_USERDATA));
|
||||
Win32Window* window = (Win32Window*)(GetWindowLong(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, GWL_USERDATA): 0;
|
||||
Win32Window* window = hWnd?(Win32Window*)GetWindowLong(hWnd, GWLP_USERDATA): 0;
|
||||
const WindowId devId = window ? window->getWindowId() : 0;
|
||||
|
||||
// State tracking for focus/lose focus cursor management
|
||||
|
|
@ -560,7 +560,7 @@ private:
|
|||
static WinMessageQueue _MessageQueue;
|
||||
|
||||
|
||||
void RemoveMessages(HWND hWnd,UINT msgBegin,WPARAM msgEnd )
|
||||
void RemoveMessages(HWND hWnd,UINT msgBegin,UINT msgEnd )
|
||||
{
|
||||
_MessageQueue.remove( hWnd, msgBegin, msgEnd );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue